diff --git a/published/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/published/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md new file mode 100644 index 0000000000..6c2f834fa2 --- /dev/null +++ b/published/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md @@ -0,0 +1,619 @@ +数码文件与文件夹收纳术(以照片为例) +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/05/000950xsxopomsrs55rrb5.jpg) + +- 更新 2014-05-14:增加了一些具体实例 +- 更新 2015-03-16:根据照片的 GPS 坐标过滤图片 +- 更新 2016-08-29:以新的 `filetags --filter` 替换已经过时的 `show-sel.sh` 脚本 +- 更新 2017-08-28: geeqier 视频缩略图的邮件评论 +- 更新 2018-03-06:增加了 Julian Kahnert 的链接 +- 更新 2018-05-06:增加了作者在 2018 Linuxtage Graz 大会上 45 分钟演讲的视频 +- 更新 2018-06-05:关于 metadata 的邮件回复 +- 更新 2018-07-22:移动文件夹结构的解释到一篇它自己的文章中 +- 更新 2019-07-09:关于在文件名中避免使用系谱和字符的邮件回复 + +每当度假或去哪游玩时我就会化身为一个富有激情的摄影师。所以,过去的几年中我积累了许多的 [JPEG][1] 文件。这篇文章中我会介绍我是如何避免 [供应商锁定][2](LCTT 译注:供应商锁定vendor lock-in,原为经济学术语,这里引申为避免过于依赖某一服务平台)造成受限于那些临时性的解决方案及数据丢失。相反,我更倾向于使用那些可以让我**投入时间和精力打理,并能长久使用**的解决方案。 + +这一(相当长的)攻略 **并不仅仅适用于图像文件**:我将进一步阐述像是文件夹结构、文件的命名规则等等许多领域的事情。因此,这些规范适用于我所能接触到的所有类型的文件。 + +在我开始传授我的方法之前,我们应该先就我将要介绍方法的达成一个共识,那就是我们是否有相同的需求。如果你对 [raw 图像格式][3]十分推崇,将照片存储在云端或其他你信赖的地方(对我而言可能不会),那么你可能不会认同这篇文章将要描述的方式了。请根据你的情况来灵活做出选择。 + +### 我的需求 + +对于 **将照片(或视频)从我的数码相机中导出到电脑里**,我只需要将 SD 卡插到我的电脑里并调用 `fetch-workflow` 软件。这一步也完成了**图像软件的预处理**以适用于我的文件命名规范(下文会具体论述),同时也可以将图片旋转至正常的方向(而不是横着)。 + +这些文件将会被存入到我的摄影收藏文件夹 `$HOME/tmp/digicam/`。在这一文件夹中我希望能**遍历我的图像和视频文件**,以便于**整理/删除、重命名、添加/移除标签,以及将一系列相关的文件移动到相应的文件夹中**。 + +在完成这些以后,我将会**浏览包含图像/电影文件集的文件夹**。在极少数情况下,我希望**在独立的图像处理工具**(比如 [GIMP][4])中打开一个图像文件。如果仅是为了**旋转 JPEG 文件**,我想找到一个快速的方法,不需要图像处理工具,并且是[以无损的方式][5]旋转 JPEG 图像。 + +我的数码相机支持用 [GPS][6] 坐标标记图像。因此,我需要一个方法来**对单个文件或一组文件可视化 GPS 坐标**来显示我走过的路径。 + +我想拥有的另一个好功能是:假设你在威尼斯度假时拍了几百张照片。每一个都很漂亮,所以你每张都舍不得删除。另一方面,你可能想把一组更少的照片送给家里的朋友。而且,在他们嫉妒的爆炸之前,他们可能只希望看到 20 多张照片。因此,我希望能够**定义并显示一组特定的照片子集**。 + +就独立性和**避免锁定效应**而言,我不想使用那种一旦公司停止产品或服务就无法使用的工具。出于同样的原因,由于我是一个注重隐私的人,**我不想使用任何基于云的服务**。为了让自己对新的可能性保持开放的心态,我不希望只在一个特定的操作系统平台才可行的方案上倾注全部的精力。**基本的东西必须在任何平台上可用**(查看、导航、……),而**全套需求必须可以在 GNU/Linux 上运行**,对我而言,我选择 Debian GNU/Linux。 + +在我传授当前针对上述大量需求的解决方案之前,我必须解释一下我的一般文件夹结构和文件命名约定,我也使用它来命名数码照片。但首先,你必须认清一个重要的事实: + +#### iPhoto、Picasa,诸如此类应被认为是有害的 + +管理照片集的软件工具确实提供了相当酷的功能。它们提供了一个良好的用户界面,并试图为你提供满足各种需求的舒适的工作流程。 + +对它们我确实遇到了很多大问题。它们几乎对所有东西都使用专有的存储格式:图像文件、元数据等等。当你打算在几年内换一个不同的软件,这是一个大问题。相信我:总有一天你会因为多种原因而**更换软件**。 + +如果你现在正打算更换相应的工具,你会意识到 iPhoto 或 Picasa 是分别存储原始图像文件和你对它们所做的所有操作的(旋转图像、向图像文件添加描述/标签、裁剪等等)。如果你不能导出并重新导入到新工具,那么**所有的东西都将永远丢失**。而无损的进行转换和迁移几乎是不可能的。 + +我不想在一个会锁住我工作的工具上投入任何精力。**我也拒绝把自己绑定在任何专有工具上**。我是一个过来人,希望你们吸取我的经验。 + +这就是我在文件名中保留时间戳、图像描述或标记的原因。文件名是永久性的,除非我手动更改它们。当我把照片备份或复制到 U 盘或其他操作系统时,它们不会丢失。每个人都能读懂。任何未来的系统都能够处理它们。 + +### 我的文件命名规范 + +这里有一个我在 [2018 Linuxtage Graz 大会][44]上做的[演讲][45],其中详细阐述了我的在本文中提到的想法和工作流程。 + +- [Grazer Linuxtage 2018 - The Advantages of File Name Conventions and Tagging](https://youtu.be/rckSVmYCH90) +- [备份视频托管在 media.CCC.de](https://media.ccc.de/v/GLT18_-_321_-_en_-_g_ap147_004_-_201804281550_-_the_advantages_of_file_name_conventions_and_tagging_-_karl_voit) + +我所有的文件都与一个特定的日期或时间有关,根据所采用的 [ISO 8601][7] 规范,我采用的是**日期戳**或**时间戳** + +带有日期戳和两个标签的示例文件名:`2014-05-09 Budget export for project 42 -- finance company.csv`。 + +带有时间戳(甚至包括可选秒)和两个标签的示例文件名:`2014-05-09T22.19.58 Susan presenting her new shoes -- family clothing.jpg`。 + +由于我使用的 ISO 时间戳冒号不适用于 Windows [NTFS 文件系统][8],因此,我用点代替冒号,以便将小时与分钟(以及可选的秒)区别开来。 + +如果是**持续的一段日期或时间**,我会将两个日期戳或时间戳用两个减号分开:`2014-05-09--2014-05-13 Jazz festival Graz -- folder tourism music.pdf`。 + +文件名中的时间/日期戳的优点是,除非我手动更改它们,否则它们保持不变。当通过某些不处理这些元数据的软件进行处理时,包含在文件内容本身中的元数据(如 [Exif][9])往往会丢失。此外,使用这样的日期/时间戳开始的文件名可以确保文件按时间顺序显示,而不是按字母顺序显示。字母表是一种[完全人工的排序顺序][10],对于用户定位文件通常不太实用。 + +当我想将**标签**关联到文件名时,我将它们放在原始文件名和[文件名扩展名][11]之间,中间用空格、两个减号和两端额外的空格分隔 ` -- `。我的标签是小写的英文单词,不包含空格或特殊字符。有时,我可能会使用 `quantifiedself` 或 `usergenerated` 这样的连接词。我[倾向于选择一般类别][12],而不是太过具体的描述标签。我在 Twitter [hashtags][13]、文件名、文件夹名、书签、诸如此类的博文等诸如此类地地方重用这些标签。 + +标签作为文件名的一部分有几个优点。通过使用常用的桌面搜索引擎,你可以在标签的帮助下定位文件。文件名称中的标签不会因为复制到不同的存储介质上而丢失。当系统使用与文件名之外的存储位置(如:元数据数据库、[点文件][14]、[备用数据流][15]等)存储元信息通常会发生丢失。 + +当然,通常在文件和文件夹名称中,**请避免使用特殊字符**、变音符、冒号等。尤其是在不同操作系统平台之间同步文件时。 + +我的**文件夹名命名约定**与文件的相应规范相同。 + +注意:由于 [Memacs][17] 的 [filenametimestamp][16] 模块的聪明之处,所有带有日期/时间戳的文件和文件夹都出现在我的 Org 模式的日历(日程)上的同一天/同一时间。这样,我就能很好地了解当天发生了什么,包括我拍的所有照片。 + +### 我的一般文件夹结构 + +在本节中,我将描述我的主文件夹中最重要的文件夹。注意:这可能在将来的被移动到一个独立的页面。或许不是。让我们等着瞧 :-) (LCTT 译注:后来这一节已被作者扩展并移动到另外一篇[文章](https://karl-voit.at/folder-hierarchy/)。) + +很多东西只有在一定的时间内才会引起人们的兴趣。这些内容包括快速浏览其内容的下载、解压缩文件以检查包含的文件、一些有趣的小内容等等。对于**临时的东西**,我有 `$HOME/tmp/` 子层次结构。新照片放在 `$HOME/tmp/digicam/` 中。我从 CD、DVD 或 USB 记忆棒临时复制的东西放在 `$HOME/tmp/fromcd/` 中。每当软件工具需要用户文件夹层次结构中的临时数据时,我就使用 `$HOME/tmp/Tools/`作为起点。我经常使用的文件夹是 `$HOME/tmp/2del/`:`2del` 的意思是“随时可以删除”。例如,我所有的浏览器都使用这个文件夹作为默认的下载文件夹。如果我需要在机器上腾出空间,我首先查看这个 `2del` 文件夹,用于删除内容。 + +与上面描述的临时文件相比,我当然也想将文件**保存更长的时间**。这些文件被移动到我的 `$HOME/archive/` 子层次结构中。它有几个子文件夹用于备份、我想保留的 web 下载类、我要存档的二进制文件、可移动媒体(CD、DVD、记忆棒、外部硬盘驱动器)的索引文件,和一个稍后(寻找一个合适的的目标文件夹)存档的文件夹。有时,我太忙或没有耐心的时候将文件妥善整理。是的,那就是我,我甚至有一个名为“现在不要烦我”的文件夹。这对你而言是否很怪?:-) + +我的归档中最重要的子层次结构是 `$HOME/archive/events_memories/` 及其子文件夹 `2014/`、`2013/`、`2012/` 等等。正如你可能已经猜到的,每个年份有一个**子文件夹**。其中每个文件中都有单个文件和文件夹。这些文件是根据我在前一节中描述的文件名约定命名的。文件夹名称以 [ISO 8601][7] 日期标签 “YYYY-MM-DD” 开头,后面跟着一个具有描述性的名称,如 `$HOME/archive/events_memories/2014/2014-05-08 Business marathon with/`。在这些与日期相关的文件夹中,我保存着各种与特定事件相关的文件:照片、(扫描的)pdf 文件、文本文件等等。 + +对于**共享数据**,我设置一个 `$HOME/share/` 子层次结构。这是我的 Dropbox 文件夹,我用各种各样的方法(比如 [unison][18])来分享数据。我也在我的设备之间共享数据:家里的 Mac Mini、家里的 GNU/Linux 笔记本、Android 手机,root-server(我的个人云),工作用的 Windows 笔记本。我不想在这里详细说明我的同步设置。如果你想了解相关的设置,可以参考另一篇相关的文章。:-) + +在我的 `$HOME/templates_tags/` 子层次结构中,我保存了各种**模板文件**([LaTeX][19]、脚本、…),插图和**徽标**,等等。 + +我的 **Org 模式** 文件,主要是保存在 `$HOME/org/`。我练习记忆力,不会解释我有多喜欢 [Emacs/Org 模式][20] 以及我从中获益多少。你可能读过或听过我详细描述我用它做的很棒的事情。具体可以在我的博客上查找 [我的 Emacs 标签][21],在 Twitter 上查找 [hashtag #orgmode][22]。 + +以上就是我最重要的文件夹子层次结构设置方式。 + +### 我的工作流程 + +哒哒哒,在你了解了我的文件夹结构和文件名约定之后,下面是我当前的工作流程和工具,我使用它们来满足我前面描述的需求。 + +请注意,**你必须知道你在做什么**。我这里的示例及文件夹路径和更多**只适用我的机器或我的环境**。**你必须采用相应的**路径、文件名等来满足你的需求! + +#### 工作流程:将文件从 SD 卡移动到笔记本电脑、旋转人像图像,并重命名文件 + +当我想把数据从我的数码相机移到我的 GNU/Linux 笔记本上时,我拿出它的 mini SD 存储卡,把它放在我的笔记本上。然后它会自动挂载在 `/media/digicam` 上。 + +然后,调用 [getdigicamdata][23]。它做了如下几件事:它将文件从 SD 卡移动到一个临时文件夹中进行处理。原始文件名会转换为小写字符。所有的人像照片会使用 [jhead][24] 旋转。同样使用 jhead,我从 Exif 头的时间戳中生成文件名称中的时间戳。使用 [date2name][25],我也将时间戳添加到电影文件中。处理完所有这些文件后,它们将被移动到新的数码相机文件的目标文件夹: `$HOME/tmp/digicam/tmp/`。 + +#### 工作流程:文件夹索引、查看、重命名、删除图像文件 + +为了快速浏览我的图像和电影文件,我喜欢使用 GNU/Linux 上的 [geeqie][26]。这是一个相当轻量级的图像浏览器,它具有其他文件浏览器所缺少的一大优势:我可以添加通过键盘快捷方式调用的外部脚本/工具。通过这种方式,我可以通过任意外部命令扩展这个图像浏览器的特性。 + +基本的图像管理功能是内置在 geeqie:浏览我的文件夹层次结构、以窗口模式或全屏查看图像(快捷键 `f`)、重命名文件名、删除文件、显示 Exif 元数据(快捷键 `Ctrl-e`)。 + +在 OS X 上,我使用 [Xee][27]。与 geeqie 不同,它不能通过外部命令进行扩展。不过,基本的浏览、查看和重命名功能也是可用的。 + +#### 工作流程:添加和删除标签 + +我创建了一个名为 [filetags][28] 的 Python 脚本,用于向单个文件以及一组文件添加和删除标记。 + +对于数码照片,我使用标签,例如,`specialL` 用于我认为适合桌面背景的风景图片,`specialP` 用于我想展示给其他人的人像照片,`sel` 用于筛选,等等。 + +##### 使用 geeqie 初始设置 filetags + +向 geeqie 添加 `filetags` 是一个手动步骤:“Edit > Preferences > Configure Editors ...”,然后创建一个附加条目 `New`。在这里,你可以定义一个新的桌面文件,如下所示: + +``` +[Desktop Entry] +Name=filetags +GenericName=filetags +Comment= +Exec=/home/vk/src/misc/vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; +``` + +*add-tags.desktop* + +封装脚本 `vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh` 是必须的,因为我想要弹出一个新的终端,以便添加标签到我的文件: + +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --interactive "${@}" + +#end +``` + +*vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh* + +在 geeqie 中,你可以在 “Edit > Preferences > Preferences ... > Keyboard”。我将 `t` 与 `filetags` 命令相关联。 + +这个 `filetags` 脚本还能够从单个文件或一组文件中删除标记。它基本上使用与上面相同的方法。唯一的区别是 `filetags` 脚本额外的 `--remove` 参数: + +``` +[Desktop Entry] +Name=filetags-remove +GenericName=filetags-remove +Comment= +Exec=/home/vk/src/misc/vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; +``` + +*remove-tags.desktop* + +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --interactive --remove "${@}" + +#end +``` + +*vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh* + +为了删除标签,我创建了一个键盘快捷方式 `T`。 + +##### 在 geeqie 中使用 filetags + +当我在 geeqie 文件浏览器中浏览图像文件时,我选择要标记的文件(一到多个)并按 `t`。然后,一个小窗口弹出,要求我提供一个或多个标签。用回车确认后,这些标签被添加到文件名中。 + +删除标签也是一样:选择多个文件,按下 `T`,输入要删除的标签,然后按回车确认。就是这样。几乎没有[给文件添加或删除标签的更简单的方法了][29]。 + +#### 工作流程:改进的使用 appendfilename 重命名文件 + +##### 不使用 appendfilename + +重命名一组大型文件可能是一个冗长乏味的过程。对于 `2014-04-20T17.09.11_p1100386.jpg` 这样的原始文件名,在文件名中添加描述的过程相当烦人。你将按 `Ctrl-r` (重命名)在 geeqie 中打开文件重命名对话框。默认情况下,原始名称(没有文件扩展名的文件名称)被标记。因此,如果不希望删除/覆盖文件名(但要追加),则必须按下光标键 `→`。然后,光标放在基本名称和扩展名之间。输入你的描述(不要忘记以空格字符开始),并用回车进行确认。 + +##### 在 geeqie 使中用 appendfilename + +使用 [appendfilename][30],我的过程得到了简化,可以获得将文本附加到文件名的最佳用户体验:当我在 geeqie 中按下 `a`(附加)时,会弹出一个对话框窗口,询问文本。在回车确认后,输入的文本将放置在时间戳和可选标记之间。 + +例如,当我在 `2014-04-20T17.09.11_p1100386.jpg` 上按下 `a`,然后键入`Pick-nick in Graz` 时,文件名变为 `2014-04-20T17.09.11_p1100386 Pick-nick in Graz.jpg`。当我再次按下 `a` 并输入 `with Susan` 时,文件名变为 `2014-04-20T17.09.11_p1100386 Pick-nick in Graz with Susan.jpg`。当文件名添加标记时,附加的文本前将附加标记分隔符。 + +这样,我就不必担心覆盖时间戳或标记。重命名的过程对我来说变得更加有趣! + +最好的部分是:当我想要将相同的文本添加到多个选定的文件中时,也可以使用 `appendfilename`。 + +##### 在 geeqie 中初始设置 appendfilename + +添加一个额外的编辑器到 geeqie: “Edit > Preferences > Configure Editors ... > New”。然后输入桌面文件定义: + +``` +[Desktop Entry] +Name=appendfilename +GenericName=appendfilename +Comment= +Exec=/home/vk/src/misc/vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; +``` + +*appendfilename.desktop* + +同样,我也使用了一个封装脚本,它将为我打开一个新的终端: + +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=90x5+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/appendfilename/appendfilename.py "${@}" + +#end +``` + +*vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh* + +#### 工作流程:播放电影文件 + +在 GNU/Linux 上,我使用 [mplayer][31] 回放视频文件。由于 geeqie 本身不播放电影文件,所以我必须创建一个设置,以便在 mplayer 中打开电影文件。 + +##### 在 geeqie 中初始设置 mplayer + +我已经使用 [xdg-open][32] 将电影文件扩展名关联到 mplayer。因此,我只需要为 geeqie 创建一个通用的“open”命令,让它使用 `xdg-open` 打开任何文件及其关联的应用程序。 + +在 geeqie 中,再次访问 “Edit > Preferences > Configure Editors ...” 添加“open”的条目: + +``` +[Desktop Entry] +Name=open +GenericName=open +Comment= +Exec=/usr/bin/xdg-open %F +Icon= +Terminal=true +Type=Application +hidden=false +NOMimeType=*; +MimeType=image/*;video/* +Categories=X-Geeqie; +``` + +*open.desktop* + +当你也将快捷方式 `o` (见上文)与 geeqie 关联时,你就能够打开与其关联的应用程序的视频文件(和其他文件)。 + +##### 使用 xdg-open 打开电影文件(和其他文件) + +在上面的设置过程之后,当你的 geeqie 光标位于文件上方时,你只需按下 `o` 即可。就是如此简洁。 + +#### 工作流程:在外部图像编辑器中打开 + +我不太希望能够在 GIMP 中快速编辑图像文件。因此,我添加了一个快捷方式 `g`,并将其与外部编辑器 “"GNU Image Manipulation Program" (GIMP)” 关联起来,geeqie 已经默认创建了该外部编辑器。 + +这样,只需按下 `g` 就可以在 GIMP 中打开当前图像。 + +#### 工作流程:移动到存档文件夹 + +现在我已经在我的文件名中添加了注释,我想将单个文件移动到 `$HOME/archive/events_memories/2014/`,或者将一组文件移动到这个文件夹中的新文件夹中,如 `$HOME/archive/events_memories/2014/2014-05-08 business marathon after show - party`。 + +通常的方法是选择一个或多个文件,并用快捷方式 `Ctrl-m` 将它们移动到文件夹中。 + +何等繁复无趣之至! + +因此,我(再次)编写了一个 Python 脚本,它为我完成了这项工作:[move2archive][33](简写为:` m2a `),需要一个或多个文件作为命令行参数。然后,出现一个对话框,我可以在其中输入一个可选文件夹名。当我不输入任何东西而是按回车,文件被移动到相应年份的文件夹。当我输入一个类似 `Business-Marathon After-Show-Party` 的文件夹名称时,第一个图像文件的日期戳被附加到该文件夹(`$HOME/archive/events_memories/2014/2014-05-08 Business-Marathon After-Show-Party`),然后创建该文件夹,并移动文件。 + +再一次,我在 geeqie 中选择一个或多个文件,按 `m`(移动),或者只按回车(没有特殊的子文件夹),或者输入一个描述性文本,这是要创建的子文件夹的名称(可选不带日期戳)。 + +**没有一个图像管理工具像我的带有 appendfilename 和 move2archive 的 geeqie 一样可以通过快捷键快速且有趣的完成工作。** + +##### 在 geeqie 里初始化 m2a 的相关设置 + +同样,向 geeqie 添加 `m2a` 是一个手动步骤:“Edit > Preferences > Configure Editors ...”,然后创建一个附加条目“New”。在这里,你可以定义一个新的桌面文件,如下所示: + +``` +[Desktop Entry] +Name=move2archive +GenericName=move2archive +Comment=Moving one or more files to my archive folder +Exec=/home/vk/src/misc/vk-m2a-interactive-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; +``` + +*m2a.desktop* + +封装脚本 `vk-m2a-interactive-wrapper-with-gnome-terminal.sh` 是必要的,因为我想要弹出一个新的终端窗口,以便我的文件进入我指定的目标文件夹: + +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=157x56+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/m2a/m2a.py --pauseonexit "${@}" + +#end +``` + +*vk-m2a-interactive-wrapper-with-gnome-terminal.sh* + +在 geeqie 中,你可以在 “Edit > Preferences > Preferences ... > Keyboard” 将 `m` 与 `m2a` 命令相关联。 + +#### 工作流程:旋转图像(无损) + +通常,我的数码相机会自动将人像照片标记为人像照片。然而,在某些特定的情况下(比如从装饰图案上方拍照),我的相机会出错。在那些**罕见的情况下**,我必须手动修正方向。 + +你必须知道,JPEG 文件格式是一种有损格式,应该只用于照片,而不是计算机生成的东西,如屏幕截图或图表。以傻瓜方式旋转 JPEG 图像文件通常会解压/可视化图像文件、旋转生成新的图像,然后重新编码结果。这将导致生成的图像[比原始图像质量差得多][5]。 + +因此,你应该使用无损方法来旋转 JPEG 图像文件。 + +再一次,我添加了一个“外部编辑器”到 geeqie:“Edit > Preferences > Configure Editors ... > New”。在这里,我添加了两个条目:使用 [exiftran][34],一个用于旋转 270 度(即逆时针旋转 90 度),另一个用于旋转 90 度(顺时针旋转 90 度): + +``` +[Desktop Entry] +Version=1.0 +Type=Application +Name=Losslessly rotate JPEG image counterclockwise + +# call the helper script +TryExec=exiftran +Exec=exiftran -p -2 -i -g %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "Edit/Orientation" +X-Geeqie-Menu-Path=EditMenu/OrientationMenu + +MimeType=image/jpeg; +``` + +*rotate-270.desktop* + +``` +[Desktop Entry] +Version=1.0 +Type=Application +Name=Losslessly rotate JPEG image clockwise + +# call the helper script +TryExec=exiftran +Exec=exiftran -p -9 -i -g %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "Edit/Orientation" +X-Geeqie-Menu-Path=EditMenu/OrientationMenu + +# It can be made verbose +# X-Geeqie-Verbose=true + +MimeType=image/jpeg; +``` + +*rotate-90.desktop* + +我创建了 geeqie 快捷键 `[`(逆时针方向)和 `]`(顺时针方向)。 + +#### 工作流程:可视化 GPS 坐标 + +我的数码相机有一个 GPS 传感器,它在 JPEG 文件的 Exif 元数据中存储当前的地理位置。位置数据以 [WGS 84][35] 格式存储,如 `47, 58, 26.73; 16, 23, 55.51`(纬度;经度)。这一方式可读性较差,我期望:要么是地图,要么是位置名称。因此,我向 geeqie 添加了一些功能,这样我就可以在 [OpenStreetMap][36] 上看到单个图像文件的位置: `Edit > Preferences > Configure Editors ... > New`。 + +``` +[Desktop Entry] +Name=vkphotolocation +GenericName=vkphotolocation +Comment= +Exec=/home/vk/src/misc/vkphotolocation.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-gray;image/x-icb;image/x-ico;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/x-pcx;image/svg+xml;image/svg+xml-compressed;image/vnd.wap.wbmp; +``` + +*photolocation.desktop* + +这调用了我的名为 `vkphotolocation.sh` 的封装脚本,它使用 [ExifTool][37] 以 [Marble][38] 能够读取和可视化的适当格式提取该坐标: + +``` +#!/bin/sh + +IMAGEFILE="${1}" +IMAGEFILEBASENAME=`basename ${IMAGEFILE}` + +COORDINATES=`exiftool -c %.6f "${IMAGEFILE}" | awk '/GPS Position/ { print $4 " " $6 }'` + +if [ "x${COORDINATES}" = "x" ]; then + zenity --info --title="${IMAGEFILEBASENAME}" --text="No GPS-location found in the image file." +else + /usr/bin/marble --latlon "${COORDINATES}" --distance 0.5 +fi + +#end +``` + +*vkphotolocation.sh* + +映射到键盘快捷键 `G`,我可以快速地得到**单个图像文件的位置的地图定位**。 + +当我想将多个 JPEG 图像文件的**位置可视化为路径**时,我使用 [GpsPrune][39]。我无法挖掘出 GpsPrune 将一组文件作为命令行参数的方法。正因为如此,我必须手动启动 GpsPrune,用 “File > Add photos”选择一组文件或一个文件夹。 + +通过这种方式,我可以为每个 JPEG 位置在 OpenStreetMap 地图上获得一个点(如果配置为这样)。通过单击这样一个点,我可以得到相应图像的详细信息。 + +如果你恰好在国外拍摄照片,可视化 GPS 位置对**在文件名中添加描述**大有帮助! + +#### 工作流程:根据 GPS 坐标过滤照片 + +这并非我的工作流程。为了完整起见,我列出该工作流对应工具的特性。我想做的就是从一大堆图片中寻找那些在一定区域内(范围或点 + 距离)的照片。 + +到目前为止,我只找到了 [DigiKam][40],它能够[根据矩形区域进行过滤][41]。如果你知道其他工具,请将其添加到下面的评论或给我写一封电子邮件。 + +#### 工作流程:显示给定集合的子集 + +如上面的需求所述,我希望能够对一个文件夹中的文件定义一个子集,以便将这个小集合呈现给其他人。 + +工作流程非常简单:我向选择的文件添加一个标记(通过 `t`/`filetags`)。为此,我使用标记 `sel`,它是 “selection” 的缩写。在标记了一组文件之后,我可以按下 `s`,它与一个脚本相关联,该脚本只显示标记为 `sel` 的文件。 + +当然,这也适用于任何标签或标签组合。因此,用同样的方法,你可以得到一个适当的概述,你的婚礼上的所有照片都标记着“教堂”和“戒指”。 + +很棒的功能,不是吗?:-) + +##### 初始设置 filetags 以根据标签和 geeqie 过滤 + +你必须定义一个额外的“外部编辑器”,“ Edit > Preferences > Configure Editors ... > New”: + +``` +[Desktop Entry] +Name=filetag-filter +GenericName=filetag-filter +Comment= +Exec=/home/vk/src/misc/vk-filetag-filter-wrapper-with-gnome-terminal.sh +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; +``` + +*filter-tags.desktop* + +再次调用我编写的封装脚本: + +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --filter + +#end +``` + +*vk-filetag-filter-wrapper-with-gnome-terminal.sh* + +带有参数 `--filter` 的 `filetags` 基本上完成的是:用户被要求输入一个或多个标签。然后,当前文件夹中所有匹配的文件都使用[符号链接][42]链接到 `$HOME/.filetags_tagfilter/`。然后,启动了一个新的 geeqie 实例,显示链接的文件。 + +在退出这个新的 geeqie 实例之后,你会看到进行选择的旧的 geeqie 实例。 + +#### 用一个真实的案例来总结 + +哇哦, 这是一篇很长的博客文章。你可能已经忘了之前的概述。总结一下我在(扩展了标准功能集的) geeqie 中可以做的事情,我有一个很酷的总结: + +快捷键 | 功能 +--- | --- +`m` | 移到归档(m2a) +`o` | 打开(针对非图像文件) +`a` | 在文件名里添加字段 +`t` | 文件标签(添加) +`T` | 文件标签(删除) +`s` | 文件标签(排序) +`g` | gimp +`G` | 显示 GPS 信息 +`[` | 无损的逆时针旋转 +`]` | 无损的顺时针旋转 +`Ctrl-e` | EXIF 图像信息 +`f` | 全屏显示 + +文件名(包括它的路径)的部分及我用来操作该部分的相应工具: + +``` + /this/is/a/folder/2014-04-20T17.09 Picknick in Graz -- food graz.jpg + [ move2archive ] [ date2name ] [appendfilename] [ filetags ] +``` + +在实践中,我按照以下步骤将照片从相机保存到存档:我将 SD 存储卡放入计算机的 SD 读卡器中。然后我运行 [getdigicamdata.sh][23]。完成之后,我在 geeqie 中打开 `$HOME/tmp/digicam/tmp/`。我浏览了一下照片,把那些不成功的删除了。如果有一个图像的方向错误,我用 `[` 或 `]` 纠正它。 + +在第二步中,我向我认为值得评论的文件添加描述 (`a`)。每当我想添加标签时,我也这样做:我快速地标记所有应该共享相同标签的文件(`Ctrl + 鼠标点击`),并使用 [filetags][28](`t`)进行标记。 + +要合并来自给定事件的文件,我选中相应的文件,将它们移动到年度归档文件夹中的 `event-folder`,并通过在 [move2archive][33](`m`)中键入事件描述,其余的(非特殊的文件夹)无需声明事件描述由 `move2archive` (`m`)直接移动到年度归档中。 + +结束我的工作流程,我删除了 SD 卡上的所有文件,把它从操作系统上弹出,然后把它放回我的数码相机里。 + +以上。 + +因为这种工作流程几乎不需要任何开销,所以评论、标记和归档照片不再是一项乏味的工作。 + +### 最后 + +所以,这是一个详细描述我关于照片和电影的工作流程的叙述。你可能已经发现了我可能感兴趣的其他东西。所以请不要犹豫,请使用下面的链接留下评论或电子邮件。 + +我也希望得到反馈,如果我的工作流程适用于你。并且,如果你已经发布了你的工作流程或者找到了其他人工作流程的描述,也请留下评论! + +及时行乐,莫让错误的工具或低效的方法浪费了我们的人生! + +### 其他工具 + +阅读关于[本文中关于 gThumb 的部分][43]。 + +当你觉得你以上文中所叙述的符合你的需求时,请根据相关的建议来选择对应的工具。 + +-------------------------------------------------------------------------------- + +via: http://karl-voit.at/managing-digital-photographs/ + +作者:[Karl Voit][a] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://karl-voit.at +[1]:https://en.wikipedia.org/wiki/Jpeg +[2]:http://en.wikipedia.org/wiki/Vendor_lock-in +[3]:https://en.wikipedia.org/wiki/Raw_image_format +[4]:http://www.gimp.org/ +[5]:http://petapixel.com/2012/08/14/why-you-should-always-rotate-original-jpeg-photos-losslessly/ +[6]:https://en.wikipedia.org/wiki/Gps +[7]:https://en.wikipedia.org/wiki/Iso_date +[8]:https://en.wikipedia.org/wiki/Ntfs +[9]:https://en.wikipedia.org/wiki/Exif +[10]:http://www.isisinform.com/reinventing-knowledge-the-medieval-controversy-of-alphabetical-order/ +[11]:https://en.wikipedia.org/wiki/File_name_extension +[12]:http://karl-voit.at/tagstore/en/papers.shtml +[13]:https://en.wikipedia.org/wiki/Hashtag +[14]:https://en.wikipedia.org/wiki/Dot-file +[15]:https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_.28ADS.29 +[16]:https://github.com/novoid/Memacs/blob/master/docs/memacs_filenametimestamps.org +[17]:https://github.com/novoid/Memacs +[18]:http://www.cis.upenn.edu/~bcpierce/unison/ +[19]:https://github.com/novoid/LaTeX-KOMA-template +[20]:http://orgmode.org/ +[21]:http://karl-voit.at/tags/emacs +[22]:https://twitter.com/search?q%3D%2523orgmode&src%3Dtypd +[23]:https://github.com/novoid/getdigicamdata.sh +[24]:http://www.sentex.net/%3Ccode%3Emwandel/jhead/ +[25]:https://github.com/novoid/date2name +[26]:http://geeqie.sourceforge.net/ +[27]:http://xee.c3.cx/ +[28]:https://github.com/novoid/filetag +[29]:http://karl-voit.at/tagstore/ +[30]:https://github.com/novoid/appendfilename +[31]:http://www.mplayerhq.hu +[32]:https://wiki.archlinux.org/index.php/xdg-open +[33]:https://github.com/novoid/move2archive +[34]:http://manpages.ubuntu.com/manpages/raring/man1/exiftran.1.html +[35]:https://en.wikipedia.org/wiki/WGS84#A_new_World_Geodetic_System:_WGS_84 +[36]:http://www.openstreetmap.org/ +[37]:http://www.sno.phy.queensu.ca/~phil/exiftool/ +[38]:http://userbase.kde.org/Marble/Tracking +[39]:http://activityworkshop.net/software/gpsprune/ +[40]:https://en.wikipedia.org/wiki/DigiKam +[41]:https://docs.kde.org/development/en/extragear-graphics/digikam/using-kapp.html#idp7659904 +[42]:https://en.wikipedia.org/wiki/Symbolic_link +[43]:http://karl-voit.at/2017/02/19/gthumb +[44]:https://glt18.linuxtage.at +[45]:https://glt18-programm.linuxtage.at/events/321.html diff --git a/published/20180706 Building a Messenger App- OAuth.md b/published/20180706 Building a Messenger App- OAuth.md new file mode 100644 index 0000000000..62b85717d5 --- /dev/null +++ b/published/20180706 Building a Messenger App- OAuth.md @@ -0,0 +1,444 @@ +[#]: collector: (lujun9972) +[#]: translator: (PsiACE) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11510-1.html) +[#]: subject: (Building a Messenger App: OAuth) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-oauth/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +构建一个即时消息应用(二):OAuth +====== + +[上一篇:模式](https://linux.cn/article-11396-1.html)。 + +在这篇帖子中,我们将会通过为应用添加社交登录功能进入后端开发。 + +社交登录的工作方式十分简单:用户点击链接,然后重定向到 GitHub 授权页面。当用户授予我们对他的个人信息的访问权限之后,就会重定向回登录页面。下一次尝试登录时,系统将不会再次请求授权,也就是说,我们的应用已经记住了这个用户。这使得整个登录流程看起来就和你用鼠标单击一样快。 + +如果进一步考虑其内部实现的话,过程就会变得复杂起来。首先,我们需要注册一个新的 [GitHub OAuth 应用][2]。 + +这一步中,比较重要的是回调 URL。我们将它设置为 `http://localhost:3000/api/oauth/github/callback`。这是因为,在开发过程中,我们总是在本地主机上工作。一旦你要将应用交付生产,请使用正确的回调 URL 注册一个新的应用。 + +注册以后,你将会收到“客户端 id”和“安全密钥”。安全起见,请不要与任何人分享他们 👀 + +顺便让我们开始写一些代码吧。现在,创建一个 `main.go` 文件: + +``` +package main + +import ( + "database/sql" + "fmt" + "log" + "net/http" + "net/url" + "os" + "strconv" + + "github.com/gorilla/securecookie" + "github.com/joho/godotenv" + "github.com/knq/jwt" + _ "github.com/lib/pq" + "github.com/matryer/way" + "golang.org/x/oauth2" + "golang.org/x/oauth2/github" +) + +var origin *url.URL +var db *sql.DB +var githubOAuthConfig *oauth2.Config +var cookieSigner *securecookie.SecureCookie +var jwtSigner jwt.Signer + +func main() { + godotenv.Load() + + port := intEnv("PORT", 3000) + originString := env("ORIGIN", fmt.Sprintf("http://localhost:%d/", port)) + databaseURL := env("DATABASE_URL", "postgresql://root@127.0.0.1:26257/messenger?sslmode=disable") + githubClientID := os.Getenv("GITHUB_CLIENT_ID") + githubClientSecret := os.Getenv("GITHUB_CLIENT_SECRET") + hashKey := env("HASH_KEY", "secret") + jwtKey := env("JWT_KEY", "secret") + + var err error + if origin, err = url.Parse(originString); err != nil || !origin.IsAbs() { + log.Fatal("invalid origin") + return + } + + if i, err := strconv.Atoi(origin.Port()); err == nil { + port = i + } + + if githubClientID == "" || githubClientSecret == "" { + log.Fatalf("remember to set both $GITHUB_CLIENT_ID and $GITHUB_CLIENT_SECRET") + return + } + + if db, err = sql.Open("postgres", databaseURL); err != nil { + log.Fatalf("could not open database connection: %v\n", err) + return + } + defer db.Close() + if err = db.Ping(); err != nil { + log.Fatalf("could not ping to db: %v\n", err) + return + } + + githubRedirectURL := *origin + githubRedirectURL.Path = "/api/oauth/github/callback" + githubOAuthConfig = &oauth2.Config{ + ClientID: githubClientID, + ClientSecret: githubClientSecret, + Endpoint: github.Endpoint, + RedirectURL: githubRedirectURL.String(), + Scopes: []string{"read:user"}, + } + + cookieSigner = securecookie.New([]byte(hashKey), nil).MaxAge(0) + + jwtSigner, err = jwt.HS256.New([]byte(jwtKey)) + if err != nil { + log.Fatalf("could not create JWT signer: %v\n", err) + return + } + + router := way.NewRouter() + router.HandleFunc("GET", "/api/oauth/github", githubOAuthStart) + router.HandleFunc("GET", "/api/oauth/github/callback", githubOAuthCallback) + router.HandleFunc("GET", "/api/auth_user", guard(getAuthUser)) + + log.Printf("accepting connections on port %d\n", port) + log.Printf("starting server at %s\n", origin.String()) + addr := fmt.Sprintf(":%d", port) + if err = http.ListenAndServe(addr, router); err != nil { + log.Fatalf("could not start server: %v\n", err) + } +} + +func env(key, fallbackValue string) string { + v, ok := os.LookupEnv(key) + if !ok { + return fallbackValue + } + return v +} + +func intEnv(key string, fallbackValue int) int { + v, ok := os.LookupEnv(key) + if !ok { + return fallbackValue + } + i, err := strconv.Atoi(v) + if err != nil { + return fallbackValue + } + return i +} +``` + +安装依赖项: + +``` +go get -u github.com/gorilla/securecookie +go get -u github.com/joho/godotenv +go get -u github.com/knq/jwt +go get -u github.com/lib/pq +ge get -u github.com/matoous/go-nanoid +go get -u github.com/matryer/way +go get -u golang.org/x/oauth2 +``` + +我们将会使用 `.env` 文件来保存密钥和其他配置。请创建这个文件,并保证里面至少包含以下内容: + +``` +GITHUB_CLIENT_ID=your_github_client_id +GITHUB_CLIENT_SECRET=your_github_client_secret +``` + +我们还要用到的其他环境变量有: + + * `PORT`:服务器运行的端口,默认值是 `3000`。 + * `ORIGIN`:你的域名,默认值是 `http://localhost:3000/`。我们也可以在这里指定端口。 + * `DATABASE_URL`:Cockroach 数据库的地址。默认值是 `postgresql://root@127.0.0.1:26257/messenger?sslmode=disable`。 + * `HASH_KEY`:用于为 cookie 签名的密钥。没错,我们会使用已签名的 cookie 来确保安全。 + * `JWT_KEY`:用于签署 JSON 网络令牌Web Token的密钥。 + +因为代码中已经设定了默认值,所以你也不用把它们写到 `.env` 文件中。 + +在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 `ORIGIN` 信息来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的数据范围设置为 “read:user”。这会允许我们读取公开的用户信息,这里我们只需要他的用户名和头像就够了。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 + +在实现 HTTP 处理程序之前,让我们编写一些函数来发送 HTTP 响应。 + +``` +func respond(w http.ResponseWriter, v interface{}, statusCode int) { + b, err := json.Marshal(v) + if err != nil { + respondError(w, fmt.Errorf("could not marshal response: %v", err)) + return + } + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(statusCode) + w.Write(b) +} + +func respondError(w http.ResponseWriter, err error) { + log.Println(err) + http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) +} +``` + +第一个函数用来发送 JSON,而第二个将错误记录到控制台并返回一个 `500 Internal Server Error` 错误信息。 + +### OAuth 开始 + +所以,用户点击写着 “Access with GitHub” 的链接。该链接指向 `/api/oauth/github`,这将会把用户重定向到 github。 + +``` +func githubOAuthStart(w http.ResponseWriter, r *http.Request) { + state, err := gonanoid.Nanoid() + if err != nil { + respondError(w, fmt.Errorf("could not generte state: %v", err)) + return + } + + stateCookieValue, err := cookieSigner.Encode("state", state) + if err != nil { + respondError(w, fmt.Errorf("could not encode state cookie: %v", err)) + return + } + + http.SetCookie(w, &http.Cookie{ + Name: "state", + Value: stateCookieValue, + Path: "/api/oauth/github", + HttpOnly: true, + }) + http.Redirect(w, r, githubOAuthConfig.AuthCodeURL(state), http.StatusTemporaryRedirect) +} +``` + +OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个“状态”(`state`)。我们使用 `Nanoid()` 来创建一个随机字符串,并用这个字符串作为状态。我们也把它保存为一个 cookie。 + +### OAuth 回调 + +一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 的查询字符串上将会包含状态(`state`)和授权码(`code`): `/api/oauth/github/callback?state=&code=`。 + +``` +const jwtLifetime = time.Hour * 24 * 14 + +type GithubUser struct { + ID int `json:"id"` + Login string `json:"login"` + AvatarURL *string `json:"avatar_url,omitempty"` +} + +type User struct { + ID string `json:"id"` + Username string `json:"username"` + AvatarURL *string `json:"avatarUrl"` +} + +func githubOAuthCallback(w http.ResponseWriter, r *http.Request) { + stateCookie, err := r.Cookie("state") + if err != nil { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } + + http.SetCookie(w, &http.Cookie{ + Name: "state", + Value: "", + MaxAge: -1, + HttpOnly: true, + }) + + var state string + if err = cookieSigner.Decode("state", stateCookie.Value, &state); err != nil { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } + + q := r.URL.Query() + + if state != q.Get("state") { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } + + ctx := r.Context() + + t, err := githubOAuthConfig.Exchange(ctx, q.Get("code")) + if err != nil { + respondError(w, fmt.Errorf("could not fetch github token: %v", err)) + return + } + + client := githubOAuthConfig.Client(ctx, t) + resp, err := client.Get("https://api.github.com/user") + if err != nil { + respondError(w, fmt.Errorf("could not fetch github user: %v", err)) + return + } + + var githubUser GithubUser + if err = json.NewDecoder(resp.Body).Decode(&githubUser); err != nil { + respondError(w, fmt.Errorf("could not decode github user: %v", err)) + return + } + defer resp.Body.Close() + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + + var user User + if err = tx.QueryRowContext(ctx, ` + SELECT id, username, avatar_url FROM users WHERE github_id = $1 + `, githubUser.ID).Scan(&user.ID, &user.Username, &user.AvatarURL); err == sql.ErrNoRows { + if err = tx.QueryRowContext(ctx, ` + INSERT INTO users (username, avatar_url, github_id) VALUES ($1, $2, $3) + RETURNING id + `, githubUser.Login, githubUser.AvatarURL, githubUser.ID).Scan(&user.ID); err != nil { + respondError(w, fmt.Errorf("could not insert user: %v", err)) + return + } + user.Username = githubUser.Login + user.AvatarURL = githubUser.AvatarURL + } else if err != nil { + respondError(w, fmt.Errorf("could not query user by github ID: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit to finish github oauth: %v", err)) + return + } + + exp := time.Now().Add(jwtLifetime) + token, err := jwtSigner.Encode(jwt.Claims{ + Subject: user.ID, + Expiration: json.Number(strconv.FormatInt(exp.Unix(), 10)), + }) + if err != nil { + respondError(w, fmt.Errorf("could not create token: %v", err)) + return + } + + expiresAt, _ := exp.MarshalText() + + data := make(url.Values) + data.Set("token", string(token)) + data.Set("expires_at", string(expiresAt)) + + http.Redirect(w, r, "/callback?"+data.Encode(), http.StatusTemporaryRedirect) +} +``` + +首先,我们会尝试使用之前保存的状态对 cookie 进行解码。并将其与查询字符串中的状态进行比较。如果它们不匹配,我们会返回一个 `418 I'm teapot`(未知来源)错误。 + +接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们会向 `https://api.github.com/user` 发送一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,一并获取用户的 ID、登录名(用户名)和头像 URL。 + +然后我们将会尝试在数据库上找到具有该 GitHub ID 的用户。如果没有找到,就使用该数据创建一个新的。 + +之后,对于新创建的用户,我们会发出一个将用户 ID 作为主题(`Subject`)的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(`Expiration`)。 + +这一 Web 应用也会被用在其他帖子,但是重定向的链接会是 `/callback?token=&expires_at=`。在那里,我们将会利用 JavaScript 从 URL 中获取令牌和到期日,并通过 `Authorization` 标头中的令牌以 `Bearer token_here` 的形式对 `/api/auth_user` 进行 GET 请求,来获取已认证的身份用户并将其保存到 localStorage。 + +### Guard 中间件 + +为了获取当前已经过身份验证的用户,我们设计了 Guard 中间件。这是因为在接下来的文章中,我们会有很多需要进行身份认证的端点,而中间件将会允许我们共享这一功能。 + +``` +type ContextKey struct { + Name string +} + +var keyAuthUserID = ContextKey{"auth_user_id"} + +func guard(handler http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var token string + if a := r.Header.Get("Authorization"); strings.HasPrefix(a, "Bearer ") { + token = a[7:] + } else if t := r.URL.Query().Get("token"); t != "" { + token = t + } else { + http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) + return + } + + var claims jwt.Claims + if err := jwtSigner.Decode([]byte(token), &claims); err != nil { + http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) + return + } + + ctx := r.Context() + ctx = context.WithValue(ctx, keyAuthUserID, claims.Subject) + + handler(w, r.WithContext(ctx)) + } +} +``` + +首先,我们尝试从 `Authorization` 标头或者是 URL 查询字符串中的 `token` 字段中读取令牌。如果没有找到,我们需要返回 `401 Unauthorized`(未授权)错误。然后我们将会对令牌中的申明进行解码,并使用该主题作为当前已经过身份验证的用户 ID。 + +现在,我们可以用这一中间件来封装任何需要授权的 `http.handlerFunc`,并且在处理函数的上下文中保有已经过身份验证的用户 ID。 + +``` +var guarded = guard(func(w http.ResponseWriter, r *http.Request) { + authUserID := r.Context().Value(keyAuthUserID).(string) +}) +``` + +### 获取认证用户 + +``` +func getAuthUser(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + + var user User + if err := db.QueryRowContext(ctx, ` + SELECT username, avatar_url FROM users WHERE id = $1 + `, authUserID).Scan(&user.Username, &user.AvatarURL); err == sql.ErrNoRows { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } else if err != nil { + respondError(w, fmt.Errorf("could not query auth user: %v", err)) + return + } + + user.ID = authUserID + + respond(w, user, http.StatusOK) +} +``` + +我们使用 Guard 中间件来获取当前经过身份认证的用户 ID 并查询数据库。 + +这一部分涵盖了后端的 OAuth 流程。在下一篇帖子中,我们将会看到如何开始与其他用户的对话。 + +- [源代码][3] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ + +作者:[Nicolás Parada][a] +选题:[lujun9972][b] +译者:[PsiACE](https://github.com/PsiACE) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://github.com/settings/applications/new +[3]: https://github.com/nicolasparada/go-messenger-demo diff --git a/published/20180906 What a shell dotfile can do for you.md b/published/20180906 What a shell dotfile can do for you.md new file mode 100644 index 0000000000..d2f1a73c71 --- /dev/null +++ b/published/20180906 What a shell dotfile can do for you.md @@ -0,0 +1,277 @@ +Shell 点文件可以为你做点什么 +====== + +> 了解如何使用配置文件来改善你的工作环境。 + +![](https://img.linux.net.cn/data/attachment/album/201910/03/123528x3skwqwb8sz8qo8s.jpg) + +不要问你可以为你的 shell 点文件dotfile做什么,而是要问一个 shell 点文件可以为你做什么! + +我一直在操作系统领域里面打转,但是在过去的几年中,我的日常使用的一直是 Mac。很长一段时间,我都在使用 Bash,但是当几个朋友开始把 [zsh][1] 当成宗教信仰时,我也试试了它。我没用太长时间就喜欢上了它,几年后,我越发喜欢它做的许多小事情。 + +我一直在使用 zsh(通过 [Homebrew][2] 提供,而不是由操作系统安装的)和 [Oh My Zsh 增强功能][3]。 + +本文中的示例是我的个人 `.zshrc`。大多数都可以直接用在 Bash 中,我觉得不是每个人都依赖于 Oh My Zsh,但是如果不用的话你的工作量可能会有所不同。曾经有一段时间,我同时为 zsh 和 Bash 维护一个 shell 点文件,但是最终我还是放弃了我的 `.bashrc`。 + +### 不偏执不行 + +如果你希望在各个操作系统上使用相同的点文件,则需要让你的点文件聪明点。 + +``` +### Mac 专用 +if [[ "$OSTYPE" == "darwin"* ]]; then +        # Mac 专用内容在此 +``` + +例如,我希望 `Alt + 箭头键` 将光标按单词移动而不是单个空格。为了在 [iTerm2][4](我的首选终端)中实现这一目标,我将此代码段添加到了 `.zshrc` 的 Mac 专用部分: + +``` +### Mac 专用 +if [[ "$OSTYPE" == "darwin"* ]]; then +        ### Mac 用于 iTerm2 的光标命令;映射 ctrl+arrows 或 alt+arrows 来快速移动 +        bindkey -e +        bindkey '^[[1;9C' forward-word +        bindkey '^[[1;9D' backward-word +        bindkey '\e\e[D' backward-word +        bindkey '\e\e[C' forward-word +fi +``` + +(LCTT 译注:标题 “We're all mad here” 是电影《爱丽丝梦游仙境》中,微笑猫对爱丽丝讲的一句话:“我们这儿全都是疯的”。) + +### 在家不工作 + +虽然我开始喜欢我的 Shell 点文件了,但我并不总是想要家用计算机上的东西与工作的计算机上的东西一样。解决此问题的一种方法是让补充的点文件在家中使用,而不是在工作中使用。以下是我的实现方式: + +``` +if [[ `egrep 'dnssuffix1|dnssuffix2' /etc/resolv.conf` ]]; then +        if [ -e $HOME/.work ] +                source $HOME/.work +        else +                echo "This looks like a work machine, but I can't find the ~/.work file" +        fi +fi +``` + +在这种情况下,我根据我的工作 dns 后缀(或多个后缀,具体取决于你的情况)来提供(`source`)一个可以使我的工作环境更好的单独文件。 + +(LCTT 译注:标题 “What about Bob?” 是 1991 年的美国电影《天才也疯狂》。) + +### 你该这么做 + +现在可能是放弃使用波浪号(`~`)表示编写脚本时的主目录的好时机。你会发现在某些上下文中无法识别它。养成使用环境变量 `$HOME` 的习惯,这将为你节省大量的故障排除时间和以后的工作。 + +如果你愿意,合乎逻辑的扩展是应该包括特定于操作系统的点文件。 + +(LCTT 译注:标题 “That thing you do” 是 1996 年由汤姆·汉克斯执导的喜剧片《挡不住的奇迹》。) + +### 别指望记忆 + +我写了那么多 shell 脚本,我真的再也不想写脚本了。并不是说 shell 脚本不能满足我大部分时间的需求,而是我发现写 shell 脚本,可能只是拼凑了一个胶带式解决方案,而不是永久地解决问题。 + +同样,我讨厌记住事情,在我的整个职业生涯中,我经常不得不在一天之中就彻彻底底地改换环境。实际的结果是这些年来,我不得不一再重新学习很多东西。(“等等……这种语言使用哪种 for 循环结构?”) + +因此,每隔一段时间我就会觉得自己厌倦了再次寻找做某事的方法。我改善生活的一种方法是添加别名。 + +对于任何一个使用操作系统的人来说,一个常见的情况是找出占用了所有磁盘的内容。不幸的是,我从来没有记住过这个咒语,所以我做了一个 shell 别名,创造性地叫做 `bigdirs`: + +``` +alias bigdirs='du --max-depth=1 2> /dev/null | sort -n -r | head -n20' +``` + +虽然我可能不那么懒惰,并实际记住了它,但是,那不太 Unix …… + +(LCTT 译注:标题 “Memory, all alone in the moonlight” 是一手英文老歌。) + +### 输错的人们 + +使用 shell 别名改善我的生活的另一种方法是使我免于输入错误。我不知道为什么,但是我已经养成了这种讨厌的习惯,在序列 `ea` 之后输入 `w`,所以如果我想清除终端,我经常会输入 `cleawr`。不幸的是,这对我的 shell 没有任何意义。直到我添加了这个小东西: + +``` +alias cleawr='clear' +``` + +在 Windows 中有一个等效但更好的命令 `cls`,但我发现自己会在 Shell 也输入它。看到你的 shell 表示抗议真令人沮丧,因此我添加: + +``` +alias cls='clear' +``` + +是的,我知道 `ctrl + l`,但是我从不使用它。 + +(LCTT 译注:标题 “Typos, and the people who love them” 可能来自某部电影。) + +### 要自娱自乐 + +工作压力很大。有时你需要找点乐子。如果你的 shell 不知道它显然应该执行的命令,则可能你想直接让它耸耸肩!你可以使用以下功能执行此操作: + +``` +shrug() { echo "¯\_(ツ)_/¯"; } +``` + +如果还不行,也许你需要掀桌不干了: + +``` +fliptable() { echo "(╯°□°)╯ ┻━┻"; } # 掀桌,用法示例: fsck -y /dev/sdb1 || fliptable +``` + +想想看,当我想掀桌子时而我不记得我给它起了个什么名字,我会有多沮丧和失望,所以我添加了更多的 shell 别名: + +``` +alias flipdesk='fliptable' +alias deskflip='fliptable' +alias tableflip='fliptable' +``` + +而有时你需要庆祝一下: + +``` +disco() { +        echo "(•_•)" +        echo "<)   )╯" +        echo " /    \ " +        echo "" +        echo "\(•_•)" +        echo " (   (>" +        echo " /    \ " +        echo "" +        echo " (•_•)" +        echo "<)   )>" +        echo " /    \ " +} +``` + +通常,我会将这些命令的输出通过管道传递到 `pbcopy`,并将其粘贴到我正在使用的相关聊天工具中。 + +我从一个我关注的一个叫 “Command Line Magic” [@ climagic][5] 的 Twitter 帐户得到了下面这个有趣的函数。自从我现在住在佛罗里达州以来,我很高兴看到我这一生中唯一的一次下雪: + +``` +snow() { + clear;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS));sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH*\033[0;0H",a[x],x;}}' +} +``` + +(LCTT 译注:标题 “Amuse yourself” 是 1936 年的美国电影《自娱自乐》) + +### 函数的乐趣 + +我们已经看到了一些我使用的函数示例。由于这些示例中几乎不需要参数,因此可以将它们作为别名来完成。 当比一个短句更长时,我出于个人喜好使用函数。 + +在我职业生涯的很多时期我都运行过 [Graphite][6],这是一个开源、可扩展的时间序列指标解决方案。 在很多的情况下,我需要将度量路径(用句点表示)转换到文件系统路径(用斜杠表示),反之亦然,拥有专用于这些任务的函数就变得很有用: + +``` +# 在 Graphite 指标和文件路径之间转换很有用 +function dottoslash() { +        echo $1 | sed 's/\./\//g' +} +function slashtodot() { +        echo $1 | sed 's/\//\./g' +} +``` + +在我的另外一段职业生涯里,我运行了很多 Kubernetes。如果你对运行 Kubernetes 不熟悉,你需要编写很多 YAML。不幸的是,一不小心就会编写了无效的 YAML。更糟糕的是,Kubernetes 不会在尝试应用 YAML 之前对其进行验证,因此,除非你应用它,否则你不会发现它是无效的。除非你先进行验证: + +``` +function yamllint() { +        for i in $(find . -name '*.yml' -o -name '*.yaml'); do echo $i; ruby -e "require 'yaml';YAML.load_file(\"$i\")"; done +} +``` + +因为我厌倦了偶尔破坏客户的设置而让自己感到尴尬,所以我写了这个小片段并将其作为提交前挂钩添加到我所有相关的存储库中。在持续集成过程中,类似的内容将非常有帮助,尤其是在你作为团队成员的情况下。 + +(LCTT 译注:哦抱歉,我不知道这个标题的出处。) + +### 手指不听话 + +我曾经是一位出色的盲打打字员。但那些日子已经一去不回。我的打字错误超出了我的想象。 + +在各种时期,我多次用过 Chef 或 Kubernetes。对我来说幸运的是,我从未同时使用过这两者。 + +Chef 生态系统的一部分是 Test Kitchen,它是加快测试的一组工具,可通过命令 `kitchen test` 来调用。Kubernetes 使用 CLI 工具 `kubectl` 进行管理。这两个命令都需要几个子命令,并且这两者都不会特别顺畅地移动手指。 + +我没有创建一堆“输错别名”,而是将这两个命令别名为 `k`: + +``` +alias k='kitchen test $@' +``` + +或 + +``` +alias k='kubectl $@' +``` + +(LCTT 译注:标题 “Oh, fingers, where art thou?” 演绎自《O Brother, Where Art Thou?》,这是 2000 年美国的一部电影《逃狱三王》。) + +### 分裂与合并 + +我职业生涯的后半截涉及与其他人一起编写更多代码。我曾在许多环境中工作过,在这些环境中,我们在帐户中复刻了存储库副本,并将拉取请求用作审核过程的一部分。当我想确保给定存储库的复刻与父版本保持最新时,我使用 `fetchupstream`: + +``` +alias fetchupstream='git fetch upstream && git checkout master && git merge upstream/master && git push' +``` + +(LCTT 译注:标题 “Timesplitters” 是一款视频游戏《时空分裂者》。) + +### 颜色之荣耀 + +我喜欢颜色。它可以使 `diff` 之类的东西更易于使用。 + +``` +alias diff='colordiff' +``` + +我觉得彩色的手册页是个巧妙的技巧,因此我合并了以下函数: + +``` +# 彩色化手册页,来自: +# http://boredzo.org/blog/archives/2016-08-15/colorized-man-pages-understood-and-customized +man() { +        env \ +                LESS_TERMCAP_md=$(printf "\e[1;36m") \ +                LESS_TERMCAP_me=$(printf "\e[0m") \ +                LESS_TERMCAP_se=$(printf "\e[0m") \ +                LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ +                LESS_TERMCAP_ue=$(printf "\e[0m") \ +                LESS_TERMCAP_us=$(printf "\e[1;32m") \ +                man "$@" +} +``` + +我喜欢命令 `which`,但它只是告诉你正在运行的命令在文件系统中的位置,除非它是 Shell 函数才能告诉你更多。在多个级联的点文件之后,有时会不清楚函数的定义位置或作用。事实证明,`whence` 和 `type` 命令可以帮助解决这一问题。 + +``` +# 函数定义在哪里? +whichfunc() { +        whence -v $1 +        type -a $1 +} +``` + +(LCTT 译注:标题“Mine eyes have seen the glory of the coming of color” 演绎自歌曲 《Mine Eyes Have Seen The Glory Of The Coming Of The Lord》) + +### 总结 + +希望本文对你有所帮助,并能激发你找到改善日常使用 Shell 的方法。这些方法不必庞大、新颖或复杂。它们可能会解决一些微小但频繁的摩擦、创建捷径,甚至提供减少常见输入错误的解决方案。 + +欢迎你浏览我的 [dotfiles 存储库][7],但我要警示你,这样做可能会花费很多时间。请随意使用你认为有帮助的任何东西,并互相取长补短。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/shell-dotfile + +作者:[H.Waldo Grunenwald][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gwaldo +[1]: http://www.zsh.org/ +[2]: https://brew.sh/ +[3]: https://github.com/robbyrussell/oh-my-zsh +[4]: https://www.iterm2.com/ +[5]: https://twitter.com/climagic +[6]: https://github.com/graphite-project/ +[7]: https://github.com/gwaldo/dotfiles diff --git a/published/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md b/published/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md new file mode 100644 index 0000000000..f28180e516 --- /dev/null +++ b/published/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11420-1.html) +[#]: subject: (The Earliest Linux Distros: Before Mainstream Distros Became So Popular) +[#]: via: (https://itsfoss.com/earliest-linux-distros/) +[#]: author: (Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/) + +主流发行版之前的那些最早的 Linux 发行版 +====== + +> 在这篇回溯历史的文章中,我们尝试回顾一些最早的 Linux 发行版是如何演变的,并形成我们今天所知道的发行版的。 + +![][1] + +在这里,我们尝试探讨了第一个 Linux 内核问世后,诸如 Red Hat、Debian、Slackware、SUSE、Ubuntu 等诸多流行的发行版的想法是如何产生的。 + +随着 1991 年 Linux 最初以内核的形式发布,今天我们所知道的发行版在世界各地众多合作者的帮助下得以创建 shell、库、编译器和相关软件包,从而使其成为一个完整的操作系统。 + +### 1、第一个已知的“发行版”是由 HJ Lu 创建的 + +Linux 发行版这种方式可以追溯到 1992 年,当时可以用来访问 Linux 的第一个已知的类似发行版的工具是由 HJ Lu 发布的。它由两个 5.25 英寸软盘组成: + +![Linux 0.12 Boot and Root Disks | Photo Credit][2] + +* LINUX 0.12 BOOT DISK:“启动”磁盘用来先启动系统。 +* LINUX 0.12 ROOT DISK:第二个“根”磁盘,用于在启动后获取命令提示符以访问 Linux 文件系统。 + +要在硬盘上安装 LINUX 0.12,必须使用十六进制编辑器来编辑其主启动记录(MBR),这是一个非常复杂的过程,尤其是在那个时代。 + +> 感觉太怀旧了? +> +> 你可以[安装 cool-retro-term 应用程序][3],它可以为你提供 90 年代计算机的复古外观的 Linux 终端。 + +### 2、MCC Interim Linux + +![MCC Linux 0.99.14, 1993 | Image Credit][4] + +MCC Interim Linux 最初由英格兰曼彻斯特计算中心的 Owen Le Blanc 与 “LINUX 0.12” 同年发布,它是针对普通用户的第一个 Linux 发行版,它具有菜单驱动的安装程序和最终用户/编程工具。它也是以软盘集的形式,可以将其安装在系统上以提供基于文本的基本环境。 + +MCC Interim Linux 比 0.12 更加易于使用,并且在硬盘驱动器上的安装过程更加轻松和类似于现代方式。它不需要使用十六进制编辑器来编辑 MBR。 + +尽管它于 1992 年 2 月首次发布,但自当年 11 月以来也可以通过 FTP 下载。 + +### 3、TAMU Linux + +![TAMU Linux | Image Credit][5] + +TAMU Linux 由 Texas A&M 的 Aggies 与 Texas A&M Unix & Linux 用户组于 1992 年 5 月开发,被称为 TAMU 1.0A。它是第一个提供 X Window System 的 Linux 发行版,而不仅仅是基于文本的操作系统。 + +### 4、Softlanding Linux System (SLS) + +![SLS Linux 1.05, 1994 | Image Credit][6] + +他们的口号是“DOS 伞降的温柔救援”!SLS 由 Peter McDonald 于 1992 年 5 月发布。SLS 在其时代得到了广泛的使用和流行,并极大地推广了 Linux 的思想。但是由于开发人员决定更改发行版中的可执行格式,因此用户停止使用它。 + +当今社区最熟悉的许多流行发行版是通过 SLS 演变而成的。其中两个是: + +* Slackware:它是最早的 Linux 发行版之一,由 Patrick Volkerding 于 1993 年创建。Slackware 基于 SLS,是最早的 Linux 发行版之一。 +* Debian:由 Ian Murdock 发起,Debian 在从 SLS 模型继续发展之后于 1993 年发布。我们今天知道的非常流行的 Ubuntu 发行版基于 Debian。 + +### 5、Yggdrasil + +![LGX Yggdrasil Fall 1993 | Image Credit][7] + +Yggdrasil 于 1992 年 12 月发行,是第一个产生 Live Linux CD 想法的发行版。它是由 Yggdrasil 计算公司开发的,该公司由位于加利福尼亚州伯克利的 Adam J. Richter 创立。它可以在系统硬件上自动配置自身,即“即插即用”功能,这是当今非常普遍且众所周知的功能。Yggdrasil 后来的版本包括一个用于在 Linux 中运行任何专有 MS-DOS CD-ROM 驱动程序的黑科技。 + +![Yggdrasil’s Plug-and-Play Promo | Image Credit][8] + +他们的座右铭是“我们其余人的免费软件”。 + +### 6、Mandriva + +在 90 年代后期,有一个非常受欢迎的发行版 [Mandriva][9],该发行版于 1998 年首次发行,是通过将法国的 Mandrake Linux 发行版与巴西的 Conectiva Linux 发行版统一起来形成的。它的发布寿命为 18 个月,会对 Linux 和系统软件进行更新,并且每年都会发布基于桌面的更新。它还有带有 5 年支持的服务器版本。现在是 [Open Mandriva][10]。 + +如果你在 Linux 发行之初就用过更多的怀旧发行版,请在下面的评论中与我们分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/earliest-linux-distros/ + +作者:[Avimanyu Bandyopadhyay][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/avimanyu/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/earliest-linux-distros.png?resize=800%2C450&ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-0.12-Floppies.jpg?ssl=1 +[3]: https://itsfoss.com/cool-retro-term/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/MCC-Interim-Linux-0.99.14-1993.jpg?fit=800%2C600&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/TAMU-Linux.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/SLS-1.05-1994.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/LGX_Yggdrasil_CD_Fall_1993.jpg?fit=781%2C800&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Yggdrasil-Linux-Summer-1994.jpg?ssl=1 +[9]: https://en.wikipedia.org/wiki/Mandriva_Linux +[10]: https://www.openmandriva.org/ diff --git a/published/20190301 Guide to Install VMware Tools on Linux.md b/published/20190301 Guide to Install VMware Tools on Linux.md new file mode 100644 index 0000000000..e3d241592e --- /dev/null +++ b/published/20190301 Guide to Install VMware Tools on Linux.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (tomjlw) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11467-1.html) +[#]: subject: (Guide to Install VMware Tools on Linux) +[#]: via: (https://itsfoss.com/install-vmware-tools-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +在 Linux 上安装 VMware 工具 +====== + +> VMware 工具通过允许你共享剪贴板和文件夹以及其他东西来提升你的虚拟机体验。了解如何在 Ubuntu 和其它 Linux 发行版上安装 VMware 工具。 + +![如何在 Linux 上安装 VMware 工具][4] + +在先前的教程中,你学习了[在 Ubuntu 上安装 VMware 工作站][1]。你还可以通过安装 VMware 工具进一步提升你的虚拟机功能。 + +如果你已经在 VMware 上安装了一个访客机系统,你必须要注意 [VMware 工具][2]的要求 —— 尽管并不完全清楚到底有什么要求。 + +在本文中,我们将要强调 VMware 工具的重要性、所提供的特性,以及在 Ubuntu 和其它 Linux 发行版上安装 VMware 工具的方法。 + +### VMware 工具:概览及特性 + +![在 Ubuntu 上安装 VMware 工具][3] + +出于显而易见的理由,虚拟机(你的访客机系统)并不能做到与宿主机上的表现完全一致。在其性能和操作上会有特定的限制。那就是为什么引入 VMware 工具的原因。 + +VMware 工具以一种高效的形式在提升了其性能的同时,也可以帮助管理访客机系统。 + +#### VMware 工具到底负责什么? + +你大致知道它可以做什么,但让我们探讨一下细节: + +* 同步访客机系统与宿主机系统间的时间以简化操作 +* 提供从宿主机系统向访客机系统传递消息的能力。比如说,你可以复制文字到剪贴板,并将它轻松粘贴到你的访客机系统 +* 在访客机系统上启用声音 +* 提升访客机视频分辨率 +* 修正错误的网络速度数据 +* 减少不合适的色深 + +在访客机系统上安装了 VMware 工具会给它带来显著改变,但是它到底包含了什么特性才解锁或提升这些功能的呢?让我们来看看…… + +#### VMware 工具:核心特性细节 + +![用 VMware 工具在宿主机系统与访客机系统间共享剪切板][5] + +如果你不想知道它包含什么来启用这些功能的话,你可以跳过这部分。但是为了好奇的读者,让我们简短地讨论它一下: + +**VMware 设备驱动:** 它具体取决于操作系统。大多数主流操作系统都默认包含了设备驱动,因此你不必另外安装它。这主要涉及到内存控制驱动、鼠标驱动、音频驱动、网卡驱动、VGA 驱动以及其它。 + +**VMware 用户进程:** 这是这里真正有意思的地方。通过它你获得了在访客机和宿主机间复制粘贴和拖拽的能力。基本上,你可以从宿主机复制粘贴文本到虚拟机,反之亦然。 + +你同样也可以拖拽文件。此外,在你未安装 SVGA 驱动时它会启用鼠标指针的释放/锁定。 + +**VMware 工具生命周期管理:** 嗯,我们会在下面看看如何安装 VMware 工具,但是这个特性帮你在虚拟机中轻松安装/升级 VMware 工具。 + +**共享文件夹**:除了这些。VMware 工具同样允许你在访客机与宿主机系统间共享文件夹。 + +![使用 VMware 工具在访客机与宿机系统间共享文件][6] + +当然,它的效果同样取决于访客机系统。例如在 Windows 上你通过 Unity 模式运行虚拟机上的程序并从宿主机系统上操作它。 + +### 如何在 Ubuntu 和其它 Linux 发行版上安装 VMware 工具 + +**注意:** 对于 Linux 操作系统,你应该已经安装好了“Open VM 工具”,大多数情况下免除了额外安装 VMware 工具的需要。 + +大部分时候,当你安装了访客机系统时,如果操作系统支持 [Easy Install][7] 的话你会收到软件更新或弹窗告诉你要安装 VMware 工具。 + +Windows 和 Ubuntu 都支持 Easy Install。因此如果你使用 Windows 作为你的宿主机或尝试在 Ubuntu 上安装 VMware 工具,你应该会看到一个和弹窗消息差不多的选项来轻松安装 VMware 工具。这是它应该看起来的样子: + +![安装 VMware 工具的弹窗][8] + +这是搞定它最简便的办法。因此当你配置虚拟机时确保你有一个通畅的网络连接。 + +如果你没收到任何弹窗或者选项来轻松安装 VMware 工具。你需要手动安装它。以下是如何去做: + +1. 运行 VMware Workstation Player。 +2. 从菜单导航至 “Virtual Machine -> Install VMware tools”。如果你已经安装了它并想修复安装,你会看到 “Re-install VMware tools” 这一选项出现。 +3. 一旦你点击了,你就会看到一个虚拟 CD/DVD 挂载在访客机系统上。 +4. 打开该 CD/DVD,并复制粘贴那个 tar.gz 文件到任何你选择的区域并解压,这里我们选择“桌面”作为解压目的地。 + + ![][9] +5. 在解压后,运行终端并通过输入以下命令导航至里面的文件夹: + + ``` +cd Desktop/VMwareTools-10.3.2-9925305/vmware-tools-distrib +``` + + 你需要检查文件夹与路径名,这取决于版本与解压目的地,名字可能会改变。 + + ![][10] + + 用你的存储位置(如“下载”)替换“桌面”,如果你安装的也是 10.3.2 版本,其它的保持一样即可。 +6. 现在仅需输入以下命令开始安装: + + ``` +sudo ./vmware-install.pl -d +``` + + ![][11] + + 你会被询问密码以获得安装权限,输入密码然后应当一切都搞定了。 + +到此为止了,你搞定了。这系列步骤应当适用于几乎大部分基于 Ubuntu 的访客机系统。如果你想要在 Ubuntu 服务器上或其它系统安装 VMware 工具,步骤应该类似。 + +### 总结 + +在 Ubuntu Linux 上安装 VMware 工具应该挺简单。除了简单办法,我们也详述了手动安装的方法。如果你仍需帮助或者对安装有任何建议,在评论区评论让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-vmware-tools-linux + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[tomjlw](https://github.com/tomjlw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[2]: https://kb.vmware.com/s/article/340 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-downloading.jpg?fit=800%2C531&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/install-vmware-tools-linux.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-features.gif?resize=800%2C500&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-shared-folder.jpg?fit=800%2C660&ssl=1 +[7]: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/15.0/com.vmware.player.linux.using.doc/GUID-3F6B9D0E-6CFC-4627-B80B-9A68A5960F60.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools.jpg?fit=800%2C481&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-extraction.jpg?fit=800%2C564&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-folder.jpg?fit=800%2C487&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-installation-ubuntu.jpg?fit=800%2C492&ssl=1 diff --git a/published/20190320 Move your dotfiles to version control.md b/published/20190320 Move your dotfiles to version control.md new file mode 100644 index 0000000000..0b99773fa9 --- /dev/null +++ b/published/20190320 Move your dotfiles to version control.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11419-1.html) +[#]: subject: (Move your dotfiles to version control) +[#]: via: (https://opensource.com/article/19/3/move-your-dotfiles-version-control) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +把“点文件”放到版本控制中 +====== + +> 通过在 GitLab 或 GitHub 上分享你的点文件,可以在整个系统上备份或同步你的自定义配置。 + +![](https://img.linux.net.cn/data/attachment/album/201910/03/205222yzo1rbck6accccvo.jpg) + +通过隐藏文件集(称为点文件dotfile)来定制操作系统是个非常棒的想法。在这篇 [Shell 点文件可以为你做点什么][1]中,H. "Waldo" Grunenwald 详细介绍了为什么以及如何设置点文件的细节。现在让我们深入探讨分享它们的原因和方式。 + +### 什么是点文件? + +“点文件dotfile”是指我们计算机中四处漂泊的配置文件。这些文件通常在文件名的开头以 `.` 开头,例如 `.gitconfig`,并且操作系统通常在默认情况下将其隐藏。例如,当我在 MacOS 上使用 `ls -a` 时,它才会显示所有可爱的点文件,否则就不会显示这些点文件。 + +``` +dotfiles on master +➜ ls +README.md  Rakefile   bin       misc    profiles   zsh-custom + +dotfiles on master +➜ ls -a +.               .gitignore      .oh-my-zsh      README.md       zsh-custom +..              .gitmodules     .tmux           Rakefile +.gemrc          .global_ignore .vimrc           bin +.git            .gvimrc         .zlogin         misc +.gitconfig      .maid           .zshrc          profiles +``` + +如果看一下用于 Git 配置的 `.gitconfig`,我能看到大量的自定义配置。我设置了帐户信息、终端颜色首选项和大量别名,这些别名可以使我的命令行界面看起来就像我的一样。这是 `[alias]` 块的摘录: + +``` +87   # Show the diff between the latest commit and the current state +88   d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" +89 +90   # `git di $number` shows the diff between the state `$number` revisions ago and the current state +91   di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" +92 +93   # Pull in remote changes for the current repository and all its submodules +94   p = !"git pull; git submodule foreach git pull origin master" +95 +96   # Checkout a pull request from origin (of a github repository) +97   pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr" +``` + +由于我的 `.gitconfig` 有 200 多行的自定义设置,我无意于在我使用的每一台新计算机或系统上重写它,其他人肯定也不想这样。这是分享点文件变得越来越流行的原因之一,尤其是随着社交编码网站 GitHub 的兴起。正式提倡分享点文件的文章是 Zach Holman 在 2008 年发表的《[点文件意味着被复刻][2]》。其前提到今天依然如此:我想与我自己、与点文件新手,以及那些分享了他们的自定义配置从而教会了我很多知识的人分享它们。 + +### 分享点文件 + +我们中的许多人拥有多个系统,或者知道硬盘变化无常,因此我们希望备份我们精心策划的自定义设置。那么我们如何在环境之间同步这些精彩的文件? + +我最喜欢的答案是分布式版本控制,最好是可以为我处理繁重任务的服务。我经常使用 GitHub,随着我对 GitLab 的使用经验越来越丰富,我肯定会一如既往地继续喜欢它。任何一个这样的服务都是共享你的信息的理想场所。要自己设置的话可以这样做: + +1. 登录到你首选的基于 Git 的服务。 +2. 创建一个名为 `dotfiles` 的存储库。(将其设置为公开!分享即关爱。) +3. 将其克隆到你的本地环境。(你可能需要设置 Git 配置命令来克隆存储库。GitHub 和 GitLab 都会提示你需要运行的命令。) +4. 将你的点文件复制到该文件夹中。 +5. 将它们符号链接回到其目标文件夹(最常见的是 `$HOME`)。 +6. 将它们推送到远程存储库。 + +![](https://opensource.com/sites/default/files/uploads/gitlab-new-project.png) + +上面的步骤 4 是这项工作的关键,可能有些棘手。无论是使用脚本还是手动执行,工作流程都是从 `dotfiles` 文件夹符号链接到点文件的目标位置,以便对点文件的任何更新都可以轻松地推送到远程存储库。要对我的 `.gitconfig` 文件执行此操作,我要输入: + +``` +$ cd dotfiles/ +$ ln -nfs .gitconfig $HOME/.gitconfig +``` + +添加到符号链接命令的标志还具有其他一些用处: + +* `-s` 创建符号链接而不是硬链接。 +* `-f` 在发生错误时继续做其他符号链接(此处不需要,但在循环中很有用) +* `-n` 避免符号链接到一个符号链接文件(等同于其他版本的 `ln` 的 `-h` 标志) + +如果要更深入地研究可用参数,可以查看 IEEE 和开放小组的 [ln 规范][3]以及 [MacOS 10.14.3] [4] 上的版本。自从其他人的点文件中拉取出这些标志以来,我才发现了这些标志。 + +你还可以使用一些其他代码来简化更新,例如我从 [Brad Parbs][6] 复刻的 [Rakefile][5]。另外,你也可以像 Jeff Geerling [在其点文件中][7]那样,使它保持极其简单的状态。他使用[此 Ansible 剧本][8]对文件进行符号链接。这样使所有内容保持同步很容易:你可以从点文件的文件夹中进行 cron 作业或偶尔进行 `git push`。 + +### 简单旁注:什么不能分享 + +在继续之前,值得注意的是你不应该添加到共享的点文件存储库中的内容 —— 即使它以点开头。任何有安全风险的东西,例如 `.ssh/` 文件夹中的文件,都不是使用此方法分享的好选择。确保在在线发布配置文件之前仔细检查配置文件,并再三检查文件中没有 API 令牌。 + +### 我应该从哪里开始? + +如果你不熟悉 Git,那么我[有关 Git 术语的文章][9]和常用命令[备忘清单][10]将会帮助你继续前进。 + +还有其他超棒的资源可帮助你开始使用点文件。多年前,我就发现了 [dotfiles.github.io][11],并继续使用它来更广泛地了解人们在做什么。在其他人的点文件中隐藏了许多秘传知识。花时间浏览一些,大胆地将它们添加到自己的内容中。 + +我希望这是让你在计算机上拥有一致的点文件的快乐开端。 + +你最喜欢的点文件技巧是什么?添加评论或在 Twitter 上找我 [@mbbroberg][12]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/move-your-dotfiles-version-control + +作者:[Matthew Broberg][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://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11417-1.html +[2]: https://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/ +[3]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ln.html +[4]: https://www.unix.com/man-page/FreeBSD/1/ln/ +[5]: https://github.com/mbbroberg/dotfiles/blob/master/Rakefile +[6]: https://github.com/bradp/dotfiles +[7]: https://github.com/geerlingguy/dotfiles +[8]: https://github.com/geerlingguy/mac-dev-playbook +[9]: https://opensource.com/article/19/2/git-terminology +[10]: https://opensource.com/downloads/cheat-sheet-git +[11]: http://dotfiles.github.io/ +[12]: https://twitter.com/mbbroberg?lang=en diff --git a/published/20190404 How writers can get work done better with Git.md b/published/20190404 How writers can get work done better with Git.md new file mode 100644 index 0000000000..125f925fef --- /dev/null +++ b/published/20190404 How writers can get work done better with Git.md @@ -0,0 +1,261 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11499-1.html) +[#]: subject: (How writers can get work done better with Git) +[#]: via: (https://opensource.com/article/19/4/write-git) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/noreplyhttps://opensource.com/users/seth) + +用 Git 帮助写作者更好地完成工作 +====== + +> 如果你是一名写作者,你也能从使用 Git 中受益。在我们的系列文章中了解有关 Git 鲜为人知的用法。 + +![](https://img.linux.net.cn/data/attachment/album/201910/24/222747ltajik2ymzmmttha.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天我们来看看写作者如何使用 Git 更好的地完成工作。 + +### 写作者的 Git + +有些人写小说,也有人撰写学术论文、诗歌、剧本、技术手册或有关开源的文章。许多人都在做一些各种写作。相同的是,如果你是一名写作者,或许能从使用 Git 中受益。尽管 Git 是著名的计算机程序员所使用的高度技术性工具,但它也是现代写作者的理想之选,本文将向你演示如何改变你的书写方式以及为什么要这么做的原因。 + +但是,在谈论 Git 之前,重要的是先谈谈“副本”(或者叫“内容”,对于数字时代而言)到底是什么,以及为什么它与你的交付*媒介*不同。这是 21 世纪,大多数写作者选择的工具是计算机。尽管计算机看似擅长将副本的编辑和布局等过程结合在一起,但写作者还是(重新)发现将内容与样式分开是一个好主意。这意味着你应该在计算机上像在打字机上而不是在文字处理器中进行书写。以计算机术语而言,这意味着以*纯文本*形式写作。 + +### 以纯文本写作 + +这个假设曾经是毫无疑问的:你知道自己的写作所要针对的市场,你可以为书籍、网站或软件手册等不同市场编写内容。但是,近来各种市场趋于扁平化:你可能决定在纸质书中使用为网站编写的内容,并且纸质书可能会在以后发布 EPUB 版本。对于你的内容的数字版本,读者才是最终控制者:他们可以在你发布内容的网站上阅读你的文字,也可以点击 Firefox 出色的[阅读视图][3],还可能会打印到纸张上,或者可能会使用 Lynx 将网页转储到文本文件中,甚至可能因为使用屏幕阅读器而根本看不到你的内容。 + +你只需要逐字写下你的内容,而将交付工作留给发布者。即使你是自己发布,将字词作为写作作品的一种源代码也是一种更聪明、更有效的工作方式,因为在发布时,你可以使用相同的源(你的纯文本)生成适合你的目标输出(用于打印的 PDF、用于电子书的 EPUB、用于网站的 HTML 等)。 + +用纯文本编写不仅意味着你不必担心布局或文本样式,而且也不再需要专门的工具。无论是手机或平板电脑上的基本的记事本应用程序、计算机附带的文本编辑器,还是从互联网上下载的免费编辑器,任何能够产生文本内容的工具对你而言都是有效的“文字处理器”。无论你身在何处或在做什么,几乎可以在任何设备上书写,并且所生成的文本可以与你的项目完美集成,而无需进行任何修改。 + +而且,Git 专门用来管理纯文本。 + +### Atom 编辑器 + +当你以纯文本形式书写时,文字处理程序会显得过于庞大。使用文本编辑器更容易,因为文本编辑器不会尝试“有效地”重组输入内容。它使你可以将脑海中的单词输入到屏幕中,而不会受到干扰。更好的是,文本编辑器通常是围绕插件体系结构设计的,这样应用程序本身很基础(它用来编辑文本),但是你可以围绕它构建一个环境来满足你的各种需求。 + +[Atom][4] 编辑器就是这种设计理念的一个很好的例子。这是一个具有内置 Git 集成的跨平台文本编辑器。如果你不熟悉纯文本格式,也不熟悉 Git,那么 Atom 是最简单的入门方法。 + +#### 安装 Git 和 Atom + +首先,请确保你的系统上已安装 Git。如果运行 Linux 或 BSD,则 Git 在软件存储库或 ports 树中可用。你使用的命令将根据你的发行版而有所不同。例如在 Fedora 上: + +``` +$ sudo dnf install git +``` + +你也可以下载并安装适用于 [Mac][5] 和 [Windows][6] 的 Git。 + +你不需要直接使用 Git,因为 Atom 会充当你的 Git 界面。下一步是安装 Atom。 + +如果你使用的是 Linux,请通过软件安装程序或适当的命令从软件存储库中安装 Atom,例如: + +``` +$ sudo dnf install atom +``` + +Atom 当前没有在 BSD 上构建。但是,有很好的替代方法,例如 [GNU Emacs][7]。对于 Mac 和 Windows 用户,可以在 [Atom 网站][4]上找到安装程序。 + +安装完成后,启动 Atom 编辑器。 + +#### 快速指导 + +如果要使用纯文本和 Git,则需要适应你的编辑器。Atom 的用户界面可能比你习惯的更加动态。实际上,你可以将它视为 Firefox 或 Chrome,而不是文字处理程序,因为它具有可以根据需要打开或关闭的选项卡和面板,甚至还可以安装和配置附件。尝试全部掌握 Atom 如许之多的功能是不切实际的,但是你至少可以知道有什么功能。 + +当打开 Atom 时,它将显示一个欢迎屏幕。如果不出意外,此屏幕很好地介绍了 Atom 的选项卡式界面。你可以通过单击 Atom 窗口顶部选项卡上的“关闭”图标来关闭欢迎屏幕,并使用“文件 > 新建文件”创建一个新文件。 + +使用纯文本格式与使用文字处理程序有点不同,因此这里有一些技巧,以人可以理解的方式编写内容,并且 Git 和计算机可以解析,跟踪和转换。 + +#### 用 Markdown 书写 + +如今,当人们谈论纯文本时,大多是指 Markdown。Markdown 与其说是格式,不如说是样式,这意味着它旨在为文本提供可预测的结构,以便计算机可以检测自然的模式并智能地转换文本。Markdown 有很多定义,但是最好的技术定义和备忘清单在 [CommonMark 的网站][8]上。 + +``` +# Chapter 1 + +This is a paragraph with an *italic* word and a **bold** word in it. +And it can even reference an image. + +![An image will render here.](drawing.jpg) +``` + +从示例中可以看出,Markdown 读起来感觉不像代码,但可以将其视为代码。如果你遵循 CommonMark 定义的 Markdown 规范,那么一键就可以可靠地将 Markdown 的文字转换为 .docx、.epub、.html、MediaWiki、.odt、.pdf、.rtf 和各种其他的格式,而*不会*失去格式。 + +你可以认为 Markdown 有点像文字处理程序的样式。如果你曾经为出版社撰写过一套样式来控制章节标题及其样式,那基本上就是一回事,除了不是从下拉菜单中选择样式以外,你需要给你的文字添加一些小记号。对于任何习惯“以文字交谈”的现代阅读者来说,这些表示法都是很自然的,但是在呈现文本时,它们会被精美的文本样式替换掉。实际上,这就是文字处理程序在后台秘密进行的操作。文字处理器显示粗体文本,但是如果你可以看到使文本变为粗体的生成代码,则它与 Markdown 很像(实际上,它是更复杂的 XML)。使用 Markdown 可以消除这种代码和样式之间的阻隔,一方面看起来更可怕一些,但另一方面,你可以在几乎所有可以生成文本的东西上书写 Markdown 而不会丢失任何格式信息。 + +Markdown 文件流行的文件扩展名是 .md。如果你使用的平台不知道 .md 文件是什么,则可以手动将该扩展名与 Atom 关联,或者仅使用通用的 .txt 扩展名。文件扩展名不会更改文件的性质。它只会改变你的计算机决定如何处理它的方式。Atom 和某些平台足够聪明,可以知道该文件是纯文本格式,无论你给它以什么扩展名。 + +#### 实时预览 + +Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编写的纯文本 Markdown 及其(通常)呈现的方式。 + +![Atom's preview screen][9] + +要激活此预览窗格,请选择“包 > Markdown 预览 > 切换预览” 或按 `Ctrl + Shift + M`。 + +此视图为你提供了两全其美的方法。无需承担为你的文本添加样式的负担就可以写作,而你也可以看到一个通用的示例外观,至少是以典型的数字化格式显示文本的外观。当然,关键是你无法控制文本的最终呈现方式,因此不要试图调整 Markdown 来强制以某种方式显示呈现的预览。 + +#### 每行一句话 + +你的高中写作老师不会看你的 Markdown。 + +一开始它不那么自然,但是在数字世界中,保持每行一个句子更有意义。Markdown 会忽略单个换行符(当你按下 `Return` 或 `Enter` 键时),并且只在单个空行之后才会创建一个新段落。 + +![Writing in Atom][10] + +每行写一个句子的好处是你的工作更容易跟踪。也就是说,假如你在段落的开头更改了一个单词,如果更改仅限于一行而不是一个长的段落中的一个单词,那么 Atom、Git 或任何应用程序很容易以有意义的方式突出显示该更改。换句话说,对一个句子的更改只会影响该句子,而不会影响整个段落。 + +你可能会想:“许多文字处理器也可以跟踪更改,它们可以突出显示已更改的单个单词。”但是这些修订跟踪器绑定在该字处理器的界面上,这意味着你必须先打开该字处理器才能浏览修订。在纯文本工作流程中,你可以以纯文本形式查看修订,这意味着无论手头有什么,只要该设备可以处理纯文本(大多数都可以),就可以进行编辑或批准编辑。 + +诚然,写作者通常不会考虑行号,但它对于计算机有用,并且通常是一个很好的参考点。默认情况下,Atom 为文本文档的行进行编号。按下 `Enter` 键或 `Return` 键后,一*行*就是一行。 + +![Writing in Atom][11] + +如果(在 Atom 的)一行的行号中有一个点而不是一个数字,则表示它是上一行折叠的一部分,因为它超出了你的屏幕。 + +#### 主题 + +如果你是一个在意视觉形象的人,那么你可能会非常注重自己的写作环境。即使你使用普通的 Markdown 进行编写,也并不意味着你必须使用程序员的字体或在使你看起来像码农的黑窗口中进行书写。修改 Atom 外观的最简单方法是使用[主题包][12]。主题设计人员通常将深色主题与浅色主题区分开,因此你可以根据需要使用关键字“Dark”或“Light”进行搜索。 + +要安装主题,请选择“编辑 > 首选项”。这将在 Atom 界面中打开一个新标签页。是的,标签页可以用于处理文档*和*用于配置及控制面板。在“设置”标签页中,单击“安装”类别。 + +在“安装”面板中,搜索要安装的主题的名称。单击搜索字段右侧的“主题”按钮,以仅搜索主题。找到主题后,单击其“安装”按钮。 + +![Atom's themes][13] + +要使用已安装的主题或根据喜好自定义主题,请导航至“设置”标签页中的“主题”类别中。从下拉菜单中选择要使用的主题。更改会立即进行,因此你可以准确了解主题如何影响你的环境。 + +你也可以在“设置”标签的“编辑器”类别中更改工作字体。Atom 默认采用等宽字体,程序员通常首选这种字体。但是你可以使用系统上的任何字体,无论是衬线字体、无衬线字体、哥特式字体还是草书字体。无论你想整天盯着什么字体都行。 + +作为相关说明,默认情况下,Atom 会在其屏幕上绘制一条垂直线,以提示编写代码的人员。程序员通常不想编写太长的代码行,因此这条垂直线会提醒他们不要写太长的代码行。不过,这条竖线对写作者而言毫无意义,你可以通过禁用 “wrap-guide” 包将其删除。 + +要禁用 “wrap-guide” 软件包,请在“设置”标签中选择“折行”类别,然后搜索 “wrap-guide”。找到该程序包后,单击其“禁用”按钮。 + +#### 动态结构 + +创建长文档时,我发现每个文件写一个章节比在一个文件中写整本书更有意义。此外,我不会以明显的语法 ` chapter-1.md` 或 `1.example.md` 来命名我的章节,而是以章节标题或关键词(例如 `example.md`)命名。为了将来为自己提供有关如何编写本书的指导,我维护了一个名为 `toc.md` (用于“目录”)的文件,其中列出了各章的(当前)顺序。 + +我这样做是因为,无论我多么相信第 6 章都不可能出现在第 1 章之前,但在我完成整本书之前,几乎难以避免我会交换一两个章节的顺序。我发现从一开始就保持动态变化可以帮助我避免重命名混乱,也可以帮助我避免僵化的结构。 + +### 在 Atom 中使用 Git + +每位写作者的共同点是两件事:他们为流传而写作,而他们的写作是一段旅程。你不能一坐下来写作就完成了最终稿件。顾名思义,你有一个初稿。该草稿会经过修订,你会仔细地将每个修订保存一式两份或三份的备份,以防万一你的文件损坏了。最终,你得到了所谓的最终草稿,但很有可能你有一天还会回到这份最终草稿,要么恢复好的部分,要么修改坏的部分。 + +Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom,你就可以与 Git 的所有主要功能进行交互,跟踪和更新项目、回滚你不喜欢的更改、集成来自协作者的更改等等。最好的学习方法就是逐步学习,因此这是在一个写作项目中从始至终在 Atom 界面中使用 Git 的方法。 + +第一件事:通过选择 “视图 > 切换 Git 标签页” 来显示 Git 面板。这将在 Atom 界面的右侧打开一个新标签页。现在没什么可看的,所以暂时保持打开状态就行。 + +#### 建立一个 Git 项目 + +你可以认为 Git 被绑定到一个文件夹。Git 目录之外的任何文件夹都不知道 Git,而 Git 也不知道外面。Git 目录中的文件夹和文件将被忽略,直到你授予 Git 权限来跟踪它们为止。 + +你可以通过在 Atom 中创建新的项目文件夹来创建 Git 项目。选择 “文件 > 添加项目文件夹”,然后在系统上创建一个新文件夹。你创建的文件夹将出现在 Atom 窗口的左侧“项目面板”中。 + +#### Git 添加文件 + +右键单击你的新项目文件夹,然后选择“新建文件”以在项目文件夹中创建一个新文件。如果你要导入文件到新项目中,请右键单击该文件夹,然后选择“在文件管理器中显示”,以在系统的文件查看器中打开该文件夹(Linux 上为 Dolphin 或 Nautilus,Mac 上为 Finder,在 Windows 上是 Explorer),然后拖放文件到你的项目文件夹。 + +在 Atom 中打开一个项目文件(你创建的空文件或导入的文件)后,单击 Git 标签中的 “创建存储库Create Repository” 按钮。在弹出的对话框中,单击 “初始化Init” 以将你的项目目录初始化为本地 Git 存储库。 Git 会将 `.git` 目录(在系统的文件管理器中不可见,但在 Atom 中可见)添加到项目文件夹中。不要被这个愚弄了:`.git` 目录是 Git 管理的,而不是由你管理的,因此一般你不要动它。但是在 Atom 中看到它可以很好地提醒你正在由 Git 管理的项目中工作。换句话说,当你看到 `.git` 目录时,就有了修订历史记录。 + +在你的空文件中,写一些东西。你是写作者,所以输入一些单词就行。你可以随意输入任何一组单词,但要记住上面的写作技巧。 + +按 `Ctrl + S` 保存文件,该文件将显示在 Git 标签的 “未暂存的改变Unstaged Changes” 部分中。这意味着该文件存在于你的项目文件夹中,但尚未提交给 Git 管理。通过单击 Git 选项卡右上方的 “暂存全部Stage All” 按钮,以允许 Git 跟踪这些文件。如果你使用过带有修订历史记录的文字处理器,则可以将此步骤视为允许 Git 记录更改。 + +#### Git 提交 + +你的文件现在已暂存。这意味着 Git 知道该文件存在,并且知道自上次 Git 知道该文件以来,该文件已被更改。 + +Git 的提交commit会将你的文件发送到 Git 的内部和永久存档中。如果你习惯于文字处理程序,这就类似于给一个修订版命名。要创建一个提交,请在 Git 选项卡底部的“提交Commit”消息框中输入一些描述性文本。你可能会感到含糊不清或随意写点什么,但如果你想在将来知道进行修订的原因,那么输入一些有用的信息会更有用。 + +第一次提交时,必须创建一个分支branch。Git 分支有点像另外一个空间,它允许你从一个时间轴切换到另一个时间轴,以进行你可能想要也可能不想要永久保留的更改。如果最终喜欢该更改,则可以将一个实验分支合并到另一个实验分支,从而统一项目的不同版本。这是一个高级过程,不需要先学会,但是你仍然需要一个活动分支,因此你必须为首次提交创建一个分支。 + +单击 Git 选项卡最底部的“分支Branch”图标,以创建新的分支。 + +![Creating a branch][14] + +通常将第一个分支命名为 `master`,但不是必须如此;你可以将其命名为 `firstdraft` 或任何你喜欢的名称,但是遵守当地习俗有时会使谈论 Git(和查找问题的答案)变得容易一些,因为你会知道有人提到 “master” 时,它们的真正意思是“主干”而不是“初稿”或你给分支起的什么名字。 + +在某些版本的 Atom 上,UI 也许不会更新以反映你已经创建的新分支。不用担心,做了提交之后,它会创建分支(并更新 UI)。按下 “提交Commit” 按钮,无论它显示的是 “创建脱离的提交Create detached commit” 还是 “提交到主干Commit to master。 + +提交后,文件的状态将永久保留在 Git 的记忆之中。 + +#### 历史记录和 Git 差异 + +一个自然而然的问题是你应该多久做一次提交。这并没有正确的答案。使用 `Ctrl + S` 保存文件和提交到 Git 是两个单独的过程,因此你会一直做这两个过程。每当你觉得自己已经做了重要的事情或打算尝试一个可能会被干掉的疯狂的新想法时,你可能都会想要做次提交。 + +要了解提交对工作流程的影响,请从测试文档中删除一些文本,然后在顶部和底部添加一些文本。再次提交。 这样做几次,直到你在 Git 标签的底部有了一小段历史记录,然后单击其中一个提交以在 Atom 中查看它。 + +![Viewing differences][15] + +查看过去的提交时,你会看到三种元素: + +1. 绿色文本是该提交中已被添加到文档中的内容。 +2. 红色文本是该提交中已从文档中删除的内容。 +3. 其他所有文字均未做更改。 + +#### 远程备份 + +使用 Git 的优点之一是,按照设计它是分布式的,这意味着你可以将工作提交到本地存储库,并将所做的更改推送到任意数量的服务器上进行备份。你还可以从这些服务器中拉取更改,以便你碰巧正在使用的任何设备始终具有最新更改。 + +为此,你必须在 Git 服务器上拥有一个帐户。有几种免费的托管服务,其中包括 GitHub,这个公司开发了 Atom,但奇怪的是 GitHub 不是开源的;而 GitLab 是开源的。相比私有软件,我更喜欢开源,在本示例中,我将使用 GitLab。 + +如果你还没有 GitLab 帐户,请注册一个帐户并开始一个新项目。项目名称不必与 Atom 中的项目文件夹匹配,但是如果匹配,则可能更有意义。你可以将项目保留为私有,在这种情况下,只有你和任何一个你给予了明确权限的人可以访问它,或者,如果你希望该项目可供任何互联网上偶然发现它的人使用,则可以将其公开。 + +不要将 README 文件添加到项目中。 + +创建项目后,它将为你提供有关如何设置存储库的说明。如果你决定在终端中或通过单独的 GUI 使用 Git,这是非常有用的信息,但是 Atom 的工作流程则有所不同。 + +单击 GitLab 界面右上方的 “克隆Clone” 按钮。这显示了访问 Git 存储库必须使用的地址。复制 “SSH” 地址(而不是 “https” 地址)。 + +在 Atom 中,点击项目的 `.git` 目录,然后打开 `config` 文件。将下面这些配置行添加到该文件中,调整 `url` 值的 `seth/example.git` 部分以匹配你自己独有的地址。 + +``` +[remote "origin"] + url = git@gitlab.com:seth/example.git + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +``` + +在 Git 标签的底部,出现了一个新按钮,标记为 “提取Fetch”。由于你的服务器是全新的服务器,因此没有可供你提取的数据,因此请右键单击该按钮,然后选择“推送Push”。这会将你的更改推送到你的 GitLab 帐户,现在你的项目已备份到 Git 服务器上。 + +你可以在每次提交后将更改推送到服务器。它提供了即刻的异地备份,并且由于数据量通常很少,因此它几乎与本地保存一样快。 + +### 撰写而 Git + +Git 是一个复杂的系统,不仅对修订跟踪和备份有用。它还支持异步协作并鼓励实验。本文介绍了一些基础知识,但还有更多关于 Git 的文章和整本的书,以及如何使用它使你的工作更高效、更具弹性和更具活力。 从使用 Git 完成小任务开始,使用的次数越多,你会发现自己提出的问题就越多,最终你将学到的技巧越多。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/write-git + +作者:[Seth Kenlon][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://opensource.com/users/sethhttps://opensource.com/users/noreplyhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/write-hand_0.jpg?itok=Uw5RJD03 (Writing Hand) +[2]: https://git-scm.com/ +[3]: https://support.mozilla.org/en-US/kb/firefox-reader-view-clutter-free-web-pages +[4]: http://atom.io +[5]: https://git-scm.com/download/mac +[6]: https://git-scm.com/download/win +[7]: http://gnu.org/software/emacs +[8]: https://commonmark.org/help/ +[9]: https://opensource.com/sites/default/files/uploads/atom-preview.jpg (Atom's preview screen) +[10]: https://opensource.com/sites/default/files/uploads/atom-para.jpg (Writing in Atom) +[11]: https://opensource.com/sites/default/files/uploads/atom-linebreak.jpg (Writing in Atom) +[12]: https://atom.io/themes +[13]: https://opensource.com/sites/default/files/uploads/atom-theme.jpg (Atom's themes) +[14]: https://opensource.com/sites/default/files/uploads/atom-branch.jpg (Creating a branch) +[15]: https://opensource.com/sites/default/files/uploads/git-diff.jpg (Viewing differences) +[16]: mailto:git@gitlab.com diff --git a/published/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md b/published/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md new file mode 100644 index 0000000000..5b3be0ba08 --- /dev/null +++ b/published/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11461-1.html) +[#]: subject: (Blockchain 2.0 – Introduction To Hyperledger Fabric [Part 10]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-introduction-to-hyperledger-fabric/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +区块链 2.0:Hyperledger Fabric 介绍(十) +====== + +![Hyperledger Fabric][1] + +### Hyperledger Fabric + +[Hyperledger 项目][2] 是一个伞形组织,包括许多正在开发的不同模块和系统。在这些子项目中,最受欢迎的是 “Hyperledger Fabric”。这篇博文将探讨一旦区块链系统开始大量使用到主流,将使 Fabric 在不久的将来成为几乎不可或缺的功能。最后,我们还将快速了解开发人员和爱好者们需要了解的有关 Hyperledger Fabric 技术的知识。 + +### 起源 + +按照 Hyperledger 项目的常规方式,Fabric 由其核心成员之一 IBM “捐赠”给该组织,而 IBM 以前是该组织的主要开发者。由 IBM 共享的这个技术平台在 Hyperledger 项目中进行了联合开发,来自 100 多个成员公司和机构为之做出了贡献。 + +目前,Fabric 正处于 LTS 版本的 v1.4,该版本已经发展很长一段时间,并且被视为企业管理业务数据的解决方案。Hyperledger 项目的核心愿景也必然会渗透到 Fabric 中。Hyperledger Fabric 系统继承了所有企业级的可扩展功能,这些功能已深深地刻入到 Hyperledger 组织旗下所有的项目当中。 + +### Hyperledger Fabric 的亮点 + +Hyperledger Fabric 提供了多种功能和标准,这些功能和标准围绕着支持快速开发和模块化体系结构的使命而构建。此外,与竞争对手(主要是瑞波和[以太坊][3])相比,Fabric 明确用于封闭和[许可区块链][4]。它们的核心目标是开发一套工具,这些工具将帮助区块链开发人员创建定制的解决方案,而不是创建独立的生态系统或产品。 + +Hyperledger Fabric 的一些亮点如下: + +#### 许可区块链系统 + +这是一个 Hyperledger Fabric 与其他平台(如以太坊和瑞波)差异很大的地方。默认情况下,Fabric 是一种旨在实现私有许可的区块链的工具。此类区块链不能被所有人访问,并且其中致力于达成共识或验证交易的节点将由中央机构进行选择。这对于某些应用(例如银行和保险)可能很重要,在这些应用中,交易必须由中央机构而不是参与者来验证。 + +#### 机密和受控的信息流 + +Fabric 内置了权限系统,该权限系统将视情况限制特定组或某些个人中的信息流。与公有区块链不同,在公有区块链中,任何运行节点的人都可以对存储在区块链中的数据进行复制和选择性访问,而 Fabric 系统的管理员可以选择谁能访问共享的信息,以及访问的方式。与现有竞争产品相比,它还有以更好的安全性标准对存储的数据进行加密的子系统。 + +#### 即插即用架构 + +Hyperledger Fabric 具有即插即用类型的体系结构。可以选择实施系统的各个组件,而开发人员看不到用处的系统组件可能会被废弃。Fabric 采取高度模块化和可定制的方式进行开发,而不是一种与其竞争对手采用的“一种方法适应所有需求”的方式。对于希望快速构建精益系统的公司和公司而言,这尤其有吸引力。这与 Fabric 和其它 Hyperledger 组件的互操作性相结合,意味着开发人员和设计人员现在可以使用各种标准化工具,而不必从其他来源提取代码并随后进行集成。它还提供了一种相当可靠的方式来构建健壮的模块化系统。 + +#### 智能合约和链码 + +运行在区块链上的分布式应用程序称为[智能合约][5]。虽然智能合约这个术语或多或少与以太坊平台相关联,但链码chaincode是 Hyperledger 阵营中为其赋予的名称。链码应用程序除了拥有 DApp 中有的所有优点之外,使 Hyperledger 与众不同的是,该应用程序的代码可以用多种高级编程语言编写。它本身支持 [Go][6] 和 JavaScript,并且在与适当的编译器模块集成后还支持许多其它编程语言。尽管这一事实在此时可能并不代表什么,但这意味着,如果可以将现有人才用于正在进行的涉及区块链的项目,从长远来看,这有可能为公司节省数十亿美元的人员培训和管理费用。开发人员可以使用自己喜欢的语言进行编码,从而在 Hyperledger Fabric 上开始构建应用程序,而无需学习或培训平台特定的语言和语法。这提供了 Hyperledger Fabric 当前竞争对手无法提供的灵活性。 + +### 总结 + +* Hyperledger Fabric 是一个后端驱动程序平台,是一个主要针对需要区块链或其它分布式账本技术的集成项目。因此,除了次要的脚本功能外,它不提供任何面向用户的服务。(认可以为​​它更像是一种脚本语言。) +* Hyperledger Fabric 支持针对特定用例构建侧链。如果开发人员希望将一组用户或参与者隔离到应用程序的特定部分或功能,则可以通过侧链来实现。侧链是衍生自主要父代的区块链,但在其初始块之后形成不同的链。产生新链的块将不受新链进一步变化的影响,即使将新信息添加到原始链中,新链也将保持不变。此功能将有助于扩展正在开发的平台,并引入用户特定的和案例特定的处理功能。 +* 前面的功能还意味着并非所有用户都会像通常对公有链所期望的那样拥有区块链中所有数据的“精确”副本。参与节点将具有仅与之相关的数据副本。例如,假设有一个类似于印度的 PayTM 的应用程序,该应用程序具有钱包功能以及电子商务功能。但是,并非所有的钱包用户都使用 PayTM 在线购物。在这种情况下,只有活跃的购物者将在 PayTM 电子商务网站上拥有相应的交易链,而钱包用户将仅拥有存储钱包交易的链的副本。这种灵活的数据存储和检索体系结构在扩展时非常重要,因为大量的单链区块链已经显示出会增加处理交易的前置时间。这样可以保持链的精简和分类。 + +我们将在以后的文章中详细介绍 Hyperledger Project 下的其他模块。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-introduction-to-hyperledger-fabric/ + +作者:[sk][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/05/Hyperledger-Fabric-720x340.png +[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ +[3]: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ +[4]: https://www.ostechnix.com/blockchain-2-0-public-vs-private-blockchain-comparison/ +[5]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ +[6]: https://www.ostechnix.com/install-go-language-linux/ diff --git a/published/20190614 What is a Java constructor.md b/published/20190614 What is a Java constructor.md new file mode 100644 index 0000000000..62d40ceeeb --- /dev/null +++ b/published/20190614 What is a Java constructor.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11478-1.html) +[#]: subject: (What is a Java constructor?) +[#]: via: (https://opensource.com/article/19/6/what-java-constructor) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +什么是 Java 构造器? +====== + +> 构造器是编程的强大组件。使用它们来释放 Java 的全部潜力。 + +![](https://img.linux.net.cn/data/attachment/album/201910/18/230523hdx7sy804xdtxybb.jpg) + +在开源、跨平台编程领域,Java 无疑(?)是无可争议的重量级语言。尽管有许多[伟大的跨平台][2][框架][3],但很少有像 [Java][4] 那样统一和直接的。 + +当然,Java 也是一种非常复杂的语言,具有自己的微妙之处和惯例。Java 中与构造器 constructor有关的最常见问题之一是:它们是什么,它们的作用是什么? + +简而言之:构造器是在 Java 中创建新对象object时执行的操作。当 Java 应用程序创建一个你编写的类的实例时,它将检查构造器。如果(该类)存在构造器,则 Java 在创建实例时将运行构造器中的代码。这几句话中包含了大量的技术术语,但是当你看到它的实际应用时就会更加清楚,所以请确保你已经[安装了 Java][5] 并准备好进行演示。 + +### 没有使用构造器的开发日常 + +如果你正在编写 Java 代码,那么你已经在使用构造器了,即使你可能不知道它。Java 中的所有类都有一个构造器,因为即使你没有创建构造器,Java 也会在编译代码时为你生成一个。但是,为了进行演示,请忽略 Java 提供的隐藏构造器(因为默认构造器不添加任何额外的功能),并观察没有显式构造器的情况。 + +假设你正在编写一个简单的 Java 掷骰子应用程序,因为你想为游戏生成一个伪随机数。 + +首先,你可以创建骰子类来表示一个骰子。你玩了很久[《龙与地下城》][6],所以你决定创建一个 20 面的骰子。在这个示例代码中,变量 `dice` 是整数 20,表示可能的最大掷骰数(一个 20 边骰子的掷骰数不能超过 20)。变量 `roll` 是最终的随机数的占位符,`rand` 用作随机数种子。 + +``` +import java.util.Random; + +public class DiceRoller { + private int dice = 20; + private int roll; + private Random rand = new Random(); +``` + +接下来,在 `DiceRoller` 类中创建一个函数,以执行计算机模拟模子滚动所必须采取的步骤:从 `rand` 中获取一个整数并将其分配给 `roll`变量,考虑到 Java 从 0 开始计数但 20 面的骰子没有 0 值的情况,`roll` 再加 1 ,然后打印结果。 + +``` +import java.util.Random; + +public class DiceRoller { + private int dice = 20; + private int roll; + private Random rand = new Random(); +``` + +最后,产生 `DiceRoller` 类的实例并调用其关键函数 `Roller`: + +``` +// main loop +public static void main (String[] args) { + System.out.printf("You rolled a "); + + DiceRoller App = new DiceRoller(); + App.Roller(); + } +} +``` + +只要你安装了 Java 开发环境(如 [OpenJDK][10]),你就可以在终端上运行你的应用程序: + +``` +$ java dice.java +You rolled a 12 +``` + +在本例中,没有显式构造器。这是一个非常有效和合法的 Java 应用程序,但是它有一点局限性。例如,如果你把游戏《龙与地下城》放在一边,晚上去玩一些《快艇骰子》,你将需要六面骰子。在这个简单的例子中,更改代码不会有太多的麻烦,但是在复杂的代码中这不是一个现实的选择。解决这个问题的一种方法是使用构造器。 + +### 构造函数的作用 + +这个示例项目中的 `DiceRoller` 类表示一个虚拟骰子工厂:当它被调用时,它创建一个虚拟骰子,然后进行“滚动”。然而,通过编写一个自定义构造器,你可以让掷骰子的应用程序询问你希望模拟哪种类型的骰子。 + +大部分代码都是一样的,除了构造器接受一个表示面数的数字参数。这个数字还不存在,但稍后将创建它。 + +``` +import java.util.Random; + +public class DiceRoller { + private int dice; + private int roll; + private Random rand = new Random(); + + // constructor + public DiceRoller(int sides) { + dice = sides; + } +``` + +模拟滚动的函数保持不变: + +``` +public void Roller() { + roll = rand.nextInt(dice); + roll += 1; + System.out.println (roll); +} +``` + +代码的主要部分提供运行应用程序时提供的任何参数。这的确会是一个复杂的应用程序,你需要仔细解析参数并检查意外结果,但对于这个例子,唯一的预防措施是将参数字符串转换成整数类型。 + +``` +public static void main (String[] args) { + System.out.printf("You rolled a "); + DiceRoller App = new DiceRoller( Integer.parseInt(args[0]) ); + App.Roller(); +} +``` + +启动这个应用程序,并提供你希望骰子具有的面数: + +``` +$ java dice.java 20 +You rolled a 10 +$ java dice.java 6 +You rolled a 2 +$ java dice.java 100 +You rolled a 44 +``` + +构造器已接受你的输入,因此在创建类实例时,会将 `sides` 变量设置为用户指定的任何数字。 + +构造器是编程的功能强大的组件。练习用它们来解开了 Java 的全部潜力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/what-java-constructor + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[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/build_structure_tech_program_code_construction.png?itok=nVsiLuag +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython +[4]: https://opensource.com/resources/java +[5]: https://openjdk.java.net/install/index.html +[6]: https://opensource.com/article/19/5/free-rpg-day +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[10]: https://openjdk.java.net/ +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer diff --git a/published/20190627 RPM packages explained.md b/published/20190627 RPM packages explained.md new file mode 100644 index 0000000000..7f036a1504 --- /dev/null +++ b/published/20190627 RPM packages explained.md @@ -0,0 +1,313 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11452-1.html) +[#]: subject: (RPM packages explained) +[#]: via: (https://fedoramagazine.org/rpm-packages-explained/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +RPM 包初窥 +====== + +![][1] + +也许,Fedora 社区追求其[促进自由和开源的软件及内容的使命][2]的最著名的方式就是开发 [Fedora 软件发行版][3]了。因此,我们将很大一部分的社区资源用于此任务也就不足为奇了。这篇文章总结了这些软件是如何“打包”的,以及使之成为可能的基础工具,如 `rpm` 之类。 + +### RPM:最小的软件单元 + +可供用户选择的“版本”和“风味版”([spins][4] / [labs][5] / [silverblue][6])其实非常相似。它们都是由各种软件组成的,这些软件经过混合和搭配,可以很好地协同工作。它们之间的不同之处在于放入其中的具体工具不同。这种选择取决于它们所针对的用例。所有这些的“版本”和“风味版”基本组成单位都是 RPM 软件包文件。 + +RPM 文件是类似于 ZIP 文件或 tarball 的存档文件。实际上,它们使用了压缩来减小存档文件的大小。但是,除了文件之外,RPM 存档中还包含有关软件包的元数据。可以使用 `rpm` 工具查询: + +``` +$ rpm -q fpaste +fpaste-0.3.9.2-2.fc30.noarch + +$ rpm -qi fpaste +Name : fpaste +Version : 0.3.9.2 +Release : 2.fc30 +Architecture: noarch +Install Date: Tue 26 Mar 2019 08:49:10 GMT +Group : Unspecified +Size : 64144 +License : GPLv3+ +Signature : RSA/SHA256, Thu 07 Feb 2019 15:46:11 GMT, Key ID ef3c111fcfc659b9 +Source RPM : fpaste-0.3.9.2-2.fc30.src.rpm +Build Date : Thu 31 Jan 2019 20:06:01 GMT +Build Host : buildhw-07.phx2.fedoraproject.org +Relocations : (not relocatable) +Packager : Fedora Project +Vendor : Fedora Project +URL : https://pagure.io/fpaste +Bug URL : https://bugz.fedoraproject.org/fpaste +Summary : A simple tool for pasting info onto sticky notes instances +Description : +It is often useful to be able to easily paste text to the Fedora +Pastebin at http://paste.fedoraproject.org and this simple script +will do that and return the resulting URL so that people may +examine the output. This can hopefully help folks who are for +some reason stuck without X, working remotely, or any other +reason they may be unable to paste something into the pastebin + +$ rpm -ql fpaste +/usr/bin/fpaste +/usr/share/doc/fpaste +/usr/share/doc/fpaste/README.rst +/usr/share/doc/fpaste/TODO +/usr/share/licenses/fpaste +/usr/share/licenses/fpaste/COPYING +/usr/share/man/man1/fpaste.1.gz +``` + +安装 RPM 软件包后,`rpm` 工具可以知道具体哪些文件被添加到了系统中。因此,删除该软件包也会删除这些文件,并使系统保持一致状态。这就是为什么要尽可能地使用 `rpm` 安装软件,而不是从源代码安装软件的原因。 + +### 依赖关系 + +如今,完全独立的软件已经非常罕见。甚至 [fpaste][7],连这样一个简单的单个文件的 Python 脚本,都需要安装 Python 解释器。因此,如果系统未安装 Python(几乎不可能,但有可能),则无法使用 `fpaste`。用打包者的术语来说,“Python 是 `fpaste` 的**运行时依赖项**。” + +构建 RPM 软件包时(本文不讨论构建 RPM 的过程),生成的归档文件中包括了所有这些元数据。这样,与 RPM 软件包归档文件交互的工具就知道必须要安装其它的什么东西,以便 `fpaste` 可以正常工作: + +``` +$ rpm -q --requires fpaste +/usr/bin/python3 +python3 +rpmlib(CompressedFileNames) <= 3.0.4-1 +rpmlib(FileDigests) <= 4.6.0-1 +rpmlib(PayloadFilesHavePrefix) <= 4.0-1 +rpmlib(PayloadIsXz) <= 5.2-1 + +$ rpm -q --provides fpaste +fpaste = 0.3.9.2-2.fc30 + +$ rpm -qi python3 +Name : python3 +Version : 3.7.3 +Release : 3.fc30 +Architecture: x86_64 +Install Date: Thu 16 May 2019 18:51:41 BST +Group : Unspecified +Size : 46139 +License : Python +Signature : RSA/SHA256, Sat 11 May 2019 17:02:44 BST, Key ID ef3c111fcfc659b9 +Source RPM : python3-3.7.3-3.fc30.src.rpm +Build Date : Sat 11 May 2019 01:47:35 BST +Build Host : buildhw-05.phx2.fedoraproject.org +Relocations : (not relocatable) +Packager : Fedora Project +Vendor : Fedora Project +URL : https://www.python.org/ +Bug URL : https://bugz.fedoraproject.org/python3 +Summary : Interpreter of the Python programming language +Description : +Python is an accessible, high-level, dynamically typed, interpreted programming +language, designed with an emphasis on code readability. +It includes an extensive standard library, and has a vast ecosystem of +third-party libraries. + +The python3 package provides the "python3" executable: the reference +interpreter for the Python language, version 3. +The majority of its standard library is provided in the python3-libs package, +which should be installed automatically along with python3. +The remaining parts of the Python standard library are broken out into the +python3-tkinter and python3-test packages, which may need to be installed +separately. + +Documentation for Python is provided in the python3-docs package. + +Packages containing additional libraries for Python are generally named with +the "python3-" prefix. + +$ rpm -q --provides python3 +python(abi) = 3.7 +python3 = 3.7.3-3.fc30 +python3(x86-64) = 3.7.3-3.fc30 +python3.7 = 3.7.3-3.fc30 +python37 = 3.7.3-3.fc30 +``` + +### 解决 RPM 依赖关系 + +虽然 `rpm` 知道每个归档文件所需的依赖关系,但不知道在哪里找到它们。这是设计使然:`rpm` 仅适用于本地文件,必须具体告知它们的位置。因此,如果你尝试安装单个 RPM 软件包,则 `rpm` 找不到该软件包的运行时依赖项时就会出错。本示例尝试安装从 Fedora 软件包集中下载的软件包: + +``` +$ ls +python3-elephant-0.6.2-3.fc30.noarch.rpm + +$ rpm -qpi python3-elephant-0.6.2-3.fc30.noarch.rpm +Name : python3-elephant +Version : 0.6.2 +Release : 3.fc30 +Architecture: noarch +Install Date: (not installed) +Group : Unspecified +Size : 2574456 +License : BSD +Signature : (none) +Source RPM : python-elephant-0.6.2-3.fc30.src.rpm +Build Date : Fri 14 Jun 2019 17:23:48 BST +Build Host : buildhw-02.phx2.fedoraproject.org +Relocations : (not relocatable) +Packager : Fedora Project +Vendor : Fedora Project +URL : http://neuralensemble.org/elephant +Bug URL : https://bugz.fedoraproject.org/python-elephant +Summary : Elephant is a package for analysis of electrophysiology data in Python +Description : +Elephant - Electrophysiology Analysis Toolkit Elephant is a package for the +analysis of neurophysiology data, based on Neo. + +$ rpm -qp --requires python3-elephant-0.6.2-3.fc30.noarch.rpm +python(abi) = 3.7 +python3.7dist(neo) >= 0.7.1 +python3.7dist(numpy) >= 1.8.2 +python3.7dist(quantities) >= 0.10.1 +python3.7dist(scipy) >= 0.14.0 +python3.7dist(six) >= 1.10.0 +rpmlib(CompressedFileNames) <= 3.0.4-1 +rpmlib(FileDigests) <= 4.6.0-1 +rpmlib(PartialHardlinkSets) <= 4.0.4-1 +rpmlib(PayloadFilesHavePrefix) <= 4.0-1 +rpmlib(PayloadIsXz) <= 5.2-1 + +$ sudo rpm -i ./python3-elephant-0.6.2-3.fc30.noarch.rpm +error: Failed dependencies: + python3.7dist(neo) >= 0.7.1 is needed by python3-elephant-0.6.2-3.fc30.noarch + python3.7dist(quantities) >= 0.10.1 is needed by python3-elephant-0.6.2-3.fc30.noarch +``` + +理论上,你可以下载 `python3-elephant` 所需的所有软件包,并告诉 `rpm` 它们都在哪里,但这并不方便。如果 `python3-neo` 和 `python3-quantities` 还有其它的运行时要求怎么办?很快,这种“依赖链”就会变得相当复杂。 + +#### 存储库 + +幸运的是,有了 `dnf` 和它的朋友们,可以帮助解决此问题。与 `rpm` 不同,`dnf` 能感知到**存储库**。存储库是程序包的集合,带有告诉 `dnf` 这些存储库包含什么内容的元数据。所有 Fedora 系统都带有默认启用的默认 Fedora 存储库: + +``` +$ sudo dnf repolist +repo id              repo name                             status +fedora               Fedora 30 - x86_64                    56,582 +fedora-modular       Fedora Modular 30 - x86_64               135 +updates              Fedora 30 - x86_64 - Updates           8,573 +updates-modular      Fedora Modular 30 - x86_64 - Updates     138 +updates-testing      Fedora 30 - x86_64 - Test Updates      8,458 +``` + +在 Fedora 快速文档中有[这些存储库][8]以及[如何管理][9]它们的更多信息。 + +`dnf` 可用于查询存储库以获取有关它们包含的软件包信息。它还可以在这些存储库中搜索软件,或从中安装/卸载/升级软件包: + +``` +$ sudo dnf search elephant +Last metadata expiration check: 0:05:21 ago on Sun 23 Jun 2019 14:33:38 BST. +============================================================================== Name & Summary Matched: elephant ============================================================================== +python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python +python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python + +$ sudo dnf list \*elephant\* +Last metadata expiration check: 0:05:26 ago on Sun 23 Jun 2019 14:33:38 BST. +Available Packages +python3-elephant.noarch 0.6.2-3.fc30 updates-testing +python3-elephant.noarch 0.6.2-3.fc30 updates +``` + +#### 安装依赖项 + +现在使用 `dnf` 安装软件包时,它将*解决*所有必需的依赖项,然后调用 `rpm` 执行该事务操作: + +``` +$ sudo dnf install python3-elephant +Last metadata expiration check: 0:06:17 ago on Sun 23 Jun 2019 14:33:38 BST. +Dependencies resolved. +============================================================================================================================================================================================== + Package Architecture Version Repository Size +============================================================================================================================================================================================== +Installing: + python3-elephant noarch 0.6.2-3.fc30 updates-testing 456 k +Installing dependencies: + python3-neo noarch 0.8.0-0.1.20190215git49b6041.fc30 fedora 753 k + python3-quantities noarch 0.12.2-4.fc30 fedora 163 k +Installing weak dependencies: + python3-igor noarch 0.3-5.20150408git2c2a79d.fc30 fedora 63 k + +Transaction Summary +============================================================================================================================================================================================== +Install 4 Packages + +Total download size: 1.4 M +Installed size: 7.0 M +Is this ok [y/N]: y +Downloading Packages: +(1/4): python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch.rpm 222 kB/s | 63 kB 00:00 +(2/4): python3-elephant-0.6.2-3.fc30.noarch.rpm 681 kB/s | 456 kB 00:00 +(3/4): python3-quantities-0.12.2-4.fc30.noarch.rpm 421 kB/s | 163 kB 00:00 +(4/4): python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch.rpm 840 kB/s | 753 kB 00:00 +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +Total 884 kB/s | 1.4 MB 00:01 +Running transaction check +Transaction check succeeded. +Running transaction test +Transaction test succeeded. +Running transaction + Preparing : 1/1 + Installing : python3-quantities-0.12.2-4.fc30.noarch 1/4 + Installing : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4 + Installing : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4 + Installing : python3-elephant-0.6.2-3.fc30.noarch 4/4 + Running scriptlet: python3-elephant-0.6.2-3.fc30.noarch 4/4 + Verifying : python3-elephant-0.6.2-3.fc30.noarch 1/4 + Verifying : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4 + Verifying : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4 + Verifying : python3-quantities-0.12.2-4.fc30.noarch 4/4 + +Installed: + python3-elephant-0.6.2-3.fc30.noarch python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch python3-quantities-0.12.2-4.fc30.noarch + +Complete! +``` + +请注意,`dnf` 甚至还安装了`python3-igor`,而它不是 `python3-elephant` 的直接依赖项。 + +### DnfDragora:DNF 的一个图形界面 + +尽管技术用户可能会发现 `dnf` 易于使用,但并非所有人都这样认为。[Dnfdragora][10] 通过为 `dnf` 提供图形化前端来解决此问题。 + +![dnfdragora (version 1.1.1-2 on Fedora 30) listing all the packages installed on a system.][11] + +从上面可以看到,dnfdragora 似乎提供了 `dnf` 的所有主要功能。 + +Fedora 中还有其他工具也可以管理软件包,GNOME 的“软件Software”和“发现Discover”就是其中两个。GNOME “软件”仅专注于图形应用程序。你无法使用这个图形化前端来安装命令行或终端工具,例如 `htop` 或 `weechat`。但是,GNOME “软件”支持安装 `dnf` 所不支持的 [Flatpak][12] 和 Snap 应用程序。它们是针对不同目标受众的不同工具,因此提供了不同的功能。 + +这篇文章仅触及到了 Fedora 软件的生命周期的冰山一角。本文介绍了什么是 RPM 软件包,以及使用 `rpm` 和 `dnf` 的主要区别。 + +在以后的文章中,我们将详细介绍: + +* 创建这些程序包所需的过程 +* 社区如何测试它们以确保它们正确构建 +* 社区用来将其给到社区用户的基础设施 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/rpm-packages-explained/ + +作者:[Ankur Sinha "FranciscoD"][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://fedoramagazine.org/author/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about +[3]: https://getfedora.org +[4]: https://spins.fedoraproject.org/ +[5]: https://labs.fedoraproject.org/ +[6]: https://silverblue.fedoraproject.org/ +[7]: https://src.fedoraproject.org/rpms/fpaste +[8]: https://docs.fedoraproject.org/en-US/quick-docs/repositories/ +[9]: https://docs.fedoraproject.org/en-US/quick-docs/adding-or-removing-software-repositories-in-fedora/ +[10]: https://src.fedoraproject.org/rpms/dnfdragora +[11]: https://fedoramagazine.org/wp-content/uploads/2019/06/dnfdragora-1024x558.png +[12]: https://fedoramagazine.org/getting-started-flatpak/ diff --git a/sources/tech/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md b/published/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md similarity index 54% rename from sources/tech/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md rename to published/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md index bf076d08ea..060ba6926a 100644 --- a/sources/tech/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md +++ b/published/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md @@ -1,48 +1,50 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11429-1.html) [#]: subject: (Learn how to Record and Replay Linux Terminal Sessions Activity) [#]: via: (https://www.linuxtechi.com/record-replay-linux-terminal-sessions-activity/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -Learn how to Record and Replay Linux Terminal Sessions Activity +在 Linux 上记录和重放终端会话活动 ====== -Generally, all Linux administrators use **history** command to track which commands were executed in previous sessions, but there is one limitation of history command is that it doesn’t store the command’s output. There can be some scenarios where we want to check commands output of previous session and want to compare it with current session. Apart from this, there are some situations where we are troubleshooting the issues on Linux production boxes and want to save all terminal session activities for future reference, so in such cases script command become handy. +通常,Linux 管理员们都使用 `history` 命令来跟踪在先前的会话中执行过哪些命令,但是 `history` 命令的局限性在于它不存储命令的输出。在某些情况下,我们要检查上一个会话的命令输出,并希望将其与当前会话进行比较。除此之外,在某些情况下,我们正在对 Linux 生产环境中的问题进行故障排除,并希望保存所有终端会话活动以供将来参考,因此在这种情况下,`script` 命令就变得很方便。 - +![](https://img.linux.net.cn/data/attachment/album/201910/06/122659mmi64z8ryr4z2n8a.jpg) -Script is a command line tool which is used to capture or record your Linux server terminal sessions activity and later the recorded session can be replayed using scriptreplay command. In this article we will demonstrate how to install script command line tool and how to record Linux server terminal session activity and then later we will see how the recorded session can be replayed using **scriptreplay** command. +`script` 是一个命令行工具,用于捕获/记录你的 Linux 服务器终端会话活动,以后可以使用 `scriptreplay` 命令重放记录的会话。在本文中,我们将演示如何安装 `script` 命令行工具以及如何记录 Linux 服务器终端会话活动,然后,我们将看到如何使用 `scriptreplay` 命令来重放记录的会话。 -### Installation of Script tool on RHEL 7/ CentOS 7 +### 安装 script 工具 -Script command is provided by the rpm package “**util-linux**”, in case it is not installed on your CentOS 7 / RHEL 7 system , run the following yum command, +#### 在 RHEL 7/ CentOS 7 上安装 script 工具 + +`script` 命令由 RPM 包 `util-linux` 提供,如果你没有在你的 CentOS 7 / RHEL 7 系统上安装它,运行下面的 `yum` 安装它: ``` [root@linuxtechi ~]# yum install util-linux -y ``` -**On RHEL 8 / CentOS 8** +#### 在 RHEL 8 / CentOS 8 上安装 script 工具 -Run the following dnf command to install script utility on RHEL 8 and CentOS 8 system, +运行下面的 `dnf` 命令来在 RHEL 8 / CentOS 8 上安装 `script` 工具: ``` [root@linuxtechi ~]# dnf install util-linux -y ``` -**Installation of Script tool on Debian based systems (Ubuntu / Linux Mint)** +#### 在基于 Debian 的系统(Ubuntu / Linux Mint)上安装 script 工具 -Execute the beneath apt-get command to install script utility +运行下面的 `apt-get` 命令来安装 `script` 工具: ``` root@linuxtechi ~]# apt-get install util-linux -y ``` -### How to Use script utility +### 如何使用 script 工具 -Use of script command is straight forward, type script command on terminal then hit enter, it will start capturing your current terminal session activities inside a file called “**typescript**” +直接使用 `script` 命令,在终端上键入 `script` 命令,然后按回车,它将开始在名为 `typescript` 的文件中捕获当前的终端会话活动。 ``` [root@linuxtechi ~]# script @@ -50,7 +52,7 @@ Script started, file is typescript [root@linuxtechi ~]# ``` -To stop recording the session activities, type exit command and hit enter. +要停止记录会话活动,请键入 `exit` 命令,然后按回车: ``` [root@linuxtechi ~]# exit @@ -59,23 +61,23 @@ Script done, file is typescript [root@linuxtechi ~]# ``` -Syntax of Script command: +`script` 命令的语法格式: ``` -~ ] # script {options} {file_name} +~] # script {options} {file_name} ``` -Different options used in script command, +能在 `script` 命令中使用的不同选项: ![options-script-command][1] -Let’s start recording of your Linux terminal session by executing script command and then execute couple of command like ‘**w**’, ‘**route -n**’ , ‘[**df -h**][2]’ and ‘**free-h**’, example is shown below +让我们开始通过执行 `script` 命令来记录 Linux 终端会话,然后执行诸如 `w`,`route -n`,`df -h` 和 `free -h`,示例如下所示: ![script-examples-linux-server][3] -As we can see above, terminal session logs are saved in the file “typescript” +正如我们在上面看到的,终端会话日志保存在文件 `typescript` 中: -Now view the contents of typescript file using [cat][4] / vi command, +现在使用 `cat` / `vi` 命令查看 `typescript` 文件的内容, ``` [root@linuxtechi ~]# ls -l typescript @@ -85,11 +87,11 @@ Now view the contents of typescript file using [cat][4] / vi command, ![typescript-file-content-linux][5] -Above confirms that whatever commands we execute on terminal that have been saved inside the file “typescript” +以上内容确认了我们在终端上执行的所有命令都已保存在 `typescript` 文件中。 -### Use Custom File name in script command +### 在 script 命令中使用定制文件名 -Let’s assume we want to use our customize file name to script command, so specify the file name after script command, in the below example we are using a file name “session-log-(current-date-time).txt” +假设我们要使用自定义文件名来执行 `script` 命令,可以在 `script` 命令后指定文件名。在下面的示例中,我们使用的文件名为 `session-log-(当前日期时间).txt`。 ``` [root@linuxtechi ~]# script sessions-log-$(date +%d-%m-%Y-%T).txt @@ -97,7 +99,7 @@ Script started, file is sessions-log-21-06-2019-01:37:39.txt [root@linuxtechi ~]# ``` -Now run the commands and then type exit, +现在运行该命令并输入 `exit`: ``` [root@linuxtechi ~]# exit @@ -106,9 +108,9 @@ Script done, file is sessions-log-21-06-2019-01:37:39.txt [root@linuxtechi ~]# ``` -### Append the commands output to script file +### 附加命令输出到 script 记录文件 -Let assume script command had already recorded the commands output to a file called session-log.txt file and now we want to append output of new sessions commands output to this file, then use “**-a**” command in script command +假设 `script` 命令已经将命令输出记录到名为 `session-log.txt` 的文件中,现在我们想将新会话命令的输出附加到该文件中,那么可以在 `script` 命令中使用 `-a` 选项。 ``` [root@linuxtechi ~]# script -a sessions-log.txt @@ -129,11 +131,11 @@ Script done, file is sessions-log.txt [root@linuxtechi ~]# ``` -To view updated session’s logs, use “cat session-log.txt ” +要查看更新的会话记录,使用 `cat session-log.txt` 命令。 -### Capture commands output to script file without interactive shell +### 无需 shell 交互而捕获命令输出到 script 记录文件 -Let’s assume we want to capture commands output to a script file, then use **-c** option, example is shown below, +假设我们要捕获命令的输出到会话记录文件,那么使用 `-c` 选项,示例如下所示: ``` [root@linuxtechi ~]# script -c "uptime && hostname && date" root-session.txt @@ -145,9 +147,9 @@ Script done, file is root-session.txt [root@linuxtechi ~]# ``` -### Run script command in quiet mode +### 以静默模式运行 script 命令 -To run script command in quiet mode use **-q** option, this option will suppress the script started and script done message, example is shown below, +要以静默模式运行 `script` 命令,请使用 `-q` 选项,该选项将禁止 `script` 的启动和完成消息,示例如下所示: ``` [root@linuxtechi ~]# script -c "uptime && date" -q root-session.txt @@ -156,11 +158,13 @@ Fri Jun 21 02:01:10 EDT 2019 [root@linuxtechi ~]# ``` -Record Timing information to a file and capture commands output to a separate file, this can be achieved in script command by passing timing file (**–timing**) , example is shown below, +要将时序信息记录到文件中并捕获命令输出到单独的文件中,这可以通过在 `script` 命令中传递时序文件(`-timing`)实现,示例如下所示: -Syntax: +语法格式: -~ ]# script -t <timing-file-name>  {file_name} +``` +~ ]# script -t {file_name} +``` ``` [root@linuxtechi ~]# script --timing=timing.txt session.log @@ -185,23 +189,23 @@ Script done, file is session.log [root@linuxtechi ~]# ``` -### Replay recorded Linux terminal session activity +### 重放记录的 Linux 终端会话活动 -Now replay the recorded terminal session activities using scriptreplay command, +现在,使用 `scriptreplay` 命令重放录制的终端会话活动。 -**Note:** Scriptreplay is also provided by rpm package “**util-linux**”. Scriptreplay command requires timing file to work. +注意:`scriptreplay` 也由 RPM 包 `util-linux` 提供。`scriptreplay` 命令需要时序文件才能工作。 ``` [root@linuxtechi ~]# scriptreplay --timing=timing.txt session.log ``` -Output of above command would be something like below, +上面命令的输出将如下所示, - +![](https://www.linuxtechi.com/wp-content/uploads/2019/06/scriptreplay-linux.gif) -### Record all User’s Linux terminal session activities +### 记录所有用户的 Linux 终端会话活动 -There are some business critical Linux servers where we want keep track on all users activity, so this can be accomplished using script command, place the following content in /etc/profile file , +在某些关键业务的 Linux 服务器上,我们希望跟踪所有用户的活动,这可以使用 `script` 命令来完成,将以下内容放在 `/etc/profile` 文件中, ``` [root@linuxtechi ~]# vi /etc/profile @@ -218,22 +222,22 @@ fi …………………………………………………… ``` -Save & exit the file. +保存文件并退出。 -Create the session directory under /var/log folder, +在 `/var/log` 文件夹下创建 `session` 目录: ``` [root@linuxtechi ~]# mkdir /var/log/session ``` -Assign the permissions to session folder, +给该文件夹指定权限: ``` [root@linuxtechi ~]# chmod 777 /var/log/session/ [root@linuxtechi ~]# ``` -Now verify whether above code is working or not. Login to ordinary user to linux server, in my I am using pkumar user, +现在,验证以上代码是否有效。在我正在使用 `pkumar` 用户的情况下,登录普通用户到 Linux 服务器: ``` ~ ] # ssh root@linuxtechi @@ -263,13 +267,13 @@ Login as root and view user’s linux terminal session activity ![Session-output-file-linux][6] -We can also use scriptreplay command to replay user’s terminal session activities, +我们还可以使用 `scriptreplay` 命令来重放用户的终端会话活动: ``` [root@linuxtechi session]# scriptreplay --timing session.pkumar.19785.21-06-2019-04\:34\:05.timing session.pkumar.19785.21-06-2019-04\:34\:05 ``` -That’s all from this tutorial, please do share your feedback and comments in the comments section below. +以上就是本教程的全部内容,请在下面的评论部分中分享你的反馈和评论。 -------------------------------------------------------------------------------- @@ -277,8 +281,8 @@ via: https://www.linuxtechi.com/record-replay-linux-terminal-sessions-activity/ 作者:[Pradeep Kumar][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20190719 Buying a Linux-ready laptop.md b/published/20190719 Buying a Linux-ready laptop.md new file mode 100644 index 0000000000..91fdeab1ab --- /dev/null +++ b/published/20190719 Buying a Linux-ready laptop.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11436-1.html) +[#]: subject: (Buying a Linux-ready laptop) +[#]: via: (https://opensource.com/article/19/7/linux-laptop) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) + +我买了一台 Linux 笔记本 +====== + +> Tuxedo 让买一台开箱即用的 Linux 笔记本变得容易。 + +![](https://img.linux.net.cn/data/attachment/album/201910/08/133924vnmbklqh5jkshkmj.jpg) + +最近,我开始使用我买的 Linux 笔记本计算机 Tuxedo Book BC1507。十年前,如果有人告诉我,十年后我可以从 [System76][2]、[Slimbook][3] 和 [Tuxedo][4] 等公司购买到高质量的“企鹅就绪”的笔记本电脑。我可能会发笑。好吧,现在我也在笑,但是很开心! + +除了为免费/自由开源软件(FLOSS)设计计算机之外,这三家公司最近[宣布][5]都试图通过切换到[Coreboot][6]来消除专有的 BIOS 软件。 + +### 买一台 + +Tuxedo Computers 是一家德国公司,生产支持 Linux 的笔记本电脑。实际上,如果你要使用其他的操作系统,则它的价格会更高。 + +购买他们的计算机非常容易。Tuxedo 提供了许多付款方式:不仅包括信用卡,而且还包括 PayPal 甚至银行转帐(LCTT 译注:我们需要支付宝和微信支付……此外,要国际配送,还需要支付运输费和清关费用等)。只需在 Tuxedo 的网页上填写银行转帐表格,公司就会给你发送银行信息。 + +Tuxedo 可以按需构建每台计算机,只需选择基本模型并浏览下拉菜单以选择不同的组件,即可轻松准确地选择所需内容。页面上有很多信息可以指导你进行购买。 + +如果你选择的 Linux 发行版与推荐的发行版不同,则 Tuxedo 会进行“网络安装”,因此请准备好网络电缆以完成安装,也可以将你首选的镜像文件刻录到 USB 盘上。我通过外部 DVD 阅读器来安装刻录了 openSUSE Leap 15.1 安装程序的 DVD,但是你可用你自己的方式。 + +我选择的型号最多可以容纳两个磁盘:一个 SSD,另一个可以是 SSD 或常规硬盘。由于已经超出了我的预算,因此我决定选择传统的 1TB 磁盘并将 RAM 增加到 16GB。该处理器是具有四个内核的第八代 i5。我选择了背光西班牙语键盘、1920×1080/96dpi 屏幕和 SD 卡读卡器。总而言之,这是一个很棒的系统。 + +如果你对默认的英语或德语键盘感觉满意,甚至可以要求在 Meta 键上印上一个企鹅图标!我需要的西班牙语键盘则不提供此选项。 + +### 收货并开箱使用 + +付款完成后仅六个工作日,完好包装的计算机就十分安全地到达了我家。打开计算机包装并解锁电池后,我准备好开始浪了。 + +![Tuxedo Book BC1507][7] + +*我的(物理)桌面上的新玩具。* + +该电脑的设计确实很棒,而且感觉扎实。即使此型号的外壳不是铝制的(LCTT 译注:他们有更好看的铝制外壳的型号),也可以保持凉爽。风扇真的很安静,气流像许多其他笔记本电脑一样导向后边缘,而不是流向侧面。电池可提供数小时的续航时间。BIOS 中的一个名为 FlexiCharger 的选项会在达到一定百分比后停止为电池充电,因此在插入电源长时间工作时,无需卸下电池。 + +键盘真的很舒适,而且非常安静。甚至触摸板按键也很安静!另外,你可以轻松调整背光键盘上的光强度。 + +最后,很容易访问笔记本电脑中的每个组件,因此可以毫无问题地对计算机进行更新或维修。Tuxedo 甚至送了几个备用螺丝! + +### 结语 + +经过一个月的频繁使用,我对该系统感到非常满意。它完全满足了我的要求,并且一切都很完美。 + +因为它们通常是高端系统,所以包含 Linux 的计算机往往比较昂贵。如果你将 Tuxedo 或 Slimbook 电脑的价格与更知名品牌的类似规格的价格进行比较,价格相差无几。如果你想要一台使用自由软件的强大系统,请毫不犹豫地支持这些公司:他们所提供的物有所值。 + +请在评论中让我们知道你在 Tuxedo 和其他“企鹅友好”公司的经历。 + +* * * + +本文基于 Ricardo 的博客 [From Mind to Type][9] 上发表的“ [我的新企鹅笔记本电脑:Tuxedo-Book-BC1507][8]”。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/linux-laptop + +作者:[Ricardo Berlasso][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://opensource.com/users/rgb-es +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://system76.com/ +[3]: https://slimbook.es/en/ +[4]: https://www.tuxedocomputers.com/ +[5]: https://www.tuxedocomputers.com/en/Infos/News/Tuxedo-Computers-stands-for-Free-Software-and-Security-.tuxedo +[6]: https://coreboot.org/ +[7]: https://opensource.com/sites/default/files/uploads/tuxedo-600_0.jpg (Tuxedo Book BC1507) +[8]: https://frommindtotype.wordpress.com/2019/06/17/my-new-penguin-ready-laptop-tuxedo-book-bc1507/ +[9]: https://frommindtotype.wordpress.com/ diff --git a/published/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md b/published/201908/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md similarity index 100% rename from published/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md rename to published/201908/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md diff --git a/published/20171216 Sysadmin 101- Troubleshooting.md b/published/201908/20171216 Sysadmin 101- Troubleshooting.md similarity index 100% rename from published/20171216 Sysadmin 101- Troubleshooting.md rename to published/201908/20171216 Sysadmin 101- Troubleshooting.md diff --git a/published/20180104 How allowing myself to be vulnerable made me a better leader.md b/published/201908/20180104 How allowing myself to be vulnerable made me a better leader.md similarity index 100% rename from published/20180104 How allowing myself to be vulnerable made me a better leader.md rename to published/201908/20180104 How allowing myself to be vulnerable made me a better leader.md diff --git a/published/20180116 Command Line Heroes- Season 1- OS Wars.md b/published/201908/20180116 Command Line Heroes- Season 1- OS Wars.md similarity index 100% rename from published/20180116 Command Line Heroes- Season 1- OS Wars.md rename to published/201908/20180116 Command Line Heroes- Season 1- OS Wars.md diff --git a/published/20180119 Two great uses for the cp command Bash shortcuts.md b/published/201908/20180119 Two great uses for the cp command Bash shortcuts.md similarity index 100% rename from published/20180119 Two great uses for the cp command Bash shortcuts.md rename to published/201908/20180119 Two great uses for the cp command Bash shortcuts.md diff --git a/published/20180131 How to test Webhooks when youre developing locally.md b/published/201908/20180131 How to test Webhooks when youre developing locally.md similarity index 100% rename from published/20180131 How to test Webhooks when youre developing locally.md rename to published/201908/20180131 How to test Webhooks when youre developing locally.md diff --git a/published/20180622 Use LVM to Upgrade Fedora.md b/published/201908/20180622 Use LVM to Upgrade Fedora.md similarity index 100% rename from published/20180622 Use LVM to Upgrade Fedora.md rename to published/201908/20180622 Use LVM to Upgrade Fedora.md diff --git a/published/201908/20180720 A brief history of text-based games and open source.md b/published/201908/20180720 A brief history of text-based games and open source.md new file mode 100644 index 0000000000..bc3026be9f --- /dev/null +++ b/published/201908/20180720 A brief history of text-based games and open source.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (cycoe) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11272-1.html) +[#]: subject: (A brief history of text-based games and open source) +[#]: via: (https://opensource.com/article/18/7/interactive-fiction-tools) +[#]: author: (Jason Mclntosh https://opensource.com/users/jmac) + +互动小说及其开源简史 +====== + +> 了解开源如何促进互动小说的成长和发展。 + +![](https://img.linux.net.cn/data/attachment/album/201908/27/142657ryf4pa2lym6fe6f1.jpg) + +[互动小说技术基金会][1]Interactive Fiction Technology Foundation(IFTF) 是一个非营利组织,致力于保护和改进那些用来生成我们称之为互动小说interactive fiction的数字艺术形式的技术。当 Opensource.com 的一位社区版主提出一篇关于 IFTF、它支持的技术与服务,以及它如何与开源相交织的文章时,我发现这对于我讲了数几十年的开源故事来说是个新颖的视角。互动小说的历史比自由及开源软件Free and Open Source Software(FOSS)运动的历史还要长,但同时也与之密切相关。希望你们能喜欢我在这里的分享。 + +### 定义和历史 + +对于我来说,互动小说这个术语涵盖了读者主要通过文本与之交互的任何视频游戏或数字化艺术作品。这个术语起源于 20 世纪 80 年代,当时由语法解析器驱动的文本冒险游戏确立了什么是家用电脑娱乐,在美国主要以 [魔域][2]、[银河系漫游指南][3] 和 [Infocom][4] 公司的其它佳作为代表。在 20 世纪 90 年代,它的主流商业价值被挖掘殆尽,但在线爱好者社区接过了该传统,继续发布这类游戏和游戏创建工具。 + +在四分之一个世纪之后的今天,互动小说包括了品种繁多并且妙趣橫生的作品,如从充满谜题的文字冒险游戏到衍生改良的超文本类型。定期举办的在线竞赛和节日为品鉴和试玩新作品提供了个好地方---英语互动小说世界每年都会举办一些活动,包括 [Spring Thing][5] 和 [IFComp][6]。后者是自 1995 年以来现代互动小说的核心活动,这也使它成为在同类型活动中持续举办时间最长的游戏展示活动。[IFComp 从 2017 年开始的评选和排名记录][7] 显示了如今基于文本的游戏在形式、风格和主题方面的惊人多样性。 + +(作者注:以上我特指英语,因为可能出于写作方面的技术原因,互动小说社区倾向于按语言进行区分。例如也有 [法语][8] 或 [意大利语][9] 的互动小说年度活动,我就听说过至少一届的中文互动小说节。幸运的是,这些边界易于打破。在我管理 IFComp 的四年中,我们很欢迎来自国际社区的所有英语翻译工作。) + +![“假冒的猴子”游戏截图][11] + +*在解释器 Lectrote 上启动 Emily Short 的“假冒的猴子”新游戏(二者皆为开源软件)。* + +此外由于互动小说专注于文本,它为玩家和作者都提供了最方便的平台。几乎所有能阅读数字化文本的人(包括能通过文字转语音软件等辅助技术阅读的用户)都能玩大部分的互动小说作品。同样,互动小说的创作对所有愿意学习和使用其工具和技术的作家开放。 + +这使我们了解了互动小说与开源的长期关系,以及从它的全盛时期以来,对于艺术形式可用性的积极影响。接下来我将概述当代开源互动小说创建工具,并讨论共享源代码的互动小说作品古老且有点稀奇的传统。 + +### 开源互动小说工具的世界 + +一些开发平台(其中大部分是开源的)可用于创建传统的语法解析器驱动互动小说,其中用户可通过输入命令(如 `向北走`、`拾取提灯`、`收养小猫` 或 `向 Zoe 询问量子机械学`)来与游戏世界交互。20 世纪 90 年代初期出现了几个适于魔改hacker-friendly的语法解析器游戏开发工具,其中目前还在使用的有 [TADS][12]、[Alan][13] 和 [Quest][14],它们都是开源的,并且后两者兼容 FOSS 许可证。 + +其中最出名的是 [Inform][15],1993 年 Graham Nelson 发布了第一个版本,目前由 Nelson 领导的一个团队进行维护。Inform 的源代码是不太寻常的半开源:Inform 6 是前一个主要版本,[它通过 Artistic 许可证开放源码][16]。这其中蕴涵着比我们所看到的更直接的相关性,因为它专有的 Inform 7 将 Inform 6 作为其核心,可以让它在将作品编译为机器码之前,将其 [杰出的自然语言语法][17] (LCTT 译注:此链接已遗失)翻译为其前一代的那种更类似 C 的代码。 + +![inform 7 集成式开发环境截图][19] + +*Inform 7 集成式开发环境,打开了文档以及一个示例项目* + +Inform 游戏运行在虚拟机上,这是 Infocom 时代的遗留产物。当时的发行者为了让同一个游戏可以运行在 Apple II、Commodore 4、Atari 800 以及其它种类的“[家用计算机][20]”上,将虚拟机作为解决方案。这些原本流行的操作系统中只有少数至今仍存在,但 Inform 的虚拟机使得它创建的作品能够通过 Inform 解释器运行在任何的计算机上。这些虚拟机包括相对现代的 [Glulx][21],或者通过对 Infocom 过去的虚拟机进行逆向工程克隆得到的可爱的古董 [Z-machine][22]。现在,流行的跨平台解释器包括如 [lectrote][23] 和 [Gargoyle][24] 等桌面程序,以及如 [Quixe][25] 和 [Parchment][26] 等基于浏览器的程序。以上所有均为开源软件。 + +如其它的流行开源项目一样,如果 Inform 的发展进程随着它的成熟而逐渐变缓,它为我们留下的最重要的财富就是其活跃透明的生态环境。对于 Inform 来说,(这些财富)包括前面提到的解释器、[一套语言扩展][27](通常混合使用 Inform 6 和 Inform 7 写成),当然也包括所有用它们写成并分享于全世界的作品,有的时候也包括那些源代码。(在这篇文章的后半部分我会回到这个话题) + +互动小说创建工具发明于 21 世纪,力求在传统的语法解析器之外探索一种新的玩家交互方式,即创建任何现代 Web 浏览器都能加载的超文本驱动作品。其中的领头羊是 [Twine][28],原本由 Klimas 在 2009 年开发,目前是 [GNU 许可证开源项目][29],有许多贡献者正在积极开发。(事实上,[Twine][30] 的开源软件血统可追溯到 [TiddlyWiki][31],Klimas 的项目最初是从该项目衍生而来的) + +对于互动小说开发来说,Twine 代表着一系列最开放及最可用的方法。由于它天生的 FOSS 属性,它将其输出渲染为一个自包含的网站,不依赖于需要进一步特殊解析的机器码,而是使用开放并且成熟的 HTML、CSS 和 JavaScript 标准。作为一个创建工具,Twine 能够根据创建者的技能等级,展示出与之相匹配的复杂度。拥有很少或没有编程知识的用户能够创建简单但是可玩的互动小说作品,但那些拥有更多编码和设计技能(包括通过开发 Twine 游戏获得的技能提升)的用户能够创建更复杂的项目。这也难怪近几年 Twine 在教育领域的曝光率和流行度有不小的提升。 + +另一些值得注意的开源互动小说开发项目包括由 Ian Millington 开发的以 MIT 许可证发布的 [Undum][32],以及由 Dan Fabulich 和 [Choice of Games][34] 团队开发的 [ChoiceScript][33],两者也专注于将 Web 浏览器作为游戏平台。除了以上专用的开发系统以外,基于 Web 的互动小说也呈现给我们以开源作品的丰富、变幻的生态。比如 Furkle 的 [Twine 扩展工具集][35],以及 Liza Daly 为自己的互动小说游戏创建的名为 [Windrift][36] 的 JavaScript 框架。 + +### 程序、游戏,以及游戏程序 + +Twine 受益于 [一个致力于提供支持的长期 IFTF 计划][37],公众可以为其维护和发展提供资助。IFTF 还直接支持两个长期公共服务:IFComp 和互动小说归档IF Archive,这两个服务都依赖并回馈开源软件和技术。 + +![Harmonia 开场截图][39] + +*由 Liza Daly 开发的“Harmonia”的开场画面,该游戏使用 Windrift 开源互动小说创建框架创建。* + +自 2014 年以来,用于运行 IFComp 网站的基于 Perl 和 JavaScript 的应用程序一直是 [一个共享源代码项目][40],它反映了 [互动小说特有子组件使用的 FOSS 许可证是个大杂烩][41],其中包括那些可以让以语法解析器驱动的竞争项目在 Web 浏览器中运行的各式各样的代码库。在 1992 年上线并 [在 2017 年成为一个 IFTF 项目][43] 的 [互动小说归档][42]IF Archive,是一套完全基于古老且稳定的互联网标准的镜像仓库,只使用了 [一点开源 Pyhon 脚本][44] 用来处理索引。 + +### 最后,也是最有趣的部分,让我们聊聊开源文字游戏 + +互动小说归档的主体 [由游戏组成][45],当然,是那些历经岁月的游戏。它们反映了数十年来不断发展的游戏设计趋势和互动小说工具发展。 + +许多互动小说作品都共享其源代码,要快速找到它们的快速很简单 —— [在 IFDB 中搜索标签 “source available”][46]。IFDB 是另一个长期运行的互动小说社区服务,由 TADS 的创立者 Mike Roberts 私人运营。对更加简单的界面感到舒适的用户,也可以浏览互动小说归档的 [games/source 目录][47],该目录按开发平台和编写语言对内容运行分组(也有很多作品,由于太繁杂或太古老而无法分类,只能浮于顶级目录)。 + +对这些代码共享游戏随机抽取的几个样本,揭示了一个有趣的窘境:与更广阔的开源软件世界不同,互动小说社区缺少一种普遍认同的方式来授权它生成的所有代码。与软件工具(包括我们用来创建互动小说的所有工具)不同的是,从字面意思上讲,交互式小说游戏是一件艺术作品。这意味着,将面向软件的开源许可证用于交互式小说游戏,并不会比将其用于其它像散文或诗歌作品更适合。但同样,互动小说游戏也是一个软件,它展示了创建者希望合法地与世界分享的源代码模式和技术。一个拥有开源意识的互动小说创建者会怎么做呢? + +有些游戏通过将其代码放到公共领域来解决这一问题,或者通过明确的许可证,亦或者如 [42 年前由 Crowther 和 Woods 开发的“冒险之旅Adventure”][48] 一样通过社区发布。一些人试图将其中的不同部分分开,应用他们自己的许可证,允许免费复用游戏公开的业务逻辑,但禁止针对其散文内容的再创作。这是我在开源自己的游戏 [莺巢][49]The Warbler’s Nest 时采取的策略。天知道这是否能在法律上站得住脚,但我当时没有更好的主意。 + +当然,你会发现一些作品对所有部分使用单一的许可证,而不介意反对者。一个突出的例子就是 [Emily Short 的史诗作品“假冒的猴子Counterfeit Monkey”][50],其全部采用 Creative Commons 4.0 许可证发布。[CC 对其应用于代码感到不满][51],但你可以认为 [Inform 7 源码这种不寻常的散文风格特性][52] 至少比传统的软件项目更适合 CC 许可证。 + +### 接下来要做什么呢,冒险者? + +如果你希望开始探索互动小说的世界,这里有几个链接可供你参考: + ++ 如上所述,[IFDB][53] 和[互动小说归档][54]都提供了可浏览的界面,用于浏览超过 40 年价值的互动小说作品。其中大部分可以在 Web 浏览器中玩,但有些需要额外的解释器程序。IFDB 能帮助你找到并安装它们。[IFComp 的年度结果页面][55]展现了另一个视图,帮助你了解最佳的免费和归档可用作品。 ++ [互动小说技术基金会][56]是一个非营利组织,主要帮助并支持 Twine、IFComp 和互动小说归档的发展,以及提升互动小说的无障碍功能、探索互动小说在教育领域中的应用等等。加入其[邮件列表][57],可以接收 IFTF 的每月资讯,浏览其[博客][58],亦或浏览[一些主题商品][59]。 ++ 在今年的早些时候,John Paul Wohlscheid 写了这篇[关于开源互动小说工具][60]的文章。它涵盖了一些这里没有提及的平台,所以如果你还想了解更多,请看一看这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/interactive-fiction-tools + +作者:[Jason Mclntosh][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jmac +[1]:http://iftechfoundation.org/ +[2]:https://en.wikipedia.org/wiki/Zork +[3]:https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy_(video_game) +[4]:https://en.wikipedia.org/wiki/Infocom +[5]:http://www.springthing.net/ +[6]:http://ifcomp.org/ +[7]:https://ifcomp.org/comp/2017 +[8]:http://www.fiction-interactive.fr/ +[9]:http://www.oldgamesitalia.net/content/marmellata-davventura-2018 +[10]:/file/403396 +[11]:https://opensource.com/sites/default/files/uploads/monkey.png (counterfeit monkey game screenshot) +[12]:http://tads.org/ +[13]:https://www.alanif.se/ +[14]:http://textadventures.co.uk/quest/ +[15]:http://inform7.com/ +[16]:https://github.com/DavidKinder/Inform6 +[17]:http://inform7.com/learn/man/RB_4_1.html#e307 +[18]:/file/403386 +[19]:https://opensource.com/sites/default/files/uploads/inform.png (inform 7 IDE screenshot) +[20]:https://www.youtube.com/watch?v=bu55q_3YtOY +[21]:http://ifwiki.org/index.php/Glulx +[22]:http://ifwiki.org/index.php/Z-machine +[23]:https://github.com/erkyrath/lectrote +[24]:https://github.com/garglk/garglk/ +[25]:http://eblong.com/zarf/glulx/quixe/ +[26]:https://github.com/curiousdannii/parchment +[27]:https://github.com/i7/extensions +[28]:http://twinery.org/ +[29]:https://github.com/klembot/twinejs +[30]:https://opensource.com/article/18/7/twine-vs-renpy-interactive-fiction +[31]:https://tiddlywiki.com/ +[32]:https://github.com/idmillington/undum +[33]:https://github.com/dfabulich/choicescript +[34]:https://www.choiceofgames.com/ +[35]:https://github.com/furkle +[36]:https://github.com/lizadaly/windrift +[37]:http://iftechfoundation.org/committees/twine/ +[38]:/file/403391 +[39]:https://opensource.com/sites/default/files/uploads/harmonia.png (Harmonia opening screen shot) +[40]:https://github.com/iftechfoundation/ifcomp +[41]:https://github.com/iftechfoundation/ifcomp/blob/master/LICENSE.md +[42]:https://www.ifarchive.org/ +[43]:http://blog.iftechfoundation.org/2017-06-30-iftf-is-adopting-the-if-archive.html +[44]:https://github.com/iftechfoundation/ifarchive-ifmap-py +[45]:https://www.ifarchive.org/indexes/if-archiveXgames +[46]:http://ifdb.tads.org/search?sortby=ratu&searchfor=%22source+available%22 +[47]:https://www.ifarchive.org/indexes/if-archiveXgamesXsource.html +[48]:http://ifdb.tads.org/viewgame?id=fft6pu91j85y4acv +[49]:https://github.com/jmacdotorg/warblers-nest/ +[50]:https://github.com/i7/counterfeit-monkey +[51]:https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software +[52]:https://github.com/i7/counterfeit-monkey/blob/master/Counterfeit%20Monkey.materials/Extensions/Counterfeit%20Monkey/Liquids.i7x +[53]:http://ifdb.tads.org/ +[54]:https://ifarchive.org/ +[55]:https://ifcomp.org/comp/last_comp +[56]:http://iftechfoundation.org/ +[57]:http://iftechfoundation.org/cgi-bin/mailman/listinfo/friends +[58]:http://blog.iftechfoundation.org/ +[59]:http://blog.iftechfoundation.org/2017-12-20-the-iftf-gift-shop-is-now-open.html +[60]:https://itsfoss.com/create-interactive-fiction/ diff --git a/published/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md b/published/201908/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md similarity index 100% rename from published/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md rename to published/201908/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md diff --git a/published/20180928 Quiet log noise with Python and machine learning.md b/published/201908/20180928 Quiet log noise with Python and machine learning.md similarity index 100% rename from published/20180928 Quiet log noise with Python and machine learning.md rename to published/201908/20180928 Quiet log noise with Python and machine learning.md diff --git a/published/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md b/published/201908/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md similarity index 100% rename from published/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md rename to published/201908/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md diff --git a/published/20181029 Create animated, scalable vector graphic images with MacSVG.md b/published/201908/20181029 Create animated, scalable vector graphic images with MacSVG.md similarity index 100% rename from published/20181029 Create animated, scalable vector graphic images with MacSVG.md rename to published/201908/20181029 Create animated, scalable vector graphic images with MacSVG.md diff --git a/published/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md b/published/201908/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md similarity index 100% rename from published/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md rename to published/201908/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md diff --git a/published/20181030 Podman- A more secure way to run containers.md b/published/201908/20181030 Podman- A more secure way to run containers.md similarity index 100% rename from published/20181030 Podman- A more secure way to run containers.md rename to published/201908/20181030 Podman- A more secure way to run containers.md diff --git a/published/20181202 How To Customize The GNOME 3 Desktop.md b/published/201908/20181202 How To Customize The GNOME 3 Desktop.md similarity index 100% rename from published/20181202 How To Customize The GNOME 3 Desktop.md rename to published/201908/20181202 How To Customize The GNOME 3 Desktop.md diff --git a/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md b/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md new file mode 100644 index 0000000000..ebf5c606a5 --- /dev/null +++ b/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11268-1.html) +[#]: subject: (Podman and user namespaces: A marriage made in heaven) +[#]: via: (https://opensource.com/article/18/12/podman-and-user-namespaces) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +Podman 和用户名字空间:天作之合 +====== + +> 了解如何使用 Podman 在单独的用户空间运行容器。 + +![](https://img.linux.net.cn/data/attachment/album/201908/25/220204khh9psjo1phllkok.jpg) + +[Podman][1] 是 [libpod][2] 库的一部分,使用户能够管理 pod、容器和容器镜像。在我的上一篇文章中,我写过将 [Podman 作为一种更安全的运行容器的方式][3]。在这里,我将解释如何使用 Podman 在单独的用户命名空间中运行容器。 + +作为分离容器的一个很棒的功能,我一直在思考[用户命名空间][4]user namespace,它主要是由 Red Hat 的 Eric Biederman 开发的。用户命名空间允许你指定用于运行容器的用户标识符(UID)和组标识符(GID)映射。这意味着你可以在容器内以 UID 0 运行,在容器外以 UID 100000 运行。如果容器进程逃逸出了容器,内核会将它们视为以 UID 100000 运行。不仅如此,任何未映射到用户命名空间的 UID 所拥有的文件对象都将被视为 `nobody` 所拥有(UID 是 `65534`, 由 `kernel.overflowuid` 指定),并且不允许容器进程访问,除非该对象可由“其他人”访问(即世界可读/可写)。 + +如果你拥有一个权限为 [660][5] 的属主为“真实” `root` 的文件,而当用户命名空间中的容器进程尝试读取它时,会阻止它们访问它,并且会将该文件视为 `nobody` 所拥有。 + +### 示例 + +以下是它是如何工作的。首先,我在 `root` 拥有的系统中创建一个文件。 + +``` +$ sudo bash -c "echo Test > /tmp/test" +$ sudo chmod 600 /tmp/test +$ sudo ls -l /tmp/test +-rw-------. 1 root root 5 Dec 17 16:40 /tmp/test +``` + +接下来,我将该文件卷挂载到一个使用用户命名空间映射 `0:100000:5000` 运行的容器中。 + +``` +$ sudo podman run -ti -v /tmp/test:/tmp/test:Z --uidmap 0:100000:5000 fedora sh +# id +uid=0(root) gid=0(root) groups=0(root) +# ls -l /tmp/test +-rw-rw----. 1 nobody nobody 8 Nov 30 12:40 /tmp/test +# cat /tmp/test +cat: /tmp/test: Permission denied +``` + +上面的 `--uidmap` 设置告诉 Podman 在容器内映射一系列的 5000 个 UID,从容器外的 UID 100000 开始的范围(100000-104999)映射到容器内 UID 0 开始的范围(0-4999)。在容器内部,如果我的进程以 UID 1 运行,则它在主机上为 100001。 + +由于实际的 `UID=0` 未映射到容器中,因此 `root` 拥有的任何文件都将被视为 `nobody` 所拥有。即使容器内的进程具有 `CAP_DAC_OVERRIDE` 能力,也无法覆盖此种保护。`DAC_OVERRIDE` 能力使得 root 的进程能够读/写系统上的任何文件,即使进程不是 `root` 用户拥有的,也不是全局可读或可写的。 + +用户命名空间的功能与宿主机上的功能不同。它们是命名空间的功能。这意味着我的容器的 root 只在容器内具有功能 —— 实际上只有该范围内的 UID 映射到内用户命名空间。如果容器进程逃逸出了容器,则它将没有任何非映射到用户命名空间的 UID 之外的功能,这包括 `UID=0`。即使进程可能以某种方式进入另一个容器,如果容器使用不同范围的 UID,它们也不具备这些功能。 + +请注意,SELinux 和其他技术还限制了容器进程破开容器时会发生的情况。 + +### 使用 podman top 来显示用户名字空间 + +我们在 `podman top` 中添加了一些功能,允许你检查容器内运行的进程的用户名,并标识它们在宿主机上的真实 UID。 + +让我们首先使用我们的 UID 映射运行一个 `sleep` 容器。 + +``` +$ sudo podman run --uidmap 0:100000:5000 -d fedora sleep 1000 +``` + +现在运行 `podman top`: + +``` +$ sudo podman top --latest user huser +USER   HUSER +root   100000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +注意 `podman top` 报告用户进程在容器内以 `root` 身份运行,但在宿主机(`HUSER`)上以 UID 100000 运行。此外,`ps` 命令确认 `sleep` 过程以 UID 100000 运行。 + +现在让我们运行第二个容器,但这次我们将选择一个单独的 UID 映射,从 200000 开始。 + +``` +$ sudo podman run --uidmap 0:200000:5000 -d fedora sleep 1000 +$ sudo podman top --latest user huser +USER   HUSER +root   200000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +200000   23644 23632  1 08:08 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +请注意,`podman top` 报告第二个容器在容器内以 `root` 身份运行,但在宿主机上是 UID=200000。 + +另请参阅 `ps` 命令,它显示两个 `sleep` 进程都在运行:一个为 100000,另一个为 200000。 + +这意味着在单独的用户命名空间内运行容器可以在进程之间进行传统的 UID 分离,而这从一开始就是 Linux/Unix 的标准安全工具。 + +### 用户名字空间的问题 + +几年来,我一直主张用户命名空间应该作为每个人应该有的安全工具,但几乎没有人使用过。原因是没有任何文件系统支持,也没有一个移动文件系统shifting file system。 + +在容器中,你希望在许多容器之间共享**基本**镜像。上面的每个示例中使用了 Fedora 基本镜像。Fedora 镜像中的大多数文件都由真实的 `UID=0` 拥有。如果我在此镜像上使用用户名称空间 `0:100000:5000` 运行容器,默认情况下它会将所有这些文件视为 `nobody` 所拥有,因此我们需要移动所有这些 UID 以匹配用户名称空间。多年来,我想要一个挂载选项来告诉内核重新映射这些文件 UID 以匹配用户命名空间。上游内核存储开发人员还在继续研究,在此功能上已经取得一些进展,但这是一个难题。 + +由于由 Nalin Dahyabhai 领导的团队开发的自动 [chown][6] 内置于[容器/存储][7]中,Podman 可以在同一镜像上使用不同的用户名称空间。当 Podman 使用容器/存储,并且 Podman 在新的用户命名空间中首次使用一个容器镜像时,容器/存储会 “chown”(如,更改所有权)镜像中的所有文件到用户命名空间中映射的 UID 并创建一个新镜像。可以把它想象成一个 `fedora:0:100000:5000` 镜像。 + +当 Podman 在具有相同 UID 映射的镜像上运行另一个容器时,它使用“预先 chown”的镜像。当我在`0:200000:5000` 上运行第二个容器时,容器/存储会创建第二个镜像,我们称之为 `fedora:0:200000:5000`。 + +请注意,如果你正在执行 `podman build` 或 `podman commit` 并将新创建的镜像推送到容器注册库,Podman 将使用容器/存储来反转该移动,并将推送所有文件属主变回真实 UID=0 的镜像。 + +这可能会导致在新的 UID 映射中创建容器时出现真正的减速,因为 `chown` 可能会很慢,具体取决于镜像中的文件数。此外,在普通的 [OverlayFS][8] 上,镜像中的每个文件都会被复制。普通的 Fedora 镜像最多可能需要 30 秒才能完成 `chown` 并启动容器。 + +幸运的是,Red Hat 内核存储团队(主要是 Vivek Goyal 和 Miklos Szeredi)在内核 4.19 中为 OverlayFS 添加了一项新功能。该功能称为“仅复制元数据”。如果使用 `metacopy=on` 选项来挂载层叠文件系统,则在更改文件属性时,它不会复制较低层的内容;内核会创建新的 inode,其中包含引用指向较低级别数据的属性。如果内容发生变化,它仍会复制内容。如果你想试用它,可以在 Red Hat Enterprise Linux 8 Beta 中使用此功能。 + +这意味着容器 `chown` 可能在两秒钟内发生,并且你不会倍增每个容器的存储空间。 + +这使得像 Podman 这样的工具在不同的用户命名空间中运行容器是可行的,大大提高了系统的安全性。 + +### 前瞻 + +我想向 Podman 添加一个新选项,比如 `--userns=auto`,它会为你运行的每个容器自动选择一个唯一的用户命名空间。这类似于 SELinux 与单独的多类别安全(MCS)标签一起使用的方式。如果设置环境变量 `PODMAN_USERNS=auto`,则甚至不需要设置该选项。 + +Podman 最终允许用户在不同的用户名称空间中运行容器。像 [Buildah][9] 和 [CRI-O][10] 这样的工具也可以利用用户命名空间。但是,对于 CRI-O,Kubernetes 需要了解哪个用户命名空间将运行容器引擎,上游正在开发这个功能。 + +在我的下一篇文章中,我将解释如何在用户命名空间中将 Podman 作为非 root 用户运行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/podman-and-user-namespaces + +作者:[Daniel J Walsh][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://opensource.com/users/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://podman.io/ +[2]: https://github.com/containers/libpod +[3]: https://linux.cn/article-11261-1.html +[4]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html +[5]: https://chmodcommand.com/chmod-660/ +[6]: https://en.wikipedia.org/wiki/Chown +[7]: https://github.com/containers/storage +[8]: https://en.wikipedia.org/wiki/OverlayFS +[9]: https://buildah.io/ +[10]: http://cri-o.io/ diff --git a/published/20181220 Getting started with Prometheus.md b/published/201908/20181220 Getting started with Prometheus.md similarity index 100% rename from published/20181220 Getting started with Prometheus.md rename to published/201908/20181220 Getting started with Prometheus.md diff --git a/published/20181222 How to detect automatically generated emails.md b/published/201908/20181222 How to detect automatically generated emails.md similarity index 100% rename from published/20181222 How to detect automatically generated emails.md rename to published/201908/20181222 How to detect automatically generated emails.md diff --git a/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..8d83afa0dd --- /dev/null +++ b/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11282-1.html) +[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装 VirtualBox +====== + +> 本新手教程解释了在 Ubuntu 和其他基于 Debian 的 Linux 发行版上安装 VirtualBox 的各种方法。 + +![](https://img.linux.net.cn/data/attachment/album/201908/30/072113uzitwinnt9betilt.jpg) + +Oracle 公司的自由开源产品 [VirtualBox][1] 是一款出色的虚拟化工具,专门用于桌面操作系统。与另一款虚拟化工具 [Linux 上的 VMWare Workstation][2] 相比起来,我更喜欢它。 + +你可以使用 VirtualBox 等虚拟化软件在虚拟机中安装和使用其他操作系统。 + +例如,你可以[在 Windows 上的 VirtualBox 中安装 Linux][3]。同样地,你也可以[用 VirtualBox 在 Linux 中安装 Windows][4]。 + +你也可以用 VirtualBox 在你当前的 Linux 系统中安装别的 Linux 发行版。事实上,这就是我用它的原因。如果我听说了一个不错的 Linux 发行版,我会在虚拟机上测试它,而不是安装在真实的系统上。当你想要在安装之前尝试一下别的发行版时,用虚拟机会很方便。 + +![Linux installed inside Linux using VirtualBox][5] + +*安装在 Ubuntu 18.04 内的 Ubuntu 18.10* + +在本新手教程中,我将向你展示在 Ubuntu 和其他基于 Debian 的 Linux 发行版上安装 VirtualBox 的各种方法。 + +### 在 Ubuntu 和基于 Debian 的 Linux 发行版上安装 VirtualBox + +这里提出的安装方法也适用于其他基于 Debian 和 Ubuntu 的 Linux 发行版,如 Linux Mint、elementar OS 等。 + +#### 方法 1:从 Ubuntu 仓库安装 VirtualBox + +**优点**:安装简便 + +**缺点**:较旧版本 + +在 Ubuntu 上下载 VirtualBox 最简单的方法可能是从软件中心查找并下载。 + +![VirtualBox in Ubuntu Software Center][6] + +*VirtualBox 在 Ubuntu 软件中心提供* + +你也可以使用这条命令从命令行安装: + +``` +sudo apt install virtualbox +``` + +然而,如果[在安装前检查软件包版本][7],你会看到 Ubuntu 仓库提供的 VirtualBox 版本已经很老了。 + +举个例子,在写下本教程时 VirtualBox 的最新版本是 6.0,但是在软件中心提供的是 5.2。这意味着你无法获得[最新版 VirtualBox ][8]中引入的新功能。 + +#### 方法 2:使用 Oracle 网站上的 Deb 文件安装 VirtualBox + +**优点**:安装简便,最新版本 + +**缺点**:不能更新 + +如果你想要在 Ubuntu 上使用 VirtualBox 的最新版本,最简单的方法就是[使用 Deb 文件][9]。 + +Oracle 为 VirtiualBox 版本提供了开箱即用的二进制文件。如果查看其下载页面,你将看到为 Ubuntu 和其他发行版下载 deb 安装程序的选项。 + +![VirtualBox Linux Download][10] + +你只需要下载 deb 文件并双击它即可安装。就是这么简单。 + +- [下载 virtualbox for Ubuntu](https://www.virtualbox.org/wiki/Linux_Downloads) + +然而,这种方法的问题在于你不能自动更新到最新的 VirtualBox 版本。唯一的办法是移除现有版本,下载最新版本并再次安装。不太方便,是吧? + +#### 方法 3:用 Oracle 的仓库安装 VirtualBox + +**优点**:自动更新 + +**缺点**:安装略微复杂 + +现在介绍的是命令行安装方法,它看起来可能比较复杂,但与前两种方法相比,它更具有优势。你将获得 VirtualBox 的最新版本,并且未来它还将自动更新到更新的版本。我想那就是你想要的。 + +要通过命令行安装 VirtualBox,请在你的仓库列表中添加 Oracle VirtualBox 的仓库。添加 GPG 密钥以便你的系统信任此仓库。现在,当你安装 VirtualBox 时,它会从 Oracle 仓库而不是 Ubuntu 仓库安装。如果发布了新版本,本地 VirtualBox 将跟随一起更新。让我们看看怎么做到这一点: + +首先,添加仓库的密钥。你可以通过这一条命令下载和添加密钥: + +``` +wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - +``` + +> Mint 用户请注意: + +> 下一步只适用于 Ubuntu。如果你使用的是 Linux Mint 或其他基于 Ubuntu 的发行版,请将命令行中的 `$(lsb_release -cs)` 替换成你当前版本所基于的 Ubuntu 版本。例如,Linux Mint 19 系列用户应该使用 bionic,Mint 18 系列用户应该使用 xenial,像这样: + +> ``` +> sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“` +> ``` + +现在用以下命令来将 Oracle VirtualBox 仓库添加到仓库列表中: + +``` +sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" +``` + +如果你有读过我的文章[检查 Ubuntu 版本][11],你大概知道 `lsb_release -cs` 将打印你的 Ubuntu 系统的代号。 + +**注**:如果你看到 “[add-apt-repository command not found][12]” 错误,你需要下载 `software-properties-common` 包。 + +现在你已经添加了正确的仓库,请通过此仓库刷新可用包列表并安装 VirtualBox: + +``` +sudo apt update && sudo apt install virtualbox-6.0 +``` + +**提示**:一个好方法是输入 `sudo apt install virtualbox-` 并点击 `tab` 键以查看可用于安装的各种 VirtualBox 版本,然后通过补全命令来选择其中一个版本。 + +![Install VirtualBox via terminal][13] + +### 如何从 Ubuntu 中删除 VirtualBox + +现在你已经学会了如何安装 VirtualBox,我还想和你提一下删除它的步骤。 + +如果你是从软件中心安装的,那么删除它最简单的方法是从软件中心下手。你只需要在[已安装的应用程序列表][14]中找到它,然后单击“删除”按钮。 + +另一种方式是使用命令行: + +``` +sudo apt remove virtualbox virtualbox-* +``` + +请注意,这不会删除你用 VirtualBox 安装的操作系统关联的虚拟机和文件。这并不是一件坏事,因为你可能希望以后或在其他系统中使用它们是安全的。 + +### 最后… + +我希望你能在以上方法中选择一种安装 VirtualBox。我还将在另一篇文章中写到如何有效地使用 VirtualBox。目前,如果你有点子、建议或任何问题,请随时在下面发表评论。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-virtualbox-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[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://www.virtualbox.org +[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[3]: https://itsfoss.com/install-linux-in-virtualbox/ +[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ +[8]: https://itsfoss.com/oracle-virtualbox-release/ +[9]: https://itsfoss.com/install-deb-files-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://itsfoss.com/add-apt-repository-command-not-found/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ diff --git a/published/20190304 How to Install MongoDB on Ubuntu.md b/published/201908/20190304 How to Install MongoDB on Ubuntu.md similarity index 100% rename from published/20190304 How to Install MongoDB on Ubuntu.md rename to published/201908/20190304 How to Install MongoDB on Ubuntu.md diff --git a/published/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/published/201908/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md similarity index 100% rename from published/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md rename to published/201908/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md diff --git a/published/20190318 Let-s try dwm - dynamic window manager.md b/published/201908/20190318 Let-s try dwm - dynamic window manager.md similarity index 100% rename from published/20190318 Let-s try dwm - dynamic window manager.md rename to published/201908/20190318 Let-s try dwm - dynamic window manager.md diff --git a/published/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md b/published/201908/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md similarity index 100% rename from published/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md rename to published/201908/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md diff --git a/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md b/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md new file mode 100644 index 0000000000..001e909fc1 --- /dev/null +++ b/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (zionfuo) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11275-1.html) +[#]: subject: (Blockchain 2.0 – An Introduction To Hyperledger Project (HLP) [Part 8]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/) +[#]: author: (editor https://www.ostechnix.com/author/editor/) + +区块链 2.0:Hyperledger 项目简介(八) +====== + +![Introduction To Hyperledger Project][1] + +一旦一个新技术平台在积极发展和商业利益方面达到了一定程度的受欢迎程度,全球的主要公司和小型的初创企业都急于抓住这块蛋糕。在当时 Linux 就是这样的一个平台。一旦实现了其应用程序的普及,个人、公司和机构就开始对其表现出兴趣,到 2000 年,Linux 基金会就成立了。 + +Linux 基金会旨在通过赞助他们的开发团队来将 Linux 作为一个平台来标准化和发展。Linux 基金会是一个由软件和 IT 巨头([如微软、甲骨文、三星、思科、 IBM 、英特尔等][7])支持的非营利组织。这不包括为改进该平台而提供服务的数百名个人开发者。多年来,Linux 基金会已经在旗下开展了许多项目。**Hyperledger** 项目是迄今为止发展最快的项目。 + +在将技术推进至可用且有用的方面上,这种联合主导的开发具有很多优势。为大型项目提供开发标准、库和所有后端协议既昂贵又耗费资源,而且不会从中产生丝毫收入。因此,对于公司来说,通过支持这些组织来汇集他们的资源来开发常见的那些 “烦人” 部分是有很意义的,以及随后完成这些标准部分的工作以简单地即插即用和定制他们的产品。除了这种模型的经济性之外,这种合作努力还产生了标准,使其容易使用和集成到优秀的产品和服务中。 + +上述联盟模式,在曾经或当下的创新包括 WiFi(Wi-Fi 联盟)、移动电话等标准。 + +### Hyperledger 项目(HLP)简介 + +Hyperledger 项目(HLP)于 2015 年 12 月由 Linux 基金会启动,目前是其孵化的增长最快的项目之一。它是一个伞式组织umbrella organization,用于合作开发和推进基于[区块链][2]的分布式账本技术 (DLT) 的工具和标准。支持该项目的主要行业参与者包括 IBM、英特尔 和 SAP Ariba [等][3]。HLP 旨在为个人和公司创建框架,以便根据需要创建共享和封闭的区块链,以满足他们自己的需求。其设计原则是开发一个专注于隐私和未来可审计性的全球可部署、可扩展、强大的区块链平台。[^2] 同样要注意的是大多数提出的区块链及其框架。 + +### 开发目标和构造:即插即用 + +虽然面向企业的平台有以太坊联盟之类的产品,但根据定义,HLP 是面向企业的,并得到行业巨头的支持,他们在 HLP 旗下的许多模块中做出贡献并进一步发展。HLP 还孵化开发的周边项目,并这些创意项目推向公众。HLP 的成员贡献了他们自己的力量,例如 IBM 为如何协作开发贡献了他们的 Fabric 平台。该代码库由 IBM 在其项目组内部研发,并开源出来供所有成员使用。 + +这些过程使得 HLP 中的模块具有高度灵活的插件框架,这将支持企业环境中的快速开发和部署。此外,默认情况下,其他对比的平台是开放的免许可链permission-less blockchain或是公有链public blockchain,甚至可以将它们应用到特定应用当中。HLP 模块本身支持该功能。 + +有关公有链和私有链的差异和用例更多地涵盖在[这篇][4]比较文章当中。 + +根据该项目执行董事 Brian Behlendorf 的说法,Hyperledger 项目的使命有四个。 + +分别是: + + 1. 创建企业级 DLT 框架和标准,任何人都可以移植以满足其特定的行业或个人需求。 + 2. 创建一个强大的开源社区来帮助生态系统发展。 + 3. 促进所述的生态系统的行业成员(如成员公司)的参与。 + 4. 为 HLP 社区提供中立且无偏见的基础设施,以收集和分享相关的更新和发展。 + +可以在这里访问[原始文档][5]。 + +### HLP 的架构 + +HLP 由 12 个项目组成,这些项目被归类为独立的模块,每个项目通常都是结构化的,可以独立开发其模块的。在孵化之前,首先对它们的能力和活力进行研究。该组织的任何成员都可以提出附加建议。在项目孵化后,就会进行积极开发,然后才会推出。这些模块之间的互操作性具有很高的优先级,因此这些组之间的定期通信由社区维护。目前,这些项目中有 4 个被归类为活跃项目。被标为活跃意味着它们已经准备好使用,但还没有准备好发布主要版本。这 4 个模块可以说是推动区块链革命的最重要或相当基本的模块。稍后,我们将详细介绍各个模块及其功能。然而,Hyperledger Fabric 平台的简要描述,可以说是其中最受欢迎的。 + +### Hyperledger Fabric + +Hyperledger Fabric 是一个完全开源的、基于区块链的许可 (非公开) DLT 平台,设计时考虑了企业的使用。该平台提供了适合企业环境的功能和结构。它是高度模块化的,允许开发人员在不同的共识协议、链上代码协议([智能合约][6])或身份管理系统等中进行选择。这是一个基于区块链的许可平台,它利用身份管理系统,这意味着参与者将知道彼此在企业环境中的身份。Fabric 允许以各种主流编程语言 (包括 Java、Javascript、Go 等) 开发智能合约(“链码chaincode”,是 Hyperledger 团队使用的术语)。这使得机构和企业可以利用他们在该领域的现有人才,而无需雇佣或重新培训开发人员来开发他们自己的智能合约。与标准订单验证系统相比,Fabric 还使用执行顺序验证execute-order-validate系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。与标准订单验证系统相比,Fabric还使用执行顺序验证系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。Fabric 的其他功能还有可插拔性能、身份管理系统、数据库管理系统、共识平台等,这些功能使它在竞争中保持领先地位。 + +### 结论 + +诸如 Hyperledger Fabric 平台这样的项目能够在主流用例中更快地采用区块链技术。Hyperledger 社区结构本身支持开放治理原则,并且由于所有项目都是作为开源平台引导的,因此这提高了团队在履行承诺时表现出来的安全性和责任感。 + +由于此类项目的主要应用涉及与企业合作及进一步开发平台和标准,因此 Hyperledger 项目目前在其他类似项目前面处于有利地位。 + +[^2]: E. Androulaki et al., “Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains,” 2018. + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ + +作者:[ostechnix][a] +选题:[lujun9972][b] +译者:[zionfuo](https://github.com/zionfuo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Introduction-To-Hyperledger-Project-720x340.png +[2]: https://linux.cn/article-10650-1.html +[3]: https://www.hyperledger.org/members +[4]: https://linux.cn/article-11080-1.html +[5]: http://www.hitachi.com/rev/archive/2017/r2017_01/expert/index.html +[6]: https://linux.cn/article-10956-1.html +[7]: https://www.theinquirer.net/inquirer/news/2182438/samsung-takes-seat-intel-ibm-linux-foundation diff --git a/published/20190510 Check storage performance with dd.md b/published/201908/20190510 Check storage performance with dd.md similarity index 100% rename from published/20190510 Check storage performance with dd.md rename to published/201908/20190510 Check storage performance with dd.md diff --git a/published/20190611 What is a Linux user.md b/published/201908/20190611 What is a Linux user.md similarity index 100% rename from published/20190611 What is a Linux user.md rename to published/201908/20190611 What is a Linux user.md diff --git a/published/20190613 Continuous integration testing for the Linux kernel.md b/published/201908/20190613 Continuous integration testing for the Linux kernel.md similarity index 100% rename from published/20190613 Continuous integration testing for the Linux kernel.md rename to published/201908/20190613 Continuous integration testing for the Linux kernel.md diff --git a/published/20190617 How To Check Linux Package Version Before Installing It.md b/published/201908/20190617 How To Check Linux Package Version Before Installing It.md similarity index 100% rename from published/20190617 How To Check Linux Package Version Before Installing It.md rename to published/201908/20190617 How To Check Linux Package Version Before Installing It.md diff --git a/published/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md b/published/201908/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md similarity index 100% rename from published/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md rename to published/201908/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md diff --git a/published/20190706 Install NetData Performance Monitoring Tool On Linux.md b/published/201908/20190706 Install NetData Performance Monitoring Tool On Linux.md similarity index 100% rename from published/20190706 Install NetData Performance Monitoring Tool On Linux.md rename to published/201908/20190706 Install NetData Performance Monitoring Tool On Linux.md diff --git a/published/20190709 How to install Elasticsearch and Kibana on Linux.md b/published/201908/20190709 How to install Elasticsearch and Kibana on Linux.md similarity index 100% rename from published/20190709 How to install Elasticsearch and Kibana on Linux.md rename to published/201908/20190709 How to install Elasticsearch and Kibana on Linux.md diff --git a/published/20190711 What is a golden image.md b/published/201908/20190711 What is a golden image.md similarity index 100% rename from published/20190711 What is a golden image.md rename to published/201908/20190711 What is a golden image.md diff --git a/published/20190715 Understanding software design patterns.md b/published/201908/20190715 Understanding software design patterns.md similarity index 100% rename from published/20190715 Understanding software design patterns.md rename to published/201908/20190715 Understanding software design patterns.md diff --git a/published/20190715 What is POSIX- Richard Stallman explains.md b/published/201908/20190715 What is POSIX- Richard Stallman explains.md similarity index 100% rename from published/20190715 What is POSIX- Richard Stallman explains.md rename to published/201908/20190715 What is POSIX- Richard Stallman explains.md diff --git a/published/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md b/published/201908/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md similarity index 100% rename from published/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md rename to published/201908/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md diff --git a/published/20190724 3 types of metric dashboards for DevOps teams.md b/published/201908/20190724 3 types of metric dashboards for DevOps teams.md similarity index 100% rename from published/20190724 3 types of metric dashboards for DevOps teams.md rename to published/201908/20190724 3 types of metric dashboards for DevOps teams.md diff --git a/published/201908/20190725 How to transition into a career as a DevOps engineer.md b/published/201908/20190725 How to transition into a career as a DevOps engineer.md new file mode 100644 index 0000000000..0446257826 --- /dev/null +++ b/published/201908/20190725 How to transition into a career as a DevOps engineer.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11285-1.html) +[#]: subject: (How to transition into a career as a DevOps engineer) +[#]: via: (https://opensource.com/article/19/7/how-transition-career-devops-engineer) +[#]: author: (Conor Delanbanque https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque) + +如何转职为 DevOps 工程师 +====== + +> 无论你是刚毕业的大学生,还是想在职业中寻求进步的经验丰富的 IT 专家,这些提示都可以帮你成为 DevOps 工程师。 + +![](https://img.linux.net.cn/data/attachment/album/201908/30/171751rodhw6wko6fkkwkq.jpg) + +DevOps 工程是一个备受称赞的热门职业。不管你是刚毕业正在找第一份工作,还是在利用之前的行业经验的同时寻求学习新技能的机会,本指南都能帮你通过正确的步骤成为 [DevOps 工程师][2]。 + +### 让自己沉浸其中 + +首先学习 [DevOps][3] 的基本原理、实践以及方法。在使用工具之前,先了解 DevOps 背后的“为什么”。DevOps 工程师的主要目标是在整个软件开发生命周期(SDLC)中提高速度并保持或提高质量,以提供最大的业务价值。阅读文章、观看 YouTube 视频、参加当地小组聚会或者会议 —— 成为热情的 DevOps 社区中的一员,在那里你将从先行者的错误和成功中学习。 + +### 考虑你的背景 + +如果你有从事技术工作的经历,例如软件开发人员、系统工程师、系统管理员、网络运营工程师或者数据库管理员,那么你已经拥有了广泛的见解和有用的经验,它们可以帮助你在未来成为 DevOps 工程师。如果你在完成计算机科学或任何其他 STEM(LCTT 译注:STEM 是科学Science技术Technology工程Engineering数学Math四个学科的首字母缩略字)领域的学业后刚开始职业生涯,那么你将拥有在这个过渡期间需要的一些基本踏脚石。 + +DevOps 工程师的角色涵盖了广泛的职责。以下是企业最有可能使用他们的三种方向: + +* **偏向于开发(Dev)的 DevOps 工程师**,在构建应用中扮演软件开发的角色。他们日常工作的一部分是利用持续集成 / 持续交付(CI/CD)、共享仓库、云和容器,但他们不一定负责构建或实施工具。他们了解基础架构,并且在成熟的环境中,能将自己的代码推向生产环境。 +* **偏向于运维技术(Ops)的 DevOps 工程师**,可以与系统工程师或系统管理员相比较。他们了解软件的开发,但并不会把一天的重心放在构建应用上。相反,他们更有可能支持软件开发团队实现手动流程的自动化,并提高人员和技术系统的效率。这可能意味着分解遗留代码,并用不太繁琐的自动化脚本来运行相同的命令,或者可能意味着安装、配置或维护基础结构和工具。他们确保为任何有需要的团队安装可使用的工具。他们也会通过教团队如何利用 CI / CD 和其他 DevOps 实践来帮助他们。 +* **网站可靠性工程师(SRE)**,就像解决运维和基础设施的软件工程师。SRE 专注于创建可扩展、高可用且可靠的软件系统。 + +在理想的世界中,DevOps 工程师将了解以上所有领域;这在成熟的科技公司中很常见。然而,顶级银行和许多财富 500 强企业的 DevOps 职位通常会偏向开发(Dev)或运营(Ops)。 + +### 要学习的技术 + +DevOps 工程师需要了解各种技术才能有效完成工作。无论你的背景如何,请从作为 DevOps 工程师需要使用和理解的基本技术开始。 + +#### 操作系统 + +操作系统是一切运行的地方,拥有相关的基础知识十分重要。[Linux][4] 是你最有可能每天使用的操作系统,尽管有的组织会使用 Windows 操作系统。要开始使用,你可以在家中安装 Linux,在那里你可以随心所欲地中断,并在此过程中学习。 + +#### 脚本 + +接下来,选择一门语言来学习脚本编程。有很多语言可供选择,包括 Python、Go、Java、Bash、PowerShell、Ruby 和 C / C++。我建议[从 Python 开始][5],因为它相对容易学习和解释,是最受欢迎的语言之一。Python 通常是遵循面向对象编程(OOP)的准则编写的,可用于 Web 开发、软件开发以及创建桌面 GUI 和业务应用程序。 + +#### 云 + +学习了 [Linux][4] 和 [Python][5] 之后,我认为下一个该学习的是云计算。基础设施不再只是“运维小哥”的事情了,因此你需要接触云平台,例如 AWS 云服务、Azure 或者谷歌云平台。我会从 AWS 开始,因为它有大量免费学习工具,可以帮助你降低作为开发人员、运维人员,甚至面向业务的部门的任何障碍。事实上,你可能会被它提供的东西所淹没。考虑从 EC2、S3 和 VPC 开始,然后看看你从其中想学到什么。 + +#### 编程语言 + +如果你对 DevOps 的软件开发充满热情,请继续提高你的编程技能。DevOps 中的一些优秀和常用的编程语言和你用于脚本编程的相同:Python、Go、Java、Bash、PowerShell、Ruby 和 C / C++。你还应该熟悉 Jenkins 和 Git / Github,你将会在 CI / CD 过程中经常使用到它们。 + +#### 容器 + +最后,使用 Docker 和编排平台(如 Kubernetes)等工具开始学习[容器化][6]。网上有大量的免费学习资源,大多数城市都有本地的线下小组,你可以在友好的环境中向有经验的人学习(还有披萨和啤酒哦!)。 + +#### 其他的呢? + +如果你缺乏开发经验,你依然可以通过对自动化的热情,提高效率,与他人协作以及改进自己的工作来[参与 DevOps][3]。我仍然建议学习上述工具,但重点不要放在编程 / 脚本语言上。了解基础架构即服务、平台即服务、云平台和 Linux 会非常有用。你可能会设置工具并学习如何构建具有弹性和容错能力的系统,并在编写代码时利用它们。 + +### 找一份 DevOps 的工作 + +求职过程会有所不同,具体取决于你是否一直从事技术工作,是否正在进入 DevOps 领域,或者是刚开始职业生涯的毕业生。 + +#### 如果你已经从事技术工作 + +如果你正在从一个技术领域转入 DevOps 角色,首先尝试在你当前的公司寻找机会。你能通过和其他的团队一起工作来重新掌握技能吗?尝试跟随其他团队成员,寻求建议,并在不离开当前工作的情况下获得新技能。如果做不到这一点,你可能需要换另一家公司。如果你能从上面列出的一些实践、工具和技术中学习,你将能在面试时展示相关知识从而占据有利位置。关键是要诚实,不要担心失败。大多数招聘主管都明白你并不知道所有的答案;如果你能展示你一直在学习的东西,并解释你愿意学习更多,你应该有机会获得 DevOps 的工作。 + +#### 如果你刚开始职业生涯 + +申请雇用初级 DevOps 工程师的公司的空缺机会。不幸的是,许多公司表示他们希望寻找更富有经验的人,并建议你在获得经验后再申请该职位。这是“我们需要经验丰富的人”的典型,令人沮丧的场景,并且似乎没人愿意给你第一次机会。 + +然而,并不是所有求职经历都那么令人沮丧;一些公司专注于培训和提升刚从大学毕业的学生。例如,我工作的 [MThree][7] 会聘请应届毕业生并且对其进行 8 周的培训。当完成培训后,参与者们可以充分了解到整个 SDLC,并充分了解它在财富 500 强公司环境中的运用方式。毕业生被聘为 MThree 的客户公司的初级 DevOps 工程师 —— MThree 在前 18 - 24 个月内支付全职工资和福利,之后他们将作为直接雇员加入客户。这是弥合从大学到技术职业的间隙的好方法。 + +### 总结 + +转职成 DevOps 工程师的方法有很多种。这是一条非常有益的职业路线,可能会让你保持繁忙和挑战 — 并增加你的收入潜力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/how-transition-career-devops-engineer + +作者:[Conor Delanbanque][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hiring_talent_resume_job_career.png?itok=Ci_ulYAH (technical resume for hiring new talent) +[2]: https://opensource.com/article/19/7/devops-vs-sysadmin +[3]: https://opensource.com/resources/devops +[4]: https://opensource.com/resources/linux +[5]: https://opensource.com/resources/python +[6]: https://opensource.com/article/18/8/sysadmins-guide-containers +[7]: https://www.mthreealumni.com/ diff --git a/published/20190725 Introduction to GNU Autotools.md b/published/201908/20190725 Introduction to GNU Autotools.md similarity index 100% rename from published/20190725 Introduction to GNU Autotools.md rename to published/201908/20190725 Introduction to GNU Autotools.md diff --git a/published/20190726 Manage your passwords with Bitwarden and Podman.md b/published/201908/20190726 Manage your passwords with Bitwarden and Podman.md similarity index 100% rename from published/20190726 Manage your passwords with Bitwarden and Podman.md rename to published/201908/20190726 Manage your passwords with Bitwarden and Podman.md diff --git a/published/20190729 Command line quick tips- More about permissions.md b/published/201908/20190729 Command line quick tips- More about permissions.md similarity index 100% rename from published/20190729 Command line quick tips- More about permissions.md rename to published/201908/20190729 Command line quick tips- More about permissions.md diff --git a/published/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md b/published/201908/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md similarity index 100% rename from published/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md rename to published/201908/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md diff --git a/published/20190730 How to create a pull request in GitHub.md b/published/201908/20190730 How to create a pull request in GitHub.md similarity index 100% rename from published/20190730 How to create a pull request in GitHub.md rename to published/201908/20190730 How to create a pull request in GitHub.md diff --git a/published/20190730 OpenHMD- Open Source Project for VR Development.md b/published/201908/20190730 OpenHMD- Open Source Project for VR Development.md similarity index 100% rename from published/20190730 OpenHMD- Open Source Project for VR Development.md rename to published/201908/20190730 OpenHMD- Open Source Project for VR Development.md diff --git a/published/20190731 Bash aliases you can-t live without.md b/published/201908/20190731 Bash aliases you can-t live without.md similarity index 100% rename from published/20190731 Bash aliases you can-t live without.md rename to published/201908/20190731 Bash aliases you can-t live without.md diff --git a/published/20190801 5 Free Partition Managers for Linux.md b/published/201908/20190801 5 Free Partition Managers for Linux.md similarity index 100% rename from published/20190801 5 Free Partition Managers for Linux.md rename to published/201908/20190801 5 Free Partition Managers for Linux.md diff --git a/published/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md b/published/201908/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md similarity index 100% rename from published/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md rename to published/201908/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md diff --git a/published/20190802 Linux Smartphone Librem 5 is Available for Preorder.md b/published/201908/20190802 Linux Smartphone Librem 5 is Available for Preorder.md similarity index 100% rename from published/20190802 Linux Smartphone Librem 5 is Available for Preorder.md rename to published/201908/20190802 Linux Smartphone Librem 5 is Available for Preorder.md diff --git a/published/20190802 Use Postfix to get email from your Fedora system.md b/published/201908/20190802 Use Postfix to get email from your Fedora system.md similarity index 100% rename from published/20190802 Use Postfix to get email from your Fedora system.md rename to published/201908/20190802 Use Postfix to get email from your Fedora system.md diff --git a/published/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md b/published/201908/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md similarity index 100% rename from published/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md rename to published/201908/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md diff --git a/published/20190805 4 cool new projects to try in COPR for August 2019.md b/published/201908/20190805 4 cool new projects to try in COPR for August 2019.md similarity index 100% rename from published/20190805 4 cool new projects to try in COPR for August 2019.md rename to published/201908/20190805 4 cool new projects to try in COPR for August 2019.md diff --git a/sources/tech/20190805 Find The Linux Distribution Name, Version And Kernel Details.md b/published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md similarity index 54% rename from sources/tech/20190805 Find The Linux Distribution Name, Version And Kernel Details.md rename to published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md index 874f68e181..f133239088 100644 --- a/sources/tech/20190805 Find The Linux Distribution Name, Version And Kernel Details.md +++ b/published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md @@ -1,32 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11270-1.html) [#]: subject: (Find The Linux Distribution Name, Version And Kernel Details) [#]: via: (https://www.ostechnix.com/find-out-the-linux-distribution-name-version-and-kernel-details/) [#]: author: (sk https://www.ostechnix.com/author/sk/) -Find The Linux Distribution Name, Version And Kernel Details +查找 Linux 发行版名称、版本和内核详细信息 ====== ![Find The Linux Distribution Name, Version And Kernel Details][1] -This guide explains how to find the Linux distribution name, version and Kernel details. If your Linux system has GUI mode, you can find these details easily from the System’s Settings. But in CLI mode, it is bit difficult for beginners to find out such details. No problem! Here I have given a few command line methods to find the Linux system information. There could be many, but these methods will work on most Linux distributions. +本指南介绍了如何查找 Linux 发行版名称、版本和内核详细信息。如果你的 Linux 系统有 GUI 界面,那么你可以从系统设置中轻松找到这些信息。但在命令行模式下,初学者很难找到这些详情。没有问题!我这里给出了一些命令行方法来查找 Linux 系统信息。可能有很多,但这些方法适用于大多数 Linux 发行版。 -### 1\. Find Linux distribution name, version +### 1、查找 Linux 发行版名称、版本 -There are many methods to find out what OS is running on in your VPS. +有很多方法可以找出 VPS 中运行的操作系统。 -##### Method 1: +#### 方法 1: -Open your Terminal and run the following command: +打开终端并运行以下命令: ``` $ cat /etc/*-release ``` -**Sample output from CentOS 7:** +CentOS 7 上的示例输出: ``` CentOS Linux release 7.0.1406 (Core) @@ -45,7 +45,7 @@ CentOS Linux release 7.0.1406 (Core) CentOS Linux release 7.0.1406 (Core) ``` -**Sample output from Ubuntu 18.04:** +Ubuntu 18.04 上的示例输出: ``` DISTRIB_ID=Ubuntu @@ -66,29 +66,29 @@ VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic ``` -##### Method 2: +#### 方法 2: -The following command will also get your distribution details. +以下命令也能获取你发行版的详细信息。 ``` $ cat /etc/issue ``` -**Sample output from Ubuntu 18.04:** +Ubuntu 18.04 上的示例输出: ``` Ubuntu 18.04.2 LTS \n \l ``` -##### Method 3: +#### 方法 3: -The following command will get you the distribution details in Debian and its variants like Ubuntu, Linux Mint etc. +以下命令能在 Debian 及其衍生版如 Ubuntu、Linux Mint 上获取发行版详细信息。 ``` $ lsb_release -a ``` -**Sample output:** +示例输出: ``` No LSB modules are available. @@ -98,87 +98,73 @@ Release: 18.04 Codename: bionic ``` -### 2\. Find Linux Kernel details +### 2、查找 Linux 内核详细信息 -##### Method 1: +#### 方法 1: -To find out your Linux kernel details, run the following command from your Terminal. +要查找 Linux 内核详细信息,请在终端运行以下命令。 ``` $ uname -a ``` -**Sample output in CentOS 7:** +CentOS 7 上的示例输出: ``` Linux server.ostechnix.lan 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux ``` -**Sample output in Ubuntu 18.04:** +Ubuntu 18.04 上的示例输出: ``` Linux ostechnix 4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux ``` -Or, +或者, ``` $ uname -mrs ``` -**Sample output:** +示例输出: ``` Linux 4.18.0-25-generic x86_64 ``` -Where, +这里, - * **Linux** – Kernel name - * **4.18.0-25-generic** – Kernel version - * **x86_64** – System hardware architecture (i.e 64 bit system) + * `Linux` – 内核名 + * `4.18.0-25-generic` – 内核版本 + * `x86_64` – 系统硬件架构(即 64 位系统) - - -For more details about uname command, refer the man page. +有关 `uname` 命令的更多详细信息,请参考手册页。 ``` $ man uname ``` -##### Method 2: +#### 方法2: -From your Terminal, run the following command: +在终端中,运行以下命令: ``` $ cat /proc/version ``` -**Sample output from CentOS 7:** +CentOS 7 上的示例输出: ``` Linux version 3.10.0-123.9.3.el7.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Thu Nov 6 15:06:03 UTC 2014 ``` -**Sample output from Ubuntu 18.04:** +Ubuntu 18.04 上的示例输出: ``` Linux version 4.18.0-25-generic ([email protected]) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 ``` -* * * - -**Suggested read:** - - * [**How To Find Linux System Details Using inxi**][2] - * [**Neofetch – Display Linux system Information In Terminal**][3] - * [**How To Find Hardware And Software Specifications In Ubuntu**][4] - - - -* * * - -These are few ways to find find out a Linux distribution’s name, version and Kernel details. Hope you find it useful. +这些是查找 Linux 发行版的名称、版本和内核详细信息的几种方法。希望你觉得它有用。 -------------------------------------------------------------------------------- @@ -186,14 +172,11 @@ via: https://www.ostechnix.com/find-out-the-linux-distribution-name-version-and- 作者:[sk][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.ostechnix.com/author/sk/ [b]: https://github.com/lujun9972 [1]: https://www.ostechnix.com/wp-content/uploads/2015/08/Linux-Distribution-Name-Version-Kernel-720x340.png -[2]: https://www.ostechnix.com/how-to-find-your-system-details-using-inxi/ -[3]: https://www.ostechnix.com/neofetch-display-linux-systems-information/ -[4]: https://www.ostechnix.com/getting-hardwaresoftware-specifications-in-linux-mint-ubuntu/ diff --git a/published/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md b/published/201908/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md similarity index 100% rename from published/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md rename to published/201908/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md diff --git a/published/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md b/published/201908/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md similarity index 100% rename from published/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md rename to published/201908/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md diff --git a/published/20190805 How To Find Hardware Specifications On Linux.md b/published/201908/20190805 How To Find Hardware Specifications On Linux.md similarity index 100% rename from published/20190805 How To Find Hardware Specifications On Linux.md rename to published/201908/20190805 How To Find Hardware Specifications On Linux.md diff --git a/published/20190805 How To Set Up Time Synchronization On Ubuntu.md b/published/201908/20190805 How To Set Up Time Synchronization On Ubuntu.md similarity index 100% rename from published/20190805 How To Set Up Time Synchronization On Ubuntu.md rename to published/201908/20190805 How To Set Up Time Synchronization On Ubuntu.md diff --git a/published/20190805 How To Verify ISO Images In Linux.md b/published/201908/20190805 How To Verify ISO Images In Linux.md similarity index 100% rename from published/20190805 How To Verify ISO Images In Linux.md rename to published/201908/20190805 How To Verify ISO Images In Linux.md diff --git a/published/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md b/published/201908/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md similarity index 100% rename from published/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md rename to published/201908/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md diff --git a/published/20190806 Unboxing the Raspberry Pi 4.md b/published/201908/20190806 Unboxing the Raspberry Pi 4.md similarity index 100% rename from published/20190806 Unboxing the Raspberry Pi 4.md rename to published/201908/20190806 Unboxing the Raspberry Pi 4.md diff --git a/published/20190808 Find Out How Long Does it Take To Boot Your Linux System.md b/published/201908/20190808 Find Out How Long Does it Take To Boot Your Linux System.md similarity index 100% rename from published/20190808 Find Out How Long Does it Take To Boot Your Linux System.md rename to published/201908/20190808 Find Out How Long Does it Take To Boot Your Linux System.md diff --git a/published/20190808 How to manipulate PDFs on Linux.md b/published/201908/20190808 How to manipulate PDFs on Linux.md similarity index 100% rename from published/20190808 How to manipulate PDFs on Linux.md rename to published/201908/20190808 How to manipulate PDFs on Linux.md diff --git a/published/20190809 Copying files in Linux.md b/published/201908/20190809 Copying files in Linux.md similarity index 100% rename from published/20190809 Copying files in Linux.md rename to published/201908/20190809 Copying files in Linux.md diff --git a/published/20190809 Use a drop-down terminal for fast commands in Fedora.md b/published/201908/20190809 Use a drop-down terminal for fast commands in Fedora.md similarity index 100% rename from published/20190809 Use a drop-down terminal for fast commands in Fedora.md rename to published/201908/20190809 Use a drop-down terminal for fast commands in Fedora.md diff --git a/published/20190811 How to measure the health of an open source community.md b/published/201908/20190811 How to measure the health of an open source community.md similarity index 100% rename from published/20190811 How to measure the health of an open source community.md rename to published/201908/20190811 How to measure the health of an open source community.md diff --git a/published/201908/20190812 How Hexdump works.md b/published/201908/20190812 How Hexdump works.md new file mode 100644 index 0000000000..81c499affb --- /dev/null +++ b/published/201908/20190812 How Hexdump works.md @@ -0,0 +1,228 @@ +[#]: collector: (lujun9972) +[#]: translator: (0x996) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11288-1.html) +[#]: subject: (How Hexdump works) +[#]: via: (https://opensource.com/article/19/8/dig-binary-files-hexdump) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Hexdump 如何工作 +====== + +> Hexdump 能帮助你查看二进制文件的内容。让我们来学习 Hexdump 如何工作。 + +![](https://img.linux.net.cn/data/attachment/album/201908/31/111531h9kzcqooluooqoo7.jpg) + +Hexdump 是个用十六进制、十进制、八进制数或 ASCII 码显示二进制文件内容的工具。它是个用于检查的工具,也可用于[数据恢复][2]、逆向工程和编程。 + +### 学习基本用法 + +Hexdump 让你毫不费力地得到输出结果,依你所查看文件的尺寸,输出结果可能会非常多。本文中我们会创建一个 1x1 像素的 PNG 文件。你可以用图像处理应用如 [GIMP][3] 或 [Mtpaint][4] 来创建该文件,或者也可以在终端内用 [ImageMagick][5] 创建。 + +用 ImagiMagick 生成 1x1 像素 PNG 文件的命令如下: + +``` +$ convert -size 1x1 canvas:black pixel.png +``` + +你可以用 `file` 命令确认此文件是 PNG 格式: + +``` +$ file pixel.png +pixel.png: PNG image data, 1 x 1, 1-bit grayscale, non-interlaced +``` + +你可能好奇 `file` 命令是如何判断文件是什么类型。巧的是,那正是 `hexdump` 将要揭示的原理。眼下你可以用你常用的图像查看软件来看看你的单一像素图片(它看上去就像这样:`.`),或者你可以用 `hexdump` 查看文件内部: + +``` +$ hexdump pixel.png +0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244 +0000010 0000 0100 0000 0100 0001 0000 3700 f96e +0000020 0024 0000 6704 4d41 0041 b100 0b8f 61fc +0000030 0005 0000 6320 5248 004d 7a00 0026 8000 +0000040 0084 fa00 0000 8000 00e8 7500 0030 ea00 +0000050 0060 3a00 0098 1700 9c70 51ba 003c 0000 +0000060 6202 474b 0044 dd01 138a 00a4 0000 7407 +0000070 4d49 0745 07e3 081a 3539 a487 46b0 0000 +0000080 0a00 4449 5441 d708 6063 0000 0200 0100 +0000090 21e2 33bc 0000 2500 4574 7458 6164 6574 +00000a0 633a 6572 7461 0065 3032 3931 302d 2d37 +00000b0 3532 3254 3a30 3735 353a 2b33 3231 303a +00000c0 ac30 5dcd 00c1 0000 7425 5845 6474 7461 +00000d0 3a65 6f6d 6964 7966 3200 3130 2d39 3730 +00000e0 322d 5435 3032 353a 3a37 3335 312b 3a32 +00000f0 3030 90dd 7de5 0000 0000 4549 444e 42ae +0000100 8260 +0000102 +``` + +透过一个你以前可能从未用过的视角,你所见的是该示例 PNG 文件的内容。它和你在图像查看软件中看到的是完全一样的数据,只是用一种你或许不熟悉的方式编码。 + +### 提取熟悉的字符串 + +尽管默认的数据输出结果看上去毫无意义,那并不意味着其中没有有价值的信息。你可以用 `--canonical` 选项将输出结果,或至少是其中可翻译的部分,翻译成更加熟悉的字符集: + +``` +$ hexdump --canonical foo.png +00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR| +00000010 00 00 00 01 00 00 00 01 01 00 00 00 00 37 6e f9 |.............7n.| +00000020 24 00 00 00 04 67 41 4d 41 00 00 b1 8f 0b fc 61 |$....gAMA......a| +00000030 05 00 00 00 20 63 48 52 4d 00 00 7a 26 00 00 80 |.... cHRM..z&...| +00000040 84 00 00 fa 00 00 00 80 e8 00 00 75 30 00 00 ea |...........u0...| +00000050 60 00 00 3a 98 00 00 17 70 9c ba 51 3c 00 00 00 |`..:....p..Q<...| +00000060 02 62 4b 47 44 00 01 dd 8a 13 a4 00 00 00 07 74 |.bKGD..........t| +00000070 49 4d 45 07 e3 07 1a 08 39 35 87 a4 b0 46 00 00 |IME.....95...F..| +00000080 00 0a 49 44 41 54 08 d7 63 60 00 00 00 02 00 01 |..IDAT..c`......| +00000090 e2 21 bc 33 00 00 00 25 74 45 58 74 64 61 74 65 |.!.3...%tEXtdate| +000000a0 3a 63 72 65 61 74 65 00 32 30 31 39 2d 30 37 2d |:create.2019-07-| +000000b0 32 35 54 32 30 3a 35 37 3a 35 33 2b 31 32 3a 30 |25T20:57:53+12:0| +000000c0 30 ac cd 5d c1 00 00 00 25 74 45 58 74 64 61 74 |0..]....%tEXtdat| +000000d0 65 3a 6d 6f 64 69 66 79 00 32 30 31 39 2d 30 37 |e:modify.2019-07| +000000e0 2d 32 35 54 32 30 3a 35 37 3a 35 33 2b 31 32 3a |-25T20:57:53+12:| +000000f0 30 30 dd 90 e5 7d 00 00 00 00 49 45 4e 44 ae 42 |00...}....IEND.B| +00000100 60 82 |`.| +00000102 +``` + +在右侧的列中,你看到的是和左侧一样的数据,但是以 ASCII 码展现的。如果你仔细看,你可以从中挑选出一些有用的信息,如文件格式(PNG)以及文件创建、修改日期和时间(向文件底部寻找一下)。 + +`file` 命令通过头 8 个字节获取文件类型。程序员会参考 [libpng 规范][6] 来知晓需要查看什么。具体而言,那就是你能在该图像文件的头 8 个字节中看到的字符串 `PNG`。这个事实显而易见,因为它揭示了 `file` 命令是如何知道要报告的文件类型。 + +你也可以控制 `hexdump` 显示多少字节,这在处理大于一个像素的文件时很实用: + +``` +$ hexdump --length 8 pixel.png +0000000 5089 474e 0a0d 0a1a +0000008 +``` + +`hexdump` 不只限于查看 PNG 或图像文件。你也可以用 `hexdump` 查看你日常使用的二进制文件,如 [ls][7]、[rsync][8],或你想检查的任何二进制文件。 + +### 用 hexdump 实现 cat 命令 + +阅读 PNG 规范的时候你可能会注意到头 8 个字节中的数据与 `hexdump` 提供的结果看上去不一样。实际上,那是一样的数据,但以一种不同的转换方式展现出来。所以 `hexdump` 的输出是正确的,但取决于你在寻找的信息,其输出结果对你而言不总是直接了当的。出于这个原因,`hexdump` 有一些选项可供用于定义格式和转化其转储的原始数据。 + +转换选项可以很复杂,所以用无关紧要的东西练习会比较实用。下面这个简易的介绍,通过重新实现 [cat][9] 命令来演示如何格式化 `hexdump` 的输出。首先,对一个文本文件运行 `hexdump` 来查看其原始数据。通常你可以在硬盘上某处找到 [GNU 通用许可证][10]GNU General Public License(GPL)的一份拷贝,也可以用你手头的任何文本文件。你的输出结果可能不同,但下面是如何在你的系统中找到一份 GPL(或至少其部分)的拷贝: + +``` +$ find /usr/share/doc/ -type f -name "COPYING" | tail -1 +/usr/share/doc/libblkid-devel/COPYING +``` + +对其运行 `hexdump`: + +``` +$ hexdump /usr/share/doc/libblkid-devel/COPYING +0000000 6854 7369 6c20 6269 6172 7972 6920 2073 +0000010 7266 6565 7320 666f 7774 7261 3b65 7920 +0000020 756f 6320 6e61 7220 6465 7369 7274 6269 +0000030 7475 2065 7469 6120 646e 6f2f 0a72 6f6d +0000040 6964 7966 6920 2074 6e75 6564 2072 6874 +0000050 2065 6574 6d72 2073 666f 7420 6568 4720 +0000060 554e 4c20 7365 6573 2072 6547 656e 6172 +0000070 206c 7550 6c62 6369 4c0a 6369 6e65 6573 +0000080 6120 2073 7570 6c62 7369 6568 2064 7962 +[...] +``` + +如果该文件输出结果很长,用 `--length`(或短选项 `-n`)来控制输出长度使其易于管理。 + +原始数据对你而言可能没什么意义,但你已经知道如何将其转换为 ASCII 码: + +``` +hexdump --canonical /usr/share/doc/libblkid-devel/COPYING +00000000  54 68 69 73 20 6c 69 62  72 61 72 79 20 69 73 20  |This library is | +00000010  66 72 65 65 20 73 6f 66  74 77 61 72 65 3b 20 79  |free software; y| +00000020  6f 75 20 63 61 6e 20 72  65 64 69 73 74 72 69 62  |ou can redistrib| +00000030  75 74 65 20 69 74 20 61  6e 64 2f 6f 72 0a 6d 6f  |ute it and/or.mo| +00000040  64 69 66 79 20 69 74 20  75 6e 64 65 72 20 74 68  |dify it under th| +00000050  65 20 74 65 72 6d 73 20  6f 66 20 74 68 65 20 47  |e terms of the G| +00000060  4e 55 20 4c 65 73 73 65  72 20 47 65 6e 65 72 61  |NU Lesser Genera| +00000070  6c 20 50 75 62 6c 69 63  0a 4c 69 63 65 6e 73 65  |l Public.License| +[...] +``` + +这个输出结果有帮助但太累赘且难于阅读。要将 `hexdump` 的输出结果转换为其选项不支持的其他格式,可组合使用 `--format`(或 `-e`)和专门的格式代码。用来自定义格式的代码和 `printf` 命令使用的类似,所以如果你熟悉 `printf` 语句,你可能会觉得 `hexdump` 自定义格式不难学会。 + +在 `hexdump` 中,字符串 `%_p` 告诉 `hexdump` 用你系统的默认字符集输出字符。`--format` 选项的所有格式符号必须以*单引号*包括起来: + +``` +$ hexdump -e'"%_p"' /usr/share/doc/libblkid-devel/COPYING +This library is fre* + software; you can redistribute it and/or.modify it under the terms of the GNU Les* +er General Public.License as published by the Fre* + Software Foundation; either.version 2.1 of the License, or (at your option) any later.version..* +The complete text of the license is available in the..* +/Documentation/licenses/COPYING.LGPL-2.1-or-later file.. +``` + +这次的输出好些了,但依然不方便阅读。传统上 UNIX 文本文件假定 80 个字符的输出宽度(因为很久以前显示器一行只能显示 80 个字符)。 + +尽管这个输出结果未被自定义格式限制输出宽度,你可以用附加选项强制 `hexdump` 一次处理 80 字节。具体而言,通过 80 除以 1 这种形式,你可以告诉 `hexdump` 将 80 字节作为一个单元对待: + +``` +$ hexdump -e'80/1 "%_p"' /usr/share/doc/libblkid-devel/COPYING +This library is free software; you can redistribute it and/or.modify it under the terms of the GNU Lesser General Public.License as published by the Free Software Foundation; either.version 2.1 of the License, or (at your option) any later.version...The complete text of the license is available in the.../Documentation/licenses/COPYING.LGPL-2.1-or-later file.. +``` + +现在该文件被分割成 80 字节的块处理,但没有任何换行。你可以用 `\n` 字符自行添加换行,在 UNIX 中它代表换行: + +``` +$ hexdump -e'80/1 "%_p""\n"' +This library is free software; you can redistribute it and/or.modify it under th +e terms of the GNU Lesser General Public.License as published by the Free Softwa +re Foundation; either.version 2.1 of the License, or (at your option) any later. +version...The complete text of the license is available in the.../Documentation/ +licenses/COPYING.LGPL-2.1-or-later file.. +``` + +现在你已经(大致上)用 `hexdump` 自定义格式实现了 `cat` 命令。 + +### 控制输出结果 + +实际上自定义格式是让 `hexdump` 变得有用的方法。现在你已经(至少是原则上)熟悉 `hexdump` 自定义格式,你可以让 `hexdump -n 8` 的输出结果跟 `libpng` 官方规范中描述的 PNG 文件头相匹配了。 + +首先,你知道你希望 `hexdump` 以 8 字节的块来处理 PNG 文件。此外,你可能通过识别这些整数从而知道 PNG 格式规范是以十进制数表述的,根据 `hexdump` 文档,十进制用 `%d` 来表示: + +``` +$ hexdump -n8 -e'8/1 "%d""\n"' pixel.png +13780787113102610 +``` + +你可以在每个整数后面加个空格使输出结果变得完美: + +``` +$ hexdump -n8 -e'8/1 "%d ""\n"' pixel.png +137 80 78 71 13 10 26 10 +``` + +现在输出结果跟 PNG 规范完美匹配了。 + +### 好玩又有用 + +Hexdump 是个迷人的工具,不仅让你更多地领会计算机如何处理和转换信息,而且让你了解文件格式和编译的二进制文件如何工作。日常工作时你可以随机地试着对不同文件运行 `hexdump`。你永远不知道你会发现什么样的信息,或是什么时候具有这种洞察力会很实用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/dig-binary-files-hexdump + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[0x996](https://github.com/0x996) +校对:[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/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://www.redhat.com/sysadmin/find-lost-files-scalpel +[3]: http://gimp.org +[4]: https://opensource.com/article/17/2/mtpaint-pixel-art-animated-gifs +[5]: https://opensource.com/article/17/8/imagemagick +[6]: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html +[7]: https://opensource.com/article/19/7/master-ls-command +[8]: https://opensource.com/article/19/5/advanced-rsync +[9]: https://opensource.com/article/19/2/getting-started-cat-command +[10]: https://en.wikipedia.org/wiki/GNU_General_Public_License diff --git a/published/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md b/published/201908/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md similarity index 100% rename from published/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md rename to published/201908/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md diff --git a/published/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md b/published/201908/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md similarity index 100% rename from published/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md rename to published/201908/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md diff --git a/published/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md b/published/201908/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md similarity index 100% rename from published/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md rename to published/201908/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md diff --git a/published/20190815 How To Change Linux Console Font Type And Size.md b/published/201908/20190815 How To Change Linux Console Font Type And Size.md similarity index 100% rename from published/20190815 How To Change Linux Console Font Type And Size.md rename to published/201908/20190815 How To Change Linux Console Font Type And Size.md diff --git a/translated/tech/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md b/published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md similarity index 89% rename from translated/tech/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md rename to published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md index b7eddc11fb..0abdba8e6d 100644 --- a/translated/tech/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md +++ b/published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11283-1.html) [#]: subject: (How To Fix “Kernel driver not installed (rc=-1908)” VirtualBox Error In Ubuntu) [#]: via: (https://www.ostechnix.com/how-to-fix-kernel-driver-not-installed-rc-1908-virtualbox-error-in-ubuntu/) [#]: author: (sk https://www.ostechnix.com/author/sk/) @@ -26,7 +26,7 @@ where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support d ![][2] -Ubuntu 中的 “Kernel driver not installed (rc=-1908)” 错误 +*Ubuntu 中的 “Kernel driver not installed (rc=-1908)” 错误* 我点击了 OK 关闭消息框,然后在后台看到了另一条消息。 @@ -45,7 +45,7 @@ IMachine {85cd948e-a71f-4289-281e-0ca7ad48cd89} ![][3] -启动期间虚拟机意外终止,退出代码为 1(0x1) +*启动期间虚拟机意外终止,退出代码为 1(0x1)* 我不知道该先做什么。我运行以下命令来检查是否有用。 @@ -61,7 +61,7 @@ modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/5.0.0-23-gen 仔细阅读这两个错误消息后,我意识到我应该更新 Virtualbox 程序。 -如果你在 Ubuntu 及其衍生版(如 Linux Mint)中遇到此错误,你只需使用以下命令重新安装或更新 **“virtualbox-dkms”** 包: +如果你在 Ubuntu 及其衍生版(如 Linux Mint)中遇到此错误,你只需使用以下命令重新安装或更新 `virtualbox-dkms` 包: ``` $ sudo apt install virtualbox-dkms @@ -82,7 +82,7 @@ via: https://www.ostechnix.com/how-to-fix-kernel-driver-not-installed-rc-1908-vi 作者:[sk][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/) 荣誉推出 diff --git a/published/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md b/published/201908/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md similarity index 100% rename from published/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md rename to published/201908/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md diff --git a/published/20190815 How To Setup Multilingual Input Method On Ubuntu.md b/published/201908/20190815 How To Setup Multilingual Input Method On Ubuntu.md similarity index 100% rename from published/20190815 How To Setup Multilingual Input Method On Ubuntu.md rename to published/201908/20190815 How To Setup Multilingual Input Method On Ubuntu.md diff --git a/published/20190815 SSLH - Share A Same Port For HTTPS And SSH.md b/published/201908/20190815 SSLH - Share A Same Port For HTTPS And SSH.md similarity index 100% rename from published/20190815 SSLH - Share A Same Port For HTTPS And SSH.md rename to published/201908/20190815 SSLH - Share A Same Port For HTTPS And SSH.md diff --git a/published/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md b/published/201908/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md similarity index 100% rename from published/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md rename to published/201908/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md diff --git a/published/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md b/published/201908/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md similarity index 100% rename from published/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md rename to published/201908/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md diff --git a/published/201908/20190820 A guided tour of Linux file system types.md b/published/201908/20190820 A guided tour of Linux file system types.md new file mode 100644 index 0000000000..0914e3b7d1 --- /dev/null +++ b/published/201908/20190820 A guided tour of Linux file system types.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11274-1.html) +[#]: subject: (A guided tour of Linux file system types) +[#]: via: (https://www.networkworld.com/article/3432990/a-guided-tour-of-linux-file-system-types.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 文件系统类型导览 +====== + +> Linux 文件系统多年来在不断发展,让我们来看一下文件系统类型。 + +![](https://img.linux.net.cn/data/attachment/album/201908/27/175516vzrp4j4zevcqr66c.jpg) + +虽然对于普通用户来说可能并不明显,但在过去十年左右的时间里,Linux 文件系统已经发生了显著的变化,这使它们能够更好对抗损坏和性能问题。 + +如今大多数 Linux 系统使用名为 ext4 的文件系统。 “ext” 代表“扩展extended”,“4” 表示这是此文件系统的第 4 代。随着时间的推移添加的功能包括:能够提供越来越大的文件系统(目前大到 1,000,000 TiB)和更大的文件(高达 16 TiB),更抗系统崩溃,更少碎片(将单个文件分散为存在多个位置的块)以提高性能。 + +ext4 文件系统还带来了对性能、可伸缩性和容量的其他改进。实现了元数据和日志校验和以增强可靠性。时间戳现在可以跟踪纳秒级变化,以便更好地对文件打戳(例如,文件创建和最后更新时间)。并且,在时间戳字段中增加了两个位,2038 年的问题(存储日期/时间的字段将从最大值翻转到零)已被推迟到了 400 多年之后(到 2446)。 + +### 文件系统类型 + +要确定 Linux 系统上文件系统的类型,请使用 `df` 命令。下面显示的命令中的 `-T` 选项显示文件系统类型。 `-h` 显示“易读的”磁盘大小。换句话说,调整报告的单位(如 M 和 G),使人们更好地理解。 + +``` +$ df -hT | head -10 +Filesystem Type Size Used Avail Use% Mounted on +udev devtmpfs 2.9G 0 2.9G 0% /dev +tmpfs tmpfs 596M 1.5M 595M 1% /run +/dev/sda1 ext4 110G 50G 55G 48% / +/dev/sdb2 ext4 457G 642M 434G 1% /apps +tmpfs tmpfs 3.0G 0 3.0G 0% /dev/shm +tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock +tmpfs tmpfs 3.0G 0 3.0G 0% /sys/fs/cgroup +/dev/loop0 squashfs 89M 89M 0 100% /snap/core/7270 +/dev/loop2 squashfs 142M 142M 0 100% /snap/hexchat/42 +``` + +请注意,`/`(根)和 `/apps` 的文件系统都是 ext4,而 `/dev` 是 devtmpfs 文件系统(一个由内核填充的自动化设备节点)。其他的文件系统显示为 tmpfs(驻留在内存和/或交换分区中的临时文件系统)和 squashfs(只读压缩文件系统的文件系统,用于快照包)。 + +还有 proc 文件系统,用于存储正在运行的进程的信息。 + +``` +$ df -T /proc +Filesystem Type 1K-blocks Used Available Use% Mounted on +proc proc 0 0 0 - /proc +``` + +当你在整个文件系统中游览时,可能会遇到许多其他文件系统类型。例如,当你移动到目录中并想了解它的文件系统时,可以运行以下命令: + +``` +$ cd /dev/mqueue; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +mqueue mqueue 0 0 0 - /dev/mqueue +$ cd /sys; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +sysfs sysfs 0 0 0 - /sys +$ cd /sys/kernel/security; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +securityfs securityfs 0 0 0 - /sys/kernel/security +``` + +与其他 Linux 命令一样,这里的 `.` 代表整个文件系统的当前位置。 + +这些和其他独特的文件系统提供了一些特殊功能。例如,securityfs 提供支持安全模块的文件系统。 + +Linux 文件系统需要能够抵抗损坏,能够承受系统崩溃并提供快速、可靠的性能。由几代 ext 文件系统和新一代专用文件系统提供的改进使 Linux 系统更易于管理和更可靠。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3432990/a-guided-tour-of-linux-file-system-types.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/guided-tour-on-the-flaker_people-in-horse-drawn-carriage_germany-by-andreas-lehner-flickr-100808681-large.jpg +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md b/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md new file mode 100644 index 0000000000..e37d9dd215 --- /dev/null +++ b/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md @@ -0,0 +1,404 @@ +[#]: collector: (lujun9972) +[#]: translator: (hello-wn) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11276-1.html) +[#]: subject: (How to Delete Lines from a File Using the sed Command) +[#]: via: (https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 sed 命令删除文件中的行 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/28/100204ei6v98sa69hdf3zf.jpg) + +Sed 代表流编辑器Stream Editor,常用于 Linux 中基本的文本处理。`sed` 命令是 Linux 中的重要命令之一,在文件处理方面有着重要作用。可用于删除或移动与给定模式匹配的特定行。 + +它还可以删除文件中的特定行,它能够从文件中删除表达式,文件可以通过指定分隔符(例如逗号、制表符或空格)进行标识。 + +本文列出了 15 个使用范例,它们可以帮助你掌握 `sed` 命令。 + +如果你能理解并且记住这些命令,在你需要使用 `sed` 时,这些命令就能派上用场,帮你节约很多时间。 + +注意:为了方便演示,我在执行 `sed` 命令时,不使用 `-i` 选项(因为这个选项会直接修改文件内容),被移除了行的文件内容将打印到 Linux 终端。 + +但是,如果你想在实际环境中从源文件中删除行,请在 `sed` 命令中使用 `-i` 选项。 + +演示之前,我创建了 `sed-demo.txt` 文件,并添加了以下内容和相应行号以便更好地理解。 + +``` +# cat sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 1) 如何删除文件的第一行? + +使用以下语法删除文件首行。 + +`N` 表示文件中的第 N 行,`d` 选项在 `sed` 命令中用于删除一行。 + +语法: + +``` +sed 'Nd' file +``` + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第一行。 + +``` +# sed '1d' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 2) 如何删除文件的最后一行? + +使用以下语法删除文件最后一行。 + +`$` 符号表示文件的最后一行。 + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的最后一行。 + +``` +# sed '$d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +``` + +### 3) 如何删除指定行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第 3 行。 + +``` +# sed '3d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 4) 如何删除指定范围内的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第 5 到 7 行。 + +``` +# sed '5,7d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 5) 如何删除多行内容? + +`sed` 命令能够删除给定行的集合。 + +本例中,下面的 `sed` 命令删除了第 1 行、第 5 行、第 9 行和最后一行。 + +``` +# sed '1d;5d;9d;$d' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +6 Arch Linux +7 CentOS +8 Debian +``` + +### 5a) 如何删除指定范围以外的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中第 3 到 6 行范围以外的所有行。 + +``` +# sed '3,6!d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +``` + +### 6) 如何删除空行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的空行。 + +``` +# sed '/^$/d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 7) 如何删除包含某个模式的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中匹配到 `System` 模式的行。 + +``` +# sed '/System/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 8) 如何删除包含字符串集合中某个字符串的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中匹配到 `System` 或 `Linux` 表达式的行。 + +``` +# sed '/System\|Linux/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 9) 如何删除以指定字符开头的行? + +为了测试,我创建了 `sed-demo-1.txt` 文件,并添加了以下内容。 + +``` +# cat sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +使用以下 `sed` 命令删除以 `R` 字符开头的所有行。 + +``` +# sed '/^R/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +Fedora +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +使用以下 `sed` 命令删除 `R` 或者 `F` 字符开头的所有行。 + +``` +# sed '/^[RF]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +### 10) 如何删除以指定字符结尾的行? + +使用以下 `sed` 命令删除 `m` 字符结尾的所有行。 + +``` +# sed '/m$/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +使用以下 `sed` 命令删除 `x` 或者 `m` 字符结尾的所有行。 + +``` +# sed '/[xm]$/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 11) 如何删除所有大写字母开头的行? + +使用以下 `sed` 命令删除所有大写字母开头的行。 + +``` +# sed '/^[A-Z]/d' sed-demo-1.txt + +debian +ubuntu +2 - Manjaro +3 4 5 6 +``` + +### 12) 如何删除指定范围内匹配模式的行? + +使用以下 `sed` 命令删除第 1 到 6 行中包含 `Linux` 表达式的行。 + +``` +# sed '1,6{/Linux/d;}' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 13) 如何删除匹配模式的行及其下一行? + +使用以下 `sed` 命令删除包含 `System` 表达式的行以及它的下一行。 + +``` +# sed '/System/{N;d;}' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 14) 如何删除包含数字的行? + +使用以下 `sed` 命令删除所有包含数字的行。 + +``` +# sed '/[0-9]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +``` + +使用以下 `sed` 命令删除所有以数字开头的行。 + +``` +# sed '/^[0-9]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +Arch Linux - 1 +``` + +使用以下 `sed` 命令删除所有以数字结尾的行。 + +``` +# sed '/[0-9]$/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +2 - Manjaro +``` + +### 15) 如何删除包含字母的行? + +使用以下 `sed` 命令删除所有包含字母的行。 + +``` +# sed '/[A-Za-z]/d' sed-demo-1.txt + +3 4 5 6 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/201908/20190823 Managing credentials with KeePassXC.md b/published/201908/20190823 Managing credentials with KeePassXC.md new file mode 100644 index 0000000000..93c6826b7e --- /dev/null +++ b/published/201908/20190823 Managing credentials with KeePassXC.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11278-1.html) +[#]: subject: (Managing credentials with KeePassXC) +[#]: via: (https://fedoramagazine.org/managing-credentials-with-keepassxc/) +[#]: author: (Marco Sarti https://fedoramagazine.org/author/msarti/) + +使用 KeePassXC 管理凭据 +====== + +![][1] + +[上一篇文章][2]我们讨论了使用服务器端技术的密码管理工具。这些工具非常有趣而且适合云安装。在本文中,我们将讨论 KeePassXC,这是一个简单的多平台开源软件,它使用本地文件作为数据库。 + +这种密码管理软件的主要优点是简单。无需服务器端技术专业知识,因此可供任何类型的用户使用。 + +### 介绍 KeePassXC + +KeePassXC 是一个开源的跨平台密码管理器:它是作为 KeePassX 的一个分支开始开发的,这是个不错的产品,但开发不是非常活跃。它使用 256 位密钥的 AES 算法将密钥保存在加密数据库中,这使得在云端设备(如 pCloud 或 Dropbox)中保存数据库相当安全。 + +除了密码,KeePassXC 还允许你在加密皮夹中保存各种信息和附件。它还有一个有效的密码生成器,可以帮助用户正确地管理他的凭据。 + +### 安装 + +这个程序在标准的 Fedora 仓库和 Flathub 仓库中都有。不幸的是,在沙箱中运行的程序无法使用浏览器集成,所以我建议通过 dnf 安装程序: + +``` +sudo dnf install keepassxc +``` + +### 创建你的皮夹 + +要创建新数据库,有两个重要步骤: + +* 选择加密设置:默认设置相当安全,增加转换轮次也会增加解密时间。 +* 选择主密钥和额外保护:主密钥必须易于记忆(如果丢失它,你的皮夹就会丢失!)而足够强大,一个至少有 4 个随机单词的密码可能是一个不错的选择。作为额外保护,你可以选择密钥文件(请记住:你必须始终都有它,否则无法打开皮夹)和/或 YubiKey 硬件密钥。 + +![][3] + +![][4] + +数据库文件将保存到文件系统。如果你想与其他计算机/设备共享,可以将它保存在 U 盘或 pCloud 或 Dropbox 等云存储中。当然,如果你选择云存储,建议使用特别强大的主密码,如果有额外保护则更好。 + +### 创建你的第一个条目 + +创建数据库后,你可以开始创建第一个条目。对于 Web 登录,请在“条目”选项卡中输入用户名、密码和 URL。你可以根据个人策略指定凭据的到期日期,也可以通过按右侧的按钮下载网站的 favicon 并将其关联为条目的图标,这是一个很好的功能。 + +![][5] + +![][6] + +KeePassXC 还提供了一个很好的密码/口令生成器,你可以选择长度和复杂度,并检查对暴力攻击的抵抗程度: + +![][7] + +### 浏览器集成 + +KeePassXC 有一个适用于所有主流浏览器的扩展。该扩展允许你填写所有已指定 URL 条目的登录信息。 + +必须在 KeePassXC(工具菜单 -> 设置)上启用浏览器集成,指定你要使用的浏览器: + +![][8] + +安装扩展后,必须与数据库建立连接。要执行此操作,请按扩展按钮,然后按“连接”按钮:如果数据库已打开并解锁,那么扩展程序将创建关联密钥并将其保存在数据库中,该密钥对于浏览器是唯一的,因此我建议对它适当命名: + +![][9] + +当你打开 URL 字段中的登录页并且数据库是解锁的,那么这个扩展程序将为你提供与该页面关联的所有凭据: + +![][10] + +通过这种方式,你可以通过 KeePassXC 获取互联网凭据,而无需将其保存在浏览器中。 + +### SSH 代理集成 + +KeePassXC 的另一个有趣功能是与 SSH 集成。如果你使用 ssh 代理,KeePassXC 能够与之交互并添加你上传的 ssh 密钥到条目中。 + +首先,在常规设置(工具菜单 -> 设置)中,你必须启用 ssh 代理并重启程序: + +![][11] + +此时,你需要以附件方式上传你的 ssh 密钥对到条目中。然后在 “SSH 代理” 选项卡中选择附件下拉列表中的私钥,此时会自动填充公钥。不要忘记选择上面的两个复选框,以便在数据库打开/解锁时将密钥添加到代理,并在数据库关闭/锁定时删除: + +![][12] + +现在打开和解锁数据库,你可以使用皮夹中保存的密钥登录 ssh。 + +唯一的限制是可以添加到代理的最大密钥数:ssh 服务器默认不接受超过 5 次登录尝试,出于安全原因,建议不要增加此值。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-credentials-with-keepassxc/ + +作者:[Marco Sarti][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/msarti/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/keepassxc-816x345.png +[2]: https://linux.cn/article-11181-1.html +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-33-27.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-48-21.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-30-07.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-43-11.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-49-22.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-48-09.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-05-57.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-13-29.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-47-21.png +[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-46-35.png diff --git a/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md b/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md new file mode 100644 index 0000000000..b8ce475557 --- /dev/null +++ b/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11271-1.html) +[#]: subject: (Happy birthday to the Linux kernel: What's your favorite release?) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-favorite-release) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +Linux 内核生日快乐 —— 那么你喜欢哪个版本? +====== + +> 自从第一个 Linux 内核发布已经过去 28 年了。自 1991 年以来发布了几十个 Linux 内核版本,你喜欢的是哪个?投个票吧! + +![][1] + +让我们回到 1991 年 8 月,那个创造历史的时间。科技界经历过许多关键时刻,这些时刻仍在影响着我们。在那个 8 月,Tim Berners-Lee 宣布了一个名为万维网World Wide Web的有趣项目,并推出了第一个网站;超级任天堂在美国发布,为所有年龄段的孩子们开启了新的游戏篇章;在赫尔辛基大学,一位名叫 Linus Torvalds 的学生向同好们询问(1991 年 8 月 25 日)了他作为[业余爱好][3]开发的新免费操作系统的反馈。那时 Linux 内核诞生了。 + +如今,我们可以浏览超过 15 亿个网站,在我们的电视机上玩另外五种任天堂游戏机,并维护着六个长期 Linux 内核。以下是我们的一些作者对他们最喜欢的 Linux 内核版本所说的话。 + +“引入模块的那个版本(1.2 吧?)。这是 Linux 迈向成功的未来的重要一步。” - Milan Zamazal + +“2.6.9,因为它是我 2006 年加入 Red Hat 时的版本(在 RHEL4 中)。但我也更钟爱 2.6.18(RHEL5)一点,因为它在大规模部署的、我们最大客户(Telco, FSI)的关键任务工作负载中使用。它还带来了我们最大的技术变革之一:虚拟化(Xen 然后是 KVM)。” - Herve Lemaitre + +“4.10。(虽然我不知道如何衡量这一点)。” - Ivan Bazulic + +“Fedora 30 附带的新内核修复了我的 Thinkpad Yoga 笔记本电脑的挂起问题;挂起功能现在可以完美运行。我是一个笨人,只是忍受这个问题而从未试着提交错误报告,所以我特别感谢这项工作,我知道一定会解决这个问题。” - MáirínDuffy + +“2.6.16 版本将永远在我的心中占有特殊的位置。这是我负责将其转换为在 hertz neverlost gps 系统上运行的第一个内核。我负责这项为那个设备构建内核和根文件系统的工作,对我来说这真的是一个奇迹时刻。我们在初次发布后多次更新了内核,但我想我必须还是推选那个最初版本,不过,我对于它的热爱没有任何技术原因,这纯属感性选择 =)” - Michael McCune + +“我最喜欢的 Linux 内核版本是 2.4.0 系列,它集成了对 USB、LVM 和 ext3 的支持。ext3 是第一个具有日志支持的主流 Linux 文件系统,其从 2.4.15 内核可用。我使用的第一个内核版本是 2.2.13。” - Sean Nelson + +“也许是 2.2.14,因为它是在我安装的第一个 Linux 上运行的版本(Mandrake Linux 7.0,在 2000 IIRC)。它也是我第一个需要重新编译以让我的视频卡或我的调制解调器(记不清了)工作的版本。” - GermánPulido + +“我认为最新的一个!但我有段时间使用实时内核扩展来进行音频制作。” - Mario Torre + +*在 Linux 内核超过 [52 个的版本][2]当中,你最喜欢哪一个?参加我们的调查并在评论中告诉我们原因。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-favorite-release + +作者:[Lauren Pritchett][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://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/luis-ibanezhttps://opensource.com/users/mhayden +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_anniversary_celebreate_tux.jpg?itok=JOE-yXus +[2]: http://phb-crystal-ball.org/ +[3]: http://lkml.iu.edu/hypermail/linux/kernel/1908.3/00457.html diff --git a/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md b/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md new file mode 100644 index 0000000000..be4bbb0a36 --- /dev/null +++ b/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11286-1.html) +[#]: subject: (How to Install Ansible (Automation Tool) on Debian 10 (Buster)) +[#]: via: (https://www.linuxtechi.com/install-ansible-automation-tool-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Debian 10 上安装 Ansible +====== + +在如今的 IT 领域,自动化一个是热门话题,每个组织都开始采用自动化工具,像 Puppet、Ansible、Chef、CFEngine、Foreman 和 Katello。在这些工具中,Ansible 是几乎所有 IT 组织中管理 UNIX 和 Linux 系统的首选。在本文中,我们将演示如何在 Debian 10 Sever 上安装和使用 Ansible。 + +![Ansible-Install-Debian10][2] + +我的实验室环境: + +* Debian 10 – Ansible 服务器/ 控制节点 – 192.168.1.14 +* CentOS 7 – Ansible 主机 (Web 服务器)– 192.168.1.15 +* CentOS 7 – Ansible 主机(DB 服务器)– 192.169.1.17 + +我们还将演示如何使用 Ansible 服务器管理 Linux 服务器 + +### 在 Debian 10 Server 上安装 Ansible + +我假设你的 Debian 10 中有一个拥有 root 或 sudo 权限的用户。在我这里,我有一个名为 `pkumar` 的本地用户,它拥有 sudo 权限。 + +Ansible 2.7 包存在于 Debian 10 的默认仓库中,在命令行中运行以下命令安装 Ansible, + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install ansible -y +``` + +运行以下命令验证 Ansible 版本, + +``` +root@linuxtechi:~$ sudo ansible --version +``` + +![ansible-version](https://www.linuxtechi.com/wp-content/uploads/2019/08/ansible-version.jpg) + +要安装最新版本的 Ansible 2.8,首先我们必须设置 Ansible 仓库。 + +一个接一个地执行以下命令, + +``` +root@linuxtechi:~$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | sudo tee -a /etc/apt/sources.list +root@linuxtechi:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install ansible -y +root@linuxtechi:~$ sudo ansible --version +``` + +![latest-ansible-version](https://www.linuxtechi.com/wp-content/uploads/2019/08/latest-ansible-version.jpg) + +### 使用 Ansible 管理 Linux 服务器 + +请参考以下步骤,使用 Ansible 控制器节点管理 Linux 类的服务器, + +#### 步骤 1:在 Ansible 服务器及其主机之间交换 SSH 密钥 + +在 Ansible 服务器生成 ssh 密钥并在 Ansible 主机之间共享密钥。 + +``` +root@linuxtechi:~$ sudo -i +root@linuxtechi:~# ssh-keygen +root@linuxtechi:~# ssh-copy-id root@linuxtechi +root@linuxtechi:~# ssh-copy-id root@linuxtechi +``` + +#### 步骤 2:创建 Ansible 主机清单 + +安装 Ansible 后会自动创建 `/etc/ansible/hosts`,在此文件中我们可以编辑 Ansible 主机或其客户端。我们还可以在家目录中创建自己的 Ansible 主机清单, + +运行以下命令在我们的家目录中创建 Ansible 主机清单。 + +``` +root@linuxtechi:~$ vi $HOME/hosts +[Web] +192.168.1.15 + +[DB] +192.168.1.17 +``` + +保存并退出文件。 + +注意:在上面的主机文件中,我们也可以使用主机名或 FQDN,但为此我们必须确保 Ansible 主机可以通过主机名或者 FQDN 访问。 + +#### 步骤 3:测试和使用默认的 Ansible 模块 + +Ansible 附带了许多可在 `ansible` 命令中使用的默认模块,示例如下所示。 + +语法: + +``` +# ansible -i -m +``` + +这里: + + * `-i ~/hosts`:包含 Ansible 主机列表 + * `-m`:在之后指定 Ansible 模块,如 ping 和 shell + * ``:我们要运行 Ansible 模块的 Ansible 主机 + +使用 Ansible ping 模块验证 ping 连接, + +``` +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping all +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping Web +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping DB +``` + +命令输出如下所示: + +![Ansible-ping-module-examples](https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-ping-module-examples.jpg) + +使用 shell 模块在 Ansible 主机上运行 shell 命令 + +语法: + +``` +ansible -i -m shell -a +``` + +例子: + +``` +root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime" all +192.168.1.17 | CHANGED | rc=0 >> + 01:48:34 up 1:07, 3 users, load average: 0.00, 0.01, 0.05 + +192.168.1.15 | CHANGED | rc=0 >> + 01:48:39 up 1:07, 3 users, load average: 0.00, 0.01, 0.04 + +root@linuxtechi:~$ +root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime ; df -Th / ; uname -r" Web +192.168.1.15 | CHANGED | rc=0 >> + 01:52:03 up 1:11, 3 users, load average: 0.12, 0.07, 0.06 +Filesystem Type Size Used Avail Use% Mounted on +/dev/mapper/centos-root xfs 13G 1017M 12G 8% / +3.10.0-327.el7.x86_64 + +root@linuxtechi:~$ +``` + +上面的命令输出表明我们已成功设置 Ansible 控制器节点。 + +让我们创建一个安装 nginx 的示例剧本,下面的剧本将在所有服务器上安装 nginx,这些服务器是 Web 主机组的一部分,但在这里,我的主机组下只有一台 centos 7 机器。 + +``` +root@linuxtechi:~$ vi nginx.yaml +--- +- hosts: Web + tasks: + - name: Install latest version of nginx on CentOS 7 Server + yum: name=nginx state=latest + - name: start nginx + service: + name: nginx + state: started +``` + +现在使用以下命令执行剧本。 + +``` +root@linuxtechi:~$ sudo ansible-playbook -i ~/hosts nginx.yaml +``` + +上面命令的输出类似下面这样, + +![nginx-installation-playbook-debian10](https://www.linuxtechi.com/wp-content/uploads/2019/08/nginx-installation-playbook-debian10.jpg) + +这表明 Ansible 剧本成功执行了。 + +本文就是这些了,请分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-ansible-automation-tool-debian10/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-Install-Debian10.jpg diff --git a/published/201908/20190827 A dozen ways to learn Python.md b/published/201908/20190827 A dozen ways to learn Python.md new file mode 100644 index 0000000000..b2fbfb4f5c --- /dev/null +++ b/published/201908/20190827 A dozen ways to learn Python.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11280-1.html) +[#]: subject: (A dozen ways to learn Python) +[#]: via: (https://opensource.com/article/19/8/dozen-ways-learn-python) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +学习 Python 的 12 个方式 +====== + +> 这些资源将帮助你入门并熟练掌握 Python。 + +![](https://img.linux.net.cn/data/attachment/album/201908/29/083446r00gdsohb7lwxdxy.jpg) + +Python 是世界上[最受欢迎的][2]编程语言之一,它受到了全世界各地的开发者和创客的欢迎。大多数 Linux 和 MacOS 计算机都预装了某个版本的 Python,现在甚至一些 Windows 计算机供应商也开始安装 Python 了。 + +也许你尚未学会它,想学习但又不知道在哪里入门。这里的 12 个资源将帮助你入门并熟练掌握 Python。 + +### 课程、书籍、文章和文档 + +1、[Python 软件基金会][3]提供了出色的信息和文档,可帮助你迈上编码之旅。请务必查看 [Python 入门指南][4]。它将帮助你得到最新版本的 Python,并提供有关编辑器和开发环境的有用提示。该组织还有可以来进一步指导你的[优秀文档][5]。 + +2、我的 Python 旅程始于[海龟模块][6]。我首先在 Bryson Payne 的《[教你的孩子编码][7]》中找到了关于 Python 和海龟的内容。这本书是一个很好的资源,购买这本书可以让你看到几十个示例程序,这将激发你的编程好奇心。Payne 博士还在 [Udemy][8] 上以相同的名称开设了一门便宜的课程。 + +3、Payne 博士的书激起了我的好奇心,我渴望了解更多。这时我发现了 Al Sweigart 的《[用 Python 自动化无聊的东西][9]》。你可以购买这本书,也可以使用它的在线版本,它与印刷版完全相同且可根据知识共享许可免费获得和分享。Al 的这本书让我学习到了 Python 的基础知识、函数、列表、字典和如何操作字符串等等。这是一本很棒的书,我已经购买了许多本捐赠给了当地图书馆。Al 还提供 [Udemy][10] 课程;使用他的网站上的优惠券代码,只需 10 美元即可参加。 + +4、Eric Matthes 撰写了《[Python 速成][11]》,这是由 No Starch Press 出版的 Python 的逐步介绍(如同上面的两本书)。Matthes 还有一个很棒的[伴侣网站][12],其中包括了如何在你的计算机上设置 Python 以及一个用以简化学习曲线的[速查表][13]。 + +5、[Python for Everybody][14] 是另一个很棒的 Python 学习资源。该网站可以免费访问 [Charles Severance][15] 的 Coursera 和 edX 认证课程的资料。该网站分为入门、课程和素材等部分,其中 17 个课程按从安装到数据可视化的主题进行分类组织。Severance([@drchuck on Twitter][16]),是密歇根大学信息学院的临床教授。 + +6、[Seth Kenlon][17],我们 Opensource.com 的 Python 大师,撰写了大量关于 Python 的文章。Seth 有很多很棒的文章,包括“[用 JSON 保存和加载 Python 数据][18]”,“[用 Python 学习面向对象编程][19]”,“[在 Python 游戏中用 Pygame 放置平台][20]”,等等。 + +### 在设备上使用 Python + +7、最近我对 [Circuit Playground Express][21] 非常感兴趣,这是一个运行 [CircuitPython][22] 的设备,CircuitPython 是为微控制器设计的 Python 编程语言的子集。我发现 Circuit Playground Express 和 CircuitPython 是向学生介绍 Python(以及一般编程)的好方法。它的制造商 Adafruit 有一个很好的[系列教程][23],可以让你快速掌握 CircuitPython。 + +8、[BBC:Microbit][24] 是另一种入门 Python 的好方法。你可以学习如何使用 [MicroPython][25] 对其进行编程,这是另一种用于编程微控制器的 Python 实现。 + +9、学习 Python 的文章如果没有提到[树莓派][26]单板计算机那是不完整的。一旦你有了[舒适][27]而强大的树莓派,你就可以在 Opensource.com 上找到[成吨的][28]使用它的灵感,包括“[7 个值得探索的树莓派项目][29]”,“[在树莓派上复活 Amiga][30]”,和“[如何使用树莓派作为 VPN 服务器][31]”。 + +10、许多学校为学生提供了 iOS 设备以支持他们的教育。在尝试帮助这些学校的老师和学生学习用 Python 编写代码时,我发现了 [Trinket.io][32]。Trinket 允许你在浏览器中编写和执行 Python 3 代码。 Trinket 的 [Python 入门][33]教程将向你展示如何在 iOS 设备上使用 Python。 +   +### 播客 + +11、我喜欢在开车的时候听播客,我在 Kelly Paredes 和 Sean Tibor 的 [Teaching Python][34] 播客上找到了大量的信息。他们的内容很适合教育领域。 + +12、如果你正在寻找一些更通用的东西,我推荐 Michael Kennedy 的 [Talk Python to Me][35] 播客。它提供了有关 Python 及相关技术的最佳信息。 + +你学习 Python 最喜欢的资源是什么?请在评论中分享。 + +计算机编程可能是一个有趣的爱好,正如我以前在 Apple II 计算机上编程时所学到的…… + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/dozen-ways-learn-python + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_screen_display.jpg?itok=2HMTzqz0 (Code on a screen) +[2]: https://insights.stackoverflow.com/survey/2019#most-popular-technologies +[3]: https://www.python.org/ +[4]: https://www.python.org/about/gettingstarted/ +[5]: https://docs.python.org/3/ +[6]: https://opensource.com/life/15/8/python-turtle-graphics +[7]: https://opensource.com/education/15/9/review-bryson-payne-teach-your-kids-code +[8]: https://www.udemy.com/teach-your-kids-to-code/ +[9]: https://automatetheboringstuff.com/ +[10]: https://www.udemy.com/automate/?couponCode=PAY_10_DOLLARS +[11]: https://nostarch.com/pythoncrashcourse2e +[12]: https://ehmatthes.github.io/pcc/ +[13]: https://ehmatthes.github.io/pcc/cheatsheets/README.html +[14]: https://www.py4e.com/ +[15]: http://www.dr-chuck.com/dr-chuck/resume/bio.htm +[16]: https://twitter.com/drchuck/ +[17]: https://opensource.com/users/seth +[18]: https://linux.cn/article-11133-1.html +[19]: https://opensource.com/article/19/7/get-modular-python-classes +[20]: https://linux.cn/article-10902-1.html +[21]: https://opensource.com/article/19/7/circuit-playground-express +[22]: https://circuitpython.org/ +[23]: https://learn.adafruit.com/welcome-to-circuitpython +[24]: https://opensource.com/article/19/8/getting-started-bbc-microbit +[25]: https://micropython.org/ +[26]: https://www.raspberrypi.org/ +[27]: https://projects.raspberrypi.org/en/pathways/getting-started-with-raspberry-pi +[28]: https://opensource.com/sitewide-search?search_api_views_fulltext=Raspberry%20Pi +[29]: https://opensource.com/article/19/3/raspberry-pi-projects +[30]: https://opensource.com/article/19/3/amiga-raspberry-pi +[31]: https://opensource.com/article/19/6/raspberry-pi-vpn-server +[32]: https://trinket.io/ +[33]: https://docs.trinket.io/getting-started-with-python#/welcome/where-we-ll-go +[34]: https://www.teachingpython.fm/ +[35]: https://talkpython.fm/ diff --git a/published/201908/20190830 11 surprising ways you use Linux every day.md b/published/201908/20190830 11 surprising ways you use Linux every day.md new file mode 100644 index 0000000000..df3bfb043b --- /dev/null +++ b/published/201908/20190830 11 surprising ways you use Linux every day.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11289-1.html) +[#]: subject: (11 surprising ways you use Linux every day) +[#]: via: (https://opensource.com/article/19/8/everyday-tech-runs-linux) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +你可能意识不到的使用 Linux 的 11 种方式 +====== + +> 什么技术运行在 Linux 上?你可能会惊讶于日常生活中使用 Linux 的频率。 + +![](https://img.linux.net.cn/data/attachment/album/201909/01/000003dsqf45rbavr5vzja.jpg) + +现在 Linux 几乎可以运行每样东西,但很多人都没有意识到这一点。有些人可能知道 Linux,可能听说过超级计算机运行着这个操作系统。根据 [Top500][2],Linux 现在驱动着世界上最快的 500 台计算机。你可以转到他们的网站并[搜索“Linux”][3]自己查看一下结果。 + +### NASA 运行在 Linux 之上 + +你可能不知道 Linux 为 NASA(美国国家航空航天局)提供支持。NASA 的 [Pleiades][4] 超级计算机运行着 Linux。由于操作系统的可靠性,国际空间站六年前[从 Windows 切换到了 Linux][5]。NASA 甚至最近给国际空间站部署了三台[运行着 Linux][6] 的“Astrobee”机器人。 + +### 电子书运行在 Linux 之上 + +我读了很多书,我的首选设备是亚马逊 Kindle Paperwhite,它运行 Linux(虽然大多数人完全没有意识到这一点)。如果你使用亚马逊的任何服务,从[亚马逊弹性计算云(Amazon EC2)][7] 到 Fire TV,你就是在 Linux 上运行。当你问 Alexa 现在是什么时候,或者你最喜欢的运动队得分时,你也在使用 Linux,因为 Alexa 由 [Fire OS][8](基于 Android 的操作系统)提供支持。实际上,[Android][9] 是由谷歌开发的用于移动手持设备的 Linux,而且占据了当今移动电话的[76% 的市场][10]。 + +### 电视运行在 Linux 之上 + +如果你有一台 [TiVo][11],那么你也在运行 Linux。如果你是 Roku 用户,那么你也在使用 Linux。[Roku OS][12] 是专为 Roku 设备定制的 Linux 版本。你可以选择使用在 Linux 上运行的 Chromecast 看流媒体。不过,Linux 不只是为机顶盒和流媒体设备提供支持。它也可能运行着你的智能电视。LG 使用 webOS,它是基于 Linux 内核的。Panasonic 使用 Firefox OS,它也是基于 Linux 内核的。三星、菲利普斯以及更多厂商都使用基于 Linux 的操作系统支持其设备。 + +### 智能手表和平板电脑运行在 Linux 之上 + +如果你拥有智能手表,它可能正在运行 Linux。世界各地的学校系统一直在实施[一对一系统][13],让每个孩子都有自己的笔记本电脑。越来越多的机构为学生配备了 Chromebook。这些轻巧的笔记本电脑使用 [Chrome OS][14],它基于 Linux。 + +### 汽车运行在 Linux 之上 + +你驾驶的汽车可能正在运行 Linux。 [汽车级 Linux(AGL)][15] 是一个将 Linux 视为汽车标准代码库的项目,它列入了丰田、马自达、梅赛德斯-奔驰和大众等汽车制造商。你的[车载信息娱乐(IVI)][16]系统也可能运行 Linux。[GENIVI 联盟][17]在其网站称,它开发了“用于集成在集中连接的车辆驾驶舱中的操作系统和中间件的标准方法”。 + +### 游戏运行在 Linux 之上 + +如果你是游戏玩家,那么你可能正在使用 [SteamOS][18],这是一个基于 Linux 的操作系统。此外,如果你使用 Google 的众多服务,那么你也运行在 Linux上。 + +### 社交媒体运行在 Linux 之上 + +当你刷屏和评论时,你可能会意识到这些平台正在做的很多工作。也许 Instagram、Facebook、YouTube 和 Twitter 都在 Linux 上运行并不令人惊讶。 + +此外,社交媒体的新浪潮,去中心化的联合社区的联盟节点,如 [Mastodon][19]、[GNU Social][20]、[Nextcloud][21](类似 Twitter 的微博平台)、[Pixelfed][22](分布式照片共享)和[Peertube][23](分布式视频共享)至少默认情况下在 Linux 上运行。由于开源,它们可以在任何平台上运行,这本身就是一个强大的优先级。 + +### 商业和政务运行在 Linux 之上 + +与五角大楼一样,纽约证券交易所也在 Linux 上运行。美国联邦航空管理局每年处理超过 1600 万次航班,他们在 Linux 上运营。美国国会图书馆、众议院、参议院和白宫都使用 Linux。 + +### 零售运行在 Linux 之上 + +最新航班座位上的娱乐系统很可能在 Linux 上运行。你最喜欢的商店的 POS 机可能正运行在 Linux 上。基于 Linux 的 [Tizen OS][24] 为智能家居和其他智能设备提供支持。许多公共图书馆现在在 [Evergreen][25] 和 [Koha][26] 上托管他们的综合图书馆系统。这两个系统都在 Linux 上运行。 + +### Apple 运行在 Linux 之上 + +如果你是使用 [iCloud][27] 的 iOS 用户,那么你也在使用运行在 Linux 上的系统。Apple 公司的网站在 Linux 上运行。如果你想知道在 Linux 上运行的其他网站,请务必使用 [Netcraft][28] 并检查“该网站运行在什么之上?”的结果。 + +### 路由器运行在 Linux 之上 + +在你家里将你连接到互联网的路由器可能正运行在 Linux 上。如果你当前的路由器没有运行 Linux 而你想改变它,那么这里有一个[优秀的方法][29]。 + +如你所见,Linux 从许多方面为今天的世界提供动力。还有什么运行在 Linux 之上的东西是人们还没有意识到的?请让我们在评论中知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/everyday-tech-runs-linux + +作者:[Don Watkins][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://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/truck_steering_wheel_drive_car_kubernetes.jpg?itok=0TOzve80 (Truck steering wheel and dash) +[2]: https://www.top500.org/ +[3]: https://www.top500.org/statistics/sublist/ +[4]: https://www.nas.nasa.gov/hecc/resources/pleiades.html +[5]: https://www.extremetech.com/extreme/155392-international-space-station-switches-from-windows-to-linux-for-improved-reliability +[6]: https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20180003515.pdf +[7]: https://aws.amazon.com/amazon-linux-ami/ +[8]: https://en.wikipedia.org/wiki/Fire_OS +[9]: https://en.wikipedia.org/wiki/Android_(operating_system) +[10]: https://gs.statcounter.com/os-market-share/mobile/worldwide/ +[11]: https://tivo.pactsafe.io/legal.html#open-source-software +[12]: https://en.wikipedia.org/wiki/Roku +[13]: https://en.wikipedia.org/wiki/One-to-one_computing +[14]: https://en.wikipedia.org/wiki/Chrome_OS +[15]: https://opensource.com/life/16/8/agl-provides-common-open-code-base +[16]: https://opensource.com/business/16/5/interview-alison-chaiken-steven-crumb +[17]: https://www.genivi.org/faq +[18]: https://store.steampowered.com/steamos/ +[19]: https://opensource.com/article/17/4/guide-to-mastodon +[20]: https://www.gnu.org/software/social/ +[21]: https://apps.nextcloud.com/apps/social +[22]: https://pixelfed.org/ +[23]: https://joinpeertube.org/en/ +[24]: https://wiki.tizen.org/Devices +[25]: https://evergreen-ils.org/ +[26]: https://koha-community.org/ +[27]: https://toolbar.netcraft.com/site_report?url=https://www.icloud.com/ +[28]: https://www.netcraft.com/ +[29]: https://opensource.com/life/16/6/why-i-built-my-own-linux-router diff --git a/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md new file mode 100644 index 0000000000..e89257812d --- /dev/null +++ b/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -0,0 +1,257 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11480-1.html) +[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) +[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 上安装和配置 PostgreSQL +====== + +> 本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。 + +[PostgreSQL][1] (又名 Postgres) 是一个功能强大的自由开源的关系型数据库管理系统 ([RDBMS][2]) ,其在可靠性、稳定性、性能方面获得了业内极高的声誉。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。 + +如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。 + +之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。 + +![][5] + +### 在 Ubuntu 上安装 PostgreSQL + +PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其它开发工具一样,它可能不是最新版本。 + +首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本: + +``` +apt show postgresql +``` + +在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10(10+190 表示版本 10)而 PostgreSQL 版本 11 已经发布。 + +``` +Package: postgresql +Version: 10+190 +Priority: optional +Section: database +Source: postgresql-common (190) +Origin: Ubuntu +``` + +根据这些信息,你可以自主决定是安装 Ubuntu 提供的版本还是还是获取 PostgreSQL 的最新发行版。 + +我将向你介绍这两种方法: + +#### 方法一:通过 Ubuntu 存储库安装 PostgreSQL + +在终端中,使用以下命令安装 PostgreSQL: + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。说到这一点,随时检查 [Ubuntu 中的各种网络带宽][8]。 + +> 什么是 postgresql-contrib? + +> postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。 + +#### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11 + +要安装 PostgreSQL 11, 你需要在 `sources.list` 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。 + +不用担心,这并不复杂。 只需按照以下步骤。 + +首先添加 GPG 密钥: + +``` +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +``` + +现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号: + +``` +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' +``` + +现在一切就绪。使用以下命令安装 PostgreSQL: + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +> PostgreSQL GUI 应用程序 + +> 你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序(pgAdmin): + +> `sudo apt install pgadmin4` + +### PostgreSQL 配置 + +你可以通过执行以下命令来检查 PostgreSQL 是否正在运行: + +``` +service postgresql status +``` + +通过 `service` 命令,你可以启动、关闭或重启 `postgresql`。输入 `service postgresql` 并按回车将列出所有选项。现在,登录该用户。 + +默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 `postgres`。要实际使用 PostgreSQL,你必须先登录该账户: + +``` +sudo su postgres +``` + +你的提示符会更改为类似于以下的内容: + +``` +postgres@ubuntu-VirtualBox:/home/ubuntu$ +``` + +现在,使用 `psql` 来启动 PostgreSQL Shell: + +``` +psql +``` + +你应该会看到如下提示符: + +``` +postgress=# +``` + +你可以输入 `\q` 以退出,输入 `\?` 获取帮助。 + +要查看现有的所有表,输入如下命令: + +``` +\l +``` + +输出内容类似于下图所示(单击 `q` 键退出该视图): + +![PostgreSQL Tables][10] + +使用 `\du` 命令,你可以查看 PostgreSQL 用户: + +![PostgreSQLUsers][11] + +你可以使用以下命令更改任何用户(包括 `postgres`)的密码: + +``` +ALTER USER postgres WITH PASSWORD 'my_password'; +``` + +**注意:**将 `postgres` 替换为你要更改的用户名,`my_password` 替换为所需要的密码。另外,不要忘记每条命令后面的 `;`(分号)。 + +建议你另外创建一个用户(不建议使用默认的 `postgres` 用户)。为此,请使用以下命令: + +``` +CREATE USER my_user WITH PASSWORD 'my_password'; +``` + +运行 `\du`,你将看到该用户,但是,`my_user` 用户没有任何的属性。来让我们给它添加超级用户权限: + +``` +ALTER USER my_user WITH SUPERUSER; +``` + +你可以使用以下命令删除用户: + +``` +DROP USER my_user; +``` + +要使用其他用户登录,使用 `\q` 命令退出,然后使用以下命令登录: + +``` +psql -U my_user +``` + +你可以使用 `-d` 参数直接连接数据库: + +``` +psql -U my_user -d my_db +``` + +你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 `ubuntu`。要登录,从终端执行以下命名: + +``` +psql -U ubuntu -d postgres +``` + +**注意:**你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。 + +如果遇到如下错误: + +``` +psql: FATAL: Peer authentication failed for user "my_user" +``` + +确保以正确的用户身份登录,并使用管理员权限编辑 `/etc/postgresql/11/main/pg_hba.conf`: + +``` +sudo vim /etc/postgresql/11/main/pg_hba.conf +``` + +**注意:**用你的版本替换 `11`(例如 `10`)。 + +对如下所示的一行进行替换: + +``` +local all postgres peer +``` + +替换为: + +``` +local all postgres md5 +``` + +然后重启 PostgreSQL: + +``` +sudo service postgresql restart +``` + +使用 PostgreSQL 与使用其他 SQL 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册(`man psql`)和 [文档][13] 也非常有用。 + +### 总结 + +阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15]。 + +如果你有任何问题或疑惑,请随时在评论部分提出。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-postgresql-ubuntu/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.postgresql.org/ +[2]: https://www.codecademy.com/articles/what-is-rdbms-sql +[3]: https://www.apple.com/in/macos/server/ +[4]: https://itsfoss.com/install-mysql-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1 +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://itsfoss.com/apt-command-guide/ +[8]: https://itsfoss.com/network-speed-monitor-linux/ +[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1 +[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546 +[13]: https://www.postgresql.org/docs/manuals/ +[14]: https://itsfoss.com/sync-any-folder-with-dropbox/ +[15]: https://itsfoss.com/basic-sql-commands/ diff --git a/published/20190809 Mutation testing is the evolution of TDD.md b/published/20190809 Mutation testing is the evolution of TDD.md new file mode 100644 index 0000000000..475673d8b5 --- /dev/null +++ b/published/20190809 Mutation testing is the evolution of TDD.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11468-1.html) +[#]: subject: (Mutation testing is the evolution of TDD) +[#]: via: (https://opensource.com/article/19/8/mutation-testing-evolution-tdd) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +变异测试是测试驱动开发(TDD)的演变 +====== + +> 测试驱动开发技术是根据大自然的运作规律创建的,变异测试自然成为 DevOps 演变的下一步。 + +![Ants and a leaf making the word "open"][1] + +在 “[故障是无懈可击的开发运维中的一个特点][2]”,我讨论了故障在通过征求反馈来交付优质产品的过程中所起到的重要作用。敏捷 DevOps 团队就是用故障来指导他们并推动开发进程的。[测试驱动开发][3]Test-driven development(TDD)是任何敏捷 DevOps 团队评估产品交付的[必要条件][4]。以故障为中心的 TDD 方法仅在与可量化的测试配合使用时才有效。 + +TDD 方法仿照大自然是如何运作的以及自然界在进化博弈中是如何产生赢家和输家为模型而建立的。 + +### 自然选择 + +![查尔斯·达尔文][5] + +1859 年,[查尔斯·达尔文][6]Charles Darwin在他的《[物种起源][7]On the Origin of Species》一书中提出了进化论学说。达尔文的论点是,自然变异是由生物个体的自发突变和环境压力共同造成的。环境压力淘汰了适应性较差的生物体,而有利于其他适应性强的生物的发展。每个生物体的染色体都会发生变异,而这些自发的变异会携带给下一代(后代)。然后在自然选择下测试新出现的变异性 —— 当下存在的环境压力是由变异性的环境条件所导致的。 + +这张简图说明了调整适应环境条件的过程。 + +![环境压力对鱼类的影响][8] + +*图1. 不同的环境压力导致自然选择下的不同结果。图片截图来源于[理查德·道金斯的一个视频][9]。* + +该图显示了一群生活在自己栖息地的鱼。栖息地各不相同(海底或河床底部的砾石颜色有深有浅),每条鱼长的也各不相同(鱼身图案和颜色也有深有浅)。 + +这张图还显示了两种情况(即环境压力的两种变化): + + 1. 捕食者在场 + 2. 捕食者不在场 + +在第一种情况下,在砾石颜色衬托下容易凸显出来的鱼被捕食者捕获的风险更高。当砾石颜色较深时,浅色鱼的数量会更少一些。反之亦然,当砾石颜色较浅时,深色鱼的数量会更少。 + +在第二种情况下,鱼完全放松下来进行交配。在没有捕食者和没有交配仪式的情况下,可以预料到相反的结果:在砾石背景下显眼的鱼会有更大的机会被选来交配并将其特性传递给后代。 + +### 选择标准 + +变异性在进行选择时,绝不是任意的、反复无常的、异想天开的或随机的。选择过程中的决定性因素通常是可以度量的。该决定性因素通常称为测试或目标。 + +一个简单的数学例子可以说明这一决策过程。(在该示例中,这种选择不是由自然选择决定的,而是由人为选择决定。)假设有人要求你构建一个小函数,该函数将接受一个正数,然后计算该数的平方根。你将怎么做? + +敏捷 DevOps 团队的方法是快速验证失败。谦虚一点,先承认自己并不真的知道如何开发该函数。这时,你所知道的就是如何描述你想做的事情。从技术上讲,你已准备好进行单元测试。 + +“单元测试unit test”描述了你的具体期望结果是什么。它可以简单地表述为“给定数字 16,我希望平方根函数返回数字 4”。你可能知道 16 的平方根是 4。但是,你不知道一些较大数字(例如 533)的平方根。 + +但至少,你已经制定了选择标准,即你的测试或你的期望值。 + +### 进行故障测试 + +[.NET Core][10] 平台可以演示该测试。.NET 通常使用 xUnit.net 作为单元测试框架。(要跟随进行这个代码示例,请安装 .NET Core 和 xUnit.net。) + +打开命令行并创建一个文件夹,在该文件夹实现平方根解决方案。例如,输入: + +``` +mkdir square_root +``` + +再输入: + +``` +cd square_root +``` + +为单元测试创建一个单独的文件夹: + +``` +mkdir unit_tests +``` + +进入 `unit_tests` 文件夹下(`cd unit_tests`),初始化 xUnit 框架: + +``` +dotnet new xunit +``` + +现在,转到 `square_root` 下, 创建 `app` 文件夹: + +``` +mkdir app +cd app +``` + +如果有必要的话,为你的代码创建一个脚手架: + +``` +dotnet new classlib +``` + +现在打开你最喜欢的编辑器开始编码! + +在你的代码编辑器中,导航到 `unit_tests` 文件夹,打开 `UnitTest1.cs`。 + +将 `UnitTest1.cs` 中自动生成的代码替换为: + +``` +using System; +using Xunit; +using app; + +namespace unit_tests{ + + public class UnitTest1{ + Calculator calculator = new Calculator(); + + [Fact] + public void GivenPositiveNumberCalculateSquareRoot(){ + var expected = 4; + var actual = calculator.CalculateSquareRoot(16); + Assert.Equal(expected, actual); + } + } +} +``` + +该单元测试描述了变量的**期望值**应该为 4。下一行描述了**实际值**。建议通过将输入值发送到称为`calculator` 的组件来计算**实际值**。对该组件的描述是通过接收数值来处理`CalculateSquareRoot` 信息。该组件尚未开发。但这并不重要,我们在此只是描述期望值。 + +最后,描述了触发消息发送时发生的情况。此时,判断**期望值**是否等于**实际值**。如果是,则测试通过,目标达成。如果**期望值**不等于**实际值**,则测试失败。 + +接下来,要实现称为 `calculator` 的组件,在 `app` 文件夹中创建一个新文件,并将其命名为`Calculator.cs`。要实现计算平方根的函数,请在此新文件中添加以下代码: + +``` +namespace app { + public class Calculator { + public double CalculateSquareRoot(double number) { + double bestGuess = number; + return bestGuess; + } + } +} +``` + +在测试之前,你需要通知单元测试如何找到该新组件(`Calculator`)。导航至 `unit_tests` 文件夹,打开 `unit_tests.csproj` 文件。在 `` 代码块中添加以下代码: + +``` + +``` + +保存 `unit_test.csproj` 文件。现在,你可以运行第一个测试了。 + +切换到命令行,进入 `unit_tests` 文件夹。运行以下命令: + +``` +dotnet test +``` + +运行单元测试,会输出以下内容: + +![单元测试失败后xUnit的输出结果][12] + +*图2. 单元测试失败后 xUnit 的输出结果* + +正如你所看到的,单元测试失败了。期望将数字 16 发送到 `calculator` 组件后会输出数字 4,但是输出(`Actual`)的是 16。 + +恭喜你!创建了第一个故障。单元测试为你提供了强有力的反馈机制,敦促你修复故障。 + +### 修复故障 + +要修复故障,你必须要改进 `bestGuess`。当下,`bestGuess` 仅获取函数接收的数字并返回。这不够好。 + +但是,如何找到一种计算平方根值的方法呢? 我有一个主意 —— 看一下大自然母亲是如何解决问题的。 + +### 效仿大自然的迭代 + +在第一次(也是唯一的)尝试中要得出正确值是非常难的(几乎不可能)。你必须允许自己进行多次尝试猜测,以增加解决问题的机会。允许多次尝试的一种方法是进行迭代。 + +要迭代,就要将 `bestGuess` 值存储在 `previousGuess` 变量中,转换 `bestGuess` 的值,然后比较两个值之间的差。如果差为 0,则说明问题已解决。否则,继续迭代。 + +这是生成任何正数的平方根的函数体: + +``` +double bestGuess = number; +double previousGuess; + +do { + previousGuess = bestGuess; + bestGuess = (previousGuess + (number/previousGuess))/2; +} while((bestGuess - previousGuess) != 0); + +return bestGuess; +``` + +该循环(迭代)将 `bestGuess` 值集中到设想的解决方案。现在,你精心设计的单元测试通过了! + +![单元测试通过了][13] + +*图 3. 单元测试通过了。* + +### 迭代解决了问题 + +正如大自然母亲解决问题的方法,在本练习中,迭代解决了问题。增量方法与逐步改进相结合是获得满意解决方案的有效方法。该示例中的决定性因素是具有可衡量的目标和测试。一旦有了这些,就可以继续迭代直到达到目标。 + +### 关键点! + +好的,这是一个有趣的试验,但是更有趣的发现来自于使用这种新创建的解决方案。到目前为止,`bestGuess` 从开始一直把函数接收到的数字作为输入参数。如果更改 `bestGuess` 的初始值会怎样? + +为了测试这一点,你可以测试几种情况。 首先,在迭代多次尝试计算 25 的平方根时,要逐步细化观察结果: + +![25 平方根的迭代编码][14] + +*图 4. 通过迭代来计算 25 的平方根。* + +以 25 作为 `bestGuess` 的初始值,该函数需要八次迭代才能计算出 25 的平方根。但是,如果在设计 `bestGuess` 初始值上犯下荒谬的错误,那将怎么办? 尝试第二次,那 100 万可能是 25 的平方根吗? 在这种明显错误的情况下会发生什么?你写的函数是否能够处理这种低级错误。 + +直接来吧。回到测试中来,这次以一百万开始: + +![逐步求精法][15] + +*图 5. 在计算 25 的平方根时,运用逐步求精法,以 100 万作为 bestGuess 的初始值。* + +哇! 以一个荒谬的数字开始,迭代次数仅增加了两倍(从八次迭代到 23 次)。增长幅度没有你直觉中预期的那么大。 + +### 故事的寓意 + +啊哈! 当你意识到,迭代不仅能够保证解决问题,而且与你的解决方案的初始猜测值是好是坏也没有关系。 不论你最初理解得多么不正确,迭代过程以及可衡量的测试/目标,都可以使你走上正确的道路并得到解决方案。 + +图 4 和 5 显示了陡峭而戏剧性的燃尽图。一个非常错误的开始,迭代很快就产生了一个绝对正确的解决方案。 + +简而言之,这种神奇的方法就是敏捷 DevOps 的本质。 + +### 回到一些更深层次的观察 + +敏捷 DevOps 的实践源于人们对所生活的世界的认知。我们生活的世界存在不确定性、不完整性以及充满太多的困惑。从科学/哲学的角度来看,这些特征得到了[海森堡的不确定性原理][16]Heisenberg's Uncertainty Principle(涵盖不确定性部分),[维特根斯坦的逻辑论哲学][17]Wittgenstein's Tractatus Logico-Philosophicus(歧义性部分),[哥德尔的不完全性定理][18]Gödel's incompleteness theorems(不完全性方面)以及[热力学第二定律][19]Second Law of Thermodynamics(无情的熵引起的混乱)的充分证明和支持。 + +简而言之,无论你多么努力,在尝试解决任何问题时都无法获得完整的信息。因此,放下傲慢的姿态,采取更为谦虚的方法来解决问题对我们会更有帮助。谦卑会给为你带来巨大的回报,这个回报不仅是你期望的一个解决方案,还会有它的副产品。 + +### 总结 + +大自然在不停地运作,这是一个持续不断的过程。大自然没有总体规划。一切都是对先前发生的事情的回应。 反馈循环是非常紧密的,明显的进步/倒退都是逐步实现的。大自然中随处可见,任何事物的都在以一种或多种形式逐步完善。 + +敏捷 DevOps 是工程模型逐渐成熟的一个非常有趣的结果。DevOps 基于这样的认识,即你所拥有的信息总是不完整的,因此你最好谨慎进行。获得可衡量的测试(例如,假设、可测量的期望结果),进行简单的尝试,大多数情况下可能失败,然后收集反馈,修复故障并继续测试。除了同意每个步骤都必须要有可衡量的假设/测试之外,没有其他方法。 + +在本系列的下一篇文章中,我将仔细研究变异测试是如何提供及时反馈来推动实现结果的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/mutation-testing-evolution-tdd + +作者:[Alex Bunardzic][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [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/osdc_520X292_openanttrail-2.png?itok=xhD3WmUd (Ants and a leaf making the word "open") +[2]: https://opensource.com/article/19/7/failure-feature-blameless-devops +[3]: https://en.wikipedia.org/wiki/Test-driven_development +[4]: https://www.merriam-webster.com/dictionary/conditio%20sine%20qua%20non +[5]: https://opensource.com/sites/default/files/uploads/darwin.png (Charles Darwin) +[6]: https://en.wikipedia.org/wiki/Charles_Darwin +[7]: https://en.wikipedia.org/wiki/On_the_Origin_of_Species +[8]: https://opensource.com/sites/default/files/uploads/environmentalconditions2.png (Environmental pressures on fish) +[9]: https://www.youtube.com/watch?v=MgK5Rf7qFaU +[10]: https://dotnet.microsoft.com/ +[11]: https://xunit.net/ +[12]: https://opensource.com/sites/default/files/uploads/xunit-output.png (xUnit output after the unit test run fails) +[13]: https://opensource.com/sites/default/files/uploads/unit-test-success.png (Unit test successful) +[14]: https://opensource.com/sites/default/files/uploads/iterating-square-root.png (Code iterating for the square root of 25) +[15]: https://opensource.com/sites/default/files/uploads/bestguess.png (Stepwise refinement) +[16]: https://en.wikipedia.org/wiki/Uncertainty_principle +[17]: https://en.wikipedia.org/wiki/Tractatus_Logico-Philosophicus +[18]: https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems +[19]: https://en.wikipedia.org/wiki/Second_law_of_thermodynamics diff --git a/published/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md b/published/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md new file mode 100644 index 0000000000..7e470c208c --- /dev/null +++ b/published/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11414-1.html) +[#]: subject: (A Raspberry Pi Based Open Source Tablet is in Making and it’s Called CutiePi) +[#]: via: (https://itsfoss.com/cutiepi-open-source-tab/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +CutiePi:正在开发中的基于树莓派的开源平板 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/02/125301wkbvgz1n7zv7j55e.jpg) + +CutiePi 是一款 8 英寸的构建在树莓派上的开源平板。他们在[树莓派论坛][1]上宣布:现在,它只是一台原型机。 + +在本文中,你将了解有关 CutiePi 的规格、价格和可用性的更多详细信息。 + +它们使用一款定制的计算模块载版(CM3)来制造平板。[官网][2]提到使用定制 CM3 载板的目的是: + +> 定制 CM3/CM3+ 载板是专为便携使用而设计,拥有增强的电源管理和锂聚合物电池电量监控功能。还可与指定的 HDMI 或 MIPI DSI 显示器配合使用。 + +因此,这使得该平板足够薄而且便携。 + +### CutiePi 规格 + +![CutiePi Board][3] + +我惊讶地了解到它有 8 英寸的 IPS LCD 显示屏,这对新手而言是个好事。然而,你不会有一个真正高清的屏幕,因为官方宣称它的分辨率是 1280×800。 + +它还计划配备 4800 mAh 锂电池(原型机的电池为 5000 mAh)。嗯,对于平板来说,这不算坏。 + +连接性上包括支持 Wi-Fi 和蓝牙 4.0。此外,还有一个 USB Type-A 插口、6 个 GPIO 引脚和 microSD 卡插槽。 + +![CutiePi Specifications][4] + +硬件与 [Raspbian OS][5] 官方兼容,用户界面采用 [Qt][6] 构建,以获得快速直观的用户体验。此外,除了内置应用外,它还将通过 XWayland 支持 Raspbian PIXEL 应用。 + +### CutiePi 源码 + +你可以通过分析所用材料的清单来猜测此平板的定价。CutiePi 遵循 100% 的开源硬件设计。因此,如果你觉得好奇,可以查看它的 [GitHub 页面][7],了解有关硬件设计和内容的详细信息。 + +### CutiePi 价格、发布日期和可用性 + +CutiePi 计划在 8 月进行[设计验证测试][8]批量 PCB。他们的目标是在 2019 年底推出最终产品。 + +官方预计,发售价大约在 $150-$250 左右。这只是一个近似的范围,还应该保有怀疑。 + +显然,即使产品听上去挺有希望,但价格将是它成功的一个主要因素。 + +### 总结 + +CutiePi 并不是第一个使用[像树莓派这样的单板计算机][9]来制作平板的项目。我们有即将推出的 [PineTab][10],它基于 Pine64 单板电脑。Pine 还有一种笔记本电脑,名为 [Pinebook][11]。 + +从原型来看,它确实是一个我们可以期望使用的产品。但是,预安装的应用和它将支持的应用可能会扭转局面。此外,考虑到价格估计,这听起来很有希望。 + +你觉得怎么样?让我们在下面的评论中知道你的想法,或者投个票。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cutiepi-open-source-tab/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/forums/viewtopic.php?t=247380 +[2]: https://cutiepi.io/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-board.png?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-specifications.jpg?ssl=1 +[5]: https://itsfoss.com/raspberry-pi-os-desktop/ +[6]: https://en.wikipedia.org/wiki/Qt_%28software%29 +[7]: https://github.com/cutiepi-io/cutiepi-board +[8]: https://en.wikipedia.org/wiki/Engineering_validation_test#Design_verification_test +[9]: https://itsfoss.com/raspberry-pi-alternatives/ +[10]: https://www.pine64.org/pinetab/ +[11]: https://itsfoss.com/pinebook-pro/ diff --git a/published/20190823 The lifecycle of Linux kernel testing.md b/published/20190823 The lifecycle of Linux kernel testing.md new file mode 100644 index 0000000000..4353371b32 --- /dev/null +++ b/published/20190823 The lifecycle of Linux kernel testing.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11464-1.html) +[#]: subject: (The lifecycle of Linux kernel testing) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-testing) +[#]: author: (Major Hayden https://opensource.com/users/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden) + +Linux 内核测试的生命周期 +====== + +> 内核持续集成(CKI)项目旨在防止错误进入 Linux 内核。 + +![](https://img.linux.net.cn/data/attachment/album/201910/16/101933nexzccpea9sjxcq9.jpg) + +在 [Linux 内核的持续集成测试][2] 一文中,我介绍了 [内核持续集成][3]Continuous Kernel Integration(CKI)项目及其使命:改变内核开发人员和维护人员的工作方式。本文深入探讨了该项目的某些技术方面,以及这所有的部分是如何组合在一起的。 + +### 从一次更改开始 + +内核中每一项令人兴奋的功能、改进和错误都始于开发人员提出的更改。这些更改出现在各个内核存储库的大量邮件列表中。一些存储库关注内核中的某些子系统,例如存储或网络,而其它存储库关注内核的更多方面。 当开发人员向内核提出更改或补丁集时,或者维护者在存储库本身中进行更改时,CKI 项目就会付诸行动。 + +CKI 项目维护的触发器用于监视这些补丁集并采取措施。诸如 [Patchwork][4] 之类的软件项目通过将多个补丁贡献整合为单个补丁系列,使此过程变得更加容易。补丁系列作为一个整体历经 CKI 系统,并可以针对该系列发布单个报告。 + +其他触发器可以监视存储库中的更改。当内核维护人员合并补丁集、还原补丁或创建新标签时,就会触发。测试这些关键的更改可确保开发人员始终具有坚实的基线,可以用作编写新补丁的基础。 + +所有这些更改都会进入 GitLab CI 管道,并历经多个阶段和多个系统。 + +### 准备构建 + +首先要准备好要编译的源代码。这需要克隆存储库、打上开发人员建议的补丁集,并生成内核配置文件。这些配置文件具有成千上万个用于打开或关闭功能的选项,并且配置文件在不同的系统体系结构之间差异非常大。 例如,一个相当标准的 x86\_64 系统在其配置文件中可能有很多可用选项,但是 s390x 系统(IBM zSeries 大型机)的选项可能要少得多。在该大型机上,某些选项可能有意义,但在消费类笔记本电脑上没有任何作用。 + +内核进一步转换为源代码工件。该工件包含整个存储库(已打上补丁)以及编译所需的所有内核配置文件。 上游内核会打包成压缩包,而 Red Hat 的内核会生成下一步所用的源代码 RPM 包。 + +### 成堆的编译 + +编译内核会将源代码转换为计算机可以启动和使用的代码。配置文件描述了要构建的内容,内核中的脚本描述了如何构建它,系统上的工具(例如 GCC 和 glibc)完成构建。此过程需要一段时间才能完成,但是 CKI 项目需要针对四种体系结构快速完成:aarch64(64 位 ARM)、ppc64le(POWER)、s390x(IBM zSeries)和 x86\_64。重要的是,我们必须快速编译内核,以便使工作任务不会积压,而开发人员可以及时收到反馈。 + +添加更多的 CPU 可以大大提高速度,但是每个系统都有其局限性。CKI 项目在 OpenShift 的部署环境中的容器内编译内核;尽管 OpenShift 可以实现高伸缩性,但在部署环境中的可用 CPU 仍然是数量有限的。CKI 团队分配了 20 个虚拟 CPU 来编译每个内核。涉及到四个体系结构,这就涨到了 80 个 CPU! + +另一个速度的提高来自 [ccache][5] 工具。内核开发进展迅速,但是即使在多个发布版本之间,内核的大部分仍保持不变。ccache 工具进行编译期间会在磁盘上缓存已构建的对象(整个内核的一小部分)。稍后再进行另一个内核编译时,ccache 会查找以前看到的内核的未更改部分。ccache 会从磁盘中提取缓存的对象并重新使用它。这样可以加快编译速度并降低总体 CPU 使用率。现在,耗时 20 分钟编译的内核在不到几分钟的时间内就完成了。 + +### 测试时间 + +内核进入最后一步:在真实硬件上进行测试。每个内核都使用 Beaker 在其原生体系结构上启动,并且开始无数次的测试以发现问题。一些测试会寻找简单的问题,例如容器问题或启动时的错误消息。其他测试则深入到各种内核子系统中,以查找系统调用、内存分配和线程中的回归问题。 + +大型测试框架,例如 [Linux Test Project][6](LTP),包含了大量测试,这些测试在内核中寻找麻烦的回归问题。其中一些回归问题可能会回滚关键的安全修复程序,并且进行测试以确保这些改进仍保留在内核中。 + +测试完成后,关键的一步仍然是:报告。内核开发人员和维护人员需要一份简明的报告,准确地告诉他们哪些有效、哪些无效以及如何获取更多信息。每个 CKI 报告都包含所用源代码、编译参数和测试输出的详细信息。该信息可帮助开发人员知道从哪里开始寻找解决问题的方法。此外,它还可以帮助维护人员在漏洞进入内核存储库之前知道何时需要保留补丁集以进行其他查看。 + +### 总结 + +CKI 项目团队通过向内核开发人员和维护人员提供及时、自动的反馈,努力防止错误进入 Linux 内核。这项工作通过发现导致内核错误、安全性问题和性能问题等易于找到的问题,使他们的工作更加轻松。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-testing + +作者:[Major Hayden][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://opensource.com/users/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: https://opensource.com/article/19/6/continuous-kernel-integration-linux +[3]: https://cki-project.org/ +[4]: https://github.com/getpatchwork/patchwork +[5]: https://ccache.dev/ +[6]: https://linux-test-project.github.io +[7]: https://cki-project.org/posts/hackfest-agenda/ +[8]: https://www.linuxplumbersconf.org/ diff --git a/published/20190824 How to compile a Linux kernel in the 21st century.md b/published/20190824 How to compile a Linux kernel in the 21st century.md new file mode 100644 index 0000000000..fd29db6483 --- /dev/null +++ b/published/20190824 How to compile a Linux kernel in the 21st century.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: (LuuMing) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11427-1.html) +[#]: subject: (How to compile a Linux kernel in the 21st century) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-21st-century) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 21 世纪该怎样编译 Linux 内核 +====== + +> 也许你并不需要编译 Linux 内核,但你能通过这篇教程快速上手。 + +![](https://img.linux.net.cn/data/attachment/album/201910/06/113927vrs6rurljyuza8cy.jpg) + +在计算机世界里,内核kernel是处理硬件与一般系统之间通信的低阶软件low-level software。除过一些烧录进计算机主板的初始固件,当你启动计算机时,内核让系统意识到它有一个硬盘驱动器、屏幕、键盘以及网卡。分配给每个部件相等时间(或多或少)使得图像、音频、文件系统和网络可以流畅甚至并行地运行。 + +然而,对于硬件的需求是源源不断的,随着发布的硬件越多,内核就必须纳入更多代码来保证那些硬件正常工作。得到具体的数字很困难,但是 Linux 内核无疑是硬件兼容性方面的顶级内核之一。Linux 操作着无数的计算机和移动电话、工业用途和爱好者使用的板级嵌入式系统(SoC)、RAID 卡、缝纫机等等。 + +回到 20 世纪(甚至是 21 世纪初期),对于 Linux 用户来说,在刚买到新的硬件后就需要下载最新的内核代码并编译安装才能使用这是不可理喻的。而现在你也很难见到 Linux 用户为了好玩而编译内核或通过高度专业化定制的硬件的方式赚钱。现在,通常已经不需要再编译 Linux 内核了。 + +这里列出了一些原因以及快速编译内核的教程。 + +### 更新当前的内核 + +无论你买了配备新显卡或 Wifi 芯片集的新品牌电脑还是给家里配备一个新的打印机,你的操作系统(称为 GNU+Linux 或 Linux,它也是该内核的名字)需要一个驱动程序来打开新部件(显卡、芯片集、打印机和其他任何东西)的信道。有时候当你插入某些新的设备时而你的电脑表示发现了它,这具有一定的欺骗性。别被骗到了,有时候那就够了,但更多的情况是你的操作系统仅仅是使用了通用的协议检测到安装了新的设备。 + +例如,你的计算机也许能够鉴别出新的网络打印机,但有时候那仅仅是因为打印机的网卡被设计成为了获得 DHCP 地址而在网络上标识自己。它并不意味着你的计算机知道如何发送文档给打印机进行打印。事实上,你可以认为计算机甚至不“知道”那台设备是一个打印机。它也许仅仅是显示网络有个设备在一个特定的地址上,并且该设备以一系列字符 “p-r-i-n-t-e-r” 标识自己而已。人类语言的便利性对于计算机毫无意义。计算机需要的是一个驱动程序。 + +内核开发者、硬件制造商、技术支持和爱好者都知道新的硬件会不断地发布。它们大多数都会贡献驱动程序,直接提交给内核开发团队以包含在 Linux 中。例如,英伟达显卡驱动程序通常都会写入 [Nouveau][2] 内核模块中,并且因为英伟达显卡很常用,它的代码都包含在任一个日常使用的发行版内核中(例如当下载 [Fedora][3] 或 [Ubuntu][4] 得到的内核)。英伟达也有不常用的地方,例如嵌入式系统中 Nouveau 模块通常被移除。对其他设备来说也有类似的模块:打印机得益于 [Foomatic][5] 和 [CUPS][6],无线网卡有 [b43、ath9k、wl][7] 模块等等。 + +发行版往往会在它们 Linux 内核的构建中包含尽可能多合理的驱动程序,因为他们想让你在接入新设备时不用安装驱动程序能够立即使用。对于大多数情况来说就是这样的,尤其是现在很多设备厂商都在资助自己售卖硬件的 Linux 驱动程序开发,并且直接将这些驱动程序提交给内核团队以用在通常的发行版上。 + +有时候,或许你正在运行六个月之前安装的内核,并配备了上周刚刚上市令人兴奋的新设备。在这种情况下,你的内核也许没有那款设备的驱动程序。好消息是经常会出现那款设备的驱动程序已经存在于最近版本的内核中,意味着你只要更新运行的内核就可以了。 + +通常,这些都是通过安装包管理软件完成的。例如在 RHEL、CentOS 和 Fedora 上: + +``` +$ sudo dnf update kernel +``` + +在 Debian 和 Ubuntu 上,首先获取你当前内核的版本: + +``` +$ uname -r +4.4.186 +``` + +搜索新的版本: + +``` +$ sudo apt update +$ sudo apt search linux-image +``` + +安装找到的最新版本。在这个例子中,最新的版本是 5.2.4: + +``` +$ sudo apt install linux-image-5.2.4 +``` + +内核更新后,你必须 [reboot][8] (除非你使用 kpatch 或 kgraft)。这时,如果你需要的设备驱动程序包含在最新的内核中,你的硬件就会正常工作。 + +### 安装内核模块 + +有时候一个发行版没有预计到用户会使用某个设备(或者该设备的驱动程序至少不足以包含在 Linux 内核中)。Linux 对于驱动程序采用模块化方式,因此尽管驱动程序没有编译进内核,但发行版可以推送单独的驱动程序包让内核去加载。尽管有些复杂但是非常有用,尤其是当驱动程序没有包含进内核中而是在引导过程中加载,或是内核中的驱动程序相比模块化的驱动程序过期时。第一个问题可以用 “initrd” 解决(初始化 RAM 磁盘),这一点超出了本文的讨论范围,第二点通过 “kmod” 系统解决。 + +kmod 系统保证了当内核更新后,所有与之安装的模块化驱动程序也得到更新。如果你手动安装一个驱动程序,你就体验不到 kmod 提供的自动化,因此只要能用 kmod 安装包,就应该选择它。例如,尽管英伟达驱动程序以 Nouveau 模块构建在内核中,但官方的驱动程序仅由英伟达发布。你可以去网站上手动安装英伟达旗下的驱动程序,下载 “.run” 文件,并运行提供的 shell 脚本,但在安装了新的内核之后你必须重复相同的过程,因为没有任何东西告诉包管理软件你手动安装了一个内核驱动程序。英伟达驱动着你的显卡,手动更新英伟达驱动程序通常意味着你需要通过终端来执行更新,因为没有显卡驱动程序将无法显示。 + +![Nvidia configuration application][9] + +然而,如果你通过 kmod 包安装英伟达驱动程序,更新你的内核也会更新你的英伟达驱动程序。在 Fedora 和相关的发行版中: + +``` +$ sudo dnf install kmod-nvidia +``` + +在 Debian 和相关发行版上: + +``` +$ sudo apt update +$ sudo apt install nvidia-kernel-common nvidia-kernel-dkms nvidia-glx nvidia-xconfig nvidia-settings nvidia-vdpau-driver vdpau-va-driver +``` + +这仅仅是一个例子,但是如果你真的要安装英伟达驱动程序,你也必须屏蔽掉 Nouveau 驱动程序。参考你使用发行版的文档获取最佳的步骤吧。 + +### 下载并安装驱动程序 + +不是所有的东西都包含在内核中,也不是所有的东西都可以作为内核模块使用。在某些情况下,你需要下载一个由供应商编写并绑定好的特殊驱动程序,还有一些情况,你有驱动程序,但是没有配置驱动程序的前端界面。 + +有两个常见的例子是 HP 打印机和 [Wacom][10] 数位板。如果你有一台 HP 打印机,你可能有能够和打印机通信的通用的驱动程序,甚至能够打印出东西。但是通用的驱动程序却不能为特定型号的打印机提供定制化的选项,例如双面打印、校对、纸盒选择等等。[HPLIP][11](HP Linux 成像和打印系统)提供了选项来进行任务管理、调整打印设置、选择可用的纸盒等等。 + +HPLIP 通常包含在包管理软件中;只要搜索“hplip”就行了。 + +![HPLIP in action][12] + +同样的,电子艺术家主要使用的数位板 Wacom 的驱动程序通常也包含在内核中,但是例如调整压感和按键功能等设置只能通过默认包含在 GNOME 的图形控制面板访问。但也可以作为 KDE 上额外的程序包“kde-config-tablet”来访问。 + +这里也有几个类似的个别例子,例如内核中没有驱动程序,但是以 RPM 或 DEB 文件提供了可供下载并且通过包管理软件安装的 kmod 版本的驱动程序。 + +### 打上补丁并编译你的内核 + +即使在 21 世纪的未来主义乌托邦里,仍有厂商不够了解开源,没有提供可安装的驱动程序。有时候,一些公司为驱动程序提供开源代码,而需要你下载代码、修补内核、编译并手动安装。 + +这种发布方式和在 kmod 系统之外安装打包的驱动程序拥有同样的缺点:对内核的更新会破坏驱动程序,因为每次更换新的内核时都必须手动将其重新集成到内核中。 + +令人高兴的是,这种事情变得少见了,因为 Linux 内核团队在呼吁公司们与他们交流方面做得很好,并且公司们最终接受了开源不会很快消失的事实。但仍有新奇的或高度专业的设备仅提供了内核补丁。 + +官方上,对于你如何编译内核以使包管理器参与到升级系统如此重要的部分中,发行版有特定的习惯。这里有太多的包管理器,所以无法一一涵盖。举一个例子,当你使用 Fedora 上的工具例如 `rpmdev` 或 `build-essential`,Debian 上的 `devscripts`。 + +首先,像通常那样,找到你正在运行内核的版本: + +``` +$ uname -r +``` + +在大多数情况下,如果你还没有升级过内核那么可以试试升级一下内核。搞定之后,也许你的问题就会在最新发布的内核中解决。如果你尝试后发现不起作用,那么你应该下载正在运行内核的源码。大多数发行版提供了特定的命令来完成这件事,但是手动操作的话,可以在 [kernel.org][13] 上找到它的源代码。 + +你必须下载内核所需的任何补丁。有时候,这些补丁对应具体的内核版本,因此请谨慎选择。 + +通常,或至少在人们习惯于编译内核的那时,都是拿到源代码并对 `/usr/src/linux` 打上补丁。 + +解压内核源码并打上需要的补丁: + +``` +$ cd /usr/src/linux +$ bzip2 --decompress linux-5.2.4.tar.bz2 +$ cd  linux-5.2.4 +$ bzip2 -d ../patch*bz2 +``` + +补丁文件也许包含如何使用的教程,但通常它们都设计成在内核源码树的顶层可用来执行。 + +``` +$ patch -p1 < patch*example.patch +``` + +当内核代码打上补丁后,你可以继续使用旧的配置来对打了补丁的内核进行配置。 + +``` +$ make oldconfig +``` + +`make oldconfig` 命令有两个作用:它继承了当前的内核配置,并且允许你配置补丁带来的新的选项。 + +你或许需要运行 `make menuconfig` 命令,它启动了一个基于 ncurses 的菜单界面,列出了新的内核所有可能的选项。整个菜单可能看不过来,但是它是以旧的内核配置为基础的,你可以遍历菜单并且禁用掉你没有或不需要的硬件模块。另外,如果你知道自己有一些硬件没有包含在当前的配置中,你可以选择构建它,当作模块或者直接嵌入内核中。理论上,这些并不是必要的,因为你可以猜想,当前的内核运行良好只是缺少了补丁,当使用补丁的时候可能已经激活了所有设备所必要的选项。 + +下一步,编译内核和它的模块: + +``` +$ make bzImage +$ make modules +``` + +这会产生一个叫作 `vmlinuz` 的文件,它是你的可引导内核的压缩版本。保存旧的版本并在 `/boot` 文件夹下替换为新的。 + +``` +$ sudo mv /boot/vmlinuz /boot/vmlinuz.nopatch +$ sudo cat arch/x86_64/boot/bzImage > /boot/vmlinuz +$ sudo mv /boot/System.map /boot/System.map.stock +$ sudo cp System.map /boot/System.map +``` + +到目前为止,你已经打上了补丁并且编译了内核和它的模块,你安装了内核,但你并没有安装任何模块。那就是最后的步骤: + +``` +$ sudo make modules_install +``` + +新的内核已经就位,并且它的模块也已经安装。 + +最后一步是更新你的引导程序,为了让你的计算机在加载 Linux 内核之前知道它的位置。GRUB 引导程序使这一过程变得相当简单: + +``` +$ sudo grub2-mkconfig +``` + +### 现实生活中的编译 + +当然,现在没有人手动执行这些命令。相反的,参考你的发行版,寻找发行版维护人员使用的开发者工具集修改内核的说明。这些工具集可能会创建一个集成所有补丁的可安装软件包,告诉你的包管理器来升级并更新你的引导程序。 + +### 内核 + +操作系统和内核都是玄学,但要理解构成它们的组件并不难。下一次你看到某个技术无法应用在 Linux 上时,深呼吸,调查可用的驱动程序,寻找一条捷径。Linux 比以前简单多了——包括内核。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-21st-century + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[LuMing](https://github.com/LuuMing) +校对:[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/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: https://nouveau.freedesktop.org/wiki/ +[3]: http://fedoraproject.org +[4]: http://ubuntu.com +[5]: https://wiki.linuxfoundation.org/openprinting/database/foomatic +[6]: https://www.cups.org/ +[7]: https://wireless.wiki.kernel.org/en/users/drivers +[8]: https://opensource.com/article/19/7/reboot-linux +[9]: https://opensource.com/sites/default/files/uploads/nvidia.jpg (Nvidia configuration application) +[10]: https://linuxwacom.github.io +[11]: https://developers.hp.com/hp-linux-imaging-and-printing +[12]: https://opensource.com/sites/default/files/uploads/hplip.jpg (HPLIP in action) +[13]: https://www.kernel.org/ diff --git a/published/20190826 Introduction to the Linux chown command.md b/published/20190826 Introduction to the Linux chown command.md new file mode 100644 index 0000000000..6a7befd20a --- /dev/null +++ b/published/20190826 Introduction to the Linux chown command.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11416-1.html) +[#]: subject: (Introduction to the Linux chown command) +[#]: via: (https://opensource.com/article/19/8/linux-chown-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +chown 命令简介 +====== + +> 学习如何使用 chown 命令更改文件或目录的所有权。 + +![](https://img.linux.net.cn/data/attachment/album/201910/03/000014mfrxrxi5rej75mjs.jpg) + +Linux 系统上的每个文件和目录均由某个人拥有,拥有者可以完全控制更改或删除他们拥有的文件。除了有一个*拥有用户*外,文件还有一个*拥有组*。 + +你可以使用 `ls -l` 命令查看文件的所有权: + +``` +[pablo@workstation Downloads]$ ls -l +total 2454732 +-rw-r--r--. 1 pablo pablo 1934753792 Jul 25 18:49 Fedora-Workstation-Live-x86_64-30-1.2.iso +``` + +该输出的第三和第四列是拥有用户和组,它们一起称为*所有权*。上面的那个 ISO 文件这两者都是 `pablo`。 + +所有权设置由 [chmod 命令][2]进行设置,控制允许谁可以执行读取、写入或运行的操作。你可以使用 `chown` 命令更改所有权(一个或两者)。 + +所有权经常需要更改。文件和目录一直存在在系统中,但用户不断变来变去。当文件和目录在系统中移动时,或从一个系统移动到另一个系统时,所有权也可能需要更改。 + +我的主目录中的文件和目录的所有权是我的用户和我的主要组,以 `user:group` 的形式表示。假设 Susan 正在管理 Delta 组,该组需要编辑一个名为 `mynotes` 的文件。你可以使用 `chown` 命令将该文件的用户更改为 `susan`,组更改为 `delta`: + +``` +$ chown susan:delta mynotes +ls -l +-rw-rw-r--. 1 susan delta 0 Aug  1 12:04 mynotes +``` + +当给该文件设置好了 Delta 组时,它可以分配回给我: + +``` +$ chown alan mynotes +$ ls -l mynotes +-rw-rw-r--. 1 alan delta 0 Aug  1 12:04 mynotes +``` + +给用户后添加冒号(`:`),可以将用户和组都分配回给我: + +``` +$ chown alan: mynotes +$ ls -l mynotes +-rw-rw-r--. 1 alan alan 0 Aug  1 12:04 mynotes +``` + +通过在组前面加一个冒号,可以只更改组。现在,`gamma` 组的成员可以编辑该文件: + +``` +$ chown :gamma mynotes +$ ls -l +-rw-rw-r--. 1 alan gamma 0 Aug  1 12:04 mynotes +``` + +`chown` 的一些附加参数都能用在命令行和脚本中。就像许多其他 Linux 命令一样,`chown` 有一个递归参数(`-R`),它告诉该命令进入目录以对其中的所有文件进行操作。没有 `-R` 标志,你就只能更改文件夹的权限,而不会更改其中的文件。在此示例中,假定目的是更改目录及其所有内容的权限。这里我添加了 `-v`(详细)参数,以便 `chown` 报告其工作情况: + +``` +$ ls -l . conf +.: +drwxrwxr-x 2 alan alan 4096 Aug  5 15:33 conf + +conf: +-rw-rw-r-- 1 alan alan 0 Aug  5 15:33 conf.xml + +$ chown -vR susan:delta conf +changed ownership of 'conf/conf.xml' from alan:alan to  susan:delta +changed ownership of 'conf' from alan:alan to  susan:delta +``` + +根据你的角色,你可能需要使用 `sudo` 来更改文件的所有权。 + +在更改文件的所有权以匹配特定配置时,或者在你不知道所有权时(例如运行脚本时),可以使用参考文件(`--reference=RFILE`)。例如,你可以复制另一个文件(`RFILE`,称为参考文件)的用户和组,以撤消上面所做的更改。回想一下,点(`.`)表示当前的工作目录。 + +``` +$ chown -vR --reference=. conf +``` + +### 报告更改 + +大多数命令都有用于控制其输出的参数。最常见的是 `-v`(`--verbose`)以启用详细信息,但是 `chown` 还具有 `-c`(`--changes`)参数来指示 `chown` 仅在进行更改时报告。`chown` 还会报告其他情况,例如不允许进行的操作。 + +参数 `-f`(`--silent`、`--quiet`)用于禁止显示大多数错误消息。在下一节中,我将使用 `-f` 和 `-c`,以便仅显示实际更改。 + +### 保持根目录 + +Linux 文件系统的根目录(`/`)应该受到高度重视。如果命令在此层级上犯了一个错误,则后果可能会使系统完全无用。尤其是在运行一个会递归修改甚至删除的命令时。`chown` 命令具有一个可用于保护和保持根目录的参数,它是 `--preserve-root`。如果在根目录中将此参数和递归一起使用,那么什么也不会发生,而是会出现一条消息: + +``` +$ chown -cfR --preserve-root alan / +chown: it is dangerous to operate recursively on '/' +chown: use --no-preserve-root to override this failsafe +``` + +如果不与 `--recursive` 结合使用,则该选项无效。但是,如果该命令由 `root` 用户运行,则 `/` 本身的权限将被更改,但其下的其他文件或目录的权限则不会更改: + +``` +$ chown -c --preserve-root alan / +chown: changing ownership of '/': Operation not permitted +[root@localhost /]# chown -c --preserve-root alan / +changed ownership of '/' from root to alan +``` + +### 所有权即安全 + +文件和目录所有权是良好的信息安全性的一部分,因此,偶尔检查和维护文件所有权以防止不必要的访问非常重要。`chown` 命令是 Linux 安全命令集中最常见和最重要的命令之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-chown-command + +作者:[Alan Formy-Duval][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://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/19/8/introduction-linux-chmod-command diff --git a/published/20190830 How to Install Linux on Intel NUC.md b/published/20190830 How to Install Linux on Intel NUC.md new file mode 100644 index 0000000000..d460dfccb0 --- /dev/null +++ b/published/20190830 How to Install Linux on Intel NUC.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11477-1.html) +[#]: subject: "How to Install Linux on Intel NUC" +[#]: via: "https://itsfoss.com/install-linux-on-intel-nuc/" +[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" + +在 Intel NUC 上安装 Linux +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/18/221221pw3hbbi3bbbbprr4.jpg) + +在上周,我买了一台 [InteL NUC][1]。虽然它是如此之小,但它与成熟的桌面型电脑差别甚小。实际上,大部分的[基于 Linux 的微型 PC][2] 都是基于 Intel NUC 构建的。 + +我买了第 8 代 Core i3 处理器的“准系统barebone” NUC。准系统意味着该设备没有 RAM、没有硬盘,显然也没有操作系统。我添加了一个 [Crucial 的 8 GB 内存条][3](大约 33 美元)和一个 [240 GB 的西数的固态硬盘][4](大约 45 美元)。 + +现在,我已经有了一台不到 400 美元的电脑。因为我已经有了一个电脑屏幕和键鼠套装,所以我没有把它们计算在内。 + +![在我的办公桌上放着一个崭新的英特尔 NUC NUC8i3BEH,后面有树莓派 4][5] + +我买这个 Intel NUC 的主要原因就是我想在实体机上测试各种各样的 Linux 发行版。我已经有一个 [树莓派 4][6] 设备作为一个入门级的桌面系统,但它是一个 [ARM][7] 设备,因此,只有少数 Linux 发行版可用于树莓派上。(LCTT 译注:新发布的 Ubuntu 19.10 支持树莓派 4B) + +*这个文章里的亚马逊链接是(原文的)受益连接。请参阅我们的[受益政策][8]。* + +### 在 NUC 上安装 Linux + +现在我准备安装 Ubuntu 18.04 长期支持版,因为我现在就有这个系统的安装文件。你也可以按照这个教程安装其他的发行版。在最重要的分区之前,前边的步骤都大致相同。 + +#### 第一步:创建一个 USB 启动盘 + +你可以在 Ubuntu 官网下载它的安装文件。使用另一个电脑去[创建一个 USB 启动盘][9]。你可以使用像 [Rufus][10] 和 [Etcher][11] 这样的软件。在 Ubuntu上,你可以使用默认的启动盘创建工具。 + +#### 第二步:确认启动顺序是正确的 + +将你的 USB 启动盘插入到你的电脑并开机。一旦你看到 “Intel NUC” 字样出现在你的屏幕上,快速的按下 `F2` 键进入到 BIOS 设置中。 + +![Intel NUC 的 BIOS 设置][12] + +在这里,只是确认一下你的第一启动项是你的 USB 设备。如果不是,切换启动顺序。 + +如果你修改了一些选项,按 `F10` 键保存退出,否则直接按下 `ESC` 键退出 BIOS 设置。 + +#### 第三步:正确分区,安装 Linux + +现在当机器重启的时候,你就可以看到熟悉的 Grub 界面,可以让你试用或者安装 Ubuntu。现在我们选择安装它。 + +开始的几个安装步骤非常简单,选择键盘的布局,是否连接网络还有一些其他简单的设置。 + +![在安装 Ubuntu Linux 时选择键盘布局][14] + +你可能会使用常规安装,默认情况下会安装一些有用的应用程序。 + +![][15] + +接下来的是要注意的部分。你有两种选择: + +* “擦除磁盘并安装 UbuntuErase disk and install Ubuntu”:最简单的选项,它将在整个磁盘上安装 Ubuntu。如果你只想在 Intel NUC 上使用一个操作系统,请选择此选项,Ubuntu 将负责剩余的工作。 +* “其他选项Something else”:这是一个控制所有选择的高级选项。就我而言,我想在同一 SSD 上安装多个 Linux 发行版。因此,我选择了此高级选项。 + +![][16] + +**如果你选择了“擦除磁盘并安装 UbuntuErase disk and install Ubuntu”,点击“继续Continue”,直接跳到第四步,** + +如果你选择了高级选项,请按照下面剩下的部分进行操作。 + +选择固态硬盘,然后点击“新建分区表New Partition Table”。 + +![][17] + +它会给你显示一个警告。直接点击“继续Continue”。 + +![][18] + +现在你就可以看到你 SSD 磁盘里的空闲空间。我的想法是为 EFI bootloader 创建一个 EFI 系统分区。一个根(`/`)分区,一个主目录(`/home`)分区。这里我并没有创建[交换分区][19]。Ubuntu 会根据自己的需要来创建交换分区。我也可以通过[创建新的交换文件][32]来扩展交换分区。 + +我将在磁盘上保留近 200 GB 的可用空间,以便可以在此处安装其他 Linux 发行版。你可以将其全部用于主目录分区。保留单独的根分区和主目录分区可以在你需要重新安装系统时帮你保存里面的数据。 + +选择可用空间,然后单击加号以添加分区。 + +![][20] + +一般来说,100MB 足够 EFI 的使用,但是某些发行版可能需要更多空间,因此我要使用 500MB 的 EFI 分区。 + +![][21] + +接下来,我将使用 20GB 的根分区。如果你只使用一个发行版,则可以随意地将其增加到 40GB。 + +根目录(`/`)是系统文件存放的地方。你的程序缓存和你安装的程序将会有一些文件放在这个目录下边。我建议你可以阅读一下 [Linux 文件系统层次结构][22]来了解更多相关内容。 + +填入分区的大小,选择 Ext4 文件系统,选择 `/` 作为挂载点。 + +![][24] + +接下来是创建一个主目录分区,我再说一下,如果你仅仅想使用一个 Linux 发行版。那就把剩余的空间都使用完吧。为主目录分区选择一个合适的大小。 + +主目录是你个人的文件,比如文档、图片、音乐、下载和一些其他的文件存储的地方。 + +![][25] + +既然你创建好了 EFI 分区、根分区、主目录分区,那你就可以点击“现在安装Install Now”按钮安装系统了。 + +![][26] + +它将会提示你新的改变将会被写入到磁盘,点击“继续Continue”。 + +![][27] + +#### 第四步:安装 Ubuntu + +事情到了这就非常明了了。现在选择你的分区或者以后选择也可以。 + +![][28] + +接下来,输入你的用户名、主机名以及密码。 + +![][29] + +看 7-8 分钟的幻灯片就可以安装完成了。 + +![][30] + +一旦安装完成,你就可以重新启动了。 + +![][31] + +当你重启的时候,你必须要移除你的 USB 设备,否则你将会再次进入安装系统的界面。 + +这就是在 Intel NUC 设备上安装 Linux 所需要做的一切。坦白说,你可以在其他任何系统上使用相同的过程。 + +### Intel NUC 和 Linux 在一起:如何使用它? + +我非常喜欢 Intel NUC。它不占用太多的桌面空间,而且有足够的能力去取代传统的桌面型电脑。你可以将它的内存升级到 32GB。你也可以安装两个 SSD 硬盘。总之,它提供了一些配置和升级范围。 + +如果你想购买一个桌面型的电脑,我非常推荐你购买使用 [Intel NUC][1] 迷你主机。如果你不想自己安装系统,那么你可以购买一个[基于 Linux 的已经安装好的系统迷你主机][2]。 + +你是否已经有了一个 Intel NUC?有一些什么相关的经验?你有什么相关的意见与我们分享吗?可以在下面评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-on-intel-nuc/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[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://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW "Intel NUC" +[2]: https://itsfoss.com/linux-based-mini-pc/ +[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 "8GB RAM from Crucial" +[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 "240 GB Western Digital SSD" +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1 +[6]: https://itsfoss.com/raspberry-pi-4/ +[7]: https://en.wikipedia.org/wiki/ARM_architecture +[8]: https://itsfoss.com/affiliate-policy/ +[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/ +[10]: https://rufus.ie/ +[11]: https://www.balena.io/etcher/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1 +[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1 +[19]: https://itsfoss.com/swap-size/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1 +[22]: https://linuxhandbook.com/linux-directory-structure/ +[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1 +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1 +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1 +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1 +[32]: https://itsfoss.com/create-swap-file-linux/ diff --git a/published/201909/20180116 Command Line Heroes- Season 1- OS Wars_2.md b/published/201909/20180116 Command Line Heroes- Season 1- OS Wars_2.md new file mode 100644 index 0000000000..68f6f81913 --- /dev/null +++ b/published/201909/20180116 Command Line Heroes- Season 1- OS Wars_2.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11296-1.html) +[#]: subject: (Command Line Heroes: Season 1: OS Wars) +[#]: via: (https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux) +[#]: author: (redhat https://www.redhat.com) + +《代码英雄》第一季(2):操作系统战争(下)Linux 崛起 +====== + +> 代码英雄讲述了开发人员、程序员、黑客、极客和开源反叛者如何彻底改变技术前景的真实史诗故事。 + +![](https://www.redhat.com/files/webux/img/bandbg/bkgd-clh-ep2-2000x950.png) + +本文是《[代码英雄](https://www.redhat.com/en/command-line-heroes)》系列播客[第一季(2):操作系统战争(下)](https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux) 的[音频](https://dts.podtrac.com/redirect.mp3/audio.simplecast.com/2199861a.mp3)脚本。 + +> 微软帝国控制着 90% 的用户。操作系统的完全标准化似乎是板上钉钉的事了。但是一个不太可能的英雄出现在开源反叛组织中。戴着眼镜,温文尔雅的林纳斯·托瓦兹Linus Torvalds免费发布了他的 Linux® 程序。微软打了个趔趄,并且开始重整旗鼓而来,战场从个人电脑转向互联网。 + +**Saron Yitbarek:** 这玩意开着的吗?让我们进一段史诗般的星球大战的开幕吧,开始了。 + +配音:第二集:Linux® 的崛起。微软帝国控制着 90% 的桌面用户。操作系统的全面标准化似乎是板上钉钉的事了。然而,互联网的出现将战争的焦点从桌面转向了企业,在该领域,所有商业组织都争相构建自己的服务器。*[00:00:30]*与此同时,一个不太可能的英雄出现在开源反叛组织中。固执、戴着眼镜的 林纳斯·托瓦兹Linus Torvalds免费发布了他的 Linux 系统。微软打了个趔趄,并且开始重整旗鼓而来。 + +**Saron Yitbarek:** 哦,我们书呆子就是喜欢那样。上一次我们讲到哪了?苹果和微软互相攻伐,试图在一场争夺桌面用户的战争中占据主导地位。*[00:01:00]* 在第一集的结尾,我们看到微软获得了大部分的市场份额。很快,由于互联网的兴起以及随之而来的开发者大军,整个市场都经历了一场地震。互联网将战场从在家庭和办公室中的个人电脑用户转移到拥有数百台服务器的大型商业客户中。 + +这意味着巨量资源的迁移。突然间,所有相关企业不仅被迫为服务器空间和网站建设付费,而且还必须集成软件来进行资源跟踪和数据库监控等工作。*[00:01:30]* 你需要很多开发人员来帮助你。至少那时候大家都是这么做的。 + +在操作系统之战的第二部分,我们将看到优先级的巨大转变,以及像林纳斯·托瓦兹和理查德·斯托尔曼Richard Stallman这样的开源反逆者是如何成功地在微软和整个软件行业的核心地带引发恐惧的。 + +我是 Saron Yitbarek,你现在收听的是代码英雄,一款红帽公司原创的播客节目。*[00:02:00]* 每一集,我们都会给你带来“从码开始”改变技术的人的故事。 + +好。想象一下你是 1991 年时的微软。你自我感觉良好,对吧?满怀信心。确立了全球主导的地位感觉不错。你已经掌握了与其他企业合作的艺术,但是仍然将大部分开发人员、程序员和系统管理员排除在联盟之外,而他们才是真正的步兵。*[00:02:30]* 这时出现了个叫林纳斯·托瓦兹的芬兰极客。他和他的开源程序员团队正在开始发布 Linux,这个操作系统内核是由他们一起编写出来的。 + +坦白地说,如果你是微软公司,你并不会太在意 Linux,甚至不太关心开源运动,但是最终,Linux 的规模变得如此之大,以至于微软不可能不注意到。*[00:03:00]* Linux 第一个版本出现在 1991 年,当时大概有 1 万行代码。十年后,变成了 300 万行代码。如果你想知道,今天则是 2000 万行代码。 + +*[00:03:30]* 让我们停留在 90 年代初一会儿。那时 Linux 还没有成为我们现在所知道的庞然大物。这个奇怪的病毒式的操作系统只是正在这个星球上蔓延,全世界的极客和黑客都爱上了它。那时候我还太年轻,但有点希望我曾经经历过那个时候。在那个时候,发现 Linux 就如同进入了一个秘密社团一样。就像其他人分享地下音乐混音带一样,程序员与朋友们分享 Linux CD 集。 + +开发者 Tristram Oaten *[00:03:40]* 讲讲你 16 岁时第一次接触 Linux 的故事吧。 + +**Tristram Oaten:** 我和我的家人去了红海的 Hurghada 潜水度假。那是一个美丽的地方,强烈推荐。第一天,我喝了自来水。也许,我妈妈跟我说过不要这么做。我整个星期都病得很厉害,没有离开旅馆房间。*[00:04:00]* 当时我只带了一台新安装了 Slackware Linux 的笔记本电脑,我听说过这玩意并且正在尝试使用它。所有的东西都在 8 张 cd 里面。这种情况下,我只能整个星期都去了解这个外星一般的系统。我阅读手册,摆弄着终端。我记得当时我甚至不知道一个点(表示当前目录)和两个点(表示前一个目录)之间的区别。 + +*[00:04:30]* 我一点头绪都没有。犯过很多错误,但慢慢地,在这种强迫的孤独中,我突破了障碍,开始理解并明白命令行到底是怎么回事。假期结束时,我没有看过金字塔、尼罗河等任何埃及遗址,但我解锁了现代世界的一个奇迹。我解锁了 Linux,接下来的事大家都知道了。 + +**Saron Yitbarek:** 你会从很多人那里听到关于这个故事的不同说法。访问 Linux 命令行是一种革命性的体验。 + +**David Cantrell:** *[00:05:00]* 它给了我源代码。我当时的感觉是,“太神奇了。” + +**Saron Yitbarek:** 我们正在参加一个名为 Flock to Fedora 的 2017 年 Linux 开发者大会。 + +**David Cantrell:** ……非常有吸引力。我觉得我对这个系统有了更多的控制力,它越来越吸引我。我想,从 1995 年我第一次编译 Linux 内核那时起,我就迷上了它。 + +**Saron Yitbarek:** 开发者 David Cantrell 与 Joe Brockmire。 + +**Joe Brockmeier:** *[00:05:30]* 我在 Cheap Software 转的时候发现了一套四张 CD 的 Slackware Linux。它看起来来非常令人兴奋而且很有趣,所以我把它带回家,安装在第二台电脑上,开始摆弄它,有两件事情让我感到很兴奋:一个是,我运行的不是 Windows,另一个是 Linux 的开源特性。 + +**Saron Yitbarek:** *[00:06:00]* 某种程度上来说,对命令行的使用总是存在的。在开源真正开始流行还要早的几十年前,人们(至少在开发人员中是这样)总是希望能够做到完全控制。让我们回到操作系统大战之前的那个时代,在苹果和微软为他们的 GUI 而战之前。那时也有代码英雄。保罗·琼斯Paul Jones教授(在线图书馆 ibiblio.org 的负责人)在那个古老的时代,就是一名开发人员。 + +**Paul Jones:** *[00:06:30]* 从本质上讲,互联网在那个时候客户端-服务器架构还是比较少的,而更多的是点对点架构的。确实,我们会说,某种 VAX 到 VAX 的连接(LCTT 译注:DEC 的一种操作系统),某种科学工作站到科学工作站的连接。这并不意味着没有客户端-服务端的架构及应用程序,但这的确意味着,最初的设计是思考如何实现点对点,*[00:07:00]* 它与 IBM 一直在做的东西相对立。IBM 给你的只有哑终端,这种终端只能让你管理用户界面,却无法让你像真正的终端一样为所欲为。 + +**Saron Yitbarek:** 图形用户界面在普通用户中普及的同时,在工程师和开发人员中总是存在着一股相反的力量。早在 Linux 出现之前的二十世纪七八十年代,这股力量就存在于 Emacs 和 GNU 中。有了斯托尔曼的自由软件基金会后,总有某些人想要使用命令行,但上世纪 90 年代的 Linux 提供了前所未有的东西。 + +*[00:07:30]* Linux 和其他开源软件的早期爱好者是都是先驱。我正站在他们的肩膀上。我们都是。 + +你现在收听的是代码英雄,一款由红帽公司原创的播客。这是操作系统大战的第二部分:Linux 崛起。 + +**Steven Vaughan-Nichols:** 1998 年的时候,情况发生了变化。 + +**Saron Yitbarek:** *[00:08:00]* Steven Vaughan-Nichols 是 zdnet.com 的特约编辑,他已经写了几十年关于技术商业方面的文章了。他将向我们讲述 Linux 是如何慢慢变得越来越流行,直到自愿贡献者的数量远远超过了在 Windows 上工作的微软开发人员的数量的。不过,Linux 从未真正追上微软桌面客户的数量,这也许就是微软最开始时忽略了 Linux 及其开发者的原因。Linux 真正大放光彩的地方是在服务器机房。当企业开始线上业务时,每个企业都需要一个满足其需求的独特编程解决方案。 + +*[00:08:30]* WindowsNT 于 1993 年问世,当时它已经在与其他的服务器操作系统展开竞争了,但是许多开发人员都在想,“既然我可以通过 Apache 构建出基于 Linux 的廉价系统,那我为什么要购买 AIX 设备或大型 Windows 设备呢?”关键点在于,Linux 代码已经开始渗透到几乎所有网上的东西中。 + +**Steven Vaughan-Nichols:** *[00:09:00]* 令微软感到惊讶的是,它开始意识到,Linux 实际上已经开始有一些商业应用,不是在桌面环境,而是在商业服务器上。因此,他们发起了一场运动,我们称之为 FUD - 恐惧、不确定和怀疑fear, uncertainty and double。他们说,“哦,Linux 这玩意,真的没有那么好。它不太可靠。你一点都不能相信它”。 + +**Saron Yitbarek:** 这种软宣传式的攻击持续了一段时间。微软也不是唯一一个对 Linux 感到紧张的公司。这其实是整个行业在对抗这个奇怪新人的挑战。*[00:09:30]* 例如,任何与 UNIX 有利害关系的人都可能将 Linux 视为篡夺者。有一个案例很著名,那就是 SCO 组织(它发行过一种 UNIX 版本)在过去 10 多年里发起一系列的诉讼,试图阻止 Linux 的传播。SCO 最终失败而且破产了。与此同时,微软一直在寻找机会,他们必须要采取动作,只是不清楚具体该怎么做。 + +**Steven Vaughan-Nichols:** *[00:10:00]* 让微软真正担心的是,第二年,在 2000 年的时候,IBM 宣布,他们将于 2001 年投资 10 亿美元在 Linux 上。现在,IBM 已经不再涉足个人电脑业务。(那时)他们还没有走出去,但他们正朝着这个方向前进,他们将 Linux 视为服务器和大型计算机的未来,在这一点上,剧透警告,IBM 是正确的。*[00:10:30]* Linux 将主宰服务器世界。 + +**Saron Yitbarek:** 这已经不再仅仅是一群黑客喜欢他们对命令行的绝地武士式的控制了。金钱的投入对 Linux 助力极大。Linux 国际Linux International的执行董事 John “Mad Dog” Hall 有一个故事可以解释为什么会这样。我们通过电话与他取得了联系。 + +**John Hall:** *[00:11:00]* 我有一个名叫 Dirk Holden 的朋友,他是德国德意志银行的系统管理员,他也参与了个人电脑上早期 X Windows 系统图形项目的工作。有一天我去银行拜访他,我说:“Dirk,你银行里有 3000 台服务器,用的都是 Linux。为什么不用 Microsoft NT 呢?”*[00:11:30]* 他看着我说:“是的,我有 3000 台服务器,如果使用微软的 Windows NT 系统,我需要 2999 名系统管理员。”他继续说道:“而使用 Linux,我只需要四个。”这真是完美的答案。 + +**Saron Yitbarek:** 程序员们着迷的这些东西恰好对大公司也极具吸引力。但由于 FUD 的作用,一些企业对此持谨慎态度。*[00:12:00]* 他们听到开源,就想:“开源。这看起来不太可靠,很混乱,充满了 BUG”。但正如那位银行经理所指出的,金钱有一种有趣的方式,可以说服人们克服困境。甚至那些只需要网站的小公司也加入了 Linux 阵营。与一些昂贵的专有选择相比,使用一个廉价的 Linux 系统在成本上是无法比拟的。如果你是一家雇佣专业人员来构建网站的商店,那么你肯定想让他们使用 Linux。 + +让我们快进几年。Linux 运行每个人的网站上。Linux 已经征服了服务器世界,然后智能手机也随之诞生。*[00:12:30]* 当然,苹果和他们的 iPhone 占据了相当大的市场份额,而且微软也希望能进入这个市场,但令人惊讶的是,Linux 也在那,已经做好准备了,迫不及待要大展拳脚。 + +作家兼记者 James Allworth。 + +**James Allworth:** 肯定还有容纳第二个竞争者的空间,那本可以是微软,但是实际上却是 Android,而 Andrid 基本上是基于 Linux 的。众所周知,Android 被谷歌所收购,现在运行在世界上大部分的智能手机上,谷歌在 Linux 的基础上创建了 Android。*[00:13:00]* Linux 使他们能够以零成本从一个非常复杂的操作系统开始。他们成功地实现了这一目标,最终将微软挡在了下一代设备之外,至少从操作系统的角度来看是这样。 + +**Saron Yitbarek:** *[00:13:30]* 这可是个大地震,很大程度上,微软有被埋没的风险。John Gossman 是微软 Azure 团队的首席架构师。他还记得当时困扰公司的困惑。 + +**John Gossman:** 像许多公司一样,微软也非常担心知识产权污染。他们认为,如果允许开发人员使用开源代码,那么他们可能只是将一些代码复制并粘贴到某些产品中,就会让某种病毒式的许可证生效从而引发未知的风险……他们也很困惑,*[00:14:00]* 我认为,这跟公司文化有关,很多公司,包括微软,都对开源开发的意义和商业模式之间的分歧感到困惑。有一种观点认为,开源意味着你所有的软件都是免费的,人们永远不会付钱。 + +**Saron Yitbarek:** 任何投资于旧的、专有软件模型的人都会觉得这里发生的一切对他们构成了威胁。当你威胁到像微软这样的大公司时,是的,他们一定会做出反应。*[00:14:30]* 他们推动所有这些 FUD —— 恐惧、不确定性和怀疑是有道理的。当时,商业运作的方式基本上就是相互竞争。不过,如果是其他公司的话,他们可能还会一直怀恨在心,抱残守缺,但到了 2013 年的微软,一切都变了。 + +微软的云计算服务 Azure 上线了,令人震惊的是,它从第一天开始就提供了 Linux 虚拟机。*[00:15:00]* 史蒂夫·鲍尔默Steve Ballmer,这位把 Linux 称为癌症的首席执行官,已经离开了,代替他的是一位新的有远见的首席执行官萨提亚·纳德拉Satya Nadella。 + +**John Gossman:** 萨提亚有不同的看法。他属于另一个世代。比保罗、比尔和史蒂夫更年轻的世代,他对开源有不同的看法。 + +**Saron Yitbarek:** 还是来自微软 Azure 团队的 John Gossman。 + +**John Gossman:** *[00:15:30]* 大约四年前,处于实际需要,我们在 Azure 中添加了 Linux 支持。如果访问任何一家企业客户,你都会发现他们并不会才试着决定是使用 Windows 还是使用 Linux、 使用 .net 还是使用 Java ^TM 。他们在很久以前就做出了决定 —— 大约 15 年前才有这样的一些争论。*[00:16:00]* 现在,我见过的每一家公司都混合了 Linux 和 Java、Windows 和 .net、SQL Server、Oracle 和 MySQL —— 基于专有源代码的产品和开放源代码的产品。 + +如果你打算运维一个云服务,允许这些公司在云上运行他们的业务,那么你根本不能告诉他们,“你可以使用这个软件,但你不能使用那个软件。” + +**Saron Yitbarek:** *[00:16:30]* 这正是萨提亚·纳德拉采纳的哲学思想。2014 年秋季,他站在舞台上,希望传递一个重要信息。“微软爱 Linux”。他接着说,“20% 的 Azure 业务量已经是 Linux 了,微软将始终对 Linux 发行版提供一流的支持。”没有哪怕一丝对开源的宿怨。 + +为了说明这一点,在他们的背后有一个巨大的标志,上面写着:“Microsoft ❤️ Linux”。哇噢。对我们中的一些人来说,这种转变有点令人震惊,但实际上,无需如此震惊。下面是 Steven Levy,一名科技记者兼作家。 + +**Steven Levy:** *[00:17:00]* 当你在踢足球的时候,如果草坪变滑了,那么你也许会换一种不同的鞋子。他们当初就是这么做的。*[00:17:30]* 他们不能否认现实,而且他们里面也有聪明人,所以他们必须意识到,这就是这个世界的运行方式,不管他们早些时候说了什么,即使他们对之前的言论感到尴尬,但是让他们之前关于开源多么可怕的言论影响到现在明智的决策那才真的是疯了。 + +**Saron Yitbarek:** 微软低下了它高傲的头。你可能还记得苹果公司,经过多年的孤立无援,最终转向与微软构建合作伙伴关系。现在轮到微软进行 180 度转变了。*[00:18:00]* 经过多年的与开源方式的战斗后,他们正在重塑自己。要么改变,要么死亡。Steven Vaughan-Nichols。 + +**Steven Vaughan-Nichols:** 即使是像微软这样规模的公司也无法与数千个开发着包括 Linux 在内的其它大项目的开源开发者竞争。很长时间以来他们都不愿意这么做。前微软首席执行官史蒂夫·鲍尔默对 Linux 深恶痛绝。*[00:18:30]* 由于它的 GPL 许可证,他视 Linux 为一种癌症,但一旦鲍尔默被扫地出门,新的微软领导层说,“这就好像试图命令潮流不要过来,但潮水依然会不断涌进来。我们应该与 Linux 合作,而不是与之对抗。” + +**Saron Tiebreak:** 事实上,互联网技术史上最大的胜利之一就是微软最终决定做出这样的转变。*[00:19:00]* 当然,当微软出现在开源圈子时,老一代的铁杆 Linux 支持者是相当怀疑的。他们不确定自己是否能接受这些家伙,但正如 Vaughan-Nichols 所指出的,今天的微软已经不是以前的微软了。 + +**Steven Vaughan-Nichols:** 2017 年的微软既不是史蒂夫·鲍尔默的微软,也不是比尔·盖茨的微软。这是一家完全不同的公司,有着完全不同的方法,而且,一旦使用了开源,你就无法退回到之前。*[00:19:30]* 开源已经吞噬了整个技术世界。从未听说过 Linux 的人可能对它并不了解,但是每次他们访问 Facebook,他们都在运行 Linux。每次执行谷歌搜索时,你都在运行 Linux。 + +*[00:20:00]* 每次你用 Android 手机,你都在运行 Linux。它确实无处不在,微软无法阻止它,而且我认为以为微软能以某种方式接管它的想法,太天真了。 + +**Saron Yitbarek:** 开源支持者可能一直担心微软会像混入羊群中的狼一样,但事实是,开源软件的本质保护了它无法被完全控制。*[00:20:30]* 没有一家公司能够拥有 Linux 并以某种特定的方式控制它。Greg Kroah-Hartman 是 Linux 基金会的一名成员。 + +**Greg Kroah-Hartman:** 每个公司和个人都以自私的方式为 Linux 做出贡献。他们之所以这样做是因为他们想要解决他们所面临的问题,可能是硬件无法工作,或者是他们想要添加一个新功能来做其他事情,又或者想在他们的产品中使用它。这很棒,因为他们会把代码贡献回去,此后每个人都会从中受益,这样每个人都可以用到这份代码。正是因为这种自私,所有的公司,所有的人都能从中受益。 + +**Saron Yitbarek:** *[00:21:00]* 微软已经意识到,在即将到来的云战争中,与 Linux 作战就像与空气作战一样。Linux 和开源不是敌人,它们是空气。如今,微软以白金会员的身份加入了 Linux 基金会。他们成为 GitHub 开源项目的头号贡献者。*[00:21:30]* 2017 年 9 月,他们甚至加入了开源促进联盟Open Source Initiative。现在,微软在开源许可证下发布了很多代码。微软的 John Gossman 描述了他们开源 .net 时所发生的事情。起初,他们并不认为自己能得到什么回报。 + +**John Gossman:** 我们本没有指望来自社区的贡献,然而,三年后,超过 50% 的对 .net 框架库的贡献来自于微软之外。这包括大量的代码。*[00:22:00]* 三星为 .net 提供了 ARM 支持。Intel 和 ARM 以及其他一些芯片厂商已经为 .net 框架贡献了特定于他们处理器的代码生成,以及数量惊人的修复、性能改进等等 —— 既有单个贡献者也有社区。 + +**Saron Yitbarek:** 直到几年前,今天的这个微软,这个开放的微软,还是不可想象的。 + +*[00:22:30]* 我是 Saron Yitbarek,这里是代码英雄。好吧,我们已经看到了为了赢得数百万桌面用户的爱而战的激烈场面。我们已经看到开源软件在专有软件巨头的背后悄然崛起,并攫取了巨大的市场份额。*[00:23:00]* 我们已经看到了一批批的代码英雄将编程领域变成了我你今天看到的这个样子。如今,大企业正在吸收开源软件,通过这一切,每个人都从他人那里受益。 + +在技术的西部荒野,一贯如此。苹果受到施乐的启发,微软受到苹果的启发,Linux 受到 UNIX 的启发。进化、借鉴、不断成长。如果比喻成大卫和歌利亚(LCTT 译注:西方经典的以弱胜强战争中的两个主角)的话,开源软件不再是大卫,但是,你知道吗?它也不是歌利亚。*[00:23:30]* 开源已经超越了传统。它已经成为其他人战斗的战场。随着开源道路变得不可避免,新的战争,那些在云计算中进行的战争,那些在开源战场上进行的战争正在加剧。 + +这是 Steven Levy,他是一名作者。 + +**Steven Levy:** 基本上,到目前为止,包括微软在内,有四到五家公司,正以各种方式努力把自己打造成为全方位的平台,比如人工智能领域。你能看到智能助手之间的战争,你猜怎么着?*[00:24:00]* 苹果有一个智能助手,叫 Siri。微软有一个,叫 Cortana。谷歌有谷歌助手。三星也有一个智能助手。亚马逊也有一个,叫 Alexa。我们看到这些战斗遍布各地。也许,你可以说,最热门的人工智能平台将控制我们生活中所有的东西,而这五家公司就是在为此而争斗。 + +**Saron Yitbarek:** *[00:24:30]* 如果你正在寻找另一个反叛者,它们就像 Linux 奇袭微软那样,偷偷躲在 Facebook、谷歌或亚马逊身后,你也许要等很久,因为正如作家 James Allworth 所指出的,成为一个真正的反叛者只会变得越来越难。 + +**James Allworth:** 规模一直以来都是一种优势,但规模优势本质上……怎么说呢,我认为以前它们在本质上是线性的,现在它们在本质上是指数型的了,所以,一旦你开始以某种方法走在前面,另一个新玩家要想赶上来就变得越来越难了。*[00:25:00]* 我认为在互联网时代这大体来说来说是正确的,无论是因为规模,还是数据赋予组织的竞争力的重要性和优势。一旦你走在前面,你就会吸引更多的客户,这就给了你更多的数据,让你能做得更好,这之后,客户还有什么理由选择排名第二的公司呢,难道是因为因为他们落后了这么远么?*[00:25:30]* 我认为在云的时代这个逻辑也不会有什么不同。 + +**Saron Yitbarek:** 这个故事始于史蒂夫·乔布斯和比尔·盖茨这样的非凡的英雄,但科技的进步已经呈现出一种众包、有机的感觉。我认为据说我们的开源英雄林纳斯·托瓦兹在第一次发明 Linux 内核时甚至没有一个真正的计划。他无疑是一位才华横溢的年轻开发者,但他也像潮汐前的一滴水一样。*[00:26:00]* 变革是不可避免的。据估计,对于一家专有软件公司来说,用他们老式的、专有的方式创建一个 Linux 发行版将花费他们超过 100 亿美元。这说明了开源的力量。 + +最后,这并不是一个专有模型所能与之竞争的东西。成功的公司必须保持开放。这是最大、最终极的教训。*[00:26:30]* 还有一点要记住:当我们连接在一起的时候,我们在已有基础上成长和建设的能力是无限的。不管这些公司有多大,我们都不必坐等他们给我们更好的东西。想想那些为了纯粹的创造乐趣而学习编码的新开发者,那些自己动手丰衣足食的人。 + +未来的优秀程序员无管来自何方,只要能够访问代码,他们就能构建下一个大项目。 + +*[00:27:00]* 以上就是我们关于操作系统战争的两个故事。这场战争塑造了我们的数字生活。争夺主导地位的斗争从桌面转移到了服务器机房,最终进入了云计算领域。过去的敌人难以置信地变成了盟友,众包的未来让一切都变得开放。*[00:27:30]* 听着,我知道,在这段历史之旅中,还有很多英雄我们没有提到,所以给我们写信吧。分享你的故事。[Redhat.com/commandlineheroes](https://www.redhat.com/commandlineheroes) 。我恭候佳音。 + +在本季剩下的时间里,我们将学习今天的英雄们在创造什么,以及他们要经历什么样的战斗才能将他们的创造变为现实。让我们从壮丽的编程一线回来看看更多的传奇故事吧。我们每两周放一集新的博客。几周后,我们将为你带来第三集:敏捷革命。 + +*[00:28:00]* 代码英雄是一款红帽公司原创的播客。要想免费自动获得新一集的代码英雄,请订阅我们的节目。只要在苹果播客、Spotify、谷歌 Play,或其他应用中搜索“Command Line Heroes”。然后点击“订阅”。这样你就会第一个知道什么时候有新剧集了。 + +我是 Saron Yitbarek。感谢收听。继续编码。 + +-------------------------------------------------------------------------------- + +via: https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux + +作者:[redhat][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.redhat.com +[b]: https://github.com/lujun9972 diff --git a/published/201909/20180117 How technology changes the rules for doing agile.md b/published/201909/20180117 How technology changes the rules for doing agile.md new file mode 100644 index 0000000000..9c12a818d6 --- /dev/null +++ b/published/201909/20180117 How technology changes the rules for doing agile.md @@ -0,0 +1,93 @@ +技术如何改变敏捷的规则 +====== + +> 当我们开始推行敏捷时,还没有容器和 Kubernetes。但是它们改变了过去最困难的部分:将敏捷性从小团队应用到整个组织。 + +![](https://img.linux.net.cn/data/attachment/album/201909/26/113910ytmoosx5tt79gan5.jpg) + +越来越多的企业正因为一个非常明显的原因开始尝试敏捷和 [DevOps][1]: 企业需要通过更快的速度和更多的实验为创新和竞争性提供优势。而 DevOps 将帮助我们得到所需的创新速度。但是,在小团队或初创企业中实践 DevOps 与进行大规模实践完全是两码事。我们都明白这样的一个事实,那就是在十个人的跨职能团队中能够很好地解决问题的方案,当将相同的模式应用到一百个人的团队中时就可能无法奏效。这条道路是如此艰难,以至于 IT 领导者最简单的应对就是将敏捷方法的推行再推迟一年。 + +但那样的时代已经结束了。如果你已经尝试过,但是没有成功,那么现在是时候重新开始了。 + +到目前为止,DevOps 需要为许多组织提供个性化的解决方案,因此往往需要进行大量的调整以及付出额外的工作。但在今天,[Linux 容器][2]和 Kubernetes 正在推动 DevOps 工具和过程的标准化。而这样的标准化将会加速整个软件开发过程。因此,我们用来实践 DevOps 工作方式的技术最终能够满足我们加快软件开发速度的愿望。 + +Linux 容器和 [Kubernetes][3] 正在改变团队交互的方式。此外,你可以在 Kubernetes 平台上运行任何能够在 Linux 运行的应用程序。这意味着什么呢?你可以运行大量的企业及应用程序(甚至可以解决以前令人烦恼的 Windows 和 Linux 之间的协调问题)。最后,容器和 Kubernetes 能够满足你未来将要运行的几乎所有工作。它们正在经受着未来的考验,以应对机器学习、人工智能和分析工作等下一代解决问题工具。 + +让我们以机器学习为例来思考一下。今天,人们可以在大量的企业数据中找到一些模式。当机器发现这些模式时(想想机器学习),你的员工就能更快地采取行动。随着人工智能的加入,机器不仅可以发现模式,还可以对模式进行操作。如今,一个积极的软件开发冲刺周期也就是三个星期而已。有了人工智能,机器每秒可以多次修改代码。创业公司会利用这种能力来“打扰你”。 + +考虑一下你需要多快才能参与到竞争当中。如果你对于无法对于 DevOps 和每周一个迭代周期充满信心,那么考虑一下当那个创业公司将 AI 驱动的过程指向你时会发生什么?现在是时候转向 DevOps 的工作方式了,否则就会像你的竞争对手一样被甩在后面。 + +### 容器技术如何改变团队的工作? + +DevOps 使得许多试图将这种工作方式扩展到更大范围的团队感到沮丧。即使许多 IT(和业务)人员之前都听说过敏捷相关的语言、框架、模型(如 DevOps),而这些都有望彻底应用程序开发和 IT 流程,但他们还是对此持怀疑态度。 + +向你的受众“推销”快速开发冲刺也不是一件容易的事情。想象一下,如果你以这种方式买了一栋房子 —— 你将不再需要向开发商支付固定的金额,而是会得到这样的信息:“我们将在 4 周内浇筑完地基,其成本是 X,之后再搭建房屋框架和铺设电路,但是我们现在只能够知道地基完成的时间表。”人们已经习惯了买房子的时候有一个预先的价格和交付时间表。 + +挑战在于构建软件与构建房屋不同。同一个建筑商往往建造了成千上万个完全相同的房子,而软件项目从来都各不相同。这是你要克服的第一个障碍。 + +开发和运维团队的工作方式确实不同,我之所以知道这一点是因为我曾经从事过这两方面的工作。企业往往会用不同的方式来激励他们,开发人员会因为更改和创建而获得奖励,而运维专家则会因降低成本和确保安全性而获得奖励。我们会把他们分成不同的小组,并且尽量减少互动。而这些角色通常会吸引那些思维方式完全不同的技术人员。但是这样的解决方案注定会失败,你必须打破横亘在开发和运维之间的藩篱。 + +想想传统情况下会发生什么。业务会把需求扔过墙,这是因为他们在“买房”模式下运作,并且说上一句“我们 9 个月后见。”开发人员根据这些需求进行开发,并根据技术约束的需要进行更改。然后,他们把它扔过墙传递给运维人员,并说一句“搞清楚如何运行这个软件”。然后,运维人员勤就会勤奋地进行大量更改,使软件与基础设施保持一致。然而,最终的结果是什么呢? + +通常情况下,当业务人员看到需求实现的最终结果时甚至根本辨认不出。在过去 20 年的大部分时间里,我们一次又一次地目睹了这种模式在软件行业中上演。而现在,是时候改变了。 + +Linux 容器能够真正地解决这样的问题,这是因为容器弥合开发和运维之间的鸿沟。容器技术允许两个团队共同理解和设计所有的关键需求,但仍然独立地履行各自团队的职责。基本上,我们去掉了开发人员和运维人员之间的电话游戏。 + +有了容器技术,我们可以使得运维团队的规模更小,但依旧能够承担起数百万应用程序的运维工作,并且能够使得开发团队可以更加快速地根据需要更改软件。(在较大的组织中,所需的速度可能比运维人员的响应速度更快。) + +有了容器技术,你可以将所需要交付的内容与它运行的位置分开。你的运维团队只需要负责运行容器的主机和安全的内存占用,仅此而已。这意味着什么呢? + +首先,这意味着你现在可以和团队一起实践 DevOps 了。没错,只需要让团队专注于他们已经拥有的专业知识,而对于容器,只需让团队了解所需集成依赖关系的必要知识即可。 + +如果你想要重新训练每个人,没有人会精通所有事情。容器技术允许团队之间进行交互,但同时也会为每个团队提供一个围绕该团队优势而构建的强大边界。开发人员会知道需要消耗什么资源,但不需要知道如何使其大规模运行。运维团队了解核心基础设施,但不需要了解应用程序的细节。此外,运维团队也可以通过更新应用程序来解决新的安全问题,以免你成为下一个数据泄露的热门话题。 + +想要为一个大型 IT 组织,比如 30000 人的团队教授运维和开发技能?那或许需要花费你十年的时间,而你可能并没有那么多时间。 + +当人们谈论“构建新的云原生应用程序将帮助我们摆脱这个问题”时,请批判性地进行思考。你可以在 10 个人的团队中构建云原生应用程序,但这对《财富》杂志前 1000 强的企业而言或许并不适用。除非你不再需要依赖现有的团队,否则你无法一个接一个地构建新的微服务:你最终将成为一个孤立的组织。这是一个诱人的想法,但你不能指望这些应用程序来重新定义你的业务。我还没见过哪家公司能在如此大规模的并行开发中获得成功。IT 预算已经受到限制;在很长时间内,将预算翻倍甚至三倍是不现实的。 + +### 当奇迹发生时:你好,速度 + +Linux 容器就是为扩容而生的。一旦你开始这样做,[Kubernetes 之类的编制工具就会发挥作用][6],这是因为你将需要运行数千个容器。应用程序将不仅仅由一个容器组成,它们将依赖于许多不同的部分,所有的部分都会作为一个单元运行在容器上。如果不这样做,你的应用程序将无法在生产环境中很好地运行。 + +思考一下有多少小滑轮和杠杆组合在一起来支撑你的业务,对于任何应用程序都是如此。开发人员负责应用程序中的所有滑轮和杠杆。(如果开发人员没有这些组件,你可能会在集成时做噩梦。)与此同时,无论是在线下还是在云上,运维团队都会负责构成基础设施的所有滑轮和杠杆。做一个较为抽象的比喻,使用Kubernetes,你的运维团队就可以为应用程序提供运行所需的燃料,但又不必成为所有方面的专家。 + +开发人员进行实验,运维团队则保持基础设施的安全和可靠。这样的组合使得企业敢于承担小风险,从而实现创新。不同于打几个孤注一掷的赌,公司中真正的实验往往是循序渐进的和快速的。 + +从个人经验来看,这就是组织内部发生的显著变化:因为人们说:“我们如何通过改变计划来真正地利用这种实验能力?”它会强制执行敏捷计划。 + +举个例子,使用 DevOps 模型、容器和 Kubernetes 的 KeyBank 如今每天都会部署代码。(观看[视频][7],其中主导了 KeyBank 持续交付和反馈的 John Rzeszotarski 将解释这一变化。)类似地,Macquarie 银行也借助 DevOps 和容器技术每天将一些东西投入生产环境。 + +一旦你每天都推出软件,它就会改变你计划的每一个方面,并且会[加速业务的变化速度][8]。Macquarie 银行和金融服务集团的 CDO,Luis Uguina 表示:“创意可以在一天内触达客户。”(参见对 Red Hat 与 Macquarie 银行合作的[案例研究][9])。 + +### 是时候去创造一些伟大的东西了 + +Macquarie 的例子说明了速度的力量。这将如何改变你的经营方式?记住,Macquarie 不是一家初创企业。这是 CIO 们所面临的颠覆性力量,它不仅来自新的市场进入者,也来自老牌同行。 + +开发人员的自由还改变了运营敏捷商店的 CIO 们的人才方程式。突然之间,大公司里的个体(即使不是在最热门的行业或地区)也可以产生巨大的影响。Macquarie 利用这一变动作为招聘工具,并向开发人员承诺,所有新招聘的员工将会在第一周内推出新产品。 + +与此同时,在这个基于云的计算和存储能力的时代,我们比以往任何时候都拥有更多可用的基础设施。考虑到[机器学习和人工智能工具将很快实现的飞跃][10],这是幸运的。 + +所有这些都说明现在正是打造伟大事业的好时机。考虑到市场创新的速度,你需要不断地创造伟大的东西来保持客户的忠诚度。因此,如果你一直在等待将赌注押在 DevOps 上,那么现在就是正确的时机。容器技术和 Kubernetes 改变了规则,并且对你有利。 + +-------------------------------------------------------------------------------- + +via: https://enterprisersproject.com/article/2018/1/how-technology-changes-rules-doing-agile + +作者:[Matt Hicks][a] +译者:[JayFrank](https://github.com/JayFrank) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://enterprisersproject.com/user/matt-hicks +[1]:https://enterprisersproject.com/tags/devops +[2]:https://www.redhat.com/en/topics/containers?intcmp=701f2000000tjyaAAA +[3]:https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA +[4]:https://enterprisersproject.com/article/2017/8/4-container-adoption-patterns-what-you-need-know?sc_cid=70160000000h0aXAAQ +[5]:https://enterprisersproject.com/devops?sc_cid=70160000000h0aXAAQ +[6]:https://enterprisersproject.com/article/2017/11/how-enterprise-it-uses-kubernetes-tame-container-complexity +[7]:https://www.redhat.com/en/about/videos/john-rzeszotarski-keybank-red-hat-summit-2017?intcmp=701f2000000tjyaAAA +[8]:https://enterprisersproject.com/article/2017/11/dear-cios-stop-beating-yourselves-being-behind-transformation +[9]:https://www.redhat.com/en/resources/macquarie-bank-case-study?intcmp=701f2000000tjyaAAA +[10]:https://enterprisersproject.com/article/2018/1/4-ai-trends-watch +[11]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ diff --git a/published/201909/20180330 Go on very small hardware Part 1.md b/published/201909/20180330 Go on very small hardware Part 1.md new file mode 100644 index 0000000000..e4759907fc --- /dev/null +++ b/published/201909/20180330 Go on very small hardware Part 1.md @@ -0,0 +1,480 @@ +Go 语言在极小硬件上的运用(一) +========= + +Go 语言,能在多低下的配置上运行并发挥作用呢? + +我最近购买了一个特别便宜的开发板: + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg) + +我购买它的理由有三个。首先,我(作为程序员)从未接触过 STM320 系列的开发板。其次,STM32F10x 系列使用也有点少了。STM320 系列的 MCU 很便宜,有更新一些的外设,对系列产品进行了改进,问题修复也做得更好了。最后,为了这篇文章,我选用了这一系列中最低配置的开发板,整件事情就变得有趣起来了。 + +### 硬件部分 + +[STM32F030F4P6][3] 给人留下了很深的印象: + +* CPU: [Cortex M0][1] 48 MHz(最低配置,只有 12000 个逻辑门电路) +* RAM: 4 KB, +* Flash: 16 KB, +* ADC、SPI、I2C、USART 和几个定时器 + +以上这些采用了 TSSOP20 封装。正如你所见,这是一个很小的 32 位系统。 + +### 软件部分 + +如果你想知道如何在这块开发板上使用 [Go][4] 编程,你需要反复阅读硬件规范手册。你必须面对这样的真实情况:在 Go 编译器中给 Cortex-M0 提供支持的可能性很小。而且,这还仅仅只是第一个要解决的问题。 + +我会使用 [Emgo][5],但别担心,之后你会看到,它如何让 Go 在如此小的系统上尽可能发挥作用。 + +在我拿到这块开发板之前,对 [stm32/hal][6] 系列下的 F0 MCU 没有任何支持。在简单研究[参考手册][7]后,我发现 STM32F0 系列是 STM32F3 削减版,这让在新端口上开发的工作变得容易了一些。 + +如果你想接着本文的步骤做下去,需要先安装 Emgo + +``` +cd $HOME +git clone https://github.com/ziutek/emgo/ +cd emgo/egc +go install +``` + +然后设置一下环境变量 + +``` +export EGCC=path_to_arm_gcc # eg. /usr/local/arm/bin/arm-none-eabi-gcc +export EGLD=path_to_arm_linker # eg. /usr/local/arm/bin/arm-none-eabi-ld +export EGAR=path_to_arm_archiver # eg. /usr/local/arm/bin/arm-none-eabi-ar + +export EGROOT=$HOME/emgo/egroot +export EGPATH=$HOME/emgo/egpath + +export EGARCH=cortexm0 +export EGOS=noos +export EGTARGET=f030x6 +``` + +更详细的说明可以在 [Emgo][8] 官网上找到。 + +要确保 `egc` 在你的 `PATH` 中。 你可以使用 `go build` 来代替 `go install`,然后把 `egc` 复制到你的 `$HOME/bin` 或 `/usr/local/bin` 中。 + +现在,为你的第一个 Emgo 程序创建一个新文件夹,随后把示例中链接器脚本复制过来: + +``` +mkdir $HOME/firstemgo +cd $HOME/firstemgo +cp $EGPATH/src/stm32/examples/f030-demo-board/blinky/script.ld . +``` + +### 最基本程序 + +在 `main.go` 文件中创建一个最基本的程序: + +``` +package main + +func main() { +} +``` + +文件编译没有出现任何问题: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 7452 172 104 7728 1e30 cortexm0.elf +``` + +第一次编译可能会花点时间。编译后产生的二进制占用了 7624 个字节的 Flash 空间(文本 + 数据)。对于一个什么都没做的程序来说,占用的空间有些大。还剩下 8760 字节,可以用来做些有用的事。 + +不妨试试传统的 “Hello, World!” 程序: + +``` +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +} +``` + +不幸的是,这次结果有些糟糕: + +``` +$ egc +/usr/local/arm/bin/arm-none-eabi-ld: /home/michal/P/go/src/github.com/ziutek/emgo/egpath/src/stm32/examples/f030-demo-board/blog/cortexm0.elf section `.text' will not fit in region `Flash' +/usr/local/arm/bin/arm-none-eabi-ld: region `Flash' overflowed by 10880 bytes +exit status 1 +``` + + “Hello, World!” 需要 STM32F030x6 上至少 32KB 的 Flash 空间。 + +`fmt` 包强制包含整个 `strconv` 和 `reflect` 包。这三个包,即使在精简版本中的 Emgo 中,占用空间也很大。我们不能使用这个例子了。有很多的应用不需要好看的文本输出。通常,一个或多个 LED,或者七段数码管显示就足够了。不过,在第二部分,我会尝试使用 `strconv` 包来格式化,并在 UART 上显示一些数字和文本。 + +### 闪烁 + +我们的开发板上有一个与 PA4 引脚和 VCC 相连的 LED。这次我们的代码稍稍长了一些: + +``` +package main + +import ( + "delay" + + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" +) + +var led gpio.Pin + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(false) + led = gpio.A.Pin(4) + + cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} + led.Setup(cfg) +} + +func main() { + for { + led.Clear() + delay.Millisec(100) + led.Set() + delay.Millisec(900) + } +} +``` + +按照惯例,`init` 函数用来初始化和配置外设。 + +`system.SetupPLL(8, 1, 48/8)` 用来配置 RCC,将外部的 8 MHz 振荡器的 PLL 作为系统时钟源。PLL 分频器设置为 1,倍频数设置为 48/8 =6,这样系统时钟频率为 48MHz。 + +`systick.Setup(2e6)` 将 Cortex-M SYSTICK 时钟作为系统时钟,每隔 2e6 次纳秒运行一次(每秒钟 500 次)。 + +`gpio.A.EnableClock(false)` 开启了 GPIO A 口的时钟。`False` 意味着这一时钟在低功耗模式下会被禁用,但在 STM32F0 系列中并未实现这一功能。 + +`led.Setup(cfg)` 设置 PA4 引脚为开漏输出。 + +`led.Clear()` 将 PA4 引脚设为低,在开漏设置中,打开 LED。 + +`led.Set()` 将 PA4 设为高电平状态,关掉LED。 + +编译这个代码: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 9772 172 168 10112 2780 cortexm0.elf +``` + +正如你所看到的,这个闪烁程序占用了 2320 字节,比最基本程序占用空间要大。还有 6440 字节的剩余空间。 + +看看代码是否能运行: + +``` +$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' +Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) +Licensed under GNU GPL v2 +For bug reports, read + http://openocd.org/doc/doxygen/bugs.html +debug_level: 0 +adapter speed: 1000 kHz +adapter_nsrst_delay: 100 +none separate +adapter speed: 950 kHz +target halted due to debug-request, current mode: Thread +xPSR: 0xc1000000 pc: 0x0800119c msp: 0x20000da0 +adapter speed: 4000 kHz +** Programming Started ** +auto erase enabled +target halted due to breakpoint, current mode: Thread +xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000da0 +wrote 10240 bytes from file cortexm0.elf in 0.817425s (12.234 KiB/s) +** Programming Finished ** +adapter speed: 950 kHz +``` + +在这篇文章中,这是我第一次,将一个短视频转换成[动画 PNG][9]。我对此印象很深,再见了 YouTube。 对于 IE 用户,我很抱歉,更多信息请看 [apngasm][10]。我本应该学习 HTML5,但现在,APNG 是我最喜欢的,用来播放循环短视频的方法了。 + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/blinky.png) + +### 更多的 Go 语言编程 + +如果你不是一个 Go 程序员,但你已经听说过一些关于 Go 语言的事情,你可能会说:“Go 语法很好,但跟 C 比起来,并没有明显的提升。让我看看 Go 语言的通道和协程!” + +接下来我会一一展示: + +``` +import ( + "delay" + + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" +) + +var led1, led2 gpio.Pin + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(false) + led1 = gpio.A.Pin(4) + led2 = gpio.A.Pin(5) + + cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} + led1.Setup(cfg) + led2.Setup(cfg) +} + +func blinky(led gpio.Pin, period int) { + for { + led.Clear() + delay.Millisec(100) + led.Set() + delay.Millisec(period - 100) + } +} + +func main() { + go blinky(led1, 500) + blinky(led2, 1000) +} + +``` + +代码改动很小: 添加了第二个 LED,上一个例子中的 `main` 函数被重命名为 `blinky` 并且需要提供两个参数。 `main` 在新的协程中先调用 `blinky`,所以两个 LED 灯在并行使用。值得一提的是,`gpio.Pin` 可以同时访问同一 GPIO 口的不同引脚。 + +Emgo 还有很多不足。其中之一就是你需要提前规定 `goroutines(tasks)` 的最大执行数量。是时候修改 `script.ld` 了: + +``` +ISRStack = 1024; +MainStack = 1024; +TaskStack = 1024; +MaxTasks = 2; + +INCLUDE stm32/f030x4 +INCLUDE stm32/loadflash +INCLUDE noos-cortexm +``` + +栈的大小需要靠猜,现在还不用关心这一点。 + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 10020 172 172 10364 287c cortexm0.elf +``` + +另一个 LED 和协程一共占用了 248 字节的 Flash 空间。 + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/goroutines.png) + +### 通道 + +通道是 Go 语言中协程之间相互通信的一种[推荐方式][11]。Emgo 甚至能允许通过*中断处理*来使用缓冲通道。下一个例子就展示了这种情况。 + +``` +package main + +import ( + "delay" + "rtos" + + "stm32/hal/gpio" + "stm32/hal/irq" + "stm32/hal/system" + "stm32/hal/system/timer/systick" + "stm32/hal/tim" +) + +var ( + leds [3]gpio.Pin + timer *tim.Periph + ch = make(chan int, 1) +) + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(false) + leds[0] = gpio.A.Pin(4) + leds[1] = gpio.A.Pin(5) + leds[2] = gpio.A.Pin(9) + + cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} + for _, led := range leds { + led.Set() + led.Setup(cfg) + } + + timer = tim.TIM3 + pclk := timer.Bus().Clock() + if pclk < system.AHB.Clock() { + pclk *= 2 + } + freq := uint(1e3) // Hz + timer.EnableClock(true) + timer.PSC.Store(tim.PSC(pclk/freq - 1)) + timer.ARR.Store(700) // ms + timer.DIER.Store(tim.UIE) + timer.CR1.Store(tim.CEN) + + rtos.IRQ(irq.TIM3).Enable() +} + +func blinky(led gpio.Pin, period int) { + for range ch { + led.Clear() + delay.Millisec(100) + led.Set() + delay.Millisec(period - 100) + } +} + +func main() { + go blinky(leds[1], 500) + blinky(leds[2], 500) +} + +func timerISR() { + timer.SR.Store(0) + leds[0].Set() + select { + case ch <- 0: + // Success + default: + leds[0].Clear() + } +} + +//c:__attribute__((section(".ISRs"))) +var ISRs = [...]func(){ + irq.TIM3: timerISR, +} +``` + +与之前例子相比较下的不同: + +1. 添加了第三个 LED,并连接到 PA9 引脚(UART 头的 TXD 引脚)。 +2. 时钟(`TIM3`)作为中断源。 +3. 新函数 `timerISR` 用来处理 `irq.TIM3` 的中断。 +4. 新增容量为 1 的缓冲通道是为了 `timerISR` 和 `blinky` 协程之间的通信。 +5. `ISRs` 数组作为*中断向量表*,是更大的*异常向量表*的一部分。 +6. `blinky` 中的 `for` 语句被替换成 `range` 语句。 + +为了方便起见,所有的 LED,或者说它们的引脚,都被放在 `leds` 这个数组里。另外,所有引脚在被配置为输出之前,都设置为一种已知的初始状态(高电平状态)。 + +在这个例子里,我们想让时钟以 1 kHz 的频率运行。为了配置 TIM3 预分频器,我们需要知道它的输入时钟频率。通过参考手册我们知道,输入时钟频率在 `APBCLK = AHBCLK` 时,与 `APBCLK` 相同,反之等于 2 倍的 `APBCLK`。 + +如果 CNT 寄存器增加 1 kHz,那么 ARR 寄存器的值等于*更新事件*(重载事件)在毫秒中的计数周期。 为了让更新事件产生中断,必须要设置 DIER 寄存器中的 UIE 位。CEN 位能启动时钟。 + +时钟外设在低功耗模式下必须启用,为了自身能在 CPU 处于休眠时保持运行: `timer.EnableClock(true)`。这在 STM32F0 中无关紧要,但对代码可移植性却十分重要。 + +`timerISR` 函数处理 `irq.TIM3` 的中断请求。`timer.SR.Store(0)` 会清除 SR 寄存器里的所有事件标志,无效化向 [NVIC][12] 发出的所有中断请求。凭借经验,由于中断请求无效的延时性,需要在程序一开始马上清除所有的中断标志。这避免了无意间再次调用处理。为了确保万无一失,需要先清除标志,再读取,但是在我们的例子中,清除标志就已经足够了。 + +下面的这几行代码: + +``` +select { +case ch <- 0: + // Success +default: + leds[0].Clear() +} +``` + +是 Go 语言中,如何在通道上非阻塞地发送消息的方法。中断处理程序无法一直等待通道中的空余空间。如果通道已满,则执行 `default`,开发板上的LED就会开启,直到下一次中断。 + +`ISRs` 数组包含了中断向量表。`//c:__attribute__((section(".ISRs")))` 会导致链接器将数组插入到 `.ISRs` 节中。 + +`blinky` 的 `for` 循环的新写法: + +``` +for range ch { + led.Clear() + delay.Millisec(100) + led.Set() + delay.Millisec(period - 100) +} +``` + +等价于: + +``` +for { + _, ok := <-ch + if !ok { + break // Channel closed. + } + led.Clear() + delay.Millisec(100) + led.Set() + delay.Millisec(period - 100) +} +``` + +注意,在这个例子中,我们不在意通道中收到的值,我们只对其接受到的消息感兴趣。我们可以在声明时,将通道元素类型中的 `int` 用空结构体 `struct{}` 来代替,发送消息时,用 `struct{}{}` 结构体的值代替 0,但这部分对新手来说可能会有些陌生。 + +让我们来编译一下代码: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 11096 228 188 11512 2cf8 cortexm0.elf +``` + +新的例子占用了 11324 字节的 Flash 空间,比上一个例子多占用了 1132 字节。 + +采用现在的时序,两个闪烁协程从通道中获取数据的速度,比 `timerISR` 发送数据的速度要快。所以它们在同时等待新数据,你还能观察到 `select` 的随机性,这也是 [Go 规范][13]所要求的。 + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/channels1.png) + +开发板上的 LED 一直没有亮起,说明通道从未出现过溢出。 + +我们可以加快消息发送的速度,将 `timer.ARR.Store(700)` 改为 `timer.ARR.Store(200)`。 现在 `timerISR` 每秒钟发送 5 条消息,但是两个接收者加起来,每秒也只能接受 4 条消息。 + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/channels2.png) + +正如你所看到的,`timerISR` 开启黄色 LED 灯,意味着通道上已经没有剩余空间了。 + +第一部分到这里就结束了。你应该知道,这一部分并未展示 Go 中最重要的部分,接口。 + +协程和通道只是一些方便好用的语法。你可以用自己的代码来替换它们,这并不容易,但也可以实现。接口是Go 语言的基础。这是文章中 [第二部分][14]所要提到的. + +在 Flash 上我们还有些剩余空间。 + +-------------------------------------------------------------------------------- + +via: https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html + +作者:[Michał Derkacz][a] +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://ziutek.github.io/ +[1]:https://en.wikipedia.org/wiki/ARM_Cortex-M#Cortex-M0 +[2]:https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html +[3]:http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32f0-series/stm32f0x0-value-line/stm32f030f4.html +[4]:https://golang.org/ +[5]:https://github.com/ziutek/emgo +[6]:https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/hal +[7]:http://www.st.com/resource/en/reference_manual/dm00091010.pdf +[8]:https://github.com/ziutek/emgo +[9]:https://en.wikipedia.org/wiki/APNG +[10]:http://apngasm.sourceforge.net/ +[11]:https://blog.golang.org/share-memory-by-communicating +[12]:http://infocenter.arm.com/help/topic/com.arm.doc.ddi0432c/Cihbecee.html +[13]:https://golang.org/ref/spec#Select_statements +[14]:https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html diff --git a/published/201909/20180704 BASHing data- Truncated data items.md b/published/201909/20180704 BASHing data- Truncated data items.md new file mode 100644 index 0000000000..dad03bf3da --- /dev/null +++ b/published/201909/20180704 BASHing data- Truncated data items.md @@ -0,0 +1,115 @@ +如何发现截断的数据项 +====== + +**截断**(形容词):缩写、删节、缩减、剪切、剪裁、裁剪、修剪…… + +数据项被截断的一种情况是将其输入到数据库字段中,该字段的字符限制比数据项的长度要短。例如,字符串: + +``` +Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE of Yermo CA +``` + +是 60 个字符长。如果你将其输入到具有 50 个字符限制的“位置”字段,则可以获得: + +``` +Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE #末尾带有一个空格 +``` + +截断也可能导致数据错误,比如你打算输入: + +``` +Sally Ann Hunter (aka Sally Cleveland) +``` + +但是你忘记了闭合的括号: + +``` +Sally Ann Hunter (aka Sally Cleveland +``` + +这会让使用数据的用户觉得 Sally 是否有被修剪掉了数据项的其它的别名。 + +截断的数据项很难检测。在审核数据时,我使用三种不同的方法来查找可能的截断,但我仍然可能会错过一些。 + +**数据项的长度分布。**第一种方法是捕获我在各个字段中找到的大多数截断的数据。我将字段传递给 `awk` 命令,该命令按字段宽度计算数据项,然后我使用 `sort` 以宽度的逆序打印计数。例如,要检查以 `tab` 分隔的文件 `midges` 中的第 33 个字段: + +``` +awk -F"\t" 'NR>1 {a[length($33)]++} \ + END {for (i in a) print i FS a[i]}' midges | sort -nr +``` + +![distro1][1] + +最长的条目恰好有 50 个字符,这是可疑的,并且在该宽度处存在数据项的“凸起”,这更加可疑。检查这些 50 个字符的项目会发现截断: + +![distro2][2] + +我用这种方式检查的其他数据表有 100、200 和 255 个字符的“凸起”。在每种情况下,这种“凸起”都包含明显的截断。 + +**未匹配的括号。**第二种方法查找类似 `...(Sally Cleveland` 的数据项。一个很好的起点是数据表中所有标点符号的统计。这里我检查文件 `mag2`: + +``` +grep -o "[[:punct:]]" file | sort | uniqc +``` + +![punct][3] + +请注意,`mag2` 中的开括号和闭括号的数量不相等。要查看发生了什么,我使用 `unmatched` 函数,它接受三个参数并检查数据表中的所有字段。第一个参数是文件名,第二个和第三个是开括号和闭括号,用引号括起来。 + +``` +unmatched() +{ + awk -F"\t" -v start="$2" -v end="$3" \ + '{for (i=1;i<=NF;i++) \ + if (split($i,a,start) != split($i,b,end)) \ + print "line "NR", field "i":\n"$i}' "$1" +} +``` + +如果在字段中找到开括号和闭括号之间不匹配,则 `unmatched` 会报告行号和字段号。这依赖于 `awk` 的 `split` 函数,它返回由分隔符分隔的元素数(包括空格)。这个数字总是比分隔符的数量多一个: + +![split][4] + +这里 `ummatched` 检查 `mag2` 中的圆括号并找到一些可能的截断: + +![unmatched][5] + +我使用 `unmatched` 来找到不匹配的圆括号 `()`、方括号 `[]`、花括号 `{}` 和尖括号 `<>`,但该函数可用于任何配对的标点字符。 + +**意外的结尾。**第三种方法查找以尾随空格或非终止标点符号结尾的数据项,如逗号或连字符。这可以在单个字段上用 `cut` 用管道输入到 `grep` 完成,或者用 `awk` 一步完成。在这里,我正在检查以制表符分隔的表 `herp5` 的字段 47,并提取可疑数据项及其行号: + +``` +cut -f47 herp5 | grep -n "[ ,;:-]$" +或 +awk -F"\t" '$47 ~ /[ ,;:-]$/ {print NR": "$47}' herp5 +``` + +![herps5][6] + +用于制表符分隔文件的 awk 命令的全字段版本是: + +``` +awk -F"\t" '{for (i=1;i<=NF;i++) if ($i ~ /[ ,;:-]$/) \ + print "line "NR", field "i":\n"$i}' file +``` + +**谨慎的想法。**在我对字段进行的验证测试期间也会出现截断。例如,我可能会在“年”的字段中检查合理的 4 位数条目,并且有个 `198` 可能是 198n?还是 1898 年?带有丢失字符的截断数据项是个谜。 作为数据审计员,我只能报告(可能的)字符损失,并建议数据编制者或管理者恢复(可能)丢失的字符。 + +-------------------------------------------------------------------------------- + +via: https://www.polydesmida.info/BASHing/2018-07-04.html + +作者:[polydesmida][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.polydesmida.info/ +[1]:https://www.polydesmida.info/BASHing/img1/2018-07-04_1.png +[2]:https://www.polydesmida.info/BASHing/img1/2018-07-04_2.png +[3]:https://www.polydesmida.info/BASHing/img1/2018-07-04_3.png +[4]:https://www.polydesmida.info/BASHing/img1/2018-07-04_4.png +[5]:https://www.polydesmida.info/BASHing/img1/2018-07-04_5.png +[6]:https://www.polydesmida.info/BASHing/img1/2018-07-04_6.png diff --git a/published/201909/20180705 Building a Messenger App- Schema.md b/published/201909/20180705 Building a Messenger App- Schema.md new file mode 100644 index 0000000000..cf222174a6 --- /dev/null +++ b/published/201909/20180705 Building a Messenger App- Schema.md @@ -0,0 +1,116 @@ +[#]: collector: "lujun9972" +[#]: translator: "PsiACE" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11396-1.html" +[#]: subject: "Building a Messenger App: Schema" +[#]: via: "https://nicolasparada.netlify.com/posts/go-messenger-schema/" +[#]: author: "Nicolás Parada https://nicolasparada.netlify.com/" + +构建一个即时消息应用(一):模式 +======== + +![](https://img.linux.net.cn/data/attachment/album/201909/27/211458n44f7jvp77lfxxm0.jpg) + +这是一系列关于构建“即时消息”应用的新帖子。你应该对这类应用并不陌生。有了它们的帮助,我们才可以与朋友畅聊无忌。[Facebook Messenger][1]、[WhatsApp][2] 和 [Skype][3] 就是其中的几个例子。正如你所看到的那样,这些应用允许我们发送图片、传输视频、录制音频、以及和一大帮子人聊天等等。当然,我们的教程应用将会尽量保持简单,只在两个用户之间发送文本消息。 + +我们将会用 [CockroachDB][4] 作为 SQL 数据库,用 [Go][5] 作为后端语言,并且用 JavaScript 来制作 web 应用。 + +这是第一篇帖子,我们将会讲述数据库的设计。 + +``` +CREATE TABLE users ( + id SERIAL NOT NULL PRIMARY KEY, + username STRING NOT NULL UNIQUE, + avatar_url STRING, + github_id INT NOT NULL UNIQUE +); +``` + +显然,这个应用需要一些用户。我们这里采用社交登录的形式。由于我选用了 [GitHub][6],所以这里需要保存一个对 GitHub 用户 ID 的引用。 + +``` +CREATE TABLE conversations ( + id SERIAL NOT NULL PRIMARY KEY, + last_message_id INT, + INDEX (last_message_id DESC) +); +``` + +每个对话都会引用最近一条消息。每当我们输入一条新消息时,我们都会更新这个字段。我会在后面添加外键约束。 + +… 你可能会想,我们可以先对对话进行分组,然后再通过这样的方式获取最近一条消息。但这样做会使查询变得更加复杂。 + +``` +CREATE TABLE participants ( + user_id INT NOT NULL REFERENCES users ON DELETE CASCADE, + conversation_id INT NOT NULL REFERENCES conversations ON DELETE CASCADE, + messages_read_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY (user_id, conversation_id) +); +``` + +尽管之前我提到过对话只会在两个用户之间进行,但我们还是采用了允许向对话中添加多个参与者的设计。因此,在对话和用户之间有一个参与者表。 + +为了知道用户是否有未读消息,我们在消息表中添加了“读取时间”(`messages_read_at`)字段。每当用户在对话中读取消息时,我们都会更新它的值,这样一来,我们就可以将它与对话中最后一条消息的“创建时间”(`created_at`)字段进行比较。 + +``` +CREATE TABLE messages ( + id SERIAL NOT NULL PRIMARY KEY, + content STRING NOT NULL, + user_id INT NOT NULL REFERENCES users ON DELETE CASCADE, + conversation_id INT NOT NULL REFERENCES conversations ON DELETE CASCADE, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + INDEX(created_at DESC) +); +``` + +尽管我们将消息表放在最后,但它在应用中相当重要。我们用它来保存对创建它的用户以及它所出现的对话的引用。而且还可以根据“创建时间”(`created_at`)来创建索引以完成对消息的排序。 + +``` +ALTER TABLE conversations +ADD CONSTRAINT fk_last_message_id_ref_messages +FOREIGN KEY (last_message_id) REFERENCES messages ON DELETE SET NULL; +``` + +我在前面已经提到过这个外键约束了,不是吗:D + +有这四张表就足够了。你也可以将这些查询保存到一个文件中,并将其通过管道传送到 Cockroach CLI。 + +首先,我们需要启动一个新节点: + +``` +cockroach start --insecure --host 127.0.0.1 +``` + +然后创建数据库和这些表: + +``` +cockroach sql --insecure -e "CREATE DATABASE messenger" +cat schema.sql | cockroach sql --insecure -d messenger +``` + +这篇帖子就到这里。在接下来的部分中,我们将会介绍「登录」,敬请期待。 + +- [源代码][7] + +--- + +via: https://nicolasparada.netlify.com/posts/go-messenger-schema/ + +作者:[Nicolás Parada][a] +选题:[lujun9972][b] +译者:[PsiACE](https://github.com/PsiACE) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出 + +[a]: https://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.messenger.com/ +[2]: https://www.whatsapp.com/ +[3]: https://www.skype.com/ +[4]: https://www.cockroachlabs.com/ +[5]: https://golang.org/ +[6]: https://github.com/ +[7]: https://github.com/nicolasparada/go-messenger-demo diff --git a/published/201909/20180802 Top 5 CAD Software Available for Linux in 2018.md b/published/201909/20180802 Top 5 CAD Software Available for Linux in 2018.md new file mode 100644 index 0000000000..6607e44885 --- /dev/null +++ b/published/201909/20180802 Top 5 CAD Software Available for Linux in 2018.md @@ -0,0 +1,141 @@ +Linux 上 5 个最好 CAD 软件 +====== + +[计算机辅助设计 (CAD)][1] 是很多工程流程的必不可少的部分。CAD 用于建筑、汽车零部件设计、航天飞机研究、航空、桥梁施工、室内设计,甚至服装和珠宝设计等专业领域。 + +在 Linux 上并不原生支持一些专业级 CAD 软件,如 SolidWorks 和 Autodesk AutoCAD。因此,今天,我们将看看排名靠前的 Linux 上可用的 CAD 软件。预知详情,请看下文。 + +### Linux 可用的最好的 CAD 软件 + +![CAD Software for Linux][2] + +在我们查看这份 Linux 的 CAD 软件列表前,你应该记住一件事,在这里不是所有的应用程序都是开源软件。我们也将包含一些非自由和开源软件的 CAD 软件来帮助普通的 Linux 用户。 + +我们为基于 Ubuntu 的 Linux 发行版提供了安装操作指南。对于其它发行版,你可以检查相应的网站来了解安装程序步骤。 + +该列表没有任何特殊顺序。在第一顺位的 CAD 应用程序不能认为比在第三顺位的好,以此类推。 + +#### 1、FreeCAD + +对于 3D 建模,FreeCAD 是一个极好的选择,它是自由 (免费和自由) 和开源软件。FreeCAD 坚持以构建机械工程和产品设计为目标。FreeCAD 是多平台的,可用于 Windows、Mac OS X+ 以及 Linux。 + +![freecad][3] + +尽管 FreeCAD 已经是很多 Linux 用户的选择,应该注意到,FreeCAD 仍然是 0.17 版本,因此,不适用于重要的部署。但是最近开发加速了。 + +- [FreeCAD][4] + +FreeCAD 并不专注于 direct-2D 绘图和真实形状的动画,但是它对机械工程相关的设计极好。FreeCAD 的 0.15 版本在 Ubuntu 存储库中可用。你可以通过运行下面的命令安装。 + +``` +sudo apt install freecad +``` + +为获取新的每日构建(目前 0.17),打开一个终端(`ctrl+alt+t`),并逐个运行下面的命令。 + +``` +sudo add-apt-repository ppa:freecad-maintainers/freecad-daily +sudo apt update +sudo apt install freecad-daily +``` + +#### 2、LibreCAD + +LibreCAD 是一个自由开源的、2D CAD 解决方案。一般来说,CAD 是一个资源密集型任务,如果你有一个相当普通的硬件,那么我建议你使用 LibreCAD ,因为它在资源使用方面真的轻量化。LibreCAD 是几何图形结构方面的一个极好的候选者。 + +![librecad][5] + +作为一个 2D 工具,LibreCAD 是好的,但是它不能在 3D 模型和渲染上工作。它有时可能不稳定,但是,它有一个可靠的自动保存,它不会让你的工作浪费。 + +- [LibreCAD][6] + +你可以通过运行下面的命令安装 LibreCAD。 + +``` +sudo apt install librecad +``` + +#### 3、OpenSCAD + +OpenSCAD 是一个自由的 3D CAD 软件。OpenSCAD 非常轻量和灵活。OpenSCAD 不是交互式的。你需要‘编程’模型,OpenSCAD 来解释这些代码来渲染一个可视化模型。在某种意义上说,它是一个编译器。你不能直接绘制模型,而是描述模型。 + +![openscad][7] + +OpenSCAD 是这个列表上最复杂的工具,但是,一旦你了解它,它将提供一个令人愉快的工作经历。 + +- [OpenSCAD][8] + +你可以使用下面的命令来安装 OpenSCAD。 + +``` +sudo apt-get install openscad +``` + +#### 4、BRL-CAD + +BRL-CAD 是最老的 CAD 工具之一。它也深受 Linux/UNIX 用户喜爱,因为它与模块化和自由的 *nix 哲学相一致。 + +![BRL-CAD rendering by Sean][9] + +BRL-CAD 始于 1979 年,并且,它仍然在积极开发。现在,BRL-CAD 不是 AutoCAD,但是对于像热穿透和弹道穿透等等的运输研究仍然是一个极好的选择。BRL-CAD 构成 CSG 的基础,而不是边界表示。在选择 BRL-CAD 时,你可能需要记住这一点。你可以从它的官方网站下载 BRL-CAD 。 + +- [BRL-CAD][10] + +#### 5、DraftSight (非开源) + +如果你习惯在 AutoCAD 上作业。那么,DraftSight 将是完美的替代。 + +DraftSight 是一个在 Linux 上可用的极好的 CAD 工具。它有相当类似于 AutoCAD 的工作流,这使得迁移更容易。它甚至提供一种类似的外观和感觉。DrafSight 也兼容 AutoCAD 的 .dwg 文件格式。 但是,DrafSight 是一个 2D CAD 软件。截至当前,它不支持 3D CAD 。 + +![draftsight][11] + +尽管 DrafSight 是一款起价 149 美元的商业软件。在 [DraftSight 网站][12]上可获得一个免费版本。你可以下载 .deb 软件包,并在基于 Ubuntu 的发行版上安装它。为了开始使用 DraftSight ,你需要使用你的电子邮件 ID 来注册你的免费版本。 + +- [DraftSight][12] + +#### 荣誉提名 + +* 随着云计算技术的巨大发展,像 [OnShape][13] 的云 CAD 解决方案已经变得日渐流行。 +* [SolveSpace][14] 是另一个值得一提的开源软件项目。它支持 3D 模型。 +* 西门子 NX 是一个在 Windows、Mac OS 及 Linux 上可用的工业级 CAD 解决方案,但是它贵得离谱,所以,在这个列表中被忽略。 +* 接下来,你有 [LeoCAD][15],它是一个 CAD 软件,在软件中你使用乐高积木来构建东西。你使用这些信息做些什么取决于你。 + +### 我对 Linux 上的 CAD 的看法 + +尽管在 Linux 上游戏变得流行,我总是告诉我的铁杆游戏朋友坚持使用 Windows。类似地,如果你是一名在你是课程中使用 CAD 的工科学生,我建议你使用学校规定的软件 (AutoCAD、SolidEdge、Catia),这些软件通常只在 Windows 上运行。 + +对于高级专业人士来说,当我们讨论行业标准时,这些工具根本达不到标准。 + +对于想在 WINE 中运行 AutoCAD 的那些人来说,尽管一些较旧版本的 AutoCAD 可以安装在 WINE 上,它们根本不执行工作,小故障和崩溃严重损害这些体验。 + +话虽如此,我高度尊重上述列表中软件的开发者的工作。他们丰富了 FOSS 世界。很高兴看到像 FreeCAD 一样的软件在近些年中加速开发速度。 + +好了,今天到此为止。使用下面的评论区与我们分享你的想法,不用忘记分享这篇文章。谢谢。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cad-software-linux/ + +作者:[Aquil Roshan][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/aquil/ +[1]:https://en.wikipedia.org/wiki/Computer-aided_design +[2]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/cad-software-linux.jpeg +[3]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freecad.jpg +[4]:https://www.freecadweb.org/ +[5]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/librecad.jpg +[6]:https://librecad.org/ +[7]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/openscad.jpg +[8]:http://www.openscad.org/ +[9]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/brlcad.jpg +[10]:https://brlcad.org/ +[11]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/draftsight.jpg +[12]:https://www.draftsight2018.com/ +[13]:https://www.onshape.com/ +[14]:http://solvespace.com/index.pl +[15]:https://www.leocad.org/ diff --git a/published/201909/20180904 How blockchain can complement open source.md b/published/201909/20180904 How blockchain can complement open source.md new file mode 100644 index 0000000000..a8f2d15a3c --- /dev/null +++ b/published/201909/20180904 How blockchain can complement open source.md @@ -0,0 +1,89 @@ +区块链能如何补充开源 +====== + +> 了解区块链如何成为去中心化的开源补贴模型。 + +![](https://img.linux.net.cn/data/attachment/album/201909/16/111521od1yn9r1nr1eii9o.jpg) + +《[大教堂与集市][1]The Cathedral and The Bazaar》是 20 年前由埃里克·史蒂文·雷蒙德Eric Steven Raymond(ESR)撰写的经典开源故事。在这个故事中,ESR 描述了一种新的革命性的软件开发模型,其中复杂的软件项目是在没有(或者很少的)集中管理的情况下构建的。这个新模型就是开源open source。 + +ESR 的故事比较了两种模式: + +* 经典模型(由“大教堂”所代表),其中软件由一小群人在封闭和受控的环境中通过缓慢而稳定的发布制作而成。 +* 以及新模式(由“集市”所代表),其中软件是在开放的环境中制作的,个人可以自由参与,但仍然可以产生一个稳定和连贯的系统。 +   +开源如此成功的一些原因可以追溯到 ESR 所描述的创始原则。尽早发布、经常发布,并接受许多头脑必然比一个更好的事实,让开源项目进入全世界的人才库(很少有公司能够使用闭源模式与之匹敌)。 + +在 ESR 对黑客社区的反思分析 20 年后,我们看到开源成为占据主导地位的的模式。它不再仅仅是为了满足开发人员的个人喜好,而是创新发生的地方。甚至是全球[最大][2]软件公司也正在转向这种模式,以便继续占据主导地位。 + +### 易货系统 + +如果我们仔细研究开源模型在实践中的运作方式,我们就会意识到它是一个封闭系统,只对开源开发者和技术人员开放。影响项目方向的唯一方法是加入开源社区,了解成文和不成文的规则,学习如何贡献、编码标准等,并自己亲力完成。 + +这就是集市的运作方式,也是这个易货系统类比的来源。易货系统是一种交换服务和货物以换取其他服务和货物的方法。在市场中(即软件的构建地)这意味着为了获取某些东西,你必须自己也是一个生产者并回馈一些东西——那就是通过交换你的时间和知识来完成任务。集市是开源开发者与其他开源开发者交互并以开源方式生成开源软件的地方。 + +易货系统向前迈出了一大步,从自给自足的状态演变而来,而在自给自足的状态下,每个人都必须成为所有行业的杰出人选。使用易货系统的集市(开源模式)允许具有共同兴趣和不同技能的人们收集、协作和创造个人无法自行创造的东西。易货系统简单,没有现代货币系统那么复杂,但也有一些局限性,例如: + +* 缺乏可分性:在没有共同的交换媒介的情况下,不能将较大的不可分割的商品/价值兑换成较小的商品/价值。例如,如果你想在开源项目中进行一些哪怕是小的更改,有时你可能仍需要经历一个高进入门槛。 +* 存储价值:如果一个项目对贵公司很重要,你可能需要投入大量投资/承诺。但由于它是开源开发者之间的易货系统,因此拥有强大发言权的唯一方法是雇佣许多开源贡献者,但这并非总是可行的。 +* 转移价值:如果你投资了一个项目(受过培训的员工、雇用开源开发者)并希望将重点转移到另一个项目,却不可能快速转移(你在上一个项目中拥有的)专业知识、声誉和影响力。 +* 时间脱钩:易货系统没有为延期或提前承诺提供良好的机制。在开源世界中,这意味着用户无法提前或在未来期间以可衡量的方式表达对项目的承诺或兴趣。 +   +下面,我们将探讨如何使用集市的后门解决这些限制。 + +### 货币系统 + +人们因为不同的原因勾连于集市上:有些人在那里学习,有些是出于满足开发者个人的喜好,有些人为大型软件工厂工作。因为在集市中拥有发言权的唯一方法是成为开源社区的一份子并加入这个易货系统,为了在开源世界获得信誉,许多大型软件公司雇用这些开发者并以货币方式支付薪酬。这代表可以使用货币系统来影响集市,开源不再只是为了满足开发者个人的喜好,它也占据全球整体软件生产的重要部分,并且有许多人想要施加影响。 + +开源设定了开发人员交互的指导原则,并以分布式方式构建一致的系统。它决定了项目的治理方式、软件的构建方式以及其成果如何分发给用户。它是分散的实体共同构建高质量软件的开放共识模型。但是开源模型并没有包括如何补贴开源的部分,无论是直接还是间接地,通过内在或外在动机的赞助,都与集市无关。 + +![](https://opensource.com/sites/default/files/uploads/tokenomics_-_page_4.png) + +目前,没有相当于以补贴为目的的去中心化式开源开发模型。大多数开源补贴都是集中式的,通常一家公司通过雇用该项目的主要开源开发者来主导该项目。说实话,这是目前最好的状况,因为它保证了开发人员将长期获得报酬,项目也将继续蓬勃发展。 + +项目垄断情景也有例外情况:例如,一些云原生计算基金会(CNCF)项目是由大量的竞争公司开发的。此外,Apache 软件基金会(ASF)旨在通过鼓励不同的贡献者来使他们管理的项目不被单一供应商所主导,但实际上大多数受欢迎的项目仍然是单一供应商项目。 + +我们缺少的是一个开放的、去中心化的模式,就像一个没有集中协调和所有权的集市一样,消费者(开源用户)和生产者(开源开发者)在市场力量和开源价值的驱动下相互作用。为了补充开源,这样的模型也必须是开放和去中心化的,这就是为什么我认为区块链技术[最适合][3]的原因。 + +旨在补贴开源开发的大多数现有区块链(和非区块链)平台主要针对的是漏洞赏金、小型和零碎的任务。少数人还专注于资助新的开源项目。但并没有多少平台旨在提供维持开源项目持续开发的机制 —— 基本上,这个系统可以模仿开源服务提供商公司或开放核心、基于开源的 SaaS 产品公司的行为:确保开发人员可以获得持续和可预测的激励,并根据激励者(即用户)的优先事项指导项目开发。这种模型将解决上面列出的易货系统的局限性: + +* 允许可分性:如果你想要一些小的修复,你可以支付少量费用,而不是成为项目的开源开发者的全部费用。 +* 存储价值:你可以在项目中投入大量资金,并确保其持续发展和你的发言权。 +* 转移价值:在任何时候,你都可以停止投资项目并将资金转移到其他项目中。 +* 时间脱钩:允许定期定期付款和订阅。 + +还有其他好处,纯粹是因为这种基于区块链的系统是透明和去中心化的:根据用户的承诺、开放的路线图承诺、去中心化决策等来量化项目的价值/实用性。 + +### 总结 + +一方面,我们看到大公司雇用开源开发者并收购开源初创公司甚至基础平台(例如微软收购 GitHub)。许多(甚至大多数)能够长期成功运行的开源项目都集中在单个供应商周围。开源的重要性及其集中化是一个事实。 + +另一方面,[维持开源软件][4]的挑战正变得越来越明显,许多人正在更深入地研究这个领域及其基本问题。有一些项目具有很高的知名度和大量的贡献者,但还有许多其他也重要的项目缺乏足够的贡献者和维护者。 + +有[许多努力][3]试图通过区块链来解决开源的挑战。这些项目应提高透明度、去中心化和补贴,并在开源用户和开发人员之间建立直接联系。这个领域还很年轻,但是进展很快,随着时间的推移,集市将会有一个加密货币系统。 + +如果有足够的时间和足够的技术,去中心化就会发生在很多层面: + +* 互联网是一种去中心化的媒介,它释放了全球分享和获取知识的潜力。 +* 开源是一种去中心化的协作模式,它释放了全球的创新潜力。 +* 同样,区块链可以补充开源,成为去中心化的开源补贴模式。 + +请在[推特][5]上关注我在这个领域的其他帖子。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/barter-currency-system + +作者:[Bilgin lbryam][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bibryam +[1]: http://catb.org/ +[2]: http://oss.cash/ +[3]: https://opensource.com/article/18/8/open-source-tokenomics +[4]: https://www.youtube.com/watch?v=VS6IpvTWwkQ +[5]: http://twitter.com/bibryam diff --git a/published/201909/20181113 Eldoc Goes Global.md b/published/201909/20181113 Eldoc Goes Global.md new file mode 100644 index 0000000000..4714f966a1 --- /dev/null +++ b/published/201909/20181113 Eldoc Goes Global.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11306-1.html) +[#]: subject: (Eldoc Goes Global) +[#]: via: (https://emacsredux.com/blog/2018/11/13/eldoc-goes-global/) +[#]: author: (Bozhidar Batsov https://emacsredux.com) + +Emacs:Eldoc 全局化了 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/05/045702d99v9vv4xy0aybmm.jpg) + +最近我注意到 Emacs 25.1 增加了一个名为 `global-eldoc-mode` 的模式,它是流行的 `eldoc-mode` 的一个全局化的变体。而且与 `eldoc-mode` 不同的是,`global-eldoc-mode` 默认是开启的! + +这意味着你可以删除 Emacs 配置中为主模式开启 `eldoc-mode` 的代码了: + +``` +;; That code is now redundant +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +(add-hook 'ielm-mode-hook #'eldoc-mode) +(add-hook 'cider-mode-hook #'eldoc-mode) +(add-hook 'cider-repl-mode-hook #'eldoc-mode) +``` + +[有人说][1] `global-eldoc-mode` 在某些不支持的模式中会有性能问题。我自己从未遇到过,但若你像禁用它则只需要这样: + +``` +(global-eldoc-mode -1) +``` + +现在是时候清理我的配置了!删除代码就是这么爽! + +-------------------------------------------------------------------------------- + +via: https://emacsredux.com/blog/2018/11/13/eldoc-goes-global/ + +作者:[Bozhidar Batsov][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://emacsredux.com +[b]: https://github.com/lujun9972 +[1]: https://emacs.stackexchange.com/questions/31414/how-to-globally-disable-eldoc diff --git a/published/201909/20181227 Linux commands for measuring disk activity.md b/published/201909/20181227 Linux commands for measuring disk activity.md new file mode 100644 index 0000000000..05988cbf63 --- /dev/null +++ b/published/201909/20181227 Linux commands for measuring disk activity.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11387-1.html) +[#]: subject: (Linux commands for measuring disk activity) +[#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +用于测量磁盘活动的 Linux 命令 +====== +> Linux 发行版提供了几个度量磁盘活动的有用命令。让我们了解一下其中的几个。 + +![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg) + +Linux 系统提供了一套方便的命令,帮助你查看磁盘有多忙,而不仅仅是磁盘有多满。在本文中,我们将研究五个非常有用的命令,用于查看磁盘活动。其中两个命令(`iostat` 和 `ioping`)可能必须添加到你的系统中,这两个命令一样要求你使用 sudo 特权,所有这五个命令都提供了查看磁盘活动的有用方法。 + +这些命令中最简单、最直观的一个可能是 `dstat` 了。 + +### dtstat + +尽管 `dstat` 命令以字母 “d” 开头,但它提供的统计信息远远不止磁盘活动。如果你只想查看磁盘活动,可以使用 `-d` 选项。如下所示,你将得到一个磁盘读/写测量值的连续列表,直到使用 `CTRL-c` 停止显示为止。注意,在第一个报告信息之后,显示中的每个后续行将在接下来的时间间隔内报告磁盘活动,缺省值仅为一秒。 + +``` +$ dstat -d +-dsk/total- + read writ + 949B 73k + 65k 0 <== first second + 0 24k <== second second + 0 16k + 0 0 ^C +``` + +在 `-d` 选项后面包含一个数字将把间隔设置为该秒数。 + +``` +$ dstat -d 10 +-dsk/total- + read writ + 949B 73k + 65k 81M <== first five seconds + 0 21k <== second five second + 0 9011B ^C +``` + +请注意,报告的数据可能以许多不同的单位显示——例如,M(Mb)、K(Kb)和 B(字节)。 + +如果没有选项,`dstat` 命令还将显示许多其他信息——指示 CPU 如何使用时间、显示网络和分页活动、报告中断和上下文切换。 + +``` +$ dstat +You did not select any stats, using -cdngy by default. +--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- +usr sys idl wai stl| read writ| recv send| in out | int csw + 0 0 100 0 0| 949B 73k| 0 0 | 0 3B| 38 65 + 0 0 100 0 0| 0 0 | 218B 932B| 0 0 | 53 68 + 0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C +``` + +`dstat` 命令提供了关于整个 Linux 系统性能的有价值的见解,几乎可以用它灵活而功能强大的命令来代替 `vmstat`、`netstat`、`iostat` 和 `ifstat` 等较旧的工具集合,该命令结合了这些旧工具的功能。要深入了解 `dstat` 命令可以提供的其它信息,请参阅这篇关于 [dstat][1] 命令的文章。 + +### iostat + +`iostat` 命令通过观察设备活动的时间与其平均传输速率之间的关系,帮助监视系统输入/输出设备的加载情况。它有时用于评估磁盘之间的活动平衡。 + +``` +$ iostat +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +loop0 0.00 0.00 0.00 1048 0 +loop1 0.00 0.00 0.00 365 0 +loop2 0.00 0.00 0.00 1056 0 +loop3 0.00 0.01 0.00 16169 0 +loop4 0.00 0.00 0.00 413 0 +loop5 0.00 0.00 0.00 1184 0 +loop6 0.00 0.00 0.00 1062 0 +loop7 0.00 0.00 0.00 5261 0 +sda 1.06 0.89 72.66 2837453 232735080 +sdb 0.00 0.02 0.00 48669 40 +loop8 0.00 0.00 0.00 1053 0 +loop9 0.01 0.01 0.00 18949 0 +loop10 0.00 0.00 0.00 56 0 +loop11 0.00 0.00 0.00 7090 0 +loop12 0.00 0.00 0.00 1160 0 +loop13 0.00 0.00 0.00 108 0 +loop14 0.00 0.00 0.00 3572 0 +loop15 0.01 0.01 0.00 20026 0 +loop16 0.00 0.00 0.00 24 0 +``` + +当然,当你只想关注磁盘时,Linux 回环设备上提供的所有统计信息都会使结果显得杂乱无章。不过,该命令也确实提供了 `-p` 选项,该选项使你可以仅查看磁盘——如以下命令所示。 + +``` +$ iostat -p sda +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.54 2843737 232815784 +sda1 1.04 0.88 72.54 2821733 232815784 +``` + +请注意 `tps` 是指每秒的传输量。 + +你还可以让 `iostat` 提供重复的报告。在下面的示例中,我们使用 `-d` 选项每五秒钟进行一次测量。 + +``` +$ iostat -p sda -d 5 +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.51 2843749 232834048 +sda1 1.04 0.88 72.51 2821745 232834048 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +如果你希望省略第一个(自启动以来的统计信息)报告,请在命令中添加 `-y`。 + +``` +$ iostat -p sda -d 5 -y +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +接下来,我们看第二个磁盘驱动器。 + +``` +$ iostat -p sdb +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sdb 0.00 0.02 0.00 48669 40 +sdb2 0.00 0.00 0.00 4861 40 +sdb1 0.00 0.01 0.00 35344 0 +``` + +### iotop + +`iotop` 命令是类似 `top` 的实用程序,用于查看磁盘 I/O。它收集 Linux 内核提供的 I/O 使用信息,以便你了解哪些进程在磁盘 I/O 方面的要求最高。在下面的示例中,循环时间被设置为 5 秒。显示将自动更新,覆盖前面的输出。 + +``` +$ sudo iotop -d 5 +Total DISK READ: 0.00 B/s | Total DISK WRITE: 1585.31 B/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND +32492 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [kworker/u8:1-ev~_power_efficient] + 208 be/3 root 0.00 B/s 1585.31 B/s 0.00 % 0.11 % [jbd2/sda1-8] + 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init splash + 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] + 3 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_gp] + 4 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_par_gp] + 8 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mm_percpu_wq] +``` + +### ioping + +`ioping` 命令是一种完全不同的工具,但是它可以报告磁盘延迟——也就是磁盘响应请求需要多长时间,而这有助于诊断磁盘问题。 + +``` +$ sudo ioping /dev/sda1 +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=1 time=960.2 us (warmup) +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=2 time=841.5 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=3 time=831.0 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=4 time=1.17 ms +^C +--- /dev/sda1 (block device 111.8 GiB) ioping statistics --- +3 requests completed in 2.84 ms, 12 KiB read, 1.05 k iops, 4.12 MiB/s +generated 4 requests in 3.37 s, 16 KiB, 1 iops, 4.75 KiB/s +min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us +``` + +### atop + +`atop` 命令,像 `top` 一样提供了大量有关系统性能的信息,包括有关磁盘活动的一些统计信息。 + +``` +ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed +PRC | sys 0.03s | user 0.01s | #proc 179 | #zombie 0 | #exit 6 | +CPU | sys 1% | user 0% | irq 0% | idle 199% | wait 0% | +cpu | sys 1% | user 0% | irq 0% | idle 99% | cpu000 w 0% | +CPL | avg1 0.00 | avg5 0.00 | avg15 0.00 | csw 677 | intr 470 | +MEM | tot 5.8G | free 223.4M | cache 4.6G | buff 253.2M | slab 394.4M | +SWP | tot 2.0G | free 2.0G | | vmcom 1.9G | vmlim 4.9G | +DSK | sda | busy 0% | read 0 | write 7 | avio 1.14 ms | +NET | transport | tcpi 4 | tcpo stall 8 | udpi 1 | udpo 0swout 2255 | +NET | network | ipi 10 | ipo 7 | ipfrw 0 | deliv 60.67 ms | +NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms | + + PID SYSCPU USRCPU VGROW RGROW ST EXC THR S CPUNR CPU CMD 1/1673e4 | + 3357 0.01s 0.00s 672K 824K -- - 1 R 0 0% atop + 3359 0.01s 0.00s 0K 0K NE 0 0 E - 0% + 3361 0.00s 0.01s 0K 0K NE 0 0 E - 0% + 3363 0.01s 0.00s 0K 0K NE 0 0 E - 0% +31357 0.00s 0.00s 0K 0K -- - 1 S 1 0% bash + 3364 0.00s 0.00s 8032K 756K N- - 1 S 1 0% sleep + 2931 0.00s 0.00s 0K 0K -- - 1 I 1 0% kworker/u8:2-e + 3356 0.00s 0.00s 0K 0K -E 0 0 E - 0% + 3360 0.00s 0.00s 0K 0K NE 0 0 E - 0% + 3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% +``` + +如果你*只*想查看磁盘统计信息,则可以使用以下命令轻松进行管理: + +``` +$ atop | grep DSK +DSK | sda | busy 0% | read 122901 | write 3318e3 | avio 0.67 ms | +DSK | sdb | busy 0% | read 1168 | write 103 | avio 0.73 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.39 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.47 ms | +DSK | sda | busy 2% | read 0 | write 99 | avio 2.26 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms | +^C +``` + +### 了解磁盘 I/O + +Linux 提供了足够的命令,可以让你很好地了解磁盘的工作强度,并帮助你关注潜在的问题或减缓。希望这些命令中的一个可以告诉你何时需要质疑磁盘性能。偶尔使用这些命令将有助于确保当你需要检查磁盘,特别是忙碌或缓慢的磁盘时可以显而易见地发现它们。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [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/3291616/linux/examining-linux-system-performance-with-dstat.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190129 Create an online store with this Java-based framework.md b/published/201909/20190129 Create an online store with this Java-based framework.md new file mode 100644 index 0000000000..ad9c52ab6f --- /dev/null +++ b/published/201909/20190129 Create an online store with this Java-based framework.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11373-1.html) +[#]: subject: (Create an online store with this Java-based framework) +[#]: via: (https://opensource.com/article/19/1/scipio-erp) +[#]: author: (Paul Piper https://opensource.com/users/madppiper) + +使用 Java 框架 Scipio ERP 创建一个在线商店 +====== + +> Scipio ERP 具有包罗万象的应用程序和功能。 + +![](https://img.linux.net.cn/data/attachment/album/201909/22/133258hqvwax5w1zvq5ffa.jpg) + +如果,你想在网上销售产品或服务,但要么找不到合适的软件,要么觉得定制成本太高?那么,[Scipio ERP][1] 也许正是你想要的。 + +Scipio ERP 是一个基于 Java 的开源的电子商务框架,具有包罗万象的应用程序和功能。这个项目于 2014 年从 [Apache OFBiz][2] 分叉而来,侧重于更好的定制和更现代的吸引力。这个电子商务组件非常丰富,可以在多商店环境中工作,同时支持国际化,具有琳琅满目的产品配置,而且它还兼容现代 HTML 框架。该软件还为许多其他业务场景提供标准应用程序,例如会计、仓库管理或销售团队自动化。它都是高度标准化的,因此易于定制,如果你想要的不仅仅是一个虚拟购物车,这是非常棒的。 + +该系统也使得跟上现代 Web 标准变得非常容易。所有界面都是使用系统的“[模板工具包][3]”构建的,这是一个易于学习的宏集,可以将 HTML 与所有应用程序分开。正因为如此,每个应用程序都已经标准化到核心。听起来令人困惑?它真的不是 HTML——它看起来很像 HTML,但你写的内容少了很多。 + +### 初始安装 + +在你开始之前,请确保你已经安装了 Java 1.8(或更高版本)的 SDK 以及一个 Git 客户端。完成了?太棒了!接下来,切换到 Github 上的主分支: + +``` +git clone https://github.com/ilscipio/scipio-erp.git +cd scipio-erp +git checkout master +``` + +要安装该系统,只需要运行 `./install.sh` 并从命令行中选择任一选项。在开发过程中,最好一直使用 “installation for development”(选项 1),它还将安装一系列演示数据。对于专业安装,你可以修改初始配置数据(“种子数据”),以便自动为你设置公司和目录数据。默认情况下,系统将使用内部数据库运行,但是它[也可以配置][4]使用各种关系数据库,比如 PostgreSQL 和 MariaDB 等。 + +![安装向导][6] + +*按照安装向导完成初始配置* + +通过命令 `./start.sh` 启动系统然后打开链接 完成配置。如果你安装了演示数据, 你可以使用用户名 `admin` 和密码 `scipio` 进行登录。在安装向导中,你可以设置公司简介、会计、仓库、产品目录、在线商店和额外的用户配置信息。暂时在产品商店配置界面上跳过网站实体的配置。系统允许你使用不同的底层代码运行多个在线商店;除非你想这样做,一直选择默认值是最简单的。 + +祝贺你,你刚刚安装了 Scipio ERP!在界面上操作一两分钟,感受一下它的功能。 + +### 捷径 + +在你进入自定义之前,这里有一些方便的命令可以帮助你: + + * 创建一个 shop-override:`./ant create-component-shop-override` + * 创建一个新组件:`./ant create-component` + * 创建一个新主题组件:`./ant create-theme` + * 创建管理员用户:`./ant create-admin-user-login` + * 各种其他实用功能:`./ant -p` + * 用于安装和更新插件的实用程序:`./git-addons help` + +另外,请记下以下位置: + + * 将 Scipio 作为服务运行的脚本:`/tools/scripts/` + * 日志输出目录:`/runtime/logs` + * 管理应用程序:`` + * 电子商务应用程序:`` + +最后,Scipio ERP 在以下五个主要目录中构建了所有代码: + + * `framework`: 框架相关的源,应用程序服务器,通用界面和配置 + * `applications`: 核心应用程序 + * `addons`: 第三方扩展 + * `themes`: 修改界面外观 + * `hot-deploy`: 你自己的组件 + +除了一些配置,你将在 `hot-deploy` 和 `themes` 目录中进行开发。 + +### 在线商店定制 + +要真正使系统成为你自己的系统,请开始考虑使用[组件][7]。组件是一种模块化方法,可以覆盖、扩展和添加到系统中。你可以将组件视为独立 Web 模块,可以捕获有关数据库([实体][8])、功能([服务][9])、界面([视图][10])、[事件和操作][11]和 Web 应用程序等的信息。由于组件功能,你可以添加自己的代码,同时保持与原始源兼容。 + +运行命令 `./ant create-component-shop-override` 并按照步骤创建你的在线商店组件。该操作将会在 `hot-deploy` 目录内创建一个新目录,该目录将扩展并覆盖原始的电子商务应用程序。 + +![组件目录结构][13] + +*一个典型的组件目录结构。* + +你的组件将具有以下目录结构: + + * `config`: 配置 + * `data`: 种子数据 + * `entitydef`: 数据库表定义 + * `script`: Groovy 脚本的位置 + * `servicedef`: 服务定义 + * `src`: Java 类 + * `webapp`: 你的 web 应用程序 + * `widget`: 界面定义 + +此外,`ivy.xml` 文件允许你将 Maven 库添加到构建过程中,`ofbiz-component.xml` 文件定义整个组件和 Web 应用程序结构。除了一些在当前目录所能够看到的,你还可以在 Web 应用程序的 `WEB-INF` 目录中找到 `controller.xml` 文件。这允许你定义请求实体并将它们连接到事件和界面。仅对于界面来说,你还可以使用内置的 CMS 功能,但优先要坚持使用核心机制。在引入更改之前,请熟悉 `/applications/shop/`。 + +#### 添加自定义界面 + +还记得[模板工具包][3]吗?你会发现它在每个界面都有使用到。你可以将其视为一组易于学习的宏,它用来构建所有内容。下面是一个例子: + +``` +<@section title="Title"> +    <@heading id="slider">Slider +    <@row> +        <@cell columns=6> +            <@slider id="" class="" controls=true indicator=true> +                <@slide link="#" image="https://placehold.it/800x300">Just some content… +                <@slide title="This is a title" link="#" image="https://placehold.it/800x300"> +            +        +        <@cell columns=6>Second column +    + +``` + +不是很难,对吧?同时,主题包含 HTML 定义和样式。这将权力交给你的前端开发人员,他们可以定义每个宏的输出,并坚持使用自己的构建工具进行开发。 + +我们快点试试吧。首先,在你自己的在线商店上定义一个请求。你将修改此代码。一个内置的 CMS 系统也可以通过 进行访问,它允许你以更有效的方式创建新模板和界面。它与模板工具包完全兼容,并附带可根据你的喜好采用的示例模板。但是既然我们试图在这里理解系统,那么首先让我们采用更复杂的方法。 + +打开你商店 `webapp` 目录中的 [controller.xml][14] 文件。控制器会跟踪请求事件并相应地执行操作。下面的操作将会在 `/shop/test` 下创建一个新的请求: + +``` + + +      +      + +``` + +你可以定义多个响应,如果需要,可以在请求中使用事件或服务调用来确定你可能要使用的响应。我选择了“视图”类型的响应。视图是渲染的响应;其他类型是请求重定向、转发等。系统附带各种渲染器,可让你稍后确定输出;为此,请添加以下内容: + +``` + + +``` + +用你自己的组件名称替换 `my-component`。然后,你可以通过在 `widget/CommonScreens.xml` 文件的标签内添加以下内容来定义你的第一个界面: + +``` + +       
+            +            +            +                +                    +                        +                    +                +            +       
+   
+``` + +商店界面实际上非常模块化,由多个元素组成([小部件、动作和装饰器][15])。为简单起见,请暂时保留原样,并通过添加第一个模板工具包文件来完成新网页。为此,创建一个新的 `webapp/mycomponent/test/test.ftl` 文件并添加以下内容: + +``` +<@alert type="info">Success! +``` + +![自定义的界面][17] + +*一个自定义的界面。* + +打开 并惊叹于你自己的成就。 + +#### 自定义主题 + +通过创建自己的主题来修改商店的界面外观。所有主题都可以作为组件在 `themes` 文件夹中找到。运行命令 `./ant create-theme` 来创建你自己的主题。 + +![主题组件布局][19] + +*一个典型的主题组件布局。* + +以下是最重要的目录和文件列表: + + * 主题配置:`data/*ThemeData.xml` + * 特定主题封装的 HTML:`includes/*.ftl` + * 模板工具包 HTML 定义:`includes/themeTemplate.ftl` + * CSS 类定义:`includes/themeStyles.ftl` + * CSS 框架: `webapp/theme-title/` + +快速浏览工具包中的 Metro 主题;它使用 Foundation CSS 框架并且充分利用了这个框架。然后,然后,在新构建的 `webapp/theme-title` 目录中设置自己的主题并开始开发。Foundation-shop 主题是一个非常简单的特定于商店的主题实现,你可以将其用作你自己工作的基础。 + +瞧!你已经建立了自己的在线商店,准备个性化定制吧! + +![搭建完成的 Scipio ERP 在线商店][21] + +*一个搭建完成的基于 Scipio ERP的在线商店。* + +### 接下来是什么? + +Scipio ERP 是一个功能强大的框架,可简化复杂的电子商务应用程序的开发。为了更完整的理解,请查看项目[文档][7],尝试[在线演示][22],或者[加入社区][23]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/scipio-erp + +作者:[Paul Piper][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/madppiper +[b]: https://github.com/lujun9972 +[1]: https://www.scipioerp.com +[2]: https://ofbiz.apache.org/ +[3]: https://www.scipioerp.com/community/developer/freemarker-macros/ +[4]: https://www.scipioerp.com/community/developer/installation-configuration/configuration/#database-configuration +[5]: /file/419711 +[6]: https://opensource.com/sites/default/files/uploads/setup_step5_sm.jpg (Setup wizard) +[7]: https://www.scipioerp.com/community/developer/architecture/components/ +[8]: https://www.scipioerp.com/community/developer/entities/ +[9]: https://www.scipioerp.com/community/developer/services/ +[10]: https://www.scipioerp.com/community/developer/views-requests/ +[11]: https://www.scipioerp.com/community/developer/events-actions/ +[12]: /file/419716 +[13]: https://opensource.com/sites/default/files/uploads/component_structure.jpg (component directory structure) +[14]: https://www.scipioerp.com/community/developer/views-requests/request-controller/ +[15]: https://www.scipioerp.com/community/developer/views-requests/screen-widgets-decorators/ +[16]: /file/419721 +[17]: https://opensource.com/sites/default/files/uploads/success_screen_sm.jpg (Custom screen) +[18]: /file/419726 +[19]: https://opensource.com/sites/default/files/uploads/theme_structure.jpg (theme component layout) +[20]: /file/419731 +[21]: https://opensource.com/sites/default/files/uploads/finished_shop_1_sm.jpg (Finished Scipio ERP shop) +[22]: https://www.scipioerp.com/demo/ +[23]: https://forum.scipioerp.com/ diff --git a/published/201909/20190401 Build and host a website with Git.md b/published/201909/20190401 Build and host a website with Git.md new file mode 100644 index 0000000000..fd3b19a04f --- /dev/null +++ b/published/201909/20190401 Build and host a website with Git.md @@ -0,0 +1,223 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11303-1.html) +[#]: subject: (Build and host a website with Git) +[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 建立和托管网站 +====== + +> 你可以让 Git 帮助你轻松发布你的网站。在我们《鲜为人知的 Git 用法》系列的第一篇文章中学习如何做到。 + +![](https://img.linux.net.cn/data/attachment/album/201909/04/134312l912496eegpoqaqe.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +创建一个网站曾经是极其简单的,而同时它又是一种黑魔法。回到 Web 1.0 的旧时代(不是每个人都会这样称呼它),你可以打开任何网站,查看其源代码,并对 HTML 及其内联样式和基于表格的布局进行反向工程,在这样的一两个下午之后,你就会感觉自己像一个程序员一样。不过要让你创建的页面放到互联网上,仍然有一些问题,因为这意味着你需要处理服务器、FTP 以及 webroot 目录和文件权限。虽然从那时起,现代网站变得愈加复杂,但如果你让 Git 帮助你,自出版可以同样容易(或更容易!)。 + +### 用 Hugo 创建一个网站 + +[Hugo][3] 是一个开源的静态站点生成器。静态网站是过去的 Web 的基础(如果你回溯到很久以前,那就是 Web 的*全部*了)。静态站点有几个优点:它们相对容易编写,因为你不必编写代码;它们相对安全,因为页面上没有执行代码;并且它们可以非常快,因为除了在页面上传输的任何内容之外没有任何处理。 + +Hugo 并不是唯一一个静态站点生成器。[Grav][4]、[Pico][5]、[Jekyll][6]、[Podwrite][7] 以及许多其他的同类软件都提供了一种创建一个功能最少的、只需要很少维护的网站的简单方法。Hugo 恰好是内置集成了 GitLab 集成的一个静态站点生成器,这意味着你可以使用免费的 GitLab 帐户生成和托管你的网站。 + +Hugo 也有一些非常大的用户。例如,如果你曾经去过 [Let's Encrypt](https://letsencrypt.org/) 网站,那么你已经用过了一个用 Hugo 构建的网站。 + +![Let's Encrypt website][8] + +#### 安装 Hugo + +Hugo 是跨平台的,你可以在 [Hugo 的入门资源][9]中找到适用于 MacOS、Windows、Linux、OpenBSD 和 FreeBSD 的安装说明。 + +如果你使用的是 Linux 或 BSD,最简单的方法是从软件存储库或 ports 树安装 Hugo。确切的命令取决于你的发行版,但在 Fedora 上,你应该输入: + +``` +$ sudo dnf install hugo +``` + +通过打开终端并键入以下内容确认你已正确安装: + +``` +$ hugo help +``` + +这将打印 `hugo` 命令的所有可用选项。如果你没有看到,你可能没有正确安装 Hugo 或需要[将该命令添加到你的路径][10]。 + +#### 创建你的站点 + +要构建 Hugo 站点,你必须有个特定的目录结构,通过输入以下命令 Hugo 将为你生成它: + +``` +$ hugo new site mysite +``` + +你现在有了一个名为 `mysite` 的目录,它包含构建 Hugo 网站所需的默认目录。 + +Git 是你将网站放到互联网上的接口,因此切换到你新的 `mysite` 文件夹,并将其初始化为 Git 存储库: + +``` +$ cd mysite +$ git init . +``` + +Hugo 与 Git 配合的很好,所以你甚至可以使用 Git 为你的网站安装主题。除非你计划开发你正在安装的主题,否则可以使用 `--depth` 选项克隆该主题的源的最新状态: + +``` +$ git clone --depth 1 https://github.com/darshanbaral/mero.git themes/mero +``` + +现在为你的网站创建一些内容: + +``` +$ hugo new posts/hello.md +``` + +使用你喜欢的文本编辑器编辑 `content/posts` 目录中的 `hello.md` 文件。Hugo 接受 Markdown 文件,并会在发布时将它们转换为经过主题化的 HTML 文件,因此你的内容必须采用 [Markdown 格式][11]。 + +如果要在帖子中包含图像,请在 `static` 目录中创建一个名为 `images` 的文件夹。将图像放入此文件夹,并使用以 `/images` 开头的绝对路径在标记中引用它们。例如: + +``` +![A picture of a thing](/images/thing.jpeg) +``` + +#### 选择主题 + +你可以在 [themes.gohugo.io][12] 找到更多主题,但最好在测试时保持一个基本主题。标准的 Hugo 测试主题是 [Ananke][13]。某些主题具有复杂的依赖关系,而另外一些主题如果没有复杂的配置的话,也许不会以你预期的方式呈现页面。本例中使用的 Mero 主题捆绑了一个详细的 `config.toml` 配置文件,但是(为了简单起见)我将在这里只提供基本的配置。在文本编辑器中打开名为 `config.toml` 的文件,并添加三个配置参数: + +``` +languageCode = "en-us" +title = "My website on the web" +theme = "mero" + +[params] + author = "Seth Kenlon" + description = "My hugo demo" +``` + +#### 预览 + +在你准备发布之前不必(预先)在互联网上放置任何内容。在你开发网站时,你可以通过启动 Hugo 附带的仅限本地访问的 Web 服务器来预览你的站点。 + +``` +$ hugo server --buildDrafts --disableFastRender +``` + +打开 Web 浏览器并导航到 以查看正在进行的工作。 + +### 用 Git 发布到 GitLab + +要在 GitLab 上发布和托管你的站点,请为你的站点内容创建一个存储库。 + +要在 GitLab 中创建存储库,请单击 GitLab 的 “Projects” 页面中的 “New Project” 按钮。创建一个名为 `yourGitLabUsername.gitlab.io` 的空存储库,用你的 GitLab 用户名或组名替换 `yourGitLabUsername`。你必须使用此命名方式作为该项目的名称。你也可以稍后为其添加自定义域。 + +不要在 GitLab 上包含许可证或 README 文件(因为你已经在本地启动了一个项目,现在添加这些文件会使将你的数据推向 GitLab 时更加复杂,以后你可以随时添加它们)。 + +在 GitLab 上创建空存储库后,将其添加为 Hugo 站点的本地副本的远程位置,该站点已经是一个 Git 存储库: + +``` +$ git remote add origin git@gitlab.com:skenlon/mysite.git +``` + +创建名为 `.gitlab-ci.yml` 的 GitLab 站点配置文件并输入以下选项: + +``` +image: monachus/hugo + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +pages: + script: + - hugo + artifacts: + paths: + - public + only: + - master +``` + +`image` 参数定义了一个为你的站点提供服务的容器化图像。其他参数是告诉 GitLab 服务器在将新代码推送到远程存储库时要执行的操作的说明。有关 GitLab 的 CI/CD(持续集成和交付)选项的更多信息,请参阅 [GitLab 文档的 CI/CD 部分][14]。 + +#### 设置排除的内容 + +你的 Git 存储库已配置好,在 GitLab 服务器上构建站点的命令也已设置,你的站点已准备好发布了。对于你的第一个 Git 提交,你必须采取一些额外的预防措施,以便你不会对你不打算进行版本控制的文件进行版本控制。 + +首先,将构建你的站点时 Hugo 创建的 `/public` 目录添加到 `.gitignore` 文件。你无需在 Git 中管理已完成发布的站点;你需要跟踪的是你的 Hugo 源文件。 + +``` +$ echo "/public" >> .gitignore +``` + +如果不创建 Git 子模块,则无法在 Git 存储库中维护另一个 Git 存储库。为了简单起见,请移除嵌入的存储库的 `.git` 目录,以使主题(存储库)只是一个主题(目录)。 + +请注意,你**必须**将你的主题文件添加到你的 Git 存储库,以便 GitLab 可以访问该主题。如果不提交主题文件,你的网站将无法成功构建。 + +``` +$ mv themes/mero/.git ~/.local/share/Trash/files/ +``` + +你也可以像使用[回收站][15]一样使用 `trash`: + +``` +$ trash themes/mero/.git +``` + +现在,你可以将本地项目目录的所有内容添加到 Git 并将其推送到 GitLab: + +``` +$ git add . +$ git commit -m 'hugo init' +$ git push -u origin HEAD +``` + +### 用 GitLab 上线 + +将代码推送到 GitLab 后,请查看你的项目页面。有个图标表示 GitLab 正在处理你的构建。第一次推送代码可能需要几分钟,所以请耐心等待。但是,请不要**一直**等待,因为该图标并不总是可靠地更新。 + +![GitLab processing your build][16] + +当你在等待 GitLab 组装你的站点时,请转到你的项目设置并找到 “Pages” 面板。你的网站准备就绪后,它的 URL 就可以用了。该 URL 是 `yourGitLabUsername.gitlab.io/yourProjectName`。导航到该地址以查看你的劳动成果。 + +![Previewing Hugo site][17] + +如果你的站点无法正确组装,GitLab 提供了可以深入了解 CI/CD 管道的日志。查看错误消息以找出发生了什么问题。 + +### Git 和 Web + +Hugo(或 Jekyll 等类似工具)只是利用 Git 作为 Web 发布工具的一种方式。使用服务器端 Git 挂钩,你可以使用最少的脚本设计你自己的 Git-to-web 工作流。使用 GitLab 的社区版,你可以自行托管你自己的 GitLab 实例;或者你可以使用 [Gitolite][18] 或 [Gitea][19] 等替代方案,并使用本文作为自定义解决方案的灵感来源。祝你玩得开心! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/building-hosting-website-git + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://git-scm.com/ +[3]: http://gohugo.io +[4]: http://getgrav.org +[5]: http://picocms.org/ +[6]: https://jekyllrb.com +[7]: http://slackermedia.info/podwrite/ +[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website) +[9]: https://gohugo.io/getting-started/installing +[10]: https://opensource.com/article/17/6/set-path-linux +[11]: https://commonmark.org/help/ +[12]: https://themes.gohugo.io/ +[13]: https://themes.gohugo.io/gohugo-theme-ananke/ +[14]: https://docs.gitlab.com/ee/ci/#overview +[15]: http://slackermedia.info/trashy +[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build) +[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site) +[18]: http://gitolite.com +[19]: http://gitea.io diff --git a/published/201909/20190402 Manage your daily schedule with Git.md b/published/201909/20190402 Manage your daily schedule with Git.md new file mode 100644 index 0000000000..88ae47f664 --- /dev/null +++ b/published/201909/20190402 Manage your daily schedule with Git.md @@ -0,0 +1,244 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11320-1.html) +[#]: subject: (Manage your daily schedule with Git) +[#]: via: (https://opensource.com/article/19/4/calendar-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 管理你的每日行程 +====== + +> 像源代码一样对待时间并在 Git 的帮助下维护你的日历。 + +![](https://img.linux.net.cn/data/attachment/album/201909/09/061835la7ne9edtlr7kn18.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天,我们将使用 Git 来跟踪你的日历。 + +### 使用 Git 跟踪你的日程安排 + +如果时间本身只是可以管理和版本控制的源代码呢?虽然证明或反驳这种理论可能超出了本文的范围,但在 Git 的帮助下,你可以将时间视为源代码并管理你的日程安排。 + +日历的卫冕冠军是 [CalDAV][3] 协议,它支撑了如 [NextCloud][4] 这样的流行的开源及闭源的日历应用程序。CalDAV 没什么问题(评论者,请注意),但它并不适合所有人,除此之外,它还有一种不同于单一文化的鼓舞人心的东西。 + +因为我对大量使用 GUI 的 CalDAV 客户端没有兴趣(如果你正在寻找一个好的终端 CalDAV 查看器,请参阅 [khal][5]),我开始研究基于文本的替代方案。基于文本的日历具有在[明文][6]中工作的所有常见好处。它很轻巧,非常便携,只要它结构化,就很容易解析和美化(无论*美丽*对你意味着什么)。 + +最重要的是,它正是 Git 旨在管理的内容。 + +### Org 模式不是一种可怕的方式 + +如果你没有对你的明文添加结构,它很快就会陷入一种天马行空般的混乱,变成恶魔才能懂的符号。幸运的是,有一种用于日历的标记语法,它包含在令人尊敬的生产力 Emacs 模式 —— [Org 模式][7] 中(承认吧,你其实一直想开始使用它)。 + +许多人没有意识到 Org 模式的惊人之处在于[你不需要知道甚至不需要使用 Emacs][8]来利用 Org 模式建立的约定。如果你使用 Emacs,你会得到许多很棒的功能,但是如果 Emacs 对你来说太难了,那么你可以实现一个基于 Git 的 Org 模式的日历系统,而不需要安装 Emacs。 + +关于 Org 模式你唯一需要知道的部分是它的语法。Org 模式的语法维护成本低、直观。使用 Org 模式而不是 GUI 日历应用程序进行日历记录的最大区别在于工作流程:你可以创建一个任务列表,然后每天分配一个任务,而不是转到日历并查找要安排任务的日期。 + +组织模式中的列表使用星号(`*`)作为项目符号。这是我的游戏任务列表: + +``` +* Gaming +** Build Stardrifter character +** Read Stardrifter rules +** Stardrifter playtest + +** Blue Planet @ Mike's + +** Run Rappan Athuk +*** Purchase hard copy +*** Skim Rappan Athuk +*** Build Rappan Athuk maps in maptool +*** Sort Rappan Athuk tokens +``` + +如果你熟悉 [CommonMark][9] 或 Markdown,你会注意到,Org 模式不是使用空格来创建子任务,而是更明确地使用了其它项目符号。无论你的使用背景和列表是什么,这都是一种构建列表的直观且简单的方法,它显然与 Emacs 没有内在联系(尽管使用 Emacs 为你提供了快捷方式,因此你可以快速地重新排列列表)。 + +要将列表转换为日历中的计划任务或事件,请返回并添加关键字 `SCHEDULED` 和(可选)`:CATEGORY:`。 + +``` +* Gaming +:CATEGORY: Game +** Build Stardrifter character +SCHEDULED: <2019-03-22 18:00-19:00> +** Read Stardrifter rules +SCHEDULED: <2019-03-22 19:00-21:00> +** Stardrifter playtest +SCHEDULED: <2019-03-25 0900-1300> +** Blue Planet @ Mike's +SCHEDULED: <2019-03-18 18:00-23:00 +1w> + +and so on... +``` + +`SCHEDULED` 关键字将该条目标记为你希望收到通知的事件,并且可选的 `:CATEGORY:` 关键字是一个可供你自己使用的任意标记系统(在 Emacs 中,你可以根据类别对条目使用颜色代码)。 + +对于重复事件,你可以使用符号(如`+1w`)创建每周事件或 `+2w` 以进行每两周一次的事件,依此类推。 + +所有可用于 Org 模式的花哨标记都[记录于文档][10],所以不要犹豫,找到更多技巧来让它满足你的需求。 + +### 放进 Git + +如果没有 Git,你的 Org 模式的日程安排只不过是本地计算机上的文件。这是 21 世纪,所以你至少需要可以在手机上使用你的日历,即便不是在你所有的个人电脑上。你可以使用 Git 为自己和他人发布日历。 + +首先,为 `.org` 文件创建一个目录。我将我的存储在 `~/cal` 中。 + +``` +$ mkdir ~/cal +``` + +转到你的目录并使其成为 Git 存储库: + +``` +$ cd cal +$ git init +``` + +将 `.org` 文件移动到你本地的 Git 存储库。在实践中,我为每个类别维护一个 `.org` 文件。 + +``` +$ mv ~/*.org ~/cal +$ ls +Game.org Meal.org Seth.org Work.org +``` + +暂存并提交你的文件: + +``` +$ git add *.org +$ git commit -m 'cal init' +``` + +### 创建一个 Git 远程源 + +要在任何地方提供日历,你必须在互联网上拥有 Git 存储库。你的日历是纯文本,因此任何 Git 存储库都可以。你可以将日历放在 [GitLab][11] 或任何其他公共 Git 托管服务(甚至是专有服务)上,只要你的主机允许,你甚至可以将该存储库标记为私有库。如果你不想将日历发布到你无法控制的服务器,则可以自行托管 Git 存储库,或者为单个用户使用裸存储库,或者使用 [Gitolite][12] 或 [Gitea][13] 等前端服务。 + +为了简单起见,我将假设一个自托管的 Git 裸存储库。你可以使用 Git 命令在任何具有 SSH 访问权限的服务器上创建一个远程裸存储库: + +``` +$ ssh -p 22122 [seth@example.com][14] +[remote]$ mkdir cal.git +[remote]$ cd cal.git +[remote]$ git init --bare +[remote]$ exit +``` + +这个裸存储库可以作为你日历在互联网上的家。 + +将其设置为本地 Git 存储库(在你的计算机上,而不是你的服务器上)的远程源: + +``` +$ git remote add origin seth@example.com:/home/seth/cal.git +``` + +然后推送你的日历到该服务器: + +``` +$ git push -u origin HEAD +``` + +将你的日历放在 Git 存储库中,就可以在任何运行 Git 的设备上使用它。这意味着你可以对计划进行更新和更改,并将更改推送到上游,以便在任何地方进行更新。 + +我使用这种方法使我的日历在我的工作笔记本电脑和家庭工作站之间保持同步。由于我每天大部分时间都在使用 Emacs,因此能够在 Emacs 中查看和编辑我的日历是一个很大的便利。对于大多数使用移动设备的人来说也是如此,因此下一步是在移动设备上设置 Org 模式的日历系统。 + +### 移动设备上的 Git + +由于你的日历数据是纯文本的,严格来说,你可以在任何可以读取文本文件的设备上“使用”它。这是这个系统之美的一部分;你永远不会缺少原始数据。但是,要按照你希望的现代日历的工作方式将日历集成到移动设备上,你需要两个组件:移动设备上的 Git 客户端和 Org 模式查看器。 + +#### 移动设备上的 Git 客户端 + +[MGit][15] 是 Android 上的优秀 Git 客户端。同样,iOS 也有 Git 客户端。 + +一旦安装了 MGit(或类似的 Git 客户端),你必须克隆日历存储库,以便在你的手机上有副本。要从移动设备访问服务器,必须设置 SSH 密钥进行身份验证。MGit 可以为你生成和存储密钥,你必须将其添加到服务器的 `~/.ssh/authorized_keys` 文件或托管的 Git 的帐户设置中的 SSH 密钥中。 + +你必须手动执行此操作。MGit 没有登录你的服务器或托管的 Git 帐户的界面。如果你不这样做,你的移动设备将无法访问你的服务器以访问你的日历数据。 + +我是通过将我在 MGit 中生成的密钥文件通过 [KDE Connect][16] 复制到我的笔记本电脑来实现的(但你可以通过蓝牙、SD 卡读卡器或 USB 电缆进行相同操作,具体取决于你访问手机上的数据的首选方法)。 我用这个命令将密钥(一个名为 `calkey` 的文件)复制到我的服务器: + +``` +$ cat calkey | ssh seth@example.com "cat >> /home/seth/.ssh/authorized_keys" +``` + +你可能有不同的方法,但如果你曾经将服务器设置为无密码登录,这是完全相同的过程。如果你使用的是 GitLab 等托管的 Git 服务,则必须将密钥文件的内容复制并粘贴到用户帐户的 SSH 密钥面板中。 + +![Adding key file data to GitLab][17] + +完成后,你的移动设备可以向你的服务器授权,但仍需要知道在哪里查找你的日历数据。不同的应用程序可能使用不同的表示法,但 MGit 使用普通的旧式 Git-over-SSH。这意味着如果你使用的是非标准 SSH 端口,则必须指定要使用的 SSH 端口: + +``` +$ git clone ssh://seth@example.com:22122//home/seth/git/cal.git +``` + +![Specifying SSH port in MGit][18] + +如果你使用其他应用程序,它可能会使用不同的语法,允许你在特殊字段中提供端口,或删除 `ssh://` 前缀。如果遇到问题,请参阅应用程序文档。 + +将存储库克隆到手机。 + +![Cloned repositories][19] + +很少有 Git 应用程序设置为自动更新存储库。有一些应用程序可以用来自动拉取,或者你可以设置 Git 钩子来推送服务器的更新 —— 但我不会在这里讨论这些。目前,在对日历进行更新后,请务必在 MGit 中手动提取新更改(或者如果在手机上更改了事件,请将更改推送到服务器)。 + +![MGit push/pull settings][20] + +#### 移动设备上的日历 + +有一些应用程序可以为移动设备上的 Org 模式提供前端。[Orgzly][21] 是一个很棒的开源 Android 应用程序,它为 Org 模式的从 Agenda 模式到 TODO 列表的大多数功能提供了一个界面。安装并启动它。 + +从主菜单中,选择“设置同步存储库”,然后选择包含日历文件的目录(即,从服务器克隆的 Git 存储库)。 + +给 Orgzly 一点时间来导入数据,然后使用 Orgzly 的[汉堡包][22]菜单选择日程视图。 + +![Orgzly's agenda view][23] + +在 Orgzly 的“设置提醒”菜单中,你可以选择在手机上触发通知的事件类型。你可以获得 `SCHEDULED` 任务,`DEADLINE` 任务或任何分配了事件时间的任何通知。如果你将手机用作任务管理器,那么你将永远不会错过 Org 模式和 Orgzly 的活动。 + +![Orgzly notification][24] + +Orgzly 不仅仅是一个解析器。你可以编辑和更新事件,甚至标记事件为 `DONE`。 + +![Orgzly to-do list][25] + +### 专为你而设计 + +关于使用 Org 模式和 Git 的重要一点是,这两个应用程序都非常灵活,并且你可以自定义它们的工作方式和内容,以便它们能够适应你的需求。如果本文中的内容是对你如何组织生活或管理每周时间表的冒犯,但你喜欢此提案提供的其他部分,那么请丢弃你不喜欢的部分。如果需要,你可以在 Emacs 中使用 Org 模式,或者你可以将其用作日历标记。你可以将手机设置为在一天结束时从计算机上拉取 Git 数据,而不是从互联网上的服务器上,或者你可以将计算机配置为在手机插入时同步日历,或者你可以每天管理它,就像你把你工作日所需的所有东西都装到你的手机上一样。这取决于你,而这是关于 Git、Org 模式和开源的最重要的事情。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/calendar-git + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0 (website design image) +[2]: https://git-scm.com/ +[3]: https://tools.ietf.org/html/rfc4791 +[4]: http://nextcloud.com +[5]: https://github.com/pimutils/khal +[6]: https://plaintextproject.online/ +[7]: https://orgmode.org +[8]: https://opensource.com/article/19/1/productivity-tool-org-mode +[9]: https://commonmark.org/ +[10]: https://orgmode.org/manual/ +[11]: http://gitlab.com +[12]: http://gitolite.com/gitolite/index.html +[13]: https://gitea.io/en-us/ +[14]: mailto:seth@example.com +[15]: https://f-droid.org/en/packages/com.manichord.mgit +[16]: https://community.kde.org/KDEConnect +[17]: https://opensource.com/sites/default/files/uploads/gitlab-add-key.jpg (Adding key file data to GitLab) +[18]: https://opensource.com/sites/default/files/uploads/mgit-0.jpg (Specifying SSH port in MGit) +[19]: https://opensource.com/sites/default/files/uploads/mgit-1.jpg (Cloned repositories) +[20]: https://opensource.com/sites/default/files/uploads/mgit-2.jpg (MGit push/pull settings) +[21]: https://f-droid.org/en/packages/com.orgzly/ +[22]: https://en.wikipedia.org/wiki/Hamburger_button +[23]: https://opensource.com/sites/default/files/uploads/orgzly-agenda.jpg (Orgzly's agenda view) +[24]: https://opensource.com/sites/default/files/uploads/orgzly-cal-notify.jpg (Orgzly notification) +[25]: https://opensource.com/sites/default/files/uploads/orgzly-cal-todo.jpg (Orgzly to-do list) diff --git a/published/201909/20190403 Use Git as the backend for chat.md b/published/201909/20190403 Use Git as the backend for chat.md new file mode 100644 index 0000000000..100750937b --- /dev/null +++ b/published/201909/20190403 Use Git as the backend for chat.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11342-1.html) +[#]: subject: (Use Git as the backend for chat) +[#]: via: (https://opensource.com/article/19/4/git-based-chat) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 作为聊天应用的后端 +====== + +> GIC 是一个聊天应用程序的原型,展示了一种使用 Git 的新方法。 + +![](https://img.linux.net.cn/data/attachment/album/201909/15/100905euzi3l5xgslsgx7i.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天我们来看看 GIC,它是一个基于 Git 的聊天应用。 + +### 初识 GIC + +虽然 Git 的作者们可能期望会为 Git 创建前端,但毫无疑问他们从未预料到 Git 会成为某种后端,如聊天客户端的后端。然而,这正是开发人员 Ephi Gabay 用他的实验性的概念验证应用 [GIC][3] 所做的事情:用 [Node.js][4] 编写的聊天客户端,使用 Git 作为其后端数据库。 + +GIC 并没有打算用于生产用途。这纯粹是一种编程练习,但它证明了开源技术的灵活性。令人惊讶的是,除了 Node 库和 Git 本身,该客户端只包含 300 行代码。这是这个聊天客户端和开源所反映出来的最好的地方之一:建立在现有工作基础上的能力。眼见为实,你应该自己亲自来了解一下 GIC。 + +### 架设起来 + +GIC 使用 Git 作为引擎,因此你需要一个空的 Git 存储库为聊天室和记录器提供服务。存储库可以托管在任何地方,只要你和需要访问聊天服务的人可以访问该存储库就行。例如,你可以在 GitLab 等免费 Git 托管服务上设置 Git 存储库,并授予聊天用户对该 Git 存储库的贡献者访问权限。(他们必须能够提交到存储库,因为每个聊天消息都是一个文本的提交。) + +如果你自己托管,请创建一个中心化的裸存储库。聊天中的每个用户必须在裸存储库所在的服务器上拥有一个帐户。你可以使用如 [Gitolite][5] 或 [Gitea][6] 这样的 Git 托管软件创建特定于 Git 的帐户,或者你可以在服务器上为他们提供个人用户帐户,可以使用 `git-shell` 来限制他们只能访问 Git。 + +自托管实例的性能最好。无论你是自己托管还是使用托管服务,你创建的 Git 存储库都必须具有一个活跃分支,否则 GIC 将无法在用户聊天时进行提交,因为没有 Git HEAD。确保分支初始化和活跃的最简单方法是在创建存储库时提交 `README` 或许可证文件。如果你没有这样做,你可以在事后创建并提交一个: + +``` +$ echo "chat logs" > README +$ git add README +$ git commit -m 'just creating a HEAD ref' +$ git push -u origin HEAD +``` + +### 安装 GIC + +由于 GIC 基于 Git 并使用 Node.js 编写,因此必须首先安装 Git、Node.js 和 Node 包管理器npm(它应该与 Node 捆绑在一起)。安装它们的命令因 Linux 或 BSD 发行版而异,这是 Fedora 上的一个示例命令: + +``` +$ sudo dnf install git nodejs +``` + +如果你没有运行 Linux 或 BSD,请按照 [git-scm.com][7] 和 [nodejs.org][8] 上的安装说明进行操作。 + +因此,GIC 没有安装过程。每个用户(在此示例中为 Alice 和 Bob)必须将存储库克隆到其硬盘驱动器: + +``` +$ git clone https://github.com/ephigabay/GIC GIC +``` + +将目录更改为 GIC 目录并使用 `npm` 安装 Node.js 依赖项: + +``` +$ cd GIC +$ npm install +``` + +等待 Node 模块下载并安装。 + +### 配置 GIC + +GIC 唯一需要的配置是 Git 聊天存储库的位置。编辑 `config.js` 文件: + +``` +module.exports = { + gitRepo: 'seth@example.com:/home/gitchat/chatdemo.git', + messageCheckInterval: 500, + branchesCheckInterval: 5000 +}; +``` + +在尝试 GIC 之前测试你与 Git 存储库的连接,以确保你的配置是正确的: + +``` +$ git clone --quiet seth@example.com:/home/gitchat/chatdemo.git > /dev/null +``` + +假设你没有收到任何错误,就可以开始聊天了。 + +### 用 Git 聊天 + +在 GIC 目录中启动聊天客户端: + +``` +$ npm start +``` + +客户端首次启动时,必须克隆聊天存储库。由于它几乎是一个空的存储库,因此不会花费很长时间。输入你的消息,然后按回车键发送消息。 + +![GIC][10] + +*基于 Git 的聊天客户端。 他们接下来会怎么想?* + +正如问候消息所说,Git 中的分支在 GIC 中就是聊天室或频道。无法在 GIC 的 UI 中创建新分支,但如果你在另一个终端会话或 Web UI 中创建一个分支,它将立即显示在 GIC 中。将一些 IRC 式的命令加到 GIC 中并不需要太多工作。 + +聊了一会儿之后,可以看看你的 Git 存储库。由于聊天发生在 Git 中,因此存储库本身也是聊天日志: + +``` +$ git log --pretty=format:"%p %cn %s" +4387984 Seth Kenlon Hey Chani, did you submit a talk for All Things Open this year? +36369bb Chani No I didn't get a chance. Did you? +[...] +``` + +### 退出 GIC + +Vim 以来,还没有一个应用程序像 GIC 那么难以退出。你看,没有办法停止 GIC。它会一直运行,直到它被杀死。当你准备停止 GIC 时,打开另一个终端选项卡或窗口并发出以下命令: + +``` +$ kill `pgrep npm` +``` + +GIC 是一个新奇的事物。这是一个很好的例子,说明开源生态系统如何鼓励和促进创造力和探索,并挑战我们从不同角度审视应用程序。尝试下 GIC,也许它会给你一些思路。至少,它可以让你与 Git 度过一个下午。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/git-based-chat + +作者:[Seth Kenlon][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://opensource.com/users/seth +[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://git-scm.com/ +[3]: https://github.com/ephigabay/GIC +[4]: https://nodejs.org/en/ +[5]: http://gitolite.com +[6]: http://gitea.io +[7]: http://git-scm.com +[8]: http://nodejs.org +[9]: mailto:seth@example.com +[10]: https://opensource.com/sites/default/files/uploads/gic.jpg (GIC) diff --git a/published/201909/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md b/published/201909/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md new file mode 100644 index 0000000000..bbd85a891f --- /dev/null +++ b/published/201909/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md @@ -0,0 +1,345 @@ +[#]: collector: (lujun9972) +[#]: translator: (LuuMing) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11307-1.html) +[#]: subject: (A beginner's guide to building DevOps pipelines with open source tools) +[#]: via: (https://opensource.com/article/19/4/devops-pipeline) +[#]: author: (Bryant Son https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter) + +使用开源工具构建 DevOps 流水线的初学者指南 +====== + +> 如果你是 DevOps 新人,请查看这 5 个步骤来构建你的第一个 DevOps 流水线。 + +![](https://img.linux.net.cn/data/attachment/album/201909/05/060323yizmqwn43zwy13za.jpg) + +DevOps 已经成为解决软件开发过程中出现的缓慢、孤立或者其他故障的默认方式。但是当你刚接触 DevOps 并且不确定从哪开始时,就意义不大了。本文探索了什么是 DevOps 流水线并且提供了创建它的 5 个步骤。尽管这个教程并不全面,但可以给你以后上手和扩展打下基础。首先,插入一个小故事。 + +### 我的 DevOps 之旅 + +我曾经在花旗集团的云小组工作,开发Infrastructure as a Service基础设施即服务网页应用来管理花旗的云基础设施,但我经常对研究如何让开发流水线更加高效以及如何带给团队积极的文化感兴趣。我在 Greg Lavender 推荐的书中找到了答案。Greg Lavender 是花旗的云架构和基础设施工程(即 [Phoenix 项目][2])的 CTO。这本书尽管解释的是 DevOps 原理,但它读起来像一本小说。 + +书后面的一张表展示了不同公司部署在发布环境上的频率: + +公司 | 部署频率 +---|--- +Amazon | 23,000 次/天 +Google | 5,500 次/天 +Netflix | 500 次/天 +Facebook | 1 次/天 +Twitter | 3 次/周 +典型企业 | 1 次/9 个月 + +Amazon、Google、Netflix 怎么能做到如此之频繁?那是因为这些公司弄清楚了如何去实现一个近乎完美的 DevOps 流水线。 + +但在花旗实施 DevOps 之前,情况并非如此。那时候,我的团队拥有不同构建阶段stage的环境,但是在开发服务器上的部署非常手工。所有的开发人员都只能访问一个基于 IBM WebSphere Application 社区版的开发环境服务器。问题是当多个用户同时尝试部署时,服务器就会宕机,因此开发人员在部署时就得互相通知,这一点相当痛苦。此外,还存在代码测试覆盖率低、手动部署过程繁琐以及无法根据定义的任务或用户需求跟踪代码部署的问题。 + +我意识到必须做些事情,同时也找到了一个有同样感受的同事。我们决定合作去构建一个初始的 DevOps 流水线 —— 他设置了一个虚拟机和一个 Tomcat 服务器,而我则架设了 Jenkins,集成了 Atlassian Jira、BitBucket 和代码覆盖率测试。这个业余项目非常成功:我们近乎全自动化了开发流水线,并在开发服务器上实现了几乎 100% 的正常运行,我们可以追踪并改进代码覆盖率测试,并且 Git 分支能够与部署任务和 jira 任务关联在一起。此外,大多数用来构建 DevOps 所使用的工具都是开源的。 + +现在我意识到了我们的 DevOps 流水线是多么的原始,因为我们没有利用像 Jenkins 文件或 Ansible 这样的高级设置。然而,这个简单的过程运作良好,这也许是因为 [Pareto][3] 原则(也被称作 80/20 法则)。 + +### DevOps 和 CI/CD 流水线的简要介绍 + +如果你问一些人,“什么是 DevOps?”,你或许会得到一些不同的回答。DevOps,就像敏捷,已经发展到涵盖着诸多不同的学科,但大多数人至少会同意这些:DevOps 是一个软件开发实践或一个软件开发生命周期software development lifecycle(SDLC),并且它的核心原则是一种文化上的变革 —— 开发人员与非开发人员呼吸着同一片天空的气息,之前手工的事情变得自动化;每个人做着自己擅长的事;同一时间的部署变得更加频繁;吞吐量提升;灵活度增加。 + +虽然拥有正确的软件工具并非实现 DevOps 环境所需的唯一东西,但一些工具却是必要的。最关键的一个便是持续集成和持续部署(CI/CD)。在流水线环境中,拥有不同的构建阶段(例如:DEV、INT、TST、QA、UAT、STG、PROD),手动的工作能实现自动化,开发人员可以实现高质量的代码,灵活而且大量部署。 + +这篇文章描述了一个构建 DevOps 流水线的五步方法,就像下图所展示的那样,使用开源的工具实现。 + +![Complete DevOps pipeline][4] + +闲话少说,让我们开始吧。 + +### 第一步:CI/CD 框架 + +首先你需要的是一个 CI/CD 工具,Jenkins,是一个基于 Java 的 MIT 许可下的开源 CI/CD 工具,它是推广 DevOps 运动的工具,并已成为了事实标准de facto standard。 + +所以,什么是 Jenkins?想象它是一种神奇的万能遥控,能够和许多不同的服务器和工具打交道,并且能够将它们统一安排起来。就本身而言,像 Jenkins 这样的 CI/CD 工具本身是没有用的,但随着接入不同的工具与服务器时会变得非常强大。 + +Jenkins 仅是众多构建 DevOps 流水线的开源 CI/CD 工具之一。 + +名称 | 许可证 +---|--- +[Jenkins][5] | Creative Commons 和 MIT +[Travis CI][6] | MIT +[CruiseControl][7] | BSD +[Buildbot][8] | GPL +[Apache Gump][9] | Apache 2.0 +[Cabie][10] | GNU + +下面就是使用 CI/CD 工具时 DevOps 看起来的样子。 + +![CI/CD tool][11] + +你的 CI/CD 工具在本地主机上运行,但目前你还不能够做些别的。让我们紧随 DevOps 之旅的脚步。 + +### 第二步:源代码控制管理 + +验证 CI/CD 工具可以执行某些魔术的最佳(也可能是最简单)方法是与源代码控制管理(SCM)工具集成。为什么需要源代码控制?假设你在开发一个应用。无论你什么时候构建应用,无论你使用的是 Java、Python、C++、Go、Ruby、JavaScript 或任意一种语言,你都在编程。你所编写的程序代码称为源代码。在一开始,特别是只有你一个人工作时,将所有的东西放进本地文件夹里或许都是可以的。但是当项目变得庞大并且邀请其他人协作后,你就需要一种方式来避免共享代码修改时的合并冲突。你也需要一种方式来恢复一个之前的版本——备份、复制并粘贴的方式已经过时了。你(和你的团队)想要更好的解决方式。 + +这就是 SCM 变得不可或缺的原因。SCM 工具通过在仓库中保存代码来帮助进行版本控制与多人协作。 + +尽管这里有许多 SCM 工具,但 Git 是最标准恰当的。我极力推荐使用 Git,但如果你喜欢这里仍有其他的开源工具。 + +名称 | 许可证 +---|--- +[Git][12] | GPLv2 & LGPL v2.1 +[Subversion][13] | Apache 2.0 +[Concurrent Versions System][14] (CVS) | GNU +[Vesta][15] | LGPL +[Mercurial][16] | GNU GPL v2+ + +拥有 SCM 之后,DevOps 流水线看起来就像这样。 + +![Source control management][17] + +CI/CD 工具能够自动化进行源代码检入检出以及完成成员之间的协作。还不错吧?但是,如何才能把它变成可工作的应用程序,使得数十亿人来使用并欣赏它呢? + +### 第三步:自动化构建工具 + +真棒!现在你可以检出代码并将修改提交到源代码控制,并且可以邀请你的朋友就源代码控制进行协作。但是到目前为止你还没有构建出应用。要想让它成为一个网页应用,必须将其编译并打包成可部署的包或可执行程序(注意,像 JavaScript 或 PHP 这样的解释型编程语言不需要进行编译)。 + +于是就引出了自动化构建工具。无论你决定使用哪一款构建工具,它们都有一个共同的目标:将源代码构建成某种想要的格式,并且将清理、编译、测试、部署到某个位置这些任务自动化。构建工具会根据你的编程语言而有不同,但这里有一些通常使用的开源工具值得考虑。 + +名称 | 许可证 | 编程语言 +---|---|--- +[Maven][18] | Apache 2.0 | Java +[Ant][19] | Apache 2.0 | Java +[Gradle][20] | Apache 2.0 | Java +[Bazel][21] | Apache 2.0 | Java +[Make][22] | GNU | N/A +[Grunt][23] | MIT | JavaScript +[Gulp][24] | MIT | JavaScript +[Buildr][25] | Apache | Ruby +[Rake][26] | MIT | Ruby +[A-A-P][27] | GNU | Python +[SCons][28] | MIT | Python +[BitBake][29] | GPLv2 | Python +[Cake][30] | MIT | C# +[ASDF][31] | Expat (MIT) | LISP +[Cabal][32] | BSD | Haskell + +太棒了!现在你可以将自动化构建工具的配置文件放进源代码控制管理系统中,并让你的 CI/CD 工具构建它。 + +![Build automation tool][33] + +一切都如此美好,对吧?但是在哪里部署它呢? + +### 第四步:网页应用服务器 + +到目前为止,你有了一个可执行或可部署的打包文件。对任何真正有用的应用程序来说,它必须提供某种服务或者接口,所以你需要一个容器来发布你的应用。 + +对于网页应用,网页应用服务器就是容器。应用程序服务器提供了环境,让可部署包中的编程逻辑能够被检测到、呈现界面,并通过打开套接字为外部世界提供网页服务。在其他环境下你也需要一个 HTTP 服务器(比如虚拟机)来安装服务应用。现在,我假设你将会自己学习这些东西(尽管我会在下面讨论容器)。 + +这里有许多开源的网页应用服务器。 + +名称 | 协议 | 编程语言 +---|---|--- +[Tomcat][34] | Apache 2.0 | Java +[Jetty][35] | Apache 2.0 | Java +[WildFly][36] | GNU Lesser Public | Java +[GlassFish][37] | CDDL & GNU Less Public | Java +[Django][38] | 3-Clause BSD | Python +[Tornado][39] | Apache 2.0 | Python +[Gunicorn][40] | MIT | Python +[Python Paste][41] | MIT | Python +[Rails][42] | MIT | Ruby +[Node.js][43] | MIT | Javascript + +现在 DevOps 流水线差不多能用了,干得好! + +![Web application server][44] + +尽管你可以在这里停下来并进行进一步的集成,但是代码质量对于应用开发者来说是一件非常重要的事情。 + +### 第五步:代码覆盖测试 + +实现代码测试件可能是另一个麻烦的需求,但是开发者需要尽早地捕捉程序中的所有错误并提升代码质量来保证最终用户满意度。幸运的是,这里有许多开源工具来测试你的代码并提出改善质量的建议。甚至更好的,大部分 CI/CD 工具能够集成这些工具并将测试过程自动化进行。 + +代码测试分为两个部分:“代码测试框架”帮助进行编写与运行测试,“代码质量改进工具”帮助提升代码的质量。 + +#### 代码测试框架 + +名称 | 许可证 | 编程语言 +---|---|--- +[JUnit][45] | Eclipse Public License | Java +[EasyMock][46] | Apache | Java +[Mockito][47] | MIT | Java +[PowerMock][48] | Apache 2.0 | Java +[Pytest][49] | MIT | Python +[Hypothesis][50] | Mozilla | Python +[Tox][51] | MIT | Python + +#### 代码质量改进工具 + +名称 | 许可证 | 编程语言 +---|---|--- +[Cobertura][52] | GNU | Java +[CodeCover][53] | Eclipse Public (EPL) | Java +[Coverage.py][54] | Apache 2.0 | Python +[Emma][55] | Common Public License | Java +[JaCoCo][56] | Eclipse Public License | Java +[Hypothesis][50] | Mozilla | Python +[Tox][51] | MIT | Python +[Jasmine][57] | MIT | JavaScript +[Karma][58] | MIT | JavaScript +[Mocha][59] | MIT | JavaScript +[Jest][60] | MIT | JavaScript + +注意,之前提到的大多数工具和框架都是为 Java、Python、JavaScript 写的,因为 C++ 和 C# 是专有编程语言(尽管 GCC 是开源的)。 + +现在你已经运用了代码覆盖测试工具,你的 DevOps 流水线应该就像教程开始那幅图中展示的那样了。 + +### 可选步骤 + +#### 容器 + +正如我之前所说,你可以在虚拟机(VM)或服务器上发布你的应用,但是容器是一个更好的解决方法。 + +[什么是容器][61]?简要的介绍就是 VM 需要占用操作系统大量的资源,它提升了应用程序的大小,而容器仅仅需要一些库和配置来运行应用程序。显然,VM 仍有重要的用途,但容器对于发布应用(包括应用程序服务器)来说是一个更为轻量的解决方式。 + +尽管对于容器来说也有其他的选择,但是 Docker 和 Kubernetes 更为广泛。 + +名称 | 许可证 +---|--- +[Docker][62] | Apache 2.0 +[Kubernetes][63] | Apache 2.0 + +了解更多信息,请查看 [Opensource.com][64] 上关于 Docker 和 Kubernetes 的其它文章: + + * [什么是 Docker?][65] + * [Docker 简介][66] + * [什么是 Kubernetes?][67] + * [从零开始的 Kubernetes 实践][68] + +#### 中间件自动化工具 + +我们的 DevOps 流水线大部分集中在协作构建与部署应用上,但你也可以用 DevOps 工具完成许多其他的事情。其中之一便是利用它实现基础设施管理Infrastructure as Code(IaC)工具,这也是熟知的中间件自动化工具。这些工具帮助完成中间件的自动化安装、管理和其他任务。例如,自动化工具可以用正确的配置下拉应用程序,例如网页服务器、数据库和监控工具,并且部署它们到应用服务器上。 + +这里有几个开源的中间件自动化工具值得考虑: + +名称 | 许可证 +---|--- +[Ansible][69] | GNU Public +[SaltStack][70] | Apache 2.0 +[Chef][71] | Apache 2.0 +[Puppet][72] | Apache or GPL + +获取更多中间件自动化工具,查看 [Opensource.com][64] 上的其它文章: + + * [Ansible 快速入门指南][73] + * [Ansible 自动化部署策略][74] + * [配置管理工具 Top 5][75] + +### 之后的发展 + +这只是一个完整 DevOps 流水线的冰山一角。从 CI/CD 工具开始并且探索其他可以自动化的东西来使你的团队更加轻松的工作。并且,寻找[开源通讯工具][76]可以帮助你的团队一起工作的更好。 + +发现更多见解,这里有一些非常棒的文章来介绍 DevOps : + + * [什么是 DevOps][77] + * [掌握 5 件事成为 DevOps 工程师][78] + * [所有人的 DevOps][79] + * [在 DevOps 中开始使用预测分析][80] + +使用开源 agile 工具来集成 DevOps 也是一个很好的主意: + + * [什么是 agile ?][81] + * [4 步成为一个了不起的 agile 开发者][82] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/devops-pipeline + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[LuMing](https://github.com/LuuMing) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) +[2]: https://www.amazon.com/dp/B078Y98RG8/ +[3]: https://en.wikipedia.org/wiki/Pareto_principle +[4]: https://opensource.com/sites/default/files/uploads/1_finaldevopspipeline.jpg (Complete DevOps pipeline) +[5]: https://github.com/jenkinsci/jenkins +[6]: https://github.com/travis-ci/travis-ci +[7]: http://cruisecontrol.sourceforge.net +[8]: https://github.com/buildbot/buildbot +[9]: https://gump.apache.org +[10]: http://cabie.tigris.org +[11]: https://opensource.com/sites/default/files/uploads/2_runningjenkins.jpg (CI/CD tool) +[12]: https://git-scm.com +[13]: https://subversion.apache.org +[14]: http://savannah.nongnu.org/projects/cvs +[15]: http://www.vestasys.org +[16]: https://www.mercurial-scm.org +[17]: https://opensource.com/sites/default/files/uploads/3_sourcecontrolmanagement.jpg (Source control management) +[18]: https://maven.apache.org +[19]: https://ant.apache.org +[20]: https://gradle.org/ +[21]: https://bazel.build +[22]: https://www.gnu.org/software/make +[23]: https://gruntjs.com +[24]: https://gulpjs.com +[25]: http://buildr.apache.org +[26]: https://github.com/ruby/rake +[27]: http://www.a-a-p.org +[28]: https://www.scons.org +[29]: https://www.yoctoproject.org/software-item/bitbake +[30]: https://github.com/cake-build/cake +[31]: https://common-lisp.net/project/asdf +[32]: https://www.haskell.org/cabal +[33]: https://opensource.com/sites/default/files/uploads/4_buildtools.jpg (Build automation tool) +[34]: https://tomcat.apache.org +[35]: https://www.eclipse.org/jetty/ +[36]: http://wildfly.org +[37]: https://javaee.github.io/glassfish +[38]: https://www.djangoproject.com/ +[39]: http://www.tornadoweb.org/en/stable +[40]: https://gunicorn.org +[41]: https://github.com/cdent/paste +[42]: https://rubyonrails.org +[43]: https://nodejs.org/en +[44]: https://opensource.com/sites/default/files/uploads/5_applicationserver.jpg (Web application server) +[45]: https://junit.org/junit5 +[46]: http://easymock.org +[47]: https://site.mockito.org +[48]: https://github.com/powermock/powermock +[49]: https://docs.pytest.org +[50]: https://hypothesis.works +[51]: https://github.com/tox-dev/tox +[52]: http://cobertura.github.io/cobertura +[53]: http://codecover.org/ +[54]: https://github.com/nedbat/coveragepy +[55]: http://emma.sourceforge.net +[56]: https://github.com/jacoco/jacoco +[57]: https://jasmine.github.io +[58]: https://github.com/karma-runner/karma +[59]: https://github.com/mochajs/mocha +[60]: https://jestjs.io +[61]: /resources/what-are-linux-containers +[62]: https://www.docker.com +[63]: https://kubernetes.io +[64]: http://Opensource.com +[65]: https://opensource.com/resources/what-docker +[66]: https://opensource.com/business/15/1/introduction-docker +[67]: https://opensource.com/resources/what-is-kubernetes +[68]: https://opensource.com/article/17/11/kubernetes-lightning-talk +[69]: https://www.ansible.com +[70]: https://www.saltstack.com +[71]: https://www.chef.io +[72]: https://puppet.com +[73]: https://opensource.com/article/19/2/quickstart-guide-ansible +[74]: https://opensource.com/article/19/1/automating-deployment-strategies-ansible +[75]: https://opensource.com/article/18/12/configuration-management-tools +[76]: https://opensource.com/alternatives/slack +[77]: https://opensource.com/resources/devops +[78]: https://opensource.com/article/19/2/master-devops-engineer +[79]: https://opensource.com/article/18/11/how-non-engineer-got-devops +[80]: https://opensource.com/article/19/1/getting-started-predictive-analytics-devops +[81]: https://opensource.com/article/18/10/what-agile +[82]: https://opensource.com/article/19/2/steps-agile-developer diff --git a/published/201909/20190409 Working with variables on Linux.md b/published/201909/20190409 Working with variables on Linux.md new file mode 100644 index 0000000000..f51bf503fa --- /dev/null +++ b/published/201909/20190409 Working with variables on Linux.md @@ -0,0 +1,261 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11344-1.html) +[#]: subject: (Working with variables on Linux) +[#]: via: (https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html#tk.rss_all) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 中使用变量 +====== + +> 变量通常看起来像 `$var` 这样,但它们也有 `$1`、`$*`、`$?` 和 `$$` 这种形式。让我们来看看所有这些 `$` 值可以告诉你什么。 + +![](https://img.linux.net.cn/data/attachment/album/201909/15/105140faf2jzyybubu1d0c.jpg) + +有许多重要的值都存储在 Linux 系统中,我们称为“变量”,但实际上变量有几种类型,并且一些有趣的命令可以帮助你使用它们。在上一篇文章中,我们研究了[环境变量][2]以及它们定义在何处。在本文中,我们来看一看在命令行和脚本中使用的变量。 + +### 用户变量 + +虽然在命令行中设置变量非常容易,但是有一些有趣的技巧。要设置变量,你只需这样做: + +``` +$ myvar=11 +$ myvar2="eleven" +``` + +要显示这些值,只需这样做: + +``` +$ echo $myvar +11 +$ echo $myvar2 +eleven +``` + +你也可以使用这些变量。例如,要递增一个数字变量,使用以下任意一个命令: + +``` +$ myvar=$((myvar+1)) +$ echo $myvar +12 +$ ((myvar=myvar+1)) +$ echo $myvar +13 +$ ((myvar+=1)) +$ echo $myvar +14 +$ ((myvar++)) +$ echo $myvar +15 +$ let "myvar=myvar+1" +$ echo $myvar +16 +$ let "myvar+=1" +$ echo $myvar +17 +$ let "myvar++" +$ echo $myvar +18 +``` + +使用其中的一些,你可以增加一个变量的值。例如: + +``` +$ myvar0=0 +$ ((myvar0++)) +$ echo $myvar0 +1 +$ ((myvar0+=10)) +$ echo $myvar0 +11 +``` + +通过这些选项,你可能会发现它们是容易记忆、使用方便的。 + +你也可以*删除*一个变量 -- 这意味着没有定义它。 + +``` +$ unset myvar +$ echo $myvar +``` + +另一个有趣的选项是,你可以设置一个变量并将其设为**只读**。换句话说,变量一旦设置为只读,它的值就不能改变(除非一些非常复杂的命令行魔法才可以)。这意味着你也不能删除它。 + +``` +$ readonly myvar3=1 +$ echo $myvar3 +1 +$ ((myvar3++)) +-bash: myvar3: readonly variable +$ unset myvar3 +-bash: unset: myvar3: cannot unset: readonly variable +``` + +你可以使用这些设置和递增选项中来赋值和操作脚本中的变量,但也有一些非常有用的*内部变量*可以用于在脚本中。注意,你无法重新赋值或增加它们的值。 + +### 内部变量 + +在脚本中可以使用很多变量来计算参数并显示有关脚本本身的信息。 + +* `$1`、`$2`、`$3` 等表示脚本的第一个、第二个、第三个等参数。 +* `$#` 表示参数的数量。 +* `$*` 表示所有参数。 +* `$0` 表示脚本的名称。 +* `$?` 表示先前运行的命令的返回码(0 代表成功)。 +* `$$` 显示脚本的进程 ID。 +* `$PPID` 显示 shell 的进程 ID(脚本的父进程)。 + +其中一些变量也适用于命令行,但显示相关信息: + +* `$0` 显示你正在使用的 shell 的名称(例如,-bash)。 +* `$$` 显示 shell 的进程 ID。 +* `$PPID` 显示 shell 的父进程的进程 ID(对我来说,是 sshd)。 + +为了查看它们的结果,如果我们将所有这些变量都放入一个脚本中,比如: + +``` +#!/bin/bash + +echo $0 +echo $1 +echo $2 +echo $# +echo $* +echo $? +echo $$ +echo $PPID +``` + +当我们调用这个脚本时,我们会看到如下内容: + +``` +$ tryme one two three +/home/shs/bin/tryme <== 脚本名称 +one <== 第一个参数 +two <== 第二个参数 +3 <== 参数的个数 +one two three <== 所有的参数 +0 <== 上一条 echo 命令的返回码 +10410 <== 脚本的进程 ID +10109 <== 父进程 ID +``` + +如果我们在脚本运行完毕后检查 shell 的进程 ID,我们可以看到它与脚本中显示的 PPID 相匹配: + +``` +$ echo $$ +10109 <== shell 的进程 ID +``` + +当然,比起简单地显示它们的值,更有用的方式是使用它们。我们来看一看它们可能的用处。 + +检查是否已提供参数: + +``` +if [ $# == 0 ]; then + echo "$0 filename" + exit 1 +fi +``` + +检查特定进程是否正在运行: + +``` +ps -ef | grep apache2 > /dev/null +if [ $? != 0 ]; then + echo Apache is not running + exit +fi +``` + +在尝试访问文件之前验证文件是否存在: + +``` +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +fi + +if [ ! -f $2 ]; then + echo "Error: File $2 not found" + exit 2 +else + head -$1 $2 +fi +``` + +在下面的小脚本中,我们检查是否提供了正确数量的参数、第一个参数是否为数字,以及第二个参数代表的文件是否存在。 + +``` +#!/bin/bash + +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +fi + +if [[ $1 != [0-9]* ]]; then + echo "Error: $1 is not numeric" + exit 2 +fi + +if [ ! -f $2 ]; then + echo "Error: File $2 not found" + exit 3 +else + echo top of file + head -$1 $2 +fi +``` + +### 重命名变量 + +在编写复杂的脚本时,为脚本的参数指定名称通常很有用,而不是继续将它们称为 `$1`、`$2` 等。等到第 35 行,阅读你脚本的人可能已经忘了 `$2` 表示什么。如果你将一个重要参数的值赋给 `$filename` 或 `$numlines`,那么他就不容易忘记。 + +``` +#!/bin/bash + +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +else + numlines=$1 + filename=$2 +fi + +if [[ $numlines != [0-9]* ]]; then + echo "Error: $numlines is not numeric" + exit 2 +fi + +if [ ! -f $ filename]; then + echo "Error: File $filename not found" + exit 3 +else + echo top of file + head -$numlines $filename +fi +``` + +当然,这个示例脚本只是运行 `head` 命令来显示文件中的前 x 行,但它的目的是显示如何在脚本中使用内部参数来帮助确保脚本运行良好,或在失败时清晰地知道失败原因。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/04/variable-key-keyboard-100793080-large.jpg +[2]: https://linux.cn/article-10916-1.html +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md b/published/201909/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md new file mode 100644 index 0000000000..5cf9c3e4c9 --- /dev/null +++ b/published/201909/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11404-1.html) +[#]: subject: (Blockchain 2.0 – What Is Ethereum [Part 9]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/) +[#]: author: (editor https://www.ostechnix.com/author/editor/) + +区块链 2.0 :以太坊(九) +====== + +![Ethereum][1] + +在本系列的上一指南中,我们讨论了 [Hyperledger 项目(HLP)][2],这是一个由 Linux 基金会开发的增长最快的产品。在本指南中,我们将详细讨论什么是“以太坊Ethereum”及其功能。许多研究人员认为,互联网的未来将基于去中心化计算decentralized computing的原理。实际上,去中心化计算是互联网放在首位的更广泛目标之一。但是,由于可用的计算能力不同,互联网发生了转折。尽管现代服务器功能使得服务器端处理和执行成为可能,但在世界上大部分地区缺乏像样的移动网络使得客户端也是如此。现在,现代智能手机具有 SoC(片上系统),在客户端本身上也能够处理许多此类操作,但是,由于安全地检索和存储数据而受到的限制仍然迫使开发人员需要在服务器端进行计算和数据管理。因此,当前可以观察到数据传输能力方面存在瓶颈。 + +由于分布式数据存储和程序执行平台的进步,所有这些可能很快就会改变。[区块链][3]允许在分布式用户网络(而不是中央服务器)上进行安全的数据管理和程序执行,这在互联网历史上基本上是第一次。 + +以太坊就是一个这样的区块链平台,使开发人员可以访问用于在这样的去中心化网络上构建和运行应用程序的框架和工具。尽管它以其加密货币而广为人知,以太坊不只是以太币ether(加密货币)。这是一种完整的图灵完备Turing complete编程语言,旨在开发和部署 DApp(即分布式应用Distributed APPlication) [^1]。我们会在接下来的一篇文章中详细介绍 DApp。 + +以太坊是开源的,默认情况下是一个公共(非许可)区块链,并具有一个大范围的智能合约平台底层(Solidity)。以太坊提供了一个称为“以太坊虚拟机Ethereum virtual machine(EVM)”的虚拟计算环境,以运行应用程序和[智能合约][4] [^2]。以太坊虚拟机运行在世界各地的成千上万个参与节点上,这意味着应用程序数据在保证安全的同时,几乎不可能被篡改或丢失。 + +### 以太坊的背后:什么使之不同 + +在 2017 年,为了推广对以太坊区块链的功能的利用,技术和金融领域的 30 多个团队汇聚一堂。因此,“以太坊企业联盟Ethereum Enterprise Alliance”(EEA)由众多支持成员组成,包括微软、摩根大通、思科、德勤和埃森哲。摩根大通已经拥有 Quorum,这是一个基于以太坊的去中心化金融服务计算平台,目前已经投入运行;而微软拥有基于以太坊的云服务,通过其 Azure 云业务销售 [^3]。 + +### 什么是以太币,它和以太坊有什么关系 + +以太坊的创建者维塔利克·布特林Vitalik Buterin深谙去中心化处理平台的真正价值以及为比特币提供动力的底层区块链技术。他提议比特币应该开发以支持运行分布式应用程序(DApp)和程序(现在称为智能合约)的想法,未能获得多数同意。 + +因此,他在 2013 年发表的白皮书中提出了以太坊的想法。原始白皮书仍然保留,[可供][5]读者阅读。其理念是开发一个基于区块链的平台来运行智能合约和应用程序,这些合约和应用程序设计为在节点和用户设备上运行,而非服务器上运行。 + +以太坊系统经常被误认为就是加密货币以太币,但是,必须重申,以太坊是一个用于开发和执行应用程序的全栈平台,自成立以来一直如此,而比特币则不是。**以太网目前是按市值计算的第二大加密货币**,在撰写本文时,其平均交易价格为每个以太币 170 美元 [^4]。 + +### 该平台的功能和技术特性 [^5] + +* 正如我们已经提到的,称为以太币的加密货币只是该平台功能之一。该系统的目的不仅仅是处理金融交易。 实际上,以太坊平台和比特币之间的主要区别在于它们的脚本能力。以太坊是以图灵完备的编程语言开发的,这意味着它具有类似于其他主要编程语言的脚本编程和应用程序功能。开发人员需要此功能才能在平台上创建 DApp 和复杂的智能合约,而该功能是比特币缺失的。 +* 以太币的“挖矿”过程更加严格和复杂。尽管可以使用专用的 ASIC 来开采比特币,但以太坊使用的基本哈希算法(EThash)降低了 ASIC 在这方面的优势。 +* 为激励矿工和节点运营者运行网络而支付的交易费用本身是使用称为 “燃料Gas”的计算令牌来计算的。通过要求交易的发起者支付与执行交易所需的计算资源数量成比例的以太币,燃料提高了系统的弹性以及对外部黑客和攻击的抵抗力。这与其他平台(例如比特币)相反,在该平台上,交易费用与交易规模一并衡量。因此,以太坊的平均交易成本从根本上低于比特币。这也意味着在以太坊虚拟机上运行的应用程序需要付费,具体取决于应用程序要解决的计算问题。基本上,执行越复杂,费用就越高。 +* 以太坊的出块时间估计约为 10 - 15 秒。出块时间是在区块链网络上打时间戳和创建区块所需的平均时间。与将在比特币网络上进行同样的交易要花费 10 分钟以上的时间相比,很明显,就交易和区块验证而言,以太坊要快得多。 +* *有趣的是,对可开采的以太币数量或开采速度没有硬性限制,这导致其系统设计不像比特币那么激进*。 + +### 总结 + +尽管与以太坊相比,它远远超过了类似的平台,但在以太坊企业联盟开始推动之前,该平台本身尚缺乏明确的发展道路。虽然以太坊平台确实推动了企业发展,但必须注意,以太坊还可以满足小型开发商和个人的需求。 这样一来,为最终用户和企业开发的平台就为以太坊遗漏了许多特定功能。另外,以太坊基金会提出和开发的区块链模型是一种公共模型,而 Hyperledger 项目等项目提出的模型是私有的和需要许可的。 + +虽然只有时间才能证明以太坊、Hyperledger 和 R3 Corda 等平台中,哪一个平台会在现实场景中找到最多粉丝,但此类系统确实证明了以区块链为动力的未来主张背后的有效性。 + +[^1]: [Gabriel Nicholas, “Ethereum Is Coding’s New Wild West | WIRED,” Wired , 2017][6]. +[^2]: [What is Ethereum? — Ethereum Homestead 0.1 documentation][7]. +[^3]: [Ethereum, a Virtual Currency, Enables Transactions That Rival Bitcoin’s – The New York Times][8]. +[^4]: [Cryptocurrency Market Capitalizations | CoinMarketCap][9]. +[^5]: [Introduction — Ethereum Homestead 0.1 documentation][10]. + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ + +作者:[ostechnix][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Ethereum-720x340.png +[2]: https://linux.cn/article-11275-1.html +[3]: https://linux.cn/article-10650-1.html +[4]: https://linux.cn/article-10956-1.html +[5]: https://github.com/ethereum/wiki/wiki/White-Paper +[6]: https://www.wired.com/story/ethereum-is-codings-new-wild-west/ +[7]: http://www.ethdocs.org/en/latest/introduction/what-is-ethereum.html#ethereum-virtual-machine +[8]: https://www.nytimes.com/2016/03/28/business/dealbook/ethereum-a-virtual-currency-enables-transactions-that-rival-bitcoins.html +[9]: https://coinmarketcap.com/ +[10]: http://www.ethdocs.org/en/latest/introduction/index.html diff --git a/published/201909/20190524 Spell Checking Comments.md b/published/201909/20190524 Spell Checking Comments.md new file mode 100644 index 0000000000..d48358c2a9 --- /dev/null +++ b/published/201909/20190524 Spell Checking Comments.md @@ -0,0 +1,40 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11294-1.html) +[#]: subject: (Spell Checking Comments) +[#]: via: (https://emacsredux.com/blog/2019/05/24/spell-checking-comments/) +[#]: author: (Bozhidar Batsov https://emacsredux.com) + +Emacs 注释中的拼写检查 +====== + +我出了名的容易拼错单词(特别是在播客当中)。谢天谢地 Emacs 内置了一个名为 `flyspell` 的超棒模式来帮助像我这样的可怜的打字员。flyspell 会在你输入时突出显示拼错的单词 (也就是实时的) 并提供有用的快捷键来快速修复该错误。 + +大多输入通常会对派生自 `text-mode`(比如 `markdown-mode`,`adoc-mode` )的主模式启用 `flyspell`,但是它对程序员也有所帮助,可以指出他在注释中的错误。所需要的只是启用 `flyspell-prog-mode`。我通常在所有的编程模式中(至少在 `prog-mode` 派生的模式中)都启用它: + +``` +(add-hook 'prog-mode-hook #'flyspell-prog-mode) +``` + +现在当你在注释中输入错误时,就会得到即时反馈了。要修复单词只需要将光标置于单词后,然后按下 `C-c $` (`M-x flyspell-correct-word-before-point`)。(还有许多其他方法可以用 `flyspell` 来纠正拼写错误的单词,但为了简单起见,我们暂时忽略它们。) + +![flyspell_prog_mode.gif][1] + +今天的分享就到这里!我要继续修正这些讨厌的拼写错误了! + +-------------------------------------------------------------------------------- + +via: https://emacsredux.com/blog/2019/05/24/spell-checking-comments/ + +作者:[Bozhidar Batsov][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://emacsredux.com +[b]: https://github.com/lujun9972 +[1]: https://emacsredux.com/assets/images/flyspell_prog_mode.gif diff --git a/published/201909/20190528 A Quick Look at Elvish Shell.md b/published/201909/20190528 A Quick Look at Elvish Shell.md new file mode 100644 index 0000000000..9822423b08 --- /dev/null +++ b/published/201909/20190528 A Quick Look at Elvish Shell.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11393-1.html) +[#]: subject: (A Quick Look at Elvish Shell) +[#]: via: (https://itsfoss.com/elvish-shell/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Elvish Shell 速览 +====== + +每个来到这里的人都会对许多系统中默认 Bash shell 有所了解(无论多少)。过去这些年已经有一些新的 shell 出现来解决 Bash 中的一些缺点。Elvish 就是其中之一,我们将在今天讨论它。 + +### 什么是 Elvish Shell? + +![Pipelines In Elvish][1] + +[Elvish][2] 不仅仅是一个 shell。它[也是][3]“一种表达性编程语言”。它有许多有趣的特性,包括: + +* 它是由 Go 语言编写的 +* 内置文件管理器,灵感来自 [Ranger 文件管理器][4](`Ctrl + N`) +* 可搜索的命令历史记录(`Ctrl + R`) +* 访问的目录的历史记录(`Ctrl + L`) +* 支持结构化数据,例如列表、字典和函数的强大的管道 +* 包含“一组标准的控制结构:有 `if` 条件控制、`for` 和 `while` 循环,还有 `try` 的异常处理” +* 通过包管理器支持[第三方模块扩展 Elvish][5] +* BSD 两句版许可证 + +你肯定在喊,“为什么叫 Elvish?”。好吧,根据[他们的网站][6],他们之所以选择当前的名字,是因为: + +> 在 Roguelike 游戏中,精灵制造的物品质量很高。它们通常被称为“精灵物品”。但是之所以选择 “elvish” 是因为它以 “sh” 结尾,这是 Unix shell 的久远传统。这个与 fish 押韵,它是影响 Elvish 哲学的 shell 之一。 + +### 如何安装 Elvish Shell + +Elvish 在几种主流发行版中都有。 + +请注意,该软件还很年轻。最新版本是 0.12。根据该项目的 [GitHub 页面][3]:“尽管还处在 1.0 之前,但它已经适合大多数日常交互使用。” + +![Elvish Control Structures][7] + +#### Debian 和 Ubuntu + +Elvish 包已引入 Debian Buster 和 Ubuntu 17.10。不幸的是,这些包已经过时,你需要使用 [PPA][8] 安装最新版本。你需要使用以下命令: + +``` +sudo add-apt-repository ppa:zhsj/elvish +sudo apt update +sudo apt install elvish +``` + +#### Fedora + +Elvish 在 Fedora 的主仓库中没有。你需要添加 [FZUG 仓库][9]安装 Evlish。为此,你需要使用以下命令: + +``` +sudo dnf config-manager --add-repo=http://repo.fdzh.org/FZUG/FZUG.repol +sudo dnf install elvish +``` + +#### Arch + +Elvish 在 [Arch 用户仓库][10]中可用。 + +我相信你知道该[如何在 Linux 中更改 Shell][11],因此安装后可以切换到 Elvish 来使用它。 + +### 对 Elvish Shell 的想法 + +就个人而言,我没有理由在任何系统上安装 Elvish。我可以通过安装几个小的命令行程序或使用已经安装的程序来获得它的大多数功能。 + +例如,Bash 中已经存在“搜索历史命令”功能,并且效果很好。如果要提高历史命令的能力,我建议安装 [fzf][12]。`fzf` 使用模糊搜索,因此你无需记住要查找的确切命令。`fzf` 还允许你预览和打开文件。 + +我认为 Elvish 作为一种编程语言是不错的,但是我会坚持使用 Bash shell 脚本,直到 Elvish 变得更成熟。 + +你们都有用过 Elvish 么?你认为安装 Elvish 是否值得?你最喜欢的 Bash 替代品是什么?请在下面的评论中告诉我们。 + +如果你发现这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 Reddit 上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/elvish-shell/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/pipelines-in-elvish.png?fit=800%2C421&ssl=1 +[2]: https://elv.sh/ +[3]: https://github.com/elves/elvish +[4]: https://ranger.github.io/ +[5]: https://github.com/elves/awesome-elvish +[6]: https://elv.sh/ref/name.html +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/Elvish-control-structures.png?fit=800%2C425&ssl=1 +[8]: https://launchpad.net/%7Ezhsj/+archive/ubuntu/elvish +[9]: https://github.com/FZUG/repo/wiki/Add-FZUG-Repository +[10]: https://aur.archlinux.org/packages/elvish/ +[11]: https://linuxhandbook.com/change-shell-linux/ +[12]: https://github.com/junegunn/fzf +[13]: http://reddit.com/r/linuxusersgroup diff --git a/published/201909/20190603 How many browser tabs do you usually have open.md b/published/201909/20190603 How many browser tabs do you usually have open.md new file mode 100644 index 0000000000..9366464b0c --- /dev/null +++ b/published/201909/20190603 How many browser tabs do you usually have open.md @@ -0,0 +1,44 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11322-1.html) +[#]: subject: (How many browser tabs do you usually have open?) +[#]: via: (https://opensource.com/article/19/6/how-many-browser-tabs) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst) + +你通常打开多少个浏览器标签页? +====== + +> 外加一些提高浏览器效率的技巧。 + +![Browser of things][1] + +这里有一个别有用心的问题:你通常一次打开多少个浏览器标签页?你是否有多个窗口,每个窗口都有多个标签页?或者你是一个极简主义者,一次只打开两个标签页。另一种选择是将一个 20 个标签页的浏览器窗口移动到另一个屏幕上去,这样在处理特定任务时它就不会碍事了。你的处理方法在工作、个人和移动浏览器之间有什么不同吗?你的浏览器策略是否与你的[工作习惯][2]有关? + +### 4 个提高浏览器效率的技巧 + +1. 了解浏览器快捷键以节省单击。无论你使用 Firefox 还是 Chrome,都有很多快捷键可以让你方便地执行包括切换标签页在内的某些功能。例如,Chrome 可以很方便地打开一个空白的谷歌文档。使用快捷键 `Ctrl + t` 打开一个新标签页,然后键入 `doc.new` 即可。电子表格、幻灯片和表单也可以这样做。 +2. 用书签文件夹组织最频繁的任务。当开始一项特定的任务时,只需打开文件夹中的所有书签 (`Ctrl + 点击`),就可以快速地从列表中勾选它。 +3. 使用正确的浏览器扩展。成千上万的浏览器扩展都声称可以提高工作效率。在安装之前,确定你不是仅仅在屏幕上添加更多的干扰而已。 +4. 使用计时器减少看屏幕的时间。无论你使用的是老式的 egg 定时器还是花哨的浏览器扩展,都没有关系。为了防止眼睛疲劳,执行 20/20/20 规则。每隔 20 分钟,离开屏幕 20 秒,看看 20 英尺以外的东西。 + +参加我们的投票来分享你一次打开多少个浏览器标签。请务必在评论中告诉我们你最喜欢的浏览器技巧。 + +生产力有两个组成部分——做正确的事情和高效地做那些事情…… + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/how-many-browser-tabs + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst +[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://enterprisersproject.com/article/2019/1/5-time-wasting-habits-break-new-year diff --git a/published/201909/20190603 How to stream music with GNOME Internet Radio.md b/published/201909/20190603 How to stream music with GNOME Internet Radio.md new file mode 100644 index 0000000000..3387da566b --- /dev/null +++ b/published/201909/20190603 How to stream music with GNOME Internet Radio.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11325-1.html) +[#]: subject: (How to stream music with GNOME Internet Radio) +[#]: via: (https://opensource.com/article/19/6/gnome-internet-radio) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/r3bl) + +如何使用 GNOME 的 Internet Radio 播放流音乐 +====== + +> 如果你正在寻找一个简单、直观的界面,让你可以播放流媒体,可以尝试一下 GNOME 的 Internet Radio 插件。 + +![](https://img.linux.net.cn/data/attachment/album/201909/10/114049ppzxeug7xx7jm7ko.jpg) + +网络广播是收听世界各地电台节目的好方法。和许多开发人员一样,我喜欢在编写代码时打开电台。你可以使用 [MPlayer][2] 或 [mpv][3] 等终端媒体播放器收听网络广播,我就是这样通过 Linux 命令行收听广播的。但是,如果你喜欢使用图形用户界面 (GUI),你可以尝试一下 [GNOME Internet Radio][4],这是一个用于 GNOME 桌面的漂亮插件。你可以在包管理器中找到它。 + +![GNOME Internet Radio plugin][5] + +使用图形桌面操作系统收听网络广播通常需要启动一个应用程序,比如 [Audacious][6] 或 [Rhythmbox][7]。它们有很好的界面,很多选项,以及很酷的音频可视化工具。但如果你只想要一个简单、直观的界面播放你的流媒体,GNOME Internet Radio 就是你的选择。 + +安装之后,工具栏中会出现一个小图标,你可以在其中进行所有配置和管理。 + +![GNOME Internet Radio icons][8] + +我做的第一件事是进入设置菜单。我启用了以下两个选项:显示标题通知和显示音量调整。 + +![GNOME Internet Radio Settings][9] + +GNOME Internet Radio 包含一些预置的电台,并且很容易添加其他电台。只需点击(“+”)符号即可。你需要输入一个频道名称,它可以是你喜欢的任何内容(包括电台名称)和电台地址。例如,我喜欢听 Synthetic FM。我输入名称(Synthetic FM),以及流地址(https://mediaserv38.live-streams.nl:2199/tunein/syntheticfm.pls)。 + +然后单击流旁边的星号将其添加到菜单中。 + +不管你听什么音乐,不管你选择什么类型,很明显,程序员需要他们的音乐!GNOME Internet Radio 插件使你可以轻松地让你排好喜爱的网络电台。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/gnome-internet-radio + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss/users/r3bl +[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/18/12/linux-toy-mplayer +[3]: https://mpv.io/ +[4]: https://extensions.gnome.org/extension/836/internet-radio/ +[5]: https://opensource.com/sites/default/files/uploads/packagemanager_s.png (GNOME Internet Radio plugin) +[6]: https://audacious-media-player.org/ +[7]: https://help.gnome.org/users/rhythmbox/stable/ +[8]: https://opensource.com/sites/default/files/uploads/titlebaricons.png (GNOME Internet Radio icons) +[9]: https://opensource.com/sites/default/files/uploads/gnomeinternetradio_settings.png (GNOME Internet Radio Settings) diff --git a/published/201909/20190628 How to Install and Use R on Ubuntu.md b/published/201909/20190628 How to Install and Use R on Ubuntu.md new file mode 100644 index 0000000000..787e359848 --- /dev/null +++ b/published/201909/20190628 How to Install and Use R on Ubuntu.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11331-1.html) +[#]: subject: (How to Install and Use R on Ubuntu) +[#]: via: (https://itsfoss.com/install-r-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 上安装和使用 R 语言 +====== + +> 这个教程指导你如何在 Ubuntu 上安装 R 语言。你也将同时学习到如何在 Ubuntu 上用不同方法运行简单的 R 语言程序。 + +[R][1],和 Python 一样,它是在统计计算和图形处理上最常用的编程语言,易于处理数据。随着数据分析、数据可视化、数据科学(机器学习热)的火热化,对于想深入这一领域的人来说,它是一个很好的工具。 + +R 语言的优点是它的语法非常简练,你可以找到它的很多实际使用的教程或指南。 + +本文将介绍包含如何在 Ubuntu 下安装 R 语言,也会介绍在 Linux 下如何运行第一个 R 程序。 + +![][2] + +### 如何在 Ubuntu 上安装 R 语言 + +R 默认在 Ubuntu 的软件库里。用以下命令很容易安装: + +``` +sudo apt install r-base +``` + +请注意这可能会安装一个较老的版本。在我写这篇文字的时候,Ubuntu 提供的是 3.4,但是最新的是3.6。 + +*我建议除非你必须使用最新版本,否则直接使用 Ubuntu 的配套版本。* + +#### 如何在 Ubuntu 上安装最新 3.6 版本的 R 环境 + +如果想安装最新的版本(或特殊情况指定版本),你必须用 [CRAN][3](Comprehensive R Archive Network)。这个是 R 最新版本的镜像列表。 + +如需获取 3.6 的版本,需要添加镜像到你的源索引里。我已经简化其命令如下: + +``` +sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran35/" +``` + +下面你需要添加密钥到服务器中: + +``` +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 +``` + +然后更新服务器信息并安装R环境: + +``` +sudo apt update +sudo apt install r-base +``` + +就这样安装完成。 + +### 如何在 Ubuntu 下使用 R 语言编程 + +R 的用法多样,我将介绍运行多个运行 R 语言的方式。 + +#### R 语言的交互模式 + +安装了 R 语言后,你可以在控制台上直接运行: + +``` +R +``` + +这样会打开交互模式: + +![R Interactive Mode][5] + +R 语言的控制台与 Python 和 Haskell 的交互模式很类似。你可以输入 R 命令做一些基本的数学运算,例如: + +``` +> 20+40 +[1] 60 + +> print ("Hello World!") +[1] "Hello World!" +``` + +你可以测试绘图: + +![R Plotting][6] + +如果想退出可以用 `q()`或按下 `CTRL+c`键。接着你会被提示是否保存工作空间镜像;工作空间是创建变量的环境。 + +#### 用 R 脚本运行程序 + +第二种运行 R 程序的方式是直接在 Linux 命令行下运行。你可以用 `RScript` 执行,它是一个包含 `r-base` 软件包的工具。 + +首先,你需要用你在 [Linux 下常用的编辑器][7]保存 R 程序到文件。文件的扩展名必须是 `.r`。 + +下面是一个打印 “Hello World” 的 R 程序。你可以保存其为 `hello.r`。 + +``` +print("Hello World!") +a <- rnorm(100) +plot(a) +``` + +用下面命令运行 R 程序: + +``` +Rscript hello.r +``` + +你会得到如下输出结果: + +``` +[1] "Hello World!" +``` + +结果将会保存到当前工作目录,文件名为 `Rplots.pdf`: + +![Rplots.pdf][8] + +小提示:`Rscript` 默认不会加载 `methods` 包。确保在脚本中[显式加载][9]它。 + +#### 在 Ubuntu 下用 RStudio 运行 R 语言 + +最常见的 R 环境是 [RStudio][10],这是一个强大的跨平台的开源 IDE。你可以用 deb 文件在 Ubuntu 上安装它。下载 deb 文件的链接如下。你需要向下滚动找到 Ubuntu 下的 DEB 文件。 + +- [下载 Ubuntu 的 Rstudio][12] + +下载了 DEB 文件后,直接点击安装。 + +下载后从菜单搜索启动它。程序主界面会弹出如下: + +![RStudio 主界面][13] + +现在可以看到和 R 命令终端一样的工作台。 + +创建一个文件:点击顶栏 “File” 然后选择 “New File > Rscript”(或 `CTRL+Shift+n`): + +![RStudio 新建文件][15] + +按下 `CTRL+s` 保存文件选择路径和命名: + +![RStudio 保存文件][16] + +这样做了后,点击 “Session > Set Working Directory > To Source File Location” 修改工作目录为你的脚本路径: + +![RStudio 工作目录][17] + +现在一切准备就绪!编写代码然后点击运行。你可以在控制台和图形窗口看到结果: + +![RStudio 运行][18] + +### 结束语 + +这篇文章中展示了如何在 Ubuntu 下使用 R 语言。包含了以下几个方面:R 控制台 —— 可用于测试,Rscript —— 终端达人操作,RStudio —— 你想要的 IDE。 + +无论你正在从事数据科学或只是热爱数据统计,作为一个数据分析的完美工具,R 都是一个比较好的编程装备。 + +你想使用 R 吗?你入门了吗?让我们了解你是如何学习 R 的以及为什么要学习 R! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-r-ubuntu/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.r-project.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/install-r-on-ubuntu.jpg?resize=800%2C450&ssl=1 +[3]: https://cran.r-project.org/ +[4]: https://itsfoss.com/bootable-windows-usb-linux/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_interactive_mode.png?fit=800%2C516&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_plotting.jpg?fit=800%2C434&ssl=1 +[7]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rplots_pdf.png?fit=800%2C539&ssl=1 +[9]: https://www.dummies.com/programming/r/how-to-install-load-and-unload-packages-in-r/ +[10]: https://www.rstudio.com/ +[11]: https://itsfoss.com/install-deb-files-ubuntu/ +[12]: https://www.rstudio.com/products/rstudio/download/#download +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_home.jpg?fit=800%2C603&ssl=1 +[14]: https://itsfoss.com/python-setup-linux/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_new_file.png?fit=800%2C392&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_save_file.png?fit=800%2C258&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_working_directory.png?fit=800%2C394&ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_run.jpg?fit=800%2C626&ssl=1 +[19]: https://i1.wp.com/images-na.ssl-images-amazon.com/images/I/51oIJTbUlnL._SL160_.jpg?ssl=1 +[20]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Learn R in a Day) +[21]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Buy on Amazon) + diff --git a/published/201909/20190701 Get modular with Python functions.md b/published/201909/20190701 Get modular with Python functions.md new file mode 100644 index 0000000000..37124c8e2b --- /dev/null +++ b/published/201909/20190701 Get modular with Python functions.md @@ -0,0 +1,322 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11295-1.html) +[#]: subject: (Get modular with Python functions) +[#]: via: (https://opensource.com/article/19/7/get-modular-python-functions) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins) + +使用 Python 函数进行模块化 +====== + +> 使用 Python 函数来最大程度地减少重复任务编码工作量。 + +![](https://img.linux.net.cn/data/attachment/album/201909/01/234309ja7ooanopazo3o2m.jpg) + +你是否对函数、类、方法、库和模块等花哨的编程术语感到困惑?你是否在与变量作用域斗争?无论你是自学成才的还是经过正式培训的程序员,代码的模块化都会令人困惑。但是类和库鼓励模块化代码,因为模块化代码意味着只需构建一个多用途代码块集合,就可以在许多项目中使用它们来减少编码工作量。换句话说,如果你按照本文对 [Python][2] 函数的研究,你将找到更聪明的工作方法,这意味着更少的工作。 + +本文假定你对 Python 很熟(LCTT 译注:稍微熟悉就可以),并且可以编写和运行一个简单的脚本。如果你还没有使用过 Python,请首先阅读我的文章:[Python 简介][3]。 + +### 函数 + +函数是迈向模块化过程中重要的一步,因为它们是形式化的重复方法。如果在你的程序中,有一个任务需要反复执行,那么你可以将代码放入一个函数中,根据需要随时调用该函数。这样,你只需编写一次代码,就可以随意使用它。 + +以下一个简单函数的示例: + +``` +#!/usr/bin/env python3 +import time + +def Timer(): +    print("Time is " + str(time.time() )) +``` + +创建一个名为 `mymodularity` 的目录,并将以上函数代码保存为该目录下的 `timestamp.py`。 + +除了这个函数,在 `mymodularity` 目录中创建一个名为 `__init__.py` 的文件,你可以在文件管理器或 bash shell 中执行此操作: + +``` +$ touch mymodularity/__init__.py +``` + +现在,你已经创建了属于你自己的 Python 库(Python 中称为“模块”),名为 `mymodularity`。它不是一个特别有用的模块,因为它所做的只是导入 `time` 模块并打印一个时间戳,但这只是一个开始。 + +要使用你的函数,像对待任何其他 Python 模块一样对待它。以下是一个小应用,它使用你的 `mymodularity` 软件包来测试 Python `sleep()` 函数的准确性。将此文件保存为 `sleeptest.py`,注意要在 `mymodularity` 文件夹 *之外*,因为如果你将它保存在 `mymodularity` *里面*,那么它将成为你的包中的一个模块,你肯定不希望这样。 + +``` +#!/usr/bin/env python3 + +import time +from mymodularity import timestamp + +print("Testing Python sleep()...") + +# modularity +timestamp.Timer() +time.sleep(3) +timestamp.Timer() +``` + +在这个简单的脚本中,你从 `mymodularity` 包中调用 `timestamp` 模块两次。从包中导入模块时,通常的语法是从包中导入你所需的模块,然后使用 *模块名称 + 一个点 + 要调用的函数名*(例如 `timestamp.Timer()`)。 + +你调用了两次 `Timer()` 函数,所以如果你的 `timestamp` 模块比这个简单的例子复杂些,那么你将节省大量重复代码。 + +保存文件并运行: + +``` +$ python3 ./sleeptest.py +Testing Python sleep()... +Time is 1560711266.1526039 +Time is 1560711269.1557732 +``` + +根据测试,Python 中的 `sleep` 函数非常准确:在三秒钟等待之后,时间戳成功且正确地增加了 3,在微秒单位上差距很小。 + +Python 库的结构看起来可能令人困惑,但其实它并不是什么魔法。Python *被编程* 为一个包含 Python 代码的目录,并附带一个 `__init__.py` 文件,那么这个目录就会被当作一个包,并且 Python 会首先在当前目录中查找可用模块。这就是为什么语句 `from mymodularity import timestamp` 有效的原因:Python 在当前目录查找名为 `mymodularity` 的目录,然后查找 `timestamp.py` 文件。 + +你在这个例子中所做的功能和以下这个非模块化的版本是一样的: + +``` +#!/usr/bin/env python3 + +import time +from mymodularity import timestamp + +print("Testing Python sleep()...") + +# no modularity +print("Time is " + str(time.time() ) ) +time.sleep(3) +print("Time is " + str(time.time() ) ) +``` + +对于这样一个简单的例子,其实没有必要以这种方式编写测试,但是对于编写自己的模块来说,最佳实践是你的代码是通用的,可以将它重用于其他项目。 + +通过在调用函数时传递信息,可以使代码更通用。例如,假设你想要使用模块来测试的不是 *系统* 的 `sleep` 函数,而是 *用户自己实现* 的 `sleep` 函数,更改 `timestamp` 代码,使它接受一个名为 `msg` 的传入变量,它将是一个字符串,控制每次调用 `timestamp` 时如何显示: + +``` +#!/usr/bin/env python3 + +import time + +# 更新代码 +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +``` + +现在函数比以前更抽象了。它仍会打印时间戳,但是它为用户打印的内容 `msg` 还是未定义的。这意味着你需要在调用函数时定义它。 + +`Timer` 函数接受的 `msg` 参数是随便命名的,你可以使用参数 `m`、`message` 或 `text`,或是任何对你来说有意义的名称。重要的是,当调用 `timestamp.Timer` 函数时,它接收一个文本作为其输入,将接收到的任何内容放入 `msg` 变量中,并使用该变量完成任务。 + +以下是一个测试测试用户正确感知时间流逝能力的新程序: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press the RETURN key. Count to 3, and press RETURN again.") + +input() +timestamp.Timer("Started timer at ") + +print("Count to 3...") + +input() +timestamp.Timer("You slept until ") +``` + +将你的新程序保存为 `response.py`,运行它: + +``` +$ python3 ./response.py +Press the RETURN key. Count to 3, and press RETURN again. + +Started timer at 1560714482.3772075 +Count to 3... + +You slept until 1560714484.1628013 +``` + +### 函数和所需参数 + +新版本的 `timestamp` 模块现在 *需要* 一个 `msg` 参数。这很重要,因为你的第一个应用程序将无法运行,因为它没有将字符串传递给 `timestamp.Timer` 函数: + +``` +$ python3 ./sleeptest.py +Testing Python sleep()... +Traceback (most recent call last): +  File "./sleeptest.py", line 8, in <module> +    timestamp.Timer() +TypeError: Timer() missing 1 required positional argument: 'msg' +``` + +你能修复你的 `sleeptest.py` 应用程序,以便它能够与更新后的模块一起正确运行吗? + +### 变量和函数 + +通过设计,函数限制了变量的范围。换句话说,如果在函数内创建一个变量,那么这个变量 *只* 在这个函数内起作用。如果你尝试在函数外部使用函数内部出现的变量,就会发生错误。 + +下面是对 `response.py` 应用程序的修改,尝试从 `timestamp.Timer()` 函数外部打印 `msg` 变量: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press the RETURN key. Count to 3, and press RETURN again.") + +input() +timestamp.Timer("Started timer at ") + +print("Count to 3...") + +input() +timestamp.Timer("You slept for ") + +print(msg) +``` + +试着运行它,查看错误: + +``` +$ python3 ./response.py +Press the RETURN key. Count to 3, and press RETURN again. + +Started timer at 1560719527.7862902 +Count to 3... + +You slept for 1560719528.135406 +Traceback (most recent call last): +  File "./response.py", line 15, in <module> +    print(msg) +NameError: name 'msg' is not defined +``` + +应用程序返回一个 `NameError` 消息,因为没有定义 `msg`。这看起来令人困惑,因为你编写的代码定义了 `msg`,但你对代码的了解比 Python 更深入。调用函数的代码,不管函数是出现在同一个文件中,还是打包为模块,都不知道函数内部发生了什么。一个函数独立地执行它的计算,并返回你想要它返回的内容。这其中所涉及的任何变量都只是 *本地的*:它们只存在于函数中,并且只存在于函数完成其目的所需时间内。 + +#### Return 语句 + +如果你的应用程序需要函数中特定包含的信息,那么使用 `return` 语句让函数在运行后返回有意义的数据。 + +时间就是金钱,所以修改 `timestamp` 函数,以使其用于一个虚构的收费系统: + +``` +#!/usr/bin/env python3 + +import time + +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +    charge = .02 +    return charge +``` + +现在,`timestamp` 模块每次调用都收费 2 美分,但最重要的是,它返回每次调用时所收取的金额。 + +以下一个如何使用 `return` 语句的演示: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press RETURN for the time (costs 2 cents).") +print("Press Q RETURN to quit.") + +total = 0 + +while True: +    kbd = input() +    if kbd.lower() == "q": +        print("You owe $" + str(total) ) +        exit() +    else: +        charge = timestamp.Timer("Time is ") +        total = total+charge +``` + +在这个示例代码中,变量 `charge` 为 `timestamp.Timer()` 函数的返回,它接收函数返回的任何内容。在本例中,函数返回一个数字,因此使用一个名为 `total` 的新变量来跟踪已经进行了多少更改。当应用程序收到要退出的信号时,它会打印总花费: + +``` +$ python3 ./charge.py +Press RETURN for the time (costs 2 cents). +Press Q RETURN to quit. + +Time is 1560722430.345412 + +Time is 1560722430.933996 + +Time is 1560722434.6027434 + +Time is 1560722438.612629 + +Time is 1560722439.3649364 +q +You owe $0.1 +``` + +#### 内联函数 + +函数不必在单独的文件中创建。如果你只是针对一个任务编写一个简短的脚本,那么在同一个文件中编写函数可能更有意义。唯一的区别是你不必导入自己的模块,但函数的工作方式是一样的。以下是时间测试应用程序的最新迭代: + +``` +#!/usr/bin/env python3 + +import time + +total = 0 + +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +    charge = .02 +    return charge + +print("Press RETURN for the time (costs 2 cents).") +print("Press Q RETURN to quit.") + +while True: +    kbd = input() +    if kbd.lower() == "q": +        print("You owe $" + str(total) ) +        exit() +    else: +        charge = Timer("Time is ") +        total = total+charge +``` + +它没有外部依赖(Python 发行版中包含 `time` 模块),产生与模块化版本相同的结果。它的优点是一切都位于一个文件中,缺点是你不能在其他脚本中使用 `Timer()` 函数,除非你手动复制和粘贴它。 + +#### 全局变量 + +在函数外部创建的变量没有限制作用域,因此它被视为 *全局* 变量。 + +全局变量的一个例子是在 `charge.py` 中用于跟踪当前花费的 `total` 变量。`total` 是在函数之外创建的,因此它绑定到应用程序而不是特定函数。 + +应用程序中的函数可以访问全局变量,但要将变量传入导入的模块,你必须像发送 `msg` 变量一样将变量传入模块。 + +全局变量很方便,因为它们似乎随时随地都可用,但也很难跟踪它们,很难知道哪些变量不再需要了但是仍然在系统内存中停留(尽管 Python 有非常好的垃圾收集机制)。 + +但是,全局变量很重要,因为不是所有的变量都可以是函数或类的本地变量。现在你知道了如何向函数传入变量并获得返回,事情就变得容易了。 + +### 总结 + +你已经学到了很多关于函数的知识,所以开始将它们放入你的脚本中 —— 如果它不是作为单独的模块,那么作为代码块,你不必在一个脚本中编写多次。在本系列的下一篇文章中,我将介绍 Python 类。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/get-modular-python-functions + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm +[2]: https://www.python.org/ +[3]: https://opensource.com/article/17/10/python-10 diff --git a/published/201909/20190705 Learn object-oriented programming with Python.md b/published/201909/20190705 Learn object-oriented programming with Python.md new file mode 100644 index 0000000000..1d2767d601 --- /dev/null +++ b/published/201909/20190705 Learn object-oriented programming with Python.md @@ -0,0 +1,305 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11317-1.html) +[#]: subject: (Learn object-oriented programming with Python) +[#]: via: (https://opensource.com/article/19/7/get-modular-python-classes) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Python 学习面对对象的编程 +====== + +> 使用 Python 类使你的代码变得更加模块化。 + +![](https://img.linux.net.cn/data/attachment/album/201909/08/091142y2bdbboctw7xdbjq.jpg) + +在我上一篇文章中,我解释了如何通过使用函数、创建模块或者两者一起来[使 Python 代码更加模块化][2]。函数对于避免重复多次使用的代码非常有用,而模块可以确保你在不同的项目中复用代码。但是模块化还有另一种方法:类。 + +如果你已经听过面对对象编程object-oriented programming(OOP)这个术语,那么你可能会对类的用途有一些概念。程序员倾向于将类视为一个虚拟对象,有时与物理世界中的某些东西直接相关,有时则作为某种编程概念的表现形式。无论哪种表示,当你想要在程序中为你或程序的其他部分创建“对象”时,你都可以创建一个类来交互。 + +### 没有类的模板 + +假设你正在编写一个以幻想世界为背景的游戏,并且你需要这个应用程序能够涌现出各种坏蛋来给玩家的生活带来一些刺激。了解了很多关于函数的知识后,你可能会认为这听起来像是函数的一个教科书案例:需要经常重复的代码,但是在调用时可以考虑变量而只编写一次。 + +下面一个纯粹基于函数的敌人生成器实现的例子: + +``` +#!/usr/bin/env python3 + +import random + +def enemy(ancestry,gear): + enemy=ancestry + weapon=gear + hp=random.randrange(0,20) + ac=random.randrange(0,20) + return [enemy,weapon,hp,ac] + +def fight(tgt): + print("You take a swing at the " + tgt[0] + ".") + hit=random.randrange(0,20) + if hit > tgt[3]: + print("You hit the " + tgt[0] + " for " + str(hit) + " damage!") + tgt[2] = tgt[2] - hit + else: + print("You missed.") + + +foe=enemy("troll","great axe") +print("You meet a " + foe[0] + " wielding a " + foe[1]) +print("Type the a key and then RETURN to attack.") + +while True: + action=input() + + if action.lower() == "a": + fight(foe) + + if foe[2] < 1: + print("You killed your foe!") + else: + print("The " + foe[0] + " has " + str(foe[2]) + " HP remaining") +``` + +`enemy` 函数创造了一个具有多个属性的敌人,例如谱系、武器、生命值和防御等级。它返回每个属性的列表,表示敌人全部特征。 + +从某种意义上说,这段代码创建了一个对象,即使它还没有使用类。程序员将这个 `enemy` 称为*对象*,因为该函数的结果(本例中是一个包含字符串和整数的列表)表示游戏中一个单独但复杂的*东西*。也就是说,列表中字符串和整数不是任意的:它们一起描述了一个虚拟对象。 + +在编写描述符集合时,你可以使用变量,以便随时使用它们来生成敌人。这有点像模板。 + +在示例代码中,当需要对象的属性时,会检索相应的列表项。例如,要获取敌人的谱系,代码会查询 `foe[0]`,对于生命值,会查询 `foe[2]`,以此类推。 + +这种方法没有什么不妥,代码按预期运行。你可以添加更多不同类型的敌人,创建一个敌人类型列表,并在敌人创建期间从列表中随机选择,等等,它工作得很好。实际上,[Lua][3] 非常有效地利用这个原理来近似了一个面对对象模型。 + +然而,有时候对象不仅仅是属性列表。 + +### 使用对象 + +在 Python 中,一切都是对象。你在 Python 中创建的任何东西都是某个预定义模板的*实例*。甚至基本的字符串和整数都是 Python `type` 类的衍生物。你可以在这个交互式 Python shell 中见证: + +``` +>>> foo=3 +>>> type(foo) + +>>> foo="bar" +>>> type(foo) + +``` + +当一个对象由一个类定义时,它不仅仅是一个属性的集合,Python 类具有各自的函数。从逻辑上讲,这很方便,因为只涉及某个对象类的操作包含在该对象的类中。 + +在示例代码中,`fight` 的代码是主应用程序的功能。这对于一个简单的游戏来说是可行的,但对于一个复杂的游戏来说,世界中不仅仅有玩家和敌人,还可能有城镇居民、牲畜、建筑物、森林等等,它们都不需要使用战斗功能。将战斗代码放在敌人的类中意味着你的代码更有条理,在一个复杂的应用程序中,这是一个重要的优势。 + +此外,每个类都有特权访问自己的本地变量。例如,敌人的生命值,除了某些功能之外,是不会改变的数据。游戏中的随机蝴蝶不应该意外地将敌人的生命值降低到 0。理想情况下,即使没有类,也不会发生这种情况。但是在具有大量活动部件的复杂应用程序中,确保不需要相互交互的部件永远不会发生这种情况,这是一个非常有用的技巧。 + +Python 类也受垃圾收集的影响。当不再使用类的实例时,它将被移出内存。你可能永远不知道这种情况会什么时候发生,但是你往往知道什么时候它不会发生,因为你的应用程序占用了更多的内存,而且运行速度比较慢。将数据集隔离到类中可以帮助 Python 跟踪哪些数据正在使用,哪些不在需要了。 + +### 优雅的 Python + +下面是一个同样简单的战斗游戏,使用了 `Enemy` 类: + +``` +#!/usr/bin/env python3 + +import random + +class Enemy(): + def __init__(self,ancestry,gear): + self.enemy=ancestry + self.weapon=gear + self.hp=random.randrange(10,20) + self.ac=random.randrange(12,20) + self.alive=True + + def fight(self,tgt): + print("You take a swing at the " + self.enemy + ".") + hit=random.randrange(0,20) + + if self.alive and hit > self.ac: + print("You hit the " + self.enemy + " for " + str(hit) + " damage!") + self.hp = self.hp - hit + print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") + else: + print("You missed.") + + if self.hp < 1: + self.alive=False + +# 游戏开始 +foe=Enemy("troll","great axe") +print("You meet a " + foe.enemy + " wielding a " + foe.weapon) + +# 主函数循环 +while True: + + print("Type the a key and then RETURN to attack.") + + action=input() + + if action.lower() == "a": + foe.fight(foe) + + if foe.alive == False: + print("You have won...this time.") + exit() +``` + +这个版本的游戏将敌人作为一个包含相同属性(谱系、武器、生命值和防御)的对象来处理,并添加一个新的属性来衡量敌人时候已被击败,以及一个战斗功能。 + +类的第一个函数是一个特殊的函数,在 Python 中称为 `init` 或初始化的函数。这类似于其他语言中的[构造器][4],它创建了类的一个实例,你可以通过它的属性和调用类时使用的任何变量来识别它(示例代码中的 `foe`)。 + +### Self 和类实例 + +类的函数接受一种你在类之外看不到的新形式的输入:`self`。如果不包含 `self`,那么当你调用类函数时,Python 无法知道要使用的类的*哪个*实例。这就像在一间充满兽人的房间里说:“我要和兽人战斗”,向一个兽人发起。没有人知道你指的是谁,所有兽人就都上来了。 + +![Image of an Orc, CC-BY-SA by Buch on opengameart.org][5] + +*CC-BY-SA by Buch on opengameart.org* + +类中创建的每个属性都以 `self` 符号作为前缀,该符号将变量标识为类的属性。一旦派生出类的实例,就用表示该实例的变量替换掉 `self` 前缀。使用这个技巧,你可以在一间满是兽人的房间里说:“我要和谱系是 orc 的兽人战斗”,这样来挑战一个兽人。当 orc 听到 “gorblar.orc” 时,它就知道你指的是谁(他自己),所以你得到是一场公平的战斗而不是斗殴。在 Python 中: + +``` +gorblar=Enemy("orc","sword") +print("The " + gorblar.enemy + " has " + str(gorblar.hp) + " remaining.") +``` + +通过检索类属性(`gorblar.enemy` 或 `gorblar.hp` 或你需要的任何对象的任何值)而不是查询 `foe[0]`(在函数示例中)或 `gorblar[0]` 来寻找敌人。 + +### 本地变量 + +如果类中的变量没有以 `self` 关键字作为前缀,那么它就是一个局部变量,就像在函数中一样。例如,无论你做什么,你都无法访问 `Enemy.fight` 类之外的 `hit` 变量: + +``` +>>> print(foe.hit) +Traceback (most recent call last): + File "./enclass.py", line 38, in + print(foe.hit) +AttributeError: 'Enemy' object has no attribute 'hit' + +>>> print(foe.fight.hit) +Traceback (most recent call last): + File "./enclass.py", line 38, in + print(foe.fight.hit) +AttributeError: 'function' object has no attribute 'hit' +``` + +`hit` 变量包含在 Enemy 类中,并且只能“存活”到在战斗中发挥作用。 + +### 更模块化 + +本例使用与主应用程序相同的文本文档中的类。在一个复杂的游戏中,我们更容易将每个类看作是自己独立的应用程序。当多个开发人员处理同一个应用程序时,你会看到这一点:一个开发人员负责一个类,另一个开发人员负责主程序,只要他们彼此沟通这个类必须具有什么属性,就可以并行地开发这两个代码块。 + +要使这个示例游戏模块化,可以把它拆分为两个文件:一个用于主应用程序,另一个用于类。如果它是一个更复杂的应用程序,你可能每个类都有一个文件,或每个逻辑类组有一个文件(例如,用于建筑物的文件,用于自然环境的文件,用于敌人或 NPC 的文件等)。 + +将只包含 `Enemy` 类的一个文件保存为 `enemy.py`,将另一个包含其他内容的文件保存为 `main.py`。 + +以下是 `enemy.py`: + +``` +import random + +class Enemy(): + def __init__(self,ancestry,gear): + self.enemy=ancestry + self.weapon=gear + self.hp=random.randrange(10,20) + self.stg=random.randrange(0,20) + self.ac=random.randrange(0,20) + self.alive=True + + def fight(self,tgt): + print("You take a swing at the " + self.enemy + ".") + hit=random.randrange(0,20) + + if self.alive and hit > self.ac: + print("You hit the " + self.enemy + " for " + str(hit) + " damage!") + self.hp = self.hp - hit + print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") + else: + print("You missed.") + + if self.hp < 1: + self.alive=False +``` + +以下是 `main.py`: + +``` +#!/usr/bin/env python3 + +import enemy as en + +# game start +foe=en.Enemy("troll","great axe") +print("You meet a " + foe.enemy + " wielding a " + foe.weapon) + +# main loop +while True: + + print("Type the a key and then RETURN to attack.") + + action=input() + + if action.lower() == "a": + foe.fight(foe) + + if foe.alive == False: + print("You have won...this time.") + exit() +``` + +导入模块 `enemy.py` 使用了一条特别的语句,引用类文件名称而不用带有 `.py` 扩展名,后跟你选择的命名空间指示符(例如,`import enemy as en`)。这个指示符是在你调用类时在代码中使用的。你需要在导入时添加指示符,例如 `en.Enemy`,而不是只使用 `Enemy()`。 + +所有这些文件名都是任意的,尽管在原则上不要使用罕见的名称。将应用程序的中心命名为 `main.py` 是一个常见约定,和一个充满类的文件通常以小写形式命名,其中的类都以大写字母开头。是否遵循这些约定不会影响应用程序的运行方式,但它确实使经验丰富的 Python 程序员更容易快速理解应用程序的工作方式。 + +在如何构建代码方面有一些灵活性。例如,使用该示例代码,两个文件必须位于同一目录中。如果你只想将类打包为模块,那么必须创建一个名为 `mybad` 的目录,并将你的类移入其中。在 `main.py` 中,你的 `import` 语句稍有变化: + +``` +from mybad import enemy as en +``` + +两种方法都会产生相同的结果,但如果你创建的类足够通用,你认为其他开发人员可以在他们的项目中使用它们,那么后者更好。 + +无论你选择哪种方式,都可以启动游戏的模块化版本: + +``` +$ python3 ./main.py +You meet a troll wielding a great axe +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You missed. +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You hit the troll for 8 damage! +The troll has 4 HP remaining +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You hit the troll for 11 damage! +The troll has -7 HP remaining +You have won...this time. +``` + +游戏启动了,它现在更加模块化了。现在你知道了面对对象的应用程序意味着什么,但最重要的是,当你向兽人发起决斗的时候,你知道是哪一个。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/get-modular-python-classes + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) +[2]: https://linux.cn/article-11295-1.html +[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi +[4]: https://opensource.com/article/19/6/what-java-constructor +[5]: https://opensource.com/sites/default/files/images/orc-buch-opengameart_cc-by-sa.jpg (CC-BY-SA by Buch on opengameart.org) diff --git a/published/201909/20190730 How to manage logs in Linux.md b/published/201909/20190730 How to manage logs in Linux.md new file mode 100644 index 0000000000..b3d448a305 --- /dev/null +++ b/published/201909/20190730 How to manage logs in Linux.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11336-1.html) +[#]: subject: (How to manage logs in Linux) +[#]: via: (https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 中管理日志 +====== + +> Linux 系统上的日志文件包含了**很多**信息——比你有时间查看的还要多。以下是一些建议,告诉你如何正确的使用它们……而不是淹没在其中。 + +![Greg Lobinski \(CC BY 2.0\)][1] + +在 Linux 系统上管理日志文件可能非常容易,也可能非常痛苦。这完全取决于你所认为的日志管理是什么。 + +如果你认为是如何确保日志文件不会耗尽你的 Linux 服务器上的所有磁盘空间,那么这个问题通常很简单。Linux 系统上的日志文件会自动翻转,系统将只维护固定数量的翻转日志。即便如此,一眼看去一组上百个文件可能会让人不知所措。在这篇文章中,我们将看看日志轮换是如何工作的,以及一些最相关的日志文件。 + +### 自动日志轮换 + +日志文件是经常轮转的。当前的日志会获得稍微不同的文件名,并建立一个新的日志文件。以系统日志文件为例。对于许多正常的系统 messages 文件来说,这个文件是一个包罗万象的东西。如果你 `cd` 转到 `/var/log` 并查看一下,你可能会看到一系列系统日志文件,如下所示: + +``` +$ ls -l syslog* +-rw-r----- 1 syslog adm 28996 Jul 30 07:40 syslog +-rw-r----- 1 syslog adm 71212 Jul 30 00:00 syslog.1 +-rw-r----- 1 syslog adm 5449 Jul 29 00:00 syslog.2.gz +-rw-r----- 1 syslog adm 6152 Jul 28 00:00 syslog.3.gz +-rw-r----- 1 syslog adm 7031 Jul 27 00:00 syslog.4.gz +-rw-r----- 1 syslog adm 5602 Jul 26 00:00 syslog.5.gz +-rw-r----- 1 syslog adm 5995 Jul 25 00:00 syslog.6.gz +-rw-r----- 1 syslog adm 32924 Jul 24 00:00 syslog.7.gz +``` + +轮换发生在每天午夜,旧的日志文件会保留一周,然后删除最早的系统日志文件。`syslog.7.gz` 文件将被从系统中删除,`syslog.6.gz` 将被重命名为 `syslog.7.gz`。日志文件的其余部分将依次改名,直到 `syslog` 变成 `syslog.1` 并创建一个新的 `syslog` 文件。有些系统日志文件会比其他文件大,但是一般来说,没有一个文件可能会变得非常大,并且你永远不会看到超过八个的文件。这给了你一个多星期的时间来回顾它们收集的任何数据。 + +某种特定日志文件维护的文件数量取决于日志文件本身。有些文件可能有 13 个。请注意 `syslog` 和 `dpkg` 的旧文件是如何压缩以节省空间的。这里的考虑是你对最近的日志最感兴趣,而更旧的日志可以根据需要用 `gunzip` 解压。 + +``` +# ls -t dpkg* +dpkg.log dpkg.log.3.gz dpkg.log.6.gz dpkg.log.9.gz dpkg.log.12.gz +dpkg.log.1 dpkg.log.4.gz dpkg.log.7.gz dpkg.log.10.gz +dpkg.log.2.gz dpkg.log.5.gz dpkg.log.8.gz dpkg.log.11.gz +``` + +日志文件可以根据时间和大小进行轮换。检查日志文件时请记住这一点。 + +尽管默认值适用于大多数 Linux 系统管理员,但如果你愿意,可以对日志文件轮换进行不同的配置。查看这些文件,如 `/etc/rsyslog.conf` 和 `/etc/logrotate.conf`。 + +### 使用日志文件 + +对日志文件的管理也包括时不时的使用它们。使用日志文件的第一步可能包括:习惯每个日志文件可以告诉你有关系统如何工作以及系统可能会遇到哪些问题。从头到尾读取日志文件几乎不是一个好的选择,但是当你想了解你的系统运行的情况或者需要跟踪一个问题时,知道如何从日志文件中获取信息会是有很大的好处。这也表明你对每个文件中存储的信息有一个大致的了解了。例如: + +``` +$ who wtmp | tail -10 显示最近的登录信息 +$ who wtmp | grep shark 显示特定用户的最近登录信息 +$ grep "sudo:" auth.log 查看谁在使用 sudo +$ tail dmesg 查看(最近的)内核日志 +$ tail dpkg.log 查看最近安装和更新的软件包 +$ more ufw.log 查看防火墙活动(假如你使用 ufw) +``` + +你运行的一些命令也会从日志文件中提取信息。例如,如果你想查看系统重新启动的列表,可以使用如下命令: + +``` +$ last reboot +reboot system boot 5.0.0-20-generic Tue Jul 16 13:19 still running +reboot system boot 5.0.0-15-generic Sat May 18 17:26 - 15:19 (21+21:52) +reboot system boot 5.0.0-13-generic Mon Apr 29 10:55 - 15:34 (18+04:39) +``` + +### 使用更高级的日志管理器 + +虽然你可以编写脚本来更容易地在日志文件中找到感兴趣的信息,但是你也应该知道有一些非常复杂的工具可用于日志文件分析。一些可以把来自多个来源的信息联系起来,以便更全面地了解你的网络上发生了什么。它们也可以提供实时监控。这些工具,如 [Solarwinds Log & Event Manager][3] 和 [PRTG 网络监视器][4](包括日志监视)浮现在脑海中。 + +还有一些免费工具可以帮助分析日志文件。其中包括: + + * Logwatch — 用于扫描系统日志中感兴趣的日志行的程序 + * Logcheck — 系统日志分析器和报告器 + +在接下来的文章中,我将提供一些关于这些工具的见解和帮助。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [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://images.idgesg.net/images/article/2019/07/logs-100806633-large.jpg +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.esecurityplanet.com/products/solarwinds-log-event-manager-siem.html +[4]: https://www.paessler.com/prtg +[5]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190805 Is your enterprise software committing security malpractice.md b/published/201909/20190805 Is your enterprise software committing security malpractice.md new file mode 100644 index 0000000000..8418098906 --- /dev/null +++ b/published/201909/20190805 Is your enterprise software committing security malpractice.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11305-1.html) +[#]: subject: (Is your enterprise software committing security malpractice?) +[#]: via: (https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +你的企业安全软件是否在背后偷传数据? +====== + +> ExtraHop 发现一些企业安全和分析软件正在“私下回拨”,悄悄地将信息上传到客户网络外的服务器上。 + +![Getty Images][1] + +当这个博客专注于微软的一切事情时,我常常抱怨、反对 Windows 10 的间谍活动方面。嗯,显然,这些跟企业安全、分析和硬件管理工具所做的相比,都不算什么。 + +一家叫做 ExtraHop 的分析公司检查了其客户的网络,并发现客户的安全和分析软件悄悄地将信息上传到客户网络外的服务器上。这家公司上周发布了一份[报告来进行警示][2]。 + +ExtraHop 特意选择不对这四个例子中的企业安全工具进行点名,这些工具在没有警告用户或使用者的情况发送了数据。这家公司的一位发言人通过电子邮件告诉我,“ExtraHop 希望关注报告的这个趋势,我们已经多次观察到了这种令人担心的情况。这个严重的问题需要企业的更多关注,而只是关注几个特定的软件会削弱这个严重的问题需要得到更多关注的观点。” + +### 产品在安全提交传输方面玩忽职守,并且偷偷地传输数据到异地 + +[ExtraHop 的报告][6]中称发现了一系列的产品在偷偷地传输数据回自己的服务器上,包括终端安全软件、医院设备管理软件、监控摄像头、金融机构使用的安全分析软件等。报告中同样指出,这些应用涉嫌违反了欧洲的[通用数据隐私法规(GDPR)][7]。 + +在每个案例里,ExtraHop 都提供了这些软件传输数据到异地的证据,在其中一个案例中,一家公司注意到,大约每隔 30 分钟,一台连接了网络的设备就会发送 UDP 数据包给一个已知的恶意 IP 地址。有问题的是一台某国制造的安全摄像头,这个摄像头正在偷偷联系一个和某国有联系的已知的恶意 IP 地址。 + +该摄像头很可能由其办公室的一名员工出于其个人安全的用途独自设置的,这显示出影子 IT 的缺陷。 + +而对于医院设备的管理工具和金融公司的分析工具,这些工具违反了数据安全法,公司面临着法律风险——即使公司不知道这个事。 + +该医院的医疗设备管理产品应该只使用医院的 WiFi 网络,以此来确保患者的数据隐私和 HIPAA 合规。ExtraHop 注意到管理初始设备部署的工作站正在打开加密的 ssl:443 来连接到供应商自己的云存储服务器,这是一个重要的 HIPAA 违规。 + +ExtraHop 指出,尽管这些例子中可能没有任何恶意活动。但它仍然违反了法律规定,管理员需要密切关注他们的网络,以此来监视异常活动的流量。 + +“要明确的是,我们不知道供应商为什么要把数据偷偷传回自己的服务器。这些公司都是受人尊敬的安全和 IT 供应商,并且很有可能,这些数据是由他们的程序框架设计用于合法目的的,或者是错误配置的结果”,报告中说。 + +### 如何减轻数据外传的安全风险 + +为了解决这种安全方面玩忽职守的问题,ExtraHop 建议公司做下面这五件事: + +* 监视供应商的活动:在你的网络上密切注意供应商的非正常活动,无论他们是活跃供应商、以前的供应商,还是评估后的供应商。 +* 监控出口流量:了解出口流量,尤其是来自域控制器等敏感资产的出口流量。当检测到出口流量时,始终将其与核准的应用程序和服务进行匹配。 +* 跟踪部署:在评估过程中,跟踪软件代理的部署。 +* 理解监管方面的考量因素:了解数据跨越政治、地理边界的监管和合规考量因素。 +* 理解合同协议:跟踪数据的使用是否符合供应商合同上的协议。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/03/cybersecurity_eye-with-binary_face-recognition_abstract-eye-100751589-large.jpg +[2]: https://www.extrahop.com/company/press-releases/2019/extrahop-issues-warning-about-phoning-home/ +[3]: https://www.networkworld.com/article/3254185/internet-of-things/tips-for-securing-iot-on-your-network.html#nww-fsb +[4]: https://www.networkworld.com/article/3269184/10-best-practices-to-minimize-iot-security-vulnerabilities#nww-fsb +[5]: https://www.networkworld.com/newsletters/signup.html#nww-fsb +[6]: https://www.extrahop.com/resources/whitepapers/eh-security-advisory-calling-home-success/ +[7]: https://www.csoonline.com/article/3202771/general-data-protection-regulation-gdpr-requirements-deadlines-and-facts.html +[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[9]: https://www.networkworld.com/article/3269165/internet-of-things/a-corporate-guide-to-addressing-iot-security-concerns.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md b/published/201909/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md new file mode 100644 index 0000000000..20ea79975d --- /dev/null +++ b/published/201909/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11298-1.html) +[#]: subject: (How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina)?) +[#]: via: (https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/) +[#]: author: (2daygeek http://www.2daygeek.com/author/2daygeek/) + +如何升级 Linux Mint 19.1 为 Linux Mint 19.2 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/02/231523na40npunm88z68ka.jpg) + +Linux Mint 19.2 “Tina” 在 2019 年 8 月 2 日发布,它是一个基于 Ubuntu 18.04 LTS (Bionic Beaver) 的长期支持版本。它将被支持到 2023 年。它带来更新的软件和精细的改进和很多新的特色来使你的桌面使用地更舒适。 + +Linux Mint 19.2 特色有 Cinnamon 4.2 、Linux 内核 4.15 和 Ubuntu 18.04 基础软件包。 + +**注意:** 不要忘记备份你的重要数据。如果一些东西出错,在最新的安装后,你可以从备份中恢复数据。 + +备份可以通过 rsnapshot 或 timeshift 完成。 + +Linux Mint 19.2 “Tina” 发布日志可以在下面的链接中找到。 + +* [Linux Mint 19.2 (Tina) 发布日志][1] + +这里有三种方法,能让我们升级为 Linux Mint 19.2 “Tina”。 + + * 使用本地方法升级 Linux Mint 19.2 (Tina) + * 使用 Mintupgrade 实用程序方法升级 Linux Mint 19.2 (Tina) + * 使用 GUI 升级 Linux Mint 19.2 (Tina) + +### 如何从 Linux Mint 19.1 (Tessa) 升级为 Linux Mint 19.2 (Tina)? + +升级 Linux Mint 系统是一项简单轻松的任务。有三种方法可以完成。 + +### 方法-1:使用本地方法升级 Linux Mint 19.2 (Tina) + +这是执行升级 Linux Mint 系统的本地和标准的方法之一。为做到这点,遵循下面的程序步骤。 + +确保你当前 Linux Mint 系统是最新的。使用下面的命令来更新你现在的软件为最新可用版本。 + +#### 步骤-1: + +通过运行下面的命令来刷新存储库索引。 + +``` +$ sudo apt update +``` + +运行下面的命令来在系统上安装可用的更新。 + +``` +$ sudo apt upgrade +``` + +运行下面的命令来在版本中执行可用的次要更新。 + +``` +$ sudo apt full-upgrade +``` + +默认情况下,它将通过上面的命令来移除过时的软件包。但是,我建议你运行下面的命令。 + +``` +$ sudo apt autoremove +$ sudo apt clean +``` + +如果安装一个新的内核,你可能需要重启系统。如果是这样,运行下面的命令。 + +``` +$ sudo shutdown -r now +``` + +最后检查当前安装的版本。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.1 (Tessa) +Release: 19.1 +Codename: Tessa +``` + +#### 步骤-2:更新/修改 /etc/apt/sources.list 文件 + +在重启后,修改 `sources.list` 文件,并从 Linux Mint 19.1 (Tessa) 指向 Linux Mint 19.2 (Tina)。 + +首先,使用 `cp` 命令备份下面的配置文件。 + +``` +$ sudo cp /etc/apt/sources.list /root +$ sudo cp -r /etc/apt/sources.list.d/ /root +``` + +修改 `sources.list` 文件,并指向 Linux Mint 19.2 (Tina)。 + +``` +$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list +$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list.d/* +``` + +通过运行下面的命令来刷新存储库索引。 + +``` +$ sudo apt update +``` + +运行下面的命令来在系统上安装可用的更新。在升级过程中,你可用需要确认服务重启和配置文件替换,因此,只需遵循屏幕上的指令。 + +升级可能花费一些时间,具体依赖于更新的数量和你的网络速度。 + +``` +$ sudo apt upgrade +``` + +运行下面的命令来执行一次完整的系统升级。 + +``` +$ sudo apt full-upgrade +``` + +默认情况下,上面的命令将移除过时的软件包。但是,我建议你再次运行下面的命令。 + +``` +$ sudo apt autoremove +$ sudo apt clean +``` + +最后重启系统来启动 Linux Mint 19.2 (Tina)。 + +``` +$ sudo shutdown -r now +``` + +升级后的 Linux Mint 版本可以通过运行下面的命令验证。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.2 (Tina) +Release: 19.2 +Codename: Tina +``` + +### 方法-2:使用 Mintupgrade 实用程序升级 Linux Mint 19.2 (Tina) + +这是 Mint 官方实用程序,它允许我们对 Linux Mint 系统执行平滑升级。 + +使用下面的命令来安装 mintupgrade 软件包。 + +``` +$ sudo apt install mintupgrade +``` + +确保你已经安装 mintupgrade 软件包的最新版本。 + +``` +$ apt version mintupgrade +``` + +以一个普通用户来运行下面的命令以模拟一次升级,遵循屏幕上的指令。 + +``` +$ mintupgrade check +``` + +使用下面的命令来下载需要的软件包来升级为 Linux Mint 19.2 (Tina) ,遵循屏幕上的指令。 + +``` +$ mintupgrade download +``` + +运行下面的命令来运用升级,最新屏幕上的指令。 + +``` +$ mintupgrade upgrade +``` + +在成功升级后,重启系统,并检查升级后的版本。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.2 (Tina) +Release: 19.2 +Codename: Tina +``` + +### 方法-3:使用 GUI 升级 Linux Mint 19.2 (Tina) + +或者,我们可以通过 GUI 执行升级。 + +#### 步骤-1: + +通过 Timeshift 创建一个系统快照。如果一些东西出错,你可以简单地恢复你的操作系统到它先前状态。 + +#### 步骤-2: + +打开更新管理器,单击刷新按钮来检查 mintupdate 和 mint-upgrade-info 的任何新版本。如果有这些软件包的更新,应用它们。 + +通过单击 “编辑-> 升级到 Linux Mint 19.2 Tina”来启动系统升级。 + +![][3] + +遵循屏幕上的指令。如果被询问是否保留或替换配置文件,选择替换它们。 + +![][4] + +#### 步骤-3: + +在升级完成后,重启你的电脑。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/ + +作者:[2daygeek][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.2daygeek.com/author/2daygeek/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechnews.com/linux-mint-19-2-tina-released-check-what-is-new-feature/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade.png +[4]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade-1.png diff --git a/published/201909/20190812 Cloud-native Java, open source security, and more industry trends.md b/published/201909/20190812 Cloud-native Java, open source security, and more industry trends.md new file mode 100644 index 0000000000..116483d98a --- /dev/null +++ b/published/201909/20190812 Cloud-native Java, open source security, and more industry trends.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11400-1.html) +[#]: subject: (Cloud-native Java, open source security, and more industry trends) +[#]: via: (https://opensource.com/article/19/8/cloud-native-java-and-more) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:云原生 Java、开源安全以及更多行业趋势 +====== + +> 开源社区和行业趋势的每周总览。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为我在具有开源开发模型的企业软件公司担任高级产品营销经理的角色的一部分,我为产品营销人员、经理和其他影响者定期发布有关开源社区,市场和行业趋势的定期更新。 以下是该更新中我和他们最喜欢的五篇文章。 + +### 《为什么现代 web 开发如此复杂?》 + +- [文章地址][2] + +> 现代前端 web 开发带来了一种两极分化的体验:许多人喜欢它,而其他人则鄙视它。 +> +> 我是现代Web开发的忠实拥护者,尽管我将其描述为“魔法”——而魔法也有其优点和缺点……。最近,我一直在向那些只具有粗略的原始 web 开发工作流程的人们讲解“现代 web 开发工作流程”……,但我发现需要解释的内容实在是太多了!甚至笼统的解释最终都会变得冗长。因此,在我努力写下更多解释的过程中,这里是对 web 开发演变的一个长期而笼统的解释的开始…… + +**影响**:足够具体,对前端开发人员非常有用(特别是对新开发人员),且足够简单,解释得足够好,可以帮助非开发人员更好地理解前端开发人员的一些问题。到最后,你将(有点)了解 Javascript 和 WebAPI 之间的区别,以及 2019 年的 Javascript 与 2006 年的 Javascript 有何不同。 + +### 开源 Kubernetes 安全审计 + +- [文章链接][3] + +> 去年,云原生计算基金会(CNCF)开始为其项目执行并开源第三方安全审计,以提高我们生态系统的整体安全性。这个想法是从一些项目开始,并从 CNCF 社区收集了关于这个试点项目是否有用的反馈。第一批经历这个过程的项目是 [CoreDNS][4]、[Envoy][5] 和 [Prometheus][6]。这些首次公开审计发现了从一般漏洞到严重漏洞的安全问题。有了这些结果,CoreDNS、Envoy 和 Prometheus 的项目维护者就能够解决已发现的漏洞,并添加文档来帮助用户。 +> +> 从这些初始审计中得出的主要结论是,公开安全审计是测试开源项目的质量及其漏洞管理过程的一个很好的方法,更重要的是,测试开源项目的安全实践有多大的弹性。特别是 CNCF 的[毕业项目][7],它们被世界上一些最大的公司广泛应用于生产中,它们必须坚持最高级别的安全最佳实践。 + +**影响**:就像 Linux 之于数据中心一样,很多公司都把云计算押宝在 Kubernetes 上。从安全的角度来看,看到其中 4 家公司以确保项目正在做应该做的事情,这激发了人们的信心。共享这项研究表明,开源远远不止是仓库中的代码;它是以一种有益于整个社区而不是少数人利益的方式获取和分享专家意见。 + +### Quarkus——这个轻量级 Java 框架的下一步是什么? + +- [文章链接][8] + +> “容器优先”是什么意思?Quarkus 有哪些优势?0.20.0 版本有什么新功能?未来我们可以期待哪些功能?1.0.0 版什么时候发布?我们对 Quarkus 有很多问题,而 Alex Soto 也很耐心地回答了所有问题。 随着 Quarkus 0.20.0 的发布,我们和 [JAX 伦敦演讲者][9],Java 拥护者和红帽的开发人员体验总监 Alex Soto 进行了接触。他很好地回答了我们关于 Quarkus 的过去、现在和未来的所有问题。看起来我们对这个令人兴奋的轻量级框架有很多期待! + +**影响**:最近有个聪明的人告诉我,Quarkus 有潜力使 Java “可能成为容器和无服务器环境的最佳语言之一”。不禁使我多看了一眼。尽管 Java 是最流行的编程语言之一([如果不是最流行的][10]),但当你听到“云原生”一词时,它可能并不是第一个想到的语言。Quarkus 可以通过让开发人员将他们的经验应用到新的挑战中,从而扩展和提高他们所拥有的技能的价值。 + +### Julia 编程语言:用户批露他们最喜欢和最讨厌它的地方 + +- [文章链接][11] + +> Julia 最受欢迎的技术特性是速度和性能,其次是易用性,而最受欢迎的非技术特性是使用者无需付费即可使用它。 +> +> 用户还报告了他们对该语言最大的不满。排在首位的是附加功能的包不够成熟,或者维护得不够好,无法满足他们的需求。 + +**影响**:Julia 1.0 版本已经发布了一年,并且在一系列相关指标(下载、GitHub 星级等)中取得了令人瞩目的增长。它是一种直接针对我们当前和未来最大挑战(“科学计算、机器学习、数据挖掘、大规模线性代数、分布式和并行计算”)的语言,因此,了解用户对它的感受,就可以间接看到有关这些挑战的应对情况。 + +### 多云数据解读:11 个有趣的统计数据 + +- [文章链接][12] + +> 如果你把我们最近对 [Kubernetes 的有趣数据][13]的深入研究归结最基本的一条,它看起来是这样的:[Kubernetes][14] 的受欢迎程度在可预见的未来将持续下去。 +> +> 剧透警报:当你挖掘有关[多云][15]使用情况的最新数据时,他们告诉你一个类似的描述:使用率正在飙升。 +> +> 这种一致性是有道理的。也许不是每个组织都将使用 Kubernetes 来管理其多云和/或[混合云][16]基础架构,但是两者越来越紧密地联系在一起。即使不这样做,它们都反映了向更分散和异构 IT 环境的普遍转变,以及[云原生开发][17]和其他重叠趋势。 + +**影响**:越来越多地采用“多云战略”的另一种解释是,它们将组织中单独部分未经协商而作出的决策追溯为“战略”,从而使决策合法化。“等等,所以你从谁那里买了几个小时?又从另一个人那里买了几个小时?为什么在会议纪要中没有呢?我想我们现在是一家多云公司!”。当然,我在开玩笑,我敢肯定大多数大公司的协调能力远胜于此,对吗? + +*我希望你喜欢这张上周让我印象深刻的列表,并在下周一回来了解更多的开放源码社区、市场和行业趋势。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/cloud-native-java-and-more + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [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.vrk.dev/2019/07/11/why-is-modern-web-development-so-complicated-a-long-yet-hasty-explanation-part-1/ +[3]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ +[4]: https://coredns.io/2018/03/15/cure53-security-assessment/ +[5]: https://github.com/envoyproxy/envoy/blob/master/docs/SECURITY_AUDIT.pdf +[6]: https://cure53.de/pentest-report_prometheus.pdf +[7]: https://www.cncf.io/projects/ +[8]: https://jaxenter.com/quarkus-whats-next-for-the-lightweight-java-framework-160793.html +[9]: https://jaxlondon.com/cloud-kubernetes-serverless/java-particle-acceleration-using-quarkus/ +[10]: https://opensource.com/article/19/8/possibly%20one%20of%20the%20best%20languages%20for%20containers%20and%20serverless%20environments. +[11]: https://www.zdnet.com/article/julia-programming-language-users-reveal-what-they-love-and-hate-the-most-about-it/#ftag=RSSbaffb68 +[12]: https://enterprisersproject.com/article/2019/8/multi-cloud-statistics +[13]: https://enterprisersproject.com/article/2019/7/kubernetes-statistics-13-compelling +[14]: https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA +[15]: https://www.redhat.com/en/topics/cloud-computing/what-is-multicloud?intcmp=701f2000000tjyaAAA +[16]: https://enterprisersproject.com/hybrid-cloud +[17]: https://enterprisersproject.com/article/2018/10/how-explain-cloud-native-apps-plain-english diff --git a/published/201909/20190812 Why const Doesn-t Make C Code Faster.md b/published/201909/20190812 Why const Doesn-t Make C Code Faster.md new file mode 100644 index 0000000000..852b62f0c7 --- /dev/null +++ b/published/201909/20190812 Why const Doesn-t Make C Code Faster.md @@ -0,0 +1,404 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11339-1.html) +[#]: subject: (Why const Doesn't Make C Code Faster) +[#]: via: (https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +为什么 const 无法让 C 代码跑得更快? +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/14/181535lsrt9t93k1c1n0mt.jpg) + +在几个月前的一篇文章里,我曾说过“[有个一个流行的传言,`const` 有助于编译器优化 C 和 C++ 代码][1]”。我觉得我需要解释一下,尤其是曾经我自己也以为这是显然对的。我将会用一些理论并构造一些例子来论证,然后在一个真实的代码库 `Sqlite` 上做一些实验和基准测试。 + +### 一个简单的测试 + +让我们从一个最简单、最明显的例子开始,以前认为这是一个 `const` 让 C 代码跑得更快的例子。首先,假设我们有如下两个函数声明: + +``` +void func(int *x); +void constFunc(const int *x); +``` + +然后假设我们如下两份代码: + +``` +void byArg(int *x) +{ + printf("%d\n", *x); + func(x); + printf("%d\n", *x); +} + +void constByArg(const int *x) +{ + printf("%d\n", *x); + constFunc(x); + printf("%d\n", *x); +} +``` + +调用 `printf()` 时,CPU 会通过指针从 RAM 中取得 `*x` 的值。很显然,`constByArg()` 会稍微快一点,因为编译器知道 `*x` 是常量,因此不需要在调用 `constFunc()` 之后再次获取它的值。它仅是打印相同的东西。没问题吧?让我们来看下 GCC 在如下编译选项下生成的汇编代码: + +``` +$ gcc -S -Wall -O3 test.c +$ view test.s +``` + +以下是函数 `byArg()` 的完整汇编代码: + +``` +byArg: +.LFB23: + .cfi_startproc + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + movl (%rdi), %edx + movq %rdi, %rbx + leaq .LC0(%rip), %rsi + movl $1, %edi + xorl %eax, %eax + call __printf_chk@PLT + movq %rbx, %rdi + call func@PLT # constFoo 中唯一不同的指令 + movl (%rbx), %edx + leaq .LC0(%rip), %rsi + xorl %eax, %eax + movl $1, %edi + popq %rbx + .cfi_def_cfa_offset 8 + jmp __printf_chk@PLT + .cfi_endproc +``` + +函数 `byArg()` 和函数 `constByArg()` 生成的汇编代码中唯一的不同之处是 `constByArg()` 有一句汇编代码 `call constFunc@PLT`,这正是源代码中的调用。关键字 `const` 本身并没有造成任何字面上的不同。 + +好了,这是 GCC 的结果。或许我们需要一个更聪明的编译器。Clang 会有更好的表现吗? + +``` +$ clang -S -Wall -O3 -emit-llvm test.c +$ view test.ll +``` + +这是 `IR` 代码(LCTT 译注:LLVM 的中间语言)。它比汇编代码更加紧凑,所以我可以把两个函数都导出来,让你可以看清楚我所说的“除了调用外,没有任何字面上的不同”是什么意思: + +``` +; Function Attrs: nounwind uwtable +define dso_local void @byArg(i32*) local_unnamed_addr #0 { + %2 = load i32, i32* %0, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) + tail call void @func(i32* %0) #4 + %4 = load i32, i32* %0, align 4, !tbaa !2 + %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + ret void +} + +; Function Attrs: nounwind uwtable +define dso_local void @constByArg(i32*) local_unnamed_addr #0 { + %2 = load i32, i32* %0, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) + tail call void @constFunc(i32* %0) #4 + %4 = load i32, i32* %0, align 4, !tbaa !2 + %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + ret void +} +``` + +### 某些有作用的东西 + +接下来是一组 `const` 能够真正产生作用的代码: + +``` +void localVar() +{ + int x = 42; + printf("%d\n", x); + constFunc(&x); + printf("%d\n", x); +} + +void constLocalVar() +{ + const int x = 42; // 对本地变量使用 const + printf("%d\n", x); + constFunc(&x); + printf("%d\n", x); +} +``` + +下面是 `localVar()` 的汇编代码,其中有两条指令在 `constLocalVar()` 中会被优化掉: + +``` +localVar: +.LFB25: + .cfi_startproc + subq $24, %rsp + .cfi_def_cfa_offset 32 + movl $42, %edx + movl $1, %edi + movq %fs:40, %rax + movq %rax, 8(%rsp) + xorl %eax, %eax + leaq .LC0(%rip), %rsi + movl $42, 4(%rsp) + call __printf_chk@PLT + leaq 4(%rsp), %rdi + call constFunc@PLT + movl 4(%rsp), %edx # 在 constLocalVar() 中没有 + xorl %eax, %eax + movl $1, %edi + leaq .LC0(%rip), %rsi # 在 constLocalVar() 中没有 + call __printf_chk@PLT + movq 8(%rsp), %rax + xorq %fs:40, %rax + jne .L9 + addq $24, %rsp + .cfi_remember_state + .cfi_def_cfa_offset 8 + ret +.L9: + .cfi_restore_state + call __stack_chk_fail@PLT + .cfi_endproc +``` + +在 LLVM 生成的 `IR` 代码中更明显一点。在 `constLocalVar()` 中,第二次调用 `printf()` 之前的 `load` 会被优化掉: + +``` +; Function Attrs: nounwind uwtable +define dso_local void @localVar() local_unnamed_addr #0 { + %1 = alloca i32, align 4 + %2 = bitcast i32* %1 to i8* + call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #4 + store i32 42, i32* %1, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42) + call void @constFunc(i32* nonnull %1) #4 + %4 = load i32, i32* %1, align 4, !tbaa !2 + %5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #4 + ret void +} +``` + +好吧,现在,`constLocalVar()` 成功的省略了对 `*x` 的重新读取,但是可能你已经注意到一些问题:`localVar()` 和 `constLocalVar()` 在函数体中做了同样的 `constFunc()` 调用。如果编译器能够推断出 `constFunc()` 没有修改 `constLocalVar()` 中的 `*x`,那为什么不能推断出完全一样的函数调用也没有修改 `localVar()` 中的 `*x`? + +这个解释更贴近于为什么 C 语言的 `const` 不能作为优化手段的核心原因。C 语言的 `const` 有两个有效的含义:它可以表示这个变量是某个可能是常数也可能不是常数的数据的一个只读别名,或者它可以表示该变量是真正的常量。如果你移除了一个指向常量的指针的 `const` 属性并写入数据,那结果将是一个未定义行为。另一方面,如果是一个指向非常量值的 `const` 指针,将就没问题。 + +这份 `constFunc()` 的可能实现揭示了这意味着什么: + +``` +// x 是一个指向某个可能是常数也可能不是常数的数据的只读指针 +void constFunc(const int *x) +{ + // local_var 是一个真正的常数 + const int local_var = 42; + + // C 语言规定的未定义行为 + doubleIt((int*)&local_var); + // 谁知道这是不是一个未定义行为呢? + doubleIt((int*)x); +} + +void doubleIt(int *x) +{ + *x *= 2; +} +``` + +`localVar()` 传递给 `constFunc()` 一个指向非 `const` 变量的 `const` 指针。因为这个变量并非常量,`constFunc()` 可以撒个谎并强行修改它而不触发未定义行为。所以,编译器不能断定变量在调用 `constFunc()` 后仍是同样的值。在 `constLocalVar()` 中的变量是真正的常量,因此,编译器可以断定它不会改变 —— 因为在 `constFunc()` 去除变量的 `const` 属性并写入它*将*会是一个未定义行为。 + +第一个例子中的函数 `byArg()` 和 `constByArg()` 是没有可能优化的,因为编译器没有任何方法能知道 `*x` 是否真的是 `const` 常量。 + +> 补充(和题外话):相当多的读者已经正确地指出,使用 `const int *x`,该指针本身不是限定的常量,只是该数据被加个了别名,而 `const int * const extra_const` 是一个“双向”限定为常量的指针。但是因为指针本身的常量与别名数据的常量无关,所以结果是相同的。仅在 `extra_const` 指向使用 `const` 定义的对象时,`*(int*const)extra_const = 0` 才是未定义行为。(实际上,`*(int*)extra_const = 0` 也不会更糟。)因为它们之间的区别可以一句话说明白,一个是完全的 `const` 指针,另外一个可能是也可能不是常量本身的指针,而是一个可能是也可能不是常量的对象的只读别名,我将继续不严谨地引用“常量指针”。(题外话结束) + +但是为什么不一致呢?如果编译器能够推断出 `constLocalVar()` 中调用的 `constFunc()` 不会修改它的参数,那么肯定也能继续在其他 `constFunc()` 的调用上实施相同的优化,是吗?并不。编译器不能假设 `constLocalVar()` 根本没有运行。如果不是这样(例如,它只是代码生成器或者宏的一些未使用的额外输出),`constFunc()` 就能偷偷地修改数据而不触发未定义行为。 + +你可能需要重复阅读几次上述说明和示例,但不要担心,它听起来很荒谬,它确实是正确的。不幸的是,对 `const` 变量进行写入是最糟糕的未定义行为:大多数情况下,编译器无法知道它是否将会是未定义行为。所以,大多数情况下,编译器看见 `const` 时必须假设它未来可能会被移除掉,这意味着编译器不能使用它进行优化。这在实践中是正确的,因为真实的 C 代码会在“深思熟虑”后移除 `const`。 + +简而言之,很多事情都可以阻止编译器使用 `const` 进行优化,包括使用指针从另一内存空间接受数据,或者在堆空间上分配数据。更糟糕的是,在大部分编译器能够使用 `const` 进行优化的情况,它都不是必须的。例如,任何像样的编译器都能推断出下面代码中的 `x` 是一个常量,甚至都不需要 `const`: + +``` +int x = 42, y = 0; +printf("%d %d\n", x, y); +y += x; +printf("%d %d\n", x, y); +``` + +总结,`const` 对优化而言几乎无用,因为: + +1. 除了特殊情况,编译器需要忽略它,因为其他代码可能合法地移除它 +2. 在 #1 以外的大多数例外中,编译器无论如何都能推断出该变量是常量 + +### C++ + +如果你在使用 C++ 那么有另外一个方法让 `const` 能够影响到代码的生成:函数重载。你可以用 `const` 和非 `const` 的参数重载同一个函数,而非 `const` 版本的代码可能可以被优化(由程序员优化而不是编译器),减少某些拷贝或者其他事情。 + +``` +void foo(int *p) +{ + // 需要做更多的数据拷贝 +} + +void foo(const int *p) +{ + // 不需要保护性的拷贝副本 +} + +int main() +{ + const int x = 42; + // const 影响被调用的是哪一个版本的重载函数 + foo(&x); + return 0; +} +``` + +一方面,我不认为这会在实际的 C++ 代码中大量使用。另一方面,为了导致差异,程序员需要假设编译器无法做出,因为它们不受语言保护。 + +### 用 Sqlite3 进行实验 + +有了足够的理论和例子。那么 `const` 在一个真正的代码库中有多大的影响呢?我将会在代码库 `Sqlite`(版本:3.30.0)上做一个测试,因为: + +* 它真正地使用了 `const` +* 它不是一个简单的代码库(超过 20 万行代码) +* 作为一个数据库,它包括了字符串处理、数学计算、日期处理等一系列内容 +* 它能够在绑定 CPU 的情况下进行负载测试 + +此外,作者和贡献者们已经进行了多年的性能优化工作,因此我能确定他们没有错过任何有显著效果的优化。 + +#### 配置 + +我做了两份[源码][2]拷贝,并且正常编译其中一份。而对于另一份拷贝,我插入了这个特殊的预处理代码段,将 `const` 变成一个空操作: + +``` +#define const +``` + +(GNU) `sed` 可以将一些东西添加到每个文件的顶端,比如 `sed -i '1i#define const' *.c *.h`。 + +在编译期间使用脚本生成 `Sqlite` 代码稍微有点复杂。幸运的是当 `const` 代码和非 `const` 代码混合时,编译器会产生了大量的提醒,因此很容易发现它并调整脚本来包含我的反 `const` 代码段。 + +直接比较编译结果毫无意义,因为任意微小的改变就会影响整个内存布局,这可能会改变整个代码中的指针和函数调用。因此,我用每个指令的二进制大小和汇编代码作为识别码(`objdump -d libsqlite3.so.0.8.6`)。举个例子,这个函数: + +``` +000000000005d570 : + 5d570: 4c 8d 05 59 a2 ff ff lea -0x5da7(%rip),%r8 # 577d0 + 5d577: e9 04 fe ff ff jmpq 5d380 + 5d57c: 0f 1f 40 00 nopl 0x0(%rax) +``` + +将会变成这样: + +``` +sqlite3_blob_read 7lea 5jmpq 4nopl +``` + +在编译时,我保留了所有 `Sqlite` 的编译设置。 + +#### 分析编译结果 + +`const` 版本的 `libsqlite3.so` 的大小是 4,740,704 字节,大约比 4,736,712 字节的非 `const` 版本大了 0.1% 。在全部 1374 个导出函数(不包括类似 PLT 里的底层辅助函数)中,一共有 13 个函数的识别码不一致。 + +其中的一些改变是由于插入的预处理代码。举个例子,这里有一个发生了更改的函数(已经删去一些 `Sqlite` 特有的定义): + +``` +#define LARGEST_INT64 (0xffffffff|(((int64_t)0x7fffffff)<<32)) +#define SMALLEST_INT64 (((int64_t)-1) - LARGEST_INT64) + +static int64_t doubleToInt64(double r){ + /* + ** Many compilers we encounter do not define constants for the + ** minimum and maximum 64-bit integers, or they define them + ** inconsistently. And many do not understand the "LL" notation. + ** So we define our own static constants here using nothing + ** larger than a 32-bit integer constant. + */ + static const int64_t maxInt = LARGEST_INT64; + static const int64_t minInt = SMALLEST_INT64; + + if( r<=(double)minInt ){ + return minInt; + }else if( r>=(double)maxInt ){ + return maxInt; + }else{ + return (int64_t)r; + } +} +``` + +删去 `const` 使得这些常量变成了 `static` 变量。我不明白为什么会有不了解 `const` 的人让这些变量加上 `static`。同时删去 `static` 和 `const` 会让 GCC 再次认为它们是常量,而我们将得到同样的编译输出。由于类似这样的局部的 `static const` 变量,使得 13 个函数中有 3 个函数产生假的变化,但我一个都不打算修复它们。 + +`Sqlite` 使用了很多全局变量,而这正是大多数真正的 `const` 优化产生的地方。通常情况下,它们类似于将一个变量比较代替成一个常量比较,或者一个循环在部分展开的一步。([Radare toolkit][3] 可以很方便的找出这些优化措施。)一些变化则令人失望。`sqlite3ParseUri()` 有 487 个指令,但 `const` 产生的唯一区别是进行了这个比较: + +``` +test %al, %al +je +cmp $0x23, %al +je +``` + +并交换了它们的顺序: + +``` +cmp $0x23, %al +je +test %al, %al +je +``` + +#### 基准测试 + +`Sqlite` 自带了一个性能回归测试,因此我尝试每个版本的代码执行一百次,仍然使用默认的 `Sqlite` 编译设置。以秒为单位的测试结果如下: + +| | const | 非 const +---|---|--- +最小值 | 10.658s | 10.803s +中间值 | 11.571s | 11.519s +最大值 | 11.832s | 11.658s +平均值 | 11.531s | 11.492s + +就我个人看来,我没有发现足够的证据来说明这个差异值得关注。我是说,我从整个程序中删去 `const`,所以如果它有明显的差别,那么我希望它是显而易见的。但也许你关心任何微小的差异,因为你正在做一些绝对性能非常重要的事。那让我们试一下统计分析。 + +我喜欢使用类似 Mann-Whitney U 检验这样的东西。它类似于更著名的 T 检验,但对你在机器上计时时产生的复杂随机变量(由于不可预测的上下文切换、页错误等)更加健壮。以下是结果: + +|| const | 非 const| +---|---|--- +N | 100 | 100 +Mean rank | 121.38 | 79.62 + +||| +---|--- +Mann-Whitney U | 2912 +Z | -5.10 +2-sided p value | <10-6 +HL median difference | -0.056s +95% confidence interval | -0.077s – -0.038s + +U 检验已经发现统计意义上具有显著的性能差异。但是,令人惊讶的是,实际上是非 `const` 版本更快——大约 60ms,0.5%。似乎 `const` 启用的少量“优化”不值得额外代码的开销。这不像是 `const` 启用了任何类似于自动矢量化的重要的优化。当然,你的结果可能因为编译器配置、编译器版本或者代码库等等而有所不同,但是我觉得这已经说明了 `const` 是否能够有效地提高 `C` 的性能,我们现在已经看到答案了。 + +### 那么,const 有什么用呢? + +尽管存在缺陷,C/C++ 的 `const` 仍有助于类型安全。特别是,结合 C++ 的移动语义和 `std::unique_pointer`,`const` 可以使指针所有权显式化。在超过十万行代码的 C++ 旧代码库里,指针所有权模糊是一个大难题,我对此深有感触。 + +但是,我以前常常使用 `const` 来实现有意义的类型安全。我曾听说过基于性能上的原因,最好是尽可能多地使用 `const`。我曾听说过当性能很重要时,重构代码并添加更多的 `const` 非常重要,即使以降低代码可读性的方式。**当时觉得这没问题,但后来我才知道这并不对。** + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/2019/04/05/d_as_c_replacement.html#const-and-immutable +[2]: https://sqlite.org/src/doc/trunk/README.md +[3]: https://rada.re/r/ diff --git a/published/201909/20190819 Moving files on Linux without mv.md b/published/201909/20190819 Moving files on Linux without mv.md new file mode 100644 index 0000000000..2483018835 --- /dev/null +++ b/published/201909/20190819 Moving files on Linux without mv.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11321-1.html) +[#]: subject: (Moving files on Linux without mv) +[#]: via: (https://opensource.com/article/19/8/moving-files-linux-without-mv) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/seth) + +在不使用 mv 命令的情况下移动文件 +====== + +> 有时当你需要移动一个文件时,mv 命令似乎不是最佳选项,那么你会如何做呢? + +![](https://img.linux.net.cn/data/attachment/album/201909/09/064313e02mvq28he8fk0mu.jpg) + +不起眼的 `mv` 命令是在你见过的每个 POSIX 系统中都能找到的有用工具之一。它的作用是明确定义的,并且做得很好:将文件从文件系统中的一个位置移动到另一个位置。但是 Linux 非常灵活,还有其他移动文件的办法。使用不同的工具可以完美匹配一些特殊用例,这算一个小优势。 + +在远离 `mv` 之前,先看看这个命令的默认结果。首先,创建一个目录并生成一些权限为 777 的文件: + +``` +$ mkdir example +$ touch example/{foo,bar,baz} +$ for i in example/*; do ls /bin > "${i}"; done +$ chmod 777 example/* +``` + +你可能不会这么认为,但是文件在一个[文件系统][2]中作为条目存在,称为索引节点(通常称为 inode),你可以使用 [ls 命令][3]及其 `--inode` 选项查看一个文件占用的 inode: + +``` +$ ls --inode example/foo +7476868 example/foo +``` + +作为测试,将文件从示例目录移动到当前目录,然后查看文件的属性: + +``` +$ mv example/foo . +$ ls -l -G -g --inode +7476868 -rwxrwxrwx. 1 29545 Aug  2 07:28 foo +``` + +如你所见,原始文件及权限已经被“移动”,但它的 inode 没有变化。 + +这就是 `mv` 工具用来移动的方式:保持 inode 不变(除非文件被移动到不同的文件系统),并保留其所有权和权限。 + +其他工具提供了不同的选项。 + +### 复制和删除 + +在某些系统上,移动操作是真的在做移动:比特从文件系统中的某个位置删除并重新分配给另一个位置。这种行为在很大程度上已经失宠。现在,移动操作要么是属性重新分配(inode 现在指向文件组织中的不同位置),要么是复制和删除操作的组合。这种设计的哲学意图是确保在移动失败时,文件不会碎片化。 + +与 `mv` 不同,`cp` 命令会在文件系统中创建一个全新的数据对象,它有一个新的 inode 位置,并取决于 umask。你可以使用 `cp` 和 `rm`(如果有的话,或者 [trash][4] —— LCTT 译注:它是一个命令行回收站工具)命令来模仿 `mv` 命令。 + +``` +$ cp example/foo . +$ ls -l -G -g --inode +7476869 -rwxrwxr-x. 29545 Aug  2 11:58 foo +$ trash example/foo +``` + +示例中的新 `foo` 文件获得了 755 权限,因为此处的 umask 明确排除了写入权限。 + +``` +$ umask +0002 +``` + +有关 umask 的更多信息,阅读 Alex Juarez 这篇关于[文件权限][5]的文章。 + +### 查看和删除 + +与复制和删除类似,使用 [cat][6](或 `tac`)命令在创建“移动”文件时分配不同的权限。假设当前目录中是一个没有 `foo` 的新测试环境: + +``` +$ cat example/foo > foo +$ ls -l -G -g --inode +7476869 -rw-rw-r--. 29545 Aug 8 12:21 foo +$ trash example/foo +``` + +这次,创建了一个没有事先设置权限的新文件,所以文件最终权限完全取决于 umask 设置,它不会阻止用户和组的权限位(无论 umask 是什么,都不会为新文件授予可执行权限),但它会阻止其他人的写入(值为 2)。所以结果是一个权限是 664 的文件。 + +### Rsync + +`rsync` 命令是一个强大的多功能工具,用于在主机和文件系统位置之间发送文件。此命令有许多可用选项,包括使其目标镜像成为源。 + +你可以使用带有 `--remove-source-files` 选项的 `rsync` 复制,然后删除文件,并可以带上你选择执行同步的任何其他选项(常见的通用选项是 `--archive`): + +``` +$ rsync --archive --remove-source-files example/foo . +$ ls example +bar  baz +$ ls -lGgi +7476870 -rwxrwxrwx. 1 seth users 29545 Aug 8 12:23 foo +``` + +在这里,你可以看到保留了文件权限和所有权,只是更新了时间戳,并删除了源文件。 + +警告:不要将此选项与 `--delete` 混淆,后者会从*目标*目录中删除(源目录中不存在的)文件。误用 `--delete` 会清除很多数据,建议你不要使用此选项,除非是在测试环境中。 + +你可以覆盖其中一些默认值,更改权限和修改设置: + +``` +$ rsync --chmod=666 --times \ + --remove-source-files example/foo . +$ ls example +bar  baz +$ ls -lGgi +7476871 -rw-rw-r--. 1 seth users 29545 Aug 8 12:55 foo +``` + +这里,目标的 umask 会生效,因此 `--chmod=666` 选项会产生一个权限为 644 的文件。 + +好处不仅仅是权限,与简单的 `mv` 命令相比,`rsync` 命令有[很多][7]有用的[选项][8](其中最重要的是 `--exclude` 选项,这样你可以在一个大型移动操作中排除某些项目),这使它成为一个更强大的工具。例如,要在移动文件集合时排除所有备份文件: + +``` +$ rsync --chmod=666 --times \ + --exclude '*~' \ + --remove-source-files example/foo . +``` + +### 使用 install 设置权限 + +`install` 命令是一个专门面向开发人员的复制命令,主要是作为软件编译安装例程的一部分调用。它并不为用户所知(我经常想知道为什么它有这么一个直观的名字,而剩下的包管理器却只能使用缩写和昵称),但是 `install` 实际上是一种将文件放在你想要地方的有用方法。 + +`install` 命令有很多选项,包括 `--backup` 和 `--compare` 命令(以避免*更新*文件的新副本)。 + +与 `cp` 和 `cat` 命令不同,但与 `mv` 完全相同,`install` 命令可以在复制文件的同时而保留其时间戳: + +``` +$ install --preserve-timestamp example/foo . +$ ls -l -G -g --inode +7476869 -rwxr-xr-x. 1 29545 Aug  2 07:28 foo +$ trash example/foo +``` + +在这里,文件被复制到一个新的 inode,但它的 mtime(修改时间)没有改变。但权限被设置为 `install` 的默认值 `755`。 + +你可以使用 `install` 来设置文件的权限,所有者和组: + +``` +$ install --preserve-timestamp \ + --owner=skenlon \ + --group=dialout \ + --mode=666 example/foo . +$ ls -li +7476869 -rw-rw-rw-. 1 skenlon dialout 29545 Aug  2 07:28 foo +$ trash example/foo +``` + +### 移动、复制和删除 + +文件包含数据,而真正重要的文件包含*你的*数据。学会聪明地管理它们是很重要的,现在你有了确保以你想要的方式来处理数据的工具包。 + +你是否有不同的数据管理方式?在评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/moving-files-linux-without-mv + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/18/11/partition-format-drive-linux#what-is-a-filesystem +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://gitlab.com/trashy +[5]: https://opensource.com/article/19/8/linux-permissions-101#umask +[6]: https://opensource.com/article/19/2/getting-started-cat-command +[7]: https://opensource.com/article/19/5/advanced-rsync +[8]: https://opensource.com/article/17/1/rsync-backup-linux diff --git a/published/201909/20190821 Getting Started with Go on Fedora.md b/published/201909/20190821 Getting Started with Go on Fedora.md new file mode 100644 index 0000000000..25cff871be --- /dev/null +++ b/published/201909/20190821 Getting Started with Go on Fedora.md @@ -0,0 +1,120 @@ +[#]: collector: "lujun9972" +[#]: translator: "hello-wn" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11293-1.html" +[#]: subject: "Getting Started with Go on Fedora" +[#]: via: "https://fedoramagazine.org/getting-started-with-go-on-fedora/" +[#]: author: "Clément Verna https://fedoramagazine.org/author/cverna/" + +在 Fefora 上开启 Go 语言之旅 +====== + +![][1] + +[Go][2] 编程语言于 2009 年首次公开发布,此后被广泛使用。特别是,Go 已经成为云基础设施领域的一种代表性语言,例如 [Kubernetes][3]、[OpenShift][4] 或 [Terraform][5] 等大型项目都使用了 Go。 + +Go 越来越受欢迎的原因是性能好、易于编写高并发的程序、语法简单和编译快。 + +让我们来看看如何在 Fedora 上开始 Go 语言编程吧。 + +### 在 Fedora 上安装 Go + +Fedora 可以通过官方库简单快速地安装 Go 语言。 + +``` +$ sudo dnf install -y golang +$ go version +go version go1.12.7 linux/amd64 +``` + +既然装好了 Go ,让我们来写个简单的程序,编译并运行。 + +### 第一个 Go 程序 + +让我们来用 Go 语言写一波 “Hello, World!”。首先创建 `main.go` 文件,然后输入或者拷贝以下内容。 + +``` +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +} +``` + +运行这个程序很简单。 + +``` +$ go run main.go +Hello, World! +``` + +Go 会在临时目录将 `main.go` 编译成二进制文件并执行,然后删除临时目录。这个命令非常适合在开发过程中快速运行程序,它还凸显了 Go 的编译速度。 + +编译一个可执行程序就像运行它一样简单。 + +``` +$ go build main.go +$ ./main +Hello, World! +``` + +### 使用 Go 的模块 + +Go 1.11 和 1.12 引入了对模块的初步支持。模块可用于管理应用程序的各种依赖包。Go 通过 `go.mod` 和 `go.sum` 这两个文件,显式地定义依赖包的版本。 + +为了演示如何使用模块,让我们为 `hello world` 程序添加一个依赖。 + +在更改代码之前,需要初始化模块。 + +``` +$ go mod init helloworld +go: creating new go.mod: module helloworld +$ ls +go.mod main main.go +``` + +然后按照以下内容修改 `main.go` 文件。 + +``` +package main + +import "github.com/fatih/color" + +func main () { + color.Blue("Hello, World!") +} +``` + +在修改后的 `main.go` 中,不再使用标准库 `fmt` 来打印 “Hello, World!” ,而是使用第三方库打印出有色字体。 + +让我们来跑一下新版的程序吧。 + +``` +$ go run main.go +Hello, World! +``` + +因为程序依赖于 `github.com/fatih/color` 库,它需要在编译前下载所有依赖包。 然后把依赖包都添加到 `go.mod` 中,并将它们的版本号和哈希值记录在 `go.sum` 中。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/getting-started-with-go-on-fedora/ + +作者:[Clément Verna][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/go-article-816x345.jpg +[2]: https://golang.org/ +[3]: https://kubernetes.io/ +[4]: https://www.openshift.com/ +[5]: https://www.terraform.io/ + diff --git a/published/201909/20190822 How to move a file in Linux.md b/published/201909/20190822 How to move a file in Linux.md new file mode 100644 index 0000000000..db2d2c4157 --- /dev/null +++ b/published/201909/20190822 How to move a file in Linux.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11380-1.html) +[#]: subject: (How to move a file in Linux) +[#]: via: (https://opensource.com/article/19/8/moving-files-linux-depth) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/doni08521059) + +在 Linux 中如何移动文件 +====== + +> 无论你是刚接触 Linux 的文件移动的新手还是已有丰富的经验,你都可以通过此深入的文章中学到一些东西。 + +![](https://img.linux.net.cn/data/attachment/album/201909/24/162919ygppgeevgrj0ppgv.jpg) + +在 Linux 中移动文件看似比较简单,但是可用的选项却比大多数人想象的要多。本文介绍了初学者如何在 GUI 和命令行中移动文件,还介绍了底层实际上发生了什么,并介绍了许多有一定经验的用户也很少使用的命令行选项。 + +### 移动什么? + +在研究移动文件之前,有必要仔细研究*移动*文件系统对象时实际发生的情况。当文件创建后,会将其分配给一个索引节点inode,这是文件系统中用于数据存储的固定点。你可以使用 [ls][2] 命令看到文件对应的索引节点: + +``` +$ ls --inode example.txt +7344977 example.txt +``` + +移动文件时,实际上并没有将数据从一个索引节点移动到另一个索引节点,只是给文件对象分配了新的名称或文件路径而已。实际上,文件在移动时会保留其权限,因为移动文件不会更改或重新创建文件。(LCTT 译注:在不跨卷、分区和存储器时,移动文件是不会重新创建文件的;反之亦然) + +文件和目录的索引节点并没有暗示这种继承关系,而是由文件系统本身决定的。索引节点的分配是基于文件创建时的顺序分配的,并且完全独立于你组织计算机文件的方式。一个目录“内”的文件的索引节点号可能比其父目录的索引节点号更低或更高。例如: + +``` +$ mkdir foo +$ mv example.txt foo +$ ls --inode +7476865 foo +$ ls --inode foo +7344977 example.txt +``` + +但是,将文件从一个硬盘驱动器移动到另一个硬盘驱动器时,索引节点基本上会更改。发生这种情况是因为必须将新数据写入新文件系统。因此,在 Linux 中,移动和重命名文件的操作实际上是相同的操作。无论你将文件移动到另一个目录还是在同一目录使用新名称,这两个操作均由同一个底层程序执行。 + +本文重点介绍将文件从一个目录移动到另一个目录。 + +### 用鼠标移动文件 + +图形用户界面是大多数人都熟悉的友好的抽象层,位于复杂的二进制数据集合之上。这也是在 Linux 桌面上移动文件的首选方法,也是最直观的方法。从一般意义上来说,如果你习惯使用台式机,那么你可能已经知道如何在硬盘驱动器上移动文件。例如,在 GNOME 桌面上,将文件从一个窗口拖放到另一个窗口时的默认操作是移动文件而不是复制文件,因此这可能是该桌面上最直观的操作之一: + +![Moving a file in GNOME.][3] + +而 KDE Plasma 桌面中的 Dolphin 文件管理器默认情况下会提示用户以执行不同的操作。拖动文件时按住 `Shift` 键可强制执行移动操作: + +![Moving a file in KDE.][4] + +### 在命令行移动文件 + +用于在 Linux、BSD、Illumos、Solaris 和 MacOS 上移动文件的 shell 命令是 `mv`。不言自明,简单的命令 `mv ` 会将源文件移动到指定的目标,源和目标都由[绝对][5]或[相对][6]文件路径定义。如前所述,`mv` 是 [POSIX][7] 用户的常用命令,其有很多不为人知的附加选项,因此,无论你是新手还是有经验的人,本文都会为你带来一些有用的选项。 + +但是,不是所有 `mv` 命令都是由同一个人编写的,因此取决于你的操作系统,你可能拥有 GNU `mv`、BSD `mv` 或 Sun `mv`。命令的选项因其实现而异(BSD `mv` 根本没有长选项),因此请参阅你的 `mv` 手册页以查看支持的内容,或安装你的首选版本(这是开源的奢侈之处)。 + +#### 移动文件 + +要使用 `mv` 将文件从一个文件夹移动到另一个文件夹,请记住语法 `mv `。 例如,要将文件 `example.txt` 移到你的 `Documents` 目录中: + +``` +$ touch example.txt +$ mv example.txt ~/Documents +$ ls ~/Documents +example.txt +``` + +就像你通过将文件拖放到文件夹图标上来移动文件一样,此命令不会将 `Documents` 替换为 `example.txt`。相反,`mv` 会检测到 `Documents` 是一个文件夹,并将 `example.txt` 文件放入其中。 + +你还可以方便地在移动文件时重命名该文件: + +``` +$ touch example.txt +$ mv example.txt ~/Documents/foo.txt +$ ls ~/Documents +foo.txt +``` + +这很重要,这使你不用将文件移动到另一个位置,也可以重命名文件,例如: + +``` +$ touch example.txt +$ mv example.txt foo2.txt +$ ls foo2.txt` +``` + +#### 移动目录 + +不像 [cp][8] 命令,`mv` 命令处理文件和目录没有什么不同,你可以用同样的格式移动目录或文件: + +``` +$ touch file.txt +$ mkdir foo_directory +$ mv file.txt foo_directory +$ mv foo_directory ~/Documents +``` + +#### 安全地移动文件 + +如果你移动一个文件到一个已有同名文件的地方,默认情况下,`mv` 会用你移动的文件替换目标文件。这种行为被称为清除clobbering,有时候这就是你想要的结果,而有时则不是。 + +一些发行版将 `mv` 别名定义为 `mv --interactive`(你也可以[自己写一个][9]),这会提醒你确认是否覆盖。而另外一些发行版没有这样做,那么你可以使用 `--interactive` 或 `-i` 选项来确保当两个文件有一样的名字而发生冲突时让 `mv` 请你来确认。 + +``` +$ mv --interactive example.txt ~/Documents +mv: overwrite '~/Documents/example.txt'? +``` + +如果你不想手动干预,那么可以使用 `--no-clobber` 或 `-n`。该选项会在发生冲突时静默拒绝移动操作。在这个例子当中,一个名为 `example.txt` 的文件以及存在于 `~/Documents`,所以它不会如命令要求从当前目录移走。 + +``` +$ mv --no-clobber example.txt ~/Documents +$ ls +example.txt +``` + +#### 带备份的移动 + +如果你使用 GNU `mv`,有一个备份选项提供了另外一种安全移动的方式。要为任何冲突的目标文件创建备份文件,可以使用 `-b` 选项。 + +``` +$ mv -b example.txt ~/Documents +$ ls ~/Documents +example.txt    example.txt~ +``` + +这个选项可以确保 `mv` 完成移动操作,但是也会保护目录位置的已有文件。 + +另外的 GNU 备份选项是 `--backup`,它带有一个定义了备份文件如何命名的参数。 + +* `existing`:如果在目标位置已经存在了编号备份文件,那么会创建编号备份。否则,会使用 `simple` 方式。 +* `none`:即使设置了 `--backup`,也不会创建备份。当 `mv` 被别名定义为带有备份选项时,这个选项可以覆盖这种行为。 +* `numbered`:给目标文件名附加一个编号。 +* `simple`:给目标文件附加一个 `~`,当你日常使用带有 `--ignore-backups` 选项的 [ls][2] 时,这些文件可以很方便地隐藏起来。 + +简单来说: + +``` +$ mv --backup=numbered example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +``` + +可以使用环境变量 `VERSION_CONTROL` 设置默认的备份方案。你可以在 `~/.bashrc` 文件中设置该环境变量,也可以在命令前动态设置: + +``` +$ VERSION_CONTROL=numbered mv --backup example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +``` + +`--backup` 选项仍然遵循 `--interactive` 或 `-i` 选项,因此即使它在执行备份之前创建了备份,它仍会提示你覆盖目标文件: + +``` +$ mv --backup=numbered example.txt ~/Documents +mv: overwrite '~/Documents/example.txt'? y +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt.~3~ +``` + +你可以使用 `--force` 或 `-f` 选项覆盖 `-i`。 + +``` +$ mv --backup=numbered --force example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:26 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt.~3~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:25 example.txt.~4~ +``` + +`--backup` 选项在 BSD `mv` 中不可用。 + +#### 一次性移动多个文件 + +移动多个文件时,`mv` 会将最终目录视为目标: + +``` +$ mv foo bar baz ~/Documents +$ ls ~/Documents +foo   bar   baz +``` + +如果最后一个项目不是目录,则 `mv` 返回错误: + +``` +$ mv foo bar baz +mv: target 'baz' is not a directory +``` + +GNU `mv` 的语法相当灵活。如果无法把目标目录作为提供给 `mv` 命令的最终参数,请使用 `--target-directory` 或 `-t` 选项: + +``` +$ mv --target-directory=~/Documents foo bar baz +$ ls ~/Documents +foo   bar   baz +``` + +当从某些其他命令的输出构造 `mv` 命令时(例如 `find` 命令、`xargs` 或 [GNU Parallel][10]),这特别有用。 + +#### 基于修改时间移动 + +使用 GNU `mv`,你可以根据要移动的文件是否比要替换的目标文件新来定义移动动作。该方式可以通过 `--update` 或 `-u` 选项使用,在BSD `mv` 中不可用: + +``` +$ ls -l ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:32 example.txt +$ ls -l +-rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt +$ mv --update example.txt ~/Documents +$ ls -l ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt +$ ls -l +``` + +此结果仅基于文件的修改时间,而不是两个文件的差异,因此请谨慎使用。只需使用 `touch` 命令即可愚弄 `mv`: + +``` +$ cat example.txt +one +$ cat ~/Documents/example.txt +one +two +$ touch example.txt +$ mv --update example.txt ~/Documents +$ cat ~/Documents/example.txt +one +``` + +显然,这不是最智能的更新功能,但是它提供了防止覆盖最新数据的基本保护。 + +### 移动 + +除了 `mv` 命令以外,还有更多的移动数据的方法,但是作为这项任务的默认程序,`mv` 是一个很好的通用选择。现在你知道了有哪些可以使用的选项,可以比以前更智能地使用 `mv` 了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/moving-files-linux-depth + +作者:[Seth Kenlon][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://opensource.com/users/sethhttps://opensource.com/users/doni08521059 +[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://opensource.com/article/19/7/master-ls-command +[3]: https://opensource.com/sites/default/files/uploads/gnome-mv.jpg (Moving a file in GNOME.) +[4]: https://opensource.com/sites/default/files/uploads/kde-mv.jpg (Moving a file in KDE.) +[5]: https://opensource.com/article/19/7/understanding-file-paths-and-how-use-them +[6]: https://opensource.com/article/19/7/navigating-filesystem-relative-paths +[7]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[8]: https://opensource.com/article/19/7/copying-files-linux +[9]: https://opensource.com/article/19/7/bash-aliases +[10]: https://opensource.com/article/18/5/gnu-parallel diff --git a/published/201909/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md b/published/201909/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md new file mode 100644 index 0000000000..33084aaa52 --- /dev/null +++ b/published/201909/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11308-1.html) +[#]: subject: (How To Check Your IP Address in Ubuntu [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/check-ip-address-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 中检查你的 IP 地址 +====== + +不知道你的 IP 地址是什么?以下是在 Ubuntu 和其他 Linux 发行版中检查 IP 地址的几种方法。 + +![][1] + +### 什么是 IP 地址? + +**互联网协议地址**(通常称为 **IP 地址**)是分配给连接到计算机网络的每个设备(使用互联网协议)的数字标签。IP 地址用于识别和定位机器。 + +**IP 地址**在网络中是*唯一的*,使得所有连接设备能够通信。 + +你还应该知道有两种**类型的 IP 地址**:**公有**和**私有**。**公有 IP 地址**是用于互联网通信的地址,这与你用于邮件的物理地址相同。但是,在本地网络(例如使用路由器的家庭)的环境中,会为每个设备分配在该子网内唯一的**私有 IP 地址**。这在本地网络中使用,而不直接暴露公有 IP(路由器用它与互联网通信)。 + +另外还有区分 **IPv4** 和 **IPv6** 协议。**IPv4** 是经典的 IP 格式,它由基本的 4 部分结构组成,四个字节用点分隔(例如 127.0.0.1)。但是,随着设备数量的增加,IPv4 很快就无法提供足够的地址。这就是 **IPv6** 被发明的原因,它使用 **128 位地址**的格式(与 **IPv4** 使用的 **32 位地址**相比)。 + +### 在 Ubuntu 中检查你的 IP 地址(终端方式) + +检查 IP 地址的最快和最简单的方法是使用 `ip` 命令。你可以按以下方式使用此命令: + +``` +ip addr show +``` + +它将同时显示 IPv4 和 IPv6 地址: + +![Display IP Address in Ubuntu Linux][2] + +实际上,你可以进一步缩短这个命令 `ip a`。它会给你完全相同的结果。 + +``` +ip a +``` + +如果你希望获得最少的细节,也可以使用 `hostname`: + +``` +hostname -I +``` + +还有一些[在 Linux 中检查 IP 地址的方法][3],但是这两个命令足以满足这个目的。 + +`ifconfig` 如何? + +老用户可能会想要使用 `ifconfig`(net-tools 软件包的一部分),但该程序已被弃用。一些较新的 Linux 发行版不再包含此软件包,如果你尝试运行它,你将看到 ifconfig 命令未找到的错误。 + +### 在 Ubuntu 中检查你的 IP 地址(GUI 方式) + +如果你对命令行不熟悉,你还可以使用图形方式检查 IP 地址。 + +打开 Ubuntu 应用菜单(在屏幕左下角**显示应用**)并搜索**Settings**,然后单击图标: + +![Applications Menu Settings][5] + +这应该会打开**设置菜单**。进入**网络**: + +![Network Settings Ubuntu][6] + +按下连接旁边的**齿轮图标**会打开一个窗口,其中包含更多设置和有关你网络链接的信息,其中包括你的 IP 地址: + +![IP Address GUI Ubuntu][7] + +### 额外提示:检查你的公共 IP 地址(适用于台式计算机) + +首先,要检查你的**公有 IP 地址**(用于与服务器通信),你可以[使用 curl 命令][8]。打开终端并输入以下命令: + +``` +curl ifconfig.me +``` + +这应该只会返回你的 IP 地址而没有其他多余信息。我建议在分享这个地址时要小心,因为这相当于公布你的个人地址。 + +**注意:** 如果 `curl` 没有安装,只需使用 `sudo apt install curl -y` 来解决问题,然后再试一次。 + +另一种可以查看公共 IP 地址的简单方法是在 Google 中搜索 “ip address”。 + +### 总结 + +在本文中,我介绍了在 Uuntu Linux 中找到 IP 地址的不同方法,并向你概述了 IP 地址的用途以及它们对我们如此重要的原因。 + +我希望你喜欢这篇文章。如果你觉得文章有用,请在评论栏告诉我们! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-ip-address-ubuntu/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/checking-ip-address-ubuntu.png?resize=800%2C450&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_addr_show.png?fit=800%2C493&ssl=1 +[3]: https://linuxhandbook.com/find-ip-address/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?fit=800%2C309&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/network_settings_ubuntu.jpg?fit=800%2C591&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_address_gui_ubuntu.png?fit=800%2C510&ssl=1 +[8]: https://linuxhandbook.com/curl-command-examples/ diff --git a/published/201909/20190823 The Linux kernel- Top 5 innovations.md b/published/201909/20190823 The Linux kernel- Top 5 innovations.md new file mode 100644 index 0000000000..486270ccfd --- /dev/null +++ b/published/201909/20190823 The Linux kernel- Top 5 innovations.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11368-1.html) +[#]: subject: (The Linux kernel: Top 5 innovations) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-top-5-innovations) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 内核的五大创新 +====== + +> 想知道什么是 Linux 内核上真正的(不是那种时髦的)创新吗? + +![](https://img.linux.net.cn/data/attachment/album/201909/21/093858no01oh78v111r3zt.jpg) + +在科技行业,*创新*这个词几乎和*革命*一样到处泛滥,所以很难将那些夸张的东西与真正令人振奋的东西区分开来。Linux 内核被称为创新,但它又被称为现代计算中最大的奇迹,一个微观世界中的庞然大物。 + +撇开营销和模式不谈,Linux 可以说是开源世界中最受欢迎的内核,它在近 30 年的生命时光当中引入了一些真正的规则改变者。 + +### Cgroups(2.6.24) + +早在 2007 年,Paul Menage 和 Rohit Seth 就在内核中添加了深奥的[控制组(cgroups)][2]功能(cgroups 的当前实现是由 Tejun Heo 重写的)。这种新技术最初被用作一种方法,从本质上来说,是为了确保一组特定任务的服务质量。 + +例如,你可以为与你的 WEB 服务相关联的所有任务创建一个控制组定义(cgroup),为例行备份创建另一个 cgroup ,再为一般操作系统需求创建另一个 cgroup。然后,你可以控制每个组的资源百分比,这样你的操作系统和 WEB 服务就可以获得大部分系统资源,而你的备份进程可以访问剩余的资源。 + +然而,cgroups 如今变得这么著名是因其作为驱动云技术的角色:容器。事实上,cgroups 最初被命名为[进程容器][3]。当它们被 [LXC][4]、[CoreOS][5] 和 Docker 等项目采用时,这并不奇怪。 + +就像闸门打开后一样,“容器” 一词就像成为了 Linux 的同义词一样,微服务风格的基于云的“应用”概念很快成为了规范。如今,已经很难摆脱 cgroups 了,它们是如此普遍。每一个大规模的基础设施(如果你运行 Linux 的话,可能还有你的笔记本电脑)都以一种合理的方式使用了 cgroups,这使得你的计算体验比以往任何时候都更加易于管理和灵活。 + +例如,你可能已经在电脑上安装了 [Flathub][6] 或 [Flatpak][7],或者你已经在工作中使用 [Kubernetes][8] 和/或 [OpenShift][9]。不管怎样,如果“容器”这个术语对你来说仍然模糊不清,则可以 [通过 Linux 容器从背后][10]获得对容器的实际理解。 + +### LKMM(4.17) + +2018 年,Jade Alglave、Alan Stern、Andrea Parri、Luc Maranget、Paul McKenney 以及其他几个人的辛勤工作的成果被合并到主线 Linux 内核中,以提供正式的内存模型。Linux 内核内存[一致性]模型(LKMM)子系统是一套描述 Linux 内存一致性模型的工具,同时也产生用于测试的用例(特别命名为 klitmus)。 + +随着系统在物理设计上变得越来越复杂(增加了更多的中央处理器内核,高速缓存和内存增长,等等),它们就越难知道哪个中央处理器需要哪个地址空间,以及何时需要。例如,如果 CPU0 需要将数据写入内存中的共享变量,并且 CPU1 需要读取该值,那么 CPU0 必须在 CPU1 尝试读取之前写入。类似地,如果值是以一种顺序方式写入内存的,那么期望它们也以同样的顺序被读取,而不管哪个或哪些 CPU 正在读取。 + +即使在单个处理器上,内存管理也需要特定的任务顺序。像 `x = y` 这样的简单操作需要处理器从内存中加载 `y` 的值,然后将该值存储在 `x` 中。在处理器从内存中读取值之前,是不能将存储在 `y` 中的值放入 `x` 变量的。此外还有地址依赖:`x[n] = 6` 要求在处理器能够存储值 `6` 之前加载 `n`。 + +LKMM 可以帮助识别和跟踪代码中的这些内存模式。它部分是通过一个名为 `herd` 的工具来实现的,该工具(以逻辑公式的形式)定义了内存模型施加的约束,然后列举了与这些约束一致性的所有可能的结果。 + +### 低延迟补丁(2.6.38) + +很久以前,在 2011 年之前,如果你想[在 Linux 上进行多媒体工作][11],你必须得有一个低延迟内核。这主要适用于[录音][12]时添加了许多实时效果(如对着麦克风唱歌和添加混音,以及在耳机中无延迟地听到你的声音)。有些发行版,如 [Ubuntu Studio][13],可靠地提供了这样一个内核,所以实际上这没有什么障碍,这只不过是当艺术家选择发行版时的一个重要提醒。 + +然而,如果你没有使用 Ubuntu Studio,或者你需要在你的发行版提供之前更新你的内核,你必须跳转到 rt-patches 网页,下载内核补丁,将它们应用到你的内核源代码,编译,然后手动安装。 + +后来,随着内核版本 2.6.38 的发布,这个过程结束了。Linux 内核突然像变魔术一样默认内置了低延迟代码(根据基准测试,延迟至少降低了 10 倍)。不再需要下载补丁,不用编译。一切都很顺利,这都是因为 Mike Galbraith 编写了一个 200 行的小补丁。 + +对于全世界的开源多媒体艺术家来说,这是一个规则改变者。从 2011 年开始事情变得如此美好,到 2016 年我自己做了一个挑战,[在树莓派 v1(型号 B)上建造一个数字音频工作站(DAW)][14],结果发现它运行得出奇地好。 + +### RCU(2.5) + +RCU,即读-拷贝-更新Read-Copy-Update,是计算机科学中定义的一个系统,它允许多个处理器线程从共享内存中读取数据。它通过延迟更新但也将它们标记为已更新来做到这一点,以确保数据读取为最新内容。实际上,这意味着读取与更新同时发生。 + +典型的 RCU 循环有点像这样: + +1. 删除指向数据的指针,以防止其他读操作引用它。 +2. 等待读操作完成它们的关键处理。 +3. 回收内存空间。 + +将更新阶段划分为删除和回收阶段意味着更新程序会立即执行删除,同时推迟回收直到所有活动读取完成(通过阻止它们或注册一个回调以便在完成时调用)。 + +虽然 RCU 的概念不是为 Linux 内核发明的,但它在 Linux 中的实现是该技术的一个定义性的例子。 + +### 合作(0.01) + +对于 Linux 内核创新的问题的最终答案永远是协作。你可以说这是一个好时机,也可以称之为技术优势,称之为黑客能力,或者仅仅称之为开源,但 Linux 内核及其支持的许多项目是协作与合作的光辉范例。 + +它远远超出了内核范畴。各行各业的人都对开源做出了贡献,可以说都是因为 Linux 内核。Linux 曾经是,现在仍然是[自由软件][15]的主要力量,激励人们把他们的代码、艺术、想法或者仅仅是他们自己带到一个全球化的、有生产力的、多样化的人类社区中。 + +### 你最喜欢的创新是什么? + +这个列表偏向于我自己的兴趣:容器、非统一内存访问(NUMA)和多媒体。无疑,列表中肯定缺少你最喜欢的内核创新。在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-top-5-innovations + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[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/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://en.wikipedia.org/wiki/Cgroups +[3]: https://lkml.org/lkml/2006/10/20/251 +[4]: https://linuxcontainers.org +[5]: https://coreos.com/ +[6]: http://flathub.org +[7]: http://flatpak.org +[8]: http://kubernetes.io +[9]: https://www.redhat.com/sysadmin/learn-openshift-minishift +[10]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[11]: http://slackermedia.info +[12]: https://opensource.com/article/17/6/qtractor-audio +[13]: http://ubuntustudio.org +[14]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker +[15]: http://fsf.org diff --git a/published/201909/20190825 Top 5 IoT networking security mistakes.md b/published/201909/20190825 Top 5 IoT networking security mistakes.md new file mode 100644 index 0000000000..237d81b266 --- /dev/null +++ b/published/201909/20190825 Top 5 IoT networking security mistakes.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11299-1.html) +[#]: subject: (Top 5 IoT networking security mistakes) +[#]: via: (https://www.networkworld.com/article/3433476/top-5-iot-networking-security-mistakes.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +五大物联网网络安全错误 +====== + +> IT 供应商兄弟国际公司分享了五种最常见的物联网安全错误,这是从它们的打印机和多功能设备买家中看到的。 + +![Getty Images][1] + +尽管[兄弟国际公司][2]是许多 IT 产品的供应商,从[机床][3]到[头戴式显示器][4]再到[工业缝纫机][5],但它最知名的产品是打印机。在当今世界,这些打印机不再是独立的设备,而是物联网的组成部分。 + +这也是我为什么对罗伯特•伯内特提供的这份列表感兴趣的原因。伯内特是兄弟公司的总监,负责 B2B 产品和提供解决方案。基本上是该公司负责大客户实施的关键人物。所以他对打印机相关的物联网安全错误非常关注,并且分享了兄弟国际公司对于处理这五大错误的建议。 + +### #5:不控制访问和授权 + +伯内特说:“过去,成本控制是管理谁可以使用机器、何时结束工作背后的推动力。”当然,这在今天也仍然很重要,但他指出安全性正迅速成为管理控制打印和扫描设备的关键因素。这不仅适用于大型企业,也适用于各种规模的企业。 + +### #4:无法定期更新固件 + +让我们来面对这一现实,大多数 IT 专业人员都忙于保持服务器和其他网络基础设施设备的更新,确保其基础设施尽可能的安全高效。“在这日常的流程中,像打印机这样的设备经常被忽视。”但过时的固件可能会使基础设施面临新的威胁。 + +### #3:设备意识不足 + +伯内特说:“正确理解谁在使用什么设备,以及整套设备中所有连接设备的功能是什么,这是至关重要的。使用端口扫描技术、协议分析和其他检测技术检查这些设备应作为你的网络基础设施整体安全审查中的一部分。 他常常提醒人们说:“处理打印设备的方法是:如果没有损坏,就不要修理!”但即使是可靠运行多年的设备也应该成为安全审查的一部分。这是因为旧设备可能无法提供更强大的安全设置,或者可能需要更新其配置才能满足当今更高的安全要求,这其中包括设备的监控/报告功能。 + +### #2:用户培训不足 + +“应该把培训团队在工作过程中管理文档的最佳实践作为强有力的安全计划中的一部分。”伯内特说道,“然而,事实却是,无论你如何努力地去保护物联网设备,人为因素通常是一家企业在保护重要和敏感信息方面最薄弱的环节。像这些简单的事情,如无意中将重要文件留在打印机上供任何人查看,或者将文件扫描到错误的目的地,不仅会给企业带来经济损失和巨大的负面影响,还会影响企业的知识产权、声誉,引起合规性/监管问题。” + +### #1:使用默认密码 + +“只是因为它很方便并不意味着它不重要!”伯内特说,“保护打印机和多功能设备免受未经授权的管理员访问不仅有助于保护敏感的机器配置设置和报告信息,还可以防止访问个人信息,例如,像可能用于网络钓鱼攻击的用户名。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3433476/top-5-iot-networking-security-mistakes.html + +作者:[Fredric Paul][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/02/iot_security_tablet_conference_digital-100787102-large.jpg +[2]: https://www.brother-usa.com/business +[3]: https://www.brother-usa.com/machinetool/default?src=default +[4]: https://www.brother-usa.com/business/hmd#sort=%40productcatalogsku%20ascending +[5]: https://www.brother-usa.com/business/industrial-sewing +[6]: https://www.networkworld.com/article/2855207/internet-of-things/5-ways-to-prepare-for-internet-of-things-security-threats.html#tk.nww-infsb +[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190826 5 ops tasks to do with Ansible.md b/published/201909/20190826 5 ops tasks to do with Ansible.md new file mode 100644 index 0000000000..de7916b81d --- /dev/null +++ b/published/201909/20190826 5 ops tasks to do with Ansible.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11312-1.html) +[#]: subject: (5 ops tasks to do with Ansible) +[#]: via: (https://opensource.com/article/19/8/ops-tasks-ansible) +[#]: author: (Mark Phillips https://opensource.com/users/markphttps://opensource.com/users/adminhttps://opensource.com/users/alsweigarthttps://opensource.com/users/belljennifer43) + +5 个 Ansible 运维任务 +====== + +> 让 DevOps 少一点,OpsDev 多一点。 + +![gears and lightbulb to represent innovation][1] + +在这个 DevOps 世界中,看起来开发(Dev)这一半成为了关注的焦点,而运维(Ops)则是这个关系中被遗忘的另一半。这几乎就好像是领头的开发告诉尾随的运维做什么,几乎所有的“运维”都是开发说要做的。因此,运维被抛到后面,降级到了替补席上。 + +我想看到更多的 OpsDev。因此,让我们来看看 Ansible 在日常的运维中可以帮助你什么。 + +![Job templates][2] + +我选择在 [Ansible Tower][3] 中展示这些方案,因为我认为用户界面 (UI) 可以增色大多数的任务。如果你想模拟测试,你可以在 Tower 的上游开源版本 [AWX][4] 中测试它。 + +### 管理用户 + +在大规模环境中,你的用户将集中在活动目录或 LDAP 等系统中。但我敢打赌,仍然存在许多包含大量的静态用户的全负荷环境。Ansible 可以帮助你将这些分散的环境集中到一起。*社区*已为我们解决了这个问题。看看 [Ansible Galaxy][5] 中的 [users][6] 角色。 + +这个角色的聪明之处在于它允许我们通过*数据*管理用户,而无需更改运行逻辑。 + +![User data][7] + +通过简单的数据结构,我们可以在系统上添加、删除和修改静态用户。这很有用。 + +### 管理 sudo + +提权有[多种形式][8],但最流行的是 [sudo][9]。通过每个 `user`、`group` 等离散文件来管理 sudo 相对容易。但一些人对给予特权感到紧张,并倾向于有时限地给予提权。因此[下面是一种方案][10],它使用简单的 `at` 命令对授权访问设置时间限制。 + +![Managing sudo][11] + +### 管理服务 + +给入门级运维团队提供[菜单][12]以便他们可以重启某些服务不是很好吗?看下面! + +![Managing services][13] + +### 管理磁盘空间 + +这有[一个简单的角色][14],可在特定目录中查找字节大于某个大小的文件。在 Tower 中这么做时,启用[回调][15]有额外的好处。想象一下,你的监控方案发现文件系统已超过 X% 并触发 Tower 中的任务以找出是什么文件导致的。 + +![Managing disk space][16] + +### 调试系统性能问题 + +[这个角色][17]相当简单:它运行一些命令并打印输出。细节在最后输出,让你 —— 系统管理员快速浏览一眼。另外可以使用 [正则表达式][18] 在输出中找到某些条件(比如说 CPU 占用率超过 80%)。 + +![Debugging system performance][19] + +### 总结 + +我已经录制了这五个任务的简短视频。你也可以在 Github 上找到[所有代码][20]! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/ops-tasks-ansible + +作者:[Mark Phillips][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markphttps://opensource.com/users/adminhttps://opensource.com/users/alsweigarthttps://opensource.com/users/belljennifer43 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://opensource.com/sites/default/files/uploads/00_templates.png (Job templates) +[3]: https://www.ansible.com/products/tower +[4]: https://github.com/ansible/awx +[5]: https://galaxy.ansible.com +[6]: https://galaxy.ansible.com/singleplatform-eng/users +[7]: https://opensource.com/sites/default/files/uploads/01_users_data.png (User data) +[8]: https://docs.ansible.com/ansible/latest/plugins/become.html +[9]: https://www.sudo.ws/intro.html +[10]: https://github.com/phips/ansible-demos/tree/master/roles/sudo +[11]: https://opensource.com/sites/default/files/uploads/02_sudo.png (Managing sudo) +[12]: https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#surveys +[13]: https://opensource.com/sites/default/files/uploads/03_services.png (Managing services) +[14]: https://github.com/phips/ansible-demos/tree/master/roles/disk +[15]: https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#provisioning-callbacks +[16]: https://opensource.com/sites/default/files/uploads/04_diskspace.png (Managing disk space) +[17]: https://github.com/phips/ansible-demos/tree/master/roles/gather_debug +[18]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#regular-expression-filters +[19]: https://opensource.com/sites/default/files/uploads/05_debug.png (Debugging system performance) +[20]: https://github.com/phips/ansible-demos diff --git a/published/201909/20190826 How to rename a group of files on Linux.md b/published/201909/20190826 How to rename a group of files on Linux.md new file mode 100644 index 0000000000..e80d1bc31d --- /dev/null +++ b/published/201909/20190826 How to rename a group of files on Linux.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11300-1.html) +[#]: subject: (How to rename a group of files on Linux) +[#]: via: (https://www.networkworld.com/article/3433865/how-to-rename-a-group-of-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 上重命名一组文件 +====== + +> 要用单个命令重命名一组文件,请使用 rename 命令。它需要使用正则表达式,并且可以在开始前告诉你会有什么更改。 + +![](https://img.linux.net.cn/data/attachment/album/201909/03/005333hfm8yf90m2gm800g.jpg) + +几十年来,Linux 用户一直使用 `mv` 命令重命名文件。它很简单,并且能做到你要做的。但有时你需要重命名一大组文件。在这种情况下,`rename` 命令可以使这个任务更容易。它只需要一些正则表达式的技巧。 + +与 `mv` 命令不同,`rename` 不允许你简单地指定旧名称和新名称。相反,它使用类似于 Perl 中的正则表达式。在下面的例子中,`s` 指定我们将第一个字符串替换为第二个字符串(旧的),从而将 `this.new` 变为 `this.old`。 + +``` +$ rename 's/new/old/' this.new +$ ls this* +this.old +``` + +使用 `mv this.new this.old` 可以更容易地进行更改一个,但是将字符串 `this` 变成通配符 `*`,你可以用一条命令将所有的 `*.new` 文件重命名为 `*.old`: + +``` +$ ls *.new +report.new schedule.new stats.new this.new +$ rename 's/new/old/' *.new +$ ls *.old +report.old schedule.old stats.old this.old +``` + +正如你所料,`rename` 命令不限于更改文件扩展名。如果你需要将名为 `report.*` 的文件更改为 `review.*`,那么可以使用以下命令做到: + +``` +$ rename 's/report/review/' * +``` + +正则表达式中的字符串可以更改文件名的任何部分,无论是文件名还是扩展名。 + +``` +$ rename 's/123/124/' * +$ ls *124* +status.124 report124.txt +``` + +如果你在 `rename` 命令中添加 `-v` 选项,那么该命令将提供一些反馈,以便你可以看到所做的更改,或许会包含你没注意的。这让你注意到并按需还原更改。 + +``` +$ rename -v 's/123/124/' * +status.123 renamed as status.124 +report123.txt renamed as report124.txt +``` + +另一方面,使用 `-n`(或 `--nono`)选项会使 `rename` 命令告诉你将要做的但不会实际做的更改。这可以让你免于执行不不想要的操作,然后再还原更改。 + +``` +$ rename -n 's/old/save/' * +rename(logger.man-old, logger.man-save) +rename(lyrics.txt-old, lyrics.txt-save) +rename(olderfile-, saveerfile-) +rename(oldfile, savefile) +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +如果你对这些更改满意,那么就可以运行不带 `-n` 选项的命令来更改文件名。 + +但请注意,正则表达式中的 `.` **不会**被视为句点,而是作为匹配任何字符的通配符。上面和下面的示例中的一些更改可能不是输入命令的人希望的。 + +``` +$ rename -n 's/.old/.save/' * +rename(logger.man-old, logger.man.save) +rename(lyrics.txt-old, lyrics.txt.save) +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +为确保句点按照字面意思执行,请在它的前面加一个反斜杠。这将使其不被解释为通配符并匹配任何字符。请注意,进行此更改时,仅选择了 `.old` 文件。 + +``` +$ rename -n 's/\.old/.save/' * +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +下面的命令会将文件名中的所有大写字母更改为小写,除了使用 `-n` 选项来确保我们在命令执行之前检查将做的修改。注意在正则表达式中使用了 `y`,这是改变大小写所必需的。 + +``` +$ rename -n 'y/A-Z/a-z/' W* +rename(WARNING_SIGN.pdf, warning_sign.pdf) +rename(Will_Gardner_buttons.pdf, will_gardner_buttons.pdf) +rename(Wingding_Invites.pdf, wingding_invites.pdf) +rename(WOW-buttons.pdf, wow-buttons.pdf) +``` + +在上面的例子中,我们将所有大写字母更改为了小写,但这仅对以大写字母 `W` 开头的文件名。 + +### 总结 + +当你需要重命名大量文件时,`rename` 命令非常有用。请注意不要做比预期更多的更改。请记住,`-n`(或者 `--nono`)选项可以帮助你避免耗时的错误。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3433865/how-to-rename-a-group-of-files-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/card-catalog-machester_city_library-100809242-large.jpg +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190828 Managing Ansible environments on MacOS with Conda.md b/published/201909/20190828 Managing Ansible environments on MacOS with Conda.md new file mode 100644 index 0000000000..24e8d65fa0 --- /dev/null +++ b/published/201909/20190828 Managing Ansible environments on MacOS with Conda.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11356-1.html) +[#]: subject: (Managing Ansible environments on MacOS with Conda) +[#]: via: (https://opensource.com/article/19/8/using-conda-ansible-administration-macos) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + + +使用 Conda 管理 MacOS 上的 Ansible 环境 +===== + +> Conda 将 Ansible 所需的一切都收集到虚拟环境中并将其与其他项目分开。 + +![](https://img.linux.net.cn/data/attachment/album/201909/18/123838m1bcmke570kl6kzm.jpg) + +如果你是一名使用 MacOS 并涉及到 Ansible 管理的 Python 开发人员,你可能希望使用 Conda 包管理器将 Ansible 的工作内容与核心操作系统和其他本地项目分开。 + +Ansible 基于 Python。要让 Ansible 在 MacOS 上工作,Conda 并不是必须要的,但是它确实让你管理 Python 版本和包依赖变得更加容易。这允许你在 MacOS 上使用升级的 Python 版本,并在你的系统中、Ansible 和其他编程项目之间保持 Python 包的依赖性相互独立。 + +在 MacOS 上安装 Ansible 还有其他方法。你可以使用 [Homebrew][2],但是如果你对 Python 开发(或 Ansible 开发)感兴趣,你可能会发现在一个独立 Python 虚拟环境中管理 Ansible 可以减少一些混乱。我觉得这更简单;与其试图将 Python 版本和依赖项加载到系统或 `/usr/local` 目录中 ,还不如使用 Conda 帮助我将 Ansible 所需的一切都收集到一个虚拟环境中,并将其与其他项目完全分开。 + +本文着重于使用 Conda 作为 Python 项目来管理 Ansible,以保持它的干净并与其他项目分开。请继续阅读,并了解如何安装 Conda、创建新的虚拟环境、安装 Ansible 并对其进行测试。 + +### 序幕 + +最近,我想学习 [Ansible][3],所以我需要找到安装它的最佳方法。 + +我通常对在我的日常工作站上安装东西很谨慎。我尤其不喜欢对供应商的默认操作系统安装应用手动更新(这是我多年作为 Unix 系统管理的习惯)。我真的很想使用 Python 3.7,但是 MacOS 的 Python 包是旧的 2.7,我不会安装任何可能干扰核心 MacOS 系统的全局 Python 包。 + +所以,我使用本地 Ubuntu 18.04 虚拟机上开始了我的 Ansible 工作。这提供了真正意义上的的安全隔离,但我很快发现管理它是非常乏味的。所以我着手研究如何在本机 MacOS 上获得一个灵活但独立的 Ansible 系统。 + +由于 Ansible 基于 Python,Conda 似乎是理想的解决方案。 + +### 安装 Conda + +Conda 是一个开源软件,它提供方便的包和环境管理功能。它可以帮助你管理多个版本的 Python、安装软件包依赖关系、执行升级和维护项目隔离。如果你手动管理 Python 虚拟环境,Conda 将有助于简化和管理你的工作。浏览 [Conda 文档][4]可以了解更多细节。 + +我选择了 [Miniconda][5] Python 3.7 安装在我的工作站中,因为我想要最新的 Python 版本。无论选择哪个版本,你都可以使用其他版本的 Python 安装新的虚拟环境。 + +要安装 Conda,请下载 PKG 格式的文件,进行通常的双击,并选择 “Install for me only” 选项。安装在我的系统上占用了大约 158 兆的空间。 + +安装完成后,调出一个终端来查看你有什么了。你应该看到: + + * 在你的家目录中的 `miniconda3` 目录 + * shell 提示符被修改为 `(base)` + * `.bash_profile` 文件更新了一些 Conda 特有的设置内容 + +现在基础已经安装好了,你有了第一个 Python 虚拟环境。运行 Python 版本检查可以证明这一点,你的 `PATH` 将指向新的位置: + +``` +(base) $ which python +/Users/jfarrell/miniconda3/bin/python +(base) $ python --version +Python 3.7.1 +``` + +现在安装了 Conda,下一步是建立一个虚拟环境,然后安装 Ansible 并运行。 + +### 为 Ansible 创建虚拟环境 + +我想将 Ansible 与我的其他 Python 项目分开,所以我创建了一个新的虚拟环境并切换到它: + +``` +(base) $ conda create --name ansible-env --clone base +(base) $ conda activate ansible-env +(ansible-env) $ conda env list +``` + +第一个命令将 Conda 库克隆到一个名为 `ansible-env` 的新虚拟环境中。克隆引入了 Python 3.7 版本和一系列默认的 Python 模块,你可以根据需要添加、删除或升级这些模块。 + +第二个命令将 shell 上下文更改为这个新的环境。它为 Python 及其包含的模块设置了正确的路径。请注意,在 `conda activate ansible-env` 命令后,你的 shell 提示符会发生变化。 + +第三个命令不是必须的;它列出了安装了哪些 Python 模块及其版本和其他数据。 + +你可以随时使用 Conda 的 `activate` 命令切换到另一个虚拟环境。这将带你回到基本环境:`conda base`。 + +### 安装 Ansible + +安装 Ansible 有多种方法,但是使用 Conda 可以将 Ansible 版本和所有需要的依赖项打包在一个地方。Conda 提供了灵活性,既可以将所有内容分开,又可以根据需要添加其他新环境(我将在后面演示)。 + +要安装 Ansible 的相对较新版本,请使用: + +``` +(base) $ conda activate ansible-env +(ansible-env) $ conda install -c conda-forge ansible +``` + +由于 Ansible 不是 Conda 默认通道的一部分,因此 `-c` 用于从备用通道搜索和安装。Ansible 现已安装到 `ansible-env` 虚拟环境中,可以使用了。 + +### 使用 Ansible + +既然你已经安装了 Conda 虚拟环境,就可以使用它了。首先,确保要控制的节点已将工作站的 SSH 密钥安装到正确的用户帐户。 + +调出一个新的 shell 并运行一些基本的 Ansible 命令: + +``` +(base) $ conda activate ansible-env +(ansible-env) $ ansible --version +ansible 2.8.1 + config file = None + configured module search path = ['/Users/jfarrell/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /Users/jfarrell/miniconda3/envs/ansibleTest/lib/python3.7/site-packages/ansible + executable location = /Users/jfarrell/miniconda3/envs/ansibleTest/bin/ansible + python version = 3.7.1 (default, Dec 14 2018, 13:28:58) [Clang 4.0.1 (tags/RELEASE_401/final)] +(ansible-env) $ ansible all -m ping -u ansible +192.168.99.200 | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +``` + +现在 Ansible 工作了,你可以在控制台中抽身,并从你的 MacOS 工作站中使用它们。 + +### 克隆新的 Ansible 进行 Ansible 开发 + +这部分完全是可选的;只有当你想要额外的虚拟环境来修改 Ansible 或者安全地使用有问题的 Python 模块时,才需要它。你可以通过以下方式将主 Ansible 环境克隆到开发副本中: + +``` +(ansible-env) $ conda create --name ansible-dev --clone ansible-env +(ansible-env) $ conda activte ansible-dev +(ansible-dev) $ +``` + +### 需要注意的问题 + +偶尔你可能遇到使用 Conda 的麻烦。你通常可以通过以下方式删除不良环境: + +``` +$ conda activate base +$ conda remove --name ansible-dev --all +``` + +如果出现无法解决的错误,通常可以通过在 `~/miniconda3/envs` 中找到该环境并删除整个目录来直接删除环境。如果基础环境损坏了,你可以删除整个 `~/miniconda3`,然后从 PKG 文件中重新安装。只要确保保留 `~/miniconda3/envs` ,或使用 Conda 工具导出环境配置并在以后重新创建即可。 + +MacOS 上不包括 `sshpass` 程序。只有当你的 Ansible 工作要求你向 Ansible 提供 SSH 登录密码时,才需要它。你可以在 SourceForge 上找到当前的 [sshpass 源代码][6]。 + +最后,基础的 Conda Python 模块列表可能缺少你工作所需的一些 Python 模块。如果你需要安装一个模块,首选命令是 `conda install package`,但是需要的话也可以使用 `pip`,Conda 会识别安装的模块。 + +### 结论 + +Ansible 是一个强大的自动化工具,值得我们去学习。Conda 是一个简单有效的 Python 虚拟环境管理工具。 + +在你的 MacOS 环境中保持软件安装分离是保持日常工作环境的稳定性和健全性的谨慎方法。Conda 尤其有助于升级你的 Python 版本,将 Ansible 从其他项目中分离出来,并安全地使用 Ansible。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/using-conda-ansible-administration-macos + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears) +[2]: https://brew.sh/ +[3]: https://docs.ansible.com/?extIdCarryOver=true&sc_cid=701f2000001OH6uAAG +[4]: https://conda.io/projects/conda/en/latest/index.html +[5]: https://docs.conda.io/en/latest/miniconda.html +[6]: https://sourceforge.net/projects/sshpass/ diff --git a/published/201909/20190829 Getting started with HTTPie for API testing.md b/published/201909/20190829 Getting started with HTTPie for API testing.md new file mode 100644 index 0000000000..c85c165df5 --- /dev/null +++ b/published/201909/20190829 Getting started with HTTPie for API testing.md @@ -0,0 +1,334 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11333-1.html) +[#]: subject: (Getting started with HTTPie for API testing) +[#]: via: (https://opensource.com/article/19/8/getting-started-httpie) +[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/jamesf) + +使用 HTTPie 进行 API 测试 +====== + +> 使用 HTTPie 调试 API,这是一个用 Python 写的易用的命令行工具。 + +![](https://img.linux.net.cn/data/attachment/album/201909/12/102919ry1ute1y9h991ftz.jpg) + +[HTTPie][2] 是一个非常易用、易于升级的 HTTP 客户端。它的发音为 “aitch-tee-tee-pie” 并以 `http` 命令运行,它是一个用 Python 编写的来用于访问 Web 的命令行工具。 + +由于这是一篇关于 HTTP 客户端的指导文章,因此你需要一个 HTTP 服务器来试用它。在这里,访问 [httpbin.org][3],它是一个简单的开源 HTTP 请求和响应服务。httpbin.org 网站是一种测试 Web API 的强大方式,并能仔细管理并显示请求和响应内容,不过现在让我们专注于 HTTPie 的强大功能。 + +### Wget 和 cURL 的替代品 + +你可能听说过古老的 [Wget][4] 或稍微新一些的 [cURL][5] 工具,它们允许你从命令行访问 Web。它们是为访问网站而编写的,而 HTTPie 则用于访问 Web API。 + +网站请求发生在计算机和正在阅读并响应它所看到的内容的最终用户之间,这并不太依赖于结构化的响应。但是,API 请求会在两台计算机之间进行*结构化*调用,人并不是该流程内的一部分,像 HTTPie 这样的命令行工具的参数可以有效地处理这个问题。 + +### 安装 HTTPie + +有几种方法可以安装 HTTPie。你可以通过包管理器安装,无论你使用的是 `brew`、`apt`、`yum` 还是 `dnf`。但是,如果你已配置 [virtualenvwrapper][6],那么你可以用自己的方式安装: + + +``` +$ mkvirtualenv httpie +... +(httpie) $ pip install httpie +... +(httpie) $ deactivate +$ alias http=~/.virtualenvs/httpie/bin/http +$ http -b GET https://httpbin.org/get +{ + "args": {}, + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "origin": "104.220.242.210, 104.220.242.210", + "url": "https://httpbin.org/get" +} +``` + +通过将 `http` 别名指向为虚拟环境中的命令,即使虚拟环境在非活动状态,你也可以运行它。你可以将 `alias` 命令放在 `.bash_profile` 或 `.bashrc` 中,这样你就可以使用以下命令升级 HTTPie: + + +``` +$ ~/.virtualenvs/httpie/bin/pip install -U pip +``` + +### 使用 HTTPie 查询网站 + +HTTPie 可以简化查询和测试 API。上面使用了一个选项,`-b`(即 `--body`)。没有它,HTTPie 将默认打印整个响应,包括响应头: + +``` +$ http GET https://httpbin.org/get +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Encoding: gzip +Content-Length: 177 +Content-Type: application/json +Date: Fri, 09 Aug 2019 20:19:47 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +{ + "args": {}, + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "origin": "104.220.242.210, 104.220.242.210", + "url": "https://httpbin.org/get" +} +``` + +这在调试 API 服务时非常重要,因为大量信息在响应头中发送。例如,查看发送的 cookie 通常很重要。httpbin.org 提供了通过 URL 路径设置 cookie(用于测试目的)的方式。以下设置一个标题为 `opensource`, 值为 `awesome` 的 cookie: + +``` +$ http GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 223 +Content-Type: text/html; charset=utf-8 +Date: Fri, 09 Aug 2019 20:22:39 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + + +Redirecting... +

Redirecting...

+

You should be redirected automatically to target URL: +/cookies. If not click the link. +``` + +注意 `Set-Cookie: opensource=awesome; Path=/` 的响应头。这表明你预期设置的 cookie 已正确设置,路径为 `/`。另请注意,即使你得到了 `302` 重定向,`http` 也不会遵循它。如果你想要遵循重定向,则需要明确使用 `--follow` 标志请求: + +``` +$ http --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Encoding: gzip +Content-Length: 66 +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:33:34 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +{ + "cookies": { + "opensource": "awesome" + } +} +``` + +但此时你无法看到原来的 `Set-Cookie` 头。为了看到中间响应,你需要使用 `--all`: + + +``` +$ http --headers --all --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Type: text/html; charset=utf-8 +Date: Sat, 10 Aug 2019 01:38:40 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 223 +Connection: keep-alive + +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Encoding: gzip +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:38:41 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 66 +Connection: keep-alive +``` + +打印响应体并不有趣,因为你大多数时候只关心 cookie。如果你想看到中间请求的响应头,而不是最终请求中的响应体,你可以使用: + +``` +$ http --print hb --history-print h --all --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Type: text/html; charset=utf-8 +Date: Sat, 10 Aug 2019 01:40:56 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 223 +Connection: keep-alive + +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Encoding: gzip +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:40:56 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 66 +Connection: keep-alive + +{ + "cookies": { + "opensource": "awesome" + } +} +``` + +你可以使用 `--print` 精确控制打印的内容(`h`:响应头;`b`:响应体),并使用 `--history-print` 覆盖中间请求的打印内容设置。 + +### 使用 HTTPie 下载二进制文件 + +有时响应体并不是文本形式,它需要发送到可被不同应用打开的文件: + +``` +$ http GET https://httpbin.org/image/jpeg +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 35588 +Content-Type: image/jpeg +Date: Fri, 09 Aug 2019 20:25:49 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + + ++-----------------------------------------+ +| NOTE: binary data not shown in terminal | ++-----------------------------------------+ +``` + +要得到正确的图片,你需要保存到文件: + +``` +$ http --download GET https://httpbin.org/image/jpeg +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 35588 +Content-Type: image/jpeg +Date: Fri, 09 Aug 2019 20:28:13 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +Downloading 34.75 kB to "jpeg.jpe" +Done. 34.75 kB in 0.00068s (50.05 MB/s) +``` + +试一下!图片很可爱。 + +### 使用 HTTPie 发送自定义请求 + +你可以发送指定的请求头。这对于需要非标准头的自定义 Web API 很有用: + +``` +$ http GET https://httpbin.org/headers X-Open-Source-Com:Awesome +{ + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2", + "X-Open-Source-Com": "Awesome" + } +} +``` + +最后,如果要发送 JSON 字段(尽管可以指定确切的内容),对于许多嵌套较少的输入,你可以使用快捷方式: + + +``` +$ http --body PUT https://httpbin.org/anything open-source=awesome author=moshez +{ + "args": {}, + "data": "{\"open-source\": \"awesome\", \"author\": \"moshez\"}", + "files": {}, + "form": {}, + "headers": { + "Accept": "application/json, */*", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "46", + "Content-Type": "application/json", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "json": { + "author": "moshez", + "open-source": "awesome" + }, + "method": "PUT", + "origin": "73.162.254.113, 73.162.254.113", + "url": "https://httpbin.org/anything" +} +``` + +下次在调试 Web API 时,无论是你自己的还是别人的,记得放下 cURL,试试 HTTPie 这个命令行工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/getting-started-httpie + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshezhttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pie-raspberry-bake-make-food.png?itok=QRV_R8Fa (Raspberry pie with slice missing) +[2]: https://httpie.org/ +[3]: https://github.com/postmanlabs/httpbin +[4]: https://en.wikipedia.org/wiki/Wget +[5]: https://en.wikipedia.org/wiki/CURL +[6]: https://opensource.com/article/19/6/virtual-environments-python-macos diff --git a/published/201909/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md b/published/201909/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md new file mode 100644 index 0000000000..f0d1ba9087 --- /dev/null +++ b/published/201909/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11315-1.html) +[#]: subject: (Three Ways to Exclude Specific/Certain Packages from Yum Update) +[#]: via: (https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +从 Yum 更新中排除特定/某些包的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/07/145817rj7khqkbqwqx7sb9.jpg) + +作为系统更新的一部分,你也许需要在基于 Red Hat 系统中由于应用依赖排除一些软件包。 + +如果是,如何排除?可以采取多少种方式?有三种方式可以做到,我们会在本篇中教你这三种方法。 + +包管理器是一组工具,它允许用户在 Linux 系统中轻松管理包。它能让用户在 Linux 系统中安装、更新/升级、删除、查询、重新安装和搜索软件包。 + +对于基于 Red Hat 的系统,我们使用 [yum 包管理器][1] 和 [rpm 包管理器][2] 进行包管理。 + +### 什么是 yum? + +yum 代表 “Yellowdog Updater, Modified”。Yum 是用于 rpm 系统的自动更新程序和包安装/卸载器。 + +它在安装包时自动解决依赖关系。 + +### 什么是 rpm? + +rpm 代表 “Red Hat Package Manager”,它是一款用于 Red Hat 系统的功能强大的包管理工具。 + +RPM 指的是 `.rpm` 文件格式,它包含已编译的软件和必要的库。 + +你可能有兴趣阅读以下与本主题相关的文章。如果是的话,请进入相应的链接。 + + * [如何检查 Red Hat(RHEL)和 CentOS 系统上的可用安全更新][3] + * [在 Red Hat(RHEL)和 CentOS 系统上安装安全更新的四种方法][4] + * [在 Redhat(RHEL)和 CentOS 系统上检查或列出已安装的安全更新的两种方法][5] + +### 方法 1:手动或临时用 yum 命令排除包 + +我们可以在 yum 中使用 `--exclude` 或 `-x` 开关来阻止 yum 命令获取特定包的更新。 + +我可以说,这是一种临时方法或按需方法。如果你只想将特定包排除一次,那么我们可以使用此方法。 + +以下命令将更新除 kernel 之外的所有软件包。 + +要排除单个包: + +``` +# yum update --exclude=kernel +或者 +# yum update -x 'kernel' +``` + +要排除多个包。以下命令将更新除 kernel 和 php 之外的所有软件包。 + +``` +# yum update --exclude=kernel* --exclude=php* +或者 +# yum update --exclude httpd,php +``` + +### 方法 2:在 yum 命令中永久排除软件包 + +这是永久性方法,如果你经常执行修补程序更新,那么可以使用此方法。 + +为此,请在 `/etc/yum.conf` 中添加相应的软件包以永久禁用软件包更新。 + +添加后,每次运行 `yum update` 命令时都不需要指定这些包。此外,这可以防止任何意外更新这些包。 + +``` +# vi /etc/yum.conf + +[main] +cachedir=/var/cache/yum/$basearch/$releasever +keepcache=0 +debuglevel=2 +logfile=/var/log/yum.log +exactarch=1 +obsoletes=1 +gpgcheck=1 +plugins=1 +installonly_limit=3 +exclude=kernel* php* +``` + +### 方法 3:使用 Yum versionlock 插件排除包 + +这也是与上面类似的永久方法。Yum versionlock 插件允许用户通过 `yum` 命令锁定指定包的更新。 + +为此,请运行以下命令。以下命令将从 `yum update` 中排除 freetype 包。 + +或者,你可以直接在 `/etc/yum/pluginconf.d/versionlock.list` 中添加条目。 + +``` +# yum versionlock add freetype + +Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock +Adding versionlock on: 0:freetype-2.8-12.el7 +versionlock added: 1 +``` + +运行以下命令来检查被 versionlock 插件锁定的软件包列表。 + +``` +# yum versionlock list + +Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock +0:freetype-2.8-12.el7.* +versionlock list done +``` + +运行以下命令清空该列表。 + +``` +# yum versionlock clear +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/rpm-command-examples/ +[3]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/ +[4]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/ +[5]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/ diff --git a/published/201909/20190830 Change your Linux terminal color theme.md b/published/201909/20190830 Change your Linux terminal color theme.md new file mode 100644 index 0000000000..321dc40997 --- /dev/null +++ b/published/201909/20190830 Change your Linux terminal color theme.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11310-1.html) +[#]: subject: (Change your Linux terminal color theme) +[#]: via: (https://opensource.com/article/19/8/add-color-linux-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何更改 Linux 终端颜色主题 +====== + +> 你可以用丰富的选项来定义你的终端主题。 + +![](https://img.linux.net.cn/data/attachment/album/201909/06/070600ztd434ppd99df99d.jpg) + +如果你大部分时间都盯着终端,那么你很自然地希望它看起来能赏心悦目。美与不美,全在观者,自 CRT 串口控制台以来,终端已经经历了很多变迁。因此,你的软件终端窗口有丰富的选项,可以用来定义你看到的主题,不管你如何定义美,这总是件好事。 + +### 设置 + +包括 GNOME、KDE 和 Xfce 在内的流行的软件终端应用,它们都提供了更改其颜色主题的选项。调整主题就像调整应用首选项一样简单。Fedora、RHEL 和 Ubuntu 默认使用 GNOME,因此本文使用该终端作为示例,但对 Konsole、Xfce 终端和许多其他终端的设置流程类似。 + +首先,进入到应用的“首选项”或“设置”面板。在 GNOME 终端中,你可以通过屏幕顶部或窗口右上角的“应用”菜单访问它。 + +在“首选项”中,单击“配置文件” 旁边的加号(“+”)来创建新的主题配置文件。在新配置文件中,单击“颜色”选项卡。 + +![GNOME Terminal preferences][2] + +在“颜色”选项卡中,取消选择“使用系统主题中的颜色”选项,以使窗口的其余部分变为可选状态。最开始,你可以选择内置的颜色方案。这些包括浅色主题,它有明亮的背景和深色的前景文字;还有深色主题,它有深色背景和浅色前景文字。 + +当没有其他设置(例如 `dircolors` 命令的设置)覆盖它们时,“默认颜色”色板将同时定义前景色和背景色。“调色板”设置 `dircolors` 命令定义的颜色。这些颜色由终端以 `LS_COLORS` 环境变量的形式使用,以在 [ls][3] 命令的输出中添加颜色。如果这些颜色不吸引你,请在此更改它们。 + +如果对主题感到满意,请关闭“首选项”窗口。 + +要将终端更改为新的配置文件,请单击“应用”菜单,然后选择“配置文件”。选择新的配置文件,接着享受自定义主题。 + +![GNOME Terminal profile selection][4] + +### 命令选项 + +如果你的终端没有合适的设置窗口,它仍然可以在启动命令中提供颜色选项。xterm 和 rxvt 终端(旧的和启用 Unicode 的变体,有时称为 urxvt 或 rxvt-unicode)都提供了这样的选项,因此即使没有桌面环境和大型 GUI 框架,你仍然可以设置终端模拟器的主题。 + +两个明显的选项是前景色和背景色,分别用 `-fg` 和 `-bg` 定义。每个选项的参数是*颜色名*而不是它的 ANSI 编号。例如: + +``` +$ urxvt -bg black -fg green +``` + +这些会设置默认的前景和背景。如果有任何其他规则会控制特定文件或设备类型的颜色,那么就使用这些颜色。有关如何设置它们的信息,请参阅 [dircolors][5] 命令。 + +你还可以使用 `-cr` 设置文本光标(而不是鼠标光标)的颜色: + +``` +$ urxvt -bg black -fg green -cr teal +``` + +![Setting color in urxvt][6] + +你的终端模拟器可能还有更多选项,如边框颜色(rxvt 中的 `-bd`)、光标闪烁(urxvt 中的 `-bc` 和 `+bc`),甚至背景透明度。请参阅终端的手册页,了解更多的功能。 + +要使用你选择的颜色启动终端,你可以将选项添加到用于启动终端的命令或菜单中(例如,在你的 Fluxbox 菜单文件、`$HOME/.local/share/applications` 目录中的 `.desktop` 或者类似的)。或者,你可以使用 [xrdb][7] 工具来管理与 X 相关的资源(但这超出了本文的范围)。 + +### 家是可定制的地方 + +自定义 Linux 机器并不意味着你需要学习如何编程。你可以而且应该进行小而有意义的更改,来使你的数字家庭感觉更舒适。而且没有比终端更好的起点了! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/add-color-linux-terminal + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://opensource.com/sites/default/files/uploads/gnome-terminal-preferences.jpg (GNOME Terminal preferences) +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://opensource.com/sites/default/files/uploads/gnome-terminal-profile-select.jpg (GNOME Terminal profile selection) +[5]: http://man7.org/linux/man-pages/man1/dircolors.1.html +[6]: https://opensource.com/sites/default/files/uploads/urxvt-color.jpg (Setting color in urxvt) +[7]: https://www.x.org/releases/X11R7.7/doc/man/man1/xrdb.1.xhtml diff --git a/published/201909/20190830 How to Create and Use Swap File on Linux.md b/published/201909/20190830 How to Create and Use Swap File on Linux.md new file mode 100644 index 0000000000..d8db4b5623 --- /dev/null +++ b/published/201909/20190830 How to Create and Use Swap File on Linux.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11341-1.html) +[#]: subject: (How to Create and Use Swap File on Linux) +[#]: via: (https://itsfoss.com/create-swap-file-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 上创建和使用交换文件 +====== + +本教程讨论了 Linux 中交换文件的概念,为什么使用它以及它相对于传统交换分区的优势。你将学习如何创建交换文件和调整其大小。 + +### 什么是 Linux 的交换文件? + +交换文件允许 Linux 将磁盘空间模拟为内存。当你的系统开始耗尽内存时,它会使用交换空间将内存的一些内容交换到磁盘空间上。这样释放了内存,为更重要的进程服务。当内存再次空闲时,它会从磁盘交换回数据。我建议[阅读这篇文章,了解 Linux 上的交换空间的更多内容][1]。 + +传统上,交换空间是磁盘上的一个独立分区。安装 Linux 时,只需创建一个单独的分区进行交换。但是这种趋势在最近几年发生了变化。 + +使用交换文件,你不再需要单独的分区。你会根目录下创建一个文件,并告诉你的系统将其用作交换空间就行了。 + +使用专用的交换分区,在许多情况下,调整交换空间的大小是一个可怕而不可能的任务。但是有了交换文件,你可以随意调整它们的大小。 + +最新版本的 Ubuntu 和其他一些 Linux 发行版已经开始 [默认使用交换文件][2]。甚至如果你没有创建交换分区,Ubuntu 也会自己创建一个 1GB 左右的交换文件。 + +让我们看看交换文件的更多信息。 + +![](https://img.linux.net.cn/data/attachment/album/201909/14/190637uggjgsjoogxg3vh0.jpg) + +### 检查 Linux 的交换空间 + +在你开始添加交换空间之前,最好检查一下你的系统中是否已经有了交换空间。 + +你可以用[Linux 上的 free 命令][4]检查它。就我而言,我的[戴尔 XPS][5]有 14GB 的交换容量。 + +``` +free -h + total used free shared buff/cache available +Mem: 7.5G 4.1G 267M 971M 3.1G 2.2G +Swap: 14G 0B 14G +``` + +`free` 命令给出了交换空间的大小,但它并没有告诉你它是真实的交换分区还是交换文件。`swapon` 命令在这方面会更好。 + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/dev/nvme0n1p4 partition 14.9G 0B -2 +``` + +如你所见,我有 14.9GB 的交换空间,它在一个单独的分区上。如果是交换文件,类型应该是 `file` 而不是 `partition`。 + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/swapfile file 2G 0B -2 +``` + +如果你的系统上没有交换空间,它应该显示如下内容: + +``` +free -h + total used free shared buff/cache available +Mem: 7.5G 4.1G 267M 971M 3.1G 2.2G +Swap: 0B 0B 0B +``` + +而 `swapon` 命令不会显示任何输出。 + + +### 在 Linux 上创建交换文件 + +如果你的系统没有交换空间,或者你认为交换空间不足,你可以在 Linux 上创建交换文件。你也可以创建多个交换文件。 + +让我们看看如何在 Linux 上创建交换文件。我在本教程中使用 Ubuntu 18.04,但它也应该适用于其他 Linux 发行版本。 + +#### 步骤 1:创建一个新的交换文件 + +首先,创建一个具有所需交换空间大小的文件。假设我想给我的系统增加 1GB 的交换空间。使用`fallocate` 命令创建大小为 1GB 的文件。 + +``` +sudo fallocate -l 1G /swapfile +``` + +建议只允许 `root` 用户读写该交换文件。当你尝试将此文件用于交换区域时,你甚至会看到类似“不安全权限 0644,建议 0600”的警告。 + +``` +sudo chmod 600 /swapfile +``` + +请注意,交换文件的名称可以是任意的。如果你需要多个交换空间,你可以给它任何合适的名称,如 `swap_file_1`、`swap_file_2` 等。它们只是一个预定义大小的文件。 + +#### 步骤 2:将新文件标记为交换空间 + +你需要告诉 Linux 系统该文件将被用作交换空间。你可以用 [mkswap][7] 工具做到这一点。 + +``` +sudo mkswap /swapfile +``` + +你应该会看到这样的输出: + +``` +Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) +no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a +``` + +#### 步骤 3:启用交换文件 + +现在,你的系统知道文件 `swapfile` 可以用作交换空间。但是还没有完成。你需要启用该交换文件,以便系统可以开始使用该文件作为交换。 + +``` +sudo swapon /swapfile +``` + +现在,如果你检查交换空间,你应该会看到你的 Linux 系统会识别并使用它作为交换空间: + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/swapfile file 1024M 0B -2 +``` + +#### 步骤 4:让改变持久化 + +迄今为止你所做的一切都是暂时的。重新启动系统,所有更改都将消失。 + +你可以通过将新创建的交换文件添加到 `/etc/fstab` 文件来使更改持久化。 + +对 `/etc/fstab` 文件进行任何更改之前,最好先进行备份。 + +``` +sudo cp /etc/fstab /etc/fstab.back +``` + +现在将以下行添加到 `/etc/fstab` 文件的末尾: + +``` +/swapfile none swap sw 0 0 +``` + +你可以使用[命令行文本编辑器][8]手动操作,或者使用以下命令: + +``` +echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab +``` + +现在一切都准备好了。即使在重新启动你的 Linux 系统后,你的交换文件也会被使用。 + +### 调整 swappiness 参数 + +`swappiness` 参数决定了交换空间的使用频率。`swappiness` 值的范围从 0 到 100。较高的值意味着交换空间将被更频繁地使用。 + +Ubuntu 桌面的默认的 `swappiness` 是 60,而服务器的默认 `swappiness` 是 1。你可以使用以下命令检查 `swappiness`: + +``` +cat /proc/sys/vm/swappiness +``` + +为什么服务器应该使用低的 `swappiness` 值?因为交换空间比内存慢,为了获得更好的性能,应该尽可能多地使用内存。在服务器上,性能因素至关重要,因此 `swappiness` 应该尽可能低。 + +你可以使用以下系统命令动态更改 `swappiness`: + +``` +sudo sysctl vm.swappiness=25 +``` + +这种改变只是暂时的。如果要使其永久化,可以编辑 `/etc/sysctl.conf` 文件,并在文件末尾添加`swappiness` 值: + +``` +vm.swappiness=25 +``` + +### 在 Linux 上调整交换空间的大小 + +在 Linux 上有几种方法可以调整交换空间的大小。但是在你看到这一点之前,你应该了解一些关于它的事情。 + +当你要求系统停止将交换文件用于交换空间时,它会将所有数据(确切地说是内存页)传输回内存。所以你应该有足够的空闲内存,然后再停止交换。 + +这就是为什么创建和启用另一个临时交换文件是一个好的做法的原因。这样,当你关闭原来的交换空间时,你的系统将使用临时交换文件。现在你可以调整原来的交换空间的大小。你可以手动删除临时交换文件或留在那里,下次启动时会自动删除(LCTT 译注:存疑?)。 + +如果你有足够的可用内存或者创建了临时交换空间,那就关闭你原来的交换文件。 + +``` +sudo swapoff /swapfile +``` + +现在你可以使用 `fallocate` 命令来更改文件的大小。比方说,你将其大小更改为 2GB: + +``` +sudo fallocate -l 2G /swapfile +``` + +现在再次将文件标记为交换空间: + +``` +sudo mkswap /swapfile +``` + +并再次启用交换文件: + +``` +sudo swapon /swapfile +``` + +你也可以选择同时拥有多个交换文件。 + +### 删除 Linux 中的交换文件 + +你可能有不在 Linux 上使用交换文件的原因。如果你想删除它,该过程类似于你刚才看到的调整交换大小的过程。 + +首先,确保你有足够的空闲内存。现在关闭交换文件: + +``` +sudo swapoff /swapfile +``` + +下一步是从 `/etc/fstab` 文件中删除相应的条目。 + +最后,你可以删除该文件来释放空间: + +``` +sudo rm /swapfile +``` + +### 你用了交换空间了吗? + +我想你现在已经很好地理解了 Linux 中的交换文件概念。现在,你可以根据需要轻松创建交换文件或调整它们的大小。 + +如果你对这个话题有什么要补充的或者有任何疑问,请在下面留下评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/create-swap-file-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[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://itsfoss.com/swap-size/ +[2]: https://help.ubuntu.com/community/SwapFaq +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/swap-file-linux.png?resize=800%2C450&ssl=1 +[4]: https://linuxhandbook.com/free-command/ +[5]: https://itsfoss.com/dell-xps-13-ubuntu-review/ +[6]: https://itsfoss.com/fix-missing-system-settings-ubuntu-1404-quick-tip/ +[7]: http://man7.org/linux/man-pages/man8/mkswap.8.html +[8]: https://itsfoss.com/command-line-text-editors-linux/ +[9]: https://itsfoss.com/replace-linux-from-dual-boot/ diff --git a/published/201909/20190830 git exercises- navigate a repository.md b/published/201909/20190830 git exercises- navigate a repository.md new file mode 100644 index 0000000000..2c7899d172 --- /dev/null +++ b/published/201909/20190830 git exercises- navigate a repository.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11379-1.html) +[#]: subject: (git exercises: navigate a repository) +[#]: via: (https://jvns.ca/blog/2019/08/30/git-exercises--navigate-a-repository/) +[#]: author: (Julia Evans https://jvns.ca/) + +Git 练习:存储库导航 +====== + +我觉得前几天的 [curl 练习][1]进展顺利,所以今天我醒来后,想尝试编写一些 Git 练习。Git 是一大块需要学习的技能,可能要花几个小时才能学会,所以我分解练习的第一个思路是从“导航”一个存储库开始的。 + +我本来打算使用一个玩具测试库,但后来我想,为什么不使用真正的存储库呢?这样更有趣!因此,我们将浏览 Ruby 编程语言的存储库。你无需了解任何 C 即可完成此练习,只需熟悉一下存储库中的文件随时间变化的方式即可。 + +### 克隆存储库 + +开始之前,需要克隆存储库: + +``` +git clone https://github.com/ruby/ruby +``` + +与实际使用的大多数存储库相比,该存储库的最大不同之处在于它没有分支,但是它有很多标签,它们与分支相似,因为它们都只是指向一个提交的指针而已。因此,我们将使用标签而不是分支进行练习。*改变*标签的方式和分支非常不同,但*查看*标签和分支的方式完全相同。 + +### Git SHA 总是引用同一个代码 + +执行这些练习时要记住的最重要的一点是,如本页面所述,像`9e3d9a2a009d2a0281802a84e1c5cc1c887edc71` 这样的 Git SHA 始终引用同一个的代码。下图摘自我与凯蒂·西勒·米勒撰写的一本杂志,名为《[Oh shit, git!][2]》。(她还有一个名为 的很棒的网站,启发了该杂志。) + +![](https://wizardzines.com/zines/oh-shit-git/samples/ohshit-commit.png) + +我们将在练习中大量使用 Git SHA,以使你习惯于使用它们,并帮助你了解它们与标签和分支的对应关系。 + +### 我们将要使用的 Git 子命令 + +所有这些练习仅使用这 5 个 Git 子命令: + +``` +git checkout +git log (--oneline, --author, and -S will be useful) +git diff (--stat will be useful) +git show +git status +``` + +### 练习 + +1. 查看 matz 从 1998 年开始的 Ruby 提交。提交 ID 为 ` 3db12e8b236ac8f88db8eb4690d10e4a3b8dbcd4`。找出当时 Ruby 的代码行数。 +2. 检出当前的 master 分支。 +3. 查看文件 `hash.c` 的历史记录。更改该文件的最后一个提交 ID 是什么? +4. 了解最近 20 年来 `hash.c` 的变化:将 master 分支上的文件与提交 `3db12e8b236ac8f88db8eb4690d10e4a3b8dbcd4` 的文件进行比较。 +5. 查找最近更改了 `hash.c` 的提交,并查看该提交的差异。 +6. 对于每个 Ruby 版本,该存储库都有一堆**标签**。获取所有标签的列表。 +7. 找出在标签 `v1_8_6_187` 和标签 `v1_8_6_188` 之间更改了多少文件。 +8. 查找 2015 年的提交(任何一个提交)并将其检出,简单地查看一下文件,然后返回 master 分支。 +9. 找出标签 `v1_8_6_187` 对应的提交。 +10. 列出目录 `.git/refs/tags`。运行 `cat .git/refs/tags/v1_8_6_187` 来查看其中一个文件的内容。 +11. 找出当前 `HEAD` 对应的提交 ID。 +12. 找出已经对 `test/` 目录进行了多少次提交。 +13. 提交 `65a5162550f58047974793cdc8067a970b2435c0` 和 `9e3d9a2a009d2a0281802a84e1c5cc1c887edc71` 之间的 `lib/telnet.rb` 的差异。该文件更改了几行? +14. 在 Ruby 2.5.1 和 2.5.2 之间进行了多少次提交(标记为 `v2_5_1` 和 `v2_5_3`)(这一步有点棘手,步骤不只一步) +15. “matz”(Ruby 的创建者)作了多少提交? +16. 最近包含 “tkutil” 一词的提交是什么? +17. 检出提交 `e51dca2596db9567bd4d698b18b4d300575d3881` 并创建一个指向该提交的新分支。 +18. 运行 `git reflog` 以查看你到目前为止完成的所有存储库导航操作。 +   +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/08/30/git-exercises--navigate-a-repository/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/08/27/curl-exercises/ +[2]: https://wizardzines.com/zines/oh-shit-git/ diff --git a/published/201909/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md b/published/201909/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md new file mode 100644 index 0000000000..c6370eb975 --- /dev/null +++ b/published/201909/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11292-1.html) +[#]: subject: (Google opens Android speech transcription and gesture tracking, Twitter's telemetry tooling, Blender's growing adoption, and more news) +[#]: via: (https://opensource.com/19/8/news-august-31) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +开源新闻综述:谷歌开源 Android 语音转录和手势追踪、Twitter 的遥测工具 +====== + +> 不要错过两周以来最大的开源头条新闻。 + +![Weekly news roundup with TV][1] + +在本期的开源新闻综述中,我们来看看谷歌发布的两个开源软件、Twitter 的最新可观测性工具、动漫工作室对 Blender 的采用在增多等等新闻! + +### 谷歌的开源双响炮 + +搜索引擎巨头谷歌的开发人员最近一直忙于开源。在过去的两周里,他们以开源的方式发布了两个截然不同的软件。 + +第一个是 Android 的语音识别和转录工具 Live Transcribe 的[语音引擎][2],它可以“在移动设备上使用机器学习算法将音频变成实时字幕”。谷歌的声明称,它正在开源 Live Transcribe 以“让所有开发人员可以为长篇对话提供字幕”。你可以[在 GitHub 上][3]浏览或下载 Live Transcribe 的源代码。 + +谷歌还为 Android 和 iOS 开源了[手势跟踪软件][4],它建立在其 [MediaPipe][5] 机器学习框架之上。该软件结合了三种人工智能组件:手掌探测器、“返回 3D 手点”的模型和手势识别器。据谷歌研究人员称,其目标是改善“跨各种技术领域和平台的用户体验”。该软件的源代码和文档[可在 GitHub 上获得][6]。 + +### Twitter 开源 Rezolus 遥测工具 + +当想到网络中断时,我们想到的是影响站点或服务性能的大崩溃或减速。让我们感到惊讶的是性能慢慢被吃掉的小尖峰的重要性。为了更容易地检测这些尖峰,Twitter 开发了一个名为 Rezolus 的工具,该公司[已将其开源][7]。 + +> 我们现有的按分钟采样的遥测技术未能反映出这些异常现象。这是因为相对于该异常发生的长度,较低的采样率掩盖了这些持续时间大约为 10 秒的异常。这使得很难理解正在发生的事情并调整系统以获得更高的性能。 + +Rezolus 旨在检测“非常短暂但有时显著的性能异常”——仅持续几秒钟。Twitter 已经运行了 Rezolus 大约一年,并且一直在使用它收集的内容“与后端服务日志来确定峰值的来源”。 + +如果你对将 Rezolus 添加到可观测性堆栈中的结果感到好奇,请查看 Twitter 的 [GitHub 存储库][8]中的源代码。 + +### 日本的 Khara 动画工作室采用 Blender + +Blender 被认为是开源的动画和视觉效果软件的黄金标准。它被几家制作公司采用,其中最新的是[日本动漫工作室 Khara][9]。 + +Khara 正在使用 Blender 开发 Evangelion: 3.0+1.0,这是基于流行动漫系列《Neon Genesis Evangelion》的电影系列的最新版本。虽然该电影的工作不能在 Blender 中全部完成,但 Khara 的员工“将从 2020 年 6 月开始使用 Blender 进行大部分工作”。为了强调其对 Blender 和开源的承诺,“Khara 宣布它将作为企业会员加入 Blender 基金会的发展基金。“ + +### NSA 分享其固件安全工具 + +继澳大利亚同行[共享他们的一个工具][10]之后,美国国家安全局(NSA)正在[提供][11]的一个项目的成果“可以更好地保护机器免受固件攻击“。这个最新的软件以及其他保护固件的开源工作可以在 [Coreboot Gerrit 存储库][12]下找到。 + +这个名为“具有受保护执行的 SMI 传输监视器”(STM-PE)的软件“将与运行 Coreboot 的 x86 处理器配合使用”以防止固件攻击。根据 NSA 高级网络安全实验室的 Eugene Meyers 的说法,STM-PE 采用低级操作系统代码“并将其置于一个盒子中,以便它只能访问它需要访问的设备系统”。这有助于防止篡改,Meyers 说,“这将提高系统的安全性。” + +### 其它新闻 + +* [Linux 内核中的 exFAT?是的!][13] +* [瓦伦西亚继续支持 Linux 学校发行版][14] +* [西班牙首个开源卫星][15] +* [Western Digital 从开放标准到开源芯片的长途旅行][16] +* [用于自动驾驶汽车多模传感器的 Waymo 开源数据集][17] + +一如既往地感谢 Opensource.com 的工作人员和主持人本周的帮助。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/19/8/news-august-31 + +作者:[Scott Nesbitt][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://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://venturebeat.com/2019/08/16/google-open-sources-live-transcribes-speech-engine/ +[3]: https://github.com/google/live-transcribe-speech-engine +[4]: https://venturebeat.com/2019/08/19/google-open-sources-gesture-tracking-ai-for-mobile-devices/ +[5]: https://github.com/google/mediapipe +[6]: https://github.com/google/mediapipe/blob/master/mediapipe/docs/hand_tracking_mobile_gpu.md +[7]: https://blog.twitter.com/engineering/en_us/topics/open-source/2019/introducing-rezolus.html +[8]: https://github.com/twitter/rezolus +[9]: https://www.neowin.net/news/anime-studio-khara-is-planning-to-use-open-source-blender-software/ +[10]: https://linux.cn/article-11241-1.html +[11]: https://www.cyberscoop.com/nsa-firmware-open-source-coreboot-stm-pe-eugene-myers/ +[12]: https://review.coreboot.org/admin/repos +[13]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[14]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/120000-lliurex-desktops +[15]: https://hackaday.com/2019/08/15/spains-first-open-source-satellite/ +[16]: https://www.datacenterknowledge.com/open-source/western-digitals-long-trip-open-standards-open-source-chips +[17]: https://venturebeat.com/2019/08/21/waymo-open-sources-data-set-for-autonomous-vehicle-multimodal-sensors/ diff --git a/published/201909/20190901 Best Linux Distributions For Everyone in 2019.md b/published/201909/20190901 Best Linux Distributions For Everyone in 2019.md new file mode 100644 index 0000000000..4a6e136180 --- /dev/null +++ b/published/201909/20190901 Best Linux Distributions For Everyone in 2019.md @@ -0,0 +1,386 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11411-1.html) +[#]: subject: (Best Linux Distributions For Everyone in 2019) +[#]: via: (https://itsfoss.com/best-linux-distributions/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +2019 年最好的 Linux 发行版 +====== + +> 哪个是最好的 Linux 发行版呢?这个问题是没有明确的答案的。这就是为什么我们按各种分类汇编了这个最佳 Linux 列表的原因。 + +有许多 Linux 发行版,我甚至想不出一个确切的数量,因为你会发现很多不同的 Linux 发行版。 + +其中有些只是另外一个的复制品,而有些往往是独一无二的。这虽然有点混乱——但这也是 Linux 的优点。 + +不用担心,尽管有成千上万的发行版,在这篇文章中,我已经列出了目前最好的 Linux 发行版。当然,这个列表是主观的。但是,在这里,我们试图对发行版进行分类——每个发行版本都有自己的特点的。 + +* 面向初学者的 Linux 用户的最佳发行版 +* 最佳 Linux 服务器发行版 +* 可以在旧计算机上运行的最佳 Linux 发行版 +* 面向高级 Linux 用户的最佳发行版 +* 最佳常青树 Linux 发行版 + +**注:** 该列表没有特定的排名顺序。 + +### 面向初学者的最佳 Linux 发行版 + +在这个分类中,我们的目标是列出开箱即用的易用发行版。你不需要深度学习,你可以在安装后马上开始使用,不需要知道任何命令或技巧。 + +#### Ubuntu + +![][6] + +Ubuntu 无疑是最流行的 Linux 发行版之一。你甚至可以发现它已经预装在很多笔记本电脑上了。 + +用户界面很容易适应。如果你愿意,你可以根据自己的要求轻松定制它的外观。无论哪种情况,你都可以选择安装一个主题。你可以从了解更多关于[如何在 Ubuntu 安装主题的][7]的信息来起步。 + +除了它本身提供的功能外,你会发现一个巨大的 Ubuntu 用户在线社区。因此,如果你有问题——可以去任何论坛(或版块)寻求帮助。如果你想直接寻找解决方案,你应该看看我们对 [Ubuntu][8] 的报道(我们有很多关于 Ubuntu 的教程和建议)。 + +- [Ubuntu][9] + +#### Linux Mint + +![][10] + +Linux Mint Cinnamon 是另一个受初学者欢迎的 Linux 发行版。默认的 Cinnamon 桌面类似于 Windows XP,这就是为什么当 Windows XP 停止维护时许多用户选择它的原因。 + +Linux Mint 基于 Ubuntu,因此它具有适用于 Ubuntu 的所有应用程序。简单易用是它成为 Linux 新用户首选的原因。 + +- [Linux Mint][11] + +#### elementary OS + +![][12] + +elementary OS 是我用过的最漂亮的 Linux 发行版之一。用户界面类似于苹果操作系统——所以如果你已经使用了苹果系统,则很容易适应。 + +该发行版基于 Ubuntu,致力于提供一个用户友好的 Linux 环境,该环境在考虑性能的同时尽可能美观。如果你选择安装 elementary OS,这份[在安装 elementary OS 后要做的 11 件事的清单][13]会派上用场。 + +- [elementary OS][14] + +#### MX Linux + +![][15] + +大约一年前,MX Linux 成为众人瞩目的焦点。现在(在发表这篇文章的时候),它是 [DistroWatch.com][16] 上最受欢迎的 Linux 发行版。如果你还没有使用过它,那么当你开始使用它时,你会感到惊讶。 + +与 Ubuntu 不同,MX Linux 是一个基于 Debian 的日益流行的发行版,采用 Xfce 作为其桌面环境。除了无与伦比的稳定性之外,它还配备了许多图形用户界面工具,这使得任何习惯了 Windows/Mac 的用户易于使用它。 + +此外,软件包管理器还专门针对一键安装进行了量身定制。你甚至可以搜索 [Flatpak][18] 软件包并立即安装它(默认情况下,Flathub 在软件包管理器中是可用的来源之一)。 + +- [MX Linux][19] + +#### Zorin OS + +![][20] + +Zorin OS 是又一个基于 Ubuntu 的发行版,它又是桌面上最漂亮、最直观的操作系统之一。尤其是在[Zorin OS 15 发布][21]之后——我绝对会向没有任何 Linux 经验的用户推荐它。它也引入了许多基于图形用户界面的应用程序。 + +你也可以将其安装在旧电脑上,但是,请确保选择“Lite”版本。此外,你还有“Core”、“Education”和 “Ultimate”版本可以选择。你可以选择免费安装 Core 版,但是如果你想支持开发人员并帮助改进 Zorin,请考虑获得 Ultimate 版。 + +Zorin OS 是由两名爱尔兰的青少年创建的。你可以[在这里阅读他们的故事][22]。 + +- [Zorin OS][23] + +#### Pop!_OS + +![](https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/pop-1.jpg?w=800&ssl=1) + +Sytem76 的 Pop!_OS 是开发人员或计算机科学专业人员的理想选择。当然,不仅限于编码人员,如果你刚开始使用 Linux,这也是一个很好的选择。它基于 Ubuntu,但是其 UI 感觉更加直观和流畅。除了 UI 外,它还强制执行全盘加密。 + +你可以通过文章下面的评论看到,我们的许多读者似乎都喜欢(并坚持使用)它。如果你对此感到好奇,也应该查看一下我们关于 Phillip Prado 的 [Pop!_OS 的动手实践](https://itsfoss.com/pop-os-linux-review/)的文章。 + +(LCTT 译注:这段推荐是原文后来补充的,因为原文下面很多人在评论推荐。) + +- [Pop!_OS](https://system76.com/pop) + +#### 其他选择 + +[深度操作系统][24] 和其他的 Ubuntu 变种(如 Kubuntu、Xubuntu)也是初学者的首选。如果你想寻求更多的选择,你可以看看。(LCTT 译注:我知道你们肯定对将深度操作系统列入其它不满意——这个锅归原作者。) + +如果你想要挑战自己,你可以试试 Ubuntu 之外的 Fedora —— 但是一定要看看我们关于 [Ubuntu 和 Fedora 对比][25]的文章,从桌面的角度做出更好的选择。 + +### 最好的服务器发行版 + +对于服务器来说,选择 Linux 发行版取决于稳定性、性能和企业级支持。如果你只是尝试,则可以尝试任何你想要的发行版。 + +但是,如果你要为 Web 服务器或任何重要的组件安装它,你应该看看我们的一些建议。 + +#### Ubuntu 服务器 + +根据你的需要,Ubuntu 为你的服务器提供了不同的选项。如果你正在寻找运行在 AWS、Azure、谷歌云平台等平台上的优化解决方案,[Ubuntu Cloud][26] 是一个很好的选择。 + +无论是哪种情况,你都可以选择 Ubuntu 服务器包,并将其安装在你的服务器上。然而,Ubuntu 在云上部署时也是最受欢迎的 Linux 发行版(根据数字判断——[来源1][27]、[来源2][28])。 + +请注意,除非你有特殊要求,我们建议你选择 LTS 版。 + +- [Ubuntu Server][29] + +#### 红帽企业版 Linux(RHEL) + +红帽企业版 Linux(RHEL)是面向企业和组织的顶级 Linux 平台。如果我们按数字来看,红帽可能不是服务器领域最受欢迎的。但是,有相当一部分企业用户依赖于 RHEL (比如联想)。 + +从技术上讲,Fedora 和红帽企业版是相关联的。无论红帽要支持什么——在出现在 RHEL 之前,都要在 Fedora 上进行测试。我不是定制需求的服务器发行版专家,所以你一定要查看他们的[官方文档][30]以了解它是否适合你。 + +- [RHEL][31] + +#### SUSE Linux 企业服务器(SLES) + +![][32] + +别担心,不要把这和 OpenSUSE 混淆。一切都以一个共同的品牌 “SUSE” 命名 —— 但是 OpenSUSE 是一个开源发行版,目标是社区,并且由社区维护。 + +SUSE Linux 企业服务器(SLES)是基于云的服务器最受欢迎的解决方案之一。为了获得管理开源解决方案的优先支持和帮助,你必须选择订阅。 + +- [SLES][33] + +#### CentOS + +![][34] + +正如我提到的,对于 RHEL 你需要订阅。而 CentOS 更像是 RHEL 的社区版,因为它是从 RHEL 的源代码中派生出来的。而且,它是开源的,也是免费的。尽管与过去几年相比,使用 CentOS 的托管提供商数量明显减少,但这仍然是一个很好的选择。 + +CentOS 可能没有加载最新的软件包,但它被认为是最稳定的发行版之一,你可以在各种云平台上找到 CentOS 镜像。如果没有,你可以选择 CentOS 提供的自托管镜像。 + +- [CentOS][35] + +#### 其他选择 + +你也可以尝试 [Fedora Server][36]或[Debian][37]作为上述发行版的替代品。 + +### 旧电脑的最佳 Linux 发行版 + +如果你有一台旧电脑,或者你真的不需要升级你的系统,你仍然可以尝试一些最好的 Linux 发行版。 + +我们已经详细讨论了一些[最好的轻量级 Linux 发行版][42]。在这里,我们将只提到那些真正突出的东西(以及一些新的补充)。 + +#### Puppy Linux + +![][43] + +Puppy Linux 实际上是最小的发行版本之一。刚开始使用 Linux 时,我的朋友建议我尝试一下 Puppy Linux,因为它可以轻松地在较旧的硬件配置上运行。 + +如果你想在你的旧电脑上享受一次爽快的体验,那就值得去看看。多年来,随着一些新的有用特性的增加,用户体验得到了改善。 + +- [Puppy Linux][44] + +#### Solus Budgie + +![][45] + +在最近的一个主要版本——[Solus 4 Fortitude][46] 之后,它是一个令人印象深刻的轻量级桌面操作系统。你可以选择像 GNOME 或 MATE 这样的桌面环境。然而,Solus Budgie 恰好是我的最爱之一,它是一款适合初学者的功能齐全的 Linux发行版,同时对系统资源要求很少。 + +- [Solus][47] + +#### Bodhi + +![][48] + +Bodhi Linux 构建于 Ubuntu 之上。然而,与Ubuntu不同,它在较旧的配置上运行良好。 + +这个发行版的主要亮点是它的 [Moksha 桌面][49](这是 Enlightenment 17 桌面的延续)。用户体验直观且反应极快。即使我个人不用它,你也应该在你的旧系统上试一试。 + +- [Bodhi Linux][50] + +#### antiX + +![][51] + +antiX 部分担起了 MX Linux 的责任,它是一个轻量级的 Linux 发行版,为新的或旧的计算机量身定制。其用户界面并不令人印象深刻——但它可以像预期的那样工作。 + +它基于 Debian,可以作为一个现场版 CD 发行版使用,而不需要安装它。antiX 还提供现场版引导加载程序。与其他发行版相比,你可以保存设置,这样就不会在每次重新启动时丢失设置。不仅如此,你还可以通过其“持久保留”功能将更改保存到根目录中。 + +因此,如果你正在寻找一个可以在旧硬件上提供快速用户体验的现场版 USB 发行版,antiX 是一个不错的选择。 + +- [antiX][52] + +#### Sparky Linux + +![][53] + +Sparky Linux 基于 Debian,它是理想的低端系统 Linux 发行版。伴随着超快的用户体验,Sparky Linux 为不同的用户提供了几个特殊版本(或变种)。 + +例如,它提供了针对一组用户的稳定版本(和变种)和滚动版本。Sparky Linux GameOver 版非常受游戏玩家欢迎,因为它包含了一堆预装的游戏。你可以查看我们的[最佳 Linux 游戏发行版][54] —— 如果你也想在你的系统上玩游戏。 + +#### 其他选择 + +你也可以尝试 [Linux Lite][55]、[Lubuntu][56]、[Peppermint][57] 等轻量级 Linux 发行版。 + +### 面向高级用户的最佳 Linux 发行版 + +一旦你习惯了各种软件包管理器和命令来帮助你解决任何问题,你就可以开始找寻只为高级用户量身定制的 Linux 发行版。 + +当然,如果你是专业人士,你会有一套具体的要求。然而,如果你已经作为普通用户使用了一段时间——以下发行版值得一试。 + +#### Arch Linux + +![][58] + +Arch Linux 本身是一个简单而强大的发行版,具有陡峭的学习曲线。不像其系统,你不会一次就把所有东西都预先安装好。你必须配置系统并根据需要添加软件包。 + +此外,在安装 Arch Linux 时,必须按照一组命令来进行(没有图形用户界面)。要了解更多信息,你可以按照我们关于[如何安装 Arch Linux][59] 的指南进行操作。如果你要安装它,你还应该知道在[安装 Arch Linux 后需要做的一些基本事情][60]。这会帮助你快速入门。 + +除了多才多艺和简便性之外,值得一提的是 Arch Linux 背后的社区非常活跃。所以,如果你遇到问题,你不用担心。 + +- [Arch Linux][61] + +#### Gentoo + +![][62] + +如果你知道如何编译源代码,Gentoo Linux 是你必须尝试的版本。这也是一个轻量级的发行版,但是,你需要具备必要的技术知识才能使它发挥作用。 + +当然,[官方手册][63]提供了许多你需要知道的信息。但是,如果你不确定自己在做什么——你需要花很多时间去想如何充分利用它。 + +- [Gentoo Linux][64] + +#### Slackware + +![][65] + +Slackware 是仍然重要的最古老的 Linux 发行版之一。如果你愿意编译或开发软件来为自己建立一个完美的环境 —— Slackware 是一个不错的选择。 + +如果你对一些最古老的 Linux 发行版感到好奇,我们有一篇关于[最早的 Linux 发行版][66]可以去看看。 + +尽管使用它的用户/开发人员的数量已经显著减少,但对于高级用户来说,它仍然是一个极好的选择。此外,最近有个新闻是 [Slackware 有了一个 Patreon 捐赠页面][67],我们希望 Slackware 继续作为最好的 Linux 发行版之一存在。 + +- [Slackware][68] + +### 最佳多用途 Linux 发行版 + +有些 Linux 发行版既可以作为初学者友好的桌面又可以作为高级操作系统的服务器。因此,我们考虑为这样的发行版编辑一个单独的部分。 + +如果你不同意我们的观点(或者有建议要补充),请在评论中告诉我们。我们认为,这对于每个用户都可以派上用场: + +#### Fedora + +![][69] + +Fedora 提供两个独立的版本:一个用于台式机/笔记本电脑(Fedora 工作站),另一个用于服务器(Fedora 服务器)。 + +因此,如果你正在寻找一款时髦的桌面操作系统,有点学习曲线,又对用户友好,那么 Fedora 是一个选择。无论是哪种情况,如果你正在为你的服务器寻找一个 Linux 操作系统,这也是一个不错的选择。 + +- [Fedora][70] + +#### Manjaro + +![][71] + +Manjaro 基于 [Arch Linux][72]。不用担心,虽然 Arch Linux 是为高级用户量身定制的,但Manjaro 让新手更容易上手。这是一个简单且对初学者友好的 Linux 发行版。用户界面足够好,并且内置了一系列有用的图形用户界面应用程序。 + +下载时,你可以为 Manjaro 选择[桌面环境][73]。就个人而言,我喜欢 Manjaro 的 KDE 桌面。 + +- [Manjaro Linux][74] + +#### Debian + +![][75] + +嗯,Ubuntu 是基于 Debian 的——所以它本身是一个非常好的发行版本。Debian 是台式机和服务器的理想选择。 + +这可能不是对初学者最友好的操作系统——但你可以通过阅读[官方文档][76]轻松开始。[Debian 10 Buster][77] 的最新版本引入了许多变化和必要的改进。所以,你必须试一试! + +### 总结 + +总的来说,这些是我们推荐你去尝试的最好的 Linux 发行版。是的,还有许多其他的 Linux 发行版值得一提,但是根据个人喜好,对每个发行版来说,取决于个人喜好,这种选择是主观的。 + +但是,我们也为 [Windows 用户][78]、[黑客和脆弱性测试人员][41]、[游戏玩家][54]、[程序员][39]和[偏重隐私者][79]提供了单独的发行版列表所以,如果你感兴趣的话请仔细阅读。 + +如果你认为我们遗漏了你最喜欢的 Linux 发行版,请在下面的评论中告诉我们你的想法,我们将更新这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-linux-distributions/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: tmp.NoRXbIWHkg#for-beginners +[2]: tmp.NoRXbIWHkg#for-servers +[3]: tmp.NoRXbIWHkg#for-old-computers +[4]: tmp.NoRXbIWHkg#for-advanced-users +[5]: tmp.NoRXbIWHkg#general-purpose +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-10.jpg?ssl=1 +[7]: https://itsfoss.com/install-themes-ubuntu/ +[8]: https://itsfoss.com/tag/ubuntu/ +[9]: https://ubuntu.com/download/desktop +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-Mint-19-desktop.jpg?ssl=1 +[11]: https://www.linuxmint.com/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/elementary-os-juno-feat.jpg?ssl=1 +[13]: https://itsfoss.com/things-to-do-after-installing-elementary-os-5-juno/ +[14]: https://elementary.io/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/mx-linux.jpg?ssl=1 +[16]: https://distrowatch.com/ +[17]: https://en.wikipedia.org/wiki/Linux_distribution#Rolling_distributions +[18]: https://flatpak.org/ +[19]: https://mxlinux.org/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/zorin-os-15.png?ssl=1 +[21]: https://itsfoss.com/zorin-os-15-release/ +[22]: https://itsfoss.com/zorin-os-interview/ +[23]: https://zorinos.com/ +[24]: https://www.deepin.org/en/ +[25]: https://itsfoss.com/ubuntu-vs-fedora/ +[26]: https://ubuntu.com/download/cloud +[27]: https://w3techs.com/technologies/details/os-linux/all/all +[28]: https://thecloudmarket.com/stats +[29]: https://ubuntu.com/download/server +[30]: https://developers.redhat.com/products/rhel/docs-and-apis +[31]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/SUSE-Linux-Enterprise.jpg?ssl=1 +[33]: https://www.suse.com/products/server/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/centos.png?ssl=1 +[35]: https://www.centos.org/ +[36]: https://getfedora.org/en/server/ +[37]: https://www.debian.org/distrib/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/coding.jpg?ssl=1 +[39]: https://itsfoss.com/best-linux-distributions-progammers/ +[40]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/hacking.jpg?ssl=1 +[41]: https://itsfoss.com/linux-hacking-penetration-testing/ +[42]: https://itsfoss.com/lightweight-linux-beginners/ +[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/puppy-linux-bionic.jpg?ssl=1 +[44]: http://puppylinux.com/ +[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/solus-4-featured.jpg?resize=800%2C450&ssl=1 +[46]: https://itsfoss.com/solus-4-release/ +[47]: https://getsol.us/home/ +[48]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/bodhi-linux.png?fit=800%2C436&ssl=1 +[49]: http://www.bodhilinux.com/moksha-desktop/ +[50]: http://www.bodhilinux.com/ +[51]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/10/antix-linux-screenshot.jpg?ssl=1 +[52]: https://antixlinux.com/ +[53]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/sparky-linux.jpg?ssl=1 +[54]: https://itsfoss.com/linux-gaming-distributions/ +[55]: https://www.linuxliteos.com/ +[56]: https://lubuntu.me/ +[57]: https://peppermintos.com/ +[58]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/arch_linux_screenshot.jpg?ssl=1 +[59]: https://itsfoss.com/install-arch-linux/ +[60]: https://itsfoss.com/things-to-do-after-installing-arch-linux/ +[61]: https://www.archlinux.org +[62]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?ssl=1 +[63]: https://wiki.gentoo.org/wiki/Handbook:Main_Page +[64]: https://www.gentoo.org +[65]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/slackware-screenshot.jpg?ssl=1 +[66]: https://itsfoss.com/earliest-linux-distros/ +[67]: https://distrowatch.com/dwres.php?resource=showheadline&story=8743 +[68]: http://www.slackware.com/ +[69]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/fedora-overview.png?ssl=1 +[70]: https://getfedora.org/ +[71]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/manjaro-gnome.jpg?ssl=1 +[72]: https://www.archlinux.org/ +[73]: https://itsfoss.com/glossary/desktop-environment/ +[74]: https://manjaro.org/ +[75]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?ssl=1 +[76]: https://www.debian.org/releases/stable/installmanual +[77]: https://itsfoss.com/debian-10-buster/ +[78]: https://itsfoss.com/windows-like-linux-distributions/ +[79]: https://itsfoss.com/privacy-focused-linux-distributions/ diff --git a/published/201909/20190901 Different Ways to Configure Static IP Address in RHEL 8.md b/published/201909/20190901 Different Ways to Configure Static IP Address in RHEL 8.md new file mode 100644 index 0000000000..d67e035961 --- /dev/null +++ b/published/201909/20190901 Different Ways to Configure Static IP Address in RHEL 8.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11390-1.html) +[#]: subject: (Different Ways to Configure Static IP Address in RHEL 8) +[#]: via: (https://www.linuxtechi.com/configure-static-ip-address-rhel8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +在 RHEL8 配置静态 IP 地址的不同方法 +====== + +在 Linux 服务器上工作时,在网卡/以太网卡上分配静态 IP 地址是每个 Linux 工程师的常见任务之一。如果一个人在 Linux 服务器上正确配置了静态地址,那么他/她就可以通过网络远程访问它。在本文中,我们将演示在 RHEL 8 服务器网卡上配置静态 IP 地址的不同方法。 + +![](https://img.linux.net.cn/data/attachment/album/201909/25/222737dx94bbl9qbhzlfe4.jpg) + +以下是在网卡上配置静态IP的方法: + + * `nmcli`(命令行工具) + * 网络脚本文件(`ifcfg-*`) + * `nmtui`(基于文本的用户界面) + +### 使用 nmcli 命令行工具配置静态 IP 地址 + +每当我们安装 RHEL 8 服务器时,就会自动安装命令行工具 `nmcli`,它是由网络管理器使用的,可以让我们在以太网卡上配置静态 IP 地址。 + +运行下面的 `ip addr` 命令,列出 RHEL 8 服务器上的以太网卡 + +``` +[root@linuxtechi ~]# ip addr +``` + +正如我们在上面的命令输出中看到的,我们有两个网卡 `enp0s3` 和 `enp0s8`。当前分配给网卡的 IP 地址是通过 DHCP 服务器获得的。 + +假设我们希望在第一个网卡 (`enp0s3`) 上分配静态 IP 地址,具体内容如下: + + * IP 地址 = 192.168.1.4 + * 网络掩码 = 255.255.255.0 + * 网关 = 192.168.1.1 + * DNS = 8.8.8.8 + +依次运行以下 `nmcli` 命令来配置静态 IP, + +使用 `nmcli connection` 命令列出当前活动的以太网卡, + +``` +[root@linuxtechi ~]# nmcli connection +NAME UUID TYPE DEVICE +enp0s3 7c1b8444-cb65-440d-9bf6-ea0ad5e60bae ethernet enp0s3 +virbr0 3020c41f-6b21-4d80-a1a6-7c1bd5867e6c bridge virbr0 +[root@linuxtechi ~]# +``` + +使用下面的 `nmcli` 给 `enp0s3` 分配静态 IP。 + +**命令语法:** + +``` +# nmcli connection modify ipv4.address +``` + +**注意:** 为了简化语句,在 `nmcli` 命令中,我们通常用 `con` 关键字替换 `connection`,并用 `mod` 关键字替换 `modify`。 + +将 IPv4 地址 (192.168.1.4) 分配给 `enp0s3` 网卡上, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.addresses 192.168.1.4/24 +``` + +使用下面的 `nmcli` 命令设置网关, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.gateway 192.168.1.1 +``` + +设置手动配置(从 dhcp 到 static), + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.method manual +``` + +设置 DNS 值为 “8.8.8.8”, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.dns "8.8.8.8" +``` + +要保存上述更改并重新加载,请执行如下 `nmcli` 命令, + +``` +[root@linuxtechi ~]# nmcli con up enp0s3 +Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4) +``` + +以上命令显示网卡 `enp0s3` 已成功配置。我们使用 `nmcli` 命令做的那些更改都将永久保存在文件 `etc/sysconfig/network-scripts/ifcfg-enp0s3` 里。 + +``` +[root@linuxtechi ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 +``` + +![ifcfg-enp0s3-file-rhel8][2] + +要确认 IP 地址是否分配给了 `enp0s3` 网卡了,请使用以下 IP 命令查看, + +``` +[root@linuxtechi ~]#ip addr show enp0s3 +``` + +### 使用网络脚本文件(ifcfg-*)手动配置静态 IP 地址 + +我们可以使用配置以太网卡的网络脚本或 `ifcfg-*` 文件来配置以太网卡的静态 IP 地址。假设我们想在第二个以太网卡 `enp0s8` 上分配静态 IP 地址: + +* IP 地址 = 192.168.1.91 +* 前缀 = 24 +* 网关 =192.168.1.1 +* DNS1 =4.2.2.2 + + +转到目录 `/etc/sysconfig/network-scripts`,查找文件 `ifcfg-enp0s8`,如果它不存在,则使用以下内容创建它, + +``` +[root@linuxtechi ~]# cd /etc/sysconfig/network-scripts/ +[root@linuxtechi network-scripts]# vi ifcfg-enp0s8 +TYPE="Ethernet" +DEVICE="enp0s8" +BOOTPROTO="static" +ONBOOT="yes" +NAME="enp0s8" +IPADDR="192.168.1.91" +PREFIX="24" +GATEWAY="192.168.1.1" +DNS1="4.2.2.2" +``` + +保存并退出文件,然后重新启动网络管理器服务以使上述更改生效, + +``` +[root@linuxtechi network-scripts]# systemctl restart NetworkManager +``` + +现在使用下面的 `ip` 命令来验证 IP 地址是否分配给网卡, + +``` +[root@linuxtechi ~]# ip add show enp0s8 +3: enp0s8: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 08:00:27:7c:bb:cb brd ff:ff:ff:ff:ff:ff + inet 192.168.1.91/24 brd 192.168.1.255 scope global noprefixroute enp0s8 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe7c:bbcb/64 scope link + valid_lft forever preferred_lft forever +[root@linuxtechi ~]# +``` + +以上输出内容确认静态 IP 地址已在网卡 `enp0s8` 上成功配置了。 + +### 使用 nmtui 实用程序配置静态 IP 地址 + +`nmtui` 是一个基于文本用户界面的,用于控制网络的管理器,当我们执行 `nmtui` 时,它将打开一个基于文本的用户界面,通过它我们可以添加、修改和删除连接。除此之外,`nmtui` 还可以用来设置系统的主机名。 + +假设我们希望通过以下细节将静态 IP 地址分配给网卡 `enp0s3` , + +* IP 地址 = 10.20.0.72 +* 前缀 = 24 +* 网关 = 10.20.0.1 +* DNS1 = 4.2.2.2 + +运行 `nmtui` 并按照屏幕说明操作,示例如下所示, + +``` +[root@linuxtechi ~]# nmtui +``` + +![nmtui-rhel8][3] + +选择第一个选项 “Edit a connection”,然后选择接口为 “enp0s3”, + +![Choose-interface-nmtui-rhel8][4] + +选择 “Edit”,然后指定 IP 地址、前缀、网关和域名系统服务器 IP, + +![set-ip-nmtui-rhel8][5] + +选择确定,然后点击回车。在下一个窗口中,选择 “Activate a connection”, + +![Activate-option-nmtui-rhel8][6] + +选择 “enp0s3”,选择 “Deactivate” 并点击回车, + +![Deactivate-interface-nmtui-rhel8][7] + +现在选择 “Activate” 并点击回车, + +![Activate-interface-nmtui-rhel8][8] + +选择 “Back”,然后选择 “Quit”, + +![Quit-Option-nmtui-rhel8][9] + +使用下面的 `ip` 命令验证 IP 地址是否已分配给接口 `enp0s3`, + +``` +[root@linuxtechi ~]# ip add show enp0s3 +2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 08:00:27:53:39:4d brd ff:ff:ff:ff:ff:ff + inet 10.20.0.72/24 brd 10.20.0.255 scope global noprefixroute enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::421d:5abf:58bd:c47e/64 scope link noprefixroute + valid_lft forever preferred_lft forever +[root@linuxtechi ~]# +``` + +以上输出内容显示我们已经使用 `nmtui` 实用程序成功地将静态 IP 地址分配给接口 `enp0s3`。 + +以上就是本教程的全部内容,我们已经介绍了在 RHEL 8 系统上为以太网卡配置 IPv4 地址的三种不同方法。请在下面的评论部分分享反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-static-ip-address-rhel8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-Static-IP-RHEL8.jpg +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/ifcfg-enp0s3-file-rhel8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/nmtui-rhel8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-interface-nmtui-rhel8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/set-ip-nmtui-rhel8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Activate-option-nmtui-rhel8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Deactivate-interface-nmtui-rhel8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Activate-interface-nmtui-rhel8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Quit-Option-nmtui-rhel8.jpg diff --git a/published/201909/20190902 Why I use Java.md b/published/201909/20190902 Why I use Java.md new file mode 100644 index 0000000000..d4ec8d6570 --- /dev/null +++ b/published/201909/20190902 Why I use Java.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11337-1.html) +[#]: subject: (Why I use Java) +[#]: via: (https://opensource.com/article/19/9/why-i-use-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +我为什么使用 Java +====== + +> 根据你的工作需要,可能有比 Java 更好的语言,但是我还没有看到任何能把我拉走的语言。 + +![](https://img.linux.net.cn/data/attachment/album/201909/13/171223bf7noo4bbnkxbkdk.jpg) + +我记得我是从 1997 年开始使用 Java 的,就在 [Java 1.1 刚刚发布][2]不久之后。从那时起,总的来说,我非常喜欢用 Java 编程;虽然我得承认,这些日子我经常像在 Java 中编写“严肃的代码”一样编写 [Groovy][3] 脚本。 + +来自 [FORTRAN][4]、[PL/1][5]、[Pascal][6] 以及最后的 [C 语言][7] 背景,我发现了许多让我喜欢 Java 的东西。Java 是我[面向对象编程][8]的第一次重要实践经验。到那时,我已经编程了大约 20 年,而且可以说我对什么重要、什么不重要有了一些看法。 + +### 调试是一个关键的语言特性 + +我真的很讨厌浪费时间追踪由我的代码不小心迭代到数组末尾而导致的模糊错误,特别是在 IBM 大型机上的 FORTRAN 编程时代。另一个不时出现的隐晦问题是调用一个子程序时,该子程序带有一个四字节整数参数,而预期有两个字节;在小端架构上,这通常是一个良性的错误,但在大端机器上,前两个字节的值通常并不总是为零。 + +在那种批处理环境中进行调试也非常不便,通过核心转储或插入打印语句进行调试,这些语句本身会移动错误的位置甚至使它们消失。 + +所以我使用 Pascal 的早期体验,先是在 [MTS][9] 上,然后是在 [IBM OS/VS1][10] 上使用相同的 MTS 编译器,让我的生活变得更加轻松。Pascal 的[强类型和静态类型][11]是取得这种胜利的重要组成部分,我使用的每个 Pascal 编译器都会在数组的边界和范围上插入运行时检查,因此错误可以在发生时检测到。当我们在 20 世纪 80 年代早期将大部分工作转移到 Unix 系统时,移植 Pascal 代码是一项简单的任务。 + +### 适量的语法 + +但是对于我所喜欢的 Pascal 来说,我的代码很冗长,而且语法似乎要比代码还要多;例如,使用: + +``` +if ... then begin ... end else ... end +``` + +而不是 C 或类似语言中的: + +``` +if (...) { ... } else { ... } +``` + +另外,有些事情在 Pascal 中很难完成,在 C 中更容易。但是,当我开始越来越多地使用 C 时,我发现自己遇到了我曾经在 FORTRAN 中遇到的同样类型的错误,例如,超出数组边界。在原始的错误点未检测到数组结束,而仅在程序执行后期才会检测到它们的不利影响。幸运的是,我不再生活在那种批处理环境中,并且手头有很好的调试工具。不过,C 对于我来说有点太灵活了。 + +当我遇到 [awk][12] 时,我发现它与 C 相比又是另外一种样子。那时,我的很多工作都涉及转换字段数据并创建报告。我发现用 `awk` 加上其他 Unix 命令行工具,如 `sort`、`sed`、`cut`、`join`、`paste`、`comm` 等等,可以做到事情令人吃惊。从本质上讲,这些工具给了我一个像是基于文本文件的关系数据库管理器,这种文本文件具有列式结构,是我们很多字段数据的保存方式。或者,即便不是这种格式,大部分时候也可以从关系数据库或某种二进制格式导出到列式结构中。 + +`awk` 支持的字符串处理、[正则表达式][13]和[关联数组][14],以及 `awk` 的基本特性(它实际上是一个数据转换管道),非常符合我的需求。当面对二进制数据文件、复杂的数据结构和关键性能需求时,我仍然会转回到 C;但随着我越来越多地使用 `awk`,我发现 C 的非常基础的字符串支持越来越令人沮丧。随着时间的推移,更多的时候我只会在必须时才使用 C,并且在其余的时候里大量使用 `awk`。 + +### Java 的抽象层级合适 + +然后是 Java。它看起来相当不错 —— 相对简洁的语法,让人联想到 C,或者这种相似性至少要比 Pascal 或其他任何早期的语言更为明显。它是强类型的,因此很多编程错误会在编译时被捕获。它似乎并不需要过多的面向对象的知识就能起步,这是一件好事,因为我当时对 [OOP 设计模式][15]毫不熟悉。但即使在刚刚开始,我也喜欢它的简化[继承模型][16]背后的思想。(Java 允许使用提供的接口进行单继承,以在某种程度上丰富范例。) + +它似乎带有丰富的功能库(即“自备电池”的概念),在适当的水平上直接满足了我的需求。最后,我发现自己很快就会想到将数据和行为在对象中组合在一起的想法。这似乎是明确控制数据之间交互的好方法 —— 比大量的参数列表或对全局变量的不受控制的访问要好得多。 + +从那以后,Java 在我的编程工具箱中成为了 Helvetic 军刀。我仍然偶尔会在 `awk` 中编写程序,或者使用 Linux 命令行实用程序(如 `cut`、`sort` 或 `sed`),因为它们显然是解决手头问题的直接方法。我怀疑过去 20 年我可能没写过 50 行的 C 语言代码;Java 完全满足了我的需求。 + +此外,Java 一直在不断改进。首先,它变得更加高效。并且它添加了一些非常有用的功能,例如[可以用 try 来测试资源][17],它可以很好地清理在文件 I/O 期间冗长而有点混乱的错误处理代码;或 [lambda][18],它提供了声明函数并将其作为参数传递的能力,而旧方法需要创建类或接口来“托管”这些函数;或[流][19],它在函数中封装了迭代行为,可以创建以链式函数调用形式实现的高效数据转换管道。 + +### Java 越来越好 + +许多语言设计者研究了从根本上改善 Java 体验的方法。对我来说,其中大部分没有引起我的太多兴趣;再次,这更多地反映了我的典型工作流程,并且(更多地)减少了这些语言带来的功能。但其中一个演化步骤已经成为我的编程工具中不可或缺的一部分:[Groovy][20]。当我遇到一个小问题,需要一个简单的解决方案时,Groovy 已经成为了我的首选。而且,它与 Java 高度兼容。对我来说,Groovy 填补了 Python 为许多其他人所提供的相同用处 —— 它紧凑、DRY(不要重复自己)和具有表达性(列表和词典有完整的语言支持)。我还使用了 [Grails][21],它使用 Groovy 为非常高性能和有用的 Java Web 应用程序提供简化的 Web 框架。 + +### Java 仍然开源吗? + +最近,对 [OpenJDK][22] 越来越多的支持进一步提高了我对 Java 的舒适度。许多公司以各种方式支持 OpenJDK,包括 [AdoptOpenJDK、Amazon 和 Red Hat][23]。在我的一个更大、更长期的项目中,我们使用 AdoptOpenJDK [来在几个桌面平台上生成自定义的运行时环境][24]。 + +有没有比 Java 更好的语言?我确信有,这取决于你的工作需要。但我一直对 Java 非常满意,我还没有遇到任何可能会让我失望的东西。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/why-i-use-java + +作者:[Chris Hermansen][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://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://en.wikipedia.org/wiki/Java_version_history +[3]: https://en.wikipedia.org/wiki/Apache_Groovy +[4]: https://en.wikipedia.org/wiki/Fortran +[5]: https://en.wikipedia.org/wiki/PL/I +[6]: https://en.wikipedia.org/wiki/Pascal_(programming_language) +[7]: https://en.wikipedia.org/wiki/C_(programming_language) +[8]: https://en.wikipedia.org/wiki/Object-oriented_programming +[9]: https://en.wikipedia.org/wiki/Michigan_Terminal_System +[10]: https://en.wikipedia.org/wiki/OS/VS1 +[11]: https://stackoverflow.com/questions/11889602/difference-between-strong-vs-static-typing-and-weak-vs-dynamic-typing +[12]: https://en.wikipedia.org/wiki/AWK +[13]: https://en.wikipedia.org/wiki/Regular_expression +[14]: https://en.wikipedia.org/wiki/Associative_array +[15]: https://opensource.com/article/19/7/understanding-software-design-patterns +[16]: https://www.w3schools.com/java/java_inheritance.asp +[17]: https://www.baeldung.com/java-try-with-resources +[18]: https://www.baeldung.com/java-8-lambda-expressions-tips +[19]: https://www.tutorialspoint.com/java8/java8_streams +[20]: https://groovy-lang.org/ +[21]: https://grails.org/ +[22]: https://openjdk.java.net/ +[23]: https://en.wikipedia.org/wiki/OpenJDK +[24]: https://opensource.com/article/19/4/java-se-11-removing-jnlp diff --git a/published/201909/20190903 5 open source speed-reading applications.md b/published/201909/20190903 5 open source speed-reading applications.md new file mode 100644 index 0000000000..ef922bf1e8 --- /dev/null +++ b/published/201909/20190903 5 open source speed-reading applications.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11316-1.html) +[#]: subject: (5 open source speed-reading applications) +[#]: via: (https://opensource.com/article/19/8/speed-reading-open-source) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari) + +5 个开源的速读应用 +====== + +> 使用这五个应用训练自己更快地阅读文本。 + +![](https://img.linux.net.cn/data/attachment/album/201909/07/151320r39o26onsp3sq1qo.jpg) + +英国散文家和政治家 [Joseph Addison][2] 曾经说过,“读书益智,运动益体。”如今,我们大多数人(如果不是全部)都是通过计算机显示器、电视屏幕、移动设备、街道标志、报纸、杂志上阅读,以及在工作场所和学校阅读论文来训练我们的大脑。 + +鉴于我们每天都会收到大量的书面信息,通过做一些挑战我们经典的阅读习惯并教会我们吸收更多内容和数据的特定练习,来训练我们的大脑以便更快地阅读似乎是有利的。学习这些技能的目的不仅仅是浏览文本,因为没有理解的阅读就是浪费精力。目标是提高你的阅读速度,同时仍然达到高水平的理解。 + +### 阅读和处理输入 + +在深入探讨速读之前,让我们来看看阅读过程。根据法国眼科医生 Louis Emile Javal 的说法,阅读分为三个步骤: + + 1. 固定 + 2. 处理 + 3. [扫视][3]saccade + +在第一步,我们确定文本中的固定点,称为最佳识别点。在第二步中,我们在眼睛固定的同时引入(处理)新信息。最后,我们改变注视点的位置,这是一种称为扫视的操作,此时未获取任何新信息。 + +在实践中,阅读更快的读者之间的主要差异是固定时间短于平均值,更长距离扫视,重读更少。 + +### 阅读练习 + +阅读不是人类的自然过程,因为它是人类生存跨度中一个相当新的发展。第一个书写系统是在大约 5000 年前创建的,它不足以让人们发展成为阅读机器。因此,我们必须运用我们的阅读技巧,在这项沟通的基本任务中变得更加娴熟和高效。 + +第一项练习包括减少默读,也被称为无声语音,这是一种在阅读时内部发音的习惯。它是一个减慢阅读速度的自然过程,因为阅读速度限于语速。减少默读的关键是只说出一些阅读的单词。一种方法是用其他任务来占据内部声音,例如用口香糖。 + +第二个练习包括减少回归,或称为重读。回归是一种懒惰的机制,因为我们的大脑可以随时重读任何材料,从而降低注意力。 + +### 5 个开源应用来训练你的大脑 + +有几个有趣的开源应用可用于锻炼你的阅读速度。 + +一个是 [Gritz][4],它是一个开源文件阅读器,它一次一个地弹出单词,以减少回归。它适用于 Linux、Windows 和 MacOS,并在 GPL 许可证下发布,因此你可以随意使用它。 + +其他选择包括 [Spray Speed-Reader][5],一个用 JavaScript 编写的开源速读应用,以及 [Sprits-it!][6],一个开源 Web 应用,可以快速阅读网页。 + +对于 Android 用户,[Comfort Reader][7] 是一个开源的速读应用。它可以在 [F-droid][8] 和 [Google Play][9] 应用商店中找到。 + +我最喜欢的应用是 [Speedread][10],它是一个简单的终端程序,它可以在最佳阅读点逐字显示文本。要安装它,请在你的设备上克隆 Github 仓库,然后输入相应的命令来选择以喜好的每分钟字数 (WPM)来阅读文档。默认速率为 250 WPM。例如,要以 400 WPM 阅读 `your_text_file.txt`,你应该输入: + +``` +`cat your_text_file.txt | ./speedread -w 400` +``` + +下面是该程序的运行界面: + +![Speedread demo][11] + +由于你可能不会只阅读[纯文本][12],因此可以使用 [Pandoc][13] 将文件从标记格式转换为文本格式。你还可以使用 Android 终端模拟器 [Termux][14] 在 Android 设备上运行 Speedread。 + +### 其他方案 + +对于开源社区来说,构建一个解决方案是一个有趣的项目,它仅为了通过使用特定练习来提高阅读速度,以此改进如默读和重读。我相信这个项目会非常有益,因为在当今信息丰富的环境中,提高阅读速度非常有价值。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/speed-reading-open-source + +作者:[Jaouhari Youssef][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jaouhari +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_stack_library_reading.jpg?itok=uulcS8Sw (stack of books) +[2]: https://en.wikipedia.org/wiki/Joseph_Addison +[3]: https://en.wikipedia.org/wiki/Saccade +[4]: https://github.com/jeffkowalski/gritz +[5]: https://github.com/chaimpeck/spray +[6]: https://github.com/the-happy-hippo/sprits-it +[7]: https://github.com/mschlauch/comfortreader +[8]: https://f-droid.org/packages/com.mschlauch.comfortreader/ +[9]: https://play.google.com/store/apps/details?id=com.mschlauch.comfortreader +[10]: https://github.com/pasky/speedread +[11]: https://opensource.com/sites/default/files/uploads/speedread_demo.gif (Speedread demo) +[12]: https://plaintextproject.online/ +[13]: https://opensource.com/article/18/9/intro-pandoc +[14]: https://termux.com/ diff --git a/published/201909/20190903 An introduction to Hyperledger Fabric.md b/published/201909/20190903 An introduction to Hyperledger Fabric.md new file mode 100644 index 0000000000..3bd8f72221 --- /dev/null +++ b/published/201909/20190903 An introduction to Hyperledger Fabric.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11328-1.html) +[#]: subject: (An introduction to Hyperledger Fabric) +[#]: via: (https://opensource.com/article/19/9/introduction-hyperledger-fabric) +[#]: author: (Matt Zand https://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook) + +Hyperledger Fabric 介绍 +====== + +> Hyperledger (超级账本)是一组开源工具,旨在构建一个强大的、业务驱动的区块链框架。 + +![](https://img.linux.net.cn/data/attachment/album/201909/11/105935hm606vso3fclzso6.jpg) + +[Hyperledger][2] (超级账本)是区块链行业中最大的项目之一,它由一组开源工具和多个子项目组成。该项目是由 Linux 基金会主办的一个全球协作项目,其中包括一些不同领域的领导者们,这些领导者们的目标是建立一个强大的、业务驱动的区块链框架。 + +区块链网络主要有三种类型:公共区块链、联盟或联合区块链,以及私有区块链。Hyperledger 是一个区块链框架,旨在帮助公司建立私人或联盟许可的区块链网络,在该网络中,多个组织可以共享控制和操作网络内节点的权限。 + +因为区块链是一个透明的,基于不可变模式的安全的去中心化系统,所以它被认为是传统的供应链行业改变游戏规则的一种解决方案。它可以通过以下方式支持有效的供应链系统: + +* 跟踪整个区块链中的产品 +* 校验和验证区块链中的产品 +* 在供应链参与者之间共享整个区块链的信息 +* 提供可审核性 + +本文通过食品供应链的例子来解释 Hyperledger 区块链是如何改变传统供应链系统的。 + +### 食品行业供应链 + +传统供应链效率低下的主要原因是由于缺乏透明度而导致报告不可靠和竞争上的劣势。 + +在传统的供应链模式中,有关实体的信息对该区块链中的其他人来说并不完全透明,这就导致了不准确的报告和缺乏互操作性问题。电子邮件和印刷文档提供了一些信息,但它们不可能包含完整详细的可见性数据,因为很难在整个供应链中去追踪产品。这也使消费者几乎不可能知道产品的真正价值和来源。 + +食品行业的供应链环境复杂,多个参与者需要协作将货物运送到最终目的地 —— 客户手中。下图显示了食品供应链(多级)网络中的主要参与者。 + +![典型的食品供应链][3] + +该区块链的每个阶段都会引入潜在的安全问题、整合问题和其他低效问题。目前食品供应链中的主要威胁仍然是假冒食品和食品欺诈。 + +基于 Hyperledger 区块链的食品跟踪系统可实现对食品信息全面的可视性和和可追溯性。更重要的是,它以一种不变但可行的方式来记录产品细节,确保食品信息的真实性。最终用户通过在不可变框架上共享产品的详细信息,可以自我验证产品的真实性。 + +### Hyperledger Fabric + +Hyperledger Fabric 是 Hyperledger 项目的基石。它是基于许可的区块链,或者更准确地说是一种分布式分类帐技术(DLT),该技术最初由 IBM 公司和 Digital Asset 创建。分布式分类帐技术被设计为具有不同组件的模块化框架(概述如下)。它也是提供可插入的共识模型的一种灵活的解决方案,尽管它目前仅提供基于投票的许可共识(假设今天的 Hyperledger 网络在部分可信赖的环境中运行)。 + +鉴于此,无需匿名矿工来验证交易,也无需用作激励措施的相关货币。所有的参与者必须经过身份验证才能参与到该区块链进行交易。与以太坊一样,Hyperledger Fabric 支持智能合约,在 Hyperledger 中称为 Chaincodes链码,这些合约描述并执行系统的应用程序逻辑。 + +然而,与以太坊不同,Hyperledger Fabric 不需要昂贵的挖矿计算来提交交易,因此它有助于构建可以在更短的延迟内进行扩展的区块链。 + +Hyperledger Fabric 不同于以太坊或比特币这样的区块链,不仅在于它们类型不同,或者说是它与货币无关,而且它们在内部机制方面也不同。以下是典型的 Hyperledger 网络的关键要素: + +* 账本Ledgers:存储了一系列块,这些块保留了所有状态交易的所有不可变历史记录。 +* 节点Nodes:区块链的逻辑实体。它有三种类型: + * 客户端Clients:是代表用户向网络提交事务的应用程序。 + * 对等体Peers:是提交交易并维护分类帐状态的实体。 + * 排序者Orderers 在客户端和对等体之间创建共享通信渠道,还将区块链交易打包成块发送给遵从的对等体节点。 + +除了这些要素,Hyperledger Fabric 还有以下关键设计功能: + +* 链码Chaincode:类似于其它诸如以太坊的网络中的智能合约。它是用一种更高级的语言编写的程序,在针对分类帐当前状态的数据库执行。 +* 通道Channels:用于在多个网络成员之间共享机密信息的专用通信子网。每笔交易都在一个只有经过身份验证和授权的各方可见的通道上执行。 +* 背书人Endorsers 验证交易,调用链码,并将背书的交易结果返回给调用应用程序。 +* 成员服务提供商Membership Services Providers(MSP)通过颁发和验证证书来提供身份验证和身份验证过程。MSP 确定信任哪些证书颁发机构(CA)去定义信任域的成员,并确定成员可能扮演的特定角色(成员、管理员等)。 + +### 如何验证交易 + +探究一笔交易是如何通过验证的是理解 Hyperledger Fabric 在底层如何工作的好方法。此图显示了在典型的 Hyperledger 网络中处理交易的端到端系统流程: + +![Hyperledger 交易验证流程][4] + +首先,客户端通过向基于 Hyperledger Fabric 的应用程序客户端发送请求来启动交易,该客户端将交易提议提交给背书对等体。这些对等体通过执行由交易指定的链码(使用该状态的本地副本)来模拟该交易,并将结果发送回应用程序。此时,应用程序将交易与背书相结合,并将其广播给排序服务Ordering Service。排序服务检查背书并为每个通道创建一个交易块,然后将其广播给通道中的其它节点,对的体验证该交易并进行提交。 + +Hyperledger Fabric 区块链可以通过透明的、不变的和共享的食品来源数据记录、处理数据,及运输细节等信息将食品供应链中的参与者们连接起来。链码由食品供应链中的授权参与者来调用。所有执行的交易记录都永久保存在分类帐中,所有参与者都可以查看此信息。 + +### Hyperledger Composer + +除了 Fabric 或 Iroha 等区块链框架外,Hyperledger 项目还提供了 Composer、Explorer 和 Cello 等工具。 Hyperledger Composer 提供了一个工具集,可帮助你更轻松地构建区块链应用程序。 它包括: + +* CTO,一种建模语言 +* Playground,一种基于浏览器的开发工具,用于快速测试和部署 +* 命令行界面(CLI)工具 + +Composer 支持 Hyperledger Fabric 的运行时和基础架构,在内部,Composer 的 API 使用底层 Fabric 的 API。Composer 在 Fabric 上运行,这意味着 Composer 生成的业务网络可以部署到 Hyperledger Fabric 执行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-hyperledger-fabric + +作者:[Matt Zand][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chain.png?itok=sgAjswFf (Chain image) +[2]: https://www.hyperledger.org/ +[3]: https://opensource.com/sites/default/files/uploads/foodindustrysupplychain.png (Typical food supply chain) +[4]: https://opensource.com/sites/default/files/uploads/hyperledger-fabric-transaction-flow.png (Hyperledger transaction validation flow) +[5]: https://coding-bootcamps.com/ultimate-guide-for-building-a-blockchain-supply-chain-using-hyperledger-fabric-and-composer.html diff --git a/published/201909/20190903 The birth of the Bash shell.md b/published/201909/20190903 The birth of the Bash shell.md new file mode 100644 index 0000000000..8102b01097 --- /dev/null +++ b/published/201909/20190903 The birth of the Bash shell.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11314-1.html) +[#]: subject: (The birth of the Bash shell) +[#]: via: (https://opensource.com/19/9/command-line-heroes-bash) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg) + +Bash shell 的诞生 +====== + +> 本周的《代码英雄》播客深入研究了最广泛使用的、已经成为事实标准的脚本语言,它来自于自由软件基金会及其作者的早期灵感。 + +![Listen to the Command Line Heroes Podcast][1] + +对于任何从事于系统管理员方面的人来说,Shell 脚本编程是一门必不可少的技能,而如今人们编写脚本的主要 shell 是 Bash。Bash 是几乎所有的 Linux 发行版和现代 MacOS 版本的默认配置,也很快就会成为 [Windows 终端][2]的原生部分。你可以说 Bash 无处不在。 + +那么它是如何做到这一点的呢?本周的《[代码英雄][3]》播客将通过询问编写那些代码的人来深入研究这个问题。 + +### 肇始于 Unix + +像所有编程方面的东西一样,我们必须追溯到 Unix。shell 的简短历史是这样的:1971 年,Ken Thompson 发布了第一个 Unix shell:Thompson shell。但是,脚本用户所能做的存在严重限制,这意味着严重制约了自动化以及整个 IT 运营领域。 + +这个[奇妙的研究][4]概述了早期尝试脚本的挑战: + +> 类似于它在 Multics 中的前身,这个 shell(`/bin/sh`)是一个在内核外执行的独立用户程序。诸如通配(参数扩展的模式匹配,例如 `*.txt`)之类的概念是在一个名为 `glob` 的单独的实用程序中实现的,就像用于计算条件表达式的 `if` 命令一样。这种分离使 shell 变得更小,才不到 900 行的 C 源代码。 +> +> shell 引入了紧凑的重定向(`<`、`>` 和 `>>`)和管道(`|` 或 `^`)语法,它们已经存在于现代 shell 中。你还可以找到对调用顺序命令(`;`)和异步命令(`&`)的支持。 +> +> Thompson shell 缺少的是编写脚本的能力。它的唯一目的是作为一个交互式 shell(命令解释器)来调用命令和查看结果。 + +随着对终端使用的增长,对自动化的兴趣随之增长。 + +### Bourne shell 前进一步 + +在 Thompson 发布 shell 六年后,1977 年,Stephen Bourne 发布了 Bourne shell,旨在解决Thompson shell 中的脚本限制。(Chet Ramey 是自 1990 年以来 Bash 语言的主要维护者,在这一集的《代码英雄》中讨论了它)。作为 Unix 系统的一部分,这是这个来自贝尔实验室的技术的自然演变。 + +Bourne 打算做什么不同的事情?[研究员 M. Jones][4] 很好地概述了它: + +> Bourne shell 有两个主要目标:作为命令解释器以交互方式执行操作系统的命令,和用于脚本编程(编写可通过 shell 调用的可重用脚本)。除了替换 Thompson shell,Bourne shell 还提供了几个优于其前辈的优势。Bourne 将控制流、循环和变量引入脚本,提供了更具功能性的语言来(以交互式和非交互式)与操作系统交互。该 shell 还允许你使用 shell 脚本作为过滤器,为处理信号提供集成支持,但它缺乏定义函数的能力。最后,它结合了我们今天使用的许多功能,包括命令替换(使用后引号)和 HERE 文档(以在脚本中嵌入保留的字符串文字)。 + +Bourne 在[之前的一篇采访中][5]这样描述它: + +> 最初的 shell (编程语言)不是一种真正的语言;它是一种记录 —— 一种从文件中线性执行命令序列的方法,唯一的控制流的原语是 `GOTO` 到一个标签。Ken Thompson 所编写的这个最初的 shell 的这些限制非常重要。例如,你无法简单地将命令脚本用作过滤器,因为命令文件本身是标准输入。而在过滤器中,标准输入是你从父进程继承的,不是命令文件。 +> +> 最初的 shell 很简单,但随着人们开始使用 Unix 进行应用程序开发和脚本编写,它就太有限了。它没有变量、它没有控制流,而且它的引用能力非常不足。 + +对于脚本编写者来说,这个新 shell 是一个巨大的进步,但前提是你可以使用它。 + +### 以自由软件来重新构思 Bourne Shell + +在此之前,这个占主导地位的 shell 是由贝尔实验室拥有和管理的专有软件。幸运的话,你的大学可能有权访问 Unix shell。但这种限制性访问远非自由软件基金会(FSF)想要实现的世界。 + +Richard Stallman 和一群志同道合的开发人员那时正在编写所有的 Unix 功能,其带有可以在 GNU 许可证下免费获得的许可。其中一个开发人员的任务是制作一个 shell,那位开发人员是 Brian Fox。他对他的任务的讲述十分吸引我。正如他在播客上所说: + +> 它之所以如此具有挑战性,是因为我们必须忠实地模仿 Bourne shell 的所有行为,同时允许扩展它以使其成为一个供人们使用的更好工具。 + +而那时也恰逢人们在讨论 shell 标准是什么的时候。在这一历史背景和将来的竞争前景下,流行的 Bourne shell 被重新构想,并再次重生。 + +### 重新打造 Bourne Shell + +自由软件的使命和竞争这两个催化剂使重制的 Bourne shell(Bash)具有了生命。和之前不同的是,Fox 并没有把 shell 放到自己的名字之后命名,他专注于从 Unix 到自由软件的演变。(虽然 Fox Shell 这个名字看起来要比 Fish shell 更适合作为 fsh 命令 #missedopportunity)。这个命名选择似乎符合他的个性。正如 Fox 在剧集中所说,他甚至对个人的荣耀也不感兴趣;他只是试图帮助编程文化发展。然而,他并不是一个优秀的双关语。 + +而 Bourne 也并没有因为他命名 shell 的文字游戏而感到被轻视。Bourne 讲述了一个故事,有人走到他面前,并在会议上给了他一件 Bash T 恤,而那个人是 Brian Fox。 + +Shell | 发布于 | 创造者 +---|---|--- +Thompson Shell | 1971 | Ken Thompson +Bourne Shell | 1977 | Stephen Bourne +Bourne-Again Shell | 1989 | Brian Fox + +随着时间的推移,Bash 逐渐成长。其他工程师开始使用它并对其设计进行改进。事实上,多年后,Fox 坚定地认为学会放弃控制 Bash 是他一生中最重要的事情之一。随着 Unix 让位于 Linux 和开源软件运动,Bash 成为开源世界的至关重要的脚本语言。这个伟大的项目似乎超出了单一一个人的愿景范围。 + +### 我们能从 shell 中学到什么? + +shell 是一项技术,它是笔记本电脑日常使用中的一个组成部分,你很容易忘记它也需要发明出来。从 Thompson 到 Bourne 再到 Bash,shell 的故事为我们描绘了一些熟悉的结论: + +* 有动力的人可以在正确的使命中取得重大进展。 +* 我们今天所依赖的大部分内容都建立在我们行业中仍然活着的那些传奇人物打下的基础之上。 +* 能够生存下来的软件超越了其原始创作者的愿景。 +   +代码英雄在全部的第三季中讲述了编程语言,并且正在接近它的尾声。[请务必订阅,来了解你想知道的有关编程语言起源的各种内容][3],我很乐意在下面的评论中听到你的 shell 故事。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/19/9/command-line-heroes-bash + +作者:[Matthew Broberg][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://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/commnad_line_hereoes_ep6_blog-header-292x521.png?itok=Bs1RlwoW (Listen to the Command Line Heroes Podcast) +[2]: https://devblogs.microsoft.com/commandline/introducing-windows-terminal/ +[3]: https://www.redhat.com/en/command-line-heroes +[4]: https://developer.ibm.com/tutorials/l-linux-shells/ +[5]: https://www.computerworld.com.au/article/279011/-z_programming_languages_bourne_shell_sh diff --git a/published/201909/20190904 How to build Fedora container images.md b/published/201909/20190904 How to build Fedora container images.md new file mode 100644 index 0000000000..0ab7ed8684 --- /dev/null +++ b/published/201909/20190904 How to build Fedora container images.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11327-1.html) +[#]: subject: (How to build Fedora container images) +[#]: via: (https://fedoramagazine.org/how-to-build-fedora-container-images/) +[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/) + +如何构建 Fedora 容器镜像 +====== + +![][1] + +随着容器和容器技术的兴起,现在所有主流的 Linux 发行版都提供了容器基础镜像。本文介绍了 Fedora 项目如何构建其基本镜像。同时还展示了如何使用它来创建分层图像。 + +### 基础和分层镜像 + +在看如何构建 Fedora 容器基础镜像base image之前,让我们定义基础镜像和分层镜像layered image。定义基础镜像的简单方法是没有父镜像层的镜像。但这具体意味着什么呢?这意味着基础镜像通常只包含操作系统的根文件系统基础镜像(rootfs)。基础镜像通常提供安装软件以创建分层镜像所需的工具。 + +分层镜像在基础镜像上添加了一组层,以便安装、配置和运行应用。分层镜像在 Dockerfile 中使用 `FROM` 指令引用基础镜像: + +``` +FROM fedora:latest +``` + +### 如何构建基础镜像 + +Fedora 有一整套用于构建容器镜像的工具。[其中包括 podman][2],它不需要以 root 身份运行。 + +#### 构建 rootfs + +基础镜像主要由一个 [tarball][3] 构成。这个 tarball 包含一个 rootfs。有不同的方法来构建此 rootfs。Fedora 项目使用 [kickstart][4] 安装方式以及 [imagefactory][5] 来创建这些 tarball。 + +在创建 Fedora 基础镜像期间使用的 kickstart 文件可以在 Fedora 的构建系统 [Koji][6] 中找到。[Fedora-Container-Base][7] 包重新组合了所有基础镜像的构建版本。如果选择了一个构建版本,那么可以访问所有相关文件,包括 kickstart 文件。查看 [示例][8],文件末尾的 `%packages` 部分定义了要安装的所有软件包。这就是让软件放在基础镜像中的方法。 + +#### 使用 rootfs 构建基础镜像 + +rootfs 完成后,构建基础镜像就很容易了。它只需要一个包含以下指令的 Dockerfile: + +``` +FROM scratch +ADD layer.tar / +CMD ["/bin/bash"] +``` + +这里的重要部分是 `FROM scratch` 指令,它会创建一个空镜像。然后,接下来的指令将 rootfs 添加到镜像,并设置在运行镜像时要执行的默认命令。 + +让我们使用 Koji 内置的 Fedora rootfs 构建一个基础镜像: + +``` +$ curl -o fedora-rootfs.tar.xz https://kojipkgs.fedoraproject.org/packages/Fedora-Container-Base/Rawhide/20190902.n.0/images/Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ tar -xJvf fedora-rootfs.tar.xz 51c14619f9dfd8bf109ab021b3113ac598aec88870219ff457ba07bc29f5e6a2/layer.tar +$ mv 51c14619f9dfd8bf109ab021b3113ac598aec88870219ff457ba07bc29f5e6a2/layer.tar layer.tar +$ printf "FROM scratch\nADD layer.tar /\nCMD [\"/bin/bash\"]" > Dockerfile +$ podman build -t my-fedora . +$ podman run -it --rm my-fedora cat /etc/os-release +``` + +需要从下载的存档中提取包含 rootfs 的 `layer.tar` 文件。这在 Fedora 生成的镜像已经可以被容器运行时使用才需要。 + +因此,使用 Fedora 生成的镜像,获得基础镜像会更容易。让我们看看它是如何工作的: + +``` +$ curl -O https://kojipkgs.fedoraproject.org/packages/Fedora-Container-Base/Rawhide/20190902.n.0/images/Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ podman load --input Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ podman run -it --rm localhost/fedora-container-base-rawhide-20190902.n.0.x86_64:latest cat /etc/os-release +``` + +### 构建分层镜像 + +要构建使用 Fedora 基础镜像的分层镜像,只需在 `FROM` 行指令中指定 `fedora`: + +``` +FROM fedora:latest +``` + +`latest` 标记引用了最新的 Fedora 版本(编写本文时是 Fedora 30)。但是可以使用镜像的标签来使用其他版本。例如,`FROM fedora:31` 将使用 Fedora 31 基础镜像。 + +Fedora 支持将软件作为容器来构建并发布。这意味着你可以维护 Dockerfile 来使其他人可以使用你的软件。关于在 Fedora 中成为容器镜像维护者的更多信息,请查看 [Fedora 容器指南][9]。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-fedora-container-images/ + +作者:[Clément Verna][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/fedoracontainers-816x345.jpg +[2]: https://linux.cn/article-10156-1.html +[3]: https://en.wikipedia.org/wiki/Tar_(computing) +[4]: https://en.wikipedia.org/wiki/Kickstart_(Linux) +[5]: http://imgfac.org/ +[6]: https://koji.fedoraproject.org/koji/ +[7]: https://koji.fedoraproject.org/koji/packageinfo?packageID=26387 +[8]: https://kojipkgs.fedoraproject.org//packages/Fedora-Container-Base/30/20190902.0/images/koji-f30-build-37420478-base.ks +[9]: https://docs.fedoraproject.org/en-US/containers/guidelines/guidelines/ diff --git a/published/201909/20190905 How to Change Themes in Linux Mint.md b/published/201909/20190905 How to Change Themes in Linux Mint.md new file mode 100644 index 0000000000..dd2f69b044 --- /dev/null +++ b/published/201909/20190905 How to Change Themes in Linux Mint.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11359-1.html) +[#]: subject: (How to Change Themes in Linux Mint) +[#]: via: (https://itsfoss.com/install-themes-linux-mint/) +[#]: author: (It's FOSS Community https://itsfoss.com/author/itsfoss/) + +如何在 Linux Mint 中更换主题 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/19/100317ixxp3y1l7lljl47a.jpg) + +一直以来,使用 Cinnamon 桌面环境的 Linux Mint 都是一种卓越的体验。这也是[为何我喜爱 Linux Mint][1]的主要原因之一。 + +自从 Mint 的开发团队[开始更为严肃的对待设计][2], “桌面主题” 应用便成为了更换新主题、图标、按钮样式、窗口边框以及鼠标指针的重要方式,当然你也可以直接通过它安装新的主题。感兴趣么?让我们开始吧。 + +### 如何在 Linux Mint 中更换主题 + +在菜单中搜索主题并打开主题应用。 + +![Theme Applet provides an easy way of installing and changing themes][3] + +在应用中有一个“添加/删除”按钮,非常简单吧。点击它,我们可以看到按流行程度排序的 Cinnamon Spices(Cinnamon 的官方插件库)的主题。 + +![Installing new themes in Linux Mint Cinnamon][4] + +要安装主题,你所要做的就是点击你喜欢的主题,然后等待它下载。之后,主题将在应用第一页的“Desktop”选项中显示可用。只需双击已安装的主题之一就可以开始使用它。 + +![Changing themes in Linux Mint Cinnamon][5] + +下面是默认的 Linux Mint 外观: + +![Linux Mint Default Theme][6] + +这是在我更换主题之后: + +![Linux Mint with Carta Theme][7] + +所有的主题都可以在 Cinnamon Spices 网站上获得更多的信息和更大的截图,这样你就可以更好地了解你的系统的外观。 + +- [浏览 Cinnamon 主题][8] + +### 在 Linux Mint 中安装第三方主题 + +> “我在另一个网站上看到了这个优异的主题,但 Cinnamon Spices 网站上没有……” + +Cinnamon Spices 集成了许多优秀的主题,但你仍然会发现,你看到的主题并没有被 Cinnamon Spices 官方网站收录。 + +这时你可能会想:如果有别的办法就好了,对么?你可能会认为有(我的意思是……当然啦)。首先,我们可以在其他网站上找到一些很酷的主题。 + +我推荐你去 Cinnamon Look 浏览一下那儿的主题。如果你喜欢什么,就下载吧。 + +- [在 Cinnamon Look 中获取更多主题][9] + +下载了首选主题之后,你现在将得到一个压缩文件,其中包含安装所需的所有内容。提取它并保存到 `~/.themes`。迷糊么? `~` 代表了你的家目录的对应路径:`/home/{YOURUSER}/.themes`。 + +然后跳转到你的家目录。按 `Ctrl+H` 来[显示 Linux 中的隐藏文件][11]。如果没有看到 `.themes` 文件夹,创建一个新文件夹并命名为 `.themes`。记住,文件夹名称开头的点很重要。 + +将提取的主题文件夹从下载目录复制到你的家目录中的 `.themes` 文件夹中。 + +最后,在上面提到的应用中查找已安装的主题。 + +> 注记 +> +> 请记住,主题必须是 Cinnamon 相对应的,即使它是一个从 GNOME 复刻的系统也不行,并不是所有的 GNOME 主题都适用于 Cinnamon。 + +改变主题是 Cinnamon 定制工作的一部分。你还可以[通过更改图标来更改 Linux Mint 的外观][12]。 + +我希望你现在已经知道如何在 Linux Mint 中更改主题了。快去选取你喜欢的主题吧。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-themes-linux-mint/ + +作者:[It's FOSS][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/tiny-features-linux-mint-cinnamon/ +[2]: https://itsfoss.com/linux-mint-new-design/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-1.jpg?resize=800%2C625&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-2.jpg?resize=800%2C625&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-3.jpg?resize=800%2C450&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-mint-default-theme.jpg?resize=800%2C450&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-mint-carta-theme.jpg?resize=800%2C450&ssl=1 +[8]: https://cinnamon-spices.linuxmint.com/themes +[9]: https://www.cinnamon-look.org/ +[10]: https://itsfoss.com/failed-to-start-session-ubuntu-14-04/ +[11]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[12]: https://itsfoss.com/install-icon-linux-mint/ diff --git a/published/201909/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md b/published/201909/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md new file mode 100644 index 0000000000..87c0308360 --- /dev/null +++ b/published/201909/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11352-1.html) +[#]: subject: (How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script) +[#]: via: (https://www.2daygeek.com/linux-get-average-cpu-memory-utilization-from-sar-data-report/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 Bash 脚本从 SAR 报告中获取 CPU 和内存使用情况 +====== + +大多数 Linux 管理员使用 [SAR 报告][1]监控系统性能,因为它会收集一周的性能数据。但是,你可以通过更改 `/etc/sysconfig/sysstat` 文件轻松地将其延长到四周。同样,这段时间可以延长一个月以上。如果超过 28,那么日志文件将放在多个目录中,每月一个。 + +要将覆盖期延长至 28 天,请对 `/etc/sysconfig/sysstat` 文件做以下更改。 + +编辑 `sysstat` 文件并将 `HISTORY=7` 更改为 `HISTORY=28`。 + +在本文中,我们添加了三个 bash 脚本,它们可以帮助你在一个地方轻松查看每个数据文件的平均值。 + +我们过去加过许多有用的 shell 脚本。如果你想查看它们,请进入下面的链接。 + +* [如何使用 shell 脚本自动化日常操作][2] + +这些脚本简单明了。出于测试目的,我们仅包括两个性能指标,即 CPU 和内存。你可以修改脚本中的其他性能指标以满足你的需求。 + +### 脚本 1:从 SAR 报告中获取平均 CPU 利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集 CPU 平均值并将其显示在一个页面上。 + +由于是月末,它显示了 2019 年 8 月的 28 天数据。 + +``` +# vi /opt/scripts/sar-cpu-avg.sh + +#!/bin/sh + +echo "+----------------------------------------------------------------------------------+" +echo "|Average: CPU %user %nice %system %iowait %steal %idle |" +echo "+----------------------------------------------------------------------------------+" + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + dat=`sar -f $file | head -n 1 | awk '{print $4}'` + echo -n $dat + sar -f $file | grep -i Average | sed "s/Average://" +done + +echo "+----------------------------------------------------------------------------------+" +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-cpu-avg.sh + ++----------------------------------------------------------------------------------+ +|Average: CPU %user %nice %system %iowait %steal %idle | ++----------------------------------------------------------------------------------+ +08/01/2019 all 0.70 0.00 1.19 0.00 0.00 98.10 +08/02/2019 all 1.73 0.00 3.16 0.01 0.00 95.10 +08/03/2019 all 1.73 0.00 3.16 0.01 0.00 95.11 +08/04/2019 all 1.02 0.00 1.80 0.00 0.00 97.18 +08/05/2019 all 0.68 0.00 1.08 0.01 0.00 98.24 +08/06/2019 all 0.71 0.00 1.17 0.00 0.00 98.12 +08/07/2019 all 1.79 0.00 3.17 0.01 0.00 95.03 +08/08/2019 all 1.78 0.00 3.14 0.01 0.00 95.08 +08/09/2019 all 1.07 0.00 1.82 0.00 0.00 97.10 +08/10/2019 all 0.38 0.00 0.50 0.00 0.00 99.12 +. +. +. +08/29/2019 all 1.50 0.00 2.33 0.00 0.00 96.17 +08/30/2019 all 2.32 0.00 3.47 0.01 0.00 94.20 ++----------------------------------------------------------------------------------+ +``` + +### 脚本 2:从 SAR 报告中获取平均内存利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集内存平均值并将其显示在一个页面上。 + +由于是月末,它显示了 2019 年 8 月的 28 天数据。 + +``` +# vi /opt/scripts/sar-memory-avg.sh + +#!/bin/sh + +echo "+-------------------------------------------------------------------------------------------------------------------+" +echo "|Average: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty |" +echo "+-------------------------------------------------------------------------------------------------------------------+" + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + dat=`sar -f $file | head -n 1 | awk '{print $4}'` + echo -n $dat + sar -r -f $file | grep -i Average | sed "s/Average://" +done + +echo "+-------------------------------------------------------------------------------------------------------------------+" +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-memory-avg.sh + ++--------------------------------------------------------------------------------------------------------------------+ +|Average: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty | ++--------------------------------------------------------------------------------------------------------------------+ +08/01/2019 1492331 2388461 61.55 29888 1152142 1560615 12.72 1693031 380472 6 +08/02/2019 1493126 2387666 61.53 29888 1147811 1569624 12.79 1696387 373346 3 +08/03/2019 1489582 2391210 61.62 29888 1147076 1581711 12.89 1701480 370325 3 +08/04/2019 1490403 2390389 61.60 29888 1148206 1569671 12.79 1697654 373484 4 +08/05/2019 1484506 2396286 61.75 29888 1152409 1563804 12.75 1702424 374628 4 +08/06/2019 1473593 2407199 62.03 29888 1151137 1577491 12.86 1715426 371000 8 +08/07/2019 1467150 2413642 62.19 29888 1155639 1596653 13.01 1716900 372574 13 +08/08/2019 1451366 2429426 62.60 29888 1162253 1604672 13.08 1725931 376998 5 +08/09/2019 1451191 2429601 62.61 29888 1158696 1582192 12.90 1728819 371025 4 +08/10/2019 1450050 2430742 62.64 29888 1160916 1579888 12.88 1729975 370844 5 +. +. +. +08/29/2019 1365699 2515093 64.81 29888 1198832 1593567 12.99 1781733 376157 15 +08/30/2019 1361920 2518872 64.91 29888 1200785 1595105 13.00 1784556 375641 8 ++-------------------------------------------------------------------------------------------------------------------+ +``` + +### 脚本 3:从 SAR 报告中获取 CPU 和内存平均利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集 CPU 和内存平均值并将其显示在一个页面上。 + +该脚本与上面相比稍微不同。它在同一位置同时显示两者(CPU 和内存)平均值,而不是其他数据。 + +``` +# vi /opt/scripts/sar-cpu-mem-avg.sh + +#!/bin/bash + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + sar -f $file | head -n 1 | awk '{print $4}' + echo "-----------" + sar -u -f $file | awk '/Average:/{printf("CPU Average: %.2f%\n"), 100 - $8}' + sar -r -f $file | awk '/Average:/{printf("Memory Average: %.2f%\n"),(($3-$5-$6)/($2+$3)) * 100 }' + printf "\n" +done +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-cpu-mem-avg.sh + +08/01/2019 +----------- +CPU Average: 1.90% +Memory Average: 31.09% + +08/02/2019 +----------- +CPU Average: 4.90% +Memory Average: 31.18% + +08/03/2019 +----------- +CPU Average: 4.89% +Memory Average: 31.29% + +08/04/2019 +----------- +CPU Average: 2.82% +Memory Average: 31.24% + +08/05/2019 +----------- +CPU Average: 1.76% +Memory Average: 31.28% +. +. +. +08/29/2019 +----------- +CPU Average: 3.83% +Memory Average: 33.15% + +08/30/2019 +----------- +CPU Average: 5.80% +Memory Average: 33.19% +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-get-average-cpu-memory-utilization-from-sar-data-report/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/sar-system-performance-monitoring-command-tool-linux/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/201909/20190905 USB4 gets final approval, offers Ethernet-like speed.md b/published/201909/20190905 USB4 gets final approval, offers Ethernet-like speed.md new file mode 100644 index 0000000000..ade65f4a5e --- /dev/null +++ b/published/201909/20190905 USB4 gets final approval, offers Ethernet-like speed.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11330-1.html) +[#]: subject: (USB4 gets final approval, offers Ethernet-like speed) +[#]: via: (https://www.networkworld.com/article/3435113/usb4-gets-final-approval-offers-ethernet-like-speed.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +USB4 规范获得最终批准,像以太网一样快! +====== + +> USB4 会是一个统一的接口,可以淘汰笨重的电缆和超大的插头,并提供满足从笔记本电脑用户到服务器管理员的每个人的吞吐量。 + +![](https://images.idgesg.net/images/article/2019/03/thunderbolt-3_intel-v2-100790083-large.jpg) + +USB 开发者论坛USB Implementers Forum(USB-IF)是通用串行总线(USB)规范开发背后的行业协会,上周宣布了它已经完成了下一代 USB4 的技术规范。 + +USB4 最重要的一个方面(它们在此版本中省略了首字母缩略词和版本号之间的空格)是它将 USB 与 Intel 设计的接口 Thunderbolt 3 融合在了一起。Thunderbolt 尽管有潜力,但在除了笔记本之外并未真正流行起来。出于这个原因,Intel 向 USB 联盟提供了 Thunderbolt 规范。 + +不幸的是,Thunderbolt 3 被列为 USB4 设备的一个可选项,因此有些设备会有,有些则不会。这无疑会让人头疼,希望所有设备制造商都会包括 Thunderbolt 3。 + +USB4 将使用与 USB type-C 相同的外形尺寸,这个小型插头用在所有现代 Android 手机和 Thunderbolt 3 中。它将向后兼容 USB 3.2、USB 2.0 以及 Thunderbolt。因此,几乎任何现有的USB type-C 设备都可以连接到具有 USB4 总线的机器,但将以连接电缆的额定速度运行。 + +### USB4:体积更小,速度更快 + +因为它支持 Thunderbolt 3,所以这种新连接将同时支持数据和显示协议,因此这可能意味着小型 USB-C 端口将取代显示器上庞大的 DVI 端口,而显示器则带有多个 USB4 端口来作为集线器。 + +新标准的主要内容:它提供双通道 40Gbps 传输速度,是当前 USB 3.2 规格的两倍,是 USB 3 的八倍。这是以太网的速度,应该足够给你的高清显示器以及其他数据传输提供充足带宽。 + +USB4 也为视频提供了更好的资源分配,因此如果你使用 USB4 端口同时传输视频和数据,端口将相应地分配带宽。这将允许计算机同时使用外部独立的 GPU(因为有 Thunderbolt 3,它已经上市 )和外部 SSD。 + +这可能会启发各种新的服务器设计,因为大型、笨重的设备,如 GPU 或其他不易放入 1U 或 2U 机箱的卡板,现在可以外部连接并以与内部设备相当的速度运行。 + +当然,我们看到配备了 USB4 端口的电脑还需要一段时间,更别说服务器了。将 USB 3 用于 PC 花费了数年时间,而 USB-C 的采用速度非常缓慢。USB 2 的 U 盘仍然是这些设备的主要市场,并且主板仍然带有 USB 2 端口。 + +尽管如此,USB4 还是有可能成为一个统一的接口,可以摆脱拥有超大插头的笨重电缆,并提供满足从笔记本电脑用户到服务器管理员的每个人的吞吐量。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3435113/usb4-gets-final-approval-offers-ethernet-like-speed.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md b/published/201909/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md new file mode 100644 index 0000000000..9118ebe1ef --- /dev/null +++ b/published/201909/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11346-1.html) +[#]: subject: (Great News! Firefox 69 Blocks Third-Party Cookies, Autoplay Videos & Cryptominers by Default) +[#]: via: (https://itsfoss.com/firefox-69/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Firefox 69 默认阻拦第三方 Cookie、自动播放的视频和加密矿工 +====== + +如果你使用的是 [Mozilla Firefox][1] 并且尚未更新到最新版本,那么你将错过许多新的重要功能。 + +### Firefox 69 版本中的一些新功能 + +首先,Mozilla Firefox 69 会默认强制执行更强大的安全和隐私选项。以下是新版本的一些主要亮点。 + +#### Firefox 69 阻拦视频自动播放 + +![][2] + +现在很多网站都提供了自动播放视频。无论是弹出视频还是嵌入在文章中设置为自动播放的视频,默认情况下,Firefox 69 都会阻止它(或者可能会提示你)。 + +这个[阻拦自动播放][3]功能可让用户自动阻止任何视频播放。 + +#### 禁止第三方跟踪 cookie + +默认情况下,作为增强型跟踪保护Enhanced Tracking Protection功能的一部分,它现在将阻止第三方跟踪 Cookie 和加密矿工。这是 Mozilla Firefox 的增强隐私保护功能的非常有用的改变。 + +Cookie 有两种:第一方的和第三方的。第一方 cookie 由网站本身拥有。这些是“好的 cookie”,可以让你保持登录、记住你的密码或输入字段等来改善浏览体验。第三方 cookie 由你访问的网站以外的域所有。广告服务器使用这些 Cookie 来跟踪你,并在你访问的所有网站上跟踪广告。Firefox 69 旨在阻止这些。 + +当它发挥作用时,你将在地址栏中看到盾牌图标。你可以选择为特定网站禁用它。 + +![Firefox Blocking Tracking][4] + +#### 禁止加密矿工消耗你的 CPU + +![][5] + +对加密货币的欲望一直困扰着这个世界。GPU 的价格已经高企,因为专业的加密矿工们使用它们来挖掘加密货币。 + +人们使用工作场所的计算机秘密挖掘加密货币。当我说工作场所时,我不一定是指 IT 公司。就在今年,[人们在乌克兰的一家核电站抓住了偷挖加密货币的活动][6]。 + +不仅如此。如果你访问某些网站,他们会运行脚本并使用你的计算机的 CPU 来挖掘加密货币。这在 IT 术语中被称为 [挖矿攻击][7]cryptojacking。 + +好消息是 Firefox 69 会自动阻止这些加密矿工脚本。因此,网站不再能利用你的系统资源进行挖矿攻击了。 + +#### Firefox 69 带来的更强隐私保护 + +![][8] + +如果你把隐私保护设置得更严格,那么它也会阻止指纹。因此,当你在 Firefox 69 中选择严格的隐私设置时,你不必担心通过[指纹][9]共享计算机的配置信息。 + +在[关于这次发布的官方博客文章][10]中,Mozilla 提到,在此版本中,他们希望默认情况下为 100% 的用户提供保护。 + +#### 性能改进 + +尽管在更新日志中没有提及 Linux,但它提到了在 Windows 10/mac OS 上运行性能、UI 和电池寿命有所改进。如果你发现任何性能改进,请在评论中提及。 + +### 总结 + +除了所有这些之外,还有很多底层的改进。你可以查看[发行说明][11]中的详细信息。 + +Firefox 69 对于关注其隐私的用户来说是一个令人印象深刻的更新。与我们最近对某些[安全电子邮件服务][12]的建议类似,我们建议你更新浏览器以充分受益。新版本已在大多数 Linux 发行版中提供,你只需要更新你的系统即可。 + +如果你对阻止广告和跟踪 Cookie 的浏览器感兴趣,请尝试[开源的 Brave 浏览器][13],他们甚至给你提供了加密货币以让你使用他们的浏览器,你可以使用这些加密货币来奖励你最喜爱的发布商。 + +你觉得这个版本怎么样?请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-69/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-firefox/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/auto-block-firefox.png?ssl=1 +[3]: https://support.mozilla.org/en-US/kb/block-autoplay +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-blocking-tracking.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-shield.png?ssl=1 +[6]: https://thenextweb.com/hardfork/2019/08/22/ukrainian-nuclear-powerplant-mine-cryptocurrency-state-secrets/ +[7]: https://hackernoon.com/cryptojacking-in-2019-is-not-dead-its-evolving-984b97346d16 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-secure.jpg?ssl=1 +[9]: https://clearcode.cc/blog/device-fingerprinting/ +[10]: https://blog.mozilla.org/blog/2019/09/03/todays-firefox-blocks-third-party-tracking-cookies-and-cryptomining-by-default/ +[11]: https://www.mozilla.org/en-US/firefox/69.0/releasenotes/ +[12]: https://itsfoss.com/secure-private-email-services/ +[13]: https://itsfoss.com/brave-web-browser/ diff --git a/published/201909/20190906 How to change the color of your Linux terminal.md b/published/201909/20190906 How to change the color of your Linux terminal.md new file mode 100644 index 0000000000..df5bd052bd --- /dev/null +++ b/published/201909/20190906 How to change the color of your Linux terminal.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11324-1.html) +[#]: subject: (How to change the color of your Linux terminal) +[#]: via: (https://opensource.com/article/19/9/linux-terminal-colors) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何改变你的终端颜色 +====== + +> 使 Linux 变得丰富多彩(或单色)。 + +![](https://img.linux.net.cn/data/attachment/album/201909/10/111118bnvvcy6sntcs1s3t.jpg) + +你可以使用特殊的 ANSI 编码设置为 Linux 终端添加颜色,可以在终端命令或配置文件中动态添加,也可以在终端仿真器中使用现成的主题。无论哪种方式,你都可以黑色屏幕上找回怀旧的绿色或琥珀色文本。本文演示了如何使 Linux 变得丰富多彩(或单色)的方法。 + +### 终端的功能特性 + +现代系统的终端的颜色配置通常默认至少是 xterm-256color,但如果你尝试为终端添加颜色但未成功,则应检查你的 `TERM` 设置。 + +从历史上看,Unix 终端从字面上讲是:用户可以输入命令的共享计算机系统上实际的物理端点(终点)。它们专指通常用于远程发出命令的电传打字机(这也是我们今天在 Linux 中仍然使用 `/dev/tty` 设备的原因)。终端内置了 CRT 显示器,因此用户可以坐在办公室的终端上直接与大型机进行交互。CRT 显示器价格昂贵 —— 无论是制造还是使用控制;比担心抗锯齿和现代计算机专家理所当然认为的漂亮信息,让计算机吐出原始 ASCII 文本更容易。然而,即使在那时,技术的发展也很快,很快人们就会发现,随着新的视频显示终端的设计,他们需要新的功能特性来提供可选功能。 + +例如,1978 年发布的花哨的新 VT100 支持 ANSI 颜色,因此如果用户将终端类型识别为 vt100,则计算机可以提供彩色输出,而基本串行设备可能没有这样的选项。同样的原则适用于今天,它是由 `TERM` [环境变量][2]设定的。你可以使用 `echo` 检查你的 `TERM` 定义: + +``` +$ echo $TERM +xterm-256color +``` + +过时的(但在一些系统上仍然为了向后兼容而维护)`/etc/termcap` 文件定义了终端和打印机的功能特性。现代的版本是 `terminfo`,位于 `/etc` 或 `/usr/share` 中,具体取决于你的发行版。 这些文件列出了不同类型终端中可用的功能特性,其中许多都是由历史上的硬件定义的,如 vt100 到 vt220 的定义,以及 xterm 和 Xfce 等现代软件仿真器。大多数软件并不关心你使用的终端类型; 在极少数情况下,登录到检查兼容功能的服务器时,你可能会收到有关错误的终端类型的警告或错误。如果你的终端设置为功能特性很少的配置文件,但你知道你所使用的仿真器能够支持更多功能特性,那么你可以通过定义 `TERM` 环境变量来更改你的设置。你可以通过在 `~/.bashrc` 配置文件中导出 `TERM` 变量来完成此操作: + +``` +export TERM=xterm-256color +``` + +保存文件并重新载入设置: + +``` +$ source ~/.bashrc +``` + +### ANSI 颜色代码 + +现代终端继承了用于“元”特征的 ANSI 转义序列。这些是特殊的字符序列,终端将其解释为操作而不是字符。例如,此序列将清除屏幕,直到下一个提示符: + +``` +$ printf '\033[2J' +``` + +它不会清除你的历史信息;它只是清除终端仿真器中的屏幕,因此它是一个安全且具有示范性的 ANSI 转义序列。 + +ANSI 还具有设置终端颜色的序列。例如,键入此代码会将后续文本更改为绿色: + +``` +$ printf '\033[32m' +``` + +只要你对相同的计算机使用同一个颜色,就可以使用颜色来帮助你记住你登录的系统。例如,如果你经常通过 SSH 连接到服务器,则可以将服务器的提示符设置为绿色,以帮助你一目了然地将其与本地的提示符区分开来。 要设置绿色提示符,请在提示符前使用 ANSI 代码设置为绿色,并使用代表正常默认颜色的代码结束: + + +``` +export PS1=`printf "\033[32m$ \033[39m"` +``` + +### 前景色和背景色 + +你不仅可以设置文本的颜色。使用 ANSI 代码,你还可以控制文本的背景颜色以及做一些基本的样式。 + +例如,使用 `\033[4m`,你可以为文本加上下划线,或者使用 `\033[5m` 你可以将其设置为闪烁的文本。起初这可能看起来很愚蠢,因为你可能不会将你的终端设置为所有文本带有下划线并整天闪烁, 但它对某些功能很有用。例如,你可以将 shell 脚本生成的紧急错误设置为闪烁(作为对用户的警报),或者你可以为 URL 添加下划线。 + +作为参考,以下是前景色和背景色的代码。前景色在 30 范围内,而背景色在 40 范围内: + +颜色 | 前景色 | 背景色 +---|---|--- +黑色 | \033[30m | \033[40m +红色 | \033[31m | \033[41m +绿色 | \033[32m | \033[42m +橙色 | \033[33m | \033[43m +蓝色 | \033[34m | \033[44m +品红 | \033[35m | \033[45m +青色 | \033[36m | \033[46m +浅灰 | \033[37m | \033[47m +回退到发行版默认值 | \033[39m | \033[49m + +还有一些可用于背景的其他颜色: + +颜色 | 背景色 +---|--- +深灰 | \033[100m +浅红 | \033[101m +浅绿 | \033[102m +黄色 | \033[103m +浅蓝 | \033[104m +浅紫 | \033[105m +蓝绿 | \033[106m +白色 | \033[107m + +### 持久设置 + +在终端会话中设置颜色只是暂时的,相对无条件的。有时效果会持续几行;这是因为这种设置颜色的方法依赖于 `printf` 语句来设置一种模式,该模式仅持续到其他设置覆盖它。 + +终端仿真器通常获取使用哪种颜色的指令的方式来自于 `LS_COLORS` 环境变量的设置,该设置又由 `dircolors` 的设置填充。你可以使用 `echo` 语句查看当前设置: + +``` +$ echo $LS_COLORS +rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40; +38;5;11:so=38;5;13:do=38;5;5:bd=48;5; +232;38;5;11:cd=48;5;232;38;5;3:or=48; +5;232;38;5;9:mi=01;05;37;41:su=48;5; +196;38;5;15:sg=48;5;11;38;5;16:ca=48;5; +196;38;5;226:tw=48;5;10;38;5;16:ow=48;5; +[...] +``` + +或者你可以直接使用 `dircolors`: + +``` +$ dircolors --print-database +[...] +# image formats +.jpg 01;35 +.jpeg 01;35 +.mjpg 01;35 +.mjpeg 01;35 +.gif 01;35 +.bmp 01;35 +.pbm 01;35 +.tif 01;35 +.tiff 01;35 +[...] +``` + +这看起来很神秘。文件类型后面的第一个数字是属性代码,它有六种选择: + +* 00 无 +* 01 粗体 +* 04 下划线 +* 05 闪烁 +* 07 反白 +* 08 暗色 + +下一个数字是简化形式的颜色代码。你可以通过获取 ANSI 代码的最后一个数字来获取颜色代码(绿色前景为 32,绿色背景为 42;红色为 31 或 41,依此类推)。 + +你的发行版可能全局设置了 `LS_COLORS`,因此系统上的所有用户都会继承相同的颜色。如果你想要一组自定义的颜色,可以使用 `dircolors`。首先,生成颜色设置的本地副本: + +``` +$ dircolors --print-database > ~/.dircolors +``` + +根据需要编辑本地列表。如果你对自己的选择感到满意,请保存文件。你的颜色设置只是一个数据库,不能由 [ls][3] 直接使用,但你可以使用 `dircolors` 获取可用于设置 `LS_COLORS` 的 shellcode: + +``` +$ dircolors --bourne-shell ~/.dircolors +LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00: +pi=40;33:so=01;35:do=01;35:bd=40;33;01: +cd=40;33;01:or=40;31;01:mi=00:su=37;41: +sg=30;43:ca=30;41:tw=30;42:ow=34; +[...] +export LS_COLORS +``` + +将输出复制并粘贴到 `~/.bashrc` 文件中并重新加载。或者,你可以将该输出直接转储到 `.bashrc` 文件中并重新加载。 + +``` +$ dircolors --bourne-shell ~/.dircolors >> ~/.bashrc +$ source ~/.bashrc +``` + +你也可以在启动时使 Bash 解析 `.dircolors` 而不是手动进行转换。实际上,你可能不会经常改变颜色,所以这可能过于激进,但如果你打算改变你的配色方案,这是一个选择。在 `.bashrc` 文件中,添加以下规则: + +``` +[[ -e $HOME/.dircolors ]] && eval "`dircolors --sh $HOME/.dircolors`" +``` + +如果你的主目录中有 `.dircolors` 文件,Bash 会在启动时对其进行评估并相应地设置 `LS_COLORS`。 + +### 颜色 + +在终端中使用颜色是一种可以为你自己提供特定信息的快速视觉参考的简单方法。但是,你可能不希望过于依赖它们。毕竟,颜色不是通用的,所以如果其他人使用你的系统,他们可能不会像你那样看懂颜色代表的含义。此外,如果你使用各种工具与计算机进行交互,你可能还会发现某些终端或远程连接无法提供你期望的颜色(或根本不提供颜色)。 + +除了上述警示之外,颜色在某些工作流程中可能很有用且很有趣,因此创建一个 `.dircolor` 数据库并根据你的想法对其进行自定义吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-terminal-colors + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://opensource.com/article/19/8/what-are-environment-variables +[3]: https://opensource.com/article/19/7/master-ls-command diff --git a/published/201909/20190906 How to put an HTML page on the internet.md b/published/201909/20190906 How to put an HTML page on the internet.md new file mode 100644 index 0000000000..8e5e283364 --- /dev/null +++ b/published/201909/20190906 How to put an HTML page on the internet.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11374-1.html) +[#]: subject: (How to put an HTML page on the internet) +[#]: via: (https://jvns.ca/blog/2019/09/06/how-to-put-an-html-page-on-the-internet/) +[#]: author: (Julia Evans https://jvns.ca/) + +如何在互联网放置 HTML 页面 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/22/234957mmzoie1imufsuwea.jpg) + +我喜欢互联网的一点是在互联网放置静态页面是如此简单。今天有人问我该怎么做,所以我想我会快速地写下来! + +### 只是一个 HTML 页面 + +我的所有网站都只是静态 HTML 和 CSS。我的网页设计技巧相对不高( 是我自己开发的最复杂的网站),因此保持我所有的网站相对简单意味着我可以做一些改变/修复,而不会花费大量时间。 + +因此,我们将在此文章中采用尽可能简单的方式 —— 只需一个 HTML 页面。 + +### HTML 页面 + +我们要放在互联网上的网站只是一个名为 `index.html` 的文件。你可以在 找到它,它是一个 Github 仓库,其中只包含一个文件。 + +HTML 文件中包含一些 CSS,使其看起来不那么无聊,部分复制自 。 + +### 如何将 HTML 页面放在互联网上 + +有以下几步: + + 1. 注册 [Neocities][1] 帐户 + 2. 将 index.html 复制到你自己 neocities 站点的 index.html 中 + 3. 完成 + +上面的 `index.html` 页面位于 [julia-example-website.neocities.com][2] 中,如果你查看源代码,你将看到它与 github 仓库中的 HTML 相同。 + +我认为这可能是将 HTML 页面放在互联网上的最简单的方法(这是一次回归 Geocities,它是我在 2003 年制作我的第一个网站的方式):)。我也喜欢 Neocities (像 [glitch][3],我也喜欢)它能实验、学习,并有乐趣。 + +### 其他选择 + +这绝不是唯一简单的方式,在你推送 Git 仓库时,Github pages 和 Gitlab pages 以及 Netlify 都将会自动发布站点,并且它们都非常易于使用(只需将它们连接到你的 GitHub 仓库即可)。我个人使用 Git 仓库的方式,因为 Git 不会让我感到紧张,我想知道我实际推送的页面发生了什么更改。但我想你如果第一次只想将 HTML/CSS 制作的站点放到互联网上,那么 Neocities 就是一个非常好的方法。 + +如果你不只是玩,而是要将网站用于真实用途,那么你或许会需要买一个域名,以便你将来可以更改托管服务提供商,但这有点不那么简单。 + +### 这是学习 HTML 的一个很好的起点 + +如果你熟悉在 Git 中编辑文件,同时想练习 HTML/CSS 的话,我认为将它放在网站中是一个有趣的方式!我真的很喜欢它的简单性 —— 实际上这只有一个文件,所以没有其他花哨的东西需要去理解。 + +还有很多方法可以复杂化/扩展它,比如这个博客实际上是用 [Hugo][4] 生成的,它生成了一堆 HTML 文件并放在网络中,但从基础开始总是不错的。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/06/how-to-put-an-html-page-on-the-internet/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://neocities.org/ +[2]: https://julia-example-website.neocities.org/ +[3]: https://glitch.com +[4]: https://gohugo.io/ diff --git a/published/201909/20190909 Firefox 69 available in Fedora.md b/published/201909/20190909 Firefox 69 available in Fedora.md new file mode 100644 index 0000000000..79249a373f --- /dev/null +++ b/published/201909/20190909 Firefox 69 available in Fedora.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11354-1.html) +[#]: subject: (Firefox 69 available in Fedora) +[#]: via: (https://fedoramagazine.org/firefox-69-available-in-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Firefox 69 已可在 Fedora 中获取 +====== + +![][1] + +当你安装 Fedora Workstation 时,你会发现它包括了世界知名的 Firefox 浏览器。 Mozilla 基金会以开发 Firefox 以及其他促进开放、安全和隐私的互联网项目为己任。Firefox 有快速的浏览引擎和大量的隐私功能。 + +开发者社区不断改进和增强 Firefox。最新版本 Firefox 69 于最近发布,你可在稳定版 Fedora 系统(30 及更高版本)中获取它。继续阅读以获得更多详情。 + +### Firefox 69 中的新功能 + +最新版本的 Firefox 包括[增强跟踪保护][2]Enhanced Tracking Protection(ETP)。当你使用带有新(或重置)配置文件的 Firefox 69 时,浏览器会使网站更难以跟踪你的信息或滥用你的计算机资源。 + +例如,不太正直的网站使用脚本让你的系统进行大量计算来产生加密货币,这称为[加密挖矿][3]cryptomining。加密挖矿在你不知情或未经许可的情况下发生,因此是对你的系统的滥用。Firefox 69 中的新标准设置可防止网站遭受此类滥用。 + +Firefox 69 还有其他设置,可防止识别或记录你的浏览器指纹,以供日后使用。这些改进为你提供了额外的保护,免于你的活动被在线追踪。 + +另一个常见的烦恼是在没有提示的情况下播放视频。视频播放也会占用更多的 CPU,你可能不希望未经许可就在你的笔记本上发生这种情况。Firefox 使用[阻止自动播放][4]Block Autoplay这个功能阻止了这种情况的发生。而 Firefox 69 还允许你停止静默开始播放的视频。此功能可防止不必要的突然的噪音。它还解决了更多真正的问题 —— 未经许可使用计算机资源。 + +新版本中还有许多其他新功能。在 [Firefox 发行说明][5]中阅读有关它们的更多信息。 + +### 如何获得更新 + +Firefox 69 存在于稳定版 Fedora 30、预发布版 Fedora 31 和 Rawhide 仓库中。该更新由 Fedora 的 Firefox 包维护者提供。维护人员还确保更新了 Mozilla 的网络安全服务(nss 包)。我们感谢 Mozilla 项目和 Firefox 社区在提供此新版本方面的辛勤工作。 + +如果你使用的是 Fedora 30 或更高版本,请在 Fedora Workstation 上使用*软件中心*,或在任何 Fedora 系统上运行以下命令: + +``` +$ sudo dnf --refresh upgrade firefox +``` + +如果你使用的是 Fedora 29,请[帮助测试更新][6],这样它可以变得稳定,让所有用户可以轻松使用。 + +Firefox 可能会提示你升级个人设置以使用新设置。要使用新功能,你应该这样做。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/firefox-69-available-in-fedora/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/firefox-v69-816x345.jpg +[2]: https://blog.mozilla.org/blog/2019/09/03/todays-firefox-blocks-third-party-tracking-cookies-and-cryptomining-by-default/ +[3]: https://www.webopedia.com/TERM/C/cryptocurrency-mining.html +[4]: https://support.mozilla.org/kb/block-autoplay +[5]: https://www.mozilla.org/en-US/firefox/69.0/releasenotes/ +[6]: https://bodhi.fedoraproject.org/updates/FEDORA-2019-89ae5bb576 diff --git a/published/201909/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md b/published/201909/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md new file mode 100644 index 0000000000..fd526ef267 --- /dev/null +++ b/published/201909/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11335-1.html) +[#]: subject: (How to Install Shutter Screenshot Tool in Ubuntu 19.04) +[#]: via: (https://itsfoss.com/install-shutter-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 19.04 中安装 Shutter 截图工具 +====== + +Shutter 是我在 [Linux 中最喜欢的截图工具][1]。你可以使用它截图,还可以用它编辑截图或其他图像。它是一个在图像上添加箭头和文本的不错的工具。你也可以使用它在 Ubuntu 或其它你使用的发行版中[调整图像大小][2]。FOSS 上大多数截图教程都使用 Shutter 编辑。 + +![Install Shutter Ubuntu][8] + + +虽然 [Shutter][4] 一直是一款很棒的工具,但它的开发却停滞了。这几年来一直没有新版本的 Shutter。甚至像 [Shutter 中编辑模式被禁用][5]这样的简单 bug 也没有修复。根本没有开发者的消息。 + +也许这就是为什么新版本的 Ubuntu 放弃它的原因。在 Ubuntu 18.04 LTS 之前,你可以在软件中心,或者[启用 universe 仓库][7]来[使用 apt-get 命令][6]安装它。但是从 Ubuntu 18.10 及更高版本开始,你就不能再这样做了。 + +抛开这些缺点,Shutter 是一个很好的工具,我想继续使用它。也许你也是像我这样的 Shutter 粉丝,并且想要使用它。好的方面是你仍然可以在 Ubuntu 19.04 中安装 Shutter,这要归功于非官方 PPA。 + +### 在 Ubuntu 19.04 上安装 Shutter + +![][3] + +我希望你了解 PPA 的概念。如果不了解,我强烈建议阅读我的指南,以了解更多关于[什么是 PPA 以及如何使用它][9]。 + +现在,打开终端并使用以下命令添加新仓库: + +``` +sudo add-apt-repository -y ppa:linuxuprising/shutter +``` + +不需要再使用 `apt update`,因为从 Ubuntu 18.04 开始,仓库会在添加新条目后自动更新。 + +现在使用 `apt` 命令安装 Shutter: + +``` +sudo apt install shutter +``` + +完成。你应该已经安装 Shutter 截图工具。你可从菜单搜索并启动它。 + +### 删除通过非官方 PPA 安装的 Shutter + +最后我以卸载 Shutter 以及删除添加的仓库来结束教程。 + +首先,从系统中删除 Shutter: + +``` +sudo apt remove shutter +``` + +接下来,从你的仓库列表中删除 PPA: + +``` +sudo add-apt-repository --remove ppa:linuxuprising/shutter +``` + +你或许还想了解 [Y PPA Manager][11],这是一款 PPA 图形管理工具。 + +Shutter 是一个很好的工具,我希望它能被积极开发。我希望它的开发人员没问题,他/她可以找一些时间来处理它。或者是时候让其他人分叉并继续让它变得更棒。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-shutter-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/take-screenshot-linux/ +[2]: https://itsfoss.com/resize-images-with-right-click/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/shutter-screenshot.jpg?ssl=1 +[4]: http://shutter-project.org/ +[5]: https://itsfoss.com/shutter-edit-button-disabled/ +[6]: https://itsfoss.com/apt-get-linux-guide/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/Install-Shutter-ubuntu.jpg?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/ppa-guide/ +[11]: https://itsfoss.com/y-ppa-manager/ diff --git a/published/201909/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md b/published/201909/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md new file mode 100644 index 0000000000..8838a490d6 --- /dev/null +++ b/published/201909/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md @@ -0,0 +1,462 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11394-1.html) +[#]: subject: (How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8) +[#]: via: (https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 RHEL8 /CentOS8 上建立多节点 Elastic stack 集群 +====== + + +Elastic stack 俗称 ELK stack,是一组包括 Elasticsearch、Logstash 和 Kibana 在内的开源产品。Elastic Stack 由 Elastic 公司开发和维护。使用 Elastic stack,可以将系统日志发送到 Logstash,它是一个数据收集引擎,接受来自可能任何来源的日志或数据,并对日志进行归一化,然后将日志转发到 Elasticsearch,用于分析、索引、搜索和存储,最后使用 Kibana 表示为可视化数据,使用 Kibana,我们还可以基于用户的查询创建交互式图表。 + +![Elastic-Stack-Cluster-RHEL8-CentOS8][2] + +在本文中,我们将演示如何在 RHEL 8 / CentOS 8 服务器上设置多节点 elastic stack 集群。以下是我的 Elastic Stack 集群的详细信息: + +**Elasticsearch:** + +* 三台服务器,最小化安装 RHEL 8 / CentOS 8 +* IP & 主机名 – 192.168.56.40(`elasticsearch1.linuxtechi.local`)、192.168.56.50 (`elasticsearch2.linuxtechi.local`)、192.168.56.60(elasticsearch3.linuxtechi.local`) + +Logstash:** + +* 两台服务器,最小化安装 RHEL 8 / CentOS 8 +* IP & 主机 – 192.168.56.20(`logstash1.linuxtechi.local`)、192.168.56.30(`logstash2.linuxtechi.local`) + +**Kibana:** + +* 一台服务器,最小化安装 RHEL 8 / CentOS 8 +* IP & 主机名 – 192.168.56.10(`kibana.linuxtechi.local`) + +**Filebeat:** + +* 一台服务器,最小化安装 CentOS 7 +* IP & 主机名 – 192.168.56.70(`web-server`) + +让我们从设置 Elasticsearch 集群开始, + +### 设置3个节点 Elasticsearch 集群 + +正如我已经说过的,设置 Elasticsearch 集群的节点,登录到每个节点,设置主机名并配置 yum/dnf 库。 + +使用命令 `hostnamectl` 设置各个节点上的主机名: + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch1.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch2.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch3.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +对于 CentOS 8 系统,我们不需要配置任何操作系统包库,对于 RHEL 8 服务器,如果你有有效订阅,那么用红帽订阅以获得包存储库就可以了。如果你想为操作系统包配置本地 yum/dnf 存储库,请参考以下网址: + +- [如何使用 DVD 或 ISO 文件在 RHEL 8 服务器上设置本地 Yum / DNF 存储库][3] + +在所有节点上配置 Elasticsearch 包存储库,在 `/etc/yum.repo.d/` 文件夹下创建一个包含以下内容的 `elastic.repo` 文件: + +``` +~]# vi /etc/yum.repos.d/elastic.repo + +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md +``` + +保存文件并退出。 + +在所有三个节点上使用 `rpm` 命令导入 Elastic 公共签名密钥。 + +``` +~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +在所有三个节点的 `/etc/hosts` 文件中添加以下行: + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +使用 `yum`/`dnf` 命令在所有三个节点上安装 Java: + +``` +[root@linuxtechi ~]# dnf install java-openjdk -y +[root@linuxtechi ~]# dnf install java-openjdk -y +[root@linuxtechi ~]# dnf install java-openjdk -y +``` + +使用 `yum`/`dnf` 命令在所有三个节点上安装 Elasticsearch: + +``` +[root@linuxtechi ~]# dnf install elasticsearch -y +[root@linuxtechi ~]# dnf install elasticsearch -y +[root@linuxtechi ~]# dnf install elasticsearch -y +``` + +**注意:** 如果操作系统防火墙已启用并在每个 Elasticsearch 节点中运行,则使用 `firewall-cmd` 命令允许以下端口开放: + +``` +~]# firewall-cmd --permanent --add-port=9300/tcp +~]# firewall-cmd --permanent --add-port=9200/tcp +~]# firewall-cmd --reload +``` + +配置 Elasticsearch, 在所有节点上编辑文件 `/etc/elasticsearch/elasticsearch.yml` 并加入以下内容: + +``` +~]# vim /etc/elasticsearch/elasticsearch.yml + +cluster.name: opn-cluster +node.name: elasticsearch1.linuxtechi.local +network.host: 192.168.56.40 +http.port: 9200 +discovery.seed_hosts: ["elasticsearch1.linuxtechi.local", "elasticsearch2.linuxtechi.local", "elasticsearch3.linuxtechi.local"] +cluster.initial_master_nodes: ["elasticsearch1.linuxtechi.local", "elasticsearch2.linuxtechi.local", "elasticsearch3.linuxtechi.local"] +``` + +**注意:** 在每个节点上,在 `node.name` 中填写正确的主机名,在 `network.host` 中填写正确的 IP 地址,其他参数保持不变。 + +现在使用 `systemctl` 命令在所有三个节点上启动并启用 Elasticsearch 服务: + +``` +~]# systemctl daemon-reload +~]# systemctl enable elasticsearch.service +~]# systemctl start elasticsearch.service +``` + +使用下面 `ss` 命令验证 elasticsearch 节点是否开始监听 9200 端口: + +``` +[root@linuxtechi ~]# ss -tunlp | grep 9200 +tcp LISTEN 0 128 [::ffff:192.168.56.40]:9200 *:* users:(("java",pid=2734,fd=256)) +[root@linuxtechi ~]# +``` + +使用以下 `curl` 命令验证 Elasticsearch 群集状态: + +``` +[root@linuxtechi ~]# curl http://elasticsearch1.linuxtechi.local:9200 +[root@linuxtechi ~]# curl -X GET http://elasticsearch2.linuxtechi.local:9200/_cluster/health?pretty +``` + +命令的输出如下所示: + +![Elasticsearch-cluster-status-rhel8][3] + +以上输出表明我们已经成功创建了 3 节点的 Elasticsearch 集群,集群的状态也是绿色的。 + +**注意:** 如果你想修改 JVM 堆大小,那么你可以编辑了文件 `/etc/elasticsearch/jvm.options`,并根据你的环境更改以下参数: + +* `-Xms1g` +* `-Xmx1g` + +现在让我们转到 Logstash 节点。 + +### 安装和配置 Logstash + +在两个 Logstash 节点上执行以下步骤。 + +登录到两个节点使用 `hostnamectl` 命令设置主机名: + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "logstash1.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "logstash2.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +在两个 logstash 节点的 `/etc/hosts` 文件中添加以下条目: + +``` +~]# vi /etc/hosts +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +保存文件并退出。 + +在两个节点上配置 Logstash 存储库,在文件夹 `/ete/yum.repo.d/` 下创建一个包含以下内容的文件 `logstash.repo`: + +``` +~]# vi /etc/yum.repos.d/logstash.repo + +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md +``` + +保存并退出文件,运行 `rpm` 命令导入签名密钥: + +``` +~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +使用 `yum`/`dnf` 命令在两个节点上安装 Java OpenJDK: + +``` +~]# dnf install java-openjdk -y +``` + +从两个节点运行 `yum`/`dnf` 命令来安装 logstash: + +``` +[root@linuxtechi ~]# dnf install logstash -y +[root@linuxtechi ~]# dnf install logstash -y +``` + +现在配置 logstash,在两个 logstash 节点上执行以下步骤,创建一个 logstash 配置文件,首先我们在 `/etc/logstash/conf.d/` 下复制 logstash 示例文件: + +``` +# cd /etc/logstash/ +# cp logstash-sample.conf conf.d/logstash.conf +``` + +编辑配置文件并更新以下内容: + +``` +# vi conf.d/logstash.conf + +input { + beats { + port => 5044 + } +} + +output { + elasticsearch { + hosts => ["http://elasticsearch1.linuxtechi.local:9200", "http://elasticsearch2.linuxtechi.local:9200", "http://elasticsearch3.linuxtechi.local:9200"] + index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}" + #user => "elastic" + #password => "changeme" + } +} +``` + +在 `output` 部分之下,在 `hosts` 参数中指定所有三个 Elasticsearch 节点的 FQDN,其他参数保持不变。 + +使用 `firewall-cmd` 命令在操作系统防火墙中允许 logstash 端口 “5044”: + +``` +~ # firewall-cmd --permanent --add-port=5044/tcp +~ # firewall-cmd –reload +``` + +现在,在每个节点上运行以下 `systemctl` 命令,启动并启用 Logstash 服务: + +``` +~]# systemctl start logstash +~]# systemctl eanble logstash +``` + +使用 `ss` 命令验证 logstash 服务是否开始监听 5044 端口: + +``` +[root@linuxtechi ~]# ss -tunlp | grep 5044 +tcp LISTEN 0 128 *:5044 *:* users:(("java",pid=2416,fd=96)) +[root@linuxtechi ~]# +``` + +以上输出表明 logstash 已成功安装和配置。让我们转到 Kibana 安装。 + +### 安装和配置 Kibana + +登录 Kibana 节点,使用 `hostnamectl` 命令设置主机名: + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "kibana.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +编辑 `/etc/hosts` 文件并添加以下行: + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +使用以下命令设置 Kibana 存储库: + +``` +[root@linuxtechi ~]# vi /etc/yum.repos.d/kibana.repo +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md + +[root@linuxtechi ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +执行 `yum`/`dnf` 命令安装 kibana: + +``` +[root@linuxtechi ~]# yum install kibana -y +``` + +通过编辑 `/etc/kibana/kibana.yml` 文件,配置 Kibana: + +``` +[root@linuxtechi ~]# vim /etc/kibana/kibana.yml +………… +server.host: "kibana.linuxtechi.local" +server.name: "kibana.linuxtechi.local" +elasticsearch.hosts: ["http://elasticsearch1.linuxtechi.local:9200", "http://elasticsearch2.linuxtechi.local:9200", "http://elasticsearch3.linuxtechi.local:9200"] +………… +``` + +启用并启动 kibana 服务: + +``` +[root@linuxtechi ~]# systemctl start kibana +[root@linuxtechi ~]# systemctl enable kibana +``` + +在系统防火墙上允许 Kibana 端口 “5601”: + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-port=5601/tcp +success +[root@linuxtechi ~]# firewall-cmd --reload +success +[root@linuxtechi ~]# +``` + +使用以下 URL 访问 Kibana 界面: + +![Kibana-Dashboard-rhel8][4] + +从面板上,我们可以检查 Elastic Stack 集群的状态。 + +![Stack-Monitoring-Overview-RHEL8][5] + +这证明我们已经在 RHEL 8 /CentOS 8 上成功地安装并设置了多节点 Elastic Stack 集群。 + +现在让我们通过 `filebeat` 从其他 Linux 服务器发送一些日志到 logstash 节点中,在我的例子中,我有一个 CentOS 7服务器,我将通过 `filebeat` 将该服务器的所有重要日志推送到 logstash。 + +登录到 CentOS 7 服务器使用 yum/rpm 命令安装 filebeat 包: + +``` +[root@linuxtechi ~]# rpm -ivh https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.1-x86_64.rpm +Retrieving https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.1-x86_64.rpm +Preparing... ################################# [100%] +Updating / installing... + 1:filebeat-7.3.1-1 ################################# [100%] +[root@linuxtechi ~]# +``` + +编辑 `/etc/hosts` 文件并添加以下内容: + +``` +192.168.56.20 logstash1.linuxtechi.local +192.168.56.30 logstash2.linuxtechi.local +``` + +现在配置 `filebeat`,以便它可以使用负载平衡技术向 logstash 节点发送日志,编辑文件 `/etc/filebeat/filebeat.yml`,并添加以下参数: + +在 `filebeat.inputs:` 部分将 `enabled: false` 更改为 `enabled: true`,并在 `paths` 参数下指定我们可以发送到 logstash 的日志文件的位置;注释掉 `output.elasticsearch` 和 `host` 参数;删除 `output.logstash:` 和 `hosts:` 的注释,并在 `hosts` 参数添加两个 logstash 节点,以及设置 `loadbalance: true`。 + +``` +[root@linuxtechi ~]# vi /etc/filebeat/filebeat.yml + +filebeat.inputs: +- type: log + enabled: true + paths: + - /var/log/messages + - /var/log/dmesg + - /var/log/maillog + - /var/log/boot.log +#output.elasticsearch: + # hosts: ["localhost:9200"] + +output.logstash: + hosts: ["logstash1.linuxtechi.local:5044", "logstash2.linuxtechi.local:5044"] + loadbalance: true +``` + +使用下面的 2 个 `systemctl` 命令 启动并启用 `filebeat` 服务: + +``` +[root@linuxtechi ~]# systemctl start filebeat +[root@linuxtechi ~]# systemctl enable filebeat +``` + +现在转到 Kibana 用户界面,验证新索引是否可见。 + +从左侧栏中选择管理选项,然后单击 Elasticsearch 下的索引管理: + +![Elasticsearch-index-management-Kibana][6] + +正如我们上面看到的,索引现在是可见的,让我们现在创建索引模型。 + +点击 Kibana 部分的 “Index Patterns”,它将提示我们创建一个新模型,点击 “Create Index Pattern” ,并将模式名称指定为 “filebeat”: + +![Define-Index-Pattern-Kibana-RHEL8][7] + +点击下一步。 + +选择 “Timestamp” 作为索引模型的时间过滤器,然后单击 “Create index pattern”: + +![Time-Filter-Index-Pattern-Kibana-RHEL8][8] + +![filebeat-index-pattern-overview-Kibana][9] + +现在单击查看实时 filebeat 索引模型: + +![Discover-Kibana-REHL8][10] + +这表明 Filebeat 代理已配置成功,我们能够在 Kibana 仪表盘上看到实时日志。 + +以上就是本文的全部内容,对这些帮助你在 RHEL 8 / CentOS 8 系统上设置 Elastic Stack 集群的步骤,请不要犹豫分享你的反馈和意见。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Elastic-Stack-Cluster-RHEL8-CentOS8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Elasticsearch-cluster-status-rhel8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Kibana-Dashboard-rhel8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Stack-Monitoring-Overview-RHEL8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Elasticsearch-index-management-Kibana.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Define-Index-Pattern-Kibana-RHEL8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Time-Filter-Index-Pattern-Kibana-RHEL8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/filebeat-index-pattern-overview-Kibana.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Discover-Kibana-REHL8.jpg diff --git a/published/201909/20190909 How to use Terminator on Linux to run multiple terminals in one window.md b/published/201909/20190909 How to use Terminator on Linux to run multiple terminals in one window.md new file mode 100644 index 0000000000..8121fe2b25 --- /dev/null +++ b/published/201909/20190909 How to use Terminator on Linux to run multiple terminals in one window.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11409-1.html) +[#]: subject: (How to use Terminator on Linux to run multiple terminals in one window) +[#]: via: (https://www.networkworld.com/article/3436784/how-to-use-terminator-on-linux-to-run-multiple-terminals-in-one-window.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Terminator 在一个窗口中运行多个终端 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/30/233732j9jjx3xxuujopiuu.jpg) + +> Terminator 为在单窗口中运行多个 GNOME 终端提供了一个选择,让你可以灵活地调整工作空间来适应你的需求。 + +![](https://images.idgesg.net/images/article/2019/09/terminator-code-100810364-large.jpg) + +如果你曾经希望可以排列多个终端并将它们组织在一个窗口中,那么我们可能会给你带来一个好消息。 Linux 的 Terminator 可以为你做到这一点。没有问题! + +### 分割窗口 + +Terminator 最初打开像是一个单一窗口的终端窗口一样。但是,一旦在该窗口中单击鼠标,它将弹出一个选项,让你可以灵活地进行更改。你可以选择“水平分割”或“垂直分割”,将你当前所在的窗口分为两个较小的窗口。实际上,菜单旁会有小的分割结果图示(类似于 `=` and `||`),你可以根据需要重复拆分窗口。当然,你如果将整个窗口分为六个或九个以上,那么你可能会发现它们太小而无法有效使用。 + +使用 ASCII 艺术来说明分割窗口的过程,你可能会看到类似以下的样子: + +``` ++-------------------+ +-------------------+ +-------------------+ +| | | | | | +| | | | | | +| | ==> |-------------------| ==> |-------------------| +| | | | | | | +| | | | | | | ++-------------------+ +-------------------+ +-------------------+ + 原始终端 水平分割 垂直分割 +``` + +另一种拆分窗口的方法是使用控制键组合,例如,使用 `Ctrl+Shift+e` 垂直分割窗口,使用 `Ctrl+Shift+o`(“o” 表示“打开”)水平分割窗口。 + +在 Terminator 分割完成后,你可以点击任意窗口使用,并根据工作需求在窗口间移动。 + +### 最大化窗口 + +如果你想暂时忽略除了一个窗口外的其他窗口而只关注一个,你可以单击该窗口,然后从菜单中选择“最大化”选项。接着该窗口会撑满所有空间。再次单击并选择“还原所有终端”可以返回到多窗口显示。使用 `Ctrl+Shift+x` 将在正常和最大化设置之间切换。 + +窗口标签上的窗口大小指示(例如 80x15)显示了每行的字符数以及每个窗口的行数。 + +### 关闭窗口 + +要关闭任何窗口,请打开 Terminator 菜单,然后选择“关闭”。其他窗口将自行调整占用空间,直到你关闭最后一个窗口。 + +### 保存你的自定义设置 + +将窗口分为多个部分后,将自定义的 Terminator 设置设置为默认非常容易。从弹出菜单中选择“首选项”,然后从打开的窗口顶部的选项卡中选择“布局”。接着你应该看到列出了“新布局”。只需单击底部的“保存”,然后单击右下角的“关闭”。Terminator 会将你的设置保存在 `~/.config/terminator/config` 中,然后每次使用到时都会使用该文件。 + +你也可以通过使用鼠标拉伸来扩大整个窗口。再说一次,如果要保留更改,请从菜单中选择“首选项”,“布局”,接着选择“保存”和“关闭”。 + +### 在保存的配置之间进行选择 + +如果愿意,你可以通过维护多个配置文件来设置多种 Terminator 窗口布局,重命名每个配置文件(如 `config-1`、`config-2`),接着在你想使用它时将它移动到 `~/.config/terminator/config`。这有一个类似执行此任务的脚本。它让你在 3 个预配置的窗口布局之间进行选择。 + +``` +#!/bin/bash + +PS3='Terminator options: ' +options=("Split 1" "Split 2" "Split 3" "Quit") +select opt in "${options[@]}" +do + case $opt in + "Split 1") + config=config-1 + break + ;; + "Split 2") + config=config-2 + break + ;; + "Split 3") + config=config-3 + break + ;; + *) + exit + ;; + esac +done + +cd ~/.config/terminator +cp config config- +cp $config config +cd +terminator & +``` + +如果有用的话,你可以给选项一个比 `config-1` 更有意义的名称。 + +### 总结 + +Terminator 是设置多窗口处理相关任务的不错选择。如果你从未使用过它,那么可能需要先使用 `sudo apt install terminator` 或 `sudo yum install -y terminator` 之类的命令进行安装。 + +希望你喜欢使用 Terminator。还有,如另一个同名角色所说,“我会回来的!” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3436784/how-to-use-terminator-on-linux-to-run-multiple-terminals-in-one-window.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190911 How to set up a TFTP server on Fedora.md b/published/201909/20190911 How to set up a TFTP server on Fedora.md new file mode 100644 index 0000000000..bdd7ab6f0d --- /dev/null +++ b/published/201909/20190911 How to set up a TFTP server on Fedora.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11371-1.html) +[#]: subject: (How to set up a TFTP server on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-set-up-a-tftp-server-on-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +如何在 Fedora 上建立一个 TFTP 服务器 +====== + +![][1] + +TFTP 即简单文本传输协议Trivial File Transfer Protocol,允许用户通过 [UDP][2] 协议在系统之间传输文件。默认情况下,协议使用的是 UDP 的 69 号端口。TFTP 协议广泛用于无盘设备的远程启动。因此,在你的本地网络建立一个 TFTP 服务器,这样你就可以对 [安装好的 Fedora][3] 和其他无盘设备做一些操作,这将非常有趣。 + +TFTP 仅仅能够从远端系统读取数据或者向远端系统写入数据,而没有列出远端服务器上文件的能力。它也没提供用户身份验证。由于安全隐患和缺乏高级功能,TFTP 通常仅用于局域网内部(LAN)。 + +### 安装 TFTP 服务器 + +首先你要做的事就是安装 TFTP 客户端和 TFTP 服务器: + +``` +dnf install tftp-server tftp -y +``` + +上述的这条命令会在 `/usr/lib/systemd/system` 目录下为 [systemd][4] 创建 `tftp.service` 和 `tftp.socket` 文件。 + +``` +/usr/lib/systemd/system/tftp.service +/usr/lib/systemd/system/tftp.socket +``` + +接下来,将这两个文件复制到 `/etc/systemd/system` 目录下,并重新命名。 + +``` +cp /usr/lib/systemd/system/tftp.service /etc/systemd/system/tftp-server.service +cp /usr/lib/systemd/system/tftp.socket /etc/systemd/system/tftp-server.socket +``` + +### 修改文件 + +当你把这些文件复制和重命名后,你就可以去添加一些额外的参数,下面是 `tftp-server.service` 刚开始的样子: + +``` +[Unit] +Description=Tftp Server +Requires=tftp.socket +Documentation=man:in.tftpd + +[Service] +ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot +StandardInput=socket + +[Install] +Also=tftp.socket +``` + +在 `[Unit]` 部分添加如下内容: + +``` +Requires=tftp-server.socket +``` + +修改 `[ExecStart]` 行: + +``` +ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot +``` + +下面是这些选项的意思: + + * `-c` 选项允许创建新的文件 + * `-p` 选项用于指明在正常系统提供的权限检查之上没有其他额外的权限检查 + * `-s` 建议使用该选项以确保安全性以及与某些引导 ROM 的兼容性,这些引导 ROM 在其请求中不容易包含目录名。 + +默认的上传和下载位置位于 `/var/lib/tftpboot`。 + +下一步,修改 `[Install]` 部分的内容 + +``` +[Install] +WantedBy=multi-user.target +Also=tftp-server.socket +``` + +不要忘记保存你的修改。 + +下面是 `/etc/systemd/system/tftp-server.service` 文件的完整内容: + +``` +[Unit] +Description=Tftp Server +Requires=tftp-server.socket +Documentation=man:in.tftpd + +[Service] +ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot +StandardInput=socket + +[Install] +WantedBy=multi-user.target +Also=tftp-server.socket +``` + +### 启动 TFTP 服务器 + +重新启动 systemd 守护进程: + +``` +systemctl daemon-reload +``` + +启动服务器: + +``` +systemctl enable --now tftp-server +``` + +要更改 TFTP 服务器允许上传和下载的权限,请使用此命令。注意 TFTP 是一种固有的不安全协议,因此不建议你在与其他人共享的网络上这样做。 + +``` +chmod 777 /var/lib/tftpboot +``` + +配置防火墙让 TFTP 能够使用: + +``` +firewall-cmd --add-service=tftp --perm +firewall-cmd --reload +``` + +### 客户端配置 + +安装 TFTP 客户端 + +``` +yum install tftp -y +``` + +运行 `tftp` 命令连接服务器。下面是一个启用详细信息选项的例子: + +``` +[client@thinclient:~ ]$ tftp 192.168.1.164 +tftp> verbose +Verbose mode on. +tftp> get server.logs +getting from 192.168.1.164:server.logs to server.logs [netascii] +Received 7 bytes in 0.0 seconds [inf bits/sec] +tftp> quit +[client@thinclient:~ ]$ +``` + +记住,因为 TFTP 没有列出服务器上文件的能力,因此,在你使用 `get` 命令之前需要知道文件的具体名称。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-set-up-a-tftp-server-on-fedora/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[wxy](https://github.com/wxy) + +本文由 [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/2019/09/tftp-server-816x345.jpg +[2]: https://en.wikipedia.org/wiki/User_Datagram_Protocol +[3]: https://docs.fedoraproject.org/en-US/fedora/f30/install-guide/advanced/Network_based_Installations/ +[4]: https://fedoramagazine.org/systemd-getting-a-grip-on-units/ +[5]: https://unsplash.com/@laikanotebooks?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[6]: https://unsplash.com/search/photos/file-folders?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/201909/20190912 An introduction to Markdown.md b/published/201909/20190912 An introduction to Markdown.md new file mode 100644 index 0000000000..56bf81de5d --- /dev/null +++ b/published/201909/20190912 An introduction to Markdown.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11402-1.html) +[#]: subject: (An introduction to Markdown) +[#]: via: (https://opensource.com/article/19/9/introduction-markdown) +[#]: author: (Juan Islas https://opensource.com/users/xislas) + +一份 Markdown 简介 +====== + +> 一次编辑便可将文本转换为多种格式。下面是如何开始使用 Markdown。 + +![](https://img.linux.net.cn/data/attachment/album/201909/29/123226bjte253n2h44cjjj.jpg) + +在很长一段时间里,我发现我在 GitLab 和 GitHub 上看到的所有文件都带有 **.md** 扩展名,这是专门为开发人员编写的文件类型。几周前,当我开始使用 Markdown 时,我的观念发生了变化。它很快成为我日常工作中最重要的工具。 + +Markdown 使我的生活更简易。我只需要在已经编写的代码中添加一些符号,并且在浏览器扩展或开源程序的帮助下,即可将文本转换为各种常用格式,如 ODT、电子邮件(稍后将详细介绍)、PDF 和 EPUB。 + +### 什么是 Markdown? + +来自 [维基百科][2]的友情提示: + +> Markdown 是一种轻量级标记语言,具有纯文本格式语法。 + +这意味着通过在文本中使用一些额外的符号,Markdown 可以帮助你创建具有特定结构和格式的文档。当你以纯文本(例如,在记事本应用程序中)做笔记时,没有任何东西表明哪个文本应该是粗体或斜体。在普通文本中,你在写链接时需要将一个链接写为 “http://example.com”,或者写为 “example.com”,又或“访问网站(example.com)”。这样没有内在的一致性。 + +但是如果你按照 Markdown 的方式编写,你的文本就有了内在的一致性。计算机喜欢一致性,因为这使得它们能够遵循严格的指令而不用担心异常。 + +相信我;一旦你学会使用 Markdown,每一项写作任务在某种程度上都会比以前更容易、更好。让我们开始吧。 + +### Markdown 基础 + +以下是使用 Markdown 的基础语法。 + +1、创建一个以 **.md** 扩展名结尾的文本文件(例如,`example.md`)。你可以使用任何文本编辑器(甚至像 LibreOffice 或 Microsoft word 这样的文字处理程序亦可),只要记住将其保存为*文本*文件。 + +![Names of Markdown files][3] + +2、想写什么就写什么,就像往常一样: + +``` +Lorem ipsum + +Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +De Finibus Bonorum et Malorum + +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. +Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. + + Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. +``` + +(LCTT 译注:上述这段“Lorem ipsum”,中文又称“乱数假文”,是一篇常用于排版设计领域的拉丁文文章,主要目的为测试文章或文字在不同字型、版型下看起来的效果。) + +3、确保在段落之间留有空行。如果你习惯写商务信函或传统散文,这可能会觉得不自然,因为那里段落只有一行,甚至在第一个单词前还有一个缩进。对于 Markdown,空行(一些文字处理程序使用 `¶`,称为Pilcrow 符号)保证在创建一个新段落应用另一种格式(如 HTML)。 + +4、指定标题和副标题。对于文档的标题,在文本前面添加一个井号或散列符号(`#`)和一个空格(例如 `# Lorem ipsum`)。第一个副标题级别使用两个(`## De Finibus Bonorum et Malorum`),下一个级别使用三个(`### 第三个副标题`),以此类推。注意,在井号和第一个单词之间有一个空格。 + +``` +# Lorem ipsum + +Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +## De Finibus Bonorum et Malorum + +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. +Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. + +  Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. +``` + +5、如果你想使用**粗体**字符,只需将字母放在两个星号之间,没有空格:`**对应的文本将以粗体显示**`。 + +![Bold text in Markdown][4] + +6、对于**斜体**,将文本放在没有空格的下划线符号之间:`_我希望这个本文以斜体显示_`。(LCTT 译注:有的 Markdown 流派会将用下划线引起来的字符串视作下划线文本,而单个星号 `*` 引用起来的才视作斜体。从兼容性的角度看,使用星号比较兼容。) + +![Italics text in Markdown][5] + +7、要插入一个链接(像 [Markdown Tutorial][6]),把你想链接的文本放在括号里,URL 放在括号里,中间没有空格:`[Markdown Tutorial]()`。 + +![Hyperlinks in Markdown][7] + +8、块引用是用大于号编写的(`>`)在你要引用的文本前加上大于符号和空格: `> 名言引用`。 + +![Blockquote text in Markdown][8] + +### Markdown 教程和技巧 + +这些技巧可以帮助你上手 Markdown ,但它涵盖了很多功能,不仅仅是粗体、斜体和链接。学习 Markdown 的最好方法是使用它,但是我建议你花 15 分钟来学习这篇简单的 [Markdown 教程][6],学以致用,勤加练习。 + +由于现代 Markdown 是对结构化文本概念的许多不同解释的融合,[CommonMark][9] 项目定义了一个规范,其中包含一组严格的规则,以使 Markdown 更加清晰。在编辑时手边准备一份[符合 CommonMark 的快捷键列表][10]可能会有帮助。 + +### 你能用 Markdown 做什么 + +Markdown 可以让你写任何你想写的东西,仅需一次编辑,就可以把它转换成几乎任何你想使用的格式。下面的示例演示如何将用 MD 编写简单的文本并转换为不同的格式。你不需要多种格式的文档-你可以仅仅编辑一次…然后拥有无限可能。 + +1、**简单的笔记**:你可以用 Markdown 编写你的笔记,并且在保存笔记时,开源笔记应用程序 [Turtl][11] 将解释你的文本文件并显示为对应的格式。你可以把笔记存储在任何地方! + +![Turtl application][12] + +2、**PDF 文件**:使用 [Pandoc][13] 应用程序,你可以使用一个简单的命令将 Markdown 文件转换为 PDF: + +``` +pandoc -o +``` + +![Markdown text converted to PDF with Pandoc][14] + +3、**Email**:你还可以通过安装浏览器扩展 [Markdown Here][15] 将 Markdown 文本转换为 html 格式的电子邮件。要使用它,只需选择你的 Markdown 文本,在这里使用 Markdown 将其转换为 HTML,并使用你喜欢的电子邮件客户端发送消息。 + +![Markdown text converted to email with Markdown Here][16] + +### 现在就开始上手吧 + +你不需要一个特殊的应用程序来使用 Markdown,你只需要一个文本编辑器和上面的技巧。它与你已有的写作方式兼容;你所需要做的就是使用它,所以试试吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-markdown + +作者:[Juan Islas][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/xislas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://en.wikipedia.org/wiki/Markdown +[3]: https://opensource.com/sites/default/files/uploads/markdown_names_md-1.png (Names of Markdown files) +[4]: https://opensource.com/sites/default/files/uploads/markdown_bold.png (Bold text in Markdown) +[5]: https://opensource.com/sites/default/files/uploads/markdown_italic.png (Italics text in Markdown) +[6]: https://www.markdowntutorial.com/ +[7]: https://opensource.com/sites/default/files/uploads/markdown_link.png (Hyperlinks in Markdown) +[8]: https://opensource.com/sites/default/files/uploads/markdown_blockquote.png (Blockquote text in Markdown) +[9]: https://commonmark.org/help/ +[10]: https://opensource.com/downloads/cheat-sheet-markdown +[11]: https://turtlapp.com/ +[12]: https://opensource.com/sites/default/files/uploads/markdown_turtl_02.png (Turtl application) +[13]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[14]: https://opensource.com/sites/default/files/uploads/markdown_pdf.png (Markdown text converted to PDF with Pandoc) +[15]: https://markdown-here.com/ +[16]: https://opensource.com/sites/default/files/uploads/markdown_mail_02.png (Markdown text converted to email with Markdown Here) diff --git a/published/201909/20190912 Bash Script to Send a Mail About New User Account Creation.md b/published/201909/20190912 Bash Script to Send a Mail About New User Account Creation.md new file mode 100644 index 0000000000..849d7c5597 --- /dev/null +++ b/published/201909/20190912 Bash Script to Send a Mail About New User Account Creation.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11362-1.html) +[#]: subject: (Bash Script to Send a Mail About New User Account Creation) +[#]: via: (https://www.2daygeek.com/linux-shell-script-to-monitor-user-creation-send-email/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +用 Bash 脚本发送新用户帐户创建的邮件 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/20/093308a615tcuiopctvp5t.jpg) + +出于某些原因,你可能需要跟踪 Linux 上的新用户创建信息。同时,你可能需要通过邮件发送详细信息。这或许是审计目标的一部分,或者安全团队出于跟踪目的可能希望对此进行监控。 + +我们可以通过其他方式进行此操作,正如我们在上一篇文章中已经描述的那样。 + +* [在系统中创建新用户帐户时发送邮件的 Bash 脚本][1] + +Linux 有许多开源监控工具可以使用。但我不认为他们有办法跟踪新用户创建过程,并在发生时提醒管理员。 + +那么我们怎样才能做到这一点? + +我们可以编写自己的 Bash 脚本来实现这一目标。我们过去写过许多有用的 shell 脚本。如果你想了解,请进入下面的链接。 + +* [如何使用 shell 脚本自动化日常活动?][2] + +### 这个脚本做了什么? + +这将每天两次(一天的开始和结束)备份 `/etc/passwd` 文件,这将使你能够获取指定日期的新用户创建详细信息。 + +我们需要添加以下两个 cron 任务来复制 `/etc/passwd` 文件。 + +``` +# crontab -e + +1 0 * * * cp /etc/passwd /opt/scripts/passwd-start-$(date +"%Y-%m-%d") +59 23 * * * cp /etc/passwd /opt/scripts/passwd-end-$(date +"%Y-%m-%d") +``` + +它使用 `diff` 命令来检测文件之间的差异,如果发现与昨日有任何差异,脚本将向指定 email 发送新用户详细信息。 + +我们不用经常运行此脚本,因为用户创建不经常发生。但是,我们计划每天运行一次此脚本。 + +这样,你可以获得有关新用户创建的综合报告。 + +**注意:**我们在脚本中使用了我们的电子邮件地址进行演示。因此,我们要求你用自己的电子邮件地址。 + +``` +# vi /opt/scripts/new-user-detail.sh + +#!/bin/bash +mv /opt/scripts/passwd-start-$(date --date='yesterday' '+%Y-%m-%d') /opt/scripts/passwd-start +mv /opt/scripts/passwd-end-$(date --date='yesterday' '+%Y-%m-%d') /opt/scripts/passwd-end +ucount=$(diff /opt/scripts/passwd-start /opt/scripts/passwd-end | grep ">" | cut -d":" -f6 | cut -d"/" -f3 | wc -l) +if [ $ucount -gt 0 ] +then + SUBJECT="ATTENTION: New User Account is created on server : `date --date='yesterday' '+%b %e'`" + MESSAGE="/tmp/new-user-logs.txt" + TO="2daygeek@gmail.com" + echo "Hostname: `hostname`" >> $MESSAGE + echo -e "\n" >> $MESSAGE + echo "The New User Details are below." >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + diff /opt/scripts/passwd-start /opt/scripts/passwd-end | grep ">" | cut -d":" -f6 | cut -d"/" -f3 >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + mail -s "$SUBJECT" "$TO" < $MESSAGE + rm $MESSAGE +fi +``` + +给 `new-user-detail.sh` 文件添加可执行权限。 + +``` +$ chmod +x /opt/scripts/new-user-detail.sh +``` + +最后添加一个 cron 任务来自动执行此操作。它在每天早上 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/scripts/new-user.sh +``` + +**注意:**你会在每天早上 7 点都会收到一封关于昨日详情的邮件提醒。 + +**输出:**输出与下面的输出相同。 + +``` +# cat /tmp/new-user-logs.txt + +Hostname: CentOS.2daygeek.com + +The New User Details are below. ++------------------------------+ +tuser3 ++------------------------------+ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-shell-script-to-monitor-user-creation-send-email/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-bash-script-to-monitor-user-creation-send-email/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/201909/20190913 An introduction to Virtual Machine Manager.md b/published/201909/20190913 An introduction to Virtual Machine Manager.md new file mode 100644 index 0000000000..aa452f418a --- /dev/null +++ b/published/201909/20190913 An introduction to Virtual Machine Manager.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11364-1.html) +[#]: subject: (An introduction to Virtual Machine Manager) +[#]: via: (https://opensource.com/article/19/9/introduction-virtual-machine-manager) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +虚拟机管理器(Virtual Machine Manager)简介 +====== + +> virt-manager 为 Linux 虚拟化提供了全方位的选择。 + +![](https://img.linux.net.cn/data/attachment/album/201909/20/113434dxbbp3ttmxbhmnnm.jpg) + +在我关于 [GNOME Boxes][3] 的[系列文章][2]中,我已经解释了 Linux 用户如何能够在他们的桌面上快速启动虚拟机。当你只需要简单的配置时,Box 可以轻而易举地创建虚拟机。 + +但是,如果你需要在虚拟机中配置更多详细信息,那么你就需要一个工具,为磁盘、网卡(NIC)和其他硬件提供全面的选项。这时就需要 [虚拟机管理器(Virtual Machine Manager)][4](virt-manager)了。如果在应用菜单中没有看到它,你可以从包管理器或命令行安装它: + +* 在 Fedora 上:`sudo dnf install virt-manager` +* 在 Ubuntu 上:`sudo apt install virt-manager` + +安装完成后,你可以从应用菜单或在命令行中输入 `virt-manager` 启动。 + +![Virtual Machine Manager's main screen][5] + +为了演示如何使用 virt-manager 创建虚拟机,我将设置一个 Red Hat Enterprise Linux 8 虚拟机。 + +首先,单击 “文件File” 然后点击 “新建虚拟机New Virtual Machine”。Virt-manager 的开发者已经标记好了每一步(例如,“第 1 步,共 5 步Step 1 of 5”)来使其变得简单。单击 “本地安装介质Local install media” 和 “下一步Forward”。 + +![Step 1 virtual machine creation][6] + +在下个页面中,选择要安装的操作系统的 ISO 文件。(RHEL 8 镜像位于我的下载目录中。)Virt-manager 自动检测操作系统。 + +![Step 2 Choose the ISO File][7] + +在步骤 3 中,你可以指定虚拟机的内存和 CPU。默认值为内存 1,024MB 和一个 CPU。 + +![Step 3 Set CPU and Memory][8] + +我想给 RHEL 充足的配置来运行,我使用的硬件配置也充足,所以我将它们(分别)增加到 4,096MB 和两个 CPU。 + +下一步为虚拟机配置存储。默认设置是 10GB 硬盘。(我保留此设置,但你可以根据需要进行调整。)你还可以选择现有磁盘镜像或在自定义位置创建一个磁盘镜像。 + +![Step 4 Configure VM Storage][9] + +步骤 5 是命名虚拟机并单击“完成Finish”。这相当于创建了一台虚拟机,也就是 GNOME Boxes 中的一个 Box。虽然技术上讲是最后一步,但你有几个选择(如下面的截图所示)。由于 virt-manager 的优点是能够自定义虚拟机,因此在单击“完成Finish”之前,我将选中“在安装前定制配置Customize configuration before install”的复选框。 + +因为我选择了自定义配置,virt-manager 打开了一个有一组设备和设置的页面。这里是重点! + +这里你也可以命名该虚拟机。在左侧列表中,你可以查看各个方面的详细信息,例如 CPU、内存、磁盘、控制器和许多其他项目。例如,我可以单击 “CPU” 来验证我在步骤 3 中所做的更改。 + +![Changing the CPU count][10] + +我也可以确认我设置的内存量。 + +当虚拟机作为服务器运行时,我通常会禁用或删除声卡。为此,请选择 “声卡Sound” 并单击 “移除Remove” 或右键单击 “声卡Sound” 并选择 “移除硬件Remove Hardware”。 + +你还可以使用底部的 “添加硬件Add Hardware” 按钮添加硬件。这会打开 “添加新的虚拟硬件Add New Virtual Hardware” 页面,你可以在其中添加其他存储设备、内存、声卡等。这就像可以访问一个库存充足的(虚拟)计算机硬件仓库。 + +![The Add New Hardware screen][11] + +对 VM 配置感到满意后,单击 “开始安装Begin Installation”,系统将启动并开始从 ISO 安装指定的操作系统。 + +![Begin installing the OS][12] + +完成后,它会重新启动,你的新虚拟机就可以使用了。 + +![Red Hat Enterprise Linux 8 running in VMM][13] + +Virtual Machine Manager 是桌面 Linux 用户的强大工具。它是开源的,是专有和封闭虚拟化产品的绝佳替代品。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-virtual-machine-manager + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=GNOME%20Box +[3]: https://wiki.gnome.org/Apps/Boxes +[4]: https://virt-manager.org/ +[5]: https://opensource.com/sites/default/files/1-vmm_main_0.png (Virtual Machine Manager's main screen) +[6]: https://opensource.com/sites/default/files/2-vmm_step1_0.png (Step 1 virtual machine creation) +[7]: https://opensource.com/sites/default/files/3-vmm_step2.png (Step 2 Choose the ISO File) +[8]: https://opensource.com/sites/default/files/4-vmm_step3default.png (Step 3 Set CPU and Memory) +[9]: https://opensource.com/sites/default/files/6-vmm_step4.png (Step 4 Configure VM Storage) +[10]: https://opensource.com/sites/default/files/9-vmm_customizecpu.png (Changing the CPU count) +[11]: https://opensource.com/sites/default/files/11-vmm_addnewhardware.png (The Add New Hardware screen) +[12]: https://opensource.com/sites/default/files/12-vmm_rhelbegininstall.png +[13]: https://opensource.com/sites/default/files/13-vmm_rhelinstalled_0.png (Red Hat Enterprise Linux 8 running in VMM) diff --git a/published/201909/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md b/published/201909/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md new file mode 100644 index 0000000000..d49a5146b9 --- /dev/null +++ b/published/201909/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md @@ -0,0 +1,346 @@ +[#]: collector: (lujun9972) +[#]: translator: (asche910) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11367-1.html) +[#]: subject: (How to Find and Replace a String in File Using the sed Command in Linux) +[#]: via: (https://www.2daygeek.com/linux-sed-to-find-and-replace-string-in-files/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +使用 sed 命令查找和替换文件中的字符串的 16 个示例 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/20/210723xf884pafyzf9zf4a.jpg) + +当你在使用文本文件时,很可能需要查找和替换文件中的字符串。`sed` 命令主要用于替换一个文件中的文本。在 Linux 中这可以通过使用 `sed` 命令和 `awk` 命令来完成。 + +在本教程中,我们将告诉你使用 `sed` 命令如何做到这一点,然后讨论讨论 `awk` 命令相关的。 + +### sed 命令是什么 + +`sed` 命令表示 Stream Editor(流编辑器),用来在 Linux 上执行基本的文本操作。它可以执行各种功能,如搜索、查找、修改、插入或删除文件。 + +此外,它也可以执行复杂的正则表达式匹配。 + +它可用于以下目的: + +* 查找和替换匹配给定的格式的内容。 +* 在指定行查找和替换匹配给定的格式的内容。 +* 在所有行查找和替换匹配给定的格式的内容。 +* 搜索并同时替换两种不同的模式。 + +本文列出的十五个例子可以帮助你掌握 `sed` 命令。 + +如果要使用 `sed` 命令删除文件中的行,去下面的文章。 + +注意:由于这是一篇演示文章,我们使用不带 `-i` 选项的 `sed` 命令,该选项会在 Linux 终端中删除行并打印文件内容。 + +但是,在实际环境中如果你想删除源文件中的行,使用带 `-i` 选项的 `sed` 命令。 + +常见的 `sed` 替换字符串的语法。 + +``` +sed -i 's/Search_String/Replacement_String/g' Input_File +``` + +首先我们需要了解 `sed` 语法来做到这一点。请参阅有关的细节。 + +* `sed`:这是一个 Linux 命令。 +* `-i`:这是 `sed` 命令的一个选项,它有什么作用?默认情况下,`sed` 打印结果到标准输出。当你使用 `sed` 添加这个选项时,那么它会在适当的位置修改文件。当你添加一个后缀(比如,`-i.bak`)时,就会创建原始文件的备份。 +* `s`:字母 `s` 是一个替换命令。 +* `Search_String`:搜索一个给定的字符串或正则表达式。 +* `Replacement_String`:替换的字符串。 +* `g`:全局替换标志。默认情况下,`sed` 命令替换每一行第一次出现的模式,它不会替换行中的其他的匹配结果。但是,提供了该替换标志时,所有匹配都将被替换。 +* `/`:分界符。 +* `Input_File`:要执行操作的文件名。 + +让我们来看看文件中用sed命令来搜索和转换文本的一些常用例子。 + +我们已经创建了用于演示的以下文件。 + +``` +# cat sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 1) 如何查找和替换一行中“第一次”模式匹配 + +下面的 `sed` 命令用 `linux` 替换文件中的 `unix`。这仅仅改变了每一行模式的第一个实例。 + +``` +# sed 's/unix/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 2) 如何查找和替换每一行中“第 N 次”出现的模式 + +在行中使用`/1`、`/2`……`/n` 等标志来代替相应的匹配。 + +下面的 `sed` 命令在一行中用 `linux` 来替换 `unix` 模式的第二个实例。 + +``` +# sed 's/unix/linux/2' sed-test.txt + +1 Unix unix linux 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 3) 如何搜索和替换一行中所有的模式实例 + +下面的 `sed` 命令用 `linux` 替换 `unix` 格式的所有实例,因为 `g` 是一个全局替换标志。 + +``` +# sed 's/unix/linux/g' sed-test.txt + +1 Unix linux linux 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 4) 如何查找和替换一行中从“第 N 个”开始的所有匹配的模式实例 + +下面的 `sed` 命令在一行中替换从模式的“第 N 个”开始的匹配实例。 + +``` +# sed 's/unix/linux/2g' sed-test.txt + +1 Unix unix linux 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 5) 在特定的行号搜索和替换模式 + +你可以替换特定行号中的字符串。下面的 `sed` 命令用 `linux` 仅替换第三行的 `unix` 模式。 + +``` +# sed '3 s/unix/linux/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 6) 在特定范围行号间搜索和替换模式 + +你可以指定行号的范围,以替换字符串。 + +下面的 `sed` 命令在 1 到 3 行间用 `linux` 替换 `Unix` 模式。 + +``` +# sed '1,3 s/unix/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 7) 如何查找和修改最后一行的模式 + +下面的 sed 命令允许你只在最后一行替换匹配的字符串。 + +下面的 `sed` 命令只在最后一行用 `Unix` 替换 `Linux` 模式。 + +``` +# sed '$ s/Linux/Unix/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Unix is free and opensource operating system +``` + +### 8) 在一行中如何只查找和替换正确的模式匹配 + +你可能已经注意到,子串 `linuxunix` 被替换为在第 6 个示例中的 `linuxlinux`。如果你只想更改正确的匹配词,在搜索串的两端用这个边界符 `\b`。 + +``` +# sed '1,3 s/\bunix\b/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 9) 如何以不区分大小写来搜索与替换模式 + +大家都知道,Linux 是区分大小写的。为了与不区分大小写的模式匹配,使用 `I` 标志。 + +``` +# sed 's/unix/linux/gI' sed-test.txt + +1 linux linux linux 23 +2 linux Linux 34 +3 linuxlinux linuxLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 10) 如何查找和替换包含分隔符的字符串 + +当你搜索和替换含分隔符的字符串时,我们需要用反斜杠 `\` 来取消转义。 + +在这个例子中,我们将用 `/usr/bin/fish` 来替换 `/bin/bash`。 + +``` +# sed 's/\/bin\/bash/\/usr\/bin\/fish/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /usr/bin/fish CentOS Linux OS +Linux is free and opensource operating system +``` + +上述 `sed` 命令按预期工作,但它看起来来很糟糕。 为了简化,大部分的人会用竖线 `|` 作为正则表达式的定位符。 所以,我建议你用它。 + +``` +# sed 's|/bin/bash|/usr/bin/fish/|g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /usr/bin/fish/ CentOS Linux OS +Linux is free and opensource operating system +``` + +### 11) 如何以给定的模式来查找和替换数字 + +类似地,数字可以用模式来代替。下面的 `sed` 命令以 `[0-9]` 替换所有数字为 `number`。 + +``` +# sed 's/[0-9]/number/g' sed-test.txt + +number Unix unix unix numbernumber +number linux Linux numbernumber +number linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 12) 如何用模式仅查找和替换两个数字 + +如果你想用模式来代替两位数字,使用下面的 `sed` 命令。 + +``` +# sed 's/\b[0-9]\{2\}\b/number/g' sed-test.txt + +1 Unix unix unix number +2 linux Linux number +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 13) 如何用 sed 命令仅打印被替换的行 + +如果你想显示仅更改的行,使用下面的 `sed` 命令。 + +* `p` - 它在终端上输出替换的行两次。 +* `-n` - 它抑制由 `p` 标志所产生的重复行。 + +``` +# sed -n 's/Unix/Linux/p' sed-test.txt + +1 Linux unix unix 23 +3 linuxunix LinuxLinux +``` + +### 14) 如何同时运行多个 sed 命令 + +以下 `sed` 命令同时检测和置换两个不同的模式。 + +下面的 `sed` 命令搜索 `linuxunix` 和 `CentOS` 模式,用 `LINUXUNIX` 和 `RHEL8` 一次性更换它们。 + +``` +# sed -e 's/linuxunix/LINUXUNIX/g' -e 's/CentOS/RHEL8/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 LINUXUNIX UnixLinux +linux /bin/bash RHEL8 Linux OS +Linux is free and opensource operating system +``` + +下面的 `sed` 命令搜索替换两个不同的模式,并一次性替换为一个字符串。 + +以下 `sed` 的命令搜索 `linuxunix` 和 `CentOS` 模式,用 `Fedora30` 替换它们。 + +``` +# sed -e 's/\(linuxunix\|CentOS\)/Fedora30/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 Fedora30 UnixLinux +linux /bin/bash Fedora30 Linux OS +Linux is free and opensource operating system +``` + +### 15) 如果给定的模式匹配,如何查找和替换整个行 + +如果模式匹配,可以使用 `sed` 命令用新行来代替整行。这可以通过使用 `c` 标志来完成。 + +``` +# sed '/OS/ c\ +New Line +' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +New Line +Linux is free and opensource operating system +``` + +### 16) 如何搜索和替换相匹配的模式行 + +在 `sed` 命令中你可以为行指定适合的模式。在匹配该模式的情况下,`sed` 命令搜索要被替换的字符串。 + +下面的 `sed` 命令首先查找具有 `OS` 模式的行,然后用 `ArchLinux` 替换单词 `Linux`。 + +``` +# sed '/OS/ s/Linux/ArchLinux/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS ArchLinux OS +Linux is free and opensource operating system +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-sed-to-find-and-replace-string-in-files/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[Asche910](https://github.com/asche910) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/201909/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md b/published/201909/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md new file mode 100644 index 0000000000..69911195d2 --- /dev/null +++ b/published/201909/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11345-1.html) +[#]: subject: (GNOME 3.34 Released With New Features & Performance Improvements) +[#]: via: (https://itsfoss.com/gnome-3-34-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.34 发布 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/15/113154i3bcp9p3md3mc3bk.jpg) + +最新版本的 GNOME 代号为“塞萨洛尼基Thessaloniki”。考虑到这个版本经过了 6 个月的开发,这应该是对 [GNOME 3.32][1] 的一次令人印象深刻的升级。 + +在此版本中,有许多新功能和显著的性能改进。除了新功能外,可定制的程度也得到了提升。 + +以下是新的变化: + +### GNOME 3.34 的关键改进 + +你可以观看此视频,了解 GNOME 3.34 中的新功能: + +- [视频](https://img.linux.net.cn/static/video/_-qAjPRr5SGoY.mp4) + +#### 拖放图标到文件夹 + +新的 shell 主题允许你拖放应用程序抽屉中的图标以重新排列它们,或将它们组合到一个文件夹中。你可能已经在 Android 或 iOS 智能手机中使用过此类功能。 + +![You can now drag and drop icons into a folder][2] + +#### 改进的日历管理器 + +改进的日历管理器可以轻松地与第三方服务集成,使你能够直接从 Linux 系统管理日程安排,而无需单独使用其他应用程序。 + +![GNOME Calendar Improvements][3] + +#### 背景选择的设置 + +现在,更容易为主屏幕和锁定屏幕选择自定义背景,因为它在同一屏幕中显示所有可用背景。为你节省至少一次鼠标点击。 + +![It’s easier to select backgrounds now][4] + +#### 重新排列搜索选项 + +搜索选项和结果可以手动重新排列。因此,当你要搜索某些内容时,可以决定哪些内容先出现。 + +#### 响应式设计的“设置”应用 + +设置菜单 UI 现在具有响应性,因此无论你使用何种类型(或尺寸)的设备,都可以轻松访问所有选项。这肯定对 [Linux 智能手机(如 Librem 5)][5] 上的 GNOME 有所帮助。 + +除了所有这些之外,[官方公告][6]还提到到开发人员的有用补充(增加了系统分析器和虚拟化改进): + +> 对于开发人员,GNOME 3.34 在 Sysprof 中包含更多数据源,使应用程序的性能分析更加容易。对 Builder 的多项改进中包括集成的 D-Bus 检查器。 + +![Improved Sysprof tool in GNOME 3.34][7] + +### 如何获得GNOME 3.34? + +虽然新版本已经发布,但它还没有进入 Linux 发行版的官方存储库。所以,我们建议等待它,并在它作为更新包提供时进行升级。不管怎么说,如果你想构建它,你都可以在这里找到[源代码][8]。 + +嗯,就是这样。如果你感兴趣,可以查看[完整版本说明][10]以了解技术细节。 + +你如何看待新的 GNOME 3.34? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-34-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnome.org/news/2019/03/gnome-3-32-released/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/icon-grid-drag-gnome.png?ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/gnome-calendar-improvements.jpg?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/background-panel-GNOME.png?resize=800%2C555&ssl=1 +[5]: https://itsfoss.com/librem-linux-phone/ +[6]: https://www.gnome.org/press/2019/09/gnome-3-34-released/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/sysprof-gnome.jpg?resize=800%2C493&ssl=1 +[8]: https://download.gnome.org/ +[9]: https://itsfoss.com/fedora-26-release/ +[10]: https://help.gnome.org/misc/release-notes/3.34/ diff --git a/published/201909/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md b/published/201909/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md new file mode 100644 index 0000000000..0f5ce59599 --- /dev/null +++ b/published/201909/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11349-1.html) +[#]: subject: (Manjaro Linux Graduates From A Hobby Project To A Professional Project) +[#]: via: (https://itsfoss.com/manjaro-linux-business-formation/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Manjaro Linux 从业余爱好项目成长为专业项目 +====== + +> Manjaro 正在走专业化路线。虽然 Manjaro 社区将负责项目的开发和其他相关活动,但该团队已成立了一家公司作为其法人实体处理商业协议和专业服务。 + +Manjaro 是一个相当流行的 Linux 发行版,而它只是由三个人(Bernhard、Jonathan 和 Phili)于 2011 年激情之下创建的项目。现在,它是目前[最好的 Linux 发行版][1]之一,所以它不能真的一直还只是个业余爱好项目了,对吧。 + +嗯,现在有个好消息:Manjaro 已经建立了一家新公司“[Manjaro GmbH & Co. KG]”,以 [Blue Systems][2] 为顾问,以便能够全职雇佣维护人员,并探索未来的商业机会。 + +![][3] + +### 具体有什么变化? + +根据[官方公告][4],Manjaro 项目将保持不变。但是,成立了一家新公司来保护该项目,以允许他们制定法律合同、官方协议和进行其他潜在的商业活动。因此,这使得这个“业余爱好项目”成为了一项专业工作。 + +除此之外,捐赠资金将转给非营利性的[财政托管][5]([CommunityBridge][6] 和 [OpenCollective][7]),让他们来代表项目接受和管理资金。请注意,这些捐赠没有被用于创建这个公司,因此,将资金转移给非营利的财务托管将在确保捐赠的同时也确保透明度。 + +### 这会有何改善? + +随着这个公司的成立,(如开发者所述)新结构将以下列方式帮助 Manjaro: + +* 使开发人员能够全职投入 Manjaro 及其相关项目; +* 在 Linux 相关的比赛和活动中与其他开发人员进行互动; +* 保护 Manjaro 作为一个社区驱动项目的独立性,并保护其品牌; +* 提供更快的安全更新,更有效地响应用户需求; +* 提供在专业层面上作为公司行事的手段。 + +Manjaro 团队还阐明了它将如何继续致力于社区: + +> Manjaro 的使命和目标将与以前一样 —— 支持 Manjaro 的协作开发及其广泛使用。这项工作将继续通过捐赠和赞助来支持,这些捐赠和赞助在任何情况下都不会被这个成立的公司使用。 + +### 关于 Manjaro 公司的更多信息 + +尽管他们提到该项目将独立于公司,但并非所有人都清楚当有了一家具有商业利益的公司时 Manjaro 与“社区”的关系。因此,该团队还在公告中澄清了他们作为一家公司的计划。 + +> Manjaro GmbH & Co.KG 的成立旨在有效地参与商业协议、建立合作伙伴关系并提供专业服务。有了这个,Manjaro 开发者 Bernhard 和 Philip 现在可以全职工作投入到 Manjaro,而 Blue Systems 将担任顾问。 + +> 公司将能够正式签署合同并承担职责和保障,而社区不能承担或承担责任。 + +### 总结 + +因此,通过这一举措以及商业机会,他们计划全职工作并聘请贡献者。 + +当然,现在他们的意思是“业务”(我希望不是作为坏人)。对此公告的大多数反应都是积极的,我们都祝他们好运。虽然有些人可能对具有“商业”利益的“社区”项目持怀疑态度(还记得 [FreeOffice 和 Manjaro 的挫败][9]吗?),但我认为这是一个有趣的举措。 + +你怎么看?请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-linux-business-formation/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://www.blue-systems.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/manjaro-gmbh.jpg?ssl=1 +[4]: https://forum.manjaro.org/t/manjaro-is-taking-the-next-step/102105 +[5]: https://en.wikipedia.org/wiki/Fiscal_sponsorship +[6]: https://communitybridge.org/ +[7]: https://opencollective.com/ +[8]: https://itsfoss.com/linux-mint-hacked/ +[9]: https://itsfoss.com/libreoffice-freeoffice-manjaro-linux/ diff --git a/published/201909/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md b/published/201909/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md new file mode 100644 index 0000000000..e70c9f8832 --- /dev/null +++ b/published/201909/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11351-1.html) +[#]: subject: (Sandboxie's path to open source, update on the Pentagon's open source initiative, open source in Hollywood, and more) +[#]: via: (https://opensource.com/article/19/9/news-september-15) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +开源新闻综述:五角大楼、好莱坞和 Sandboxie 的开源 +====== + +> 不要错过两周以来最大的开源头条新闻。 + +![Weekly news roundup with TV][1] + +在本期我们的开源新闻综述中有 Sandboxie 的开源之路、五角大楼开源计划的进一步变化、好莱坞开源等等! + +### 五角大楼不符合白宫对开源软件的要求 + +2016 年,美国白宫要求每个美国政府机构必须在三年内开放至少 20% 的定制软件。2017 年有一篇关于这一倡议的[有趣文章][5],其中列出了一些令人激动的事情和面临的挑战。 + +根据美国政府问责局(GAO)的说法,[美国五角大楼做的还远远不足][6]。 + +在一篇关于 Nextgov 的文章中,Jack Corrigan 写道,截至 2019 年 7 月,美国五角大楼仅发布了 10% 的代码为开源代码。他们还没有实施的其它白宫任务包括要求制定开源软件政策和定制代码的清单。 + +根据该报告,一些美国政府官员告诉 GAO,他们担心美国政府部门间共享代码的安全风险。他们还承认没有创建衡量开源工作成功的指标。美国五角大楼的首席技术官将五角大楼的规模列为不执行白宫的开源任务的原因。在周二发布的一份报告中,GAO 表示,“在(美国国防部)完全实施其试点计划并确定完成行政管理和预算局(OMB)要求的里程碑之前,该部门将无法达成显著的成本节约和效率的目的。” + +### Sandboxie 在开源的过程中变成了免费软件 + +一家英国安全公司 Sophos Group plc 发布了[其流行的 Sandboxie 工具的免费版本][2],它用作Windows 的隔离操作环境([可在此下载][2])。 + +Sophos 表示,由于 Sandboxie 不是其业务的核心,因此更容易做出的决定就是关闭它。但 Sandboxie 因为无需让用户的操作系统冒风险就可以在安全的环境中运行未知软件而[广受赞誉][3],因此该团队正在投入额外的工作将其作为开源软件发布。这个免费但非开源的中间阶段似乎与当前的系统设计有关,因为它需要激活密钥: + +> Sandboxie 目前使用许可证密钥来激活和授予仅针对付费客户开放的高级功能的访问权限(与使用免费版本的用户相比)。我们修改了代码,并发布了一个不限制任何功能的免费版本的更新版。换句话说,新的免费许可证将可以访问之前仅供付费客户使用的所有功能。 + +受此工具的社区影响,Sophos 的高级领导人宣布发布 Sandboxie 版本 5.31.4,这个不受限制的程序版本将保持免费,直到该工具完全开源。 + +> “Sandboxie 用户群代表了一些最热情、前瞻性和知识渊博的安全社区成员,我们不想让你失望,”[Sophos 的博文说到][4]。“经过深思熟虑后,我们认为让 Sandboxie 走下去的最佳方式是将其交还给用户,将其转换为开源工具。” + +### 志愿者团队致力于查找和数字化无版权书籍 + +1924 年以前在美国出版的所有书籍都是[公有的、可以自由使用/复制的][7]。1964 年及之后出版的图书在出版日期后将保留 95 年的版权。但由于版权漏洞,1923 年至 1964 年间出版的书籍中有高达 75% 可以免费阅读和复制。现在只需要耗时确认那些书是什么。 + +因此,一些图书馆、志愿者和档案管理员们联合起来了解哪些图书没有版权,然后将其数字化并上传到互联网。由于版权续约记录已经数字化,因此很容易判断 1923 年至 1964 年间出版的书籍是否更新了其版权。但是,由于试图提供的是反证,因此寻找缺乏版权更新的难度要大得多。 + +参与者包括纽约公共图书馆(NYPL),它[最近解释了][8]为什么这个耗时的项目是值得的。为了帮助更快地找到更多书籍,NYPL 将许多记录转换为 XML 格式。这样可以更轻松地自动执行查找可以将哪些书籍添加到公共域的过程。 + +### 好莱坞的学院软件基金会获得新成员 + +微软和苹果公司宣布计划以学院软件基金会Academy Software Foundation(ASWF)的高级会员做出贡献。他们将加入[创始董事会成员][9],其它成员还包括 Netflix、Google Cloud、Disney Studios 和 Sony Pictures。 + +学院软件基金会于 2018 年作为[电影艺术与科学学院][10]和[Linux 基金会][11]的联合项目而启动。 + +> 学院软件基金会(ASWF)的使命是提高贡献到内容创作行业的开源软件库的质量和数量;提供一个中立的论坛来协调跨项目的工作;提供通用的构建和测试基础架构;并为个人和组织提供参与推进我们的开源生态系统的明确途径。 + +在第一年内,该基金会构建了 [OpenTimelineIO][12],这是一种开源 API 和交换格式,可帮助工作室团队跨部门协作。OpenTImelineIO 被该[基金会技术咨询委员会][13]去年 7 月正式接受为第五个托管项目。他们现在将它与 [OpenColorIO][14]、[OpenCue][15]、[OpenEXR][16] 和 [OpenVDB] [17] 并列维护。 + +### 其它新闻 + +* [Comcast 将开源网络软件投入生产环境][18] +* [SD Times 本周开源项目:Ballerina][19] +* [美国国防部努力实施开源计划][20] +* [Kong 开源通用服务网格 Kuma][21] +* [Eclipse 推出 Jakarta EE 8][22] + +一如既往地感谢 Opensource.com 的工作人员和主持人本周的帮助。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/news-september-15 + +作者:[Lauren Maffeo][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://opensource.com/users/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://www.sandboxie.com/DownloadSandboxie +[3]: https://betanews.com/2019/09/13/sandboxie-free-open-source/ +[4]: https://community.sophos.com/products/sandboxie/f/forum/115109/major-sandboxie-news-sandboxie-is-now-a-free-tool-with-plans-to-transition-it-to-an-open-source-tool/414522 +[5]: https://medium.com/@DefenseDigitalService/code-mil-an-open-source-initiative-at-the-pentagon-5ae4986b79bc +[6]: https://www.nextgov.com/analytics-data/2019/09/pentagon-needs-make-more-software-open-source-watchdog-says/159832/ +[7]: https://www.vice.com/en_us/article/a3534j/libraries-and-archivists-are-scanning-and-uploading-books-that-are-secretly-in-the-public-domain +[8]: https://www.nypl.org/blog/2019/09/01/historical-copyright-records-transparency +[9]: https://variety.com/2019/digital/news/microsoft-apple-academy-software-foundation-1203334675/ +[10]: https://www.oscars.org/ +[11]: http://www.linuxfoundation.org/ +[12]: https://github.com/PixarAnimationStudios/OpenTimelineIO +[13]: https://www.linuxfoundation.org/press-release/2019/07/opentimelineio-joins-aswf/ +[14]: https://opencolorio.org/ +[15]: https://www.opencue.io/ +[16]: https://www.openexr.com/ +[17]: https://www.openvdb.org/ +[18]: https://www.fiercetelecom.com/operators/comcast-puts-open-source-networking-software-into-production +[19]: https://sdtimes.com/os/sd-times-open-source-project-of-the-week-ballerina/ +[20]: https://www.fedscoop.com/open-source-software-dod-struggles/ +[21]: https://sdtimes.com/micro/kong-open-sources-universal-service-mesh-kuma/ +[22]: https://devclass.com/2019/09/11/hey-were-open-source-again-eclipse-unveils-jakarta-ee-8/ diff --git a/published/201909/20190916 How to freeze and lock your Linux system (and why you would want to).md b/published/201909/20190916 How to freeze and lock your Linux system (and why you would want to).md new file mode 100644 index 0000000000..37b0a31311 --- /dev/null +++ b/published/201909/20190916 How to freeze and lock your Linux system (and why you would want to).md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11384-1.html) +[#]: subject: (How to freeze and lock your Linux system (and why you would want to)) +[#]: via: (https://www.networkworld.com/article/3438818/how-to-freeze-and-lock-your-linux-system-and-why-you-would-want-to.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何冻结和锁定你的 Linux 系统 +====== + +> 冻结终端窗口并锁定屏幕意味着什么 - 以及如何在 Linux 系统上管理这些活动。 + +![](https://img.linux.net.cn/data/attachment/album/201909/24/230938vgxzv3nrakk0wxnw.jpg) + +如何在 Linux 系统上冻结和“解冻”屏幕,很大程度上取决于这些术语的含义。有时“冻结屏幕”可能意味着冻结终端窗口,以便该窗口内的活动停止。有时它意味着锁定屏幕,这样就没人可以在你去拿一杯咖啡时,走到你的系统旁边代替你输入命令了。 + +在这篇文章中,我们将研究如何使用和控制这些操作。 + +### 如何在 Linux 上冻结终端窗口 + +你可以输入 `Ctrl+S`(按住 `Ctrl` 键和 `s` 键)冻结 Linux 系统上的终端窗口。把 `s` 想象成“开始冻结start the freeze”。如果在此操作后继续输入命令,那么你不会看到输入的命令或你希望看到的输出。实际上,命令将堆积在一个队列中,并且只有在通过输入 `Ctrl+Q` 解冻时才会运行。把它想象成“退出冻结quit the freeze”。 + +查看其工作的一种简单方式是使用 `date` 命令,然后输入 `Ctrl+S`。接着再次输入 `date` 命令并等待几分钟后再次输入 `Ctrl+Q`。你会看到这样的情景: + +``` +$ date +Mon 16 Sep 2019 06:47:34 PM EDT +$ date +Mon 16 Sep 2019 06:49:49 PM EDT +``` + +这两次时间显示的差距表示第二次的 `date` 命令直到你解冻窗口时才运行。 + +无论你是坐在计算机屏幕前还是使用 PuTTY 等工具远程运行,终端窗口都可以冻结和解冻。 + +这有一个可以派上用场的小技巧。如果你发现终端窗口似乎处于非活动状态,那么可能是你或其他人无意中输入了 `Ctrl+S`。那么,输入 `Ctrl+Q` 来尝试解决不妨是个不错的办法。 + +### 如何锁定屏幕 + +要在离开办公桌前锁定屏幕,请按住  `Ctrl+Alt+L` 或 `Super+L`(即按住 `Windows` 键和 `L` 键)。屏幕锁定后,你必须输入密码才能重新登录。 + +### Linux 系统上的自动屏幕锁定 + +虽然最佳做法建议你在即将离开办公桌时锁定屏幕,但 Linux 系统通常会在一段时间没有活动后自动锁定。 “消隐”屏幕(使其变暗)并实际锁定屏幕(需要登录才能再次使用)的时间取决于你个人首选项中的设置。 + +要更改使用 GNOME 屏幕保护程序时屏幕变暗所需的时间,请打开设置窗口并选择 “Power” 然后 “Blank screen”。你可以选择 1 到 15 分钟或从不变暗。要选择屏幕变暗后锁定所需时间,请进入设置,选择 “Privacy”,然后选择 “Blank screen”。设置应包括 1、2、3、5 和 30 分钟或一小时。 + +### 如何在命令行锁定屏幕 + +如果你使用的是 GNOME 屏幕保护程序,你还可以使用以下命令从命令行锁定屏幕: + +``` +gnome-screensaver-command -l +``` + +这里是小写的 L,代表“锁定”。 + +### 如何检查锁屏状态 + +你还可以使用 `gnome-screensaver` 命令检查屏幕是否已锁定。使用 `--query` 选项,该命令会告诉你屏幕当前是否已锁定(即处于活动状态)。使用 `--time` 选项,它会告诉你锁定生效的时间。这是一个示例脚本: + +``` +#!/bin/bash + +gnome-screensaver-command --query +gnome-screensaver-command --time +``` + +运行脚本将会输出: + +``` +$ ./check_lockscreen +The screensaver is active +The screensaver has been active for 1013 seconds. +``` + +#### 总结 + +如果你记住了正确的控制方式,那么锁定终端窗口是很简单的。对于屏幕锁定,它的效果取决于你自己的设置,或者你是否习惯使用默认设置。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438818/how-to-freeze-and-lock-your-linux-system-and-why-you-would-want-to.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190916 How to start developing with .NET.md b/published/201909/20190916 How to start developing with .NET.md new file mode 100644 index 0000000000..81233361e9 --- /dev/null +++ b/published/201909/20190916 How to start developing with .NET.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11397-1.html) +[#]: subject: (How to start developing with .NET) +[#]: via: (https://opensource.com/article/19/9/getting-started-net) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux/Windows/MacOS 上使用 .NET 进行开发 +====== + +> 了解 .NET 开发平台启动和运行的基础知识。 + +![](https://img.linux.net.cn/data/attachment/album/201909/28/111101n3i43c38tv3j9im4.jpg) + +.NET 框架由 Microsoft 于 2000 年发布。该平台的开源实现 [Mono][2] 在 21 世纪初成为了争议的焦点,因为微软拥有 .NET 技术的多项专利,并且可能使用这些专利来终止 Mono 项目。幸运的是,在 2014 年,微软宣布 .NET 开发平台从此成为 MIT 许可下的开源平台,并在 2016 年收购了开发 Mono 的 Xamarin 公司。 + +.NET 和 Mono 已经同时可用于 C#、F#、GTK+、Visual Basic、Vala 等的跨平台编程环境。使用 .NET 和 Mono 创建的程序已经应用于 Linux、BSD、Windows、MacOS、Android,甚至一些游戏机。你可以使用 .NET 或 Mono 来开发 .NET 应用。这两个都是开源的,并且都有活跃和充满活力的社区。本文重点介绍微软的 .NET 环境。 + +### 如何安装 .NET + +.NET 下载被分为多个包:一个仅包含 .NET 运行时,另一个 .NET SDK 包含了 .NET Core 和运行时。根据架构和操作系统版本,这些包可能有多个版本。要开始使用 .NET 进行开发,你必须[安装该 SDK][3]。它为你提供了 [dotnet][4] 终端或 PowerShell 命令,你可以使用它们来创建和生成项目。 + +#### Linux + +要在 Linux 上安装 .NET,首先将微软 Linux 软件仓库添加到你的计算机。 + +在 Fedora 上: + +``` +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ sudo wget -q -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/27/prod.repo +``` + +在 Ubuntu 上: + +``` +$ wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +接下来,使用包管理器安装 SDK,将 `` 替换为当前版本的 .NET 版本: + +在 Fedora 上: + +``` +$ sudo dnf install dotnet-sdk- +``` + +在 Ubuntu 上: + +``` +$ sudo apt install apt-transport-https +$ sudo apt update +$ sudo apt install dotnet-sdk- +``` + +下载并安装所有包后,打开终端并输入下面命令确认安装: + +``` +$ dotnet --version +X.Y.Z +``` + +#### Windows + +如果你使用的是微软 Windows,那么你可能已经安装了 .NET 运行时。但是,要开发 .NET 应用,你还必须安装 .NET Core SDK。 + +首先,[下载安装程序][3]。请认准下载 .NET Core 进行跨平台开发(.NET Framework 仅适用于 Windows)。下载 .exe 文件后,双击该文件启动安装向导,然后单击两下进行安装:接受许可证并允许安装继续。 + +![Installing dotnet on Windows][5] + +然后,从左下角的“应用程序”菜单中打开 PowerShell。在 PowerShell 中,输入测试命令: + +``` +PS C:\Users\osdc> dotnet +``` + +如果你看到有关 dotnet 安装的信息,那么说明 .NET 已正确安装。 + +#### MacOS + +如果你使用的是 Apple Mac,请下载 .pkg 形式的 [Mac 安装程序][3]。下载并双击该 .pkg 文件,然后单击安装程序。你可能需要授予安装程序权限,因为该软件包并非来自 App Store。 + +下载并安装所有软件包后,请打开终端并输入以下命令来确认安装: + +``` +$ dotnet --version +X.Y.Z +``` + +### Hello .NET + +`dotnet` 命令提供了一个用 .NET 编写的 “hello world” 示例程序。或者,更准确地说,该命令提供了示例应用。 + +首先,使用 `dotnet` 命令以及 `new` 和 `console` 参数创建一个控制台应用的项目目录及所需的代码基础结构。使用 `-o` 选项指定项目名称: + +``` +$ dotnet new console -o hellodotnet +``` + +这将在当前目录中创建一个名为 `hellodotnet` 的目录。进入你的项目目录并看一下: + +``` +$ cd hellodotnet +$ dir +hellodotnet.csproj  obj  Program.cs +``` + +`Program.cs` 是一个空的 C# 文件,它包含了一个简单的 Hello World 程序。在文本编辑器中打开查看它。微软的 Visual Studio Code 是一个使用 dotnet 编写的跨平台的开源应用,虽然它不是一个糟糕的文本编辑器,但它会收集用户的大量数据(在它的二进制发行版的许可证中授予了自己权限)。如果要尝试使用 Visual Studio Code,请考虑使用 [VSCodium][6],它是使用 Visual Studio Code 的 MIT 许可的源码构建的版本,而*没有*远程收集(请阅读[此文档][7]来禁止此构建中的其他形式追踪)。或者,只需使用现有的你最喜欢的文本编辑器或 IDE。 + +新控制台应用中的样板代码为: + +``` +using System; + +namespace hellodotnet +{ +    class Program +    { +        static void Main(string[] args) +        { +            Console.WriteLine("Hello World!"); +        } +    } +} +``` + +要运行该程序,请使用 `dotnet run` 命令: + +``` +$ dotnet run +Hello World! +``` + +这是 .NET 和 `dotnet` 命令的基本工作流程。这里有完整的 [.NET C# 指南][8],并且都是与 .NET 相关的内容。关于 .NET 实战示例,请关注 [Alex Bunardzic][9] 在 opensource.com 中的变异测试文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/getting-started-net + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://www.monodevelop.com/ +[3]: https://dotnet.microsoft.com/download +[4]: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?tabs=netcore21 +[5]: https://opensource.com/sites/default/files/uploads/dotnet-windows-install.jpg (Installing dotnet on Windows) +[6]: https://vscodium.com/ +[7]: https://github.com/VSCodium/vscodium/blob/master/DOCS.md +[8]: https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/intro-to-csharp/ +[9]: https://opensource.com/users/alex-bunardzic (View user profile.) diff --git a/published/201909/20190916 Linux Plumbers, Appwrite, and more industry trends.md b/published/201909/20190916 Linux Plumbers, Appwrite, and more industry trends.md new file mode 100644 index 0000000000..8ca1e16da6 --- /dev/null +++ b/published/201909/20190916 Linux Plumbers, Appwrite, and more industry trends.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11355-1.html) +[#]: subject: (Linux Plumbers, Appwrite, and more industry trends) +[#]: via: (https://opensource.com/article/19/9/conferences-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + + +每周开源点评:Linux Plumbers、Appwrite +====== + +> 了解每周的开源社区和行业趋势。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为采用开源开发模式的企业软件公司的高级产品营销经理,这是我为产品营销人员、经理和其他相关人员发布的有关开源社区、市场和行业趋势的定期更新。以下是本次更新中我最喜欢的五篇文章。 + +### 《在 Linux Plumbers 会议上解决 Linux 具体细节》 + +- [文章地址][2] + +> Linux 的创建者 Linus Torvalds 告诉我,内核维护者峰会Kernel Maintainers Summit是顶级 Linux 内核开发人员的邀请制聚会。但是,虽然你可能认为这是关于规划 Linux 内核的未来的会议,但事实并非如此。“这个维护者峰会真的与众不同,因为它甚至不谈论技术问题。”相反,“全都谈的是关于创建和维护 Linux 内核的过程。” + +**影响**:这就像技术版的 Bilderberg 会议:你们举办的都是各种华丽的流行语会议,而在这里我们做出的才是真正的决定。不过我觉得,可能不太会涉及到私人飞机吧。(LCTT 译注:有关 Bilderberg 请自行搜索) + +### 《微软主办第一个 WSL 会议》 + +- [文章地址][3] + +> [Whitewater Foundry][4] 是一家专注于 [Windows 的 Linux 子系统(WSL)][5]的创业公司,它的创始人 Hayden Barnes [宣布举办 WSLconf 1][6],这是 WSL 的第一次社区会议。该活动将于 2020 年 3 月 10 日至 11 日在华盛顿州雷德蒙市的微软总部 20 号楼举行。会议是合办的。我们已经知道将有来自[Pengwin(Whitewater 的 Linux for Windows)][7]、微软 WSL 和 Canonical 的 Ubuntu on WSL 开发人员的演讲和研讨会。 + +**影响**:微软正在培育社区成长的种子,围绕它越来越多地采用开源软件并作出贡献。这足以让我眼前一亮。 + +### 《Appwrite 简介:面向移动和 Web 开发人员的开源后端服务器》 + +- [文章链接][10] + +> [Appwrite][11] 是一个新的[开源软件][12],用于前端和移动开发人员的端到端的后端服务器,可以让你更快地构建应用程序。[Appwrite][13] 的目标是抽象和简化 REST API 和工具背后的常见开发任务,以帮助开发人员更快地构建高级应用程序。 +> +> 在这篇文章中,我将简要介绍一些主要的 [Appwrite][14] 服务,并解释它们的主要功能以及它们的设计方式,相比从头开始编写所有后端 API,这可以帮助你更快地构建下一个项目。 + +**影响**:随着更多开源中间件变得更易于使用,软件开发越来越容易。Appwrite 声称可将开发时间和成本降低 70%。想象一下这对小型移动开发机构或个人开发者意味着什么。我很好奇他们将如何通过这种方式赚钱。 + +### 《“不只是 IT”:开源技术专家说协作文化是政府转型的关键》 + +- [文章链接][15] + +> AGL(敏捷的政府领导agile government leadership)正在为那些帮助政府更好地为公众工作的人们提供价值支持网络。该组织专注于我非常热衷的事情:DevOps、数字化转型、开源以及许多政府 IT 领导者首选的类似主题。AGL 为我提供了一个社区,可以了解当今最优秀和最聪明的人所做的事情,并与整个行业的同行分享这些知识。 + +**影响**:不管你的政治信仰如何,对政府都很容易愤世嫉俗。我发现令人耳目一新的是,政府也是由一个个实际的人组成的,他们大多在尽力将相关技术应用于公益事业。特别是当该技术是开源的! + +### 《彭博社如何通过 Kubernetes 实现接近 90-95% 的硬件利用率》 + +- [文章链接][16] + +> 2016 年,彭博社采用了 Kubernetes(当时仍处于 alpha 阶段中),自使用该项目的上游代码以来,取得了显著成果。Rybka 说:“借助 Kubernetes,我们能够非常高效地使用我们的硬件,使利用率接近 90% 到 95%。”Kubernetes 中的自动缩放使系统能够更快地满足需求。此外,Kubernetes “为我们提供了标准化我们构建和管理服务的方法的能力,这意味着我们可以花费更多时间专注于实际使用我们支持的开源工具,”数据和分析基础架构主管 Steven Bower 说,“如果我们想要在世界的另一个位置建立一个新的集群,那么这样做真的非常简单。一切都只是代码。配置就是代码。” + +**影响**:没有什么能像利用率统计那样穿过营销的迷雾。我听说过关于 Kube 的一件事是,当人们运行它时,他们不知道用它做什么。像这样的用例可以给他们(和你)一些想要的东西。 + +*我希望你喜欢这个上周重要内容的清单,请下周回来了解有关开源社区、市场和行业趋势的更多信息。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/conferences-industry-trends + +作者:[Tim Hildred][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://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.zdnet.com/article/working-on-linuxs-nuts-and-bolts-at-linux-plumbers/ +[3]: https://www.zdnet.com/article/microsoft-hosts-first-windows-subsystem-for-linux-conference/ +[4]: https://github.com/WhitewaterFoundry +[5]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[6]: https://www.linkedin.com/feed/update/urn:li:activity:6574754435518599168/ +[7]: https://www.zdnet.com/article/pengwin-a-linux-specifically-for-windows-subsystem-for-linux/ +[8]: https://canonical.com/ +[9]: https://ubuntu.com/ +[10]: https://medium.com/@eldadfux/introducing-appwrite-an-open-source-backend-server-for-mobile-web-developers-4be70731575d +[11]: https://appwrite.io +[12]: https://github.com/appwrite/appwrite +[13]: https://medium.com/@eldadfux/introducing-appwrite-an-open-source-backend-server-for-mobile-web-developers-4be70731575d?source=friends_link&sk=b6a2be384aafd1fa5b1b6ff12906082c +[14]: https://appwrite.io/ +[15]: https://medium.com/agile-government-leadership/more-than-just-it-open-source-technologist-says-collaborative-culture-is-key-to-government-c46d1489f822 +[16]: https://www.cncf.io/blog/2019/09/12/how-bloomberg-achieves-close-to-90-95-hardware-utilization-with-kubernetes/ diff --git a/published/201909/20190917 Getting started with Zsh.md b/published/201909/20190917 Getting started with Zsh.md new file mode 100644 index 0000000000..460ab91c92 --- /dev/null +++ b/published/201909/20190917 Getting started with Zsh.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11378-1.html) +[#]: subject: (Getting started with Zsh) +[#]: via: (https://opensource.com/article/19/9/getting-started-zsh) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Zsh 入门 +====== + +> 从 Bash 进阶到 Z-shell,改进你的 shell 体验。 + +![](https://img.linux.net.cn/data/attachment/album/201909/23/163910imr1z1qw1ruo9uqs.jpg) + +Z-shell(Zsh)是一种 Bourne 式的交互式 POSIX shell,以其丰富的创新功能而著称。Z-Shell 用户经常会提及它的许多便利之处,赞誉它对效率的提高和丰富的自定义支持。 + +如果你刚接触 Linux 或 Unix,但你的经验足以让你可以打开终端并运行一些命令的话,那么你可能使用的就是 Bash shell。Bash 可能是最具有代表意义的自由软件 shell,部分是因为它具有的先进的功能,部分是因为它是大多数流行的 Linux 和 Unix 操作系统上的默认 shell。但是,随着使用的次数越多,你可能会开始发现一些细节可能能够做的更好。开源有一个众所周知的地方,那就是选择。所以,许多人选择从 Bash “毕业”到 Z。 + +### Zsh 介绍 + +Shell 只是操作系统的接口。交互式 shell 程序允许你通过称为*标准输入*(stdin)的某个东西键入命令,并通过*标准输出*(stdout)和*标准错误*(stderr)获取输出。有很多种 shell,如 Bash、Csh、Ksh、Tcsh、Dash 和 Zsh。每个都有其开发者所认为最适合于 Shell 的功能。而这些功能的好坏,则取决于最终用户。 + +Zsh 具有交互式制表符补全、自动文件搜索、支持正则表达式、用于定义命令范围的高级速记符,以及丰富的主题引擎等功能。这些功能也包含在你所熟悉的其它 Bourne 式 shell 环境中,这意味着,如果你已经了解并喜欢 Bash,那么你也会熟悉 Zsh,除此以外,它还有更多的功能。你可能会认为它是一种 Bash++。 + +### 安装 Zsh + +用你的包管理器安装 Zsh。 + +在 Fedora、RHEL 和 CentOS 上: + +``` +$ sudo dnf install zsh +``` + +在 Ubuntu 和 Debian 上: + +``` +$ sudo apt install zsh +``` + +在 MacOS 上你可以使用 MacPorts 安装它: + +``` +$ sudo port install zsh +``` + +或使用 Homebrew: + +``` +$ brew install zsh +``` + +在 Windows 上也可以运行 Zsh,但是只能在 Linux 层或类似 Linux 的层之上运行,例如 [Windows 的 Linux 子系统][2](WSL)或 [Cygwin][3]。这类安装超出了本文的范围,因此请参考微软的文档。 + +### 设置 Zsh + +Zsh 不是终端模拟器。它是在终端仿真器中运行的 shell。因此,要启动 Zsh,必须首先启动一个终端窗口,例如 GNOME Terminal、Konsole、Terminal、iTerm2、rxvt 或你喜欢的其它终端。然后,你可以通过键入以下命令启动 Zsh: + +``` +$ zsh +``` + +首次启动 Zsh 时,会要求你选择一些配置选项。这些都可以在以后更改,因此请按 `1` 继续。 + +``` +This is the Z Shell configuration function for new users, zsh-newuser-install. + +(q)  Quit and do nothing. + +(0)  Exit, creating the file ~/.zshrc + +(1)  Continue to the main menu. +``` + +偏好设置分为四类,因此请从顶部开始。 + +1. 第一个类使你可以选择在 shell 历史记录文件中保留多少个命令。默认情况下,它设置为 1,000 行。 +2. Zsh 补全是其最令人兴奋的功能之一。为了简单起见,请考虑使用其默认选项激活它,直到你习惯了它的工作方式。按 `1` 使用默认选项,按 `2` 手动设置选项。 +3. 选择 Emacs 式键绑定或 Vi 式键绑定。Bash 使用 Emacs 式绑定,因此你可能已经习惯了。 +4. 最后,你可以了解(以及设置或取消设置)Zsh 的一些精妙的功能。例如,当你提供不带命令的非可执行路径时,可以通过让 Zsh 来改变目录而无需你使用 `cd` 命令。要激活这些额外选项之一,请输入选项号并输入 `s` 进行设置。请尝试打开所有选项以获得完整的 Zsh 体验。你可以稍后通过编辑 `~/.zshrc` 取消设置它们。 + +要完成配置,请按 `0`。 + +### 使用 Zsh + +刚开始,Zsh 的使用感受就像使用 Bash 一样,这无疑是其众多功能之一。例如,Bash 和 Tcsh 之间就存在严重的差异,因此如果你必须在工作中或在服务器上使用 Bash,而 Zsh 就可以在家里轻松尝试和使用,这样在 Bash 和 Zsh 之间轻松切换就是一种便利。 + +#### 在 Zsh 中改变目录 + +正是这些微小的差异使 Zsh 变得好用。首先,尝试在没有 `cd` 命令的情况下,将目录更改为 `Documents` 文件夹。简直太棒了,难以置信。如果你输入的是目录路径而没有进一步的指令,Zsh 会更改为该目录: + +``` +% Documents +% pwd +/home/seth/Documents +``` + +而这会在 Bash 或任何其他普通 shell 中导致错误。但是 Zsh 却根本不是普通的 shell,而这仅仅才是开始。 + +#### 在 Zsh 中搜索 + +当你想使用普通 shell 程序查找文件时,可以使用 `find` 或 `locate` 命令。最起码,你可以使用 `ls -R` 来递归地列出一组目录。Zsh 内置有允许它在当前目录或任何其他子目录中查找文件的功能。 + +例如,假设你有两个名为 `foo.txt` 的文件。一个位于你的当前目录中,另一个位于名为 `foo` 的子目录中。在 Bash Shell 中,你可以使用以下命令列出当前目录中的文件: + +``` +$ ls +foo.txt +``` + +你可以通过明确指明子目录的路径来列出另一个目录: + +``` +$ ls foo +foo.txt +``` + +要同时列出这两者,你必须使用 `-R` 开关,并结合使用 `grep`: + +``` +$ ls -R | grep foo.txt +foo.txt +foo.txt +``` + +但是在 Zsh 中,你可以使用 `**` 速记符号: + +``` +% ls **/foo.txt +foo.txt +foo.txt +``` + +你可以在任何命令中使用此语法,而不仅限于 `ls`。想象一下在这样的场景中提高的效率:将特定文件类型从一组目录中移动到单个位置、将文本片段串联到一个文件中,或对日志进行抽取。 + +### 使用 Zsh 的制表符补全 + +制表符补全是 Bash 和其他一些 Shell 中的高级用户功能,它变得司空见惯,席卷了 Unix 世界。Unix 用户不再需要在输入冗长而乏味的路径时使用通配符(例如输入 `/h*/s*h/V*/SCS/sc*/comp*/t*/a*/*9/04/LS*boat*v`,比输入 `/home/seth/Videos/SCS/scenes/composite/takes/approved/109/04/LS_boat-port-cargo-mover.mkv` 要容易得多)。相反,他们只要输入足够的唯一字符串即可按 `Tab` 键。例如,如果你知道在系统的根目录下只有一个以 `h` 开头的目录,则可以键入 `/h`,然后单击 `Tab`。快速、简单、高效。它还会确认路径存在;如果 `Tab` 无法完成任何操作,则说明你在错误的位置或输入了错误的路径部分。 + +但是,如果你有许多目录有五个或更多相同的首字母,`Tab` 会坚决拒绝进行补全。尽管在大多数现代终端中,它将(至少会)显示阻止其进行猜测你的意思的文件,但通常需要按两次 `Tab` 键才能显示它们。因此,制表符补全通常会变成来回按下键盘上字母和制表符,以至于你好像在接受钢琴独奏会的训练。 + +Zsh 通过循环可能的补全来解决这个小问题。如果键入 `*ls ~/D` 并按 `Tab`,则 Zsh 首先使用 `Documents` 来完成命令;如果再次按 `Tab`,它将提供 `Downloads`,依此类推,直到找到所需的选项。 + +### Zsh 中的通配符 + +在 Zsh 中,通配符的行为不同于 Bash 中用户所习惯的行为。首先,可以对其进行修改。例如,如果要列出当前目录中的所有文件夹,则可以使用修改后的通配符: + +``` +% ls +dir0   dir1   dir2   file0   file1 +% ls *(/) +dir0   dir1   dir2 +``` + +在此示例中,`(/)` 限定了通配符的结果,因此 Zsh 仅显示目录。要仅列出文件,请使用 `(.)`。要列出符号链接,请使用 `(@)`。要列出可执行文件,请使用 `(*)`。 + +``` +% ls ~/bin/*(*) +fop  exify  tt +``` + +Zsh 不仅仅知道文件类型。它也可以使用相同的通配符修饰符约定根据修改时间列出。例如,如果要查找在过去八个小时内修改的文件,请使用 `mh` 修饰符(即 “modified hours” 的缩写)和小时的负整数: + +``` +% ls ~/Documents/*(mh-8) +cal.org   game.org   home.org +``` + +要查找超过(例如)两天前修改过的文件,修饰符更改为 `md`(即 “modified day” 的缩写),并带上天数的正整数: + +``` +% ls ~/Documents/*(+2) +holiday.org +``` + +通配符修饰符和限定符还可以做很多事情,因此,请阅读 [Zsh 手册页][4],以获取全部详细信息。 + +#### 通配符的副作用 + +要像在 Bash 中使用通配符一样使用它,有时必须在 Zsh 中对通配符进行转义。例如,如果要在 Bash 中将某些文件复制到服务器上,则可以使用如下通配符: + +``` +$ scp IMG_*.JPG seth@example.com:~/www/ph*/*19/09/14 +``` + +这在 Bash 中有效,但是在 Zsh 中会返回错误,因为它在发出 `scp` 命令之前尝试在远程端扩展该变量(通配符)。为避免这种情况,必须转义远程变量(通配符): + +``` +% scp IMG_*.JPG seth@example.com:~/www/ph\*/\*19/09/14 +``` + +当你切换到新的 shell 时,这些小异常可能会使你感到沮丧。使用 Zsh 时会遇到的问题不多(体验过 Zsh 后切换回 Bash 的可能遇到更多),但是当它们发生时,请保持镇定且坦率。严格遵守 POSIX 的情况很少会出错,但是如果失败了,请查找问题以解决并继续。对于许多在工作中困在一个 shell 上而在家中困在另一个 shell 上的用户来说,[hyperpolyglot.org][5] 已被证明其是无价的。 + +在我的下一篇 Zsh 文章中,我将向你展示如何安装主题和插件以定制你的 Z-Shell 甚至 Z-ier。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/getting-started-zsh + +作者:[Seth Kenlon][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://opensource.com/users/seth +[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) +[2]: https://devblogs.microsoft.com/commandline/category/bash-on-ubuntu-on-windows/ +[3]: https://www.cygwin.com/ +[4]: https://linux.die.net/man/1/zsh +[5]: http://hyperpolyglot.org/unix-shells diff --git a/published/201909/20190917 How to Check Linux Mint Version Number - Codename.md b/published/201909/20190917 How to Check Linux Mint Version Number - Codename.md new file mode 100644 index 0000000000..5f102dfa89 --- /dev/null +++ b/published/201909/20190917 How to Check Linux Mint Version Number - Codename.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11360-1.html) +[#]: subject: (How to Check Linux Mint Version Number & Codename) +[#]: via: (https://itsfoss.com/check-linux-mint-version/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何查看 Linux Mint 版本号和代号 +====== + +Linux Mint 每两年发布一次主版本(如 Mint 19),每六个月左右发布一次次版本(如 Mint 19.1、19.2 等)。 你可以自己升级 Linux Mint 版本,而次版本也会自动更新。 + +在所有这些版本中,你可能想知道你正在使用的是哪个版本。了解 Linux Mint 版本号可以帮助你确定某个特定软件是否适用于你的系统,或者检查你的系统是否已达到使用寿命。 + +你可能需要 Linux Mint 版本号有多种原因,你也有多种方法可以获取此信息。让我向你展示用图形和命令行的方式获取 Mint 版本信息。 + +* [使用命令行查看 Linux Mint 版本信息][1] +* [使用 GUI(图形用户界面)查看 Linux Mint 版本信息][2] + +### 使用终端查看 Linux Mint 版本号的方法 + +![][3] + +我将介绍几种使用非常简单的命令查看 Linux Mint 版本号和代号的方法。 你可以从 “菜单” 中打开终端,或按 `CTRL+ALT+T`(默认热键)打开。 + +本文中的最后两个命令还会输出你当前的 Linux Mint 版本所基于的 Ubuntu 版本。 + +#### 1、/etc/issue + +从最简单的 CLI 方法开始,你可以打印出 `/etc/issue` 的内容来检查你的版本号和代号: + +``` +[email protected]:~$ cat /etc/issue +Linux Mint 19.2 Tina \n \l +``` + +#### 2、hostnamectl + +![hostnamectl][4] + +这一个命令(`hostnamectl`)打印的信息几乎与“系统信息”中的信息相同。 你可以看到你的操作系统(带有版本号)以及你的内核版本。 + +#### 3、lsb_release + +`lsb_release` 是一个非常简单的 Linux 实用程序,用于查看有关你的发行版本的基本信息: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: LinuxMint +Description: Linux Mint 19.2 Tina +Release: 19.2 +Codename: tina +``` + +**注:** 我使用 `–a` 标签打印所有参数, 但你也可以使用 `-s` 作为简写格式,`-d` 用于描述等 (用 `man lsb_release` 查看所有选项) + +#### 4、/etc/linuxmint/info + +![/etc/linuxmint/info][5] + +这不是命令,而是 Linux Mint 系统上的文件。只需使用 `cat` 命令将其内容打印到终端,然后查看你的版本号和代号。 + +#### 5、使用 /etc/os-release 命令也可以获取到 Ubuntu 代号 + +![/etc/os-release][7] + +Linux Mint 基于 Ubuntu。每个 Linux Mint 版本都基于不同的 Ubuntu 版本。了解你的 Linux Mint 版本所基于的 Ubuntu 版本有助你在必须要使用 Ubuntu 版本号的情况下使用(比如你需要在 [Linux Mint 中安装最新的 Virtual Box][8]添加仓库时)。 + +`os-release` 则是另一个类似于 `info` 的文件,向你展示 Linux Mint 所基于的 Ubuntu 版本代号。 + +#### 6、使用 /etc/upstream-release/lsb-release 只获取 Ubuntu 的基本信息 + +如果你只想要查看有关 Ubuntu 的基本信息,请输出 `/etc/upstream-release/lsb-release`: + +``` +[email protected]:~$ cat /etc/upstream-release/lsb-release +DISTRIB_ID=Ubuntu +DISTRIB_RELEASE=18.04 +DISTRIB_CODENAME=bionic +DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS" +``` + +特别提示:[你可以使用 uname 命令查看 Linux 内核版本][9]。 + +``` +[email protected]:~$ uname -r +4.15.0-54-generic +``` + +**注:** `-r` 代表 release,你可以使用 `man uname` 查看其他信息。 + +### 使用 GUI 查看 Linux Mint 版本信息 + +如果你对终端和命令行不满意,可以使用图形方法。如你所料,这个非常明了。 + +打开“菜单” (左下角),然后转到“偏好设置 > 系统信息”: + +![Linux Mint 菜单][10] + +或者,在菜单中,你可以搜索“System Info”: + +![Menu Search System Info][11] + +在这里,你可以看到你的操作系统(包括版本号),内核和桌面环境的版本号: + +![System Info][12] + +### 总结 + +我已经介绍了一些不同的方法,用这些方法你可以快速查看你正在使用的 Linux Mint 的版本和代号(以及所基于的 Ubuntu 版本和内核)。我希望这个初学者教程对你有所帮助。请在评论中告诉我们你最喜欢哪个方法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-linux-mint-version/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: tmp.pL5Hg3N6Qt#terminal +[2]: tmp.pL5Hg3N6Qt#GUI +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/check-linux-mint-version.png?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/hostnamectl.jpg?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/linuxmint_info.jpg?ssl=1 +[6]: https://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/os_release.jpg?ssl=1 +[8]: https://itsfoss.com/install-virtualbox-ubuntu/ +[9]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux_mint_menu.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/menu_search_system_info.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/system_info.png?ssl=1 diff --git a/published/201909/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md b/published/201909/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md new file mode 100644 index 0000000000..e8a658cebc --- /dev/null +++ b/published/201909/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (name1e5s) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11358-1.html) +[#]: subject: (Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President) +[#]: via: (https://itsfoss.com/richard-stallman-controversy/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Richard Stallman 被迫辞去 FSF 主席的职务 +====== + +> Richard Stallman,自由软件基金会的创建者以及主席,已经辞去主席及董事会职务。此前,因为 Stallman 对于爱泼斯坦事件中的受害者的观点,一小撮活动家以及媒体人发起了清除 Stallman 的运动。这份声明就是在这些活动后发生的。阅读全文以获得更多信息。 + +![][1] + +### Stallman 事件的背景概述 + +如果你不知道这次事件发生的前因后果,请看本段的详细信息。 + +[Richard Stallman][2],66岁,是就职于 [MIT][3] 的计算机科学家。他最著名的成就就是在 1983 年发起了[自由软件运动][4]。他也开发了 GNU 项目旗下的部分软件,比如 GCC 和 Emacs。受自由软件运动影响选择使用 GPL 开源协议的项目不计其数。Linux 是其中最出名的项目之一。 + +[Jeffrey Epstein][5](爱泼斯坦),美国亿万富翁,金融大佬。其涉嫌为社会上流精英提供性交易服务(其中有未成年少女)而被指控成为性犯罪者。在受审期间,爱泼斯坦在监狱中自杀身亡。 + +[Marvin Lee Minsky][6],MIT 知名计算机科学家。他在 MIT 建立了人工智能实验室。2016 年,88 岁的 Minsky 逝世。在 Minsky 逝世后,一位名为 Misky 的爱泼斯坦事件受害者声称其在未成年时曾被“诱导”到爱泼斯坦的私人岛屿,与之发生性关系。 + +但是这些与 Richard Stallman 有什么关系?这要从 Stallman 发给 MIT 计算机科学与人工智能实验室(CSAIL)的学生以及附属机构就爱泼斯坦的捐款提出抗议的邮件列表的邮件说起。邮件全文翻译如下: + +> 周五事件的公告对 Marvin Minsky 来说是不公正的。 +> +> “已故的人工智能 ‘先锋’ Marvin Minsky (被控告侵害了爱泼斯坦事件的受害者之一\[2])” +> +> 不公正之处在于 “侵害assulting” 这个用语。“性侵犯sexual assault” 这个用语非常的糢糊,夸大了指控的严重性:宣称某人做了 X 但误导别人,让别人觉得这个人做了 Y,Y 远远比 X 严重。 +> +> 上面引用的指控显然就是夸大。报导声称 Minksy 与爱泼斯坦的女眷harem之一发生了性关系(详见 )。我们假设这是真的(我找不到理由不相信)。 +> +> “侵害assulting” 这个词,意味着他使用了某种暴力。但那篇报道并没有提到这个,只说了他们发生了性关系。 +> +> 我们可以想像很多种情况,但最合理的情况是,她在 Marvin 面前表现的像是完全自愿的。假设她是被爱泼斯坦强迫的,那爱泼斯坦有充足的理由让她对大多数人守口如瓶。 +> +> 从各种的指控夸大事例中,我总结出,在指控时使用“性侵犯sexual assault”是绝对错误的。 +> +> 无论你想要批判什么行为,你都应该使用特定的词汇来描述,以此避免批判的本质的道德模糊性。 + +### “清除 Stallman” 的呼吁 + +‘爱泼斯坦’在美国是颇具争议的‘话题’。Stallman 对该敏感事件做出如此鲁莽的 “知识陈述” 不会有好结果,事实也是如此。 + +一位机器人学工程师从她的朋友那里收到了转发的邮件并发起了一个[清除 Stallman 的活动][7]。她要的不是澄清或者道歉,她只想要清除斯托曼,就算这意味着 “将 MIT 夷为平地” 也在所不惜。 + +> 是,至少 Stallman 没有被控强奸任何人。但这就是我们的最高标准吗?这所声望极高的学院坚持的标准就是这样的吗?如果这是麻省理工学院想要捍卫的、想要代表的标准的话,还不如把这破学校夷为平地… +> +> 如果有必要的话,就把所有人都清除出去,之后从废墟中建立出更好的秩序。 +> +> —— Salem,发起“清除 Stallman“运动的机器人学专业学生 + +Salem 的声讨最初没有被主流媒体重视。但它还是被反对软件行业内的精英崇拜以及性别偏见的积极分子发现了。 + +> [#epstein][8] [#MIT][9] 嗨 记者没有回复我我很生气就自己写了这么个故事。作为 MIT 的校友我还真是高兴啊🙃 +> +> — SZJG (@selamjie) [September 12, 2019][10] + +. + +> 是不是对于性侵儿童的 “杰出混蛋” 我们也可以辩护说 “万一这是你情我愿的” +> +> — Tracy Chou 👩🏻‍💻 (@triketora) [September 13, 2019][11] + +. + +> 多年来我就一直发推说 Richard "RMS" Stallman 这人有多恶心 —— 恋童癖、厌女症、还残障歧视 +> +> 不可避免的是,每次我这样做,都会有老哥检查我的数据来源,然后说 “这都是几年前的事了!他现在变了!” +> +> 变个屁。 +> +> — Sarah Mei (@sarahmei) [September 12, 2019][12] + +下面是 Sage Sharp 开头的一篇关于 Stallman 的行为如何对科技人员产生负面影响的帖子: + +> 👇大家说下 Richard Stallman 对科技从业者的影响吧,尤其是女性。 [例如: 强奸、乱伦、残障歧视、性交易] +> +> [@fsf][13] 有必要永久禁止 Richard Stallman 担任自由软件基金会董事会主席。 +> +> — Sage Sharp (@\_sagesharp\_) [September 16, 2019][14] + +Stallman 一直以来也不是一个圣人。他粗暴,不合时宜、多年来一直在开带有性别歧视的笑话。你可以在[这里][15]和[这里][16]读到。 + +很快这个消息就被 [The Vice][17]、[每日野兽][18],[未来主义][19]等大媒体采访。他们把 Stallman 描绘成爱泼斯坦的捍卫者。在强烈的抗议声中,[GNOME 执行董事威胁要结束 GNOME 和 FSF 之间的关系][20]。 + +最后,Stallman 先是从 MIT 辞职,现在又从 [自由软件基金会][21] 辞职。 + +![][22] + +### 危险的特权? + +我们见识到了,把一个人从他创建并为之工作了三十多年的组织中驱逐出去仅仅需要五天。这甚至还是在 Stallman 没有参与性交易丑闻的情况下。 + +其中一些 “活动家” 过去也曾[针对过 Linux 的作者 Linus Torvalds][23]。Linux 基金会背后的管理层预见到了科技行业激进主义的增长趋势,因此他们制定了[适用于 Linux 内核开发的行为准则][24]并[强制 Torvalds 接受培训以改善他的行为][25]。如果他们没有采取纠正措施,可能 Torvalds 也已经被批倒批臭了。 + +忽视技术支持者的鲁莽行为和性别歧视是不可接受的,但是对于那些遇到不同意某种流行观点的人就进行声讨,施以私刑也是不道德的做法。我不支持 Stallman 和他过去的言论,但我也不能接受他以这种方式(被迫?)辞职。 + +Techrights 对此有一些有趣的评论,你可以在[这里][26]和[这里][27]看到。 + +*你对此事有何看法?请文明分享你的观点和意见。过激评论将不会公布。* + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/richard-stallman-controversy/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[name1e5s](https://github.com/name1e5s) +校对:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/stallman-conroversy.png?w=800&ssl=1 +[2]: https://en.wikipedia.org/wiki/Richard_Stallman +[3]: https://en.wikipedia.org/wiki/Massachusetts_Institute_of_Technology +[4]: https://en.wikipedia.org/wiki/Free_software_movement +[5]: https://en.wikipedia.org/wiki/Jeffrey_Epstein +[6]: https://en.wikipedia.org/wiki/Marvin_Minsky +[7]: https://medium.com/@selamie/remove-richard-stallman-fec6ec210794 +[8]: https://twitter.com/hashtag/epstein?src=hash&ref_src=twsrc%5Etfw +[9]: https://twitter.com/hashtag/MIT?src=hash&ref_src=twsrc%5Etfw +[10]: https://twitter.com/selamjie/status/1172244207978897408?ref_src=twsrc%5Etfw +[11]: https://twitter.com/triketora/status/1172443389536555009?ref_src=twsrc%5Etfw +[12]: https://twitter.com/sarahmei/status/1172283772428906496?ref_src=twsrc%5Etfw +[13]: https://twitter.com/fsf?ref_src=twsrc%5Etfw +[14]: https://twitter.com/_sagesharp_/status/1173637138413318144?ref_src=twsrc%5Etfw +[15]: https://geekfeminism.wikia.org/wiki/Richard_Stallman +[16]: https://medium.com/@selamie/remove-richard-stallman-appendix-a-a7e41e784f88 +[17]: https://www.vice.com/en_us/article/9ke3ke/famed-computer-scientist-richard-stallman-described-epstein-victims-as-entirely-willing +[18]: https://www.thedailybeast.com/famed-mit-computer-scientist-richard-stallman-defends-epstein-victims-were-entirely-willing +[19]: https://futurism.com/richard-stallman-epstein-scandal +[20]: https://blog.halon.org.uk/2019/09/gnome-foundation-relationship-gnu-fsf/ +[21]: https://www.fsf.org/news/richard-m-stallman-resigns +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/richard-stallman.png?resize=800%2C94&ssl=1 +[23]: https://www.newyorker.com/science/elements/after-years-of-abusive-e-mails-the-creator-of-linux-steps-aside +[24]: https://itsfoss.com/linux-code-of-conduct/ +[25]: https://itsfoss.com/torvalds-takes-a-break-from-linux/ +[26]: http://techrights.org/2019/09/15/media-attention-has-been-shifted/ +[27]: http://techrights.org/2019/09/16/stallman-removed/ diff --git a/published/201909/20190918 How to remove carriage returns from text files on Linux.md b/published/201909/20190918 How to remove carriage returns from text files on Linux.md new file mode 100644 index 0000000000..2f746068d7 --- /dev/null +++ b/published/201909/20190918 How to remove carriage returns from text files on Linux.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11389-1.html) +[#]: subject: (How to remove carriage returns from text files on Linux) +[#]: via: (https://www.networkworld.com/article/3438857/how-to-remove-carriage-returns-from-text-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 中删除文本中的回车字符 +====== + +> 当回车字符(`Ctrl+M`)让你紧张时,别担心。有几种简单的方法消除它们。 + +![](https://img.linux.net.cn/data/attachment/album/201909/25/214211xenk2dqfepx3xemm.jpg) + +“回车”字符可以往回追溯很长一段时间 —— 早在打字机上就有一个机械装置或杠杆将承载纸滚筒的机架移到右边,以便可以重新在左侧输入字母。他们在 Windows 上的文本文件上保留了它,但从未在 Linux 系统上使用过。当你尝试在 Linux 上处理在 Windows 上创建的文件时,这种不兼容性有时会导致问题,但这是一个非常容易解决的问题。 + +如果你使用 `od`(八进制转储octal dump)命令查看文件,那么回车(也用 `Ctrl+M` 代表)字符将显示为八进制的 15。字符 `CRLF` 通常用于表示 Windows 文本文件中的一行结束的回车符和换行符序列。那些注意看八进制转储的会看到 `\r\n`。相比之下,Linux 文本仅以换行符结束。 + +这有一个 `od` 输出的示例,高亮显示了行中的 `CRLF` 字符,以及它的八进制。 + +``` +$ od -bc testfile.txt +0000000 124 150 151 163 040 151 163 040 141 040 164 145 163 164 040 146 + T h i s i s a t e s t f +0000020 151 154 145 040 146 162 157 155 040 127 151 156 144 157 167 163 + i l e f r o m W i n d o w s +0000040 056 015 012 111 164 047 163 040 144 151 146 146 145 162 145 156 <== + . \r \n I t ' s d i f f e r e n <== +0000060 164 040 164 150 141 156 040 141 040 125 156 151 170 040 164 145 + t t h a n a U n i x t e +0000100 170 164 040 146 151 154 145 015 012 167 157 165 154 144 040 142 <== + x t f i l e \r \n w o u l d b <== +``` + +虽然这些字符不是大问题,但是当你想要以某种方式解析文本,并且不希望就它们是否存在进行编码时,这有时候会产生干扰。 + +### 3 种从文本中删除回车符的方法 + +幸运的是,有几种方法可以轻松删除回车符。这有三个选择: + +#### dos2unix + +你可能会在安装时遇到麻烦,但 `dos2unix` 可能是将 Windows 文本转换为 Unix/Linux 文本的最简单方法。一个命令带上一个参数就行了。不需要第二个文件名。该文件会被直接更改。 + +``` +$ dos2unix testfile.txt +dos2unix: converting file testfile.txt to Unix format... +``` + +你应该会发现文件长度减少,具体取决于它包含的行数。包含 100 行的文件可能会缩小 99 个字符,因为只有最后一行不会以 `CRLF` 字符结尾。 + +之前: + +``` +-rw-rw-r-- 1 shs shs 121 Sep 14 19:11 testfile.txt +``` + +之后: + +``` +-rw-rw-r-- 1 shs shs 118 Sep 14 19:12 testfile.txt +``` + +如果你需要转换大量文件,不用每次修复一个。相反,将它们全部放在一个目录中并运行如下命令: + +``` +$ find . -type f -exec dos2unix {} \; +``` + +在此命令中,我们使用 `find` 查找常规文件,然后运行 `dos2unix` 命令一次转换一个。命令中的 `{}` 将被替换为文件名。运行时,你应该处于包含文件的目录中。此命令可能会损坏其他类型的文件,例如除了文本文件外在上下文中包含八进制 15 的文件(如,镜像文件中的字节)。 + +#### sed + +你还可以使用流编辑器 `sed` 来删除回车符。但是,你必须提供第二个文件名。以下是例子: + +``` +$ sed -e “s/^M//” before.txt > after.txt +``` + +一件需要注意的重要的事情是,请不要输入你看到的字符。你必须按下 `Ctrl+V` 后跟 `Ctrl+M` 来输入 `^M`。`s` 是替换命令。斜杠将我们要查找的文本(`Ctrl + M`)和要替换的文本(这里为空)分开。 + +#### vi + +你甚至可以使用 `vi` 删除回车符(`Ctrl+M`),但这里假设你没有打开数百个文件,或许也在做一些其他的修改。你可以键入 `:` 进入命令行,然后输入下面的字符串。与 `sed` 一样,命令中 `^M` 需要通过 `Ctrl+V` 输入 `^`,然后 `Ctrl+M` 插入 `M`。`%s` 是替换操作,斜杠再次将我们要删除的字符和我们想要替换它的文本(空)分开。 `g`(全局)意味在所有行上执行。 + +``` +:%s/^M//g +``` + +### 总结 + +`dos2unix` 命令可能是最容易记住的,也是从文本中删除回车的最可靠的方法。其他选择使用起来有点困难,但它们提供相同的基本功能。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438857/how-to-remove-carriage-returns-from-text-files-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/kmsiever/5895380540/in/photolist-9YXnf5-cNmpxq-2KEvib-rfecPZ-9snnkJ-2KAcDR-dTxzKW-6WdgaG-6H5i46-2KzTZX-7cnSw7-e3bUdi-a9meh9-Zm3pD-xiFhs-9Hz6YM-ar4DEx-4PXAhw-9wR4jC-cihLcs-asRFJc-9ueXvG-aoWwHq-atwL3T-ai89xS-dgnntH-5en8Te-dMUDd9-aSQVn-dyZqij-cg4SeS-abygkg-f2umXt-Xk129E-4YAeNn-abB6Hb-9313Wk-f9Tot-92Yfva-2KA7Sv-awSCtG-2KDPzb-eoPN6w-FE9oi-5VhaNf-eoQgx7-eoQogA-9ZWoYU-7dTGdG-5B1aSS +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md b/published/201909/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md new file mode 100644 index 0000000000..4063ab4778 --- /dev/null +++ b/published/201909/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11375-1.html) +[#]: subject: (Microsoft brings IBM iron to Azure for on-premises migrations) +[#]: via: (https://www.networkworld.com/article/3438904/microsoft-brings-ibm-iron-to-azure-for-on-premises-migrations.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Skytap 和微软将 IBM 机器搬到了 Azure +====== + +> 微软再次证明了其摒弃了“非我发明”这一态度来支持客户。 + +![](https://images.idgesg.net/images/article/2019/05/cso_microsoft_azure_backups_cloud_computing_binary_data_transfer_by_just_super_gettyimages-1003878434_3x2_2400x1600-100796537-large.jpg) + +当微软将 Azure 作为其 Windows 服务器操作系统的云计算版本发布时,它并没有使其成为仅支持 Windows 系统的版本,它还支持 Linux 系统,并且在短短几年内[其 Linux 实例的数量现在已经超过了Windows 实例的数量][1]。 + +很高兴看到微软终于摆脱了这种长期以来非常有害的“非我发明”态度,该公司的最新举动确实令人惊讶。 + +微软与一家名为 Skytap 的公司合作,以在 Azure 云服务上提供 IBM Power9 实例,可以在 Azure 云内运行基于 Power 的系统,该系统将与其已有的 Xeon 和 Epyc 实例一同作为 Azure 的虚拟机(VM)。 + +Skytap 是一家有趣的公司。它由华盛顿大学的三位教授创立,专门研究本地遗留硬件的云迁移,如 IBM System I 或 Sparc 的云迁移。该公司在西雅图拥有一个数据中心,以 IBM 的硬件运行 IBM 的 PowerVM 管理程序,并且对在美国和英格兰的 IBM 数据中心提供主机托管。 + +该公司的座右铭是快速迁移,然后按照自己的节奏进行现代化。因此,它专注于帮助一些企业将遗留系统迁移到云,然后实现应用程序的现代化,这也是它与微软合作的目的。Azure 将通过为企业提供平台来提高传统应用程序的价值,而无需花费巨额费用重写一个新平台。 + +Skytap 提供了预览,可以看到使用 Skytap 上的 DB2 提升和扩展原有的 IBM i 应用程序以及通过 Azure 的物联网中心进行扩展时可能发生的情况。该应用程序无缝衔接新旧架构,并证明了不需要完全重写可靠的 IBM i 应用程序即可从现代云功能中受益。 + +### 迁移到 Azure + +根据协议,微软将把 IBM 的 Power S922 服务器部署在一个未声明的 Azure 区域。这些机器可以运行 PowerVM 管理程序,这些管理程序支持老式 IBM 操作系统以及 Linux 系统。 + +Skytap 首席执行官布拉德·希克Brad Schick在一份声明中说道:“通过先替换旧技术来迁移上云既耗时又冒险。……Skytap 的愿景一直是通过一些小小的改变和较低的风险实现企业系统到云平台的迁移。与微软合作,我们将为各种遗留应用程序迁移到 Azure 提供本地支持,包括那些在 IBM i、AIX 和 Power Linux 上运行的程序。这将使企业能够通过使用 Azure 服务进行现代化来延长传统系统的寿命并增加其价值。” + +随着基于 Power 应用程序的现代化,Skytap 随后将引入 DevOps CI/CD 工具链来加快软件的交付。迁移到 Azure 的 Skytap 上后,客户将能够集成 Azure DevOps,以及 Power 的 CI/CD 工具链,例如 Eradani 和 UrbanCode。 + +这些听起来像是迈出了第一步,但这意味着以后将会实现更多,尤其是在应用程序迁移方面。如果它仅在一个 Azure 区域中,听起来好像它们正在对该项目进行测试和验证,并可能在今年晚些时候或明年进行扩展。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438904/microsoft-brings-ibm-iron-to-azure-for-on-premises-migrations.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.openwall.com/lists/oss-security/2019/06/27/7 +[2]: https://www.networkworld.com/article/3119362/hybrid-cloud/how-to-make-hybrid-cloud-work.html#tk.nww-fsb +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/201909/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md b/published/201909/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md new file mode 100644 index 0000000000..8721fea8c8 --- /dev/null +++ b/published/201909/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11366-1.html) +[#]: subject: (Oracle Unleashes World’s Fastest Database Machine ‘Exadata X8M’) +[#]: via: (https://opensourceforu.com/2019/09/oracle-unleashes-worlds-fastest-database-machine-exadata-x8m/) +[#]: author: (Longjam Dineshwori https://opensourceforu.com/author/dineshwori-longjam/) + +Oracle 发布全球最快的数据库机器 Exadata X8M +====== + +> Exadata X8M 是第一台具有集成持久内存和 RoCE 的数据库机器。Oracle 还宣布推出 Oracle 零数据丢失恢复设备 X8M(ZDLRA)。 + +![](https://img.linux.net.cn/data/attachment/album/201909/20/191530qiyvvxl8qqcov8xq.jpg) + +Oracle 发布了新的 Exadata 数据库机器 X8M,旨在为数据库基础架构市场树立新的标杆。 + +Exadata X8M 结合了英特尔 Optane DC 持久存储器和通过融合以太网(RoCE)的 100 千兆的远程直接内存访问(RDMA)来消除存储瓶颈,并显著提高性能,其适用于最苛刻的工作负载,如在线事务处理(OLTP)、分析、物联网、欺诈检测和高频交易。 + +“借助 Exadata X8M,我们可以提供内存级的性能,同时为 OLTP 和分析提供共享存储的所有优势,”Oracle 任务关键型数据库技术执行副总裁 Juan Loaiza 说。 + +“使用对共享持久存储器的直接数据库访问将响应时间减少一个数量级,可加速每个 OLTP 应用程序,它是需要实时访问大量数据的应用程序的游戏规则改变者,例如欺诈检测和个性化购物,”官方补充。 + +### 它有什么独特之处? + +Oracle Exadata X8M 使用 RDMA 让数据库直接访问智能存储服务器中的持久内存,从而绕过整个操作系统、IO 和网络软件堆栈。这导致更低的延迟和更高的吞吐量。使用 RDMA 绕过软件堆栈还可以释放存储服务器上的 CPU 资源,以执行更多智能扫描查询来支持分析工作负载。 + +### 更少的存储瓶颈 + +“高性能 OLTP 应用需要高的每秒输入/输出操作(IOPS)和低延迟。直接数据库访问共享持久性内存可将SQL 读取的峰值性能提升至 1600 万 IOPS,比行业领先的 Exadata X8 高出 2.5 倍,“Oracle 在一份声明中表示。 + +此外,Exadata X8M 通过使远程 IO 延迟低于 19 微秒,大大减少了关键数据库 IO 的延迟 —— 这比 Exadata X8 快 10 倍以上。即使对于每秒需要数百万 IO 的工作负载,也可实现这些超低延迟。 + +### 比 AWS 和 Azure 更高效 + +该公司声称,与 Oracle 最快的 Amazon RDS 存储相比,Exadata X8M 的延迟降低了 50 倍,IOPS 提高了 200 倍,容量提高了 15 倍。 + +与 Azure SQL 数据库服务存储相比,Exadata X8M 的延迟降低了 100 倍,IOPS 提高了 150 倍,容量提高了 300 倍。 + +据 Oracle 称,单机架 Exadata X8M 可提供高达 2 倍的 OLTP 读取 IOPS,3 倍的吞吐量和比具有持久性内存的共享存储系统(如 Dell EMC PowerMax 8000 的单机架)低 5 倍的延迟。 + +“通过同时支持更快的 OLTP 查询和更高的分析工作负载吞吐量,Exadata X8M 是融合混合工作负载环境以降低 IT 成本和复杂性的理想平台,”该公司说。 + +### Oracle 零数据丢失恢复设备 X8 + +Oracle 当天还宣布推出 Oracle 零数据丢失恢复设备 X8M(ZDLRA),它使用新的 100Gb RoCE,用于计算和存储服务器之间的高吞吐量内部数据传输。 + +Exadata 和 ZDLRA 客户现在可以在 RoCE 或基于 InfiniBand 的工程系统之间进行选择,以在其架构部署中实现最佳灵活性。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/oracle-unleashes-worlds-fastest-database-machine-exadata-x8m/ + +作者:[Longjam Dineshwori][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://opensourceforu.com/author/dineshwori-longjam/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/02/Oracle-Cloud.jpg?resize=350%2C212&ssl=1 diff --git a/published/201909/20190921 How to Remove (Delete) Symbolic Links in Linux.md b/published/201909/20190921 How to Remove (Delete) Symbolic Links in Linux.md new file mode 100644 index 0000000000..bbe57011eb --- /dev/null +++ b/published/201909/20190921 How to Remove (Delete) Symbolic Links in Linux.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (arrowfeng) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11382-1.html) +[#]: subject: (How to Remove (Delete) Symbolic Links in Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 中怎样移除(删除)符号链接 +====== + +你可能有时需要在 Linux 上创建或者删除符号链接。如果有,你知道该怎样做吗?之前你做过吗?你踩坑没有?如果你踩过坑,那没什么问题。如果还没有,别担心,我们将在这里帮助你。 + +使用 `rm` 和 `unlink` 命令就能完成移除(删除)符号链接的操作。 + +### 什么是符号链接? + +符号链接(symlink)又称软链接,它是一种特殊的文件类型,在 Linux 中该文件指向另一个文件或者目录。它类似于 Windows 中的快捷方式。它能在相同或者不同的文件系统或分区中指向一个文件或着目录。 + +符号链接通常用来链接库文件。它也可用于链接日志文件和挂载的 NFS(网络文件系统)上的文件夹。 + +### 什么是 rm 命令? + +[rm 命令][1] 被用来移除文件和目录。它非常危险,你每次使用 `rm` 命令的时候要非常小心。 + +### 什么是 unlink 命令? + +`unlink` 命令被用来移除特殊的文件。它被作为 GNU Gorutils 的一部分安装了。 + +### 1) 使用 rm 命令怎样移除符号链接文件 + +`rm` 命令是在 Linux 中使用最频繁的命令,它允许我们像下列描述那样去移除符号链接。 + +``` +# rm symlinkfile +``` + +始终将 `rm` 命令与 `-i` 一起使用以了解正在执行的操作。 + +``` +# rm -i symlinkfile1 +rm: remove symbolic link ‘symlinkfile1’? y +``` + +它允许我们一次移除多个符号链接: + +``` +# rm -i symlinkfile2 symlinkfile3 + +rm: remove symbolic link ‘symlinkfile2’? y +rm: remove symbolic link ‘symlinkfile3’? y +``` + +#### 1a) 使用 rm 命令怎样移除符号链接目录 + +这像移除符号链接文件那样。使用下列命令移除符号链接目录。 + +``` +# rm -i symlinkdir + +rm: remove symbolic link ‘symlinkdir’? y +``` + +使用下列命令移除多个符号链接目录。 + +``` +# rm -i symlinkdir1 symlinkdir2 + +rm: remove symbolic link ‘symlinkdir1’? y +rm: remove symbolic link ‘symlinkdir2’? y +``` + +如果你在结尾增加 `/`,这个符号链接目录将不会被删除。如果你加了,你将得到一个错误。 + +``` +# rm -i symlinkdir/ + +rm: cannot remove ‘symlinkdir/’: Is a directory +``` + +你可以增加 `-r` 去处理上述问题。**但如果你增加这个参数,它将会删除目标目录下的内容,并且它不会删除这个符号链接文件。**(LCTT 译注:这可能不是你的原意。) + +``` +# rm -ri symlinkdir/ + +rm: descend into directory ‘symlinkdir/’? y +rm: remove regular file ‘symlinkdir/file4.txt’? y +rm: remove directory ‘symlinkdir/’? y +rm: cannot remove ‘symlinkdir/’: Not a directory +``` + +### 2) 使用 unlink 命令怎样移除符号链接 + +`unlink` 命令删除指定文件。它一次仅接受一个文件。 + +删除符号链接文件: + +``` +# unlink symlinkfile +``` + +删除符号链接目录: + +``` +# unlink symlinkdir2 +``` + +如果你在结尾增加 `/`,你不能使用 `unlink` 命令删除符号链接目录。 + +``` +# unlink symlinkdir3/ + +unlink: cannot unlink ‘symlinkdir3/’: Not a directory +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[arrowfeng](https://github.com/arrowfeng) +校对:[wxy](https://github.com/wxy) + +本文由 [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/linux-remove-files-directories-folders-rm-command/ diff --git a/published/201909/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md b/published/201909/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md new file mode 100644 index 0000000000..5390aee222 --- /dev/null +++ b/published/201909/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11370-1.html) +[#]: subject: (Oracle Autonomous Linux: A Self Updating, Self Patching Linux Distribution for Cloud Computing) +[#]: via: (https://itsfoss.com/oracle-autonomous-linux/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Oracle Autonomous Linux:用于云计算的自我更新、自我修补的 Linux 发行版 +====== + +自动化是 IT 行业的增长趋势,其目的是消除重复任务中的手动干扰。Oracle 通过推出 Oracle Autonomous Linux 向自动化世界迈出了又一步,这无疑将使 IoT 和云计算行业受益。 + +### Oracle Autonomous Linux:减少人工干扰,增多自动化 + +![][1] + +周一,Oracle 联合创始人拉里·埃里森Larry Ellison参加了在旧金山举行的Oracle OpenWorld 全球大会。[他宣布了][2]一个新产品:世界上第一个自治 Linux。这是 Oracle 向第二代云迈进的第二步。第一步是两年前发布的 [Autonomous Database][3]。 + +Oracle Autonomous Linux 的最大特性是降低了维护成本。根据 [Oracle 网站][4] 所述,Autonomous Linux “使用先进的机器学习和自治功能来提供前所未有的成本节省、安全性和可用性,并释放关键的 IT 资源来应对更多的战略计划”。 + +Autonomous Linux 可以无需人工干预就安装更新和补丁。这些自动更新包括 “Linux 内核和关键用户空间库”的补丁。“不需要停机,而且可以免受外部攻击和内部恶意用户的攻击。”它们也可以在系统运行时进行,以减少停机时间。Autonomous Linux 还会自动处理伸缩,以确保满足所有计算需求。 + +埃里森强调了新的自治系统将如何提高安全性。他特别提到了 [Capitol One 数据泄露][5]是由于配置错误而发生的。他说:“一个防止数据被盗的简单规则:将数据放入自治系统。没有人为错误,没有数据丢失。 那是我们与 AWS 之间的最大区别。” + +有趣的是,Oracle 还瞄准了这一新产品以与 IBM 竞争。埃里森说:“如果你付钱给 IBM,可以停了。”所有 Red Hat 应用程序都应该能够在 Autonomous Linux 上运行而无需修改。有趣的是,Oracle Linux 是从 Red Hat Enterprise Linux 的源代码中[构建][6]的。 + +看起来,Oracle Autonomous Linux 不会用于企业市场以外。 + +### 关于 Oracle Autonomous Linux 的思考 + +Oracle 是云服务市场的重要参与者。这种新的 Linux 产品将使其能够与 IBM 竞争。让人感兴趣的是 IBM 的反应会是如何,特别是当他们有来自 Red Hat 的新一批开源智能软件。 + +如果你看一下市场数字,那么对于 IBM 或 Oracle 来说情况都不好。大多数云业务由 [Amazon Web Services、Microsoft Azure 和 Google Cloud Platform][7] 所占据。IBM 和 Oracle 落后于他们。[IBM 收购 Red Hat][8] 试图获得发展。这项新的自主云计划是 Oracle 争取统治地位(或至少试图获得更大的市场份额)的举动。让人感兴趣的是,到底有多少公司因为购买了 Oracle 的系统而在互联网的狂野西部变得更加安全? + +我必须简单提一下:当我第一次阅读该公告时,我的第一反应就是“好吧,我们离天网更近了一步。”如果我们技术性地考虑一下,我们就像是要进入了机器人末日。如果你打算帮我,我计划去购买一些罐头食品。 + +你对 Oracle 的新产品感兴趣吗?你会帮助他们赢得云战争吗?在下面的评论中让我们知道。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][9] 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/oracle-autonomous-linux/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/oracle-autonomous-linux.png?resize=800%2C450&ssl=1 +[2]: https://www.zdnet.com/article/oracle-announces-oracle-autonomous-linux/ +[3]: https://www.oracle.com/in/database/what-is-autonomous-database.html +[4]: https://www.oracle.com/corporate/pressrelease/oow19-oracle-autonomous-linux-091619.html +[5]: https://www.zdnet.com/article/100-million-americans-and-6-million-canadians-caught-up-in-capital-one-breach/ +[6]: https://distrowatch.com/table.php?distribution=oracle +[7]: https://www.zdnet.com/article/top-cloud-providers-2019-aws-microsoft-azure-google-cloud-ibm-makes-hybrid-move-salesforce-dominates-saas/ +[8]: https://itsfoss.com/ibm-red-hat-acquisition/ +[9]: https://reddit.com/r/linuxusersgroup diff --git a/published/201909/20190923 Getting started with data science using Python.md b/published/201909/20190923 Getting started with data science using Python.md new file mode 100644 index 0000000000..319331fadc --- /dev/null +++ b/published/201909/20190923 Getting started with data science using Python.md @@ -0,0 +1,312 @@ +[#]: collector: (lujun9972) +[#]: translator: (GraveAccent) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11406-1.html) +[#]: subject: (Getting started with data science using Python) +[#]: via: (https://opensource.com/article/19/9/get-started-data-science-python) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Python 入门数据科学 +====== + +> 使用 Python 开展数据科学为你提供了无限的潜力,使你能够以有意义和启发性的方式解析、解释和组织数据。 + +![](https://img.linux.net.cn/data/attachment/album/201909/30/001853sfkm07j7wfp94dzp.jpg) + +数据科学是计算领域一个令人兴奋的新领域,它围绕分析、可视化和关联以解释我们的计算机收集的有关世界的无限信息而建立。当然,称其为“新”领域有点不诚实,因为该学科是统计学、数据分析和普通而古老的科学观察派生而来的。 + +但是数据科学是这些学科的形式化分支,拥有自己的流程和工具,并且可以广泛应用于以前从未产生过大量不可管理数据的学科(例如视觉效果)。数据科学是一个新的机会,可以重新审视海洋学、气象学、地理学、制图学、生物学、医学和健康以及娱乐行业的数据,并更好地了解其中的模式、影响和因果关系。 + +像其他看似包罗万象的大型领域一样,知道从哪里开始探索数据科学可能会令人生畏。有很多资源可以帮助数据科学家使用自己喜欢的编程语言来实现其目标,其中包括最流行的编程语言之一:Python。使用 [Pandas][2]、[Matplotlib][3] 和 [Seaborn][4] 这些库,你可以学习数据科学的基本工具集。 + +如果你对 Python 的基本用法不是很熟悉,请在继续之前先阅读我的 [Python 介绍][5]。 + +### 创建 Python 虚拟环境 + +程序员有时会忘记在开发计算机上安装了哪些库,这可能导致他们提供了在自己计算机上可以运行,但由于缺少库而无法在所有其它电脑上运行的代码。Python 有一个系统旨在避免这种令人不快的意外:虚拟环境。虚拟环境会故意忽略你已安装的所有 Python 库,从而有效地迫使你一开始使用通常的 Python 进行开发。 + +为了用 `venv` 激活虚拟环境, 为你的环境取个名字 (我会用 `example`) 并且用下面的指令创建它: + +``` +$ python3 -m venv example +``` + +导入source该环境的 `bin` 目录里的 `activate` 文件以激活它: + +``` +$ source ./example/bin/activate +(example) $ +``` + +你现在“位于”你的虚拟环境中。这是一个干净的状态,你可以在其中构建针对该问题的自定义解决方案,但是额外增加了需要有意识地安装依赖库的负担。 + +### 安装 Pandas 和 NumPy + +你必须在新环境中首先安装的库是 Pandas 和 NumPy。这些库在数据科学中很常见,因此你肯定要时不时安装它们。它们也不是你在数据科学中唯一需要的库,但是它们是一个好的开始。 + +Pandas 是使用 BSD 许可证的开源库,可轻松处理数据结构以进行分析。它依赖于 NumPy,这是一个提供多维数组、线性代数和傅立叶变换等等的科学库。使用 `pip3` 安装两者: + +``` +(example) $ pip3 install pandas +``` + +安装 Pandas 还会安装 NumPy,因此你无需同时指定两者。一旦将它们安装到虚拟环境中,安装包就会被缓存,这样,当你再次安装它们时,就不必从互联网上下载它们。 + +这些是你现在仅需的库。接下来,你需要一些样本数据。 + +### 生成样本数据集 + +数据科学都是关于数据的,幸运的是,科学、计算和政府组织可以提供许多免费和开放的数据集。虽然这些数据集是用于教育的重要资源,但它们具有比这个简单示例所需的数据更多的数据。你可以使用 Python 快速创建示例和可管理的数据集: + +```python +#!/usr/bin/env python3 + +import random + +def rgb(): +    NUMBER=random.randint(0,255)/255 +    return NUMBER + +FILE = open('sample.csv','w') +FILE.write('"red","green","blue"') +for COUNT in range(10): +    FILE.write('\n{:0.2f},{:0.2f},{:0.2f}'.format(rgb(),rgb(),rgb())) +``` + +这将生成一个名为 `sample.csv` 的文件,该文件由随机生成的浮点数组成,这些浮点数在本示例中表示 RGB 值(在视觉效果中通常是数百个跟踪值)。你可以将 CSV 文件用作 Pandas 的数据源。 + +### 使用 Pandas 提取数据 + +Pandas 的基本功能之一是可以提取数据和处理数据,而无需程序员编写仅用于解析输入的新函数。如果你习惯于自动执行此操作的应用程序,那么这似乎不是很特别,但请想象一下在 [LibreOffice][6] 中打开 CSV 并且必须编写公式以在每个逗号处拆分值。Pandas 可以让你免受此类低级操作的影响。以下是一些简单的代码,可用于提取和打印以逗号分隔的值的文件: + +```python +#!/usr/bin/env python3 + +from pandas import read_csv, DataFrame +import pandas as pd + +FILE = open('sample.csv','r') +DATAFRAME = pd.read_csv(FILE) +print(DATAFRAME) +``` + +一开始的几行导入 Pandas 库的组件。Pandas 库功能丰富,因此在寻找除本文中基本功能以外的功能时,你会经常参考它的文档。 + +接下来,通过打开你创建的 `sample.csv` 文件创建变量 `FILE`。Pandas 模块 `read_csv`(在第二行中导入)使用该变量来创建数据帧dataframe。在 Pandas 中,数据帧是二维数组,通常可以认为是表格。数据放入数据帧中后,你可以按列和行进行操作,查询其范围,然后执行更多操作。目前,示例代码仅将该数据帧输出到终端。 + +运行代码。你的输出会和下面的输出有些许不同,因为这些数字都是随机生成的,但是格式都是一样的。 + +``` +(example) $ python3 ./parse.py +    red  green  blue +0  0.31   0.96  0.47 +1  0.95   0.17  0.64 +2  0.00   0.23  0.59 +3  0.22   0.16  0.42 +4  0.53   0.52  0.18 +5  0.76   0.80  0.28 +6  0.68   0.69  0.46 +7  0.75   0.52  0.27 +8  0.53   0.76  0.96 +9  0.01   0.81  0.79 +``` + +假设你只需要数据集中的红色值(`red`),你可以通过声明数据帧的列名称并有选择地仅打印你感兴趣的列来做到这一点: + +```python +from pandas import read_csv, DataFrame +import pandas as pd + +FILE = open('sample.csv','r') +DATAFRAME = pd.read_csv(FILE) + +# define columns +DATAFRAME.columns = [ 'red','green','blue' ] + +print(DATAFRAME['red']) +``` + +现在运行代码,你只会得到红色列: + +``` +(example) $ python3 ./parse.py +0    0.31 +1    0.95 +2    0.00 +3    0.22 +4    0.53 +5    0.76 +6    0.68 +7    0.75 +8    0.53 +9    0.01 +Name: red, dtype: float64 +``` + +处理数据表是经常使用 Pandas 解析数据的好方法。从数据帧中选择数据的方法有很多,你尝试的次数越多就越习惯。 + +### 可视化你的数据 + +很多人偏爱可视化信息已不是什么秘密,这是图表和图形成为与高层管理人员开会的主要内容的原因,也是“信息图”在新闻界如此流行的原因。数据科学家的工作之一是帮助其他人理解大量数据样本,并且有一些库可以帮助你完成这项任务。将 Pandas 与可视化库结合使用可以对数据进行可视化解释。一个流行的可视化开源库是 [Seaborn][7],它基于开源的 [Matplotlib][3]。 + +#### 安装 Seaborn 和 Matplotlib + +你的 Python 虚拟环境还没有 Seaborn 和 Matplotlib,所以用 `pip3` 安装它们。安装 Seaborn 的时候,也会安装 Matplotlib 和很多其它的库。 + +``` +(example) $ pip3 install seaborn +``` + +为了使 Matplotlib 显示图形,你还必须安装 [PyGObject][8] 和 [Pycairo][9]。这涉及到编译代码,只要你安装了必需的头文件和库,`pip3` 便可以为你执行此操作。你的 Python 虚拟环境不了解这些依赖库,因此你可以在环境内部或外部执行安装命令。 + +在 Fedora 和 CentOS 上: + +``` +(example) $ sudo dnf install -y gcc zlib-devel bzip2 bzip2-devel readline-devel \ +sqlite sqlite-devel openssl-devel tk-devel git python3-cairo-devel \ +cairo-gobject-devel gobject-introspection-devel +``` + +在 Ubuntu 和 Debian 上: + +``` +(example) $ sudo apt install -y libgirepository1.0-dev build-essential \ +libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget \ +curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libcairo2-dev +``` + +一旦它们安装好了,你可以安装 Matplotlib 需要的 GUI 组件。 + +``` +(example) $ pip3 install PyGObject pycairo +``` + +### 用 Seaborn 和 Matplotlib 显示图形 + +在你最喜欢的文本编辑器新建一个叫 `vizualize.py` 的文件。要创建数据的线形图可视化,首先,你必须导入必要的 Python 模块 —— 先前代码示例中使用的 Pandas 模块: + +```python +#!/usr/bin/env python3 + +from pandas import read_csv, DataFrame +import pandas as pd +``` + +接下来,导入 Seaborn、Matplotlib 和 Matplotlib 的几个组件,以便你可以配置生成的图形: + +```python +import seaborn as sns +import matplotlib +import matplotlib.pyplot as plt +from matplotlib import rcParams +``` + +Matplotlib 可以将其输出导出为多种格式,包括 PDF、SVG 和桌面上的 GUI 窗口。对于此示例,将输出发送到桌面很有意义,因此必须将 Matplotlib 后端设置为 `GTK3Agg`。如果你不使用 Linux,则可能需要使用 `TkAgg` 后端。 + +设置完 GUI 窗口以后,设置窗口大小和 Seaborn 预设样式: + +```python +matplotlib.use('GTK3Agg') +rcParams['figure.figsize'] = 11,8 +sns.set_style('darkgrid') +``` + +现在,你的显示已配置完毕,代码已经很熟悉了。使用 Pandas 导入 `sample.csv` 文件,并定义数据帧的列: + +```python +FILE = open('sample.csv','r') +DATAFRAME = pd.read_csv(FILE) +DATAFRAME.columns = [ 'red','green','blue' ] +``` + +有了适当格式的数据,你可以将其绘制在图形中。将每一列用作绘图的输入,然后使用 `plt.show()` 在 GUI 窗口中绘制图形。`plt.legend()` 参数将列标题与图形上的每一行关联(`loc` 参数将图例放置在图表之外而不是在图表上方): + + +```python +for i in DATAFRAME.columns: +    DATAFRAME[i].plot() + +plt.legend(bbox_to_anchor=(1, 1), loc=2, borderaxespad=1) +plt.show() +``` + +运行代码以获得结果。 + +![第一个数据可视化][10] + +你的图形可以准确显示 CSV 文件中包含的所有信息:值在 Y 轴上,索引号在 X 轴上,并且图形中的线也被标识出来了,以便你知道它们代表什么。然而,由于此代码正在跟踪颜色值(至少是假装),所以线条的颜色不仅不直观,而且违反直觉。如果你永远不需要分析颜色数据,则可能永远不会遇到此问题,但是你一定会遇到类似的问题。在可视化数据时,你必须考虑呈现数据的最佳方法,以防止观看者从你呈现的内容中推断出虚假信息。 + +为了解决此问题(并展示一些可用的自定义设置),以下代码为每条绘制的线分配了特定的颜色: + +```python +import matplotlib +from pandas import read_csv, DataFrame +import pandas as pd +import seaborn as sns +import matplotlib.pyplot as plt +from matplotlib import rcParams + +matplotlib.use('GTK3Agg') +rcParams['figure.figsize'] = 11,8 +sns.set_style('whitegrid') + +FILE = open('sample.csv','r') +DATAFRAME = pd.read_csv(FILE) +DATAFRAME.columns = [ 'red','green','blue' ] + +plt.plot(DATAFRAME['red'],'r-') +plt.plot(DATAFRAME['green'],'g-') +plt.plot(DATAFRAME['blue'],'b-') +plt.plot(DATAFRAME['red'],'ro') +plt.plot(DATAFRAME['green'],'go') +plt.plot(DATAFRAME['blue'],'bo') + +plt.show() +``` + +这使用特殊的 Matplotlib 表示法为每列创建两个图。每列的初始图分配有一种颜色(红色为 `r`,绿色为 `g`,蓝色为 `b`)。这些是内置的 Matplotlib 设置。 `-` 表示实线(双破折号,例如 `r--`,将创建虚线)。为每个具有相同颜色的列创建第二个图,但是使用 `o` 表示点或节点。为了演示内置的 Seaborn 主题,请将 `sns.set_style` 的值更改为 `whitegrid`。 + +![改进的数据可视化][11] + +### 停用你的虚拟环境 + +探索完 Pandas 和绘图后,可以使用 `deactivate` 命令停用 Python 虚拟环境: + +``` +(example) $ deactivate +$ +``` + +当你想重新使用它时,只需像在本文开始时一样重新激活它即可。重新激活虚拟环境时,你必须重新安装模块,但是它们是从缓存安装的,而不是从互联网下载的,因此你不必联网。 + +### 无尽的可能性 + +Pandas、Matplotlib、Seaborn 和数据科学的真正力量是无穷的潜力,使你能够以有意义和启发性的方式解析、解释和组织数据。下一步是使用你在本文中学到的新工具探索简单的数据集。Matplotlib 和 Seaborn 不仅有折线图,还有很多其他功能,因此,请尝试创建条形图或饼图或完全不一样的东西。 + +一旦你了解了你的工具集并对如何关联数据有了一些想法,则可能性是无限的。数据科学是寻找隐藏在数据中的故事的新方法。让开源成为你的媒介。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/get-started-data-science-python + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[GraveAccent](https://github.com/GraveAccent) +校对:[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/metrics_graph_stats_blue.png?itok=OKCc_60D (Metrics and a graph illustration) +[2]: https://pandas.pydata.org/ +[3]: https://matplotlib.org/ +[4]: https://seaborn.pydata.org/index.html +[5]: https://opensource.com/article/17/10/python-101 +[6]: http://libreoffice.org +[7]: https://seaborn.pydata.org/ +[8]: https://pygobject.readthedocs.io/en/latest/getting_started.html +[9]: https://pycairo.readthedocs.io/en/latest/ +[10]: https://opensource.com/sites/default/files/uploads/seaborn-matplotlib-graph_0.png (First data visualization) +[11]: https://opensource.com/sites/default/files/uploads/seaborn-matplotlib-graph_1.png (Improved data visualization) diff --git a/published/201909/20190923 Introduction to the Linux chgrp and newgrp commands.md b/published/201909/20190923 Introduction to the Linux chgrp and newgrp commands.md new file mode 100644 index 0000000000..7dffe09737 --- /dev/null +++ b/published/201909/20190923 Introduction to the Linux chgrp and newgrp commands.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11399-1.html) +[#]: subject: (Introduction to the Linux chgrp and newgrp commands) +[#]: via: (https://opensource.com/article/19/9/linux-chgrp-and-newgrp-commands) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +chgrp 和 newgrp 命令简介 +====== + +> chgrp 和 newgrp 命令可帮助你管理需要维护组所有权的文件。 + +![](https://img.linux.net.cn/data/attachment/album/201909/28/155554aezllilzbedetm43.jpg) + +在最近的一篇文章中,我介绍了 [chown][2] 命令,它用于修改系统上的文件所有权。回想一下,所有权是分配给一个对象的用户和组的组合。`chgrp` 和 `newgrp` 命令为管理需要维护组所有权的文件提供了帮助。 + +### 使用 chgrp + +`chgrp` 只是更改文件的组所有权。这与 `chown :` 命令相同。你可以使用: + +``` +$chown :alan mynotes +``` + +或者: + +``` +$chgrp alan mynotes +``` + +#### 递归 + +`chgrp` 和它的一些参数可以用在命令行和脚本中。就像许多其他 Linux 命令一样,`chgrp` 有一个递归参数 `-R`。如下所示,你需要它来对文件夹及其内容进行递归操作。我加了 `-v`(详细)参数,因此 `chgrp` 会告诉我它在做什么: + + +``` +$ ls -l . conf +.: +drwxrwxr-x 2 alan alan 4096 Aug  5 15:33 conf + +conf: +-rw-rw-r-- 1 alan alan 0 Aug  5 15:33 conf.xml +# chgrp -vR delta conf +changed group of 'conf/conf.xml' from alan to delta +changed group of 'conf' from alan to delta +``` + +#### 参考 + +当你要更改文件的组以匹配特定的配置,或者当你不知道具体的组时(比如你运行一个脚本时),可使用参考文件 (`--reference=RFILE`)。你可以复制另外一个作为参考的文件(RFILE)的组。比如,为了撤销上面的更改 (请注意,点 `.` 代表当前工作目录): + +``` +$ chgrp -vR --reference=. conf +``` + +#### 报告更改 + +大多数命令都有用于控制其输出的参数。最常见的是 `-v` 来启用详细信息,而且 `chgrp` 命令也拥有详细模式。它还具有 `-c`(`--changes`)参数,指示 `chgrp` 仅在进行了更改时报告。`chgrp` 还会报告其他内容,例如是操作不被允许时。 + +参数 `-f`(`--silent`、`--quiet`)用于禁止显示大部分错误消息。我将在下一节中使用此参数和 `-c` 来显示实际更改。 + +#### 保持根目录 + +Linux 文件系统的根目录(`/`)应该受到高度重视。如果命令在此层级犯了一个错误,那么后果可能是可怕的,并会让系统无法使用。尤其是在运行一个会递归修改甚至删除的命令时。`chgrp` 命令有一个可用于保护和保持根目录的参数。它是 `--preserve-root`。如果在根目录中将此参数和递归一起使用,那么什么也不会发生,而是会出现一条消息: + +``` +[root@localhost /]# chgrp -cfR --preserve-root a+w / +chgrp: it is dangerous to operate recursively on '/' +chgrp: use --no-preserve-root to override this failsafe +``` + +不与递归(-R)结合使用时,该选项无效。但是,如果该命令由 `root` 用户运行,那么 `/` 的权限将会更改,但其下的其他文件或目录的权限则不会被更改: + +``` +[alan@localhost /]$ chgrp -c --preserve-root alan / +chgrp: changing group of '/': Operation not permitted +[root@localhost /]# chgrp -c --preserve-root alan / +changed group of '/' from root to alan +``` + +令人惊讶的是,它似乎不是默认参数。而选项 `--no-preserve-root` 是默认的。如果你在不带“保持”选项的情况下运行上述命令,那么它将默认为“无保持”模式,并可能会更改不应更改的文件的权限: + +``` +[alan@localhost /]$ chgrp -cfR alan / +changed group of '/dev/pts/0' from tty to alan +changed group of '/dev/tty2' from tty to alan +changed group of '/var/spool/mail/alan' from mail to alan +``` + +### 关于 newgrp + +`newgrp` 命令允许用户覆盖当前的主要组。当你在所有文件必须有相同的组所有权的目录中操作时,`newgrp` 会很方便。假设你的内网服务器上有一个名为 `share` 的目录,不同的团队在其中存储市场活动照片。组名为 `share`。当不同的用户将文件放入目录时,文件的主要组可能会变得混乱。每当添加新文件时,你都可以运行 `chgrp` 将错乱的组纠正为 `share`: + +``` +$ cd share +ls -l +-rw-r--r--. 1 alan share 0 Aug  7 15:35 pic13 +-rw-r--r--. 1 alan alan 0 Aug  7 15:35 pic1 +-rw-r--r--. 1 susan delta 0 Aug  7 15:35 pic2 +-rw-r--r--. 1 james gamma 0 Aug  7 15:35 pic3 +-rw-rw-r--. 1 bill contract  0 Aug  7 15:36 pic4 +``` + +我在 [chmod 命令][3]的文章中介绍了 `setgid` 模式。它是解决此问题的一种方法。但是,假设由于某种原因未设置 `setgid` 位。`newgrp` 命令在此时很有用。在任何用户将文件放入 `share` 目录之前,他们可以运行命令 `newgrp share`。这会将其主要组切换为 `share`,因此他们放入目录中的所有文件都将有 `share` 组,而不是用户自己的主要组。完成后,用户可以使用以下命令切换回常规主要组(举例): + +``` +newgrp alan +``` + +### 总结 + +了解如何管理用户、组和权限非常重要。最好知道一些替代方法来解决可能遇到的问题,因为并非所有环境都以相同的方式设置。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-chgrp-and-newgrp-commands + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/alanfdosshttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/community-penguins-osdc-lead.png?itok=BmqsAF4A (Penguins walking on the beach ) +[2]: https://opensource.com/article/19/8/linux-chown-command +[3]: https://opensource.com/article/19/8/linux-chmod-command diff --git a/published/201909/20190927 IBM brings blockchain to Red Hat OpenShift- adds Apache CouchDB for hybrid cloud customers.md b/published/201909/20190927 IBM brings blockchain to Red Hat OpenShift- adds Apache CouchDB for hybrid cloud customers.md new file mode 100644 index 0000000000..ac533a1b2c --- /dev/null +++ b/published/201909/20190927 IBM brings blockchain to Red Hat OpenShift- adds Apache CouchDB for hybrid cloud customers.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11405-1.html) +[#]: subject: (IBM brings blockchain to Red Hat OpenShift; adds Apache CouchDB for hybrid cloud customers) +[#]: via: (https://www.networkworld.com/article/3441362/ibm-brings-blockchain-to-red-hat-openshift-adds-apache-couchdb-for-hybrid-cloud-customers.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM 将区块链引入红帽 OpenShift;为混合云客户添加了Apache CouchDB +====== + +> IBM 在其区块链平台上增加了红帽 OpenShift 支持,并将用于 Apache CouchDB 的 Kubernetes Operator 引入其混合云服务中。 + +![](https://images.idgesg.net/images/article/2019/08/cloudjourney1200x800-100808549-large.jpg) + +IBM 本周继续推进其红帽和开源集成工作,在其[区块链][1]平台上添加了红帽 OpenShift 支持,并在其[混合云][2]服务产品之外为 Apache CouchDB 引入了 Kubernetes Operator。 + +在该公司的旗舰级企业 Kubernetes 平台 [红帽 OpenShift 上部署 IBM 区块链][3] 的能力,意味着 IBM 区块链的开发人员将能够在本地、公共云或混合云架构中部署安全软件。 + +区块链是一个分布式数据库,维护着一个不断增长的记录列表,可以使用哈希技术对其进行验证,并且 IBM 区块链平台包括用于构建、操作、治理和发展受保护的区块链网络的工具。 + +IBM 表示,其区块链 / OpenShift 组合的目标客户面对的公司客户是:希望保留区块链分类帐副本并在自己的基础设施上运行工作负载以实现安全性,降低风险或合规性;需要将数据存储在特定位置以满足数据驻留要求;需要在多个云或混合云架构中部署区块链组件。 + +自 7 月份完成对红帽的收购以来,IBM 一直在围绕红帽基于 Kubernetes 的 OpenShift 容器平台构建云开发生态系统。最近,这位蓝色巨人将其[新 z15 大型机与 IBM 的红帽][4]技术融合在一起,称它将为红帽 OpenShift 容器平台提供 IBM z/OS 云代理。该产品将通过连接到 Kubernetes 容器为用户提供 z/OS 计算资源的直接自助访问。 + +IBM 表示,打算在 IBM z 系列和 LinuxONE 产品上向 Linux 提供 IBM [Cloud Pak 产品][5]。Cloud Paks 是由 OpenShift 与 100 多种其他 IBM 软件产品组成的捆绑包。LinuxONE 是 IBM 专为支持 Linux 环境而设计的非常成功的大型机系统。 + +IBM 表示,愿景是使支持 OpenShift 的 IBM 软件成为客户用来转变其组织的基础构建组件。 + +IBM 表示:“我们的大多数客户都需要支持混合云工作负载以及可在任何地方运行这些工作负载的灵活性的解决方案,而用于红帽的 z/OS 云代理将成为我们在平台上启用云原生的关键。” + +在相关新闻中,IBM 宣布支持开源 Apache CouchDB,这是 [Apache CouchDB][7] 的 Kubernetes Operator,并且该 Operator 已通过认证可与红帽 OpenShift 一起使用。Operator 可以自动部署、管理和维护 Apache CouchDB 部署。Apache CouchDB 是非关系型开源 NoSQL 数据库。 + +在最近的 [Forrester Wave 报告][8]中,研究人员说:“企业喜欢 NoSQL 这样的能力,可以使用低成本服务器和可以存储、处理和访问任何类型的业务数据的灵活的无模式模型进行横向扩展。NoSQL 平台为企业基础设施专业人士提供了对数据存储和处理的更好控制,并提供了可加速应用程序部署的配置。当许多组织使用 NoSQL 来补充其关系数据库时,一些组织已开始替换它们以支持更好的性能、扩展规模并降低其数据库成本。” + +当前,IBM 云使用 Cloudant Db 服务作为其针对新的云原生应用程序的标准数据库。IBM 表示,对 CouchDB 的强大支持为用户提供了替代方案和后备选项。IBM 表示,能够将它们全部绑定到红帽 OpenShift Kubernetes 部署中,可以使客户在部署应用程序并在多个云环境中移动数据时使用数据库本地复制功能来维持对数据的低延迟访问。 + +“我们的客户正在转向基于容器化和[微服务][9]的架构,以提高速度、敏捷性和运营能力。在云原生应用程序开发中,应用程序需要具有支持可伸缩性、可移植性和弹性的数据层。”IBM 院士兼云数据库副总裁 Adam Kocoloski 写道,“我们相信数据可移植性和 CouchDB 可以大大改善多云架构的功能,使客户能够构建真正可在私有云、公共云和边缘位置之间移植的解决方案。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3441362/ibm-brings-blockchain-to-red-hat-openshift-adds-apache-couchdb-for-hybrid-cloud-customers.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3330937/how-blockchain-will-transform-the-iot.html +[2]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[3]: https://www.ibm.com/blogs/blockchain/2019/09/ibm-blockchain-platform-meets-red-hat-openshift/ +[4]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[5]: https://www.networkworld.com/article/3429596/ibm-fuses-its-software-with-red-hats-to-launch-hybrid-cloud-juggernaut.html +[6]: https://www.networkworld.com/article/3400740/achieve-compliant-cost-effective-hybrid-cloud-operations.html +[7]: https://www.ibm.com/cloud/learn/couchdb +[8]: https://reprints.forrester.com/#/assets/2/363/RES136481/reports +[9]: https://www.networkworld.com/article/3137250/what-you-need-to-know-about-microservices.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/published/20190901 Best Linux Distributions For Everyone in 2019.md b/published/20190901 Best Linux Distributions For Everyone in 2019.md new file mode 100644 index 0000000000..4a6e136180 --- /dev/null +++ b/published/20190901 Best Linux Distributions For Everyone in 2019.md @@ -0,0 +1,386 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11411-1.html) +[#]: subject: (Best Linux Distributions For Everyone in 2019) +[#]: via: (https://itsfoss.com/best-linux-distributions/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +2019 年最好的 Linux 发行版 +====== + +> 哪个是最好的 Linux 发行版呢?这个问题是没有明确的答案的。这就是为什么我们按各种分类汇编了这个最佳 Linux 列表的原因。 + +有许多 Linux 发行版,我甚至想不出一个确切的数量,因为你会发现很多不同的 Linux 发行版。 + +其中有些只是另外一个的复制品,而有些往往是独一无二的。这虽然有点混乱——但这也是 Linux 的优点。 + +不用担心,尽管有成千上万的发行版,在这篇文章中,我已经列出了目前最好的 Linux 发行版。当然,这个列表是主观的。但是,在这里,我们试图对发行版进行分类——每个发行版本都有自己的特点的。 + +* 面向初学者的 Linux 用户的最佳发行版 +* 最佳 Linux 服务器发行版 +* 可以在旧计算机上运行的最佳 Linux 发行版 +* 面向高级 Linux 用户的最佳发行版 +* 最佳常青树 Linux 发行版 + +**注:** 该列表没有特定的排名顺序。 + +### 面向初学者的最佳 Linux 发行版 + +在这个分类中,我们的目标是列出开箱即用的易用发行版。你不需要深度学习,你可以在安装后马上开始使用,不需要知道任何命令或技巧。 + +#### Ubuntu + +![][6] + +Ubuntu 无疑是最流行的 Linux 发行版之一。你甚至可以发现它已经预装在很多笔记本电脑上了。 + +用户界面很容易适应。如果你愿意,你可以根据自己的要求轻松定制它的外观。无论哪种情况,你都可以选择安装一个主题。你可以从了解更多关于[如何在 Ubuntu 安装主题的][7]的信息来起步。 + +除了它本身提供的功能外,你会发现一个巨大的 Ubuntu 用户在线社区。因此,如果你有问题——可以去任何论坛(或版块)寻求帮助。如果你想直接寻找解决方案,你应该看看我们对 [Ubuntu][8] 的报道(我们有很多关于 Ubuntu 的教程和建议)。 + +- [Ubuntu][9] + +#### Linux Mint + +![][10] + +Linux Mint Cinnamon 是另一个受初学者欢迎的 Linux 发行版。默认的 Cinnamon 桌面类似于 Windows XP,这就是为什么当 Windows XP 停止维护时许多用户选择它的原因。 + +Linux Mint 基于 Ubuntu,因此它具有适用于 Ubuntu 的所有应用程序。简单易用是它成为 Linux 新用户首选的原因。 + +- [Linux Mint][11] + +#### elementary OS + +![][12] + +elementary OS 是我用过的最漂亮的 Linux 发行版之一。用户界面类似于苹果操作系统——所以如果你已经使用了苹果系统,则很容易适应。 + +该发行版基于 Ubuntu,致力于提供一个用户友好的 Linux 环境,该环境在考虑性能的同时尽可能美观。如果你选择安装 elementary OS,这份[在安装 elementary OS 后要做的 11 件事的清单][13]会派上用场。 + +- [elementary OS][14] + +#### MX Linux + +![][15] + +大约一年前,MX Linux 成为众人瞩目的焦点。现在(在发表这篇文章的时候),它是 [DistroWatch.com][16] 上最受欢迎的 Linux 发行版。如果你还没有使用过它,那么当你开始使用它时,你会感到惊讶。 + +与 Ubuntu 不同,MX Linux 是一个基于 Debian 的日益流行的发行版,采用 Xfce 作为其桌面环境。除了无与伦比的稳定性之外,它还配备了许多图形用户界面工具,这使得任何习惯了 Windows/Mac 的用户易于使用它。 + +此外,软件包管理器还专门针对一键安装进行了量身定制。你甚至可以搜索 [Flatpak][18] 软件包并立即安装它(默认情况下,Flathub 在软件包管理器中是可用的来源之一)。 + +- [MX Linux][19] + +#### Zorin OS + +![][20] + +Zorin OS 是又一个基于 Ubuntu 的发行版,它又是桌面上最漂亮、最直观的操作系统之一。尤其是在[Zorin OS 15 发布][21]之后——我绝对会向没有任何 Linux 经验的用户推荐它。它也引入了许多基于图形用户界面的应用程序。 + +你也可以将其安装在旧电脑上,但是,请确保选择“Lite”版本。此外,你还有“Core”、“Education”和 “Ultimate”版本可以选择。你可以选择免费安装 Core 版,但是如果你想支持开发人员并帮助改进 Zorin,请考虑获得 Ultimate 版。 + +Zorin OS 是由两名爱尔兰的青少年创建的。你可以[在这里阅读他们的故事][22]。 + +- [Zorin OS][23] + +#### Pop!_OS + +![](https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/pop-1.jpg?w=800&ssl=1) + +Sytem76 的 Pop!_OS 是开发人员或计算机科学专业人员的理想选择。当然,不仅限于编码人员,如果你刚开始使用 Linux,这也是一个很好的选择。它基于 Ubuntu,但是其 UI 感觉更加直观和流畅。除了 UI 外,它还强制执行全盘加密。 + +你可以通过文章下面的评论看到,我们的许多读者似乎都喜欢(并坚持使用)它。如果你对此感到好奇,也应该查看一下我们关于 Phillip Prado 的 [Pop!_OS 的动手实践](https://itsfoss.com/pop-os-linux-review/)的文章。 + +(LCTT 译注:这段推荐是原文后来补充的,因为原文下面很多人在评论推荐。) + +- [Pop!_OS](https://system76.com/pop) + +#### 其他选择 + +[深度操作系统][24] 和其他的 Ubuntu 变种(如 Kubuntu、Xubuntu)也是初学者的首选。如果你想寻求更多的选择,你可以看看。(LCTT 译注:我知道你们肯定对将深度操作系统列入其它不满意——这个锅归原作者。) + +如果你想要挑战自己,你可以试试 Ubuntu 之外的 Fedora —— 但是一定要看看我们关于 [Ubuntu 和 Fedora 对比][25]的文章,从桌面的角度做出更好的选择。 + +### 最好的服务器发行版 + +对于服务器来说,选择 Linux 发行版取决于稳定性、性能和企业级支持。如果你只是尝试,则可以尝试任何你想要的发行版。 + +但是,如果你要为 Web 服务器或任何重要的组件安装它,你应该看看我们的一些建议。 + +#### Ubuntu 服务器 + +根据你的需要,Ubuntu 为你的服务器提供了不同的选项。如果你正在寻找运行在 AWS、Azure、谷歌云平台等平台上的优化解决方案,[Ubuntu Cloud][26] 是一个很好的选择。 + +无论是哪种情况,你都可以选择 Ubuntu 服务器包,并将其安装在你的服务器上。然而,Ubuntu 在云上部署时也是最受欢迎的 Linux 发行版(根据数字判断——[来源1][27]、[来源2][28])。 + +请注意,除非你有特殊要求,我们建议你选择 LTS 版。 + +- [Ubuntu Server][29] + +#### 红帽企业版 Linux(RHEL) + +红帽企业版 Linux(RHEL)是面向企业和组织的顶级 Linux 平台。如果我们按数字来看,红帽可能不是服务器领域最受欢迎的。但是,有相当一部分企业用户依赖于 RHEL (比如联想)。 + +从技术上讲,Fedora 和红帽企业版是相关联的。无论红帽要支持什么——在出现在 RHEL 之前,都要在 Fedora 上进行测试。我不是定制需求的服务器发行版专家,所以你一定要查看他们的[官方文档][30]以了解它是否适合你。 + +- [RHEL][31] + +#### SUSE Linux 企业服务器(SLES) + +![][32] + +别担心,不要把这和 OpenSUSE 混淆。一切都以一个共同的品牌 “SUSE” 命名 —— 但是 OpenSUSE 是一个开源发行版,目标是社区,并且由社区维护。 + +SUSE Linux 企业服务器(SLES)是基于云的服务器最受欢迎的解决方案之一。为了获得管理开源解决方案的优先支持和帮助,你必须选择订阅。 + +- [SLES][33] + +#### CentOS + +![][34] + +正如我提到的,对于 RHEL 你需要订阅。而 CentOS 更像是 RHEL 的社区版,因为它是从 RHEL 的源代码中派生出来的。而且,它是开源的,也是免费的。尽管与过去几年相比,使用 CentOS 的托管提供商数量明显减少,但这仍然是一个很好的选择。 + +CentOS 可能没有加载最新的软件包,但它被认为是最稳定的发行版之一,你可以在各种云平台上找到 CentOS 镜像。如果没有,你可以选择 CentOS 提供的自托管镜像。 + +- [CentOS][35] + +#### 其他选择 + +你也可以尝试 [Fedora Server][36]或[Debian][37]作为上述发行版的替代品。 + +### 旧电脑的最佳 Linux 发行版 + +如果你有一台旧电脑,或者你真的不需要升级你的系统,你仍然可以尝试一些最好的 Linux 发行版。 + +我们已经详细讨论了一些[最好的轻量级 Linux 发行版][42]。在这里,我们将只提到那些真正突出的东西(以及一些新的补充)。 + +#### Puppy Linux + +![][43] + +Puppy Linux 实际上是最小的发行版本之一。刚开始使用 Linux 时,我的朋友建议我尝试一下 Puppy Linux,因为它可以轻松地在较旧的硬件配置上运行。 + +如果你想在你的旧电脑上享受一次爽快的体验,那就值得去看看。多年来,随着一些新的有用特性的增加,用户体验得到了改善。 + +- [Puppy Linux][44] + +#### Solus Budgie + +![][45] + +在最近的一个主要版本——[Solus 4 Fortitude][46] 之后,它是一个令人印象深刻的轻量级桌面操作系统。你可以选择像 GNOME 或 MATE 这样的桌面环境。然而,Solus Budgie 恰好是我的最爱之一,它是一款适合初学者的功能齐全的 Linux发行版,同时对系统资源要求很少。 + +- [Solus][47] + +#### Bodhi + +![][48] + +Bodhi Linux 构建于 Ubuntu 之上。然而,与Ubuntu不同,它在较旧的配置上运行良好。 + +这个发行版的主要亮点是它的 [Moksha 桌面][49](这是 Enlightenment 17 桌面的延续)。用户体验直观且反应极快。即使我个人不用它,你也应该在你的旧系统上试一试。 + +- [Bodhi Linux][50] + +#### antiX + +![][51] + +antiX 部分担起了 MX Linux 的责任,它是一个轻量级的 Linux 发行版,为新的或旧的计算机量身定制。其用户界面并不令人印象深刻——但它可以像预期的那样工作。 + +它基于 Debian,可以作为一个现场版 CD 发行版使用,而不需要安装它。antiX 还提供现场版引导加载程序。与其他发行版相比,你可以保存设置,这样就不会在每次重新启动时丢失设置。不仅如此,你还可以通过其“持久保留”功能将更改保存到根目录中。 + +因此,如果你正在寻找一个可以在旧硬件上提供快速用户体验的现场版 USB 发行版,antiX 是一个不错的选择。 + +- [antiX][52] + +#### Sparky Linux + +![][53] + +Sparky Linux 基于 Debian,它是理想的低端系统 Linux 发行版。伴随着超快的用户体验,Sparky Linux 为不同的用户提供了几个特殊版本(或变种)。 + +例如,它提供了针对一组用户的稳定版本(和变种)和滚动版本。Sparky Linux GameOver 版非常受游戏玩家欢迎,因为它包含了一堆预装的游戏。你可以查看我们的[最佳 Linux 游戏发行版][54] —— 如果你也想在你的系统上玩游戏。 + +#### 其他选择 + +你也可以尝试 [Linux Lite][55]、[Lubuntu][56]、[Peppermint][57] 等轻量级 Linux 发行版。 + +### 面向高级用户的最佳 Linux 发行版 + +一旦你习惯了各种软件包管理器和命令来帮助你解决任何问题,你就可以开始找寻只为高级用户量身定制的 Linux 发行版。 + +当然,如果你是专业人士,你会有一套具体的要求。然而,如果你已经作为普通用户使用了一段时间——以下发行版值得一试。 + +#### Arch Linux + +![][58] + +Arch Linux 本身是一个简单而强大的发行版,具有陡峭的学习曲线。不像其系统,你不会一次就把所有东西都预先安装好。你必须配置系统并根据需要添加软件包。 + +此外,在安装 Arch Linux 时,必须按照一组命令来进行(没有图形用户界面)。要了解更多信息,你可以按照我们关于[如何安装 Arch Linux][59] 的指南进行操作。如果你要安装它,你还应该知道在[安装 Arch Linux 后需要做的一些基本事情][60]。这会帮助你快速入门。 + +除了多才多艺和简便性之外,值得一提的是 Arch Linux 背后的社区非常活跃。所以,如果你遇到问题,你不用担心。 + +- [Arch Linux][61] + +#### Gentoo + +![][62] + +如果你知道如何编译源代码,Gentoo Linux 是你必须尝试的版本。这也是一个轻量级的发行版,但是,你需要具备必要的技术知识才能使它发挥作用。 + +当然,[官方手册][63]提供了许多你需要知道的信息。但是,如果你不确定自己在做什么——你需要花很多时间去想如何充分利用它。 + +- [Gentoo Linux][64] + +#### Slackware + +![][65] + +Slackware 是仍然重要的最古老的 Linux 发行版之一。如果你愿意编译或开发软件来为自己建立一个完美的环境 —— Slackware 是一个不错的选择。 + +如果你对一些最古老的 Linux 发行版感到好奇,我们有一篇关于[最早的 Linux 发行版][66]可以去看看。 + +尽管使用它的用户/开发人员的数量已经显著减少,但对于高级用户来说,它仍然是一个极好的选择。此外,最近有个新闻是 [Slackware 有了一个 Patreon 捐赠页面][67],我们希望 Slackware 继续作为最好的 Linux 发行版之一存在。 + +- [Slackware][68] + +### 最佳多用途 Linux 发行版 + +有些 Linux 发行版既可以作为初学者友好的桌面又可以作为高级操作系统的服务器。因此,我们考虑为这样的发行版编辑一个单独的部分。 + +如果你不同意我们的观点(或者有建议要补充),请在评论中告诉我们。我们认为,这对于每个用户都可以派上用场: + +#### Fedora + +![][69] + +Fedora 提供两个独立的版本:一个用于台式机/笔记本电脑(Fedora 工作站),另一个用于服务器(Fedora 服务器)。 + +因此,如果你正在寻找一款时髦的桌面操作系统,有点学习曲线,又对用户友好,那么 Fedora 是一个选择。无论是哪种情况,如果你正在为你的服务器寻找一个 Linux 操作系统,这也是一个不错的选择。 + +- [Fedora][70] + +#### Manjaro + +![][71] + +Manjaro 基于 [Arch Linux][72]。不用担心,虽然 Arch Linux 是为高级用户量身定制的,但Manjaro 让新手更容易上手。这是一个简单且对初学者友好的 Linux 发行版。用户界面足够好,并且内置了一系列有用的图形用户界面应用程序。 + +下载时,你可以为 Manjaro 选择[桌面环境][73]。就个人而言,我喜欢 Manjaro 的 KDE 桌面。 + +- [Manjaro Linux][74] + +#### Debian + +![][75] + +嗯,Ubuntu 是基于 Debian 的——所以它本身是一个非常好的发行版本。Debian 是台式机和服务器的理想选择。 + +这可能不是对初学者最友好的操作系统——但你可以通过阅读[官方文档][76]轻松开始。[Debian 10 Buster][77] 的最新版本引入了许多变化和必要的改进。所以,你必须试一试! + +### 总结 + +总的来说,这些是我们推荐你去尝试的最好的 Linux 发行版。是的,还有许多其他的 Linux 发行版值得一提,但是根据个人喜好,对每个发行版来说,取决于个人喜好,这种选择是主观的。 + +但是,我们也为 [Windows 用户][78]、[黑客和脆弱性测试人员][41]、[游戏玩家][54]、[程序员][39]和[偏重隐私者][79]提供了单独的发行版列表所以,如果你感兴趣的话请仔细阅读。 + +如果你认为我们遗漏了你最喜欢的 Linux 发行版,请在下面的评论中告诉我们你的想法,我们将更新这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-linux-distributions/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: tmp.NoRXbIWHkg#for-beginners +[2]: tmp.NoRXbIWHkg#for-servers +[3]: tmp.NoRXbIWHkg#for-old-computers +[4]: tmp.NoRXbIWHkg#for-advanced-users +[5]: tmp.NoRXbIWHkg#general-purpose +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-10.jpg?ssl=1 +[7]: https://itsfoss.com/install-themes-ubuntu/ +[8]: https://itsfoss.com/tag/ubuntu/ +[9]: https://ubuntu.com/download/desktop +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-Mint-19-desktop.jpg?ssl=1 +[11]: https://www.linuxmint.com/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/elementary-os-juno-feat.jpg?ssl=1 +[13]: https://itsfoss.com/things-to-do-after-installing-elementary-os-5-juno/ +[14]: https://elementary.io/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/mx-linux.jpg?ssl=1 +[16]: https://distrowatch.com/ +[17]: https://en.wikipedia.org/wiki/Linux_distribution#Rolling_distributions +[18]: https://flatpak.org/ +[19]: https://mxlinux.org/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/zorin-os-15.png?ssl=1 +[21]: https://itsfoss.com/zorin-os-15-release/ +[22]: https://itsfoss.com/zorin-os-interview/ +[23]: https://zorinos.com/ +[24]: https://www.deepin.org/en/ +[25]: https://itsfoss.com/ubuntu-vs-fedora/ +[26]: https://ubuntu.com/download/cloud +[27]: https://w3techs.com/technologies/details/os-linux/all/all +[28]: https://thecloudmarket.com/stats +[29]: https://ubuntu.com/download/server +[30]: https://developers.redhat.com/products/rhel/docs-and-apis +[31]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/SUSE-Linux-Enterprise.jpg?ssl=1 +[33]: https://www.suse.com/products/server/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/centos.png?ssl=1 +[35]: https://www.centos.org/ +[36]: https://getfedora.org/en/server/ +[37]: https://www.debian.org/distrib/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/coding.jpg?ssl=1 +[39]: https://itsfoss.com/best-linux-distributions-progammers/ +[40]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/hacking.jpg?ssl=1 +[41]: https://itsfoss.com/linux-hacking-penetration-testing/ +[42]: https://itsfoss.com/lightweight-linux-beginners/ +[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/puppy-linux-bionic.jpg?ssl=1 +[44]: http://puppylinux.com/ +[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/solus-4-featured.jpg?resize=800%2C450&ssl=1 +[46]: https://itsfoss.com/solus-4-release/ +[47]: https://getsol.us/home/ +[48]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/bodhi-linux.png?fit=800%2C436&ssl=1 +[49]: http://www.bodhilinux.com/moksha-desktop/ +[50]: http://www.bodhilinux.com/ +[51]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/10/antix-linux-screenshot.jpg?ssl=1 +[52]: https://antixlinux.com/ +[53]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/sparky-linux.jpg?ssl=1 +[54]: https://itsfoss.com/linux-gaming-distributions/ +[55]: https://www.linuxliteos.com/ +[56]: https://lubuntu.me/ +[57]: https://peppermintos.com/ +[58]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/arch_linux_screenshot.jpg?ssl=1 +[59]: https://itsfoss.com/install-arch-linux/ +[60]: https://itsfoss.com/things-to-do-after-installing-arch-linux/ +[61]: https://www.archlinux.org +[62]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?ssl=1 +[63]: https://wiki.gentoo.org/wiki/Handbook:Main_Page +[64]: https://www.gentoo.org +[65]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/slackware-screenshot.jpg?ssl=1 +[66]: https://itsfoss.com/earliest-linux-distros/ +[67]: https://distrowatch.com/dwres.php?resource=showheadline&story=8743 +[68]: http://www.slackware.com/ +[69]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/fedora-overview.png?ssl=1 +[70]: https://getfedora.org/ +[71]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/manjaro-gnome.jpg?ssl=1 +[72]: https://www.archlinux.org/ +[73]: https://itsfoss.com/glossary/desktop-environment/ +[74]: https://manjaro.org/ +[75]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?ssl=1 +[76]: https://www.debian.org/releases/stable/installmanual +[77]: https://itsfoss.com/debian-10-buster/ +[78]: https://itsfoss.com/windows-like-linux-distributions/ +[79]: https://itsfoss.com/privacy-focused-linux-distributions/ diff --git a/published/20190911 4 open source cloud security tools.md b/published/20190911 4 open source cloud security tools.md new file mode 100644 index 0000000000..f2c9de3893 --- /dev/null +++ b/published/20190911 4 open source cloud security tools.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11432-1.html) +[#]: subject: (4 open source cloud security tools) +[#]: via: (https://opensource.com/article/19/9/open-source-cloud-security) +[#]: author: (Alison Naylor https://opensource.com/users/asnaylor,Anderson Silva https://opensource.com/users/ansilva) + +4 种开源云安全工具 +====== + +> 查找并排除你存储在 AWS 和 GitHub 中的数据里的漏洞。 + +![Tools in a cloud][1] + +如果你的日常工作是开发者、系统管理员、全栈工程师或者是网站可靠性工程师(SRE),工作内容包括使用 Git 从 GitHub 上推送、提交和拉取,并部署到亚马逊 Web 服务上(AWS),安全性就是一个需要持续考虑的一个点。幸运的是,开源工具能帮助你的团队避免犯常见错误,这些常见错误会导致你的组织损失数千美元。 + +本文介绍了四种开源工具,当你在 GitHub 和 AWS 上进行开发时,这些工具能帮助你提升项目的安全性。同样的,本着开源的精神,我会与三位安全专家——[Travis McPeak][2],奈飞高级云安全工程师;[Rich Monk][3],红帽首席高级信息安全分析师;以及 [Alison Naylor][4],红帽首席信息安全分析师——共同为本文做出贡献。 + +我们已经按场景对每个工具都做了区分,但是它们并不是相互排斥的。 + +### 1、使用 gitrob 发现敏感数据 + +你需要发现任何出现于你们团队的 Git 仓库中的敏感信息,以便你能将其删除。借助专注于攻击应用程序或者操作系统的工具以使用红/蓝队模型,这样可能会更有意义,在这个模型中,一个信息安全团队会划分为两块,一个是攻击团队(又名红队),以及一个防守团队(又名蓝队)。有一个红队来尝试渗透你的系统和应用要远远好于等待一个攻击者来实际攻击你。你的红队可能会尝试使用 [Gitrob][5],该工具可以克隆和爬取你的 Git 仓库,以此来寻找凭证和敏感信息。 + +即使像 Gitrob 这样的工具可以被用来造成破坏,但这里的目的是让你的信息安全团队使用它来发现无意间泄露的属于你的组织的敏感信息(比如 AWS 的密钥对或者是其他被失误提交上去的凭证)。这样,你可以修整你的仓库并清除敏感数据——希望能赶在攻击者发现它们之前。记住不光要修改受影响的文件,还要[删除它们的历史记录][6]。 + +### 2、使用 git-secrets 来避免合并敏感数据 + +虽然在你的 Git 仓库里发现并移除敏感信息很重要,但在一开始就避免合并这些敏感信息岂不是更好?即使错误地提交了敏感信息,使用 [git-secrets][7] 可以避免你陷入公开的困境。这款工具可以帮助你设置钩子,以此来扫描你的提交、提交信息和合并信息,寻找常见的敏感信息模式。注意你选择的模式要匹配你的团队使用的凭证,比如 AWS 访问密钥和秘密密钥。如果发现了一个匹配项,你的提交就会被拒绝,一个潜在的危机就此得到避免。 + +为你已有的仓库设置 git-secrets 是很简单的,而且你可以使用一个全局设置来保护所有你以后要创建或克隆的仓库。你同样可以在公开你的仓库之前,使用 git-secrets 来扫描它们(包括之前所有的历史版本)。 + +### 3、使用 Key Conjurer 创建临时凭证 + +有一点额外的保险来防止无意间公开了存储的敏感信息,这是很好的事,但我们还可以做得更好,就完全不存储任何凭证。追踪凭证,谁访问了它,存储到了哪里,上次更新是什么时候——太麻烦了。然而,以编程的方式生成的临时凭证就可以避免大量的此类问题,从而巧妙地避开了在 Git 仓库里存储敏感信息这一问题。使用 [Key Conjurer][8],它就是为解决这一需求而被创建出来的。有关更多 Riot Games 为什么创建 Key Conjurer,以及 Riot Games 如何开发的 Key Conjurer,请阅读 [Key Conjurer:我们最低权限的策略][9]。 + +### 4、使用 Repokid 自动化地提供最小权限 + +任何一个参加过基本安全课程的人都知道,设置最小权限是基于角色的访问控制的最佳实现。难过的是,离开校门,会发现手动运用最低权限策略会变得如此艰难。一个应用的访问需求会随着时间的流逝而变化,开发人员又太忙了没时间去手动削减他们的权限。[Repokid][10] 使用 AWS 提供提供的有关身份和访问管理(IAM)的数据来自动化地调整访问策略。Repokid 甚至可以在 AWS 中为超大型组织提供自动化地最小权限设置。 + +### 工具而已,又不是大招 + +这些工具并不是什么灵丹妙药,它们只是工具!所以,在尝试使用这些工具或其他的控件之前,请和你的组织里一起工作的其他人确保你们已经理解了你的云服务的使用情况和用法模式。 + +应该严肃对待你的云服务和代码仓库服务,并熟悉最佳实现的做法。下面的文章将帮助你做到这一点。 + +**对于 AWS:** + + * [管理 AWS 访问密钥的最佳实现][11] + * [AWS 安全审计指南][12] + +**对于 GitHub:** + + * [介绍一种新方法来让你的代码保持安全][13] + * [GitHub 企业版最佳安全实现][14] + +同样重要的一点是,和你的安全团队保持联系;他们应该可以为你团队的成功提供想法、建议和指南。永远记住:安全是每个人的责任,而不仅仅是他们的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/open-source-cloud-security + +作者:[Alison Naylor][a1],[Anderson Silva][a2] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a1]: https://opensource.com/users/asnaylor +[a2]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT (Tools in a cloud) +[2]: https://twitter.com/travismcpeak?lang=en +[3]: https://github.com/rmonk +[4]: https://www.linkedin.com/in/alperkins/ +[5]: https://github.com/michenriksen/gitrob +[6]: https://help.github.com/en/articles/removing-sensitive-data-from-a-repository +[7]: https://github.com/awslabs/git-secrets +[8]: https://github.com/RiotGames/key-conjurer +[9]: https://technology.riotgames.com/news/key-conjurer-our-policy-least-privilege +[10]: https://github.com/Netflix/repokid +[11]: https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html +[12]: https://docs.aws.amazon.com/general/latest/gr/aws-security-audit-guide.html +[13]: https://github.blog/2019-05-23-introducing-new-ways-to-keep-your-code-secure/ +[14]: https://github.blog/2015-10-09-github-enterprise-security-best-practices/ diff --git a/published/20190916 Copying large files with Rsync, and some misconceptions.md b/published/20190916 Copying large files with Rsync, and some misconceptions.md new file mode 100644 index 0000000000..3fe61c4a95 --- /dev/null +++ b/published/20190916 Copying large files with Rsync, and some misconceptions.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11415-1.html) +[#]: subject: (Copying large files with Rsync, and some misconceptions) +[#]: via: (https://fedoramagazine.org/copying-large-files-with-rsync-and-some-misconceptions/) +[#]: author: (Daniel Leite de Abreu https://fedoramagazine.org/author/dabreu/) + +使用 rsync 复制大文件的一些误解 +====== + +![][1] + +有一种观点认为,在 IT 行业工作的许多人经常从网络帖子里复制和粘贴。我们都干过,复制粘贴本身不是问题。问题是当我们在不理解它们的情况下这样干。 + +几年前,一个曾经在我团队中工作的朋友需要将虚拟机模板从站点 A 复制到站点 B。他们无法理解为什么复制的文件在站点 A 上为 10GB,但是在站点 B 上却变为 100GB。 + +这位朋友认为 `rsync` 是一个神奇的工具,应该仅“同步”文件本身。但是,我们大多数人所忘记的是了解 `rsync` 的真正含义、用法,以及我认为最重要的是它原本是用来做什么的。本文提供了有关 `rsync` 的更多信息,并解释了那件事中发生了什么。 + +### 关于 rsync + +`rsync` 是由 Andrew Tridgell 和 Paul Mackerras 创建的工具,其动机是以下问题: + +假设你有两个文件,`file_A` 和 `file_B`。你希望将 `file_B` 更新为与 `file_A` 相同。显而易见的方法是将 `file_A` 复制到 `file_B`。 + +现在,假设这两个文件位于通过慢速通信链接(例如,拨号 IP 链接)连接的两个不同的服务器上。如果`file_A` 大,将其复制到 `file_B` 将会很慢,有时甚至是不可能完成的。为了提高效率,你可以在发送前压缩 `file_A`,但这通常只会获得 2 到 4 倍的效率提升。 + +现在假设 `file_A` 和 `file_B` 非常相似,并且为了加快处理速度,你可以利用这种相似性。一种常见的方法是仅通过链接发送 `file_A` 和 `file_B` 之间的差异,然后使用这个差异列表在远程端重建文件。 + +问题在于,用于在两个文件之间创建一组差异的常规方法依赖于能够读取两个文件。因此,它们要求链接的一端预先提供两个文件。如果它们在同一台计算机上不是同时可用的,则无法使用这些算法。(一旦将文件复制过来,就不需要做对比差异了)。而这是 `rsync` 解决的问题。 + +`rsync` 算法有效地计算源文件的哪些部分与现有目标文件的部分匹配。这样,匹配的部分就不需要通过链接发送了;所需要的只是对目标文件部分的引用。只有源文件中不匹配的部分才需要发送。 + +然后,接收者可以使用对现有目标文件各个部分的引用和原始素材来构造源文件的副本。 + +另外,可以使用一系列常用压缩算法中的任何一种来压缩发送到接收器的数据,以进一步提高速度。 + +我们都知道,`rsync` 算法以一种漂亮的方式解决了这个问题。 + +在 `rsync` 的介绍之后,回到那件事! + +### 问题 1:自动精简配置 + +有两件事可以帮助那个朋友了解正在发生的事情。 + +该文件在其他地方的大小变得越来越大的问题是由源系统上启用了自动精简配置Thin Provisioning(TP)引起的,这是一种优化存储区域网络(SAN)或网络连接存储(NAS)中可用空间效率的方法。 + +由于启用了 TP,源文件只有 10GB,并且在不使用任何其他配置的情况下使用 `rsync` 进行传输时,目标位置将接收到全部 100GB 的大小。`rsync` 无法自动完成该(TP)操作,必须对其进行配置。 + +进行此工作的选项是 `-S`(或 `–sparse`),它告诉 `rsync` 有效地处理稀疏文件。它会按照它说的做!它只会发送该稀疏数据,因此源和目标将有一个 10GB 的文件。 + +### 问题 2:更新文件 + +当发送一个更新的文件时会出现第二个问题。现在目标仅接收 10GB 了,但始终传输的是整个文件(包含虚拟磁盘),即使只是在该虚拟磁盘上更改了一个配置文件。换句话说,只是该文件的一小部分发生了更改。 + +用于此传输的命令是: + +``` +rsync -avS vmdk_file syncuser@host1:/destination +``` + +同样,了解 `rsync` 的工作方式也将有助于解决此问题。 + +上面是关于 `rsync` 的最大误解。我们许多人认为 `rsync` 只会发送文件的增量更新,并且只会自动更新需要更新的内容。**但这不是 `rsync` 的默认行为**。 + +如手册页所述,`rsync` 的默认行为是在目标位置创建文件的新副本,并在传输完成后将其移动到正确的位置。 + +要更改 `rsync` 的默认行为,你必须设置以下标志,然后 `rsync` 将仅发送增量: + +``` +--inplace 原地更新目标文件 +--partial 保留部分传输的文件 +--append 附加数据到更短的文件 +--progress 在传输时显示进度条 +``` + +因此,可以确切地执行我那个朋友想要的功能的完整命令是: + +``` +rsync -av --partial --inplace --append --progress vmdk_file syncuser@host1:/destination +``` + +注意,出于两个原因,这里必须删除稀疏选项 `-S`。首先是通过网络发送文件时,不能同时使用 `–sparse` 和 `–inplace`。其次,当你以前使用过 `–sparse` 发送文件时,就无法再使用 `–inplace` 进行更新。请注意,低于 3.1.3 的 `rsync` 版本将拒绝 `–sparse` 和 `–inplace` 的组合。 + +因此,即使那个朋友最终通过网络复制了 100GB,那也只需发生一次。以下所有更新仅复制差异,从而使复制非常高效。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/copying-large-files-with-rsync-and-some-misconceptions/ + +作者:[Daniel Leite de Abreu][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://fedoramagazine.org/author/dabreu/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/rsync-816x345.jpg diff --git a/published/20190916 Linux commands to display your hardware information.md b/published/20190916 Linux commands to display your hardware information.md new file mode 100644 index 0000000000..39cd92b312 --- /dev/null +++ b/published/20190916 Linux commands to display your hardware information.md @@ -0,0 +1,363 @@ +[#]: collector: (lujun9972) +[#]: translator: (way-ww) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11422-1.html) +[#]: subject: (Linux commands to display your hardware information) +[#]: via: (https://opensource.com/article/19/9/linux-commands-hardware-information) +[#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth) + +用 Linux 命令显示硬件信息 +====== + +> 通过命令行获取计算机硬件详细信息。 + +![](https://img.linux.net.cn/data/attachment/album/201910/04/120618q2k1fflrsy1bgbwp.jpg) + +你可能会有很多的原因需要查清计算机硬件的详细信息。例如,你需要修复某些问题并在论坛上发出请求,人们可能会立即询问你的计算机具体的信息。或者当你想要升级计算机配置时,你需要知道现有的硬件型号和能够升级的型号。这些都需要查询你的计算机具体规格信息。 + +最简单的方法是使用标准的 Linux GUI 程序之一: + +* [i-nex][2] 收集硬件信息,并且类似于 Windows 下流行的 [CPU-Z][3] 的显示。 +* [HardInfo][4] 显示硬件具体信息,甚至包括一组八个的流行的性能基准程序,你可以用它们评估你的系统性能。 +* [KInfoCenter][5] 和 [Lshw][6] 也能够显示硬件的详细信息,并且可以从许多软件仓库中获取。 + +或者,你也可以拆开计算机机箱去查看硬盘、内存和其他设备上的标签信息。或者你可以在系统启动时,按下[相应的按键][7]进入 UEFI 和 BIOS 界面获得信息。这两种方式都会向你显示硬件信息但省略软件信息。 + +你也可以使用命令行获取硬件信息。等一下… 这听起来有些困难。为什么你会要这样做? + +有时候通过使用一条针对性强的命令可以很轻松的找到特定信息。也可能你没有可用的 GUI 程序或者只是不想安装这样的程序。 + +使用命令行的主要原因可能是编写脚本。无论你是使用 Linux shell 还是其他编程语言来编写脚本通常都需要使用命令行。 + +很多检测硬件信息的命令行都需要使用 root 权限。所以要么切换到 root 用户,要么使用 `sudo` 在普通用户状态下发出命令: + +``` +sudo +``` + +并按提示输入你的密码。 + +这篇文章介绍了很多用于发现系统信息的有用命令。文章最后的快速查询表对它们作出了总结。 + +### 硬件概述 + +下面几条命令可以全面概述计算机硬件信息。 + +`inxi` 命令能够列出包括 CPU、图形、音频、网络、驱动、分区、传感器等详细信息。当论坛里的人尝试帮助其他人解决问题的时候,他们常常询问此命令的输出。这是解决问题的标准诊断程序: + +``` +inxi -Fxz +``` + +`-F` 参数意味着你将得到完整的输出,`x` 增加细节信息,`z` 参数隐藏像 MAC 和 IP 等私人身份信息。 + +`hwinfo` 和 `lshw` 命令以不同的格式显示大量相同的信息: + +``` +hwinfo --short +``` + +或 + +``` +lshw -short +``` + +这两条命令的长格式输出非常详细,但也有点难以阅读: + +``` +hwinfo +``` + +或 + +``` +lshw +``` + +### CPU 详细信息 + +通过命令你可以了解关于你的 CPU 的任何信息。使用 `lscpu` 命令或与它相近的 `lshw` 命令查看 CPU 的详细信息: + +``` +lscpu +``` + +或 + +``` +lshw -C cpu +``` + +在这两个例子中,输出的最后几行都列出了所有 CPU 的功能。你可以查看你的处理器是否支持特定的功能。 + +使用这些命令的时候,你可以通过使用 `grep` 命令过滤复杂的信息,并缩小所需信息范围。例如,只查看 CPU 品牌和型号: + +``` +lshw -C cpu | grep -i product +``` + +仅查看 CPU 的速度(兆赫兹): + +``` +lscpu | grep -i mhz +``` + +或其 [BogoMips][8] 额定功率: + +``` +lscpu | grep -i bogo +``` + +`grep` 命令的 `-i` 参数代表搜索结果忽略大小写。 + +### 内存 + +Linux 命令行使你能够收集关于你的计算机内存的所有可能的详细信息。你甚至可以不拆开计算机机箱就能确定是否可以为计算机添加额外的内存条。 + +使用 `dmidecode` 命令列出每根内存条和其容量: + +``` +dmidecode -t memory | grep -i size +``` + +使用以下命令获取系统内存更多的信息,包括类型、容量、速度和电压: + +``` +lshw -short -C memory +``` + +你肯定想知道的一件事是你的计算机可以安装的最大内存: + +``` +dmidecode -t memory | grep -i max +``` + +现在检查一下计算机是否有空闲的插槽可以插入额外的内存条。你可以通过使用命令在不打开计算机机箱的情况下就做到: + +``` +lshw -short -C memory | grep -i empty +``` + +输出为空则意味着所有的插槽都在使用中。 + +确定你的计算机拥有多少显卡内存需要下面的命令。首先使用 `lspci` 列出所有设备信息然后过滤出你想要的显卡设备信息: + +``` +lspci | grep -i vga +``` + +视频控制器的设备号输出信息通常如下: + +``` +00:02.0 VGA compatible controller: Intel Corporation 82Q35 Express Integrated Graphics Controller (rev 02) +``` + +现在再加上视频设备号重新运行 `lspci` 命令: + +``` +lspci -v -s 00:02.0 +``` + +输出信息中 `prefetchable` 那一行显示了系统中的显卡内存大小: + +``` +... +Memory at f0100000 (32-bit, non-prefetchable) [size=512K] +I/O ports at 1230 [size=8] +Memory at e0000000 (32-bit, prefetchable) [size=256M] +Memory at f0000000 (32-bit, non-prefetchable) [size=1M] +... +``` + +最后使用下面的命令展示当前内存使用量(兆字节): + +``` +free -m +``` + +这条命令告诉你多少内存是空闲的,多少命令正在使用中以及交换内存的大小和是否正在使用。例如,输出信息如下: + +``` +              total        used        free     shared    buff/cache   available +Mem:          11891        1326        8877      212        1687       10077 +Swap:          1999           0        1999 +``` + +`top` 命令为你提供内存使用更加详细的信息。它显示了当前全部内存和 CPU 使用情况并按照进程 ID、用户 ID 及正在运行的命令细分。同时这条命令也是全屏输出: + +``` +top +``` + +### 磁盘文件系统和设备 + +你可以轻松确定有关磁盘、分区、文件系统和其他设备信息。 + +显示每个磁盘设备的描述信息: + +``` +lshw -short -C disk +``` + +通过以下命令获取任何指定的 SATA 磁盘详细信息,例如其型号、序列号以及支持的模式和扇区数量等: + +``` +hdparm -i /dev/sda +``` + +当然,如果需要的话你应该将 `sda` 替换成 `sdb` 或者其他设备号。 + +要列出所有磁盘及其分区和大小,请使用以下命令: + +``` +lsblk +``` + +使用以下命令获取更多有关扇区数量、大小、文件系统 ID 和 类型以及分区开始和结束扇区: + +``` +fdisk -l +``` + +要启动 Linux,你需要确定 [GRUB][9] 引导程序的可挂载分区。你可以使用 `blkid` 命令找到此信息。它列出了每个分区的唯一标识符(UUID)及其文件系统类型(例如 ext3 或 ext4): + +``` +blkid +``` + +使用以下命令列出已挂载的文件系统和它们的挂载点,以及已用的空间和可用的空间(兆字节为单位): + +``` +df -m +``` + +最后,你可以列出所有的 USB 和 PCI 总线以及其他设备的详细信息: + +``` +lsusb +``` + +或 + +``` +lspci +``` + +### 网络 + +Linux 提供大量的网络相关命令,下面只是几个例子。 + +查看你的网卡硬件详细信息: + +``` +lshw -C network +``` + +`ifconfig` 是显示网络接口的传统命令: + +``` +ifconfig -a +``` + +但是现在很多人们使用: + +``` +ip link show +``` + +或 + +``` +netstat -i +``` + +在阅读输出时,了解常见的网络缩写十分有用: + +缩写 | 含义 +---|--- +`lo` | 回环接口 +`eth0` 或 `enp*` | 以太网接口 +`wlan0` | 无线网接口 +`ppp0` | 点对点协议接口(由拨号调制解调器、PPTP VPN 连接或者 USB 调制解调器使用) +`vboxnet0` 或 `vmnet*` | 虚拟机网络接口 + +表中的星号是通配符,代表不同系统的任意字符。 + +使用以下命令显示默认网关和路由表: + +``` +ip route | column -t +``` + +或 + +``` +netstat -r +``` + +### 软件 + +让我们以显示最底层软件详细信息的两条命令来结束。例如,如果你想知道是否安装了最新的固件该怎么办?这条命令显示了 UEFI 或 BIOS 的日期和版本: + +``` +dmidecode -t bios +``` + +内核版本是多少,以及它是 64 位的吗?网络主机名是什么?使用下面的命令查出结果: + +``` +uname -a +``` + +### 快速查询表 + +用途 | 命令 +--- | --- +显示所有硬件信息 | `inxi -Fxz` 或 `hwinfo --short` 或 `lshw  -short` +CPU 信息 | `lscpu` 或 `lshw -C cpu` +显示 CPU 功能(例如 PAE、SSE2) | `lshw -C cpu | grep -i capabilities` +报告 CPU 位数 | `lshw -C cpu | grep -i width` +显示当前内存大小和配置 | `dmidecode -t memory | grep -i size` 或 `lshw -short -C memory` +显示硬件支持的最大内存 | `dmidecode -t memory | grep -i max` +确定是否有空闲内存插槽 | `lshw -short -C memory | grep -i empty`(输出为空表示没有可用插槽) +确定显卡内存数量 | `lspci | grep -i vga` 然后指定设备号再次使用;例如:`lspci -v -s 00:02.0` 显卡内存数量就是 `prefetchable` 的值 +显示当前内存使用情况 | `free -m` 或 `top` +列出磁盘驱动器 | `lshw -short -C disk` +显示指定磁盘驱动器的详细信息 | `hdparm -i /dev/sda`(需要的话替换掉 `sda`) +列出磁盘和分区信息 | `lsblk`(简单) 或 `fdisk -l`(详细) +列出分区 ID(UUID)| `blkid` +列出已挂载文件系统挂载点以及已用和可用空间 | `df -m` +列出 USB 设备 | `lsusb` +列出 PCI 设备 | `lspci` +显示网卡详细信息 | `lshw -C network` +显示网络接口 | `ifconfig -a` 或 `ip link show` 或 `netstat -i` +显示路由表 | `ip route | column -t` 或 `netstat -r` +显示 UEFI/BIOS 信息 | `dmidecode -t bios` +显示内核版本网络主机名等 | `uname -a` + +你有喜欢的命令被我忽略掉的吗?请添加评论分享给大家。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-commands-hardware-information + +作者:[Howard Fosdick][a] +选题:[lujun9972][b] +译者:[way-ww](https://github.com/way-ww) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/howtechhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: http://sourceforge.net/projects/i-nex/ +[3]: https://www.cpuid.com/softwares/cpu-z.html +[4]: http://sourceforge.net/projects/hardinfo.berlios/ +[5]: https://userbase.kde.org/KInfoCenter +[6]: http://www.binarytides.com/linux-lshw-command/ +[7]: http://www.disk-image.com/faq-bootmenu.htm +[8]: https://en.wikipedia.org/wiki/BogoMips +[9]: https://www.dedoimedo.com/computers/grub.html diff --git a/published/20190918 Adding themes and plugins to Zsh.md b/published/20190918 Adding themes and plugins to Zsh.md new file mode 100644 index 0000000000..a9eaf0da80 --- /dev/null +++ b/published/20190918 Adding themes and plugins to Zsh.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11426-1.html) +[#]: subject: (Adding themes and plugins to Zsh) +[#]: via: (https://opensource.com/article/19/9/adding-plugins-zsh) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +给 Zsh 添加主题和插件 +====== + +> 通过 Oh My Zsh 安装的主题和插件来扩展 Zsh 的功能。 + +![](https://img.linux.net.cn/data/attachment/album/201910/05/120457r49mk2l9oelv94bi.jpg) + +在我的[前文][2]中,我向大家展示了如何安装并使用 [Z-Shell][2] (Zsh)。对于某些用户来说,Zsh 最令人激动的是它可以安装主题。Zsh 安装主题非常容易,一方面是因为有非常活跃的社区为 Z-Shell 设计主题,另一方面是因为有 [Oh My Zsh][3] 这个项目。这使得安装主题变得轻而易举。 + +主题的变化可能会立刻吸引你的注意力,因此如果你安装了 Zsh 并且将默认的 Shell 替换为 Zsh 时,你可能不喜欢 Shell 默认主题的样子,那么你可以立即更换 Oh My Zsh 自带的 100 多个主题。Oh My Zsh 不仅拥有大量精美的主题,同时还有数以百计的扩展 Zsh 功能的插件。 + +### 安装 Oh My Zsh + +Oh My Zsh 的[官网][3]建议你使用一个脚本在有网络的情况下来安装这个包。尽管 Oh My Zsh 项目几乎是可以令人信服的,但是盲目地在你的电脑上运行一个脚本这是一个糟糕的建议。如果你想运行这个脚本,你可以把它下载下来,看一下它实现了什么功能,在你确信你已经了解了它的所作所为之后,你就可以运行它了。 + +如果你下载了脚本并且阅读了它,你就会发现安装过程仅仅只有三步: + +#### 1、克隆 oh-my-zsh + +第一步,克隆 oh-my-zsh 库到 `~/.oh-my-zsh` 目录: + +``` +% git clone http://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh +``` + +#### 2、切换配置文件 + +下一步,备份你已有的 `.zshrc` 文件,然后将 oh-my-zsh 自带的配置文件移动到这个地方。这两步操作可以一步完成,只需要你的 `mv` 命令支持 `-b` 这个选项。 + +``` +% mv -b \ +~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +``` + +#### 3、编辑配置文件 + +默认情况下,Oh My Zsh 自带的配置文件是非常简陋的。如果你想将你自己的 `~/.zshrc` 文件合并到 `.oh-my-zsh` 的配置文件中。你可以使用 [cat][4] 命令将你的旧的配置文件添加到新文件的末尾。 + +``` +% cat ~/.zshrc~ >> ~/.zshrc +``` + +看一下默认的配置文件以及它提供的一些选项。用你最喜欢的编辑器打开 `~/.zshrc` 文件。这个文件有非常良好的注释。这是了解它的一个非常好的方法。 + +例如,你可以更改 `.oh-my-zsh` 目录的位置。在安装的时候,它默认是位于你的家目录。但是,根据 [Free Desktop][5] 所定义的现代 Linux 规范。这个目录应当放置于 `~/.local/share` 。你可以在配置文件中进行修改。如下所示: + +``` +# Path to your oh-my-zsh installation. +export ZSH=$HOME/.local/share/oh-my-zsh +``` + +然后将 .oh-my-zsh 目录移动到你新配置的目录下: + +``` +% mv ~/.oh-my-zsh $HOME/.local/share/oh-my-zsh +``` + +如果你使用的是 MacOS,这个目录可能会有点含糊不清,但是最合适的位置可能是在 `$HOME/Library/Application\ Support`。 + +### 重新启动 Zsh + +编辑配置文件之后,你必须重新启动你的 Shell。在这之前,你必须确定你的任何操作都已正确完成。例如,在你修改了 `.oh-my-zsh` 目录的路径之后。不要忘记将目录移动到新的位置。如果你不想重新启动你的 Shell。你可以使用 `source` 命令来使你的配置文件生效。 + +``` +% source ~/.zshrc +➜  .oh-my-zsh git:(master) ✗ +``` + +你可以忽略任何丢失更新文件的警告;他们将会在重启的时候再次进行解析。 + +### 更换你的主题 + +安装好 oh-my-zsh 之后。你可以将你的 Zsh 的主题设置为 `robbyrussell`,这是一个该项目维护者的主题。这个主题的更改是非常小的,仅仅是改变了提示符的颜色。 + +你可以通过列出 `.oh-my-zsh` 目录下的所有文件来查看所有安装的主题: + +``` +➜  .oh-my-zsh git:(master) ✗ ls ~/.local/share/oh-my-zsh/themes +3den.zsh-theme +adben.zsh-theme +af-magic.zsh-theme +afowler.zsh-theme +agnoster.zsh-theme +[...] +``` + +想在切换主题之前查看一下它的样子,你可以查看 Oh My Zsh 的 [wiki][6] 页面。要查看更多主题,可以查看 [外部主题][7] wiki 页面。 + +大部分的主题是非常易于安装和使用的,仅仅需要改变 `.zshrc` 文件中的配置选项然后重新载入配置文件。 + +``` +➜ ~ sed -i 's/_THEME=\"robbyrussel\"/_THEME=\"linuxonly\"/g' ~/.zshrc +➜ ~ source ~/.zshrc +seth@darkstar:pts/0->/home/skenlon (0) ➜ +``` + +其他的主题可能需要一些额外的配置。例如,为了使用 `agnoster` 主题,你必须先安装 Powerline 字体。这是一个开源字体,如果你使用 Linux 操作系统的话,这个字体很可能在你的软件库中存在。使用下面的命令安装这个字体: + +``` +➜ ~ sudo dnf install powerline-fonts +``` + +在配置文件中更改你的主题: + +``` +➜ ~ sed -i 's/_THEME=\"linuxonly\"/_THEME=\"agnoster\"/g' ~/.zshrc +``` + +重新启动你的 Sehll(一个简单的 `source` 命令并不会起作用)。一旦重启,你就可以看到新的主题: + +![agnoster theme][8] + +### 安装插件 + +Oh My Zsh 有超过 200 的插件,你可以在 `.oh-my-zsh/plugins` 中看到它们。每一个扩展目录下都有一个 `README` 文件解释了这个插件的作用。 + +一些插件相当简单。例如,`dnf`、`ubuntu`、`brew` 和 `macports` 插件仅仅是为了简化与 DNF、Apt、Homebres 和 MacPorts 的交互操作而定义的一些别名。 + +而其他的一些插件则较为复杂,`git` 插件默认是被激活使用的。当你的目录是一个 git 仓库的时候,这个扩展就会更新你的 Shell 提示符,以显示当前的分支和是否有未合并的更改。 + +为了激活这个扩展,你可以将这个扩展添加到你的配置文件 `~/.zshrc` 中。例如,你可以添加 `dnf` 和 `pass` 插件,按照如下的方式更改: + +``` +plugins=(git dnf pass) +``` + +保存修改,重新启动你的 Shell。 + +``` +% source ~/.zshrc +``` + +这个扩展现在就可以使用了。你可以通过使用 `dnf` 提供的别名来测试一下: + +``` +% dnfs fop +====== Name Exactly Matched: fop ====== +fop.noarch : XSL-driven print formatter +``` + +不同的插件做不同的事,因此你可以一次安装一两个插件来帮你学习新的特性和功能。 + +### 兼容性 + +一些 Oh My Zsh 插件具有通用性。如果你看到一个插件声称它可以与 Bash 兼容,那么它就可以在你自己的 Bash 中使用。另一些插件需要 Zsh 提供的特定功能。因此,它们并不是所有都能工作。但是你可以添加一些其他的插件,例如 `dnf`、`ubuntu`、`firewalld`,以及其他的一些插件。你可以使用 `source` 使你的选择生效。例如: + +``` +if [ -d $HOME/.local/share/oh-my-zsh/plugins ]; then +        source $HOME/.local/share/oh-my-zsh/plugins/dnf/dnf.plugin.zsh +fi +``` + +### 选择或者不选择 Zsh + +Z-shell 的内置功能和它由社区贡献的扩展功能都非常强大。你可以把它当成你的主 Shell 使用,你也可以在你休闲娱乐的时候尝试一下。这取决于你的爱好。 + +什么是你最喜爱的主题和扩展可以在下方的评论告诉我们! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/adding-plugins-zsh + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[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/build_structure_tech_program_code_construction.png?itok=nVsiLuag (Someone wearing a hardhat and carrying code ) +[2]: https://linux.cn/article-11378-1.html +[3]: https://ohmyz.sh/ +[4]: https://opensource.com/article/19/2/getting-started-cat-command +[5]: http://freedesktop.org +[6]: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +[7]: https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes +[8]: https://opensource.com/sites/default/files/uploads/zsh-agnoster.jpg (agnoster theme) +[9]: https://opensource.com/resources/what-is-git +[10]: https://opensource.com/article/19/7/make-linux-stronger-firewalls diff --git a/published/20190920 Hone advanced Bash skills by building Minesweeper.md b/published/20190920 Hone advanced Bash skills by building Minesweeper.md new file mode 100644 index 0000000000..59b0e8cbd1 --- /dev/null +++ b/published/20190920 Hone advanced Bash skills by building Minesweeper.md @@ -0,0 +1,325 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11430-1.html) +[#]: subject: (Hone advanced Bash skills by building Minesweeper) +[#]: via: (https://opensource.com/article/19/9/advanced-bash-building-minesweeper) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +通过编写扫雷游戏提高你的 Bash 技巧 +====== + +> 那些令人怀念的经典游戏可是提高编程能力的好素材。今天就让我们仔细探索一番,怎么用 Bash 编写一个扫雷程序。 + +![bash logo on green background][1] + +我在编程教学方面不是专家,但当我想更好掌握某一样东西时,会试着找出让自己乐在其中的方法。比方说,当我想在 shell 编程方面更进一步时,我决定用 Bash 编写一个[扫雷][2]游戏来加以练习。 + +如果你是一个有经验的 Bash 程序员,希望在提高技巧的同时乐在其中,那么请跟着我编写一个你的运行在终端中的扫雷游戏。完整代码可以在这个 [GitHub 存储库][3]中找到。 + +### 做好准备 + +在我编写任何代码之前,我列出了该游戏所必须的几个部分: + +1. 显示雷区 +2. 创建游戏逻辑 +3. 创建判断单元格是否可选的逻辑 +4. 记录可用和已查明(已排雷)单元格的个数 +5. 创建游戏结束逻辑 + +### 显示雷区 + +在扫雷中,游戏界面是一个由 2D 数组(列和行)组成的不透明小方格。每一格下都有可能藏有地雷。玩家的任务就是找到那些不含雷的方格,并且在这一过程中,不能点到地雷。这个 Bash 版本的扫雷使用 10x10 的矩阵,实际逻辑则由一个简单的 Bash 数组来完成。 + +首先,我先生成了一些随机数字。这将是地雷在雷区里的位置。控制地雷的数量,在开始编写代码之前,这么做会容易一些。实现这一功能的逻辑可以更好,但我这么做,是为了让游戏实现保持简洁,并有改进空间。(我编写这个游戏纯属娱乐,但如果你能将它修改的更好,我也是很乐意的。) + +下面这些变量在整个过程中是不变的,声明它们是为了随机生成数字。就像下面的 `a` - `g` 的变量,它们会被用来计算可排除的地雷的值: + +``` +# 变量 +score=0 # 会用来存放游戏分数 +# 下面这些变量,用来随机生成可排除地雷的实际值 +a="1 10 -10 -1" +b="-1 0 1" +c="0 1" +d="-1 0 1 -2 -3" +e="1 2 20 21 10 0 -10 -20 -23 -2 -1" +f="1 2 3 35 30 20 22 10 0 -10 -20 -25 -30 -35 -3 -2 -1" +g="1 4 6 9 10 15 20 25 30 -30 -24 -11 -10 -9 -8 -7" +# +# 声明 +declare -a room # 声明一个 room 数组,它用来表示雷区的每一格。 +``` + +接下来,我会用列(0-9)和行(a-j)显示出游戏界面,并且使用一个 10x10 矩阵作为雷区。(`M[10][10]` 是一个索引从 0-99,有 100 个值的数组。) 如想了解更多关于 Bash 数组的内容,请阅读这本书[那些关于 Bash 你所不了解的事: Bash 数组简介][4]。 + + +创建一个叫 `plough` 的函数,我们先将标题显示出来:两个空行、列头,和一行 `-`,以示意往下是游戏界面: + +``` +printf '\n\n' +printf '%s' "     a   b   c   d   e   f   g   h   i   j" +printf '\n   %s\n' "-----------------------------------------" +``` + +然后,我初始化一个计数器变量,叫 `r`,它会用来记录已显示多少横行。注意,稍后在游戏代码中,我们会用同一个变量 `r`,作为我们的数组索引。 在 [Bash for 循环][5]中,用 `seq` 命令从 0 增加到 9。我用数字(`d%`)占位,来显示行号(`$row`,由 `seq` 定义): + + +``` +r=0 # 计数器 +for row in $(seq 0 9); do + printf '%d ' "$row" # 显示 行数 0-9 +``` + +在我们接着往下做之前,让我们看看到现在都做了什么。我们先横着显示 `[a-j]` 然后再将 `[0-9]` 的行号显示出来,我们会用这两个范围,来确定用户排雷的确切位置。 + +接着,在每行中,插入列,所以是时候写一个新的 `for` 循环了。这一循环管理着每一列,也就是说,实际上是生成游戏界面的每一格。我添加了一些辅助函数,你能在源码中看到它的完整实现。 对每一格来说,我们需要一些让它看起来像地雷的东西,所以我们先用一个点(`.`)来初始化空格。为了实现这一想法,我们用的是一个叫 [`is_null_field`][6] 的自定义函数。 同时,我们需要一个存储每一格具体值的数组,这儿会用到之前已定义的全局数组 [`room`][7] , 并用 [变量 `r`][8]作为索引。随着 `r` 的增加,遍历所有单元格,并随机部署地雷。 + +``` +  for col in $(seq 0 9); do + ((r+=1)) # 循环完一列行数加一 + is_null_field $r # 假设这里有个函数,它会检查单元格是否为空,为真,则此单元格初始值为点(.) + printf '%s \e[33m%s\e[0m ' "|" "${room[$r]}" # 最后显示分隔符,注意,${room[$r]} 的第一个值为 '.',等于其初始值。 + #结束 col 循环 + done +``` + +最后,为了保持游戏界面整齐好看,我会在每行用一个竖线作为结尾,并在最后结束行循环: + +``` +printf '%s\n' "|" # 显示出行分隔符 +printf ' %s\n' "-----------------------------------------" +# 结束行循环 +done +printf '\n\n' +``` + +完整的 `plough` 代码如下: + +``` +plough() +{ +  r=0 +  printf '\n\n' +  printf '%s' "     a   b   c   d   e   f   g   h   i   j" +  printf '\n   %s\n' "-----------------------------------------" +  for row in $(seq 0 9); do +    printf '%d  ' "$row" +    for col in $(seq 0 9); do +       ((r+=1)) +       is_null_field $r +       printf '%s \e[33m%s\e[0m ' "|" "${room[$r]}" +    done +    printf '%s\n' "|" +    printf '   %s\n' "-----------------------------------------" +  done +  printf '\n\n' +} +``` + +我花了点时间来思考,`is_null_field` 的具体功能是什么。让我们来看看,它到底能做些什么。在最开始,我们需要游戏有一个固定的状态。你可以随便选择个初始值,可以是一个数字或者任意字符。我最后决定,所有单元格的初始值为一个点(`.`),因为我觉得,这样会让游戏界面更好看。下面就是这一函数的完整代码: + +``` +is_null_field() +{ + local e=$1 # 在数组 room 中,我们已经用过循环变量 'r' 了,这次我们用 'e' + if [[ -z "${room[$e]}" ]];then + room[$r]="." #这里用点(.)来初始化每一个单元格 + fi +} +``` + +现在,我已经初始化了所有的格子,现在只要用一个很简单的函数就能得出当前游戏中还有多少单元格可以操作: + +``` +get_free_fields() +{ + free_fields=0 # 初始化变量 + for n in $(seq 1 ${#room[@]}); do + if [[ "${room[$n]}" = "." ]]; then # 检查当前单元格是否等于初始值(.),结果为真,则记为空余格子。 + ((free_fields+=1)) +    fi +  done +} +``` + +这是显示出来的游戏界面,`[a-j]` 为列,`[0-9]` 为行。 + +![Minefield][9] + +### 创建玩家逻辑 + +玩家操作背后的逻辑在于,先从 [stdin][10] 中读取数据作为坐标,然后再找出对应位置实际包含的值。这里用到了 Bash 的[参数扩展][11],来设法得到行列数。然后将代表列数的字母传给分支语句,从而得到其对应的列数。为了更好地理解这一过程,可以看看下面这段代码中,变量 `o` 所对应的值。 举个例子,玩家输入了 `c3`,这时 Bash 将其分成两个字符:`c` 和 `3`。为了简单起见,我跳过了如何处理无效输入的部分。 + +``` + colm=${opt:0:1} # 得到第一个字符,一个字母 + ro=${opt:1:1} # 得到第二个字符,一个整数 + case $colm in + a ) o=1;; # 最后,通过字母得到对应列数。 + b ) o=2;; +    c ) o=3;; +    d ) o=4;; +    e ) o=5;; +    f ) o=6;; +    g ) o=7;; +    h ) o=8;; +    i ) o=9;; +    j ) o=10;; +  esac +``` + +下面的代码会计算用户所选单元格实际对应的数字,然后将结果储存在变量中。 + +这里也用到了很多的 `shuf` 命令,`shuf` 是一个专门用来生成随机序列的 [Linux 命令][12]。`-i` 选项后面需要提供需要打乱的数或者范围,`-n` 选项则规定输出结果最多需要返回几个值。Bash 中,可以在两个圆括号内进行[数学计算][13],这里我们会多次用到。 + +还是沿用之前的例子,玩家输入了 `c3`。 接着,它被转化成了 `ro=3` 和 `o=3`。 之后,通过上面的分支语句代码, 将 `c` 转化为对应的整数,带进公式,以得到最终结果 `i` 的值。 + +``` + i=$(((ro*10)+o)) # 遵循运算规则,算出最终值 + is_free_field $i $(shuf -i 0-5 -n 1) # 调用自定义函数,判断其指向空/可选择单元格。 +``` + +仔细观察这个计算过程,看看最终结果 `i` 是如何计算出来的: + +``` +i=$(((ro*10)+o)) +i=$(((3*10)+3))=$((30+3))=33 +``` + +最后结果是 33。在我们的游戏界面显示出来,玩家输入坐标指向了第 33 个单元格,也就是在第 3 行(从 0 开始,否则这里变成 4),第 3 列。 + +### 创建判断单元格是否可选的逻辑 + +为了找到地雷,在将坐标转化,并找到实际位置之后,程序会检查这一单元格是否可选。如不可选,程序会显示一条警告信息,并要求玩家重新输入坐标。 + +在这段代码中,单元格是否可选,是由数组里对应的值是否为点(`.`)决定的。如果可选,则重置单元格对应的值,并更新分数。反之,因为其对应值不为点,则设置变量 `not_allowed`。为简单起见,游戏中[警告消息][14]这部分源码,我会留给读者们自己去探索。 + +``` +is_free_field() +{ +  local f=$1 +  local val=$2 +  not_allowed=0 +  if [[ "${room[$f]}" = "." ]]; then +    room[$f]=$val +    score=$((score+val)) +  else +    not_allowed=1 +  fi +} +``` + +![Extracting mines][15] + +如输入坐标有效,且对应位置为地雷,如下图所示。玩家输入 `h6`,游戏界面会出现一些随机生成的值。在发现地雷后,这些值会被加入用户得分。 + +![Extracting mines][16] + +还记得我们开头定义的变量,`a` - `g` 吗,我会用它们来确定随机生成地雷的具体值。所以,根据玩家输入坐标,程序会根据(`m`)中随机生成的数,来生成周围其他单元格的值(如上图所示)。之后将所有值和初始输入坐标相加,最后结果放在 `i`(计算结果如上)中。 + +请注意下面代码中的 `X`,它是我们唯一的游戏结束标志。我们将它添加到随机列表中。在 `shuf` 命令的魔力下,`X` 可以在任意情况下出现,但如果你足够幸运的话,也可能一直不会出现。 + +``` +m=$(shuf -e a b c d e f g X -n 1) # 将 X 添加到随机列表中,当 m=X,游戏结束 + if [[ "$m" != "X" ]]; then # X 将会是我们爆炸地雷(游戏结束)的触发标志 + for limit in ${!m}; do # !m 代表 m 变量的值 + field=$(shuf -i 0-5 -n 1) # 然后再次获得一个随机数字 + index=$((i+limit)) # 将 m 中的每一个值和 index 加起来,直到列表结尾 + is_free_field $index $field +    done +``` + +我想要游戏界面中,所有随机显示出来的单元格,都靠近玩家选择的单元格。 + +![Extracting mines][17] + +### 记录已选择和可用单元格的个数 + +这个程序需要记录游戏界面中哪些单元格是可选择的。否则,程序会一直让用户输入数据,即使所有单元格都被选中过。为了实现这一功能,我创建了一个叫 `free_fields` 的变量,初始值为 `0`。用一个 `for` 循环,记录下游戏界面中可选择单元格的数量。 如果单元格所对应的值为点(`.`),则 `free_fields` 加一。 + +``` +get_free_fields() +{ +  free_fields=0 +  for n in $(seq 1 ${#room[@]}); do +    if [[ "${room[$n]}" = "." ]]; then +      ((free_fields+=1)) +    fi +  done +} +``` + +等下,如果 `free_fields=0` 呢? 这意味着,玩家已选择过所有单元格。如果想更好理解这一部分,可以看看这里的[源代码][18]。 + +``` +if [[ $free_fields -eq 0 ]]; then # 这意味着你已选择过所有格子 + printf '\n\n\t%s: %s %d\n\n' "You Win" "you scored" "$score" +      exit 0 +fi +``` + +### 创建游戏结束逻辑 + +对于游戏结束这种情况,我们这里使用了一些很[巧妙的技巧][19],将结果在屏幕中央显示出来。我把这部分留给读者朋友们自己去探索。 + +``` +if [[ "$m" = "X" ]]; then + g=0 # 为了在参数扩展中使用它 + room[$i]=X # 覆盖此位置原有的值,并将其赋值为X + for j in {42..49}; do # 在游戏界面中央, + out="gameover" + k=${out:$g:1} # 在每一格中显示一个字母 + room[$j]=${k^^} +      ((g+=1)) +    done +fi +``` + +最后,我们显示出玩家最关心的两行。 + +``` +if [[ "$m" = "X" ]]; then +      printf '\n\n\t%s: %s %d\n' "GAMEOVER" "you scored" "$score" +      printf '\n\n\t%s\n\n' "You were just $free_fields mines away." +      exit 0 +fi +``` + +![Minecraft Gameover][20] + +文章到这里就结束了,朋友们!如果你想了解更多,具体可以查看我的 [GitHub 存储库][3],那儿有这个扫雷游戏的源代码,并且你还能找到更多用 Bash 编写的游戏。 我希望,这篇文章能激起你学习 Bash 的兴趣,并乐在其中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/advanced-bash-building-minesweeper + +作者:[Abhishek Tamrakar][a] +选题:[lujun9972][b] +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tamrakar +[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) +[2]: https://en.wikipedia.org/wiki/Minesweeper_(video_game) +[3]: https://github.com/abhiTamrakar/playground/tree/master/bash_games +[4]: https://opensource.com/article/18/5/you-dont-know-bash-intro-bash-arrays +[5]: https://opensource.com/article/19/6/how-write-loop-bash +[6]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L114-L120 +[7]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L41 +[8]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L74 +[9]: https://opensource.com/sites/default/files/uploads/minefield.png (Minefield) +[10]: https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin) +[11]: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html +[12]: https://linux.die.net/man/1/shuf +[13]: https://www.tldp.org/LDP/abs/html/dblparens.html +[14]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L143-L177 +[15]: https://opensource.com/sites/default/files/uploads/extractmines.png (Extracting mines) +[16]: https://opensource.com/sites/default/files/uploads/extractmines2.png (Extracting mines) +[17]: https://opensource.com/sites/default/files/uploads/extractmines3.png (Extracting mines) +[18]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L91 +[19]: https://github.com/abhiTamrakar/playground/blob/28143053ced699c80569666f25268e8b96c38c46/bash_games/minesweeper.sh#L131-L141 +[20]: https://opensource.com/sites/default/files/uploads/gameover.png (Minecraft Gameover) diff --git a/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md new file mode 100644 index 0000000000..bd8516c2b3 --- /dev/null +++ b/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11487-1.html) +[#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots) +[#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +Manjaro 18.1(KDE)安装图解 +====== + +在 Manjaro 18.0(Illyria)发布一年之际,该团队发布了他们的下一个重要版本,即 Manjaro 18.1,代号为 “Juhraya”。该团队还发布了一份官方声明,称 Juhraya 包含了许多改进和错误修复。 + +### Manjaro 18.1 中的新功能 + +以下列出了 Manjaro 18.1 中的一些新功能和增强功能: + +* 可以在 LibreOffice 或 Free Office 之间选择 +* Xfce 版的新 Matcha 主题 +* 在 KDE 版本中重新设计了消息传递系统 +* 使用 bhau 工具支持 Snap 和 FlatPak 软件包 + +### 最小系统需求 + +* 1 GB RAM +* 1 GHz 处理器 +* 大约 30 GB 硬盘空间 +* 互联网连接 +* 启动介质(USB/DVD) + +### 安装 Manjaro 18.1(KDE 版)的分步指南 + +要在系统中开始安装 Manjaro 18.1(KDE 版),请遵循以下步骤: + +#### 步骤 1) 下载 Manjaro 18.1 ISO + +在安装之前,你需要从位于 [这里][1] 的官方下载页面下载 Manjaro 18.1 的最新副本。由于我们这里介绍的是 KDE 版本,因此我们选择 KDE 版本。但是对于所有桌面环境(包括 Xfce、KDE 和 Gnome 版本),安装过程都是相同的。 + +#### 步骤 2) 创建 USB 启动盘 + +从 Manjaro 下载页面成功下载 ISO 文件后,就可以创建 USB 磁盘了。将下载的 ISO 文件复制到 USB 磁盘中,然后创建可引导磁盘。确保将你的引导设置更改为使用 USB 引导,并重新启动系统。 + +#### 步骤 3) Manjaro Live 版安装环境 + +系统重新启动时,它将自动检测到 USB 驱动器,并开始启动进入 Manjaro Live 版安装屏幕。 + +![Boot-Manjaro-18-1-kde-installation][3] + +接下来,使用箭头键选择 “启动:Manjaro x86\_64 kdeBoot: Manjaro x86\_64 kde”,然后按回车键以启动 Manjaro 安装程序。 + +#### 安装 4) 选择启动安装程序 + +接下来,将启动 Manjaro 安装程序,如果你已连接到互联网,Manjaro 将自动检测你的位置和时区。单击 “启动安装程序Launch Installer”,开始在系统中安装 Manjaro 18.1 KDE 版本。 + +![Choose-Launch-Installaer-Manjaro18-1-kde][4] + +#### 步骤 5) 选择语言 + +接下来,安装程序将带你选择你的首选语言。 + +![Choose-Language-Manjaro18-1-Kde-Installation][5] + +选择你想要的语言,然后单击“下一步Next”。 + +#### 步骤 6) 选择时区和区域 + +在下一个屏幕中,选择所需的时区和区域,然后单击“下一步Next”继续。 + +![Select-Location-During-Manjaro18-1-KDE-Installation][6] + +#### 步骤 7) 选择键盘布局 + +在下一个屏幕中,选择你喜欢的键盘布局,然后单击“下一步Next”继续。 + +![Select-Keyboard-Layout-Manjaro18-1-kde-installation][7] + +#### 步骤 8) 选择分区类型 + +这是安装过程中非常关键的一步。 它将允许你选择分区方式: + +* 擦除磁盘 +* 手动分区 +* 并存安装 +* 替换分区 + +如果在 VM(虚拟机)中安装 Manjaro 18.1,则将看不到最后两个选项。 + +如果你不熟悉 Manjaro Linux,那么我建议你使用第一个选项(擦除磁盘Erase Disk),它将为你自动创建所需的分区。如果要创建自定义分区,则选择第二个选项“手动分区Manual Partitioning”,顾名思义,它将允许我们创建自己的自定义分区。 + +在本教程中,我将通过选择“手动分区Manual Partitioning”选项来创建自定义分区: + +![Manual-Partition-Manjaro18-1-KDE][8] + +选择第二个选项,然后单击“下一步Next”继续。 + +如我们所见,我有 40 GB 硬盘,因此我将在其上创建以下分区, + +* `/boot`       –  2GB(ext4) +* `/`           –  10 GB(ext4) +* `/home`      –  22 GB(ext4) +* `/opt`       –  4 GB(ext4) +* 交换分区Swap     –  2 GB + +当我们在上方窗口中单击“下一步Next”时,将显示以下屏幕,选择“新建分区表new partition table”: + +![Create-Partition-Table-Manjaro18-1-Installation][9] + +点击“确定OK”。 + +现在选择可用空间,然后单击“创建create”以将第一个分区设置为大小为 2 GB 的 `/boot`, + +![boot-partition-manjaro-18-1-installation][10] + +单击“确定OK”以继续操作,在下一个窗口中再次选择可用空间,然后单击“创建create”以将第二个分区设置为 `/`,大小为 10 GB: + +![slash-root-partition-manjaro18-1-installation][11] + +同样,将下一个分区创建为大小为 22 GB 的 `/home`: + +![home-partition-manjaro18-1-installation][12] + +到目前为止,我们已经创建了三个分区作为主分区,现在创建下一个分区作为扩展分区: + +![Extended-Partition-Manjaro18-1-installation][13] + +单击“确定OK”以继续。 + +创建大小分别为 5 GB 和 2 GB 的 `/opt` 和交换分区作为逻辑分区。 + +![opt-partition-manjaro-18-1-installation][14] + +![swap-partition-manjaro18-1-installation][15] + +完成所有分区的创建后,单击“下一步Next”: + +![choose-next-after-partition-creation][16] + +#### 步骤 9) 提供用户信息 + +在下一个屏幕中,你需要提供用户信息,包括你的姓名、用户名、密码、计算机名等: + +![User-creation-details-manjaro18-1-installation][17] + +提供所有信息后,单击“下一步Next”继续安装。 + +在下一个屏幕中,系统将提示你选择办公套件,因此请做出适合你的选择: + +![Office-Suite-Selection-Manjaro18-1][18] + +单击“下一步Next”以继续。 + +#### 步骤 10) 摘要信息 + +在完成实际安装之前,安装程序将向你显示你选择的所有详细信息,包括语言、时区、键盘布局和分区信息等。单击“安装Install”以继续进行安装过程。 + +![Summary-manjaro18-1-installation][19] + +#### 步骤 11) 进行安装 + +现在,实际的安装过程开始,一旦完成,请重新启动系统以登录到 Manjaro 18.1 KDE 版: + +![Manjaro18-1-Installation-Progress][20] + +![Restart-Manjaro-18-1-after-installation][21] + +#### 步骤 12) 安装成功后登录 + +重新启动后,我们将看到以下登录屏幕,使用我们在安装过程中创建的用户凭据登录: + +![Login-screen-after-manjaro-18-1-installation][22] + +点击“登录Login”。 + +![KDE-Desktop-Screen-Manjaro-18-1][23] + +就是这样!你已经在系统中成功安装了 Manjaro 18.1 KDE 版,并探索了所有令人兴奋的功能。请在下面的评论部分中发表你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://manjaro.org/download/official/kde/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Boot-Manjaro-18-1-kde-installation.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Launch-Installaer-Manjaro18-1-kde.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Language-Manjaro18-1-Kde-Installation.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Location-During-Manjaro18-1-KDE-Installation.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Keyboard-Layout-Manjaro18-1-kde-installation.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manual-Partition-Manjaro18-1-KDE.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Create-Partition-Table-Manjaro18-1-Installation.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-manjaro-18-1-installation.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-manjaro18-1-installation.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-manjaro18-1-installation.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Extended-Partition-Manjaro18-1-installation.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/opt-partition-manjaro-18-1-installation.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/swap-partition-manjaro18-1-installation.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/choose-next-after-partition-creation.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/User-creation-details-manjaro18-1-installation.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Office-Suite-Selection-Manjaro18-1.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Summary-manjaro18-1-installation.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manjaro18-1-Installation-Progress.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Restart-Manjaro-18-1-after-installation.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-after-manjaro-18-1-installation.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/KDE-Desktop-Screen-Manjaro-18-1.jpg diff --git a/published/20190923 Mutation testing by example- How to leverage failure.md b/published/20190923 Mutation testing by example- How to leverage failure.md new file mode 100644 index 0000000000..f0d5dac0df --- /dev/null +++ b/published/20190923 Mutation testing by example- How to leverage failure.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11483-1.html) +[#]: subject: (Mutation testing by example: How to leverage failure) +[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-tdd) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +变异测试:如何利用故障? +====== + +> 使用事先设计好的故障以确保你的代码达到预期的结果,并遵循 .NET xUnit.net 测试框架来进行测试。 + +![](https://img.linux.net.cn/data/attachment/album/201910/20/200030ipm13zmi08mv8z34.jpg) + +[在变异测试是 TDD 的演变][2] 一文中,我谈到了迭代的力量。在可度量的测试中,迭代能够保证找到问题的解决方案。在那篇文章中,我们讨论了迭代法帮助确定实现计算给定数字平方根的代码。 + +我还演示了最有效的方法是找到可衡量的目标或测试,然后以最佳猜测值开始迭代。正如所预期的,第一次测试通常会失败。因此,必须根据可衡量的目标或测试对失败的代码进行完善。根据运行结果,对测试值进行验证或进一步加以完善。 + +在此模型中,学习获得解决方案的唯一方法是反复失败。这听起来有悖常理,但它确实有效。 + +按照这种分析,本文探讨了在构建包含某些依赖项的解决方案时使用 DevOps 的最佳方法。第一步是编写一个预期结果失败的用例。 + +### 依赖性问题是你不能依赖它们 + +正如迈克尔·尼加德Michael Nygard在《[没有终结状态的架构][3]》中机智的表示的那样,依赖问题是一个很大的话题,最好留到另一篇文章中讨论。在这里,你将会看到依赖项给项目带来的一些潜在问题,以及如何利用测试驱动开发(TDD)来避免这些陷阱。 + +首先,找到现实生活中的一个挑战,然后看看如何使用 TDD 解决它。 + +### 谁把猫放出来? + +![一只猫站在屋顶][4] + +在敏捷开发环境中,通过定义期望结果开始构建解决方案会很有帮助。通常,在 [用户故事][5]user story 中描述期望结果: + +> 我想使用我的家庭自动化系统(HAS)来控制猫何时可以出门,因为我想保证它在夜间的安全。 + +现在你已经有了一个用户故事,你需要通过提供一些功能要求(即指定验收标准)来对其进行详细说明。 从伪代码中描述的最简单的场景开始: + +> 场景 1:在夜间关闭猫门 +> +> * 用时钟监测到了晚上的时间 +> * 时钟通知 HAS 系统 +> * HAS 关闭支持物联网(IoT)的猫门 + +### 分解系统 + +开始构建之前,你需要将正在构建的系统(HAS)进行分解(分解为依赖项)。你必须要做的第一件事是识别任何依赖项(如果幸运的话,你的系统没有依赖项,这将会更容易,但是,这样的系统可以说不是非常有用)。 + +从上面的简单场景中,你可以看到所需的业务成果(自动控制猫门)取决于对夜间情况监测。这种依赖性取决于时钟。但是时钟是无法区分白天和夜晚的。需要你来提供这种逻辑。 + +正在构建的系统中的另一个依赖项是能够自动访问猫门并启用或关闭它。该依赖项很可能取决于具有 IoT 功能的猫门提供的 API。 + +### 依赖管理面临快速失败 + +为了满足依赖项,我们将构建确定当前时间是白天还是晚上的逻辑。本着 TDD 的精神,我们将从一个小小的失败开始。 + +有关如何设置此练习所需的开发环境和脚手架的详细说明,请参阅我的[上一篇文章][2]。我们将重用相同的 NET 环境和 [xUnit.net][6] 框架。 + +接下来,创建一个名为 HAS(“家庭自动化系统”)的新项目,创建一个名为 `UnitTest1.cs` 的文件。在该文件中,编写第一个失败的单元测试。在此单元测试中,描述你的期望结果。例如,当系统运行时,如果时间是晚上 7 点,负责确定是白天还是夜晚的组件将返回值 `Nighttime`。 + +这是描述期望值的单元测试: + +``` +using System; +using Xunit; + +namespace unittest +{ + public class UnitTest1 + { + DayOrNightUtility dayOrNightUtility = new DayOrNightUtility(); + + [Fact] + public void Given7pmReturnNighttime() + { + var expected = "Nighttime"; + var actual = dayOrNightUtility.GetDayOrNight(); + Assert.Equal(expected, actual); + } + } +} +``` + +至此,你可能已经熟悉了单元测试的结构。快速复习一下:在此示例中,通过给单元测试一个描述性名称`Given7pmReturnNighttime` 来描述期望结果。然后,在单元测试的主体中,创建一个名为 `expected` 的变量,并为该变量指定期望值(在该示例中,值为 `Nighttime`)。然后,为实际值指定一个 `actual`(在组件或服务处理一天中的时间之后可用)。 + +最后,通过断言期望值和实际值是否相等来检查是否满足期望结果:`Assert.Equal(expected, actual)`。 + +你还可以在上面的列表中看到名为 `dayOrNightUtility` 的组件或服务。该模块能够接收消息`GetDayOrNight`,并且返回 `string` 类型的值。 + +同样,本着 TDD 的精神,描述的组件或服务还尚未构建(仅为了后面说明在此进行描述)。构建这些是由所描述的期望结果来驱动的。 + +在 `app` 文件夹中创建一个新文件,并将其命名为 `DayOrNightUtility.cs`。将以下 C# 代码添加到该文件中并保存: + +``` +using System; + +namespace app { + public class DayOrNightUtility { + public string GetDayOrNight() { + string dayOrNight = "Undetermined"; + return dayOrNight; + } + } +} +``` + +现在转到命令行,将目录更改为 `unittests` 文件夹,然后运行: + +``` +[Xunit.net 00:00:02.33] unittest.UnitTest1.Given7pmReturnNighttime [FAIL] +Failed unittest.UnitTest1.Given7pmReturnNighttime +[...] +``` + +恭喜,你已经完成了第一个失败的单元测试。单元测试的期望结果是 `DayOrNightUtility` 方法返回字符串 `Nighttime`,但相反,它返回是 `Undetermined`。 + +### 修复失败的单元测试 + +修复失败的测试的一种快速而粗略的方法是将值 `Undetermined` 替换为值 `Nighttime` 并保存更改: + +``` +using System; + +namespace app { + public class DayOrNightUtility { + public string GetDayOrNight() { + string dayOrNight = "Nighttime"; + return dayOrNight; + } + } +} +``` + +现在运行,成功了。 + +``` +Starting test execution, please wait... + +Total tests: 1. Passed: 1. Failed: 0. Skipped: 0. +Test Run Successful. +Test execution time: 2.6470 Seconds +``` + +但是,对值进行硬编码基本上是在作弊,最好为 `DayOrNightUtility` 方法赋予一些智能。修改 `GetDayOrNight` 方法以包括一些时间计算逻辑: + +``` +public string GetDayOrNight() { + string dayOrNight = "Daylight"; + DateTime time = new DateTime(); + if(time.Hour < 7) { + dayOrNight = "Nighttime"; + } + return dayOrNight; +} +``` + +该方法现在从系统获取当前时间,并与 `Hour` 比较,查看其是否小于上午 7 点。如果小于,则处理逻辑将 `dayOrNight` 字符串值从 `Daylight` 转换为 `Nighttime`。现在,单元测试通过。 + +### 测试驱动解决方案的开始 + +现在,我们已经开始了基本的单元测试,并为我们的时间依赖项提供了可行的解决方案。后面还有更多的测试案例需要执行。 + +在下一篇文章中,我将演示如何对白天时间进行测试以及如何在整个过程中利用故障。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mutation-testing-example-tdd + +作者:[Alex Bunardzic][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [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/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: https://linux.cn/article-11468-1.html +[3]: https://www.infoq.com/presentations/Architecture-Without-an-End-State/ +[4]: https://opensource.com/sites/default/files/uploads/cat.png (Cat standing on a roof) +[5]: https://www.agilealliance.org/glossary/user-stories +[6]: https://xunit.net/ +[7]: http://www.google.com/search?q=new+msdn.microsoft.com diff --git a/published/20190924 Fedora and CentOS Stream.md b/published/20190924 Fedora and CentOS Stream.md new file mode 100644 index 0000000000..d31e7437c0 --- /dev/null +++ b/published/20190924 Fedora and CentOS Stream.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11412-1.html) +[#]: subject: (Fedora and CentOS Stream) +[#]: via: (https://fedoramagazine.org/fedora-and-centos-stream/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 和 CentOS Stream +====== + +![][1] + +*一封来自 Fedora 项目负责人办公室的信件:* + +(LCTT 译注:背景介绍 —— 红帽宣布与 CentOS 同步构建一个 CentOS Stream 滚动构建版。我们知道 Fedora 是红帽企业版 Linux [RHEL] 的上游,经过 Fedora 验证的特性才会放入 RHEL;而 RHEL 发布后,其源代码开放出来形成了 CentOS。而新的 CentOS Stream 则位于 Fedora 和 RHEL 之间,会滚动添加新的实验特性、更新的软件包等。) + +嗨,大家好!你可能已经看到有关 [CentOS 项目变更][3]的[公告][2]。(如果没有,请花一些时间阅读它,我等你看完回来!)现在你可能想知道:如果 CentOS 现在位于 RHEL 的上游,那么 Fedora 会发生什么?那不是 Fedora 在 Red Hat 生态系统中的角色吗? + +首先,不用担心。整体有一些变化,但是一切都变得更好。 + +![][4] + +如果你一直在关注 RHEL 领导者关于 Fedora、CentOS 和 RHEL 之间关系的会议讨论,那么你就听说过 “[彭罗斯三角][5]Penrose Triangle”。形状就像 M. C. Escher 绘图中的形状:在现实生活中这是不可能的! + +我们已经思考了一段时间,*也许*几何不可能实际上是最好的模型。 + +一方面,想象中的流向最终的贡献会流回 Fedora 并以“良性循环”增长,但这种流从来没有真正起作用过。 真可惜,因为有一个庞大而强大的 CentOS 社区,并且有很多伟大的人在为此工作,而且 Fedora 社区也有很多重叠之处。我们错失了。 + +但是,这个缺口并不是唯一的空隙:在该项目与产品之间并没有真正一致的流程。到目前为止,该过程如下: + +1. 在上一版 RHEL 发布之后的某个时间,红帽突然会比以往更加关注 Fedora。 +2. 几个月后,红帽将分拆出一个内部开发的 RHEL 新版本。 +3. 几个月后,它便被带到了世界各地,成为所有包括 CentOS 在内的下游发行版的来源。 +4. 这些源持续向下更新,有时这些更新包括 Fedora 中的修补程序,但没有明确的路径。 + +这里的每个步骤都有其问题:间歇性注意力、闭门开发、盲目下发以及几乎没有持续的透明度。但是现在红帽和 CentOS 项目正在解决此问题,这对 Fedora 也是个好消息。 + +**Fedora 仍将是 RHEL 的[第一个][6]上游**。这是每个 RHEL 的来源,也是 RHEL 9 的来源。但是在 RHEL 分支之后,*CentOS* 将成为上游,以继续进行那些 RHEL 版本的工作。我喜欢称其为“中游”,但营销人员却不这样称呼,因此将其称为 “CentOS Stream”。 + +我们(Fedora、CentOS 和红帽)仍需要解决各种技术细节,但是我们的想法是这些分支将存在于同一软件包源存储库中。(目前的计划是制作一个 “src.centos.org”,它具有与 [src.fedoraproject.org][7] 相同数据的并行视图)。这项更改使公众可以看到已经发布的 RHEL 上正在进行的工作,并为开发人员和红帽合作伙伴在该级别进行协作提供了场所。 + +[CentOS SIG][8](虚拟化、存储、配置管理等特殊兴趣小组)将在 Fedora 分支旁边的共享空间中开展工作。这将使项目之间的协作和共享更加容易,我希望我们甚至能够合并一些类似的 SIG,以直接协同工作。在有用的情况下,可以将 Fedora 软件包中的修补程序挑选到 CentOS “中游”中,反之亦然。 + +最终,Fedora、CentOS 和 RHEL 属于同一大型项目家族。这种新的、更自然的流程为协作提供了可能性,这些协作被锁定在人为(和超维度!)障碍的后面。我们现在可以一起做,我感到非常兴奋! + +*—— Matthew Miller, Fedora 项目负责人* + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-and-centos-stream/ + +作者:[Matthew Miller][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://fedoramagazine.org/author/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/centos-stream-816x345.jpg +[2]: http://redhat.com/en/blog/transforming-development-experience-within-centos +[3]: https://wiki.centos.org/Manuals/ReleaseNotes/CentOSStream +[4]: https://lh3.googleusercontent.com/5XMDU29DYPsFKIVLCexK46n9DqWZEa0nTjAnJcouzww-RSAzNshGW3yIxXBSBsd6KfAyUAGpxX9y0Dsh1hj21ygcAn5a7h55LrneKROkxsipdXO2gq8cgoFqz582ojOh8NU9Ix0X +[5]: https://www.youtube.com/watch?v=1JmgOkEznjw +[6]: https://docs.fedoraproject.org/en-US/project/#_first +[7]: https://src.fedoraproject.org/ +[8]: https://wiki.centos.org/SpecialInterestGroup diff --git a/published/20190924 How DevOps professionals can become security champions.md b/published/20190924 How DevOps professionals can become security champions.md new file mode 100644 index 0000000000..c356e406ff --- /dev/null +++ b/published/20190924 How DevOps professionals can become security champions.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11498-1.html) +[#]: subject: (How DevOps professionals can become security champions) +[#]: via: (https://opensource.com/article/19/9/devops-security-champions) +[#]: author: (Jessica Repka https://opensource.com/users/jrepka) + +DevOps 专业人员如何成为网络安全拥护者 +====== + +> 打破信息孤岛,成为网络安全的拥护者,这对你、对你的职业、对你的公司都会有所帮助。 + +![](https://img.linux.net.cn/data/attachment/album/201910/24/202520u09xw2vm4w2jm0mx.jpg) + +安全是 DevOps 中一个被误解了的部分,一些人认为它不在 DevOps 的范围内,而另一些人认为它太过重要(并且被忽视),建议改为使用 DevSecOps。无论你同意哪一方的观点,网络安全都会影响到我们每一个人,这是很明显的事实。 + +每年,[黑客行为的统计数据][3] 都会更加令人震惊。例如,每 39 秒就有一次黑客行为发生,这可能会导致你为公司写的记录、身份和专有项目被盗。你的安全团队可能需要花上几个月(也可能是永远找不到)才能发现这次黑客行为背后是谁,目的是什么,人在哪,什么时候黑进来的。 + +运维专家面对这些棘手问题应该如何是好?呐我说,现在是时候成为网络安全的拥护者,变为解决方案的一部分了。 + +### 孤岛势力范围的战争 + +在我和我本地的 IT 安全(ITSEC)团队一起肩并肩战斗的岁月里,我注意到了很多事情。一个很大的问题是,安全团队和 DevOps 之间关系紧张,这种情况非常普遍。这种紧张关系几乎都是来源于安全团队为了保护系统、防范漏洞所作出的努力(例如,设置访问控制或者禁用某些东西),这些努力会中断 DevOps 的工作并阻碍他们快速部署应用程序。 + +你也看到了,我也看到了,你在现场碰见的每一个人都有至少一个和它有关的故事。一小撮的怨恨最终烧毁了信任的桥梁,要么是花费一段时间修复,要么就是两个团体之间开始一场小型的地盘争夺战,这个结果会使 DevOps 实现起来更加艰难。 + +### 一种新观点 + +为了打破这些孤岛并结束势力战争,我在每个安全团队中都选了至少一个人来交谈,了解我们组织日常安全运营里的来龙去脉。我开始做这件事是出于好奇,但我持续做这件事是因为它总是能带给我一些有价值的、新的观点。例如,我了解到,对于每个因为失败的安全性而被停止的部署,安全团队都在疯狂地尝试修复 10 个他们看见的其他问题。他们反应的莽撞和尖锐是因为他们必须在有限的时间里修复这些问题,不然这些问题就会变成一个大问题。 + +考虑到发现、识别和撤销已完成操作所需的大量知识,或者指出 DevOps 团队正在做什么(没有背景信息)然后复制并测试它。所有的这些通常都要由人手配备非常不足的安全团队完成。 + +这就是你的安全团队的日常生活,并且你的 DevOps 团队看不到这些。ITSEC 的日常工作意味着超时加班和过度劳累,以确保公司,公司的团队,团队里工作的所有人能够安全地工作。 + +### 成为安全拥护者的方法 + +这些是你成为你的安全团队的拥护者之后可以帮到它们的。这意味着,对于你做的所有操作,你必须仔细、认真地查看所有能够让其他人登录的方式,以及他们能够从中获得什么。 + +帮助你的安全团队就是在帮助你自己。将工具添加到你的工作流程里,以此将你知道的要干的活和他们知道的要干的活结合到一起。从小事入手,例如阅读公共漏洞披露(CVE),并将扫描模块添加到你的 CI/CD 流程里。对于你写的所有代码,都会有一个开源扫描工具,添加小型开源工具(例如下面列出来的)在长远看来是可以让项目更好的。 + +**容器扫描工具:** + + * [Anchore Engine][5] + * [Clair][6] + * [Vuls][7] + * [OpenSCAP][8] + +**代码扫描工具:** + + * [OWASP SonarQube][9] + * [Find Security Bugs][10] + * [Google Hacking Diggity Project][11] + +**Kubernetes 安全工具:** + + * [Project Calico][12] + * [Kube-hunter][13] + * [NeuVector][14] + +### 保持你的 DevOps 态度 + +如果你的工作角色是和 DevOps 相关的,那么学习新技术和如何运用这项新技术创造新事物就是你工作的一部分。安全也是一样。我在 DevOps 安全方面保持到最新,下面是我的方法的列表。 + + * 每周阅读一篇你工作的方向里和安全相关的文章. + * 每周查看 [CVE][15] 官方网站,了解出现了什么新漏洞. + * 尝试做一次黑客马拉松。一些公司每个月都要这样做一次;如果你觉得还不够、想了解更多,可以访问 Beginner Hack 1.0 网站。 + * 每年至少一次和那你的安全团队的成员一起参加安全会议,从他们的角度来看事情。 + +### 成为拥护者是为了变得更好 + +你应该成为你的安全的拥护者,下面是我们列出来的几个理由。首先是增长你的知识,帮助你的职业发展。第二是帮助其他的团队,培养新的关系,打破对你的组织有害的孤岛。在你的整个组织内建立由很多好处,包括设置沟通团队的典范,并鼓励人们一起工作。你同样能促进在整个组织中分享知识,并给每个人提供一个在安全方面更好的内部合作的新契机。 + +总的来说,成为一个网络安全的拥护者会让你成为你整个组织的拥护者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/devops-security-champions + +作者:[Jessica Repka][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://opensource.com/article/19/1/what-devsecops +[3]: https://hostingtribunal.com/blog/hacking-statistics/ +[4]: https://opensource.com/article/18/8/what-cicd +[5]: https://github.com/anchore/anchore-engine +[6]: https://github.com/coreos/clair +[7]: https://vuls.io/ +[8]: https://www.open-scap.org/ +[9]: https://github.com/OWASP/sonarqube +[10]: https://find-sec-bugs.github.io/ +[11]: https://resources.bishopfox.com/resources/tools/google-hacking-diggity/ +[12]: https://www.projectcalico.org/ +[13]: https://github.com/aquasecurity/kube-hunter +[14]: https://github.com/neuvector/neuvector-helm +[15]: https://cve.mitre.org/ +[16]: https://www.hackerearth.com/challenges/hackathon/beginner-hack-10/ diff --git a/published/20190924 Java still relevant, Linux desktop, and more industry trends.md b/published/20190924 Java still relevant, Linux desktop, and more industry trends.md new file mode 100644 index 0000000000..9823bf93e1 --- /dev/null +++ b/published/20190924 Java still relevant, Linux desktop, and more industry trends.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11453-1.html) +[#]: subject: (Java still relevant, Linux desktop, and more industry trends) +[#]: via: (https://opensource.com/article/19/9/java-relevant-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:Java 还有用吗、Linux 桌面以及更多的行业趋势 +====== + +> 开源社区和行业趋势的每周总览。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为我在具有开源开发模型的企业软件公司担任高级产品营销经理的角色的一部分,我为产品营销人员、经理和其他影响者定期发布有关开源社区,市场和行业趋势的定期更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### 《Java 还有用吗?》 + +- [文章地址][2] + +> 负责 Java Enterprise Edition(现为 Jakarta EE)的 Eclipse 基金会执行董事 Mike Milinkovich 也认为 Java 本身将不断发展以支持这些技术。“我认为 Java 将从 JVM 一直到 Java 本身都将发生变化,”Milinkovich 表示,“因此,JVM 中任何有助于将 JVM 与 Docker 容器集成在一起,以及能够更好地在 Kubernetes 中对 Docker 容器进行检测的新特性,都将是一个巨大的帮助。因此,我们将期待 Java SE 朝着这个方向发展。” + +**影响**:Jakarta EE 是 Java Enterprise Edition 的完全开源版本,奠定了 Java 未来发展的基础。一些 Java 有用论来自于在用 Java 开发中花费的令人难以置信的成本,以及软件开发人员在用它解决问题方面的多年经验。将其与生态系统中的创新相结合(例如,请参见 [Quarkus][3] 或 GraalVM),答案必须是“是”。 + +### 《GraalVM:多语言 JVM 的圣杯?》 + +- [文章地址][4] + +> 虽然大多数关于 GraalVM 的宣传都是围绕着将 JVM 项目编译成原生的程序,但是我们仍可以发现它的 Polyglot API 有很多价值。GraalVM 是一个引人注目的、已经完全可以用来替代 Nashorn 的选择,尽管迁移的路径仍然有一些困难,主要原因是缺乏文档。希望这篇文章能帮助其他人找到离开 Nashorn 通往圣杯之路。 + +**影响**:对于开放源码项目来说,最好的事情之一就是用户开始对一些新奇的应用程序赞不绝口,即使这些应用程序不是主要用例。“是的,听起来不错,我们甚至没有使用过那个功能(指在 JVM 上运行本地语言)……,(都可以感受得到它的优势,)然而我们使用了它的另一个功能(指 Polyglot API)!” + +### 《你可以说我疯了,但 Windows 11 或可以在 Linux 上运行》 + +- [文章链接][5] + +> 微软已经做了一些必要的工作。[Windows 的 Linux 子系统][6](WSL)的开发人员一直在致力于将 Linux API 调用映射到 Windows 中,反之亦然。在 WSL 的第一个版本中, 微软将 Windows 本地库、程序以及 Linux 之间的关键点连接起来了。当时,[Carmen Crincoli 发推文称][7]:“2017 年归根结底还是 Linux 桌面年。只不过这个桌面是 Windows。”Carmen Crincoli 是什么人?微软与存储和独立硬件供应商的合作伙伴经理。 + +**影响**:[Hieroglyph 项目][8] 的前提是“一部好的科幻小说都有一个对未来的愿景……是建立在现实主义的基础上的……(而这)引发我们思考自己的选择和互动对创造未来做出贡献的复杂方式。”微软的选择以及与更广泛的开源社区的互动是否可以导致科幻的未来?敬请关注! + +### 《Python 正在吞噬世界:一个开发人员的业余项目如何成为地球上最热门的编程语言》 + +- [文章链接][9] + +> 还有一个问题是,监督语言开发的机构“Python 核心开发人员和 Python 指导委员会”的组成是否能更好地反映 2019 年 Python 用户群的多样性。 +> +> Wijaya 称:“我希望看到在所有不同指标上都有更好的代表,不仅在性别平衡方面,而且在种族和其它所有方面。” +> +> “在 PyCon 上,我与来自印度和非洲的 [PyLadies][10] 成员进行了交谈。他们评论说:‘当我们听说 Python 或 PyLadies 时,我们想到的是北美或加拿大的人,而实际上,世界其它地区的用户群很大。为什么我们看不到更多?’我认为这很有意义。因此,我绝对希望看到这种情况发生,我认为我们都需要尽自己的一份力量。” + +**影响**: 在这个动荡的时代,谁不想听到一位仁慈独裁者(指 Python 创始人)把他们项目的统治权移交给最经常使用它的人呢? + +*我希望你喜欢这张上周让我印象深刻的列表,并在下周一回来了解更多的开放源码社区、市场和行业趋势。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/java-relevant-and-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [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://sdtimes.com/java/is-java-still-relevant/ +[3]: https://github.com/quarkusio/quarkus +[4]: https://www.transposit.com/blog/2019.01.02-graalvm-holy/?c=hn +[5]: https://www.computerworld.com/article/3438856/call-me-crazy-but-windows-11-could-run-on-linux.html#tk.rss_operatingsystems +[6]: https://blogs.msdn.microsoft.com/wsl/ +[7]: https://twitter.com/CarmenCrincoli/status/862714516257226752 +[8]: https://hieroglyph.asu.edu/2016/04/what-is-the-purpose-of-science-fiction-stories/ +[9]: https://www.techrepublic.com/article/python-is-eating-the-world-how-one-developers-side-project-became-the-hottest-programming-language-on-the-planet/ +[10]: https://www.pyladies.com/ diff --git a/published/20190924 Mutation testing by example- Failure as experimentation.md b/published/20190924 Mutation testing by example- Failure as experimentation.md new file mode 100644 index 0000000000..bc1b43181f --- /dev/null +++ b/published/20190924 Mutation testing by example- Failure as experimentation.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11494-1.html) +[#]: subject: (Mutation testing by example: Failure as experimentation) +[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-failure-experimentation) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzichttps://opensource.com/users/jocunddew) + +变异测试:基于故障的试验 +====== + +> 基于 .NET 的 xUnit.net 测试框架,开发一款自动猫门的逻辑,让门在白天开放,夜间锁定。 + +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +在本系列的[第一篇文章][2]中,我演示了如何使用设计的故障来确保代码中的预期结果。在第二篇文章中,我将继续开发示例项目:一款自动猫门,该门在白天开放,夜间锁定。 + +在此提醒一下,你可以按照[此处的说明][3]使用 .NET 的 xUnit.net 测试框架。 + +### 关于白天时间 + +回想一下,测试驱动开发(TDD)围绕着大量的单元测试。 + +第一篇文章中实现了满足 `Given7pmReturnNighttime` 单元测试期望的逻辑。但还没有完,现在,你需要描述当前时间大于 7 点时期望发生的结果。这是新的单元测试,称为 `Given7amReturnDaylight`: + +``` + [Fact] + public void Given7amReturnDaylight() + { + var expected = "Daylight"; + var actual = dayOrNightUtility.GetDayOrNight(); + Assert.Equal(expected, actual); + } +``` + +现在,新的单元测试失败了(越早失败越好!): + +``` +Starting test execution, please wait... +[Xunit.net 00:00:01.23] unittest.UnitTest1.Given7amReturnDaylight [FAIL] +Failed unittest.UnitTest1.Given7amReturnDaylight +[...] +``` + +期望接收到字符串值是 `Daylight`,但实际接收到的值是 `Nighttime`。 + +### 分析失败的测试用例 + +经过仔细检查,代码本身似乎已经出现问题。 事实证明,`GetDayOrNight` 方法的实现是不可测试的! + +看看我们面临的核心挑战: + +1. `GetDayOrNight` 依赖隐藏输入。 + + `dayOrNight` 的值取决于隐藏输入(它从内置系统时钟中获取一天的时间值)。 +2. `GetDayOrNight` 包含非确定性行为。 + + 从系统时钟中获取到的时间值是不确定的。(因为)该时间取决于你运行代码的时间点,而这一点我们认为这是不可预测的。 +3. `GetDayOrNight` API 的质量差。 + + 该 API 与具体的数据源(系统 `DateTime`)紧密耦合。 +4. `GetDayOrNight` 违反了单一责任原则。 + + 该方法实现同时使用和处理信息。优良作法是一种方法应负责执行一项职责。 +5. `GetDayOrNight` 有多个更改原因。 + + 可以想象内部时间源可能会更改的情况。同样,很容易想象处理逻辑也将改变。这些变化的不同原因必须相互隔离。 +6. 当(我们)尝试了解 `GetDayOrNight` 行为时,会发现它的 API 签名不足。 + + 最理想的做法就是通过简单的查看 API 的签名,就能了解 API 预期的行为类型。 +7. `GetDayOrNight` 取决于全局共享可变状态。 + + 要不惜一切代价避免共享的可变状态! +8. 即使在阅读源代码之后,也无法预测 `GetDayOrNight` 方法的行为。 + + 这是一个严重的问题。通过阅读源代码,应该始终非常清晰,系统一旦开始运行,便可以预测出其行为。 + +### 失败背后的原则 + +每当你遇到工程问题时,建议使用久经考验的分而治之divide and conquer策略。在这种情况下,遵循关注点分离separation of concerns的原则是一种可行的方法。 + +> 关注点分离(SoC)是一种用于将计算机程序分为不同模块的设计原理,以便每个模块都可以解决一个关注点。关注点是影响计算机程序代码的一组信息。关注点可以和要优化代码的硬件的细节一样概括,也可以和要实例化的类的名称一样具体。完美体现 SoC 的程序称为模块化程序。 +> +> ([出处][4]) + +`GetDayOrNight` 方法应仅与确定日期和时间值表示白天还是夜晚有关。它不应该与寻找该值的来源有关。该问题应留给调用客户端。 + +必须将这个问题留给调用客户端,以获取当前时间。这种方法符合另一个有价值的工程原理——控制反转inversion of control。Martin Fowler [在这里][5]详细探讨了这一概念。 + +> 框架的一个重要特征是用户定义的用于定制框架的方法通常来自于框架本身,而不是从用户的应用程序代码调用来的。该框架通常在协调和排序应用程序活动中扮演主程序的角色。控制权的这种反转使框架有能力充当可扩展的框架。用户提供的方法为框架中的特定应用程序量身制定泛化算法。 +> +> -- [Ralph Johnson and Brian Foote][6] + +### 重构测试用例 + +因此,代码需要重构。摆脱对内部时钟的依赖(`DateTime` 系统实用程序): + +``` + DateTime time = new DateTime(); +``` + +删除上述代码(在你的文件中应该是第 7 行)。通过将输入参数 `DateTime` 时间添加到 `GetDayOrNight` 方法,进一步重构代码。 + +这是重构的类 `DayOrNightUtility.cs`: + +``` +using System; + +namespace app { + public class DayOrNightUtility { + public string GetDayOrNight(DateTime time) { + string dayOrNight = "Nighttime"; + if(time.Hour >= 7 && time.Hour < 19) { + dayOrNight = "Daylight"; + } + return dayOrNight; + } + } +} +``` + +重构代码需要更改单元测试。 需要准备 `nightHour` 和 `dayHour` 的测试数据,并将这些值传到`GetDayOrNight` 方法中。 以下是重构的单元测试: + +``` +using System; +using Xunit; +using app; + +namespace unittest +{ + public class UnitTest1 + { + DayOrNightUtility dayOrNightUtility = new DayOrNightUtility(); + DateTime nightHour = new DateTime(2019, 08, 03, 19, 00, 00); + DateTime dayHour = new DateTime(2019, 08, 03, 07, 00, 00); + + [Fact] + public void Given7pmReturnNighttime() + { + var expected = "Nighttime"; + var actual = dayOrNightUtility.GetDayOrNight(nightHour); + Assert.Equal(expected, actual); + } + + [Fact] + public void Given7amReturnDaylight() + { + var expected = "Daylight"; + var actual = dayOrNightUtility.GetDayOrNight(dayHour); + Assert.Equal(expected, actual); + } + + } +} +``` + +### 经验教训 + +在继续开发这种简单的场景之前,请先回顾复习一下本次练习中所学到的东西。 + +运行无法测试的代码,很容易在不经意间制造陷阱。从表面上看,这样的代码似乎可以正常工作。但是,遵循测试驱动开发(TDD)的实践(首先描述期望结果,然后才描述实现),暴露了代码中的严重问题。 + +这表明 TDD 是确保代码不会太凌乱的理想方法。TDD 指出了一些问题区域,例如缺乏单一责任和存在隐藏输入。此外,TDD 有助于删除不确定性代码,并用行为明确的完全可测试代码替换它。 + +最后,TDD 帮助交付易于阅读、逻辑易于遵循的代码。 + +在本系列的下一篇文章中,我将演示如何使用在本练习中创建的逻辑来实现功能代码,以及如何进行进一步的测试使其变得更好。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mutation-testing-example-failure-experimentation + +作者:[Alex Bunardzic][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [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/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://linux.cn/article-11483-1.html +[3]: https://linux.cn/article-11468-1.html +[4]: https://en.wikipedia.org/wiki/Separation_of_concerns +[5]: https://martinfowler.com/bliki/InversionOfControl.html +[6]: http://www.laputan.org/drc/drc.html +[7]: http://www.google.com/search?q=new+msdn.microsoft.com diff --git a/published/20190925 3 quick tips for working with Linux files.md b/published/20190925 3 quick tips for working with Linux files.md new file mode 100644 index 0000000000..dcf0c29398 --- /dev/null +++ b/published/20190925 3 quick tips for working with Linux files.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11445-1.html) +[#]: subject: (3 quick tips for working with Linux files) +[#]: via: (https://www.networkworld.com/article/3440035/3-quick-tips-for-working-with-linux-files.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +处理 Linux 文件的 3 个技巧 +====== + +> Linux 提供了许多用于查找、计数和重命名文件的命令。这有一些有用的选择。 + +![](https://img.linux.net.cn/data/attachment/album/201910/11/101136ei4sslezne7esyis.jpg) + +Linux 提供了多种用于处理文件的命令,这些命令可以节省你的时间,并使你的工作不那么繁琐。 + +### 查找文件 + +当你查找文件时,`find` 可能会是第一个想到的命令,但是有时精心设计的 `ls` 命令会更好。想知道你昨天离开办公室回家前调用的脚本么?简单!使用 `ls` 命令并加上 `-ltr` 选项。最后一个列出的将是最近创建或更新的文件。 + +``` +$ ls -ltr ~/bin | tail -3 +-rwx------ 1 shs shs 229 Sep 22 19:37 checkCPU +-rwx------ 1 shs shs 285 Sep 22 19:37 ff +-rwxrw-r-- 1 shs shs 1629 Sep 22 19:37 test2 +``` + +像这样的命令将仅列出今天更新的文件: + +``` +$ ls -al --time-style=+%D | grep `date +%D` +drwxr-xr-x 60 shs shs 69632 09/23/19 . +drwxrwxr-x 2 shs shs 8052736 09/23/19 bin +-rw-rw-r-- 1 shs shs 506 09/23/19 stats +``` + +如果你要查找的文件可能不在当前目录中,那么 `find` 将比 `ls` 提供更好的选项,但它可能会输出比你想要的更多结果。在下面的命令中,我们*不*搜索以点开头的目录(它们很多一直在更新),指定我们要查找的是文件(即不是目录),并要求仅显示最近一天 (`-mtime -1`)更新过的文件。 + +``` +$ find . -not -path '*/\.*' -type f -mtime -1 -ls + 917517 0 -rwxrw-r-- 1 shs shs 683 Sep 23 11:00 ./newscript +``` + +注意 `-not` 选项反转了 `-path` 的行为,因此我们不会搜索以点开头的子目录。 + +如果只想查找最大的文件和目录,那么可以使用类似 `du` 这样的命令,它会按大小列出当前目录的内容。将输出通过管道传输到 `tail`,仅查看最大的几个。 + +``` +$ du -kx | egrep -v "\./.+/" | sort -n | tail -5 +918984 ./reports +1053980 ./notes +1217932 ./.cache +31470204 ./photos +39771212 . +``` + +`-k` 选项让 `du` 以块列出文件大小,而 `x` 可防止其遍历其他文件系统上的目录(例如,通过符号链接引用)。事实上,`du` 会先列出文件大小,这样可以按照大小排序(`sort -n`)。 + +### 文件计数 + +使用 `find` 命令可以很容易地计数任何特定目录中的文件。你只需要记住,`find` 会递归到子目录中,并将这些子目录中的文件与当前目录中的文件一起计数。在此命令中,我们计数一个特定用户(`username`)的家目录中的文件。根据家目录的权限,这可能需要使用 `sudo`。请记住,第一个参数是搜索的起点。这里指定的是用户的家目录。 + +``` +$ find ~username -type f 2>/dev/null | wc -l +35624 +``` + +请注意,我们正在将上面 `find` 命令的错误输出发送到 `/dev/null`,以避免搜索类似 `~username/.cache` 这类无法搜索并且对它的内容也不感兴趣的文件夹。 + +必要时,你可以使用 `maxdepth 1` 选项将 `find` 限制在单个目录中: + +``` +$ find /home/shs -maxdepth 1 -type f | wc -l +387 +``` + +### 重命名文件 + +使用 `mv` 命令可以很容易地重命名文件,但是有时你会想重命名大量文件,并且不想花费大量时间。例如,要将你在当前目录的文件名中找到的所有空格更改为下划线,你可以使用如下命令: + +``` +$ rename 's/ /_/g' * +``` + +如你怀疑的那样,此命令中的 `g` 表示“全局”。这意味着该命令会将文件名中的*所有*空格更改为下划线,而不仅仅是第一个。 + +要从文本文件中删除 .txt 扩展名,可以使用如下命令: + +``` +$ rename 's/.txt//g' * +``` + +### 总结 + +Linux 命令行提供了许多用于处理文件的有用选择。请提出你认为特别有用的其他命令。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440035/3-quick-tips-for-working-with-linux-files.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/09/file_key-100811696-large.jpg +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/20190925 Essential Accessories for Intel NUC Mini PC.md b/published/20190925 Essential Accessories for Intel NUC Mini PC.md new file mode 100644 index 0000000000..8d6f9b7f63 --- /dev/null +++ b/published/20190925 Essential Accessories for Intel NUC Mini PC.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11485-1.html) +[#]: subject: (Essential Accessories for Intel NUC Mini PC) +[#]: via: (https://itsfoss.com/intel-nuc-essential-accessories/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +英特尔 NUC 迷你 PC 的基本配件 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/20/224650me0qoiqjeiysqqph.jpg) + +几周前,我买了一台 [英特尔 NUC 迷你 PC][1]。我[在上面安装了 Linux][2],我非常喜欢它。这个小巧的无风扇机器取代了台式机那庞大的 CPU。 + +英特尔 NUC 通常采用准系统形式,这意味着它没有任何内存、硬盘,也显然没有操作系统。许多[基于 Linux 的微型 PC][3] 定制化英特尔 NUC 并添加磁盘、RAM 和操作系统将它出售给终端用户。 + +不用说,它不像大多数其他台式机那样带有键盘、鼠标或屏幕。 + +[英特尔 NUC][4] 是一款出色的设备,如果你要购买台式机,我强烈建议你购买它。如果你正在考虑购买英特尔 NUC,你需要买一些配件,以便开始使用它。 + +### 基本的英特尔 NUC 配件 + +![][5] + +*文章中的 Amazon 链接是(原文的)受益链接。请阅读我们的[受益政策][6]。 + +#### 外围设备:显示器、键盘和鼠标 + +这很容易想到。你需要有屏幕、键盘和鼠标才能使用计算机。你需要一台有 HDMI 连接的显示器和一个 USB 或无线键盘鼠标。如果你已经有了这些东西,那你可以继续。 + +如果你正在寻求建议,我建议购买 LG IPS LED 显示器。我有两台 22 英寸的型号,我对它提供的清晰视觉效果感到满意。 + +这些显示器有一个简单的固定支架。如果要使显示器可以上下移动并纵向旋转,请尝试使用 [HP EliteDisplay 显示器][7]。 + +![HP EliteDisplay Monitor][8] + +我在多屏设置中同时连接了三台显示器。一台显示器连接到指定的 HDMI 端口。两台显示器通过 [Club 3D 的 Thunderbolt 转 HDMI 分配器][9]连接到 Thunderbolt 端口。 + +你也可以选择超宽显示器。我对此没有亲身经历。 + +#### 内存 + +英特尔 NUC 有两个内存插槽,最多可支持 32GB 内存。由于我的是 i3 核心处理器,因此我选择了 [Crucial 的 8GB DDR4 内存][11],价格约为 $33。 + +![][12] + +8 GB 内存在大多数情况下都没问题,但是如果你的是 i7 核心处理器,那么可以选择 [16GB 内存][13],价格约为 $67。你可以加两条,以获得最大 32GB。选择全在于你。 + +#### 硬盘(重要) + +英特尔 NUC 同时支持 2.5 英寸驱动器和 M.2 SSD,因此你可以同时使用两者以获得更多存储空间。 + +2.5 英寸插槽可同时容纳 SSD 和 HDD。我强烈建议选择 SSD,因为它比 HDD 快得多。[480GB 2.5 英寸][14]的价格是 $60。我认为这是一个合理的价格。 + +![][15] + +2.5 英寸驱动器的标准 SATA 口速度为 6 Gb/秒。根据你是否选择 NVMe SSD,M.2 插槽可能会更快。 NVMe(非易失性内存主机控制器接口规范)SSD 的速度比普通 SSD(也称为 SATA SSD)快 4 倍。但是它们可能也比 SATA M2 SSD 贵一些。 + +当购买 M.2 SSD 时,请检查产品图片。无论是 NVMe 还是 SATA SSD,都应在磁盘本身的图片中提到。你可以考虑使用[经济的三星 EVO NVMe M.2 SSD][16]。 + +![Make sure that your are buying the faster NVMe M2 SSD][17] + +M.2 插槽和 2.5 英寸插槽中的 SATA SSD 具有相同的速度。这就是为什么如果你不想选择昂贵的 NVMe SSD,建议你选择 2.5 英寸 SATA SSD,并保留 M.2 插​​槽供以后升级。 + +#### 交流电源线 + +当我拿到 NUC 时,为惊讶地发现,尽管它有电源适配器,但它并没有插头。 + +正如一些读者指出的那样,你可能有完整的电源线。这取决于你的地理区域和供应商。因此,请检查产品说明和用户评论,以验证其是否具有完整的电源线。 + +![][10] + +#### 其他配套配件 + +你需要使用 HDMI 线缆连接显示器。如果你要购买新显示器,通常应会有一根线缆。 + +如果要使用 M.2 插槽,那么可能需要螺丝刀。英特尔 NUC 是一款出色的设备,你只需用手旋转四个脚即可拧开底部面板。你必须打开设备才能放置内存和磁盘。 + +![Intel NUC with Security Cable | Image Credit Intel][18] + +NUC 还有防盗孔,可与防盗绳一起使用。在业务环境中,建议使用防盗绳保护计算机安全。购买[防盗绳几美元][19]便可节省数百美元。 + +### 你使用什么配件? + +这些就是我在使用和建议使用的英特尔 NUC 配件。你呢?如果你有一台 NUC,你会使用哪些配件并推荐给其他 NUC 用户? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/intel-nuc-essential-accessories/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (barebone Intel NUC mini PC) +[2]: https://linux.cn/article-11477-1.html +[3]: https://itsfoss.com/linux-based-mini-pc/ +[4]: https://www.intel.in/content/www/in/en/products/boards-kits/nuc.html +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-accessories.png?ssl=1 +[6]: https://itsfoss.com/affiliate-policy/ +[7]: https://www.amazon.com/HP-EliteDisplay-21-5-Inch-1FH45AA-ABA/dp/B075L4VKQF?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B075L4VKQF (HP EliteDisplay monitors) +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/hp-elitedisplay-monitor.png?ssl=1 +[9]: https://www.amazon.com/Club3D-CSV-1546-USB-C-Multi-Monitor-Splitter/dp/B06Y2FX13G?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B06Y2FX13G (thunderbolt to HDMI splitter from Club 3D) +[10]: https://img.linux.net.cn/data/attachment/album/201910/20/224718eebvzvvvm0b6f3ow.jpg +[11]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB DDR4 RAM from Crucial) +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/crucial-ram.jpg?ssl=1 +[13]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B019FRBHZ0?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B019FRBHZ0 (16 GB RAM) +[14]: https://www.amazon.com/Green-480GB-Internal-SSD-WDS480G2G0A/dp/B01M3POPK3?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M3POPK3 (480 GB 2.5) +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/wd-green-ssd.png?ssl=1 +[16]: https://www.amazon.com/Samsung-970-EVO-500GB-MZ-V7E500BW/dp/B07BN4NJ2J?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07BN4NJ2J (Samsung EVO is a cost effective NVMe M.2 SSD) +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/samsung-evo-nvme.jpg?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-security-cable.jpg?ssl=1 +[19]: https://www.amazon.com/Kensington-Combination-Laptops-Devices-K64673AM/dp/B005J7Y99W?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B005J7Y99W (few dollars in the security cable) diff --git a/published/20190925 Mirror your Android screen on your computer with Guiscrcpy.md b/published/20190925 Mirror your Android screen on your computer with Guiscrcpy.md new file mode 100644 index 0000000000..a0c8a223bd --- /dev/null +++ b/published/20190925 Mirror your Android screen on your computer with Guiscrcpy.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11434-1.html) +[#]: subject: (Mirror your Android screen on your computer with Guiscrcpy) +[#]: via: (https://opensource.com/article/19/9/mirror-android-screen-guiscrcpy) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 guiscrcpy 将你的安卓手机的屏幕投射到你的电脑 +====== + +> 使用这个基于 scrcpy 的开源应用从你的电脑上访问你的安卓设备。 + +![](https://img.linux.net.cn/data/attachment/album/201910/08/123143nlz718152v5nf5n8.png) + +在未来,你所需的一切信息皆触手可及,并且全部会以全息的形式出现在空中,即使你在驾驶汽车时也可以与之交互。不过,那是未来,在那一刻到来之前,我们所有人都只能将信息分散在笔记本电脑、手机、平板电脑和智能冰箱上。不幸的是,这意味着当我们需要来自该设备的信息时,我们通常必须查看该设备。 + +虽然不完全是像全息终端或飞行汽车那样酷炫,但 [srevin saju][3] 开发的 [guiscrcpy][2] 是一个可以在一个地方整合多个屏幕,让你有一点未来感觉的应用程序。 + +Guiscrcpy 是一个基于屡获殊荣的一个开源引擎 [scrcpy][4] 的一个开源项目(GUN GPLv3 许可证)。使用 Guiscrcpy 可以将你的安卓手机的屏幕投射到你的电脑,这样你就可以查看手机上的一切东西。Guiscrcpy 支持 Linux、Windows 和 MacOS。 + +不像其他 scrcpy 的替代软件一样,Guiscrcpy 并不仅仅是 scrcpy 的一个简单的复制品。该项目优先考虑了与其他开源项目的协作。因此,Guiscrcpy 对 scrcpy 来说是一个扩展,或者说是一个用户界面层。将 Python 3 GUI 与 scrcpy 分开可以确保没有任何东西干扰 scrcpy 后端的效率。你可以投射到 1080P 分辨率的屏幕,因为它的超快的渲染速度和超低的 CPU 使用,即使在低端的电脑上也可以运行的很顺畅。 + +Scrcpy 是 Guiscrcpy 项目的基石。它是一个基于命令行的应用,因此它没有处理你的手势操作的用户界面。它也没有提供返回按钮和主页按钮,而且它需要你对 [Linux 终端][5]比较熟悉。Guiscrcpy 给 scrcpy 添加了图形面板。因此,任何用户都可以使用它,而且不需要通过网络发送任何信息就可以投射和控制他的设备。Guiscrcpy 同时也为 Windows 用户和 Linux 用户提供了编译好的二进制文件,以方便你的使用。 + +### 安装 Guiscrcpy + +在你安装 Guiscrcpy 之前,你需要先安装它的依赖包。尤其是要安装 scrcpy。安装 scrcpy 最简单的方式可能就是使用对于大部分 Linux 发行版都安装了的 [snap][6] 工具。如果你的电脑上安装并使用了 snap,那么你就可以使用下面的命令来一步安装 scrcpy。 + +``` +$ sudo snap install scrcpy +``` + +当你安装完 scrcpy,你就可以安装其他的依赖包了。[Simple DirectMedia Layer][7](SDL 2.0) 是一个显示和控制你设备屏幕的工具包。[Android Debug Bridge][8] (ADB) 命令可以连接你的安卓手机到电脑。 + +在 Fedora 或者 CentOS: + +``` +$ sudo dnf install SDL2 android-tools +``` + +在 Ubuntu 或者 Debian: + +``` +$ sudo apt install SDL2 android-tools-adb +``` + +在另一个终端中,安装 Python 依赖项: + +``` +$ python3 -m pip install -r requirements.txt --user +``` + +### 设置你的手机 + +为了能够让你的手机接受 adb 连接。必须让你的手机开启开发者选项。为了打开开发者选项,打开“设置”,然后选择“关于手机”,找到“版本号”(它也可能位于“软件信息”面板中)。不敢置信,只要你连续点击“版本号”七次,你就可以打开开发者选项。(LCTT 译注:显然这里是以 Google 原生的 Android 作为说明的,你的不同品牌的安卓手机打开开发者选项的方式或有不同。) + +![Enabling Developer Mode][9] + +更多更全面的连接手机的方式,请参考[安卓开发者文档][10]。 + +一旦你设置好了你的手机,将你的手机通过 USB 线插入到你的电脑中(或者通过无线的方式进行连接,确保你已经配置好了无线连接)。 + +### 使用 Guiscrcpy + +当你启动 guiscrcpy 的时候,你就能看到一个主控制窗口。点击窗口里的 “Start scrcpy” 按钮。只要你设置好了开发者模式并且通过 USB 或者 WiFi 将你的手机连接到电脑。guiscrcpy 就会连接你的手机。 + +![Guiscrcpy main screen][11] + +它还包括一个可写入的配置系统,你可以将你的配置文件写入到 `~/.config` 目录。可以在使用前保存你的首选项。 + +guiscrcpy 底部的面板是一个浮动的窗口,可以帮助你执行一些基本的控制动作。它包括了主页按钮、返回按钮、电源按钮以及一些其他的按键。这些按键在安卓手机上都非常常用。值得注意的是,这个模块并不是与 scrcpy 的 SDL 进行交互。因此,它可以毫无延迟的执行。换句话说,这个操作窗口是直接通过 adb 与你的手机进行交互而不是通过 scrcpy。 + +![guiscrcpy's bottom panel][12] + +这个项目目前十分活跃,不断地有新的特性加入其中。最新版本的具有了手势操作和通知界面。 + +有了这个 guiscrcpy,你不仅仅可以在你的电脑屏幕上看到你的手机,你还可以就像操作你的实体手机一样点击 SDL 窗口,或者使用浮动窗口上的按钮与之进行交互。 + +![guiscrcpy running on Fedora 30][13] + +Guiscrcpy 是一个有趣且实用的应用程序,它提供的功能应该是任何现代设备(尤其是 Android 之类的平台)的正式功能。自己尝试一下,为当今的数字生活增添一些未来主义的感觉。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mirror-android-screen-guiscrcpy + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://github.com/srevinsaju/guiscrcpy +[3]: http://opensource.com/users/srevinsaju +[4]: https://github.com/Genymobile/scrcpy +[5]: https://www.redhat.com/sysadmin/navigating-filesystem-linux-terminal +[6]: https://snapcraft.io/ +[7]: https://www.libsdl.org/ +[8]: https://developer.android.com/studio/command-line/adb +[9]: https://opensource.com/sites/default/files/uploads/developer-mode.jpg (Enabling Developer Mode) +[10]: https://developer.android.com/studio/debug/dev-options +[11]: https://opensource.com/sites/default/files/uploads/guiscrcpy-main.png (Guiscrcpy main screen) +[12]: https://opensource.com/sites/default/files/uploads/guiscrcpy-bottompanel.png (guiscrcpy's bottom panel) +[13]: https://opensource.com/sites/default/files/uploads/guiscrcpy-screenshot.jpg (guiscrcpy running on Fedora 30) diff --git a/published/20190926 How to Execute Commands on Remote Linux System over SSH.md b/published/20190926 How to Execute Commands on Remote Linux System over SSH.md new file mode 100644 index 0000000000..944cd800c7 --- /dev/null +++ b/published/20190926 How to Execute Commands on Remote Linux System over SSH.md @@ -0,0 +1,411 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11440-1.html) +[#]: subject: (How to Execute Commands on Remote Linux System over SSH) +[#]: via: (https://www.2daygeek.com/execute-run-linux-commands-remote-system-over-ssh/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何通过 SSH 在远程 Linux 系统上运行命令 +====== + +我们有时可能需要在远程机器上运行一些命令。如果只是偶尔进行的操作,要实现这个目的,可以登录到远程系统上直接执行命令。但是每次都这么做的话,就有点烦人了。既然如此,有没有摆脱这种麻烦操作的更佳方案? + +是的,你可以从你本地系统上执行这些操作,而不用登录到远程系统上。这有什么好处吗?毫无疑问。这会为你节省很多好时光。 + +这是怎么实现的?SSH 允许你无需登录到远程计算机就可以在它上面运行命令。 + +**通用语法如下所示:** + +``` +$ ssh [用户名]@[远程主机名或 IP] [命令或脚本] +``` + +### 1) 如何通过 SSH 在远程 Linux 系统上运行命令 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上运行 [df 命令][1]。 + +``` +$ ssh daygeek@CentOS7.2daygeek.com df -h + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/centos-root 27G 4.4G 23G 17% / + devtmpfs 903M 0 903M 0% /dev + tmpfs 920M 0 920M 0% /dev/shm + tmpfs 920M 9.3M 910M 2% /run + tmpfs 920M 0 920M 0% /sys/fs/cgroup + /dev/sda1 1014M 179M 836M 18% /boot + tmpfs 184M 8.0K 184M 1% /run/user/42 + tmpfs 184M 0 184M 0% /run/user/1000 +``` + +### 2) 如何通过 SSH 在远程 Linux 系统上运行多条命令 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上一次运行多条命令。 + +同时在远程 Linux 系统上运行 `uptime` 命令和 `free` 命令。 + +``` +$ ssh daygeek@CentOS7.2daygeek.com "uptime && free -m" + + 23:05:10 up 10 min, 0 users, load average: 0.00, 0.03, 0.03 + + total used free shared buffers cached + Mem: 1878 432 1445 1 100 134 + -/+ buffers/cache: 197 1680 + Swap: 3071 0 3071 +``` + +### 3) 如何通过 SSH 在远程 Linux 系统上运行带 sudo 权限的命令 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上运行带有 [sudo 权限][2] 的 `fdisk` 命令。 + +普通用户不允许执行系统二进制(`/usr/sbin/`)目录下提供的命令。用户需要 root 权限来运行它。 + +所以你需要 root 权限,好在 Linux 系统上运行 [fdisk 命令][3]。`which` 命令返回给定命令的完整可执行路径。 + +``` +$ which fdisk + /usr/sbin/fdisk +``` + +``` +$ ssh -t daygeek@CentOS7.2daygeek.com "sudo fdisk -l" + [sudo] password for daygeek: + + Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + Disk label type: dos + Disk identifier: 0x000bf685 + + Device Boot Start End Blocks Id System + /dev/sda1 * 2048 2099199 1048576 83 Linux + /dev/sda2 2099200 62914559 30407680 8e Linux LVM + + Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + Disk /dev/mapper/centos-root: 29.0 GB, 28982640640 bytes, 56606720 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + Connection to centos7.2daygeek.com closed. +``` + +### 4) 如何通过 SSH 在远程 Linux 系统上运行带 sudo 权限的服务控制命令 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上运行带有 sudo 权限的服务控制命令。 + +``` +$ ssh -t daygeek@CentOS7.2daygeek.com "sudo systemctl restart httpd" + + [sudo] password for daygeek: + Connection to centos7.2daygeek.com closed. +``` + +### 5) 如何通过非标准端口 SSH 在远程 Linux 系统上运行命令 + +下面的例子允许用户通过 ssh 在使用了非标准端口的远程 Linux 机器上运行 [hostnamectl 命令][4]。 + +``` +$ ssh -p 2200 daygeek@CentOS7.2daygeek.com hostnamectl + + Static hostname: Ubuntu18.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 27f6c2febda84dc881f28fd145077187 + Boot ID: bbeccdf932be41ddb5deae9e5f15183d + Virtualization: oracle + Operating System: Ubuntu 18.04.2 LTS + Kernel: Linux 4.15.0-60-generic + Architecture: x86-64 +``` + +### 6) 如何将远程系统的输出保存到本地系统 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上运行 [top 命令][5],并将输出保存到本地系统。 + +``` +$ ssh daygeek@CentOS7.2daygeek.com "top -bc | head -n 35" > /tmp/top-output.txt +``` + +``` +cat /tmp/top-output.txt + + top - 01:13:11 up 18 min, 1 user, load average: 0.01, 0.05, 0.10 + Tasks: 168 total, 1 running, 167 sleeping, 0 stopped, 0 zombie + %Cpu(s): 0.0 us, 6.2 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st + KiB Mem : 1882300 total, 1176324 free, 342392 used, 363584 buff/cache + KiB Swap: 2097148 total, 2097148 free, 0 used. 1348140 avail Mem + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 4943 daygeek 20 0 162052 2248 1612 R 10.0 0.1 0:00.07 top -bc + 1 root 20 0 128276 6936 4204 S 0.0 0.4 0:03.08 /usr/lib/sy+ + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] + 3 root 20 0 0 0 0 S 0.0 0.0 0:00.25 [ksoftirqd/+ + 4 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:+ + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:+ + 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 [migration/+ + 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] + 9 root 20 0 0 0 0 S 0.0 0.0 0:00.77 [rcu_sched] + 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-dr+ + 11 root rt 0 0 0 0 S 0.0 0.0 0:00.01 [watchdog/0] + 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kdevtmpfs] + 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] + 15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [khungtaskd] + 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [writeback] + 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrity+ + 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] +``` + +或者你也可以使用以下格式在远程系统上运行多条命令: + +``` +$ ssh daygeek@CentOS7.2daygeek.com << EOF +hostnamectl +free -m +grep daygeek /etc/passwd +EOF +``` + +上面命令的输出如下: + +``` +Pseudo-terminal will not be allocated because stdin is not a terminal. + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: dca9a1ba06374d7d96678f9461752482 + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 + + total used free shared buff/cache available + Mem: 1838 335 1146 11 355 1314 + Swap: 2047 0 2047 + + daygeek:x:1000:1000:2daygeek:/home/daygeek:/bin/bash +``` + +### 7) 如何在远程系统上运行本地 Bash 脚本 + +下面的例子允许用户通过 ssh 在远程 Linux 机器上运行本地 [bash 脚本][5] `remote-test.sh`。 + +创建一个 shell 脚本并执行它。 + +``` +$ vi /tmp/remote-test.sh + +#!/bin/bash +#Name: remote-test.sh +#-------------------- + uptime + free -m + df -h + uname -a + hostnamectl +``` + +上面命令的输出如下: + +``` +$ ssh daygeek@CentOS7.2daygeek.com 'bash -s' < /tmp/remote-test.sh + + 01:17:09 up 22 min, 1 user, load average: 0.00, 0.02, 0.08 + + total used free shared buff/cache available + Mem: 1838 333 1148 11 355 1316 + Swap: 2047 0 2047 + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/centos-root 27G 4.4G 23G 17% / + devtmpfs 903M 0 903M 0% /dev + tmpfs 920M 0 920M 0% /dev/shm + tmpfs 920M 9.3M 910M 2% /run + tmpfs 920M 0 920M 0% /sys/fs/cgroup + /dev/sda1 1014M 179M 836M 18% /boot + tmpfs 184M 12K 184M 1% /run/user/42 + tmpfs 184M 0 184M 0% /run/user/1000 + + Linux CentOS7.2daygeek.com 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux + + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: dca9a1ba06374d7d96678f9461752482 + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +``` + +或者也可以使用管道。如果你觉得输出不太好看,再做点修改让它更优雅些。 + +``` +$ vi /tmp/remote-test-1.sh + +#!/bin/bash +#Name: remote-test.sh + echo "---------System Uptime--------------------------------------------" + uptime + echo -e "\n" + echo "---------Memory Usage---------------------------------------------" + free -m + echo -e "\n" + echo "---------Disk Usage-----------------------------------------------" + df -h + echo -e "\n" + echo "---------Kernel Version-------------------------------------------" + uname -a + echo -e "\n" + echo "---------HostName Info--------------------------------------------" + hostnamectl + echo "------------------------------------------------------------------" +``` + +上面脚本的输出如下: + +``` +$ cat /tmp/remote-test.sh | ssh daygeek@CentOS7.2daygeek.com + Pseudo-terminal will not be allocated because stdin is not a terminal. + ---------System Uptime-------------------------------------------- + 03:14:09 up 2:19, 1 user, load average: 0.00, 0.01, 0.05 + + ---------Memory Usage--------------------------------------------- + total used free shared buff/cache available + Mem: 1838 376 1063 11 398 1253 + Swap: 2047 0 2047 + + ---------Disk Usage----------------------------------------------- + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/centos-root 27G 4.4G 23G 17% / + devtmpfs 903M 0 903M 0% /dev + tmpfs 920M 0 920M 0% /dev/shm + tmpfs 920M 9.3M 910M 2% /run + tmpfs 920M 0 920M 0% /sys/fs/cgroup + /dev/sda1 1014M 179M 836M 18% /boot + tmpfs 184M 12K 184M 1% /run/user/42 + tmpfs 184M 0 184M 0% /run/user/1000 + tmpfs 184M 0 184M 0% /run/user/0 + + ---------Kernel Version------------------------------------------- + Linux CentOS7.2daygeek.com 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux + + ---------HostName Info-------------------------------------------- + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: dca9a1ba06374d7d96678f9461752482 + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +``` + +### 8) 如何同时在多个远程系统上运行多条指令 + +下面的 bash 脚本允许用户同时在多个远程系统上运行多条指令。使用简单的 `for` 循环实现。 + +为了实现这个目的,你可以尝试 [PSSH 命令][7] 或 [ClusterShell 命令][8] 或 [DSH 命令][9]。 + +``` +$ vi /tmp/multiple-host.sh + + for host in CentOS7.2daygeek.com CentOS6.2daygeek.com + do + ssh daygeek@CentOS7.2daygeek.com${host} "uname -a;uptime;date;w" + done +``` + +上面脚本的输出如下: + +``` +$ sh multiple-host.sh + + Linux CentOS7.2daygeek.com 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux + + 01:33:57 up 39 min, 1 user, load average: 0.07, 0.06, 0.06 + + Wed Sep 25 01:33:57 CDT 2019 + + 01:33:57 up 39 min, 1 user, load average: 0.07, 0.06, 0.06 + USER TTY FROM daygeek@CentOS7.2daygeek.com IDLE JCPU PCPU WHAT + daygeek pts/0 192.168.1.6 01:08 23:25 0.06s 0.06s -bash + + Linux CentOS6.2daygeek.com 2.6.32-754.el6.x86_64 #1 SMP Tue Jun 19 21:26:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux + + 23:33:58 up 39 min, 0 users, load average: 0.00, 0.00, 0.00 + + Tue Sep 24 23:33:58 MST 2019 + + 23:33:58 up 39 min, 0 users, load average: 0.00, 0.00, 0.00 + USER TTY FROM daygeek@CentOS7.2daygeek.com IDLE JCPU PCPU WHAT +``` + +### 9) 如何使用 sshpass 命令添加一个密码 + +如果你觉得每次输入密码很麻烦,我建议你视你的需求选择以下方法中的一项来解决这个问题。 + +如果你经常进行类似的操作,我建议你设置 [免密码认证][10],因为它是标准且永久的解决方案。 + +如果你一个月只是执行几次这些任务,我推荐你使用 `sshpass` 工具。只需要使用 `-p` 参数选项提供你的密码即可。 + +``` +$ sshpass -p '在这里输入你的密码' ssh -p 2200 daygeek@CentOS7.2daygeek.com ip a + + 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever + 2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 + link/ether 08:00:27:18:90:7f brd ff:ff:ff:ff:ff:ff + inet 192.168.1.12/24 brd 192.168.1.255 scope global dynamic eth0 + valid_lft 86145sec preferred_lft 86145sec + inet6 fe80::a00:27ff:fe18:907f/64 scope link tentative dadfailed + valid_lft forever preferred_lft forever +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/execute-run-linux-commands-remote-system-over-ssh/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [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/linux-check-disk-space-usage-df-command/ +[2]: https://www.2daygeek.com/how-to-configure-sudo-access-in-linux/ +[3]: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ +[4]: https://www.2daygeek.com/four-methods-to-change-the-hostname-in-linux/ +[5]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ +[6]: https://www.2daygeek.com/category/shell-script/ +[7]: https://www.2daygeek.com/pssh-parallel-ssh-run-execute-commands-on-multiple-linux-servers/ +[8]: https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/ +[9]: https://www.2daygeek.com/dsh-run-execute-shell-commands-on-multiple-linux-servers-at-once/ +[10]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ diff --git a/published/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md b/published/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md new file mode 100644 index 0000000000..9b850bca1e --- /dev/null +++ b/published/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11433-1.html) +[#]: subject: (You Can Now Use OneDrive in Linux Natively Thanks to Insync) +[#]: via: (https://itsfoss.com/use-onedrive-on-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +现在你可以借助 Insync 在 Linux 中原生使用 OneDrive +====== + +[OneDrive][1] 是微软的一项云存储服务,它为每个用户提供 5GB 的免费存储空间。它已与微软帐户集成,如果你使用 Windows,那么已在其中预安装了 OneDrive。 + +OneDrive 无法在 Linux 中作为桌面应用使用。你可以通过网页访问已存储的文件,但无法像在文件管理器中那样使用云存储。 + +好消息是,你现在可以使用一个非官方工具,它可让你在 Ubuntu 或其他 Linux 发行版中使用 OneDrive。 + +当 [Insync][2] 在 Linux 上支持 Google Drive 时,它变成了 Linux 上非常流行的高级第三方同步工具。我们有篇对 [Insync 支持 Google Drive][3] 的详细点评文章。 + +而最近[发布的 Insync 3][4] 支持了 OneDrive。因此在本文中,我们将看下如何在 Insync 中使用 OneDrive 以及它的新功能。 + +> 非 FOSS 警告 + +> 少数开发者会对非 FOSS 软件引入 Linux 感到痛苦。作为专注于桌面 Linux 的门户,即使不是 FOSS,我们也会在此介绍此类软件。 + +> Insync 3 既不是开源软件,也不免费使用。你只有 15 天的试用期进行测试。如果你喜欢它,那么可以按每个帐户终生 29.99 美元的费用购买。 + +> 我们不会拿钱来推广它们(以防你这么想)。我们不会在这里这么做。 + +### 在 Linux 中通过 Insync 获得原生 OneDrive 体验 + +![][5] + +尽管它是一个付费工具,但依赖 OneDrive 的用户或许希望在他们的 Linux 系统中获得同步 OneDrive 的无缝体验。 + +首先,你需要从[官方页面][6]下载适合你 Linux 发行版的软件包。 + +- [下载 Insync][7] + +你也可以选择添加仓库并进行安装。你将在 Insync 的[官方网站][7]看到说明。 + +安装完成后,只需启动并选择 OneDrive 选项。 + +![][8] + +另外,要注意的是,你添加的每个 OneDrive 或 Google Drive 帐户都需要单独的许可证。 + +现在,在授权 OneDrive 帐户后,你必须选择一个用于同步所有内容的基础文件夹,这是 Insync 3 中的一项新功能。 + +![Insync 3 Base Folder][9] + +除此之外,设置完成后,你还可以选择性地同步本地或云端的文件/文件夹。 + +![Insync Selective Sync][10] + +你还可以通过添加自己的规则来自定义同步选项,以忽略/同步所需的文件夹和文件,这完全是可选的。 + +![Insync Customize Sync Preferences][11] + +最后,就这样完成了。 + +![Insync 3][12] + +你现在可以在包括带有 Insync 的 Linux 桌面在内的多个平台使用 OneDrive 开始同步文件/文件夹。除了上面所有新功能/更改之外,你还可以在 Insync 上获得更快/更流畅的体验。 + +此外,借助 Insync 3,你可以查看同步进度: + +![][13] + +### 总结 + +总的来说,对于希望在 Linux 系统上同步 OneDrive 的用户而言,Insync 3 是令人印象深刻的升级。如果你不想付款,你可以尝试其他 [Linux 的免费云服务][14]。 + +你如何看待 Insync?如果你已经在使用它,到目前为止的体验如何?在下面的评论中让我们知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/use-onedrive-on-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://onedrive.live.com +[2]: https://www.insynchq.com +[3]: https://itsfoss.com/insync-linux-review/ +[4]: https://www.insynchq.com/blog/insync-3/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/onedrive-linux.png?ssl=1 +[6]: https://www.insynchq.com/downloads?start=true +[7]: https://www.insynchq.com/downloads +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-3one-drive-sync.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-3-base-folder-1.png?ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-selective-syncs.png?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-customize-sync.png?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-homescreen.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/insync-3-progress-bar.png?ssl=1 +[14]: https://itsfoss.com/cloud-services-linux/ diff --git a/published/20190927 CentOS 8 Installation Guide with Screenshots.md b/published/20190927 CentOS 8 Installation Guide with Screenshots.md new file mode 100644 index 0000000000..7e1a49882c --- /dev/null +++ b/published/20190927 CentOS 8 Installation Guide with Screenshots.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11438-1.html) +[#]: subject: (CentOS 8 Installation Guide with Screenshots) +[#]: via: (https://www.linuxtechi.com/centos-8-installation-guide-screenshots/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +CentOS 8 安装图解 +====== + +继 RHEL 8 发布之后,CentOS 社区也发布了让人期待已久的 CentOS 8,并发布了两种模式: + +* CentOS stream:滚动发布的 Linux 发行版,适用于需要频繁更新的开发者 +* CentOS:类似 RHEL 8 的稳定操作系统,系统管理员可以用其部署或配置服务和应用 + +在这篇文章中,我们会使用图解的方式演示 CentOS 8 的安装方法。 + +### CentOS 8 的新特性 + +* DNF 成为了默认的软件包管理器,同时 yum 仍然是可用的 +* 使用网络管理器(`nmcli` 和 `nmtui`)进行网络配置,移除了网络脚本 +* 使用 Podman 进行容器管理 +* 引入了两个新的包仓库:BaseOS 和 AppStream +* 使用 Cockpit 作为默认的系统管理工具 +* 默认使用 Wayland 作为显示服务器 +* `iptables` 将被 `nftables` 取代 +* 使用 Linux 内核 4.18 +* 提供 PHP 7.2、Python 3.6、Ansible 2.8、VIM 8.0 和 Squid 4 + +### CentOS 8 所需的最低硬件配置: + +* 2 GB RAM +* 64 位 x86 架构、2 GHz 或以上的 CPU +* 20 GB 硬盘空间 + +### CentOS 8 安装图解 + +#### 第一步:下载 CentOS 8 ISO 文件 + +在 CentOS 官方网站 下载 CentOS 8 ISO 文件。 + +#### 第二步: 创建 CentOS 8 启动介质(USB 或 DVD) + +下载 CentOS 8 ISO 文件之后,将 ISO 文件烧录到 USB 移动硬盘或 DVD 光盘中,作为启动介质。 + +然后重启系统,在 BIOS 中设置为从上面烧录好的启动介质启动。 + +#### 第三步:选择“安装 CentOS Linux 8.0”选项 + +当系统从 CentOS 8 ISO 启动介质启动之后,就可以看到以下这个界面。选择“Install CentOS Linux 8.0”(安装 CentOS Linux 8.0)选项并按回车。 + +![Choose-Install-CentOS8][2] + +#### 第四步:选择偏好语言 + +选择想要在 CentOS 8 **安装过程**中使用的语言,然后继续。 + +![Select-Language-CentOS8-Installation][3] + +#### 第五步:准备安装 CentOS 8 + +这一步我们会配置以下内容: + +* 键盘布局 +* 日期和时间 +* 安装来源 +* 软件选择 +* 安装目标 +* Kdump + +![Installation-Summary-CentOS8][4] + +如上图所示,安装向导已经自动提供了“键盘布局Keyboard”、“时间和日期Time & Date”、“安装来源Installation Source”和“软件选择Software Selection”的选项。 + +如果你需要修改以上设置,点击对应的图标就可以了。例如修改系统的时间和日期,只需要点击“时间和日期Time & Date”,选择正确的时区,然后点击“完成Done”即可。 + +![TimeZone-CentOS8-Installation][5] + +在软件选择选项中选择安装的模式。例如“包含图形界面Server with GUI”选项会在安装后的系统中提供图形界面,而如果想安装尽可能少的额外软件,可以选择“最小化安装Minimal Install”。 + +![Software-Selection-CentOS8-Installation][6] + +这里我们选择“包含图形界面Server with GUI”,点击“完成Done”。 + +Kdump 功能默认是开启的。尽管这是一个强烈建议开启的功能,但也可以点击对应的图标将其关闭。 + +如果想要在安装过程中对网络进行配置,可以点击“网络与主机名Network & Host Name”选项。 + +![Networking-During-CentOS8-Installation][7] + +如果系统连接到启用了 DHCP 功能的调制解调器上,就会在启动网络接口的时候自动获取一个 IP 地址。如果需要配置静态 IP,点击“配置Configure”并指定 IP 的相关信息。除此以外我们还将主机名设置为 “linuxtechi.com”。 + +完成网络配置后,点击“完成Done”。 + +最后我们要配置“安装目标Installation Destination”,指定 CentOS 8 将要安装到哪一个硬盘,以及相关的分区方式。 + +![Installation-Destination-Custom-CentOS8][8] + +点击“完成Done”。 + +如图所示,我为 CentOS 8 分配了 40 GB 的硬盘空间。有两种分区方案可供选择:如果由安装向导进行自动分区,可以从“存储配置Storage Configuration”中选择“自动Automatic”选项;如果想要自己手动进行分区,可以选择“自定义Custom”选项。 + +在这里我们选择“自定义Custom”选项,并按照以下的方式创建基于 LVM 的分区: + +* `/boot` – 2 GB (ext4 文件系统) +* `/` – 12 GB (xfs 文件系统) +* `/home` – 20 GB (xfs 文件系统) +* `/tmp` – 5 GB (xfs 文件系统) +* Swap – 1 GB (xfs 文件系统) + +首先创建 `/boot` 标准分区,设置大小为 2GB,如下图所示: + +![boot-partition-CentOS8-Installation][9] + +点击“添加挂载点Add mount point”。 + +再创建第二个分区 `/`,并设置大小为 12GB。点击加号,指定挂载点和分区大小,点击“添加挂载点Add mount point”即可。 + +![slash-root-partition-centos8-installation][10] + +然后在页面上将 `/` 分区的分区类型从标准更改为 LVM,并点击“更新设置Update Settings”。 + +![Change-Partition-Type-CentOS8][11] + +如上图所示,安装向导已经自动创建了一个卷组。如果想要更改卷组的名称,只需要点击“卷组Volume Group”标签页中的“修改Modify”选项。 + +同样地,创建 `/home` 分区和 `/tmp` 分区,分别将大小设置为 20GB 和 5GB,并设置分区类型为 LVM。 + +![home-partition-CentOS8-Installation][12] + +![tmp-partition-centos8-installation][13] + +最后创建交换分区Swap Partition。 + +![Swap-Partition-CentOS8-Installation][14] + +点击“添加挂载点Add mount point”。 + +在完成所有分区设置后,点击“完成Done”。 + +![Choose-Done-after-manual-partition-centos8][15] + +在下一个界面,点击“应用更改Accept changes”,以上做的更改就会写入到硬盘中。 + +![Accept-changes-CentOS8-Installation][16] + +#### 第六步:选择“开始安装” + +完成上述的所有更改后,回到先前的安装概览界面,点击“开始安装Begin Installation”以开始安装 CentOS 8。 + +![Begin-Installation-CentOS8][17] + +下面这个界面表示安装过程正在进行中。 + +![Installation-progress-centos8][18] + +要设置 root 用户的口令,只需要点击 “root 口令Root Password”选项,输入一个口令,然后点击“创建用户User Creation”选项创建一个本地用户。 + +![Root-Password-CentOS8-Installation][19] + +填写新创建的用户的详细信息。 + +![Local-User-Details-CentOS8][20] + +在安装完成后,安装向导会提示重启系统。 + +![CentOS8-Installation-Progress][21] + +#### 第七步:完成安装并重启系统 + +安装完成后要重启系统。只需点击“重启Reboot”按钮。 + +![Installation-Completed-CentOS8][22] + +注意:重启完成后,记得要把安装介质断开,并将 BIOS 的启动介质设置为硬盘。 + +#### 第八步:启动新安装的 CentOS 8 并接受许可协议 + +在 GRUB 引导菜单中,选择 CentOS 8 进行启动。 + +![Grub-Boot-CentOS8][23] + +同意 CentOS 8 的许可证,点击“完成Done”。 + +![Accept-License-CentOS8-Installation][24] + +在下一个界面,点击“完成配置Finish Configuration”。 + +![Finish-Configuration-CentOS8-Installation][25] + +#### 第九步:配置完成后登录 + +同意 CentOS 8 的许可证以及完成配置之后,会来到登录界面。 + +![Login-screen-CentOS8][26] + +使用刚才创建的用户以及对应的口令登录,按照提示进行操作,就可以看到以下界面。 + +![CentOS8-Ready-Use-Screen][27] + +点击“开始使用 CentOS LinuxStart Using CentOS Linux”。 + +![Desktop-Screen-CentOS8][28] + +以上就是 CentOS 8 的安装过程,至此我们已经完成了 CentOS 8 的安装。 + +欢迎给我们发送评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/centos-8-installation-guide-screenshots/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Install-CentOS8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Language-CentOS8-Installation.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Installation-Summary-CentOS8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/TimeZone-CentOS8-Installation.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Software-Selection-CentOS8-Installation.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Networking-During-CentOS8-Installation.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Installation-Destination-Custom-CentOS8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-CentOS8-Installation.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-centos8-installation.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Change-Partition-Type-CentOS8.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-CentOS8-Installation.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/tmp-partition-centos8-installation.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Swap-Partition-CentOS8-Installation.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Done-after-manual-partition-centos8.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Accept-changes-CentOS8-Installation.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Begin-Installation-CentOS8.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Installation-progress-centos8.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Root-Password-CentOS8-Installation.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Local-User-Details-CentOS8.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/CentOS8-Installation-Progress.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Installation-Completed-CentOS8.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Grub-Boot-CentOS8.jpg +[24]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Accept-License-CentOS8-Installation.jpg +[25]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Finish-Configuration-CentOS8-Installation.jpg +[26]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-CentOS8.jpg +[27]: https://www.linuxtechi.com/wp-content/uploads/2019/09/CentOS8-Ready-Use-Screen.jpg +[28]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Desktop-Screen-CentOS8.jpg diff --git a/published/20190929 Bash Script to Generate System Uptime Reports on Linux.md b/published/20190929 Bash Script to Generate System Uptime Reports on Linux.md new file mode 100644 index 0000000000..8f147863b7 --- /dev/null +++ b/published/20190929 Bash Script to Generate System Uptime Reports on Linux.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11455-1.html) +[#]: subject: (Bash Script to Generate System Uptime Reports on Linux) +[#]: via: (https://www.2daygeek.com/bash-script-generate-linux-system-uptime-reports/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +生成 Linux 运行时间报告的 Bash 脚本 +====== + +出于一些原因,你可能需要每月收集一次 [Linux 系统运行时间][1]报告。如果是这样,你可以根据需要使用以下 [bash 脚本][2] 之一。 + +我们为什么要收集这份报告?在一段时间后重启 Linux 服务器是解决某些未解决问题的好方法。(LCTT 译注:本文这些观点值得商榷,很多服务器可以稳定运行几千天,尤其是有了内核热补丁之后,启动并不是必须的。) + +建议每 180 天重新启动一次。但时间段也许取决于你公司的政策。如果你已经长时间运行服务器而没有重启。这可能导致服务器上出现一些性能或内存问题,我在许多服务器上都注意到了这一点。 + +这些脚本一次性提供了所有系统运行报告。 + +### 什么是 uptime 命令 + +`uptime` 命令将告诉你系统已经运行了多长时间。它在一行中显示以下信息:当前时间、系统运行了多长时间、当前登录了多少用户以及过去 1、5 和 15 分钟的平均系统负载。 + +### 什么是 tuptime? + +[tuptime][3] 是用于报告系统的历史和统计运行时间的工具,可在重启之间保存。它类似于 `uptime` 命令,但输出更有趣。 + +### 1)检查 Linux 系统运行时间的 Bash 脚本 + +该 bash 脚本将收集所有服务器正常运行时间,并将报告发送到给定的电子邮箱地址。 + +请替换为你的电子邮箱地址,而不是用我们的,否则你将不会收到邮件。 + +``` +# vi /opt/scripts/system-uptime-script.sh + +#!/bin/bash +> /tmp/uptime-report.out +for host in cat /tmp/servers.txt +do +echo -n "$host: " +ssh $host uptime | awk '{print $3,$4}' | sed 's/,//' +done | column -t >> /tmp/uptime-report.out +cat /tmp/uptime-report.out | mail -s "Linux Servers Uptime Report" "2daygeek@gmail.com" +``` + +给 `system-uptime-script.sh` 设置可执行权限。 + +``` +$ chmod +x /opt/scripts/system-uptime-script.sh +``` + +最后运行 bash 脚本获取输出。 + +``` +# sh /opt/scripts/system-uptime-script.sh +``` + +你将收到类似以下的报告。 + +``` +# cat /tmp/uptime-report.out + +192.168.1.5: 2 days +192.168.1.6: 15 days +192.168.1.7: 30 days +192.168.1.8: 7 days +192.168.1.9: 67 days +192.168.1.10: 130 days +192.168.1.11: 23 days +``` + +### 2)检查 Linux 系统是否运行了 30 天以上的 Bash 脚本 + +此 bash 脚本会收集运行 30 天以上的服务器,并将报告发送到指定的邮箱地址。你可以根据需要更改天数。 + +``` +# vi /opt/scripts/system-uptime-script-1.sh + +#!/bin/bash +> /tmp/uptime-report-1.out +for host in cat /tmp/servers.txt +do +echo -n "$host: " +ssh $host uptime | awk '{print $3,$4}' | sed 's/,//' +done | column -t >> /tmp/uptime-report-1.out +cat /tmp/uptime-report-1.out | awk ' $2 >= 30' > /tmp/uptime-report-2.out +cat /tmp/uptime-report-2.out | mail -s "Linux Servers Uptime Report" "2daygeek@gmail.com" +``` + +给 `system-uptime-script-1.sh` 设置可执行权限。 + +``` +$ chmod +x /opt/scripts/system-uptime-script-1.sh +``` + +最后添加一条 [cronjob][4] 来自动执行。它会在每天早上 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/scripts/system-uptime-script-1.sh +``` + +**注意:** 你会在每天早上 7 点会收到一封电子邮件提醒,它是昨天的详情。 + +你将收到类似下面的报告。 + +``` +# cat /tmp/uptime-report-2.out + +192.168.1.7: 30 days +192.168.1.9: 67 days +192.168.1.10: 130 days +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-generate-linux-system-uptime-reports/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-system-server-uptime-check/ +[2]: https://www.2daygeek.com/category/shell-script/ +[3]: https://www.2daygeek.com/linux-tuptime-check-historical-uptime/ +[4]: https://www.2daygeek.com/crontab-cronjob-to-schedule-jobs-in-linux/ diff --git a/published/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md b/published/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..ebefb9d662 --- /dev/null +++ b/published/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11449-1.html) +[#]: subject: (How to Install and Use Cockpit on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-use-cockpit-tool-centos8-rhel8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 CentOS 8/RHEL 8 上安装和使用 Cockpit +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/12/093405gb8hv3exdbsdyfda.jpg) + +Cockpit 是一个基于 Web 的服务器管理工具,可用于 CentOS 和 RHEL 系统。最近发布的 CentOS 8 和 RHEL 8,其中 cockpit 是默认的服务器管理工具。它的软件包在默认的 CentOS 8 和 RHEL 8 仓库中就有。Cockpit 是一个有用的基于 Web 的 GUI 工具,系统管理员可以通过该工具监控和管理 Linux 服务器,它还可用于管理服务器、容器、虚拟机中的网络和存储,以及检查系统和应用的日志。 + +在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 中安装和设置 Cockpit。 + +### 在 CentOS 8/RHEL 8 上安装和设置Cockpit + +登录你的 CentOS 8/RHEL 8,打开终端并执行以下 `dnf` 命令: + +``` +[root@linuxtechi ~]# dnf install cockpit -y +``` + +运行以下命令启用并启动 cockpit 服务: + +``` +[root@linuxtechi ~]# systemctl start cockpit.socket +[root@linuxtechi ~]# systemctl enable cockpit.socket +``` + +使用以下命令在系统防火墙中允许 Cockpit 端口: + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-service=cockpit +[root@linuxtechi ~]# firewall-cmd --reload +``` + +验证 cockpit 服务是否已启动和运行,执行以下命令: + +``` +[root@linuxtechi ~]# systemctl status cockpit.socket +[root@linuxtechi ~]# ss -tunlp | grep cockpit +[root@linuxtechi ~]# ps auxf|grep cockpit +``` + +![cockpit-status-centos8-rhel8][1] + +### 在 CentOS 8/RHEL 8 上访问 Cockpit + +正如我们在上面命令的输出中看到的,cockpit 正在监听 tcp 9090 端口,打开你的 Web 浏览器并输入 url:`https://:9090`。 + +![CentOS8-cockpit-login-screen][2] + +RHEL 8 中的 Cockpit 登录页面: + +![RHEL8-Cockpit-Login-Screen][3] + +使用有管理员权限的用户名,或者我们也可以使用 root 用户的密码登录。如果要将管理员权限分配给任何本地用户,请执行以下命令: + +``` +[root@linuxtechi ~]# usermod -G wheel pkumar +``` + +这里 `pkumar` 是我的本地用户, + +在输入用户密码后,选择 “Reuse my password for privileged tasks”,然后单击 “Log In”,然后我们看到以下页面: + +![cockpit-dashboard-centos8][4] + +在左侧栏上,我们可以看到可以通过 cockpit GUI 监控和配置的内容, + +假设你要检查 CentOS 8/RHEL 8 中是否有任何可用更新,请单击 “System Updates”: + +![Software-Updates-Cockpit-GUI-CentOS8-RHEL8][5] + +要安装所有更新,点击 “Install All Updates”: + +![Install-Software-Updates-CentOS8-RHEL8][6] + +如果想要修改网络并要添加 Bond 接口和网桥,请单击 “Networking”: + +![Networking-Cockpit-Dashboard-CentOS8-RHEL8][7] + +如上所见,我们有创建 Bond 接口、网桥和 VLAN 标记接口的选项。 + +假设我们想创建一个 `br0` 网桥,并要为它添加 `enp0s3` 端口,单击 “Add Bridge”: + +将网桥名称指定为 `br0`,将端口指定为 `enp0s3`,然后单击“Apply”。 + +![Add-Bridge-Cockpit-CentOS8-RHEL8][8] + +在下个页面,我们将看到该网桥处于活动状态,并且获得了与 enp0s3 接口相同的 IP: + +![Bridge-Details-Cockpit-Dashboard-CentOS8-RHEL8][9] + +如果你想检查系统日志,单击 “Logs”,我们可以根据严重性查看日志: + +![System-Logs-Cockpit-Dashboard-CentOS8-RHEL8][10] + +本文就是这些了,类似地,系统管理员可以使用 cockpit 的其他功能来监控和管理 CentOS 8 和 RHEL 8 服务器。如果这些步骤可以帮助你在 Linux 服务器上设置 cockpit,请在下面的评论栏分享你的反馈和意见。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-use-cockpit-tool-centos8-rhel8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/wp-content/uploads/2019/09/cockpit-status-centos8-rhel8.jpg +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/CentOS8-cockpit-login-screen.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/RHEL8-Cockpit-Login-Screen.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/cockpit-dashboard-centos8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Software-Updates-Cockpit-GUI-CentOS8-RHEL8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Install-Software-Updates-CentOS8-RHEL8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Networking-Cockpit-Dashboard-CentOS8-RHEL8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Add-Bridge-Cockpit-CentOS8-RHEL8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Bridge-Details-Cockpit-Dashboard-CentOS8-RHEL8.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/System-Logs-Cockpit-Dashboard-CentOS8-RHEL8.jpg diff --git a/published/20191002 3 command line games for learning Bash the fun way.md b/published/20191002 3 command line games for learning Bash the fun way.md new file mode 100644 index 0000000000..beea31d857 --- /dev/null +++ b/published/20191002 3 command line games for learning Bash the fun way.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11448-1.html) +[#]: subject: (3 command line games for learning Bash the fun way) +[#]: via: (https://opensource.com/article/19/10/learn-bash-command-line-games) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Bash 学习的快乐之旅:3 个命令行游戏 +====== + +> 通过这些命令行游戏,学习有用的 Bash 技能也是一件乐事。 + +![](https://attackofthefanboy.com/wp-content/uploads/2018/11/fallout-terminal-computer-hacking-guide.jpg) + +学习是件艰苦的工作,然而没有人喜欢工作。这意味着无论学习 Bash 多么容易,它仍然对你来说就像工作一样。当然,除非你通过游戏来学习。 + +你不会觉得会有很多游戏可以教你如何使用 Bash 终端吧,这是对的。严肃的 PC 游戏玩家知道,《辐射Fallout》系列在金库中配备了基于终端的计算机,这可以帮你理解通过文本与计算机进行交互是什么样子,但是尽管其功能或多或少地类似于 [Alpine][2] 或 [Emacs][3],可是玩《辐射》并不会教给你可以在现实生活中使用的命令或应用程序。《辐射》系列从未直接移植到Linux(尽管可以通过 Steam 的开源的 [Proton][4] 来玩。)曾是《辐射》的前身的《[废土][5]Wasteland》系列的最新作品倒是面向 Linux 的,因此,如果你想体验游戏中的终端,可以在你的 Linux 游戏计算机上玩《[废土 2][6]》和《[废土 3][7]》。《[暗影狂奔][8]Shadowrun》系列也有面向 Linux 的版本,它有许多基于终端的交互,尽管公认 [hot sim][9] 序列常常使它黯然失色。 + +虽然这些游戏中采用了有趣的操作计算机终端的方式,并且可以在开源的系统上运行,但它们本身都不是开源的。不过,至少有两个游戏采用了严肃且非常有趣的方法来教人们如何通过文本命令与系统进行交互。最重要的是,它们是开源的。 + +### Bashcrawl + +你可能听说过《[巨洞探险][10]Colossal Cave Adventure》游戏,这是一款古老的基于文本的交互式游戏,其风格为“自由冒险”类。早期的计算机爱好者们在 DOS 或 ProDOS 命令行上痴迷地玩这些游戏,他们努力寻找有效语法和(如一个讽刺黑客所解释的)滑稽幻想逻辑的正确组合来击败游戏。想象一下,如果除了探索虚拟的中世纪地下城之外,挑战还在于回忆起有效的 Bash 命令,那么这样的挑战会多么有成效。这就是 [Bashcrawl][11] 的基调,这是一个基于 Bash 的地下城探险游戏,你可以通过学习和使用 Bash 命令来玩这个游戏。 + +在 Bashcrawl 中,“地下城”是以目录和文件的形式创建在你的计算机上的。你可以通过使用 `cd` 命令更改目录进入地下城的每个房间来探索它。当你[穿行目录][12]时,你可以用 [ls -F][13] 来查看文件,用 [cat][14] 读取文件,[设置变量][15]来收集宝藏,并运行脚本来与怪物战斗。你在游戏中所做的一切操作都是有效的 Bash 命令,你可以稍后在现实生活中使用它,玩这个游戏提供了 Bash 体验,因为这个“游戏”是由计算机上的实际目录和文件组成的。 + +``` +$ cd entrance/ +$ ls +cellar  scroll +$ cat scroll + +It is pitch black in these catacombs. +You have a magical spell that lists all items in a room. + +To see in the dark, type:     ls +To move around, type:         cd <directory> + +Try looking around this room. +Then move into one of the next rooms. + +EXAMPLE: + +$ ls +$ cd cellar + +Remember to cast ``ls`` when you get into the next room! +$ +``` + +#### 安装 Bashcrawl + +在玩 Bashcrawl 之前,你的系统上必须有 Bash 或 [Zsh][16]。Linux、BSD 和 MacOS 都附带了 Bash。Windows 用户可以下载并安装 [Cygwin][17] 或 [WSL][18] 或[试试 Linux][19]。 + +要安装 Bashcrawl,请在 Firefox 或你选择的 Web 浏览器中导航到这个 [GitLab 存储库][11]。在页面的右侧,单击“下载”图标(位于“Find file”按钮右侧)。在“下载”弹出菜单中,单击“zip”按钮以下载最新版本的游戏。 + +![Download a zip from Gitlab][20] + +下载完成后,解压缩该存档文件。 + +另外,如果你想从终端中开始安装,则可以使用 [Git][21] 命令: + +``` +$ git clone https://gitlab.com/slackermedia/bashcrawl.git bashcrawl +``` + +#### 游戏入门 + +与你下载的几乎所有新的软件包一样,你必须做的第一件事是阅读 README 文件。你可以通过双击`bashcrawl` 目录中的 `README.md` 文件来阅读。在 Mac 上,你的计算机可能不知道要使用哪个应用程序打开该文件;你也可以使用任何文本编辑器或 LibreOffice 打开它。`README.md` 这个文件会具体告诉你如何开始玩游戏,包括如何在终端上进入游戏以及要开始游戏必须发出的第一条命令。如果你无法阅读 README 文件,那游戏就不战自胜了(尽管由于你没有玩而无法告诉你)。 + +Bashcrawl 并不意味着是给比较聪明或高级用户玩的。相反,为了对新用户透明,它尽可能地简单。理想情况下,新的 Bash 用户可以从游戏中学习 Bash 的一些基础知识,然后会偶然发现一些游戏机制,包括使游戏运行起来的简单脚本,并学习到更多的 Bash 知识。此外,新的 Bash 用户可以按照 Bashcrawl 现有内容的示例设计自己的地下城,没有比编写游戏更好的学习编码的方法了。 + +### 命令行英雄:BASH + +Bashcrawl 适用于绝对初学者。如果你经常使用 Bash,则很有可能会尝试通过以初学者尚不了解的方式查看 Bashcrawl 的文件,从而找到胜过它的秘径。如果你是中高级的 Bash 用户,则应尝试一下 [命令行英雄:BASH][22]。 + +这个游戏很简单:在给定的时间内输入尽可能多的有效命令(LCTT 译注:BASH 也有“猛击”的意思)。听起来很简单。作为 Bash 用户,你每天都会使用许多命令。对于 Linux 用户来说,你知道在哪里可以找到命令列表。仅 util-linux 软件包就包含一百多个命令!问题是,在倒计时的压力下,你的指尖是否忙的过来输入这些命令? + +![Command Line Heroes: BASH][23] + +这个游戏听起来很简单,它确实也很简单!原则上,它与闪卡flashcard相似,只是反过来而已。在实践中,这是测试你的知识和回忆的一种有趣方式。当然,它是开源的,是由 [Open Jam][24] 的开发者开发的。 + +#### 安装 + +你可以[在线][25]玩“命令行英雄:BASH”,或者你也可以从 [GitHub][26] 下载它的源代码。 + +这个游戏是用 Node.js 编写的,因此除非你想帮助开发该游戏,否则在线进行游戏就够了。 + +### 在 Bash 中扫雷 + +如果你是高级 Bash 用户,并且已经编写了多个 Bash 脚本,那么你可能不仅仅想学习 Bash。你可以尝试编写游戏而不是玩游戏,这才是真的挑战。稍加思考,用上一个下午或几个小时,便可以在 Bash 中实现流行的游戏《扫雷》。你可以先尝试自己编写这个游戏,然后参阅 Abhishek Tamrakar 的[文章][27],以了解他如何完成该游戏的。 + +![][28] + +有时编程没有什么目的而是为了教育。在 Bash 中编写的游戏可能不是可以让你在网上赢得声誉的项目,但是该过程可能会很有趣且很有启发性。面对一个你从未想到的问题,这是学习新技巧的好方法。 + +### 学习 Bash,玩得开心 + +不管你如何学习它,Bash 都是一个功能强大的界面,因为它使你能够指示计算机执行所需的操作,而无需通过图形界面的应用程序的“中间人”界面。有时,图形界面很有帮助,但有时你想离开那些已经非常了解的东西,然后转向可以快速或通过自动化来完成的事情。由于 Bash 基于文本,因此易于编写脚本,使其成为自动化作业的理想起点。 + +了解 Bash 以开始走向高级用户之路,但是请确保你乐在其中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/learn-bash-command-line-games + +作者:[Seth Kenlon][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://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_maze.png?itok=mZ5LP4-X (connecting yellow dots in a maze) +[2]: https://opensource.com/article/17/10/alpine-email-client +[3]: http://www.gnu.org/software/emacs +[4]: https://github.com/ValveSoftware/Proton/ +[5]: https://www.gog.com/game/wasteland_the_classic_original +[6]: https://www.inxile-entertainment.com/wasteland2 +[7]: https://www.inxile-entertainment.com/wasteland3 +[8]: http://harebrained-schemes.com/games/ +[9]: https://forums.shadowruntabletop.com/index.php?topic=21804.0 +[10]: https://opensource.com/article/18/12/linux-toy-adventure +[11]: https://gitlab.com/slackermedia/bashcrawl +[12]: https://opensource.com/article/19/8/understanding-file-paths-linux +[13]: https://opensource.com/article/19/7/master-ls-command +[14]: https://opensource.com/article/19/2/getting-started-cat-command +[15]: https://opensource.com/article/19/8/using-variables-bash +[16]: https://opensource.com/article/19/9/getting-started-zsh +[17]: https://www.cygwin.com/ +[18]: https://docs.microsoft.com/en-us/windows/wsl/wsl2-about +[19]: https://opensource.com/article/19/7/ways-get-started-linux +[20]: https://opensource.com/sites/default/files/images/education/screenshot_from_2019-09-28_10-49-49.png (Download a zip from Gitlab) +[21]: https://opensource.com/life/16/7/stumbling-git +[22]: https://www.redhat.com/en/command-line-heroes/bash/index.html?extIdCarryOver=true&sc_cid=701f2000001OH79AAG +[23]: https://opensource.com/sites/default/files/uploads/commandlineheroes-bash.jpg (Command Line Heroes: BASH) +[24]: http://openjam.io/ +[25]: https://www.redhat.com/en/command-line-heroes/bash/index.html +[26]: https://github.com/CommandLineHeroes/clh-bash/ +[27]: https://linux.cn/article-11430-1.html +[28]: https://opensource.com/sites/default/files/uploads/extractmines.png diff --git a/published/20191002 7 Bash history shortcuts you will actually use.md b/published/20191002 7 Bash history shortcuts you will actually use.md new file mode 100644 index 0000000000..0b26c89131 --- /dev/null +++ b/published/20191002 7 Bash history shortcuts you will actually use.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11456-1.html) +[#]: subject: (7 Bash history shortcuts you will actually use) +[#]: via: (https://opensource.com/article/19/10/bash-history-shortcuts) +[#]: author: (Ian Miell https://opensource.com/users/ianmiell) + +7 个实用的操作 Bash 历史记录的快捷方式 +====== + +> 这些必不可少的 Bash 快捷键可在命令行上节省时间。 + +![Command line prompt][1] + +大多数介绍 Bash 历史记录的指南都详尽地列出了全部可用的快捷方式。这样做的问题是,你会对每个快捷方式都浅尝辄止,然后在尝试了那么多的快捷方式后就搞得目不暇接。而在开始工作时它们就全被丢在脑后,只记住了刚开始使用 Bash 时学到的 [!! 技巧][2]。这些技巧大多数从未进入记忆当中。 + +本文概述了我每天实际使用的快捷方式。它基于我的书《[Bash 学习,艰难之旅][3]》中的某些内容(你可以阅读其中的[样章][4]以了解更多信息)。 + +当人们看到我使用这些快捷方式时,他们经常问我:“你做了什么!?” 学习它们只需付出很少的精力或智力,但是要真正的学习它们,我建议每周用一天学一个,然后下次再继续学习一个。值得花时间让它们落在你的指尖下,因为从长远来看,节省的时间将很重要。 + +### 1、最后一个参数:`!$` + +如果你仅想从本文中学习一种快捷方式,那就是这个。它会将最后一个命令的最后一个参数替换到你的命令行中。 + +看看这种情况: + +``` +$ mv /path/to/wrongfile /some/other/place +mv: cannot stat '/path/to/wrongfile': No such file or directory +``` + +啊哈,我在命令中写了错误的文件名 “wrongfile”,我应该用正确的文件名 “rightfile” 代替。 + +你可以重新键入上一个命令,并用 “rightfile” 完全替换 “wrongfile”。但是,你也可以键入: + +``` +$ mv /path/to/rightfile !$ +mv /path/to/rightfile /some/other/place +``` + +这个命令也可以奏效。 + +在 Bash 中还有其他方法可以通过快捷方式实现相同的目的,但是重用上一个命令的最后一个参数的这种技巧是我最常使用的。 + +### 2、第 n 个参数:`!:2` + +是不是干过像这样的事情: + +``` +$ tar -cvf afolder afolder.tar +tar: failed to open +``` + +像许多其他人一样,我也经常搞错 `tar`(和 `ln`)的参数顺序。 + +![xkcd comic][5] + +当你搞混了参数,你可以这样: + +``` +$ !:0 !:1 !:3 !:2 +tar -cvf afolder.tar afolder +``` + +这样就不会出丑了。 + +上一个命令的各个参数的索引是从零开始的,并且可以用 `!:` 之后跟上该索引数字代表各个参数。 + +显然,你也可以使用它来重用上一个命令中的特定参数,而不是所有参数。 + +### 3、全部参数:`!:1-$` + +假设我运行了类似这样的命令: + +``` +$ grep '(ping|pong)' afile +``` + +参数是正确的。然而,我想在文件中匹配 “ping” 或 “pong”,但我使用的是 `grep` 而不是 `egrep`。 + +我开始输入 `egrep`,但是我不想重新输入其他参数。因此,我可以使用 `!:1-$` 快捷方式来调取上一个命令的所有参数,从第二个(记住它们的索引从零开始,因此是 `1`)到最后一个(由 `$` 表示)。 + +``` +$ egrep !:1-$ +egrep '(ping|pong)' afile +ping +``` + +你不用必须用 `1-$` 选择全部参数;你也可以选择一个子集,例如 `1-2` 或 `3-9` (如果上一个命令中有那么多参数的话)。 + +### 4、倒数第 n 行的最后一个参数:`!-2:$` + +当我输错之后马上就知道该如何更正我的命令时,上面的快捷键非常有用,但是我经常在原来的命令之后运行别的命令,这意味着上一个命令不再是我所要引用的命令。 + +例如,还是用之前的 `mv` 例子,如果我通过 `ls` 检查文件夹的内容来纠正我的错误: + +``` +$ mv /path/to/wrongfile /some/other/place +mv: cannot stat '/path/to/wrongfile': No such file or directory +$ ls /path/to/ +rightfile +``` + +我就不能再使用 `!$` 快捷方式了。 + +在这些情况下,我可以在 `!` 之后插入 `-n`:(其中 `n` 是要在历史记录中回溯的命令条数),以从较旧的命令取得最后的参数: + +``` +$ mv /path/to/rightfile !-2:$ +mv /path/to/rightfile /some/other/place +``` + +同样,一旦你学会了它,你可能会惊讶于你需要使用它的频率。 + +### 5、进入文件夹:`!$:h` + +从表面上看,这个看起来不太有用,但我每天要用它几十次。 + +想象一下,我运行的命令如下所示: + +``` +$ tar -cvf system.tar /etc/system + tar: /etc/system: Cannot stat: No such file or directory + tar: Error exit delayed from previous errors. +``` + +我可能要做的第一件事是转到 `/etc` 文件夹,查看其中的内容并找出我做错了什么。 + +我可以通过以下方法来做到这一点: + +``` +$ cd !$:h +cd /etc +``` + +这是说:“获取上一个命令的最后一个参数(`/etc/system`),并删除其最后的文件名部分,仅保留 `/ etc`。” + +### 6、当前行:`!#:1` + +多年以来,在我最终找到并学会之前,我有时候想知道是否可以在当前行引用一个参数。我多希望我能早早学会这个快捷方式。我经常常使用它制作备份文件: + +``` +$ cp /path/to/some/file !#:1.bak +cp /path/to/some/file /path/to/some/file.bak +``` + +但当我学会之后,它很快就被下面的快捷方式替代了…… + +### 7、搜索并替换:`!!:gs` + +这将搜索所引用的命令,并将前两个 `/` 之间的字符替换为后两个 `/` 之间的字符。 + +假设我想告诉别人我的 `s` 键不起作用,而是输出了 `f`: + +``` +$ echo my f key doef not work +my f key doef not work +``` + +然后我意识到这里出现的 `f` 键都是错的。要将所有 `f` 替换为 `s`,我可以输入: + +``` +$ !!:gs/f /s / +echo my s key does not work +my s key does not work +``` + +它不只对单个字符起作用。我也可以替换单词或句子: + +``` +$ !!:gs/does/did/ +echo my s key did not work +my s key did not work +``` + +### 测试一下 + +为了向你展示如何组合这些快捷方式,你知道这些命令片段将输出什么吗? + +``` +$ ping !#:0:gs/i/o +$ vi /tmp/!:0.txt +$ ls !$:h +$ cd !-2:$:h +$ touch !$!-3:$ !! !$.txt +$ cat !:1-$ +``` + +### 总结 + +对于日常的命令行用户,Bash 可以作为快捷方式的优雅来源。虽然有成千上万的技巧要学习,但这些是我经常使用的最喜欢的技巧。 + +如果你想更深入地了解 Bash 可以教给你的全部知识,请买本我的书,《[Bash 学习,艰难之旅][3]》,或查看我的在线课程《[精通 Bash shell][7]》。 + +* * * + +本文最初发布在 Ian 的博客 [Zwischenzugs.com][8] 上,并经允许重复发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/bash-history-shortcuts + +作者:[Ian Miell][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://opensource.com/users/ianmiell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/article/18/5/bash-tricks +[3]: https://leanpub.com/learnbashthehardway +[4]: https://leanpub.com/learnbashthehardway/read_sample +[5]: https://opensource.com/sites/default/files/uploads/tar_2x.png (xkcd comic) +[6]: https://xkcd.com/1168/ +[7]: https://www.educative.io/courses/master-the-bash-shell +[8]: https://zwischenzugs.com/2019/08/25/seven-god-like-bash-history-shortcuts-you-will-actually-use/ diff --git a/published/20191003 How to Run the Top Command in Batch Mode.md b/published/20191003 How to Run the Top Command in Batch Mode.md new file mode 100644 index 0000000000..6e0316f9b8 --- /dev/null +++ b/published/20191003 How to Run the Top Command in Batch Mode.md @@ -0,0 +1,331 @@ +[#]: collector: "lujun9972" +[#]: translator: "way-ww" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11491-1.html" +[#]: subject: "How to Run the Top Command in Batch Mode" +[#]: via: "https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" + +如何在批处理模式下运行 top 命令 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/22/235420ylswdescv5ddffit.jpg) + +[top 命令][1] 是每个人都在使用的用于 [监控 Linux 系统性能][2] 的最好的命令。你可能已经知道 `top` 命令的绝大部分操作,除了很少的几个操作,如果我没错的话,批处理模式就是其中之一。 + +大部分的脚本编写者和开发人员都知道这个,因为这个操作主要就是用来编写脚本。 + +如果你不了解这个,不用担心,我们将在这里介绍它。 + +### 什么是 top 命令的批处理模式 + +批处理模式允许你将 `top` 命令的输出发送至其他程序或者文件中。 + +在这个模式中,`top` 命令将不会接收输入并且持续运行,直到迭代次数达到你用 `-n` 选项指定的次数为止。 + +如果你想解决 Linux 服务器上的任何性能问题,你需要正确的 [理解 top 命令的输出][3]。 + +### 1) 如何在批处理模式下运行 top 命令 + +默认地,`top` 命令按照 CPU 的使用率来排序输出结果,所以当你在批处理模式中运行以下命令时,它会执行同样的操作并打印前 35 行: + +``` +# top -bc | head -35 + +top - 06:41:14 up 8 days, 20:24, 1 user, load average: 0.87, 0.77, 0.81 +Tasks: 139 total, 1 running, 136 sleeping, 0 stopped, 2 zombie +%Cpu(s): 0.0 us, 3.2 sy, 0.0 ni, 96.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1595932 free, 886736 used, 1398272 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2648472 avail Mem + +PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.63 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] + 3 root 20 0 0 0 0 S 0.0 0.0 0:28.10 [ksoftirqd/0] + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] + 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] + 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] + 9 root 20 0 0 0 0 S 0.0 0.0 63:05.12 [rcu_sched] + 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] + 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] + 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] + 13 root rt 0 0 0 0 S 0.0 0.0 0:44.27 [migration/1] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.45 [ksoftirqd/1] + 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] + 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] + 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] + 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] + 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] + 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] + 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] + 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] + 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] + 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] + 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] + 44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kthrotld] + 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kmpath_rdacd] +``` + +### 2) 如何在批处理模式下运行 top 命令并按内存使用率排序结果 + +在批处理模式中运行以下命令按内存使用率对结果进行排序: + +``` +# top -bc -o +%MEM | head -n 20 + +top - 06:42:00 up 8 days, 20:25, 1 user, load average: 0.66, 0.74, 0.80 +Tasks: 146 total, 1 running, 145 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1422044 free, 1059176 used, 1399720 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2475984 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 18105 mysql 20 0 1453900 156096 8816 S 0.0 4.0 2:12.98 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid + 1841 root 20 0 228980 107036 5360 S 0.0 2.8 0:05.56 /usr/local/cpanel/3rdparty/perl/528/bin/perl -T -w /usr/local/cpanel/3rdparty/bin/spamd --max-children=3 --max-spare=1 --allowed-ips=127.0.0.+ + 4301 root 20 0 230208 104608 1816 S 0.0 2.7 0:03.77 spamd child + 8139 nobody 20 0 257000 27108 3408 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 7961 nobody 20 0 256988 26912 3160 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start + 8190 nobody 20 0 256976 26812 3140 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start + 8353 nobody 20 0 256976 26812 3144 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 8629 nobody 20 0 256856 26736 3108 S 0.0 0.7 0:00.02 /usr/sbin/httpd -k start + 8636 nobody 20 0 256856 26712 3100 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start + 8611 nobody 20 0 256844 25764 2228 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start + 8451 nobody 20 0 256844 25760 2220 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 8610 nobody 20 0 256844 25748 2224 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start + 8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start +``` + +上面命令的详细信息: + + * `-b`:批处理模式选项 + * `-c`:打印运行中的进程的绝对路径 + * `-o`:指定进行排序的字段 + * `head`:输出文件的第一部分 + * `-n`:打印前 n 行 + +### 3) 如何在批处理模式下运行 top 命令并按照指定的用户进程对结果进行排序 + +如果你想要按照指定用户进程对结果进行排序请运行以下命令: + +``` +# top -bc -u mysql | head -n 10 + +top - 06:44:58 up 8 days, 20:27, 1 user, load average: 0.99, 0.87, 0.84 +Tasks: 140 total, 1 running, 137 sleeping, 0 stopped, 2 zombie +%Cpu(s): 13.3 us, 3.3 sy, 0.0 ni, 83.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1589832 free, 885648 used, 1405460 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2649412 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 18105 mysql 20 0 1453900 156888 8816 S 0.0 4.0 2:16.42 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid +``` + +### 4) 如何在批处理模式下运行 top 命令并按照处理时间进行排序 + +在批处理模式中使用以下 `top` 命令按照处理时间对结果进行排序。这展示了任务从启动以来已使用的总 CPU 时间。 + +但是如果你想要检查一个进程在 Linux 上运行了多长时间请看接下来的文章: + + * [检查 Linux 中进程运行时间的五种方法][4] + +``` +# top -bc -o TIME+ | head -n 20 + +top - 06:45:56 up 8 days, 20:28, 1 user, load average: 0.56, 0.77, 0.81 +Tasks: 148 total, 1 running, 146 sleeping, 0 stopped, 1 zombie +%Cpu(s): 0.0 us, 3.1 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1378664 free, 1094876 used, 1407400 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2440332 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 9 root 20 0 0 0 0 S 0.0 0.0 63:05.70 [rcu_sched] + 272 root 20 0 0 0 0 S 0.0 0.0 16:12.13 [xfsaild/vda1] + 3882 root 20 0 229832 6212 1220 S 0.0 0.2 9:00.84 /usr/sbin/httpd -k start + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.75 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 3761 root 20 0 68784 9820 2048 S 0.0 0.3 5:09.67 tailwatchd + 3529 root 20 0 404380 3472 2604 S 0.0 0.1 3:24.98 /usr/sbin/rsyslogd -n + 3520 root 20 0 574208 572 164 S 0.0 0.0 3:07.74 /usr/bin/python2 -Es /usr/sbin/tuned -l -P + 444 dbus 20 0 58444 1144 612 S 0.0 0.0 2:23.90 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation + 18105 mysql 20 0 1453900 157152 8816 S 0.0 4.0 2:17.29 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid + 249 root 0 -20 0 0 0 S 0.0 0.0 1:28.83 [kworker/0:1H] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 342 root 20 0 39472 2940 2752 S 0.0 0.1 1:18.17 /usr/lib/systemd/systemd-journald +``` + +### 5) 如何在批处理模式下运行 top 命令并将结果保存到文件中 + +如果出于解决问题的目的,你想要和别人分享 `top` 命令的输出,请使用以下命令重定向输出到文件中: + +``` +# top -bc | head -35 > top-report.txt + +# cat top-report.txt + +top - 06:47:11 up 8 days, 20:30, 1 user, load average: 0.67, 0.77, 0.81 +Tasks: 133 total, 4 running, 129 sleeping, 0 stopped, 0 zombie +%Cpu(s): 59.4 us, 12.5 sy, 0.0 ni, 28.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1596268 free, 843284 used, 1441388 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2659084 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 9686 daygeekc 20 0 406132 62184 43448 R 94.1 1.6 0:00.34 /opt/cpanel/ea-php56/root/usr/bin/php-cgi + 9689 nobody 20 0 256588 24428 1184 S 5.9 0.6 0:00.01 /usr/sbin/httpd -k start + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.79 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] + 3 root 20 0 0 0 0 S 0.0 0.0 0:28.11 [ksoftirqd/0] + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] + 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] + 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] + 9 root 20 0 0 0 0 R 0.0 0.0 63:05.82 [rcu_sched] + 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] + 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] + 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] + 13 root rt 0 0 0 0 S 0.0 0.0 0:44.28 [migration/1] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] + 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] + 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] + 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] + 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] + 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] + 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] + 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] + 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] + 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] + 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] + 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] +``` + +### 如何按照指定字段对结果进行排序 + +在 `top` 命令的最新版本中, 按下 `f` 键进入字段管理界面。 + +要使用新字段进行排序, 请使用 `up`/`down` 箭头选择正确的选项,然后再按下 `s` 键进行排序。最后按 `q` 键退出此窗口。 + +``` +Fields Management for window 1:Def, whose current sort field is %CPU + Navigate with Up/Dn, Right selects for move then or Left commits, + 'd' or toggles display, 's' sets sort. Use 'q' or to end! + PID = Process Id nsUTS = UTS namespace Inode + USER = Effective User Name LXC = LXC container name + PR = Priority RSan = RES Anonymous (KiB) + NI = Nice Value RSfd = RES File-based (KiB) + VIRT = Virtual Image (KiB) RSlk = RES Locked (KiB) + RES = Resident Size (KiB) RSsh = RES Shared (KiB) + SHR = Shared Memory (KiB) CGNAME = Control Group name + S = Process Status NU = Last Used NUMA node + %CPU = CPU Usage + %MEM = Memory Usage (RES) + TIME+ = CPU Time, hundredths + COMMAND = Command Name/Line + PPID = Parent Process pid + UID = Effective User Id + RUID = Real User Id + RUSER = Real User Name + SUID = Saved User Id + SUSER = Saved User Name + GID = Group Id + GROUP = Group Name + PGRP = Process Group Id + TTY = Controlling Tty + TPGID = Tty Process Grp Id + SID = Session Id + nTH = Number of Threads + P = Last Used Cpu (SMP) + TIME = CPU Time + SWAP = Swapped Size (KiB) + CODE = Code Size (KiB) + DATA = Data+Stack (KiB) + nMaj = Major Page Faults + nMin = Minor Page Faults + nDRT = Dirty Pages Count + WCHAN = Sleeping in Function + Flags = Task Flags + CGROUPS = Control Groups + SUPGIDS = Supp Groups IDs + SUPGRPS = Supp Groups Names + TGID = Thread Group Id + OOMa = OOMEM Adjustment + OOMs = OOMEM Score current + ENVIRON = Environment vars + vMj = Major Faults delta + vMn = Minor Faults delta + USED = Res+Swap Size (KiB) + nsIPC = IPC namespace Inode + nsMNT = MNT namespace Inode + nsNET = NET namespace Inode + nsPID = PID namespace Inode + nsUSER = USER namespace Inode +``` + +对 `top` 命令的旧版本,请按 `shift+f` 或 `shift+o` 键进入字段管理界面进行排序。 + +要使用新字段进行排序,请选择相应的排序字段字母, 然后按下回车键排序。 + +``` +Current Sort Field: N for window 1:Def + Select sort field via field letter, type any other key to return + a: PID = Process Id + b: PPID = Parent Process Pid + c: RUSER = Real user name + d: UID = User Id + e: USER = User Name + f: GROUP = Group Name + g: TTY = Controlling Tty + h: PR = Priority + i: NI = Nice value + j: P = Last used cpu (SMP) + k: %CPU = CPU usage + l: TIME = CPU Time + m: TIME+ = CPU Time, hundredths +* N: %MEM = Memory usage (RES) + o: VIRT = Virtual Image (kb) + p: SWAP = Swapped size (kb) + q: RES = Resident size (kb) + r: CODE = Code size (kb) + s: DATA = Data+Stack size (kb) + t: SHR = Shared Mem size (kb) + u: nFLT = Page Fault count + v: nDRT = Dirty Pages count + w: S = Process Status + x: COMMAND = Command name/line + y: WCHAN = Sleeping in Function + z: Flags = Task Flags + Note1: + If a selected sort field can't be + shown due to screen width or your + field order, the '<' and '>' keys + will be unavailable until a field + within viewable range is chosen. + Note2: + Field sorting uses internal values, + not those in column display. Thus, + the TTY & WCHAN fields will violate + strict ASCII collating sequence. + (shame on you if WCHAN is chosen) +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[way-ww](https://github.com/way-ww) +校对:[wxy](https://github.com/wxy) + +本文由 [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/linux-top-command-linux-system-performance-monitoring-tool/ +[2]: https://www.2daygeek.com/category/system-monitoring/ +[3]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ +[4]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ diff --git a/published/20191004 9 essential GNU binutils tools.md b/published/20191004 9 essential GNU binutils tools.md new file mode 100644 index 0000000000..49c30e20d2 --- /dev/null +++ b/published/20191004 9 essential GNU binutils tools.md @@ -0,0 +1,640 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11441-1.html) +[#]: subject: (9 essential GNU binutils tools) +[#]: via: (https://opensource.com/article/19/10/gnu-binutils) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +GNU binutils 里的九种武器 +====== + +> 二进制分析是计算机行业中最被低估的技能。 + +![](https://img.linux.net.cn/data/attachment/album/201910/10/115409g9nkdm2omutduw7u.jpg) + +想象一下,在无法访问软件的源代码时,但仍然能够理解软件的实现方式,在其中找到漏洞,并且更厉害的是还能修复错误。所有这些都是在只有二进制文件时做到的。这听起来就像是超能力,对吧? + +你也可以拥有这样的超能力,GNU 二进制实用程序(binutils)就是一个很好的起点。[GNU binutils] [2] 是一个二进制工具集,默认情况下所有 Linux 发行版中都会安装这些二进制工具。 + +二进制分析是计算机行业中最被低估的技能。它主要由恶意软件分析师、反向工程师和使用底层软件的人使用。 + +本文探讨了 binutils 可用的一些工具。我使用的是 RHEL,但是这些示例应该在任何 Linux 发行版上可以运行。 + +``` +[~]# cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.6 (Maipo) +[~]# +[~]# uname -r +3.10.0-957.el7.x86_64 +[~]# +``` + +请注意,某些打包命令(例如 `rpm`)在基于 Debian 的发行版中可能不可用,因此请使用等效的 `dpkg` 命令替代。 + +### 软件开发的基础知识 + +在开源世界中,我们很多人都专注于源代码形式的软件。当软件的源代码随时可用时,很容易获得源代码的副本,打开喜欢的编辑器,喝杯咖啡,然后就可以开始探索了。 + +但是源代码不是在 CPU 上执行的代码,在 CPU 上执行的是二进制或者说是机器语言指令。二进制或可执行文件是编译源代码时获得的。熟练的调试人员深谙通常这种差异。 + +### 编译的基础知识 + +在深入研究 binutils 软件包本身之前,最好先了解编译的基础知识。 + +编译是将程序从某种编程语言(如 C/C++)的源代码(文本形式)转换为机器代码的过程。 + +机器代码是 CPU(或一般而言,硬件)可以理解的 1 和 0 的序列,因此可以由 CPU 执行或运行。该机器码以特定格式保存到文件,通常称为可执行文件或二进制文件。在 Linux(和使用 [Linux 兼容二进制][3]的 BSD)上,这称为 [ELF][4](可执行和可链接格式Executable and Linkable Format)。 + +在生成给定的源文件的可执行文件或二进制文件之前,编译过程将经历一系列复杂的步骤。以这个源程序(C 代码)为例。打开你喜欢的编辑器,然后键入以下程序: + +``` +#include + +int main(void) +{ + printf("Hello World\n"); + return 0; +} +``` + +#### 步骤 1:用 cpp 预处理 + +[C 预处理程序(cpp)][5]用于扩展所有宏并将头文件包含进来。在此示例中,头文件 `stdio.h` 将被包含在源代码中。`stdio.h` 是一个头文件,其中包含有关程序内使用的 `printf` 函数的信息。对源代码运行 `cpp`,其结果指令保存在名为 `hello.i` 的文件中。可以使用文本编辑器打开该文件以查看其内容。打印 “hello world” 的源代码在该文件的底部。 + +``` +[testdir]# cat hello.c +#include + +int main(void) +{ + printf("Hello World\n"); + return 0; +} +[testdir]# +[testdir]# cpp hello.c > hello.i +[testdir]# +[testdir]# ls -lrt +total 24 +-rw-r--r--. 1 root root 76 Sep 13 03:20 hello.c +-rw-r--r--. 1 root root 16877 Sep 13 03:22 hello.i +[testdir]# +``` + +#### 步骤 2:用 gcc 编译 + +在此阶段,无需创建目标文件就将步骤 1 中生成的预处理源代码转换为汇编语言指令。这个阶段使用 [GNU 编译器集合(gcc)][6]。对 `hello.i` 文件运行带有 `-S` 选项的 `gcc` 命令后,它将创建一个名为 `hello.s` 的新文件。该文件包含该 C 程序的汇编语言指令。 + +你可以使用任何编辑器或 `cat` 命令查看其内容。 + +``` +[testdir]# +[testdir]# gcc -Wall -S hello.i +[testdir]# +[testdir]# ls -l +total 28 +-rw-r--r--. 1 root root 76 Sep 13 03:20 hello.c +-rw-r--r--. 1 root root 16877 Sep 13 03:22 hello.i +-rw-r--r--. 1 root root 448 Sep 13 03:25 hello.s +[testdir]# +[testdir]# cat hello.s +.file "hello.c" +.section .rodata +.LC0: +.string "Hello World" +.text +.globl main +.type main, @function +main: +.LFB0: +.cfi_startproc +pushq %rbp +.cfi_def_cfa_offset 16 +.cfi_offset 6, -16 +movq %rsp, %rbp +.cfi_def_cfa_register 6 +movl $.LC0, %edi +call puts +movl $0, %eax +popq %rbp +.cfi_def_cfa 7, 8 +ret +.cfi_endproc +.LFE0: +.size main, .-main +.ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-36)" +.section .note.GNU-stack,"",@progbits +[testdir]# +``` + +#### 步骤 3:用 as 汇编 + +汇编器的目的是将汇编语言指令转换为机器语言代码,并生成扩展名为 `.o` 的目标文件。此阶段使用默认情况下在所有 Linux 平台上都可用的 GNU 汇编器。 + +``` +testdir]# as hello.s -o hello.o +[testdir]# +[testdir]# ls -l +total 32 +-rw-r--r--. 1 root root 76 Sep 13 03:20 hello.c +-rw-r--r--. 1 root root 16877 Sep 13 03:22 hello.i +-rw-r--r--. 1 root root 1496 Sep 13 03:39 hello.o +-rw-r--r--. 1 root root 448 Sep 13 03:25 hello.s +[testdir]# +``` + +现在,你有了第一个 ELF 格式的文件;但是,还不能执行它。稍后,你将看到“目标文件object file”和“可执行文件executable file”之间的区别。 + +``` +[testdir]# file hello.o +hello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped +``` + +#### 步骤 4:用 ld 链接 + +这是编译的最后阶段,将目标文件链接以创建可执行文件。可执行文件通常需要外部函数,这些外部函数通常来自系统库(`libc`)。 + +你可以使用 `ld` 命令直接调用链接器;但是,此命令有些复杂。相反,你可以使用带有 `-v`(详细)标志的 `gcc` 编译器,以了解链接是如何发生的。(使用 `ld` 命令进行链接作为一个练习,你可以自行探索。) + +``` +[testdir]# gcc -v hello.o +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper +Target: x86_64-redhat-linux +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man [...] --build=x86_64-redhat-linux +Thread model: posix +gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) +COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:[...]:/usr/lib/gcc/x86_64-redhat-linux/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' +/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu [...]/../../../../lib64/crtn.o +[testdir]# +``` + +运行此命令后,你应该看到一个名为 `a.out` 的可执行文件: + +``` +[testdir]# ls -l +total 44 +-rwxr-xr-x. 1 root root 8440 Sep 13 03:45 a.out +-rw-r--r--. 1 root root 76 Sep 13 03:20 hello.c +-rw-r--r--. 1 root root 16877 Sep 13 03:22 hello.i +-rw-r--r--. 1 root root 1496 Sep 13 03:39 hello.o +-rw-r--r--. 1 root root 448 Sep 13 03:25 hello.s +``` + +对 `a.out` 运行 `file` 命令,结果表明它确实是 ELF 可执行文件: + +``` +[testdir]# file a.out +a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=48e4c11901d54d4bf1b6e3826baf18215e4255e5, not stripped +``` + +运行该可执行文件,看看它是否如源代码所示工作: + +``` +[testdir]# ./a.out Hello World +``` + +工作了!在幕后发生了很多事情它才在屏幕上打印了 “Hello World”。想象一下在更复杂的程序中会发生什么。 + +### 探索 binutils 工具 + +上面这个练习为使用 binutils 软件包中的工具提供了良好的背景。我的系统带有 binutils 版本 2.27-34;你的 Linux 发行版上的版本可能有所不同。 + +``` +[~]# rpm -qa | grep binutils +binutils-2.27-34.base.el7.x86_64 +``` + +binutils 软件包中提供了以下工具: + +``` +[~]# rpm -ql binutils-2.27-34.base.el7.x86_64 | grep bin/ +/usr/bin/addr2line +/usr/bin/ar +/usr/bin/as +/usr/bin/c++filt +/usr/bin/dwp +/usr/bin/elfedit +/usr/bin/gprof +/usr/bin/ld +/usr/bin/ld.bfd +/usr/bin/ld.gold +/usr/bin/nm +/usr/bin/objcopy +/usr/bin/objdump +/usr/bin/ranlib +/usr/bin/readelf +/usr/bin/size +/usr/bin/strings +/usr/bin/strip +``` + +上面的编译练习已经探索了其中的两个工具:用作汇编器的 `as` 命令,用作链接器的 `ld` 命令。继续阅读以了解上述 GNU binutils 软件包工具中的其他七个。 + +#### readelf:显示 ELF 文件信息 + +上面的练习提到了术语“目标文件”和“可执行文件”。使用该练习中的文件,通过带有 `-h`(标题)选项的 `readelf` 命令,以将文件的 ELF 标题转储到屏幕上。请注意,以 `.o` 扩展名结尾的目标文件显示为 `Type: REL (Relocatable file)`(可重定位文件): + +``` +[testdir]# readelf -h hello.o +ELF Header: +Magic: 7f 45 4c 46 02 01 01 00 [...] +[...] +Type: REL (Relocatable file) +[...] +``` + +如果尝试执行此目标文件,会收到一条错误消息,指出无法执行。这仅表示它尚不具备在 CPU 上执行所需的信息。 + +请记住,你首先需要使用 `chmod` 命令在对象文件上添加 `x`(可执行位),否则你将得到“权限被拒绝”的错误。 + +``` +[testdir]# ./hello.o +bash: ./hello.o: Permission denied +[testdir]# chmod +x ./hello.o +[testdir]# +[testdir]# ./hello.o +bash: ./hello.o: cannot execute binary file +``` + +如果对 `a.out` 文件尝试相同的命令,则会看到其类型为 `EXEC (Executable file)`(可执行文件)。 + +``` +[testdir]# readelf -h a.out +ELF Header: +Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 +Class: ELF64 +[...] Type: EXEC (Executable file) +``` + +如上所示,该文件可以直接由 CPU 执行: + +``` +[testdir]# ./a.out Hello World +``` + +`readelf` 命令可提供有关二进制文件的大量信息。在这里,它会告诉你它是 ELF 64 位格式,这意味着它只能在 64 位 CPU 上执行,而不能在 32 位 CPU 上运行。它还告诉你它应在 X86-64(Intel/AMD)架构上执行。该二进制文件的入口点是地址 `0x400430`,它就是 C 源程序中 `main` 函数的地址。 + +在你知道的其他系统二进制文件上尝试一下 `readelf` 命令,例如 `ls`。请注意,在 RHEL 8 或 Fedora 30 及更高版本的系统上,由于安全原因改用了位置无关可执行文件position independent executable([PIE][7]),因此你的输出(尤其是 `Type:`)可能会有所不同。 + +``` +[testdir]# readelf -h /bin/ls +ELF Header: +Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 +Class: ELF64 +Data: 2's complement, little endian +Version: 1 (current) +OS/ABI: UNIX - System V +ABI Version: 0 +Type: EXEC (Executable file) +``` + +使用 `ldd` 命令了解 `ls` 命令所依赖的系统库,如下所示: + +``` +[testdir]# ldd /bin/ls +linux-vdso.so.1 => (0x00007ffd7d746000) +libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f060daca000) +libcap.so.2 => /lib64/libcap.so.2 (0x00007f060d8c5000) +libacl.so.1 => /lib64/libacl.so.1 (0x00007f060d6bc000) +libc.so.6 => /lib64/libc.so.6 (0x00007f060d2ef000) +libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f060d08d000) +libdl.so.2 => /lib64/libdl.so.2 (0x00007f060ce89000) +/lib64/ld-linux-x86-64.so.2 (0x00007f060dcf1000) +libattr.so.1 => /lib64/libattr.so.1 (0x00007f060cc84000) +libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f060ca68000) +``` + +对 `libc` 库文件运行 `readelf` 以查看它是哪种文件。正如它指出的那样,它是一个 `DYN (Shared object file)`(共享对象文件),这意味着它不能直接执行;必须由内部使用了该库提供的任何函数的可执行文件使用它。 + +``` +[testdir]# readelf -h /lib64/libc.so.6 +ELF Header: +Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00 +Class: ELF64 +Data: 2's complement, little endian +Version: 1 (current) +OS/ABI: UNIX - GNU +ABI Version: 0 +Type: DYN (Shared object file) +``` + +#### size:列出节的大小和全部大小 + +`size` 命令仅适用于目标文件和可执行文件,因此,如果尝试在简单的 ASCII 文件上运行它,则会抛出错误,提示“文件格式无法识别”。 + +``` +[testdir]# echo "test" > file1 +[testdir]# cat file1 +test +[testdir]# file file1 +file1: ASCII text +[testdir]# size file1 +size: file1: File format not recognized +``` + +现在,在上面的练习中,对目标文件和可执行文件运行 `size` 命令。请注意,根据 `size` 命令的输出可以看出,可执行文件(`a.out`)的信息要比目标文件(`hello.o`)多得多: + +``` +[testdir]# size hello.o +text data bss dec hex filename +89 0 0 89 59 hello.o +[testdir]# size a.out +text data bss dec hex filename +1194 540 4 1738 6ca a.out +``` + +但是这里的 `text`、`data` 和 `bss` 节是什么意思? + +`text` 节是指二进制文件的代码部分,其中包含所有可执行指令。`data` 节是所有初始化数据所在的位置,`bss` 节是所有未初始化数据的存储位置。(LCTT 译注:一般来说,在静态的映像文件中,各个部分称之为section,而在运行时的各个部分称之为segment,有时统称为段。) + +比较其他一些可用的系统二进制文件的 `size` 结果。 + +对于 `ls` 命令: + +``` +[testdir]# size /bin/ls +text data bss dec hex filename +103119 4768 3360 111247 1b28f /bin/ls +``` + +只需查看 `size` 命令的输出,你就可以看到 `gcc` 和 `gdb` 是比 `ls` 大得多的程序: + +``` +[testdir]# size /bin/gcc +text data bss dec hex filename +755549 8464 81856 845869 ce82d /bin/gcc +[testdir]# size /bin/gdb +text data bss dec hex filename +6650433 90842 152280 6893555 692ff3 /bin/gdb +``` + +#### strings:打印文件中的可打印字符串 + +在 `strings` 命令中添加 `-d` 标志以仅显示 `data` 节中的可打印字符通常很有用。 + +`hello.o` 是一个目标文件,其中包含打印出 `Hello World` 文本的指令。因此,`strings` 命令的唯一输出是 `Hello World`。 + +``` +[testdir]# strings -d hello.o +Hello World +``` + +另一方面,在 `a.out`(可执行文件)上运行 `strings` 会显示在链接阶段该二进制文件中包含的其他信息: + +``` +[testdir]# strings -d a.out +/lib64/ld-linux-x86-64.so.2 +!^BU +libc.so.6 +puts +__libc_start_main +__gmon_start__ +GLIBC_2.2.5 +UH-0 +UH-0 +=( +[]A\A]A^A_ +Hello World +;*3$" +``` + +#### objdump:显示目标文件信息 + +另一个可以从二进制文件中转储机器语言指令的 binutils 工具称为 `objdump`。使用 `-d` 选项,可从二进制文件中反汇编出所有汇编指令。 + +回想一下,编译是将源代码指令转换为机器代码的过程。机器代码仅由 1 和 0 组成,人类难以阅读。因此,它有助于将机器代码表示为汇编语言指令。汇编语言是什么样的?请记住,汇编语言是特定于体系结构的;由于我使用的是 Intel(x86-64)架构,因此如果你使用 ARM 架构编译相同的程序,指令将有所不同。 + +``` +[testdir]# objdump -d hello.o +hello.o: file format elf64-x86-64 +Disassembly of section .text: +0000000000000000 +: +0: 55 push %rbp +1: 48 89 e5 mov %rsp,%rbp +4: bf 00 00 00 00 mov $0x0,%edi +9: e8 00 00 00 00 callq e + +e: b8 00 00 00 00 mov $0x0,%eax +13: 5d pop %rbp +14: c3 retq +``` + +该输出乍一看似乎令人生畏,但请花一点时间来理解它,然后再继续。回想一下,`.text` 节包含所有的机器代码指令。汇编指令可以在第四列中看到(即 `push`、`mov`、`callq`、`pop`、`retq` 等)。这些指令作用于寄存器,寄存器是 CPU 内置的存储器位置。本示例中的寄存器是 `rbp`、`rsp`、`edi`、`eax` 等,并且每个寄存器都有特殊的含义。 + +现在对可执行文件(`a.out`)运行 `objdump` 并查看得到的内容。可执行文件的 `objdump` 的输出可能很大,因此我使用 `grep` 命令将其缩小到 `main` 函数: + +``` +[testdir]# objdump -d a.out | grep -A 9 main\> +000000000040051d +: +40051d: 55 push %rbp +40051e: 48 89 e5 mov %rsp,%rbp +400521: bf d0 05 40 00 mov $0x4005d0,%edi +400526: e8 d5 fe ff ff callq 400400 +40052b: b8 00 00 00 00 mov $0x0,%eax +400530: 5d pop %rbp +400531: c3 retq +``` + +请注意,这些指令与目标文件 `hello.o` 相似,但是其中包含一些其他信息: + +* 目标文件 `hello.o` 具有以下指令:`callq e` +* 可执行文件 `a.out` 由以下指令组成,该指令带有一个地址和函数:`callq 400400 ` +   +上面的汇编指令正在调用 `puts` 函数。请记住,你在源代码中使用了一个 `printf` 函数。编译器插入了对 `puts` 库函数的调用,以将 `Hello World` 输出到屏幕。 + +查看 `put` 上方一行的说明: + +* 目标文件 `hello.o` 有个指令 `mov`:`mov $0x0,%edi` +* 可执行文件 `a.out` 的 `mov` 指令带有实际地址(`$0x4005d0`)而不是 `$0x0`:`mov $0x4005d0,%edi` + +该指令将二进制文件中地址 `$0x4005d0` 处存在的内容移动到名为 `edi` 的寄存器中。 + +这个存储位置的内容中还能是别的什么吗?是的,你猜对了:它就是文本 `Hello, World`。你是如何确定的? + +`readelf` 命令使你可以将二进制文件(`a.out`)的任何节转储到屏幕上。以下要求它将 `.rodata`(这是只读数据)转储到屏幕上: + +``` +[testdir]# readelf -x .rodata a.out + +Hex dump of section '.rodata': +0x004005c0 01000200 00000000 00000000 00000000 .... +0x004005d0 48656c6c 6f20576f 726c6400 Hello World. +``` + +你可以在右侧看到文本 `Hello World`,在左侧可以看到其二进制格式的地址。它是否与你在上面的 `mov` 指令中看到的地址匹配?是的,确实匹配。 + +#### strip:从目标文件中剥离符号 + +该命令通常用于在将二进制文件交付给客户之前减小二进制文件的大小。 + +请记住,由于重要信息已从二进制文件中删除,因此它会妨碍调试。但是,这个二进制文件可以完美地执行。 + +对 `a.out` 可执行文件运行该命令,并注意会发生什么。首先,通过运行以下命令确保二进制文件没有被剥离(`not stripped`): + +``` +[testdir]# file a.out +a.out: ELF 64-bit LSB executable, x86-64, [......] not stripped +``` + +另外,在运行 `strip` 命令之前,请记下二进制文件中最初的字节数: + +``` +[testdir]# du -b a.out +8440 a.out +``` + +现在对该可执行文件运行 `strip` 命令,并使用 `file` 命令以确保正常完成: + +``` +[testdir]# strip a.out +[testdir]# file a.out a.out: ELF 64-bit LSB executable, x86-64, [......] stripped + +``` + +剥离该二进制文件后,此小程序的大小从之前的 `8440` 字节减小为 `6296` 字节。对于这样小的一个程序都能有这么大的空间节省,难怪大型程序经常被剥离。 + +``` +[testdir]# du -b a.out +6296 a.out +``` + +#### addr2line:转换地址到文件名和行号 + +`addr2line` 工具只是在二进制文件中查找地址,并将其与 C 源代码程序中的行进行匹配。很酷,不是吗? + +为此编写另一个测试程序;只是这一次确保使用 `gcc` 的 `-g` 标志进行编译,这将为二进制文件添加其它调试信息,并包含有助于调试的行号(由源代码中提供): + +``` +[testdir]# cat -n atest.c +1 #include +2 +3 int globalvar = 100; +4 +5 int function1(void) +6 { +7 printf("Within function1\n"); +8 return 0; +9 } +10 +11 int function2(void) +12 { +13 printf("Within function2\n"); +14 return 0; +15 } +16 +17 int main(void) +18 { +19 function1(); +20 function2(); +21 printf("Within main\n"); +22 return 0; +23 } +``` + +用 `-g` 标志编译并执行它。正如预期: + +``` +[testdir]# gcc -g atest.c +[testdir]# ./a.out +Within function1 +Within function2 +Within main +``` + +现在使用 `objdump` 来标识函数开始的内存地址。你可以使用 `grep` 命令来过滤出所需的特定行。函数的地址在下面突出显示(`55 push %rbp` 前的地址): + +``` +[testdir]# objdump -d a.out | grep -A 2 -E 'main>:|function1>:|function2>:' +000000000040051d : +40051d: 55 push %rbp +40051e: 48 89 e5 mov %rsp,%rbp +-- +0000000000400532 : +400532: 55 push %rbp +400533: 48 89 e5 mov %rsp,%rbp +-- +0000000000400547 +: +400547: 55 push %rbp +400548: 48 89 e5 mov %rsp,%rbp +``` + +现在,使用 `addr2line` 工具从二进制文件中的这些地址映射到 C 源代码匹配的地址: + +``` +[testdir]# addr2line -e a.out 40051d +/tmp/testdir/atest.c:6 +[testdir]# +[testdir]# addr2line -e a.out 400532 +/tmp/testdir/atest.c:12 +[testdir]# +[testdir]# addr2line -e a.out 400547 +/tmp/testdir/atest.c:18 +``` + +它说 `40051d` 从源文件 `atest.c` 中的第 `6` 行开始,这是 `function1` 的起始大括号(`{`)开始的行。`function2` 和 `main` 的输出也匹配。 + +#### nm:列出目标文件的符号 + +使用上面的 C 程序测试 `nm` 工具。使用 `gcc` 快速编译并执行它。 + +``` +[testdir]# gcc atest.c +[testdir]# ./a.out +Within function1 +Within function2 +Within main +``` + +现在运行 `nm` 和 `grep` 获取有关函数和变量的信息: + +``` +[testdir]# nm a.out | grep -Ei 'function|main|globalvar' +000000000040051d T function1 +0000000000400532 T function2 +000000000060102c D globalvar +U __libc_start_main@@GLIBC_2.2.5 +0000000000400547 T main +``` + +你可以看到函数被标记为 `T`,它表示 `text` 节中的符号,而变量标记为 `D`,表示初始化的 `data` 节中的符号。 + +想象一下在没有源代码的二进制文件上运行此命令有多大用处?这使你可以窥视内部并了解使用了哪些函数和变量。当然,除非二进制文件已被剥离,这种情况下它们将不包含任何符号,因此 `nm` 就命令不会很有用,如你在此处看到的: + +``` +[testdir]# strip a.out +[testdir]# nm a.out | grep -Ei 'function|main|globalvar' +nm: a.out: no symbols +``` + +### 结论 + +GNU binutils 工具为有兴趣分析二进制文件的人提供了许多选项,这只是它们可以为你做的事情的冰山一角。请阅读每种工具的手册页,以了解有关它们以及如何使用它们的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/gnu-binutils + +作者:[Gaurav Kamathe][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://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn (Tools for the sysadmin) +[2]: https://en.wikipedia.org/wiki/GNU_Binutils +[3]: https://www.freebsd.org/doc/handbook/linuxemu.html +[4]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format +[5]: https://en.wikipedia.org/wiki/C_preprocessor +[6]: https://gcc.gnu.org/onlinedocs/gcc/ +[7]: https://en.wikipedia.org/wiki/Position-independent_code#Position-independent_executables diff --git a/published/20191004 All That You Can Do with Google Analytics, and More.md b/published/20191004 All That You Can Do with Google Analytics, and More.md new file mode 100644 index 0000000000..a06d46414c --- /dev/null +++ b/published/20191004 All That You Can Do with Google Analytics, and More.md @@ -0,0 +1,253 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11460-1.html) +[#]: subject: (All That You Can Do with Google Analytics, and More) +[#]: via: (https://opensourceforu.com/2019/10/all-that-you-can-do-with-google-analytics-and-more/) +[#]: author: (Ashwin Sathian https://opensourceforu.com/author/ashwin-sathian/) + +Google Analytics 的一些用法介绍 +====== + +![][1] + +Google Analytics (GA)这个最流行的用户活动追踪工具我们或多或少都听说过甚至使用过,但它的用途并不仅仅限于对页面访问的追踪。作为一个既实用又流行的工具,它已经受到了广泛的欢迎,因此我们将要在下文中介绍如何在各种 Angular 和 React 单页应用中使用 Google Analytics。 + +这篇文章源自这样一个问题:如何对单页应用中的页面访问进行跟踪? + +通常来说,有很多的方法可以解决这个问题,在这里我们只讨论其中的一种方法。下面我会使用 Angular 来写出对应的实现,如果你使用的是 React,相关的用法和概念也不会有太大的差别。接下来就开始吧。 + +### 准备好应用程序 + +首先需要有一个追踪 IDtracking ID。在开始编写业务代码之前,要先准备好一个追踪 ID,通过这个唯一的标识,Google Analytics 才能识别出某个点击或者某个页面访问是来自于哪一个应用。 + +按照以下的步骤: + + 1. 访问 ; + 2. 提交指定信息以完成注册,并确保可用于 Web 应用,因为我们要开发的正是一个 Web 应用; + 3. 同意相关的条款,生成一个追踪 ID; + 4. 保存好追踪 ID。 + +追踪 ID 拿到了,就可以开始编写业务代码了。 + +### 添加 analytics.js 脚本 + +Google 已经帮我们做好了接入之前需要做的所有事情,接下来就是我们的工作了。不过我们要做的也很简单,只需要把下面这段脚本添加到应用的 `index.html` 里,就可以了: + +``` + +``` + +现在我们来看一下 Google Analytics 是如何在应用程序中初始化的。 + +### 创建追踪器 + +首先创建一个应用程序的追踪器。在 `app.component.ts` 中执行以下两个步骤: + + 1. 声明一个名为 `ga`,类型为 `any` 的全局变量(在 Typescript 中需要制定变量类型); + 2. 将下面一行代码加入到 `ngInInit()` 中。 + +``` +ga('create', <你的追踪 ID>, 'auto'); +``` + +这样就已经成功地在应用程序中初始化了一个 Google Analytics 的追踪器了。由于追踪器的初始化是在 `OnInit()` 函数中执行的,因此每当应用程序启动,追踪器就会启动。 + +### 在单页应用中记录页面访问情况 + +我们需要实现的是记录访问路由route-visits。 + +如何记录用户在一个应用中不同部分的访问,这是一个难点。从功能上来看,单页应用中的路由对应了传统多页面应用中各个页面之间的跳转,因此我们需要记录访问路由。要做到这一点尽管不算简单,但仍然是可以实现的。在 `app.component.ts` 的 `ngOnInit()` 函数中添加以下的代码片段: + +``` +import { Router, NavigationEnd } from '@angular/router'; +... +constructor(public router: Router) {} +... +this.router.events.subscribe( + event => { + if (event instanceof NavigationEnd) { + ga('set', 'page', event.urlAfterRedirects); + ga('send', { hitType: 'pageview', hitCallback: () => { this.pageViewSent = true; }}); + } + } +); +``` + +神奇的是,只需要这么几行代码,就实现了 Angular 应用中记录页面访问情况的功能。 + +这段代码实际上做了以下几件事情: + + 1. 从 Angular Router 中导入了 `Router`、`NavigationEnd`; + 2. 通过构造函数中将 `Router` 添加到组件中; + 3. 然后订阅 `router` 事件,也就是由 Angular Router 发出的所有事件; + 4. 只要产生了一个 `NavigationEnd` 事件实例,就将路由和目标作为一个页面访问进行记录。 + +这样,只要使用到了页面路由,就会向 Google Analytics 发送一条页面访问记录,在 Google Analytics 的在线控制台中可以看到这些记录。 + +类似地,我们可以用相同的方式来记录除了页面访问之外的活动,例如某个界面的查看次数或者时长等等。只要像上面的代码那样使用 `hitCallBack()` 就可以在有需要收集的数据的时候让应用程序作出反应,这里我们做的事情仅仅是把一个变量的值设为 `true`,但实际上 `hitCallBack()` 中可以执行任何代码。 + +### 追踪用户交互活动 + +除了页面访问记录之外,Google Analytics 还经常被用于追踪用户的交互活动,例如某个按钮的点击情况。“提交按钮被用户点击了多少次?”,“产品手册会被经常查阅吗?”这些都是 Web 应用程序的产品评审会议上的常见问题。这一节我们将会介绍如何实现这些数据的统计。 + +#### 按钮点击 + +设想这样一种场景,需要统计到应用程序中某个按钮或链接被点击的次数,这是一个和注册之类的关键动作关系最密切的数据指标。下面我们来举一个例子: + +假设应用程序中有一个“感兴趣”按钮,用于显示即将推出的活动,你希望通过统计这个按钮被点击的次数来推测有多少用户对此感兴趣。那么我们可以使用以下的代码来实现这个功能: + +``` +... +params = { + eventCategory: + 'Button' + , + eventAction: + 'Click' + , + eventLabel: + 'Show interest' + , + eventValue: + 1 +}; + +showInterest() { + ga('send', 'event', this.params); +} +... +``` + +现在看下这段代码实际上做了什么。正如前面说到,当我们向 Google Analytics 发送数据的时候,Google Analytics 就会记录下来。因此我们可以向 `send()` 方法传递不同的参数,以区分不同的事件,例如两个不同按钮的点击记录。 + +1、首先我们定义了一个 `params` 对象,这个对象包含了以下几个字段: + + 1. `eventCategory` – 交互发生的对象,这里对应的是按钮(button) + 2. `eventAction` – 发生的交互的类型,这里对应的是点击(click) + 3. `eventLabel` – 交互动作的标识,这里对应的是这个按钮的内容,也就是“感兴趣” + 4. `eventValue` – 与每个发生的事件实例相关联的值 + +由于这个例子中是要统计点击了“感兴趣”按钮的用户数,因此我们把 `eventValue` 的值定为 1。 + +2、对象构造完成之后,下一步就是将 `params` 对象作为请求负载发送到 Google Analytics,而这一步是通过事件绑定将 `showInterest()` 绑定在按钮上实现的。这也是使用 Google Analytics 追踪中最常用的发送事件方法。 + +至此,Google Analytics 就可以通过记录按钮的点击次数来统计感兴趣的用户数了。 + +#### 追踪社交活动 + +Google Analytics 还可以通过应用程序追踪用户在社交媒体上的互动。其中一种场景就是在应用中放置类似 Facebook 的点赞按钮,下面我们来看看如何使用 Google Analytics 来追踪这一行为。 + +``` +... +fbLikeParams = { + socialNetwork: + 'Facebook', + socialAction: + 'Like', + socialTarget: + 'https://facebook.com/mypage' +}; +... +fbLike() { + ga('send', 'social', this.fbLikeParams); +} +``` + +如果你觉得这段代码似曾相识,那是因为它确实跟上面统计“感兴趣”按钮点击次数的代码非常相似。下面我们继续看其中每一步的内容: + +1、构造发送的数据负载,其中包括以下字段: + + 1. `socialNetwork` – 交互发生的社交媒体,例如 Facebook、Twitter 等等 + 2. `socialAction` – 发生的交互类型,例如点赞、发表推文、分享等等 + 3. `socialTarget` – 交互的目标 URL,一般是社交媒体账号的主页 + +2、下一步是增加一个函数来发送整个交互记录。和统计按钮点击数量时相比,这里使用 `send()` 的方式有所不同。另外,我们还需要把这个函数绑定到已有的点赞按钮上。 + +在追踪用户交互方面,Google Analytics 还可以做更多的事情,其中最重要的一种是针对异常的追踪,这让我们可以通过 Google Analytics 来追踪应用程序中出现的错误和异常。在本文中我们就不赘述这一点了,但我们鼓励读者自行探索。 + +### 用户识别 + +#### 隐私是一项权利,而不是奢侈品 + +Google Analytics 除了可以记录很多用户的操作和交互活动之外,这一节还将介绍一个不太常见的功能,就是可以控制是否对用户的身份进行追踪。 + +#### Cookies + +Google Analytics 追踪用户活动的方式是基于 Cookies 的,因此我们可以自定义 Cookies 的名称以及一些其它的内容,请看下面这段代码: + +``` +trackingID = + 'UA-139883813-1' +; +cookieParams = { + cookieName: 'myGACookie', + cookieDomain: window.location.hostname, + cookieExpires: 604800 +}; +... +ngOnInit() { + ga('create', this.trackingID, this.cookieParams); +... +} +``` + +在上面这段代码中,我们设置了 Google Analytics Cookies 的名称、域以及过期时间,这就让我们能够将不同网站或 Web 应用的 Cookies 区分开来。因此我们需要为我们自己的应用程序的 Google Analytics 追踪器的 Cookies 设置一个自定义的标识1,而不是一个自动生成的随机标识。 + +#### IP 匿名 + +在某些场景下,我们可能不需要知道应用程序的流量来自哪里。例如对于一个按钮点击的追踪器,我们只需要关心按钮的点击量,而不需要关心点击者的地理位置。在这种场景下,Google Analytics 允许我们只追踪用户的操作行为,而不获取到用户的 IP 地址。 + +``` +ipParams = { + anonymizeIp: true +}; +... +ngOnInit() { + ... + ga('set', this.ipParams); + ... +} +``` + +在上面这段代码中,我们将 Google Analytics 追踪器的 `abibymizeIp` 参数设置为 `true`。这样用户的 IP 地址就不会被 Google Analytics 所追踪,这可以让用户知道自己的隐私正在被保护。 + +#### 不被跟踪 + +还有些时候用户可能不希望自己的行为受到追踪,而 Google Analytics 也允许这样的需求。因此也存在让用户不被追踪的选项。 + +``` +... +optOut() { + window['ga-disable-UA-139883813-1'] = true; +} +... +``` + +`optOut()` 是一个自定义函数,它可以禁用页面中的 Google Analytics 追踪,我们可以使用按钮或复选框上得事件绑定来使用这一个功能,这样用户就可以选择是否会被 Google Analytics 追踪。 + +在本文中,我们讨论了 Google Analytics 集成到单页应用时的难点,并探索出了一种相关的解决方法。我们还了解到了如何在单页应用中追踪页面访问和用户交互,例如按钮点击、社交媒体活动等。 + +最后,我们还了解到 Google Analytics 为用户提供了保护隐私的功能,尤其是用户的一些隐私数据并不需要参与到统计当中的时候。而用户也可以选择完全不受到 Google Analytics 的追踪。除此以外,Google Analytics 还可以做到很多其它的事情,这就需要我们继续不断探索了。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/all-that-you-can-do-with-google-analytics-and-more/ + +作者:[Ashwin Sathian][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/ashwin-sathian/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Analytics-illustration.jpg?resize=696%2C396&ssl=1 (Analytics illustration) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Analytics-illustration.jpg?fit=900%2C512&ssl=1 diff --git a/published/20191004 In Fedora 31, 32-bit i686 is 86ed.md b/published/20191004 In Fedora 31, 32-bit i686 is 86ed.md new file mode 100644 index 0000000000..933083eb29 --- /dev/null +++ b/published/20191004 In Fedora 31, 32-bit i686 is 86ed.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11424-1.html) +[#]: subject: (In Fedora 31, 32-bit i686 is 86ed) +[#]: via: (https://fedoramagazine.org/in-fedora-31-32-bit-i686-is-86ed/) +[#]: author: (Justin Forbes https://fedoramagazine.org/author/jforbes/) + +Fedora 31 将放弃 32 位 i686 支持 +====== + +![][1] + +Fedora 31 中[丢弃了][2] 32 位 i686 内核及其可启动镜像。虽然可能有一些用户仍然拥有无法与 64 位 x86_64 内核一起使用的硬件,但数量很少。本文为你提供了这次更改背后的整个事情,以及在 Fedora 31 中仍然可以找到的 32 位元素。 + +### 发生了什么? + +i686 架构实质上从 [Fedora 27 版本][3]就进入了社区支持阶段(LCTT 译注:不再由官方支持)。不幸的是,社区中没有足够的成员愿意做维护该体系结构的工作。不过请放心,Fedora 不会删除所有 32 位软件包,仍在构建许多 i686 软件包,以确保诸如 multilib、wine 和 Steam 之类的东西可以继续工作。 + +尽管该存储库不再构建和镜像输出,但存在一个 koji i686 存储库,该库可与 mock 一起使用以构建 32 位程序包,并且可以在紧要关头安装不属于 x86_64 multilib 存储库的 32 位版本。当然,维护人员希望这样做解决有限的使用场景。只是需要运行一个 32 位应用程序的用户应该可以在 64 位系统上使用 multilib 来运行。 + +### 如果你要运行 32 位应用需要做什么? + +如果你仍在运行 32 位 i686 系统,则会在 Fedora 30 生命周期中继续收到受支持的 Fedora 更新。直到大约 2020 年 5 月或 6 月。到那时,如果硬件支持,你可以将其重新安装为 64 位 x86_64,或者如果可能的话,将其替换为支持 64 位的硬件。 + +社区中有一个用户已经成功地从 32 位 Fedora “升级” 到了 64 位 x86 Fedora。虽然这不是预期或受支持的升级路径,但应该也可行。该项目希望可以为具有 64 位功能的硬件的用户提供一些文档,以在 Fedora 30 使用寿命终止之前说明该升级过程。 + +如果有 64 位的 CPU,但由于内存不足而运行 32 位 Fedora,请尝试[备用桌面流派][4]之一。LXDE 和其他产品在内存受限的环境中往往表现良好。对于仅在旧的可以扔掉的 32 位硬件上运行简单服务器的用户,请考虑使用较新的 ARM 板之一。在许多情况下,仅节能一项就可以支付新硬件的费用。如果以上皆不可行,[CentOS 7][5] 提供了一个 32 位镜像,并对该平台提供长期支持。 + +### 安全与你 + +尽管有些用户可能会在生命周期结束后继续运行旧版本的 Fedora,但强烈建议不要这样做。人们不断研究软件的安全问题。通常,他们发现这些问题已经存在多年了。 + +一旦 Fedora 维护人员知道了此类问题,他们通常会为它们打补丁,并为支持的发行版提供更新,而不会给使用寿命已终止的发行版提供。当然,一旦这些漏洞公开,就会有人尝试利用它们。如果你在生命周期结束时运行了较旧的发行版,则安全风险会随着时间的推移而增加,从而使你的系统面临不断增长的风险。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/in-fedora-31-32-bit-i686-is-86ed/ + +作者:[Justin Forbes][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://fedoramagazine.org/author/jforbes/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/i686-86-816x345.jpg +[2]: https://fedoraproject.org/wiki/Changes/Stop_Building_i686_Kernels +[3]: https://fedoramagazine.org/announcing-fedora-27/ +[4]: https://spins.fedoraproject.org +[5]: https://centos.org +[6]: https://unsplash.com/@alexkixa?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[7]: https://unsplash.com/s/photos/motherboard?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md new file mode 100644 index 0000000000..5c4de853c5 --- /dev/null +++ b/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11504-1.html) +[#]: subject: (Use GameHub to Manage All Your Linux Games in One Place) +[#]: via: (https://itsfoss.com/gamehub/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +用 GameHub 集中管理你 Linux 上的所有游戏 +====== + +你在 Linux 上是怎么[玩游戏的呢][1]? 让我猜猜,要不就是从软件中心直接安装,要不就选 Steam、GOG、Humble Bundle 等平台,对吧?但是,如果你有多个游戏启动器和客户端,又要如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现 [GameHub][2] 这个应用之后,感到非常高兴的原因。 + +GameHub 是为 Linux 发行版设计的一个桌面应用,它能让你“集中管理你的所有游戏”。这听起来很有趣,是不是?下面让我来具体说明一下。 + +![][3] + +### 集中管理不同平台 Linux 游戏的 GameHub + +让我们看看,对玩家来说,让 GameHub 成为一个[不可或缺的 Linux 应用][4]的功能,都有哪些。 + +#### Steam、GOG & Humble Bundle 支持 + +![][5] + +它支持 Steam、[GOG][6] 和 [Humble Bundle][7] 账户整合。你可以登录你的 GameHub 账号,从而在你的库管理器中管理所有游戏。 + +对我来说,我在 Steam 上有很多游戏,Humble Bundle 上也有一些。我不能确保它支持所有平台,但可以确信的是,主流平台游戏是没有问题的。 + +#### 支持原生游戏 + +![][8] + +[有很多网站专门推荐 Linux 游戏,并支持下载][9]。你可以通过下载安装包,或者添加可执行文件,从而管理原生游戏。 + +可惜的是,现在无法在 GameHub 内搜索 Linux 游戏。如上图所示,你需要分别下载游戏,随后再将其添加到 GameHub 中。 + +#### 模拟器支持 + +用模拟器,你可以在 [Linux 上玩复古游戏][10]。正如上图所示,你可以添加模拟器(并导入模拟的镜像)。 + +你可以在 [RetroArch][11] 查看已有的模拟器,但也能根据需求添加自定义模拟器。 + +#### 用户界面 + +![Gamehub 界面选项][12] + +当然,用户体验很重要。因此,探究下用户界面都有些什么,也很有必要。 + +我个人觉得,这一应用很容易使用,并且黑色主题是一个加分项。 + +#### 手柄支持 + +如果你习惯在 Linux 系统上用手柄玩游戏 —— 你可以轻松在设置里添加,启用或禁用它。 + +#### 多个数据提供商 + +因为它需要获取你的游戏信息(或元数据),也意味着它需要一个数据源。你可以看到下图列出的所有数据源。 + +![Data Providers Gamehub][13] + +这里你什么也不用做 —— 但如果你使用的是 steam 之外的其他平台,你需要为 [IDGB 生成一个 API 密钥][14]。 + +我建议只有出现 GameHub 中的提示/通知,或有些游戏在 GameHub 上没有任何描述/图片/状态时,再这么做。 + +#### 兼容性选项 + +![][15] + +你有不支持在 Linux 上运行的游戏吗? + +不用担心,GameHub 上提供了多种兼容工具,如 Wine/Proton,你可以利用它们来玩游戏。 + +我们无法确定具体哪个兼容工具适用于你 —— 所以你需要自己亲自测试。然而,对许多游戏玩家来说,这的确是个很有用的功能。 + +### GameHub: 如何安装它呢? + +![][18] + +首先,你可以直接在软件中心或者应用商店内搜索。 它在 “Pop!_Shop” 之下。所以,它在绝大多数官方源中都能找到。 + +如果你在这些地方都没有找到,你可以手动添加源,并从终端上安装它,你需要输入以下命令: + +``` +sudo add-apt-repository ppa:tkashkin/gamehub +sudo apt update +sudo apt install com.github.tkashkin.gamehub +``` + +如果你遇到了 “add-apt-repository command not found” 这个错误,你可以看看,[add-apt-repository not found error.][19]这篇文章,它能帮你解决这一问题。 + +这里还提供 AppImage 和 FlatPak 版本。 在[官网][2] 上,你可以针对找到其他 Linux 发行版的安装手册。 + +同时,你还可以从它的 [GitHub 页面][20]下载之前版本的安装包. + +[GameHub][2] + +### 如何在 GameHub 上管理你的游戏? + +在启动程序后,你可以将自己的 Steam/GOG/Humble Bundle 账号添加进来。 + +对于 Steam,你需要在 Linux 发行版上安装 Steam 客户端。一旦安装完成,你可以轻松将账号中的游戏导入 GameHub。 + +![][16] + +对于 GOG & Humble Bundle,登录后,就能直接在 GameHub 上管理游戏了。 + +如果你想添加模拟器或者本地安装文件,点击窗口右上角的 “+” 按钮进行添加。 + +### 如何安装游戏? + +对于 Steam 游戏,它会自动启动 Steam 客户端,从而下载/安装游戏(我希望之后安装游戏,可以不用启动 Steam!) + +![][17] + +但对于 GOG/Humble Bundle,登录后就能直接、下载安装游戏。必要的话,对于那些不支持在 Linux 上运行的游戏,你可以使用兼容工具。 + +无论是模拟器游戏,还是本地游戏,只需添加安装包或导入模拟器镜像就可以了。这里没什么其他步骤要做。 + +### 注意 + +GameHub 是相当灵活的一个集中游戏管理应用。 用户界面和选项设置也相当直观。 + +你之前是否使用过这一应用呢?如果有,请在评论里写下你的感受。 + +而且,如果你想尝试一些与此功能相似的工具/应用,请务必告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gamehub/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-gaming-guide/ +[2]: https://tkashkin.tk/projects/gamehub/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-home-1.png?ssl=1 +[4]: https://itsfoss.com/essential-linux-applications/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-platform-support.png?ssl=1 +[6]: https://www.gog.com/ +[7]: https://www.humblebundle.com/monthly?partner=itsfoss +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-native-installers.png?ssl=1 +[9]: https://itsfoss.com/download-linux-games/ +[10]: https://itsfoss.com/play-retro-games-linux/ +[11]: https://www.retroarch.com/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-appearance.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/data-providers-gamehub.png?ssl=1 +[14]: https://www.igdb.com/api +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-windows-game.png?fit=800%2C569&ssl=1 +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-library.png?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-compatibility-layer.png?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/gamehub-install.jpg?ssl=1 +[19]: https://itsfoss.com/add-apt-repository-command-not-found/ +[20]: https://github.com/tkashkin/GameHub/releases diff --git a/published/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md b/published/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md new file mode 100644 index 0000000000..ad7f88f885 --- /dev/null +++ b/published/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11458-1.html) +[#]: subject: (How to Install and Configure VNC Server on Centos 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-configure-vnc-server-centos8-rhel8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Centos 8 / RHEL 8 上安装和配置 VNC 服务器 +====== + +VNC(虚拟网络计算Virtual Network Computing)服务器是基于 GUI 的桌面共享平台,它可让你访问远程桌面计算机。在 Centos 8 和 RHEL 8 系统中,默认未安装 VNC 服务器,它需要手动安装。在本文中,我们将通过简单的分步指南,介绍如何在 Centos 8 / RHEL 8 上安装 VNC 服务器。 + +### 在 Centos 8 / RHEL 8 上安装 VNC 服务器的先决要求 + +要在你的系统中安装 VNC 服务器,请确保你的系统满足以下要求: + + * CentOS 8 / RHEL 8 + * GNOME 桌面环境 + * root 用户权限 + * DNF / YUM 软件包仓库 + +### 在 Centos 8 / RHEL 8 上安装 VNC 服务器的分步指导 + +#### 步骤 1)安装 GNOME 桌面环境 + +在 CentOS 8 / RHEL 8 中安装 VNC 服务器之前,请确保已安装了桌面环境(DE)。如果已经安装了 GNOME 桌面或安装了 GUI 支持,那么可以跳过此步骤。 + +在 CentOS 8 / RHEL 8 中,GNOME 是默认的桌面环境。如果你的系统中没有它,请使用以下命令进行安装: + +``` +[root@linuxtechi ~]# dnf groupinstall "workstation" +或者 +[root@linuxtechi ~]# dnf groupinstall "Server with GUI +``` + +成功安装上面的包后,请运行以下命令启用图形模式: + +``` +[root@linuxtechi ~]# systemctl set-default graphical +``` + +现在重启系统,进入 GNOME 登录页面(LCTT 译注:你可以通过切换运行态来进入图形界面)。 + +``` +[root@linuxtechi ~]# reboot +``` + +重启后,请取消注释 `/etc/gdm/custom.conf` 中的 `WaylandEnable=false`,以使通过 vnc 进行的远程桌面会话请求由 GNOME 桌面的 xorg 处理,来代替 Wayland 显示管理器。 + +注意: Wayland 是 GNOME 中的默认显示管理器 (GDM),并且未配置用于处理 X.org 等远程渲染的 API。 + +#### 步骤 2)安装 VNC 服务器(tigervnc-server) + +接下来,我们将安装 VNC 服务器,有很多 VNC 服务器可以选择,出于安装目的,我们将安装 `TigerVNC 服务器`。它是最受欢迎的 VNC 服务器之一,并且高性能还独立于平台,它使用户可以轻松地与远程计算机进行交互。 + +现在,使用以下命令安装 TigerVNC 服务器: + +``` +[root@linuxtechi ~]# dnf install tigervnc-server tigervnc-server-module -y +``` + +#### 步骤 3)为本地用户设置 VNC 密码 + +假设我们希望用户 `pkumar` 使用 VNC 进行远程桌面会话,然后切换到该用户并使用 `vncpasswd` 命令设置其密码, + +``` +[root@linuxtechi ~]# su - pkumar +[root@linuxtechi ~]$ vncpasswd +Password: +Verify: +Would you like to enter a view-only password (y/n)? n +A view-only password is not used +[root@linuxtechi ~]$ +[root@linuxtechi ~]$ exit +logout +[root@linuxtechi ~]# +``` + +#### 步骤 4)设置 VNC 服务器配置文件 + +下一步是配置 VNC 服务器配置文件。创建含以下内容的 `/etc/systemd/system/vncserver@.service`,以便为上面的本地用户 `pkumar` 启动 tigervnc-server 的服务。 + +``` +[root@linuxtechi ~]# vim /etc/systemd/system/vncserver@.service +[Unit] +Description=Remote Desktop VNC Service +After=syslog.target network.target + +[Service] +Type=forking +WorkingDirectory=/home/pkumar +User=pkumar +Group=pkumar + +ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' +ExecStart=/usr/bin/vncserver -autokill %i +ExecStop=/usr/bin/vncserver -kill %i + +[Install] +WantedBy=multi-user.target +``` + +保存并退出文件, + +注意:替换上面文件中的用户名为你自己的。 + +默认情况下,VNC 服务器在 tcp 端口 5900+n 上监听,其中 n 是显示端口号,如果显示端口号为 “1”,那么 VNC 服务器将在 TCP 端口 5901 上监听其请求。 + +#### 步骤 5)启动 VNC 服务并允许防火墙中的端口 + +我将显示端口号设置为 1,因此请使用以下命令在显示端口号 “1” 上启动并启用 vnc 服务, + +``` +[root@linuxtechi ~]# systemctl daemon-reload +[root@linuxtechi ~]# systemctl start vncserver@:1.service +[root@linuxtechi ~]# systemctl enable vncserver@:1.service +Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:1.service → /etc/systemd/system/vncserver@.service. +[root@linuxtechi ~]# +``` + +使用下面的 `netstat` 或 `ss` 命令来验证 VNC 服务器是否开始监听 5901 上的请求, + +``` +[root@linuxtechi ~]# netstat -tunlp | grep 5901 +tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 8169/Xvnc +tcp6 0 0 :::5901 :::* LISTEN 8169/Xvnc +[root@linuxtechi ~]# ss -tunlp | grep -i 5901 +tcp LISTEN 0 5 0.0.0.0:5901 0.0.0.0:* users:(("Xvnc",pid=8169,fd=6)) +tcp LISTEN 0 5 [::]:5901 [::]:* users:(("Xvnc",pid=8169,fd=7)) +[root@linuxtechi ~]# +``` + +使用下面的 `systemctl` 命令验证 VNC 服务器的状态, + +``` +[root@linuxtechi ~]# systemctl status vncserver@:1.service +``` + +![vncserver-status-centos8-rhel8][2] + +上面命令的输出确认在 tcp 端口 5901 上成功启动了 VNC。使用以下命令在系统防火墙中允许 VNC 服务器端口 “5901”, + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-port=5901/tcp +success +[root@linuxtechi ~]# firewall-cmd --reload +success +[root@linuxtechi ~]# +``` + +#### 步骤 6)连接到远程桌面会话 + +现在,我们已经准备就绪,可以查看远程桌面连接是否正常工作。要访问远程桌面,请在 Windows / Linux 工作站中启动 VNC Viewer,然后输入 VNC 服务器的 IP 地址和端口号,然后按回车。 + +![VNC-Viewer-Windows10][3] + +接下来,它将询问你的 VNC 密码。输入你先前为本地用户创建的密码,然后单击 “OK” 继续。 + +![VNC-Viewer-Connect-CentOS8-RHEL8-VNC-Server][4] + +现在你可以看到远程桌面, + +![VNC-Desktop-Screen-CentOS8][5] + +就是这样,你已经在 Centos 8 / RHEL 8 中成功安装了 VNC 服务器。 + +### 总结 + +希望这篇在 Centos 8 / RHEL 8 上安装 VNC 服务器的分步指南为你提供了轻松设置 VNC 服务器并访问远程桌面的所有信息。请在下面的评论栏中提供你的意见和建议。下篇文章再见。谢谢再见!!! + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-configure-vnc-server-centos8-rhel8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/cdn-cgi/l/email-protection +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/vncserver-status-centos8-rhel8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/10/VNC-Viewer-Windows10.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/VNC-Viewer-Connect-CentOS8-RHEL8-VNC-Server.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/VNC-Desktop-Screen-CentOS8.jpg diff --git a/published/20191007 IceWM - A really cool desktop.md b/published/20191007 IceWM - A really cool desktop.md new file mode 100644 index 0000000000..8ad9f9f045 --- /dev/null +++ b/published/20191007 IceWM - A really cool desktop.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11443-1.html) +[#]: subject: (IceWM – A really cool desktop) +[#]: via: (https://fedoramagazine.org/icewm-a-really-cool-desktop/) +[#]: author: (tdawson https://fedoramagazine.org/author/tdawson/) + +IceWM:一个非常酷的桌面 +====== + +![][1] + +IceWM 是一款非常轻量的桌面。它已经出现 20 多年了,它今天的目标仍然与当时相同:速度、简单性以及不妨碍用户。 + +我曾经将 IceWM 添加到 Scientific Linux 中作为轻量级桌面。当时它只是 0.5 兆的 rpm 包。运行时,它仅使用 5 兆的内存。这些年来,IceWM 有所增长。rpm 包现在为 1 兆。运行时,IceWM 现在使用 10 兆的内存。尽管在过去十年中它的大小增加了一倍,但它仍然非常小。 + +这么小的包,你能得到什么?确切地说,就是一个窗口管理器。没有其他东西。你有一个带有菜单或图标的工具栏来启动程序。速度很快。最后,还有主题和选项。除了工具栏中的一些小东西,就只有这些了。 + +![][2] + +### 安装 + +因为 IceWM 很小,你只需安装主软件包。 + +``` +$ sudo dnf install icewm +``` + +如果要节省磁盘空间,许多依赖项都是可选的。没有它们,IceWM 也可以正常工作。 + +``` +$ sudo dnf install icewm --setopt install_weak_deps=false +``` + +### 选项 + +IceWM 默认已经设置完毕,以使普通的 Windows 用户也能感到舒适。这是一件好事,因为选项是通过配置文件手动完成的。 + +我希望你不会因此而止步,因为它并没有听起来那么糟糕。它只有 8 个配置文件,大多数人只使用其中几个。主要的三个配置文件是 `keys`(键绑定),`preferences`(总体首选项)和 `toolbar`(工具栏上显示的内容)。默认配置文件位于 `/usr/share/icewm/`。 + +要进行更改,请将默认配置复制到 IceWM 家目录(`~/.icewm`),编辑文件,然后重新启动 IceWM。第一次做可能会有点害怕,因为在 “Logout” 菜单项下可以找到 “Restart Icewm”。但是,当你重启 IceWM 时,你只会看到闪烁一下,更改就生效了。任何打开的程序均不受影响,并保持原样。 + +### 主题 + +![IceWM in the NanoBlue theme][3] + +如果安装 icewm-themes 包,那么会得到很多主题。与常规选项不同,你无需重启 IceWM 即可更改为新主题。通常我不会谈论主题,但是由于其他功能很少,因此我想提下。 + +### 工具栏 + +工具栏是为 IceWM 添加了更多的功能的地方。你可以看到它可以切换不同的工作区。工作区有时称为虚拟桌面。单击工作区图标以移动到它。右键单击一个窗口的任务栏项目,可以在工作区之间移动它。如果你喜欢工作区,它拥有你想要的所有功能。如果你不喜欢工作区,那么可以选择关闭它。 + +工具栏还有网络/内存/CPU 监控图。将鼠标悬停在图标上可获得详细信息。单击图标可以打开一个拥有完整监控功能的窗口。这些小图形曾经出现在每个窗口管理器上。但是,随着桌面环境的成熟,它们都将这些图形去除了。我很高兴 IceWM 留下了这个不错的功能。 + +### 总结 + +如果你想要轻量但功能强大的桌面,IceWM 适合你。它已经设置好了,因此新的 Linux 用户也可以立即使用它。它是灵活的,因此 Unix 用户可以根据自己的喜好进行调整。最重要的是,IceWM 可以让你的程序不受阻碍地运行。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/icewm-a-really-cool-desktop/ + +作者:[tdawson][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/icewm-1-816x346.png +[2]: https://fedoramagazine.org/wp-content/uploads/2019/09/icewm.2-1024x768.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/09/icewm.3-1024x771.png diff --git a/published/20191008 7 steps to securing your Linux server.md b/published/20191008 7 steps to securing your Linux server.md new file mode 100644 index 0000000000..a98495f234 --- /dev/null +++ b/published/20191008 7 steps to securing your Linux server.md @@ -0,0 +1,223 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11444-1.html) +[#]: subject: (7 steps to securing your Linux server) +[#]: via: (https://opensource.com/article/19/10/linux-server-security) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +安全强化你的 Linux 服务器的七个步骤 +====== + +> 通过七个简单的步骤来加固你的 Linux 服务器。 + +![](https://img.linux.net.cn/data/attachment/album/201910/11/094107k8skl8wwxq62pzld.jpg) + +这篇入门文章将向你介绍基本的 Linux 服务器安全知识。虽然主要针对 Debian/Ubuntu,但是你可以将此处介绍的所有内容应用于其他 Linux 发行版。我也鼓励你研究这份材料,并在适用的情况下进行扩展。 + +### 1、更新你的服务器 + +保护服务器安全的第一件事是更新本地存储库,并通过应用最新的修补程序来升级操作系统和已安装的应用程序。 + +在 Ubuntu 和 Debian 上: + +``` +$ sudo apt update && sudo apt upgrade -y +``` + +在 Fedora、CentOS 或 RHEL: + +``` +$ sudo dnf upgrade +``` + +### 2、创建一个新的特权用户 + +接下来,创建一个新的用户帐户。永远不要以 root 身份登录服务器,而是创建你自己的帐户(用户),赋予它 `sudo` 权限,然后使用它登录你的服务器。 + +首先创建一个新用户: + +``` +$ adduser +``` + +通过将 `sudo` 组(`-G`)附加(`-a`)到用户的组成员身份里,从而授予新用户帐户 `sudo` 权限: + +``` +$ usermod -a -G sudo +``` + +### 3、上传你的 SSH 密钥 + +你应该使用 SSH 密钥登录到新服务器。你可以使用 `ssh-copy-id` 命令将[预生成的 SSH 密钥][2]上传到你的新服务器: + +``` +$ ssh-copy-id @ip_address +``` + +现在,你无需输入密码即可登录到新服务器。 + +### 4、安全强化 SSH + +接下来,进行以下三个更改: + +* 禁用 SSH 密码认证 +* 限制 root 远程登录 +* 限制对 IPv4 或 IPv6 的访问 + +使用你选择的文本编辑器打开 `/etc/ssh/sshd_config` 并确保以下行: + +``` +PasswordAuthentication yes +PermitRootLogin yes +``` + +改成这样: + +``` +PasswordAuthentication no +PermitRootLogin no +``` + +接下来,通过修改 `AddressFamily` 选项将 SSH 服务限制为 IPv4 或 IPv6。要将其更改为仅使用 IPv4(对大多数人来说应该没问题),请进行以下更改: + +``` +AddressFamily inet +``` + +重新启动 SSH 服务以启用你的更改。请注意,在重新启动 SSH 服务之前,与服务器建立两个活动连接是一个好主意。有了这些额外的连接,你可以在重新启动 SSH 服务出错的情况下修复所有问题。 + +在 Ubuntu 上: + +``` +$ sudo service sshd restart +``` + +在 Fedora 或 CentOS 或任何使用 Systemd 的系统上: + +``` +$ sudo systemctl restart sshd +``` + +### 5、启用防火墙 + +现在,你需要安装防火墙、启用防火墙并对其进行配置,以仅允许你指定的网络流量通过。(Ubuntu 上的)[简单的防火墙][3](UFW)是一个易用的 iptables 界面,可大大简化防火墙的配置过程。 + +你可以通过以下方式安装 UFW: + +``` +$ sudo apt install ufw +``` + +默认情况下,UFW 拒绝所有传入连接,并允许所有传出连接。这意味着服务器上的任何应用程序都可以访问互联网,但是任何尝试访问服务器的内容都无法连接。 + +首先,确保你可以通过启用对 SSH、HTTP 和 HTTPS 的访问来登录: + +``` +$ sudo ufw allow ssh +$ sudo ufw allow http +$ sudo ufw allow https +``` + +然后启用 UFW: + +``` +$ sudo ufw enable +``` + +你可以通过以下方式查看允许和拒绝了哪些服务: + +``` +$ sudo ufw status +``` + +如果你想禁用 UFW,可以通过键入以下命令来禁用: + +``` +$ sudo ufw disable +``` + +你还可以(在 RHEL/CentOS 上)使用 [firewall-cmd][4],它已经安装并集成到某些发行版中。 + +### 6、安装 Fail2ban + +[Fail2ban][5] 是一种用于检查服务器日志以查找重复或自动攻击的应用程序。如果找到任何攻击,它会更改防火墙以永久地或在指定的时间内阻止攻击者的 IP 地址。 + +你可以通过键入以下命令来安装 Fail2ban: + +``` +$ sudo apt install fail2ban -y +``` + +然后复制随附的配置文件: + +``` +$ sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local +``` + +重启 Fail2ban: + +``` +$ sudo service fail2ban restart +``` + +这样就行了。该软件将不断检查日志文件以查找攻击。一段时间后,该应用程序将建立相当多的封禁的 IP 地址列表。你可以通过以下方法查询 SSH 服务的当前状态来查看此列表: + +``` +$ sudo fail2ban-client status ssh +``` + +### 7、移除无用的网络服务 + +几乎所有 Linux 服务器操作系统都启用了一些面向网络的服务。你可能希望保留其中大多数,然而,有一些你或许希望删除。你可以使用 `ss` 命令查看所有正在运行的网络服务:(LCTT 译注:应该是只保留少部分,而所有确认无关的、无用的服务都应该停用或删除。) + +``` +$ sudo ss -atpu +``` + +`ss` 的输出取决于你的操作系统。下面是一个示例,它显示 SSH(`sshd`)和 Ngnix(`nginx`)服务正在侦听网络并准备连接: + +``` +tcp LISTEN 0 128 *:http *:* users:(("nginx",pid=22563,fd=7)) +tcp LISTEN 0 128 *:ssh *:* users:(("sshd",pid=685,fd=3)) +``` + +删除未使用的服务的方式因你的操作系统及其使用的程序包管理器而异。 + +要在 Debian / Ubuntu 上删除未使用的服务: + +``` +$ sudo apt purge +``` + +要在 Red Hat/CentOS 上删除未使用的服务: + +``` +$ sudo yum remove +``` + +再次运行 `ss -atup` 以确认这些未使用的服务没有安装和运行。 + +### 总结 + +本教程介绍了加固 Linux 服务器所需的最起码的措施。你应该根据服务器的使用方式启用其他安全层。这些安全层可以包括诸如各个应用程序配置、入侵检测软件(IDS)以及启用访问控制(例如,双因素身份验证)之类的东西。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/linux-server-security + +作者:[Patrick H. Mullins][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://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8 (computer servers processing data) +[2]: https://opensource.com/article/19/4/ssh-keys-seahorse +[3]: https://launchpad.net/ufw +[4]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[5]: https://www.fail2ban.org/wiki/index.php/Main_Page diff --git a/published/20191008 How to manage Go projects with GVM.md b/published/20191008 How to manage Go projects with GVM.md new file mode 100644 index 0000000000..62cf495b26 --- /dev/null +++ b/published/20191008 How to manage Go projects with GVM.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11447-1.html) +[#]: subject: (How to manage Go projects with GVM) +[#]: via: (https://opensource.com/article/19/10/introduction-gvm) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +如何用 GVM 管理 Go 项目 +====== + +> 使用 Go 版本管理器管理多个版本的 Go 语言环境及其模块。 + +![正在编程的女人][1] + +Go 语言版本管理器([GVM][2])是管理 Go 语言环境的开源工具。GVM “pkgsets” 支持安装多个版本的 Go 并管理每个项目的模块。它最初由 [Josh Bussdieker][3] 开发,GVM(像它的对手 Ruby RVM 一样)允许你为每个项目或一组项目创建一个开发环境,分离不同的 Go 版本和包依赖关系,以提供更大的灵活性,防止不同版本造成的问题。 + +有几种管理 Go 包的方式,包括内置于 Go 中的 Go 1.11 的 Modules。我发现 GVM 简单直观,即使我不用它来管理包,我还是会用它来管理 Go 不同的版本的。 + +### 安装 GVM + +安装 GVM 很简单。[GVM 存储库][4]安装文档指示你下载安装程序脚本并将其传送到 Bash 来安装: + +``` +bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) +``` + +尽管越来越多的人采用这种安装方法,但是在安装之前先看看安装程序在做什么仍然是一个很好的想法。以 GVM 为例,该安装程序脚本: + +1. 检查一些相关依赖性 +2. 克隆 GVM 存储库 +3. 使用 shell 脚本: + * 安装 Go 语言 + * 管理 `GOPATH` 环境变量 + * 向 `bashrc`、`zshrc` 或配置文件中添加一行内容 + +如果你想确认它在做什么,你可以克隆该存储库并查看 shell 脚本,然后运行 `./binscripts/gvm-installer` 这个本地脚本进行设置。 + +`注意:` 因为 GVM 可以用来下载和编译新的 Go 版本,所以有一些预期的依赖关系,如 Make、Git 和 Curl。你可以在 [GVM 的自述文件][5]中找到完整的发行版列表。 + +### 使用 GVM 安装和管理 GO 版本 + +一旦安装了 GVM,你就可以使用它来安装和管理不同版本的 Go。`gvm listall` 命令显示可下载和编译的可用版本的 Go: + +``` +[chris@marvin ]$ gvm listall + +gvm gos (available) + +   go1 +   go1.0.1 +   go1.0.2 +   go1.0.3 + +<输出截断> +``` + +安装特定的 Go 版本就像 `gvm install <版本>` 一样简单,其中 `<版本>` 是 `gvm listall` 命令返回的版本之一。 + +假设你正在进行一个使用 Go1.12.8 版本的项目。你可以使用 `gvm install go1.12.8` 安装这个版本: + +``` +[chris@marvin]$ gvm install go1.12.8 +Installing go1.12.8... + * Compiling... +go1.12.8 successfully installed! +``` + +输入 `gvm list`,你会看到 Go 版本 1.12.8 与系统 Go 版本(使用操作系统的软件包管理器打包的版本)一起并存: + +``` +[chris@marvin]$ gvm list + +gvm gos (installed) + +   go1.12.8 +=> system +``` + +GVM 仍在使用系统版本的 Go ,由 `=>` 符号表示。你可以使用 `gvm use` 命令切换你的环境以使用新安装的 go1.12.8: + +``` +[chris@marvin]$ gvm use go1.12.8 +Now using version go1.12.8 + +[chris@marvin]$ go version +go version go1.12.8 linux/amd64 +``` + +GVM 使管理已安装版本的 Go 变得极其简单,但它不止于此! + +### 使用 GVM pkgset + +开箱即用,Go 有一种出色而令人沮丧的管理包和模块的方式。默认情况下,如果你 `go get` 获取一个包,它将被下载到 `$GOPATH` 目录中的 `src` 和 `pkg` 目录下,然后可以使用 `import` 将其包含在你的 Go 程序中。这使得获得软件包变得很容易,特别是对于非特权用户,而不需要 `sudo` 或 root 特权(很像 Python 中的 `pip install --user`)。然而,在不同的项目中管理相同包的不同版本是非常困难的。 + +有许多方法可以尝试修复或缓解这个问题,包括实验性 Go Modules(Go 1.11 版中增加了初步支持)和 [Go dep][6](Go Modules 的“官方实验”并且持续迭代)。在我发现 GVM 之前,我会在一个 Go 项目自己的 Docker 容器中构建和测试它,以确保分离。 + +GVM 通过使用 “pkgsets” 将项目的新目录附加到安装的 Go 版本的默认 `$GOPATH` 上,很好地实现了项目之间包的管理和隔离,就像 `$PATH` 在 Unix/Linux 系统上工作一样。 + +想象它如何运行的。首先,安装新版 Go 1.12.9: + +``` +[chris@marvin]$ echo $GOPATH +/home/chris/.gvm/pkgsets/go1.12.8/global + +[chris@marvin]$ gvm install go1.12.9 +Installing go1.12.9... + * Compiling... +go1.12.9 successfully installed + +[chris@marvin]$ gvm use go1.12.9 +Now using version go1.12.9 +``` + +当 GVM 被告知使用新版本时,它会更改为新的 `$GOPATH`,默认 `gloabl` pkgset 应用于该版本: + +``` +[chris@marvin]$ echo $GOPATH +/home/chris/.gvm/pkgsets/go1.12.9/global + +[chris@marvin]$ gvm pkgset list + +gvm go package sets (go1.12.9) + +=>  global +``` + +尽管默认情况下没有安装额外的包,但是全局 pkgset 中的包对于使用该特定版本的 Go 的任何项目都是可用的。 + +现在,假设你正在启用一个新项目,它需要一个特定的包。首先,使用 GVM 创建一个新的 pkgset,名为 `introToGvm`: + +``` +[chris@marvin]$ gvm pkgset create introToGvm + +[chris@marvin]$ gvm pkgset use introToGvm +Now using version go1.12.9@introToGvm + +[chris@marvin]$ gvm pkgset list + +gvm go package sets (go1.12.9) + +    global +=>  introToGvm +``` + +如上所述,pkgset 的一个新目录被添加到 `$GOPATH`: + +``` +[chris@marvin]$ echo $GOPATH +/home/chris/.gvm/pkgsets/go1.12.9/introToGvm:/home/chris/.gvm/pkgsets/go1.12.9/global +``` + +将目录更改为预先设置的 `introToGvm` 路径,检查目录结构,这里使用 `awk` 和 `bash` 完成。 + +``` +[chris@marvin]$ cd $( awk -F':' '{print $1}' <<< $GOPATH ) +[chris@marvin]$ pwd +/home/chris/.gvm/pkgsets/go1.12.9/introToGvm + +[chris@marvin]$ ls +overlay pkg src +``` + +请注意,新目录看起来很像普通的 `$GOPATH`。新的 Go 包使用同样的 `go get` 命令下载并正常使用,且添加到 pkgset 中。 + +例如,使用以下命令获取 `gorilla/mux` 包,然后检查 pkgset 的目录结构: + +``` +[chris@marvin]$ go get github.com/gorilla/mux +[chris@marvin]$ tree +[chris@marvin introToGvm ]$ tree +. +├── overlay +│ ├── bin +│ └── lib +│ └── pkgconfig +├── pkg +│ └── linux_amd64 +│ └── github.com +│ └── gorilla +│ └── mux.a +src/ +└── github.com + └── gorilla + └── mux + ├── AUTHORS + ├── bench_test.go + ├── context.go + ├── context_test.go + ├── doc.go + ├── example_authentication_middleware_test.go + ├── example_cors_method_middleware_test.go + ├── example_route_test.go + ├── go.mod + ├── LICENSE + ├── middleware.go + ├── middleware_test.go + ├── mux.go + ├── mux_test.go + ├── old_test.go + ├── README.md + ├── regexp.go + ├── route.go + └── test_helpers.go +``` + +如你所见,`gorilla/mux` 已按预期添加到 pkgset `$GOPATH` 目录中,现在可用于使用此 pkgset 项目了。 + +### GVM 让 Go 管理变得轻而易举 + +GVM 是一种直观且非侵入性的管理 Go 版本和包的方式。它可以单独使用,也可以与其他 Go 模块管理技术结合使用并利用 GVM Go 版本管理功能。按 Go 版本和包依赖来分离项目使得开发更加容易,并且减少了管理版本冲突的复杂性,GVM 让这变得轻而易举。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/introduction-gvm + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://github.com/moovweb/gvm +[3]: https://github.com/jbussdieker +[4]: https://github.com/moovweb/gvm#installing +[5]: https://github.com/moovweb/gvm/blob/master/README.md +[6]: https://golang.github.io/dep/ diff --git a/published/20191009 Command line quick tips- Locate and process files with find and xargs.md b/published/20191009 Command line quick tips- Locate and process files with find and xargs.md new file mode 100644 index 0000000000..038a61aaa6 --- /dev/null +++ b/published/20191009 Command line quick tips- Locate and process files with find and xargs.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11469-1.html) +[#]: subject: (Command line quick tips: Locate and process files with find and xargs) +[#]: via: (https://fedoramagazine.org/command-line-quick-tips-locate-and-process-files-with-find-and-xargs/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +命令行技巧:使用 find 和 xargs 查找和处理文件 +====== + +![][1] + +`find` 是日常工具箱中功能强大、灵活的命令行程序之一。它如它名字所暗示的:查找符合你指定条件的文件和目录。借助 `-exec` 或 `-delete` 之类的参数,你可以让它对找到的文件进行操作。 + +在[命令行提示][2]系列的这一期中,你将会看到 `find` 命令的介绍,并学习如何使用内置命令或使用 `xargs` 命令处理文件。 + +### 查找文件 + +`find` 至少要加上查找的路径。例如,此命令将查找(并打印)系统上的每个文件: + +``` +find / +``` + +由于一切皆文件,因此你会看到大量的输出。这可能无法帮助你找到所需的内容。你可以更改路径参数缩小范围,但这实际上并没有比使用 `ls` 命令更好。因此,你需要考虑要查找的内容。 + +也许你想在家目录中查找所有 JPEG 文件。 `-name` 参数允许你将结果限制为与给定模式匹配的文件。 + +``` +find ~ -name '*jpg' +``` + +但是等等!如果其中一些扩展名是大写怎么办? `-iname` 类似于 `-name`,但不区分大小写: + +``` +find ~ -iname '*jpg' +``` + +很好!但是 8.3 命名方案出自 1985 年。某些图片的扩展名可能是 .jpeg。幸运的是,我们可以将模式使用“或”(`-o`)进行组合。括号需要转义,以便使 `find` 命令而不是 shell 程序尝试解释它们。 + +``` +find ~ \( -iname 'jpeg' -o -iname 'jpg' \) +``` + +更进一步。如果你有一些以 `jpg` 结尾的目录怎么办?(我不懂你为什么将目录命名为 `bucketofjpg` 而不是 `pictures`?)我们可以加上 `-type` 参数来仅查找文件: + +``` +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f +``` + +或者,也许你想找到那些名字奇怪的目录,以便之后可以重命名它们: + +``` +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type d +``` + +最近你拍摄了很多照片,因此使用 `-mtime`(修改时间)将范围缩小到最近一周修改过的文件。 `-7` 表示 7 天或更短时间内修改的所有文件。 + +``` +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7 +``` + +### 使用 xargs 进行操作 + +`xargs` 命令从标准输入流中获取参数,并基于它们执行命令。继续使用上一节中的示例,假设你要将上周修改过的家目录中的所有 JPEG 文件复制到 U 盘,以便插到电子相册上。假设你已经将 U 盘挂载到 `/media/photo_display`。 + +``` +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7 -print0 | xargs -0 cp -t /media/photo_display +``` + +这里的 `find` 命令与以前的版本略有不同。`-print0` 命令让输出有一些更改:它不使用换行符,而是添加了一个 `null` 字符。`xargs` 的 `-0`(零)选项可调整解析以达到预期效果。这很重要,不然对包含空格、引号或其他特殊字符的文件名执行操作可能无法按预期进行。对文件采取任何操作时,都应使用这些选项。 + +`cp` 命令的 `-t` 参数很重要,因为 `cp` 通常要求目的地址在最后。你可以不使用 `xargs` 而使用 `find` 的 `-exec` 执行此操作,但是 `xargs` 的方式会更快,尤其是对于大量文件,因为它会单次调用 `cp`。 + +### 了解更多 + +这篇文章仅仅是 `find` 可以做的事情的表面。 `find` 支持基于权限、所有者、访问时间等的测试。它甚至可以将搜索路径中的文件与其他文件进行比较。将测试与布尔逻辑相结合,可以为你提供惊人的灵活性,以精确地找到你要查找的文件。使用内置命令或管道传递给 `xargs`,你可以快速处理大量文件。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/command-line-quick-tips-locate-and-process-files-with-find-and-xargs/ + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg +[2]: https://fedoramagazine.org/?s=command+line+quick+tips +[3]: https://opensource.com/article/18/4/how-use-find-linux +[4]: https://unsplash.com/@wflwong?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[5]: https://unsplash.com/s/photos/search?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/20191009 Top 10 open source video players for Linux.md b/published/20191009 Top 10 open source video players for Linux.md new file mode 100644 index 0000000000..8735a7b408 --- /dev/null +++ b/published/20191009 Top 10 open source video players for Linux.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11481-1.html) +[#]: subject: (Top 10 open source video players for Linux) +[#]: via: (https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-linux/) +[#]: author: (Stella Aldridge https://opensourceforu.com/author/stella-aldridge/) + +Linux 中的十大开源视频播放器 +====== + +![][1] + +> 选择合适的视频播放器有助于确保你获得最佳的观看体验,并为你提供[创建视频网站][3]的工具。你甚至可以根据个人喜好自定义正在观看的视频。 + +因此,为了帮助你挑选适合你需求的最佳播放器,我们列出了 Linux 中的十大开源播放器。 + +让我们来看看: + +### 1、XBMC – Kodi 媒体中心 + +这是一个灵活的跨平台播放器,核心使用 C++ 编写,并提供 Python 脚本作为附加组件。使用 Kodi 的好处包括: + + * 提供超过 69 种语言版本 + * 用户可以从网络和本地存储播放音频、视频和媒体播放文件 + * 可与 JeOS 一起作为应用套件用于智能电视和机顶盒等设备 + * 有很多不错的附加组件,如视频和音频流插件、主题、屏幕保护程序等 + * 它支持多种格式,如 MPEG-1、2、4、RealVideo、HVC、HEVC 等 + +### 2、VLC 媒体播放器 + +由于该播放器在一系列操作系统上具有令人印象深刻的功能和可用性,它出现在列表上是理所当然的。它使用 C、C++ 和 Objective C 编写,用户无需使用插件,这要归功于它对解码库的广泛支持。VLC 媒体播放器的优势包括: + + * 在 Linux 上支持 DVD 播放器 + * 能够播放 .iso 文件 + * 能够播放高清录制的 D-VHS 磁带 + * 可以直接从 U 盘或外部驱动器运行 + * API 支持和浏览器支持(通过插件) + +### 3、Bomi(CMPlayer) + +这个灵活和强大的播放器被许多普通用户选择,它的优势有: + + * 易于使用的图形用户界面(GUI) + * 令人印象深刻的播放能力 + * 可以恢复播放 + * 支持字幕,可以渲染多个字幕文件 + +![][4] + +### 4、Miro 音乐与视频播放器 + +以前被称为 Democracy Player(DTV),Miro 由参与文化基金会Participatory Culture Foundation重新开发,是一个不错的跨平台音频视频播放器。令人印象深刻,因为: + + * 支持一些高清音频和视频 + * 提供超过 40 种语言版本 + * 可以播放多种文件格式,例如,QuickTime、WMV、MPEG 文件、AVI、XVID + * 一旦可用,可以自动通知用户并下载视频 + +### 5、SMPlayer + +这个跨平台的媒体播放器,只使用 C++ 的 Qt 库编写,它是一个强大的多功能播放器。我们喜欢它,因为: + + * 有多语言选择 + * 支持所有默认格式 + * 支持 EDL 文件,你可以配置从互联网获取的字幕 + * 可从互联网下载的各种皮肤 + * 倍速播放 + +### 6、MPV 播放器 + +它用 C、Objective-C、Lua 和 Python 编写,免费、易于使用,并且有许多新功能,便于使用。主要加分是: + + * 可以编译为一个库,公开客户端 API,从而增强控制 + * 允许媒体编码 + * 平滑动画 + +### 7、Deepin Movie + +此播放器是开源媒体播放器的一个极好的例子,它有很多优势,包括: + + * 通过键盘完成所有播放操作 + * 各种格式的视频文件可以通过这个播放器轻松播放 + * 流媒体功能能让用户享受许多在线视频资源 + +### 8、Gnome 视频 + +以前称为 Totem,这是 Gnome 桌面环境的播放器。 + +完全用 C 编写,使用 GStreamer 多媒体框架构建,高于 2.7.1 的版本使用 xine 作为后端。它是很棒的,因为: + +它支持大量的格式,包括: + + * SHOUTcast、SMIL、M3U、Windows 媒体播放器格式等 + * 你可以在播放过程中调整灯光设置,如亮度和对比度 + * 加载 SubRip 字幕 + * 支持从互联网频道(如 Apple)直接播放视频 + +### 9、Xine 多媒体播放器 + +我们列表中用 C 编写的另外一个跨平台多媒体播放器。这是一个全能播放器,因为: + + * 它支持物理媒体以及视频设备。3gp、MKV、 MOV、Mp4、音频格式 + * 网络协议,V4L、DVB 和 PVR 等 + * 它可以手动校正音频和视频流的同步 + +### 10、ExMPlayer + +最后但同样重要的一个,ExMPlayer 是一个惊人的、强大的 MPlayer 的 GUI 前端。它的优点包括: + + * 可以播放任何媒体格式 + * 支持网络流和字幕 + * 易于使用的音频转换器 + * 高品质的音频提取,而不会影响音质 + +上面这些视频播放器在 Linux 上工作得很好。我们建议你尝试一下,选择一个最适合你的播放器。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-linux/ + +作者:[Stella Aldridge][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/stella-aldridge/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Depositphotos_50337841_l-2015.jpg?resize=696%2C585&ssl=1 (Depositphotos_50337841_l-2015) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Depositphotos_50337841_l-2015.jpg?fit=900%2C756&ssl=1 +[3]: https://www.ning.com/create-video-website/ +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Depositphotos_20380441_l-2015.jpg?resize=350%2C231&ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Depositphotos_20380441_l-2015.jpg?ssl=1 diff --git a/published/20191010 DevSecOps pipelines and tools- What you need to know.md b/published/20191010 DevSecOps pipelines and tools- What you need to know.md new file mode 100644 index 0000000000..11ef11bb61 --- /dev/null +++ b/published/20191010 DevSecOps pipelines and tools- What you need to know.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11492-1.html) +[#]: subject: (DevSecOps pipelines and tools: What you need to know) +[#]: via: (https://opensource.com/article/19/10/devsecops-pipeline-and-tools) +[#]: author: (Sagar Nangare https://opensource.com/users/sagarnangare) + +你需要知道的 DevSecOps 流程及工具 +====== + +> DevSecOps 对 DevOps 进行了改进,以确保安全性仍然是该过程的一个重要部分。 + +![](https://img.linux.net.cn/data/attachment/album/201910/23/002010fvzh282e8ghhdzpk.jpg) + +到目前为止,DevOps 在 IT 世界中已广为人知,但其并非完美无缺。试想一下,你在一个项目的现代应用程序交付中实施了所有 DevOps 工程实践。你已经到达开发流程的末尾,但是渗透测试团队(内部或外部)检测到安全漏洞并提出了报告。现在,你必须重新启动所有流程,并要求开发人员修复该漏洞。 + +在基于 DevOps 的软件开发生命周期(SDLC)系统中,这并不繁琐,但它确实会浪费时间并影响交付进度。如果从 SDLC 初期就已经集成了安全性,那么你可能已经跟踪到了该故障,并在开发流程中就消除了它。但是,如上述情形那样,将安全性推到开发流程的最后将导致更长的开发生命周期。 + +这就是引入 DevSecOps 的原因,它以自动化的方式巩固了整个软件交付周期。 + +在现代 DevOps 方法中,组织广泛使用容器托管应用程序,我们看到 [Kubernetes][2] 和 [Istio][3] 使用的较多。但是,这些工具都有其自身的漏洞。例如,云原生计算基金会(CNCF)最近完成了一项 [kubernetes 安全审计][4],发现了几个问题。DevOps 开发流程中使用的所有工具在流程运行时都需要进行安全检查,DevSecOps 会推动管理员去监视工具的存储库以获取升级和补丁。 + +### 什么是 DevSecOps? + +与 DevOps 一样,DevSecOps 是开发人员和 IT 运营团队在开发和部署软件应用程序时所遵循的一种思维方式或文化。它将主动和自动化的安全审计以及渗透测试集成到敏捷应用程序开发中。 + +要使用 [DevSecOps][5],你需要: + + * 从 SDLC 开始就引入安全性概念,以最大程度地减少软件代码中的漏洞。 + * 确保每个人(包括开发人员和 IT 运营团队)共同承担在其任务中遵循安全实践的责任。 + * 在 DevOps 工作流程开始时集成安全控件、工具和流程。这些将在软件交付的每个阶段启用自动安全检查。 + +DevOps 一直致力于在开发和发布过程中包括安全性以及质量保证(QA)、数据库管理和其他所有方面。然而,DevSecOps 是该过程的一个演进,以确保安全永远不会被遗忘,成为该过程的一个重要部分。 + +### 了解 DevSecOps 流程 + +典型的 DevOps 流程有不同的阶段;典型的 SDLC 流程包括计划、编码、构建、测试、发布和部署等阶段。在 DevSecOps 中,每个阶段都会应用特定的安全检查。 + + * **计划**:执行安全性分析并创建测试计划,以确定在何处、如何以及何时进行测试的方案。 + * **编码**:部署整理工具和 Git 控件以保护密码和 API 密钥。 + * **构建**:在构建执行代码时,请结合使用静态应用程序安全测试(SAST)工具来跟踪代码中的缺陷,然后再部署到生产环境中。这些工具针对特定的编程语言。 + * **测试**:在运行时使用动态应用程序安全测试(DAST)工具来测试您的应用程序。 这些工具可以检测与用户身份验证,授权,SQL 注入以及与 API 相关的端点相关的错误。 + * **发布**:在发布应用程序之前,请使用安全分析工具来进行全面的渗透测试和漏洞扫描。 + * **部署**:在运行时完成上述测试后,将安全的版本发送到生产中以进行最终部署。 + +### DevSecOps 工具 + +SDLC 的每个阶段都有可用的工具。有些是商业产品,但大多数是开源的。在我的下一篇文章中,我将更多地讨论在流程的不同阶段使用的工具。 + +随着基于现代 IT 基础设施的企业安全威胁的复杂性增加,DevSecOps 将发挥更加关键的作用。然而,DevSecOps 流程将需要随着时间的推移而改进,而不是仅仅依靠同时实施所有安全更改即可。这将消除回溯或应用交付失败的可能性。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/devsecops-pipeline-and-tools + +作者:[Sagar Nangare][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sagarnangare +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://opensource.com/article/18/9/what-istio +[4]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ +[5]: https://resources.whitesourcesoftware.com/blog-whitesource/devsecops diff --git a/published/20191010 Viewing files and processes as trees on Linux.md b/published/20191010 Viewing files and processes as trees on Linux.md new file mode 100644 index 0000000000..f8d1fb7183 --- /dev/null +++ b/published/20191010 Viewing files and processes as trees on Linux.md @@ -0,0 +1,242 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11462-1.html) +[#]: subject: (Viewing files and processes as trees on Linux) +[#]: via: (https://www.networkworld.com/article/3444589/viewing-files-and-processes-as-trees-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上以树状查看文件和进程 +====== + +> 介绍三个 Linux 命令:ps、pstree 和 tree 以类似树的格式查看文件和进程。 + +![](https://img.linux.net.cn/data/attachment/album/201910/15/093202rwm5k9pnpntgbtpr.jpg) + +[Linux][3] 提供了一些方便的命令,用于以树状分支形式查看文件和进程,从而易于查看它们之间的关系。在本文中,我们将介绍 `ps`、`pstree` 和 `tree` 命令以及它们提供的一些选项,这些选项可帮助你将注意力集中在要查看的内容上。 + +### ps + +我们用来列出进程的 `ps` 命令有一些有趣的选项,但是很多人从来没有利用过。虽然常用的 `ps -ef` 提供了正在运行的进程的完整列表,但是 `ps -ejH` 命令增加了一个不错的效果。它缩进了相关的进程以使这些进程之间的关系在视觉上更加清晰——就像这个片段: + +``` +$ ps -ejH + PID PGID SID TTY TIME CMD +... + 1396 1396 1396 ? 00:00:00 sshd +28281 28281 28281 ? 00:00:00 sshd +28409 28281 28281 ? 00:00:00 sshd +28410 28410 28410 pts/0 00:00:00 bash +30968 30968 28410 pts/0 00:00:00 ps +``` + +可以看到,正在运行的 `ps` 进程是在 `bash` 中运行的,而 `bash` 是在 ssh 会话中运行的。 + +`-exjf` 选项字符串提供了类似的视图,但是带有一些其它细节和符号以突出显示进程的层次结构性质: + +``` +$ ps -exjf +PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND +... + 1 1396 1396 1396 ? -1 Ss 0 0:00 /usr/sbin/sshd -D + 1396 28281 28281 28281 ? -1 Ss 0 0:00 \_ sshd: shs [priv] +28281 28409 28281 28281 ? -1 S 1000 0:00 \_ sshd: shs@pts/0 +28409 28410 28410 28410 pts/0 31028 Ss 1000 0:00 \_ -bash +28410 31028 31028 28410 pts/0 31028 R+ 1000 0:00 \_ ps axjf +``` + +命令中使用的这些选项表示: + +``` +-e 选择所有进程 +-j 使用工作格式 +-f 提供完整格式列表 +-H 分层显示进程(如,树状格式) +-x 取消“必须与 tty 相关联”的限制 +``` + +同时,该命令也有一个 `--forest` 选项提供了类似的视图。 + +``` +$ ps -ef --forest +UID PID PPID C STIME TTY TIME CMD +... +root 1396 1 0 Oct08 ? 00:00:00 /usr/sbin/sshd -D +root 28281 1396 0 12:55 ? 00:00:00 \_ sshd: shs [priv] +shs 28409 28281 0 12:56 ? 00:00:00 \_ sshd: shs@pts/0 +shs 28410 28409 0 12:56 pts/0 00:00:00 \_ -bash +shs 32351 28410 0 14:39 pts/0 00:00:00 \_ ps -ef --forest +``` + +注意,这些示例只是这些命令如何使用的示例。你可以选择最适合你的进程视图的任何选项组合。 + +### pstree + +使用 `pstree` 命令可以获得类似的进程视图。尽管 `pstree` 具备了许多选项,但是该命令本身就提供了非常有用的显示。注意,许多父子进程关系显示在单行而不是后续行上。 + +``` +$ pstree +... + ├─sshd───sshd───sshd───bash───pstree + ├─systemd─┬─(sd-pam) + │ ├─at-spi-bus-laun─┬─dbus-daemon + │ │ └─3*[{at-spi-bus-laun}] + │ ├─at-spi2-registr───2*[{at-spi2-registr}] + │ ├─dbus-daemon + │ ├─ibus-portal───2*[{ibus-portal}] + │ ├─pulseaudio───2*[{pulseaudio}] + │ └─xdg-permission-───2*[{xdg-permission-}] +``` + +通过 `-n` 选项,`pstree` 以数值(按进程 ID)顺序显示进程: + +``` +$ pstree -n +systemd─┬─systemd-journal + ├─systemd-udevd + ├─systemd-timesyn───{systemd-timesyn} + ├─systemd-resolve + ├─systemd-logind + ├─dbus-daemon + ├─atopacctd + ├─irqbalance───{irqbalance} + ├─accounts-daemon───2*[{accounts-daemon}] + ├─acpid + ├─rsyslogd───3*[{rsyslogd}] + ├─freshclam + ├─udisksd───4*[{udisksd}] + ├─networkd-dispat + ├─ModemManager───2*[{ModemManager}] + ├─snapd───10*[{snapd}] + ├─avahi-daemon───avahi-daemon + ├─NetworkManager───2*[{NetworkManager}] + ├─wpa_supplicant + ├─cron + ├─atd + ├─polkitd───2*[{polkitd}] + ├─colord───2*[{colord}] + ├─unattended-upgr───{unattended-upgr} + ├─sshd───sshd───sshd───bash───pstree +``` + +使用 `pstree` 时可以考虑的一些选项包括 `-a`(包括命令行参数)和 `-g`(包括进程组)。 + +以下是一些简单的示例(片段)。 + +命令 `pstree -a` 的输出内容: + +``` +└─wpa_supplicant -u -s -O /run/wpa_supplicant +``` + +命令 `pstree -g` 的输出内容: + +``` +├─sshd(1396)───sshd(28281)───sshd(28281)───bash(28410)───pstree(1115) +``` + +### tree + +虽然 `tree` 命令听起来与 `pstree` 非常相似,但这是用于查看文件而非进程的命令。它提供了一个漂亮的树状目录和文件视图。 + +如果你使用 `tree` 命令查看 `/proc` 目录,你显示的开头部分将类似于这个: + +``` +$ tree /proc +/proc +├── 1 +│ ├── attr +│ │ ├── apparmor +│ │ │ ├── current +│ │ │ ├── exec +│ │ │ └── prev +│ │ ├── current +│ │ ├── display +│ │ ├── exec +│ │ ├── fscreate +│ │ ├── keycreate +│ │ ├── prev +│ │ ├── smack +│ │ │ └── current +│ │ └── sockcreate +│ ├── autogroup +│ ├── auxv +│ ├── cgroup +│ ├── clear_refs +│ ├── cmdline +... +``` + +如果以 root 权限运行这条命令(`sudo tree /proc`),你将会看到更多详细信息,因为 `/proc` 目录的许多内容对于普通用户而言是无法访问的。 + +命令 `tree -d` 将会限制仅显示目录。 + +``` +$ tree -d /proc +/proc +├── 1 +│ ├── attr +│ │ ├── apparmor +│ │ └── smack +│ ├── fd [error opening dir] +│ ├── fdinfo [error opening dir] +│ ├── map_files [error opening dir] +│ ├── net +│ │ ├── dev_snmp6 +│ │ ├── netfilter +│ │ └── stat +│ ├── ns [error opening dir] +│ └── task +│ └── 1 +│ ├── attr +│ │ ├── apparmor +│ │ └── smack +... +``` + +使用 `-f` 选项,`tree` 命令会显示完整的路径。 + +``` +$ tree -f /proc +/proc +├── /proc/1 +│ ├── /proc/1/attr +│ │ ├── /proc/1/attr/apparmor +│ │ │ ├── /proc/1/attr/apparmor/current +│ │ │ ├── /proc/1/attr/apparmor/exec +│ │ │ └── /proc/1/attr/apparmor/prev +│ │ ├── /proc/1/attr/current +│ │ ├── /proc/1/attr/display +│ │ ├── /proc/1/attr/exec +│ │ ├── /proc/1/attr/fscreate +│ │ ├── /proc/1/attr/keycreate +│ │ ├── /proc/1/attr/prev +│ │ ├── /proc/1/attr/smack +│ │ │ └── /proc/1/attr/smack/current +│ │ └── /proc/1/attr/sockcreate +... +``` + +分层显示通常可以使进程和文件之间的关系更容易理解。可用选项的数量很多,而你总可以找到一些视图,帮助你查看所需的内容。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3444589/viewing-files-and-processes-as-trees-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [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/cricketsblog/46967168105/in/photolist-2eyk1Lr-KQsMHg-JbWG41-FWu8FU-6daUYv-cxH2Aq-DV2CNk-25eF8V1-GEEwLx-S9a29U-GpiYf2-Yi5dnF-YLPMV3-23ThoAZ-dTyphv-DVXTMY-ERmSjL-6z86DE-QVnnyv-7PLo9u-58CYnd-dYmbPX-63nVid-p7Ea54-238LQaD-Qb6CkZ-QoRhQX-suMNcq-22JeozK-BwMvBg-26AQHz1-PhQT4J-AGyhXA-2fhixB3-qngdKE-UiptQQ-ZzpiHa-pH4g9e-28CoU2s-81gNxg-qnoewg-2cmYaRk-d3FRuo-4fJrSL-23NqveR-LLEYMU-FZixFK-5aBDGU-PBQbWq-dJoaKi +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md b/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md new file mode 100644 index 0000000000..a40d412a74 --- /dev/null +++ b/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (singledo) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11470-1.html) +[#]: subject: (How to Unzip a Zip File in Linux [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/unzip-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +新手教程:如何在 Linux 下解压 Zip 文件 +====== + +> 本文将会向你展示如何在 Ubuntu 和其他 Linux 发行版本上解压文件。终端和图形界面的方法都会讨论。 + +[Zip][1] 是一种创建压缩存档文件的最普通、最流行的方法。它也是一种古老的文件归档文件格式,这种格式创建于 1989 年。由于它的广泛使用,你会经常遇见 zip 文件。 + +在更早的一份教程里,我介绍了[如何在 Linux 上用 zip 压缩一个文件夹][2]。在这篇面向初学者的快速教程中,我会介绍如何在 Linux 上解压文件。 + +先决条件:检查你是否安装了 `unzip`。 + +为了解压 zip 归档文件,你必须在你的系统上安装了 unzip 软件包。大多数现代的的 Linux 发行版本提供了解压 zip 文件的支持,但是对这些 zip 文件进行校验以避免以后出现损坏总是没有坏处的。 + +在基于 [Unbutu][3] 和 [Debian][4] 的发行版上,你能够使用下面的命令来安装 `unzip`。如果你已经安装了,你会被告知已经被安装。 + +``` +sudo apt install unzip +``` + +一旦你能够确认你的系统中安装了 `unzip`,你就可以通过 `unzip` 来解压 zip 归档文件。 + +你也能够使用命令行或者图形工具来达到目的,我会向你展示两种方法: + +### 使用命令行解压文件 + +在 Linux 下使用 `unzip` 命令是非常简单的。在你放 zip 文件的目录,用下面的命令: + +``` +unzip zipped_file.zip +``` + +你可以给 zip 文件提供解压路径而不是解压到当前所在路径。你会在终端输出中看到提取的文件: + +``` +unzip metallic-container.zip -d my_zip +Archive: metallic-container.zip + inflating: my_zip/625993-PNZP34-678.jpg + inflating: my_zip/License free.txt + inflating: my_zip/License premium.txt +``` + +上面的命令有一个小问题。它会提取 zip 文件中所有的内容到现在的文件夹。你会在当前文件夹下留下一堆没有组织的文件,这不是一件很好的事情。 + +#### 解压到文件夹下 + +在 Linux 命令行下,对于把文件解压到一个文件夹下是一个好的做法。这种方式下,所有的提取文件都会被存储到你所指定的文件夹下。如果文件夹不存在,会创建该文件夹。 + +``` +unzip zipped_file.zip -d unzipped_directory +``` + +现在 `zipped_file.zip` 中所有的内容都会被提取到 `unzipped_directory` 中。 + +由于我们在讨论好的做法,这里有另一个注意点,我们可以查看压缩文件中的内容而不用实际解压。 + +#### 查看压缩文件中的内容而不解压压缩文件 + +``` +unzip -l zipped_file.zip +``` + +下面是该命令的输出: + +``` +unzip -l metallic-container.zip +Archive: metallic-container.zip + Length Date Time Name +--------- ---------- ----- ---- + 6576010 2019-03-07 10:30 625993-PNZP34-678.jpg + 1462 2019-03-07 13:39 License free.txt + 1116 2019-03-07 13:39 License premium.txt +--------- ------- + 6578588 3 files +``` + +在 Linux 下,还有些 `unzip` 的其它用法,但我想你现在已经对在 Linux 下使用解压文件有了足够的了解。 + +### 使用图形界面来解压文件 + +如果你使用桌面版 Linux,那你就不必总是使用终端。在图形化的界面下,我们又要如何解压文件呢? 我使用的是 [GNOME 桌面][7],不过其它桌面版 Linux 发行版也大致相同。 + +打开文件管理器,然后跳转到 zip 文件所在的文件夹下。在文件上点击鼠标右键,你会在弹出的窗口中看到 “提取到这里”,选择它。 + +![Unzip File in Ubuntu][8] + +与 `unzip` 命令不同,这个提取选项会创建一个和压缩文件名相同的文件夹(LCTT 译注:文件夹没有 `.zip` 扩展名),并且把压缩文件中的所有内容存储到创建的文件夹下。相对于 `unzip` 命令的默认行为是将压缩文件提取到当前所在的文件下,图形界面的解压对于我来说是一件非常好的事情。 + +这里还有一个选项“提取到……”,你可以选择特定的文件夹来存储提取的文件。 + +你现在知道如何在 Linux 解压文件了。你也许还对学习[在 Linux 下使用 7zip][9] 感兴趣? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unzip-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[octopus](https://github.com/singledo) +校对:[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://en.wikipedia.org/wiki/Zip_(file_format) +[2]: https://itsfoss.com/linux-zip-folder/ +[3]: https://ubuntu.com/ +[4]: https://www.debian.org/ +[5]: tmp.eqEocGssC8#terminal +[6]: tmp.eqEocGssC8#gui +[7]: https://gnome.org/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/unzip-files-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/use-7zip-ubuntu-linux/ + + diff --git a/published/20191011 How to use IoT devices to keep children safe.md b/published/20191011 How to use IoT devices to keep children safe.md new file mode 100644 index 0000000000..bf05a950f1 --- /dev/null +++ b/published/20191011 How to use IoT devices to keep children safe.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11506-1.html) +[#]: subject: (How to use IoT devices to keep children safe?) +[#]: via: (https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/) +[#]: author: (Andrew Carroll https://opensourceforu.com/author/andrew-carroll/) + +如何使用物联网设备来确保儿童安全? +====== + +![][1] + +IoT (物联网)设备正在迅速改变我们的生活。这些设备无处不在,从我们的家庭到其它行业。根据一些预测数据,到 2020 年,将会有 100 亿个 IoT 设备。到 2025 年,该数量将增长到 220 亿。目前,物联网已经在很多领域得到了应用,包括智能家居、工业生产过程、农业甚至医疗保健领域。伴随着如此广泛的应用,物联网显然已经成为近年来的热门话题之一。 + +多种因素促成了物联网设备在多个学科的爆炸式增长。这其中包括低成本处理器和无线连接的的可用性,以及开源平台的信息交流推动了物联网领域的创新。与传统的应用程序开发相比,物联网设备的开发成指数级增长,因为它的资源是开源的。 + +在解释如何使用物联网设备来保护儿童之前,必须对物联网技术有基本的了解。 + +### IoT 设备是什么? + +IoT 设备是指那些在没有人类参与的情况下彼此之间可以通信的设备。因此,许多专家并不将智能手机和计算机视为物联网设备。此外,物联网设备必须能够收集数据并且能将收集到的数据传送到其他设备或云端进行处理。 + +然而,在某些领域中,我们需要探索物联网的潜力。儿童往往是脆弱的,他们很容易成为犯罪分子和其他蓄意伤害者的目标。无论在物理世界还是数字世界中,儿童都很容易面临犯罪的威胁。因为父母不能始终亲自到场保护孩子;这就是为什么需要监视工具了。 + +除了适用于儿童的可穿戴设备外,还有许多父母监视应用程序,例如 Xnspy,可实时监控儿童并提供信息的实时更新。这些工具可确保儿童安全。可穿戴设备确保儿童身体上的安全性,而家长监控应用可确保儿童的上网安全。 + +由于越来越多的孩子花费时间在智能手机上,毫无意外地,他们也就成为诈骗分子的主要目标。此外,由于恋童癖、网络自夸和其他犯罪在网络上的盛行,儿童也有可能成为网络欺凌的目标。 + +这些解决方案够吗?我们需要找到物联网解决方案,以确保孩子们在网上和线下的安全。在当代,我们如何确保孩子的安全?我们需要提出创新的解决方案。 物联网可以帮助保护孩子在学校和家里的安全。 + +### 物联网的潜力 + +物联网设备提供的好处很多。举例来说,父母可以远程监控自己的孩子,而又不会显得太霸道。因此,儿童在拥有安全环境的同时也会有空间和自由让自己变得独立。 + +而且,父母也不必在为孩子的安全而担忧。物联网设备可以提供 7x24 小时的信息更新。像 Xnspy 之类的监视应用程序在提供有关孩子的智能手机活动信息方面更进了一步。随着物联网设备变得越来越复杂,拥有更长使用寿命的电池只是一个时间问题。诸如位置跟踪器之类的物联网设备可以提供有关孩子下落的准确详细信息,所以父母不必担心。 + +虽然可穿戴设备已经非常好了,但在确保儿童安全方面,这些通常还远远不够。因此,要为儿童提供安全的环境,我们还需要其他方法。许多事件表明,儿童在学校比其他任何公共场所都容易受到攻击。因此,学校需要采取安全措施,以确保儿童和教师的安全。在这一点上,物联网设备可用于检测潜在威胁并采取必要的措施来防止攻击。威胁检测系统包括摄像头。系统一旦检测到威胁,便可以通知当局,如一些执法机构和医院。智能锁等设备可用于封锁学校(包括教室),来保护儿童。除此之外,还可以告知父母其孩子的安全,并立即收到有关威胁的警报。这将需要实施无线技术,例如 Wi-Fi 和传感器。因此,学校需要制定专门用于提供教室安全性的预算。 + +智能家居实现拍手关灯,也可以让你的家庭助手帮你关灯。同样,物联网设备也可用在屋内来保护儿童。在家里,物联网设备(例如摄像头)为父母在照顾孩子时提供 100% 的可见性。当父母不在家里时,可以使用摄像头和其他传感器检测是否发生了可疑活动。其他设备(例如连接到这些传感器的智能锁)可以锁门和窗,以确保孩子们的安全。 + +同样,可以引入许多物联网解决方案来确保孩子的安全。 + +### 有多好就有多坏 + +物联网设备中的传感器会创建大量数据。数据的安全性是至关重要的一个因素。收集的有关孩子的数据如果落入不法分子手中会存在危险。因此,需要采取预防措施。IoT 设备中泄露的任何数据都可用于确定行为模式。因此,必须对提供不违反用户隐私的安全物联网解决方案投入资金。 + +IoT 设备通常连接到 Wi-Fi,用于设备之间传输数据。未加密数据的不安全网络会带来某些风险。这样的网络很容易被窃听。黑客可以使用此类网点来入侵系统。他们还可以将恶意软件引入系统,从而使系统变得脆弱、易受攻击。此外,对设备和公共网络(例如学校的网络)的网络攻击可能导致数据泄露和私有数据盗用。 因此,在实施用于保护儿童的物联网解决方案时,保护网络和物联网设备的总体计划必须生效。 + +物联网设备保护儿童在学校和家里的安全的潜力尚未发现有什么创新。我们需要付出更多努力来保护连接 IoT 设备的网络安全。此外,物联网设备生成的数据可能落入不法分子手中,从而造成更多麻烦。因此,这是物联网安全至关重要的一个领域。 + + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/ + +作者:[Andrew Carroll][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/andrew-carroll/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?resize=696%2C507&ssl=1 (Visual Internet of things_EB May18) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?fit=900%2C656&ssl=1 diff --git a/published/20191014 Use sshuttle to build a poor man-s VPN.md b/published/20191014 Use sshuttle to build a poor man-s VPN.md new file mode 100644 index 0000000000..a5395a5405 --- /dev/null +++ b/published/20191014 Use sshuttle to build a poor man-s VPN.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11476-1.html) +[#]: subject: (Use sshuttle to build a poor man’s VPN) +[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +使用 shuttle 构建一个穷人的虚拟专网 +====== + +![][1] + +如今,企业网络经常使用“虚拟专用网络”[来保证员工通信安全][2]。但是,使用的协议有时会降低性能。如果你可以使用 SSH 连接远程主机,那么你可以设置端口转发。但这可能会很痛苦,尤其是在你需要与该网络上的许多主机一起使用的情况下。试试 `sshuttle`,它可以通过 SSH 访问来设置快速简易的虚拟专网。请继续阅读以获取有关如何使用它的更多信息。 + +`sshuttle` 正是针对上述情况而设计的。远程端的唯一要求是主机必须有可用的 Python。这是因为 `sshuttle` 会构造并运行一些 Python 代码来帮助传输数据。 + +### 安装 sshuttle + +`sshuttle` 被打包在官方仓库中,因此很容易安装。打开一个终端,并[使用 sudo][3] 来运行以下命令: + +``` +$ sudo dnf install sshuttle +``` + +安装后,你可以在手机页中找到相关信息: + +``` +$ man sshuttle +``` + +### 设置虚拟专网 + +最简单的情况就是将所有流量转发到远程网络。这不一定是一个疯狂的想法,尤其是如果你不在自己家里这样的受信任的本地网络中。将 `-r` 选项与 SSH 用户名和远程主机名一起使用: + +``` +$ sshuttle -r username@remotehost 0.0.0.0/0 +``` + +但是,你可能希望将该虚拟专网限制为特定子网,而不是所有网络流量。(有关子网的完整讨论超出了本文的范围,但是你可以在[维基百科][4]上阅读更多内容。)假设你的办公室内部使用了预留的 A 类子网 10.0.0.0 和预留的 B 类子网 172.16.0.0。上面的命令变为: + +``` +$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16 +``` + +这非常适合通过 IP 地址访问远程网络的主机。但是,如果你的办公室是一个拥有大量主机的大型网络,该怎么办?名称可能更方便,甚至是必须的。不用担心,`sshuttle` 还可以使用 `–dns` 选项转发 DNS 查询: + +``` +$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16 +``` + +要使 `sshuttle` 以守护进程方式运行,请加上 `-D` 选项。它会以 syslog 兼容的日志格式发送到 systemd 日志中。 + +根据本地和远程系统的功能,可以将 `sshuttle` 用于基于 IPv6 的虚拟专网。如果需要,你还可以设置配置文件并将其与系统启动集成。如果你想阅读更多有关 `sshuttle` 及其工作方式的信息,请[查看官方文档][5]。要查看代码,请[进入 GitHub 页面][6]。 + +*题图由 [Kurt Cotoaga][7] 拍摄并发表在 [Unsplash][8] 上。* + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Virtual_private_network +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://en.wikipedia.org/wiki/Subnetwork +[5]: https://sshuttle.readthedocs.io/en/stable/index.html +[6]: https://github.com/sshuttle/sshuttle +[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md b/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md new file mode 100644 index 0000000000..447b694c3a --- /dev/null +++ b/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (algzjh) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11474-1.html) +[#]: subject: (4 Free and Open Source Alternatives to Adobe Photoshop) +[#]: via: (https://itsfoss.com/open-source-photoshop-alternatives/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Adobe Photoshop 的 4 种自由开源替代品 +====== + +> 想寻找免费的 Photoshop 替代品?这里有一些最好的自由开源软件,你可以用它们来代替 Adobe Photoshop。 + +Adobe Photoshop 是一个可用于 Windows 和 macOS 的高级图像编辑和设计工具。毫无疑问,几乎每个人都知道它。其十分受欢迎。在 Linux 上,你可以在虚拟机中使用 Windows 或[通过 Wine][1] 来使用 Photoshop,但这并不是一种理想的体验。 + +一般来说,我们没有太多可以替代 Adobe Photoshop 的选项。然而,在本文中,我们将提到一些在 Linux 上可用的最佳的开源 Photoshop 替代品(也支持跨平台)。 + +请注意 Photoshop 不仅仅是一个图片编辑器。摄影师、数码艺术家、专业编辑使用它用于各种用途。此处的替代软件可能不具备 Photoshop 的所有功能,但你可以将它们用于在 Photoshop 中完成的各种任务。 + +### 适用于 Linux、Windows 和 macOS 的 Adobe Photoshop 的开源替代品 + +![][2] + +最初,我想只关注 Linux 中的 Photoshop 替代品,但为什么要把这个列表局限于 Linux 呢?其他操作系统用户也可使用开源软件。 + +**如果你正在使用 Linux,则所有提到的软件都应该可以在你的发行版的存储库中找到。你可以使用软件中心或包管理器进行安装。** + +对于其他平台,请查看官方项目网站以获取安装文件。 + +*该列表没有特定的排名顺序* + +#### 1、GIMP:真正的 Photoshop 替代品 + +![][3] + +主要特点: + + * 可定制的界面 + * 数字级修饰 + * 照片增强(使用变换工具) + * 支持广泛的硬件(压敏平板、音乐数字接口等) + * 几乎支持所有主要的图像文件 + * 支持图层管理 + +可用平台:Linux、Windows 和 macOS + +[GIMP][4] 是我处理任何事情的必备工具,无论任务多么基础/高级。也许,这是你在 Linux 下最接近 Photoshop 的替代品。除此之外,它还是一个开源和免费的解决方案,适合希望在 Linux 上创作伟大作品的艺术家。 + +它具有任何类型的图像处理所必需的所有功能。当然,还有图层管理支持。根据你的经验水平,利用率会有所不同。因此,如果你想充分利用它,则应阅读 [文档][5] 并遵循 [官方教程][6]。 + +#### 2、Krita + +![][7] + +主要特点: + + * 支持图层管理 + * 转换工具 + * 丰富的笔刷/绘图工具 + +可用平台:Linux、Windows 和 macOS + +[Krita][8] 是一个令人印象深刻的开源的数字绘画工具。图层管理支持和转换工具的存在使它成为 Photoshop 的基本编辑任务的替代品之一。 + +如果你喜欢素描/绘图,这将对你很有帮助。 + +#### 3、Darktable + +![][9] + +主要特点: + + * RAW 图像显影 + * 支持多种图像格式 + * 多个带有混合运算符的图像操作模块 + +可用平台:Linux、Windows 和 macOS + +[Darktable][10] 是一个由摄影师制作的开源摄影工作流应用程序。它可以让你在数据库中管理你的数码底片。从你的收藏中,显影 RAW 格式的图像并使用可用的工具对其进行增强。 + +从基本的图像编辑工具到支持混合运算符的多个图像模块,你将在探索中发现许多。 + +#### 4、Inkscape + +![][11] + +主要特点: + + * 创建对象的工具(最适合绘图/素描) + * 支持图层管理 + * 用于图像处理的转换工具 + * 颜色选择器(RGB、HSL、CMYK、色轮、CMS) + * 支持所有主要文件格式 + +可用平台:Linux、Windows 和 macOS + +[Inkscape][12] 是一个非常流行的开源矢量图形编辑器,许多专业人士都使用它。它提供了灵活的设计工具,可帮助你创作漂亮的艺术作品。从技术上说,它是 Adobe Illustrator 的直接替代品,但它也提供了一些技巧,可以帮助你将其作为 Photoshop 的替代品。 + +与 GIMP 的官方资源类似,你可以利用 [Inkscape 的教程][13] 来最大程度地利用它。 + +### 在你看来,真正的 Photoshop 替代品是什么? + +很难提供与 Adobe Photoshop 完全相同的功能。然而,如果你遵循官方文档和资源,则可以使用上述 Photoshop 替代品做很多很棒的事情。 + +Adobe 提供了一系列的图形工具,并且我们有 [整个 Adobe 创意套件的开源替代方案][14]。 你也可以去看看。 + +你觉得我们在此提到的 Photoshop 替代品怎么样?你是否知道任何值得提及的更好的替代方案?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-photoshop-alternatives/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[algzjh](https://github.com/algzjh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-latest-wine/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/open_source_photoshop_alternatives.png?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/gimp-screenshot.jpg?ssl=1 +[4]: https://www.gimp.org/ +[5]: https://www.gimp.org/docs/ +[6]: https://www.gimp.org/tutorials/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1 +[8]: https://krita.org/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/darktable.jpg?ssl=1 +[10]: https://www.darktable.org/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/12/inkscape-screenshot.jpg?ssl=1 +[12]: https://inkscape.org/ +[13]: https://inkscape.org/learn/ +[14]: https://itsfoss.com/adobe-alternatives-linux/ diff --git a/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md new file mode 100644 index 0000000000..c80f5540b9 --- /dev/null +++ b/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md @@ -0,0 +1,205 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11490-1.html) +[#]: subject: (Bash Script to Delete Files/Folders Older Than “X” Days in Linux) +[#]: via: (https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 中使用 Bash 脚本删除早于 “X” 天的文件/文件夹 +====== + +[磁盘使用率][1] 监控工具能够在达到给定阈值时提醒我们。但它们无法自行解决 [磁盘使用率][2] 问题。需要手动干预才能解决该问题。 + +如果你想完全自动化此类操作,你会做什么。是的,可以使用 bash 脚本来完成。 + +该脚本可防止来自 [监控工具][3] 的警报,因为我们会在填满磁盘空间之前删除旧的日志文件。 + +我们过去做了很多 shell 脚本。如果要查看,请进入下面的链接。 + +* [如何使用 shell 脚本自动化日常活动?][4] + +我在本文中添加了两个 bash 脚本,它们有助于清除旧日志。 + +### 1)在 Linux 中删除早于 “X” 天的文件夹的 Bash 脚本 + +我们有一个名为 `/var/log/app/` 的文件夹,其中包含 15 天的日志,我们将删除早于 10 天的文件夹。 + +``` +$ ls -lh /var/log/app/ + +drwxrw-rw- 3 root root 24K Oct 1 23:52 app_log.01 +drwxrw-rw- 3 root root 24K Oct 2 23:52 app_log.02 +drwxrw-rw- 3 root root 24K Oct 3 23:52 app_log.03 +drwxrw-rw- 3 root root 24K Oct 4 23:52 app_log.04 +drwxrw-rw- 3 root root 24K Oct 5 23:52 app_log.05 +drwxrw-rw- 3 root root 24K Oct 6 23:54 app_log.06 +drwxrw-rw- 3 root root 24K Oct 7 23:53 app_log.07 +drwxrw-rw- 3 root root 24K Oct 8 23:51 app_log.08 +drwxrw-rw- 3 root root 24K Oct 9 23:52 app_log.09 +drwxrw-rw- 3 root root 24K Oct 10 23:52 app_log.10 +drwxrw-rw- 3 root root 24K Oct 11 23:52 app_log.11 +drwxrw-rw- 3 root root 24K Oct 12 23:52 app_log.12 +drwxrw-rw- 3 root root 24K Oct 13 23:52 app_log.13 +drwxrw-rw- 3 root root 24K Oct 14 23:52 app_log.14 +drwxrw-rw- 3 root root 24K Oct 15 23:52 app_log.15 +``` + +该脚本将删除早于 10 天的文件夹,并通过邮件发送文件夹列表。 + +你可以根据需要修改 `-mtime X` 的值。另外,请替换你的电子邮箱,而不是用我们的。 + +``` +# /opt/script/delete-old-folders.sh + +#!/bin/bash +prev_count=0 +fpath=/var/log/app/app_log.* +find $fpath -type d -mtime +10 -exec ls -ltrh {} \; > /tmp/folder.out +find $fpath -type d -mtime +10 -exec rm -rf {} \; +count=$(cat /tmp/folder.out | wc -l) +if [ "$prev_count" -lt "$count" ] ; then +MESSAGE="/tmp/file1.out" +TO="[email protected]" +echo "Application log folders are deleted older than 15 days" >> $MESSAGE +echo "+----------------------------------------------------+" >> $MESSAGE +echo "" >> $MESSAGE +cat /tmp/folder.out | awk '{print $6,$7,$9}' >> $MESSAGE +echo "" >> $MESSAGE +SUBJECT="WARNING: Apache log files are deleted older than 15 days $(date)" +mail -s "$SUBJECT" "$TO" < $MESSAGE +rm $MESSAGE /tmp/folder.out +fi +``` + +给 `delete-old-folders.sh` 设置可执行权限。 + +``` +# chmod +x /opt/script/delete-old-folders.sh +``` + +最后添加一个 [cronjob][5] 自动化此任务。它于每天早上 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/script/delete-old-folders.sh +``` + +你将看到类似下面的输出。 + +``` +Application log folders are deleted older than 20 days ++--------------------------------------------------------+ +Oct 11 /var/log/app/app_log.11 +Oct 12 /var/log/app/app_log.12 +Oct 13 /var/log/app/app_log.13 +Oct 14 /var/log/app/app_log.14 +Oct 15 /var/log/app/app_log.15 +``` + +### 2)在 Linux 中删除早于 “X” 天的文件的 Bash 脚本 + +我们有一个名为 `/var/log/apache/` 的文件夹,其中包含15天的日志,我们将删除 10 天前的文件。 + +以下文章与该主题相关,因此你可能有兴趣阅读。 + + * [如何在 Linux 中查找和删除早于 “X” 天和 “X” 小时的文件?][6] + * [如何在 Linux 中查找最近修改的文件/文件夹][7] + * [如何在 Linux 中自动删除或清理 /tmp 文件夹内容?][8] + +``` +# ls -lh /var/log/apache/ + +-rw-rw-rw- 3 root root 24K Oct 1 23:52 2daygeek_access.01 +-rw-rw-rw- 3 root root 24K Oct 2 23:52 2daygeek_access.02 +-rw-rw-rw- 3 root root 24K Oct 3 23:52 2daygeek_access.03 +-rw-rw-rw- 3 root root 24K Oct 4 23:52 2daygeek_access.04 +-rw-rw-rw- 3 root root 24K Oct 5 23:52 2daygeek_access.05 +-rw-rw-rw- 3 root root 24K Oct 6 23:54 2daygeek_access.06 +-rw-rw-rw- 3 root root 24K Oct 7 23:53 2daygeek_access.07 +-rw-rw-rw- 3 root root 24K Oct 8 23:51 2daygeek_access.08 +-rw-rw-rw- 3 root root 24K Oct 9 23:52 2daygeek_access.09 +-rw-rw-rw- 3 root root 24K Oct 10 23:52 2daygeek_access.10 +-rw-rw-rw- 3 root root 24K Oct 11 23:52 2daygeek_access.11 +-rw-rw-rw- 3 root root 24K Oct 12 23:52 2daygeek_access.12 +-rw-rw-rw- 3 root root 24K Oct 13 23:52 2daygeek_access.13 +-rw-rw-rw- 3 root root 24K Oct 14 23:52 2daygeek_access.14 +-rw-rw-rw- 3 root root 24K Oct 15 23:52 2daygeek_access.15 +``` + +该脚本将删除 10 天前的文件并通过邮件发送文件夹列表。 + +你可以根据需要修改 `-mtime X` 的值。另外,请替换你的电子邮箱,而不是用我们的。 + +``` +# /opt/script/delete-old-files.sh + +#!/bin/bash +prev_count=0 +fpath=/var/log/apache/2daygeek_access.* +find $fpath -type f -mtime +15 -exec ls -ltrd {} \; > /tmp/file.out +find $fpath -type f -mtime +15 -exec rm -rf {} \; +count=$(cat /tmp/file.out | wc -l) +if [ "$prev_count" -lt "$count" ] ; then +MESSAGE="/tmp/file1.out" +TO="[email protected]" +echo "Apache Access log files are deleted older than 20 days" >> $MESSAGE +echo "+--------------------------------------------- +" >> $MESSAGE +echo "" >> $MESSAGE +cat /tmp/file.out | awk '{print $6,$7,$9}' >> $MESSAGE +echo "" >> $MESSAGE +SUBJECT="WARNING: Apache log folders are deleted older than 15 days $(date)" +mail -s "$SUBJECT" "$TO" < $MESSAGE +rm $MESSAGE /tmp/file.out +fi +``` + +给 `delete-old-files.sh` 设置可执行权限。 + +``` +# chmod +x /opt/script/delete-old-files.sh +``` + +最后添加一个 [cronjob][5] 自动化此任务。它于每天早上 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/script/delete-old-folders.sh +``` + +你将看到类似下面的输出。 + +``` +Apache Access log files are deleted older than 20 days ++--------------------------------------------------------+ +Oct 11 /var/log/apache/2daygeek_access.11 +Oct 12 /var/log/apache/2daygeek_access.12 +Oct 13 /var/log/apache/2daygeek_access.13 +Oct 14 /var/log/apache/2daygeek_access.14 +Oct 15 /var/log/apache/2daygeek_access.15 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-check-disk-usage-files-and-directories-folders-size-du-command/ +[2]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ +[3]: https://www.2daygeek.com/category/monitoring-tools/ +[4]: https://www.2daygeek.com/category/shell-script/ +[5]: https://www.2daygeek.com/crontab-cronjob-to-schedule-jobs-in-linux/ +[6]: https://www.2daygeek.com/how-to-find-and-delete-files-older-than-x-days-and-x-hours-in-linux/ +[7]: https://www.2daygeek.com/check-find-recently-modified-files-folders-linux/ +[8]: https://www.2daygeek.com/automatically-delete-clean-up-tmp-directory-folder-contents-in-linux/ diff --git a/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md new file mode 100644 index 0000000000..327458485a --- /dev/null +++ b/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11495-1.html) +[#]: subject: (Linux sudo flaw can lead to unauthorized privileges) +[#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux sudo 漏洞可能导致未经授权的特权访问 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/23/173934huyi6siys2u33w9z.png) + +> 在 Linux 中利用新发现的 sudo 漏洞可以使某些用户以 root 身份运行命令,尽管对此还有所限制。 + +[sudo][1] 命令中最近发现了一个严重漏洞,如果被利用,普通用户可以 root 身份运行命令,即使在 `/etc/sudoers` 文件中明确禁止了该用户这样做。 + +将 `sudo` 更新到版本 1.8.28 应该可以解决该问题,因此建议 Linux 管理员尽快这样做。 + +如何利用此漏洞取决于 `/etc/sudoers` 中授予的特定权限。例如,一条规则允许用户以除了 root 用户之外的任何用户身份来编辑文件,这实际上将允许该用户也以 root 用户身份来编辑文件。在这种情况下,该漏洞可能会导致非常严重的问题。 + +用户要能够利用此漏洞,需要在 `/etc/sudoers` 中为**用户**分配特权,以使该用户可以以其他用户身份运行命令,并且该漏洞仅限于以这种方式分配的命令特权。 + +此问题影响 1.8.28 之前的版本。要检查你的 `sudo` 版本,请使用以下命令: + +``` +$ sudo -V +Sudo version 1.8.27 <=== +Sudoers policy plugin version 1.8.27 +Sudoers file grammar version 46 +Sudoers I/O plugin version 1.8.27 +``` + +该漏洞已在 CVE 数据库中分配了编号 [CVE-2019-14287][4]。它的风险是,任何被指定能以任意用户运行某个命令的用户,即使被明确禁止以 root 身份运行,它都能逃脱限制。 + +下面这些行让 `jdoe` 能够以除了 root 用户之外的其他身份使用 `vi` 编辑文件(`!root` 表示“非 root”),同时 `nemo` 有权运行以除了 root 身份以外的任何用户使用 `id` 命令: + +``` +# affected entries on host "dragonfly" +jdoe dragonfly = (ALL, !root) /usr/bin/vi +nemo dragonfly = (ALL, !root) /usr/bin/id +``` + +但是,由于存在漏洞,这些用户中要么能够绕过限制并以 root 编辑文件,或者以 root 用户身份运行 `id` 命令。 + +攻击者可以通过指定用户 ID 为 `-1` 或 `4294967295` 来以 root 身份运行命令。 + +``` +sudo -u#-1 id -u +``` + +或者 + +``` +sudo -u#4294967295 id -u +``` + +响应为 `1` 表明该命令以 root 身份运行(显示 root 的用户 ID)。 + +苹果信息安全团队的 Joe Vennix 找到并分析该问题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3236499/some-tricks-for-using-sudo.html +[4]: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-14287 +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..ba0505daf9 --- /dev/null +++ b/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11505-1.html) +[#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +如何在 CentOS8/RHEL8 中配置 Rsyslog 服务器 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/27/062908v4nnzgf7bhnplgvg.jpg) + +Rsyslog 是一个自由开源的日志记录程序,在 CentOS 8 和 RHEL 8 系统上默认可用。它提供了一种从客户端节点到单个中央服务器的“集中日志”的简单有效的方法。日志集中化有两个好处。首先,它简化了日志查看,因为系统管理员可以在一个中心节点查看远程服务器的所有日志,而无需登录每个客户端系统来检查日志。如果需要监视多台服务器,这将非常有用,其次,如果远程客户端崩溃,你不用担心丢失日志,因为所有日志都将保存在中心的 Rsyslog 服务器上。rsyslog 取代了仅支持 UDP 协议的 syslog。它以优异的功能扩展了基本的 syslog 协议,例如在传输日志时支持 UDP 和 TCP 协议,增强的过滤功能以及灵活的配置选项。让我们来探讨如何在 CentOS 8 / RHEL 8 系统中配置 Rsyslog 服务器。 + +![configure-rsyslog-centos8-rhel8][2] + +### 预先条件 + +我们将搭建以下实验环境来测试集中式日志记录过程: + + * Rsyslog 服务器       CentOS 8 Minimal    IP 地址: 10.128.0.47 + * 客户端系统          RHEL 8 Minimal      IP 地址: 10.128.0.48 + +通过上面的设置,我们将演示如何设置 Rsyslog 服务器,然后配置客户端系统以将日志发送到 Rsyslog 服务器进行监视。 + +让我们开始! + +### 在 CentOS 8 上配置 Rsyslog 服务器 + +默认情况下,Rsyslog 已安装在 CentOS 8 / RHEL 8 服务器上。要验证 Rsyslog 的状态,请通过 SSH 登录并运行以下命令: + +``` +$ systemctl status rsyslog +``` + +示例输出: + +![rsyslog-service-status-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-service-status-centos8.jpg) + +如果由于某种原因 Rsyslog 不存在,那么可以使用以下命令进行安装: + +``` +$ sudo yum install rsyslog +``` + +接下来,你需要修改 Rsyslog 配置文件中的一些设置。打开配置文件: + +``` +$ sudo vim /etc/rsyslog.conf +``` + +滚动并取消注释下面的行,以允许通过 UDP 协议接收日志: + +``` +module(load="imudp") # needs to be done just once +input(type="imudp" port="514") +``` + +![rsyslog-conf-centos8-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-conf-centos8-rhel8.jpg) + +同样,如果你希望启用 TCP rsyslog 接收,请取消注释下面的行: + +``` +module(load="imtcp") # needs to be done just once +input(type="imtcp" port="514") +``` + +![rsyslog-conf-tcp-centos8-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-conf-tcp-centos8-rhel8.jpg) + +保存并退出配置文件。 + +要从客户端系统接收日志,我们需要在防火墙上打开 Rsyslog 默认端口 514。为此,请运行: + +``` +# sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +接下来,重新加载防火墙保存更改: + +``` +# sudo firewall-cmd --reload +``` + +示例输出: + +![firewall-ports-rsyslog-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/firewall-ports-rsyslog-centos8.jpg) + +接下来,重启 Rsyslog 服务器: + +``` +$ sudo systemctl restart rsyslog +``` + +要在启动时运行 Rsyslog,运行以下命令: + +``` +$ sudo systemctl enable rsyslog +``` + +要确认 Rsyslog 服务器正在监听 514 端口,请使用 `netstat` 命令,如下所示: + +``` +$ sudo netstat -pnltu +``` + +示例输出: + +![netstat-rsyslog-port-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/netstat-rsyslog-port-centos8.jpg) + +完美!我们已经成功配置了 Rsyslog 服务器来从客户端系统接收日志。 + +要实时查看日志消息,请运行以下命令: + +``` +$ tail -f /var/log/messages +``` + +现在开始配置客户端系统。 + +### 在 RHEL 8 上配置客户端系统 + +与 Rsyslog 服务器一样,登录并通过以下命令检查 rsyslog 守护进程是否正在运行: + +``` +$ sudo systemctl status rsyslog +``` + +示例输出: + +![client-rsyslog-service-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/client-rsyslog-service-rhel8.jpg) + +接下来,打开 rsyslog 配置文件: + +``` +$ sudo vim /etc/rsyslog.conf +``` + +在文件末尾,添加以下行: + +``` +*.* @10.128.0.47:514 # Use @ for UDP protocol +*.* @@10.128.0.47:514 # Use @@ for TCP protocol +``` + +保存并退出配置文件。就像 Rsyslog 服务器一样,打开 514 端口,这是防火墙上的默认 Rsyslog 端口: + +``` +$ sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +接下来,重新加载防火墙以保存更改: + +``` +$ sudo firewall-cmd --reload +``` + +接下来,重启 rsyslog 服务: + +``` +$ sudo systemctl restart rsyslog +``` + +要在启动时运行 Rsyslog,请运行以下命令: + +``` +$ sudo systemctl enable rsyslog +``` + +### 测试日志记录操作 + +已经成功安装并配置 Rsyslog 服务器和客户端后,就该验证你的配置是否按预期运行了。 + +在客户端系统上,运行以下命令: + +``` +# logger "Hello guys! This is our first log" +``` + +现在进入 Rsyslog 服务器并运行以下命令来实时查看日志消息: + +``` +# tail -f /var/log/messages +``` + +客户端系统上命令运行的输出显示在了 Rsyslog 服务器的日志中,这意味着 Rsyslog 服务器正在接收来自客户端系统的日志: + +![centralize-logs-rsyslogs-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/centralize-logs-rsyslogs-centos8.jpg) + +就是这些了!我们成功设置了 Rsyslog 服务器来接收来自客户端系统的日志信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/ + +作者:[James Kiarie][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg diff --git a/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md new file mode 100644 index 0000000000..994c583274 --- /dev/null +++ b/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11497-1.html) +[#]: subject: (Kubernetes networking, OpenStack Train, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:Kubernetes 网络、OpenStack Train 以及更多的行业趋势 +====== + +> 开源社区和行业趋势的每周总览。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为我在具有开源开发模型的企业软件公司担任高级产品营销经理的角色的一部分,我为产品营销人员、经理和其他影响者定期发布有关开源社区,市场和行业趋势的定期更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### OpenStack Train 中最令人兴奋的功能 + +- [文章地址][2] + +> 考虑到 Train 版本必须提供的所有技术优势([你可以在此处查看版本亮点][3]),你可能会对 Red Hat 认为这些将使我们的电信和企业客户受益的顶级功能及其用例感到好奇。以下我们对该版本最兴奋的功能的概述。 + +**影响**:OpenStack 对我来说就像 Shia LaBeouf:它在几年前达到了炒作的顶峰,然后继续产出了好的作品。Train 版本看起来是又一次令人难以置信的创新下降。 + +### 以 Ansible 原生的方式构建 Kubernetes 操作器 + +- [文章地址][4] + +> 操作器简化了 Kubernetes 上复杂应用程序的管理。它们通常是用 Go 语言编写的,并且需要懂得 Kubernetes 内部的专业知识。但是,还有另一种进入门槛较低的选择。Ansible 是操作器 SDK 中的一等公民。使用 Ansible 可以释放应用程序工程师的精力,最大限度地利用时间来自动化和协调你的应用程序,并使用一种简单的语言在新的和现有的平台上进行操作。在这里我们可以看到如何做。 + +**影响**:这就像你发现可以用搅拌器和冷冻香蕉制作出不错的冰淇淋一样:Ansible(通常被认为很容易掌握)可以使你比你想象的更容易地做一些令人印象深刻的操作器魔术。 + +### Kubernetes 网络:幕后花絮 + +- [文章地址][5] + +> 尽管围绕该主题有很多很好的资源(链接在[这里][6]),但我找不到一个示例,可以将所有的点与网络工程师喜欢和讨厌的命令输出连接起来,以显示背后实际发生的情况。因此,我决定从许多不同的来源收集这些信息,以期帮助你更好地了解事物之间的联系。 + +**影响**:这是一篇对复杂主题(带有图片)阐述的很好的作品。保证可以使 Kubenetes 网络的混乱程度降低 10%。 + +### 保护容器供应链 + +- [文章地址][7] + +> 随着容器、软件即服务和函数即服务的出现,人们开始着眼于在使用现有服务、函数和容器映像的过程中寻求新的价值。[Red Hat][8] 的容器首席产品经理 Scott McCarty 表示,关注这个重点既有优点也有缺点。“它使我们能够集中精力编写满足我们需求的新应用程序代码,同时将对基础架构的关注转移给其他人身上,”McCarty 说,“容器处于一个最佳位置,提供了足够的控制,而卸去了许多繁琐的基础架构工作。”但是,容器也会带来与安全性相关的劣势。 + +**影响**:我在一个由大约十位安全人员组成的小组中,可以肯定地说,整天要考虑软件安全性需要一定的倾向。当你长时间凝视深渊时,它也凝视着你。如果你不是如此倾向的软件开发人员,请听取 Scott 的建议并确保你的供应商考虑安全。 + +### 15 岁的 Fedora:为何 Matthew Miller 看到 Linux 发行版的光明前景 + +- [文章链接][9] + +> 在 TechRepublic 的一个大范围采访中,Fedora 项目负责人 Matthew Miller 讨论了过去的经验教训、软件容器的普遍采用和竞争性标准、Fedora 的潜在变化以及包括 systemd 在内的热门话题。 + +**影响**:我喜欢 Fedora 项目的原因是它的清晰度;该项目知道它代表什么。像 Matt 这样的人就是为什么能看到光明前景的原因。 + +*我希望你喜欢这张上周让我印象深刻的列表,并在下周一回来了解更多的开放源码社区、市场和行业趋势。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends + +作者:[Tim Hildred][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://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.redhat.com/en/blog/look-most-exciting-features-openstack-train +[3]: https://releases.openstack.org/train/highlights.html +[4]: https://www.cncf.io/webinars/building-kubernetes-operators-in-an-ansible-native-way/ +[5]: https://itnext.io/kubernetes-networking-behind-the-scenes-39a1ab1792bb +[6]: https://github.com/nleiva/kubernetes-networking-links +[7]: https://www.devprojournal.com/technology-trends/open-source/securing-the-container-supply-chain/ +[8]: https://www.redhat.com/en +[9]: https://www.techrepublic.com/article/fedora-at-15-why-matthew-miller-sees-a-bright-future-for-the-linux-distribution/ diff --git a/published/20191021 Pylint- Making your Python code consistent.md b/published/20191021 Pylint- Making your Python code consistent.md new file mode 100644 index 0000000000..80991142a5 --- /dev/null +++ b/published/20191021 Pylint- Making your Python code consistent.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11502-1.html) +[#]: subject: (Pylint: Making your Python code consistent) +[#]: via: (https://opensource.com/article/19/10/python-pylint-introduction) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Pylint:让你的 Python 代码保持一致 +====== + +> 当你想要争论代码复杂性时,Pylint 是你的朋友。 + +![OpenStack source code \(Python\) in VIM][1] + +Pylint 是更高层级的 Python 样式强制程序。而 [flake8][2] 和 [black][3] 检查的是“本地”样式:换行位置、注释的格式、发现注释掉的代码或日志格式中的错误做法之类的问题。 + +默认情况下,Pylint 非常激进。它将对每样东西都提供严厉的意见,从检查是否实际实现声明的接口到重构重复代码的可能性,这对新用户来说可能会很多。一种温和地将其引入项目或团队的方法是先关闭*所有*检查器,然后逐个启用检查器。如果你已经在使用 flake8、black 和 [mypy][4],这尤其有用:Pylint 有相当多的检查器和它们在功能上重叠。 + +但是,Pylint 独有之处之一是能够强制执行更高级别的问题:例如,函数的行数或者类中方法的数量。 + +这些数字可能因项目而异,并且可能取决于开发团队的偏好。但是,一旦团队就参数达成一致,使用自动工具*强制化*这些参数非常有用。这是 Pylint 闪耀的地方。 + +### 配置 Pylint + +要以空配置开始,请将 `.pylintrc` 设置为 + +``` +[MESSAGES CONTROL] + +disable=all +``` + +这将禁用所有 Pylint 消息。由于其中许多是冗余的,这是有道理的。在 Pylint 中,`message` 是一种特定的警告。 + +你可以通过运行 `pylint` 来确认所有消息都已关闭: + +``` +$ pylint +``` + +通常,向 `pylint` 命令行添加参数并不是一个好主意:配置 `pylint` 的最佳位置是 `.pylintrc`。为了使它做*一些*有用的事,我们需要启用一些消息。 + +要启用消息,在 `.pylintrc` 中的 `[MESSAGES CONTROL]` 下添加 + +``` +enable=, + ... +``` + +对于看起来有用的“消息”(Pylint 称之为不同类型的警告)。我最喜欢的包括 `too-many-lines`、`too-many-arguments` 和 `too-many-branches`。所有这些会限制模块或函数的复杂性,并且无需进行人工操作即可客观地进行代码复杂度测量。 + +*检查器*是*消息*的来源:每条消息只属于一个检查器。许多最有用的消息都在[设计检查器][5]下。默认数字通常都不错,但要调整最大值也很简单:我们可以在 `.pylintrc` 中添加一个名为 `DESIGN` 的段。 + +``` +[DESIGN] +max-args=7 +max-locals=15 +``` + +另一个有用的消息来源是“重构”检查器。我已启用一些最喜欢的消息有 `consider-using-dict-comprehension`、`stop-iteration-return`(它会查找正确的停止迭代的方式是 `return` 而使用了 `raise StopIteration` 的迭代器)和 `chained-comparison`,它将建议使用如 `1 <= x < 5`,而不是不太明显的 `1 <= x && 5 > 5` 的语法。 + +最后是一个在性能方面消耗很大的检查器,但它非常有用,就是 `similarities`。它会查找不同部分代码之间的复制粘贴来强制执行“不要重复自己”(DRY 原则)。它只启用一条消息:`duplicate-code`。默认的 “最小相似行数” 设置为 4。可以使用 `.pylintrc` 将其设置为不同的值。 + +``` +[SIMILARITIES] +min-similarity-lines=3 +``` + +### Pylint 使代码评审变得简单 + +如果你厌倦了需要指出一个类太复杂,或者两个不同的函数基本相同的代码评审,请将 Pylint 添加到你的[持续集成][6]配置中,并且只需要对项目复杂性准则的争论一次就行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-pylint-introduction + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) +[2]: https://opensource.com/article/19/5/python-flake8 +[3]: https://opensource.com/article/19/5/python-black +[4]: https://opensource.com/article/19/5/python-mypy +[5]: https://pylint.readthedocs.io/en/latest/technical_reference/features.html#design-checker +[6]: https://opensource.com/business/15/7/six-continuous-integration-tools diff --git a/published/20191021 Transition to Nftables.md b/published/20191021 Transition to Nftables.md new file mode 100644 index 0000000000..71aac43603 --- /dev/null +++ b/published/20191021 Transition to Nftables.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11513-1.html) +[#]: subject: (Transition to Nftables) +[#]: via: (https://opensourceforu.com/2019/10/transition-to-nftables/) +[#]: author: (Vijay Marcel D https://opensourceforu.com/author/vijay-marcel/) + +过渡到 nftables +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/29/085827o8b7rbswjjr7ijsr.jpg) + +> 开源世界中的每个主要发行版都在演进,逐渐将 nftables 作为了默认防火墙。换言之,古老的 iptables 现在已经消亡。本文是有关如何构建 nftables 的教程。 + +当前,有一个与 nftables 兼容的 iptables-nft 后端,但是很快,即使是它也不再提供了。另外,正如 Red Hat 开发人员所指出的那样,有时它可能会错误地转换规则。我们需要知道如何构建自己的 nftables,而不是依赖于 iptables 到 nftables 的转换器。 + +在 nftables 中,所有地址族都遵循一个规则。与 iptables 不同,nftables 在用户空间中运行,iptables 中的每个模块都运行在内核(空间)中。它很少需要更新内核,并带有一些新功能,例如映射、地址族和字典。 + +### 地址族 + +地址族确定要处理的数据包的类型。在 nftables 中有六个地址族,它们是: + +* ip +* ipv6 +* inet +* arp +* bridge +* netdev + +在 nftables 中,ipv4 和 ipv6 协议可以被合并为一个称为 inet 的单一地址族。因此,我们不需要指定两个规则:一个用于 ipv4,另一个用于 ipv6。如果未指定地址族,它将默认为 ip 协议,即 ipv4。我们感兴趣的领域是 inet 地址族,因为大多数家庭用户将使用 ipv4 或 ipv6 协议。 + +### nftables + +典型的 nftables 规则包含三个部分:表、链和规则。 + +表是链和规则的容器。它们由其地址族和名称来标识。链包含 inet/arp/bridge/netdev 等协议所需的规则,并具有三种类型:过滤器、NAT 和路由。nftables 规则可以从脚本加载,也可以在终端键入,然后另存为规则集。 + +对于家庭用户,默认链为过滤器。inet 系列包含以下钩子: + +* Input +* Output +* Forward +* Pre-routing +* Post-routing + +### 使用脚本还是不用? + +最大的问题之一是我们是否可以使用防火墙脚本。答案是:这是你自己的选择。这里有一些建议:如果防火墙中有数百条规则,那么最好使用脚本,但是如果你是典型的家庭用户,则可以在终端中键入命令,然后(保存并在重启时)加载规则集。每种选择都有其自身的优缺点。在本文中,我们将在终端中键入它们以构建防火墙。 + +nftables 使用一个名为 `nft` 的程序来添加、创建、列出、删除和加载规则。确保使用以下命令将 nftables 与 conntrackd 和 netfilter-persistent 软件包一起安装,并删除 iptables: + +``` +apt-get install nftables conntrackd netfilter-persistent +apt-get purge iptables +``` + +`nft` 需要以 root 身份运行或使用 `sudo` 运行。使用以下命令分别列出、刷新、删除规则集和加载脚本。 + +``` +nft list ruleset +nft flush ruleset +nft delete table inet filter +/usr/sbin/nft -f /etc/nftables.conf +``` + +### 输入策略 + +就像 iptables 一样,防火墙将包含三部分:输入(`input`)、转发(`forward`)和输出(`output`)。在终端中,为输入(`input`)策略键入以下命令。在开始之前,请确保已刷新规则集。我们的默认策略将会删除所有内容。我们将在防火墙中使用 inet 地址族。将以下规则以 root 身份添加或使用 `sudo` 运行: + +``` +nft add table inet filter +nft add chain inet filter input { type filter hook input priority 0 \; counter \; policy drop \; } +``` + +你会注意到有一个名为 `priority 0` 的东西。这意味着赋予该规则更高的优先级。挂钩通常赋予负整数,这意味着更高的优先级。每个挂钩都有自己的优先级,过滤器链的优先级为 0。你可以检查 nftables Wiki 页面以查看每个挂钩的优先级。 + +要了解你计算机中的网络接口,请运行以下命令: + +``` +ip link show +``` + +它将显示已安装的网络接口,一个是本地主机、另一个是以太网端口或无线端口。以太网端口的名称如下所示:`enpXsY`,其中 `X` 和 `Y` 是数字,无线端口也是如此。我们必须允许本地主机的流量,并且仅允许从互联网建立的传入连接。 + +nftables 具有一项称为裁决语句的功能,用于解析规则。裁决语句为 `accept`、`drop`、`queue`、`jump`、`goto`、`continue` 和 `return`。由于这是一个很简单的防火墙,因此我们将使用 `accept` 或 `drop` 处理数据包。 + +``` +nft add rule inet filter input iifname lo accept +nft add rule inet filter input iifname enpXsY ct state new, established, related accept +``` + +接下来,我们必须添加规则以保护我们免受隐秘扫描。并非所有的隐秘扫描都是恶意的,但大多数都是。我们必须保护网络免受此类扫描。第一组规则列出了要测试的 TCP 标志。在这些标志中,第二组列出了要与第一组匹配的标志。 + +``` +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|fin\) == \(syn\|fin\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|rst\) == \(syn\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(fin\|rst\) == \(fin\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|fin\) == fin drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|psh\) == psh drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|urg\) == urg drop +``` + +记住,我们在终端中键入这些命令。因此,我们必须在一些特殊字符之前添加一个反斜杠,以确保终端能够正确解释该斜杠。如果你使用的是脚本,则不需要这样做。 + +### 关于 ICMP 的警告 + +互联网控制消息协议(ICMP)是一种诊断工具,因此不应完全丢弃该流量。完全阻止 ICMP 的任何尝试都是不明智的,因为它还会导致停止向我们提供错误消息。仅启用最重要的控制消息,例如回声请求、回声应答、目的地不可达和超时等消息,并拒绝其余消息。回声请求和回声应答是 `ping` 的一部分。在输入策略中,我们仅允许回声应答、而在输出策略中,我们仅允许回声请求。 + +``` +nft add rule inet filter input iifname enpXsY icmp type { echo-reply, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter input iifname enpXsY ip protocol icmp drop +``` + +最后,我们记录并丢弃所有无效数据包。 + +``` +nft add rule inet filter input iifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Input: \” +nft add rule inet filter input iifname enpXsY ct state invalid drop +``` + +### 转发和输出策略 + +在转发和输出策略中,默认情况下我们将丢弃数据包,仅接受已建立连接的数据包。 + +``` +nft add chain inet filter forward { type filter hook forward priority 0 \; counter \; policy drop \; } +nft add rule inet filter forward ct state established, related accept +nft add rule inet filter forward ct state invalid drop +nft add chain inet filter output { type filter hook output priority 0 \; counter \; policy drop \; } +``` + +典型的桌面用户只需要端口 80 和 443 即可访问互联网。最后,允许可接受的 ICMP 协议并在记录无效数据包时丢弃它们。 + +``` +nft add rule inet filter output oifname enpXsY tcp dport { 80, 443 } ct state established accept +nft add rule inet filter output oifname enpXsY icmp type { echo-request, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter output oifname enpXsY ip protocol icmp drop +nft add rule inet filter output oifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Output: \” +nft add rule inet filter output oifname enpXsY ct state invalid drop +``` + +现在我们必须保存我们的规则集,否则重新启动时它将丢失。为此,请运行以下命令: + +``` +sudo nft list ruleset. > /etc/nftables.conf +``` + +我们须在引导时加载 nftables,以下将在 systemd 中启用 nftables 服务: + +``` +sudo systemctl enable nftables +``` + +接下来,编辑 nftables 单元文件以删除 `Execstop` 选项,以避免在每次引导时刷新规则集。该文件通常位于 `/etc/systemd/system/sysinit.target.wants/nftables.service`。现在重新启动nftables: + +``` +sudo systemctl restart nftables +``` + +### 在 rsyslog 中记录日志 + +当你记录丢弃的数据包时,它们直接进入 syslog,这使得读取该日志文件非常困难。最好将防火墙日志重定向到单独的文件。在 `/var/log` 目录中创建一个名为 `nftables` 的目录,并在其中创建两个名为 `input.log` 和 `output.log` 的文件,分别存储输入和输出日志。确保系统中已安装 rsyslog。现在转到 `/etc/rsyslog.d` 并创建一个名为 `nftables.conf` 的文件,其内容如下: + +``` +:msg,regex,”Invalid-Input: “ -/var/log/nftables/Input.log +:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log & stop +``` + +现在,我们必须确保日志是可管理的。为此,使用以下代码在 `/etc/logrotate.d` 中创建另一个名为 `nftables` 的文件: + +``` +/var/log/nftables/* { rotate 5 daily maxsize 50M missingok notifempty delaycompress compress postrotate invoke-rc.d rsyslog rotate > /dev/null endscript } +``` + +重新启动 nftables。现在,你可以检查你的规则集。如果你觉得在终端中键入每个命令很麻烦,则可以使用脚本来加载 nftables 防火墙。我希望本文对保护你的系统有用。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/transition-to-nftables/ + +作者:[Vijay Marcel D][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://opensourceforu.com/author/vijay-marcel/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?resize=696%2C481&ssl=1 (REHfirewall) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?fit=900%2C622&ssl=1 diff --git a/published/20191022 How to Get the Size of a Directory in Linux.md b/published/20191022 How to Get the Size of a Directory in Linux.md new file mode 100644 index 0000000000..d5566b7ec0 --- /dev/null +++ b/published/20191022 How to Get the Size of a Directory in Linux.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11503-1.html) +[#]: subject: (How to Get the Size of a Directory in Linux) +[#]: via: (https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何获取 Linux 中的目录大小 +====== + +你应该已经注意到,在 Linux 中使用 [ls 命令][1] 列出的目录内容中,目录的大小仅显示 4KB。这个大小正确吗?如果不正确,那它代表什么,又该如何获取 Linux 中的目录或文件夹大小?这是一个默认的大小,是用来存储磁盘上存储目录的元数据的大小。 + +Linux 上有一些应用程序可以 [获取目录的实际大小][2]。其中,磁盘使用率(`du`)命令已被 Linux 管理员广泛使用。 + +我将向您展示如何使用各种选项获取文件夹大小。 + +### 什么是 du 命令? + +[du 命令][3] 表示 磁盘使用率Disk Usage。这是一个标准的 Unix 程序,用于估计当前工作目录中的文件空间使用情况。 + +它使用递归方式总结磁盘使用情况,以获取目录及其子目录的大小。 + +如同我说的那样, 使用 `ls` 命令时,目录大小仅显示 4KB。参见下面的输出。 + +``` +$ ls -lh | grep ^d + +drwxr-xr-x 3 daygeek daygeek 4.0K Aug 2 13:57 Bank_Details +drwxr-xr-x 2 daygeek daygeek 4.0K Mar 15 2019 daygeek +drwxr-xr-x 6 daygeek daygeek 4.0K Feb 16 2019 drive-2daygeek +drwxr-xr-x 13 daygeek daygeek 4.0K Jan 6 2019 drive-mageshm +drwxr-xr-x 15 daygeek daygeek 4.0K Sep 29 21:32 Thanu_Photos +``` + +### 1) 在 Linux 上如何只获取父目录的大小 + +使用以下 `du` 命令格式获取给定目录的总大小。在该示例中,我们将得到 `/home/daygeek/Documents` 目录的总大小。 + +``` +$ du -hs /home/daygeek/Documents +或 +$ du -h --max-depth=0 /home/daygeek/Documents/ +20G /home/daygeek/Documents +``` + +详细说明: + + * `du` – 这是一个命令 + * `-h` – 以易读的格式显示大小 (例如 1K 234M 2G) + * `-s` – 仅显示每个参数的总数 + * `--max-depth=N` – 目录的打印深度 + +### 2) 在 Linux 上如何获取每个目录的大小 + +使用以下 `du` 命令格式获取每个目录(包括子目录)的总大小。 + +在该示例中,我们将获得每个 `/home/daygeek/Documents` 目录及其子目录的总大小。 + +``` +$ du -h /home/daygeek/Documents/ | sort -rh | head -20 + +20G /home/daygeek/Documents/ +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +5.3G /home/daygeek/Documents/Thanu_Photos/Camera +5.3G /home/daygeek/Documents/drive-2daygeek/Thanu-videos +3.2G /home/daygeek/Documents/drive-mageshm +2.3G /home/daygeek/Documents/drive-2daygeek/Thanu-Photos +2.2G /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month +916M /home/daygeek/Documents/drive-mageshm/Tanisha +454M /home/daygeek/Documents/drive-mageshm/2g-backup +415M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video +300M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Jan-2017 +288M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2017 +226M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Sep-2017 +219M /home/daygeek/Documents/Thanu_Photos/WhatsApp Documents +213M /home/daygeek/Documents/drive-mageshm/photos +163M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video/Sent +161M /home/daygeek/Documents/Thanu_Photos/WhatsApp Images +154M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/June-2017 +150M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2016 +``` + +### 3) 在 Linux 上如何获取每个目录的摘要 + +使用如下 `du` 命令格式仅获取每个目录的摘要。 + +``` +$ du -hs /home/daygeek/Documents/* | sort -rh | head -10 + +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +3.2G /home/daygeek/Documents/drive-mageshm +756K /home/daygeek/Documents/Bank_Details +272K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-TouchInterface1.png +172K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-NightLight.png +164K /home/daygeek/Documents/ConfigServer Security and Firewall (csf) Cheat Sheet.pdf +132K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-Todo.png +112K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-ZorinAutoTheme.png +96K /home/daygeek/Documents/distro-info.xlsx +``` + +### 4) 在 Linux 上如何获取每个目录的不含子目录的大小 + +使用如下 `du` 命令格式来展示每个目录的总大小,不包括子目录。 + +``` +$ du -hS /home/daygeek/Documents/ | sort -rh | head -20 + +5.3G /home/daygeek/Documents/Thanu_Photos/Camera +5.3G /home/daygeek/Documents/drive-2daygeek/Thanu-videos +2.3G /home/daygeek/Documents/drive-2daygeek/Thanu-Photos +1.5G /home/daygeek/Documents/drive-mageshm +831M /home/daygeek/Documents/drive-mageshm/Tanisha +454M /home/daygeek/Documents/drive-mageshm/2g-backup +300M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Jan-2017 +288M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2017 +253M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video +226M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Sep-2017 +219M /home/daygeek/Documents/Thanu_Photos/WhatsApp Documents +213M /home/daygeek/Documents/drive-mageshm/photos +163M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video/Sent +154M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/June-2017 +150M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2016 +127M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Dec-2016 +100M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2016 +94M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2017 +92M /home/daygeek/Documents/Thanu_Photos/WhatsApp Images +90M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Dec-2017 +``` + +### 5) 在 Linux 上如何仅获取一级子目录的大小 + +如果要获取 Linux 上给定目录的一级子目录(包括其子目录)的大小,请使用以下命令格式。 + +``` +$ du -h --max-depth=1 /home/daygeek/Documents/ + +3.2G /home/daygeek/Documents/drive-mageshm +4.0K /home/daygeek/Documents/daygeek +756K /home/daygeek/Documents/Bank_Details +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +20G /home/daygeek/Documents/ +``` + +### 6) 如何在 du 命令输出中获得总计 + +如果要在 `du` 命令输出中获得总计,请使用以下 `du` 命令格式。 + +``` +$ du -hsc /home/daygeek/Documents/* | sort -rh | head -10 + +20G total +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +3.2G /home/daygeek/Documents/drive-mageshm +756K /home/daygeek/Documents/Bank_Details +272K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-TouchInterface1.png +172K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-NightLight.png +164K /home/daygeek/Documents/ConfigServer Security and Firewall (csf) Cheat Sheet.pdf +132K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-Todo.png +112K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-ZorinAutoTheme.png +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [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/linux-unix-ls-command-display-directory-contents/ +[2]: https://www.2daygeek.com/how-to-get-find-size-of-directory-folder-linux/ +[3]: https://www.2daygeek.com/linux-check-disk-usage-files-directories-size-du-command/ diff --git a/published/20191023 Using SSH port forwarding on Fedora.md b/published/20191023 Using SSH port forwarding on Fedora.md new file mode 100644 index 0000000000..e2a66912a4 --- /dev/null +++ b/published/20191023 Using SSH port forwarding on Fedora.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11515-1.html) +[#]: subject: (Using SSH port forwarding on Fedora) +[#]: via: (https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +在 Fedora 上使用 SSH 端口转发 +====== + +![](https://img.linux.net.cn/data/attachment/album/201910/29/123804dql3aqqlghza9txt.jpg) + +你可能已经熟悉使用 [ssh 命令][2]访问远程系统。`ssh` 命令背后所使用的协议允许终端的输入和输出流经[安全通道][3]。但是你知道也可以使用 `ssh` 来安全地发送和接收其他数据吗?一种方法是使用“端口转发port forwarding”,它允许你在进行 `ssh` 会话时安全地连接网络端口。本文向你展示了它是如何工作的。 + +### 关于端口 + +标准 Linux 系统已分配了一组网络端口,范围是 0 - 65535。系统会保留 0 - 1023 的端口以供系统使用。在许多系统中,你不能选择使用这些低端口号。通常有几个端口用于运行特定的服务。你可以在系统的 `/etc/services` 文件中找到这些定义。 + +你可以认为网络端口是类似的物理端口或可以连接到电缆的插孔。端口可以连接到系统上的某种服务,类似物理插孔后面的接线。一个例子是 Apache Web 服务器(也称为 `httpd`)。对于 HTTP 非安全连接,Web 服务器通常要求在主机系统上使用端口 80,对于 HTTPS 安全连接通常要求使用 443。 + +当你连接到远程系统(例如,使用 Web 浏览器)时,你是将浏览器“连接”到你的主机上的端口。这通常是一个随机的高端口号,例如 54001。你的主机上的端口连接到远程主机上的端口(例如 443)来访问其安全的 Web 服务器。 + +那么,当你有这么多可用端口时,为什么还要使用端口转发呢?这是 Web 开发人员生活中的几种常见情况。 + +### 本地端口转发 + +想象一下,你正在名为 `remote.example.com` 的远程系统上进行 Web 开发。通常,你是通过 `ssh` 进入此系统的,但是它位于防火墙后面,而且该防火墙很少允许其他类型的访问,并且会阻塞大多数其他端口。要尝试你的网络应用,能够使用浏览器访问远程系统会很有帮助。但是,由于使用了讨厌的防火墙,你无法通过在浏览器中输入 URL 的常规方法来访问它。 + +本地转发使你可以通过 `ssh` 连接来建立可通过远程系统访问的端口。该端口在系统上显示为本地端口(因而称为“本地转发”)。 + +假设你的网络应用在 `remote.example.com` 的 8000 端口上运行。要将那个系统的 8000 端口本地转发到你系统上的 8000 端口,请在开始会话时将 `-L` 选项与 `ssh` 结合使用: + +``` +$ ssh -L 8000:localhost:8000 remote.example.com +``` + +等等,为什么我们使用 `localhost` 作为转发目标?这是因为从 `remote.example.com` 的角度来看,你是在要求主机使用其自己的端口 8000。(回想一下,任何主机通常可以通过网络连接 `localhost` 而连接到自身。)现在那个端口连接到你系统的 8000 端口了。`ssh` 会话准备就绪后,将其保持打开状态,然后可以在浏览器中键入 `http://localhost:8000` 来查看你的 Web 应用。现在,系统之间的流量可以通过 `ssh` 隧道安全地传输! + +如果你有敏锐的眼睛,你可能已经注意到了一些东西。如果我们要 `remote.example.com` 转发到与 `localhost` 不同的主机名怎么办?如果它可以访问该网络上另一个系统上的端口,那么通常可以同样轻松地转发该端口。例如,假设你想访问也在该远程网络中的 `db.example.com` 的 MariaDB 或 MySQL 服务。该服务通常在端口 3306 上运行。因此,即使你无法 `ssh` 到实际的 `db.example.com` 主机,你也可以使用此命令将其转发: + +``` +$ ssh -L 3306:db.example.com:3306 remote.example.com +``` + +现在,你可以在 `localhost` 上运行 MariaDB 命令,而实际上是在使用 `db.example.com` 主机。 + +### 远程端口转发 + +远程转发让你可以进行相反操作。想象一下,你正在为办公室的朋友设计一个 Web 应用,并想向他们展示你的工作。不过,不幸的是,你在咖啡店里工作,并且由于网络设置,他们无法通过网络连接访问你的笔记本电脑。但是,你同时使用着办公室的 `remote.example.com` 系统,并且仍然可在这里登录。你的 Web 应用似乎在本地 5000 端口上运行良好。 + +远程端口转发使你可以通过 `ssh` 连接从本地系统建立端口的隧道,并使该端口在远程系统上可用。在开始 `ssh` 会话时,只需使用 `-R` 选项: + +``` +$ ssh -R 6000:localhost:5000 remote.example.com +``` + +现在,当在公司防火墙内的朋友打开浏览器时,他们可以进入 `http://remote.example.com:6000` 查看你的工作。就像在本地端口转发示例中一样,通信通过 `ssh` 会话安全地进行。 + +默认情况下,`sshd` 守护进程运行在设置的主机上,因此**只有**该主机可以连接它的远程转发端口。假设你的朋友希望能够让其他 `example.com` 公司主机上的人看到你的工作,而他们不在 `remote.example.com` 上。你需要让 `remote.example.com` 主机的所有者将以下选项**之一**添加到 `/etc/ssh/sshd_config` 中: + +``` +GatewayPorts yes # 或 +GatewayPorts clientspecified +``` + +第一个选项意味着 `remote.example.com` 上的所有网络接口都可以使用远程转发的端口。第二个意味着建立隧道的客户端可以选择地址。默认情况下,此选项设置为 `no`。 + +使用此选项,你作为 `ssh` 客户端仍必须指定可以共享你这边转发端口的接口。通过在本地端口之前添加网络地址范围来进行此操作。有几种方法可以做到,包括: + +``` +$ ssh -R *:6000:localhost:5000 # 所有网络 +$ ssh -R 0.0.0.0:6000:localhost:5000 # 所有网络 +$ ssh -R 192.168.1.15:6000:localhost:5000 # 单个网络 +$ ssh -R remote.example.com:6000:localhost:5000 # 单个网络 +``` + +### 其他注意事项 + +请注意,本地和远程系统上的端口号不必相同。实际上,有时你甚至可能无法使用相同的端口。例如,普通用户可能不会在默认设置中转发到系统端口。 + +另外,可以限制主机上的转发。如果你需要在联网主机上更严格的安全性,那么这你来说可能很重要。 `sshd` 守护程进程的 `PermitOpen` 选项控制是否以及哪些端口可用于 TCP 转发。默认设置为 `any`,这让上面的所有示例都能正常工作。要禁止任何端口转发,请选择 `none`,或仅允许的特定的“主机:端口”。有关更多信息,请在手册页中搜索 `PermitOpen` 来配置 `sshd` 守护进程: + +``` +$ man sshd_config +``` + +最后,请记住,只有在 `ssh` 会话处于打开状态时才会端口转发。如果需要长时间保持转发活动,请尝试使用 `-N` 选项在后台运行会话。确保控制台已锁定,以防止在你离开控制台时其被篡夺。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/ssh-port-forwarding-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Secure_Shell +[3]: https://fedoramagazine.org/open-source-ssh-clients/ diff --git a/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md new file mode 100644 index 0000000000..1e157e106d --- /dev/null +++ b/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11509-1.html) +[#]: subject: (MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements) +[#]: via: (https://itsfoss.com/mx-linux-19/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +随着 Debian 10.1 “Buster” 的发布,MX Linux 19 也发布了 +====== + +MX Linux 18 是我在[最佳 Linux 发行版][1]中的主要推荐的发行版之一,特别是当你在考虑 Ubuntu 以外的发行版时。 + +它基于 Debian 9.6 “Stretch”,具有令人难以置信的快速流畅的体验。 + +现在,作为该发行版的主要升级版本,MX Linux 19 带来了许多重大改进和变更。在这里,我们将看一下主要亮点。 + +### MX Linux 19 中的新功能 + +- [视频](https://player.vimeo.com/video/368459760) + +#### Debian 10 “Buster” + +这个值得一提,因为 Debian 10 实际上是 MX Linux 18 所基于的 Debian 9.6 “Stretch” 的主要升级。 + +如果你对 Debian 10 “Buster” 的变化感到好奇,建议你阅读有关 [Debian 10 “Buster” 的新功能][3]的文章。 + +#### Xfce 桌面 4.14 + +![MX Linux 19][4] + +[Xfce 4.14][5] 正是 Xfce 开发团队提供的最新产品。就个人而言,我不是 Xfce 桌面环境的粉丝,但是当你在 Linux 发行版(尤其是 MX Linux 19)上使用它时,它超快的性能会让你惊叹。 + +或许你会感兴趣,我们也有一个快速指南来帮助你[自定义 Xfce][6]。 + +#### 升级的软件包及最新的 Debian 内核 4.19 + +除了 [GIMP][7]、MESA、Firefox 等的更新软件包之外,它还随附有 Debian “Buster” 可用的最新内核 4.19。 + +#### 升级的 MX 系列应用 + +如果你以前使用过 MX Linux,则可能会知道它已经预装了有用的 MX 系列应用,可以帮助你快速完成更多工作。 + +像 MX-installer 和 MX-packageinstaller 这样的应用程序得到了显著改进。 + +除了这两个以外,所有其他 MX 工具也已不同程度的进行了更新和修复错误、添加了新的翻译(或只是改善了用户体验)。 + +#### 其它改进 + +考虑到这是一次重大升级,很明显,底层的更改要多于表面(包括最新的 antiX live 系统更新)。 + +你可以在他们的[官方公告][8]中查看更多详细信息。你还可以从开发人员那里观看以下视频,它介绍了 MX Linux 19 中的所有新功能: + +- [视频](https://youtu.be/4XVHA4l4Zrc) + +### 获取 MX Linux 19 + +即使是你现在正在使用 MX Linux 18 版本,你也[无法][9]升级到 MX Linux 19。你需要像其他人一样进行全新安装。 + +你可以从此页面下载 MX Linux 19: + +- [下载 MX Linux 19][10] + +### 结语 + +在 MX Linux 18 上,我在使用 WiFi 适配器时遇到了问题,通过[论坛][11]解决了该问题,但看来 MX Linux 19 仍未解决该问题。因此,如果你在安装 MX Linux 19 之后遇到了相同的问题,你可能想要查看一下我的[论坛帖子][11]。 + +如果你使用的是 MX Linux 18,那么这绝对是一个令人印象深刻的升级。 + +你尝试过了吗?你对新的 MX Linux 19 版本有何想法?让我知道你在以下评论中的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mx-linux-19/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11411-1.html +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://linux.cn/article-11071-1.html +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/mx-linux-19.jpg?ssl=1 +[5]: https://xfce.org/about/news +[6]: https://itsfoss.com/customize-xfce/ +[7]: https://itsfoss.com/gimp-2-10-release/ +[8]: https://mxlinux.org/blog/mx-19-patito-feo-released/ +[9]: https://mxlinux.org/migration/ +[10]: https://mxlinux.org/download-links/ +[11]: https://forum.mxlinux.org/viewtopic.php?t=52201 diff --git a/sources/news/20190820 Serverless on Kubernetes, diverse automation, and more industry trends.md b/sources/news/20190820 Serverless on Kubernetes, diverse automation, and more industry trends.md deleted file mode 100644 index 881ac5410a..0000000000 --- a/sources/news/20190820 Serverless on Kubernetes, diverse automation, and more industry trends.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Serverless on Kubernetes, diverse automation, and more industry trends) -[#]: via: (https://opensource.com/article/19/8/serverless-kubernetes-and-more) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Serverless on Kubernetes, diverse automation, 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. - -## [10 tips for creating robust serverless components][2] - -> There are some repeated patterns that we have seen after creating 20+ serverless components. We recommend that you browse through the [available component repos on GitHub][3] and check which one is close to what you’re building. Just open up the repo and check the code and see how everything fits together. -> -> All component code is open source, and we are striving to keep it clean, simple and easy to follow. After you look around you’ll be able to understand how our core API works, how we interact with external APIs, and how we are reusing other components. - -**The impact**: Serverless Inc is striving to take probably the most hyped architecture early on in the hype cycle and make it usable and practical today. For serverless to truly go mainstream, producing something useful has to be as easy for a developer as "Hello world!," and these components are a step in that direction. - -## [Kubernetes workloads in the serverless era: Architecture, platforms, and trends][4] - -> There are many fascinating elements of the Kubernetes architecture: the containers providing common packaging, runtime and resource isolation model within its foundation; the simple control loop mechanism that monitors the actual state of components and reconciles this with the desired state; the custom resource definitions. But the true enabler for extending Kubernetes to support diverse workloads is the concept of the pod. -> -> A pod provides two sets of guarantees. The deployment guarantee ensures that the containers of a pod are always placed on the same node. This behavior has some useful properties such as allowing containers to communicate synchronously or asynchronously over localhost, over inter-process communication ([IPC][5]), or using the local file system. - -**The impact**: If developer adoption of serverless architectures is largely driven by how easily they can be productive working that way, business adoption will be driven by the ability to place this trend in the operational and business context. IT decision-makers need to see a holistic picture of how serverless adds value alongside their existing investments, and operators and architects need to envision how they'll keep it all up and running. - -## [How developers can survive the Last Mile with CodeReady Workspaces][6] - -> Inside each cloud provider, a host of tools can address CI/CD, testing, monitoring, backing up and recovery problems. Outside of those providers, the cloud native community has been hard at work cranking out new tooling from [Prometheus][7], [Knative][8], [Envoy][9] and [Fluentd][10], to [Kubenetes][11] itself and the expanding ecosystem of Kubernetes Operators. -> -> Within all of those projects, cloud-based services and desktop utilities is one major gap, however: the last mile of software development is the IDE. And despite the wealth of development projects inside the community and Cloud Native Computing Foundation, it is indeed the Eclipse Foundation, as mentioned above, that has taken on this problem with a focus on the new cloud development landscape. - -**The impact**: Increasingly complex development workflows and deployment patterns call for increasingly intelligent IDEs. While I'm sure it is possible to push a button and redeploy your microservices to a Kubernetes cluster from emacs (or vi, relax), Eclipse Che (and CodeReady Workspaces) are being built from the ground up with these types of cloud-native workflows in mind. - -## [Automate security in increasingly complex hybrid environments][12] - -> According to the [Information Security Forum][13]’s [Global Security Threat Outlook for 2019][14], one of the biggest IT trends to watch this year is the increasing sophistication of cybercrime and ransomware. And even as the volume of ransomware attacks is dropping, cybercriminals are finding new, more potent ways to be disruptive. An [article in TechRepublic][15] points to cryptojacking malware, which enables someone to hijack another's hardware without permission to mine cryptocurrency, as a growing threat for enterprise networks. -> -> To more effectively mitigate these risks, organizations could invest in automation as a component of their security plans. That’s because it takes time to investigate and resolve issues, in addition to applying controlled remediations across bare metal, virtualized systems, and cloud environments -- both private and public -- all while documenting changes.  - -**The impact**: This one is really about our ability to trust that the network service providers that we rely upon to keep our phones and smart TVs full of stutter-free streaming HD content have what they need to protect the infrastructure that makes it all possible. I for one am rooting for you! - -## [AnsibleFest 2019 session catalog][16] - -> 85 Ansible automation sessions over 3 days in Atlanta, Georgia - -**The impact**: What struck me is the range of things that can be automated with Ansible. Windows? Check. Multicloud? Check. Security? Check. The real question after those three days are over will be: Is there anything in IT that can't be automated with Ansible? Seriously, I'm asking, let me know. - -_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/19/8/serverless-kubernetes-and-more - -作者:[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://serverless.com/blog/10-tips-creating-robust-serverless-components/ -[3]: https://github.com/serverless-components/ -[4]: https://www.infoq.com/articles/kubernetes-workloads-serverless-era/ -[5]: https://opensource.com/article/19/4/interprocess-communication-linux-networking -[6]: https://thenewstack.io/how-developers-can-survive-the-last-mile-with-codeready-workspaces/ -[7]: https://prometheus.io/ -[8]: https://knative.dev/ -[9]: https://www.envoyproxy.io/ -[10]: https://www.fluentd.org/ -[11]: https://kubernetes.io/ -[12]: https://www.redhat.com/en/blog/automate-security-increasingly-complex-hybrid-environments -[13]: https://www.securityforum.org/ -[14]: https://www.prnewswire.com/news-releases/information-security-forum-forecasts-2019-global-security-threat-outlook-300757408.html -[15]: https://www.techrepublic.com/article/top-4-security-threats-businesses-should-expect-in-2019/ -[16]: https://agenda.fest.ansible.com/sessions diff --git a/sources/news/20190822 Semiconductor startup Cerebras Systems launches massive AI chip.md b/sources/news/20190822 Semiconductor startup Cerebras Systems launches massive AI chip.md deleted file mode 100644 index 91685c8501..0000000000 --- a/sources/news/20190822 Semiconductor startup Cerebras Systems launches massive AI chip.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Semiconductor startup Cerebras Systems launches massive AI chip) -[#]: via: (https://www.networkworld.com/article/3433617/semiconductor-startup-cerebras-systems-launches-massive-ai-chip.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Semiconductor startup Cerebras Systems launches massive AI chip -====== - -![Cerebras][1] - -There are a host of different AI-related solutions for the data center, ranging from add-in cards to dedicated servers, like the Nvidia DGX-2. But a startup called Cerebras Systems has its own server offering that relies on a single massive processor rather than a slew of small ones working in parallel. - -Cerebras has taken the wraps off its Wafer Scale Engine (WSE), an AI chip that measures 8.46x8.46 inches, making it almost the size of an iPad and more than 50 times larger than a CPU or GPU. A typical CPU or GPU is about the size of a postage stamp. - -[Now see how AI can boost data-center availability and efficiency.][2] - -Cerebras won’t sell the chips to ODMs due to the challenges of building and cooling such a massive chip. Instead, it will come as part of a complete server to be installed in data centers, which it says will start shipping in October. - -The logic behind the design is that AI requires huge amounts of data just to run a test and current technology, even GPUs, are not fast or powerful enough. So Cerebras supersized the chip. - -The numbers are just incredible. The company’s WSE chip has 1.2 trillion transistors, 400,000 computing cores and 18 gigabytes of memory. A typical PC processor has about 2 billion transistors, four to six cores and a few megabytes of cache memory. Even a high-end GPU has 21 billion transistors and a few thousand cores. - -The 400,000 cores on the WSE are connected via the Swarm communication fabric in a 2D mesh with 100 Pb/s of bandwidth. The WSE has 18 GB of on-chip memory, all accessible within a single clock cycle, and provides 9 PB/s memory bandwidth. This is 3000x more capacity and 10,000x greater bandwidth than the best Nvidia has to offer. More to the point it eliminates the need to move data in and out of memory to and from the CPU. - -“A vast array of programmable cores provides cluster-scale compute on a single chip. High-speed memory close to each core ensures that cores are always occupied doing calculations. And by connecting everything on-die, communication is many thousands of times faster than what is possible with off-chip technologies like InfiniBand,” the company said in a [blog post][3] announcing the processor. - -The cores are called Sparse Linear Algebra Cores, or SLA. They are optimized for the sparse linear algebra that is fundamental to neural network calculation. These cores are designed specifically for AI work. They are small and fast, contain no caches, and have eliminated other features and overheads that are needed in general purpose cores but play no useful role in a deep learning processor. - -The chip is the brainchild of Andrew Feldman, who created the SeaMicro high density Atom-based server a decade ago as an alternative to overpowered Xeons for doing simple tasks like file and print or serving LAMP stacks. Feldman is a character, one of the more interesting people [I’ve interviewed][4]. He definitely thinks outside the box. - -Feldman sold SeaMicro to AMD for $334 million in 2012, which turned out to be a colossal waste of money on AMD’s part, as the product shortly disappeared from the market. Since then he’s raised $100 million in VC money. - -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/3433617/semiconductor-startup-cerebras-systems-launches-massive-ai-chip.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://images.idgesg.net/images/article/2019/08/cerebras-wafer-scale-engine-100809084-large.jpg -[2]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html -[3]: https://www.cerebras.net/hello-world/ -[4]: https://www.serverwatch.com/news/article.php/3887471/SeaMicro-Launches-an-AtomPowered-Cloud-Computing-Server.htm -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20190823 VMware spends -4.8B to grab Pivotal, Carbon Black to secure, develop integrated cloud world.md b/sources/news/20190823 VMware spends -4.8B to grab Pivotal, Carbon Black to secure, develop integrated cloud world.md deleted file mode 100644 index be11927309..0000000000 --- a/sources/news/20190823 VMware spends -4.8B to grab Pivotal, Carbon Black to secure, develop integrated cloud world.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (VMware spends $4.8B to grab Pivotal, Carbon Black to secure, develop integrated cloud world) -[#]: via: (https://www.networkworld.com/article/3433916/vmware-spends-48b-to-grab-pivotal-carbon-black-to-secure-develop-integrated-cloud-world.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -VMware spends $4.8B to grab Pivotal, Carbon Black to secure, develop integrated cloud world -====== -VMware will spend $2.7 billion on cloud-application developer Pivotal and $2.1 billion for security vendor Carbon Black - details at next week's VMworld user conference -![Bigstock][1] - -All things cloud are major topics of conversation at the VMworld user conference next week, ratcheded up a notch by VMware's $4.8 billion plans to acquire cloud development firm Pivotal and security provider Carbon Black. - -VMware said during its quarterly financial call this week it would spend about $2.7 billion on Pivotal and its Cloud Foundry hybrid cloud development technology, and about $2.1 billion for the security technology of Carbon Black, which includes its Predictive Security Cloud and other endpoint-security software.  Both amounts represent the [enterprise value][2] of the deals the actual purchase prices will vary, experts said. - -**[ Check out [What is hybrid cloud computing][3] and learn [what you need to know about multi-cloud][4]. | Get regularly scheduled insights by [signing up for Network World newsletters][5]. ]** - -VMware has deep relationships with both companies. Carbon Black technology is part of [VMware’s AppDefense][6] endpoint security. Pivotal has a deeper relationship in that VMware and Dell, VMware’s parent company, [spun out Pivotal][7] in 2013. - -“These acquisitions address two critical technology priorities of all businesses today – building modern, enterprise-grade applications and protecting enterprise workloads and clients. With these actions we meaningfully accelerate our subscription and SaaS offerings and expand our ability to enable our customers’ digital transformation,” said VMware CEO Pat Gelsinger, on the call. - -With regards to the Pivotal acquisition Gelsinger said the time was right to own the whole compute stack. “We will now be uniquely positioned to help customers build, run and manage their cloud environment, and customers can go one place to get all of this technology,” Gelsinger said. “We embed the technology in our core VMware platform, and we will explain more about that at VMworld next week.” - -On the Carbon Black buy Gelsinger said he expects the technology to be integrated across VMware’s produce families such as NSX networking software and vSphere, VMware's flagship virtualization platform. - -“Security is broken and fundamentally customers want a different answer in the security space. We think this move will be an opportunity for major disruption.” - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][8] ]** - -Patric Morley, president and CEO of Carbon Black [wrote of the deal][9]: “VMware has a vision to create a modern security platform for any app, running on any cloud, delivered to any device – essentially, to build security into the fabric of the compute stack. Carbon Black’s cloud-native platform, our ability to see and stop attackers by leveraging the power of our rich data and behavioral analytics, and our deep cybersecurity expertise are all truly differentiating.” - -Both transactions are expected to close in the second half of VMware’s fiscal year, which ends Jan. 31. - -VMware has been on a massive buying spree this year that has included: - - * Avi Networks for multi-cloud application delivery services. - * Bitfusion for hardware virtualization. - * Uhana, a company that is employing deep learning and real-time AI in carrier networks and applications, to automate network operations and optimize application experience. - * Veriflow, for network verification, assurance, and troubleshooting. - * Heptio for its Kubernetes technology. - - - -Kubernetes integration will be a big topic at VMworld, Gelsinger hinted. “You will hear very specific announcements about how Heptio will be used. [And] we will be announcing major expansions of our Kubernetes and modern apps portfolio and help Pivotal complete that strategy. Together with Heptio and Pivotal, VMware will offer a comprehensive Kubernetes-based portfolio to build, run and manage modern applications on any cloud,” Gelsinger said. - -“VMware has increased its Kubernetes-related investments over the past year with the acquisition of Heptio to become a top-three contributor to Kubernetes, and at VMworld we will describe a major R&D effort to evolve VMware vSphere into a native Kubernetes platform for VMs and containers.” - -Other updates about where VMware vSphere and NSX-T are headed will also be hot topics. - -Introduced in 2017, NSX-T Data Center software is targeted at organizations looking to support multivendor cloud-native applications, [bare-metal][10] workloads, [hypervisor][11] environments and the growing hybrid and multi-cloud worlds. In February the [company anointed NSX-T][12] the company’s go-to platform for future software-defined cloud developments. - -VMware is battling Cisco's Application Centric Infrastructure, Juniper's Contrail system and other platforms from vendors including Pluribus, Arista and Big Switch. How NSX-T evolves will be key to how well VMware competes. - -The most recent news around vSphere was that new features of its Hybrid Cloud Extension application-mobility software enables non-vSphere as well as increased on-premises application workloads to migrate to a variety of specific cloud services. Introduced in 2017, [VMware HCX][13] lets vSphere customers tie on-premises systems and applications to cloud services. - -The HCX announcement was part of VMware’s continued evolution into cloud technologies. In July the company teamed with [Google][14] to natively support VMware workloads in its Google Cloud service, giving customers more options for deploying enterprise applications. - -Further news about that relationship is likely at VMworld as well. - -VMware also has a hybrid cloud partnership with [Microsoft’s Azure cloud service][15].  That package, called Azure VMware Solutions is built on VMware Cloud Foundation, which  is a packag of vSphere with NSX network-virtualization and VSAN software-defined storage-area-network platform. The company is expected to update developments with that platform as well. - -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/3433916/vmware-spends-48b-to-grab-pivotal-carbon-black-to-secure-develop-integrated-cloud-world.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://images.idgesg.net/images/article/2019/08/hybridcloud-100808516-large.jpg -[2]: http://valuationacademy.com/what-is-the-enterprise-value-ev/ -[3]: https://www.networkworld.com/article/3233132/cloud-computing/what-is-hybrid-cloud-computing.html -[4]: https://www.networkworld.com/article/3252775/hybrid-cloud/multicloud-mania-what-to-know.html -[5]: https://www.networkworld.com/newsletters/signup.html -[6]: https://www.networkworld.com/article/3359242/vmware-firewall-takes-aim-at-defending-apps-in-data-center-cloud.html -[7]: https://www.networkworld.com/article/2225739/what-is-pivotal--emc-and-vmware-want-it-to-be-your-platform-for-building-big-data-apps.html -[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[9]: https://www.carbonblack.com/2019/08/22/the-next-chapter-in-our-story-vmware-carbon-black/ -[10]: https://www.networkworld.com/article/3261113/why-a-bare-metal-cloud-provider-might-be-just-what-you-need.html?nsdr=true -[11]: https://www.networkworld.com/article/3243262/what-is-a-hypervisor.html?nsdr=true -[12]: https://www.networkworld.com/article/3346017/vmware-preps-milestone-nsx-release-for-enterprise-cloud-push.html -[13]: https://docs.vmware.com/en/VMware-HCX/services/rn/VMware-HCX-Release-Notes.html -[14]: https://www.networkworld.com/article/3428497/google-cloud-to-offer-vmware-data-center-tools-natively.html -[15]: https://www.networkworld.com/article/3113394/vmware-cloud-foundation-integrates-virtual-compute-network-and-storage-systems.html -[16]: https://www.facebook.com/NetworkWorld/ -[17]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md b/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md new file mode 100644 index 0000000000..a3ba0a6a52 --- /dev/null +++ b/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kubernetes communication, SRE struggles, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/kubernetes-sre-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Kubernetes communication, SRE struggles, 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. + +## [Review of pod-to-pod communications in Kubernetes][2] + +> In this article, we dive into pod-to-pod communications by showing you ways in which pods within a Kubernetes network can communicate with one another. +> +> While Kubernetes is opinionated in how containers are deployed and operated, it is very non-prescriptive of how the network should be designed in which pods are to be run. Kubernetes imposes the following fundamental requirements on any networking implementation (barring any intentional network segmentation policies) + +**The impact**: Networking is one of the most complicated parts of making computers work together to solve our problems. Kubernetes turns that complexity up to 11, and this article dials it back down to 10.75. + +## [One SRE's struggle and success to improve Infrastructure as Code][3] + +> Convergence is our goal because we expect our infrastructure to reach a desired state over time expressed in the code. Software idempotence means software can run as many times as it wants and unintended changes don’t happen. As a result, we built an in-house service that runs as specified to apply configurations in source control. Traditionally, we’ve aimed for a masterless configuration design so our configuration agent looks for information on the host. + +**The impact**: I've heard it said that the [human element][4] is the most important element of any digital transformation. While I don't know that the author would use that term to describe the outcome he was after, he does a great job of showing that it is not automation for automation's sake we want but rather automation that makes a meaningful impact on the lives of the people it supports. + +## [Why GitHub is the gold standard for developer-focused companies][5] + +> Now, with last year’s purchase by Microsoft supporting them, it is clear that GitHub has a real opportunity to continue building out a robust ecosystem, with billion dollar companies built upon what could turn into a powerful platform. Is GitHub the next ecosystem success story? In a word, yes. At my company, we bet on GitHub as a successful platform to build upon from the very start. We felt it was the place to build our solution if we wanted to streamline project management and keep software teams close to the code. + +**The impact**: It is one of the great ironies of open source that the most popular tool for open source development is not itself open source. The only way this works is if that tool is so good that open source developers are willing to overlook that inconsistency. + +## [KubeVirt joins Cloud Native Computing Foundation][6] + +> This month the Cloud Native Computing Foundation (CNCF) formally adopted [KubeVirt][7] into the CNCF Sandbox. KubeVirt allows you to provision, manage and run virtual machines from and within Kubernetes. In joining the CNCF Sandbox, KubeVirt now has a more substantial platform to grow as well as educate the CNCF community on the use cases for placing virtual machines within Kubernetes. The CNCF onboards projects into the CNCF Sandbox when they warrant experimentation on neutral ground to promote and foster collaborative development. + +**The impact**: The convergence of containers and virtual machines is clearly a direction vendors think is valuable. Moving this project to the CNCF gives a way to see whether this idea is going to be as popular with users and customers as vendors hope it will be. + +_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/19/10/kubernetes-sre-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://superuser.openstack.org/articles/review-of-pod-to-pod-communications-in-kubernetes/ +[3]: https://thenewstack.io/one-sres-struggle-and-success-to-improve-infrastructure-as-code/ +[4]: https://devops.com/the-secret-to-digital-transformation-is-human-connection/ +[5]: https://thenextweb.com/podium/2019/10/02/why-github-is-the-gold-standard-for-developer-focused-companies/ +[6]: https://blog.openshift.com/kubevirt-joins-cloud-native-computing-foundation/ +[7]: https://kubevirt.io/ diff --git a/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md b/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md new file mode 100644 index 0000000000..eab1e9bd0e --- /dev/null +++ b/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news) +[#]: via: (https://opensource.com/article/19/10/news-october-13) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we cover System76 shipping Coreboot-powered firmware, a new OS for the apocalypse, and more open source news! + +### System76 will ship 2 Linux laptops with Coreboot-powered open source firmware + +The Denver-based Linux PC manufacturer announced plans to start shipping two laptop models with its Coreboot-powered open source firmware later this month. Jason Evangelho, Senior Contributor at _Forbes_, cited this move as a march towards offering open source software and hardware from the ground up.  + +System76, which also develops [Pop OS][2], is now taking pre-orders for its Galago Pro and Darter Pro laptops. It claims that Coreboot will let users boot from power off to the desktop 29% faster. + +Coreboot is a lightweight firmware designed to simplify the boot cycle of systems using it. It requires the minimum number of tasks needed to load and run a modern 32-bit or 64-bit operating system. Coreboot can offer a replacement for proprietary firmware, though it omits features like execution environments. Our own [Don Watkins][3] asked if Coreboot will ship on other System76 machines. Their response, [as reported by _Forbes_][4]: + +> _"Yes. Long term, System76 is working to open source all aspects of the computer. Thelio Io, the controller board in the Thelio desktop, is both open hardware and open firmware. This is a long journey but we're picking up speed. It's been less than a year since the our open hardware Thelio desktop was released and we're now producing two laptops with System76 Open Firmware."_ + +### Collapse OS is an operating system for the post-apocalypse + +Virgil Dupras, a software developer based in Quebec, is convinced the world's global supply chain will collapse before 2030. And he's worried that most [electronics will get caught in the crosshairs][5] due to "a very complex supply chain that we won't be able to achieve again for decades (ever?)."  + +To prepare for the worst, Dupras built Collapse OS. It's [designed to run][6] on "minimal or improvised machines" and perform simple tasks that are helpful in a post-apocalyptic society. These include editing text files, collecting sources files for MCUs and CPUs, and reading/writing from several storage devices. + +Dupras says it's intended for worst-case scenarios, and that a "weak collapse" might not be enough to justify its use. If you err on the side of caution, the Collapse OS project is accepting new contributors [on GitHub][7].  + +Per the project website, Dupras says his goal is for Collapse OS to be as self-contained as possible with the ability for users to install the OS without Internet access or other resources. Ideally, the goal is for Collapse OS to not be used at all. + +### ExpressionEngine will stay open source post-acquisition + +The team behind open source CMS ExpressEngine was acquired by Packet Tide - EEHarbor's parent company - in early October. [This announcement ][8]comes one year after Digital Locations acquired EllisLab, which develops EE core.  + +[In an announcement][9] on ExpressionEngine's website, EllisLab founder Rick Ellis said Digital Locations wasn't a good fit for ExpressionEngine. Citing Digital Location's goals to build an AI business, Ellis realized several months ago that ExpressionEngine needed a new home: + +> _"We decided that what was best for ExpressionEngine was to seek a new owner, one that could devote all the resources necessary for ExpressionEngine to flourish. Our top candidate was Packet Tide due to their development capability, extensive catalog of add-ons, and deep roots in the ExpressionEngine community._ +> +> _We are thrilled that they immediately expressed enthusiastic interest in becoming the caretakers of ExpressionEngine."_ + +Ellis says Packet Tide's first goal is to finish building ExpressionEngine 6.0, which will have a new control panel with a dark theme (who doesn't love dark mode?). ExpressionEngine adopted the Apache License Version 2.0 in November 2018, after 16 years as a proprietary tool. + +The tool is still marketed as an open source CMS, and EE Harbor developer Tom Jaeger said [in the EE Slack][10] that their plan is to keep ExpressionEngine open source now. But he also left the door open to possible changes.  + +### McAfee and IBM Security to lead the Open Source Cybersecurity Alliance + +The two tech giants will contribute the initiative's first open source code and content, under guidance from the OASIS consortium. The Alliance aims to share best practices, tech stacks, and security solutions in an open source platform.  + +Carol Geyer, chief development officer of OASIS, said the lack of standard language makes it hard for businesses to share data between tools and products. Despite efforts to collaborate, the lack of a standardized format yields more integration costs that are expensive and time-consuming. + +In lieu of building connections and integrations, [the Alliance wants members][11] to "develop protocols and standards which enable tools to work together and share information across vendors."  + +According to _Tech Republic_, IBM Security will contribute [STIX-Shifter][12], an open source library that offer a universal security system. Meanwhile, McAfee added its [OpenDXL Standard Ontology][13], a cybersecurity messaging format. Other members of the Alliance include CrowdStrike, CyberArk, and SafeBreach. + +#### In other news + + * [Paris uses open source to get closer to the citizen][14] + * [SD Times open source project of the week: ABAP SDK for IBM Watson][15] + * [Google's keeping Knative development under its thumb 'for the foreseeable future'][16] + * [Devs engage in soul-searching on future of open source][17] + * [Why leading Formula 1 teams back 'copycat' open source design idea][18] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/news-october-13 + +作者:[Lauren Maffeo][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/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://system76.com/pop +[3]: https://opensource.com/users/don-watkins +[4]: https://www.forbes.com/sites/jasonevangelho/2019/10/10/system76-will-begin-shipping-2-linux-laptops-with-coreboot-based-open-source-firmware/#15a4da174e64 +[5]: https://collapseos.org/why.html +[6]: https://www.digitaltrends.com/cool-tech/collapse-os-after-societys-collapse/ +[7]: https://github.com/hsoft/collapseos +[8]: https://wptavern.com/expressionengine-under-new-ownership-will-remain-open-source-for-now +[9]: https://expressionengine.com/blog/expressionengine-has-a-new-owner +[10]: https://eecms.slack.com/?redir=%2Farchives%2FC04CUNNR9%2Fp1570576465005500 +[11]: https://www.techrepublic.com/article/mcafee-ibm-join-forces-for-global-open-source-cybersecurity-initiative/ +[12]: https://github.com/opencybersecurityalliance/stix-shifter +[13]: https://www.opendxl.com/ +[14]: https://www.smartcitiesworld.net/special-reports/special-reports/paris-uses-open-source-to-get-closer-to-the-citizen +[15]: https://sdtimes.com/os/sd-times-open-source-project-of-the-week-abap-sdk-for-ibm-watson/ +[16]: https://www.datacenterknowledge.com/google-alphabet/googles-keeping-knative-development-under-its-thumb-foreseeable-future +[17]: https://www.linuxinsider.com/story/86282.html +[18]: https://www.autosport.com/f1/news/146407/why-leading-f1-teams-back-copycat-design-proposal diff --git a/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md b/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md new file mode 100644 index 0000000000..13bc238c2c --- /dev/null +++ b/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco issues critical security warning for IOS XE REST API container) +[#]: via: (https://www.networkworld.com/article/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco issues critical security warning for IOS XE REST API container +====== +This Cisco IOS XE REST API vulnerability could lead to attackers obtaining the token-id of an authenticated user. +D3Damon / Getty Images + +Cisco this week said it issued a software update to address a vulnerability in its [Cisco REST API virtual service container for Cisco IOS XE][1] software that scored a critical 10 out of 10 on the Common Vulnerability Scoring System (CVSS) system. + +With the vulnerability an attacker could submit malicious HTTP requests to the targeted device and if successful, obtain the _token-id_ of an authenticated user. This _token-id_ could be used to bypass authentication and execute privileged actions through the interface of the REST API virtual service container on the affected Cisco IOS XE device, the company said. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +According to Cisco the REST API is an application that runs in a virtual services container. A virtual services container is a virtualized environment on a device and is delivered as an open virtual application (OVA).  The OVA package has to be installed and enabled on a device through the device virtualization manager (VMAN) CLI. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** + +The Cisco REST API provides a set of RESTful APIs as an alternative method to the Cisco IOS XE CLI to provision selected functions on Cisco devices. + +Cisco said the vulnerability can be exploited under the  following conditions: + + * The device runs an affected Cisco IOS XE Software release. + * The device has installed and enabled an affected version of the Cisco REST API virtual service container. + * An authorized user with administrator credentials (level 15) is authenticated to the REST API interface. + + + +The REST API interface is not enabled by default. To be vulnerable, the virtual services container must be installed and activated. Deleting the OVA package from the device storage memory removes the attack vector. If the Cisco REST API virtual service container is not enabled, this operation will not impact the device's normal operating conditions, Cisco stated.    + +This vulnerability affects Cisco devices that are configured to use a vulnerable version of Cisco REST API virtual service container. This vulnerability affected the following products: + + * Cisco 4000 Series Integrated Services Routers + * Cisco ASR 1000 Series Aggregation Services Routers + * Cisco Cloud Services Router 1000V Series + * Cisco Integrated Services Virtual Router + + + +Cisco said it has [released a fixed version of the REST API][4] virtual service container and   a hardened IOS XE release that prevents installation or activation of a vulnerable container on a device. If the device was already configured with an active vulnerable container, the IOS XE software upgrade will deactivate the container, making the device not vulnerable. In that case, to restore the REST API functionality, customers should upgrade the Cisco REST API virtual service container to a fixed software release, the company said. + +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/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.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://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190828-iosxe-rest-auth-bypass +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[4]: https://www.cisco.com/c/en/us/about/legal/cloud-and-software/end_user_license_agreement.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md b/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md new file mode 100644 index 0000000000..b50a93d8c1 --- /dev/null +++ b/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news) +[#]: via: (https://opensource.com/article/19/10/news-october-26) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look at a machine learning tool from Netflix, Microsoft's election software bug bounty, a cost-effective microscope built with Raspberry Pi, and more! + +### Netflix release Polynote machine learning tool + +While there have been numerous advances in machine learning over the last decade, it's still a difficult, laborious, and sometimes frustrating task. To help make that task easier, Netflix has [released a machine learning notebook environment][2] called Polynote as open source. + +Polynote enables "data scientists and AI researchers to integrate Netflix’s JVM-based machine learning framework with Python machine learning and visualization libraries". What make Polynote unique is its reproducibility feature, which "takes cells’ positions in the notebook into account before executing them, helping prevent bad practices that make notebooks difficult to rerun from the top." It's also quite flexible—Polynote works with Apache Spark and supports languages like Python, Scala, and SQL. + +You can grab Polynote [off GitHub][3] or learn more about it at the Polynote website. + +### Microsoft announces bug bounty program for its election software + +Hoping that more eyeballs on its code will make bugs shallow, Microsoft announced a [a bug bounty][4] for its open source ElectionGuard software development kit for voting machines. The goal of the program is to "uncover vulnerabilities and help bolster election security." + +The bounty is open to "security professionals, part-time hobbyists, and students." Successful submissions, which must include proofs of concept demonstrating how bugs could compromise the security of voters, are worth up to $15,000 (USD). + +If you're interested in participating, you can find ElectionGuard's code on [GitHub][5], and read more about the [bug bounty][6]. + +### microscoPI: a microscope built on Raspberry Pi + +It's not a stretch to say that the Raspberry Pi is one of the most flexible platforms for hardware and software hackers. Micropalaeontologist Martin Tetard saw the potential of the tiny computers in his field of study and [create the microscoPI][7]. + +The microscoPI is a Raspberry Pi-assisted microscope that can "capture, process, and store images and image analysis results." Using an old adjustable microscope with a movable stage as a base, Tetard added a Raspberry Pi B, a Raspberry Pi camera module, and a small touchscreen to the device. The result is a compact rig that's "completely portable and measuring less than 30 cm (12 inches) in height." The entire setup cost him €159 (about $177 USD). + +Tetard has set up [a website][8] for the microscoPI, where you can learn more about it. + +#### In other news + + * [Happy 15th birthday, Ubuntu][9] + * [Open-Source Arm Puts Robotics Within Reach][10] + * [Apache Rya matures open source triple store database][11] + * [UNICEF Launches Cryptocurrency Fund to Back Open Source Technology][12] + * [Open-source Delta Lake project moves to the Linux Foundation][13] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/news-october-26 + +作者:[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/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://venturebeat.com/2019/10/23/netflix-open-sources-polynote-to-simplify-data-science-and-machine-learning-workflows/ +[3]: https://github.com/polynote/polynote +[4]: https://thenextweb.com/security/2019/10/21/microsofts-open-source-election-software-now-has-a-bug-bounty-program/ +[5]: https://github.com/microsoft/ElectionGuard-SDK +[6]: https://www.microsoft.com/en-us/msrc/bounty +[7]: https://www.geeky-gadgets.com/raspberry-pi-microscope-07-10-2019/ +[8]: https://microscopiproject.wordpress.com/ +[9]: https://www.omgubuntu.co.uk/2019/10/happy-birthday-ubuntu-2019 +[10]: https://hackaday.com/2019/10/17/open-source-arm-puts-robotics-within-reach/ +[11]: https://searchdatamanagement.techtarget.com/news/252472464/Apache-Rya-matures-open-source-triple-store-database +[12]: https://www.coindesk.com/unicef-launches-cryptocurrency-fund-to-back-open-source-technology +[13]: https://siliconangle.com/2019/10/16/open-source-delta-lake-project-moves-linux-foundation/ diff --git a/sources/talk/20120911 Doug Bolden, Dunnet (IF).md b/sources/talk/20120911 Doug Bolden, Dunnet (IF).md deleted file mode 100644 index c856dc5be0..0000000000 --- a/sources/talk/20120911 Doug Bolden, Dunnet (IF).md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Doug Bolden, Dunnet (IF)) -[#]: via: (http://www.wyrmis.com/games/if/dunnet.html) -[#]: author: (W Doug Bolden http://www.wyrmis.com) - -Doug Bolden, Dunnet (IF) -====== - -### Dunnet (IF) - -#### Review - -When I began becoming a semi-serious hobbyist of IF last year, I mostly focused on Infocom, Adventures Unlimited, other Scott Adams based games, and freeware titles. I went on to buy some from Malinche. I picked up _1893_ and _Futureboy_ and (most recnetly) _Treasures of a Slave Kingdom_. I downloaded a lot of free games from various sites. With all of my research and playing, I never once read anything that talked about a game being bundled with Emacs. - -Partially, this is because I am a Vim guy. But I used to use Emacs. Kind of a lot. For probably my first couple of years with Linux. About as long as I have been a diehard Vim fan, now. I just never explored, it seems. - -I booted up Emacs tonight, and my fonts were hosed. Still do not know exactly why. I surfed some menus to find out what was going wrong and came across a menu option called "Adventure" under Games, which I assumed (I know, I know) meant the Crowther and Woods and 1977 variety. When I clicked it tonight, thinking that it has been a few months since I chased a bird around with a cage in a mine so I can fight off giant snakes or something, I was brought up text involving ends of roads and shovels. Trees, if shaken, that kill me with a coconut. This was not the game I thought it was. - -I dug around (or, in purely technical terms, typed "help") and got directed to [this website][1]. Well, here was an IF I had never touched before. Brand spanking new to me. I had planned to play out some _ToaSK_ tonight, but figured that could wait. Besides, I was not quite in the mood for the jocular fun of S. John Ross's commerical IF outing. I needed something a little more direct, and this apparently it. - -Most of the game plays out just like the _Colossal Cave Adventure_ cousins of the oldschool (generally commercial) IF days. There are items you pick. Each does a single task (well, there could be one exception to this, I guess). You collect treasures. Winning is a combination of getting to the end and turning in the treasures. The game slightly tweaks the formula by allowing multiple drop off points for the treasures. Since there is a weight limit, though, you usually have to drop them off at a particular time to avoid getting stuck. At several times, your "item cache" is flushed, so to speak, meaning you have to go back and replay earlier portions to find out how to bring things foward. Damage to items can occur to stop you from being able to play. Replaying is pretty much unavoidable, unless you guess outcomes just right. - -It also inherits many problems from the era it came. There is a twisty maze. I'm not sure how big it is. I just cheated and looked up a walkthrough for the maze portion. I plan on going back and replaying up to the maze bit and mapping it out, though. I was just mentally and physically beat when I played and knew that I was going to have to call it quits on the game for the night or cheat through the maze. I'm glad I cheated, because there are some interesting things after the maze. - -It also has the same sort of stilted syntax and variable levels of description that the original _Adventure_ had. Looking at one item might give you "there is nothing special about that" while looking at another might give you a sentence of flavor text. Several things mentioned in the background do not exist to the parser, which some do. Part of game play is putting up with experimenting. This includes, in cases, a tendency of room descriptions to be written from the perspective of the first time you enter. I know that the Classroom found towards the end of the game does not mention the South exit, either. There are possibly other times this occured that I didn't notice. - -It's final issue, again coming out of the era it was designed, is random death syndrome. This is not too common, but there are a few places where things that have no initially apparent fatal outcome lead to one anyhow. In some ways, this "fatal outcome" is just the game reaching an unwinnable state. For an example of the former, type "shake trees" in the first room. For an example of the latter, send either the lamp, the key, or the shovel through the ftp without switching ftp modes first. At least with the former, there is a sense of exploration in finding out new ways to die. In IF, creative deaths is a form of victory in their own right. - -_Dunnet_ has a couple of differences from most IF. The former difference is minor. There are little odd descriptions throughout the game. "This room is red" or "The towel has a picture of Snoopy one it" or "There is a cliff here" that do not seem to have an immediate effect on the game. Sure, you can jump over the cliff (and die, obviously) but but it still comes off as a bright spot in the standard description matrix. Towards the end, you will be forced to bring back these details. It makes a neat little diversion of looking around and exploring things. Most of the details are cute and/or add to the surreality of the game overall. - -The other big difference, and the one that greatly increased both my annoyance with and my enjoyment of the game, revolves around the two-three computer oriented scenes in the game. You have to type commands into two different computers throughout. One is a VAX and the other is, um, something like a PC (I forget). In both cases, there are clues to be found by knowing your way around the interface. This is a game for computer folk, so most who play it will have a sense of how to type "ls" or "dir" depending on the OS. But not all, will. Beating the game requires a general sense of computer literacy. You must know what types are in ftp. You must know how to determine what type a file is. You must know how to read a text file on a DOS style prompt. You must know something about protocols and etiquette for logging into ftp servers. All this sort of thing. If you do, or are willing to learn (I looked up some of the stuff online) then you can get past this portion with no problem. But this can be like the maze to some people, requiring several replays to get things right. - -The end result is a quirky but fun game that I wish I had known about before because now I have the feeling that my computer is hiding other secrets from me. Glad to have played. Will likely play again to see how many ways I can die. - --------------------------------------------------------------------------------- - -via: http://www.wyrmis.com/games/if/dunnet.html - -作者:[W Doug Bolden][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.wyrmis.com -[b]: https://github.com/lujun9972 -[1]: http://www.driver-aces.com/ronnie.html diff --git a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md deleted file mode 100644 index 7be913c3bf..0000000000 --- a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md +++ /dev/null @@ -1,111 +0,0 @@ -My Lisp Experiences and the Development of GNU Emacs -====== - -> (Transcript of Richard Stallman's Speech, 28 Oct 2002, at the International Lisp Conference). - -Since none of my usual speeches have anything to do with Lisp, none of them were appropriate for today. So I'm going to have to wing it. Since I've done enough things in my career connected with Lisp I should be able to say something interesting. - -My first experience with Lisp was when I read the Lisp 1.5 manual in high school. That's when I had my mind blown by the idea that there could be a computer language like that. The first time I had a chance to do anything with Lisp was when I was a freshman at Harvard and I wrote a Lisp interpreter for the PDP-11. It was a very small machine — it had something like 8k of memory — and I managed to write the interpreter in a thousand instructions. This gave me some room for a little bit of data. That was before I got to see what real software was like, that did real system jobs. - -I began doing work on a real Lisp implementation with JonL White once I started working at MIT. I got hired at the Artificial Intelligence Lab not by JonL, but by Russ Noftsker, which was most ironic considering what was to come — he must have really regretted that day. - -During the 1970s, before my life became politicized by horrible events, I was just going along making one extension after another for various programs, and most of them did not have anything to do with Lisp. But, along the way, I wrote a text editor, Emacs. The interesting idea about Emacs was that it had a programming language, and the user's editing commands would be written in that interpreted programming language, so that you could load new commands into your editor while you were editing. You could edit the programs you were using and then go on editing with them. So, we had a system that was useful for things other than programming, and yet you could program it while you were using it. I don't know if it was the first one of those, but it certainly was the first editor like that. - -This spirit of building up gigantic, complicated programs to use in your own editing, and then exchanging them with other people, fueled the spirit of free-wheeling cooperation that we had at the AI Lab then. The idea was that you could give a copy of any program you had to someone who wanted a copy of it. We shared programs to whomever wanted to use them, they were human knowledge. So even though there was no organized political thought relating the way we shared software to the design of Emacs, I'm convinced that there was a connection between them, an unconscious connection perhaps. I think that it's the nature of the way we lived at the AI Lab that led to Emacs and made it what it was. - -The original Emacs did not have Lisp in it. The lower level language, the non-interpreted language — was PDP-10 Assembler. The interpreter we wrote in that actually wasn't written for Emacs, it was written for TECO. It was our text editor, and was an extremely ugly programming language, as ugly as could possibly be. The reason was that it wasn't designed to be a programming language, it was designed to be an editor and command language. There were commands like ‘5l’, meaning ‘move five lines’, or ‘i’ and then a string and then an ESC to insert that string. You would type a string that was a series of commands, which was called a command string. You would end it with ESC ESC, and it would get executed. - -Well, people wanted to extend this language with programming facilities, so they added some. For instance, one of the first was a looping construct, which was < >. You would put those around things and it would loop. There were other cryptic commands that could be used to conditionally exit the loop. To make Emacs, we (1) added facilities to have subroutines with names. Before that, it was sort of like Basic, and the subroutines could only have single letters as their names. That was hard to program big programs with, so we added code so they could have longer names. Actually, there were some rather sophisticated facilities; I think that Lisp got its unwind-protect facility from TECO. - -We started putting in rather sophisticated facilities, all with the ugliest syntax you could ever think of, and it worked — people were able to write large programs in it anyway. The obvious lesson was that a language like TECO, which wasn't designed to be a programming language, was the wrong way to go. The language that you build your extensions on shouldn't be thought of as a programming language in afterthought; it should be designed as a programming language. In fact, we discovered that the best programming language for that purpose was Lisp. - -It was Bernie Greenberg, who discovered that it was (2). He wrote a version of Emacs in Multics MacLisp, and he wrote his commands in MacLisp in a straightforward fashion. The editor itself was written entirely in Lisp. Multics Emacs proved to be a great success — programming new editing commands was so convenient that even the secretaries in his office started learning how to use it. They used a manual someone had written which showed how to extend Emacs, but didn't say it was a programming. So the secretaries, who believed they couldn't do programming, weren't scared off. They read the manual, discovered they could do useful things and they learned to program. - -So Bernie saw that an application — a program that does something useful for you — which has Lisp inside it and which you could extend by rewriting the Lisp programs, is actually a very good way for people to learn programming. It gives them a chance to write small programs that are useful for them, which in most arenas you can't possibly do. They can get encouragement for their own practical use — at the stage where it's the hardest — where they don't believe they can program, until they get to the point where they are programmers. - -At that point, people began to wonder how they could get something like this on a platform where they didn't have full service Lisp implementation. Multics MacLisp had a compiler as well as an interpreter — it was a full-fledged Lisp system — but people wanted to implement something like that on other systems where they had not already written a Lisp compiler. Well, if you didn't have the Lisp compiler you couldn't write the whole editor in Lisp — it would be too slow, especially redisplay, if it had to run interpreted Lisp. So we developed a hybrid technique. The idea was to write a Lisp interpreter and the lower level parts of the editor together, so that parts of the editor were built-in Lisp facilities. Those would be whatever parts we felt we had to optimize. This was a technique that we had already consciously practiced in the original Emacs, because there were certain fairly high level features which we re-implemented in machine language, making them into TECO primitives. For instance, there was a TECO primitive to fill a paragraph (actually, to do most of the work of filling a paragraph, because some of the less time-consuming parts of the job would be done at the higher level by a TECO program). You could do the whole job by writing a TECO program, but that was too slow, so we optimized it by putting part of it in machine language. We used the same idea here (in the hybrid technique), that most of the editor would be written in Lisp, but certain parts of it that had to run particularly fast would be written at a lower level. - -Therefore, when I wrote my second implementation of Emacs, I followed the same kind of design. The low level language was not machine language anymore, it was C. C was a good, efficient language for portable programs to run in a Unix-like operating system. There was a Lisp interpreter, but I implemented facilities for special purpose editing jobs directly in C — manipulating editor buffers, inserting leading text, reading and writing files, redisplaying the buffer on the screen, managing editor windows. - -Now, this was not the first Emacs that was written in C and ran on Unix. The first was written by James Gosling, and was referred to as GosMacs. A strange thing happened with him. In the beginning, he seemed to be influenced by the same spirit of sharing and cooperation of the original Emacs. I first released the original Emacs to people at MIT. Someone wanted to port it to run on Twenex — it originally only ran on the Incompatible Timesharing System we used at MIT. They ported it to Twenex, which meant that there were a few hundred installations around the world that could potentially use it. We started distributing it to them, with the rule that “you had to send back all of your improvements” so we could all benefit. No one ever tried to enforce that, but as far as I know people did cooperate. - -Gosling did, at first, seem to participate in this spirit. He wrote in a manual that he called the program Emacs hoping that others in the community would improve it until it was worthy of that name. That's the right approach to take towards a community — to ask them to join in and make the program better. But after that he seemed to change the spirit, and sold it to a company. - -At that time I was working on the GNU system (a free software Unix-like operating system that many people erroneously call “Linux”). There was no free software Emacs editor that ran on Unix. I did, however, have a friend who had participated in developing Gosling's Emacs. Gosling had given him, by email, permission to distribute his own version. He proposed to me that I use that version. Then I discovered that Gosling's Emacs did not have a real Lisp. It had a programming language that was known as ‘mocklisp’, which looks syntactically like Lisp, but didn't have the data structures of Lisp. So programs were not data, and vital elements of Lisp were missing. Its data structures were strings, numbers and a few other specialized things. - -I concluded I couldn't use it and had to replace it all, the first step of which was to write an actual Lisp interpreter. I gradually adapted every part of the editor based on real Lisp data structures, rather than ad hoc data structures, making the data structures of the internals of the editor exposable and manipulable by the user's Lisp programs. - -The one exception was redisplay. For a long time, redisplay was sort of an alternate world. The editor would enter the world of redisplay and things would go on with very special data structures that were not safe for garbage collection, not safe for interruption, and you couldn't run any Lisp programs during that. We've changed that since — it's now possible to run Lisp code during redisplay. It's quite a convenient thing. - -This second Emacs program was ‘free software’ in the modern sense of the term — it was part of an explicit political campaign to make software free. The essence of this campaign was that everybody should be free to do the things we did in the old days at MIT, working together on software and working with whomever wanted to work with us. That is the basis for the free software movement — the experience I had, the life that I've lived at the MIT AI lab — to be working on human knowledge, and not be standing in the way of anybody's further using and further disseminating human knowledge. - -At the time, you could make a computer that was about the same price range as other computers that weren't meant for Lisp, except that it would run Lisp much faster than they would, and with full type checking in every operation as well. Ordinary computers typically forced you to choose between execution speed and good typechecking. So yes, you could have a Lisp compiler and run your programs fast, but when they tried to take `car` of a number, it got nonsensical results and eventually crashed at some point. - -The Lisp machine was able to execute instructions about as fast as those other machines, but each instruction — a car instruction would do data typechecking — so when you tried to get the car of a number in a compiled program, it would give you an immediate error. We built the machine and had a Lisp operating system for it. It was written almost entirely in Lisp, the only exceptions being parts written in the microcode. People became interested in manufacturing them, which meant they should start a company. - -There were two different ideas about what this company should be like. Greenblatt wanted to start what he called a “hacker” company. This meant it would be a company run by hackers and would operate in a way conducive to hackers. Another goal was to maintain the AI Lab culture (3). Unfortunately, Greenblatt didn't have any business experience, so other people in the Lisp machine group said they doubted whether he could succeed. They thought that his plan to avoid outside investment wouldn't work. - -Why did he want to avoid outside investment? Because when a company has outside investors, they take control and they don't let you have any scruples. And eventually, if you have any scruples, they also replace you as the manager. - -So Greenblatt had the idea that he would find a customer who would pay in advance to buy the parts. They would build machines and deliver them; with profits from those parts, they would then be able to buy parts for a few more machines, sell those and then buy parts for a larger number of machines, and so on. The other people in the group thought that this couldn't possibly work. - -Greenblatt then recruited Russell Noftsker, the man who had hired me, who had subsequently left the AI Lab and created a successful company. Russell was believed to have an aptitude for business. He demonstrated this aptitude for business by saying to the other people in the group, “Let's ditch Greenblatt, forget his ideas, and we'll make another company.” Stabbing in the back, clearly a real businessman. Those people decided they would form a company called Symbolics. They would get outside investment, not have scruples, and do everything possible to win. - -But Greenblatt didn't give up. He and the few people loyal to him decided to start Lisp Machines Inc. anyway and go ahead with their plans. And what do you know, they succeeded! They got the first customer and were paid in advance. They built machines and sold them, and built more machines and more machines. They actually succeeded even though they didn't have the help of most of the people in the group. Symbolics also got off to a successful start, so you had two competing Lisp machine companies. When Symbolics saw that LMI was not going to fall flat on its face, they started looking for ways to destroy it. - -Thus, the abandonment of our lab was followed by “war” in our lab. The abandonment happened when Symbolics hired away all the hackers, except me and the few who worked at LMI part-time. Then they invoked a rule and eliminated people who worked part-time for MIT, so they had to leave entirely, which left only me. The AI lab was now helpless. And MIT had made a very foolish arrangement with these two companies. It was a three-way contract where both companies licensed the use of Lisp machine system sources. These companies were required to let MIT use their changes. But it didn't say in the contract that MIT was entitled to put them into the MIT Lisp machine systems that both companies had licensed. Nobody had envisioned that the AI lab's hacker group would be wiped out, but it was. - -So Symbolics came up with a plan (4). They said to the lab, “We will continue making our changes to the system available for you to use, but you can't put it into the MIT Lisp machine system. Instead, we'll give you access to Symbolics' Lisp machine system, and you can run it, but that's all you can do.” - -This, in effect, meant that they demanded that we had to choose a side, and use either the MIT version of the system or the Symbolics version. Whichever choice we made determined which system our improvements went to. If we worked on and improved the Symbolics version, we would be supporting Symbolics alone. If we used and improved the MIT version of the system, we would be doing work available to both companies, but Symbolics saw that we would be supporting LMI because we would be helping them continue to exist. So we were not allowed to be neutral anymore. - -Up until that point, I hadn't taken the side of either company, although it made me miserable to see what had happened to our community and the software. But now, Symbolics had forced the issue. So, in an effort to help keep Lisp Machines Inc. going (5) — I began duplicating all of the improvements Symbolics had made to the Lisp machine system. I wrote the equivalent improvements again myself (i.e., the code was my own). - -After a while (6), I came to the conclusion that it would be best if I didn't even look at their code. When they made a beta announcement that gave the release notes, I would see what the features were and then implement them. By the time they had a real release, I did too. - -In this way, for two years, I prevented them from wiping out Lisp Machines Incorporated, and the two companies went on. But, I didn't want to spend years and years punishing someone, just thwarting an evil deed. I figured they had been punished pretty thoroughly because they were stuck with competition that was not leaving or going to disappear (7). Meanwhile, it was time to start building a new community to replace the one that their actions and others had wiped out. - -The Lisp community in the 70s was not limited to the MIT AI Lab, and the hackers were not all at MIT. The war that Symbolics started was what wiped out MIT, but there were other events going on then. There were people giving up on cooperation, and together this wiped out the community and there wasn't much left. - -Once I stopped punishing Symbolics, I had to figure out what to do next. I had to make a free operating system, that was clear — the only way that people could work together and share was with a free operating system. - -At first, I thought of making a Lisp-based system, but I realized that wouldn't be a good idea technically. To have something like the Lisp machine system, you needed special purpose microcode. That's what made it possible to run programs as fast as other computers would run their programs and still get the benefit of typechecking. Without that, you would be reduced to something like the Lisp compilers for other machines. The programs would be faster, but unstable. Now that's okay if you're running one program on a timesharing system — if one program crashes, that's not a disaster, that's something your program occasionally does. But that didn't make it good for writing the operating system in, so I rejected the idea of making a system like the Lisp machine. - -I decided instead to make a Unix-like operating system that would have Lisp implementations to run as user programs. The kernel wouldn't be written in Lisp, but we'd have Lisp. So the development of that operating system, the GNU operating system, is what led me to write the GNU Emacs. In doing this, I aimed to make the absolute minimal possible Lisp implementation. The size of the programs was a tremendous concern. - -There were people in those days, in 1985, who had one-megabyte machines without virtual memory. They wanted to be able to use GNU Emacs. This meant I had to keep the program as small as possible. - -For instance, at the time the only looping construct was ‘while’, which was extremely simple. There was no way to break out of the ‘while’ statement, you just had to do a catch and a throw, or test a variable that ran the loop. That shows how far I was pushing to keep things small. We didn't have ‘caar’ and ‘cadr’ and so on; “squeeze out everything possible” was the spirit of GNU Emacs, the spirit of Emacs Lisp, from the beginning. - -Obviously, machines are bigger now, and we don't do it that way any more. We put in ‘caar’ and ‘cadr’ and so on, and we might put in another looping construct one of these days. We're willing to extend it some now, but we don't want to extend it to the level of common Lisp. I implemented Common Lisp once on the Lisp machine, and I'm not all that happy with it. One thing I don't like terribly much is keyword arguments (8). They don't seem quite Lispy to me; I'll do it sometimes but I minimize the times when I do that. - -That was not the end of the GNU projects involved with Lisp. Later on around 1995, we were looking into starting a graphical desktop project. It was clear that for the programs on the desktop, we wanted a programming language to write a lot of it in to make it easily extensible, like the editor. The question was what it should be. - -At the time, TCL was being pushed heavily for this purpose. I had a very low opinion of TCL, basically because it wasn't Lisp. It looks a tiny bit like Lisp, but semantically it isn't, and it's not as clean. Then someone showed me an ad where Sun was trying to hire somebody to work on TCL to make it the “de-facto standard extension language” of the world. And I thought, “We've got to stop that from happening.” So we started to make Scheme the standard extensibility language for GNU. Not Common Lisp, because it was too large. The idea was that we would have a Scheme interpreter designed to be linked into applications in the same way TCL was linked into applications. We would then recommend that as the preferred extensibility package for all GNU programs. - -There's an interesting benefit you can get from using such a powerful language as a version of Lisp as your primary extensibility language. You can implement other languages by translating them into your primary language. If your primary language is TCL, you can't very easily implement Lisp by translating it into TCL. But if your primary language is Lisp, it's not that hard to implement other things by translating them. Our idea was that if each extensible application supported Scheme, you could write an implementation of TCL or Python or Perl in Scheme that translates that program into Scheme. Then you could load that into any application and customize it in your favorite language and it would work with other customizations as well. - -As long as the extensibility languages are weak, the users have to use only the language you provided them. Which means that people who love any given language have to compete for the choice of the developers of applications — saying “Please, application developer, put my language into your application, not his language.” Then the users get no choices at all — whichever application they're using comes with one language and they're stuck with [that language]. But when you have a powerful language that can implement others by translating into it, then you give the user a choice of language and we don't have to have a language war anymore. That's what we're hoping ‘Guile’, our scheme interpreter, will do. We had a person working last summer finishing up a translator from Python to Scheme. I don't know if it's entirely finished yet, but for anyone interested in this project, please get in touch. So that's the plan we have for the future. - -I haven't been speaking about free software, but let me briefly tell you a little bit about what that means. Free software does not refer to price; it doesn't mean that you get it for free. (You may have paid for a copy, or gotten a copy gratis.) It means that you have freedom as a user. The crucial thing is that you are free to run the program, free to study what it does, free to change it to suit your needs, free to redistribute the copies of others and free to publish improved, extended versions. This is what free software means. If you are using a non-free program, you have lost crucial freedom, so don't ever do that. - -The purpose of the GNU project is to make it easier for people to reject freedom-trampling, user-dominating, non-free software by providing free software to replace it. For those who don't have the moral courage to reject the non-free software, when that means some practical inconvenience, what we try to do is give a free alternative so that you can move to freedom with less of a mess and less of a sacrifice in practical terms. The less sacrifice the better. We want to make it easier for you to live in freedom, to cooperate. - -This is a matter of the freedom to cooperate. We're used to thinking of freedom and cooperation with society as if they are opposites. But here they're on the same side. With free software you are free to cooperate with other people as well as free to help yourself. With non-free software, somebody is dominating you and keeping people divided. You're not allowed to share with them, you're not free to cooperate or help society, anymore than you're free to help yourself. Divided and helpless is the state of users using non-free software. - -We've produced a tremendous range of free software. We've done what people said we could never do; we have two operating systems of free software. We have many applications and we obviously have a lot farther to go. So we need your help. I would like to ask you to volunteer for the GNU project; help us develop free software for more jobs. Take a look at [http://www.gnu.org/help][1] to find suggestions for how to help. If you want to order things, there's a link to that from the home page. If you want to read about philosophical issues, look in /philosophy. If you're looking for free software to use, look in /directory, which lists about 1900 packages now (which is a fraction of all the free software out there). Please write more and contribute to us. My book of essays, “Free Software and Free Society”, is on sale and can be purchased at [www.gnu.org][2]. Happy hacking! - --------------------------------------------------------------------------------- - -via: https://www.gnu.org/gnu/rms-lisp.html - -作者:[Richard Stallman][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.gnu.org -[1]:https://www.gnu.org/help/ -[2]:http://www.gnu.org/ diff --git a/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md b/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md deleted file mode 100644 index 5e00b887d2..0000000000 --- a/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md +++ /dev/null @@ -1,199 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (anonymone ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An Ubuntu User’s Review Of Dell XPS 13 Ubuntu Edition) -[#]: via: (https://itsfoss.com/dell-xps-13-ubuntu-review) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -An Ubuntu User’s Review Of Dell XPS 13 Ubuntu Edition -====== - -_**Brief: Sharing my feel and experience about Dell XPS 13 Kaby Lake Ubuntu edition after using it for over three months.**_ - -During Black Friday sale last year, I took the bullet and ordered myself a [Dell XPS 13][1] with the new [Intel Kaby Lake processor][2]. It got delivered in the second week of December and if you [follow It’s FOSS on Facebook][3], you might have seen the [live unboxing][4]. - -Though I was tempted to do the review of Dell XPS 13 Ubuntu edition almost at the same time, I knew it won’t be fair. A brand new system will, of course, feel good and work smooth. - -But that’s not the real experience. The real experience of any system comes after weeks, if not months, of use. That’s the reason I hold myself back and waited three months to review Dell XPS Kobylake Ubuntu edition. - -### Dell XPS 13 Ubuntu Edition Review - -Before we saw what’s hot and what’s not in the latest version of Dell XPS 13, I should tell you that I was using an Acer R13 ultrabook book before this. So I may compare the new Dell system with the older Acer one. - -![Dell XPS 13 Ubuntu Edition System Settings][5]![Dell XPS 13 Ubuntu Edition System Settings][5] - -Dell XPS 13 has several versions based on processor. The one I am reviewing is Dell XPS13 MLK (9360). It has i5-7200U 7th generation processor. Since I hardly used the touch screen in Acer Aspire R13, I chose to go with the non-touch version of XPS. This decision also saved me a couple of hundreds of Euro. - -It has 8 GB of LPDDR3 1866MHz RAM and 256 GB SSD PCIe. Graphics is Intel HD. On connectivity side, it’s got Killer 1535 Wi-Fi 802.11ac 2×2 and Bluetooth 4.1. Screen is InfinityEdge Full HD (1 920 x 1080). - -Now, you know what kind of hardware we’ve got here, let’s see what works and what sucks. - -#### Look and feel - -![Dell XPS 13 Kaby Lake Ubuntu Edition][6]![Dell XPS 13 Kaby Lake Ubuntu Edition][6] - -At 13.3″, Dell XPS 13 looks even smaller than a regular 13.3″ laptop, thanks to its non-existent bezel which is the specialty of the infinite display. It is light as a feather with weight just under 1.23 Kg. - -The outer surface is metallic, not very shiny but a decent aluminum look. On the interior, the palm rest is made of carbon fiber which is very comfortable at the rest. Unlike the MacBook Air that uses metallic palm rests, the carbon fiber ones are more friendly, especially in winters. - -It is almost centimeter and a half high at it’s thickest part (around hinges). This also adds a plus point to the elegance of XPS 13. - -Overall, Dell XPS 13 has a compact body and an elegant body. - -#### Keyboard and touchpad - -The keyboard and touchpad mix well with the carbon fiber interiors. The keys are smooth with springs in the back (perhaps) and give a rich feel while typing. All of the important keys are present and are not tiny in size, something you might be worried of, considering the overall tiny size of XPS13. - -Oh! the keyboards have backlit support. Which adds to the rich feel of this expensive laptop. - -While the keyboard is a great experience, the same cannot be said about the touchpad. In fact, the touchpad is the weakest part which mars the overall good experience of XPS 13. - -The touchpad has a cheap feeling because it makes an irritating sound while tapping on the right side as if it’s hollow underneath. This is [something that has been noticed in the earlier versions of XPS 13][7] but hasn’t been given enough consideration to fix it. This is something you do not expect from a product at such a price. - -Also, the touchpad scroll on websites is hideous. It is also not suitable for pixel works because of difficulty in moving little adjustments. - -#### Ports - -Dell XPS 13 has two USB 3.0 ports, one of them with PowerShare. If you did not know, [USB 3.0 PowerShare][8] ports allow you to charge external devices even when your system is turned off. - -![Dell XPS 13 Kaby Lake Ubuntu edition ports][9]![Dell XPS 13 Kaby Lake Ubuntu edition ports][9] - -It also has a [Thunderbolt][10] (doubles up as [USB Type-C port][11]). It doesn’t have HDMI port, Ethernet port or VGA port. However, all of these three can be used via the Thunderbolt port and external adapters (sold separately). - -![Dell XPS 13 Kaby Lake Ubuntu edition ports][12]![Dell XPS 13 Kaby Lake Ubuntu edition ports][12] - -It also has an SD card reader and a headphone jack. In addition to all these, there is an [anti-theft slot][13] (a common security practice in enterprises). - -#### Display - -The model I have packs 1920x1080px. It’s full HD and display quality is at par. It perfectly displays the high definition pictures and 1080p video files. - -I cannot compare it with the [qHD model][14] as I never used it. But considering that there are not enough 4K contents for now, full HD display should be sufficient for next few years. - -#### Sound - -Compared to Acer R13, XPS 13 has better audio quality. Even the max volume is louder than that of Acer R13. The dual speakers give a nice stereo effect. - -#### Webcam - -The weirdest part of Dell XPS 13 review comes now. We all have been accustomed of seeing the webcam at the top-middle position on any laptop. But this is not the case here. - -XPS 13 puts the webcam on the bottom left corner of the laptop. This is done to keep the bezel as thin as possible. But this creates a problem. - -![Image captured with laptop screen at 90 degree][15] - -When you video chat with someone, it is natural to look straight up. With the top-middle webcam, your face is in direct line with the camera. But with the bottom left position of web cam, it looks like those weird accidental selfies you take with the front camera of your smartphone. Heck, people on the other side might see inside of your nostrils. - -#### Battery - -Battery life is the strongest point of Dell XPS 13. While Dell claims an astounding 21-hour battery life, but in my experience, it smoothly gives a battery life of 8-10 hours. This is when I watch movies, browse the internet and other regular stuff. - -There is one strange thing that I noticed, though. It charges pretty quick until 90% but the charging slows down afterward. And it almost never goes beyond 98%. - -The battery indicator turns red when the battery status falls below 30% and it starts displaying notifications if the battery goes below 10%. There is small light indicator under the touchpad that turns yellow when the battery is low and it turns white when the charger is plugged in. - -#### Overheating - -I have previously written about ways to [reduce laptop overheating in Linux][16]. Thankfully, so far, I didn’t need to employ those tricks. - -Dell XPS 13 remains surprisingly cool when you are using it on battery, even in long runs. The bottom does get heated a little when you use it while charging. - -Overall, XPS 13 manages overheating very well. - -#### The Ubuntu experience with Dell XPS 13 - -So far we have seen pretty generic things about the Dell XPS 13. Let’s talk about how good a Linux laptop it is. - -Until now, I used to manually [install Linux on Windows laptop][17]. This is the first Linux laptop I ever bought. I would also like to mention the awesome first boot animation of Dell’s Ubuntu laptop. Here’s a YouTube video of the same: - -One thing I would like to mention here is that Dell never displays Ubuntu laptops on its website. You’ll have to search the website with Ubuntu then you’ll see the Ubuntu editions. Also, Ubuntu edition is cheaper just by 50 Euro in comparison to its Windows counterpart whereas I was expecting it to be at least 100 Euro less than that of Windows. - -Despite being an Ubuntu preloaded laptop, the super key still comes with Windows logo on it. It’s trivial but I would have loved to see the Ubuntu logo on it. - -Now talking about Ubuntu experience, the first thing I noticed was that there was no hardware issue. Even the function and media keys work perfectly in Ubuntu, which is a pleasant surprise. - -Dell has also added its own repository in the software sources to provide for some Dell specific tools. You can see the footprints of Dell in the entire system. - -You might be interested to see how Dell partitioned the 256Gb of disk space. Let me show that to you. - -![Default disk partition by Dell][18] - -As you can see, there is 524MB reserved for [EFI][19]. Then there is 3.2 GB of factory restore image perhaps. - -Dell is using 17Gb of Swap partition, which is more than double of the RAM size. It seems Dell didn’t put enough thought here because this is simply waste of disk space, in my opinion. I would have used not [more than 11 GB of Swap partition][20] here. - -As I mentioned before, Dell adds a “restore to factory settings” option in the Grub menu. This is a nice little feature to have. - -One thing which I don’t like in the XPS 13 Ubuntu edition is the long boot time. It takes entire 23 seconds to reach the login screen after pressing the power button. I would expect it to be faster considering that it uses SSD PCIe. - -If it interests you, the XPS 13 had Chromium and Google Chrome browsers installed by default instead of Firefox. - -As far my experience goes, I am fairly impressed with Dell XPS 13 Ubuntu edition. It gives a smooth Ubuntu experience. The laptop seems to be a part of Ubuntu. Though it is an expensive laptop, I would say it is definitely worth the money. - -To summarize, let’s see the good, the bad and the ugly of Dell XPS 13 Ubuntu edition. - -#### The Good - - * Ultralight weight - * Compact - * Keyboard - * Carbon fiber palm rest - * Full hardware support for Ubuntu - * Factory restore option for Ubuntu - * Nice display and sound quality - * Good battery life - - - -#### The bad - - * Poor touchpad - * A little pricey - * Long boot time for SSD powered laptop - * Windows key still present :P - - - -#### The ugly - - * Weird webcam placement - - - -How did you like the **Dell XPS 13 Ubuntu edition review** from an Ubuntu user’s point of view? Do you find it good enough to spend over a thousand bucks? Do share your views in the comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/dell-xps-13-ubuntu-review - -作者:[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://amzn.to/2ImVkCV -[2]: http://www.techradar.com/news/computing-components/processors/kaby-lake-intel-core-processor-7th-gen-cpu-news-rumors-and-release-date-1325782 -[3]: https://www.facebook.com/itsfoss/ -[4]: https://www.facebook.com/itsfoss/videos/810293905778045/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/Dell-XPS-13-Ubuntu-Edition-spec.jpg?resize=540%2C337&ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-Ubuntu-review.jpeg?resize=800%2C600&ssl=1 -[7]: https://www.youtube.com/watch?v=Yt5SkI0c3lM -[8]: http://www.dell.com/support/article/fr/fr/frbsdt1/SLN155147/usb-powershare-feature?lang=EN -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-Ubuntu-XPS-13-Kaby-Lake-ports-1.jpg?resize=800%2C435&ssl=1 -[10]: https://en.wikipedia.org/wiki/Thunderbolt_(interface) -[11]: https://en.wikipedia.org/wiki/USB-C -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-Ubuntu-XPS-13-Kaby-Lake-ports-2.jpg?resize=800%2C325&ssl=1 -[13]: http://accessories.euro.dell.com/sna/productdetail.aspx?c=ie&l=en&s=dhs&cs=iedhs1&sku=461-10169 -[14]: https://recombu.com/mobile/article/quad-hd-vs-qhd-vs-4k-ultra-hd-what-does-it-all-mean_M20472.html -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-webcam-issue.jpg?resize=800%2C450&ssl=1 -[16]: https://itsfoss.com/reduce-overheating-laptops-linux/ -[17]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ -[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-Ubuntu-Edition-disk-partition.jpeg?resize=800%2C448&ssl=1 -[19]: https://en.wikipedia.org/wiki/EFI_system_partition -[20]: https://itsfoss.com/swap-size/ diff --git a/sources/talk/20170908 Betting on the Web.md b/sources/talk/20170908 Betting on the Web.md deleted file mode 100644 index 84d70e164f..0000000000 --- a/sources/talk/20170908 Betting on the Web.md +++ /dev/null @@ -1,467 +0,0 @@ -[Betting on the Web][27] -============================================================ - -![](https://static.joreteg.com/large_background.jpg) - - _Note: I just spoke at [Coldfront 2017][12] about why I’m such a big proponent of the Web. What follows is essentially that talk as a blog post (I’ll add a link to the video once it is published)._ - - _Also: the Starbucks PWA mentioned in the talk has shipped! 🎉_ - -I’m  _not_  going to tell you what to do. Instead, I’m going to explain why I’ve chosen to bet my whole career on this crazy Web thing. "Betting" sounds a bit haphazard, it’s more calculated than that. It would probably be better described as "investing." - -Investing what? Our time and attention. - -Many of us only have maybe 6 or so  _really_  productive hours per day when we’re capable of being super focused and doing our absolute best work. So how we chose to invest that very limited time is kind of a big deal. Even though I really enjoy programming I rarely do it aimlessly just for the pure joy of it. Ultimately, I’m investing that productive time expecting to get  _some kind of return_  even if it’s just mastering something or solving a difficult problem. - - [### "So what, what’s your point?"][28] - -> > More than most of us realize we are  _constantly_  investing - -Sure, someone may be paying for our time directly but there’s more to it than just trading hours for money. In the long run, what we chose to invest our professional efforts into has other effects: - -**1\. Building Expertise:** We learn as we work and gain valuable experience in the technologies and platform we’re investing in. That expertise impacts our future earning potential and what types of products we’re capable of building. - -**2\. Building Equity:** Hopefully we’re generating equity and adding value to whatever product we’re building. - -**3\. Shaping tomorrow’s job market:** We’re building tomorrow’s legacy code today™. Today’s new hotness is tomorrow’s maintenance burden. In many cases the people that initially build a product or service are not the ones that ultimately maintain it. This means the technology choices we make when building a new product or service, determine whether or not there will be jobs later that require expertise in that particular platform/technology. So, those tech choices  _literally shape tomorrow’s job market!_ - -**4\. Body of knowledge:** As developers, we’re pretty good at sharing what we learn. We blog, we "Stack-Overflow", etc. These things all contribute to the corpus of knowledge available about that given platform which adds significant value by making it easier/faster for others to build things using these tools. - -**5\. Open Source:** We solve problems and share our work. When lots of developers do this it adds  _tremendous value_  to the technologies and platforms these tools are for. The sheer volume of work that we  _don’t have to do_  because we can use someone else’s library that already does it is mind-boggling. Millions and millions of hours of development work are available to us for free with a simple `npm install`. - -**6\. Building apps for users on that platform:** Last but not least, without apps there is no platform. By making more software available to end users, we’re contributing significant value to the platforms that run our apps. - -Looking at that list, the last four items are not about  _us_  at all. They represent other significant long-term impacts. - -> > We often have a broader impact than we realize - -We’re not just investing time into a job, we're also shaping the platform, community, and technologies we use. - -We’re going to come back to this, but hopefully, recognizing that greater impact can help us make better investments. - - [### With all investing comes  _risk_][29] - -We can’t talk about investing without talking about risk. So what are some of the potential risks? - - [### Are we building for the right platform?][30] - -Platform stability is indeed A Thing™. Just ask a Flash developer, Windows Phone developer, or Blackberry developer. Platforms  _can_  go away. - -If we look at those three platforms, what do they have in common? They’re  _closed_  platforms. What I mean is there’s a single controlling interest. When you build for them, you’re building for a specific operating system and coding against a particular implementation as opposed to coding against a set of  _open standards_ . You could argue, that at least to some degree, Flash died because of its "closed-ness". Regardless, one thing is clear from a risk mitigation perspective: open is better than closed. - -the Web is  _incredibly_  open. It would be quite difficult for any one entity to kill it off. - -Now, for Windows Phone/Blackberry it failed due to a lack of interested users... or was it lack of interested developers?? - -![](https://d33wubrfki0l68.cloudfront.net/9c118bc64747a753804bf88f16237bfe1c71905e/8d334/images/2/ballmer.jpg) - -Maybe if Ballmer ☝️ has just yelled "developers"  _one more time_  we’d all have Windows Phones in our pockets right now 😜. - -From a risk mitigation perspective, two things are clear with regard to platform stability: - -1. Having  _many users_  is better than having few users - -2. Having  _more developers_  building for the platform is better than having few developers - -> > There is no bigger more popular open platform than the Web - - [### Are we building the right software?][31] - -Many of us are building apps. Well, we used to build "applications" but that wasn’t nearly cool enough. So now we build "apps" instead 😎. - -What does "app" mean to a user? This is important because I think it’s changed a bit over the years. To a user, I would suggest it basically means: "a thing I put on my phone." - -But for our purposes I want to get a bit more specific. I’d propose that an app is really: - -1. An "ad hoc" user interface - -2. That is local(ish) to the device - -The term "ad hoc" is Latin and translates to **"for this"**. This actually matches pretty closely with what Apple’s marketing campaigns have been teaching the masses: - -> There’s an app **for that** -> -> – Apple - -The point is it helps you  _do_  something. The emphasis is on action. I happen to think this is largely the difference between a "site" and an "app". A news site for example has articles that are resources in and of themselves. Where a news app is software that runs on the device that helps you consume news articles. - -Another way to put it would be that site is more like a book, while an app is a tool. - - [### Should we be building apps at all?!][32] - -Remember when chatbots were supposed to take over the world? Or perhaps we’ll all be walking around with augmented reality glasses and that’s how we’ll interact with the world? - -I’ve heard it said that "the future app is  _no_  app" and virtual assistants will take over everything. - -![](https://d33wubrfki0l68.cloudfront.net/447b9cdc5e549f874d40fcccbdc6a4225d898677/b3dce/images/2/echo.png) - -I’ve had one of these sitting in my living room for a couple of years, but I find it all but useless. It’s just a nice bluetooth speaker that I can yell at to play me music. - -But I find it very interesting that: - -> > Even Alexa has an app! - -Why? Because there’s no screen! As it turns out these "ad hoc visual interfaces" are extremely efficient. - -Sure, I can yell out "Alexa, what’s the weather going to be like today" and I’ll hear a reply with high and low and whether it’s cloudy, rainy, or sunny. But in that same amount of time, I can pull my phone out tap the weather app and before Alexa can finish telling me those 3 pieces of data, I can visually scan the entire week’s worth of data, air quality, sunrise/sunset times, etc. It’s just  _so much more_  efficient as a mechanism for consuming this type of data. - -As a result of that natural efficiency, I believe that having a visual interface is going to continue to be useful for all sorts of things for a long time to come. - -That’s  _not_  to say virtual assistants aren’t useful! Google Assistant on my Pixel is quite useful in part because it can show me answers and can tolerate vagueness in a way that an app with a fixed set of buttons never could. - -But, as is so often the case with new useful tech, rarely does it complete replace everything that came before it, instead, it augments what we already have. - - [### If apps are so great why are we so "apped out"?][33] - -How do we explain that supposed efficiency when there’s data like this? - -* [65% of smartphone users download zero apps per month][13] - -* [More than 75% of app downloads open an app once and never come back][14] - -I think to answer that we have to really look at what isn’t working well. - - [### What sucks about apps?][34] - -1. **Downloading them certainly sucks.** No one wants to open an app store, search for the app they’re trying to find, then wait to download the huge file. These days a 50mb app is pretty small. Facebook for iOS 346MB, Twitter iOS 212MB. - -2. **Updating them sucks.** Every night I plug in my phone I download a whole slew of app updates that I, as a user, **could not possibly care less about**. In addition, many of these apps are things I installed  _once_ and will **never open again, ever!**. I’d love to know the global stats on how much bandwidth has been wasted on app updates for apps that were never opened again. - -3. **Managing them sucks.** Sure, when I first got an iPhone ages ago and could first download apps my home screen was impeccable. Then when we got folders!! Wow... what an amazing development! Now I could finally put all those pesky uninstallable Apple apps in a folder called "💩" and pretend they didn’t exist. But now, my home screen is a bit of a disaster. Sitting there dragging apps around is not my idea of a good time. So eventually things get all cluttered up again. - -The thing I’ve come to realize, is this: - -> > We don’t care how they got there. We only care that they’re  _there_  when we need them. - -For example, I love to go mountain biking and I enjoy tracking my rides with an app called Strava. I get all geared up for my ride, get on my bike and then go, "Oh right, gotta start Strava." So I pull out my phone  _with my gloves on_  and go: "Ok Google, open Strava". - -I  _could not care less_  about where that app was or where it came from when I said that. - -I don’t care if it was already installed, I don’t care if it never existed on my home screen, or if it was generated out of thin air on the spot. - -> > Context is  _everything_ ! - -If I’m at a parking meter, I want the app  _for that_ . If I’m visiting Portland, I want their public transit app. - -But I certainly  _do not_  want it as soon as I’ve left. - -If I’m at a conference, I might want a conference app to see the schedule, post questions to speakers, or whatnot. But wow, talk about something that quickly becomes worthless as soon as that conference is over! - -As it turns out the more "ad hoc" these things are, the better! The more  _disposable_  and  _re-inflatable_  the better! - -Which also reminds me of something that I feel like we often forget. We always assume people want our shiny apps and we measure things like "engagement" and "time spent in the app" when really, and there certainly are exceptions to this such as apps that are essentially entertainment, but often... - -> > People don’t want to use your app. They want  _to be done_  using your app. - - [### Enter PWAs][35] - -I’ve been contracting with Starbucks for the past 18 months. They’ve taken on the ambitious project of essentially re-building a lot of their web stuff in Node.js and React. One of the things I’ve helped them with (and pushed hard for) was to build a PWA (Progressive Web App) that could provide similar functionality as their native apps. Coincidentally it was launched today: [https://preview.starbucks.com][18]! - - - -This gives is a nice real world example: - -* Starbucks iOS: 146MB - -* Starbucks PWA: ~600KB - -The point is there’s a  _tremendous_  size difference. - -It’s 0.4% of the size. To put it differently, I could download the PWA **243 times**in the same amount of time it would take to download the iOS app. Then, of course on iOS it then also still has to install and boot up! - -Personally, I’d have loved it if the app ended up even smaller and there are plans to shrink it further. But even still, they’re  _not even on the same planet_  in terms of file-size! - -Market forces are  _strongly_  aligned with PWAs here: - -* Few app downloads - -* User acquisition is  _hard_ - -* User acquisition is  _expensive_ - -If the goal is to get people to sign up for the rewards program, that type of size difference could very well make the difference of getting someone signed up and using the app experience (via PWA) by the time they reach the front of the line at Starbucks or not. - -User acquisition is hard enough already, the more time and barriers that can be removed from that process, the better. - - [### Quick PWA primer][36] - -As mentioned, PWA stands for "Progressive Web Apps" or, as I like to call them: "Web Apps" 😄 - -Personally I’ve been trying to build what a user would define as an "app" with web technology for  _years_ . But until PWAs came along, as hard as we tried, you couldn’t quite build a  _real app_  with just web tech. Honestly, I kinda hate myself for saying that, but in terms of something that a user would understand as an "app" I’m afraid that statement has probably true until very recently. - -So what’s a PWA? As one of its primary contributors put it: - -> It’s just a website that took all the right vitamins. -> -> – Alex Russell - -It involves a few specific technologies, namely: - -* Service Worker. Which enable true reliability on the web. What I mean by that is I can build an app that as long as you loaded it while you were online, from then on it will  _always_  open, even if you’re not. This puts it on equal footing with other apps. - -* HTTPS. Requires encrypted connections - -* Web App Manifest. A simple JSON file that describes your application. What icons to use is someone adds it to their home screen, what its name is, etc. - -There are plenty of other resources about PWAs on the web. The point for my purposes is: - -> > It is now possible to build PWAs that are  _indistinguishable_  from their native counter parts - -They can be up and running in a fraction of the time whether or not they were already "installed" and unlike "apps" can be saved as an app on the device  _at the user’s discretion!_ - -Essentially they’re really great for creating "ad hoc" experiences that can be "cold started" on a whim nearly as fast as if it were already installed. - -I’ve said it before and I’ll say it again: - -> PWAs are the biggest thing to happen to the mobile web since the iPhone. -> -> – Um... that was me - - [### Let’s talk Internet of things][37] - -I happen to think that PWAs + IoT = ✨ MAGIC ✨. As several smart folks have pointed out. - -The one-app-per-device approach to smart devices probably isn’t particularly smart. - -It doesn’t scale well and it completely fails in terms of "ad hoc"-ness. Sure, if I have a Nest thermostat and Phillips Hue lightbulbs, it’s reasonable to have two apps installed. But even that sucks as soon as I want someone else to be able to use control them. If  _I just let you into my house_ , trust me... I’m perfectly happy to let you flip a light switch, you’re in my house, after all. But for the vast majority of these things there’s no concept of "nearby apps" and, it’s silly for my guest (or a house-sitter) to download an app they don’t actually want, just so I can let them control my lights. - -The whole "nearby apps" thing has so many uses: - -* thermostat - -* lights - -* locks - -* garage doors - -* parking meter - -* setting refrigerator temp - -* conference apps - -Today there are lots of new capabilities being added to the web to enable web apps to interact with physical devices in the real world. Things like WebUSB, WebBluetooth, WebNFC, and efforts like [Physical Web][19]. Even for things like Augmented (and Virtual) reality, the idea of the items we want to interact with having URLs makes so much sense and I can’t imagine a better, more flexible use of those URLs than for them to point to a PWA that lets you interact with that device! - - [### Forward looking statements...][38] - -I’ve been talking about all this in terms of investing. If you’ve ever read any company statement that discusses the future you always see this line explaining that things that are about to be discussed contains "forward looking statements" that may or may not ultimately happen. - -So, here are  _my_  forward looking statements. - - [### 1\. PWA-only startups][39] - -Given the cost (and challenge) of user-acquisition and the quality of app you can build with PWAs these days, I feel like this is inevitable. If you’re trying to get something off the ground, it just isn’t very efficient to spin up  _three whole teams_  to build for iOS, Android, and the Web. - - [### 2\. PWAs listed in App Stores][40] - -So, there’s a problem with "web only" which is that for the good part of a decade we’ve been training users to look for apps in the app store for their given platform. So if you’re already a recognized brand, especially if you already have a native app that you’re trying to replace, it simply isn’t smart for you  _not to exist_  in the app stores. - -So, some of this isn’t all that "forward looking" as it turns out [Microsoft has already committed to listing PWAs in the Windows Store][20], more than once! - -**They haven’t even finished implementing Service Worker in Edge yet!** But they’re already committing hard to PWAs. In addition to post linked above, one of their lead Developer Relations folks, Aaron Gustafson just [wrote an article for A List Apart][21] telling everyone to build PWAs. - -But if you think about it from their perspective, of course they should do that! As I said earlier they’ve struggled to attract developer to build for their mobile phones. In fact, they’ve at times  _paid_  companies to write apps for them simply to make sure apps exist so that users will be able to have apps they want when using a Windows Phone. Remember how I said developer time is a scarce resource and without apps, the platform is worthless? So  _of course_  they should add first class support for PWAs. If you build a PWA like a lot of folks are doing then TADA!!! 🎉 You just made a Windows/Windows Phone app! - -I’m of the opinion that the writing is on the wall for Google to do the same thing. It’s pure speculation, but it certainly seems like they are taking steps that suggest they may be planning on listing PWAs too. Namely that the Chrome folks recently shipped a feature referred to as "WebAPKs" for Chrome stable on Android (yep, everyone). In the past I’ve [explained in more detail][22] why I think this is a big deal. But a shorted version would be that before this change, sure you could save a PWA to your home screen...  _But_ , in reality it was actually a glorified bookmark. That’s what changes with WebAPKs. Instead, when you add a PWA to your home screen it generates and "side loads" an actual `.apk`file on the fly. This allows that PWA to enjoy some privileges that were simply impossible until the operating system recognized it as "an app." For example: - -* You can now mute push notifications for a specific PWA without muting it for all of Chrome. - -* The PWA is listed in the "app tray" that shows all installed apps (previously it was just the home screen). - -* You can see power usage, and permissions granted to the PWA just like any other app. - -* The app developer can now update the icon for the app by publishing an update to the app manifest. Before, there was no way to updated the icon once it had been added. - -* And a slew of other similar benefits... - -If you’ve ever installed an Android app from a source other than the Play Store (or carriers/OEMs store) you know that you have to flip a switch in settings to allow installs from "untrusted sources". So, how then, you might ask, can they generate and install an actual `.apk` file for a PWA without requiring that you change that setting? As it turns out the answer is quite simple: Use a trusted source! - -> > As it turns out WebAPKs are managed through Google Play Services! - -I’m no rocket scientist, but based on their natural business alignment with the web, their promotion of PWAs, the lengths they’ve gone to to grant PWAs equal status on the operating system as native apps, it only seems natural that they’d eventually  _list them in the store_ . - -Additionally, if Google did start listing PWAs in the Play Store both them and Microsoft would be doing it  _leaving Apple sticking out like a sore thumb and looking like the laggard_ . Essentially, app developers would be able to target a  _massive_  number of users on a range of platforms with a single well-built PWA. But, just like developers grew to despise IE for not keeping up with the times and forcing them to jump through extra hoops to support it, the same thing would happen here. Apple does  _not_  want to be the next IE and I’ve already seen many prominent developers suggesting they already are. - -Which bring us to another forward-looking statement: - - [### 3\. PWAs on iOS][41] - -Just a few weeks ago the Safari folks announced that Service Worker is now [officially under development][23]. - - [### 4\. PWAs everywhere][42] - -I really think we’ll start seeing them everywhere: - -* Inside VR/AR/MR experiences - -* Inside chat bots (again, pulling up an ad-hoc interface is so much more efficient). - -* Inside Xbox?! - -As it turns out, if you look at Microsoft’s status page for Edge about Service Worker you see this: - -![](https://d33wubrfki0l68.cloudfront.net/6e28110b29d042e6472c3512748ecb9f541dcb67/a2b7d/images/2/edge.png) - -I hinted at this already, but I also think PWAs pair very nicely with virtual assistants being able to pull up an PWA on a whim without requiring it to already be installed would add tremendous power to the virtual assistant. Incidentally, this also becomes easier if there’s a known "registered" name of a PWA listed in an app store. - -Some other fun use cases: - -* Apparently the new digital menu displays in McDonald’s Restaurants (at least in the U.S.) are actually a web app built with Polymer ([source][15]). I don’t know if there’s a Service Worker or not, but it would make sense for there to be. - -* Sports score boards!? I’m a [independent consultant][16], and someone approached me about potentially using a set of TVs and web apps to build a score keeping system at an arena. Point is, there are so many cool examples! - -The web really is the universal platform! - - [### For those who think PWAs are just a Google thing][43] - -First off, I’m pretty sure Microsoft, Opera, Firefox, and Samsung folks would want to punch you for that. It [simply isn’t true][24] and increasingly we’re seeing a lot more compatibility efforts between browser vendors. - -For example: check out the [Web Platform Tests][25] which is essentially Continuous Integration for web features that are run against new releases of major browsers. Some folks will recall that when Apple first claimed they implemented IndexedDb in Safari, the version they shipped was essentially unusable because it had major shortcomings and bugs. - -Now, with the WPTs, you can drill into these features (to quite some detail) and see whether a given browser passes or fails. No more claiming "we shipped!" but not actually shipping. - - [### What about feature "x" on platform "y" that we need?][44] - -It could well be that you have a need that isn’t yet covered by the web platform. In reality, that list is getting shorter and shorter, also... HAVE YOU ASKED?! Despite what it may feel like, browser vendors eagerly want to know what you’re trying to do that you can’t. If there are missing features, be loud, be nice, but from my experience it’s worth making your desires known. - -Also, it doesn’t take much to wrap a web view and add hooks into the native OS that your JavaScript can call to do things that aren’t  _quite_  possible yet. - -But that also brings me to another point, in terms of investing, as the world’s greatest hockey player said: - -> Skate to where the puck is going, not where it has been. -> -> – Wayne Gretzky - -Based on what I’ve outlined thus far, it could be more risky to building an entire application for a whole other platform that you ultimately may not need than to at least exhaust your options seeing what you can do with the Web first. - -So to line ’em up in terms of PWA support: - -* Chrome: yup - -* Firefox: yup - -* Opera: yup - -* Samsung Internet ([the 3rd largest browser surprise!][17]): yup - -* Microsoft: huge public commitment - -* Safari: at least implementing Service Worker - - [### Ask them add your feature!][45] - -Sure, it may not happen, it may take a long time but  _at least_  try. Remember, developers have a lot more influence over platforms than we typically realize. Make. your. voice. heard. - - [### Side note about React-Native/Expo][46] - -These projects are run by awesome people, the tech is incredibly impressive. If you’re Facebook and you’re trying to consolidate your development efforts, for the same basic reasons as why it makes sense for them to create their on [VM for running PHP][26]. They have realities to deal with at a scale that most of us will never have to deal with. Personally, I’m not Facebook. - -As a side note, I find it interesting that building native apps and having as many people do that as possible, plays nicely into their advertising competition with Google. - -It just so happens that Google is well positioned to capitalize off of people using the Web. Inversely, I’m fairly certain Facebook wouldn’t mind that ad revenue  _not_  going Google. Facebook, seemingly would much rather  _be_  your web, that be part of the Web. - -Anyway, all that aside, for me it’s also about investing well. - -By building a native app you’re volunteering for a 30% app-store tax. Plus, like we covered earlier odds are that no one wants to go download your app. Also, though it seems incredibly unlikely, I feel compelled to point out that in terms of "openness" Apple’s App Store is very clearly  _anything_  but that. Apple could decide one day that they really don’t like how it’s possible to essentially circumvent their normal update/review process when you use Expo. One day they could just decide to reject all React Native apps. I really don’t think they would because of the uproar it would cause. I’m simply pointing out that it’s  _their_  platform and they would have  _every_  right to do so. - - [### So is it all about investing for your own gain?][47] - -So far, I’ve presented all this from kind of a cold, heartless investor perspective: getting the most for your time. - -But, that’s not the whole story is it? - -Life isn’t all about me. Life isn’t all about us. - -I want to invest in platforms that increase opportunities **for others**. Personally, I really hope the next friggin’ Mark Zuckerburg isn’t an ivy-league dude. Wouldn’t it be amazing if instead the next huge success was, I don’t know, perhaps a young woman in Nairobi or something? The thing is, if owning an iPhone is a prerequisite for building apps, it  _dramatically_  decreases the odds of something like that happening. I feel like the Web really is the closest thing we have to a level playing field. - -**I want to invest in and improve  _that_  platform!** - -This quote really struck me and has stayed with me when thinking about these things: - -> If you’re the kind of person who tends to succeed in what you start, -> -> changing what you start could be  _the most extraordinary thing_  you could do. -> -> – Anand Giridharadas - -Thanks for your valuable attention ❤️. I’ve presented the facts as I see them and I’ve done my best not to "should on you." - -Ultimately though, no matter how prepared we are or how much research we’ve done; investing is always a bit of a gamble. - -So I guess the only thing left to say is: - -> > I’m all in. - --------------------------------------------------------------------------------- - -via: https://joreteg.com/blog/betting-on-the-web - -作者:[Joreteg][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://joreteg.com/ -[1]:https://twitter.com/davidbrunelle -[2]:https://twitter.com/intent/tweet?in_reply_to=905931990444244995 -[3]:https://twitter.com/intent/retweet?tweet_id=905931990444244995 -[4]:https://twitter.com/intent/like?tweet_id=905931990444244995 -[5]:https://twitter.com/davidbrunelle/status/905931990444244995/photo/1 -[6]:https://twitter.com/davidbrunelle -[7]:https://twitter.com/Starbucks -[8]:https://t.co/tEUXM8BLgP -[9]:https://twitter.com/davidbrunelle/status/905931990444244995 -[10]:https://twitter.com/davidbrunelle/status/905931990444244995/photo/1 -[11]:https://support.twitter.com/articles/20175256 -[12]:https://2017.coldfront.co/ -[13]:https://qz.com/253618/most-smartphone-users-download-zero-apps-per-month/ -[14]:http://fortune.com/2016/05/19/app-economy/ -[15]:https://twitter.com/AJStacy06/status/857628546507968512 -[16]:http://consulting.joreteg.com/ -[17]:https://medium.com/samsung-internet-dev/think-you-know-the-top-web-browsers-458a0a070175 -[18]:https://preview.starbucks.com/ -[19]:https://google.github.io/physical-web/ -[20]:https://blogs.windows.com/msedgedev/2016/07/08/the-progress-of-web-apps/ -[21]:https://alistapart.com/article/yes-that-web-project-should-be-a-pwa -[22]:https://joreteg.com/blog/installing-web-apps-for-real -[23]:https://webkit.org/status/#specification-service-workers -[24]:https://jakearchibald.github.io/isserviceworkerready/ -[25]:http://wpt.fyi/ -[26]:http://hhvm.com/ -[27]:https://joreteg.com/blog/betting-on-the-web -[28]:https://joreteg.com/blog/betting-on-the-web#quotso-what-whats-your-pointquot -[29]:https://joreteg.com/blog/betting-on-the-web#with-all-investing-comes -[30]:https://joreteg.com/blog/betting-on-the-web#are-we-building-for-the-right-platform -[31]:https://joreteg.com/blog/betting-on-the-web#are-we-building-the-right-software -[32]:https://joreteg.com/blog/betting-on-the-web#should-we-be-building-apps-at-all -[33]:https://joreteg.com/blog/betting-on-the-web#if-apps-are-so-great-why-are-we-so-quotapped-outquot -[34]:https://joreteg.com/blog/betting-on-the-web#what-sucks-about-apps -[35]:https://joreteg.com/blog/betting-on-the-web#enter-pwas -[36]:https://joreteg.com/blog/betting-on-the-web#quick-pwa-primer -[37]:https://joreteg.com/blog/betting-on-the-web#lets-talk-internet-of-things -[38]:https://joreteg.com/blog/betting-on-the-web#forward-looking-statements -[39]:https://joreteg.com/blog/betting-on-the-web#1-pwa-only-startups -[40]:https://joreteg.com/blog/betting-on-the-web#2-pwas-listed-in-app-stores -[41]:https://joreteg.com/blog/betting-on-the-web#3-pwas-on-ios -[42]:https://joreteg.com/blog/betting-on-the-web#4-pwas-everywhere -[43]:https://joreteg.com/blog/betting-on-the-web#for-those-who-think-pwas-are-just-a-google-thing -[44]:https://joreteg.com/blog/betting-on-the-web#what-about-feature-quotxquot-on-platform-quotyquot-that-we-need -[45]:https://joreteg.com/blog/betting-on-the-web#ask-them-add-your-feature -[46]:https://joreteg.com/blog/betting-on-the-web#side-note-about-react-nativeexpo -[47]:https://joreteg.com/blog/betting-on-the-web#so-is-it-all-about-investing-for-your-own-gain diff --git a/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md b/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md deleted file mode 100644 index 9eee39888a..0000000000 --- a/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md +++ /dev/null @@ -1,70 +0,0 @@ -Inside AGL: Familiar Open Source Components Ease Learning Curve -============================================================ - -![Matt Porter](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/porter-elce-agl.png?itok=E-5xG98S "Matt Porter") -Konsulko’s Matt Porter (pictured) and Scott Murray ran through the major components of the AGL’s Unified Code Base at Embedded Linux Conference Europe.[The Linux Foundation][1] - -Among the sessions at the recent [Embedded Linux Conference Europe (ELCE)][5] — 57 of which are [available on YouTube][2] -- are several reports on the Linux Foundation’s [Automotive Grade Linux project][6]. These include [an overview from AGL Community Manager Walt Miner ][3]showing how AGL’s Unified Code Base (UCB) Linux distribution is expanding from in-vehicle infotainment (IVI) to ADAS. There was even a presentation on using AGL to build a remote-controlled robot (see links below). - -Here we look at the “State of AGL: Plumbing and Services,” from Konsulko Group’s CTO Matt Porter and senior staff software engineer Scott Murray. Porter and Murray ran through the components of the current [UCB 4.0 “Daring Dab”][7] and detailed major upstream components and API bindings, many of which will be appear in the Electric Eel release due in Jan. 2018. - -Despite the automotive focus of the AGL stack, most of the components are already familiar to Linux developers. “It looks a lot like a desktop distro,” Porter told the ELCE attendees in Prague. “All these familiar friends.” - -Some of those friends include the underlying Yocto Project “Poky” with OpenEmbedded foundation, which is topped with layers like oe-core, meta-openembedded, and metanetworking. Other components are based on familiar open source software like systemd (application control), Wayland and Weston (graphics), BlueZ (Bluetooth), oFono (telephony), PulseAudio and ALSA (audio), gpsd (location), ConnMan (Internet), and wpa-supplicant (WiFi), among others. - -UCB’s application framework is controlled through a WebSocket interface to the API bindings, thereby enabling apps to talk to each other. There’s also a new W3C widget for an alternative application packaging scheme, as well as support for SmartDeviceLink, a technology developed at Ford that automatically syncs up IVI systems with mobile phones.  - -AGL UCB’s Wayland/Weston graphics layer is augmented with an “IVI shell” that works with the layer manager. “One of the unique requirements of automotive is the ability to separate aspects of the application in the layers,” said Porter. “For example, in a navigation app, the graphics rendering for the map may be completely different than the engine used for the UI decorations. One engine layers to a surface in Wayland to expose the map while the decorations and controls are handled by another layer.” - -For audio, ALSA and PulseAudio are joined by GENIVI AudioManager, which works together with PulseAudio. “We use AudioManager for policy driven audio routing,” explained Porter. “It allows you to write a very complex XML-based policy using a rules engine with audio routing.” - -UCB leans primarily on the well-known [Smack Project][8] for security, and also incorporates Tizen’s [Cynara][9] safe policy-checker service. A Cynara-enabled D-Bus daemon is used to control Cynara security policies. - -Porter and Murray went on to explain AGL’s API binding mechanism, which according to Murray “abstracts the UI from its back-end logic so you can replace it with your own custom UI.” You can re-use application logic with different UI implementations, such as moving from the default Qt to HTML5 or a native toolkit. Application binding requests and responses use JSON via HTTP or WebSocket. Binding calls can be made from applications or from other bindings, thereby enabling “stacking” of bindings. - -Porter and Murray concluded with a detailed description of each binding. These include upstream bindings currently in various stages of development. The first is a Master binding that manages the application lifecycle, including tasks such as install, uninstall, start, and terminate. Other upstream bindings include the WiFi binding and the BlueZ-based Bluetooth binding, which in the future will be upgraded with Bluetooth [PBAP][10] (Phone Book Access Profile). PBAP can connect with contacts databases on your phone, and links to the Telephony binding to replicate caller ID. - -The oFono-based Telephony binding also makes calls to the Bluetooth binding for Bluetooth Hands-Free-Profile (HFP) support. In the future, Telephony binding will add support for sent dial tones, call waiting, call forwarding, and voice modem support. - -Support for AM/FM radio is not well developed in the Linux world, so for its Radio binding, AGL started by supporting [RTL-SDR][11] code for low-end radio dongles. Future plans call for supporting specific automotive tuner devices. - -The MediaPlayer binding is in very early development, and is currently limited to GStreamer based audio playback and control. Future plans call for adding playlist controls, as well as one of the most actively sought features among manufacturers: video playback support. - -Location bindings include the [gpsd][12] based GPS binding, as well as GeoClue and GeoFence. GeoClue, which is built around the [GeoClue][13] D-Bus geolocation service, “overlaps a little with GPS, which uses the same location data,” says Porter. GeoClue also gathers location data from WiFi AP databases, 3G/4G tower info, and the GeoIP database — sources that are useful “if you’re inside or don’t have a good fix,” he added. - -GeoFence depends on the GPS binding, as well. It lets you establish a bounding box, and then track ingress and egress events. GeoFence also tracks “dwell” status, which is determined by arriving at home and staying for 10 minutes. “It then triggers some behavior based on a timeout,” said Porter. Future plans call for a customizable dwell transition time. - -While most of these Upstream bindings are well established, there are also Work in Progress (WIP) bindings that are still in the early stages, including CAN, HomeScreen, and WindowManager bindings. Farther out, there are plans to add speech recognition and text-to-speech bindings, as well as a WWAN modem binding. - -In conclusion, Porter noted: “Like any open source project, we desperately need more developers.” The Automotive Grade Linux project may seem peripheral to some developers, but it offers a nice mix of familiarity — grounded in many widely used open source projects -- along with the excitement of expanding into a new and potentially game changing computing form factor: your automobile. AGL has also demonstrated success — you can now [check out AGL in action in the 2018 Toyota Camry][14], followed in the coming month by most Toyota and Lexus vehicles sold in North America. - -Watch the complete video below: - -[视频][15] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/event/elce/2017/11/inside-agl-familiar-open-source-components-ease-learning-curve - -作者:[ ERIC BROWN][a] -译者:[译者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/ericstephenbrown -[1]:https://www.linux.com/licenses/category/linux-foundation -[2]:https://www.youtube.com/playlist?list=PLbzoR-pLrL6pISWAq-1cXP4_UZAyRtesk -[3]:https://www.youtube.com/watch?v=kfwEmjSjAzM&index=14&list=PLbzoR-pLrL6pISWAq-1cXP4_UZAyRtesk -[4]:https://www.linux.com/files/images/porter-elce-aglpng -[5]:http://events.linuxfoundation.org/events/embedded-linux-conference-europe -[6]:https://www.automotivelinux.org/ -[7]:https://www.linux.com/blog/2017/8/automotive-grade-linux-moves-ucb-40-launches-virtualization-workgroup -[8]:http://schaufler-ca.com/ -[9]:https://wiki.tizen.org/Security:Cynara -[10]:https://wiki.maemo.org/Bluetooth_PBAP -[11]:https://www.rtl-sdr.com/about-rtl-sdr/ -[12]:http://www.catb.org/gpsd/ -[13]:https://www.freedesktop.org/wiki/Software/GeoClue/ -[14]:https://www.linux.com/blog/event/automotive-linux-summit/2017/6/linux-rolls-out-toyota-and-lexus-vehicles -[15]:https://youtu.be/RgI-g5h1t8I diff --git a/sources/talk/20180117 How technology changes the rules for doing agile.md b/sources/talk/20180117 How technology changes the rules for doing agile.md deleted file mode 100644 index 1b67935509..0000000000 --- a/sources/talk/20180117 How technology changes the rules for doing agile.md +++ /dev/null @@ -1,95 +0,0 @@ -How technology changes the rules for doing agile -====== - -![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO%20Containers%20Ecosystem.png?itok=lDTaYXzk) - -More companies are trying agile and [DevOps][1] for a clear reason: Businesses want more speed and more experiments - which lead to innovations and competitive advantage. DevOps helps you gain that speed. But doing DevOps in a small group or startup and doing it at scale are two very different things. Any of us who've worked in a cross-functional group of 10 people, come up with a great solution to a problem, and then tried to apply the same patterns across a team of 100 people know the truth: It often doesn't work. This path has been so hard, in fact, that it has been easy for IT leaders to put off agile methodology for another year. - -But that time is over. If you've tried and stalled, it's time to jump back in. - -Until now, DevOps required customized answers for many organizations - lots of tweaks and elbow grease. But today, [Linux containers ][2]and Kubernetes are fueling standardization of DevOps tools and processes. That standardization will only accelerate. The technology we are using to practice the DevOps way of working has finally caught up with our desire to move faster. - -Linux containers and [Kubernetes][3] are changing the way teams interact. Moreover, on the Kubernetes platform, you can run any application you now run on Linux. What does that mean? You can run a tremendous number of enterprise apps (and handle even previously vexing coordination issues between Windows and Linux.) Finally, containers and Kubernetes will handle almost all of what you'll run tomorrow. They're being future-proofed to handle machine learning, AI, and analytics workloads - the next wave of problem-solving tools. - -**[ See our related article,[4 container adoption patterns: What you need to know. ] ][4]** - -Think about machine learning, for example. Today, people still find the patterns in much of an enterprise's data. When machines find the patterns (think machine learning), your people will be able to act on them faster. With the addition of AI, machines can not only find but also act on patterns. Today, with people doing everything, three weeks is an aggressive software development sprint cycle. With AI, machines can change code multiple times per second. Startups will use that capability - to disrupt you. - -Consider how fast you have to be to compete. If you can't make a leap of faith now to DevOps and a one week cycle, think of what will happen when that startup points its AI-fueled process at you. It's time to move to the DevOps way of working now, or get left behind as your competitors do. - -### How are containers changing how teams work? - -DevOps has frustrated many groups trying to scale this way of working to a bigger group. Many IT (and business) people are suspicious of agile: They've heard it all before - languages, frameworks, and now models (like DevOps), all promising to revolutionize application development and IT process. - -**[ Want DevOps advice from other CIOs? See our comprehensive resource, [DevOps: The IT Leader's Guide][5]. ]** - -It's not easy to "sell" quick development sprints to your stakeholders, either. Imagine if you bought a house this way. You're not going to pay a fixed amount to your builder anymore. Instead, you get something like: "We'll pour the foundation in 4 weeks and it will cost x. Then we'll frame. Then we'll do electrical. But we only know the timing on the foundation right now." People are used to buying homes with a price up front and a schedule. - -The challenge is that building software is not like building a house. The same builder builds thousands of houses that are all the same. Software projects are never the same. This is your first hurdle to get past. - -Dev and operations teams really do work differently: I know because I've worked on both sides. We incent them differently. Developers are rewarded for changing and creating, while operations pros are rewarded for reducing cost and ensuring security. We put them in different groups and generally minimize interaction. And the roles typically attract technical people who think quite differently. This situation sets IT up to fail. You have to be willing to break down these barriers. - -Think of what has traditionally happened. You throw pieces over the wall, then the business throws requirements over the wall because they are operating in "house-buying" mode: "We'll see you in 9 months." Developers build to those requirements and make changes as needed for technical constraints. Then they throw it over the wall to operations to "figure out how to run this." Operations then works diligently to make a slew of changes to align the software with their infrastructure. And what's the end result? - -More often than not, the end result isn't even recognizable to the business when they see it in its final glory. We've watched this pattern play out time and time again in our industry for the better part of two decades. It's time for a change. - -It's Linux containers that truly crack the problem - because containers close the gap between development and operations. They allow both teams to understand and design to all of the critical requirements, but still uniquely fulfill their team's responsibilities. Basically, we take out the telephone game between developers and operations. With containers, we can have smaller operations teams, even teams responsible for millions of applications, but development teams that can change software as quickly as needed. (In larger organizations, the desired pace may be faster than humans can respond on the operations side.) - -With containers, you're separating what is delivered from where it runs. Your operations teams are responsible for the host that will run the containers and the security footprint, and that's all. What does this mean? - -First, it means you can get going on DevOps now, with the team you have. That's right. Keep teams focused on the expertise they already have: With containers, just teach them the bare minimum of the required integration dependencies. - -If you try and retrain everyone, no one will be that good at anything. Containers let teams interact, but alongside a strong boundary, built around each team's strengths. Your devs know what needs to be consumed, but don't need to know how to make it run at scale. Ops teams know the core infrastructure, but don't need to know the minutiae of the app. Also, Ops teams can update apps to address new security implications, before you become the next trending data breach story. - -Teaching a large IT organization of say 30,000 people both ops and devs skills? It would take you a decade. You don't have that kind of time. - -When people talk about "building new, cloud-native apps will get us out of this problem," think critically. You can build cloud-native apps in 10-person teams, but that doesn't scale for a Fortune 1000 company. You can't just build new microservices one by one until you're somehow not reliant on your existing team: You'll end up with a siloed organization. It's an alluring idea, but you can't count on these apps to redefine your business. I haven't met a company that could fund parallel development at this scale and succeed. IT budgets are already constrained; doubling or tripling them for an extended period of time just isn't realistic. - -### When the remarkable happens: Hello, velocity - -Linux containers were made to scale. Once you start to do so, [orchestration tools like Kubernetes come into play][6] - because you'll need to run thousands of containers. Applications won't consist of just a single container, they will depend on many different pieces, all running on containers, all running as a unit. If they don't, your apps won't run well in production. - -Think of how many small gears and levers come together to run your business: The same is true for any application. Developers are responsible for all the pulleys and levers in the application. (You could have an integration nightmare if developers don't own those pieces.) At the same time, your operations team is responsible for all the pulleys and levers that make up your infrastructure, whether on-premises or in the cloud. With Kubernetes as an abstraction, your operations team can give the application the fuel it needs to run - without being experts on all those pieces. - -Developers get to experiment. The operations team keeps infrastructure secure and reliable. This combination opens up the business to take small risks that lead to innovation. Instead of having to make only a couple of bet-the-farm size bets, real experimentation happens inside the company, incrementally and quickly. - -In my experience, this is where the remarkable happens inside organizations: Because people say "How do we change planning to actually take advantage of this ability to experiment?" It forces agile planning. - -For example, KeyBank, which uses a DevOps model, containers, and Kubernetes, now deploys code every day. (Watch this [video][7] in which John Rzeszotarski, director of Continuous Delivery and Feedback at KeyBank, explains the change.) Similarly, Macquarie Bank uses DevOps and containers to put something in production every day. - -Once you push software every day, it changes every aspect of how you plan - and [accelerates the rate of change to the business][8]. "An idea can get to a customer in a day," says Luis Uguina, CDO of Macquarie's banking and financial services group. (See this [case study][9] on Red Hat's work with Macquarie Bank). - -### The right time to build something great - -The Macquarie example demonstrates the power of velocity. How would that change your approach to your business? Remember, Macquarie is not a startup. This is the type of disruptive power that CIOs face, not only from new market entrants but also from established peers. - -The developer freedom also changes the talent equation for CIOs running agile shops. Suddenly, individuals within huge companies (even those not in the hottest industries or geographies) can have great impact. Macquarie uses this dynamic as a recruiting tool, promising developers that all new hires will push something live within the first week. - -At the same time, in this day of cloud-based compute and storage power, we have more infrastructure available than ever. That's fortunate, considering the [leaps that machine learning and AI tools will soon enable][10]. - -This all adds up to this being the right time to build something great. Given the pace of innovation in the market, you need to keep building great things to keep customers loyal. So if you've been waiting to place your bet on DevOps, now is the right time. Containers and Kubernetes have changed the rules - in your favor. - -**Want more wisdom like this, IT leaders? [Sign up for our weekly email newsletter][11].** - --------------------------------------------------------------------------------- - -via: https://enterprisersproject.com/article/2018/1/how-technology-changes-rules-doing-agile - -作者:[Matt Hicks][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://enterprisersproject.com/user/matt-hicks -[1]:https://enterprisersproject.com/tags/devops -[2]:https://www.redhat.com/en/topics/containers?intcmp=701f2000000tjyaAAA -[3]:https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA -[4]:https://enterprisersproject.com/article/2017/8/4-container-adoption-patterns-what-you-need-know?sc_cid=70160000000h0aXAAQ -[5]:https://enterprisersproject.com/devops?sc_cid=70160000000h0aXAAQ -[6]:https://enterprisersproject.com/article/2017/11/how-enterprise-it-uses-kubernetes-tame-container-complexity -[7]:https://www.redhat.com/en/about/videos/john-rzeszotarski-keybank-red-hat-summit-2017?intcmp=701f2000000tjyaAAA -[8]:https://enterprisersproject.com/article/2017/11/dear-cios-stop-beating-yourselves-being-behind-transformation -[9]:https://www.redhat.com/en/resources/macquarie-bank-case-study?intcmp=701f2000000tjyaAAA -[10]:https://enterprisersproject.com/article/2018/1/4-ai-trends-watch -[11]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ diff --git a/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md b/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md deleted file mode 100644 index af352aefe1..0000000000 --- a/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md +++ /dev/null @@ -1,65 +0,0 @@ -Reflecting on the GPLv3 license for its 11th anniversary -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_vaguepatent_520x292.png?itok=_zuxUwyt) - -Last year, I missed the opportunity to write about the 10th anniversary of [GPLv3][1], the third version of the GNU General Public License. GPLv3 was officially released by the Free Software Foundation (FSF) on June 29, 2007—better known in technology history as the date Apple launched the iPhone. Now, one year later, I feel some retrospection on GPLv3 is due. For me, much of what is interesting about GPLv3 goes back somewhat further than 11 years, to the public drafting process in which I was an active participant. - -In 2005, following nearly a decade of enthusiastic self-immersion in free software, yet having had little open source legal experience to speak of, I was hired by Eben Moglen to join the Software Freedom Law Center as counsel. SFLC was then outside counsel to the FSF, and my role was conceived as focusing on the incipient public phase of the GPLv3 drafting process. This opportunity rescued me from a previous career turn that I had found rather dissatisfying. Free and open source software (FOSS) legal matters would come to be my new specialty, one that I found fascinating, gratifying, and intellectually rewarding. My work at SFLC, and particularly the trial by fire that was my work on GPLv3, served as my on-the-job training. - -GPLv3 must be understood as the product of an earlier era of FOSS, the contours of which may be difficult for some to imagine today. By the beginning of the public drafting process in 2006, Linux and open source were no longer practically synonymous, as they might have been for casual observers several years earlier, but the connection was much closer than it is now. - -Reflecting the profound impact that Linux was already having on the technology industry, everyone assumed GPL version 2 was the dominant open source licensing model. We were seeing the final shakeout of a Cambrian explosion of open source (and pseudo-open source) business models. A frothy business-fueled hype surrounded open source (for me most memorably typified by the Open Source Business Conference) that bears little resemblance to the present-day embrace of open source development by the software engineering profession. Microsoft, with its expanding patent portfolio and its competitive opposition to Linux, was commonly seen in the FOSS community as an existential threat, and the [SCO litigation][2] had created a cloud of legal risk around Linux and the GPL that had not quite dissipated. - -That environment necessarily made the drafting of GPLv3 a high-stakes affair, unprecedented in free software history. Lawyers at major technology companies and top law firms scrambled for influence over the license, convinced that GPLv3 was bound to take over and thoroughly reshape open source and all its massive associated business investment. - -A similar mindset existed within the technical community; it can be detected in the fears expressed in the final paragraph of the Linux kernel developers' momentous September 2006 [denunciation][3] of GPLv3. Those of us close to the FSF knew a little better, but I think we assumed the new license would be either an overwhelming success or a resounding failure—where "success" meant something approximating an upgrade of the existing GPLv2 project ecosystem to GPLv3, though perhaps without the kernel. The actual outcome was something in the middle. - -I have no confidence in attempts to measure open source license adoption, which have in recent years typically been used to demonstrate a loss of competitive advantage for copyleft licensing. My own experience, which is admittedly distorted by proximity to Linux and my work at Red Hat, suggests that GPLv3 has enjoyed moderate popularity as a license choice for projects launched since 2007, though most GPLv2 projects that existed before 2007, along with their post-2007 offshoots, remained on the old license. (GPLv3's sibling licenses LGPLv3 and AGPLv3 never gained comparable popularity.) Most of the existing GPLv2 projects (with a few notable exceptions like the kernel and Busybox) were licensed as "GPLv2 or any later version." The technical community decided early on that "GPLv2 or later" was a politically neutral license choice that embraced both GPLv2 and GPLv3; this goes some way to explain why adoption of GPLv3 was somewhat gradual and limited, especially within the Linux community. - -During the GPLv3 drafting process, some expressed concerns about a "balkanized" Linux ecosystem, whether because of the overhead of users having to understand two different, strong copyleft licenses or because of GPLv2/GPLv3 incompatibility. These fears turned out to be entirely unfounded. Within mainstream server and workstation Linux stacks, the two licenses have peacefully coexisted for a decade now. This is partly because such stacks are made up of separate units of strong copyleft scope (see my discussion of [related issues in the container setting][4]). As for incompatibility inside units of strong copyleft scope, here, too, the prevalence of "GPLv2 or later" was seen by the technical community as neatly resolving the theoretical problem, despite the fact that nominal license upgrading of GPLv2-or-later to GPLv3 hardly ever occurred. - -I have alluded to the handwringing that some of us FOSS license geeks have brought to the topic of supposed copyleft decline. GPLv3 has taken its share of abuse from critics as far back as the beginning of the public drafting process, and some, predictably, have drawn a link between GPLv3 in particular and GPL or copyleft disfavor in general. - -I have viewed it somewhat differently: Largely because of its complexity and baroqueness, GPLv3 was a lost opportunity to create a strong copyleft license that would appeal very broadly to modern individual software authors and corporate licensors. I believe individual developers today tend to prefer short, simple, easy to understand, minimalist licenses, the most obvious example of which is the [MIT License][5]. - -Some corporate decisionmakers around open source license selection may naturally share that view, while others may associate some parts of GPLv3, such as the patent provisions or the anti-lockdown requirements, as too risky or incompatible with their business models. The great irony is that the characteristics of GPLv3 that fail to attract these groups are there in part because of conscious attempts to make the license appeal to these same sorts of interests. - -How did GPLv3 come to be so baroque? As I have said, GPLv3 was the product of an earlier time, in which FOSS licenses were viewed as the primary instruments of project governance. (Today, we tend to associate governance with other kinds of legal or quasi-legal tools, such as structuring of nonprofit organizations, rules around project decision making, codes of conduct, and contributor agreements.) - -GPLv3, in its drafting, was the high point of an optimistic view of FOSS licenses as ambitious means of private regulation. This was already true of GPLv2, but GPLv3 took things further by addressing in detail a number of new policy problems—software patents, anti-circumvention laws, device lockdown. That was bound to make the license longer and more complex than GPLv2, as the FSF and SFLC noted apologetically in the first GPLv3 [rationale document][6]. - -But a number of other factors at play in the drafting of GPLv3 unintentionally caused the complexity of the license to grow. Lawyers representing vendors' and commercial users' interests provided useful suggestions for improvements from a legal and commercial perspective, but these often took the form of making simply worded provisions more verbose, arguably without net increases in clarity. Responses to feedback from the technical community, typically identifying loopholes in license provisions, had a similar effect. - -The GPLv3 drafters also famously got entangled in a short-term political crisis—the controversial [Microsoft/Novell deal][7] of 2006—resulting in the permanent addition of new and unusual conditions in the patent section of the license, which arguably served little purpose after 2007 other than to make license compliance harder for conscientious patent-holding vendors. Of course, some of the complexity in GPLv3 was simply the product of well-intended attempts to make compliance easier, especially for community project developers, or to codify FSF interpretive practice. Finally, one can take issue with the style of language used in GPLv3, much of which had a quality of playful parody or mockery of conventional software license legalese; a simpler, straightforward form of phrasing would in many cases have been an improvement. - -The complexity of GPLv3 and the movement towards preferring brevity and simplicity in license drafting and unambitious license policy objectives meant that the substantive text of GPLv3 would have little direct influence on later FOSS legal drafting. But, as I noted with surprise and [delight][8] back in 2012, MPL 2.0 adapted two parts of GPLv3: the 30-day cure and 60-day repose language from the GPLv3 termination provision, and the assurance that downstream upgrading to a later license version adds no new obligations on upstream licensors. - -The GPLv3 cure language has come to have a major impact, particularly over the past year. Following the Software Freedom Conservancy's promulgation, with the FSF's support, of the [Principles of Community-Oriented GPL Enforcement][9], which calls for extending GPLv3 cure opportunities to GPLv2 violations, the Linux Foundation Technical Advisory Board published a [statement][10], endorsed by over a hundred Linux kernel developers, which incorporates verbatim the cure language of GPLv3. This in turn was followed by a Red Hat-led series of [corporate commitments][11] to extend the GPLv3 cure provisions to GPLv2 and LGPLv2.x noncompliance, a campaign to get individual open source developers to extend the same commitment, and an announcement by Red Hat that henceforth GPLv2 and LGPLv2.x projects it leads will use the commitment language directly in project repositories. I discussed these developments in a recent [blog post][12]. - -One lasting contribution of GPLv3 concerns changed expectations for how revisions of widely-used FOSS licenses are done. It is no longer acceptable for such licenses to be revised entirely in private, without opportunity for comment from the community and without efforts to consult key stakeholders. The drafting of MPL 2.0 and, more recently, EPL 2.0 reflects this new norm. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/gplv3-anniversary - -作者:[Richard Fontana][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/fontana -[1]:https://www.gnu.org/licenses/gpl-3.0.en.html -[2]:https://en.wikipedia.org/wiki/SCO%E2%80%93Linux_disputes -[3]:https://lwn.net/Articles/200422/ -[4]:https://opensource.com/article/18/1/containers-gpl-and-copyleft -[5]:https://opensource.org/licenses/MIT -[6]:http://gplv3.fsf.org/gpl-rationale-2006-01-16.html -[7]:https://en.wikipedia.org/wiki/Novell#Agreement_with_Microsoft -[8]:https://opensource.com/law/12/1/the-new-mpl -[9]:https://sfconservancy.org/copyleft-compliance/principles.html -[10]:https://www.kernel.org/doc/html/v4.16/process/kernel-enforcement-statement.html -[11]:https://www.redhat.com/en/about/press-releases/technology-industry-leaders-join-forces-increase-predictability-open-source-licensing -[12]:https://www.redhat.com/en/blog/gpl-cooperation-commitment-and-red-hat-projects?source=author&term=26851 diff --git a/sources/talk/20180904 How blockchain can complement open source.md b/sources/talk/20180904 How blockchain can complement open source.md deleted file mode 100644 index 7712539f3f..0000000000 --- a/sources/talk/20180904 How blockchain can complement open source.md +++ /dev/null @@ -1,95 +0,0 @@ -How blockchain can complement open source -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/block-quilt-chain.png?itok=mECoDbrc) - -[The Cathedral and The Bazaar][1] is a classic open source story, written 20 years ago by Eric Steven Raymond. In the story, Eric describes a new revolutionary software development model where complex software projects are built without (or with a very little) central management. This new model is open source. - -Eric's story compares two models: - - * The classic model (represented by the cathedral), in which software is crafted by a small group of individuals in a closed and controlled environment through slow and stable releases. - * And the new model (represented by the bazaar), in which software is crafted in an open environment where individuals can participate freely but still produce a stable and coherent system. - - - -Some of the reasons open source is so successful can be traced back to the founding principles Eric describes. Releasing early, releasing often, and accepting the fact that many heads are inevitably better than one allows open source projects to tap into the world’s pool of talent (and few companies can match that using the closed source model). - -Two decades after Eric's reflective analysis of the hacker community, we see open source becoming dominant. It is no longer a model only for scratching a developer’s personal itch, but instead, the place where innovation happens. Even the world's [largest][2] software companies are transitioning to this model in order to continue dominating. - -### A barter system - -If we look closely at how the open source model works in practice, we realize that it is a closed system, exclusive only to open source developers and techies. The only way to influence the direction of a project is by joining the open source community, understanding the written and the unwritten rules, learning how to contribute, the coding standards, etc., and doing it yourself. - -This is how the bazaar works, and it is where the barter system analogy comes from. A barter system is a method of exchanging services and goods in return for other services and goods. In the bazaar—where the software is built—that means in order to take something, you must also be a producer yourself and give something back in return. And that is by exchanging your time and knowledge for getting something done. A bazaar is a place where open source developers interact with other open source developers and produce open source software the open source way. - -The barter system is a great step forward and an evolution from the state of self-sufficiency where everybody must be a jack of all trades. The bazaar (open source model) using the barter system allows people with common interests and different skills to gather, collaborate, and create something that no individual can create on their own. The barter system is simple and lacks complex problems of the modern monetary systems, but it also has some limitations, such as: - - * Lack of divisibility: In the absence of a common medium of exchange, a large indivisible commodity/value cannot be exchanged for a smaller commodity/value. For example, if you want to do even a small change in an open source project, you may sometimes still need to go through a high entry barrier. - * Storing value: If a project is important to your company, you may want to have a large investment/commitment in it. But since it is a barter system among open source developers, the only way to have a strong say is by employing many open source committers, and that is not always possible. - * Transferring value: If you have invested in a project (trained employees, hired open source developers) and want to move focus to another project, it is not possible to transfer expertise, reputation, and influence quickly. - * Temporal decoupling: The barter system does not provide a good mechanism for deferred or advance commitments. In the open source world, that means a user cannot express commitment or interest in a project in a measurable way in advance, or continuously for future periods. - - - -Below, we will explore how to address these limitations using the back door to the bazaar. - -### A currency system - -People are hanging at the bazaar for different reasons: Some are there to learn, some are there to scratch a personal developer's itch, and some work for large software farms. Because the only way to have a say in the bazaar is to become part of the open source community and join the barter system, in order to gain credibility in the open source world, many large software companies employ these developers and pay them in monetary value. This represents the use of a currency system to influence the bazaar. Open source is no longer only for scratching the personal developer itch. It also accounts for a significant part of the overall software production worldwide, and there are many who want to have an influence. - -Open source sets the guiding principles through which developers interact and build a coherent system in a distributed way. It dictates how a project is governed, how software is built, and how the output distributed to users. It is an open consensus model for decentralized entities for building quality software together. But the open source model does not cover how open source is subsidized. Whether it is sponsored, directly or indirectly, through intrinsic or extrinsic motivators is irrelevant to the bazaar. - -![](https://opensource.com/sites/default/files/uploads/tokenomics_-_page_4.png) - -Currently, there is no equivalent of the decentralized open source development model for subsidization purposes. The majority of open source subsidization is centralized, where typically one company dominates a project by employing the majority of the open source developers of that project. And to be honest, this is currently the best-case scenario, as it guarantees that the developers will be paid for a long period and the project will continue to flourish. - -There are also exceptions for the project monopoly scenario: For example, some Cloud Native Computing Foundation projects are developed by a large number of competing companies. Also, the Apache Software Foundation aims for their projects not to be dominated by a single vendor by encouraging diverse contributors, but most of the popular projects, in reality, are still single-vendor projects. - -What we are missing is an open and decentralized model that works like the bazaar without a central coordination and ownership, where consumers (open source users) and producers (open source developers) interact with each other, driven by market forces and open source value. In order to complement open source, such a model must also be open and decentralized, and this is why I think the blockchain technology would [fit best here][3]. - -Most of the existing blockchain (and non-blockchain) platforms that aim to subsidize open source development are targeting primarily bug bounties, small and piecemeal tasks. A few also focus on funding new open source projects. But not many aim to provide mechanisms for sustaining continued development of open source projects—basically, a system that would emulate the behavior of an open source service provider company, or open core, open source-based SaaS product company: ensuring developers get continued and predictable incentives and guiding the project development based on the priorities of the incentivizers; i.e., the users. Such a model would address the limitations of the barter system listed above: - - * Allow divisibility: If you want something small fixed, you can pay a small amount rather than the full premium of becoming an open source developer for a project. - * Storing value: You can invest a large amount into a project and ensure both its continued development and that your voice is heard. - * Transferring value: At any point, you can stop investing in the project and move funds into other projects. - * Temporal decoupling: Allow regular recurring payments and subscriptions. - - - -There would be also other benefits, purely from the fact that such a blockchain-based system is transparent and decentralized: to quantify a project’s value/usefulness based on its users’ commitment, open roadmap commitment, decentralized decision making, etc. - -### Conclusion - -On the one hand, we see large companies hiring open source developers and acquiring open source startups and even foundational platforms (such as Microsoft buying GitHub). Many, if not most, long-running successful open source projects are centralized around a single vendor. The significance of open source and its centralization is a fact. - -On the other hand, the challenges around [sustaining open source][4] software are becoming more apparent, and many are investigating this space and its foundational issues more deeply. There are a few projects with high visibility and a large number of contributors, but there are also many other still-important projects that lack enough contributors and maintainers. - -There are [many efforts][3] trying to address the challenges of open source through blockchain. These projects should improve the transparency, decentralization, and subsidization and establish a direct link between open source users and developers. This space is still very young, but it is progressing quickly, and with time, the bazaar is going to have a cryptocurrency system. - -Given enough time and adequate technology, decentralization is happening at many levels: - - * The internet is a decentralized medium that has unlocked the world’s potential for sharing and acquiring knowledge. - * Open source is a decentralized collaboration model that has unlocked the world’s potential for innovation. - * Similarly, blockchain can complement open source and become the decentralized open source subsidization model. - - - -Follow me on [Twitter][5] for other posts in this space. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/barter-currency-system - -作者:[Bilgin lbryam][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bibryam -[1]: http://catb.org/ -[2]: http://oss.cash/ -[3]: https://opensource.com/article/18/8/open-source-tokenomics -[4]: https://www.youtube.com/watch?v=VS6IpvTWwkQ -[5]: http://twitter.com/bibryam diff --git a/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md b/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md new file mode 100644 index 0000000000..b6e1a4fdd9 --- /dev/null +++ b/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md @@ -0,0 +1,278 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Rise and Demise of RSS (Old Version)) +[#]: via: (https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +The Rise and Demise of RSS (Old Version) +====== + +_A newer version of this post was published on [December 18th, 2018][1]._ + +There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. + +In the late 1990s, in the go-go years between Netscape’s IPO and the Dot-com crash, everyone could see that the web was going to be an even bigger deal than it already was, even if they didn’t know exactly how it was going to get there. One theory was that the web was about to be revolutionized by syndication. The web, originally built to enable a simple transaction between two parties—a client fetching a document from a single host server—would be broken open by new standards that could be used to repackage and redistribute entire websites through a variety of channels. Kevin Werbach, writing for _Release 1.0_, a newsletter influential among investors in the 1990s, predicted that syndication “would evolve into the core model for the Internet economy, allowing businesses and individuals to retain control over their online personae while enjoying the benefits of massive scale and scope.”[1][2] He invited his readers to imagine a future in which fencing aficionados, rather than going directly to an “online sporting goods site” or “fencing equipment retailer,” could buy a new épée directly through e-commerce widgets embedded into their favorite website about fencing.[2][3] Just like in the television world, where big networks syndicate their shows to smaller local stations, syndication on the web would allow businesses and publications to reach consumers through a multitude of intermediary sites. This would mean, as a corollary, that consumers would gain significant control over where and how they interacted with any given business or publication on the web. + +RSS was one of the standards that promised to deliver this syndicated future. To Werbach, RSS was “the leading example of a lightweight syndication protocol.”[3][4] Another contemporaneous article called RSS the first protocol to realize the potential of XML.[4][5] It was going to be a way for both users and content aggregators to create their own customized channels out of everything the web had to offer. And yet, two decades later, RSS [appears to be a dying technology][6], now used chiefly by podcasters and programmers with tech blogs. Moreover, among that latter group, RSS is perhaps used as much for its political symbolism as its actual utility. Though of course some people really do have RSS readers, stubbornly adding an RSS feed to your blog, even in 2018, is a reactionary statement. That little tangerine bubble has become a wistful symbol of defiance against a centralized web increasingly controlled by a handful of corporations, a web that hardly resembles the syndicated web of Werbach’s imagining. + +The future once looked so bright for RSS. What happened? Was its downfall inevitable, or was it precipitated by the bitter infighting that thwarted the development of a single RSS standard? + +### Muddied Water + +RSS was invented twice. This meant it never had an obvious owner, a state of affairs that spawned endless debate and acrimony. But it also suggests that RSS was an important idea whose time had come. + +In 1998, Netscape was struggling to envision a future for itself. Its flagship product, the Netscape Navigator web browser—once preferred by 80% of web users—was quickly losing ground to Internet Explorer. So Netscape decided to compete in a new arena. In May, a team was brought together to start work on what was known internally as “Project 60.”[5][7] Two months later, Netscape announced “My Netscape,” a web portal that would fight it out with other portals like Yahoo, MSN, and Excite. + +The following year, in March, Netscape announced an addition to the My Netscape portal called the “My Netscape Network.” My Netscape users could now customize their My Netscape page so that it contained “channels” featuring the most recent headlines from sites around the web. As long as your favorite website published a special file in a format dictated by Netscape, you could add that website to your My Netscape page, typically by clicking an “Add Channel” button that participating websites were supposed to add to their interfaces. A little box containing a list of linked headlines would then appear. + +![A My Netscape Network Channel][8] + +The special file that participating websites had to publish was an RSS file. In the My Netscape Network announcement, Netscape explained that RSS stood for “RDF Site Summary.”[6][9] This was somewhat of a misnomer. RDF, or the Resource Description Framework, is basically a grammar for describing certain properties of arbitrary resources. (See [my article about the Semantic Web][10] if that sounds really exciting to you.) In 1999, a draft specification for RDF was being considered by the W3C. Though RSS was supposed to be based on RDF, the example RSS document Netscape actually released didn’t use any RDF tags at all, even if it declared the RDF XML namespace. In a document that accompanied the Netscape RSS specification, Dan Libby, one of the specification’s authors, explained that “in this release of MNN, Netscape has intentionally limited the complexity of the RSS format.”[7][11] The specification was given the 0.90 version number, the idea being that subsequent versions would bring RSS more in line with the W3C’s XML specification and the evolving draft of the RDF specification. + +RSS had been cooked up by Libby and another Netscape employee, Ramanathan Guha. Guha previously worked for Apple, where he came up with something called the Meta Content Framework. MCF was a format for representing metadata about anything from web pages to local files. Guha demonstrated its power by developing an application called [HotSauce][12] that visualized relationships between files as a network of nodes suspended in 3D space. After leaving Apple for Netscape, Guha worked with a Netscape consultant named Tim Bray to produce an XML-based version of MCF, which in turn became the foundation for the W3C’s RDF draft.[8][13] It’s no surprise, then, that Guha and Libby were keen to incorporate RDF into RSS. But Libby later wrote that the original vision for an RDF-based RSS was pared back because of time constraints and the perception that RDF was “‘too complex’ for the ‘average user.’”[9][14] + +While Netscape was trying to win eyeballs in what became known as the “portal wars,” elsewhere on the web a new phenomenon known as “weblogging” was being pioneered.[10][15] One of these pioneers was Dave Winer, CEO of a company called UserLand Software, which developed early content management systems that made blogging accessible to people without deep technical fluency. Winer ran his own blog, [Scripting News][16], which today is one of the oldest blogs on the internet. More than a year before Netscape announced My Netscape Network, on December 15th, 1997, Winer published a post announcing that the blog would now be available in XML as well as HTML.[11][17] + +Dave Winer’s XML format became known as the Scripting News format. It was supposedly similar to Microsoft’s Channel Definition Format (a “push technology” standard submitted to the W3C in March, 1997), but I haven’t been able to find a file in the original format to verify that claim.[12][18] Like Netscape’s RSS, it structured the content of Winer’s blog so that it could be understood by other software applications. When Netscape released RSS 0.90, Winer and UserLand Software began to support both formats. But Winer believed that Netscape’s format was “woefully inadequate” and “missing the key thing web writers and readers need.”[13][19] It could only represent a list of links, whereas the Scripting News format could represent a series of paragraphs, each containing one or more links. + +In June, 1999, two months after Netscape’s My Netscape Network announcement, Winer introduced a new version of the Scripting News format, called ScriptingNews 2.0b1. Winer claimed that he decided to move ahead with his own format only after trying but failing to get anyone at Netscape to care about RSS 0.90’s deficiencies.[14][20] The new version of the Scripting News format added several items to the `

` element that brought the Scripting News format to parity with RSS. But the two formats continued to differ in that the Scripting News format, which Winer nicknamed the “fat” syndication format, could include entire paragraphs and not just links. + +Netscape got around to releasing RSS 0.91 the very next month. The updated specification was a major about-face. RSS no longer stood for “RDF Site Summary”; it now stood for “Rich Site Summary.” All the RDF—and there was almost none anyway—was stripped out. Many of the Scripting News tags were incorporated. In the text of the new specification, Libby explained: + +> RDF references removed. RSS was originally conceived as a metadata format providing a summary of a website. Two things have become clear: the first is that providers want more of a syndication format than a metadata format. The structure of an RDF file is very precise and must conform to the RDF data model in order to be valid. This is not easily human-understandable and can make it difficult to create useful RDF files. The second is that few tools are available for RDF generation, validation and processing. For these reasons, we have decided to go with a standard XML approach.[15][21] + +Winer was enormously pleased with RSS 0.91, calling it “even better than I thought it would be.”[16][22] UserLand Software adopted it as a replacement for the existing ScriptingNews 2.0b1 format. For a while, it seemed that RSS finally had a single authoritative specification. + +### The Great Fork + +A year later, the RSS 0.91 specification had become woefully inadequate. There were all sorts of things people were trying to do with RSS that the specification did not address. There were other parts of the specification that seemed unnecessarily constraining—each RSS channel could only contain a maximum of 15 items, for example. + +By that point, RSS had been adopted by several more organizations. Other than Netscape, which seemed to have lost interest after RSS 0.91, the big players were Dave Winer’s UserLand Software; O’Reilly Net, which ran an RSS aggregator called Meerkat; and Moreover.com, which also ran an RSS aggregator focused on news.[17][23] Via mailing list, representatives from these organizations and others regularly discussed how to improve on RSS 0.91. But there were deep disagreements about what those improvements should look like. + +The mailing list in which most of the discussion occurred was called the Syndication mailing list. [An archive of the Syndication mailing list][24] is still available. It is an amazing historical resource. It provides a moment-by-moment account of how those deep disagreements eventually led to a political rupture of the RSS community. + +On one side of the coming rupture was Winer. Winer was impatient to evolve RSS, but he wanted to change it only in relatively conservative ways. In June, 2000, he published his own RSS 0.91 specification on the UserLand website, meant to be a starting point for further development of RSS. It made no significant changes to the 0.91 specification published by Netscape. Winer claimed in a blog post that accompanied his specification that it was only a “cleanup” documenting how RSS was actually being used in the wild, which was needed because the Netscape specification was no longer being maintained.[18][25] In the same post, he argued that RSS had succeeded so far because it was simple, and that by adding namespaces or RDF back to the format—some had suggested this be done in the Syndication mailing list—it “would become vastly more complex, and IMHO, at the content provider level, would buy us almost nothing for the added complexity.” In a message to the Syndication mailing list sent around the same time, Winer suggested that these issues were important enough that they might lead him to create a fork: + +> I’m still pondering how to move RSS forward. I definitely want ICE-like stuff in RSS2, publish and subscribe is at the top of my list, but I am going to fight tooth and nail for simplicity. I love optional elements. I don’t want to go down the namespaces and schema road, or try to make it a dialect of RDF. I understand other people want to do this, and therefore I guess we’re going to get a fork. I have my own opinion about where the other fork will lead, but I’ll keep those to myself for the moment at least.[19][26] + +Arrayed against Winer were several other people, including Rael Dornfest of O’Reilly, Ian Davis (responsible for a search startup called Calaba), and a precocious, 14-year-old Aaron Swartz, who all thought that RSS needed namespaces in order to accommodate the many different things everyone wanted to do with it. On another mailing list hosted by O’Reilly, Davis proposed a namespace-based module system, writing that such a system would “make RSS as extensible as we like rather than packing in new features that over-complicate the spec.”[20][27] The “namespace camp” believed that RSS would soon be used for much more than the syndication of blog posts, so namespaces, rather than being a complication, were the only way to keep RSS from becoming unmanageable as it supported more and more use cases. + +At the root of this disagreement about namespaces was a deeper disagreement about what RSS was even for. Winer had invented his Scripting News format to syndicate the posts he wrote for his blog. Guha and Libby at Netscape had designed RSS and called it “RDF Site Summary” because in their minds it was a way of recreating a site in miniature within Netscape’s online portal. Davis, writing to the Syndication mailing list, explained his view that RSS was “originally conceived as a way of building mini sitemaps,” and that now he and others wanted to expand RSS “to encompass more types of information than simple news headlines and to cater for the new uses of RSS that have emerged over the last 12 months.”[21][28] Winer wrote a prickly reply, stating that his Scripting News format was in fact the original RSS and that it had been meant for a different purpose. Given that the people most involved in the development of RSS disagreed about why RSS had even been created, a fork seems to have been inevitable. + +The fork happened after Dornfest announced a proposed RSS 1.0 specification and formed the RSS-DEV Working Group—which would include Davis, Swartz, and several others but not Winer—to get it ready for publication. In the proposed specification, RSS once again stood for “RDF Site Summary,” because RDF had had been added back in to represent metadata properties of certain RSS elements. The specification acknowledged Winer by name, giving him credit for popularizing RSS through his “evangelism.”[22][29] But it also argued that just adding more elements to RSS without providing for extensibility with a module system—that is, what Winer was suggesting—”sacrifices scalability.” The specification went on to define a module system for RSS based on XML namespaces. + +Winer was furious that the RSS-DEV Working Group had arrogated the “RSS 1.0” name for themselves.[23][30] In another mailing list about decentralization, he described what the RSS-DEV Working Group had done as theft.[24][31] Other members of the Syndication mailing list also felt that the RSS-DEV Working Group should not have used the name “RSS” without unanimous agreement from the community on how to move RSS forward. But the Working Group stuck with the name. Dan Brickley, another member of the RSS-DEV Working Group, defended this decision by arguing that “RSS 1.0 as proposed is solidly grounded in the original RSS vision, which itself had a long heritage going back to MCF (an RDF precursor) and related specs (CDF etc).”[25][32] He essentially felt that the RSS 1.0 effort had a better claim to the RSS name than Winer did, since RDF had originally been a part of RSS. The RSS-DEV Working Group published a final version of their specification in December. That same month, Winer published his own improvement to RSS 0.91, which he called RSS 0.92, on UserLand’s website. RSS 0.92 made several small optional improvements to RSS, among which was the addition of the `` tag soon used by podcasters everywhere. RSS had officially forked. + +It’s not clear to me why a better effort was not made to involve Winer in the RSS-DEV Working Group. He was a prominent contributor to the Syndication mailing list and obviously responsible for much of RSS’ popularity, as the members of the Working Group themselves acknowledged. But Tim O’Reilly, founder and CEO of O’Reilly, explained in a UserLand discussion group that Winer more or less refused to participate: + +> A group of people involved in RSS got together to start thinking about its future evolution. Dave was part of the group. When the consensus of the group turned in a direction he didn’t like, Dave stopped participating, and characterized it as a plot by O’Reilly to take over RSS from him, despite the fact that Rael Dornfest of O’Reilly was only one of about a dozen authors of the proposed RSS 1.0 spec, and that many of those who were part of its development had at least as long a history with RSS as Dave had.[26][33] + +To this, Winer said: + +> I met with Dale [Dougherty] two weeks before the announcement, and he didn’t say anything about it being called RSS 1.0. I spoke on the phone with Rael the Friday before it was announced, again he didn’t say that they were calling it RSS 1.0. The first I found out about it was when it was publicly announced. +> +> Let me ask you a straight question. If it turns out that the plan to call the new spec “RSS 1.0” was done in private, without any heads-up or consultation, or for a chance for the Syndication list members to agree or disagree, not just me, what are you going to do? +> +> UserLand did a lot of work to create and popularize and support RSS. We walked away from that, and let your guys have the name. That’s the top level. If I want to do any further work in Web syndication, I have to use a different name. Why and how did that happen Tim?[27][34] + +I have not been able to find a discussion in the Syndication mailing list about using the RSS 1.0 name prior to the announcement of the RSS 1.0 proposal. + +RSS would fork again in 2003, when several developers frustrated with the bickering in the RSS community sought to create an entirely new format. These developers created Atom, a format that did away with RDF but embraced XML namespaces. Atom would eventually be specified by [a proposed IETF standard][35]. After the introduction of Atom, there were three competing versions of RSS: Winer’s RSS 0.92 (updated to RSS 2.0 in 2002 and renamed “Really Simple Syndication”), the RSS-DEV Working Group’s RSS 1.0, and Atom. + +### Decline + +The proliferation of competing RSS specifications may have hampered RSS in other ways that I’ll discuss shortly. But it did not stop RSS from becoming enormously popular during the 2000s. By 2004, the New York Times had started offering its headlines in RSS and had written an article explaining to the layperson what RSS was and how to use it.[28][36] Google Reader, an RSS aggregator ultimately used by millions, was launched in 2005. By 2013, RSS seemed popular enough that the New York Times, in its obituary for Aaron Swartz, called the technology “ubiquitous.”[29][37] For a while, before a third of the planet had signed up for Facebook, RSS was simply how many people stayed abreast of news on the internet. + +The New York Times published Swartz’ obituary in January, 2013. By that point, though, RSS had actually turned a corner and was well on its way to becoming an obscure technology. Google Reader was shutdown in July, 2013, ostensibly because user numbers had been falling “over the years.”[30][38] This prompted several articles from various outlets declaring that RSS was dead. But people had been declaring that RSS was dead for years, even before Google Reader’s shuttering. Steve Gillmor, writing for TechCrunch in May, 2009, advised that “it’s time to get completely off RSS and switch to Twitter” because “RSS just doesn’t cut it anymore.”[31][39] He pointed out that Twitter was basically a better RSS feed, since it could show you what people thought about an article in addition to the article itself. It allowed you to follow people and not just channels. Gillmor told his readers that it was time to let RSS recede into the background. He ended his article with a verse from Bob Dylan’s “Forever Young.” + +Today, RSS is not dead. But neither is it anywhere near as popular as it once was. Lots of people have offered explanations for why RSS lost its broad appeal. Perhaps the most persuasive explanation is exactly the one offered by Gillmor in 2009. Social networks, just like RSS, provide a feed featuring all the latest news on the internet. Social networks took over from RSS because they were simply better feeds. They also provide more benefits to the companies that own them. Some people have accused Google, for example, of shutting down Google Reader in order to encourage people to use Google+. Google might have been able to monetize Google+ in a way that it could never have monetized Google Reader. Marco Arment, the creator of Instapaper, wrote on his blog in 2013: + +> Google Reader is just the latest casualty of the war that Facebook started, seemingly accidentally: the battle to own everything. While Google did technically “own” Reader and could make some use of the huge amount of news and attention data flowing through it, it conflicted with their far more important Google+ strategy: they need everyone reading and sharing everything through Google+ so they can compete with Facebook for ad-targeting data, ad dollars, growth, and relevance.[32][40] + +So both users and technology companies realized that they got more out of using social networks than they did out of RSS. + +Another theory is that RSS was always too geeky for regular people. Even the New York Times, which seems to have been eager to adopt RSS and promote it to its audience, complained in 2006 that RSS is a “not particularly user friendly” acronym coined by “computer geeks.”[33][41] Before the RSS icon was designed in 2004, websites like the New York Times linked to their RSS feeds using little orange boxes labeled “XML,” which can only have been intimidating.[34][42] The label was perfectly accurate though, because back then clicking the link would take a hapless user to a page full of XML. [This great tweet][43] captures the essence of this explanation for RSS’ demise. Regular people never felt comfortable using RSS; it hadn’t really been designed as a consumer-facing technology and involved too many hurdles; people jumped ship as soon as something better came along. + +RSS might have been able to overcome some of these limitations if it had been further developed. Maybe RSS could have been extended somehow so that friends subscribed to the same channel could syndicate their thoughts about an article to each other. But whereas a company like Facebook was able to “move fast and break things,” the RSS developer community was stuck trying to achieve consensus. The Great RSS Fork only demonstrates how difficult it was to do that. So if we are asking ourselves why RSS is no longer popular, a good first-order explanation is that social networks supplanted it. If we ask ourselves why social networks were able to supplant it, then the answer may be that the people trying to make RSS succeed faced a problem much harder than, say, building Facebook. As Dornfest wrote to the Syndication mailing list at one point, “currently it’s the politics far more than the serialization that’s far from simple.”[35][44] + +So today we are left with centralized silos of information. In a way, we _do_ have the syndicated internet that Kevin Werbach foresaw in 1999. After all, _The Onion_ is a publication that relies on syndication through Facebook and Twitter the same way that Seinfeld relied on syndication to rake in millions after the end of its original run. But syndication on the web only happens through one of a very small number of channels, meaning that none of us “retain control over our online personae” the way that Werbach thought we would. One reason this happened is garden-variety corporate rapaciousness—RSS, an open format, didn’t give technology companies the control over data and eyeballs that they needed to sell ads, so they did not support it. But the more mundane reason is that centralized silos are just easier to design than common standards. Consensus is difficult to achieve and it takes time, but without consensus spurned developers will go off and create competing standards. The lesson here may be that if we want to see a better, more open web, we have to get better at not screwing each other over. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][45] on Twitter or subscribe to the [RSS feed][46] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> New post: This week we're traveling back in time in our DeLorean to see what it was like learning to program on early home computers. +> +> — TwoBitHistory (@TwoBitHistory) [September 2, 2018][47] + + 1. Kevin Werbach, “The Web Goes into Syndication,” Release 1.0, July 22, 1999, 1, accessed September 14, 2018, . [↩︎][48] + + 2. ibid. [↩︎][49] + + 3. Werbach, 8. [↩︎][50] + + 4. Peter Wiggin, “RSS Delivers the XML Promise,” Web Review, October 29, 1999, accessed September 14, 2018, . [↩︎][51] + + 5. Ben Hammersley, RSS and Atom (O’Reilly), 8, accessed September 14, 2018, . [↩︎][52] + + 6. “RSS 0.90 Specification,” RSS Advisory Board, accessed September 14, 2018, . [↩︎][53] + + 7. “My Netscape Network Future Directions,” RSS Advisory Board, accessed September 14, 2018, . [↩︎][54] + + 8. Tim Bray, “The RDF.net Challenge,” Ongoing by Tim Bray, May 21, 2003, accessed September 14, 2018, . [↩︎][55] + + 9. Dan Libby, “RSS: Introducing Myself,” August 24, 2000, RSS-DEV Mailing List, accessed September 14, 2018, . [↩︎][56] + + 10. Alexandra Krasne, “Browser Wars May Become Portal Wars,” CNN, accessed September 14, 2018, . [↩︎][57] + + 11. Dave Winer, “Scripting News in XML,” Scripting News, December 15, 1997, accessed September 14, 2018, . [↩︎][58] + + 12. Joseph Reagle, “RSS History,” 2004, accessed September 14, 2018, . [↩︎][59] + + 13. Dave Winer, “A Faceoff with Netscape,” Scripting News, June 16, 1999, accessed September 14, 2018, . [↩︎][60] + + 14. ibid. [↩︎][61] + + 15. Dan Libby, “RSS 0.91 Specification (Netscape),” RSS Advisory Board, accessed September 14, 2018, . [↩︎][62] + + 16. Dave Winer, “Scripting News: 7/28/1999,” Scripting News, July 28, 1999, accessed September 14, 2018, . [↩︎][63] + + 17. Oliver Willis, “RSS Aggregators?” June 19, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][64] + + 18. Dave Winer, “Scripting News: 07/07/2000,” Scripting News, July 07, 2000, accessed September 14, 2018, . [↩︎][65] + + 19. Dave Winer, “Re: RSS 0.91 Restarted,” June 9, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][66] + + 20. Leigh Dodds, “RSS Modularization,” XML.com, July 5, 2000, accessed September 14, 2018, . [↩︎][67] + + 21. Ian Davis, “Re: [syndication] RSS Modularization Demonstration,” June 28, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][68] + + 22. “RDF Site Summary (RSS) 1.0,” December 09, 2000, accessed September 14, 2018, . [↩︎][69] + + 23. Dave Winer, “Re: [syndication] Re: Thoughts, Questions, and Issues,” August 16, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][70] + + 24. Mark Pilgrim, “History of the RSS Fork,” Dive into Mark, September 5, 2002, accessed September 14, 2018, . [↩︎][71] + + 25. Dan Brickley, “RSS-Classic, RSS 1.0 and a Historical Debt,” November 7, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][72] + + 26. Tim O’Reilly, “Re: Asking Tim,” UserLand, September 20, 2000, accessed September 14, 2018, . [↩︎][73] + + 27. Dave Winer, “Re: Asking Tim,” UserLand, September 20, 2000, accessed September 14, 2018, . [↩︎][74] + + 28. John Quain, “BASICS; Fine-Tuning Your Filter for Online Information,” The New York Times, 2004, accessed September 14, 2018, . [↩︎][75] + + 29. John Schwartz, “Aaron Swartz, Internet Activist, Dies at 26,” The New York Times, January 12, 2013, accessed September 14, 2018, . [↩︎][76] + + 30. “A Second Spring of Cleaning,” Official Google Blog, March 13, 2013, accessed September 14, 2018, . [↩︎][77] + + 31. Steve Gillmor, “Rest in Peace, RSS,” TechCrunch, May 5, 2009, accessed September 14, 2018, . [↩︎][78] + + 32. Marco Arment, “Lockdown,” Marco.org, July 3, 2013, accessed September 14, 2018, . [↩︎][79] + + 33. Bob Tedeschi, “There’s a Popular New Code for Deals: RSS,” The New York Times, January 29, 2006, accessed September 14, 2018, . [↩︎][80] + + 34. “NYTimes.com RSS Feeds,” The New York Times, accessed September 14, 2018, . [↩︎][81] + + 35. Rael Dornfest, “RE: Re: [syndication] RE: RFC: Clearing Confusion for RSS, Agreement for Forward Motion,” May 31, 2001, Syndication Mailing List, accessed September 14, 2018, . [↩︎][82] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/2018/12/18/rss.html +[2]: tmp.F599d8dnXW#fn:3 +[3]: tmp.F599d8dnXW#fn:4 +[4]: tmp.F599d8dnXW#fn:5 +[5]: tmp.F599d8dnXW#fn:6 +[6]: https://trends.google.com/trends/explore?date=all&geo=US&q=rss +[7]: tmp.F599d8dnXW#fn:7 +[8]: https://twobithistory.org/images/mnn-channel.gif +[9]: tmp.F599d8dnXW#fn:8 +[10]: https://twobithistory.org/2018/05/27/semantic-web.html +[11]: tmp.F599d8dnXW#fn:9 +[12]: http://web.archive.org/web/19970703020212/http://mcf.research.apple.com:80/hs/screen_shot.html +[13]: tmp.F599d8dnXW#fn:10 +[14]: tmp.F599d8dnXW#fn:11 +[15]: tmp.F599d8dnXW#fn:12 +[16]: http://scripting.com/ +[17]: tmp.F599d8dnXW#fn:13 +[18]: tmp.F599d8dnXW#fn:14 +[19]: tmp.F599d8dnXW#fn:15 +[20]: tmp.F599d8dnXW#fn:16 +[21]: tmp.F599d8dnXW#fn:17 +[22]: tmp.F599d8dnXW#fn:18 +[23]: tmp.F599d8dnXW#fn:19 +[24]: https://groups.yahoo.com/neo/groups/syndication/info +[25]: tmp.F599d8dnXW#fn:20 +[26]: tmp.F599d8dnXW#fn:21 +[27]: tmp.F599d8dnXW#fn:22 +[28]: tmp.F599d8dnXW#fn:23 +[29]: tmp.F599d8dnXW#fn:24 +[30]: tmp.F599d8dnXW#fn:25 +[31]: tmp.F599d8dnXW#fn:26 +[32]: tmp.F599d8dnXW#fn:27 +[33]: tmp.F599d8dnXW#fn:28 +[34]: tmp.F599d8dnXW#fn:29 +[35]: https://tools.ietf.org/html/rfc4287 +[36]: tmp.F599d8dnXW#fn:30 +[37]: tmp.F599d8dnXW#fn:31 +[38]: tmp.F599d8dnXW#fn:32 +[39]: tmp.F599d8dnXW#fn:33 +[40]: tmp.F599d8dnXW#fn:34 +[41]: tmp.F599d8dnXW#fn:35 +[42]: tmp.F599d8dnXW#fn:36 +[43]: https://twitter.com/mgsiegler/status/311992206716203008 +[44]: tmp.F599d8dnXW#fn:37 +[45]: https://twitter.com/TwoBitHistory +[46]: https://twobithistory.org/feed.xml +[47]: https://twitter.com/TwoBitHistory/status/1036295112375115778?ref_src=twsrc%5Etfw +[48]: tmp.F599d8dnXW#fnref:3 +[49]: tmp.F599d8dnXW#fnref:4 +[50]: tmp.F599d8dnXW#fnref:5 +[51]: tmp.F599d8dnXW#fnref:6 +[52]: tmp.F599d8dnXW#fnref:7 +[53]: tmp.F599d8dnXW#fnref:8 +[54]: tmp.F599d8dnXW#fnref:9 +[55]: tmp.F599d8dnXW#fnref:10 +[56]: tmp.F599d8dnXW#fnref:11 +[57]: tmp.F599d8dnXW#fnref:12 +[58]: tmp.F599d8dnXW#fnref:13 +[59]: tmp.F599d8dnXW#fnref:14 +[60]: tmp.F599d8dnXW#fnref:15 +[61]: tmp.F599d8dnXW#fnref:16 +[62]: tmp.F599d8dnXW#fnref:17 +[63]: tmp.F599d8dnXW#fnref:18 +[64]: tmp.F599d8dnXW#fnref:19 +[65]: tmp.F599d8dnXW#fnref:20 +[66]: tmp.F599d8dnXW#fnref:21 +[67]: tmp.F599d8dnXW#fnref:22 +[68]: tmp.F599d8dnXW#fnref:23 +[69]: tmp.F599d8dnXW#fnref:24 +[70]: tmp.F599d8dnXW#fnref:25 +[71]: tmp.F599d8dnXW#fnref:26 +[72]: tmp.F599d8dnXW#fnref:27 +[73]: tmp.F599d8dnXW#fnref:28 +[74]: tmp.F599d8dnXW#fnref:29 +[75]: tmp.F599d8dnXW#fnref:30 +[76]: tmp.F599d8dnXW#fnref:31 +[77]: tmp.F599d8dnXW#fnref:32 +[78]: tmp.F599d8dnXW#fnref:33 +[79]: tmp.F599d8dnXW#fnref:34 +[80]: tmp.F599d8dnXW#fnref:35 +[81]: tmp.F599d8dnXW#fnref:36 +[82]: tmp.F599d8dnXW#fnref:37 diff --git a/sources/talk/20180916 The Rise and Demise of RSS.md b/sources/talk/20180916 The Rise and Demise of RSS.md deleted file mode 100644 index 8511d220d9..0000000000 --- a/sources/talk/20180916 The Rise and Demise of RSS.md +++ /dev/null @@ -1,122 +0,0 @@ -The Rise and Demise of RSS -====== -There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. - -In the late 1990s, in the go-go years between Netscape’s IPO and the Dot-com crash, everyone could see that the web was going to be an even bigger deal than it already was, even if they didn’t know exactly how it was going to get there. One theory was that the web was about to be revolutionized by syndication. The web, originally built to enable a simple transaction between two parties—a client fetching a document from a single host server—would be broken open by new standards that could be used to repackage and redistribute entire websites through a variety of channels. Kevin Werbach, writing for Release 1.0, a newsletter influential among investors in the 1990s, predicted that syndication “would evolve into the core model for the Internet economy, allowing businesses and individuals to retain control over their online personae while enjoying the benefits of massive scale and scope.” He invited his readers to imagine a future in which fencing aficionados, rather than going directly to an “online sporting goods site” or “fencing equipment retailer,” could buy a new épée directly through e-commerce widgets embedded into their favorite website about fencing. Just like in the television world, where big networks syndicate their shows to smaller local stations, syndication on the web would allow businesses and publications to reach consumers through a multitude of intermediary sites. This would mean, as a corollary, that consumers would gain significant control over where and how they interacted with any given business or publication on the web. - -RSS was one of the standards that promised to deliver this syndicated future. To Werbach, RSS was “the leading example of a lightweight syndication protocol.” Another contemporaneous article called RSS the first protocol to realize the potential of XML. It was going to be a way for both users and content aggregators to create their own customized channels out of everything the web had to offer. And yet, two decades later, RSS [appears to be a dying technology][1], now used chiefly by podcasters and programmers with tech blogs. Moreover, among that latter group, RSS is perhaps used as much for its political symbolism as its actual utility. Though of course some people really do have RSS readers, stubbornly adding an RSS feed to your blog, even in 2018, is a reactionary statement. That little tangerine bubble has become a wistful symbol of defiance against a centralized web increasingly controlled by a handful of corporations, a web that hardly resembles the syndicated web of Werbach’s imagining. - -The future once looked so bright for RSS. What happened? Was its downfall inevitable, or was it precipitated by the bitter infighting that thwarted the development of a single RSS standard? - -### Muddied Water - -RSS was invented twice. This meant it never had an obvious owner, a state of affairs that spawned endless debate and acrimony. But it also suggests that RSS was an important idea whose time had come. - -In 1998, Netscape was struggling to envision a future for itself. Its flagship product, the Netscape Navigator web browser—once preferred by 80% of web users—was quickly losing ground to Internet Explorer. So Netscape decided to compete in a new arena. In May, a team was brought together to start work on what was known internally as “Project 60.” Two months later, Netscape announced “My Netscape,” a web portal that would fight it out with other portals like Yahoo, MSN, and Excite. - -The following year, in March, Netscape announced an addition to the My Netscape portal called the “My Netscape Network.” My Netscape users could now customize their My Netscape page so that it contained “channels” featuring the most recent headlines from sites around the web. As long as your favorite website published a special file in a format dictated by Netscape, you could add that website to your My Netscape page, typically by clicking an “Add Channel” button that participating websites were supposed to add to their interfaces. A little box containing a list of linked headlines would then appear. - -![A My Netscape Network Channel][2] - -The special file that participating websites had to publish was an RSS file. In the My Netscape Network announcement, Netscape explained that RSS stood for “RDF Site Summary.” This was somewhat of a misnomer. RDF, or the Resource Description Framework, is basically a grammar for describing certain properties of arbitrary resources. (See [my article about the Semantic Web][3] if that sounds really exciting to you.) In 1999, a draft specification for RDF was being considered by the W3C. Though RSS was supposed to be based on RDF, the example RSS document Netscape actually released didn’t use any RDF tags at all, even if it declared the RDF XML namespace. In a document that accompanied the Netscape RSS specification, Dan Libby, one of the specification’s authors, explained that “in this release of MNN, Netscape has intentionally limited the complexity of the RSS format.” The specification was given the 0.90 version number, the idea being that subsequent versions would bring RSS more in line with the W3C’s XML specification and the evolving draft of the RDF specification. - -RSS had been cooked up by Libby and another Netscape employee, Ramanathan Guha. Guha previously worked for Apple, where he came up with something called the Meta Content Framework. MCF was a format for representing metadata about anything from web pages to local files. Guha demonstrated its power by developing an application called [HotSauce][4] that visualized relationships between files as a network of nodes suspended in 3D space. After leaving Apple for Netscape, Guha worked with a Netscape consultant named Tim Bray to produce an XML-based version of MCF, which in turn became the foundation for the W3C’s RDF draft. It’s no surprise, then, that Guha and Libby were keen to incorporate RDF into RSS. But Libby later wrote that the original vision for an RDF-based RSS was pared back because of time constraints and the perception that RDF was “‘too complex’ for the ‘average user.’” - -While Netscape was trying to win eyeballs in what became known as the “portal wars,” elsewhere on the web a new phenomenon known as “weblogging” was being pioneered. One of these pioneers was Dave Winer, CEO of a company called UserLand Software, which developed early content management systems that made blogging accessible to people without deep technical fluency. Winer ran his own blog, [Scripting News][5], which today is one of the oldest blogs on the internet. More than a year before Netscape announced My Netscape Network, on December 15th, 1997, Winer published a post announcing that the blog would now be available in XML as well as HTML. - -Dave Winer’s XML format became known as the Scripting News format. It was supposedly similar to Microsoft’s Channel Definition Format (a “push technology” standard submitted to the W3C in March, 1997), but I haven’t been able to find a file in the original format to verify that claim. Like Netscape’s RSS, it structured the content of Winer’s blog so that it could be understood by other software applications. When Netscape released RSS 0.90, Winer and UserLand Software began to support both formats. But Winer believed that Netscape’s format was “woefully inadequate” and “missing the key thing web writers and readers need.” It could only represent a list of links, whereas the Scripting News format could represent a series of paragraphs, each containing one or more links. - -In June, 1999, two months after Netscape’s My Netscape Network announcement, Winer introduced a new version of the Scripting News format, called ScriptingNews 2.0b1. Winer claimed that he decided to move ahead with his own format only after trying but failing to get anyone at Netscape to care about RSS 0.90’s deficiencies. The new version of the Scripting News format added several items to the `
` element that brought the Scripting News format to parity with RSS. But the two formats continued to differ in that the Scripting News format, which Winer nicknamed the “fat” syndication format, could include entire paragraphs and not just links. - -Netscape got around to releasing RSS 0.91 the very next month. The updated specification was a major about-face. RSS no longer stood for “RDF Site Summary”; it now stood for “Rich Site Summary.” All the RDF—and there was almost none anyway—was stripped out. Many of the Scripting News tags were incorporated. In the text of the new specification, Libby explained: - -> RDF references removed. RSS was originally conceived as a metadata format providing a summary of a website. Two things have become clear: the first is that providers want more of a syndication format than a metadata format. The structure of an RDF file is very precise and must conform to the RDF data model in order to be valid. This is not easily human-understandable and can make it difficult to create useful RDF files. The second is that few tools are available for RDF generation, validation and processing. For these reasons, we have decided to go with a standard XML approach. - -Winer was enormously pleased with RSS 0.91, calling it “even better than I thought it would be.” UserLand Software adopted it as a replacement for the existing ScriptingNews 2.0b1 format. For a while, it seemed that RSS finally had a single authoritative specification. - -### The Great Fork - -A year later, the RSS 0.91 specification had become woefully inadequate. There were all sorts of things people were trying to do with RSS that the specification did not address. There were other parts of the specification that seemed unnecessarily constraining—each RSS channel could only contain a maximum of 15 items, for example. - -By that point, RSS had been adopted by several more organizations. Other than Netscape, which seemed to have lost interest after RSS 0.91, the big players were Dave Winer’s UserLand Software; O’Reilly Net, which ran an RSS aggregator called Meerkat; and Moreover.com, which also ran an RSS aggregator focused on news. Via mailing list, representatives from these organizations and others regularly discussed how to improve on RSS 0.91. But there were deep disagreements about what those improvements should look like. - -The mailing list in which most of the discussion occurred was called the Syndication mailing list. [An archive of the Syndication mailing list][6] is still available. It is an amazing historical resource. It provides a moment-by-moment account of how those deep disagreements eventually led to a political rupture of the RSS community. - -On one side of the coming rupture was Winer. Winer was impatient to evolve RSS, but he wanted to change it only in relatively conservative ways. In June, 2000, he published his own RSS 0.91 specification on the UserLand website, meant to be a starting point for further development of RSS. It made no significant changes to the 0.91 specification published by Netscape. Winer claimed in a blog post that accompanied his specification that it was only a “cleanup” documenting how RSS was actually being used in the wild, which was needed because the Netscape specification was no longer being maintained. In the same post, he argued that RSS had succeeded so far because it was simple, and that by adding namespaces or RDF back to the format—some had suggested this be done in the Syndication mailing list—it “would become vastly more complex, and IMHO, at the content provider level, would buy us almost nothing for the added complexity.” In a message to the Syndication mailing list sent around the same time, Winer suggested that these issues were important enough that they might lead him to create a fork: - -> I’m still pondering how to move RSS forward. I definitely want ICE-like stuff in RSS2, publish and subscribe is at the top of my list, but I am going to fight tooth and nail for simplicity. I love optional elements. I don’t want to go down the namespaces and schema road, or try to make it a dialect of RDF. I understand other people want to do this, and therefore I guess we’re going to get a fork. I have my own opinion about where the other fork will lead, but I’ll keep those to myself for the moment at least. - -Arrayed against Winer were several other people, including Rael Dornfest of O’Reilly, Ian Davis (responsible for a search startup called Calaba), and a precocious, 14-year-old Aaron Swartz, who all thought that RSS needed namespaces in order to accommodate the many different things everyone wanted to do with it. On another mailing list hosted by O’Reilly, Davis proposed a namespace-based module system, writing that such a system would “make RSS as extensible as we like rather than packing in new features that over-complicate the spec.” The “namespace camp” believed that RSS would soon be used for much more than the syndication of blog posts, so namespaces, rather than being a complication, were the only way to keep RSS from becoming unmanageable as it supported more and more use cases. - -At the root of this disagreement about namespaces was a deeper disagreement about what RSS was even for. Winer had invented his Scripting News format to syndicate the posts he wrote for his blog. Guha and Libby at Netscape had designed RSS and called it “RDF Site Summary” because in their minds it was a way of recreating a site in miniature within Netscape’s online portal. Davis, writing to the Syndication mailing list, explained his view that RSS was “originally conceived as a way of building mini sitemaps,” and that now he and others wanted to expand RSS “to encompass more types of information than simple news headlines and to cater for the new uses of RSS that have emerged over the last 12 months.” Winer wrote a prickly reply, stating that his Scripting News format was in fact the original RSS and that it had been meant for a different purpose. Given that the people most involved in the development of RSS disagreed about why RSS had even been created, a fork seems to have been inevitable. - -The fork happened after Dornfest announced a proposed RSS 1.0 specification and formed the RSS-DEV Working Group—which would include Davis, Swartz, and several others but not Winer—to get it ready for publication. In the proposed specification, RSS once again stood for “RDF Site Summary,” because RDF had had been added back in to represent metadata properties of certain RSS elements. The specification acknowledged Winer by name, giving him credit for popularizing RSS through his “evangelism.” But it also argued that just adding more elements to RSS without providing for extensibility with a module system—that is, what Winer was suggesting—”sacrifices scalability.” The specification went on to define a module system for RSS based on XML namespaces. - -Winer was furious that the RSS-DEV Working Group had arrogated the “RSS 1.0” name for themselves. In another mailing list about decentralization, he described what the RSS-DEV Working Group had done as theft. Other members of the Syndication mailing list also felt that the RSS-DEV Working Group should not have used the name “RSS” without unanimous agreement from the community on how to move RSS forward. But the Working Group stuck with the name. Dan Brickley, another member of the RSS-DEV Working Group, defended this decision by arguing that “RSS 1.0 as proposed is solidly grounded in the original RSS vision, which itself had a long heritage going back to MCF (an RDF precursor) and related specs (CDF etc).” He essentially felt that the RSS 1.0 effort had a better claim to the RSS name than Winer did, since RDF had originally been a part of RSS. The RSS-DEV Working Group published a final version of their specification in December. That same month, Winer published his own improvement to RSS 0.91, which he called RSS 0.92, on UserLand’s website. RSS 0.92 made several small optional improvements to RSS, among which was the addition of the `` tag soon used by podcasters everywhere. RSS had officially forked. - -It’s not clear to me why a better effort was not made to involve Winer in the RSS-DEV Working Group. He was a prominent contributor to the Syndication mailing list and obviously responsible for much of RSS’ popularity, as the members of the Working Group themselves acknowledged. But Tim O’Reilly, founder and CEO of O’Reilly, explained in a UserLand discussion group that Winer more or less refused to participate: - -> A group of people involved in RSS got together to start thinking about its future evolution. Dave was part of the group. When the consensus of the group turned in a direction he didn’t like, Dave stopped participating, and characterized it as a plot by O’Reilly to take over RSS from him, despite the fact that Rael Dornfest of O’Reilly was only one of about a dozen authors of the proposed RSS 1.0 spec, and that many of those who were part of its development had at least as long a history with RSS as Dave had. - -To this, Winer said: - -> I met with Dale [Dougherty] two weeks before the announcement, and he didn’t say anything about it being called RSS 1.0. I spoke on the phone with Rael the Friday before it was announced, again he didn’t say that they were calling it RSS 1.0. The first I found out about it was when it was publicly announced. -> -> Let me ask you a straight question. If it turns out that the plan to call the new spec “RSS 1.0” was done in private, without any heads-up or consultation, or for a chance for the Syndication list members to agree or disagree, not just me, what are you going to do? -> -> UserLand did a lot of work to create and popularize and support RSS. We walked away from that, and let your guys have the name. That’s the top level. If I want to do any further work in Web syndication, I have to use a different name. Why and how did that happen Tim? - -I have not been able to find a discussion in the Syndication mailing list about using the RSS 1.0 name prior to the announcement of the RSS 1.0 proposal. - -RSS would fork again in 2003, when several developers frustrated with the bickering in the RSS community sought to create an entirely new format. These developers created Atom, a format that did away with RDF but embraced XML namespaces. Atom would eventually be specified by [a proposed IETF standard][7]. After the introduction of Atom, there were three competing versions of RSS: Winer’s RSS 0.92 (updated to RSS 2.0 in 2002 and renamed “Really Simple Syndication”), the RSS-DEV Working Group’s RSS 1.0, and Atom. - -### Decline - -The proliferation of competing RSS specifications may have hampered RSS in other ways that I’ll discuss shortly. But it did not stop RSS from becoming enormously popular during the 2000s. By 2004, the New York Times had started offering its headlines in RSS and had written an article explaining to the layperson what RSS was and how to use it. Google Reader, an RSS aggregator ultimately used by millions, was launched in 2005. By 2013, RSS seemed popular enough that the New York Times, in its obituary for Aaron Swartz, called the technology “ubiquitous.” For a while, before a third of the planet had signed up for Facebook, RSS was simply how many people stayed abreast of news on the internet. - -The New York Times published Swartz’ obituary in January, 2013. By that point, though, RSS had actually turned a corner and was well on its way to becoming an obscure technology. Google Reader was shutdown in July, 2013, ostensibly because user numbers had been falling “over the years.” This prompted several articles from various outlets declaring that RSS was dead. But people had been declaring that RSS was dead for years, even before Google Reader’s shuttering. Steve Gillmor, writing for TechCrunch in May, 2009, advised that “it’s time to get completely off RSS and switch to Twitter” because “RSS just doesn’t cut it anymore.” He pointed out that Twitter was basically a better RSS feed, since it could show you what people thought about an article in addition to the article itself. It allowed you to follow people and not just channels. Gillmor told his readers that it was time to let RSS recede into the background. He ended his article with a verse from Bob Dylan’s “Forever Young.” - -Today, RSS is not dead. But neither is it anywhere near as popular as it once was. Lots of people have offered explanations for why RSS lost its broad appeal. Perhaps the most persuasive explanation is exactly the one offered by Gillmor in 2009. Social networks, just like RSS, provide a feed featuring all the latest news on the internet. Social networks took over from RSS because they were simply better feeds. They also provide more benefits to the companies that own them. Some people have accused Google, for example, of shutting down Google Reader in order to encourage people to use Google+. Google might have been able to monetize Google+ in a way that it could never have monetized Google Reader. Marco Arment, the creator of Instapaper, wrote on his blog in 2013: - -> Google Reader is just the latest casualty of the war that Facebook started, seemingly accidentally: the battle to own everything. While Google did technically “own” Reader and could make some use of the huge amount of news and attention data flowing through it, it conflicted with their far more important Google+ strategy: they need everyone reading and sharing everything through Google+ so they can compete with Facebook for ad-targeting data, ad dollars, growth, and relevance. - -So both users and technology companies realized that they got more out of using social networks than they did out of RSS. - -Another theory is that RSS was always too geeky for regular people. Even the New York Times, which seems to have been eager to adopt RSS and promote it to its audience, complained in 2006 that RSS is a “not particularly user friendly” acronym coined by “computer geeks.” Before the RSS icon was designed in 2004, websites like the New York Times linked to their RSS feeds using little orange boxes labeled “XML,” which can only have been intimidating. The label was perfectly accurate though, because back then clicking the link would take a hapless user to a page full of XML. [This great tweet][8] captures the essence of this explanation for RSS’ demise. Regular people never felt comfortable using RSS; it hadn’t really been designed as a consumer-facing technology and involved too many hurdles; people jumped ship as soon as something better came along. - -RSS might have been able to overcome some of these limitations if it had been further developed. Maybe RSS could have been extended somehow so that friends subscribed to the same channel could syndicate their thoughts about an article to each other. But whereas a company like Facebook was able to “move fast and break things,” the RSS developer community was stuck trying to achieve consensus. The Great RSS Fork only demonstrates how difficult it was to do that. So if we are asking ourselves why RSS is no longer popular, a good first-order explanation is that social networks supplanted it. If we ask ourselves why social networks were able to supplant it, then the answer may be that the people trying to make RSS succeed faced a problem much harder than, say, building Facebook. As Dornfest wrote to the Syndication mailing list at one point, “currently it’s the politics far more than the serialization that’s far from simple.” - -So today we are left with centralized silos of information. In a way, we do have the syndicated internet that Kevin Werbach foresaw in 1999. After all, The Onion is a publication that relies on syndication through Facebook and Twitter the same way that Seinfeld relied on syndication to rake in millions after the end of its original run. But syndication on the web only happens through one of a very small number of channels, meaning that none of us “retain control over our online personae” the way that Werbach thought we would. One reason this happened is garden-variety corporate rapaciousness—RSS, an open format, didn’t give technology companies the control over data and eyeballs that they needed to sell ads, so they did not support it. But the more mundane reason is that centralized silos are just easier to design than common standards. Consensus is difficult to achieve and it takes time, but without consensus spurned developers will go off and create competing standards. The lesson here may be that if we want to see a better, more open web, we have to get better at not screwing each other over. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][9] on Twitter or subscribe to the [RSS feed][10] to make sure you know when a new post is out. - -Previously on TwoBitHistory… - -> New post: This week we're traveling back in time in our DeLorean to see what it was like learning to program on early home computers. -> -> — TwoBitHistory (@TwoBitHistory) [September 2, 2018][11] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://trends.google.com/trends/explore?date=all&geo=US&q=rss -[2]: https://twobithistory.org/images/mnn-channel.gif -[3]: https://twobithistory.org/2018/05/27/semantic-web.html -[4]: http://web.archive.org/web/19970703020212/http://mcf.research.apple.com:80/hs/screen_shot.html -[5]: http://scripting.com/ -[6]: https://groups.yahoo.com/neo/groups/syndication/info -[7]: https://tools.ietf.org/html/rfc4287 -[8]: https://twitter.com/mgsiegler/status/311992206716203008 -[9]: https://twitter.com/TwoBitHistory -[10]: https://twobithistory.org/feed.xml -[11]: https://twitter.com/TwoBitHistory/status/1036295112375115778?ref_src=twsrc%5Etfw diff --git a/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md b/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md deleted file mode 100644 index 3129e4b6f0..0000000000 --- a/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md +++ /dev/null @@ -1,74 +0,0 @@ -Why it matters that Microsoft released old versions of MS-DOS as open source -====== - -Microsoft's release of MS-DOS 1.25 and 2.0 on GitHub adopts an open source license that's compatible with GNU GPL. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) - -One open source software project I work on is the FreeDOS Project. It's a complete, free, DOS-compatible operating system that you can use to play classic DOS games, run legacy business software, or develop embedded systems. Any program that works on MS-DOS should also run on FreeDOS. - -So I took notice when Microsoft recently released the source code to MS-DOS 1.25 and 2.0 via a [GitHub repository][1]. This is a huge step for Microsoft, and I’d like to briefly explain why it is significant. - -### MS-DOS as open source software - -Some open source fans may recall that this is not the first time Microsoft has officially released the MS-DOS source code. On March 25, 2014, Microsoft posted the source code to MS-DOS 1.1 and 2.0 via the [Computer History Museum][2]. Unfortunately, this source code was released under a “look but do not touch” license that limited what you could do with it. According to the license from the 2014 source code release, users were barred from re-using it in other projects and could use it “[solely for non-commercial research, experimentation, and educational purposes.][3]” - -The museum license wasn’t friendly to open source software, and as a result, the MS-DOS source code was ignored. On the FreeDOS Project, we interpreted the “look but do not touch” license as a potential risk to FreeDOS, so we decided developers who had viewed the MS-DOS source code could not contribute to FreeDOS. - -But Microsoft’s recent MS-DOS source code release represents a significant change. This MS-DOS source code uses the MIT License (also called the Expat License). Quoting Microsoft’s [LICENSE.md][4] file on GitHub: - -> ## MS-DOS v1.25 and v2.0 Source Code -> -> Copyright © Microsoft Corporation. -> -> All rights reserved. -> -> MIT License. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -If that text looks familiar to you, it is because that’s the same text as the MIT License recognized by the [Open Source Initiative][5]. It’s also the same as the Expat License recognized by the [Free Software Foundation][6]. - -The Free Software Foundation (via GNU) says the Expat License is compatible with the [GNU General Public License][7]. Specifically, GNU describes the Expat License as “a lax, permissive non-copyleft free software license, compatible with the GNU GPL. It is sometimes ambiguously referred to as the MIT License.” Also according to GNU, when they say a license is [compatible with the GNU GPL][8], “you can combine code released under the other license [MIT/Expat License] with code released under the GNU GPL in one larger program.” - -Microsoft’s use of the MIT/Expat License for the original MS-DOS source code is significant because the license is not only open source software but free software. - -### What does it mean? - -This is great, but there’s a practical side to the source code release. You might think, “If Microsoft has released the MS-DOS source code under a license compatible with the GNU GPL, will that help FreeDOS?” - -Not really. Here's why: FreeDOS started from an original source code base, independent from MS-DOS. Certain functions and behaviors of MS-DOS were identified and documented in the comprehensive [Interrupt List by Ralf Brown][9], and we provided MS-DOS compatibility in FreeDOS by referencing the Interrupt List. But many significant fundamental technical differences remain between FreeDOS and MS-DOS. For example, FreeDOS uses a completely different memory structure and memory layout. You can’t simply forklift MS-DOS source code into FreeDOS and expect it to work. The code assumptions are quite different. - -There’s also the simple matter that these are very old versions of MS-DOS. For example, MS-DOS 2.0 was the first version to support directories and redirection. But these versions of MS-DOS did not yet include more advanced features, including networking, CDROM support, and ’386 support such as EMM386. These features have been standard in FreeDOS for a long time. - -So the MS-DOS source code release is interesting, but FreeDOS would not be able to reuse this code for any modern features anyway. FreeDOS has already surpassed these versions of MS-DOS in functionality and features. - -### Congratulations - -Still, it’s important to recognize the big step that Microsoft has taken in releasing these versions of MS-DOS as open source software. The new MS-DOS source code release on GitHub does away with the restrictive license from 2014 and adopts a recognized open source software license that is compatible with the GNU GPL. Congratulations to Microsoft for releasing MS-DOS 1.25 and 2.0 under an open source license! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/microsoft-open-source-old-versions-ms-dos - -作者:[Jim Hall][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/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://github.com/Microsoft/MS-DOS -[2]: http://www.computerhistory.org/press/ms-source-code.html -[3]: http://www.computerhistory.org/atchm/microsoft-research-license-agreement-msdos-v1-1-v2-0/ -[4]: https://github.com/Microsoft/MS-DOS/blob/master/LICENSE.md -[5]: https://opensource.org/licenses/MIT -[6]: https://directory.fsf.org/wiki/License:Expat -[7]: https://www.gnu.org/licenses/license-list.en.html#Expat -[8]: https://www.gnu.org/licenses/gpl-faq.html#WhatDoesCompatMean -[9]: http://www.cs.cmu.edu/~ralf/files.html diff --git a/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md b/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md deleted file mode 100644 index 78922f9525..0000000000 --- a/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (NSA to Open Source its Reverse Engineering Tool GHIDRA) -[#]: via: (https://itsfoss.com/nsa-ghidra-open-source) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -NSA to Open Source its Reverse Engineering Tool GHIDRA -====== - -GHIDRA – NSA’s reverse engineering tool is getting ready for a free public release this March at the [RSA Conference 2019][1] to be held in San Francisco. - -The National Security Agency (NSA) did not officially announce this – however – a senior NSA advisor, Robert Joyce’s [session description][2] on the official RSA conference website revealed about it before any official statement or announcement. - -Here’s what it mentioned: - -![][3] -Image Credits: [Twitter][4] - -In case the text in the image isn’t properly visible, let me quote the description here: - -> NSA has developed a software reverse engineering framework known as GHIDRA, which will be demonstrated for the first time at RSAC 2019. An interactive GUI capability enables reverse engineers to leverage an integrated set of features that run on a variety of platforms including Windows, Mac OS, and Linux and supports a variety of processor instruction sets. The GHISDRA platform includes all the features expected in high-end commercial tools, with new and expanded functionality NSA uniquely developed. and will be released for free public use at RSA. - -### What is GHIDRA? - -GHIDRA is a software reverse engineering framework developed by [NSA][5] that is in use by the agency for more than a decade. - -Basically, a software reverse engineering tool helps to dig up the source code of a proprietary program which further gives you the ability to detect virus threats or potential bugs. You should read how [reverse engineering][6] works to know more. - -The tool is is written in Java and quite a few people compared it to high-end commercial reverse engineering tools available like [IDA][7]. - -A [Reddit thread][8] involves more detailed discussion where you will find some ex-employees giving good amount of details before the availability of the tool. - -![NSA open source][9] - -### GHIDRA was a secret tool, how do we know about it? - -The existence of the tool was uncovered in a series of leaks by [WikiLeaks][10] as part of [Vault 7 documents of CIA][11]. - -### Is it going to be open source? - -We do think that the reverse engineering tool to be released could be made open source. Even though there is no official confirmation mentioning “open source” – but a lot of people do believe that NSA is definitely targeting the open source community to help improve their tool while also reducing their effort to maintain this tool. - -This way the tool can remain free and the open source community can help improve GHIDRA as well. - -You can also check out the existing [Vault 7 document at WikiLeaks][12] to come up with your prediction. - -### Is NSA doing a good job here? - -The reverse engineering tool is going to be available for Windows, Linux, and Mac OS for free. - -Of course, we care about the Linux platform here – which could be a very good option for people who do not want to or cannot afford a thousand dollar license for a reverse engineering tool with the best-in-class features. - -### Wrapping Up - -If GHIDRA becomes open source and is available for free, it would definitely help a lot of researchers and students and on the other side – the competitors will be forced to adjust their pricing. - -What are your thoughts about it? Is it a good thing? What do you think about the tool going open sources Let us know what you think in the comments below. - -![][13] - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/nsa-ghidra-open-source - -作者:[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.rsaconference.com/events/us19 -[2]: https://www.rsaconference.com/events/us19/agenda/sessions/16608-come-get-your-free-nsa-reverse-engineering-tool -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/come-get-your-free-nsa.jpg?fit=800%2C337&ssl=1 -[4]: https://twitter.com/0xffff0800/status/1080909700701405184 -[5]: http://nsa.gov -[6]: https://en.wikipedia.org/wiki/Reverse_engineering -[7]: https://en.wikipedia.org/wiki/Interactive_Disassembler -[8]: https://www.reddit.com/r/ReverseEngineering/comments/ace2m3/come_get_your_free_nsa_reverse_engineering_tool/ -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?resize=800%2C450&ssl=1 -[10]: https://www.wikileaks.org/ -[11]: https://en.wikipedia.org/wiki/Vault_7 -[12]: https://wikileaks.org/ciav7p1/cms/page_9536070.html -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?fit=800%2C450&ssl=1 diff --git a/sources/talk/20190115 The Art of Unix Programming, reformatted.md b/sources/talk/20190115 The Art of Unix Programming, reformatted.md deleted file mode 100644 index 73ffb4c955..0000000000 --- a/sources/talk/20190115 The Art of Unix Programming, reformatted.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Art of Unix Programming, reformatted) -[#]: via: (https://arp242.net/weblog/the-art-of-unix-programming.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -The Art of Unix Programming, reformatted -====== - -tl;dr: I reformatted Eric S. Raymond’s The Art of Unix Programming for readability; [read it here][1]. - -I recently wanted to look up a quote for an article I was writing, and I was fairly sure I had read it in The Art of Unix Programming. Eric S. Raymond (esr) has [kindly published it online][2], but it’s difficult to search as it’s distributed over many different pages, and the formatting is not exactly conducive for readability. - -I `wget --mirror`’d it to my drive, and started out with a simple [script][3] to join everything to a single page, but eventually ended up rewriting a lot of the HTML from crappy 2003 docbook-generated tagsoup to more modern standards, and I slapped on some CSS to make it more readable. - -The results are fairly nice, and it should work well in any version of any browser (I haven’t tested Internet Explorer and Edge, lacking access to a Windows computer, but I’m reasonably confident it should work without issues; if not, see the bottom of this page on how to get in touch). - -The HTML could be simplified further (so rms can read it too), but dealing with 360k lines of ill-formatted HTML is not exactly my idea of fun, so this will have to do for now. - -The entire page is self-contained. You can save it to your laptop or mobile phone and read it on a plane or whatnot. - -Why spend so much work on an IT book from 2003? I think a substantial part of the book still applies very much today, for all programmers (not just Unix programmers). For example the [Basics of the Unix Philosophy][4] was good advice in 1972, is still good advice in 2019, and will continue to be good advice well in to the future. - -Other parts have aged less gracefully; for example “since 2000, practice has been moving toward use of XML-DocBook as a documentation interchange format” doesn’t really represent the current state of things, and the [Data File Metaformats][5] section mentions XML and INI, but not JSON or YAML (as they weren’t invented until after the book was written) - -I find this adds, rather than detracts. It makes for an interesting window in to past. The downside is that the uninitiated will have a bit of a hard time distinguishing between the good and outdated parts; as a rule of thumb: if it talks about abstract concepts, it probably still applies today. If it talks about specific software, it may be outdated. - -I toyed with the idea of updating or annotating the text, but the license doesn’t allow derivative works, so that’s not going to happen. Perhaps I’ll email esr and ask nicely. Another project, for another weekend :-) - -You can mail me at [martin@arp242.net][6] or [create a GitHub issue][7] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/the-art-of-unix-programming.html - -作者:[Martin Tournoij][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: https://arp242.net/the-art-of-unix-programming/ -[2]: http://catb.org/~esr/writings/taoup/html/ -[3]: https://arp242.net/the-art-of-unix-programming/fix-taoup.py -[4]: https://arp242.net/the-art-of-unix-programming#ch01s06 -[5]: https://arp242.net/the-art-of-unix-programming/#ch05s02 -[6]: mailto:martin@arp242.net -[7]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md deleted file mode 100644 index bb7dd14943..0000000000 --- a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (No! Ubuntu is NOT Replacing Apt with Snap) -[#]: via: (https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -No! Ubuntu is NOT Replacing Apt with Snap -====== - -Stop believing the rumors that Ubuntu is planning to replace Apt with Snap in the [Ubuntu 19.04 release][1]. These are only rumors. - -![Snap replacing apt rumors][2] - -Don’t get what I am talking about? Let me give you some context. - -There is a ‘blueprint’ on Ubuntu’s launchpad website, titled ‘Replace APT with snap as default package manager’. It talks about replacing Apt (package manager at the heart of Debian) with Snap ( a new packaging system by Ubuntu). - -> Thanks to Snap, the need for APT is disappearing, fast… why don’t we use snap at the system level? - -The post further says “Imagine, for example, being able to run “sudo snap install cosmic” to upgrade to the current release, “sudo snap install –beta disco” (in March) to upgrade to a beta release, or, for that matter, “sudo snap install –edge disco” to upgrade to a pre-beta release. It would make the whole process much easier, and updates could simply be delivered as updates to the corresponding snap, which could then just be pushed to the repositories and there it is. This way, instead of having a separate release updater, it would be possible to A, run all system updates completely and silently in the background to avoid nagging the user (a la Chrome OS), and B, offer release upgrades in the GNOME software store, Mac-style, as banners, so the user can install them easily. It would make the user experience both more consistent and even more user-friendly than it currently is.” - -It might sound good and promising and if you take a look at [this link][3], even you might start believing the rumor. Why? Because at the bottom of the blueprint information, it lists Ubuntu-founder Mark Shuttleworth as the approver. - -![Apt being replaced with Snap blueprint rumor][4]Mark Shuttleworth’s name adds to the confusion - -The rumor got fanned when the Switch to Linux YouTube channel covered it. You can watch the video from around 11:30. - - - -When this ‘news’ was brought to my attention, I reached out to Alan Pope of Canonical and asked him if he or his colleagues at Canonical (Ubuntu’s parent company) could confirm it. - -Alan clarified that the so called blueprint was not associated with official Ubuntu team. It was created as a proposal by some community member not affiliated with Ubuntu. - -> That’s not anything official. Some random community person made it. Anyone can write a blueprint. -> -> Alan Pope, Canonical - -Alan further elaborated that anyone can create such blueprints and tag Mark Shuttleworth or other Ubuntu members in it. Just because Mark’s name was listed as the approver, it doesn’t mean he already approved the idea. - -Canonical has no such plans to replace Apt with Snap. It’s not as simple as the blueprint in question suggests. - -After talking with Alan, I decided to not write about this topic because I don’t want to fan baseless rumors and confuse people. - -Unfortunately, the ‘replace Apt with Snap’ blueprint is still being shared on various Ubuntu and Linux related groups and forums. Alan had to publicly dismiss these rumors in a series of tweets: - -> Seen this [#Ubuntu][5] blueprint being shared around the internet. It's not official, not a thing we're doing. Just because someone made a blueprint, doesn't make it fact. -> -> — Alan Pope 🇪🇺🇬🇧 (@popey) [February 23, 2019][6] - -I don’t want you, the It’s FOSS reader, to fell for such silly rumors so I quickly penned this article. - -If you come across ‘apt being replaced with snap’ discussion, you may tell people that it’s not true and provide them this link as a reference. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/ - -作者:[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-19-04-release-features/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/snap-replacing-apt.png?resize=800%2C450&ssl=1 -[3]: https://blueprints.launchpad.net/ubuntu/+spec/package-management-default-snap -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-snap-blueprint.jpg?ssl=1 -[5]: https://twitter.com/hashtag/Ubuntu?src=hash&ref_src=twsrc%5Etfw -[6]: https://twitter.com/popey/status/1099238146393468931?ref_src=twsrc%5Etfw diff --git a/sources/talk/20190331 Codecademy vs. The BBC Micro.md b/sources/talk/20190331 Codecademy vs. The BBC Micro.md deleted file mode 100644 index e4720315cc..0000000000 --- a/sources/talk/20190331 Codecademy vs. The BBC Micro.md +++ /dev/null @@ -1,129 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Codecademy vs. The BBC Micro) -[#]: via: (https://twobithistory.org/2019/03/31/bbc-micro.html) -[#]: author: (Two-Bit History https://twobithistory.org) - -Codecademy vs. The BBC Micro -====== - -In the late 1970s, the computer, which for decades had been a mysterious, hulking machine that only did the bidding of corporate overlords, suddenly became something the average person could buy and take home. An enthusiastic minority saw how great this was and rushed to get a computer of their own. For many more people, the arrival of the microcomputer triggered helpless anxiety about the future. An ad from a magazine at the time promised that a home computer would “give your child an unfair advantage in school.” It showed a boy in a smart blazer and tie eagerly raising his hand to answer a question, while behind him his dim-witted classmates look on sullenly. The ad and others like it implied that the world was changing quickly and, if you did not immediately learn how to use one of these intimidating new devices, you and your family would be left behind. - -In the UK, this anxiety metastasized into concern at the highest levels of government about the competitiveness of the nation. The 1970s had been, on the whole, an underwhelming decade for Great Britain. Both inflation and unemployment had been high. Meanwhile, a series of strikes put London through blackout after blackout. A government report from 1979 fretted that a failure to keep up with trends in computing technology would “add another factor to our poor industrial performance.”1 The country already seemed to be behind in the computing arena—all the great computer companies were American, while integrated circuits were being assembled in Japan and Taiwan. - -In an audacious move, the BBC, a public service broadcaster funded by the government, decided that it would solve Britain’s national competitiveness problems by helping Britons everywhere overcome their aversion to computers. It launched the _Computer Literacy Project_ , a multi-pronged educational effort that involved several TV series, a few books, a network of support groups, and a specially built microcomputer known as the BBC Micro. The project was so successful that, by 1983, an editor for BYTE Magazine wrote, “compared to the US, proportionally more of Britain’s population is interested in microcomputers.”2 The editor marveled that there were more people at the Fifth Personal Computer World Show in the UK than had been to that year’s West Coast Computer Faire. Over a sixth of Great Britain watched an episode in the first series produced for the _Computer Literacy Project_ and 1.5 million BBC Micros were ultimately sold.3 - -[An archive][1] containing every TV series produced and all the materials published for the _Computer Literacy Project_ was put on the web last year. I’ve had a huge amount of fun watching the TV series and trying to imagine what it would have been like to learn about computing in the early 1980s. But what’s turned out to be more interesting is how computing was _taught_. Today, we still worry about technology leaving people behind. Wealthy tech entrepreneurs and governments spend lots of money trying to teach kids “to code.” We have websites like Codecademy that make use of new technologies to teach coding interactively. One would assume that this approach is more effective than a goofy ’80s TV series. But is it? - -### The Computer Literacy Project - -The microcomputer revolution began in 1975 with the release of [the Altair 8800][2]. Only two years later, the Apple II, TRS-80, and Commodore PET had all been released. Sales of the new computers exploded. In 1978, the BBC explored the dramatic societal changes these new machines were sure to bring in a documentary called “Now the Chips Are Down.” - -The documentary was alarming. Within the first five minutes, the narrator explains that microelectronics will “totally revolutionize our way of life.” As eerie synthesizer music plays, and green pulses of electricity dance around a magnified microprocessor on screen, the narrator argues that the new chips are why “Japan is abandoning its ship building, and why our children will grow up without jobs to go to.” The documentary goes on to explore how robots are being used to automate car assembly and how the European watch industry has lost out to digital watch manufacturers in the United States. It castigates the British government for not doing more to prepare the country for a future of mass unemployment. - -The documentary was supposedly shown to the British Cabinet.4 Several government agencies, including the Department of Industry and the Manpower Services Commission, became interested in trying to raise awareness about computers among the British public. The Manpower Services Commission provided funds for a team from the BBC’s education division to travel to Japan, the United States, and other countries on a fact-finding trip. This research team produced a report that cataloged the ways in which microelectronics would indeed mean major changes for industrial manufacturing, labor relations, and office work. In late 1979, it was decided that the BBC should make a ten-part TV series that would help regular Britons “learn how to use and control computers and not feel dominated by them.”5 The project eventually became a multimedia endeavor similar to the _Adult Literacy Project_ , an earlier BBC undertaking involving both a TV series and supplemental courses that helped two million people improve their reading. - -The producers behind the _Computer Literacy Project_ were keen for the TV series to feature “hands-on” examples that viewers could try on their own if they had a microcomputer at home. These examples would have to be in BASIC, since that was the language (really the entire shell) used on almost all microcomputers. But the producers faced a thorny problem: Microcomputer manufacturers all had their own dialects of BASIC, so no matter which dialect they picked, they would inevitably alienate some large fraction of their audience. The only real solution was to create a new BASIC—BBC BASIC—and a microcomputer to go along with it. Members of the British public would be able to buy the new microcomputer and follow along without worrying about differences in software or hardware. - -The TV producers and presenters at the BBC were not capable of building a microcomputer on their own. So they put together a specification for the computer they had in mind and invited British microcomputer companies to propose a new machine that met the requirements. The specification called for a relatively powerful computer because the BBC producers felt that the machine should be able to run real, useful applications. Technical consultants for the _Computer Literacy Project_ also suggested that, if it had to be a BASIC dialect that was going to be taught to the entire nation, then it had better be a good one. (They may not have phrased it exactly that way, but I bet that’s what they were thinking.) BBC BASIC would make up for some of BASIC’s usual shortcomings by allowing for recursion and local variables.6 - -The BBC eventually decided that a Cambridge-based company called Acorn Computers would make the BBC Micro. In choosing Acorn, the BBC passed over a proposal from Clive Sinclair, who ran a company called Sinclair Research. Sinclair Research had brought mass-market microcomputing to the UK in 1980 with the Sinclair ZX80. Sinclair’s new computer, the ZX81, was cheap but not powerful enough for the BBC’s purposes. Acorn’s new prototype computer, known internally as the Proton, would be more expensive but more powerful and expandable. The BBC was impressed. The Proton was never marketed or sold as the Proton because it was instead released in December 1981 as the BBC Micro, also affectionately called “The Beeb.” You could get a 16k version for £235 and a 32k version for £335. - -In 1980, Acorn was an underdog in the British computing industry. But the BBC Micro helped establish the company’s legacy. Today, the world’s most popular microprocessor instruction set is the ARM architecture. “ARM” now stands for “Advanced RISC Machine,” but originally it stood for “Acorn RISC Machine.” ARM Holdings, the company behind the architecture, was spun out from Acorn in 1990. - -![Picture of the BBC Micro.][3] _A bad picture of a BBC Micro, taken by me at the Computer History Museum -in Mountain View, California._ - -### The Computer Programme - -A dozen different TV series were eventually produced as part of the _Computer Literacy Project_ , but the first of them was a ten-part series known as _The Computer Programme_. The series was broadcast over ten weeks at the beginning of 1982. A million people watched each week-night broadcast of the show; a quarter million watched the reruns on Sunday and Monday afternoon. - -The show was hosted by two presenters, Chris Serle and Ian McNaught-Davis. Serle plays the neophyte while McNaught-Davis, who had professional experience programming mainframe computers, plays the expert. This was an inspired setup. It made for [awkward transitions][4]—Serle often goes directly from a conversation with McNaught-Davis to a bit of walk-and-talk narration delivered to the camera, and you can’t help but wonder whether McNaught-Davis is still standing there out of frame or what. But it meant that Serle could voice the concerns that the audience would surely have. He can look intimidated by a screenful of BASIC and can ask questions like, “What do all these dollar signs mean?” At several points during the show, Serle and McNaught-Davis sit down in front of a computer and essentially pair program, with McNaught-Davis providing hints here and there while Serle tries to figure it out. It would have been much less relatable if the show had been presented by a single, all-knowing narrator. - -The show also made an effort to demonstrate the many practical applications of computing in the lives of regular people. By the early 1980s, the home computer had already begun to be associated with young boys and video games. The producers behind _The Computer Programme_ sought to avoid interviewing “impressively competent youngsters,” as that was likely “to increase the anxieties of older viewers,” a demographic that the show was trying to attract to computing.7 In the first episode of the series, Gill Nevill, the show’s “on location” reporter, interviews a woman that has bought a Commodore PET to help manage her sweet shop. The woman (her name is Phyllis) looks to be 60-something years old, yet she has no trouble using the computer to do her accounting and has even started using her PET to do computer work for other businesses, which sounds like the beginning of a promising freelance career. Phyllis says that she wouldn’t mind if the computer work grew to replace her sweet shop business since she enjoys the computer work more. This interview could instead have been an interview with a teenager about how he had modified _Breakout_ to be faster and more challenging. But that would have been encouraging to almost nobody. On the other hand, if Phyllis, of all people, can use a computer, then surely you can too. - -While the show features lots of BASIC programming, what it really wants to teach its audience is how computing works in general. The show explains these general principles with analogies. In the second episode, there is an extended discussion of the Jacquard loom, which accomplishes two things. First, it illustrates that computers are not based only on magical technology invented yesterday—some of the foundational principles of computing go back two hundred years and are about as simple as the idea that you can punch holes in card to control a weaving machine. Second, the interlacing of warp and weft threads is used to demonstrate how a binary choice (does the weft thread go above or below the warp thread?) is enough, when repeated over and over, to produce enormous variation. This segues, of course, into a discussion of how information can be stored using binary digits. - -Later in the show there is a section about a steam organ that plays music encoded in a long, segmented roll of punched card. This time the analogy is used to explain subroutines in BASIC. Serle and McNaught-Davis lay out the whole roll of punched card on the floor in the studio, then point out the segments where it looks like a refrain is being repeated. McNaught-Davis explains that a subroutine is what you would get if you cut out those repeated segments of card and somehow added an instruction to go back to the original segment that played the refrain for the first time. This is a brilliant explanation and probably one that stuck around in people’s minds for a long time afterward. - -I’ve picked out only a few examples, but I think in general the show excels at demystifying computers by explaining the principles that computers rely on to function. The show could instead have focused on teaching BASIC, but it did not. This, it turns out, was very much a conscious choice. In a retrospective written in 1983, John Radcliffe, the executive producer of the _Computer Literacy Project_ , wrote the following: - -> If computers were going to be as important as we believed, some genuine understanding of this new subject would be important for everyone, almost as important perhaps as the capacity to read and write. Early ideas, both here and in America, had concentrated on programming as the main route to computer literacy. However, as our thinking progressed, although we recognized the value of “hands-on” experience on personal micros, we began to place less emphasis on programming and more on wider understanding, on relating micros to larger machines, encouraging people to gain experience with a range of applications programs and high-level languages, and relating these to experience in the real world of industry and commerce…. Our belief was that once people had grasped these principles, at their simplest, they would be able to move further forward into the subject. - -Later, Radcliffe writes, in a similar vein: - -> There had been much debate about the main explanatory thrust of the series. One school of thought had argued that it was particularly important for the programmes to give advice on the practical details of learning to use a micro. But we had concluded that if the series was to have any sustained educational value, it had to be a way into the real world of computing, through an explanation of computing principles. This would need to be achieved by a combination of studio demonstration on micros, explanation of principles by analogy, and illustration on film of real-life examples of practical applications. Not only micros, but mini computers and mainframes would be shown. - -I love this, particularly the part about mini-computers and mainframes. The producers behind _The Computer Programme_ aimed to help Britons get situated: Where had computing been, and where was it going? What can computers do now, and what might they do in the future? Learning some BASIC was part of answering those questions, but knowing BASIC alone was not seen as enough to make someone computer literate. - -### Computer Literacy Today - -If you google “learn to code,” the first result you see is a link to Codecademy’s website. If there is a modern equivalent to the _Computer Literacy Project_ , something with the same reach and similar aims, then it is Codecademy. - -“Learn to code” is Codecademy’s tagline. I don’t think I’m the first person to point this out—in fact, I probably read this somewhere and I’m now ripping it off—but there’s something revealing about using the word “code” instead of “program.” It suggests that the important thing you are learning is how to decode the code, how to look at a screen’s worth of Python and not have your eyes glaze over. I can understand why to the average person this seems like the main hurdle to becoming a professional programmer. Professional programmers spend all day looking at computer monitors covered in gobbledygook, so, if I want to become a professional programmer, I better make sure I can decipher the gobbledygook. But dealing with syntax is not the most challenging part of being a programmer, and it quickly becomes almost irrelevant in the face of much bigger obstacles. Also, armed only with knowledge of a programming language’s syntax, you may be able to _read_ code but you won’t be able to _write_ code to solve a novel problem. - -I recently went through Codecademy’s “Code Foundations” course, which is the course that the site recommends you take if you are interested in programming (as opposed to web development or data science) and have never done any programming before. There are a few lessons in there about the history of computer science, but they are perfunctory and poorly researched. (Thank heavens for [this noble internet vigilante][5], who pointed out a particularly egregious error.) The main focus of the course is teaching you about the common structural elements of programming languages: variables, functions, control flow, loops. In other words, the course focuses on what you would need to know to start seeing patterns in the gobbledygook. - -To be fair to Codecademy, they offer other courses that look meatier. But even courses such as their “Computer Science Path” course focus almost exclusively on programming and concepts that can be represented in programs. One might argue that this is the whole point—Codecademy’s main feature is that it gives you little interactive programming lessons with automated feedback. There also just isn’t enough room to cover more because there is only so much you can stuff into somebody’s brain in a little automated lesson. But the producers at the BBC tasked with kicking off the _Computer Literacy Project_ also had this problem; they recognized that they were limited by their medium and that “the amount of learning that would take place as a result of the television programmes themselves would be limited.”8 With similar constraints on the volume of information they could convey, they chose to emphasize general principles over learning BASIC. Couldn’t Codecademy replace a lesson or two with an interactive visualization of a Jacquard loom weaving together warp and weft threads? - -I’m banging the drum for “general principles” loudly now, so let me just explain what I think they are and why they are important. There’s a book by J. Clark Scott about computers called _But How Do It Know?_ The title comes from the anecdote that opens the book. A salesman is explaining to a group of people that a thermos can keep hot food hot and cold food cold. A member of the audience, astounded by this new invention, asks, “But how do it know?” The joke of course is that the thermos is not perceiving the temperature of the food and then making a decision—the thermos is just constructed so that cold food inevitably stays cold and hot food inevitably stays hot. People anthropomorphize computers in the same way, believing that computers are digital brains that somehow “choose” to do one thing or another based on the code they are fed. But learning a few things about how computers work, even at a rudimentary level, takes the homunculus out of the machine. That’s why the Jacquard loom is such a good go-to illustration. It may at first seem like an incredible device. It reads punch cards and somehow “knows” to weave the right pattern! The reality is mundane: Each row of holes corresponds to a thread, and where there is a hole in that row the corresponding thread gets lifted. Understanding this may not help you do anything new with computers, but it will give you the confidence that you are not dealing with something magical. We should impart this sense of confidence to beginners as soon as we can. - -Alas, it’s possible that the real problem is that nobody wants to learn about the Jacquard loom. Judging by how Codecademy emphasizes the professional applications of what it teaches, many people probably start using Codecademy because they believe it will help them “level up” their careers. They believe, not unreasonably, that the primary challenge will be understanding the gobbledygook, so they want to “learn to code.” And they want to do it as quickly as possible, in the hour or two they have each night between dinner and collapsing into bed. Codecademy, which after all is a business, gives these people what they are looking for—not some roundabout explanation involving a machine invented in the 18th century. - -The _Computer Literacy Project_ , on the other hand, is what a bunch of producers and civil servants at the BBC thought would be the best way to educate the nation about computing. I admit that it is a bit elitist to suggest we should laud this group of people for teaching the masses what they were incapable of seeking out on their own. But I can’t help but think they got it right. Lots of people first learned about computing using a BBC Micro, and many of these people went on to become successful software developers or game designers. [As I’ve written before][6], I suspect learning about computing at a time when computers were relatively simple was a huge advantage. But perhaps another advantage these people had is shows like _The Computer Programme_ , which strove to teach not just programming but also how and why computers can run programs at all. After watching _The Computer Programme_ , you may not understand all the gobbledygook on a computer screen, but you don’t really need to because you know that, whatever the “code” looks like, the computer is always doing the same basic thing. After a course or two on Codecademy, you understand some flavors of gobbledygook, but to you a computer is just a magical machine that somehow turns gobbledygook into running software. That isn’t computer literacy. - -_If you enjoyed this post, more like it come out every four weeks! Follow[@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out._ - -_Previously on TwoBitHistory…_ - -> FINALLY some new damn content, amirite? -> -> Wanted to write an article about how Simula bought us object-oriented programming. It did that, but early Simula also flirted with a different vision for how OOP would work. Wrote about that instead! -> -> — TwoBitHistory (@TwoBitHistory) [February 1, 2019][9] - - 1. Robert Albury and David Allen, Microelectronics, report (1979). ↩ - - 2. Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, . ↩ - - 3. John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, [https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards Computer Literacy.pdf][10]. ↩ - - 4. David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, . ↩ - - 5. ibid. ↩ - - 6. Williams, 51. ↩ - - 7. Radcliffe, 11. ↩ - - 8. Radcliffe, 5. ↩ - - - - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2019/03/31/bbc-micro.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/ -[2]: /2018/07/22/dawn-of-the-microcomputer.html -[3]: /images/beeb.jpg -[4]: https://twitter.com/TwoBitHistory/status/1112372000742404098 -[5]: https://twitter.com/TwoBitHistory/status/1111305774939234304 -[6]: /2018/09/02/learning-basic.html -[7]: https://twitter.com/TwoBitHistory -[8]: https://twobithistory.org/feed.xml -[9]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw -[10]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf diff --git a/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md b/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md deleted file mode 100644 index db534e4457..0000000000 --- a/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco Talos details exceptionally dangerous DNS hijacking attack) -[#]: via: (https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco Talos details exceptionally dangerous DNS hijacking attack -====== -Cisco Talos says state-sponsored attackers are battering DNS to gain access to sensitive networks and systems -![Peshkova / Getty][1] - -Security experts at Cisco Talos have released a [report detailing][2] what it calls the “first known case of a domain name registry organization that was compromised for cyber espionage operations.” - -Talos calls ongoing cyber threat campaign “Sea Turtle” and said that state-sponsored attackers are abusing DNS to harvest credentials to gain access to sensitive networks and systems in a way that victims are unable to detect, which displays unique knowledge on how to manipulate DNS, Talos stated. - -**More about DNS:** - - * [DNS in the cloud: Why and why not][3] - * [DNS over HTTPS seeks to make internet use more private][4] - * [How to protect your infrastructure from DNS cache poisoning][5] - * [ICANN housecleaning revokes old DNS security key][6] - - - -By obtaining control of victims’ DNS, the attackers can change or falsify any data on the Internet, illicitly modify DNS name records to point users to actor-controlled servers; users visiting those sites would never know, Talos reported. - -DNS, routinely known as the Internet’s phonebook, is part of the global internet infrastructure that translates between familiar names and the numbers computers need to access a website or send an email. - -### Threat to DNS could spread - -At this point Talos says Sea Turtle isn't compromising organizations in the U.S. - -“While this incident is limited to targeting primarily national security organizations in the Middle East and North Africa, and we do not want to overstate the consequences of this specific campaign, we are concerned that the success of this operation will lead to actors more broadly attacking the global DNS system,” Talos stated. - -Talos reports that the ongoing operation likely began as early as January 2017 and has continued through the first quarter of 2019. “Our investigation revealed that approximately 40 different organizations across 13 different countries were compromised during this campaign,” Talos stated. “We assess with high confidence that this activity is being carried out by an advanced, state-sponsored actor that seeks to obtain persistent access to sensitive networks and systems.” - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][7] ]** - -Talos says the attackers directing the Sea Turtle campaign show signs of being highly sophisticated and have continued their attacks despite public reports of their activities. In most cases, threat actors typically stop or slow down their activities once their campaigns are publicly revealed suggesting the Sea Turtle actors are unusually brazen and may be difficult to deter going forward, Talos stated. - -In January the Department of Homeland Security (DHS) [issued an alert][8] about this activity, warning that an attacker could redirect user traffic and obtain valid encryption certificates for an organization’s domain names. - -At that time the DHS’s [Cybersecurity and Infrastructure Security Agency][9] said in its [Emergency Directive][9] that it was tracking a series of incidents targeting DNS infrastructure. CISA wrote that it “is aware of multiple executive branch agency domains that were impacted by the tampering campaign and has notified the agencies that maintain them.” - -### DNS hijacking - -CISA said that attackers have managed to intercept and redirect web and mail traffic and could target other networked services. The agency said the attacks start with compromising user credentials of an account that can make changes to DNS records. Then the attacker alters DNS records, like Address, Mail Exchanger, or Name Server records, replacing the legitimate address of the services with an address the attacker controls. - -To achieve their nefarious goals, Talos stated the Sea Turtle accomplices: - - * Use DNS hijacking through the use of actor-controlled name servers. - * Are aggressive in their pursuit targeting DNS registries and a number of registrars, including those that manage country-code top-level domains (ccTLD). - - - * Use Let’s Encrypts, Comodo, Sectigo, and self-signed certificates in their man-in-the-middle (MitM) servers to gain the initial round of credentials. - - - * Steal victim organization’s legitimate SSL certificate and use it on actor-controlled servers. - - - -Such actions also distinguish Sea Turtle from an earlier DNS exploit known as DNSpionage, which [Talos ​reported][10]​ on in November 2018. - -Talos noted “with high confidence” that these operations are distinctly different and independent from the operations performed by [DNSpionage.][11] - -In that report, Talos said a DNSpionage campaign utilized two fake, malicious websites containing job postings that were used to compromise targets via malicious Microsoft Office documents with embedded macros. The malware supported HTTP and DNS communication with the attackers. - -In a separate DNSpionage campaign, the attackers used the same IP address to redirect the DNS of legitimate .gov and private company domains. During each DNS compromise, the actor carefully generated Let's Encrypt certificates for the redirected domains. These certificates provide X.509 certificates for [Transport Layer Security (TLS)][12] free of charge to the user, Talos said. - -The Sea Turtle campaign gained initial access either by exploiting known vulnerabilities or by sending spear-phishing emails. Talos said it believes the attackers have exploited multiple known common vulnerabilities and exposures (CVEs) to either gain initial access or to move laterally within an affected organization. Talos research further shows the following known exploits of Sea Turtle include: - - * CVE-2009-1151​: PHP code injection vulnerability affecting phpMyAdmin - * CVE-2014-6271​: RCE affecting GNU bash system, specifically the SMTP (this was part of the ​Shellshock​ CVEs) - * CVE-2017-3881​: RCE by unauthenticated user with elevated privileges Cisco switches - * CVE-2017-6736​: Remote Code Exploit (RCE) for Cisco integrated Service Router 2811 - * CVE-2017-12617​: RCE affecting Apache web servers running Tomcat - * CVE-2018-0296​: ​Directory​ traversal allowing unauthorized access to Cisco Adaptive Security Appliances (ASAs) and firewalls - * CVE-2018-7600​: RCE for Website built with Drupal, aka “Drupalgeddon” - - - -“As with any initial access involving a sophisticated actor, we believe this list of CVEs to be incomplete,” Talos stated. “The actor in question can leverage known vulnerabilities as they encounter a new threat surface. This list only represents the observed behavior of the actor, not their complete capabilities.” - -Talos says that the Sea Turtle campaign continues to be highly successful for several reasons. “First, the actors employ a unique approach to gain access to the targeted networks. Most traditional security products such as IDS and IPS systems are not designed to monitor and log DNS requests,” Talos stated. “The threat actors were able to achieve this level of success because the DNS domain space system added security into the equation as an afterthought. Had more ccTLDs implemented security features such as registrar locks, attackers would be unable to redirect the targeted domains.” - -Talos said the attackers also used previously undisclosed techniques such as certificate impersonation. “This technique was successful in part because the SSL certificates were created to provide confidentiality, not integrity. The attackers stole organizations’ SSL certificates associated with security appliances such as [Cisco's Adaptive Security Appliance] to obtain VPN credentials, allowing the actors to gain access to the targeted network, and have long-term persistent access, Talos stated. - -### Cisco Talos DNS attack mitigation strategy - -To protect against Sea Turtle, Cisco recommends: - - * Use a registry lock service, which will require an out-of-band message before any changes can occur to an organization's DNS record. - * If your registrar does not offer a registry-lock service, Talos recommends implementing multi-factor authentication, such as ​DUO​, to access your organization's DNS records. - * If you suspect you were targeted by this type of intrusion, Talos recommends instituting a network-wide password reset, preferably from a computer on a trusted network. - * Apply patches, especially on internet-facing machines. Network administrators can monitor passive DNS records on their domains to check for abnormalities. - - - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/02/man-in-boat-surrounded-by-sharks_risk_fear_decision_attack_threat_by-peshkova-getty-100786972-large.jpg -[2]: https://blog.talosintelligence.com/2019/04/seaturtle.html -[3]: https://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html -[4]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html -[5]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html -[6]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html -[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[8]: https://www.networkworld.com/article/3336201/batten-down-the-dns-hatches-as-attackers-strike-feds.html -[9]: https://cyber.dhs.gov/ed/19-01/ -[10]: https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html -[11]: https://krebsonsecurity.com/tag/dnspionage/ -[12]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md b/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md deleted file mode 100644 index e202384558..0000000000 --- a/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco: DNSpionage attack adds new tools, morphs tactics) -[#]: via: (https://www.networkworld.com/article/3390666/cisco-dnspionage-attack-adds-new-tools-morphs-tactics.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco: DNSpionage attack adds new tools, morphs tactics -====== -Cisco's Talos security group says DNSpionage tools have been upgraded to be more stealthy -![Calvin Dexter / Getty Images][1] - -The group behind the Domain Name System attacks known as DNSpionage have upped their dark actions with new tools and malware to focus their attacks and better hide their activities. - -Cisco Talos security researchers, who discovered [DNSpionage][2] in November, this week warned of new exploits and capabilities of the nefarious campaign. - -**More about DNS:** - - * [DNS in the cloud: Why and why not][3] - * [DNS over HTTPS seeks to make internet use more private][4] - * [How to protect your infrastructure from DNS cache poisoning][5] - * [ICANN housecleaning revokes old DNS security key][6] - - - -“The threat actor's ongoing development of DNSpionage malware shows that the attacker continues to find new ways to avoid detection. DNS tunneling is a popular method of exfiltration for some actors and recent examples of DNSpionage show that we must ensure DNS is monitored as closely as an organization's normal proxy or weblogs,” [Talos wrote][7]. “DNS is essentially the phonebook of the internet, and when it is tampered with, it becomes difficult for anyone to discern whether what they are seeing online is legitimate.” - -In Talos’ initial report, researchers said a DNSpionage campaign targeted various businesses in the Middle East as well as United Arab Emirates government domains. It also utilized two malicious websites containing job postings that were used to compromise targets via crafted Microsoft Office documents with embedded macros. The malware supported HTTP and DNS communication with the attackers. - -In a separate DNSpionage campaign, the attackers used the same IP address to redirect the DNS of legitimate .gov and private company domains. During each DNS compromise, the actor carefully generated “Let's Encrypt” certificates for the redirected domains. These certificates provide X.509 certificates for [Transport Layer Security (TLS)][8] free of charge to the user, Talos said. - -This week Cisco said DNSpionage actors have created a new remote administrative tool that supports HTTP and DNS communication with the attackers' command and control (C2). - -“In our previous post concerning DNSpionage, we showed that the malware author used malicious macros embedded in a Microsoft Word document. In the new sample from Lebanon identified at the end of February, the attacker used an Excel document with a similar macro.” - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][9] ]** - -Talos wrote: “The malware supports HTTP and DNS communication to the C2 server. The HTTP communication is hidden in the comments in the HTML code. This time, however, the C2 server mimics the GitHub platform instead of Wikipedia. While the DNS communication follows the same method we described in our previous article, the developer added some new features in this latest version and, this time, the actor removed the debug mode.” - -Talos added that the domain used for the C2 campaign is “bizarre.” - -“The previous version of DNSpionage attempted to use legitimate-looking domains in an attempt to remain undetected. However, this newer version uses the domain ‘coldfart[.]com,’ which would be easier to spot than other APT campaigns which generally try to blend in with traffic more suitable to enterprise environments. The domain was also hosted in the U.S., which is unusual for any espionage-style attack.” - -Talos researchers said they discovered that DNSpionage added a reconnaissance phase, that ensures the payload is being dropped on specific targets rather than indiscriminately downloaded on every machine. - -This level of attack also returns information about the workstation environment, including platform-specific information, the name of the domain and the local computer, and information concerning the operating system, Talos wrote. This information is key to helping the malware select the victims only and attempts to avoid researchers or sandboxes. Again, it shows the actor's improved abilities, as they now fingerprint the victim. - -This new tactic indicates an improved level of sophistication and is likely in response to the significant amount of public interest in the campaign. - -Talos noted that there have been several other public reports of DNSpionage attacks, and in January, the U.S. Department of Homeland Security issued an [alert][10] warning users about this threat activity. - -“In addition to increased reports of threat activity, we have also discovered new evidence that the threat actors behind the DNSpionage campaign continue to change their tactics, likely in an attempt to improve the efficacy of their operations,” Talos stated. - -In April, Cisco Talos identified an undocumented malware developed in .NET. On the analyzed samples, the malware author left two different internal names in plain text: "DropperBackdoor" and "Karkoff." - -“The malware is lightweight compared to other malware due to its small size and allows remote code execution from the C2 server. There is no obfuscation and the code can be easily disassembled,” Talos wrote. - -The Karkoff malware searches for two specific anti-virus platforms: Avira and Avast and will work around them. - -“The discovery of Karkoff also shows the actor is pivoting and is increasingly attempting to avoid detection while remaining very focused on the Middle Eastern region,” Talos wrote. - -Talos distinguished DNSpionage from another DNS attack method, “[Sea Turtle][11]”, it detailed this month. Sea Turtle involves state-sponsored attackers that are abusing DNS to target organizations and harvest credentials to gain access to sensitive networks and systems in a way that victims are unable to detect. This displays unique knowledge about how to manipulate DNS, Talos stated. - -By obtaining control of victims’ DNS, attackers can change or falsify any data victims receive from the Internet, illicitly modify DNS name records to point users to actor-controlled servers and users visiting those sites would never know, Talos reported. - -“While this incident is limited to targeting primarily national security organizations in the Middle East and North Africa, and we do not want to overstate the consequences of this specific campaign, we are concerned that the success of this operation will lead to actors more broadly attacking the global DNS system,” Talos stated about Sea Turtle. - -Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3390666/cisco-dnspionage-attack-adds-new-tools-morphs-tactics.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/02/cyber_attack_threat_danger_breach_hack_security_by_calvindexter_gettyimages-860363294_2400x800-100788395-large.jpg -[2]: https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html -[3]: https://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html -[4]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html -[5]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html -[6]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html -[7]: https://blog.talosintelligence.com/2019/04/dnspionage-brings-out-karkoff.html -[8]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html -[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[10]: https://www.us-cert.gov/ncas/alerts/AA19-024A -[11]: https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190429 Cisco goes all in on WiFi 6.md b/sources/talk/20190429 Cisco goes all in on WiFi 6.md deleted file mode 100644 index decd25500a..0000000000 --- a/sources/talk/20190429 Cisco goes all in on WiFi 6.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco goes all in on WiFi 6) -[#]: via: (https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco goes all in on WiFi 6 -====== -Cisco rolls out Catalyst and Meraki WiFi 6-based access points, Catalyst 9000 switch -![undefined / Getty Images][1] - -Cisco has taken the wraps off a family of WiFi 6 access points, roaming technology and developer-community support all to make wireless a solid enterprise equal with the wired world. - -“Best-effort’ wireless for enterprise customers doesn’t cut it any more. There’s been a change in customer expectations that there will be an uninterrupted unplugged experience,” said Scott Harrell, senior vice president and general manager of enterprise networking at Cisco. **“ **It is now a wireless-first world.** ”** - -**More about 802.11ax (Wi-Fi 6)** - - * [Why 802.11ax is the next big thing in wireless][2] - * [FAQ: 802.11ax Wi-Fi][3] - * [Wi-Fi 6 (802.11ax) is coming to a router near you][4] - * [Wi-Fi 6 with OFDMA opens a world of new wireless possibilities][5] - * [802.11ax preview: Access points and routers that support Wi-Fi 6 are on tap][6] - - - -Bringing a wireless-first enterprise world together is one of the drivers behind a new family of WiFi 6-based access points (AP) for Cisco’s Catalyst and Meraki portfolios. WiFi 6 (802.11ax) is designed for high-density public or private environments. But it also will be beneficial in internet of things (IoT) deployments, and in offices that use bandwidth-hogging applications like videoconferencing. - -The Cisco Catalyst 9100 family and Meraki [MR 45/55][7] WiFi-6 access points are built on Cisco silicon and communicate via pre-802.1ax protocols. The silicon in these access points now acts a rich sensor providing IT with insights about what is going on the wireless network in real-time, and that enables faster reactions to problems and security concerns, Harrell said. - -Aside from WiFi 6, the boxes include support for visibility and communications with Zigbee, BLE and Thread protocols. The Catalyst APs support uplink speeds of 2.5 Gbps, in addition to 100 Mbps and 1 Gbps. All speeds are supported on Category 5e cabling for an industry first, as well as 10GBASE-T (IEEE 802.3bz) cabling, Cisco said. - -Wireless traffic aggregates to wired networks so and the wired network must also evolve. Technology like multi-gigabit Ethernet must be driven into the access layer, which in turn drives higher bandwidth needs at the aggregation and core layers, [Harrell said][8]. - -Handling this influx of wireless traffic was part of the reason Cisco also upgraded its iconic Catalyst 6000 with the [Catalyst 9600 this week][9]. The 9600 brings with it support for Cat 6000 features such as support for MPLS, virtual switching and IPv6, while adding or bolstering support for wireless netowrks as well as Intent-based networking (IBN) and security segmentation. The 9600 helps fill out the company’s revamped lineup which includes the 9200 family of access switches, the 9500 aggregation switch and 9800 wireless controller. - -“WiFi doesn’t exist in a vacuum – how it connects to the enterprise and the data center or the Internet is key and in Cisco’s case that key is now the 9600 which has been built to handle the increased traffic,” said Lee Doyle, principal analyst with Doyle Research. - -The new 9600 ties in with the recently [released Catalyst 9800][10], which features 40Gbps to 100Gbps performance, depending on the model, hot-patching to simplify updates and eliminate update-related downtime, Encrypted Traffic Analytics (ETA), policy-based micro- and macro-segmentation and Trustworthy solutions to detect malware on wired or wireless connected devices, Cisco said. - -All Catalyst 9000 family members support other Cisco products such as [DNA Center][11] , which controls automation capabilities, assurance setting, fabric provisioning and policy-based segmentation for enterprise wired and wireless networks. - -The new APs are pre-standard, but other vendors including Aruba, NetGear and others are also selling pre-standard 802.11ax devices. Cisco getting into the market solidifies the validity of this strategy, said Brandon Butler, a senior research analyst with IDC. - -Many experts [expect the standard][12] to be ratified late this year. - -“We expect to see volume shipments of WiFi 6 products by early next year and it being the de facto WiFi standard by 2022.” - -On top of the APs and 9600 switch, Cisco extended its software development community – [DevNet][13] – to offer WiFi 6 learning labs, sandboxes and developer resources. - -The Cisco Catalyst and Meraki access platforms are open and programmable all the way down to the chipset level, allowing applications to take advantage of network programmability, Cisco said. - -Cisco also said it had added more vendors to now include Apple, Samsung, Boingo, Presidio and Intel for its ongoing [OpenRoaming][14] project. OpenRoaming, which is in beta promises to let users move seamlessly between wireless networks and LTE without interruption. - -Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/04/cisco_catalyst_wifi_coffee-cup_coffee-beans_-100794990-large.jpg -[2]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html -[3]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html -[4]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html -[5]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html -[6]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html -[7]: https://meraki.cisco.com/lib/pdf/meraki_datasheet_MR55.pdf -[8]: https://blogs.cisco.com/news/unplugged-and-uninterrupted -[9]: https://www.networkworld.com/article/3391580/venerable-cisco-catalyst-6000-switches-ousted-by-new-catalyst-9600.html -[10]: https://www.networkworld.com/article/3321000/cisco-links-wireless-wired-worlds-with-new-catalyst-9000-switches.html -[11]: https://www.networkworld.com/article/3280988/cisco/cisco-opens-dna-center-network-control-and-management-software-to-the-devops-masses.html -[12]: https://www.networkworld.com/article/3336263/is-jumping-ahead-to-wi-fi-6-the-right-move.html -[13]: https://developer.cisco.com/wireless/?utm_campaign=colaunch-wireless19&utm_source=pressrelease&utm_medium=ciscopress-wireless-main -[14]: https://www.cisco.com/c/en/us/solutions/enterprise-networks/802-11ax-solution/openroaming.html -[15]: https://www.facebook.com/NetworkWorld/ -[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md b/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md deleted file mode 100644 index 0ddef36770..0000000000 --- a/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Vapor IO provides direct, high-speed connections from the edge to AWS) -[#]: via: (https://www.networkworld.com/article/3391922/vapor-io-provides-direct-high-speed-connections-from-the-edge-to-aws.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Vapor IO provides direct, high-speed connections from the edge to AWS -====== -With a direct fiber line, latency between the edge and the cloud can be dramatically reduced. -![Vapor IO][1] - -Edge computing startup Vapor IO now offers a direct connection between its edge containers to Amazon Web Services (AWS) via a high-speed fiber network link. - -The company said that connection between its Kinetic Edge containers and AWS will be provided by Crown Castle's Cloud Connect fiber network, which uses Amazon Direct Connect Services. This would help reduce network latency by essentially drawing a straight fiber line from Vapor IO's edge computing data centers to Amazon's cloud computing data centers. - -“When combined with Crown Castle’s high-speed Cloud Connect fiber, the Kinetic Edge lets AWS developers build applications that span the entire continuum from core to edge. By enabling new classes of applications at the edge, we make it possible for any AWS developer to unlock the next generation of real-time, innovative use cases,” wrote Matt Trifiro, chief marketing officer of Vapor IO, in a [blog post][2]. - -**[ Read also:[What is edge computing and how it’s changing the network][3] ]** - -Vapor IO clams that the connection will lower latency by as much as 75%. “Connecting workloads and data at the Kinetic Edge with workloads and data in centralized AWS data centers makes it possible to build edge applications that leverage the full power of AWS,” wrote Trifiro. - -Developers building applications at the Kinetic Edge will have access to the full suite of AWS cloud computing services, including Amazon Simple Storage Service (Amazon S3), Amazon Elastic Cloud Compute (Amazon EC2), Amazon Virtual Private Cloud (Amazon VPC), and Amazon Relational Database Service (Amazon RDS). - -Crown Castle is the largest provider of shared communications infrastructure in the U.S., with 40,000 cell towers and 60,000 miles of fiber, offering 1Gbps to 10Gbps private fiber connectivity between the Kinetic Edge and AWS. - -AWS Direct Connect is a essentially a private connection between Amazon's AWS customers and their the AWS data centers, so customers don’t have to rout their traffic over the public internet and compete with Netflix and YouTube, for example, for bandwidth. - -### How edge computing works - -The structure of [edge computing][3] is the reverse of the standard internet design. Rather than sending all the data up to central servers, as much processing as possible is done at the edge. This is to reduce the sheer volume of data coming upstream and thus reduce latency. - -With things like smart cars, even if 95% of data is eliminated that remaining, 5% can still be a lot, so moving it fast is essential. Vapor IO said it will shuttle workloads to Amazon’s USEAST and USWEST data centers, depending on location. - -This shows how the edge is up-ending the traditional internet design and moving more computing outside the traditional data center, although a connection upstream is still important because it allows for rapid movement of necessary data from the edge to the cloud, where it can be stored or processed. - -**More 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] - - - -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/3391922/vapor-io-provides-direct-high-speed-connections-from-the-edge-to-aws.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/09/vapor-io-kinetic-edge-data-center-100771510-large.jpg -[2]: https://www.vapor.io/powering-amazon-web-services-at-the-kinetic-edge/ -[3]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.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.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md b/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md deleted file mode 100644 index c676e5effb..0000000000 --- a/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco boosts SD-WAN with multicloud-to-branch access system) -[#]: via: (https://www.networkworld.com/article/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco boosts SD-WAN with multicloud-to-branch access system -====== -Cisco's SD-WAN Cloud onRamp for CoLocation can tie branch offices to private data centers in regional corporate headquarters via colocation facilities for shorter, faster, possibly more secure connections. -![istock][1] - -Cisco is looking to give traditional or legacy wide-area network users another reason to move to the [software-defined WAN world][2]. - -The company has rolled out an integrated hardware/software package called SD-WAN Cloud onRamp for CoLocation that lets customers tie distributed multicloud applications back to a local branch office or local private data center. The idea is that a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly all the way to the data center. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -“With Cisco SD-WAN Cloud onRamp for CoLocation operating regionally, connections from colocation facilities to branches are set up and configured according to traffic loads (such as video vs web browsing vs email) SLAs (requirements for low latency/jitter), and Quality of Experience for optimizing cloud application performance,” wrote Anand Oswal, senior vice president of engineering, in Cisco’s Enterprise Networking Business in a [blog about the new service][7]. - -According to Oswal, each branch or private data center is equipped with a network interface that provides a secure tunnel to the regional colocation facility. In turn, the Cloud onRamp for CoLocation establishes secure tunnels to SaaS application platforms, multi-cloud platform services, and enterprise data centers, he stated. - -Traffic is securely routed through the Cloud onRamp for CoLocation stack which includes security features such as application-aware firewalls, URL-filtering, intrusion detection/prevention, DNS-layer security, and Advanced Malware Protection (AMP) Threat Grid, as well as other network services such as load-balancing and Wide Area Application Services, Oswal wrote. - -A typical use case for the package is an enterprise that has dozens of distributed branch offices, clustered around major cities, spread over several countries. The goal is to tie each branch to enterprise data center databases, SaaS applications, and multi-cloud services while meeting service level agreements and application quality of experience, Oswal stated. - -“With virtualized Cisco SD-WAN running on regional colocation centers, the branch workforce has access to applications and data residing in AWS, Azure, and Google cloud platforms as well as SaaS providers such as Microsoft 365 and Salesforce—transparently and securely,” Oswal said. “Distributing SD-WAN features over a regional architecture also brings processing power closer to where data is being generated—at the cloud edge.” - -The idea is that paths to designated SaaS applications will be monitored continuously for performance, and the application traffic will be dynamically routed to the best-performing path, without requiring human intervention, Oswal stated. - -For a typical configuration, a region covering a target city uses a colocation IaaS provider that hosts the Cisco Cloud onRamp for CoLocation, which includes: - - * Cisco vManage software that lets customers manage applications and provision, monitor and troubleshooting the WAN. - * [Cisco Cloud Services Platform (CSP) 5000][8] The systems are x86 Linux Kernel-based Virtual Machine (KVM) software and hardware platforms for the data center, regional hub, and colocation Network Functions Virtualization (NFV). The platforms let enterprise IT teams or service providers deploy any Cisco or third-party network virtual service with Cisco’s [Network Services Orchestrator (NSO)][9] or any other northbound management and orchestration system. - * The Cisco [Catalyst 9500 Series][10] aggregation switches. Based on an x86 CPU, the Catalyst 9500 Series is Cisco’s lead purpose-built fixed core and aggregation enterprise switching platform, built for security, IoT, and cloud. The switches come with a 4-core x86, 2.4-GHz CPU, 16-GB DDR4 memory, and 16-GB internal storage. - - - -If the features of the package sound familiar, that’s because the [Cloud onRamp for CoLocation][11] package is the second generation of a similar SD-WAN package offered by Viptela which Cisco [bought in 2017][12]. - -SD-WAN's driving principle is to simplify the way big companies turn up new links to branch offices, better manage the way those links are utilized – for data, voice or video – and potentially save money in the process. - -It's a profoundly hot market with tons of players including [Cisco][13], VMware, Silver Peak, Riverbed, Aryaka, Fortinet, Nokia and Versa. IDC 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. - -[SD-WAN][14] lets networks route traffic based on centrally managed roles and rules, no matter what the entry and exit points of the traffic are, and with full security. For example, if a user in a branch office is working in Office365, SD-WAN can route their traffic directly to the closest cloud data center for that app, improving network responsiveness for the user and lowering bandwidth costs for the business. - -"SD-WAN has been a promised technology for years, but in 2019 it will be a major driver in how networks are built and re-built," Oswal said a Network World [article][15] earlier this year. - -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/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/02/istock-578801262-100750453-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://blogs.cisco.com/enterprise/cisco-sd-wan-cloud-onramp-for-colocation-multicloud -[8]: https://www.cisco.com/c/en/us/products/collateral/switches/cloud-services-platform-5000/nb-06-csp-5k-data-sheet-cte-en.html#ProductOverview -[9]: https://www.cisco.com/go/nso -[10]: https://www.cisco.com/c/en/us/products/collateral/switches/catalyst-9500-series-switches/data_sheet-c78-738978.html -[11]: https://www.networkworld.com/article/3207751/viptela-cloud-onramp-optimizes-cloud-access.html -[12]: https://www.networkworld.com/article/3193784/cisco-grabs-up-sd-wan-player-viptela-for-610m.html?nsdr=true -[13]: https://www.networkworld.com/article/3322937/what-will-be-hot-for-cisco-in-2019.html -[14]: https://www.networkworld.com/article/3031279/sd-wan/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html -[15]: https://www.networkworld.com/article/3332027/cisco-touts-5-technologies-that-will-change-networking-in-2019.html -[16]: https://www.facebook.com/NetworkWorld/ -[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md b/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md deleted file mode 100644 index 8169c594ef..0000000000 --- a/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md +++ /dev/null @@ -1,56 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Server shipments to pick up in the second half of 2019) -[#]: via: (https://www.networkworld.com/article/3393167/server-shipments-to-pick-up-in-the-second-half-of-2019.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Server shipments to pick up in the second half of 2019 -====== -Server sales slowed in anticipation of the new Intel Xeon processors, but they are expected to start up again before the end of the year. -![Thinkstock][1] - -Global server shipments are not expected to return to growth momentum until the third quarter or even the fourth quarter of 2019, according to Taiwan-based tech news site DigiTimes, which cited unnamed server supply chain sources. The one bright spot remains cloud providers like Amazon, Google, and Facebook, which continue their buying binge. - -Normally I’d be reluctant to cite such a questionable source, but given most of the OEMs and ODMs are based in Taiwan and DigiTimes (the article is behind a paywall so I cannot link) has shown it has connections to them, I’m inclined to believe them. - -Quanta Computer chairman Barry Lam told the publication that Quanta's shipments of cloud servers have risen steadily, compared to sharp declines in shipments of enterprise servers. Lam continued that enterprise servers command only 1-2% of the firm's total server shipments. - -**[ Also read:[Gartner: IT spending to drop due to falling equipment prices][2] ]** - -[Server shipments began to slow down in the first quarter][3] thanks in part to the impending arrival of second-generation Xeon Scalable processors from Intel. And since it takes a while to get parts and qualify them, this quarter won’t be much better. - -In its latest quarterly earnings, Intel's data center group (DCG) said sales declined 6% year over year, the first decline of its kind since the first quarter of 2012 and reversing an average growth of over 20% in the past. - -[The Osbourne Effect][4] wasn’t the sole reason. An economic slowdown in China and the trade war, which will add significant tariffs to Chinese-made products, are also hampering sales. - -DigiTimes says Inventec, Intel's largest server motherboard supplier, expects shipments of enterprise server motherboards to further lose steams for the rest of the year, while sales of data center servers are expected to grow 10-15% on year in 2019. - -**[[Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][5] ]** - -It went on to say server shipments may concentrate in the second half or even the fourth quarter of the year, while cloud-based data center servers for the cloud giants will remain positive as demand for edge computing, new artificial intelligence (AI) applications, and the proliferation of 5G applications begin in 2020. - -Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3393167/server-shipments-to-pick-up-in-the-second-half-of-2019.html#tk.rss_all - -作者:[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://images.techhive.com/images/article/2017/04/2_data_center_servers-100718306-large.jpg -[2]: https://www.networkworld.com/article/3391062/it-spending-to-drop-due-to-falling-equipment-prices-gartner-predicts.html -[3]: https://www.networkworld.com/article/3332144/server-sales-projected-to-slow-while-memory-prices-drop.html -[4]: https://en.wikipedia.org/wiki/Osborne_effect -[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md b/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md deleted file mode 100644 index a5ec6212d8..0000000000 --- a/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco adds AMP to SD-WAN for ISR/ASR routers) -[#]: via: (https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco adds AMP to SD-WAN for ISR/ASR routers -====== -Cisco SD-WAN now sports Advanced Malware Protection on its popular edge routers, adding to their routing, segmentation, security, policy and orchestration capabilities. -![vuk8691 / Getty Images][1] - -Cisco has added support for Advanced Malware Protection (AMP) to its million-plus ISR/ASR edge routers, in an effort to [reinforce branch and core network malware protection][2] at across the SD-WAN. - -Cisco last year added its Viptela SD-WAN technology to the IOS XE version 16.9.1 software that runs its core ISR/ASR routers such as the ISR models 1000, 4000 and ASR 5000, in use by organizations worldwide. Cisco bought Viptela in 2017. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -The release of Cisco IOS XE offered an instant upgrade path for creating cloud-controlled SD-WAN fabrics to connect distributed offices, people, devices and applications operating on the installed base, Cisco said. At the time Cisco said that Cisco SD-WAN on edge routers builds a secure virtual IP fabric by combining routing, segmentation, security, policy and orchestration. - -With the recent release of [IOS-XE SD-WAN 16.11][7], Cisco has brought AMP and other enhancements to its SD-WAN. - -“Together with Cisco Talos [Cisco’s security-intelligence arm], AMP imbues your SD-WAN branch, core and campuses locations with threat intelligence from millions of worldwide users, honeypots, sandboxes, and extensive industry partnerships,” wrote Cisco’s Patrick Vitalone a product marketing manager in a [blog][8] about the security portion of the new software. “In total, AMP identifies more than 1.1 million unique malware samples a day." When AMP in Cisco SD-WAN spots malicious behavior it automatically blocks it, he wrote. - -The idea is to use integrated preventative engines, exploit prevention and intelligent signature-based antivirus to stop malicious attachments and fileless malware before they execute, Vitalone wrote. - -AMP support is added to a menu of security features already included in the SD-WAN software including support for URL filtering, [Cisco Umbrella][9] DNS security, Snort Intrusion Prevention, the ability to segment users across the WAN and embedded platform security, including the [Cisco Trust Anchor][10] module. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][11] ]** - -The software also supports [SD-WAN Cloud onRamp for CoLocation][12], which lets customers tie distributed multicloud applications back to a local branch office or local private data center. That way a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly to the data center. - -“The idea that this kind of security technology is now integrated into Cisco’s SD-WAN offering is a critical for Cisco and customers looking to evaluate SD-WAN offerings,” said Lee Doyle, principal analyst at Doyle Research. - -IOS-XE SD-WAN 16.11 is available now. - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/09/shimizu_island_el_nido_palawan_philippines_by_vuk8691_gettyimages-155385042_1200x800-100773533-large.jpg -[2]: https://www.networkworld.com/article/3285728/what-are-the-options-for-securing-sd-wan.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://www.cisco.com/c/en/us/td/docs/routers/sdwan/release/notes/xe-16-11/sd-wan-rel-notes-19-1.html -[8]: https://blogs.cisco.com/enterprise/enabling-amp-in-cisco-sd-wan -[9]: https://www.networkworld.com/article/3167837/cisco-umbrella-cloud-service-shapes-security-for-cloud-mobile-resources.html -[10]: https://www.cisco.com/c/dam/en_us/about/doing_business/trust-center/docs/trustworthy-technologies-datasheet.pdf -[11]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[12]: https://www.networkworld.com/article/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190510 Supermicro moves production from China.md b/sources/talk/20190510 Supermicro moves production from China.md deleted file mode 100644 index 21739fa416..0000000000 --- a/sources/talk/20190510 Supermicro moves production from China.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Supermicro moves production from China) -[#]: via: (https://www.networkworld.com/article/3394404/supermicro-moves-production-from-china.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Supermicro moves production from China -====== -Supermicro was cleared of any activity related to the Chinese government and secret chips in its motherboards, but it is taking no chances and is moving its facilities. -![Frank Schwichtenberg \(CC BY 4.0\)][1] - -Server maker Supermicro, based in Fremont, California, is reportedly moving production out of China over customer concerns that the Chinese government had secretly inserted chips for spying into its motherboards. - -The claims were made by Bloomberg late last year in a story that cited more than 100 sources in government and private industry, including Apple and Amazon Web Services (AWS). However, Apple CEO Tim Cook and AWS CEO Andy Jassy denied the claims and called for Bloomberg to retract the article. And a few months later, the third-party investigations firm Nardello & Co examined the claims and [cleared Supermicro][2] of any surreptitious activity. - -At first it seemed like Supermicro was weathering the storm, but the story did have a negative impact. Server sales have fallen since the Bloomberg story, and the company is forecasting a near 10% decline in total revenues for the March quarter compared to the previous three months. - -**[ Also read:[Who's developing quantum computers][3] ]** - -And now, Nikkei Asian Review reports that despite the strong rebuttals, some customers remain cautious about the company's products. To address those concerns, Nikkei says Supermicro has told suppliers to [move production out of China][4], citing industry sources familiar with the matter. - -It also has the side benefit of mitigating against the U.S.-China trade war, which is only getting worse. Since the tariffs are on the dollar amount of the product, that can quickly add up even for a low-end system, as Serve The Home noted in [this analysis][5]. - -Supermicro is the world's third-largest server maker by shipments, selling primarily to cloud providers like Amazon and Facebook. It does its own assembly in its Fremont facility but outsources motherboard production to numerous suppliers, mostly China and Taiwan. - -"We have to be more self-reliant [to build in-house manufacturing] without depending only on those outsourcing partners whose production previously has mostly been in China," an executive told Nikkei. - -Nikkei notes that roughly 90% of the motherboards shipped worldwide in 2017 were made in China, but that percentage dropped to less than 50% in 2018, according to Digitimes Research, a tech supply chain specialist based in Taiwan. - -Supermicro just held a groundbreaking ceremony in Taiwan for a 800,000 square foot manufacturing plant in Taiwan and is expanding its San Jose, California, plant as well. So, they must be anxious to be free of China if they are willing to expand in one of the most expensive real estate markets in the world. - -A Supermicro spokesperson said via email, “We have been expanding our manufacturing capacity for many years to meet increasing customer demand. We are currently constructing a new Green Computing Park building in Silicon Valley, where we are the only Tier 1 solutions vendor manufacturing in Silicon Valley, and we proudly broke ground this week on a new manufacturing facility in Taiwan. To support our continued global growth, we look forward to expanding in Europe as well.” - -Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394404/supermicro-moves-production-from-china.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/05/supermicro_-_x11sae__cebit_2016_01-100796121-large.jpg -[2]: https://www.networkworld.com/article/3326828/investigator-finds-no-evidence-of-spy-chips-on-super-micro-motherboards.html -[3]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html -[4]: https://asia.nikkei.com/Economy/Trade-war/Server-maker-Super-Micro-to-ditch-made-in-China-parts-on-spy-fears -[5]: https://www.servethehome.com/how-tariffs-hurt-intel-xeon-d-atom-and-amd-epyc-3000/ -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190513 HPE-s CEO lays out his technology vision.md b/sources/talk/20190513 HPE-s CEO lays out his technology vision.md deleted file mode 100644 index c9a8de9c8a..0000000000 --- a/sources/talk/20190513 HPE-s CEO lays out his technology vision.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE’s CEO lays out his technology vision) -[#]: via: (https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html) -[#]: author: (Eric Knorr ) - -HPE’s CEO lays out his technology vision -====== -In an exclusive interview, HPE CEO Antonio Neri unpacks his portfolio of technology initiatives, from edge computing to tomorrow’s memory-driven architecture. -![HPE][1] - -Like Microsoft's Satya Nadella, HPE CEO Antonio Neri is a technologist with a long history of leading initiatives in his company. Meg Whitman, his former boss at HPE, showed her appreciation of Neri’s acumen by promoting him to HPE Executive Vice President in 2015 – and gave him the green light to acquire [Aruba][2], [SimpliVity][3], [Nimble Storage][4], and [Plexxi][5], all of which added key items to HPE’s portfolio. - -Neri succeeded Whitman as CEO just 16 months ago. In a recent interview with Network World, Neri’s engineering background was on full display as he explained HPE’s technology roadmap. First and foremost, he sees a huge opportunity in [edge computing][6], into which HPE is investing $4 billion over four years to further develop edge “connectivity, security, and obviously cloud and analytics.” - -**More about edge networking** - - * [How edge networking and IoT will reshape data centers][7] - * [Edge computing best practices][8] - * [How edge computing can help secure the IoT][9] - - - -Although his company abandoned its public cloud efforts in 2015, Neri is also bullish on the self-service “cloud experience,” which he asserts HPE is already implementing on-prem today in a software-defined, consumption-driven model. More fundamentally, he believes we are on the brink of a memory-driven computing revolution, where storage and memory become one and, depending on the use case, various compute engines are brought to bear on zettabytes of data. - -This interview, conducted by Network World Editor-in-Chief Eric Knorr and edited for length and clarity, digs into Neri’s technology vision. [A companion interview on CIO][10] centers on Neri’s views of innovation, management, and company culture. - -**Eric Knorr: ** Your biggest and highest profile investment so far has been in edge computing. My understanding of edge computing is that we’re really talking about mini-data centers, defined by IDC as less than 100 square feet in size. What’s the need for a $4 billion investment in that? - -**Antonio Neri:** It’s twofold. We focus first on connectivity. Think about Aruba as a platform company, a cloud-enabled company. Now we offer branch solutions and edge data center solutions that include [wireless][11], LAN, [WAN][12] connectivity and soon [5G][13]. We give you a control plane so that that connectivity experience can be seen consistently the same way. All the policy management, the provisioning and the security aspects of it. - -**Knorr:** Is 5G a big focus? - -**[[Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][14] ]** - -**Neri:** It’s a big focus for us. What customers are telling us is that it’s hard to get 5G inside the building. How you do hand off between 5G and Wi-Fi and give them the same experience? Because the problem is that we have LAN, wireless, and WAN already fully integrated into the control plane, but 5G sits over here. If you are an enterprise, you have to manage these two pipes independently. - -With the new spectrum, though, they are kind of comingling anyway. [Customers ask] why don’t you give me [a unified] experience on top of that, with all this policy management and cloud-enablement, so I can provision the right connectivity for the right use case? A sensor can use a lower radio access or [Bluetooth][15] or other type of connectivity because you don’t need persistent connectivity and you don’t have the power to do it. - -In some cases, you just put a SIM on it, and you have 5G, but in another one it’s just wireless connectivity. Wi-Fi connectivity is significantly lower cost than 5G. The use cases will dictate what type of connectivity you need, but the reality is they all want one experience. And we can do that because we have a great platform and a great partnership with MSPs, telcos, and providers. - -**Knorr:** So it sounds like much of your investment is going into that integration. - -**Neri:** The other part is how we provide the ability to provision the right cloud computing at the edge for the right use cases. Think about, for example, a manufacturing floor. We can converge the OT and IT worlds through a converged infrastructure aspect that digitizes the analog process into a digital process. We bring the cloud compute in there, which is fully virtualized and containerized, we integrate Wi-Fi connectivity or LAN connectivity, and we eliminate all these analog processes that are multi-failure touchpoints because you have multiple things that have to come together. - -That’s a great example of a cloud at the edge. And maybe that small cloud is connected to a big cloud which could be in the large data center, which the customer owns – or it can be one of the largest public cloud providers. - -**Knorr:** It’s difficult to talk about the software-defined data center and private cloud without talking about [VMware][16]. Where do your software-defined solutions leave off and where does VMware begin? - -**Neri:** Where we stop is everything below the hypervisor, including the software-defined storage and things like SimpliVity. That has been the advantage we’ve had with [HPE OneView][17], so we can provision and manage the infrastructure-life-cycle and software-defined aspects at the infrastructure level. And let’s not forget security, because we’ve integrated [silicon root of trust][18] into our systems, which is a good advantage for us in the government space. - -Then above that we continue to develop capabilities. Customers want choice. That’s why [the partnership with Nutanix][19] was important. We offer an alternative to vSphere and vCloud Foundation with Nutanix Prism and Acropolis. - -**Knorr:** VMware has become the default for the private cloud, though. - -**Neri:** Obviously, VMware owns 60 percent of the on-prem virtualized environment, but more and more, containers are becoming the way to go in a cloud-native approach. For us, we own the full container stack, because we base our solution on Kubernetes. We deploy that. That’s why the partnership with Nutanix is important. With Nutanix, we offer KVM and the Prism stack and then we’re fully integrated with HPE OneView for the rest of the infrastructure. - -**Knorr:** You also offer GKE [Google [Kubernetes][20] Engine] on-prem. - -**Neri:** Correct. We’re working with Google on the next version of that. - -**Knorr:** How long do you think it will be before you start seeing Kubernetes and containers on bare metal? - -**Neri:** It’s an interesting question. Many customers tell us it’s like going back to the future. It’s like we’re paying this tax on the virtualization layer. - -**Knorr:** Exactly. - -**Neri:** I can go bare metal and containers and be way more efficient. It is a little bit back to the future. But it’s a different future. - -**Knorr:** And it makes the promise of [hybrid cloud][21] a little more real. I know HPE has been very bullish on hybrid. - -**Neri:** We have been the one to say the world would be hybrid. - -**Knorr:** But today, how hybrid is hybrid really? I mean, you have workloads in the public cloud, you have workloads in a [private cloud][22]. Can you really rope it all together into hybrid? - -**Neri:** I think you have to have portability eventually. - -**Knorr:** Eventually. It’s not really true now, though. - -**Neri:** No, not true now. If you look at it from the software brokering perspective that makes hybrid very small. We know this eventually has to be all connected, but it’s not there yet. More and more of these workloads have to go back and forth. - -If you ask me what the CIO role of the future will look like, it would be a service provider. I wake up in the morning, have a screen that says – oh, you know what? Today it’s cheaper to run that app here. I just slice it there and then it just moves. Whatever attributes on the data I want to manage and so forth – oh, today I have capacity here and by the way, why are you not using it? Slide it back here. That’s the hybrid world. - -Many people, when they started with the cloud, thought, “I’ll just virtualize everything,” but that’s not the cloud. You’re [virtualizing][23], but you have to make it self-service. Obviously, cloud-native applications have developed that are different today. That’s why containers are definitely a much more efficient way, and that’s why I agree that the bare-metal piece of this is coming back. - -**Knorr:** Do you worry about public cloud incursions into the [data center][24]? - -**Neri:** It’s happening. Of course I’m worried. But what at least gives me comfort is twofold. One is that the customer wants choice. They don’t want to be locked in. Service is important. It’s one thing to say: Here’s the system. The other is: Who’s going to maintain it for me? Who is going to run it for me? And even though you have all the automation tools in the world, somebody has to watch this thing. Our job is to bring the public-cloud experience on prem, so that the customer has that choice. - -**Knorr:** Part of that is economics. - -**Neri:** When you look at economics it’s no longer just the cost of compute anymore. What we see more and more is the cost of the data bandwidth back and forth. That’s why the first question a customer asks is: Where should I put my data? And that dictates a lot of things, because today the data transfer bill is way higher than the cost of renting a VM. - -The other thing is that when you go on the public cloud you can spin up a VM, but the problem is if you don’t shut it off, the bill keeps going. We brought, in the context of [composability][25], the ability to shut it off automatically. That’s why composability is important, because we can run, first of all, multi-workloads in the same infrastructure – whether it’s bare metal, virtualized or containerized. It’s called composable because the software layers of intelligence compose the right solutions from compute, storage, fabric and memory to that workload. When it doesn’t need it, it gives it back. - -**Knorr:** Is there any opportunity left at the hardware level to innovate? - -**Neri:** That’s why we think about memory-driven computing. Today we have a very CPU-centric approach. This is a limiting factor, and the reality is, if you believe data is the core of the architecture going forward, then the CPU can’t be the core of the architecture anymore. - -You have a bunch of inefficiency by moving data back and forth across the system, which also creates energy waste and so forth. What we are doing is basically rearchitecting this for once in 70 years. We take memory and storage and collapse the two into one, so this becomes one central pool, which is nonvolatile and becomes the core. And then we bring the right computing capability to the data. - -In an AI use case, you don’t move the data. You bring accelerators or GPUs to the data. For general purpose, you may use an X86, and maybe in video transcoding, you use an ARM-based architecture. The magic is this: You can do this on zettabytes of data and the benefit is there is no waste, very little power to keep it alive, and it’s persistent. - -We call this the Generation Z fabric, which is based on a data fabric and silicon photonics. Now we go from copper, which is generating a lot of waste and a lot of heat and energy, to silicon photonics. So we not only scale this to zettabytes, we can do massive amounts of computation by bringing the right compute at the speed that’s needed to the data – and we solve a cost and scale problem too, because copper today costs a significant amount of money, and gold-plated connectors are hundreds of dollars. - -We’re going to actually implement this capability in silicon photonics in our current architectures by the end of the year. In Synergy, for example, which is a composable blade system, at the back of the rack you can swap from Ethernet to silicon photonics. It was designed that way. We already prototyped this in a simple 2U chassis with 160 TB of memory and 2000 cores. We were able to process a billion-record database with 55 million combinations of algorithms in less than a minute. - -**Knorr:** So you’re not just focusing on the edge, but the core, too. - -**Neri:** As you go down from the cloud to the edge, that architecture actually scales to the smallest things. You can do it on a massive scale or you can do it on a small scale. We will deploy these technologies in our systems architectures now. Once the whole ecosystem is developed, because we also need an ISV ecosystem that can code applications in this new world or you’re not taking advantage of it. Also, the current Linux kernel can only handle so much memory, so you have to rewrite the kernel. We are working with two universities to do that. - -The hardware will continue to evolve and develop, but there still is a lot of innovation that has to happen. What’s holding us back, honestly, is the software. - -**Knorr:** And that’s where a lot of your investment is going? - -**Neri:** Correct. Exactly right. Systems software, not application software. It’s the system software that makes this infrastructure solution-oriented, workload-optimized, autonomous and efficient. - -Join the Network World communities on [Facebook][26] and [LinkedIn][27] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html - -作者:[Eric Knorr][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/05/antonio-neri_hpe_new-100796112-large.jpg -[2]: https://www.networkworld.com/article/2891130/aruba-networks-is-different-than-hps-failed-wireless-acquisitions.html -[3]: https://www.networkworld.com/article/3158784/hpe-buying-simplivity-for-650-million-to-boost-hyperconvergence.html -[4]: https://www.networkworld.com/article/3177376/hpe-to-pay-1-billion-for-nimble-storage-after-cutting-emc-ties.html -[5]: https://www.networkworld.com/article/3273113/hpe-snaps-up-hyperconverged-network-hcn-vendor-plexxi.html -[6]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html -[7]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[8]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html -[9]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html -[10]: https://www.cio.com/article/3394598/hpe-ceo-antonio-neri-rearchitects-for-the-future.html -[11]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html -[12]: https://www.networkworld.com/article/3248989/what-is-a-wide-area-network-a-definition-examples-and-where-wans-are-headed.html -[13]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html -[14]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[15]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html -[16]: https://www.networkworld.com/article/3340259/vmware-s-transformation-takes-hold.html -[17]: https://www.networkworld.com/article/2174203/hp-expands-oneview-into-vmware-environs.html -[18]: https://www.networkworld.com/article/3199826/hpe-highlights-innovation-in-software-defined-it-security-at-discover.html -[19]: https://www.networkworld.com/article/3388297/hpe-and-nutanix-partner-for-hyperconverged-private-cloud-systems.html -[20]: https://www.infoworld.com/article/3268073/what-is-kubernetes-container-orchestration-explained.html -[21]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html -[22]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html -[23]: https://www.networkworld.com/article/3285906/whats-the-future-of-server-virtualization.html -[24]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[25]: https://www.networkworld.com/article/3266106/what-is-composable-infrastructure.html -[26]: https://www.facebook.com/NetworkWorld/ -[27]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md b/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md deleted file mode 100644 index e821405199..0000000000 --- a/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md +++ /dev/null @@ -1,56 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise) -[#]: via: (https://www.networkworld.com/article/3394687/brillio-and-blue-planet-partner-to-bring-network-automation-to-the-enterprise.html) -[#]: author: (Rick Hamilton, Senior Vice President, Blue Planet Software ) - -Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise -====== -Rick Hamilton, senior vice president of Blue Planet, a division of Ciena, explains how partnering with Brillio brings the next generation of network capabilities to enterprises—just when they need it most. -![Kritchanut][1] - -![][2] - -_Rick Hamilton, senior vice president of Blue Planet, a division of Ciena, explains how partnering with Brillio brings the next generation of network capabilities to enterprises—just when they need it most._ - -In February 2019, we announced that Blue Planet was evolving into a more independent division, helping us increase our focus on innovative intelligent automation solutions that help our enterprise and service provider customers accelerate and achieve their business transformation goals. - -Today we’re excited to make another leap forward in delivering these benefits to enterprises of all types via our partnership with digital transformation services and solutions leader Brillio. Together, we are co-creating intelligent cloud and network management solutions that increase service visibility and improve service assurance by effectively leveraging the convergence of cloud, IoT, and AI. - -**Accelerating digital transformation in the enterprise** - -Enterprises continue to look toward cloud services to create new and incremental revenue streams based on innovative solution offerings and on-demand product/solution delivery models, and to optimize their infrastructure investments. In fact, Gartner predicts that enterprise IT spending for cloud-based offerings will continue to grow faster than non-cloud IT offerings, making up 28% of spending by 2022, up from 19% in 2018. - -As enterprises adopt cloud, they realize there are many challenges associated with traditional approaches to operating and managing complex and hybrid multi-cloud environments. Our partnership with Brillio enables us to help these organizations across industries such as manufacturing, logistics, retail, and financial services meet their technical and business needs with high-impact solutions that improve customer experiences, drive operational efficiencies, and improve quality of service. - -This is achieved by combining the Blue Planet intelligent automation platform and the Brillio CLIP™services delivery excellence platform and user-centered design (UCD) lead solution framework. Together, we offer end-to-end visibility of application and infrastructure assets in a hybrid multi-cloud environment and provide service assurance and self-healing capabilities that improve network and service availability. - -**Partnering on research and development** - -Brillio will also partner with Blue Planet on longer-term R&D efforts. As one of a preferred product engineering services providers, Brillio will work closely with our engineering team to develop and deliver network intelligence and automation solutions to help enterprises build dynamic, programmable infrastructure that leverage analytics and automation to realize the Adaptive Network vision. - -Of course, a partnership like this is a two-way street, and we consider Brillio’s choice to work with us to be a testament to our expertise, vision, and execution. In the words of Brillio Chairman and CEO Raj Mamodia, “Blue Planet’s experience in end-to-end service orchestration coupled with Brillio’s expertise in cloudification, user-centered enterprise solutions design, and rapid software development delivers distinct advantages to the industry. Through integration of technologies like cloud, IoT, and AI into our combined solutions, our partnership spurs greater innovation and helps us address the large and growing enterprise networking automation market.” - -Co-creating intelligent hybrid cloud and network management solutions with Brillio is key to advancing enterprise digital transformation initiatives. Partnering with Brillio helps us address the plethora of challenges facing enterprises today on their digital journey. Our partnership enables Blue Planet to achieve faster time-to-market and greater efficiency in developing new solutions to enable enterprises to continue to thrive and grow. - -[Learn more about Blue Planet here][3] - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394687/brillio-and-blue-planet-partner-to-bring-network-automation-to-the-enterprise.html - -作者:[Rick Hamilton, Senior Vice President, Blue Planet Software][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/05/istock-952625346-100796314-large.jpg -[2]: https://images.idgesg.net/images/article/2019/05/rick-100796315-small.jpg -[3]: https://www.blueplanet.com/?utm_campaign=X1058319&utm_source=NWW&utm_term=BPWeb_Brillio&utm_medium=sponsoredpost3Q19 diff --git a/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md b/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md deleted file mode 100644 index 84a563c8bc..0000000000 --- a/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Las Vegas targets transport, public safety with IoT deployments) -[#]: via: (https://www.networkworld.com/article/3395536/las-vegas-targets-transport-public-safety-with-iot-deployments.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Las Vegas targets transport, public safety with IoT deployments -====== - -![Franck V. \(CC0\)][1] - -The city of Las Vegas’ pilot program with NTT and Dell, designed to crack down on wrong-way driving on municipal roads, is just part of the big plans that Sin City has for leveraging IoT tech in the future, according to the city's director of technology Michael Sherwood, who sat down with Network World at the IoT World conference in Silicon Valley this week. - -The system uses smart cameras and does most of its processing at the edge, according to Sherwood. The only information that gets sent back to the city’s private cloud is metadata – aggregated information about overall patterns, for decision-making and targeting purposes, not data about individual traffic incidents and wrong-way drivers. - -**[ Also see[What is edge computing?][2] and [How edge networking and IoT will reshape data centers][3].]** - -It’s an important public safety consideration, he said, but it’s a small part of the larger IoT-enabled framework that the city envisions for the future. - -“Our goal is to make our data open to the public, not only for transparency purposes, but to help spur development and create new applications to make Vegas a better place to live,” said Sherwood. - -[The city’s public data repository][4] already boasts a range of relevant data, some IoT-generated, some not. And efforts to make that data store more open have already begun to bear fruit, according to Sherwood. For example, one hackathon about a year ago resulted in an Alexa app that tells users how many traffic lights are out, by tracking energy usage data via the city’s portal, among other applications. - -As with IoT in general, Sherwood said that the city’s efforts have been bolstered by an influx of operational talen. Rather than additional IT staff to run the new systems, they’ve brought in experts from the traffic department to help get the most out of the framework. - -Another idea for leveraging the city’s traffic data involves tracking the status of the curb. Given the rise of Uber and Lyft and other on-demand transportation services, linking a piece of camera-generated information like “rideshares are parked along both sides of this street” directly into a navigation app could help truck drivers avoid gridlock. - -“We’re really looking to make the roads a living source of information,” Sherwood said. - -**Safer parks** - -Las Vegas is also pursuing related public safety initiatives. One pilot project aims to make public parks safer by installing infrared cameras so authorities can tell whether people are in parks after hours without incurring undue privacy concerns, given that facial recognition is very tricky in infrared. - -It’s the test-and-see method of IoT development, according to Sherwood. - -“That’s a way of starting with an IoT project: start with one park. The cost to do something like this is not astronomical, and it allows you to gauge some other information from it,” he said. - -The city has also worked to keep the costs of these projects low or even show a returnon investment, Sherwood added. Workforce development programs could train municipal workers to do simple maintenance on smart cameras in parks or along roadways, and the economic gains made from the successful use of the systems ought to outweigh deployment and operational outlay. - -“If it’s doing it’s job, those efficiencies should cover the system’s cost,” he said. - -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/3395536/las-vegas-targets-transport-public-safety-with-iot-deployments.html - -作者:[Jon Gold][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/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/07/pedestrian-walk-sign_go_start_begin_traffic-light_by-franck-v-unsplaash-100765089-large.jpg -[2]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html -[3]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[4]: https://opendata.lasvegasnevada.gov/ -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md b/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md deleted file mode 100644 index b69109641d..0000000000 --- a/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services) -[#]: via: (https://www.networkworld.com/article/3395776/ibm-overhauls-mainframe-software-pricing-adds-hybrid-private-cloud-services.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services -====== -IBM brings cloud consumption model to the mainframe, adds Docker container extensions -![Thinkstock][1] - -IBM continues to adopt new tools and practices for its mainframe customers to keep the Big Iron relevant in a cloud world. - -First of all, the company switched-up its 20-year mainframe software pricing scheme to make it more palatable to hybrid and multicloud users who might be thinking of moving workloads off the mainframe and into the cloud. - -**[ Check out[What is hybrid cloud computing][2] and learn [what you need to know about multi-cloud][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** - -Specifically IBM rolled out Tailored Fit Pricing for the IBM Z mainframe which offers two consumption-based pricing models that can help customers cope with ever-changing workload – and hence software – costs. - -Tailored Fit Pricing removes the need for complex and restrictive capping, which typically weakens responsiveness and can impact service level availability, IBM said. IBM’s standard monthly mainframe licensing model calculates costs as a “rolling four-hour average” (R4HA) which would determine cost based on a customer’s peak usage during the month. Customers would many time cap usage to keep costs down, experts said - -Systems can now be configured to support optimal response times and service level agreements, rather than artificially slowing down workloads to manage software licensing costs, IBM stated. - -Predicting demand for IT services can be a major challenge and in the era of hybrid and multicloud, everything is connected and workload patterns constantly change, wrote IBM’s Ross Mauri, General Manager, IBM Z in a [blog][5] about the new pricing and services. “In this environment, managing demand for IT services can be a major challenge. As more customers shift to an enterprise IT model that incorporates on-premises, private cloud and public we’ve developed a simple cloud pricing model to drive the transformation forward.” - -[Tailored Fit Pricing][6] for IBM Z comes in two flavors, the Enterprise Consumption Solution and the Enterprise Capacity Solution. - -IBM said the Enterprise Consumption model is a tailored usage-based pricing model, where customers pay only for what they use, removing the need for complex and restrictive capping, IBM said. - -The Enterprise Capacity model lets customers mix and match workloads to help maximize use of the full capacity of the platform. Charges are referenced to the overall size of the physical environment and are calculated based on the estimated mix of workloads running, while providing the flexibility to vary actual usage across workloads, IBM said. - -The software pricing changes should be a welcome benefit to customers, experts said. - -“By making access to Z mainframes more flexible and ‘cloud-like,’ IBM is making it less likely that customers will consider shifting Z workloads to other systems and environments. As cloud providers become increasingly able to support mission critical applications, that’s a big deal,” wrote Charles King, president and principal analyst for Pund-IT in a [blog][7] about the IBM changes. - -“A notable point about both models is that discounted growth pricing is offered on all workloads – whether they be 40-year old Assembler programs or 4-day old JavaScript apps. This is in contrast to previous models which primarily rewarded only brand-new applications with growth pricing. By thinking outside the Big Iron box, the company has substantially eased the pain for its largest clients’ biggest mainframe-related headaches,” King wrote. - -IBM’s Tailored Fit Pricing supports an increasing number of enterprises that want to continue to grow and build new services on top of this mission-critical platform, wrote [John McKenny][8] vice president of strategy for ZSolutions Optimization at BMC Software. “In not yet released results from the 2019 BMC State of the Mainframe Survey, 62% of the survey respondents reported that they are planning to expand MIPS/MSU consumption and are growing their mainframe workloads. For customers with no current plans for growth, the affordability and cost-competitiveness of the new pricing model will re-ignite interest in also using this platform as an integral part of their hybrid cloud strategies.” - -In addition to the pricing, IBM announced some new services that bring the mainframe closer to cloud workloads. - -First, IBM rolled out z/OS Container Extensions (zCX), which makes it possible to run Linux on Z applications that are packaged as Docker Container images on z/OS. Application developers can develop and data centers can operate popular open source packages, Linux applications, IBM software, and third-party software together with z/OS applications and data, IBM said. zCX will let customers use the latest open source tools, popular NoSQL databases, analytics frameworks, application servers, and so on within the z/OS environment. - -“With z/OS Container Extensions, customers will be able to access the most recent development tools and processes available in Linux on the Z ecosystem, giving developers the flexibility to build new, cloud-native containerized apps and deploy them on z/OS without requiring Linux or a Linux partition,” IBM’s Mauri stated. - -Big Blue also rolled out z/OS Cloud Broker which will let customers access and deploy z/OS resources and services on [IBM Cloud Private][9]. [IBM Cloud Private][10] is the company’s Kubernetes-based Platform as a Service (PaaS) environment for developing and managing containerized applications. IBM said z/OS Cloud Broker is designed to help cloud application developers more easily provision and deprovision apps in z/OS environments. - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3395776/ibm-overhauls-mainframe-software-pricing-adds-hybrid-private-cloud-services.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://images.techhive.com/images/article/2015/08/thinkstockphotos-520137237-100610459-large.jpg -[2]: https://www.networkworld.com/article/3233132/cloud-computing/what-is-hybrid-cloud-computing.html -[3]: https://www.networkworld.com/article/3252775/hybrid-cloud/multicloud-mania-what-to-know.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://www.ibm.com/blogs/systems/ibm-z-defines-the-future-of-hybrid-cloud/ -[6]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS219-014&appname=USN -[7]: https://www.pund-it.com/blog/ibm-reinvents-the-z-mainframe-again/ -[8]: https://www.bmc.com/blogs/bmc-supports-ibm-tailored-fit-pricing-ibm-z/ -[9]: https://www.ibm.com/marketplace/cloud-private-on-z-and-linuxone -[10]: https://www.networkworld.com/article/3340043/ibm-marries-on-premises-private-and-public-cloud-data.html -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md b/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md deleted file mode 100644 index a1dafef683..0000000000 --- a/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE to buy Cray, offer HPC as a service) -[#]: via: (https://www.networkworld.com/article/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html) -[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) - -HPE to buy Cray, offer HPC as a service -====== -High-performance computing offerings from HPE plus Cray could enable things like AI, ML, high-speed financial trading, creation digital twins for entire enterprise networks. -![Cray Inc.][1] - -HPE has agreed to buy supercomputer-maker Cray for $1.3 billion, a deal that the companies say will bring their corporate customers high-performance computing as a service to help with analytics needed for artificial intelligence and machine learning, but also products supporting high-performance storage, compute and software. - -In addition to bringing HPC capabilities that can blend with and expand HPE’s current products, Cray brings with it customers in government and academia that might be interested in HPE’s existing portfolio as well. - -**[ Now read:[Who's developing quantum computers][2] ]** - -The companies say they expect to close the cash deal by the end of next April. - -The HPC-as-a-service would be offered through [HPE GreenLake][3], the company’s public-, private-, hybrid-cloud service. Such a service could address periodic enterprise need for fast computing that might otherwise be too expensive, says Tim Zimmerman, an analyst with Gartner. - -Businesses could use the service, for example, to create [digital twins][4] of their entire networks and use them to test new code to see how it will impact the network before deploying it live, Zimmerman says. - -Cray has HPC technology that HPE Labs might be exploring on its own, but that can be brought to market in a much quicker timeframe. - -HPE says that overall, buying cray give it technologies needed for massively data-intensive workloads such as AI and ML that is used for engineering services, transaction-based trading by financial firms, pharmaceutical research and academic studies into weather and genomes, for instance, Zimmerman says. - -As HPE puts it, Cray supercomputing platforms “have the ability to handle massive data sets, converged modelling, simulation, AI and analytics workloads.” - -Cray is working on [what it says will be the world’s fastest supercomputer][5] when it’s finished in 2021, cranking out 1.5 exaflops. The current fastest supercomputer is 143.5 petaflops. [Click [here][6] to see the current top 10 fastest supercomputers.] - -In general, HPE says it hopes to create a comprehensive line of products to support HPC infrastructure including “compute, high-performance storage, system interconnects, software and services.” - -Together, the talent in the two companies and their combined technologies should be able to increase innovation, HPE says. - -Earlier this month, HPE’s CEO Antonio Neri said in [an interview with _Network World_][7] that the company will be investing $4 billion over four years in a range of technology to boost “connectivity, security, and obviously cloud and analytics.” In laying out the company’s roadmap he made no specific mention of HPC. - -HPE net revenues last fiscal year were $30.9 billion. Cray’s total revenue was $456 million, with a gross profit of $130 million. - -The acquisition will pay $35 per share for Cray stock. - -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/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html - -作者:[Tim Greene][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/Tim-Greene/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/06/the_cray_xc30_piz_daint_system_at_the_swiss_national_supercomputing_centre_via_cray_inc_3x2_978x652-100762113-large.jpg -[2]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html -[3]: https://www.networkworld.com/article/3280996/hpe-adds-greenlake-hybrid-cloud-to-enterprise-service-offerings.html -[4]: https://www.networkworld.com/article/3280225/what-is-digital-twin-technology-and-why-it-matters.html -[5]: https://www.networkworld.com/article/3373539/doe-plans-worlds-fastest-supercomputer.html -[6]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html -[7]: https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html -[8]: https://www.facebook.com/NetworkWorld/ -[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md b/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md deleted file mode 100644 index 2638987b16..0000000000 --- a/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco ties its security/SD-WAN gear with Teridion’s cloud WAN service) -[#]: via: (https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco ties its security/SD-WAN gear with Teridion’s cloud WAN service -====== -An agreement links Cisco Meraki MX Security/SD-WAN appliances and its Auto VPN technology to Teridion’s cloud-based WAN service that claims to accelerate TCP-based applications by up to 5X. -![istock][1] - -Cisco and Teridion have tied the knot to deliver faster enterprise [software-defined WAN][2] services. - -The agreement links [Cisco Meraki][3] MX Security/SD-WAN appliances and its Auto [VPN][4] technology which lets users quickly bring up and configure secure sessions between branches and data centers with [Teridion’s cloud-based WAN service][5]. Teridion’s service promises customers better performance and control over traffic running from remote offices over the public internet to the [data center][6]. The service features what Teridion calls “Curated Routing” which fuses WAN acceleration techniques with route optimization to speed traffic. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][7] - * [How to pick an off-site data-backup method][8] - * [SD-Branch: What it is and why you’ll need it][9] - * [What are the options for security SD-WAN?][10] - - - -For example, Teridion says its WAN service can accelerate TCP-based applications like file transfers, backups and page loads, by as much as three to five times. - -“[The service] improves network performance for UDP based applications like voice, video, RDP, and VDI. Enterprises can get carrier grade performance over broadband and dedicated internet access. Depending on the locations of the sites, [customers] can expect to see a 15 to 30 percent reduction in latency. That’s the difference between a great quality video conference and an unworkable, choppy mess” Teridion [stated][11]. - -Teridion says the Meraki integration creates an IPSec connection from the Cisco Meraki MX to the Teridion edge. “Customers create locations in the Teridion portal and apply the preconfigured Meraki template to them, or just upload a csv file if you have a lot of locations. Then, from each Meraki MX, create a 3rd party IPSec tunnel to the Teridion edge IP addresses that are generated as part of the Teridion configuration.” - -The combined Cisco Meraki and Teridion offering brings SD-WAN and security capabilities at the WAN edge that are tightly integrated with a WAN service delivered over cost-effective broadband or dedicated Internet access, said Raviv Levi, director of product management at Cisco Meraki in a statement. “This brings better reliability and consistency to the enterprise WAN across multiple sites, as well as high performance access to all SaaS applications and cloud workloads.” - -Meraki’s MX family supports everything from SD-WAN and [Wi-Fi][12] features to next-generation [firewall][13] and intrusion prevention in a single package. - -Some studies show that by 2021 over 75 percent of enterprise traffic will be SaaS-oriented, so giving branch offices SD-WAN's reliable, secure transportation options will be a necessity, Cisco said when it [upgraded the Meraki][3] boxes last year. - -Cisco Meraki isn’t the only SD-WAN service Teridion supports. The company also has agreements Citrix, Silver Peak, VMware (VeloCloud). Teridion also has partnerships with over 25 cloud partners, including Google, Amazon Web Services and Microsoft Azure. - -[Teridion for Cisco Meraki][14] is available now from authorized Teridion resellers. Pricing starts at $50 per site per month. - -Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.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://images.idgesg.net/images/article/2018/02/istock-820219662-100749695-large.jpg -[2]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html -[3]: https://www.networkworld.com/article/3301169/cisco-meraki-amps-up-throughput-wi-fi-to-sd-wan-family.html -[4]: https://www.networkworld.com/article/3138952/5-things-you-need-to-know-about-virtual-private-networks.html -[5]: https://www.networkworld.com/article/3284285/teridion-enables-higher-performing-and-more-responsive-saas-applications.html -[6]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[7]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[8]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[9]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[10]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[11]: https://www.teridion.com/blog/teridion-announces-deep-integration-with-cisco-meraki-mx/ -[12]: https://www.networkworld.com/article/3318119/what-to-expect-from-wi-fi-6-in-2019.html -[13]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[14]: https://www.teridion.com/meraki -[15]: https://www.facebook.com/NetworkWorld/ -[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md b/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md deleted file mode 100644 index 07f9eea10c..0000000000 --- a/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (With Cray buy, HPE rules but does not own the supercomputing market) -[#]: via: (https://www.networkworld.com/article/3397087/with-cray-buy-hpe-rules-but-does-not-own-the-supercomputing-market.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -With Cray buy, HPE rules but does not own the supercomputing market -====== -In buying supercomputer vendor Cray, HPE has strengthened its high-performance-computing technology, but serious competitors remain. -![Cray Inc.][1] - -Hewlett Packard Enterprise was already the leader in the high-performance computing (HPC) sector before its announced acquisition of supercomputer maker Cray earlier this month. Now it has a commanding lead, but there are still competitors to the giant. - -The news that HPE would shell out $1.3 billion to buy the company came just as Cray had announced plans to build three of the biggest systems yet — all exascale, and all with the same deployment time of 2021. - -Sales had been slowing for HPC systems, but our government, with its endless supply of money, came to the rescue, throwing hundreds of millions at Cray for systems to be built at Lawrence Berkeley National Laboratory, Argonne National Laboratory and Oak Ridge National Laboratory. - -**[ Read also:[How to plan a software-defined data-center network][2] ]** - -And HPE sees a big revenue opportunity in HPC, a market that was $2 billion in 1990 and now nearly $30 billion, according to Steve Conway, senior vice president with Hyperion Research, which follows the HPC market. HPE thinks the HPC market will grow to $35 billion by 2021, and it hopes to earn a big chunk of that pie. - -“They were solidly in the lead without Cray. They were already in a significant lead over the No. 2 company, Dell. This adds to their lead and gives them access to very high end of market, especially government supercomputers that sell for $300 million to $600 million each,” said Conway. - -He’s not exaggerating. Earlier this month the U.S. Department of Energy announced a contract with Cray to build Frontier, an exascale supercomputer at Oak Ridge National Laboratory, sometime in 2021, with a $600 million price tag. Frontier will be powered by AMD Epyc processors and Radeon GPUs, which must have them doing backflips at AMD. - -With Cray, HPE is sitting on a lot of technology for the supercomputing and even the high-end, non-HPC market. It had the ProLiant business, the bulk of server sales (and proof the Compaq acquisition wasn’t such a bad idea), Integrity NonStop mission-critical servers, the SGI business it acquired in in 2016, plus a variety running everything from Arm to Xeon Scalable processors. - -Conway thinks all of those technologies fit in different spaces, so he doubts HPE will try to consolidate any of it. All HPE has said so far is it will keep the supercomputer products it has now under the Cray business unit. - -But the company is still getting something it didn’t have. “It takes a certain kind of technical experience [to do HPC right] and only a few companies able to play at that level. Before this deal, HPE was not one of them,” said Conway. - -And in the process, HPE takes Cray away from its many competitors: IBM, Lenovo, Dell/EMC, Huawei (well, not so much now), Super Micro, NEC, Hitachi, Fujitsu, and Atos. - -“[The acquisition] doesn’t fundamentally change things because there’s still enough competitors that buyers can have competitive bids. But it’s gotten to be a much bigger market,” said Conway. - -Cray sells a lot to government, but Conway thinks there is a new opportunity in the ever-expanding AI race. “Because HPC is indispensable at the forefront of AI, there is a new area for expanding the market,” he said. - -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/3397087/with-cray-buy-hpe-rules-but-does-not-own-the-supercomputing-market.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://images.idgesg.net/images/article/2018/06/the_cray_xc30_piz_daint_system_at_the_swiss_national_supercomputing_centre_via_cray_inc_3x2_978x652-100762113-large.jpg -[2]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md b/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md deleted file mode 100644 index c1e0493e63..0000000000 --- a/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco security spotlights Microsoft Office 365 e-mail phishing increase) -[#]: via: (https://www.networkworld.com/article/3398925/cisco-security-spotlights-microsoft-office-365-e-mail-phishing-increase.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco security spotlights Microsoft Office 365 e-mail phishing increase -====== -Cisco blog follows DHS Cybersecurity and Infrastructure Security Agency (CISA) report detailing risks around Office 365 and other cloud services -![weerapatkiatdumrong / Getty Images][1] - -It’s no secret that if you have a cloud-based e-mail service, fighting off the barrage of security issues has become a maddening daily routine. - -The leading e-mail service – in [Microsoft’s Office 365][2] package – seems to be getting the most attention from those attackers hellbent on stealing enterprise data or your private information via phishing attacks. Amazon and Google see their share of phishing attempts in their cloud-based services as well. - -**[ Also see[What to consider when deploying a next generation firewall][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** - -But attackers are crafting and launching phishing campaigns targeting Office 365 users, [wrote][5] Ben Nahorney, a Threat Intelligence Analyst focused on covering the threat landscape for Cisco Security in a blog focusing on the Office 365 phishing issue. - -Nahorney wrote of research from security vendor [Agari Data][6], that found over the last few quarters, there has been a steady increase in the number of phishing emails impersonating Microsoft. While Microsoft has long been the most commonly impersonated brand, it now accounts for more than half of all brand impersonations seen in the last quarter. - -Recently cloud security firm Avanan wrote in its [annual phishing report][7], one in every 99 emails is a phishing attack, using malicious links and attachments as the main vector. “Of the phishing attacks we analyzed, 25 percent bypassed Office 365 security, a number that is likely to increase as attackers design new obfuscation methods that take advantage of zero-day vulnerabilities on the platform,” Avanan wrote. - -The attackers attempt to steal a user’s login credentials with the goal of taking over accounts. If successful, attackers can often log into the compromised accounts, and perform a wide variety of malicious activity: Spread malware, spam and phishing emails from within the internal network; carry out tailored attacks such as spear phishing and [business email compromise][8] [a long-standing business scam that uses spear-phishing, social engineering, identity theft, e-mail spoofing], and target partners and customers, Nahorney wrote. - -Nahorney wrote that at first glance, this may not seem very different than external email-based attacks. However, there is one critical distinction: The malicious emails sent are now coming from legitimate accounts. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][9] ]** - -“For the recipient, it’s often even someone that they know, eliciting trust in a way that would not necessarily be afforded to an unknown source. To make things more complicated, attackers often leverage ‘conversation hijacking,’ where they deliver their payload by replying to an email that’s already located in the compromised inbox,” Nahorney stated. - -The methods used by attackers to gain access to an Office 365 account are fairly straightforward, Nahorney wrote. - -“The phishing campaigns usually take the form of an email from Microsoft. The email contains a request to log in, claiming the user needs to reset their password, hasn’t logged in recently or that there’s a problem with the account that needs their attention. A URL is included, enticing the reader to click to remedy the issue,” Nahorney wrote. - -Once logged in, nefarious activities can go on unnoticed as the attacker has what look like authorized credentials. - -“This gives the attacker time for reconnaissance: a chance to observe and plan additional attacks. Nor will this type of attack set off a security alert in the same way something like a brute-force attack against a webmail client will, where the attacker guesses password after password until they get in or are detected,” Nahorney stated. - -Nahorney suggested the following steps customers can take to protect email: - - * Use multi-factor authentication. If a login attempt requires a secondary authorization before someone is allowed access to an inbox, this will stop many attackers, even with phished credentials. - * Deploy advanced anti-phishing technologies. Some machine-learning technologies can use local identity and relationship modeling alongside behavioral analytics to spot deception-based threats. - * Run regular phishing exercises. Regular, mandated phishing exercises across the entire organization will help to train employees to recognize phishing emails, so that they don’t click on malicious URLs, or enter their credentials into malicious website. - - - -### Homeland Security flags Office 365, other cloud email services - -The U.S. government, too, has been warning customers of Office 365 and other cloud-based email services that they should be on alert for security risks. The US Department of Homeland Security's Cybersecurity and Infrastructure Security Agency (CISA) this month [issued a report targeting][10] Office 365 and other cloud services saying: - -“Organizations that used a third party have had a mix of configurations that lowered their overall security posture (e.g., mailbox auditing disabled, unified audit log disabled, multi-factor authentication disabled on admin accounts). In addition, the majority of these organizations did not have a dedicated IT security team to focus on their security in the cloud. These security oversights have led to user and mailbox compromises and vulnerabilities.” - -The agency also posted remediation suggestions including: - - * Enable unified audit logging in the Security and Compliance Center. - * Enable mailbox auditing for each user. - * Ensure Azure AD password sync is planned for and configured correctly, prior to migrating users. - * Disable legacy email protocols, if not required, or limit their use to specific users. - - - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3398925/cisco-security-spotlights-microsoft-office-365-e-mail-phishing-increase.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://images.idgesg.net/images/article/2019/05/cso_phishing_social_engineering_security_threat_by_weerapatkiatdumrong_gettyimages-489433130_3x2_2400x1600-100796450-large.jpg -[2]: https://docs.microsoft.com/en-us/office365/securitycompliance/security-roadmap -[3]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://blogs.cisco.com/security/office-365-phishing-threat-of-the-month -[6]: https://www.agari.com/ -[7]: https://www.avanan.com/hubfs/2019-Global-Phish-Report.pdf -[8]: https://www.networkworld.com/article/3195072/fbi-ic3-vile-5b-business-e-mail-scam-continues-to-breed.html -[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[10]: https://www.us-cert.gov/ncas/analysis-reports/AR19-133A -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md b/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md deleted file mode 100644 index f608db970c..0000000000 --- a/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Nvidia launches edge computing platform for AI processing) -[#]: via: (https://www.networkworld.com/article/3397841/nvidia-launches-edge-computing-platform-for-ai-processing.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Nvidia launches edge computing platform for AI processing -====== -EGX platform goes to the edge to do as much processing there as possible before sending data upstream to major data centers. -![Leo Wolfert / Getty Images][1] - -Nvidia is launching a new platform called EGX Platform designed to bring real-time artificial intelligence (AI) to edge networks. The idea is to put AI computing closer to where sensors collect data before it is sent to larger data centers. - -The edge serves as a buffer to data sent to data centers. It whittles down the data collected and only sends what is relevant up to major data centers for processing. This can mean discarding more than 90% of data collected, but the trick is knowing which data to keep and which to discard. - -“AI is required in this data-driven world,” said Justin Boitano, senior director for enterprise and edge computing at Nvidia, on a press call last Friday. “We analyze data near the source, capture anomalies and report anomalies back to the mothership for analysis.” - -**[ Now read[20 hot jobs ambitious IT pros should shoot for][2]. ]** - -Boitano said we are hitting crossover where there is more compute at edge than cloud because more work needs to be done there. - -EGX comes from 14 server vendors in a range of form factors, combining AI with network, security and storage from Mellanox. Boitano said that the racks will fit in any industry-standard rack, so they will fit into edge containers from the likes of Vapor IO and Schneider Electric. - -EGX uses Nvidia’s low-power Jetson Nano processor, but also all the way up to Nvidia T4 processors that can deliver more than 10,000 trillion operations per second (TOPS) for real-time speech recognition and other real-time AI tasks. - -Nvdia is working on software stack called Nvidia Edge Stack that can be updated constantly, and the software runs in containers, so no reboots are required, just a restart of the container. EGX runs enterprise-grade Kubernetes container platforms like Red Hat Openshift. - -Edge Stack is optimized software that includes Nvidia drivers, a CUDA Kubernetes plugin, a CUDA container runtime, CUDA-X libraries and containerized AI frameworks and applications, including TensorRT, TensorRT Inference Server and DeepStream. - -The company is boasting more than 40 early adopters, including BMW Group Logistics, which uses EGX and its own Isaac robotic platforms to handle increasingly complex logistics with real-time efficiency. - -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/3397841/nvidia-launches-edge-computing-platform-for-ai-processing.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://images.idgesg.net/images/article/2019/02/industry_4-0_industrial_iot_smart_factory_by_leowolfert_gettyimages-689799380_2400x1600-100788464-large.jpg -[2]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190601 HPE Synergy For Dummies.md b/sources/talk/20190601 HPE Synergy For Dummies.md deleted file mode 100644 index 1b7ddbe2e7..0000000000 --- a/sources/talk/20190601 HPE Synergy For Dummies.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE Synergy For Dummies) -[#]: via: (https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html) -[#]: author: (HPE https://www.networkworld.com/author/Michael-Cooney/) - -HPE Synergy For Dummies -====== - -![istock/venimo][1] - -Business must move fast today to keep up with competitive forces. That means IT must provide an agile — anytime, anywhere, any workload — infrastructure that ensures growth, boosts productivity, enhances innovation, improves the customer experience, and reduces risk. - -A composable infrastructure helps organizations achieve these important objectives that are difficult — if not impossible — to achieve via traditional means, such as the ability to do the following: - - * Deploy quickly with simple flexing, scaling, and updating - * Run workloads anywhere — on physical servers, on virtual servers, or in containers - * Operate any workload upon which the business depends, without worrying about infrastructure resources or compatibility - * Ensure the infrastructure is able to provide the right service levels so the business can stay in business - - - -In other words, IT must inherently become part of the fabric of products and services that are rapidly innovated at every company, with an anytime, anywhere, any workload infrastructure. - -**The anytime paradigm** - -For organizations that seek to embrace DevOps, collaboration is the cultural norm. Development and operations staff work side‐by‐side to support software across its entire life cycle, from initial idea to production support. - -To provide DevOps groups — as well as other stakeholders — the IT infrastructure required at the rate at which it is demanded, enterprise IT must increase its speed, agility, and flexibility to enable people anytime composition and re‐composition of resources. Composable infrastructure enables this anytime paradigm. - -**The anywhere ability** - -Bare metal and virtualized workloads are just two application foundations that need to be supported in the modern data center. Today, containers are emerging as a compelling construct, providing significant benefits for certain kinds of workloads. Unfortunately, with traditional infrastructure approaches, IT needs to build out custom, unique infrastructure to support them, at least until an infrastructure is deployed that can seamlessly handle physical, virtual, and container‐based workloads. - -Each environment would need its own hardware and software and might even need its own staff members supporting it. - -Composable infrastructure provides an environment that supports the ability to run physical, virtual, or containerized workloads. - -**Support any workload** - -Do you have a legacy on‐premises application that you have to keep running? Do you have enterprise resource planning (ERP) software that currently powers your business but that will take ten years to phase out? At the same time, do you have an emerging DevOps philosophy under which you’d like to empower developers to dynamically create computing environments as a part of their development efforts? - -All these things can be accomplished simultaneously on the right kind of infrastructure. Composable infrastructure enables any workload to operate as a part of the architecture. - -**HPE Synergy** - -HPE Synergy brings to life the architectural principles of composable infrastructure. It is a single, purpose-built platform that reduces operational complexity for workloads and increases operational velocity for applications and services. - -Download a copy of the [HPE Synergy for Dummies eBook][2] to learn how to: - - * Infuse the IT architecture with the ability to enable agility, flexibility, and speed - * Apply composable infrastructure concepts to support both traditional and cloud-native applications - * Deploy HPE Synergy infrastructure to revolutionize workload support in the data center - - - -Also, you will find more information about HPE Synergy [here][3]. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html - -作者:[HPE][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://images.idgesg.net/images/article/2019/06/istock-1026657600-100798064-large.jpg -[2]: https://www.hpe.com/us/en/resources/integrated-systems/synergy-for-dummies.html -[3]: http://hpe.com/synergy diff --git a/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md b/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md deleted file mode 100644 index 29d2acd519..0000000000 --- a/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco will use AI/ML to boost intent-based networking) -[#]: via: (https://www.networkworld.com/article/3400382/cisco-will-use-aiml-to-boost-intent-based-networking.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco will use AI/ML to boost intent-based networking -====== -Cisco explains how artificial intelligence and machine learning fit into a feedback loop that implements and maintain desired network conditions to optimize network performance for workloads using real-time data. -![xijian / Getty Images][1] - -Artificial Intelligence and machine learning are expected to be some of the big topics at next week’s Cisco Live event and the company is already talking about how those technologies will help drive the next generation of [Intent-Based Networking][2]. - -“Artificial intelligence will change how we manage networks, and it’s a change we need,” wrote John Apostolopoulos Cisco CTO and vice president of Enterprise Networking in a [blog][3] about how Cisco says these technologies impact the network. - -**[ Now see[7 free network tools you must have][4]. ]** - -AI is the next major step for networking capabilities, and while researchers have talked in the past about how great AI would be, now the compute power and algorithms exist to make it possible, Apostolopoulos told Network World. - -To understand how AI and ML can boost IBN, Cisco says it's necessary to understand four key factors an IBN environment needs: infrastructure, translation, activation and assurance. - -Infrastructure can be virtual or physical and include wireless access points, switches, routers, compute and storage. “To make the infrastructure do what we want, we use the translation function to convert the intent, or what we are trying to make the network accomplish, from a person or computer into the correct network and security policies. These policies then must be activated on the network,” Apostolopoulos said. - -The activation step takes the network and security polices and couples them with a deep understanding of the network infrastructure that includes both real-time and historic data about its behavior. It then activates or automates the policies across all of the network infrastructure elements, ideally optimizing for performance, reliability and security, Apostolopoulos wrote. - -Finally assurance maintains a continuous validation-and-verification loop. IBN improves on translation and assurance to form a valuable feedback loop about what’s going on in the network that wasn’t available before. ** ** - -Apostolopoulos used the example of an international company that wanted to set up a world-wide video all-hands meeting. Everyone on the call had to have high-quality, low-latency video, and also needed the capability to send high-quality video into the call when it was time for Q&A. - -“By applying machine learning and related machine reasoning, assurance can also sift through the massive amount of data related to such a global event to correctly identify if there are any problems arising. We can then get solutions to these issues – and even automatically apply solutions – more quickly and more reliably than before,” Apostolopoulos said. - -In this case, assurance could identify that the use of WAN bandwidth to certain sites is increasing at a rate that will saturate the network paths and could proactively reroute some of the WAN flows through alternative paths to prevent congestion from occurring, Apostolopoulos wrote. - -“In prior systems, this problem would typically only be recognized after the bandwidth bottleneck occurred and users experienced a drop in call quality or even lost their connection to the meeting. It would be challenging or impossible to identify the issue in real time, much less to fix it before it distracted from the experience of the meeting. Accurate and fast identification through ML and MR coupled with intelligent automation through the feedback loop is key to successful outcome.” - -Apostolopoulos said AI can accelerate the path from intent into translation and activation and then examine network and behavior data in the assurance step to make sure everything is working correctly. Activation uses the insights to drive more intelligent actions for improved performance, reliability and security, creating a cycle of network optimization. - -So what might an implementation of this look like? Applications that run on Cisco’s DNA Center may be the central component in an IBN environment. Introduced on 2017 as the heart of its IBN initiative, [Cisco DNA Center][5] features automation capabilities, assurance setting, fabric provisioning and policy-based segmentation for enterprise networks. - -“DNA Center can bring together AI and ML in a unified manner,” Apostolopoulos said. “It can store data from across the network and then customers can do AI and ML on that data.” - -Central to Cisco's push is being able to gather metadata about traffic as it passes without slowing the traffic, which is accomplished through the use of ASICs in its campus and data-center switches. - -“We have designed our networking gear from the ASIC, OS and software levels to gather key data via our IBN architecture, which provides unified data collection and performs algorithmic analysis across the entire network (wired, wireless, LAN, WAN, datacenter), Apostolopoulos said. “We have a massive collection of network data, including a database of problems and associated root causes, from being the world’s top enterprise network vendor over the past 20-plus years. And we have been investing for many years to create innovative network-data analysis and ML, MR, and other AI techniques to identify and solve key problems.” - -Machine learning and AI can then be applied to all that data to help network operators handle everything from policy setting and network control to security. - -“I also want to stress that the feedback the IT user gets from the IBN system with AI is not overwhelming telemetry data,” Apostolopoulos said. Instead it is valuable and actionable insights at scale, derived from immense data and behavioral analytics using AI. - -Managing and developing new AI/ML-based applications from enormous data sets beyond what Cisco already has is a key driver behind it’s the company’s Unified Compute System (UCS) server that wasa rolled out last September. While the new server, the UCS C480 ML, is powerful – it includes eight Nvidia Tesla V100-32G GPUs with 128GB of DDR4 RAM, 24 SATA hard drives and more – it is the ecosystem of vendors – Cloudera, HortonWorks and others that will end up being more important. - -[Earlier this year Cisco forecast][6] that [AI and ML][7] will significantly boost network management this year. - -“In 2019, companies will start to adopt Artificial Intelligence, in particular Machine Learning, to analyze the telemetry coming off networks to see these patterns, in an attempt to get ahead of issues from performance optimization, to financial efficiency, to security,” said [Anand Oswal][8], senior vice president of engineering in Cisco’s Enterprise Networking Business. The pattern-matching capabilities of ML will be used to spot anomalies in network behavior that might otherwise be missed, while also de-prioritizing alerts that otherwise nag network operators but that aren’t critical, Oswal said. - -“We will also start to use these tools to categorize and cluster device and user types, which can help us create profiles for use cases as well as spot outlier activities that could indicate security incursions,” he said. - -The first application of AI in network management will be smarter alerts that simply report on activities that break normal patterns, but as the technology advances it will react to more situations autonomously. The idea is to give customers more information so they and the systems can make better network decisions. Workable tools should appear later in 2019, Oswal said. - -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/3400382/cisco-will-use-aiml-to-boost-intent-based-networking.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://images.idgesg.net/images/article/2019/05/ai-vendor-relationship-management_bar-code_purple_artificial-intelligence_hand-on-virtual-screen-100795252-large.jpg -[2]: http://www.networkworld.com/cms/article/3202699 -[3]: https://blogs.cisco.com/enterprise/improving-networks-with-ai -[4]: https://www.networkworld.com/article/2825879/7-free-open-source-network-monitoring-tools.html -[5]: https://www.networkworld.com/article/3280988/cisco-opens-dna-center-network-control-and-management-software-to-the-devops-masses.html -[6]: https://www.networkworld.com/article/3332027/cisco-touts-5-technologies-that-will-change-networking-in-2019.html -[7]: https://www.networkworld.com/article/3320978/data-center/network-operations-a-new-role-for-ai-and-ml.html -[8]: https://blogs.cisco.com/author/anandoswal -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md b/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md deleted file mode 100644 index b140969eb5..0000000000 --- a/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Juniper: Security could help drive interest in SDN) -[#]: via: (https://www.networkworld.com/article/3400739/juniper-sdn-snapshot-finds-security-legacy-network-tech-impacts-core-network-changes.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Juniper: Security could help drive interest in SDN -====== -Juniper finds that enterprise interest in software-defined networking (SDN) is influenced by other factors, including artificial intelligence (AI) and machine learning (ML). -![monsitj / Getty Images][1] - -Security challenges and developing artificial intelligence/maching learning (AI/ML) technologies are among the key issues driving [software-defined networking][2] (SDN) implementations, according to a new Juniper survey of 500 IT decision makers. - -And SDN interest abounds – 98% of the 500 said they were already using or considering an SDN implementation. Juniper said it had [Wakefield Research][3] poll IT decision makers of companies with 500 or more employees about their SDN strategies between May 7 and May 14, 2019. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][4] - * [How to pick an off-site data-backup method][5] - * [SD-Branch: What it is and why you’ll need it][6] - * [What are the options for security SD-WAN?][7] - - - -SDN includes technologies that separate the network control plane from the forwarding plane to enable more automated provisioning and policy-based management of network resources. - -IDC estimates that the worldwide data-center SDN market will be worth more than $12 billion in 2022, recording a CAGR of 18.5% during the 2017-2022 period. The market-generated revenue of nearly $5.15 billion in 2017 was up more than 32.2% from 2016. - -There are many ideas driving the development of SDN. For example, it promises to reduce the complexity of statically defined networks; make automating network functions much easier; and allow for simpler provisioning and management of networked resources from the data center to the campus or wide area network. - -While the evolution of SDN is ongoing, Juniper’s study pointed out an issue that was perhaps not unexpected – many users are still managing operations via the command line interface (CLI). CLI is the primary text-based user interface used for configuring, monitoring and maintaining most networked devices. - -“If SDN is as attractive as it is then why manage the network with the same legacy technology of the past?” said Michael Bushong, vice president of enterprise and cloud marketing at Juniper Networks. “If you deploy SDN and don’t adjust the operational model then it is difficult to reap all the benefits SDN can bring. It’s the difference between managing devices individually which you may have done in the past to managing fleets of devices via SDN – it simplifies and reduces operational expenses.” - -Juniper pointed to a [Gartner prediction][8] that stated “by 2020, only 30% of network operations teams will use the command line interface (CLI) as their primary interface, down from 85% at years end 2016.” Garter stated that poll results from a recent Gartner conference found some 71% still using CLI as the primary way to make network changes. - -Gartner [wrote][9] in the past that CLI has remained the primary operational tool for mainstream network operations teams for easily the past 15-20 years but that “moving away from the CLI is a good thing for the networking industry, and while it won’t disappear completely (advanced/nuanced troubleshooting for example), it will be supplanted as the main interface into networking infrastructure.” - -Juniper’s study found that 87% of businesses are still doing most or some of their network management at the device level. - -What all of this shows is that customers are obviously interested in SDN but are still grappling with the best ways to get there, Bushong said. - -The Juniper study also found users interested in SDN because of the potential for a security boost. - -SDN can empowers a variety of security benefits. A customer can split up a network connection between an end user and the data center and have different security settings for the various types of network traffic. A network could have one public-facing, low-security network that does not touch any sensitive information. Another segment could have much more fine-grained remote-access control with software-based [firewall][10] and encryption policies on it, which allow sensitive data to traverse over it. SDN users can roll out security policies across the network from the data center to the edge much more rapidly than traditional network environments. - -“Many enterprises see security—not speed—as the biggest consequence of not making this transition in the next five years, with nearly 40 percent identifying the inability to quickly address new threats as one of their main concerns,” wrote Manoj Leelanivas, chief product officer at Juniper Networks, in a blog about the survey. - -“SDN is not often associated with greater security but this makes sense when we remember this is an operational transformation. In security, the challenge lies not in identifying threats or creating solutions, but in applying these solutions to a fragmented network. Streamlining complex security operations, touching many different departments and managing multiple security solutions, is where a software-defined approach can provide the answer,” Leelanivas stated. - -Some of the other key findings from Juniper included: - - * **The future of AI** : The deployment of artificial intelligence is about changing the operational model, Bushong said. “The ability to more easily manage workflows over groups of devices and derive usable insights to help customers be more proactive rather than reactive is the direction we are moving. Everything will ultimately be AI-driven, he said. - * **Automation** : While automation is often considered a threat, Juniper said its respondents see it positively within the context of SDN, with 38% reporting it will improve security and 25% that it will enhance their jobs by streamlining manual operations. - * **Flexibility** : Agility is the #1 benefit respondents considering SDN want to gain (48%), followed by improved reliability (43%) and greater simplicity (38%). - * **SD-WAN** : The majority, 54%, have rolled out or are in the process of rolling out SD-WAN, while an additional 34% have it under current consideration. - - - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3400739/juniper-sdn-snapshot-finds-security-legacy-network-tech-impacts-core-network-changes.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://images.idgesg.net/images/article/2019/03/sdn_software-defined-network_architecture-100791938-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.wakefieldresearch.com/ -[4]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[5]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[6]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[7]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[8]: https://blogs.gartner.com/andrew-lerner/2018/01/04/checking-in-on-the-death-of-the-cli/ -[9]: https://blogs.gartner.com/andrew-lerner/2016/11/22/predicting-the-death-of-the-cli/ -[10]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190611 Cisco launches a developer-community cert program.md b/sources/talk/20190611 Cisco launches a developer-community cert program.md deleted file mode 100644 index 92ce486e6d..0000000000 --- a/sources/talk/20190611 Cisco launches a developer-community cert program.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco launches a developer-community cert program) -[#]: via: (https://www.networkworld.com/article/3401524/cisco-launches-a-developer-community-cert-program.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco launches a developer-community cert program -====== -Cisco has revamped some of its most critical certification and career-development programs in an effort to address the emerging software-oriented-network environment. -![Getty Images][1] - -SAN DIEGO – Cisco revamped some of its most critical certification and career-development tools in an effort to address the emerging software-oriented network environment. - -Perhaps one of the biggest additions – rolled out here at the company’s Cisco Live customer event – is the new set of professional certifications for developers utilizing Cisco’s growing DevNet developer community. - -**[ Also see[4 job skills that can boost networking salaries][2] and [20 hot jobs ambitious IT pros should shoot for][3].]** - -The Cisco Certified DevNet Associate, Specialist and Professional certifications will cover software development for applications, automation, DevOps, cloud and IoT. They will also target software developers and network engineers who develop software proficiency to develop applications and automated workflows for operational networks and infrastructure. - -“This certification evolution is the next step to reflect the critical skills network engineers must have to be at the leading edge of networked-enabled business disruption and delivering customer excellence,” said Mike Adams, vice president and general manager of Learning@Cisco. “To perform effectively in this new world, every IT professional needs skills that are broader, deeper and more agile than ever before. And they have to be comfortable working as a multidisciplinary team including infrastructure network engineers, DevOps and automation specialists, and software professionals.” - -Other Cisco Certifications changes include: - - * Streamlined certifications to validate engineering professionals with Cisco Certified Network Associate (CCNA) and Cisco Specialist certifications as well as Cisco Certified Network Professional (CCNP) and Cisco Certified Internetwork Expert (CCIE) certifications in enterprise, data center, service provider, security and collaboration. - * For more senior professionals, the CCNP will give learners a choice of five tracks, covering enterprise technologies including infrastructure and wireless, service provider, data center, security and collaboration. Candidates will be able to further specialize in a particular focus area within those technologies. - * Cisco says it will eliminate pre-requisites for certifications, meaning engineers can change career options without having to take a defined path. - * Expansion of Cisco Networking Academy offerings to train entry level network professionals and software developers. Courses prepare students to earn CCNA and Certified DevNet Associate certifications, equipping them for high-demand jobs in IT. - - - -New network technologies such as intent-based networking, multi-domain networking, and programmability fundamentally change the capabilities of the network, giving network engineers the opportunity to architect solutions that utilize the programmable network in new and exciting ways, wrote Susie Wee senior vice president and chief technology officer of DevNet. - -“DevOps practices can be applied to the network, making the network more agile and enabling automation at scale. The new network provides more than just connectivity, it can now use policy and intent to securely connect applications, users, devices and data across multiple environments – from the data center and cloud, to the campus and branch, to the edge, and to the device,” Wee wrote. - -**[[Looking to upgrade your career in tech? This comprehensive online course teaches you how.][4] ]** - -She also announced the DevNet Automation Exchange, a community that will offer shared code, best practices and technology tools for users, developers or channel partners interested in developing automation apps. - -Wee said Cisco seeded the Automation Exchange with over 50 shared code repositories. - -“It is becoming increasingly clear that network ops can be handled much more efficiently with automation, and offering the tools to develop better applications is crucial going forward,” said Zeus Kerravala, founder and principal analyst with ZK Research. - -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/3401524/cisco-launches-a-developer-community-cert-program.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://images.idgesg.net/images/article/2019/01/run_digital-vanguard_business-executive-with-briefcase_career-growth-100786736-large.jpg -[2]: https://www.networkworld.com/article/3227832/lan-wan/4-job-skills-that-can-boost-networking-salaries.html -[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html -[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fupgrading-your-technology-career -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md b/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md deleted file mode 100644 index a6cd0c73b4..0000000000 --- a/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco offers cloud-based security for SD-WAN resources) -[#]: via: (https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco offers cloud-based security for SD-WAN resources -====== -Cisco adds support for its cloud-based security gateway Umbrella to SD-WAN software -![Thinkstock][1] - -SAN DIEGO— As many companies look to [SD-WAN][2] technology to reduce costs, improve connectivity and streamline branch office access, one of the key requirements will be solid security technologies to protect corporate resources. - -At its Cisco Live customer event here this week, the company took aim at that need by telling customers it added support for the its cloud-based security gateway – known as Umbrella – to its SD-WAN software offerings. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -At its most basic, SD-WAN lets companies aggregate a variety of network connections – including MPLS, 4G LTE and DSL – into a branch or network-edge location and provides a management software that can turn up new sites, prioritize traffic and set security policies. SD-WAN's driving principle is to simplify the way big companies turn up new links to branch offices, better manage the way those links are utilized – for data, voice or video – and potentially save money in the process. - -According to Cisco, Umbrella can provide the first line of defense against threats on the internet. By analyzing and learning from internet activity patterns, Umbrella automatically uncovers attacker infrastructure and proactively blocks requests to malicious destinations before a connection is even established — without adding latency for users. With Umbrella, customers can stop phishing and malware infections earlier, identify already infected devices faster and prevent data exfiltration, Cisco says. - -Branch offices and roaming users are more vulnerable to attacks, and attackers are looking to exploit them, said Gee Rittenhouse, senior vice president and general manager of Cisco's Security Business Group. He pointed to Enterprise Strategy Group research that says 68 percent of branch offices and roaming users were the source of compromise in recent attacks. And as organizations move to more direct internet access, this becomes an even greater risk, Rittenhouse said. - -“Scaling security at every location often means more appliances to ship and manage, more policies to separately maintain, which translates into more money and resources needed – but Umbrella offers an alternative to all that," he said. "Umbrella provides simple deployment and management, and in a single cloud platform, it unifies multiple layers of security, ncluding DNS, secure web gateway, firewall and cloud-access security,” Rittenhouse said. - -“It also acts as your secure onramp to the internet by offering secure internet access and controlled SaaS usage across all locations and roaming users.” - -Basically users can set up Umbrella support via the SD-WAN dashboard vManage, and the system automatically creates a secure tunnel to the cloud.** ** Once the SD-WAN traffic is pointed at the cloud, firewall and other security policies can be set. Customers can then see traffic and collect information about patterns or set policies and respond to anomalies, Rittenhouse said. - -Analysts said the Umbrella offering is another important security option offered by Cisco for SD-WAN customers. - -“Since it is cloud-based, using Umbrella is a great option for customers with lots of branch or SD-WAN locations who don’t want or need to have a security gateway on premises,” said Rohit Mehra, vice president of Network Infrastructure at IDC. “One of the largest requirements for large customers going forward will be the need for all manner of security technologies for the SD-WAN environment, and Cisco has a big menu of offerings that can address those requirements.” - -IDC says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40 percent yearly clip between now and then. - -The Umbrella announcement is on top of other recent SD-WAN security enhancements the company has made. In May [Cisco added support for Advanced Malware Protection (AMP) to its million-plus ISR/ASR edge routers][7] in an effort to reinforce branch- and core-network malware protection across the SD-WAN. - -“Together with Cisco Talos [Cisco’s security-intelligence arm], AMP imbues your SD-WAN branch, core and campuses locations with threat intelligence from millions of worldwide users, honeypots, sandboxes and extensive industry partnerships,” Cisco said. - -In total, AMP identifies more than 1.1 million unique malware samples a day and when AMP in Cisco SD-WAN platform spots malicious behavior it automatically blocks it, Cisco said. - -Last year Cisco added its [Viptela SD-WAN technology to the IOS XE][8] version 16.9.1 software that runs its core ISR/ASR routers such as the ISR models 1000, 4000 and ASR 1000, in use by organizations worldwide. Cisco bought Viptela in 2017. - -The release of Cisco IOS XE offered an instant upgrade path for creating cloud-controlled SD-WAN fabrics to connect distributed offices, people, devices and applications operating on the installed base, Cisco said. At the time Cisco said that Cisco SD-WAN on edge routers builds a secure virtual IP fabric by combining routing, segmentation, security, policy and orchestration. - -With the recent release of IOS-XE SD-WAN 16.11, Cisco has brought AMP and other enhancements to its SD-WAN. - -AMP support is added to a menu of security features already included in Cisco's SD-WAN software including support for URL filtering, Snort Intrusion Prevention, the ability to segment users across the WAN and embedded platform security, including the Cisco Trust Anchor module. - -The software also supports SD-WAN Cloud onRamp for CoLocation, which lets customers tie distributed multicloud applications back to a local branch office or local private data center. That way a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly to the data center. - -Also in May [Cisco and Teridion][9] said they would team to deliver faster enterprise software-defined WAN services. The integration links Cisco Meraki MX Security/SD-WAN appliances and its Auto VPN technology which lets users quickly bring up and configure secure sessions between branches and data centers with Teridion’s cloud-based WAN service. Teridion’s service promises customers better performance and control over traffic running from remote offices over the public internet to the data center. - -Teridion said the Meraki integration creates an IPSec connection from the Cisco Meraki MX to the Teridion edge. Customers create locations in the Teridion portal and apply the preconfigured Meraki template to them, or just upload a csv file if they have a lot of locations. Then, from each Meraki MX, they can create a third-party IPSec tunnel to the Teridion edge IP addresses that are generated as part of the Teridion configuration, the company stated. - -The combined Cisco Meraki and Teridion offering brings SD-WAN and security capabilities at the WAN edge that are tightly integrated with a WAN service delivered over cost-effective broadband or dedicated Internet access. Meraki’s MX family supports everything from SD-WAN and [Wi-Fi][10] features to next-generation [firewall][11] and intrusion prevention in a single package. - -Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.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://images.techhive.com/images/article/2015/10/cloud-security-ts-100622309-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html -[8]: https://www.networkworld.com/article/3296007/cisco-upgrade-enables-sd-wan-in-1m-israsr-routers.html -[9]: https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.html -[10]: https://www.networkworld.com/article/3318119/what-to-expect-from-wi-fi-6-in-2019.html -[11]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md b/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md deleted file mode 100644 index 30e225de98..0000000000 --- a/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Dell and Cisco extend VxBlock integration with new features) -[#]: via: (https://www.networkworld.com/article/3402036/dell-and-cisco-extend-vxblock-integration-with-new-features.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Dell and Cisco extend VxBlock integration with new features -====== -Dell EMC and Cisco took another step in their alliance, announcing plans to expand VxBlock 1000 integration across servers, networking, storage, and data protection. -![Dell EMC][1] - -Just two months ago [Dell EMC and Cisco renewed their converged infrastructure][2] vows, and now the two have taken another step in the alliance. At this year’s at [Cisco Live][3] event taking place in San Diego, the two announced plans to expand VxBlock 1000 integration across servers, networking, storage, and data protection. - -This is done through support of NVMe over Fabrics (NVMe-oF), which allows enterprise SSDs to talk to each other directly through a high-speed fabric. NVMe is an important advance because SATA and PCI Express SSDs could never talk directly to other drives before until NVMe came along. - -To leverage NVMe-oF to its fullest extent, Dell EMC has unveiled a new integrated Cisco compute (UCS) and storage (MDS) 32G options, extending PowerMax capabilities to deliver NVMe performance across the VxBlock stack. - -**More news from Cisco Live 2019:** - - * [Cisco offers cloud-based security for SD-WAN resources][4] - * [Cisco software to make networks smarter, safer, more manageable][5] - * [Cisco launches a developer-community cert program][6] - - - -Dell EMC said this will enhance the architecture, high-performance consistency, availability, and scalability of VxBlock and provide its customers with high-performance, end-to-end mission-critical workloads that can deliver microsecond responses. - -These new compute and storage options will be available to order sometime later this month. - -### Other VxBlock news from Dell EMC - -Dell EMC also announced it is extending its factory-integrated on-premise integrated protection solutions for VxBlock to hybrid and multi-cloud environments, such as Amazon Web Services (AWS). This update will offer to help protect VMware workloads and data via the company’s Data Domain Virtual Edition and Cloud Disaster Recovery software options. This will be available in July. - -The company also plans to release VxBlock Central 2.0 software next month. VxBlock Central is designed to help customers simplify CI administration through converged awareness, automation, and analytics. - -New to version 2.0 is modular licensing that matches workflow automation, advanced analytics, and life-cycle management/upgrade options to your needs. - -VxBlock Central 2.0 has a variety of license features, including the following: - -**Base** – Free with purchase of a VxBlock, the base license allows you to manage your system and improve compliance with inventory reporting and alerting. **Workflow Automation** – Provision infrastructure on-demand using engineered workflows through vRealize Orchestrator. New workflows available with this package include Cisco UCS server expansion with Unity and XtremIO storage arrays. **Advanced Analytics** – View capacity and KPIs to discover deeper actionable insights through vRealize Operations. **Lifecycle Management** (new, available later in 2019) – Apply “guided path” software upgrades to optimize system performance. - - * Lifecycle Management includes a new multi-tenant, cloud-based database based on Cloud IQ that will collect and store the CI component inventory structured by the customer, extending the value and ease of use of the cloud-based analytics monitoring. - * This feature extends the value and ease of use of the cloud-based analytics monitoring Cloud IQ already provides for individual Dell EMC storage arrays. - - - -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/3402036/dell-and-cisco-extend-vxblock-integration-with-new-features.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://images.idgesg.net/images/article/2019/04/dell-emc-vxblock-1000-100794721-large.jpg -[2]: https://www.networkworld.com/article/3391071/dell-emc-and-cisco-renew-converged-infrastructure-alliance.html -[3]: https://www.ciscolive.com/global/ -[4]: https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.html -[5]: https://www.networkworld.com/article/3401523/cisco-software-to-make-networks-smarter-safer-more-manageable.html -[6]: https://www.networkworld.com/article/3401524/cisco-launches-a-developer-community-cert-program.html -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md b/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md deleted file mode 100644 index 280cfd1a4a..0000000000 --- a/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Oracle updates Exadata at long last with AI and machine learning abilities) -[#]: via: (https://www.networkworld.com/article/3402559/oracle-updates-exadata-at-long-last-with-ai-and-machine-learning-abilities.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Oracle updates Exadata at long last with AI and machine learning abilities -====== -Oracle to update the Oracle Exadata Database Machine X8 server line to include artificial intelligence (AI) and machine learning capabilities, plus support for hybrid cloud. -![Magdalena Petrova][1] - -After a rather [long period of silence][2], Oracle announced an update to its server line, the Oracle Exadata Database Machine X8, which features hardware and software enhancements that include artificial intelligence (AI) and machine learning capabilities, as well as support for hybrid cloud. - -Oracle acquired a hardware business nine years ago with the purchase of Sun Microsystems. It steadily whittled down the offerings, getting out of the commodity hardware business in favor of high-end mission-critical hardware. Whereas the Exalogic line is more of a general-purpose appliance running Oracle’s own version of Linux, Exadata is a purpose-built database server, and they really made some upgrades. - -The Exadata X8 comes with the latest Intel Xeon Scalable processors and PCIe NVME flash technology to drive performance improvements, which Oracle promises a 60% increase in I/O throughput for all-Flash storage and a 25% increase in IOPS per storage server compared to Exadata X7. The X8 offers a 60% performance improvement over the previous generation for analytics with up to 560GB per second throughput. It can scan a 1TB table in under two seconds. - -**[ Also read:[What is quantum computing (and why enterprises should care)][3] ]** - -The company also enhanced the storage server to offload Oracle Database processing, and the X8 features 60% more cores and 40% higher capacity disk drives over the X7. - -But the real enhancements come on the software side. With Exadata X8, Oracle introduces new machine-learning capabilities, such as Automatic Indexing, which continuously learns and tunes the database as usage patterns change. The Indexing technology originated with the Oracle Autonomous Database, the cloud-based software designed to automate management of Oracle databases. - -And no, MySQL is not included in the stack. This is for Oracle databases only. - -“We’re taking code from Autonomous Database and making it available on prem for our customers,” said Steve Zivanic, vice president for converged infrastructure at Oracle’s Cloud Business Group. “That enables companies rather than doing manual indexing for various Oracle databases to automate it with machine learning.” - -In one test, it took a 15-year-old Netsuite database with over 9,000 indexes built up over the lifespan of the database, and in 24 hours, its AI indexer rebuilt the indexes with just 6,000, reducing storage space and greatly increasing performance of the database, since the number of indexes to search were smaller. - -### Performance improvements with Exadata - -Zivanic cited several examples of server consolidation done with Exadata but would not identify companies by name. He told of a large healthcare company that achieved a 10-fold performance improvement over IBM Power servers and consolidated 600 Power servers with 50 Exadata systems. - -A financial services company replaced 4,000 Dell servers running Red Hat Linux and VMware with 100 Exadata systems running 6,000 production Oracle databases. Not only did it reduce its power footprint, but patching was down 99%. An unnamed retailer with 28 racks of hardware from five vendors went from installing 1,400 patches per year to 16 patches on four Exadata racks. - -Because Oracle owns the entire stack, from hardware to OS to middleware and database, Exadata can roll all of its patch components – 640 in all – into a single bundle. - -“The trend we’ve noticed is you see these [IT hardware] companies who try to maintain an erector set mentality,” said Zivanic. “And you have people saying why are we trying to build pods? Why don’t we buy finished goods and focus on our core competency rather than build erector sets?” - -### Oracle Zero Data Loss Recovery Appliance X8 now available - -Oracle also announced the availability of the Oracle Zero Data Loss Recovery Appliance X8, its database backup appliance, which offers up to 10 times faster data recovery of an Oracle Database than conventional data deduplication appliances while providing sub-second recoverability of all transactions. - -The new Oracle Recovery Appliance X8 now features 30% larger capacity, nearly a petabyte in a single rack, for the same price, Oracle says. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3402559/oracle-updates-exadata-at-long-last-with-ai-and-machine-learning-abilities.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://images.techhive.com/images/article/2017/03/vid-still-79-of-82-100714308-large.jpg -[2]: https://www.networkworld.com/article/3317564/is-oracles-silence-on-its-on-premises-servers-cause-for-concern.html -[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md b/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md deleted file mode 100644 index d4a3a9a927..0000000000 --- a/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Report: Mirai tries to hook its tentacles into SD-WAN) -[#]: via: (https://www.networkworld.com/article/3403016/report-mirai-tries-to-hook-its-tentacles-into-sd-wan.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Report: Mirai tries to hook its tentacles into SD-WAN -====== - -Mirai – the software that has hijacked hundreds of thousands of internet-connected devices to launch massive DDoS attacks – now goes beyond recruiting just IoT products; it also includes code that seeks to exploit a vulnerability in corporate SD-WAN gear. - -That specific equipment – VMware’s SDX line of SD-WAN appliances – now has an updated software version that fixes the vulnerability, but by targeting it Mirai’s authors show that they now look beyond enlisting security cameras and set-top boxes and seek out any vulnerable connected devices, including enterprise networking gear. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][1] - * [How to pick an off-site data-backup method][2] - * [SD-Branch: What it is and why you’ll need it][3] - * [What are the options for security SD-WAN?][4] - - - -“I assume we’re going to see Mirai just collecting as many devices as it can,” said Jen Miller-Osborn, deputy director of threat research at Palo Alto Networks’ Unit 42, which recently issued [a report][5] about Mirai. - -### Exploiting SD-WAN gear is new - -While the exploit against the SD-WAN appliances was a departure for Mirai, it doesn’t represent a sea-change in the way its authors are approaching their work, according Miller-Osborn. - -The idea, she said, is simply to add any devices to the botnet, regardless of what they are. The fact that SD-WAN devices were targeted is more about those particular devices having a vulnerability than anything to do with their SD-WAN capabilities. - -### Responsible disclosure headed off execution of exploits - -[The vulnerability][6] itself was discovered last year by independent researchers who responsibly disclosed it to VMware, which then fixed it in a later software version. But the means to exploit the weakness nevertheless is included in a recently discovered new variant of Mirai, according to the Unit 42 report. - -The authors behind Mirai periodically update the software to add new targets to the list, according to Unit 42, and the botherders’ original tactic of simply targeting devices running default credentials has given way to a strategy that also exploits vulnerabilities in a wide range of different devices. The updated variant of the malicious software includes a total of eight new-to-Mirai exploits. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][7] ]** - -The remediated version of the VMware SD-WAN is SD-WAN Edge 3.1.2. The vulnerability still affects SD-WAN Edge 3.1.1 and earlier, [according to a VMware security advisory][8]. After the Unit 42 report came out VMware posted [a blog][9] that says it is conducting its own investigation into the matter. - -Detecting whether a given SD-WAN implementation has been compromised depends heavily on the degree of monitoring in place on the network. Any products that give IT staff the ability to notice unusual traffic to or from an affected appliance could flag that activity. Otherwise, it could be difficult to tell if anything’s wrong, Miller-Osborne said. “You honestly might not notice it unless you start seeing a hit in performance or an outside actor notifies you about it.” - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403016/report-mirai-tries-to-hook-its-tentacles-into-sd-wan.html - -作者:[Jon Gold][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/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[2]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[3]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[4]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[5]: https://unit42.paloaltonetworks.com/new-mirai-variant-adds-8-new-exploits-targets-additional-iot-devices/ -[6]: https://www.exploit-db.com/exploits/44959 -[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[8]: https://www.vmware.com/security/advisories/VMSA-2018-0011.html -[9]: https://blogs.vmware.com/security/2019/06/vmsa-2018-0011-revisited.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md b/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md deleted file mode 100644 index 9c31358d47..0000000000 --- a/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Western Digital launches open-source zettabyte storage initiative) -[#]: via: (https://www.networkworld.com/article/3402318/western-digital-launches-open-source-zettabyte-storage-initiative.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Western Digital launches open-source zettabyte storage initiative -====== -Western Digital's Zoned Storage initiative leverages new technology to create more efficient zettabyte-scale data storage for data centers by improving how data is organized when it is stored. -![monsitj / Getty Images][1] - -Western Digital has announced a project called the Zoned Storage initiative that leverages new technology to create more efficient zettabyte-scale data storage for data centers by improving how data is organized when it is stored. - -As part of this, the company also launched a [developer site][2] that will host open-source, standards-based tools and other resources. - -The Zoned Storage architecture is designed for Western Digital hardware and its shingled magnetic recording (SMR) HDDs, which hold up to 15TB of data, as well as the emerging zoned namespaces (ZNS) standard for NVMe SSDs, designed to deliver better endurance and predictability. - -**[ Now read:[What is quantum computing (and why enterprises should care)][3] ]** - -This initiative is not being retrofitted for non-SMR drives or non-NVMe SSDs. Western Digital estimates that by 2023, half of all its HDD shipments are expected to be SMR. And that will be needed because IDC predicts data will be generated at a rate of 103 zettabytes a year by 2023. - -With this project Western Digital is targeting cloud and hyperscale providers and anyone building a large data center who has to manage a large amount of data, according to Eddie Ramirez, senior director of product marketing for Western Digital. - -Western Digital is changing how data is written and stored from the traditional random 4K block writes to large blocks of sequential data, like Big Data workloads and video streams, which are rapidly growing in size and use in the digital age. - -“We are now looking at a one-size-fits-all architecture that leaves a lot of TCO [total cost of ownership] benefits on the table if you design for a single architecture,” Ramirez said. “We are looking at workloads that don’t rely on small block randomization of data but large block sequential write in nature.” - -Because drives use 4k write blocks, that leads to overprovisioning of storage, especially around SSDs. This is true of consumer and enterprise SSDs alike. My 1TB SSD drive has only 930GB available. And that loss scales. An 8TB SSD has only 6.4TB available, according to Ramirez. SSDs also have to be built with DRAM for caching of small block random writes. You need about 1GB of DRAM per 1TB of NAND to act as a buffer, according to Ramirez. - -### The benefits of Zoned Storage - -Zoned Storage allows for 15-20% more storage on a HDD the than traditional storage mechanism. It eliminates the overprovisioning of SSDs, so you get all the NAND flash the drive has and you need far fewer DRAM chips on an SSD. Additionally, Western Digital promises you will need up to one-eighth as much DRAM to act as a cache in future SSD drives, lowering the cost. - -Ramirez also said quality of service will improve, not necessarily that peak performance is better, but it will manage latency from outliers better. - -Western Digital has not disclosed what if any pricing is associated with the project. It plans to work with the open-source community, customers, and industry players to help accelerate application development around Zoned Storage through its website. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3402318/western-digital-launches-open-source-zettabyte-storage-initiative.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://images.idgesg.net/images/article/2019/02/big_data_center_server_racks_storage_binary_analytics_by_monsitj_gettyimages-951389152_3x2-100787358-large.jpg -[2]: http://ZonedStorage.io -[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md b/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md deleted file mode 100644 index b3344c5eb2..0000000000 --- a/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco connects with IBM in to simplify hybrid cloud deployment) -[#]: via: (https://www.networkworld.com/article/3403363/cisco-connects-with-ibm-in-to-simplify-hybrid-cloud-deployment.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco connects with IBM in to simplify hybrid cloud deployment -====== -Cisco and IBM are working todevelop a hybrid-cloud architecture that meld Cisco’s data-center, networking and analytics platforms with IBM’s cloud offerings. -![Ilze Lucero \(CC0\)][1] - -Cisco and IBM said the companies would meld their [data-center][2] and cloud technologies to help customers more easily and securely build and support on-premises and [hybrid-cloud][3] applications. - -Cisco, IBM Cloud and IBM Global Technology Services (the professional services business of IBM) said they will work to develop a hybrid-cloud architecture that melds Cisco’s data-center, networking and analytics platforms with IBM’s cloud offerings. IBM's contribution includea a heavy emphasis on Kubernetes-based offerings such as Cloud Foundry and Cloud Private as well as a catalog of [IBM enterprise software][4] such as Websphere and open source software such as Open Whisk, KNative, Istio and Prometheus. - -**[ Read also:[How to plan a software-defined data-center network][5] ]** - -Cisco said customers deploying its Virtual Application Centric Infrastructure (ACI) technologies can now extend that network fabric from on-premises to the IBM Cloud. ACI is Cisco’s [software-defined networking (SDN)][6] data-center package, but it also delivers the company’s Intent-Based Networking technology, which brings customers the ability to automatically implement network and policy changes on the fly and ensure data delivery. - -[IBM said Cisco ACI Virtual Pod][7] (vPOD) software can now run on IBM Cloud bare-metal servers. “vPOD consists of virtual spines and leafs and supports up to eight instances of ACI Virtual Edge. These elements are often deployed on VMware services on the IBM Cloud to support hybrid deployments from on-premises environments to the IBM Cloud," the company stated. - -“Through a new relationship with IBM’s Global Technology Services team, customers can implement Virtual ACI on their IBM Cloud,” Cisco’s Kaustubh Das, vice president of strategy and product development wrote in a [blog][8] about the agreement. “Virtual ACI is a software-only solution that you can deploy wherever you have at least two servers on which you can run the VMware ESXi hypervisor. In the future, the ability to deploy IBM Cloud Pak for Applications in a Cisco ACI environment will also be supported,” he stated. - -IBM’s prepackaged Cloud Paks include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers, Big Blue said. - -Additionally IBM said it would add support for its IBM Cloud Private, which manages Kubernetes and other containers, on Cisco HyperFlex and HyperFlex Edge hyperconverged infrastructure (HCI) systems. HyperFlex is Cisco's HCI that offers computing, networking and storage resources in a single system. The package can be managed via Cisco’s Intersight software-as-a-service cloud management platform that offers a central dashboard of HyperFlex operations. - -IBM said it was adding Hyperflex support to its IBM Cloud Pak for Applications as well. - -The paks include IBM Multicloud Manager which is a Kubernetes-based platform that runs on the company’s [IBM Cloud Private][9] platform and lets customers manage and integrate workloads on clouds from other providers such as Amazon, Red Hat and Microsoft. - -At the heart of the Multi-cloud Manager is a dashboard interface for managing thousands of Kubernetes applications and huge volumes of data regardless of where in the organization they are located. - -The idea is that Multi-cloud Manager lets operations and development teams get visibility of Kubernetes applications and components across the different clouds and clusters via a single control pane. - -“With IBM Multicloud Manager, enterprises can have a single place to manage multiple clusters running across multiple on-premises, public and private cloud environments, providing consistent visibility, governance and automation from on-premises to the edge, wrote IBM’s Evaristus Mainsah, general manager of IBM Cloud Private Ecosystem in a [blog][7] about the relationship. - -Distributed workloads can be pushed out and managed directly at the device at a much larger scale across multiple public clouds and on-premises locations. Visibility, compliance and governance are provided with extended MCM capabilities that will be available at the lightweight device layer, with a connection back to the central server/gateway, Mainsah stated. - -In addition, Cisco’s AppDynamics\can be tied in to monitor infrastructure and business performance, Cisco stated. Cisco recently added [AppDynamics for Kubernetes][10], which Cisco said will reduce the time it takes to identify and troubleshoot performance issues across Kubernetes clusters. - -The companies said the hybrid-cloud architecture they envision will help reduce the complexity of setting up and managing hybrid-cloud environments. - -Cisco and IBM are both aggressively pursuing cloud customers. Cisco[ ramped up][11] its own cloud presence in 2018 with all manner of support stemming from an [agreement with Amazon Web Services][12] (AWS) that will offer enterprise customers an integrated platform to help them more simply build, secure and connect [Kubernetes][13] clusters across private [data centers][14] and the AWS cloud. - -Cisco and Google in [April expanded their joint cloud-development][15] activities to help customers more easily build secure multicloud and hybrid applications everywhere from on-premises data centers to public clouds. - -IBM is waiting to close [its $34 billion Red Hat deal][16] that it expects will give it a huge presence in the hotly contested hybrid-cloud arena and increase its inroads to competitors – Google, Amazon and Microsoft among others. Gartner says that market will be worth $240 billion by next year. - -Join the Network World communities on [Facebook][17] and [LinkedIn][18] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403363/cisco-connects-with-ibm-in-to-simplify-hybrid-cloud-deployment.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://images.idgesg.net/images/article/2018/03/cubes_blocks_squares_containers_ilze_lucero_cc0_via_unsplash_1200x800-100752172-large.jpg -[2]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[3]: https://www.networkworld.com/article/3233132/what-is-hybrid-cloud-computing.html -[4]: https://www.networkworld.com/article/3340043/ibm-marries-on-premises-private-and-public-cloud-data.html -[5]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[6]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[7]: https://www.ibm.com/blogs/cloud-computing/2019/06/18/ibm-cisco-collaborating-hybrid-cloud-modern-enterprise/ -[8]: https://blogs.cisco.com/datacenter/cisco-and-ibm-cloud-announce-hybrid-cloud-partnership -[9]: https://www.ibm.com/cloud/private -[10]: https://blog.appdynamics.com/product/kubernetes-monitoring-with-appdynamics/ -[11]: https://www.networkworld.com/article/3322937/lan-wan/what-will-be-hot-for-cisco-in-2019.html?nsdr=true -[12]: https://www.networkworld.com/article/3319782/cloud-computing/cisco-aws-marriage-simplifies-hybrid-cloud-app-development.html?nsdr=true -[13]: https://www.networkworld.com/article/3269848/cloud-computing/cisco-embraces-kubernetes-pushing-container-software-into-mainstream.html -[14]: https://www.networkworld.com/article/3223692/data-center/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[15]: https://www.networkworld.com/article/3388218/cisco-google-reenergize-multicloudhybrid-cloud-joint-development.html -[16]: https://www.networkworld.com/article/3316960/ibm-says-buying-red-hat-makes-it-the-biggest-in-hybrid-cloud.html -[17]: https://www.facebook.com/NetworkWorld/ -[18]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md b/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md deleted file mode 100644 index 187e883706..0000000000 --- a/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco issues critical security warnings on SD-WAN, DNA Center) -[#]: via: (https://www.networkworld.com/article/3403349/cisco-issues-critical-security-warnings-on-sd-wan-dna-center.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco issues critical security warnings on SD-WAN, DNA Center -====== -Vulnerabilities to Cisco's SD-WAN and DNA Center software top a list of nearly 30 security advisories issued by the company. -![zajcsik \(CC0\)][1] - -Cisco has released two critical warnings about security issues with its SD-WAN and DNA Center software packages. - -The worse, with a Common Vulnerability Scoring System rating of 9.3 out of 10, is a vulnerability in its [Digital Network Architecture][2] (DNA) Center software that could let an unauthenticated attacker connect an unauthorized network device to the subnet designated for cluster services. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -A successful exploit could let an attacker reach internal services that are not hardened for external access, Cisco [stated][7]. The vulnerability is due to insufficient access restriction on ports necessary for system operation, and the company discovered the issue during internal security testing, Cisco stated. - -Cisco DNA Center gives IT teams the ability to control access through policies using Software-Defined Access, automatically provision through Cisco DNA Automation, virtualize devices through Cisco Network Functions Virtualization (NFV), and lower security risks through segmentation and Encrypted Traffic Analysis. - -This vulnerability affects Cisco DNA Center Software releases prior to 1.3, and it is fixed in version 1.3 and releases after that. - -Cisco wrote that system updates are available from the Cisco cloud but not from the [Software Center][8] on Cisco.com. To upgrade to a fixed release of Cisco DNA Center Software, administrators can use the “System Updates” feature of the software. - -A second critical warning – with a CVVS score of 7.8 – is a weakness in the command-line interface of the Cisco SD-WAN Solution that could let an authenticated local attacker elevate lower-level privileges to the root user on an affected device. - -Cisco [wrote][9] that the vulnerability is due to insufficient authorization enforcement. An attacker could exploit this vulnerability by authenticating to the targeted device and executing commands that could lead to elevated privileges. A successful exploit could let the attacker make configuration changes to the system as the root user, the company stated. - -This vulnerability affects a range of Cisco products running a release of the Cisco SD-WAN Solution prior to Releases 18.3.6, 18.4.1, and 19.1.0 including: - - * vBond Orchestrator Software - * vEdge 100 Series Routers - * vEdge 1000 Series Routers - * vEdge 2000 Series Routers - * vEdge 5000 Series Routers - * vEdge Cloud Router Platform - * vManage Network Management Software - * vSmart Controller Software - - - -Cisco said it has released free [software updates][10] that address the vulnerability described in this advisory. Cisco wrote that it fixed this vulnerability in Release 18.4.1 of the Cisco SD-WAN Solution. - -The two critical warnings were included in a dump of [nearly 30 security advisories][11]. - -There were two other “High” impact rated warnings involving the SD-WAN software. - -One, a vulnerability in the vManage web-based UI (Web UI) of the Cisco SD-WAN Solution could let an authenticated, remote attacker gain elevated privileges on an affected vManage device, Cisco [wrote][12]. - -The vulnerability is due to a failure to properly authorize certain user actions in the device configuration. An attacker could exploit this vulnerability by logging in to the vManage Web UI and sending crafted HTTP requests to vManage. A successful exploit could let attackers gain elevated privileges and make changes to the configuration that they would not normally be authorized to make, Cisco stated. - -Another vulnerability in the vManage web-based UI could let an authenticated, remote attacker inject arbitrary commands that are executed with root privileges. - -This exposure is due to insufficient input validation, Cisco [wrote][13]. An attacker could exploit this vulnerability by authenticating to the device and submitting crafted input to the vManage Web UI. - -Both vulnerabilities affect Cisco vManage Network Management Software that is running a release of the Cisco SD-WAN Solution prior to Release 18.4.0 and Cisco has released free [software updates][10] to correct them. - -Other high-rated vulnerabilities Cisco disclosed included: - - * A [vulnerability][14] in the Cisco Discovery Protocol (CDP) implementation for the Cisco TelePresence Codec (TC) and Collaboration Endpoint (CE) Software could allow an unauthenticated, adjacent attacker to inject arbitrary shell commands that are executed by the device. - * A [weakness][15] in the internal packet-processing functionality of the Cisco StarOS operating system running on virtual platforms could allow an unauthenticated, remote attacker to cause an affected device to stop processing traffic, resulting in a denial of service (DoS) condition. - * A [vulnerability][16] in the web-based management interface of the Cisco RV110W Wireless-N VPN Firewall, Cisco RV130W Wireless-N Multifunction VPN Router, and Cisco RV215W Wireless-N VPN Router could allow an unauthenticated, remote attacker to cause a reload of an affected device, resulting in a denial of service (DoS) condition. - - - -Cisco has [released software][10] fixes for those advisories as well. - -Join the Network World communities on [Facebook][17] and [LinkedIn][18] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403349/cisco-issues-critical-security-warnings-on-sd-wan-dna-center.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://images.idgesg.net/images/article/2018/04/lightning_storm_night_gyorgy_karoly_toth_aka_zajcsik_cc0_via_pixabay_1200x800-100754504-large.jpg -[2]: https://www.networkworld.com/article/3401523/cisco-software-to-make-networks-smarter-safer-more-manageable.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-dnac-bypass -[8]: https://software.cisco.com/download/home -[9]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-privesca -[10]: https://tools.cisco.com/security/center/resources/security_vulnerability_policy.html#fixes -[11]: https://tools.cisco.com/security/center/publicationListing.x?product=Cisco&sort=-day_sir&limit=50#~Vulnerabilities -[12]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-privilescal -[13]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-cmdinj -[14]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-tele-shell-inj -[15]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-staros-asr-dos -[16]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-rvrouters-dos -[17]: https://www.facebook.com/NetworkWorld/ -[18]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md b/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md deleted file mode 100644 index eb2dc6f18e..0000000000 --- a/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (You Can’t Afford Not to Use a Business-Driven SD-WAN) -[#]: via: (https://www.networkworld.com/article/3404618/you-can-t-afford-not-to-use-a-business-driven-sd-wan.html) -[#]: author: (Rami Rammaha https://www.networkworld.com/author/Rami-Rammaha/) - -You Can’t Afford Not to Use a Business-Driven SD-WAN -====== - -![maxkabakov/istock][1] - -Digital transformation and cloud initiatives are changing the way IT organizations are thinking about and architecting the wide area network. It is estimated that over 70 percent of applications have already moved to the cloud. Yet, the transformational promise of the cloud is falling short as conventional networks can’t keep pace with demands of the cloud. Why? Because today’s router-centric and basic [SD-WAN][2] architectures have either hit the wall or can’t keep up with traffic pattern shifts, distributed applications and the open security perimeters inherent to the cloud. This blog will explore the limitations of today’s WAN approaches, offering a better way forward with a business-first networking model. - -### **Traditional Router-centric WAN** - -The traditional router-centric model is network-driven, where businesses are forced to conform to the constraints of the network. Enterprises struggle trying to stretch the old router-centric WAN – it’s too cumbersome and complicated and is simply unable to meet the business needs of a cloud-first enterprise. Cloud-first enterprise business requirements include: - - * Using the internet to connect users directly to cloud applications - * Delivering new applications to 1000s of sites, across multiple clouds, in 10 percent of the time - * Delivering 10x more bandwidth at the edge, for the same budget - * Protecting the business when the cloud is open, accessible and everything is connected - * Continuously delivering a WOW application performance for every business-critical application - - - -![][3] - -### **Basic SD-WAN Solutions** - -To address the requirements of cloud-first businesses, a plethora of SD-WAN solutions have emerged in the past few years. Basic SD-WAN solutions are a step in the right direction but fall well short of the goal of a fully automated business-driven network. A basic SD-WAN provides some level of automation and intelligence, but it is unable to continuously and automatically adapt to changing network conditions. A basic SD-WAN solution can’t deliver a consistent WOW experience for real-time voice and video applications, especially over broadband. Furthermore, with a basic SD-WAN, IT is unable to deliver a simplified end-to-end secure segmentation across the LAN-WAN-LAN/Data Center to minimize the attack surface.  A basic SD-WAN also won’t deliver on the promised savings in operational costs. The graphic below illustrates the short falls of a basic SD-WAN offering.  - -![][4] - -### **The Time is Now to Shift to a Business-driven SD-WAN** - -With a [business-driven SD-WAN][5], the network becomes a business enabler, not a constraint. It acts as a business accelerant with a top-down approach that starts with business intent. Business intent defines how applications should be delivered to end users. Business intent can include performance, priority, security, resiliency, routing, etc. that should be applied to different classes of applications. With a business-driven SD-WAN, network resources are matched – automatically – based on the business priority and security requirements for every application. The network continuously monitors the performance of applications and transport resources and automatically adapts to any changes to remain in compliance with application QoS and security policies. A business-driven SD-WAN delivers the highest quality of experience for users with consistent, reliable application performance – including the highest quality voice and video over broadband.  - -The highest quality of experience doesn’t stop with users. With [centralized orchestration][6], a business-driven SD-WAN minimizes human error, makes changes easier and enables faster response to business needs. A business-driven SD-WAN goes beyond the automation and templates of basic SD-WAN solutions to power a self-driving wide area network™ that learns and adapts to the changing requirements of the business to ensure the highest levels of end user and application performance. It eliminates the impact of brownouts and blackouts as monitoring and analytics detect changing conditions and trigger immediate adjustments. Built-in monitoring, alarms/alerts and reporting enables faster troubleshooting when issues occur. With a highly available, resilient, business-driven SD-WAN, IT can reclaim their weekends and sleep through the night!  A unified platform is designed as one unifying and orchestrating network functions such as SD-WAN, firewall, segmentation, routing, WAN optimization, application visibility and control based on business requirements. With service chaining, to ecosystem partners (security, cloud and service providers), existing investments can be fully leveraged with rapid deployment, interoperating with full and open APIs.     - -![][7] - -In this table, a comparison of router-centric, basic SD-WAN and business-driven SD-WAN shows that enterprises get the most value and benefits from shifting to a business-first networking model.  - -![Full Harvey Ball: Most; Empty Harvey Ball: Least][8] - -Click on the [infographic][9] for a full summary of the WAN edge architecture approaches. - -![][10] - -With an interactive ROI calculator, you can calculate savings between a business-driven SD-WAN from Silver Peak and a traditional router-centric SD-WAN. Click [here][11] to calculate your savings right now. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3404618/you-can-t-afford-not-to-use-a-business-driven-sd-wan.html - -作者:[Rami Rammaha][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/Rami-Rammaha/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/06/istock-1073941846-100800084-large.jpg -[2]: https://www.silver-peak.com/sd-wan/sd-wan-explained -[3]: https://images.idgesg.net/images/article/2019/06/illo_1-100800095-large.jpg -[4]: https://images.idgesg.net/images/article/2019/06/illo_2-100800097-large.jpg -[5]: https://www.silver-peak.com/products/unity-edge-connect -[6]: https://www.silver-peak.com/products/unity-orchestrator -[7]: https://images.idgesg.net/images/article/2019/06/illo_3-100800099-large.jpg -[8]: https://images.idgesg.net/images/article/2019/06/sd-wan-comparison-chart4-100800100-large.jpg -[9]: https://www.silver-peak.com/sites/default/files/infoctr/sd-wan-comparison-diagram-0119.pdf -[10]: https://images.idgesg.net/images/article/2019/06/acomparisonoftodayswanedgeapproaches-100800113-large.jpg -[11]: https://www.silver-peak.com/sd-wan-interactive-roi-calculator diff --git a/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md b/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md deleted file mode 100644 index 0548e968fe..0000000000 --- a/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Juniper’s Mist adds WiFi 6, AI-based cloud services to enterprise edge) -[#]: via: (https://www.networkworld.com/article/3405123/juniper-s-mist-adds-wifi-6-ai-based-cloud-services-to-enterprise-edge.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Juniper’s Mist adds WiFi 6, AI-based cloud services to enterprise edge -====== -Mist, a Juniper Networks company, has rolled out an artificial-intelligence, cloud-based appliance and a WIFI 6 access point aimed at helping users roll out smart, high-density wireless networks. -![Getty Images][1] - -Mist, now a Juniper Networks company, has rolled out an artificial-intelligence, cloud-based appliance and a WiFi 6 access point that together aim at helping users deploy smart, high-density wireless networks. - -Leading the rollout is the Mist Edge appliance that extends Mist’s cloud services to the branch and lets enterprises manage the distributed Wi-Fi infrastructure from a central location.  - -**More about 802.11ax (Wi-Fi 6)** - - * [Why 802.11ax is the next big thing in wireless][2] - * [FAQ: 802.11ax Wi-Fi][3] - * [Wi-Fi 6 (802.11ax) is coming to a router near you][4] - * [Wi-Fi 6 with OFDMA opens a world of new wireless possibilities][5] - * [802.11ax preview: Access points and routers that support Wi-Fi 6 are on tap][6] - - - -The Mist Edge device features the company’s artificial-intelligence engine that helps automate tasks such as adjusting Wi-Fi signal strength and troubleshooting.  According to Mist, some other potential use cases for Mist Edge include: - - * Seamless roaming for large campus networks through on-premises tunnel termination of traffic to/from access points. - * Extending virtual LANs (VLANs) to distributed branches and telecommuters to replace remote virtual private network (VPN) technology. - * Dynamic traffic segmentation for IoT devices. - * The ability to split tunneling to keep guest access and corporate traffic separate. - - - -The company says a software-only version of Mist Edge will be available in the future.  - -[Mist’s][7] strength is its AI-based wireless platform which makes Wi-Fi more predictable, reliable and measurable. Mist is also unique in how it has delivered applications via cloud microservices and containers which could be attractive to enterprise users looking to reduce wireless operational costs, experts say.  - -Mist’s cloud-based system brings patented dynamic packet capture and machine learning technology to automatically identify, adapt and fix network issues, Gartner wrote in a recent Magic Quadrant report. The Mist system is delivered and managed via cloud services. - -“Mist's AI-driven Wi-Fi provides guest access, network management, policy applications and a virtual network assistant as well as analytics, IoT segmentation, and behavioral analysis at scale,” Gartner stated.  “Mist offers a new and unique approach to high-accuracy location services through a cloud-based machine-learning engine that uses Wi-Fi and Bluetooth Low Energy (BLE)-based signals from its multielement directional-antenna access points. The same platform can be used for Real Time Location System (RTLS) usage scenarios, static or zonal applications, and engagement use cases like wayfinding and proximity notifications.” - -Juniper bought Mist in March for $405 million for this AI-based WIFI technology.  For Juniper the Mist buy was significant as it had depended on agreements with partners such as Aerohive and Aruba to deliver wireless, according to Gartner.  - -Mist, too, has partners and recently announced joint product development with VMware that integrates Mist WLAN technology and VMware’s VeloCloud-based NSX SD-WAN. - -“Mist has focused on large enterprises and has won some very well known brands,” said Chris Depuy, technology analyst with the 650 Group.  “The [Mist/Juniper] combination is a good fit because both product lines are focusing on larger enterprises and over time, we expect Mist AI will be used to benefit the entire Juniper campus portfolio.” - -The other part of the company’s rollout is a WiFi 6 (802.11ax) access point, the Mist AP43, a cloud-managed WiFi 6 access point with integrated support for Mist’s AI automation and manageability. - -“The new access point gets Juniper to 802.11ax on the same time frame as other major competitors like Cisco,” said Depuy. “Juniper could not address customers who were upgrading wireless and wired at the same time without Mist. With 802.11ax, we expect new switches to be necessary because 1 GB isn’t fast enough to support these new APs. Thus, Juniper can now upgrade customers to 802.11ax and MultiGig switches instead of bringing in another vendor. “ - -WiFi 6 is designed for high-density public or private environments. But it also will be beneficial in internet of things (IoT) deployments, and in offices that use bandwidth-hogging applications like videoconferencing. Products promising WIFI 6 support have been rolling out across the industry with [HPE][8], [Cisco][9], [Arista][10] and others recently tossing their hats into the ring. - -The enterprise WLAN is now dominated by the 802.11ac standard, which makes up 86.4% of dependent access point (AP) shipments and 93.1% of enterprise WLAN dependent AP revenues. The next iteration of the standard, 802.11ax or WiFi 6, will increase in the market throughout the rest of 2019 and into 2020. In the consumer WLAN market, the 802.11ac standard accounted for 58.0% of shipments and 79.2% of revenue in 1Q19, according to IDC’s most recent [Worldwide Quarterly WLAN Tracker][11] report. - -"The WLAN market continues to see steady, moderate growth as enterprises invest in wireless connectivity to support the continued demand for access technology," said [Brandon Butler][12], senior research analyst, Network Infrastructure at IDC in the report. "Meanwhile, the coming Wi-Fi 6 standard will be a major driver of growth in the WLAN market in the coming years, especially in the advanced enterprise segments of the market." - -The AP43 lists at $1,585. - -Mist also announced a strategic relationship with ForeScout to automate management and security control of Wi-Fi client and Internet of Things (IoT) devices.  The Juniper and Forescout mashup lets customers monitor and profile devices and mobile clients including smartphones, tablets, laptops, robots and IoT devices (HVAC systems, security devices, displays, sensors, lights) based on their network traffic patterns. Then if anomalous or threatening behavior is observed, customers can launch trouble tickets, remediate software on devices as needed or quarantine devices. - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3405123/juniper-s-mist-adds-wifi-6-ai-based-cloud-services-to-enterprise-edge.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://images.idgesg.net/images/article/2019/02/wifi_cloud_wireless-100787113-large.jpg -[2]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html -[3]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html -[4]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html -[5]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html -[6]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html -[7]: https://www.networkworld.com/article/3089038/why-one-cisco-shop-is-willing-to-give-wifi-startup-mist-a-shot.html -[8]: https://www.arubanetworks.com/products/networking/802-11ax/ -[9]: https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html -[10]: https://www.networkworld.com/article/3400905/new-switches-wi-fi-gear-to-advance-aristas-campus-architecture.html -[11]: http://www.idc.com/tracker/showproductinfo.jsp?prod_id=262 -[12]: https://www.idc.com/getdoc.jsp?containerId=PRF005027 -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md b/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md deleted file mode 100644 index 5cf40e865d..0000000000 --- a/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tempered Networks simplifies secure network connectivity and microsegmentation) -[#]: via: (https://www.networkworld.com/article/3405853/tempered-networks-simplifies-secure-network-connectivity-and-microsegmentation.html) -[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) - -Tempered Networks simplifies secure network connectivity and microsegmentation -====== -Tempered Networks’ Identity Defined Network platform uses the Host Identity Protocol to partition and isolate the network into trusted microsegments, providing an easy and cost-effective way to secure the network. -![Thinkstock][1] - -The TCP/IP protocol is the foundation of the internet and pretty much every single network out there. The protocol was designed 45 years ago and was originally only created for connectivity. There’s nothing in the protocol for security, mobility, or trusted authentication. - -The fundamental problem with TCP/IP is that the IP address within the protocol represents both the device location and the device identity on a network. This dual functionality of the address lacks the basic mechanisms for security and mobility of devices on a network. - -This is one of the reasons networks are so complicated today. To connect to things on a network or over the internet, you need VPNs, firewalls, routers, cell modems, etc. and you have all the configurations that come with ACLs, VLANs, certificates, and so on. The nightmare grows exponentially when you factor in internet of things (IoT) device connectivity and security. It’s all unsustainable at scale. - -Clearly, we need a more efficient and effective way to take on network connectivity, mobility, and security. - -**[ Also read: [What is microsegmentation? How getting granular improves network security][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** - -The Internet Engineering Task Force (IETF) tackled this problem with the Host Identity Protocol (HIP). It provides a method of separating the endpoint identifier and the locator roles of IP addresses. It introduces a new Host Identity (HI) name space, based on public keys, from which endpoint identifiers are taken. HIP uses existing IP addressing and forwarding for locators and packet delivery.The protocol is compatible with IPv4 and IPv6 applications and utilizes a customized IPsec tunnel mode for confidentiality, authentication, and integrity of network applications. - -Ratified by IETF in 2015, HIP represents a new security networking layer within the OSI stack. Think of it as Layer 3.5. It’s a flip of the trust model where TCP/IP is inherently promiscuous and will answer to anything that wants to talk to a device on that network. In contrast, HIP is a trust protocol that will not answer to anything on the network unless that connection has been authenticated and authorized based on its cryptographic identity. It is, in effect, a form of a [software-defined perimeter][4] around specific network resources. This is also known as [microsegmentation][5]. - -![][6] - -### Tempered Networks’ IDN platform creates segmented, encrypted network - -[Tempered Networks][7] has created a platform utilizing the HIP and a variety of technologies that partitions and isolates the network into trusted microsegments. Tempered Networks’ Identity Defined Networking (IDN) platform is deployed as an overlay technology that layers on top of any IP network. The HIP was designed to be both forward and backward compatible with any IP network without having to make any changes to the underlay network. The overlay network creates a direct tunnel between the two things you want to connect. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][8] ]** - -The IDN platform uses three components to create a segmented and encrypted network: an orchestration engine called the Conductor, the HIPrelay identity-based router, and HIP Services enforcement points. - -The Conductor is a centralized orchestration and intelligence engine that connects, protects, and disconnects any resource globally through a single pane of glass. The Conductor is used to define and enforce policies for HIP Services. Policy configuration is done in a simple point-and-click manner. The Conductor is available as a physical or virtual appliance or in the Amazon Web Services (AWS) cloud. - -HIP Services provide software-based policy enforcement, enabling secure connectivity among IDN-protected devices, as well as cloaking, segmentation, identity-based routing, and IP mobility. They can be deployed on or in-line to any device or system and come in the form of HIPswitch hardware, HIPserver, HIPclient, Cloud HIPswitch, or Virtual HIPswitch. HIP Services also can be embedded in customer hardware or applications. - -Placing HIPswitches in front of any connected device renders the device HIP-enabled and immediately microsegments the traffic, isolating inbound and outbound traffic from the underlying network. HIPswitches deployed on the network automatically register with the Conductor using their cryptographic identity. - -HIPrelay works with the HIP Service-enabled endpoints to deliver peer-to-peer connectivity for any device or system across all networks and transport options. Rather than using Layer 3 or 4 rule sets or traditional routing protocols, HIPrelay routes and connects encrypted communications based on provable cryptographic identities traversing existing infrastructure. - -It sounds complicated, but it really isn’t. A use case example should demonstrate the ease and power of this solution. - -### Use case: Smart Ships - -An international cruise line recently installed Tempered Networks’ IDN solution to provide tighter security around its critical maritime systems. Prior to deployment, the systems for fuel, propulsion, navigation, ballast, weather, and incinerators were on a flat Layer 2 network, which basically allowed authorized users of the network to see everything. - -Given that vendors of the different maritime systems had access to their own system, the lack of microsegmentation allowed them to see the other systems as well. The cruise line needed a simple way to segment access to these different systems — isolating them from each other — and they wanted to do it without having to put the ships in dry dock for the network reconfiguration. - -The original configuration looked like this: - -![][9] - -The company implemented microsegmentation of the network based on the functionality of the systems. This isolated and segmented vendor access to only their own systems — everything else was hidden to them. The implementation involved installing HIPrelay identity routing in the cloud, several HIPswitch wireless devices onboard the ships, and HIPclient software on the vendors’ and crew members’ devices. The Conductor appliance that managed the entire deployment was installed in AWS. - -All of that was done without impacting the underlying network, and no dry dock time was required for the deployment. In addition, the cruise line was able to eliminate internal firewalls and VPNs that had previously been used for segmentation and remote access. The resulting configuration looks like this: - -![][10] - -The color coding of the illustration above indicates what systems are now able to directly see and communicate with their corresponding controllers and sensors. Everything else on the network is hidden from view of those systems. - -The acquisition cost of the Tempered Networks’ solution was one-tenth that of a traditional microsegmentation solution. The deployment time was 2 FTE days per ship compared to the 40 FTE days a traditional solution would have needed. No additional staffing was required to support the solution, and no changes were made to the underlying network. - -### A time-tested microsegmentation solution - -This technology came out of Boeing and was deployed for over 12 years within their manufacturing facilities until 2014, when Boeing allowed the technology to become commercialized. Tempered Networks took the HIP and developed the full platform with easy, centralized management. It was purpose-built to provide secure connectivity to networks. The solution has been successfully deployed in industrial domains such as the utilities sector, oil and gas, electricity generation, and aircraft manufacturing, as well as in enterprise domains and healthcare. - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3405853/tempered-networks-simplifies-secure-network-connectivity-and-microsegmentation.html - -作者:[Linda Musthaler][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/Linda-Musthaler/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/01/network_security_hacker_virus_crime-100745979-large.jpg -[2]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3359363/software-defined-perimeter-brings-trusted-access-to-multi-cloud-applications-network-resources.html -[5]: https://www.networkworld.com/article/3247672/what-is-microsegmentation-how-getting-granular-improves-network-security.html -[6]: https://images.idgesg.net/images/article/2019/07/hip-slide-100800735-large.jpg -[7]: https://www.temperednetworks.com/ -[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[9]: https://images.idgesg.net/images/article/2019/07/cruise-ship-before-100800736-large.jpg -[10]: https://images.idgesg.net/images/article/2019/07/cruise-ship-after-100800738-large.jpg -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md b/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md index 445075b49f..fe92b389a9 100644 --- a/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md +++ b/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md @@ -1,5 +1,5 @@ [#]: collector: "lujun9972" -[#]: translator: "acyanbird " +[#]: translator: " " [#]: reviewer: " " [#]: publisher: " " [#]: url: " " diff --git a/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md b/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md deleted file mode 100644 index 96f4b055cd..0000000000 --- a/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco goes deeper into photonic, optical technology with $2.6B Acacia buy) -[#]: via: (https://www.networkworld.com/article/3407706/cisco-goes-deeper-into-photonic-optical-technology-with-2-6b-acacia-buy.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco goes deeper into photonic, optical technology with $2.6B Acacia buy -====== -Cisco: Optical-interconnect technologies are becoming increasingly strategic for data centers, service providers -![KTSimage / Getty Images][1] - -Looking to bulk-up its optical systems portfolio, Cisco says it intends to buy Acacia Communications for approximately $2.6 billion.  The deal is Cisco’s largest since it [laid out $3.7B for AppDynamics][2] in 2017. - -Acacia develops, manufactures and sells high-speed [coherent optical][3] interconnect products that are designed to transform networks linking data centers, cloud and service providers. Cisco is familiar with Acacia as it has been a “significant” customer of the optical firm for about five years, Cisco said. - -**[ Also see [How to plan a software-defined data-center network][4] and [Efficient container use requires data-center software networking][5].]** - -Acacia’s other customers include Nokia Oyj, Huawei and ZTE. Cisco accounts for about 18% of its revenue, [according to Bloomberg’s supply-chain analysis][6]. - -"With the explosion of bandwidth in the multi-cloud era, optical interconnect technologies are becoming increasingly strategic,” said David Goeckeler, executive vice president and general manager of Cisco's networking and security business in a statement. “The acquisition of Acacia will allow us to build on the strength of our switching, routing and optical networking portfolio to address our customers' most demanding requirements." - -For Cisco, one of the key drivers for making this deal was Acacia’s coherent technology – “a fancy term that means the ability to send optical signals over long distances,” said Bill Gartner, senior vice president of Cisco’s Optical Systems and Optics business.  “That technology today is typically delivered via a line card on a big chassis in a separate optical layer but with Acadia’s digital signal processing, ASIC and other technology we are looking to move that from a line card to a pluggable module that increases network capacity, but also reduces complexity and costs.” - -In addition, Acacia uses silicon photonics as the platform for integration of multiple photonic functions for coherent optics, Gartner wrote in a [blog][7] about the acquisition. “Leveraging the advances in silicon photonics, each new generation of coherent optics products has enabled higher data transmission rates, lower power and higher performance than the one before.” - -Recent research from [IHS Markit][8] shows that data center interconnections are the fastest growing segment for coherent transceivers. - -“Acacia’s digital signal processing and small form-factor long-distance communications technology is strong and will be very valuable to Cisco in the long and short term,” said Jimmy Yu, vice president of the Dell'Oro Group. - -The question many analysts have is the impact the sale will have on other Acacia customers Yu said.   “If wasn’t for Acacia selling to others, [such as Huawei, ZTE and Infinera] I don’t thise think vendors would have done as well as they have, and when Cisco owns Acacia it could be a different story,” Yu said. - -The Acacia buy will significantly boost Cisco’s optical portfolio for application outside the data center.  In February [Cisco closed a deal to buy optical-semiconductor firm Luxtera][9] for $660 million, bringing it the advanced optical technology customers will need for speed and throughput for future data center and webscale networks. - -The combination of Cisco’s and Luxtera’s capabilities in 100GbE/400GbE optics, silicon and process technology will help customers build future-proof networks optimized for performance, reliability and cost, Cisco stated. - -The reason Cisco snatched-up Luxtera was its silicon photonics technology that moves data among computer chips optically, which is far quicker than today's electrical transfer, Cisco said. Photonics will be the underpinning of future switches and other networking devices. - -"It seems that Cisco is going all in on being a supplier of optical components and optical pluggable: Luxtera (client side optical components and pluggable) and Acacia (line side optical components and pluggable)," Yu said. - -"Unless Cisco captures more of the optical systems market share and coherent shipment volume, I think Cisco will need to continue selling Acacia products to the broader market and other system vendors due to the high cost of product development," Yu said. - -The acquisition is expected to close during the second half of Cisco's FY2020, and upon close, Acacia employees will join Cisco's Optical Systems and Optics business within its networking and security business under Goeckeler. - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3407706/cisco-goes-deeper-into-photonic-optical-technology-with-2-6b-acacia-buy.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://images.idgesg.net/images/article/2019/02/money_currency_printing_press_us_100-dollar_bills_by_ktsimage_gettyimages-1015664778_2400x1600-100788423-large.jpg -[2]: https://www.networkworld.com/article/3184027/cisco-closes-appdynamics-deal-increases-software-weight.html -[3]: https://www.ciena.com/insights/what-is/What-Is-Coherent-Optics.html -[4]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[5]: https://www.networkworld.com/article/3297379/data-center/efficient-container-use-requires-data-center-software-networking.html -[6]: https://www.bloomberg.com/news/articles/2019-07-09/cisco-to-acquire-acacia-communications-for-2-6-billion-jxvs6rva?utm_source=twitter&utm_medium=social&cmpid=socialflow-twitter-business&utm_content=business&utm_campaign=socialflow-organic -[7]: https://blogs.cisco.com/news/cisco-news-announcement-07191234 -[8]: https://technology.ihs.com/ -[9]: https://www.networkworld.com/article/3339360/cisco-pushes-silicon-photonics-for-enterprise-webscale-networking.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md b/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md deleted file mode 100644 index 1cee0a981d..0000000000 --- a/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Titan supercomputer is being decommissioned: a costly, time-consuming project) -[#]: via: (https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -The Titan supercomputer is being decommissioned: a costly, time-consuming project -====== -The old gives way to new at Oak Ridge National Labs. The Titan supercomputer is being replaced by Frontier, and it's a super-sized task. -![Oak Ridge National Laboratory][1] - -A supercomputer deployed in 2012 is going into retirement after seven years of hard work, but the task of decommissioning it is not trivial. - -The Cray XK7 “Titan” supercomputer at the Department of Energy’s (DOE) Oak Ridge National Laboratory (ORNL) is scheduled to be decommissioned on August 1 and disassembled for recycling. - -At 27 petaflops, or 27 quadrillion calculations per second, Titan was at one point the fastest supercomputer in the world at its debut in 2012 and remained in the top 10 worldwide until June 2019. - -**[ Also read: [10 of the world's fastest supercomputers][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** - -But time marches on. This beast is positively ancient by computing standards. It uses 16-core AMD Opteron CPUs and Nvidia Kepler generation processors. You can buy a gaming PC with better than that today. - -“Titan has run its course,” Operations Manager Stephen McNally at ORNL said in an [article][4] published by ONRL. “The reality is, in electronic years, Titan is ancient. Think of what a cell phone was like seven years ago compared to the cell phones available today. Technology advances rapidly, including supercomputers.” - -In its seven years, Titan generated than 26 billion core hours of computing time for hundreds of research teams around the world, not just the DOE. It was one of the first to use GPUs, a groundbreaking move at the time but now commonplace. - -The Oak Ridge Leadership Computing Facility (OLCF) actually houses Titan in a 60,000-sq.-ft. facility, 20,000 of which is occupied by Titan, the Eos cluster that supports Titan and Atlas file system that holds 32 petabytes of data. - -**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][5] ]** - -June 30 was the last day users could submit jobs to Titan or Eos, another supercomputer, which is also 7 years old.  - -### Decommissioning a supercomputer is a super-sized task - -Decommissioning a computer the size of Titan is more than turning off a switch. ONRL didn’t have a dollar estimate of the cost involved, but it did discuss the scale, which should give some idea of how costly this will be. - -The decommissioning of Titan will include about 41 people, including staff from ORNL, Cray, and external subcontractors. OLCF staff are supporting users who need to complete runs, save data, or transition their projects to other resources. - -Electricians will safely shut down the 9 megawatt-capacity system, and Cray staff will disassemble and recycle Titan’s electronics and its metal components and cabinets. A separate crew will handle the cooling system. All told, 350 tons of equipment and 10,800 pounds of refrigerant are being removed from the site. - -What becomes of the old gear is unclear. Even ONRL has no idea what Cray will do with it. McNally said there is no value in Titan’s parts: “It’s simply not worth the cost to a data center or university of powering and cooling even fragments of Titan. Titan’s value lies in the system as a whole.” - -The 20,000-sq.-ft. data center that is currently home to Titan will be gutted and expanded in preparation for [Frontier][6], the an exascale system scheduled for delivery in 2021 running AMD Epyc processors and Nvidia GPUs. - -A power, cooling, and data center upgrade is already underway ahead of the Titan decommissioning to prepare for Frontier. The whole removal process will take about a month but has been in the works for several months to ensure a smooth transition for people still using the old machine. - -**[ Now read this: [10 of the world's fastest supercomputers][2] ]** - -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/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.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://images.idgesg.net/images/article/2018/06/titan_supercomputer_at_ornl_oak_ridge_national_laboratory_1200x800-100762120-large.jpg -[2]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.olcf.ornl.gov/2019/06/28/farewell-titan/ -[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[6]: https://www.olcf.ornl.gov/frontier/ -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md b/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md deleted file mode 100644 index a1a2e4cad5..0000000000 --- a/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Will IBM’s acquisition be the end of Red Hat?) -[#]: via: (https://www.networkworld.com/article/3407746/will-ibms-acquisition-be-the-end-of-red-hat.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Will IBM’s acquisition be the end of Red Hat? -====== -IBM's acquisition of Red Hat is a big deal -- a 34 billion dollar big deal -- and many Linux professionals are wondering how it's going to change Red Hat's role in the Linux world. Here are some thoughts. -![Stephen Lawson/IDG][1] - -[IBM's acquisition of Red Hat for $34 billion][2] is now a done deal, and statements from the leadership of both companies sound extremely promising. But some in the Linux users have expressed concern. - -Questions being asked by some Linux professionals and devotees include: - - * Will Red Hat lose customer confidence now that it’s part of IBM and not an independent company? - * Will IBM continue putting funds into open source after paying such a huge price for Red Hat? Will they curtail what Red Hat is able to invest? - * Both companies’ leaders are saying all the right things now, but can they predict how their business partners and customers will react as they move forward? Will their good intentions be derailed? - - - -Part of the worry simply comes from the size of this deal. Thirty-four billion dollars is a _lot_ of money. This is probably the largest cloud computing acquisition to date. What kind of strain will that price tag put on how the new IBM functions going forward? Other worries come from the character of the acquisition – whether Red Hat will be able to continue operating independently and what will change if they cannot. In addition, a few Linux devotees hark back to Oracle’s acquisition of Sun Microsystems in 2010 and Sun’s slow death in its aftermath. - -**[ Also read: [The IBM-Red Hat deal: What it means for enterprises][3] | Get daily insights: [Sign up for Network World newsletters][4] ]** - -The good news is that this merger of IBM and Red Hat appears to offer each of the companies some significant benefits. IBM makes a strong move into cloud computing, and Red Hat gains a broader international footing. - -The other good news relates to the pace at which this acquisition occurred. Initially announced on October 28, 2018, it is now more than eight months later. It’s clear that the leadership of each company has not rushed headlong into this new relationship. Both parties to the acquisition appear to be moving ahead with trust and optimism. IBM promises to ensure Red Hat's independence and will allow it to continue to be "Red Hat" both in name and business activity. - -### The end of Red Hat highly unlikely - -Will this acquisition be the end of Red Hat? That outcome is not impossible, but it seems extremely unlikely. For one thing, both companies stand to gain significantly from the other’s strong points. IBM is likely to be revitalized in ways that allow it to be more successful, and Red Hat is starting from a very strong position. While it’s a huge gamble by some measurements, I think most of us Linux enthusiasts are cautiously optimistic at worst. - -IBM seems intent on allowing Red Hat to work independently and seems to be taking the time required to work out the kinks in their plans. - -As for the eventual demise of Sun Microsystems, the circumstances were very different. As this [coverage in Network World in 2017][5] suggests, Sun was in an altogether different position when it was acquired. The future for IBM and Red Hat appears to be considerably brighter – even to a former (decades earlier) member of the Sun User Group Board of Directors. - -The answer to the question posed by the title of this post is “probably not.” Only time will tell, but leadership seems committed to doing things the right way – preserving Red Hat's role in the Linux world and making the arrangement pay off for both organizations. And I, for one, expect good things to come from the merger – for IBM, for Red Hat and likely even for Linux enthusiasts like myself. - -**[ Now read this: [The IBM-Red Hat deal: What it means for enterprises][3] ]** - -Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3407746/will-ibms-acquisition-be-the-end-of-red-hat.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://images.techhive.com/images/article/2015/10/20151027-red-hat-logo-100625237-large.jpg -[2]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html -[3]: https://www.networkworld.com/article/3317517/the-ibm-red-hat-deal-what-it-means-for-enterprises.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://www.networkworld.com/article/3222707/the-sun-sets-on-solaris-and-sparc.html -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md b/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md deleted file mode 100644 index 159c8598db..0000000000 --- a/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MPLS is hanging on in this SD-WAN world) -[#]: via: (https://www.networkworld.com/article/3409070/mpls-is-hanging-on-in-this-sd-wan-world.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -MPLS is hanging on in this SD-WAN world -====== -The legacy networking protocol is still viable and there is no need to replace it in certain use cases, argues one cloud provider. -![jamesteohart][1] - -The [SD-WAN networking market is booming and is expected to grow][2] to $17 billion by 2025, and no wonder. Software-defined wide-area networking eliminates the need for expensive routers and does all the network connectivity in the cloud. - -Among its advantages is the support for secure cloud connectivity, one area where multiprotocol label switching (MPLS) falls short. MPLS is a data protocol from before the internet took off and while ideal for communications within the corporate firewall, it doesn’t lend itself to cloud and outside communications well. - -You would think that would seal MPLS’s fate, but just like IPv6 is ever so slowly replacing IPv4, MPLS is hanging on and some IT pros are even increasing their investment. - -**[ Related: [MPLS explained – What you need to know about multi-protocol label switching][3] ]** - -Avant Communications, a cloud services provider that specializes in SD-WAN, recently issued a report entitled [State of Disruption][4] that found that 83% of enterprises that use or are familiar with MPLS plan to increase their MPLS network infrastructure this year, and 40% say they will “significantly increase” their use of it. - -The report did not find one protocol winning that the expense of another. Just as 83% plan to use MPLS, 78% acknowledged plans to use SD-WAN in their corporate networks by the end of the year. Although SD-WAN is on the rise, MPLS is clearly not going away anytime soon. Both SD-WAN and MPLS can live together in harmony, adding value to each other. - -“SD-WAN is the most disruptive technology in our study. It’s not surprising that adoption of new technologies is slowest among the largest companies. The wave of SD-WAN disruption has not fully hit larger companies yet, but our belief is that it is moving quickly upmarket,” the report stated. - -While SD-WAN is much better suited for the job of cloud connectivity, 50% of network traffic is still staying within the corporate firewall. So while SD-WAN can solve the connection issues, so can MPLS. And if you have it deployed, rip and replace makes no sense. - -“MPLS continues to have a strong role in modern networks, and we expect that to continue,” the report stated. “This is especially true among larger enterprises that have larger networks depending on MPLS. While you’ll find MPLS at the core for a long time to come, we expect to see a shared environment with SD-WAN at the edge, enabled by broadband Internet and other lower cost networks. “ - -And MPLS isn’t without its advantages, most notably it can [guarantee performance][5] while SD-WAN, at the mercy of the public internet, cannot. - -As broadband networks continue to improve in performance, SD-WAN will allow companies to reduce their reliance on MPLS, especially as equipment ages and is replaced. Avant expects that, for the foreseeable future, there will continue to be a very viable role for both. - -**More about SD-WAN:** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][6] - * [How to pick an off-site data-backup method][7] - * [SD-Branch: What it is and why you’ll need it][8] - * [What are the options for security SD-WAN?][9] - - - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3409070/mpls-is-hanging-on-in-this-sd-wan-world.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://images.idgesg.net/images/article/2019/07/the-latest-in-innovation-in-the-sd-wan-managed-services-market1400-100801684-large.jpg -[2]: https://www.prnewswire.com/news-releases/software-defined-wide-area-network-sd-wan-market-to-hit-17bn-by-2025-global-market-insights-inc-300795304.html -[3]: https://www.networkworld.com/article/2297171/sd-wan/network-security-mpls-explained.html -[4]: https://www.goavant.net/Disruption -[5]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html -[6]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[7]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[8]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[9]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md b/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md deleted file mode 100644 index 06b5726379..0000000000 --- a/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Smart cities offer window into the evolution of enterprise IoT technology) -[#]: via: (https://www.networkworld.com/article/3409787/smart-cities-offer-window-into-the-evolution-of-enterprise-iot-technology.html) -[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) - -Smart cities offer window into the evolution of enterprise IoT technology -====== -Smart-city technologies such as 0G networking hold clues for successful large-scale implementations of the internet of things in enterprise settings. -![Benjamin Hung modified by IDG Comm. \(CC0\)][1] - -Powering smart cities is one of the most ambitious use cases for the internet of things (IoT), combining a wide variety of IoT technologies to create coherent systems that span not just individual buildings or campuses but entire metropolises. As such, smart cities offer a window into the evolution of enterprise IoT technologies and implementations on the largest scale. - -And that’s why I connected with [Christophe Fourtet][2], CSO and co-founder of [Sigfox][3], a French global network operator, to learn more about using wireless networks to connect large numbers of low-power objects, ranging from smartwatches to electricity meters. (And I have to admit I was intrigued by the 0G network moniker, which conjured visions of weightless IoT devices floating in space, or maybe [OG-][4]style old-school authenticity. That’s not at all what it’s about, of course.) - -**[ Learns more: [Download a PDF bundle of five essential articles about IoT in the enterprise][5] ]** - -According to Fourtet, "Sigfox’s global 0G network specializes in inexpensively conveying small amounts of data over long ranges—without sacrificing quality. Whereas other networks aim to collect and transmit as much data as possible, as quickly as possible, we deliver small packets of information at regular intervals, giving customers only the critical information they need." - -The software-based wireless 0G network listens to devices without the need to establish and maintain network connection, eliminating signaling overhead. With network and computing complexity managed in the cloud, energy consumption and costs of connected devices are dramatically reduced, [the company says][6]. Just as important, the low power requirements can also dramatically cut battery requirements for IoT devices. - -Around the world, customers like Michelin, General Motors, and Airbus use the 0G networks to connect IoT devices, and the network is supported by more than 660 partner organizations, including device makers and service providers such as Urbansense and Bosch. Sigfox cited [0G-connected IoT devices enabling Danish cities][7] to monitor quality of life data, from detecting defects in buildings to tracking garbage collection. - -### 0G applications beyond smart cities - -In addition to smart cities applications, Sigfox serves several industry verticals, including manufacturing, agriculture, and retail. Common use cases include supply-chain management and asset tracking, both within factory/warehouse environments and between locations as containers/shipments move through the supply chain around the globe. The network is uniquely equipped for supply chain use cases due to its cost-efficiency, long-lasting batteries with totally predictable autonomy, and wide-range reach. - -In facilities management, the 0G network can connect IoT devices that track ambient factors such temperature, humidity, and occupancy. Doing so helps managers leverage occupancy data to adjust the amount of space a company needs to rent, reducing overhead costs. It can also help farmers optimize the planting, care, and harvesting of crops. - -Operating as a backup solution to ensure connectivity during a broadband network outage, 0G networking built into a cable box or router could allow service providers to access hardware even when the primary network is down, Fourtet said. - -“The 0G network does not promise a continuation of these services,” Fourtet noted, “but it can provide access to the necessary information to solve challenges associated with outages.” - -In a more dire example in the home and commercial building security market, sophisticated burglars could use cellular and Wi-Fi jammers to block a security system’s access to a network so even though alarms were issued, the service might never receive them, Fourtet said. But the 0G network can send an alert to the alarm system provider even if it has been jammed or blocked, he said. - -### How 0g networks are used today - -Current 0G implementations include helping [Louis Vuitton track luggage][8] for its traveling customers. Using a luggage tracker powered by by [Sigfox’s Monarch service][9], a suitcase can stay connected to the 0G network throughout a trip, automatically recognizing and adapting to local radio frequency standards. The idea is for travelers to track the location of their bags at major airports in multiple countries, Fourtet said, while low energy consumption promises a six-month battery life with a very small battery. - -At the Special Olympics World Games Abu Dhabi 2019, [iWire, LITE-ON and Sigfox worked together][10] to create a tracking solution designed to help safeguard 10,000 athletes and delegates. Sensors connected to the Sigfox 0G network and outfitted with Wi-Fi capabilities were equipped with tiny batteries designed to provide uninterrupted service throughout the weeklong event. The devices “periodically transmitted messages that helped to identify the location of athletes and delegates in case they went off course,” Fourtet said, while LITE-ON incorporated a panic button for use in case of emergencies. In fact, during the event, the system was used to locate a lost athlete and return them to the Games without incident, he said. - -French car manufacturer [Groupe PSA][11] uses the 0G network to optimize shipping container routes between suppliers and assembly plants. [Track&Trace][11] works with IBM’s cloud-based IoT technologies to track container locations and alert Groupe PSA when issues crop up, Fourtet said. - -### 0G is still growing - -“It takes time to build a new network,” Fourtet said. So while Sigfox has delivered 0G network coverage in 60 countries across five continents, covering 1 billion people  (including 51 U.S. metropolitan areas covering 30% of the population), Fourtet acknowledged, “[We] still have a ways to go to build our global network.” In the meantime, the company is expanding its Connectivity-as-a-Service (CaaS) solutions to enable coverage in areas where the 0G network does not yet exist. - -**More on IoT:** - - * [What is the IoT? How the internet of things works][12] - * [What is edge computing and how it’s changing the network][13] - * [Most powerful Internet of Things companies][14] - * [10 Hot IoT startups to watch][15] - * [The 6 ways to make money in IoT][16] - * [What is digital twin technology? [and why it matters]][17] - * [Blockchain, service-centric networking key to IoT success][18] - * [Getting grounded in IoT networking and security][5] - * [Building IoT-ready networks must become a priority][19] - * [What is the Industrial IoT? [And why the stakes are so high]][20] - - - -Join the Network World communities on [Facebook][21] and [LinkedIn][22] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3409787/smart-cities-offer-window-into-the-evolution-of-enterprise-iot-technology.html - -作者:[Fredric 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://www.networkworld.com/author/Fredric-Paul/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/07/tokyo_asia_smart-city_iot_networking_by-benjamin-hung-unsplash-100764249-large.jpg -[2]: https://www.sigfox.com/en/sigfox-story -[3]: https://www.sigfox.com/en -[4]: https://www.dictionary.com/e/slang/og/ -[5]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html -[6]: https://www.sigfox.com/en/sigfox-iot-technology-overview -[7]: https://www.youtube.com/watch?v=WXc722WGjnE&t=1s -[8]: https://www.sigfox.com/en/news/sigfox-and-louis-vuitton-partner-innovative-luggage-tracker -[9]: https://www.sigfox.com/en/solutions/sigfox-services -[10]: https://www.sigfox.com/en/news/case-study-special-olympics-2019 -[11]: https://www.sigfox.com/en/news/ibm-revolutionizes-container-tracking-groupe-psa-sigfox -[12]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html -[13]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html -[14]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html -[15]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html -[16]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html -[17]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html -[18]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html -[19]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html -[20]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html -[21]: https://www.facebook.com/NetworkWorld/ -[22]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190724 How BMW-s new annual fee for Apple CarPlay could define the IoT.md b/sources/talk/20190724 How BMW-s new annual fee for Apple CarPlay could define the IoT.md deleted file mode 100644 index 6a73b041d5..0000000000 --- a/sources/talk/20190724 How BMW-s new annual fee for Apple CarPlay could define the IoT.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How BMW’s new annual fee for Apple CarPlay could define the IoT) -[#]: via: (https://www.networkworld.com/article/3411478/how-bmws-new-annual-fee-for-apple-carplay-could-define-the-iot.html) -[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) - -How BMW’s new annual fee for Apple CarPlay could define the IoT -====== -BMW's plans to charge for Apple CarPlay access illustrates the promise—and the pitfalls—of the internet of things (IoT). -![Apple][1] - -Apple calls CarPlay “[the ultimate co-pilot][2].” BMW calls it the “smart and fast way to conveniently use your iPhone features while in your car. ... You can control your iPhone and use apps with the touchscreen display, the iDrive Controller or voice commands.” - -However you describe it, though, Apple’s CarPlay system suddenly finds itself in the center of what could be a defining conversation about the future of the internet of things (IoT). - -You see, the German luxury carmaker’s plans to charge $80 a year to access CarPlay have suddenly become the talk of the internet, from [tech blogs][3] to [car sites][4]. The hue and cry makes CarPlay the perfect illustration of the promise—and the pitfalls—of the IoT. - -**[ [Learn more:][5] Download a PDF bundle of five essential articles about IoT in the enterprise ]** - -First, the facts: BMW’s website now reveals that beginning with the 2019 model year, it’s turning the CarPlay interface between iPhones and the vehicle’s infotainment system into a subscription service. While most car manufacturers that offer CarPlay make it available free of charge, owners of the “ultimate driving machine,” will get free access for only the first year. After that, [BMW drivers will need to pony up $80 a year—or $300 for 20 years][6]—to keep using it. - -### An “outrageous” fee? - -Some observers are labeling the new fee “[outrageous][7],” and it’s not yet clear what Apple thinks about BMW’s pricing policy. For me, though, it’s both a shining example of the amazing new revenue opportunities generated by the IoT, and a terrifying warning of how the IoT could add new cost and complexity to everyday activities. - -Look at this as a glass half full, and BMW is cleverly finding a new revenue stream by offering valuable functionality to a target market that has already demonstrated a willingness to pay for high-end functionality. The IoT and connected cars offer a new and better experience, and BMW is leveraging that to boost its business. It’s the power of capitalism at work, and if BMW drivers don’t value the CarPlay functionality, no one is forcing them to buy it. - -In some ways, the subscription business model is similar to that of [satellite radio][8] or GM’s [OnStar][9] system. The automaker builds in the equipment needed to offer the service, and car owners can choose to avail themselves of it if they feel it’s worthwhile. Or not. - -### A particular bit of usury - -But that’s only one perspective on what’s happening here. Look at it another way, and you could paint a very different picture. For one thing, as noted above, other car makers that offer CarPlay do not charge anything extra for it. BMWs are relatively expensive vehicles, and nickel-and-diming affluent consumers does not seem like a path to great customer loyalty. Think of the annoyance surrounding the fact that budget motels typically make Wi-Fi available for free, while luxury properties charge guests through the nose. (With the [rise of 5G networks][10], though, that particular bit of usury may not last much longer.) - -Making matters worse, CarPlay is really just internal connectivity between your iPhone and your car’s infotainment system. There’s no actual _service_ involved, and no real justification for a separate fee, other than the fact that BMW _can_ charge for it. It seems more like getting charged a monthly fee to connect your own phone to your own big-screen TV (like Apple’s AirPlay) or hooking up your smart light fixture to your home assistant or—I don’t know—putting your lamp on your coffee table! It just doesn’t feel right. - -### Dangerous long-term implications? - -Sure, if this kind of thing takes off in the larger world of the IoT, it could lead to a significant amount of new revenue—at least in the short run. But over time, it could easily backfire, encouraging consumers to view IoT vendors as greedy and to question the costs and benefits of everything from smart houses to connected enterprises. That could turn out to be a drag on the overall IoT market. - -That would be a shame, and it doesn’t have to be that way. If BMW had merely buried the CarPlay costs in the price of the equipment or options, or in the sticker cost of the car itself, nobody would be worrying about it. But just like breaking out the costs of checked baggage on airplane flights, charging a subscription for CarPlay makes it seem like a combination of bait-and-switch and price gouging. And that’s exactly what the IoT industry _doesn’t_ need. If the goal is to maximize the growth and acceptance of the IoT, vendors should strive to make IoT users feel like they’re getting great functionality at a fair price. - -That’s often exactly what many IoT devices and IoT-based services do, so it shouldn’t be too hard to avoid screwing it up. - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3411478/how-bmws-new-annual-fee-for-apple-carplay-could-define-the-iot.html - -作者:[Fredric 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://www.networkworld.com/author/Fredric-Paul/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/06/ios13-carplay-waze-100799546-large.jpg -[2]: https://www.apple.com/ios/carplay/ -[3]: https://www.engadget.com/2019/07/24/bmw-adds-a-80-yearly-subscription-for-apples-carplay/ -[4]: https://www.caranddriver.com/news/a15530125/bmw-to-treat-apple-carplay-as-a-subscription-service-and-charge-customers-an-annual-fee/ -[5]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html -[6]: https://connecteddrive.bmwusa.com/app/index.html#/portal/store/Base_CarPlay -[7]: https://www.cultofmac.com/640578/bmw-carplay-annual-fee/ -[8]: https://www.siriusxm.com/ -[9]: https://www.onstar.com/us/en/home/?ppc=GOOGLE_700000001302986_71700000048879287_58700004855294718_p41772767724&gclid=EAIaIQobChMIi7qn4IDO4wIVJRh9Ch1mlw6tEAAYASAAEgKQf_D_BwE&gclsrc=aw.ds -[10]: http://www.networkworld.com/cms/article/17%20predictions%20about%205G%20networks%20and%20devices -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190730 Google Cloud to offer VMware data-center tools natively.md b/sources/talk/20190730 Google Cloud to offer VMware data-center tools natively.md deleted file mode 100644 index e882248bf8..0000000000 --- a/sources/talk/20190730 Google Cloud to offer VMware data-center tools natively.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Google Cloud to offer VMware data-center tools natively) -[#]: via: (https://www.networkworld.com/article/3428497/google-cloud-to-offer-vmware-data-center-tools-natively.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Google Cloud to offer VMware data-center tools natively -====== -Google is enlisting VMware and CloudSimple to serve up vSphere, NSX and vSAN software on Google Cloud to make ease the transition of enterprise workloads to the cloud. -![Thinkstock / Google][1] - -Google this week said it would for the first time natively support VMware workloads in its Cloud service, giving customers more options for deploying enterprise applications. - -The hybrid cloud service called Google Cloud VMware Solution by CloudSimple will use VMware software-defined data center (SDCC) technologies including VMware vSphere, NSX and vSAN software deployed on a platform administered by CloudSimple for GCP. - -[RELATED: How to make hybrid cloud work][2] - -“Users will have full, native access to the full VMware stack including vCenter, vSAN and NSX-T. Google Cloud will provide the first line of support, working closely with CloudSimple to help ensure customers receive a streamlined product support experience and that their business-critical applications are supported with the SLAs that enterprise customers need,”  Thomas Kurian, CEO of Google Cloud [wrote in a blog outlining the deal][3].  - -“With VMware on Google Cloud Platform, customers will be able to leverage all of the familiarity of VMware tools and training, and protect their investments, as they execute on their cloud strategies and rapidly bring new services to market and operate them seamlessly and more securely across a hybrid cloud environment,” said Sanjay Poonen, chief operating officer, customer operations at VMware [in a statement][4]. - -The move further integrates Google and VMware software as both have teamed up multiple times in the past including: - - * Google Cloud integration for VMware NSX Service Mesh and SD-WAN by VeloCloud that lets customers deploy and gain visibility into their hybrid workloads—wherever they’re running. - * Google Cloud’s Anthos on VMware vSphere, including validations for vSAN, as the preferred hyperconverged infrastructure, to provide customers a multi-cloud offering and providing Kubernetes users the ability to create and manage persistent storage volumes for stateful workloads on-premises. - * A Google Cloud plug-in for VMware vRealize Automation providing customers with a seamless way to deploy, orchestrate and manage Google Cloud resources from within their vRealize Automation environment. - - - -Google is just one key cloud relationship VMware relies on.  It has a deep integration with Amazon Web Services that began in 2017.  With that flagship agreement, VMware customers can run workloads in the AWS cloud.  And more recently, VMware cloud offerings can be bought directly through the AWS service.  - -VMware also has a hybrid cloud partnership with [Microsoft’s Azure cloud service][5].  That package, called Azure VMware Solutions is built on VMware Cloud Foundation, which  is a packaging of the company’s traditional compute virtualization software vSphere with its NSX network virtualization product and its VSAN software-defined storage area network product. - -More recently VMware bulked up its cloud offerings by [buying Avi Networks][6]' load balancing, analytics and application-delivery technology for an undisclosed amount. - -Founded in 2012 by a group of Cisco engineers and executives, Avi offers a variety of software-defined products and services including a software-based application delivery controller (ADC) and intelligent web-application firewall.  The software already integrates with VMware vCenter and NSX, OpenStack, third party [SDN][7] controllers, as well as Amazon AWS and Google Cloud Platform, Red Hat OpenShift and container orchestration platforms such as Kubernetes and Docker. - -According to the company,  the VMware and Avi Networks teams will work together to advance VMware’s Virtual Cloud Network plan, build out full stack Layer 2-7 services, and deliver the public-cloud experience for on-prem environments and data centers, said Tom Gillis, VMware's senior vice president and general manager of its networking and security business unit. - -Combining Avi Networks with [VMware NSX][8] will further enable organizations to respond to new opportunities and threats, create new business models and deliver services to all applications and data, wherever they are located, VMware stated. - -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/3428497/google-cloud-to-offer-vmware-data-center-tools-natively.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://images.idgesg.net/images/article/2018/07/google-cloud-services-100765812-large.jpg -[2]: https://www.networkworld.com/article/3119362/hybrid-cloud/how-to-make-hybrid-cloud-work.html#tk.nww-fsb -[3]: https://cloud.google.com/blog/topics/partners/vmware-cloud-foundation-comes-to-google-cloud -[4]: https://www.vmware.com/company/news/releases/vmw-newsfeed.Google-Cloud-and-VMware-Extend-Strategic-Partnership.1893625.html -[5]: https://www.networkworld.com/article/3113394/vmware-cloud-foundation-integrates-virtual-compute-network-and-storage-systems.html -[6]: https://www.networkworld.com/article/3402981/vmware-eyes-avi-networks-for-data-center-software.html -[7]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[8]: https://www.networkworld.com/article/3346017/vmware-preps-milestone-nsx-release-for-enterprise-cloud-push.html -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190731 Cisco simplifies Kubernetes container deployment with Microsoft Azure collaboration.md b/sources/talk/20190731 Cisco simplifies Kubernetes container deployment with Microsoft Azure collaboration.md deleted file mode 100644 index 423cd7180a..0000000000 --- a/sources/talk/20190731 Cisco simplifies Kubernetes container deployment with Microsoft Azure collaboration.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco simplifies Kubernetes container deployment with Microsoft Azure collaboration) -[#]: via: (https://www.networkworld.com/article/3429116/cisco-simplifies-kubernetes-container-deployment-with-microsoft-azure-collaboration.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco simplifies Kubernetes container deployment with Microsoft Azure collaboration -====== -Microsoft's Azure Kubernetes Service (AKS) has been added to the Kubernetes managed services that natively integrate with the Cisco Container Platform. -![Viti / Getty Images][1] - -Cisco seeks to enhance container deployment with a service to let enterprise customers run containerized applications across both Cisco-based on-premises environments and in the Microsoft Azure cloud. - -Customers can now further simplify deploying and managing Kubernetes clusters on-premises and in Azure Kubernetes Service (AKS) with one tool, using common identify and control policies, reducing manual tasks and ultimately time-to-market for their application environments, wrote Cisco’s Kip Compton, senior vice president of the company’s Cloud Platform and Solutions group in a [blog][2] about the work.  - -[RELATED: How to make hybrid cloud work][3] - -Specifically, AKS has been added to Kubernetes managed services that natively integrate with the [Cisco Container Platform][4]. Cisco introduced its Kubernetes-based Container Platform in January 2018 and said it allows for self-service deployment and management of container clusters.  - -Cisco has added multivendor support to the platform, including support of SAP’s Data Hub to integrate large data sets that may be in public clouds, such as Amazon Web Services, Hadoop, Microsoft or Google, and integrate them with private cloud or enterprise apps such as SAP S/4 HANA. - -Kubernetes, originally designed by Google, is an open-source-based system for developing and orchestrating containerized applications. Containers can be deployed across multiple server hosts and Kubernetes orchestration lets customers build application services that span multiple containers, schedule those containers across a cluster, scale those containers and manage the container health.  - -Cisco has been working to further integrate with Azure services for quite a while  now.  For example, the [Cisco Integrated System for Microsoft Azure Stack][5] lets organizations access development tools, data repositories, and related Azure services to reinvent applications and gain new information from secured data. Azure Stack provides the same APIs and user interface as the Azure public cloud. - -In future phases, the Cisco Container Platform will integrate more features to support Microsoft Windows container applications with the potential to leverage virtual-kubelet or Windows node pools in Azure, Compton stated. “In addition, we will support Azure Active Directory common identity integration for both on-prem and AKS clusters so customer/applications experience a single consistent environment across hybrid cloud.” - -In addition, Cisco has a substantial portfolio of offerings running in the Azure cloud and available in the Azure Marketplace.  For example,  the company offers its Cloud Services Router, CSV1000v, as well as Meraki vMX, Stealthwatch Cloud, the Adaptive Security Virtual Appliance and its Next Generation Firewall.  - -The Azure work broadens Cisco’s drive into cloud.  For example Cisco and [Amazon Web Services (AWS) offer][6] enterprise customers an integrated platform that promises to help them more simply build, secure and connect Kubernetes clusters across private data centers and the AWS cloud.  - -The package, Cisco Hybrid Solution for Kubernetes on AWS, combines Cisco, AWS and open-source technologies to simplify complexity and helps eliminate challenges for customers who use Kubernetes to enable deploying applications on premises and across the AWS cloud in a secure, consistent manner.  The hybrid service integrates Cisco Container Platform (CCP) and Amazon Elastic Container Service for Kubernetes (EKS), so customers can provision clusters on premises and on EKS in the cloud. - -Cisco [also released a cloud-service program][7] on its flagship software-defined networking (SDN) software that will let customers manage and secure applications running in the data center or in Amazon Web Service cloud environments. The service, Cisco Cloud application centric infrastructure (ACI) for AWS lets users configure inter-site connectivity, define policies and monitor the health of network infrastructure across hybrid environments, Cisco said. - -Meanwhile, Cisco and Google have done extensive work on their own joint cloud-development activities to help customers more easily build secure multicloud and hybrid applications everywhere from on-premises data centers to public clouds.  - -Cisco and Google have been working closely together since October 2017, when the companies said they were working on an open hybrid cloud platform that bridges on-premises and cloud environments. That package, [Cisco Hybrid Cloud Platform for Google Cloud][8], became generally available in September 2018. It lets customer develop enterprise-grade capabilities from Google Cloud-managed Kubernetes containers that include Cisco networking and security technology as well as service mesh monitoring from Istio. - -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/3429116/cisco-simplifies-kubernetes-container-deployment-with-microsoft-azure-collaboration.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://images.idgesg.net/images/article/2019/07/africa_guinea_conakry_harbor_harbour_shipping_containers_cranes_by_viti_gettyimages-1154922310_2400x1600-100802866-large.jpg -[2]: https://www.networkworld.com/cms/article/%20https:/blogs.cisco.com/news/cisco-microsoft%20%E2%80%8E -[3]: https://www.networkworld.com/article/3119362/hybrid-cloud/how-to-make-hybrid-cloud-work.html#tk.nww-fsb -[4]: https://www.networkworld.com/article/3252810/cisco-unveils-container-management-on-hyperflex.html -[5]: https://blogs.cisco.com/datacenter/cisco-integrated-system-for-microsoft-azure-stack-it-is-here-and-shipping -[6]: https://www.networkworld.com/article/3319782/cisco-aws-marriage-simplifies-hybrid-cloud-app-development.html -[7]: https://www.networkworld.com/article/3388679/cisco-taps-into-aws-for-data-center-cloud-applications.html -[8]: https://cloud.google.com/cisco/ -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190731 Remote code execution is possible by exploiting flaws in Vxworks.md b/sources/talk/20190731 Remote code execution is possible by exploiting flaws in Vxworks.md deleted file mode 100644 index 7fa6eaa226..0000000000 --- a/sources/talk/20190731 Remote code execution is possible by exploiting flaws in Vxworks.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Remote code execution is possible by exploiting flaws in Vxworks) -[#]: via: (https://www.networkworld.com/article/3428996/remote-code-execution-is-possible-by-exploiting-flaws-in-vxworks.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Remote code execution is possible by exploiting flaws in Vxworks -====== - -![Thinkstock][1] - -Eleven zero-day vulnerabilities in WindRiver’s VxWorks, a real-time operating system in use across an advertised 2 billion connected devices have been discovered by network security vendor Armis. - -Six of the vulnerabilities could enable remote attackers to access unpatched systems without any user interaction, even through a firewall according to Armis. - -**About IoT:** - - * [What is the IoT? How the internet of things works][2] - * [What is edge computing and how it’s changing the network][3] - * [Most powerful Internet of Things companies][4] - * [10 Hot IoT startups to watch][5] - * [The 6 ways to make money in IoT][6] - * [What is digital twin technology? [and why it matters]][7] - * [Blockchain, service-centric networking key to IoT success][8] - * [Getting grounded in IoT networking and security][9] - * [Building IoT-ready networks must become a priority][10] - * [What is the Industrial IoT? [And why the stakes are so high]][11] - - - -The vulnerabilities affect all devices running VxWorks version 6.5 and later with the exception of VxWorks 7, issued July 19, which patches the flaws. That means the attack windows may have been open for more than 13 years. - -Armis Labs said that affected devices included SCADA controllers, patient monitors, MRI machines, VOIP phones and even network firewalls, specifying that users in the medical and industrial fields should be particularly quick about patching the software. - -Thanks to remote-code-execution vulnerabilities, unpatched devices can be compromised by a maliciously crafted IP packet that doesn’t need device-specific tailoring, and every vulnerable device on a given network can be targeted more or less simultaneously. - -The Armis researchers said that, because the most severe of the issues targets “esoteric parts of the TCP/IP stack that are almost never used by legitimate applications,” specific rules for the open source Snort security framework can be imposed to detect exploits. - -VxWorks, which has been in use since the 1980s, is a popular real-time OS, used in industrial, medical and many other applications that require extremely low latency and response time. While highly reliable, the inability to install a security agent alongside the operating system makes it vulnerable, said Armis, and the proprietary source code makes it more difficult to detect problems. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][12] ]** - -Armis argued that more attention has to be paid by security researchers to real-time operating systems, particularly given the explosive growth in IoT usage – for one thing, the researchers said, any software that doesn’t get thoroughly researched runs a higher risk of having serious vulnerabilities go unaddressed. For another, the critical nature of many IoT use cases means that the consequences of a compromised device are potentially very serious. - -“It is inconvenient to have your phone put out of use, but it’s an entirely different story to have your manufacturing plant shut down,” the Armis team wrote. “A compromised industrial controller could shut down a factory, and a pwned patient monitor could have a life-threatening effect.” - -In addition to the six headlining vulnerabilities, five somewhat less serious security holes were found. These could lead to consequences ranging from denial of service and leaked information to logic flaws and memory issues. - -More technical details and a fuller overview of the problem can be found at the Armis Labs blog post here, and there are partial lists available of companies and devices that run VxWorks available [on Wikipedia][13] and at [Wind River’s customer page][14]. Wind River itself issued a security advisory [here][15], which contains some potential mitigation techniques. - -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/3428996/remote-code-execution-is-possible-by-exploiting-flaws-in-vxworks.html - -作者:[Jon Gold][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/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2017/09/iot-security11-100735405-large.jpg -[2]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html -[3]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html -[4]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html -[5]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html -[6]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html -[7]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html -[8]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html -[9]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html -[10]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html -[11]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html -[12]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[13]: https://en.wikipedia.org/wiki/VxWorks#Notable_uses -[14]: https://www.windriver.com/customers/ -[15]: https://www.windriver.com/security/announcements/tcp-ip-network-stack-ipnet-urgent11/security-advisory-ipnet/ -[16]: https://www.facebook.com/NetworkWorld/ -[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190731 VMware-s Bitfusion acquisition could be a game-changer for GPU computing.md b/sources/talk/20190731 VMware-s Bitfusion acquisition could be a game-changer for GPU computing.md deleted file mode 100644 index 4946824820..0000000000 --- a/sources/talk/20190731 VMware-s Bitfusion acquisition could be a game-changer for GPU computing.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (VMware’s Bitfusion acquisition could be a game-changer for GPU computing) -[#]: via: (https://www.networkworld.com/article/3429036/vmwares-bitfusion-acquisition-could-be-a-game-changer-for-gpu-computing.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -VMware’s Bitfusion acquisition could be a game-changer for GPU computing -====== -VMware will integrate Bitfusion technology into vSphere, bolstering VMware’s strategy of supporting AI- and ML-based workloads by virtualizing hardware accelerators. -![Vladimir Timofeev / Getty Images][1] - -In a low-key move that went under the radar of a lot of us, last week VMware snapped up a startup called Bitfusion, which makes virtualization software for accelerated computing. It improves performance of virtual machines by offloading processing to accelerator chips, such as GPUs, FPGAs, or other custom ASICs. - -Bitfusion provides sharing of GPU resources among isolated GPU compute workloads, allowing workloads to be shared across the customer’s network. This way workloads are not tied to one physical server but shared as a pool of resources, and if multiple GPUs are brought to bear, performance naturally increases. - -“In many ways, Bitfusion offers for hardware acceleration what VMware offered to the compute landscape several years ago. Bitfusion also aligns well with VMware’s ‘Any Cloud, Any App, Any Device’ vision with its ability to work across AI frameworks, clouds, networks, and formats such as virtual machines and containers,” said Krish Prasad, senior vice president and general manager of the Cloud Platform Business Unit at VMware, in a [blog post][2] announcing the deal. - -**[ Also read: [After virtualization and cloud, what's left on premises?][3] ]** - -When the acquisition closes, VMware will integrate Bitfusion technology into vSphere. Prasad said the inclusion of Bitfusion will bolster VMware’s strategy of supporting artificial intelligence- and machine learning-based workloads by virtualizing hardware accelerators. - -“Multi-vendor hardware accelerators and the ecosystem around them are key components for delivering modern applications. These accelerators can be used regardless of location in the environment—on-premises and/or in the cloud,” he wrote. The platform can be extended to support other accelerator chips, such as FGPAs and ASICs, he wrote. - -Prasad noted that hardware accelerators today are deployed “with bare-metal practices, which force poor utilization, poor efficiencies, and limit organizations from sharing, abstracting, and automating the infrastructure. This provides a perfect opportunity to virtualize them—providing increased sharing of resources and lowering costs.” - -He added: “The platform can share GPUs in a virtualized infrastructure as a pool of network-accessible resources rather than isolated resources per server.” - -This is a real game-changer, much the way VMware added storage virtualization and software-defined networks (SDN) to expand the use of vSphere. It gives them a major competitive advantage over Microsoft Hyper-V and Linux’s KVM now as well. - -By virtualizing and pooling GPUs, it lets users bring multiple GPUs to bear rather than locking one physical processor to a server and application. The same applies to FPGAs and the numerous AI processor chips either on or coming to market. - -### VMware also buys Uhana - -That wasn’t VMware’s only purchase. The company also acquired Uhana, which provides an AI engine specifically for telcos and other carriers that discovers anomalies in the network or application, prioritizes them based on their potential impact, and automatically recommends optimization strategies. That means improved network operations and operational efficiently. - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3429036/vmwares-bitfusion-acquisition-could-be-a-game-changer-for-gpu-computing.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://images.idgesg.net/images/article/2018/08/clouded_view_of_data_center_server_virtualization_by_vladimir_timofeev_gettyimages-600404124_1200x800-100768156-large.jpg -[2]: https://blogs.vmware.com/vsphere/2019/07/vmware-to-acquire-bitfusion.html -[3]: https://https//www.networkworld.com/article/3232626/virtualization/extreme-virtualization-impact-on-enterprises.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190801 Cisco assesses the top enterprise SD-WAN technology drivers.md b/sources/talk/20190801 Cisco assesses the top enterprise SD-WAN technology drivers.md deleted file mode 100644 index b6f845b4a7..0000000000 --- a/sources/talk/20190801 Cisco assesses the top enterprise SD-WAN technology drivers.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco assesses the top enterprise SD-WAN technology drivers) -[#]: via: (https://www.networkworld.com/article/3429186/cisco-assesses-the-top-enterprise-sd-wan-technology-drivers.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco assesses the top enterprise SD-WAN technology drivers -====== -Cisco SD-WAN customer National Instruments touts benefits of the technology: Speed, efficiency, security, cost savings -![Getty Images][1] - -Cisco this week celebrated the [second anniversary][2] of its purchase of SD-WAN vendor Viptela and reiterated its expectation that 2019 will see the [technology change][3] enterprise networks in major ways. - -In a blog outlining trends in the SD-WAN world, Anand Oswal, Cisco senior vice president, engineering, in the company’s Enterprise Networking Business described how SD-WAN technology has changed the network for one of its customers,  test and measurement systems vendor National Instruments.  - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][4] - * [How to pick an off-site data-backup method][5] - * [SD-Branch: What it is and why you’ll need it][6] - * [What are the options for security SD-WAN?][7] - - - -“The existing WAN greatly constrained video conferencing, slowed large software transfers, and couldn’t provide acceptable application performance,” [Oswald wrote][8].  Implementing SD-WAN turned those issues around by: - - * Reducing MPLS spending by 25% while increasing bandwidth by 3,075% - * Categorizing traffic by function and type, sending backup traffic over the Internet under an SLA, eliminating bandwidth bottleneck on MPLS circuits - * Reducing the time for software updates to replicate across the network from 8 hours to 10 minutes - * Adding new internet-based services used to take months, but with the agility of SD-WAN, new services can be deployed in the cloud immediately - * Eliminating the need for call -dmission controls and limiting video quality for conferencing - - - -National Instruments' bandwidth requirements were growing10 to 25 percent per year, overwhelming the budget, Luis Castillo, global network team manager told Cisco in a [case study][9] of the SD-WAN project. “Part of the problem was that these sites can have very different requirements. R&D shops need lots of bandwidth. One site may have a special customer that requires unique segmentation and security. Our contact centers need to support mission-critical voice services. All of that is dependent on the WAN, which means escalating complexity and constantly growing costs.” - -After the shift to SD-WAN, the company no longer has 80 people with diverse IT workloads copeting for a sinlge 10-Mbit circuit, Castillo says. - -It’s not just cost savings by supplementing or replacing MPLS with direct internet connections that is motivating the transition to software-defined WAN architecture, Oswald said.   “It’s also about gaining flexibility and stability with intelligent, continuously monitored connections to multicloud resources and SaaS applications that are fueling the current SD-WAN transition.” - -In its most recent [SD-WAN Infrastructure Forecast][10], IDC researchers talked about a number of other factors driving SD-WAN evolution. - -"First, traditional enterprise WANs are increasingly not meeting the needs of today's modern digital businesses, especially as it relates to supporting SaaS apps and multi- and hybrid-cloud usage. Second, enterprises are interested in easier management of multiple connection types across their WAN to improve application performance and end-user experience," said [Rohit Mehra][11], vice president, [Network Infrastructure][12] at IDC. "Combined with the rapid embrace of SD-WAN by leading communications service providers globally, these trends continue to drive deployments of SD-WAN, providing enterprises with dynamic management of hybrid WAN connections and the ability to guarantee high levels of quality of service on a per-application basis." - -IDC also said that the SD-WAN infrastructure market continues to be highly competitive with sales increasing 64.9% in 2018 to $1.37 billion. IDC stated Cisco holds the largest share of the SD-WAN infrastructure market, with VMware coming in second followed by Silver Peak, Nokia-Nuage, and Riverbed. - -IDC also [recently wrote][13] about how security is also a key driver in recent SD-WAN deployments.  - -“With SD-WAN, mission-critical traffic and assets can be partitioned and protected against vulnerabilities in other parts of the enterprise. This use case appears to be especially popular in verticals such as retail, healthcare, and financial,” IDC wrote.  - -"SD-WAN can also protect application traffic from threats within the enterprise and from outside by leveraging a full stack of security solutions included in SD-WAN such as next-gen firewalls, IPS, URL filtering, malware protection, and cloud security.  - -These security features can enable Layer 3-7 protection for WAN traffic regardless of where it's headed - to the cloud or to the data center, IDC wrote. - -Application traffic to the cloud straight from the branch can now be secured using an internet or cloud gateway, IDC wrote. Users, applications and their data at the branch edge can be protected by the stack of security solutions incorporated into the SD-WAN on-premises appliance, vCPE or router, which typically includes  next-gen firewall, intrusion protection, malware protection and URL filtering, IDC wrote. - -Cisco [most recently][14] added support for its cloud-based security gateway – known as Umbrella – to its SD-WAN software offerings.  According to Cisco, Umbrella can provide the first line of defense against threats on the internet. By analyzing and learning from internet activity patterns, Umbrella automatically uncovers attacker infrastructure and blocks requests to malicious destinations before a connection is even established — without adding latency for users. With Umbrella, customers can stop phishing and malware infections earlier, identify already infected devices faster and prevent data exfiltration, Cisco says. - -The Umbrella announcement is on top of other recent SD-WAN security enhancements the company has made. In May Cisco added support for Advanced Malware Protection (AMP) to its million-plus ISR/ASR edge routers in an effort to reinforce branch- and core-network malware protection across the SD-WAN. AMP support is added to a menu of security features already included in Cisco's SD-WAN software including support for URL filtering, Snort Intrusion Prevention, the ability to segment users across the WAN and embedded platform security, including the Cisco Trust Anchor module. - -Last year Cisco added its Viptela SD-WAN technology to the IOS XE version 16.9.1 software that runs its core ISR/ASR routers. - -Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3429186/cisco-assesses-the-top-enterprise-sd-wan-technology-drivers.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://images.idgesg.net/images/article/2018/08/2_networks_smart-city_iot_connected-100769196-large.jpg -[2]: https://www.networkworld.com/article/3193888/why-cisco-needs-sd-wan-vendor-viptela.html -[3]: https://blog.cimicorp.com/?p=3781 -[4]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[5]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[6]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[7]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[8]: https://blogs.cisco.com/author/anandoswal -[9]: https://www.cisco.com/c/dam/en_us/services/it-case-studies/ni-case-study.pdf -[10]: https://www.idc.com/getdoc.jsp?containerId=prUS45380319 -[11]: https://www.idc.com/getdoc.jsp?containerId=PRF003513 -[12]: https://www.idc.com/getdoc.jsp?containerId=IDC_P2 -[13]: https://www.cisco.com/c/dam/en/us/solutions/collateral/enterprise-networks/intelligent-wan/idc-tangible-benefits.pdf -[14]: https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.html -[15]: https://www.facebook.com/NetworkWorld/ -[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190801 IBM fuses its software with Red Hat-s to launch hybrid-cloud juggernaut.md b/sources/talk/20190801 IBM fuses its software with Red Hat-s to launch hybrid-cloud juggernaut.md deleted file mode 100644 index c1c3ba375e..0000000000 --- a/sources/talk/20190801 IBM fuses its software with Red Hat-s to launch hybrid-cloud juggernaut.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (IBM fuses its software with Red Hat’s to launch hybrid-cloud juggernaut) -[#]: via: (https://www.networkworld.com/article/3429596/ibm-fuses-its-software-with-red-hats-to-launch-hybrid-cloud-juggernaut.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -IBM fuses its software with Red Hat’s to launch hybrid-cloud juggernaut -====== -IBM is starting a potentially huge run at hybrid cloud by tying more than 100 of its products to the Red Hat OpenShift platform. -![Hans \(CC0\)][1] - -IBM has wasted no time aligning its own software with its newly acquired [Red Hat technoloogy][2],saying its portfolio would be transformed to work cloud natively and augmented to run on Red Hat’s OpenShift platform. - -IBM in July [finalized its $34 billion][3] purchase of Red Hat and says it will use the Linux powerhouse's open-source know-how and Linux expertise to grow larger scale hybrid-cloud customer projects and to create a web of partnerships to simplify carrying them out. - -**[ Check out [What is hybrid cloud computing][4] and learn [what you need to know about multi-cloud][5]. | Get regularly scheduled insights by [signing up for Network World newsletters][6]. ]** - -The effort has started with IBM bundling Red Hat’s Kubernetes-based OpenShift Container Platform with more than 100 IBM products in what it calls Cloud Paks. OpenShift lets enterprise customers deploy and manage containers on their choice of infrastructure of choice, be it private or public clouds, including AWS, Microsoft Azure, Google Cloud Platform, Alibaba and IBM Cloud. - -The prepackaged Cloud Paks include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers, the company said.  - -Five Cloud Paks exist today: Cloud Pak for Data, Application, Integration, Automation and Multicloud Management. The Paks will ultimately include IBM’s DB2, WebSphere, [API Connect][7], Watson Studio, [Cognos Analytics][8] and more. - -In addition, IBM said it will bring the Red Hat OpenShift Container Platform over to IBM Z mainframes and IBM LinuxONE. Together these two platforms power about 30 billion transactions a day globally, [IBM said][9].  Some of the goals here are to increase container density and help customers build containerized applications that can scale vertically and horizontally. - -“The vision is for OpenShift-enabled IBM software to become the foundational building blocks clients can use to transform their organizations and build across hybrid, multicloud environments,” Hillery Hunter, VP & CTO IBM Cloud said in an [IBM blog][10] about the announcement. - -OpenShift is the underlying Kubernetes and Container orchestration layer that supports the containerized software, she wrote, and placing the Cloud Paks atop Red Hat OpenShift gives IBM a broad reach immediately. "OpenShift is also where the common services such as logging, metering, and security that IBM Cloud Paks leverage let businesses effectively manage and understand their workloads,” Hunter stated. - -Analysts said the moves were expected but still extremely important for the company to ensure this acquisition is successful. - -“We expect IBM and Red Hat will do the obvious stuff first, and that’s what this mostly is,” said Lee Doyle, principal analyst at Doyle Research. "The challenge will be getting deeper integrations and taking the technology to the next level. What they do in the next six months to a year will be critical.” - -Over the last few years IBM has been evolving its strategy to major on-cloud computing and cognitive computing. Its argument against cloud providers like AWS, Microsoft Azure, and Google Cloud is that only 20 percent of enterprise workloads have so far moved to the cloud – the easy 20 percent. The rest are the difficult 80 percent of workloads that are complex, legacy applications, often mainframe based, that have run banking and big business for decades, wrote David Terrar, executive advisor for [Bloor Research][11]. "How do you transform those?" - -That background gives IBM enterprise expertise and customer relationships competitors don't. “IBM has been talking hybrid cloud and multicloud to these customers for a while, and the Red Hat move is like an injection of steroids to the strategy, " Terrar wrote. "When you add in its automation and cognitive positioning with Watson, and the real-world success with enterprise-grade blockchain implementations like TradeLens and the Food Trust network, I’d argue that IBM is positioning itself as the ‘Enterprise Cloud Company’.” - -Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3429596/ibm-fuses-its-software-with-red-hats-to-launch-hybrid-cloud-juggernaut.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://images.idgesg.net/images/article/2017/06/moon-2117426_1280-100726933-large.jpg -[2]: https://www.networkworld.com/article/3317517/the-ibm-red-hat-deal-what-it-means-for-enterprises.html -[3]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html -[4]: https://www.networkworld.com/article/3233132/cloud-computing/what-is-hybrid-cloud-computing.html -[5]: https://www.networkworld.com/article/3252775/hybrid-cloud/multicloud-mania-what-to-know.html -[6]: https://www.networkworld.com/newsletters/signup.html -[7]: https://www.ibm.com/cloud/api-connect -[8]: https://www.ibm.com/products/cognos-analytics -[9]: https://www.ibm.com/blogs/systems/announcing-our-direction-for-red-hat-openshift-for-ibm-z-and-linuxone/?cm_mmc=OSocial_Twitter-_-Systems_Systems+-+LinuxONE-_-WW_WW-_-OpenShift+IBM+Z+and+LinuxONE+BLOG+still+image&cm_mmca1=000001BT&cm_mmca2=10009456&linkId=71365692 -[10]: https://www.ibm.com/blogs/think/2019/08/ibm-software-on-any-cloud/ -[11]: https://www.bloorresearch.com/ -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190805 Is your enterprise software committing security malpractice.md b/sources/talk/20190805 Is your enterprise software committing security malpractice.md deleted file mode 100644 index 9ab039b6e9..0000000000 --- a/sources/talk/20190805 Is your enterprise software committing security malpractice.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Is your enterprise software committing security malpractice?) -[#]: via: (https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Is your enterprise software committing security malpractice? -====== -ExtraHop discovered enterprise security and analytic software are "phoning home" and quietly uploading information to servers outside of customers' networks. -![Getty Images][1] - -Back when this blog was dedicated to all things Microsoft I routinely railed against the spying aspects of Windows 10. Well, apparently that’s nothing compared to what enterprise security, analytics, and hardware management tools are doing. - -An analytics firm called ExtraHop examined the networks of its customers and found that their security and analytic software was quietly uploading information to servers outside of the customer's network. The company issued a [report and warning][2] last week. - -ExtraHop deliberately chose not to name names in its four examples of enterprise security tools that were sending out data without warning the customer or user. A spokesperson for the company told me via email, “ExtraHop wants the focus of the report to be the trend, which we have observed on multiple occasions and find alarming. Focusing on a specific group would detract from the broader point that this important issue requires more attention from enterprises.” - -**[ For more on IoT security, read [tips to securing IoT on your network][3] and [10 best practices to minimize IoT security vulnerabilities][4]. | Get regularly scheduled insights by [signing up for Network World newsletters][5]. ]** - -### Products committing security malpractice and secretly transmitting data offsite - -[ExtraHop's report][6] found a pretty broad range of products secretly phoning home, including endpoint security software, device management software for a hospital, surveillance cameras, and security analytics software used by a financial institution. It also noted the applications may run afoul of Europe’s [General Data Privacy Regulation (GDPR)][7]. - -In every case, ExtraHop provided evidence that the software was transmitting data offsite. In one case, a company noticed that approximately every 30 minutes, a network-connected device was sending UDP traffic out to a known bad IP address. The device in question was a Chinese-made security camera that was phoning home to a known ​malicious IP address​ with ties to China. - -And the camera was likely set up independently by an employee at their office for personal security purposes, showing the downside to shadow IT. - -In the cases of the hospital's device management tool and the financial firm's analytics tool, those were violations of data security laws and could expose the company to legal risks even though it was happening without their knowledge. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][8] ]** - -The hospital’s medical device management product was supposed to use the hospital’s Wi-Fi network to only ensure patient data privacy and HIPAA compliance. ExtraHop noticed traffic from the workstation that was managing initial device rollout was opening encrypted SSL:443 connections to vendor-owned cloud storage, a major HIPAA violation. - -ExtraHop notes that while there may not be any malicious activity in these examples, it is still in violation of the law, and administrators need to keep an eye on their networks to monitor traffic for unusual activity. - -"To be clear, we don’t know why these vendors are phoning home data. The companies are all respected security and IT vendors, and in all likelihood, their phoning home of data was either for a legitimate purpose given their architecture design or the result of a misconfiguration," the report says. - -### How to mitigate phoning-home security risks - -To address this security malpractice problem, ExtraHop suggests companies do these five things: - - * Monitor for vendor activity: Watch for unexpected vendor activity on your network, whether they are an active vendor, a former vendor or even a vendor post-evaluation. - * Monitor egress traffic: Be aware of egress traffic, especially from sensitive assets such as domain controllers. When egress traffic is detected, always match it to approved applications and services. - * Track deployment: While under evaluation, track deployments of software agents. - * Understand regulatory considerations: Be informed about the regulatory and compliance considerations of data crossing political and geographic boundaries. - * Understand contract agreements: Track whether data is used in compliance with vendor contract agreements. - - - -**[ Now read this: [Network World's corporate guide to addressing IoT security][9] ]** - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.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://images.idgesg.net/images/article/2018/03/cybersecurity_eye-with-binary_face-recognition_abstract-eye-100751589-large.jpg -[2]: https://www.extrahop.com/company/press-releases/2019/extrahop-issues-warning-about-phoning-home/ -[3]: https://www.networkworld.com/article/3254185/internet-of-things/tips-for-securing-iot-on-your-network.html#nww-fsb -[4]: https://www.networkworld.com/article/3269184/10-best-practices-to-minimize-iot-security-vulnerabilities#nww-fsb -[5]: https://www.networkworld.com/newsletters/signup.html#nww-fsb -[6]: https://www.extrahop.com/resources/whitepapers/eh-security-advisory-calling-home-success/ -[7]: https://www.csoonline.com/article/3202771/general-data-protection-regulation-gdpr-requirements-deadlines-and-facts.html -[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[9]: https://www.networkworld.com/article/3269165/internet-of-things/a-corporate-guide-to-addressing-iot-security-concerns.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190809 Goodbye, Linux Journal.md b/sources/talk/20190809 Goodbye, Linux Journal.md deleted file mode 100644 index dd0964db66..0000000000 --- a/sources/talk/20190809 Goodbye, Linux Journal.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Goodbye, Linux Journal) -[#]: via: (https://opensource.com/article/19/8/goodbye-linux-journal) -[#]: author: (Jim Hall https://opensource.com/users/jim-hallhttps://opensource.com/users/scottnesbitthttps://opensource.com/users/alanfdoss) - -Goodbye, Linux Journal -====== -Linux Journal's coverage from 1994 to 2019 highlighted Linux’s rise to -an enterprise platform that runs a majority of the world’s servers and -services. -![Linux keys on the keyboard for a desktop computer][1] - -I first discovered Linux in 1993, when I was an undergraduate physics student who wanted the power of Big Unix on my home PC. I remember installing my first Linux distribution, SoftLanding Systems (SLS), and exploring the power of Linux on my ‘386 PC. I was immediately impressed. Since then, I’ve run Linux at home—and even at work. - -In those early days, it felt like I was the only person who knew about Linux. Certainly, there was an online community via Usenet, but there weren’t many other ways to get together with other Linux users—unless you had a local Linux User Group in your area. I shared what I knew about Linux with those around me, and we pooled our Linux fu. - -So, it was awesome to learn about a print magazine that was dedicated to all things Linux. In March 1994, Phil Hughes and Red Hat co-founder Bob Young published a new magazine about Linux, named _Linux Journal_. The [first issue][2] featured an "[Interview With Linus, The Author of Linux][3]" by Robert Young, and an article comparing "[Linux Vs. Windows NT and OS/2][4]" by Bernie Thompson. - -From the start, _Linux Journal_ aimed to be a community-driven magazine. Hughes and Young were not the only contributors to the magazine. Instead, they invited others to write about Linux and share what they had learned. In a way, _Linux Journal_ used a model similar to open source software. Anyone could contribute, and the editors acted as "maintainers" to ensure content was top quality and informative. - -_Linux Journal_ also went for a broad audience. The editors realized that a purely technical magazine would lose too many new users, while a magazine written for "newbies" would not attract a more focused audience. In the first issue, [Hughes highlighted][5] both groups of users as the audience _Linux Journal_ was looking for, writing: "We see this part of our audience as being two groups. Lots of the current Linux users have worked professionally with Unix. The other segment is the DOS user who wants to upgrade to a multi-user system. With a combination of tutorials and technical articles, we hope to satisfy the needs of both these groups." - -I was glad to discover _Linux Journal_ in those early days, and I quickly became a subscriber. In time, I contributed my own stories to _Linux Journal_. I’ve written several articles including essays on usability in open source software, Bash shell scripting tricks, and C programming how-tos. - -But my contributions to Linux Journal are meager compared to others. Over the years, I have enjoyed reading many article series from regular contributors. I loved Dave Taylor's "Work the Shell" series about practical and sometimes magical scripts written for the Bash shell. I always turned to Kyle Rankin's "Hack and /" series about cool projects with Linux. And I have enjoyed reading articles from the latest Linux Journal deputy editor Bryan Lunduke, especially a recent geeky article about "[How to Live Entirely in a Terminal][6]" that showed you can still do daily tasks on Linux without a graphical environment. - -Many years later, things took a turn. Linux Journal’s Publisher Carlie Fairchild wrote a seemingly terminal essay [_Linux Journal Ceases Publication_][7] in December 2017 that indicated _Linux Journal_ had "run out of money, and options along with it." But a month later, Carlie updated the news item to report that "*Linux Journal *was saved and brought back to life" by an angel investor. London Trust Media, the parent company of Private Internet Access, injected new funds into Linux Journal to get the magazine back on its feet. _Linux Journal_ resumed regular issues in March 2018. - -But it seems the rescue was not enough. Late in the evening of August 7, 2019, _Linux Journal_ posted a final, sudden goodbye. Kyle Rankin’s essay [_Linux Journal Ceases Publication: An Awkward Goodbye_][8] was preceded with this announcement: - -**IMPORTANT NOTICE FROM LINUX JOURNAL, LLC:** -_On August 7, 2019, Linux Journal shut its doors for good. All staff were laid off and the company is left with no operating funds to continue in any capacity. The website will continue to stay up for the next few weeks, hopefully longer for archival purposes if we can make it happen. -–Linux Journal, LLC_ - -The announcement came as a surprise to readers and staff alike. I reached out to Bryan Lunduke, who commented the shutdown was a "total surprise. Was writing an article the night before for an upcoming issue... No indication that things were preparing to fold." The next morning, on August 7, Lunduke said he "had a series of frantic messages from our Editor (Jill) and Publisher (Carlie). They had just found out, effective the night before... _Linux Journal_ was shut down. So we weren't so much being told that Linux Journal is shutting down... as _Linux Journal_ had already been shut down the day before... and we just didn't know it." - -It's the end of an era. And as we salute the passing of _Linux Journal_, I’d like to recognize the indelible mark the magazine has left on the Linux landscape. _Linux Journal_ was the first publication to highlight Linux as a serious platform, and I think that made people take notice. - -And with that seriousness, that maturity, _Linux Journal_ helped Linux shake its early reputation of being a hobby project. _Linux Journal's_ coverage from 1994 to 2019 highlighted Linux’s rise to an enterprise platform that runs a majority of the world’s servers and services. - -I tip my hat to everyone at _Linux Journal_ and any contributor who was part of its journey. It has been a pleasure to work with you over the years. You kept the spirit alive. This may be a painful experience, but I hope everyone ends up in a good place. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/goodbye-linux-journal - -作者:[Jim Hall][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/jim-hallhttps://opensource.com/users/scottnesbitthttps://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://www.linuxjournal.com/issue/1 -[3]: https://www.linuxjournal.com/article/2736 -[4]: https://www.linuxjournal.com/article/2734 -[5]: https://www.linuxjournal.com/article/2735 -[6]: https://www.linuxjournal.com/content/without-gui-how-live-entirely-terminal -[7]: https://www.linuxjournal.com/content/linux-journal-ceases-publication -[8]: https://www.linuxjournal.com/content/linux-journal-ceases-publication-awkward-goodbye diff --git a/sources/talk/20190812 Xilinx launches new FPGA cards that can match GPU performance.md b/sources/talk/20190812 Xilinx launches new FPGA cards that can match GPU performance.md deleted file mode 100644 index d53ca0253f..0000000000 --- a/sources/talk/20190812 Xilinx launches new FPGA cards that can match GPU performance.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Xilinx launches new FPGA cards that can match GPU performance) -[#]: via: (https://www.networkworld.com/article/3430763/xilinx-launches-new-fpga-cards-that-can-match-gpu-performance.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Xilinx launches new FPGA cards that can match GPU performance -====== -Xilinx says its new FPGA card, the Alveo U50, can match the performance of a GPU in areas of artificial intelligence (AI) and machine learning. -![Thinkstock][1] - -Xilinx has launched a new FPGA card, the Alveo U50, that it claims can match the performance of a GPU in areas of artificial intelligence (AI) and machine learning. - -The company claims the card is the industry’s first low-profile adaptable accelerator with PCIe Gen 4 support, which offers double the throughput over PCIe Gen3. It was finalized in 2017, but cards and motherboards to support it have been slow to come to market. - -The Alveo U50 provides customers with a programmable low-profile and low-power accelerator platform built for scale-out architectures and domain-specific acceleration of any server deployment, on premises, in the cloud, and at the edge. - -**[ Also read: [What is quantum computing (and why enterprises should care)][2] ]** - -Xilinx claims the Alveo U50 delivers 10 to 20 times improvements in throughput and latency as compared to a CPU. One thing's for sure, it beats the competition on power draw. It has a 75 watt power envelope, which is comparable to a desktop CPU and vastly better than a Xeon or GPU. - -For accelerated networking and storage workloads, the U50 card helps developers identify and eliminate latency and data movement bottlenecks by moving compute closer to the data. - -![Xilinx Alveo U50][3] - -The Alveo U50 card is the first in the Alveo portfolio to be packaged in a half-height, half-length form factor. It runs the Xilinx UltraScale+ FPGA architecture, features high-bandwidth memory (HBM2), 100 gigabits per second (100 Gbps) networking connectivity, and support for the PCIe Gen 4 and CCIX interconnects. Thanks to the 8GB of HBM2 memory, data transfer speeds can reach 400Gbps. It also supports NVMe-over-Fabric for high-speed SSD transfers. - -That’s a lot of performance packed into a small card. - -**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][4] ]** - -### What the Xilinx Alveo U50 can do - -Xilinx is making some big boasts about Alveo U50's capabilities: - - * Deep learning inference acceleration (speech translation): delivers up to 25x lower latency, 10x higher throughput, and significantly improved power efficiency per node compared to GPU-only for speech translation performance. - * Data analytics acceleration (database query): running the TPC-H Query benchmark, Alveo U50 delivers 4x higher throughput per hour and reduced operational costs by 3x compared to in-memory CPU. - * Computational storage acceleration (compression): delivers 20x more compression/decompression throughput, faster Hadoop and big data analytics, and over 30% lower cost per node compared to CPU-only nodes. - * Network acceleration (electronic trading): delivers 20x lower latency and sub-500ns trading time compared to CPU-only latency of 10us. - * Financial modeling (grid computing): running the Monte Carlo simulation, Alveo U50 delivers 7x greater power efficiency compared to GPU-only performance for a faster time to insight, deterministic latency and reduced operational costs. - - - -The Alveo U50 is sampling now with OEM system qualifications in process. General availability is slated for fall 2019. - -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/3430763/xilinx-launches-new-fpga-cards-that-can-match-gpu-performance.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://images.techhive.com/images/article/2014/04/bolts-of-light-speeding-through-the-acceleration-tunnel-95535268-100264665-large.jpg -[2]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[3]: https://images.idgesg.net/images/article/2019/08/xilinx-alveo-u50-100808003-medium.jpg -[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190815 Extreme-s acquisitions have prepped it to better battle Cisco, Arista, HPE, others.md b/sources/talk/20190815 Extreme-s acquisitions have prepped it to better battle Cisco, Arista, HPE, others.md deleted file mode 100644 index cfe30ea142..0000000000 --- a/sources/talk/20190815 Extreme-s acquisitions have prepped it to better battle Cisco, Arista, HPE, others.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Extreme's acquisitions have prepped it to better battle Cisco, Arista, HPE, others) -[#]: via: (https://www.networkworld.com/article/3432173/extremes-acquisitions-have-prepped-it-to-better-battle-cisco-arista-hpe-others.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Extreme's acquisitions have prepped it to better battle Cisco, Arista, HPE, others -====== -Extreme has bought cloud, SD-WAN and data center technologies that make it more prepared to take on its toughest competitors. -Extreme Networks has in recent months restyled the company with data-center networking technology acquisitions and upgrades, but now comes the hard part – executing with enterprise customers and effectively competing with the likes of Cisco, VMware, Arista, Juniper, HPE and others. - -The company’s latest and perhaps most significant long-term move was closing the [acquisition of wireless-networking vendor Aerohive][1] for about $210 million.  The deal brings Extreme Aerohive’s wireless-networking technology – including its WiFi 6 gear, SD-WAN software and cloud-management services. - -**More about edge networking** - - * [How edge networking and IoT will reshape data centers][2] - * [Edge computing best practices][3] - * [How edge computing can help secure the IoT][4] - - - -With the Aerohive technology, Extreme says customers and partners will be able to mix and match a broader array of software, hardware, and services to create networks that support their unique needs, and that can be managed and automated from the enterprise edge to the cloud. - -The Aerohive buy is just the latest in a string of acquisitions that have reshaped the company. In the past few years the company has acquired networking and data-center technology from Avaya and Brocade, and it bought wireless player Zebra Technologies in 2016 for $55 million. - -While it has been a battle to integrate and get solid sales footing for those acquisitions – particularly Brocade and Avaya, the company says those challenges are behind it and that the Aerohive integration will be much smoother. - -“After scaling Extreme’s business to $1B in revenue [for FY 2019, which ended in June] and expanding our portfolio to include end-to-end enterprise networking solutions, we are now taking the next step to transform our business to add sustainable, subscription-oriented cloud-based solutions that will enable us to drive recurring revenue and improved cash-flow generation,” said Extreme CEO Ed Meyercord at the firm’s [FY 19 financial analysts][5] call. - -The strategy to move more toward a software-oriented, cloud-based revenue generation and technology development is brand new for Extreme. The company says it expects to generate as much as 30 percent of revenues from recurring charges in the near future. The tactic was enabled in large part by the Aerohive buy, which doubled Extreme’s customer based to 60,000 and its sales partners to 11,000 and whose revenues are recurring and cloud-based.  The acquisition also created the number-three enterprise Wireless LAN company behind Cisco and HPE/Aruba.    - -“We are going to take this Aerohive system and expand across our entire portfolio and use it to deliver common, simplified software  with feature packages for on-premises or in-cloud based on customers' use case,” added Norman Rice, Extreme’s Chief Marketing, Development and Product Operations Officer. “We have never really been in any cloud conversations before so for us this will be a major add.” - -Indeed, the Aerohive move is key for the company’s future, analysts say. - -To continue reading this article register now - -[Get Free Access][6] - -[Learn More][7]   Existing Users [Sign In][6] - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3432173/extremes-acquisitions-have-prepped-it-to-better-battle-cisco-arista-hpe-others.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.networkworld.com/article/3405440/extreme-targets-cloud-services-sd-wan-wifi-6-with-210m-aerohive-grab.html -[2]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[3]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html -[4]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html -[5]: https://seekingalpha.com/article/4279527-extreme-networks-inc-extr-ceo-ed-meyercord-q4-2019-results-earnings-call-transcript -[6]: javascript:// -[7]: https://www.networkworld.com/learn-about-insider/ diff --git a/sources/talk/20190815 Nvidia rises to the need for natural language processing.md b/sources/talk/20190815 Nvidia rises to the need for natural language processing.md deleted file mode 100644 index c2b64d7f63..0000000000 --- a/sources/talk/20190815 Nvidia rises to the need for natural language processing.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Nvidia rises to the need for natural language processing) -[#]: via: (https://www.networkworld.com/article/3432203/nvidia-rises-to-the-need-for-natural-language-processing.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Nvidia rises to the need for natural language processing -====== -As the demand for natural language processing grows for chatbots and AI-powered interactions, more companies will need systems that can provide it. Nvidia says its platform can handle it. -![andy.brandon50 \(CC BY-SA 2.0\)][1] - -Nvidia is boasting of a breakthrough in conversation natural language processing (NLP) training and inference, enabling more complex interchanges between customers and chatbots with immediate responses. - -The need for such technology is expected to grow, as digital voice assistants alone are expected to climb from 2.5 billion to 8 billion within the next four years, according to Juniper Research, while Gartner predicts that by 2021, 15% of all customer service interactions will be completely handled by AI, an increase of 400% from 2017. - -The company said its DGX-2 AI platform trained the BERT-Large AI language model in less than an hour and performed AI inference in 2+ milliseconds, making it possible “for developers to use state-of-the-art language understanding for large-scale applications.” - -**[ Also read: [What is quantum computing (and why enterprises should care)][2] ]** - -BERT, or Bidirectional Encoder Representations from Transformers, is a Google-powered AI language model that many developers say has better accuracy than humans in some performance evaluations. It’s all discussed [here][3]. - -### Nvidia sets natural language processing records - -All told, Nvidia is claiming three NLP records: - -**1\. Training:** Running the largest version of the BERT language model, a Nvidia DGX SuperPOD with 92 Nvidia DGX-2H systems running 1,472 V100 GPUs cut training from several days to 53 minutes. A single DGX-2 system, which is about the size of a tower PC, trained BERT-Large in 2.8 days. - -“The quicker we can train a model, the more models we can train, the more we learn about the problem, and the better the results get,” said Bryan Catanzaro, vice president of applied deep learning research, in a statement. - -**2\. Inference**: Using Nvidia T4 GPUs on its TensorRT deep learning inference platform, Nvidia performed inference on the BERT-Base SQuAD dataset in 2.2 milliseconds, well under the 10 millisecond processing threshold for many real-time applications, and far ahead of the 40 milliseconds measured with highly optimized CPU code. - -**3\. Model:** Nvidia said its new custom model, called Megatron, has 8.3 billion parameters, making it 24 times larger than the BERT-Large and the world's largest language model based on Transformers, the building block used for BERT and other natural language AI models. - -In a move sure to make FOSS advocates happy, Nvidia is also making a ton of source code available via [GitHub][4]. - - * NVIDIA GitHub BERT training code with PyTorch - * NGC model scripts and check-points for TensorFlow - * TensorRT optimized BERT Sample on GitHub - * Faster Transformer: C++ API, TensorRT plugin, and TensorFlow OP - * MXNet Gluon-NLP with AMP support for BERT (training and inference) - * TensorRT optimized BERT Jupyter notebook on AI Hub - * Megatron-LM: PyTorch code for training massive Transformer models - - - -Not that any of this is easily consumed. We’re talking very advanced AI code. Very few people will be able to make heads or tails of it. But the gesture is a positive one. - -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/3432203/nvidia-rises-to-the-need-for-natural-language-processing.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://images.idgesg.net/images/article/2019/04/alphabetic_letters_characters_language_by_andybrandon50_cc_by-sa_2-0_1500x1000-100794409-large.jpg -[2]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[3]: https://medium.com/ai-network/state-of-the-art-ai-solutions-1-google-bert-an-ai-model-that-understands-language-better-than-92c74bb64c -[4]: https://github.com/NVIDIA/TensorRT/tree/release/5.1/demo/BERT/ -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190826 Software-defined perimeter - the essence of trust.md b/sources/talk/20190826 Software-defined perimeter - the essence of trust.md new file mode 100644 index 0000000000..6bc24dae2c --- /dev/null +++ b/sources/talk/20190826 Software-defined perimeter - the essence of trust.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Software-defined perimeter – the essence of trust) +[#]: via: (https://www.networkworld.com/article/3433922/software-defined-perimeter-the-essence-of-trust.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +Software-defined perimeter – the essence of trust +====== +Within a zero-trust environment, there is no implicit trust. Thus, trust must be sourced from somewhere else in order to gain access to protected resources. +![Thinkstock][1] + +Actions speak louder than words. Reliable actions build lasting trust in contrast to unreliable words. Imagine that you had a house with a guarded wall. You would feel safe in the house, correct? Now, what if that wall is dismantled? You might start to feel your security is under threat. Anyone could have easy access to your house. + +In the same way, with traditional security products: it is as if anyone is allowed to leave their house, knock at your door and pick your locks. Wouldn’t it be more secure if only certain individuals whom you fully trust can even see your house? This is the essence of zero-trust networking and is a core concept discussed in my recent course on [SDP (][2][software-defined perimeter).][2] + +Within a zero-trust environment, there is no implicit trust. Thus, trust must be sourced from somewhere else in order to gain access to protected resources. It is only after sufficient trust has been established and the necessary controls are passed, that the access is granted, providing a path to the requested resource. The access path to the resource is designed differently, depending on whether it’s a client or service-initiated software-defined perimeter solution. + +**[ Don’t miss [customer reviews of top remote access tools][3] and see [the most powerful IoT companies][4] . | Get daily insights by [signing up for Network World newsletters][5]. ]** + +A per application tunnel is created through the one-to-one mapping process. This effectively establishes a “network segment of one” that is unique for each user and application. This is in comparison to broad-level access that traditional architectures exhibit. Typically, the broad network access results in overly permissive access with an attack surface that is simply too large. + +One of the key elements for the software-defined perimeter and zero trust is that both; the user and device validation, along with application access validation are based on the user’s identity, not the IP address. Nowadays, anything associated with IP addresses is ridiculous as we have nothing solid to hang policy from. + +### The traditional chain of events + +Traditionally, a device would look at the IP address of the requesting entity and ask for a password. This opens the door to bad actors that can communicate from any IP address and insert themselves between you and the trusted remote device if they please. + +Today, the IP address is no longer sufficient to define the level of trust for a user. IP addresses lack user knowledge to assign and validate the trust. There is no contextual information taken into consideration. This is often referred to as the IP address conundrum. Therefore, as an anchor for the network location and policy, we need to look beyond the ports and IP addresses. + +Network policies have traditionally focused on what systems can communicate with each other. The permit or deny is a very binary framework to use in today's dynamic environment. It has resulted in a policy that is either too rigidly defined or too loosely defined. This is where the software-defined perimeter finds the middle-ground. + +Essentially with SDP, we examine at every stage the user validation, device validation, and applications for every request in a zero-trust network. Trust in a network is constantly evolving, based on the previous and current actions of the user. This is what’s known as a variable trust level and will ensure a strong trust chain. + +### What is Software-Defined Perimeter (SDP)? + +According to a report from IDG and Pulsesecure, [SDP is gaining momentum][6]. It controls access to resources based on the identity often referred to as the “Black Out”, which means that the applications and sensitive data cannot be detected by unauthorized users. As mentioned earlier, it is designed around the user identity, not the IP address. + +The whole idea of SDP is to isolate the user from the application. This can be done in a number of ways, client-initiated and service-initiated. + +### SDP client-initiated + +One such way is to put the requesting client on the network while leaving the network infrastructure and applications dark. This can be done with a lightweight security protocol, such as single packet authorization (SPA). This allows the SDP to receive a valid SPA packet before turning the lights on. In this case, the client has to initiate the connection to trigger the authentication. + +### What is a SPA? + +A [SPA packet][7] _[Disclaimer: the author is employed by Network Insight]_ is a UDP packet that is encrypted, cryptographically signed and cannot be faked. No two SPA packets are ever the same; therefore, replay attacks are impossible. SPA is intentionally designed to have multiple layers of security that are built on each other. These are the layers of security that are on top of whatever the port it is protecting.  + +SPA plays a significant role by hiding both; the applications and SDP infrastructure components (including the SDP controller and gateway) until the client sends a valid SPA packet. Until this happens, everything remains dark hidden from unauthorized users and devices. + +### SDP service-initiated + +We also have a service-initiated approach that uses an SDP broker. The SDP broker may come in the form of an appliance or cloud service that remains within the cloud approach. One example could be to have mutual TLS tunnels from an SDP device (located wherever the application is ) to the SDP cloud, then another mutual TLS from the initiating client to the same SDP cloud. This enables both the client and an SDP device to connect outbound on the port TCP 443 to the SDP cloud. + +With the service-initiated model, the client does not connect to the location of the application. Basically, the location of the application is irrelevant to the path access. This is completely different to how application access is built today. Instead, with SDP, a trust chain is built between the two sides of the service. + +### Removing the network + +This model of connectivity inverts our existing approach. Fundamentally, the user is never given access to the network until fully authenticated. Applications can literally exist anywhere as you don’t need an inbound path. This offers additional levels of security against the application DDoS and the ability to have overlapping IP addresses that are useful for mergers and acquisitions. + +As per the initial security setup, in order to get access to an application you had to connect a user to a network. Further, if the users were external and not on the local network, you needed to create a virtual network. An inbound port was needed to expose the application to the public internet. However, this open port was visible to anyone. As you can imagine from a security standpoint, the idea of network connectivity to access an application is not a good idea. + +The traditional chain of events is to connect first and then authenticate. This allows users, good or bad, to gain access to your network and services. Then we hand them off to the service to determine whether the user is permitted access. + +Access before authentication allows both good and bad users to gain access to all the services. Evidently, ‘first, connect and then authenticate’ has many drawbacks which is why we must secure the user access with stronger levels of authentication and authorization. + +### A robust way to validate + +The first stage is authentication, which ensures that a user is who he or she claims to be. The second stage is authorization, which allows access to the resources based on the identity. Here, the SDP policies can define a set of network services (such as network geolocation and encryption for communications) that a given user or group of users is authorized to access, and under what circumstances. + +### The authentication + +The policies governing authentication may require single or multiple factors. SDP uses a combination of user authentication as well as device authentication for each connection between the initiating and accepting hosts. + +The main part of the authentication stage is the “Authenticators”. Authenticators could be as simple as something you know, such as a password or potentially more complex, such as something you are, a fingerprint or other biometric data. + +The authentication process provides authentication to two things, user and device authentication. Device authentication can be done by following protocols, such as single packet authorization (SPA), host-specific firewalls, mutual transport layer security, device fingerprinting, software verification, and geo-location + +The user authentication can be provided by the trusted browser, SAML or authentication to an identity provider (IP). + +### Authenticating the user + +Firstly, the user needs to be authenticated. The SDP policy plane has a context that needs to be validated before access is granted. This will most likely be not just authentication but a full authorization. + +The users will have a set of credentials on their device as a result of pre-authentication and pre-authorization. What is recommended here is to use SAML based services. With SAML you can get things back, such as SAML attributes. This ensures that if this user is part of this group or access path the user is allowed access to this application. + +The identity can also be validated against an identity provider. The traditional VPNs would use an authorization database that had user credentials. But this was different from the centralized trust. The centralized trust would be provided by some kind of LDAP environment, such as an active directory (AD). + +The considerable benefit of using an identity provider is that it acts as a gateway for users to authenticate against the same centralized trust. However, VPNs or other gateway services require a different database with a different management process. This can create an overhead to either add or delete the users from different databases. + +Having everything controlled in one central database provider is the key to managing a single set of controls of trust. Essentially, in SDP, a user validates against an externally facing IDP and then the user is authenticated against the identity store. The identity store can be certificate-based and may even include multi-factor authentication (MFA). + +With services, such as MS Azure AD and Octa, you can go deeper and include the contextual-based authentication against the IDP. The IDP can then take into consideration the geolocation details and other parameters that are not usually accessed with the standard authentication. + +### Geo-location + +Geo-location is a useful feature. It is the identification or estimation of the real-world’s geographic location. This can be used as a source of information which can help in making decisions regarding the access in an SDP. + +Here, an ideal approach for the SDP would be to compare the user geolocation with the connection attempts to detect the credential theft. If the user does not meet the criteria in the IDP, the trust level is lowered, and the user will be given a subset of access instead of the full access path. + +### Authenticating the device + +Largely, the end goal of device validation is to make sure that the device is trusted. This stage occurs only after the user is validated. By employing some SDP solutions, the device validation can be carried out for the client’s software running on the client’s device. + +The process is that the user authorizes himself or herself against the IDP. Then all the tests are run against the IDP. Once the user passes these validation steps and submits an application request to the SDP, the SDP will go to another layer of validation and test things like corporate certification tests, disk encryption, etc. The SDP will also verify if there a local firewall running. These tests are done under the enforcement of the policy. + +The device validation should be done on a per-application and per policy rule. The device test is not a one-time test. It tests the device in relation to the access request at that particular time. On the other hand, SAML occurs only once, i.e. when a user logs in. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][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/3433922/software-defined-perimeter-the-essence-of-trust.html + +作者:[Matt Conran][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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://images.techhive.com/images/article/2015/11/millennials_trust-100625376-large.jpg +[2]: https://www.pluralsight.com/courses/sdp-leveraging-zero-trust-create-network-security-architecture +[3]: https://www.networkworld.com/article/3262145/lan-wan/customer-reviews-top-remote-access-tools.html#nww-fsb +[4]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html#nww-fsb +[5]: https://www.networkworld.com/newsletters/signup.html#nww-fsb +[6]: https://www.pulsesecure.net/resource/2019-state-of-enterprise-secure-access/ +[7]: https://network-insight.net/2019/06/zero-trust-single-packet-authorization-passive-authorization/ +[8]: https://www.networkworld.com/contributor-network/signup.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190827 6 crucial tips for leading a cross-functional team.md b/sources/talk/20190827 6 crucial tips for leading a cross-functional team.md new file mode 100644 index 0000000000..b3a90dace5 --- /dev/null +++ b/sources/talk/20190827 6 crucial tips for leading a cross-functional team.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 crucial tips for leading a cross-functional team) +[#]: via: (https://opensource.com/open-organization/19/8/tips-cross-functional-teams) +[#]: author: (Michael Doyle https://opensource.com/users/mdoyle) + +6 crucial tips for leading a cross-functional team +====== +Leading work that cuts across teams and departments isn't easy, but +taking an open approach will help you succeed. Here's a checklist for +getting started. +![a big flag flying in a sea of other flags, teamwork][1] + +So you've taken on the challenge of leading your first cross-functional project, one that requires voluntary effort from people across organizational functions to achieve its objective. Congratulations! + +But amidst your excitement over the opportunity to prove yourself, you're also feeling anxious about how you're _actually going to do it_? + +Here are six tips for leveraging [open organization principles][2] to help you shine like the leader you truly want to be. These tips are drawn from my experience having led cross-functional projects, and from my conversations with other-cross functional project leaders. + +### 1\. Start at the top + +Executive sponsors who care will make your work feel like you're not swimming against the tide. Ideally, you'll want a sponsor who understands your project's importance to the organization—someone who can regularly motivate the team by demonstrating how this project delivers on the organization's goals, and who will, in the process, celebrate and promote the successful work the team achieves. + +If your executive sponsor doesn't look like this, then your first responsibility as a leader is to guide them to clarity. Using the open organization value of inclusivity, give your sponsor clear feedback that will help them identify the project's priority. For you to be successful, your executive sponsor needs to clearly understand why they're sponsoring this project and be willing to support it all the way to its completion. That means being prepared to commit some time after the project kick-off to receive updates, remind the team about why this project is important, and to celebrate success. Your duty is to help them understand this. + +Having this conversation with your executive sponsor might seem confrontational, but you're actually stepping up to your role as leader by caring about the success of the project and all the people who will be involved. On a few projects in which I was involved, this step helped the executive sponsor see that they didn't really _need_ this project. Think of all the resources saved because the executive sponsor made that decision earlier rather than later. + +### 2\. Why ask why + +Now that you've secured a committed executive sponsor, it's now time to translate their vision into the team's shared vision. + +This might sound like a trivial step, but it's an important one for achieving team buy-in; it turns the executive sponsor's reasons for the team's existence into the team's _own_ reasons for existing. The open organization value of community is key here, because as the project leader you are helping build the necessary framework that provides the team with an opportunity to contribute to, understand, and agree on the problem scope presented by the project sponsor. + +Notice I said "problem" and not "solution." Guide the team to agree on the _problem_ first, and define and agree on the _solution_ to solve it second. As you do this, make sure that each team member can voice concerns. Listen and note those concerns rather than giving reasons to dismiss them. You're going to need each team member's _real_ commitment to the project—not just a head nod. Listening to team members is the founding conduit through which this happens. + +In an ideal open organization, people come together naturally and for the right reasons. Unfortunately your project exists in a real organization, and sometimes you need more than a verbal agreement to get such buy-in to stick. + +In an ideal open organization, people come together naturally and for the right reasons. Unfortunately your project exists in a _real_ organization, and sometimes you need more than a verbal agreement to get such buy-in to stick. This is once again an opportunity to step up as a leader. Talk to each team member's manager and work together to connect the work they will do on the project to their performance and development plan. You'll want to make sure the team member and their manager are touching base on the project in their one-on-ones and factoring in behavior and outcomes into any financial compensation mechanism your company has (bonuses, salary review, etc.). + +With this key step in place, you'll have the buy-in you need when the going gets tough as team members struggle to prioritize project work with their day-to-day responsibilities. + +### 3\. Lights, camera, action + +Movies work because everyone knows their role and the roles of others. They know what they are supposed to do and when. Your team needs this too, and you can shine as a leader by helping them create it. + +Work with your team to draft some kind of "team agreement," guidelines team members have developed to structure _how_ they must work together to create a positive, productive process. + +Work will flow smoothly if every team member understands what they're expected to deliver. As a leader, you're facilitating the open organization value of collaboration by giving each member an opportunity to define their role. You need to have an idea of the roles required to deliver the project, and you need to consult with the team to make sure each member is a good fit for the role. + +At this point, you'll also start to define common vocabulary the team must understand to ensure they can work together smoothly. Don't take anything for granted here; use any opportunity to establish that common vocabulary by asking team members what they mean when they use potentially vague, ambiguous, or domain-specific vocabulary. For example, a team member might say, "We need to have a robust review process after each milestone." That's a great opportunity to ask, "What does a robust review process look like to you?" + +### 4\. Mirror, mirror on the wall + +Now that you've identified—and documented—the team's roles and common vocabulary, it's time to make sure you define yours. + +Movies work because everyone knows their role and the roles of others. They know what they are supposed to do and when. Your team needs this too, and you can shine as a leader by helping them create it. + +In my experience a project _leader's_ role is different to a project _member's_ role. The leader's job is to work _on_ the project, not in it. Getting bogged down in the tactical and becoming the project's "hero" might scream of individual accomplishment, but it's not going to prove your leadership ability to the organization in the way you're hoping it would when you took on this project in the first place. Let the team know that you're not responsible for managing or owning all actions. Leverage the open organization value of adaptability and use your advantage of seeing a broader view of the work to help the project team see for themselves where the gaps are. Help them make the connections from the tactical work to the strategic. Hold up a mirror so they can see when they're breaking their own rules, as documented in the "team agreement." The project team should expect their leader to keep them on track, focused, organized, and informed. + +Having peer support will help you here. Your peers may know the landscape of people better than you do. They can also double-check your communications before you've rolled them out publicly. Seek out a trusted peer to be your sounding board, and find one or two equally trusted sources who can help you navigate the cross-functional landscape. + +### 5\. Publish or perish + +Communicate well and you'll be that successful leader you're hoping to be. Communicate poorly (or not at all) and you'll be fighting more fires than Steve McQueen's Michael O'Halloran in "The Towering Inferno." + +Communication is not a burden; it's a useful tool for building organizational alliances, and it asks of you only a small amount of time. In return, it delivers immense value. + +As a team, identify a meeting cadence and stick to it. Cut meetings short if there's no remaining value to add to a discussion, but keep the cadence. Cadence is your lead measure. Without a regular cadence the group will slowly disintegrate. Team members need to agree to join the meeting and show up. Let up for a moment here and make it acceptable not to attend, and guess what? That's now the team norm. Don't be that leader. + +Publish your meeting minutes in a location that others can find them. This is essentially the "social proof" that the team is doing its work. Nobody praises a team that acts like a black box. Don't become that team. Transparency all the way. + +And the most overlooked part of this? Measure it. Never assume anything has been read or understood just because it went live on the corporate intranet or swooshed away from your outbox. Find a way to ensure you know whether people have _read_ and _understood_ your materials. You can keep this really simple: just ask them. "What's one pressing question you have from our latest project update?" + +### 6\. (Never) to infinity and beyond + +Communication is not a burden; it's a useful tool for building organizational alliances, and it asks of you only a small amount of time. In return, it delivers immense value. + +Lastly, the project needs to be _time bound_. Team members need some _light_ at the end of the project's tunnel. If the project is multi-year, or multi-phase, then this could mean giving an opportunity for old members to leave and new members to join. Nobody wins in a protracted war. + +Be a great leader and conduct a retrospective when the project is finished so you can add _your_ experience to all of this—and pass it on to someone else leading their first cross-functional project. + +Here's a handy checklist of the key points to set your cross-functional team up for success. + +**Checklist for Leading a Cross-Functional Team** + +Step 1 + +✓ + +My sponsor is clear on the project's priority and understands what the project team expects from them for the duration of the project. + +Step 2 + +✓ + +The project team agrees on the problem and understands why this team exists. + +✓ + +Each team member's manager understands how this work fits into the team member’s performance and development and will support them in their one-on-ones. + +Step 3 + +✓ + +Each team member has helped to define and document their role. + +✓ + +As a team we have clarified and documented the meaning of common project vocabulary. + +Step 4 + +✓ + +The team understands my role as project leader. + +✓ + +I have identified and engaged peers who will support me personally during this project. + +Step 5 + +✓ + +The team has set the meeting cadence and committed to attending. And they documented it in the "team agreement." + +✓ + +I have identified how I will follow up on team communications to ensure stakeholders are engaged. + +Step 6 + +✓ + +Team members know how long they are engaged with this project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/8/tips-cross-functional-teams + +作者:[Michael Doyle][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/mdoyle +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/leader_flag_people_team_group.png?itok=NvrjQxM6 (a big flag flying in a sea of other flags, teamwork) +[2]: https://opensource.com/open-organization/resources/open-org-definition diff --git a/sources/talk/20190827 Why Spinnaker matters to CI-CD.md b/sources/talk/20190827 Why Spinnaker matters to CI-CD.md new file mode 100644 index 0000000000..79e0f9071e --- /dev/null +++ b/sources/talk/20190827 Why Spinnaker matters to CI-CD.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why Spinnaker matters to CI/CD) +[#]: via: (https://opensource.com/article/19/8/why-spinnaker-matters-cicd) +[#]: author: (Swapnil Bhartiya https://opensource.com/users/arnieswap) + +Why Spinnaker matters to CI/CD +====== +Spinnaker provides unique building blocks to create tailor-made, and +highly-collaborative continuous delivery pipelines. Join them at +Spinnaker Summit. +![CICD with gears][1] + +It takes many tools to deliver an artifact into production. Tools for building and testing, tools for creating a deployable artifact like a container image, tools for authentication and authorization, tools for maintaining infrastructure, and more. Seamlessly integrating these tools into a workflow can be transformative for an engineering culture, but doing it yourself can be a tall order. + +As organizations mature, both the number of tools and the number of people managing them tend to grow, often leading to confusing complexity and fragmentation. A bespoke continuous delivery (CD) process may work at a smaller scale, but it becomes increasingly challenging to maintain and understand. It can take a long time for new engineers to discover and sort through all the tools needed to deploy even the simplest of changes. + +[Spinnaker][2] was created to address this issue. It is a generalizable and extensible tool that provides users with the building blocks to create tailor-made continuous delivery pipelines. There is no need to spend time and take on increased risk inventing your own approach when you can instead use a solution that is already trusted and developed by major companies like Netflix and Google for handling the delivery of thousands of applications. + +### Spinnaker's origin + +Netflix used to have a fragmented continuous delivery story. Each organization's delivery system was built specifically for that org, so others were often unable to benefit from that work. Teams considered themselves unique and wove together Jenkins jobs with [Asgard][3]. All of this duplicated effort was not only wasteful but also made it difficult to keep teams savvy and up-to-date with the latest delivery best practices. + +In 2014, teams agreed that a general-purpose continuous integration (CI) tool like Jenkins did not provide a suitable foundation to build a continuous delivery platform with the safety and flexibility they needed. To that end, a new tool was born. Netflix's delivery engineering team collaborated with Google to build Spinnaker, a multi-cloud continuous delivery and infrastructure management tool that would be centrally managed and flexible enough to let teams customize their own delivery, but standardized enough to bring best practices and safety to everyone. Spinnaker codifies our decades of experience writing and delivering software into something everyone can use without going through the same growing pains. + +Since the widespread adoption of Spinnaker in the open source community, the maintainers have continuously added new features and integrations to make Spinnaker even more useful and sticky across companies like Netflix, Google, Airbnb, Pinterest, and Snap. + +### Spinnaker in practice + +With Spinnaker, you can [build flexible pipelines made up of stages][4] to deliver your software the way you need. You can have a Deploy stage, which orchestrates the creation and cleanup of new infrastructure using a blue/green strategy for zero downtime. If you want more direct control on your release process, you can add a Manual Judgment stage that waits for external confirmation. These stages can be woven together into pipelines capable of representing complex and customized delivery workflows. + +[![Spinnaker pipeline][5]][6] + +The flexibility of pipelines, combined with a comprehensive set of built-in stages, enabled Spinnaker to catch on across teams. One clear example of this is our [Canary][7] stage, which evaluates a set of metrics to determine if a deploy is healthy or unhealthy. Before Spinnaker, many teams could not use canaries in their deploy pipelines because it was too cumbersome to integrate with their old canary system. This "batteries-included" Canary stage was the carrot that brought a lot of teams to Spinnaker. + +If you need custom behavior, stages also offer an extension point to encapsulate logic specific to your organization or team. These extensions can be open or closed source. For example, you could add custom functionality that updates the status of a Jira ticket, refreshes a cache, or snapshots a database. + +### Spinnaker customization + +As a generalized tool, Spinnaker can do lots of things out of the box; however, it really shines when you customize it. When you add integrations to other tools in your organization or share best practices, it becomes easier to help teams deploy and operate software safely and reliably. + +![Spinnaker concepts hierarchy][8] + +We've added a diverse variety of custom integrations for Spinnaker to make it sticky. The following may spark ideas for how you could customize Spinnaker to fit your organization. + +#### Improve developer efficiency + +One simple UI customization we've done is to have an icon next to each instance that allows you to copy the SSH command to that instance. We did that by overriding the Instance Details panel in the UI with a Netflix-specific component that takes some information from the config file (the base SSH command), inserts the instance ID into that command, and makes it available as a little clipboard button next to the instance ID. + +#### Improve security + +We've worked closely with our security team for the last five years to work best practices into Spinnaker. One example of that is how we create identity and access management (IAM) roles automatically for each application and use those roles to restrict who can do what in AWS, allowing each team the permissions they need to get their job done. + +We make this happen using two parts: (1) we add a custom class into [Clouddriver][9] (the microservice that does cloud operations) that talks to (2) a Lambda function maintained by our security team. + +For each cloud mutating operation, we check with AWS to see if an IAM role exists with that app name; if it doesn't, we check with the security service to see if we should create one. If a role needs to be created, we call that security service with the info it needs to make sure the IAM role is created successfully. + +Because of this setup, we can easily control the IAM profile that every instance is launched while leaving the meat of the IAM functionality to the security team. This provides them the flexibility to change their implementation, add functionality, or do additional auditing without having to make changes to Spinnaker. + +We often use the pattern of a Spinnaker hook and a resulting partner team service call. It helps to separate Spinnaker's concern, which is to serve as a delivery platform, from the concerns managed by partner teams, such as security. This separation also supports partner teams' ability to innovate independently, resulting in a better, more secure delivery experience for our users. + +#### Improve traceability and auditing + +A final example of a custom integration is sending a [Spinnaker event stream][10] to another service. Spinnaker does a lot of mutating operations, and often you might need to record those events for auditing or compliance purposes. We send all events to our Big Data store so other teams within the company can make use of the data. + +We also manage a [PCI][11]-compliant environment. Previously, we had a co-located Spinnaker instance that ran in this isolated environment to maintain compliance. This year, we enabled the [Fiat][12] authorization microservice in Spinnaker, hardened it, and converged on maintaining all properties with a single Spinnaker. + +### Conclusion + +Continuous delivery is hard to do correctly. Spinnaker is a hardened and well-maintained tool (with approximately 460 merged pull requests in the last month) that has many existing integrations to popular services while also supporting custom integrations for increased flexibility. Large companies like Netflix, Google, Amazon, Nike, Cisco, and Salesforce are actively contributing to Spinnaker. Adopting Spinnaker allows you to centralize your continuous delivery and gain access to best practices. Instead of reinventing the wheel, why not join the Spinnaker community? + +* * * + +_If this topic interests you, come talk to users, maintainers, and other people in the delivery space at the [Spinnaker Summit][13] November 15–17 in San Diego._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/why-spinnaker-matters-cicd + +作者:[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://opensource.com/users/arnieswap +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears) +[2]: https://www.spinnaker.io/ +[3]: https://github.com/Netflix/asgard +[4]: https://www.spinnaker.io/concepts/ +[5]: https://opensource.com/sites/default/files/uploads/spinnaker_edit-pipeline.png (Spinnaker pipeline) +[6]: https://www.spinnaker.io/concepts/pipelines/ +[7]: https://www.spinnaker.io/guides/user/canary/ +[8]: https://opensource.com/sites/default/files/images/spinnaker-pipeline-tasks-opensourcedotcom.png (Spinnaker concepts hierarchy) +[9]: https://github.com/spinnaker/clouddriver +[10]: https://www.spinnaker.io/setup/features/notifications/#add-a-listening-webhook-to-spinnaker +[11]: https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard +[12]: https://github.com/spinnaker/fiat/ +[13]: http://spinnakersummit.com/ diff --git a/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md new file mode 100644 index 0000000000..ab1ad90fe7 --- /dev/null +++ b/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word) +[#]: via: (https://itsfoss.com/gimp-fork-glimpse/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word +====== + +In the world of open source applications, forking is common when members of the community want to take an application in a different direction than the rest. The latest newsworthy fork is named [Glimpse][1] and is intended to fix certain issues that users have with the [GNU Image Manipulation Program][2], commonly known as GIMP. + +### Why create a fork of GIMP? + +![][3] + +When you visit the [homepage][1] of the Glimpse app, it says that the goal of the project is to “experiment with other design directions and fix longstanding bugs.” That doesn’t sound too much out of the ordinary. However, if you start reading the project’s blog posts, a different image appears. + +According to the project’s [first blog post][4], they created this fork because they did not like the GIMP name. According to the post, “A number of us disagree that the name of the software is suitable for all users, and after 13 years of the project refusing to budge on this have decided to fork!” + +If you are wondering why these people find the work GIMP disagreeable they answer that question on the [About page][5]: + +> “If English is not your first language, then you may not have realised that the word “gimp” is problematic. In some countries it is considered a slur against disabled people and a playground insult directed at unpopular children. It can also be linked to certain “after dark” activities performed by consenting adults.” + +They also point out that they are not making this move out of political correctness or being oversensitive. “In addition to the pain it can cause to marginalized communities many of us have our own free software advocacy stories about the GNU Image Manipulation Program not being taken seriously as an option by bosses or colleagues in professional settings.” + +As if to answer many questions, they also said, “It is unfortunate that we have to fork the whole project to change the name, but we feel that discussions about the issue are at an impasse and that this is the most positive way forward.” + +[][6] + +Suggested read  After 6 Years, GIMP 2.10 is Here With Ravishing New Looks and Tons of New Features + +It looks like the Glimpse name is not written in stone. There is [an issue][7] on their GitHub page about possibly picking another name. Maybe they should just drop GNU. I don’t think the word IMP has a bad connotation. + +### A diverging path + +![GIMP 2.10][8] + +[GIMP][6] has been around for over twenty years, so any kind of fork is a big task. Currently, [they are planning][9] to start by releasing Glimpse 0.1 in September 2019. This will be a soft fork, meaning that changes will be mainly cosmetic as they migrate to a new identity. + +Glimpse 1.0 will be a hard fork where they will be actively changing the codebase and adding to it. They want 1.0 to be a port to GTK3 and have its own documentation. They estimate that this will not take place until GIMP 3 is released in 2020. + +Beyond the 1.0, the Glimpse team has plans to forge their own identity. They plan to work on a “front-end UI rewrite”. They are currently discussing [which language][10] they should use for the rewrite. There seems to be a lot of push for D and Rust. They also [hope to][4] “add new functionality that addresses common user complaints” as time goes on. + +### Final Thoughts + +I have used GIMP a little bit in the past but was never too bothered by the name. To be honest, I didn’t know what it meant for quite a while. Interestingly, when I searched Wikipedia for GIMP, I came across an entry for the [GIMP Project][11], which is a modern dance project in New York that includes disabled people. I guess gimp isn’t considered a derogatory term by everyone. + +To me, it seems like a lot of work to go through to change a name. It also seems like the idea of rewriting the UI was tacked to make the project look more worthwhile. I wonder if they will tweak it to bring a more classic UI like [using Ctrl+S to save in GIMP][12]/Glimpse. Let’s wait and watch. + +[][13] + +Suggested read  Finally! WPS Office Has A New Release for Linux + +If you are interested in the project, you can follow them on [Twitter][14], check out their [GitHub account][15], or take a look at their [Patreon page][16]. + +Are you offended by the GIMP name? Do you think it is worthwhile to fork an application, just so you can rename it? 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/gimp-fork-glimpse/ + +作者:[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://getglimpse.app/ +[2]: https://www.gimp.org/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/gimp-fork-glimpse.png?resize=800%2C450&ssl=1 +[4]: https://getglimpse.app/posts/so-it-begins/ +[5]: https://getglimpse.app/about/ +[6]: https://itsfoss.com/gimp-2-10-release/ +[7]: https://github.com/glimpse-editor/Glimpse/issues/92 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/gimp-screenshot.jpg?resize=800%2C508&ssl=1 +[9]: https://getglimpse.app/posts/six-week-checkpoint/ +[10]: https://github.com/glimpse-editor/Glimpse/issues/70 +[11]: https://en.wikipedia.org/wiki/The_Gimp_Project +[12]: https://itsfoss.com/how-to-solve-gimp-2-8-does-not-save-in-jpeg-or-png-format/ +[13]: https://itsfoss.com/wps-office-2016-linux/ +[14]: https://twitter.com/glimpse_editor +[15]: https://github.com/glimpse-editor/Glimpse +[16]: https://www.patreon.com/glimpse +[17]: https://reddit.com/r/linuxusersgroup diff --git a/sources/talk/20190829 Data center-specific AI completes tasks twice as fast.md b/sources/talk/20190829 Data center-specific AI completes tasks twice as fast.md new file mode 100644 index 0000000000..61505ddebe --- /dev/null +++ b/sources/talk/20190829 Data center-specific AI completes tasks twice as fast.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data center-specific AI completes tasks twice as fast) +[#]: via: (https://www.networkworld.com/article/3434597/data-center-specific-ai-completes-tasks-twice-as-fast.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Data center-specific AI completes tasks twice as fast +====== +Researchers at MIT have developed an artificial intelligence-powered system based on reinforcement learning that could revolutionize data center operations. +Matejmo / Getty Images + +Data centers running artificial intelligence (AI) will be significantly more efficient than those operating with hand-edited algorithm schedules, say experts at MIT. The researchers there say they have developed an automated scheduler that speeds cluster jobs by up to 20 or 30 percent, and even faster (2x) in peak periods. + +The school’s AI job scheduler works on a type of AI called “reinforcement learning” (RL). That’s a trial-and-error-based machine-learning method that modifies scheduling decisions depending on actual workloads in a specific cluster. AI, when done right, could supersede the current state-of-the-art method, which is algorithms. They often must be fine-tuned by humans, introducing inefficiency. + +“The system could enable data centers to handle the same workload at higher speeds, using fewer resources,” [the school says in a news article related to the tech][1]. The MIT researchers say the data center-adapted form of RL could revolutionize operations. + +**Also read: [AI boosts data center availability and efficiency][2]** + +“If you have a way of doing trial and error using machines, they can try different ways of scheduling jobs and automatically figure out which strategy is better than others,” says Hongzi Mao, a student in the university’s Department of Electrical Engineering and Computer Science, in the article. “Any slight improvement in utilization, even 1%, can save millions of dollars and a lot of energy.” + +### What's wrong with today's data center algorithms + +The problem with the current algorithms for running tasks on thousands of servers at the same time is that they’re not very efficient. Theoretically, they should be, but because workloads (combinations of tasks) are varied, humans get involved in tweaking the performance—a resource, say, might need to be shared between jobs, or some jobs might need to be performed faster than others—but humans can’t handle the range or scope of the edits; the job is just too big. + +Unfathomable permutations for humans in the manually edited scheduling can include the fact that a lower node (smaller computational task) can’t start work until an upper node (larger, more power-requiring computational task) has completed its work. It gets highly complicated allocating the computational resources, the scientists explain. + +Decima, MIT’s system, can process dynamic graphs (representations) of nodes and edges (edges connect nodes, linking tasks), the school says. That hasn’t been possible before with RL because RL hasn’t been able to understand the graphs well enough at scale. + +“Traditional RL systems are not accustomed to processing such dynamic graphs,” MIT says. + +MIT’s graph-oriented AI is different than other forms of AI that are more commonly used with images. Robots, for example, learn the difference between objects in different scenarios by processing images and getting reward signals when they get it right. + +Similar, though, to presenting images to robots, workloads in the Decima system are mimicked until the system, through the receipt of AI reward signals, improves its decisions. A special kind of baselining (comparison to history) then helps Decima figure out which actions are good and which ones are bad, even when the workload sequences only supply poor reward signals due to the complication of the job structures slowing everything down. That baselining is a key differentiator in the MIT system. + +“Decima can find opportunities for [scheduling] optimization that are simply too onerous to realize via manual design/tuning processes,” says Aditya Akella, a professor at University of Wisconsin at Madison, in the MIT article. The team there has developed a number of high-performance schedulers. “Decima can go a step further,” Akella says. + +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/3434597/data-center-specific-ai-completes-tasks-twice-as-fast.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://news.mit.edu/2019/decima-data-processing-0821 +[2]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190829 Rating IoT devices to gauge their impact on your network.md b/sources/talk/20190829 Rating IoT devices to gauge their impact on your network.md new file mode 100644 index 0000000000..9da7cd573d --- /dev/null +++ b/sources/talk/20190829 Rating IoT devices to gauge their impact on your network.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Rating IoT devices to gauge their impact on your network) +[#]: via: (https://www.networkworld.com/article/3435136/rating-iot-devices-to-gauge-their-impact-on-your-network.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Rating IoT devices to gauge their impact on your network +====== +With the wide range of internet of things devices being connected to business networks, there’s no cookie-cutter solution to building networks to support them, but assessing their needs can help. +Natalya Burova / Getty Images + +One difficulty designing [IoT][1] implementations is the large number of moving parts. Most IoT setups are built out of components from many different manufacturers – one company’s sensors here, another’s there, someone else handling the networking and someone else again making the backend. + +To help you get a ballpark sense of what any given implementation will demand from your network, we’ve come up with a basic taxonomy for rating IoT endpoints. It’s got three main axes: delay tolerance, data throughput and processing power. Here is an explainer for each. (Terminology note: We’ll use “IoT setup” or “IoT implementation” to refer to the entirety of the IoT infrastructure being used by a given organization.) + +**Learn about edge networking** + + * [How edge networking and IoT will reshape data centers][2] + * [Edge computing best practices][3] + * [How edge computing can help secure the IoT][4] + + + +### Delay tolerance + +Many IoT implementation don’t require the millisecond-scale delay tolerance that traditional enterprise networks can provide, so that opens up a lot of network-connectivity options and means that going for a lower-priced choice could prove very successful. + +For example, a connected parking meter doesn’t need to report its status to the city more than once a minute or so (if that), so a delay-inducing wireless option like [LoRaWAN][5] might be perfectly acceptable. Some systems of that type even use standard cellular SMS services to send updates back to central hubs. + +For less delay-tolerant applications, like a production line or oil and gas extraction, industrial Ethernet or particularly low-latency wireless links should be used. Older-generation orchestration systems usually have the actual handling of instructions and coordination between machines well in hand, but adding real-time analytics data to the mix can increase network demands. + +### Data throughput + +Again, networking pros used to dealing with nothing less than megabits per second should adjust their expectations here, as there are plenty of IoT devices that require as little as a few kilobits per second or even less. + +Devices with low-bandwidth requirements include smart-building devices such as connected door locks and light switches that mostly say “open” or “closed” or “on” or “off.” + +Fewer demands on a given data link opens up the possibility of using less-capable wireless technology. Low-power WAN and Sigfox might not have the bandwidth to handle large amounts of traffic, but they are well suited for connections that don’t need to move large amounts of data in the first place, and they can cover significant areas. The range of Sigfox is 3 to 50 km depending on the terrain, and for Bluetooth, it’s 100 meters to 1,000 meters, depending on the class of Bluetooth being used. + +Conversely, an IoT setup such as multiple security cameras connected to a central hub to a backend for image analysis will require many times more bandwidth. In such a case the networking piece of the puzzle will have to be more capable and, consequently, more expensive. Widely distributed devices could demand a dedicated [LTE][6] connection, for example, or perhaps even a microcell of their own for coverage. + +Network World / IDG + +### Processing power + +The degree to which an IoT device is capable of doing its own processing is a somewhat indirect measurement of its impact on your network, to be sure, but it’s still relevant in terms of comparing it to other devices that perform a similar function. A device that’s constantly streaming raw data onto the network, without performing any meaningful analysis or shaping of its own, can be a bigger traffic burden than one that’s doing at least some of the work. + +That’s not always the case, of course. Many less-capable devices won’t generate a lot of data with which to clog up whatever network connection they have, while some more-capable ones (let’s say industrial robots with a lot of inbuilt power to processing data they collect) might still generate plenty of traffic. + +But the onboard computing power of a device is still relevant when comparing it to others that perform similar jobs, particularly in sectors like manufacturing and energy extraction where a lot of analysis has to be performed somewhere, whether it’s on the device, at the edge or at the back end. + +It’s even more relevant in the context of an edge setup, where some or all of the data analysis is done on an [edge-gateway device][7] located close to the endpoints. These gateways can be a good choice when fairly complicated analysis has to be performed as close to real-time as possible. But edge gateways don’t have the same resources available as a full-on [data center][8] or cloud so the amount of work that can be done on the endpoint itself remains a crucial concern. Synthesizing raw information into analysis can mean less traffic that has to go on the network. + +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/3435136/rating-iot-devices-to-gauge-their-impact-on-your-network.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[3]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html +[4]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html +[5]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html +[6]: https://www.networkworld.com/article/3432938/when-private-lte-is-better-than-wi-fi.html +[7]: https://www.networkworld.com/article/3327197/edge-gateways-flexible-rugged-iot-enablers.html +[8]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190829 SparkFun continues to innovate thanks to open source hardware.md b/sources/talk/20190829 SparkFun continues to innovate thanks to open source hardware.md new file mode 100644 index 0000000000..ed48ba62f1 --- /dev/null +++ b/sources/talk/20190829 SparkFun continues to innovate thanks to open source hardware.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SparkFun continues to innovate thanks to open source hardware) +[#]: via: (https://opensource.com/article/19/8/sparkfun-creator-nathan-seidle) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +SparkFun continues to innovate thanks to open source hardware +====== +SparkFun founder Nathan Seidle says companies built around patents +become "intellectually unfit" to innovate. Artemis, his new +microprocessor for low-power devices, is just one example of the +company's nimbleness. +![SparkFun Redboard with Artemis][1] + +When [SparkFun Electronics][2] founder and CEO Nathan Seidle was an engineering student at the University of Colorado, he was taught, "Real engineers come up with an idea and patent that idea." However, his experience with SparkFun, which he founded from his college apartment in 2003, is quite the opposite. + +All 600 "SparkFun original" components are for sale on the site in addition to 1000+ resell products. All of the company's schematics and code are licensed under [CC BY-SA][3], with some firmware [CC0][4], and its design files are available on [public GitHub repos][5]. In addition, some of the company's designs are Open Source Hardware Association ([OSHWA][6]) certified. + +Contrary to his college professor's lesson, Nathan sees patents as an anachronism that provide no guarantees to the companies and individuals who hold them. As he explained in a 2013 [TEDx Boulder talk][7], "If your idea can be sold, it will be," even if you have a patent. + +"When a company relies too much on their intellectual property, they become intellectually unfit—they suffer from IP obesity," he says. "There have been numerous companies in history that have had long periods of prosperity only to be quickly left behind when technology shifted. Cloners are going to clone regardless of your business plan." + +### Openness leads to innovation + +Nathan says building a business on open hardware enables companies like SparkFun to innovate faster than those that are more concerned with defending their patents than developing new ideas. + +Nathan says, "At the end of the day, by not relying on IP and patents, we've gotten stronger, more nimble, and built a more enduring business because of open source hardware." Nathan and SparkFun's 100 employees would rather spend their time innovating than litigating, he says. + +His latest innovation is [Artemis][8], a new type of microprocessor module and the most complex thing he has ever designed. + +![SparkFun and Artemis][9] + +He hopes Artemis will enable users to design consumer-grade products and run anything from an Arduino sketch down to a bare-metal model for voice recognition. + +"The Apollo 3 [integrated circuit] that powers Artemis is exceptionally powerful but also mind-bogglingly low power," he says. "At 0.5mA at 48MHz, it really changes the way you think about microcontrollers and low-power devices. Combine that low power with the push by Google to deploy TensorFlow light onto Artemis, and you've got the potential for battery-powered devices that can run machine learning algorithms for weeks on a single coin cell. It's all a bit mind-bending. We created a custom Arduino port from scratch in order to allow users to program Artemis with Arduino but not be limited to any toolchain." + +### Building a sustainable business on open hardware + +Because all of SparkFun's designs and hardware are open source, anyone can take the source files and copy, modify, sell, or do anything they like with them. SparkFun appreciates that people can take its innovations and use them in even more innovative ways, he says. + +"Where many companies bury or open-wash themselves with the 'open source' banner, we like to brag we're two clicks away from the source files: a link on the product page will take you to the repo where you can immediately clone the repo and begin benefiting from our designs," Nathan says. + +You may be wondering how a company can survive when everything is open and available. Nathan believes that open source is more than sustainable. He says it is a necessity given the rapid pace of change. A culture of sharing and openness can mitigate a lot of problems that more closed companies suffer. He says, "We need to avoid the mistakes that others have made, and the only way to do that is to talk openly and share in our mistakes." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/sparkfun-creator-nathan-seidle + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sparkfun_redboard_artemis.jpg?itok=XGRU-VUF (SparkFun Redboard with Artemis) +[2]: https://www.sparkfun.com/ +[3]: https://creativecommons.org/licenses/by-sa/2.0/ +[4]: https://creativecommons.org/publicdomain/zero/1.0/ +[5]: https://github.com/sparkfun +[6]: https://www.oshwa.org/ +[7]: https://www.youtube.com/watch?v=xGhj_lLNtd0 +[8]: https://www.sparkfun.com/artemis +[9]: https://opensource.com/sites/default/files/uploads/sparkfun_artemis_module_-_low_power_machine_learning_ble_cortex-m4f.jpg (SparkFun and Artemis) diff --git a/sources/talk/20190830 7 rules for remote-work sanity.md b/sources/talk/20190830 7 rules for remote-work sanity.md new file mode 100644 index 0000000000..7e282d02a5 --- /dev/null +++ b/sources/talk/20190830 7 rules for remote-work sanity.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 rules for remote-work sanity) +[#]: via: (https://opensource.com/article/19/8/rules-remote-work-sanity) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +7 rules for remote-work sanity +====== +These rules don't describe my complete practice, but they are an +important summary of what I try to do and what keeps me (relatively) +sane. +![Coding on a computer][1] + +I work remotely and have done so on and off for a good percentage of the past 10 to 15 years. I'm lucky that I'm in a role where this suits my responsibilities, and in a company that is set up for it. Not all roles—those with many customer onsite meetings or those with a major service component—are suited to remote working, of course. But it's clear that an increasing number of organisations are considering having at least some of their workers doing so remotely. + +I've carefully avoided using the phrase either "working from home" or "working at home" above. I've seen discussions that the latter gives a better "vibe" for some reason, but it's not accurate for many remote workers. In fact, it doesn't describe my role perfectly, either. My role is remote, in that I have no company-provided "base"—with a chair, desk, meeting rooms, phone, internet access, etc.—but I don't spend all of my time at home. I spend maybe one-and-a-half weeks a month, on average, travelling—to attend or speak at conferences, to have face-to-face ("F2F") meetings, etc. During these times, I'm generally expected to be contactable and to keep at least vaguely up-to-date on email—although the exact nature of the activities in which I'm engaged, and the urgency of the contacts and email, may increase or reduce my engagement. + +### Open source + +One of the reasons I can work remotely is that I work for a company that works with open source software. I'm currently involved in a very exciting project called [Enarx][2] (which I [announced][3] in May). We have contributors in Europe and the US and interest from further abroad. Our stand-ups are all virtual, and we default to turning on video. At least two of our regulars participate from a treadmill, I will typically stand at my desk. We use GitHub for all our code (it's all open source, of course), and there's basically no reason for us to meet in person very often. We try to celebrate together—agreeing to get cake, wherever we are, to mark special occasions, for instance—and have laptop stickers to brand ourselves and help team unity. We have a shared chat and IRC channel and spend a lot of time communicating via different channels. We're still quite a small team, but it works for now. + +If you're looking for more tips about how to manage, coordinate, and work in remote teams, particularly around open source projects, you'll find lots of [information][4] online. + +### The environment + +When I'm not travelling around the place, I'm based at home. There, I have a commute—depending on weather conditions—of around 30-45 seconds, which is generally pretty bearable. My office is separate from the rest of the house (set in the garden) and outfitted with an office chair, desk, laptop dock, monitor, webcam, phone, keyboard, and printer; these are the obvious work-related items in the room. + +Equally important, however, are the other accoutrements that make for a good working environment. These will vary from person to person, but I also have: + + * A Sonos attached to an amplifier and good speakers + * A sofa, often occupied by my dog and sometimes one of the cats + * A bookshelf where the books that aren't littering the floor reside + * Tea-making facilities (I'm British; this is important) + * A fridge filled with milk (for the tea), beer, and wine (don't worry: I don't drink these during work hours, and it's more that the fridge is good for "overflow" from our main kitchen one) + * Wide-opening windows and blinds for the summer (we have no air-conditioning; I'm British, remember?) + * Underfloor heating _and_ a wood-burning stove for the winter (the former to keep the room above freezing until I get the latter warmed up) + * A "[NUC][5]" computer and monitor for activities that aren't specifically work-related + * A few spiders + + + +What you have will depend on your work style, but these "non-work" items are important (bar the spiders, possibly) to my comfort and work practice. For instance, I often like to listen to music to help me concentrate; I often sit on the sofa with the dog and cats to read long documents; and without the fridge and tea-making facilities, I might as well be American.[1][6] + +### My rules + +How does it work, then? Well, first of all, most of us like human contact from time to time. Some remote workers rent space in a shared work environment and work there most of the time; they prefer an office environment or don't have a dedicated space for working at home. Others will mainly work in coffee shops or on their boat,[2][7] or they may spend half of the year in the office and the other half working from a second home. Whatever you do, finding something that works for you is important. Here's what I tend to do, and why: + + 1. **I try to have fairly rigid work hours.** Officially (and as advertised on our intranet for the information of colleagues), I work 10am-6pm UK time. This gives me a good overlap with the US (where many of my colleagues are based) and time in the morning to go for a run or a cycle and/or to walk the dog (see below). I don't always manage these times, but when I flex outward in one direction, I attempt to pull some time back the other way, as otherwise I know I'll just work ridiculous hours. + 2. **I ensure that I get up and have a cup of tea.** In an office environment, I would typically be interrupted from time to time by conversations, invitations to get tea, physical meetings in meeting rooms, lunch trips, etc. This doesn't happen at home, so it's important to keep moving, or you'll be stuck at your desk frequently for three to four hours at a time. This isn't good for your health or often for your productivity (and I enjoy drinking tea). + 3. **I have an app that tells me when I've been inactive.** This is new for me, but I like it. If I've basically not moved for an hour, my watch (could be a phone or laptop) tells me to do some exercise. It even suggests something, but I'll often ignore that and get up for some tea, for instance.[3][8] + 4. **I use my standing desk's up/down capability.** I try to vary my position through the day from standing to sitting and back again. It's good for posture and keeps me more alert. + 5. **I walk the dog.** If I need to get out of my office and do some deep thinking (or just escape a particularly painful email thread!), I'll take the dog for a walk. Even if I'm not thinking about work for the entire time, I know it'll make me more productive, and if it's a longish walk, I'll make sure I compensate by spending extra time working (which is always easy). + 6. **I have family rules.** The family knows that when I'm in my office, I'm at work. They can message me on my phone (which I may ignore) or may come to the window to see if I'm available, but if I'm not, I'm not. Emergencies (lack of milk for tea, for example) can be negotiated on a case-by-case basis. + 7. **I go for tea (and usually cake) at a cafe.** Sometimes, I need to get into a different environment and have a chat with actual people. For me, popping into the car for 10 minutes and going to a cafe is the way to do this. I've found one that makes good cakes (and tea). + + + +These rules don't describe my complete practice, but they are an important summary of what I try to do and what keeps me (relatively) sane. Your rules will be different, but I think it's really important to _have_ rules and to make it clear to yourself, your colleagues, your friends, and your family what they are. Remote working is not always easy and requires discipline—but that discipline, more often than not, is in giving yourself some slack, rather than making yourself sit down for eight hours a day. + +* * * + +1\. I realise that many people, including many of my readers, are American. That's fine: you be you. I actively _like_ tea, however (and know how to make it properly, which seems to be an issue when I visit the US). +2\. I know a couple of these: lucky, lucky people! +3\. Can you spot a pattern? + +* * * + +_This article was originally published on [Alice, Eve, and Bob][9] and is reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/rules-remote-work-sanity + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://enarx.io/ +[3]: https://opensource.com/article/19/5/enarx-security +[4]: https://opensource.com/sitewide-search?search_api_views_fulltext=remote%20work +[5]: https://en.wikipedia.org/wiki/Next_Unit_of_Computing +[6]: tmp.S5SfsQZWG4#1 +[7]: tmp.S5SfsQZWG4#2 +[8]: tmp.S5SfsQZWG4#3 +[9]: https://aliceevebob.com/2019/08/13/my-7-rules-for-remote-work-sanity/ diff --git a/sources/talk/20190830 Bluetooth finds a role in the industrial internet of things.md b/sources/talk/20190830 Bluetooth finds a role in the industrial internet of things.md new file mode 100644 index 0000000000..1bdc34a5fb --- /dev/null +++ b/sources/talk/20190830 Bluetooth finds a role in the industrial internet of things.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bluetooth finds a role in the industrial internet of things) +[#]: via: (https://www.networkworld.com/article/3434526/bluetooth-finds-a-role-in-the-industrial-internet-of-things.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +Bluetooth finds a role in the industrial internet of things +====== +Market awareness and penetration, plus new technological advancements, are making Bluetooth—yes, Bluetooth—a key networking technology for the IIoT. +Michael Brown / IDG + +Like most people, I think of Bluetooth as a useful but consumer-oriented technology that lets me make easy wireless connections from my smartphone to various headsets, portable speakers, automobile, and other devices. And, of course, billions of people rely on Bluetooth for exactly those capabilities. But according to [Chuck Sabin][1], senior director of market development for the [Bluetooth SIG][2], the technology is growing into a key role in the industrial internet of things (IIoT). + +Sabin says, Bluetooth “technology is actually well-suited for both consumer and enterprise markets.” He cites Bluetooth’s easy-to-implement low-power connections. More importantly, though, Bluetooth is ubiquitous, enjoying 90% global awareness and global, multi-vendor interoperability.  + +Bluetooth offers low deployment costs and massive economies of scale because it’s already built into virtually every new smartphone, tablet, and personal computer, not to mention a wide variety of wearables, smart speakers, and other devices, notes Sabin. That means IIoT deployments leveraging Bluetooth may be able to avoid having to build a completely proprietary solution to start using wireless systems in smart-building and smart-industry environments. + +**[ Learn more [Download a PDF bundle of five essential articles about IoT in the enterprise][3] ]** + +### 3 things driving Bluetooth adoption in IIoT? + +In addition to Bluetooth’s deep market penetration, Sabin cites three notable technical advancements that are driving Bluetooth adoption in industrial and enterprise IoT applications: + + 1. **“The introduction of [Bluetooth 5][4] in 2016 was all about flexibility,”** Sabin explains. Bluetooth 5’s longer range and higher speeds provide the crucial flexibility necessary to support more reliable connections in a wide variety of large, noisy environments, like those of industrial or commercial spaces. For example, Sabin says, “a warehouse is a much different environment than the basement of a nuclear power plant. One is open and requires long-range connections, and the other is a more complex environment with a lot of interference, requiring a reliable connection or device network that can deliver information despite the noise.” + + 2. **[Bluetooth mesh][5], released In July of 2017, extends the [Bluetooth Core Specification][6] to enable “industrial-grade” many-to-many communication,** Sabin says, where tens, hundreds, and even thousands of devices can reliably and securely communicate with one another. “Bluetooth mesh networks are ideally suited for control, monitoring, and automation systems,” Sabin claims, and can also reduce latency and improve security. + + 3. **More recently, the Bluetooth SIG announced a new [direction-finding feature][7]** **for Bluetooth,** bringing even greater precision to location-services systems used in industrial and enterprise settings. [Bluetooth low energy][8] introduced the ability to roughly determine the location of a Bluetooth device by comparing signal strength between the device being located and the tracking device, at what Sabin calls a “fairly broad—“the device is in this room”—level of accuracy. This led to inexpensive, mass-market indoor location and asset tracking solutions. + +The new direction-finding feature makes this much more precise: “Not only is the device in a specific room, but it’s in the back, left corner,” he says. And the Bluetooth SIG is working to add distance to this feature, so users will know whether “the device is in this specific room, in the back, left the corner, and 30 feet from me right now.” This level of precision will enable new applications, including monitoring for safety and security, Sabin says: for example, helping keep workers out of a toxic environment. + + + + +### IioT Bluetooth use cases + +Put all those developments together, and you enable device networks, Sabin says, where interconnected networks of devices are used to control lighting systems, sensor networks, and asset management solutions. + +The Bluetooth SIG divides smart buildings and smart industry into three primary categories: + + 1. **Building automation:** The centralized automation of a factory’s essential systems—including lighting, heating, ventilation, and air conditioning (HVAC) and security—which can help conserve energy, lower operating costs, and improve the life cycle of a building’s core systems. + 2. **Condition monitoring:** Bluetooth sensor networks deployed across a factory floor or throughout an office building enable real-time monitoring of system performance to make maintenance, updating, and overall management more efficient. + 3. **Location services:** This can take on many forms, from wayfinding to asset tracking/management to indoor positioning and location and logistics solutions. + + + +Use cases in manufacturing include helping manufacturers better monitor location, availability, and condition of equipment and output across the supply chain, Sabin says. Using enterprise wearables is helping manufacturers improve material management and process flow. Bluetooth location services are employing beacons to boost safety and security in chemical and manufacturing plants by creating geo-fences for restricted access and tracking numbers of employees in critical areas. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][9] ]** + +Bluetooth Mesh was actually designed with connected lighting in mind, Sabin says, enabling everything from connected lighting in building automation to what he called [Lighting-as-a Platform (LaaP)][10] for deploying these services. + +### Fast growth for Bluetooth in the IIoT + +Based on these trends and advancements, the Bluetooth SIG’s recent [Bluetooth Market Update][11] predicts a 7x growth in annual shipments of Bluetooth smart-building location services devices by 2023, with 374 million Bluetooth smart-building devices shipping that year. The update also sees a 5x growth in annual shipments of Bluetooth smart-industry devices by 2023. These shipments are growing at of 47% a year, Sabin says, and will account for 70% of market shipments in 2023. The report also forecasts a 3.5x increase in shipments of Bluetooth enterprise wearables for smart industry use cases by 2023, with a 28% annual growth rate over the next five years. + +That’s only if everything goes as planned, of course. Sabin warns that industrial and enterprise organizations often adopt new technology relatively slowly, looking for clear ROIs that may not always be fully fleshed out for new technologies. And, yes, no doubt some decision makers still think of Bluetooth as a short-range, point-to-point, consumer-grade technology not ready for enterprise and industrial environments. + +**More about IoT:** + + * [What is the IoT? How the internet of things works][12] + * [What is edge computing and how it’s changing the network][13] + * [Most powerful Internet of Things companies][14] + * [10 Hot IoT startups to watch][15] + * [The 6 ways to make money in IoT][16] + * [What is digital twin technology? [and why it matters]][17] + * [Blockchain, service-centric networking key to IoT success][18] + * [Getting grounded in IoT networking and security][3] + * [Building IoT-ready networks must become a priority][19] + * [What is the Industrial IoT? [And why the stakes are so high]][20] + + + +Join the Network World communities on [Facebook][21] and [LinkedIn][22] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3434526/bluetooth-finds-a-role-in-the-industrial-internet-of-things.html + +作者:[Fredric 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://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://www.linkedin.com/in/chucksabin/ +[2]: https://www.bluetooth.com/about-us/ +[3]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html +[4]: https://www.bluetooth.com/bluetooth-resources/bluetooth-5-go-faster-go-further/ +[5]: https://www.bluetooth.com/media/mesh-kit/ +[6]: https://www.bluetooth.com/specifications/bluetooth-core-specification/ +[7]: https://www.bluetooth.com/media/location-services/ +[8]: https://en.wikipedia.org/wiki/Bluetooth_Low_Energy +[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[10]: https://www.bluetooth.com/blog/lighting-as-a-platform-part-1/ +[11]: https://www.bluetooth.com/bluetooth-resources/2019-bluetooth-market-update/?utm_campaign=bmu&utm_source=internal&utm_medium=pr&utm_content=2019bmu-pr-outreach-ink +[12]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html +[13]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[14]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html +[15]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html +[16]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html +[17]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html +[18]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html +[19]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html +[20]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[21]: https://www.facebook.com/NetworkWorld/ +[22]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190831 Why support open source- Strategies from around the world.md b/sources/talk/20190831 Why support open source- Strategies from around the world.md new file mode 100644 index 0000000000..9b142b5c9c --- /dev/null +++ b/sources/talk/20190831 Why support open source- Strategies from around the world.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why support open source? Strategies from around the world) +[#]: via: (https://opensource.com/article/19/8/open-source-large-series) +[#]: author: (Karl Fogel https://opensource.com/users/kfogelhttps://opensource.com/users/jamesvasile) + +Why support open source? Strategies from around the world +====== +A new series on open source strategy digs into using open source +investments to support the overall mission. +![World locations with red dots with a sun burst background][1] + +There are many excellent resources available to teach you how to run an open source project—how to set up the collaboration tools, how to get the community engaged, etc. But there is much less out there about open source _strategy_; that is, about how to use well-considered open source investments to support an overall mission. + +Thus, while "How can we integrate new contributors?" is a project management concern, the strategic question it grows from has wider implications: "What are the long-term returns we expect from engaging with others, who are those others, and how do we structure our investments to achieve those returns?" + +As we work with different clients, we've been gradually publishing reports that approach open source strategy from various directions. Two examples are our work with Mozilla on [open source archetypes][2] and with the World Bank on its [investment strategy for the GeoNode project][3]. + +Now we have a chance to have this discussion in a more regular and complete way: Microsoft has asked us to do a series of blog posts about open source, and the request was essentially _"help organizations get better at open source"_ (not a direct quote, but a reasonable summary). They were very clear about the series being independent; they did not want editorial control and specifically did not want to be involved in any pre-approval before we publish a post. It goes without saying, but we'll say it anyway, just so there's no doubt, that the views we express in the series may or may not be shared by Microsoft. + +We're calling the series [Open Source At Large][4], and it focuses on open source strategy. The first three posts in the series are already up: + + * [What is open source strategy?][5] + * [Open source goal setting][6] + * [Ecosystem mapping][7] + + + +Our clients will recognize some of the material—our advice tends to be consistent over time—but the series will also cover ideas we have not discussed widely before. + +Strategy is not just for executives and managers, by the way. We can most effectively support strategies we understand, and every person on a team can use strategic awareness to improve performance. Our target audience is the managers and organization leaders who make decisions about open source investments and also developers who can benefit from a strategic viewpoint. + +We hope that offering techniques for strategic analysis will be useful for newcomers to open source, and we also look forward to engaging colleagues in a wide-ranging discussion about best practices and considered approaches to strategy. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/open-source-large-series + +作者:[Karl Fogel][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/kfogelhttps://opensource.com/users/jamesvasile +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_remote_teams.png?itok=Wk1yBFv6 (World locations with red dots with a sun burst background) +[2]: https://blog.opentechstrategies.com/2018/05/field-guide-to-open-source-project-archetypes/ +[3]: https://blog.opentechstrategies.com/2017/06/geonode-report/ +[4]: https://blog.opentechstrategies.com/category/open-source-at-large/ +[5]: https://blog.opentechstrategies.com/2019/05/what-is-open-source-strategy/ +[6]: https://blog.opentechstrategies.com/2019/05/open-source-goal-setting/ +[7]: https://blog.opentechstrategies.com/2019/06/ecosystem-mapping/ diff --git a/sources/talk/20190902 Top take-aways from DevOps World 2019.md b/sources/talk/20190902 Top take-aways from DevOps World 2019.md new file mode 100644 index 0000000000..d85b944b56 --- /dev/null +++ b/sources/talk/20190902 Top take-aways from DevOps World 2019.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top take-aways from DevOps World 2019) +[#]: via: (https://opensource.com/article/19/9/devops-world-2019) +[#]: author: (Patrick Housley https://opensource.com/users/patrickhousley) + +Top take-aways from DevOps World 2019 +====== +Some of the biggest announcements from August's major DevOps event. +![Globe up in the clouds][1] + +In August, I had the opportunity to join more than 2,000 people gathered in San Francisco for DevOps World 2019. Following are some of the most newsworthy announcements from the 150 breakout sessions and 16 workshops held over the four-day event. + +### Standardizing CI/CD + +The greatest advantage and sometimes the most difficult challenge for our industry is the number of options we have for solving problems. Both are true for continuous integration and continuous development (CI/CD); it seems as though there's a new product or tool every week. This means we have amazing flexibility and control in how we implement CI/CD for our products and organizations. It also means we have a flood of opinions about how CI/CD _should_ be implemented. While there are some agreed-upon concepts (like shift-left), there is not much in the way of standards or best practices. That's not surprising. Continuously integrating features and bug fixes and continuously delivering those to a production environment for customer consumption are still fairly new. + +Our struggles have not gone unnoticed, and in March, the Linux Foundation announced the formation of the [Continuous Delivery Foundation][2]. The CD Foundation's goals are to provide a vendor-neutral home for many of the tools we rely on and to provide support to DevOps practitioners around learning and developing industry best practices. To do this, the CD Foundation is bringing together some of the most-used and fastest-growing open source projects with the companies and users using their solutions. The first projects to join the foundation include Jenkins, Jenkins X, Spinnaker, and Tekton, and its members include CapitalOne, CircleCI, CloudBees, Google, Huawei, Netflix, and many more. + +### Creating a BOK for CI/CD + +One of the most significant contributors to the success of agile and the [theory of constraints][3] is having a body of knowledge (BOK). A BOK is a collection of industry learnings that embody the principles of a professional domain. For example, the CD Foundation's focus will not be on standardizing the tools we use for CI/CD but on standardizing the collective knowledge about how to implement those tools and CI/CD in general. + +To that end, I want to give a special shout-out to the [DevOps Institute][4], a new member of the CD Foundation. Technology tools and practices can be complex, difficult to learn, and even harder to stay up-to-date on. The DevOps Institute is trying to tackle this by providing training and learning resources to help us stay skilled-up. Even better, it is launching an [Ambassador Program][5] to help spread its reach around the world. I encourage everyone to take a look and consider signing up. + +### Integrating DevOps metrics and reporting + +It's doubtful we will see any slowdown around the release of new CI/CD tools, and the CD Foundation's and DevOps Institute's valuable initiatives won't affect that. I am also sure we will continue to find innovative ways to move code from our developers' laptops to our production systems (hopefully with some quality checks in between). So, how can we follow the flow of that code from laptop to production? Can we follow new code from a twinkle in a customer's eye to when we release their idea (and see their jumps for joy when we do)? + +In today's DevOps, we use multiple tools to track our work. It usually starts with some type of issue tracker, like Jira or Trello. We work in a feature branch in our code repository and eventually merge to the trunk branch with a pull request. Along the way, our CI tools (like Jenkins) build, test, and scan our code to make sure we didn't fat-finger something, and eventually, our CD tooling deploys our code into pre-production and production environments. + +Even if all these tools are operating perfectly and our CI/CD implementation is the best in the world, we still have one piece missing: How can leadership, product owners, and developers take all the data these tools are generating and construct some knowledge from it? How can these individuals get a bird's-eye view of what features and bug fixes went out in the last 24 hours? How can they monitor the lead time for those changes? + +We can use something along the lines of an [ELK Stack][6] to centralize our data collection and create pretty dashboards. We could also use custom shell scripts to drive our CI/CD instead of Jenkins, but I wouldn't advocate for that. Not that there is anything wrong with ELK, but I'm not a big data engineer, and trying to find what ties the logs of two completely different tools together does not sound fun to me. + +There is a clear gap in tools that can do this off the shelf, and I hope we will see some new offerings in this area soon. + +### Learning with new book releases + +If like me, you like to learn through reading, following are some new books I picked up at DevOps World that you may want to acquire to further your DevOps knowledge. + + * [_Epic Failures in DevSecOps: Volume 1_][7] edited by Mark Miller + * [_Effective Feature Management_][8] by John Kodumal + * [_The Continuous Application Security Handbook_][9] by Contrast Security + * [_Engineering DevOps_][10] by Marc Hornbeek + * [_The Unicorn Project_][11] by Gene Kim + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/devops-world-2019 + +作者:[Patrick Housley][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/patrickhousley +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://cd.foundation/ +[3]: https://en.wikipedia.org/wiki/Theory_of_constraints +[4]: https://devopsinstitute.com/ +[5]: https://devopsinstitute.com/become-a-community-member/devops-institute-ambassador/ +[6]: https://www.elastic.co/what-is/elk-stack +[7]: https://www.amazon.com/Epic-Failures-DevSecOps-Mark-Miller/dp/1728806992 +[8]: https://launchdarkly.com/effective-feature-management-ebook/ +[9]: https://www.contrastsecurity.com/continuous-app-sec-cas +[10]: https://engineeringdevops.com/ +[11]: https://www.amazon.com/gp/product/1942788762 diff --git a/sources/talk/20190903 IoT security essentials- Physical, network, software.md b/sources/talk/20190903 IoT security essentials- Physical, network, software.md new file mode 100644 index 0000000000..8264591faf --- /dev/null +++ b/sources/talk/20190903 IoT security essentials- Physical, network, software.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT security essentials: Physical, network, software) +[#]: via: (https://www.networkworld.com/article/3435108/iot-security-essentials-physical-network-software.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +IoT security essentials: Physical, network, software +====== +Internet of things devices present unique security problems due to being spread out, exposed to physical attacks and often lacking processor power. +Thinkstock + +Even in the planning stages of a deployment, IoT security is one of the chief stumbling blocks to successful adoption of the technology. + +And while the problem is vastly complicated, there are three key angles to think about when laying out how IoT sensors will be deployed in any given setup: How secure are the device themselves, how many are there and can they receive security patches. + +### Physical access + +Physical access is an important but, generally, straightforward consideration for traditional IT security. Data centers can be carefully secured, and routers and switches are often located in places where they’re either difficult to fiddle with discreetly or difficult to access in the first place. + +Where IoT is concerned, however, best security practices aren’t as fleshed out. Some types of IoT implementation could be relatively simple to secure – a bad actor could find it comparatively difficult to tinker with a piece of complex diagnostic equipment in a well-secured hospital, or a big piece of sophisticated robotic manufacturing equipment on an access-controlled factory floor. Compromises can happen, certainly, but a bad actor trying to get into a secure area is still a well-understood security threat. + +By contrast, smart city equipment scattered across a metropolis – traffic cameras, smart parking meters, noise sensors and the like – is readily accessible by the general public, to say nothing of anybody able to look convincing in a hard hat and hazard vest. The same issue applies to soil sensors in rural areas and any other technology deployed to a sufficiently remote location. + +The solutions to this problem vary. Cases and enclosures could deter some attackers, but they might not be practical in some instances. The same goes for video surveillance of the devices, which could become a target itself. The IoT Security Foundation recommends disabling all ports on a device that aren’t strictly necessary for it perform its function, implementing tamper-proofing on circuit boards, and even embedding those circuits entirely in resin. + +### Discovery and networking + +Securing the connections between IoT sensors and the backend is arguably the toughest part to solve, in part because an alarming number of organizations aren’t even aware of all the devices on their network at any given time. Hence, device discovery remains a critically important part of network security for IoT. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][1] ]** + +The main reason for this lack of visibility is that the nature of IoT as an operational technology, rather than one that’s solely administered by IT staff, means that line-of-business personnel will sometimes connect helpful devices to the network without telling the people in charge of keeping the network secure. For network **operations** people, used to having a clear sense of the entire network’s topology, this can be an unaccustomed headache. + +Beyond IT personnel working closely with the operational side of the business to ensure all devices connected to the network are properly provisioned and monitored, network scanners can discover connected devices on a network automatically, whether that’s via network traffic analysis, device profiles, whitelists or other techniques. + +### Software patching + +Many IoT sensors don’t have a lot of built-in computing capability, so some of those devices aren’t able to run a security-software agent nor accept updates and patches remotely. + +That is a huge worry, because there are software vulnerabilities being discovered every day that target the IoT. An inability to patch those holes when they’re discovered is a serious problem. + +Moreover, certain devices simply won’t be able to be properly secured and made patchable. The only solution might be to find a different product that accomplishes the functional task yet has better security. + +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/3435108/iot-security-essentials-physical-network-software.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190903 Peanuts, paper towels, and other important considerations on community.md b/sources/talk/20190903 Peanuts, paper towels, and other important considerations on community.md new file mode 100644 index 0000000000..80b9bb89db --- /dev/null +++ b/sources/talk/20190903 Peanuts, paper towels, and other important considerations on community.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Peanuts, paper towels, and other important considerations on community) +[#]: via: (https://opensource.com/open-organization/19/9/peanuts-community-reciprocity) +[#]: author: (Jim Whitehurst https://opensource.com/users/jwhitehurst) + +Peanuts, paper towels, and other important considerations on community +====== +Red Hat president and CEO Jim Whitehurst explains that even the smallest +gestures can impact how an organization sees itself—and how it sustains +itself. +![People working together to build ][1] + +The most powerful aspects of an organization's culture live in the smallest individual gestures—sometimes no bigger than a peanut. + +Not long ago, as I was sitting in the Dallas airport waiting for a delayed flight, I watched another passenger munch on some peanuts. Their shells fell all over the floor and, after a few minutes, the passenger kicked them into the aisle, presumably for the airport cleaning staff to collect later. + +I hadn't given those peanuts shells much thought until a recent internal Red Hat event, when someone asked me about my pet peeves. I started thinking about the way I notice paper towels on the floors in Red Hat bathrooms. Whenever I see them, I pick them up and put them in the trash. + +I'll admit: it's a tiny gesture. But the longer I work at Red Hat, the more I realize just how great an impact those seemingly inconsequential moments can have on a community. + +I've always done my best to put others before myself (my mother was a nurse, and I think I inherited that attitude from her). But working at Red Hat has made me care even more about the importance of community. Community is critical not only [to our business][2] but also to how we operate as an open organization. + +In a well-functioning open organization, you'll often see people doing things simply because they benefit the organization itself—even if those actions don't immediately benefit the individual. People tend to prioritize the well-being of the group over the agendas of the few. + +At the same time, you'll also encounter people working to keep that spirit in place (I'm thinking of the Red Hatters who take pictures of vehicles occupying more than one parking space in our company lot and post them to the all-building mailing list). Maybe they're extra conscientious about ending their meetings on time, so others waiting for the room can get started right away. Maybe they refill the printer paper even if they haven't used the last sheet. Maybe they schedule an early-morning call so their colleagues overseas don't need to stay up late. Regardless, in an open organization, you'll hear "let me help with that" much more than you'll hear "that's not my responsibility." + +For these folks, a paper towel is more than a paper towel. It's a tangible representation of someone's investment in the organization. + +In a well-functioning open organization, you'll often see people doing things simply because they benefit the organization itself—even if those actions don't immediately benefit the individual. + +That sense of reciprocity at the heart of a community-focused organization—the idea that I might do something because it strengthens the critical social bonds that keep our group from falling apart—is important. We can't underestimate the power of that kind of social cohesion, not only in our organizations but in our societies more broadly. + +In fact, writer and historian Paul Collier attributes the United States' growth and success after World War II to it. "The escape from the Depression by means of the Second World War had been far more than an inadvertent stimulus package," he writes [in _The Future of Capitalism_][3]. "Its legacy was to turn each nation into a gigantic community, a society with a strong sense of shared identity, obligation and reciprocity." Collier goes on to assess the current state of that shared identity and sense of reciprocity in today's seemingly fragmented political landscape. + +He also explains how leadership practices also shifted during this time, especially in organizations: + +> Gradually, many organizations learned that it was more effective to soften hierarchy, creating interdependent roles that had a clear sense of purpose, and giving people the autonomy and responsibility to perform them. The change from hierarchy run through power, to interdependence run through purpose, implies a corresponding change in leadership. Instead of being the commander-in-chief, the leader became the communicator-in-chief. Carrots and sticks evolved into narratives. + +I love this passage, because it describes how my own thinking about leadership has changed since I joined Red Hat. Being a "communicator-in-chief" is now the most important job a leader can have. That means creating a sense of common purpose, shared values, and what Collier calls "mutual obligation" among people empowered with the [context and resources they need to do their best work][4]. + +We tell stories through actions, not just words. Open leaders should take opportunities to reinforce the kinds of communal, reciprocity-generating behaviors they want to see in other people. + +It's why I always pick up the paper towels. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/9/peanuts-community-reciprocity + +作者:[Jim Whitehurst][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/jwhitehurst +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_buildtogether.png?itok=9Tvz64K5 (People working together to build ) +[2]: https://www.redhat.com/en/about/development-model +[3]: https://www.harpercollins.com/9780062748652/the-future-of-capitalism/ +[4]: https://opensource.com/open-organization/16/3/what-it-means-be-open-source-leader diff --git a/sources/talk/20190904 A guide to human communication for sysadmins.md b/sources/talk/20190904 A guide to human communication for sysadmins.md new file mode 100644 index 0000000000..eaa25203c8 --- /dev/null +++ b/sources/talk/20190904 A guide to human communication for sysadmins.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to human communication for sysadmins) +[#]: via: (https://opensource.com/article/19/9/communication-sysadmins) +[#]: author: (Maxim Burgerhout https://opensource.com/users/wzzrdhttps://opensource.com/users/rikki-endsley) + +A guide to human communication for sysadmins +====== +The best way to increase your value to an organization is to get to know +the people around you. +![People work on a computer server with devices][1] + +Not too long ago, I spoke at a tech event in the Netherlands to an audience mostly made up of sysadmins. One of my topics was how sysadmins can increase the value they deliver to the organization they work for. I believe that among the most important factors for delivering value is for everyone to know the overall organization's priorities and goals, as well as the priorities and goals of the organization's development teams. + +This all sounds obvious, but in many organizations, silos almost completely block the inter-team communication needed to understand each other's priorities. Even in large organizations that pat themselves on the back for having gone full DevOps (or aspire to go full DevOps), knowledge of the priorities and goals of other teams is not ubiquitous. When I asked the couple hundred people in my audience whether they knew their development teams and what drives those teams, very few hands came up. + +You could argue that if you claim to have gone full DevOps, yet your people don't know the goals and priorities of the teams they work directly with, you are doing it wrong. And you would probably have a point. But put that aside for a moment. Even in a traditional organization—one that is only beginning its DevOps journey, has implemented some parts of the DevOps philosophy, or implemented DevOps only in certain parts of the organization (I have seen them all)—I would heartily recommend getting to know your co-workers. I would _especially_ recommend getting to know the ones outside your team that work with (or on) the platform that you build and maintain. + +Sit down for an hour or so with one of the people that develop applications on your platform or with someone who maintains commercial, off-the-shelf software on it. Have them explain to you how your platform and your services make their lives easier and how they make their lives harder. What could you and your team do to improve that situation? + +Talking to each other, learning from each other, debating problems _and_ solutions—especially with people whose immediate goals might initially differ from your own—helps everyone move forward together and build something that benefits an entire community. + +We see this happening in open source communities around the world all the time. Broad communities that are built from different companies and different people with (potentially) different or even conflicting goals, work. Successful open source communities are usually diverse, and members communicate to meet a broad range of goals, to find compromises, and to accommodate everyone. + +There is an obvious parallel between a broad open source community and working with "neighboring teams" in your organization to make your platform fit their interests and goals better. It's just a matter of taking that first step and starting a conversation with them. + +At this point, you may be asking, "But this is what I have my architects or service owners for, right?" Well, yeah, of course, they play a role in this. As do many others. And so do you! + +As an example, imagine your organization sets a target for your team to deliver a service within one week of the initial request. If the service is delivered within the week, the service-level agreements (SLAs) are met, and all is good, right? In reality, that is only sometimes true. + +Imagine your goal is to automatically (upon a self-service request) deliver a new virtual machine (VM) within a day and with a success rate of at least 95%. Now imagine a development team requests dozens of temporary VMs per day for CI/CD purposes, and 95% of them are delivered correctly. Your goal has been met, your SLA has been achieved—but no one is happy with the situation, because the CI/CD pipeline has broken on multiple occasions due to misconfigured VMs. + +**[More to read: [10 ways to have better conversations][2]]** + +In this example, the goals and SLAs need to be re-evaluated as soon as possible. But having a regular conversation with your developer teams or application maintainers, even in an organization that is pretty siloed, could make experiences like this much less common (and much easier to solve if they occur). Small annoyances and small problems would be unearthed at an early stage; small improvements would be suggested, and small improvements would be made _before_ large deployments of shadow IT happen. + +At the end of the day, nothing beats human-to-human communication. Nothing breaks barriers like knowing which face goes with which name. Nothing makes it easier to talk to people than knowing they want to support you in being successful! So, go and talk to your neighboring teams. Have coffee with them. Go build a broad community in your organization! + +P.S. Odds are your developer teams will talk to you about cloud and continuous integration and delivery. Those are topics for a potential future follow-up to this article. Stay tuned! + +It takes developers, sales, marketing, and product people to take this open source thing and turn... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/communication-sysadmins + +作者:[Maxim Burgerhout][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/wzzrdhttps://opensource.com/users/rikki-endsley +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://enterprisersproject.com/article/2019/7/leadership-10-tips-better-conversations diff --git a/sources/talk/20190904 Geeks in Cyberspace- A documentary about Linux nerds and the web that was.md b/sources/talk/20190904 Geeks in Cyberspace- A documentary about Linux nerds and the web that was.md new file mode 100644 index 0000000000..df6726fb56 --- /dev/null +++ b/sources/talk/20190904 Geeks in Cyberspace- A documentary about Linux nerds and the web that was.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Geeks in Cyberspace: A documentary about Linux nerds and the web that was) +[#]: via: (https://opensource.com/article/19/9/geeks-cyberspace) +[#]: author: (Michael Stevenson https://opensource.com/users/mstevenson) + +Geeks in Cyberspace: A documentary about Linux nerds and the web that was +====== +Film explores how a group of friends helped usher in our present age of +social media, inventing now-familiar conventions that we use every day. +![An old-fashioned video camera][1] + +"We invented blogging, we invented podcasting, we invented the LIKE button…" + +Rob Malda is only half-joking when he makes these claims in the closing minutes of my new documentary, _Geeks in Cyberspace_. Together with his friends Jeff Bates, Nate Oostendorp, and Kurt Demaagd, Malda helped usher in our present age of social media, inventing now-familiar conventions that we use every day on Reddit, Wikipedia, Facebook, and elsewhere. + +### Slashdot's success + +Malda created [Slashdot.org][2] more than 20 years ago, in 1997, and his friends helped him turn his proto-blog into an engine of participation. The site was powered by an incredibly rich suite of Linux, Apache, MySQL, and clever Perl hacks, as well as a community of readers who would submit stories, comment on them, then moderate those comments to bring the best bits to the top. _Wired_ called this "open-source journalism" in 1999, and the site would directly influence the creation of Digg and later Reddit. + +Slashdot's massive influence in the open source community coincided with what could be termed the open source bubble of the late 1990s, when Linux companies set records on Wall Street, and Microsoft recognized it had a real competitor in projects that were giving their source code away for free. Malda and his friends profited from the speculative craze, albeit modestly in comparison to later social media entrepreneurs. They sold Slashdot to Andover.net in the summer of 1999 for several million dollars in cash and stock options. + +### Everything2 and PerlMonks + +With some of the profits from Slashdot's sale, the friends looked to reproduce their success with [Everything2][3] (E2), another community website. E2 evolved out of a side project that Oostendorp built in 1998, one that in some ways was even more creative than Slashdot. Called "Everything," the project was to be a user-contributed information database that covered, well, everything—from _The Simpsons_ and beer brands to historical events and computer companies. Sound familiar? Conceived several years before Wikipedia launched, Everything was different from the collaborative encyclopedia we all use today. Rather than a "neutral point of view," it promoted something like "multiple points of view," and it had what could be considered an early ancestor of the ubiquitous "Like" button (as well as a counterpart "I don't like this" button). + +E2 launched in 1999 and took on a life of its own. Although its audience was small in comparison to Slashdot, the site's community was tight-knit and dedicated. The E2 community’s story is central to the documentary; it is striking because it reminds us that even in the footnotes of internet history, there are fascinating human stories that are worth recounting. + +Technologically, Everything2 was notable for being the first site run on The Everything Engine, software that would now be called a content management system or even an early web framework. As fellow geek chromatic [wrote][4], the Everything Engine was ahead of its time in many ways, if not as robust as the technologies it foreshadowed. The engine was also used to create [PerlMonks][5], the question-and-answer programming site that prefigured Stack Overflow and others. + +### Looking back, looking forward + +When I look at the history of Slashdot, E2, and PerlMonks, I don't simply see predecessors to today's social media landscape. For one thing, there were many other initiatives that shaped what was to come. More importantly, the value of such history is found in its specificity and how it can help us ask new questions about contemporary social media and imagine future platforms that will eventually challenge today's major players. + +With that in mind, I draw two key lessons from the work that Malda and company did at the turn of the century. + +First, they showed that getting these things off the ground requires not just a mix of hard work and luck but also an inspired mode of production. Chromatic rightly described the joy and sense of purpose they felt in terms of "momentum" and "a movement." A similar mix of joy and purpose can be found in waves across the cultural spectrum: think, for example, of the emerging scene of [chiptunes][6] artists, whose music I drew on heavily for this documentary, or a (hypothetical) group of journalists who seek to retake the news industry from commercial and political interests. Money certainly matters, as does circumstance. But time and again, for culture to renew itself, inspiration is key. + +Second, in the case of social media, an inspired outlook must translate to its community of users in tangible ways. For Slashdot, and even more so for E2 and PerlMonks, community members felt connected to _their_ site's purpose and had a real say in determining daily operations and overall direction. + +When real ownership is given, and a community works together to manage complex tasks of maintenance and government, social media becomes much more than a communications infrastructure. As E2 user and documentary subject Dana McNabb wrote many years ago about E2: "Everything is people. I married a noder, some of my best friends are noders, I continue to make new noding friends. Don't tell me this website is just a website." + +Although it is hard to imagine something similar ever being said about a platform the size of Facebook or Instagram, I believe such lessons can nonetheless figure into improving our current social media or in our attempts to provide alternatives. + +### Acknowledgments + +"Geeks in Cyberspace" and this article came out of my research project "The web that was," which also includes [this open access article][7]. The project is funded by the Dutch Research Council, project number 275-45-006. Most of all, thanks are due to Rob Malda, Nate Oostendorp, Kurt Demaagd, Jeff Bates, Tim Vroom, Ryan Postma, chromatic, Dana McNabb, and Cliff Lampe for generously giving their time for this project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/geeks-cyberspace + +作者:[Michael Stevenson][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/mstevenson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera) +[2]: https://slashdot.org/ +[3]: https://www.everything2.com/ +[4]: https://www.perl.com/pub/2010/08/rethinking-perl-web.html +[5]: https://www.perlmonks.org/ +[6]: https://en.wikipedia.org/wiki/Chiptune +[7]: https://www.tandfonline.com/doi/full/10.1080/24701475.2018.1495810 diff --git a/sources/talk/20190905 10 pitfalls to avoid when implementing DevOps.md b/sources/talk/20190905 10 pitfalls to avoid when implementing DevOps.md new file mode 100644 index 0000000000..2d66534959 --- /dev/null +++ b/sources/talk/20190905 10 pitfalls to avoid when implementing DevOps.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 pitfalls to avoid when implementing DevOps) +[#]: via: (https://opensource.com/article/19/9/pitfalls-avoid-devops) +[#]: author: (Mehul Rajput https://opensource.com/users/mehulrajputhttps://opensource.com/users/daniel-ohhttps://opensource.com/users/genekimhttps://opensource.com/users/ghaff) + +10 pitfalls to avoid when implementing DevOps +====== +Make your DevOps implementation journey smoother by avoiding the +mistakes others have made. +![old postcard highway ][1] + +In companies of every size, software is increasingly providing business value because of a shift in how technology teams define success. More than ever, they are defined by how the applications they build bring value to their customers. Tickets and stability at the cost of saying no are no longer the key value of IT. It's now about increasing developer velocity by partnering with the business. + +In order to keep up with this faster pace, leading technology professionals are building software with precision and embracing standards of continuous delivery, integration, and DevOps. According to [Shanhong Liu][2], "As of 2018, only nine percent of technology professionals responsible for the development and quality of web and mobile applications stated that they had not adopted DevOps and had no plans to do so." + +A significant value in a [DevOps culture][3] is to accept failure as a part of the journey toward value. For software, the journey comes in the form of [continuous delivery][4] with the expectation that we regularly release code. The fast pace ensures failure, but it also ensures that when you do fail, you learn from your mistakes and adapt quickly. This is how you grow as a business: you get more insights and let them guide you toward success. + +Since those who have already adopted DevOps have made mistakes, you can use their experience to learn and avoid repeating the same mistakes. In the spirit of DevOps and open source—rapid iteration, building upon the work (and mistakes) of those who have gone before—following are some of the most common mistakes businesses encounter on their DevOps journey and how to work through them. + +### 1\. Out-of-order delivery + +Sometimes, developers will perform continuous delivery (CD) and continuous integration (CI) simultaneously to accelerate automated testing and feedback cycles. CI/CD as a practice has a lot of benefits when it comes to the pace of software delivery. The risk is that incorrect code configurations may be delivered to production environments without enough exploration on their impact, negating the value of automated testing before expansion. + +I believe manual confirmation is still essential before code goes all the way through the software delivery cycle. There must be a pre-production stage—a layer of deployment and testing before production—that allows developers to correct and rectify errors that users could face if the code were pushed directly to production. + +![Software delivery cycle][5] + +It is extremely important to put monitoring in place before code reaches the end user. For instance, structuring the CD pipelines so testing is done alongside development will ensure that changes are not deployed automatically. + +While DevOps standards declare that teams must expand beyond silos, deployment should always be validated by those familiar with the code that comes out at the end of the pipeline. This mandates a thorough examination before code reaches customers. + +### 2\. Misunderstanding the DevOps title + +Some organizations are bewildered about the DevOps title. They believe a DevOps engineer's object is to solve all problems associated with DevOps—even when DevOps means collaboration across Developers and Operators. + +The way DevOps integrates development and operations roles can be a difficult career progression. Developers require more understanding of how their application runs in order to keep it running and potentially be on call for support if it goes down. Operations must become an expert on how to scale and understand the metrics that fit inside a larger [monitoring and observability strategy][6]. + +DevOps, in practice, helps companies accelerate time-consuming tasks in IT operations. For example, automating testing provides developers with faster feedback, and automating integration incorporates developers' changes more quickly into the codebase. DevOps may also be asked to automate procedures around collecting, expanding, and running apps. + +Your organization's fundamental needs dictate whether your DevOps professionals' skill sets need to be stronger in operations or development, and this information must align with how you select or hire your DevOps team. For instance, it is important to prioritize past software development and scripting skills when automation is key (instead of requiring expertise around containerization). Hire for your unique DevOps experience needs, and let people learn the other skills on the job. If you hire people who are ready to learn, you will build the best possible team for your organization. + +### 3\. Inflexibility around DevOps procedures + +While DevOps principles provide a foundation, each organization must be ready to customize their journey for their desired outcomes. Companies need to make sure that, while the core DevOps pillars stay steady during implementation, they create internal modifications that are essential in measuring their predicted results. + +It is important to master the fundamentals of DevOps, especially the [CALMS][7] (Culture, Automation, Lean, Measurement, and Sharing) pillars, to build a foundation for technology advancement. But there is no one-size-fits-all DevOps implementation. By recognizing that, the DevOps team can build a plan to address the key reason for the initiative and build from past failed results. Teams should be ready to modify their plan while staying within the recommendations of the fundamental DevOps principles. + +### 4\. Selecting speed over quality + +Many companies concentrate on product delivery without paying enough attention to product quality. If the effort's key performance indicators (KPIs) center only on time to production, it is easy for quality to fall off in the process. Endpoints that could monitor performance are left for future versions, and software that is not production-ready is seen as a success because it was pushed rapidly forward. + +In a fast-paced market, teams can't afford to provide the best product quality with the time requirements dictated by either the customer or internal demand. Many companies are hurrying to get and finish as many DevOps projects as possible within a shorter time span to keep their position in a competitive market. That may sound like a good idea, but expecting DevOps to be a quick journey may result in more pain than gain. + +Achieving both speed and quality improvement is an essential DevOps value. It is not achieved easily and requires operators and developers to write testing in new and improved ways. When done well, quality and speed improve simultaneously. + +### 5\. Building a dedicated DevOps team + +Theoretically, it makes sense to build a dedicated team to concentrate on training the newest professionals in IT. The movement to complete a DevOps journey must be hassle-free and seamless, right? But two issues quickly arise: + + * Existing quality assurance (QA), operations, and development team members feel overlooked and may try to hinder the new team's efforts. + * This new team becomes another silo, providing new technology but not advancing the company's goals on a DevOps journey. + + + +It is better to have a mix of new team members and current employees from QA, ops, and dev who are excited to join the DevOps initiative. The latter group has a lot of institutional knowledge that is valuable as you roll out such a large initiative. + +### 6\. Overlooking databases + +The database is one of the most essential technology areas overlooked while building out DevOps. New, ephemeral applications can fly through a DevOps pipeline at a speed unlike any application before. But data-hungry applications don't see the same ease of deployment. + +Data snapshots in separate environments can and will drift toward inaccuracy without a concentrated effort to automate them effectively. Experts stress constant integration and code handling but fail in automating the database. Database management should be done properly, particularly for data-centric apps. The database plays an important role in such apps and may require separate expertise to automate it alongside other applications. + +### 7\. Insufficient incident-handling procedures + +In case something goes wrong (and it will), DevOps teams should have incident-handling procedures in place. Incident handling should be a continuous and active procedure clearly outlined for consistency and to avoid error. This means that in order for an incident-handling process to be documented, you must capture and describe the incident-response requirements. There is a lot of research into runbook documentation and [blameless post-mortems][8] that is important to learn to be successful. + +### 8\. Insufficient knowledge of DevOps + +Although acceptance of DevOps has expanded rapidly in recent years, application experts may be working without precise quality-control procedures. The team's ability to do all the technical, cultural, and process changes needed to succeed in DevOps sometimes falls short. + +It's a wise move to adopt DevOps practices, but success requires ample experience and preparation. In some cases, getting the right expertise to meet your requirements means hiring outside experts (disclaimer: I manage a DevOps consultancy). These trained experts should have certifications in the required technologies, and companies should abstain from making rapid DevOps decisions without having a good handle on outcomes. + +### 9\. Neglecting security + +Security and DevOps should move side-by-side. Many organizations dismiss security guidelines because it's hard, and a DevOps journey can be hard enough. This leads to issues, such as initially maximizing the output of developers and later realizing that they neglected to secure those applications. Take security seriously, and look into [DevSecOps][9] to see if it makes sense to your organization. + +### 10\. Getting fatigued while implementing DevOps + +If you start a DevOps team with the goal to go from one product deployment a year to 10 pushes in a week, it will likely fail. The path to get to an arbitrary metric that looks good in a presentation will not motivate the team. DevOps is not a simple technology movement; it's a huge cultural upgrade. + +The larger the enterprise, the longer it may take to get DevOps practices to stick. You should apply your DevOps methodology in a phased and measured approach with realistic results as milestones to celebrate. Train your employees, and schedule ample breaks before starting the initial round of application deployments. The first DevOps pipeline can be slow to achieve. That's what continuous improvement looks like in real life. + +### The bottom line + +Companies are rapidly moving towards DevOps to keep pace with their competition but make common mistakes in their implementations. To avoid these pitfalls, plan precisely and apply the right strategies to achieve a more successful DevOps outcome. + +Just as with any transformational and disruptive movement, DevOps can be misunderstood or... + +Is DevOps fundamentally about changing culture in an IT organization? That seemingly simple... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/pitfalls-avoid-devops + +作者:[Mehul Rajput][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/mehulrajputhttps://opensource.com/users/daniel-ohhttps://opensource.com/users/genekimhttps://opensource.com/users/ghaff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/road2.jpeg?itok=chTVOSil (old postcard highway ) +[2]: https://www.statista.com/statistics/673505/worldwide-software-development-survey-devops-adoption/ +[3]: https://www.linkedin.com/pulse/10-facts-stats-every-devops-enthusiast-must-know-pavan-belagatti-/ +[4]: https://opensource.com/article/19/4/devops-pipeline +[5]: https://opensource.com/sites/default/files/uploads/devopsmistakes_pipeline.png (Software delivery cycle) +[6]: https://opensource.com/article/18/8/now-available-open-source-guide-devops-monitoring-tools +[7]: https://whatis.techtarget.com/definition/CALMS +[8]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective +[9]: https://opensource.com/article/19/1/what-devsecops diff --git a/sources/talk/20190905 6 years of tech evolution, revolution and radical change.md b/sources/talk/20190905 6 years of tech evolution, revolution and radical change.md new file mode 100644 index 0000000000..f08cb34071 --- /dev/null +++ b/sources/talk/20190905 6 years of tech evolution, revolution and radical change.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 years of tech evolution, revolution and radical change) +[#]: via: (https://www.networkworld.com/article/3435857/6-years-of-tech-evolution-revolution-and-radical-change.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +6 years of tech evolution, revolution and radical change +====== +In his farewell TechWatch post, Fredric Paul looks back at how technology has changed in the six years he’s been writing for Network World—and what to expect over the next six years. +Peshkov / Getty Images + +Exactly six years ago today—Sept. 5, 2013—Network World published my very first [TechWatch][1] blog post. It addressed the introduction of [Samsung's Galaxy Gear and the problem with smartwatches][2]. + +Since then, I’ve written hundreds of blog posts on a dizzying array of technology topics, ranging from [net neutrality][3] to phablets to cloud computing to big data to the internet of things (IoT)—and many, many more. It’s been a great ride, and I will be forever grateful to my amazing editors at Network World and everyone who’s taken the time to read my work. But all good things must come to an end, and this will be my last TechWatch post for Network World. + +You see, writing for Network World is not my day job. For the last five and a half years, I have been editor in chief of [New Relic][4], a leader in the enterprise observability space. But this week, I’ve taken a new position at director of content for [Redis Labs][5], the home of the fast Redis database. I’m super excited about the opportunity, but here’s the thing: Redis Labs has a number of products in the IoT space, which could raise thorny conflict-of-interest questions for many blog posts I might write. + +**[ Find out how [5G wireless could change networking as we know it][6] and [how to deal with networking IoT][7]. | Get regularly scheduled insights by [signing up for Network World newsletters][8]. ]** + +### Looking back: What technology has changed and what hasn’t + +So, for this good-bye post, I want to look back at some of the topics I’ve touched on over the years—and especially that first year—and see how far we’ve come, and maybe get a sense of what’s coming next. + +Obviously, there’s no time or space to revisit everything. But I do want to touch on six key themes. + +#### **1\. Wearable tech** + +Back when I wrote that first post on [Samsung's Galaxy Gear][2], it seemed like wearable technology was about to change everything. Smartwatches and fitness trackers were being introduced by everyone from tech companies to sporting goods manufacturers to fashion brands and [luxury watch companies][9]. The [epic failure of Google Glass][10] hadn’t yet set the category back a decade by permanently creeping out folks around the world. + +Today, things look very different. [The Apple Watch is thriving in a limited role][11] as a fitness and health tracking device, trailed by a variety of simpler, cheaper options. [Google Glass and its ilk are niche products looking for industrial applications.][12] And my grand vision of wearable tech fundamentally reshaping the technology landscape? Yeah, we’re still waiting for that. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][13] ]** + +#### 2\. Phones & phablets & tablets + +Six years ago, I had a lot of phun making puns about the rise of “phablets,” those giant phones (or miniature tablets) threatening to take over the mobile world. Well, that happened. In fact, it happened so thoroughly that no one even talks about increasingly ginormous phones as phablets anymore. They’re just… phones. + +**[ Also on Network World: [Phablets are the phuture, no phoolin'][14] ]** + +#### 3\. BYOD and shadow IT + +Back in 2013, shadow IT was still mostly thought of as [Bring Your Own Device][15], but increasingly powerful online services have expanded the concept far beyond enterprise workers using their own phones on the corporate network. Now, shadow IT includes everything from computing power and storage in the cloud to virtually Everything-as-a-Service. And with the rise of Shadow IoT, the situation is only getting more complicated for IT teams. How do you maintain order and security while also empowering users with maximum productivity? + +**[ Also on Network World: [Don’t worry about shadow IT. Shadow IoT is much worse.][16] ]** + +#### 4\. Net neutrality + +Hoo-boy. After endless arguments rooted in deeply differing versions of what freedom really means, ideological conflicts, all-out business battles between communications companies and online services, net neutrality was finally settled as official U.S. policy. And then, suddenly, [all that was changed by a new administration and a new FCC leader][17]. At least for now. Probably. Ahhh, who are we kidding? We’re going to be arguing over net neutrality forever. + +**[ Also on Network World: [Why even ISPs will regret the end of net neutrality][18] ]** + +#### 5\. The cloud + +When I started writing TechWatch, the cloud was still a good idea looking to find its rightful place in a world still dominated by private data centers. Today, everything has flipped. [The cloud is now pretty much the default for new IT infrastructure workloads][19], and it is slowly but surely chipping away at all those legacy, mission-critical apps and systems. Sure, key questions around cost, security, compliance and reliability remain, but as 2019 begins to wind down, the cloud’s promise of radical improvements in development speed and agility can no longer be questioned. As [cloud providers keep growing like weeds on steroids][19], modern IT leaders increasingly have to justify _not_doing things in the cloud. + +**[ Also on Network World: [The week cloud computing took over the world][20] ]** + +#### 6\. The internet of things + +TechWatch has been interested in the IoT for a while now (see [How the Internet of Things will – and won't – change IT][21]), but for the last couple years it has been the dominant topic for TechWatch. Over that time, the IoT has evolved from a concept with tremendous promise but limited real-world applications to one of the most important technologies on the planet, on pace to disrupt everything from brushing your teeth to driving (or not driving) your car to [maintaining jet airplanes][22]. It’s been a wild ride, but serious barriers remain. IoT security concerns, especially on the consumer side, still threaten IoT adoption. Lack of interoperability and unclear ROI continue to slow IoT installations. + +But those are just speed bumps. Like it or not, the IoT is going to keep growing. And that growth won’t always come in nicely defined, easily understood and controlled ways. In many cases, IoT devices and networks are being deployed without established goals, metrics, controls, and contingency plans. It may be a recipe for trouble, but it’s also how just about every important technology rolls out. [The winners will be the organizations that figure out how to maximize the IoT’s value while avoiding its pitfalls.][23] I will be watching closely to see what happens! + +Join the Network World communities on [Facebook][24] and [LinkedIn][25] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3435857/6-years-of-tech-evolution-revolution-and-radical-change.html + +作者:[Fredric 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://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/blog/techwatch/ +[2]: https://www.networkworld.com/article/2225307/samsung-s-galaxy-gear-and-the-problem-with-smartwatches.html +[3]: https://www.networkworld.com/article/3238016/will-the-end-of-net-neutrality-crush-the-internet-of-things.html +[4]: https://newrelic.com/ +[5]: https://redislabs.com/ +[6]: https://www.networkworld.com/cms/article/https:/www.networkworld.com/article/3203489/lan-wan/what-is-5g-wireless-networking-benefits-standards-availability-versus-lte.html +[7]: https://www.networkworld.com/cms/article/https:/www.networkworld.com/article/3258993/internet-of-things/how-to-deal-with-networking-iot-devices.html +[8]: https://www.networkworld.com/newsletters/signup.html +[9]: https://www.networkworld.com/article/2882057/would-you-buy-a-smartwatch-from-a-watch-company.html +[10]: https://www.networkworld.com/article/2364501/how-google-glass-set-wearable-computing-back-10-years.html +[11]: https://www.networkworld.com/article/3305812/the-new-apple-watch-4-represents-an-epic-fail-for-smartwatches.html +[12]: https://www.networkworld.com/article/2955708/google-glass-returning-enterprise-business-users.html +[13]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[14]: https://www.networkworld.com/article/2225569/phablets-are-the-phuture--no-phoolin-.html +[15]: https://www.networkworld.com/article/2225741/5-disturbing-byod-lessons-from-the-faa-s-in-flight-electronics-announcement.html +[16]: https://www.networkworld.com/article/3433496/dont-worry-about-shadow-it-shadow-iot-is-much-worse.html +[17]: https://www.networkworld.com/article/3166611/the-end-of-net-neutrality-is-nighheres-whats-likely-to-happen.html +[18]: https://www.networkworld.com/article/2226155/why-even-isps-will-regret-the-end-of-net-neutrality.html +[19]: https://www.networkworld.com/article/3391465/another-strong-cloud-computing-quarter-puts-pressure-on-data-centers.html +[20]: https://www.networkworld.com/article/2914880/the-week-cloud-computing-took-over-the-world-microsoft-amazon.html +[21]: https://www.networkworld.com/article/2454225/how-the-internet-of-things-will-and-wont-change-it.html +[22]: https://www.networkworld.com/article/3340132/why-predictive-maintenance-hasn-t-taken-off-as-expected.html +[23]: https://www.networkworld.com/article/3211438/is-iot-really-driving-enterprise-digital-transformation.html +[24]: https://www.facebook.com/NetworkWorld/ +[25]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190905 Data center cooling- Electricity-free system sends excess building heat into space.md b/sources/talk/20190905 Data center cooling- Electricity-free system sends excess building heat into space.md new file mode 100644 index 0000000000..e87065de21 --- /dev/null +++ b/sources/talk/20190905 Data center cooling- Electricity-free system sends excess building heat into space.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data center cooling: Electricity-free system sends excess building heat into space) +[#]: via: (https://www.networkworld.com/article/3435769/data-center-cooling-electricity-free-system-sends-excess-building-heat-into-space.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Data center cooling: Electricity-free system sends excess building heat into space +====== +A polymer and aluminum film solar shelter that transmits heat into space without using electricity could drastically cut data center cooling costs. +University at Buffalo + +We all know that blocking incoming sunlight helps cool buildings and that indoor thermal conditions can be improved with the added shade. More recently, though, scientists have been experimenting with ways to augment that passive cooling by capturing any superfluous, unwanted solar heat and expelling it, preferably into outer space, where it can’t add to global warming. + +Difficulties in getting that kind of radiative cooling to work are two-fold. First, directing the heat optimally is hard. + +“Normally, thermal emissions travel in all directions,” says Qiaoqiang Gan, an associate professor of electrical engineering at University at Buffalo, in a [news release][1]. The school is working on radiative concepts. That’s bad for heat spill-over and can send the thermal energy where it’s not wanted—like into other buildings. + +**[ Learn [how server disaggregation can boost data center efficiency][2] and [how Windows Server 2019 embraces hyperconverged data centers][3] . | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** + +But the school says it has recently figured out how to “beam the emissions in a narrow direction.” + +Second, radiative cooling is a night-time effect. It can be best described in the analogy of a blacktop road surface, which absorbs the sun’s rays during the day and emits that captured heat overnight as the surrounding air cools. + +But University at Buffalo's system works during the day, the researchers say. It is made up of building-installed rooftop boxes that have a polymer combination aluminum film affixed to the bottom (pictured above). The film stops the area around the roof from getting hot through a form of heat absorption. The polymer absorbs warmth from the air in the box and transmits “that energy through the Earth’s atmosphere into outer space.” The box, when installed en massse, potentially shelters the entire roof from sunlight “while also beaming thermal radiation emitted from the film into the sky.” The polymer itself stays cool. + +That directionality also solves the problem of how to get the application to function within a city—the heat is beamed straight up in this case, rather than being allowed to disperse side to side and potentially infiltrate neighboring buildings. + +University at Buffalo’s box is about 18 inches by 10 inches. Multiple boxes would be affixed to cover a rooftop, augmenting the air conditioning. + +### Stanford University also has a cooling system + +I’ve written before about passive, radiative cooling systems that could be used in data center environments. A few years ago, [Stanford University suggested using the sky as one giant heatsink][5]. It reckons cost savings for cooling could be in the order of 21%. That system used mirror-like panels and, like the University at Buffalo solution, tries to solve the second major problem involved with radiative heating: How to get it to work during the day when the sun is beating down on the surfaces and the ambient air is warm—you need cool air to absorb the hot air. + +Stanford’s solution is to reflect the sunlight away from the panels during the day so the stored heat can radiate, even during the day. Researchers at University at Buffalo, however, say their approach, which uses special materials, is better. + +“Daytime cooling is a challenge because the sun is shining. In this situation, you need to find strategies to prevent rooftops from heating up. You also need to find emissive materials that don’t absorb solar energy. Our system address these challenges,” says Haomin Song, Ph.D., UB assistant professor of research in electrical engineering, in the news release. + +University at Buffalo’s directional aspect is interesting, too. + +“If you look at the headlight of your car, it has a certain structure that allows it to direct the light in a certain direction,” Gan says. “We follow this kind of a design. The structure of our beam-shaping system increases our access to the sky.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3435769/data-center-cooling-electricity-free-system-sends-excess-building-heat-into-space.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://www.buffalo.edu/news/releases/2019/08/003.html +[2]: https://www.networkworld.com/article/3266624/how-server-disaggregation-could-make-cloud-datacenters-more-efficient.html +[3]: https://www.networkworld.com/article/3263718/software/windows-server-2019-embraces-hybrid-cloud-hyperconverged-data-centers-linux.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3222850/space-radiated-cooling-cuts-power-use-21.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190906 How to open source your academic work in 7 steps.md b/sources/talk/20190906 How to open source your academic work in 7 steps.md new file mode 100644 index 0000000000..a233d8131d --- /dev/null +++ b/sources/talk/20190906 How to open source your academic work in 7 steps.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to open source your academic work in 7 steps) +[#]: via: (https://opensource.com/article/19/9/how-open-source-academic-work) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearcehttps://opensource.com/users/ianwellerhttps://opensource.com/users/edunham) + +How to open source your academic work in 7 steps +====== +Open source technology and academia are the perfect match. Find out how +to meet tenure requirements while benefiting the whole community. +![Document sending][1] + +Academic work fits nicely into the open source ethos: The higher the value of what you give away, the greater your academic prestige and earnings. Professors accomplish this by sharing their best ideas for free in journal articles in peer-reviewed literature. This is our currency, without a strong publishing record not only would our ability to progress in our careers degrade, but even our jobs could be lost (and the ability to get any other job). + +This situation makes attribution or credit for developing new ideas and technologies critical to an academic, and it must be done in the peer-reviewed literature. Many young academics struggle with how to pull this off while working with an open source community and keeping their academic publishing record strong. There does not need to be a conflict. In fact, by fully embracing open source, there are distinct advantages (e.g., it is hard to get scooped by unethical reviewers when you have a time- and date-stamped open access preprint published for all the world to see). + +The following seven steps provide the best practices for making an academic’s work open source. Start by using best practices (e.g., [General Design Procedure for Free and Open-Source Hardware for Scientific Equipment][2]), then when your work is ready to share, do the first three steps simultaneously. + +**Note:** Academics should not be concerned about working in open source at all at this point, as open source is now mainstream academia in software and has even been [embraced by the hardware community][3]. + +### Step 1: Select a relevant peer-reviewed journal + +Your work should first be published as a technology paper in a peer-reviewed journal with a good reputation (e.g., by [Impact Factor][4] or [CiteScore][5], which is a measure reflecting the yearly average number of citations to recent articles published in that journal). If yours is a hardware project, then choose journals such as: + + * _[HardwareX][6]_ (CiteScore: 4.42) + * _[Sensors][7]_ (CiteScore: 3.72) + * _[PLOS ONE][8]_ (CiteScore: 3.02) + * _[The Journal of Open Hardware][9]_ (new) + + + +You could also choose a discipline-specific journal that publishes hardware. + +Or, if your project is software, then the following journals may be of interest: + + * _[SoftwareX][10]_ (CiteScore: 11.56) + * _[The Journal of Open Source Software][11]_ (new) + * _[The Journal of Open Research Software][12]_ (new) + + + +### Step 2: Post your source code + +When submitting your work to a peer-reviewed journal, you will need to post your source code and cite it in your paper. For software papers, you would post your actual code, but for hardware papers, you would post aspects like the bill of materials, CAD designs, build instructions, etc. + +Use common websites for sharing code like [GitLab][13], or websites meant specifically for academia like the [Open Science Framework][14]. + +### Step 3: Publish an open access pre-print + +When your paper is complete and you submit it to the journal, publish an open-access preprint as well. Doing so protects you against others scooping or patenting your ideas, while at the same time opening all of your work including the paper itself. + +Almost all major publishers allow preprints. There are a lot of pre-print servers for every discipline (e.g., [arXiv][15], [preprints.org][16]). + +### Step 4: Start (or select) a company + +The next step is not strictlly mandatory, but it is useful to either commercialize your work or provide support for your open source software. Start a spin-off company (or have a student do it), or work with an existing open source company. This step is recommended because although some people will fabricate your device from open source plans or compile your code, the vast majority would rather buy a reasonably priced version that is both open source so they control it, but also assembled or compiled, ready to use, and supported. + +### Step 5: Certify your project + +As soon as the paper is accepted, send it in for certification. See: [The trials of certifying open source software][17], or the perhaps more straightforward [OSHWA open hardware certification][18], for more information. You could do this step earlier, but publishing outside of a preprint server runs risks of being auto-rejected due to the plagiarism checks run by some journals. + +### Step 6: Prepare a press release + +As soon as certification comes through, organize a press release between the company and the university—and embargo it to the date of the academic paper’s official publication. This action spreads information about your open source technology and its benefits as far as possible. + +### Step 7: Use your own technology + +Last, but not least—use your open source technology in future research. From here on out, an academic can publish normally (e.g., do a scientific study using the open hardware and publish in a discipline-specific journal). Of course, preference should be given to [open access journals][19]. + +### Step up + +These seven steps are reasonably straightforward for new open source technology projects. When it comes to academics working on _existing_ open source projects, it’s a bit different. They need to carve out an area such as an upgrade to existing open hardware, or a new feature for free and open source software (FOSS), that they can publish on independently. They can then follow the same steps as above while integrating their work back into the community’s code (e.g., back in Step 2). + +Following these steps enables academics to more than meet the academic requirements they need for tenure and promotion while developing open source technology for everyone’s benefit. + +A few months ago, opensource.com ran a story on a textbook for college students learning... + +When academia and open source collaborate, everybody wins. Open source projects get new... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/how-open-source-academic-work + +作者:[Joshua Pearce][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/jmpearcehttps://opensource.com/users/ianwellerhttps://opensource.com/users/edunham +[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]: http://www.mdpi.com/2411-9660/2/1/2/htm +[3]: https://opensource.com/article/18/4/mainstream-academia-embraces-open-source-hardware +[4]: https://en.wikipedia.org/wiki/Impact_factor +[5]: https://en.wikipedia.org/wiki/CiteScore +[6]: https://www.journals.elsevier.com/hardwarex +[7]: https://www.mdpi.com/journal/sensors +[8]: https://journals.plos.org/plosone/ +[9]: https://openhardware.metajnl.com/ +[10]: https://www.journals.elsevier.com/softwarex +[11]: https://joss.theoj.org/ +[12]: https://openresearchsoftware.metajnl.com/ +[13]: https://about.gitlab.com/ +[14]: https://osf.io/ +[15]: https://arxiv.org/ +[16]: https://www.preprints.org/ +[17]: https://opensource.com/business/16/2/certified-good-software +[18]: https://certification.oshwa.org/ +[19]: https://doaj.org/ diff --git a/sources/talk/20190911 How Linux came to the mainframe.md b/sources/talk/20190911 How Linux came to the mainframe.md new file mode 100644 index 0000000000..c83cc7ae91 --- /dev/null +++ b/sources/talk/20190911 How Linux came to the mainframe.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Linux came to the mainframe) +[#]: via: (https://opensource.com/article/19/9/linux-mainframes-part-1) +[#]: author: (Elizabeth K. Joseph https://opensource.com/users/pleia2https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jhibbetshttps://opensource.com/users/jimmyolano) + +How Linux came to the mainframe +====== +Linux's emergence on the mainframe is indebted to the external developer +community working with IBM. +![Person typing on a 1980's computer][1] + +Despite my 15 years of experience in the Linux infrastructure space, if you had asked me a year ago what a mainframe was, I'd be hard-pressed to give a satisfying technical answer. I was surprised to learn that the entire time I'd been toiling away on x86 machines in various systems administration roles, Linux was running on the s390x architecture for mainframes. In fact, 2019 marks 20 years of IBM's involvement in Linux on the mainframe, with purely community efforts predating that by a year. + +### What is a mainframe? + +You can think of a mainframe as a big, enterprise-grade server. Everything from the custom s390x CPUs to memory and power, coupled with external storage arrays, is highly redundant and even built to survive earthquakes (check out the [z13 Earthquake Shake Test][2] on YouTube). Built-in hardware-based encryption allows for end-to-end encryption of your data without taking general processing power away from your workloads. Essentially, if you want your workloads and data to be safe and secure, it still makes sense to invest in a mainframe. + +The traditional mainframe operating system is z/OS, which has a long history and still gets regular releases to add functionality, security, and stability. The [Open Mainframe Project][3] hosts a collection of open source projects, largely built around z/OS, to further modernize the platform. This includes [Zowe][4], which brings modern API, shell, automation, and scripting tooling to the mainframe. Systems administrators who are looking at mainframes now have a modern, familiar toolset to work with. Add support for Linux in the mix? Suddenly you have an incredibly powerful addition to infrastructure, and it supports all the tools you're familiar with. + +### The origins of Linux on the mainframe + +To get a real picture of how Linux got to the mainframe, I'll take you back in time. The first IBM mainframe, the IBM System/360, was introduced in 1964. Before this, computers were purpose-built for specific clients and industries. The S/360 was built to be a multi-purpose computer, able to cover a variety of computing needs across industries. Fast-forward to 1972, and we have what's really a pivotal moment in modern computing: the introduction of VM/370. + +VM stands for the same thing it means today, virtual machine, and this was the first virtualization technology for the mainframe. Time-sharing on the mainframe had been an idea in whitepapers dating back to the 1950s, but VM/370 brought that to another level. If you're interested in why this was revolutionary and the technical history of the components and teams that made this happen, read Melinda Varian's fascinating article _[VM and the VM Community: Past, Present, and Future][5]_. + +As a long-time open source enthusiast, I found one of the most interesting things about the development of the VM was how community-driven it was. People from various universities and companies outside IBM were driving the efforts and giving their feedback to IBM to push development forward. While learning about the history, I identified key people inside IBM—I would call them the first developer advocates—who went out of their way to support external developers on the platform and advocate for their needs internally to drive change at IBM. + +Fast-forward to 1994, and we reach another milestone that helped pave the way for Linux on the mainframe: experimental TCP/IP support in VMs. Mainframes have supported a series of network-type interfaces; TCP/IP was just one, but for the purposes of porting Linux to the mainframe, it was a key one. + +It was 1998 when a fellow named Linas Vepstas started the "Bigfoot" effort to see if he could get Linux running on a mainframe using a VM. I love this part of the history, partially because it goes back to the community driving development, but also because of his [_Why port Linux to the mainframe?_][6] page. His first four points really spoke to me as an infrastructure geek: + + * Stunt + * To learn + * Because it's there + * Because it's knarly, duude! + + + +Linas fleshes these points out—and reading them showed me immediately that I had found a kindred spirit. His list continues into more practical things: I/O, address spaces and access lists, VM, and the business model. But given how he orders his points, I think I know where his real motivations are. + +But when did IBM join in and offer official support? I'll explain next week in part two of this history. + +We got a chance to send a few questions to Jim Zemlin, executive director of the Linux Foundation... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-mainframes-part-1 + +作者:[Elizabeth K. Joseph][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/pleia2https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jhibbetshttps://opensource.com/users/jimmyolano +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://www.youtube.com/watch?v=kmMn5Q_lnkk +[3]: https://www.openmainframeproject.org/ +[4]: https://www.openmainframeproject.org/projects/zowe +[5]: http://www.leeandmelindavarian.com/Melinda/25paper.pdf +[6]: https://linas.org/linux/i370-why.html diff --git a/sources/talk/20190911 To secure industrial IoT, use segmentation instead of firewalls.md b/sources/talk/20190911 To secure industrial IoT, use segmentation instead of firewalls.md new file mode 100644 index 0000000000..9d5e300b47 --- /dev/null +++ b/sources/talk/20190911 To secure industrial IoT, use segmentation instead of firewalls.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (To secure industrial IoT, use segmentation instead of firewalls) +[#]: via: (https://www.networkworld.com/article/3437956/to-secure-industrial-iot-use-segmentation-instead-of-firewalls.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +To secure industrial IoT, use segmentation instead of firewalls +====== +Firewalls have been the de facto standard for securing internal devices for years, but the industrial internet of things (IIoT) will change that. +Jiraroj Praditcharoenkul / Getty Images + +The internet of things (IoT) has been top of mind for network and security professionals for the better part of the past five years. This has been particularly true for the area of industrial IoT (IIoT). Connected industrial devices are nothing new, but most IT people aren’t familiar with them because they have been managed by operational technology (OT) teams. More and more, though, business leaders want to bring OT and IT together to drive better insights from the combined data set. + +While there are many advantages to merging IT and OT and having IIoT fall under IT ownership, it has a profound impact on the cybersecurity team because it introduces several new security threats. Each connected endpoint, if breached, creates a backdoor into the other systems. + +**[ Also read: [A corporate guide to addressing IoT security][1] ]** + +### Internal firewalls an expensive, complex option for IIoT + +One way to protect IIoT environments is to use internal firewalls. This may seem like an obvious choice because internal firewalls have become the de facto standard for securing almost anything. However, in an IIoT environment, firewalls are perhaps the worst choice because of cost and complexity. + +Historically, internal firewalls were deployed where traffic moved in a “north-south” direction and would pass through a single ingress/egress point, such as a core switch.  Also, the devices connected were all known and managed by IT. With IIoT, connections can be much more dynamic and traffic can flow between devices in an “east-west” pattern, bypassing where the firewalls are located. That means security teams would need to deploy an internal firewall at every possible IIoT connection point and then manage the policies and configurations across hundreds, possibly thousands of firewalls, creating an almost unmanageable situation. + +To get a better understanding of the magnitude of this problem, I talked with Jeff Hussey, president and CEO of Tempered Networks, which specializes in IIoT security solutions, and he told me about one of the company’s customers that explored using internal firewalls. After doing an extensive evaluation of where all the internal firewalls would need to go, the business estimated that the total cost of firewalls would be about $100 million. Even if a business could afford that, there’s another layer of challenges associated with the operational side. + +Hussey then told me about a healthcare customer that’s trying to use a combination of firewall rules, ACL, VLANs, and VPNs to secure their environment, but, as he put it, “the complexity was killing them” and makes it impossible to get anything done because of the operational overhead. + +I also spoke with Derek Harp, founder and chairman of the [Control System Cyber Security Association International][2] (CS2AI), who does a lot of work in the IIoT area. He described the current IIoT environments as getting “more porous” as networks continue to evolve and become more open as third parties need access to data from internal systems. Toss in the advanced skill level of threat actors, and it’s easy to see how this isn’t a fight that cybersecurity teams can fight with traditional network security. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** + +### Micro-segmentation preferred over internal firewalls for IIoT + +Instead of using internal firewalls, security professionals should turn towards IIoT micro-segmentation. Segmentation is similar to the use of VLANs and ACLs, but the environmental separation is done at the device level and managed with rules instead of at the network layer. With VLANs and ACLs, all devices, including IIoT endpoints, would need to be assigned to a VLAN. If the endpoint moves, the network then needs to be reconfigured to accommodate. If it’s not, the device either can’t connect or is on the same network as devices where bad things could happen if it were breached. + +The Target breach of a few years ago is an excellent example of this where the retailer's HVAC system was compromised, and that created a back door into the point-of-sale (PoS) system. Traditional security works great in highly static environments, but IIoT can be highly dynamic with devices routinely joining and leaving the network. + +### Segmentation operates at the device layer + +The benefit of segmentation is that it’s done in software and operates at the device connectivity layer, so policies follow the endpoints. For example, a rule could be created where all medical devices are in a particular segment and isolated from the rest of the connected nodes. If a medical device moves, the policy goes with it and there’s no need to reconfigure things. If Target had been using IIoT micro-segmentation and the HVAC and PoS systems were in separate segments (which they should be from a best practice standpoint), the worst that could have happened is the stores got too warm. + +Micro-segmentation has been used in data centers to secure lateral traffic that flows between virtual machines and containers. Cybersecurity teams should now look to extend the technology out to the broader network, with the first use case being to secure IIoT endpoints. This will let businesses move forward with digital transformation plans without putting their companies at risk. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3437956/to-secure-industrial-iot-use-segmentation-instead-of-firewalls.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]: https://www.networkworld.com/article/3269165/internet-of-things/a-corporate-guide-to-addressing-iot-security-concerns.html +[2]: https://www.cs2ai.org/ +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190912 3 ways to handle transient faults for DevOps.md b/sources/talk/20190912 3 ways to handle transient faults for DevOps.md new file mode 100644 index 0000000000..d2b112c656 --- /dev/null +++ b/sources/talk/20190912 3 ways to handle transient faults for DevOps.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 ways to handle transient faults for DevOps) +[#]: via: (https://opensource.com/article/19/9/transient-faults-devops) +[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaubhttps://opensource.com/users/wpschaubhttps://opensource.com/users/wpschaub) + +3 ways to handle transient faults for DevOps +====== +DevOps is about delighting our stakeholders with continuous business +value, and how we manage transient faults is part of that. +![Bright gears connecting][1] + +In electrical engineering, a _transient fault_ is defined as an error condition that vanishes after the power is disconnected and restored. This is also a workaround many of us unconsciously use when we forcefully power our physical devices off and on when they're performing poorly or frozen on a blue crash screen filled with gibberish. + +In cloud computing, we are faced with increased complexity, known unknowns, or worse, unknown unknowns with infrastructure we will never touch as well as technology that's evolving at an exponential rate and disparate solutions connecting an expanding digital world. Today's virtual users' tolerance for unresponsive, unreliable, and underperforming products is zero—everyone wants 24x7 uptime and solutions that evolve and blend into their lifestyle. + +In this new virtual world, we cannot just walk up and reboot a machine, at least not without impacting hundreds, thousands, or even millions of users. And loyalty to brands and products is dwindling fast in today's competitive world; users would probably look for an alternative service at a click of a keystroke and never return rather than put up with any measurable amount of downtime. + +Let's take a quick look at two events that were _humbling_ reminders that today's transient faults can occur in a heartbeat, are complex to identify and resolve, and have a profound impact on our stakeholders. + + * [**A Rough Patch**][2]**:** "_We've had some issues with the service over the past week and a half. I feel terrible about it, and I can't apologize enough. It's the biggest incident we've had since the instability created by our service refactoring,"_ wrote Microsoft corporate VP of cloud developer services Brian Harry on his blog. After weeks of sleepless nights, the root cause was identified as a storm of requests to the access control service (ACS) that exhausted Source Network Address Translation (SNAT) ports, prevented authentications, and impacted our stakeholders. + * **[503 Error][3]:** _"Setting up monitoring from the beginning of the implementation of our Azure function confirms the importance of monitoring in the DevOps process,"_ reported Cellenza's Mikael Krief on the ALM DevOps Rangers blog. Again, we spent sleepless nights finding the root cause of why our refactored extension spawned a storm of connections and threads, imploded our Azure service, and frustrated our stakeholders with 503 Service Unavailable errors. + + + +We can set up failure and disaster recovery for our cloud applications to help minimize, not eliminate, the impact of an outage caused by resource failures or natural disasters. However, for solutions that use remote resources or communicate with remote services, we need to add a pinch of sensitivity to transient faults. Well-designed solutions detect and attempt to self-correct transient faults before sounding an alarm—or worse, becoming unresponsive and failing. + +There are a handful of transient fault handling patterns, including the three shown on the following whiteboard: **retry**, **throttling**, and **circuit breaker**. + +![transient fault handling patterns][4] + +### Retry pattern + +The retry pattern is the simplest of the three transient fault handling patterns and something we do naturally in everyday life. It can be effective in solutions that communicate across distributed networks to handle transient faults caused by issues such as network latency, service overloads, and power outages. + +![Retry pattern][5] + +**Pseudocode** + +Set failure_count = 0 +**Call** the [micro] service +If (fail) failure_count++ +If (failure_count > retry_limit) or (not transient failure) FAIL +**Delay** (delay_time) +Increase delay_time by factor of failure_count +**Retry** step 2 + +The pattern ensures that a user's request eventually succeeds during less-than-ideal situations where transient failures would otherwise result in immediate and frequent failures. See open source implementations such as [java-design-patterns][6] and [transient-fault-handling-application-block][7] for details. + +### Throttling pattern + +We need to protect our services against clients that are overutilizing our solution or have gone rogue due to a system or logic failure. Like a four-lane tunnel servicing a six-lane freeway, we must manage the flow of requests (cars) and throttle endpoints (lanes) that are exceeding the maximum throughput (tunnel). + +![Throttling pattern][8] + +**Pseudocode** + +Increment request_count +// Limit – Maximum requests within an interval +// Degrade – Fail with “slow down” error or pause operation +If (request_count > limit) **degrade** service +**Call** the [micro] service + +The pattern helps us meet service level agreements, prevent a single user from overutilizing the system, optimize request flows, and deal with bursts of unexpected requests. One of the reasons we need to increase the delay between retries in the previous pattern is to ensure that we do not inadvertently exceed the throughput of the system and trigger degradation of service. See open source implementations such as [WebApiThrottle][9] and [Core.Throttling][10] for more details. + +### Circuit breaker pattern + +Like circuit breakers in your home, the circuit breaker pattern is your last defense. While the retry pattern helps to autocorrect brief transient faults, this pattern is more suited for transient faults that take a longer period to resolve. When dealing with network or service outages, such as the [Rough Patch][2] event, retrying a failing service operation could worsen the situation, lead to cascading failures, and eventually trigger a solution meltdown. The hypothesis of the circuit breaker pattern is that the failed service call is likely to succeed if (and only if) it is automatically retried after a significant delay. + +Like when you stagger into your basement in the dark to find your circuit breaker cabinet, you are allowing the electrical system and potential static charges to recover before you flip the switch. + +![Circuit breaker pattern][11] + +**Pseudocode** + +// Circuit breaker has not tripped +If (circuit_state == open) + +**Call** the [micro] service +If (fail) fail_count++ +If (fail_count > limit) circuit_state = **closed** + +// Circuit breaker tripped +Else + +If (circuit_state == closed) Start Timer + +// Call back for timer event +On Timer timeout + +**Call** the [micro] service +If (success) circuit_state == **open** + +See open source implementations such as [Hystrix][12], [circuit-breaker][13], and [Polly][14] for more details. + +### Don't fear faults  + +Remember to include unit and integration tests for all known faults and implemented handling patterns. Your unit tests must validate that your solution reacts appropriately when your fault-handling logic is triggered. On the other hand, your integration tests must simulate resilient faults to verify that your solution of collective services can deal with the fault effectively. You can simulate services, transient faults, and degrading services by using service virtualization such as [Hoverfly][15]. Your stakeholders will not be amused if your solution and associated fault handling patterns fail to deliver the promise of self-healing and avoidance of catastrophic meltdowns. + +So, faults, like failures, are a [feature in blameless DevOps][16] and we should [not fear them][17]. To remain competitive, we must raise the quality bar of our infrastructures, solutions, and accountability to detect, remediate at the root-cause level, and self-correct to maintain an acceptable service level. + +For example, in the following illustration, microservice #7 has imploded, triggering circuit breakers and traffic throttling and allowing the system to recover while continuing to service the users. What is evident from this simple illustration is that the combination of faults and the difficulty of dealing with them can become complex at the flip of a switch of a feature flag. + +![Transient fault example][18] + +These and other patterns are powerful allies for one of the [core values of a healthy DevOps mindset][19] to "_improve beyond the limits of today's processes—strive to always innovate and improve beyond repeatable processes and frameworks._" They help us raise the quality bar and continuously deliver business value and delight our stakeholders. + +* * * + +_Special thanks to [Brent Reed][20] for his candid review and feedback that help us improve and share our insights._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/transient-faults-devops + +作者:[Willy-Peter Schaub][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/wpschaubhttps://opensource.com/users/wpschaubhttps://opensource.com/users/wpschaub +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devop.png?itok=Yicb2nnZ (Bright gears connecting) +[2]: https://aka.ms/bh-ff-sos +[3]: https://aka.ms/vsar-ff-sos +[4]: https://opensource.com/sites/default/files/uploads/handlingtransientfaults_1.jpg (transient fault handling patterns) +[5]: https://opensource.com/sites/default/files/uploads/handlingtransientfaults_2.png (Retry pattern) +[6]: https://github.com/iluwatar/java-design-patterns +[7]: https://github.com/microsoftarchive/transient-fault-handling-application-block +[8]: https://opensource.com/sites/default/files/uploads/handlingtransientfaults_3.png (Throttling pattern) +[9]: https://github.com/stefanprodan/WebApiThrottle +[10]: https://github.com/SharePoint/PnP/tree/master/Samples/Core.Throttling +[11]: https://opensource.com/sites/default/files/uploads/handlingtransientfaults_4.png (Circuit breaker pattern) +[12]: https://github.com/Netflix/Hystrix/wiki +[13]: https://github.com/josephwilk/circuit-breaker +[14]: https://github.com/App-vNext/Polly +[15]: https://github.com/SpectoLabs/hoverfly +[16]: https://opensource.com/article/19/8/failure-feature-blameless-devops +[17]: https://opensource.com/article/19/8/why-fear-failure-silent-devops-virus +[18]: https://opensource.com/sites/default/files/uploads/handlingtransientfaults_5.png (Transient fault example) +[19]: https://agents-of-chaos.org/2019/05/12/five-essential-values-for-the-devops-mindset/ +[20]: https://opensource.com/users/brentaaronreed diff --git a/sources/talk/20190912 A Virtual WAN- Moving closer to the enterprise.md b/sources/talk/20190912 A Virtual WAN- Moving closer to the enterprise.md new file mode 100644 index 0000000000..b589bd5e2a --- /dev/null +++ b/sources/talk/20190912 A Virtual WAN- Moving closer to the enterprise.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Virtual WAN: Moving closer to the enterprise) +[#]: via: (https://www.networkworld.com/article/3438357/a-virtual-wan-moving-closer-to-the-enterprise.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +A Virtual WAN: Moving closer to the enterprise +====== +Virtual WAN will radically change the telecom environment, including how circuits are procured and who procures them. +BlueBay2014 / Getty Images + +Microsoft has introduced a new virtual WAN as a competitive differentiator and is getting enough tracking that AWS and Google may follow. At present, Microsoft is the only company to offer a virtual WAN of this kind. This made me curious to discover the highs and lows of this technology. So I sat down with [Sorell Slaymaker][1], Principal Consulting Analyst at TechVision Research to discuss. The following is a summary of our discussion. + +But before we proceed, let’s gain some understanding of the cloud connectivity. + +Cloud connectivity has evolved over time. When the cloud was introduced about a decade ago, let’s say, if you were an enterprise, you would connect to what's known as a cloud service provider (CSP). However, over the last 10 years, many providers like Equinix have started to offer carrier-neutral collocations. Now, there is the opportunity to meet a variety of cloud companies in a carrier-neutral colocation. On the other hand, there are certain limitations as well as cloud connectivity. + +[NEWSLETTERS: Get the latest tech news sent directly to your in-box][2] + +Undoubtedly, carrier-neutral colocation has fetched many advantages. However, even with this enhanced and flexible connectivity model, the pain-point for the majority of cloud companies is still the network connectivity. The network presents a number of challenges. Firstly, it will slow you down and secondly, from a security perspective, it makes you susceptible to vulnerabilities. + +### The connectivity transition + +We are now entering into a new phase, taking the cloud connectivity to the next level. Primarily, the cloud is moving closer to the enterprise, as opposed to the enterprise moving closer to the cloud. So, where will this approach lead us to? + +Eventually, we will see the removal of the CSP, where the connectivity is serviced directly into the enterprise. We have already witnessed this transition with AWS. AWS now allows the companies to run AWS infrastructure in their own private data centers. This, ultimately, enables the organization to connect the various VPCs together. + +With this paradigm, the cloud meets the customer in the enterprise as opposed to the enterprise coming to the cloud, or to a carrier-neutral colocation. This will radically change the telecom environment; especially how circuits are procured and who procures them. + +### Cloud connectivity + +First, let’s recap some basics. The connectivity to any cloud can be done via the internet or a private direct connection. The internet is untrusted and public, where an IPsec tunnel is created. It may be cheap and quick to provision logical tunnels, but this comes with certain drawbacks, such as security, uptime, latency, packet loss and jitter. + +All such hindrances can degrade the application’s performance severely. This can be critical to support the sensitive and hybrid applications requiring real-time backend on-premise communications. For direct connectivity, most cloud providers have a more stable solution rather than relying solely on the Internet. + +For example, AWS has a product called AWS Direct Connect, whereas Microsoft has a product known as Azure ExpressRoute. Both products have the same end goal: cloud and on-premise endpoint connectivity that is not over the Internet. + +With Microsoft's Azure ExpressRoute, you get a private connection with guaranteed service level agreement (SLA). It's like a natural extension to the on-premise data center that offers lower latency, higher throughput and better reliability than the Internet has to offer. However, there are some drawbacks to this mechanism. + +Even though ExpressRoute provides a private connection, enforcing end-to-end QoS is quite challenging. How Microsoft would label the packet will be different from how the service providers label based on their standard MPLS links. The other challenge is the lack of efficient load balancing due to separate BGP domains. Since ExpressRoute is not delivered end-to-end, so you are basically doing a cross-connect or meeting the service provider at a point where there is already another BGP domain available. + +As a result, if you want to do equal-cost multipath (ECMP), complex failover and dynamic routing around congestion and configurations can get complex. This surfaces the demand for a change. Since Microsoft is aware of this need, therefore, they are evolving this ExpressRoute into what they are calling as the “Azure Virtual WAN.” A virtual WAN, as you might expect, provides a massive scale during the software-defined connectivity. + +### What the virtual WAN offers? + +The Azure Virtual WAN brings together many Azure cloud connectivity services, such as site-to-site VPN and ExpressRoute into a single operational interface. Now connectivity can leverage the Azure backbone to connect the branches and enjoy the branch-to-VNet connectivity. We will learn more about the new connectivity options later. The virtual WAN is purposely designed to provide large-scale site-to-site connectivity. It is built to offer throughput, scalability and ease of use. + +Microsoft has virtual WAN locations that connect to the Microsoft virtual network. This network consists of 130 connections in 50 countries. This pushes the cloud connectivity model closer to the edge. Therefore, if you are using Azure or Office 365, connectivity is closer, as compared to doing a global backhaul. Microsoft's primary objective is to be within 30 ms of the consumer. + +Microsoft also gives the option to do hop-on and hop-off, so that you can use the Microsoft global backbone as your WAN. In the case of remote offices in different locations, you only need to provide local circuits to the Microsoft edge point in that country. This eliminates the need for purchasing large WAN circuits. + +This significantly allows you to have a global WAN where you don't have to pay for the expensive WAN circuits between or within counties. + +Virtual WAN offers the following advantages: + + * **Integrated connectivity solutions in the hub-and-spoke:** You can automate the site-to-site configuration and connectivity between the on-premises sites and an Azure hub. + * **Automated spoke setup and configuration:** You can connect your virtual networks and workloads to the Azure hub seamlessly. + * **Intuitive troubleshooting:** You can see the end-to-end flow within Azure, and then use this information to take action when required + + + +### The partners and virtual Hub + +Typically, virtual WAN lets you connect and configure the branch devices to communicate with Azure. This can be done in two ways, either manually, or by using the provider devices offered through a virtual WAN partner. + +The partner devices allow ease of use, simplification of connectivity and configuration management. The connectivity from the on-premise device is established in an automated way to the virtual hub. Fundamentally, a virtual hub is a Microsoft-managed virtual network. + +### The global transit network + +The virtual WAN helps in laying the foundation of a global transit network architecture by enabling ubiquitous, any-to-any connectivity between distributed VNets, sites, applications and users. + +In the WAN architecture, Azure regions serve as hubs, from which you can choose to connect your branches. Once the branches are connected, you can leverage the Azure backbone to establish, for example, branch-to-VNet and branch-to-branch connectivity. + +The virtual WAN supports the following; global transit connectivity paths, branch to VNets, branch to branch, the remote user to VNet, the remote user to branch, VNet to VNet by using VNet peering and ExpressRoute global reach. + +### The WAN architecture + +The architecture is based on a hub-and-spoke model where the Microsoft cloud-hosted network acts as the hub. This enables transitive connectivity between endpoints that may be distributed across different types of spokes. + +A spoke can be a VNets, physical branch site, remote user and internet. Global transit network architecture enables any-to-any connectivity via a central network hub. Largely, this architecture eliminates or reduces the need for full-mesh or partial mesh connectivity models that are complex to build and maintain. + +Routing control in mesh networks is easier to configure and maintain through the hub-and-spoke model. The Microsoft any-to-any connectivity enables an enterprise with globally distributed users, branches, data centers, VNets and applications to connect to each other through the Microsoft transit hub. In essence, it is this transit hub that acts as the global system. + +Mainly, you can establish a virtual WAN by creating a single Virtual WAN hub in the region that has the largest number of spokes that can take the form of branches, VNets and users. Then you can connect the spokes that are in other regions of the hub. An alternative design would occur if the spokes are geographically distributed, you can also instantiate regional hubs and interconnect the hubs. The hubs are all part of the same virtual WAN, but the best part is that they can be associated with different regional policies. + +### Virtual WAN SD-WAN capabilities + +Currently, SD-WAN is not fully integrated. Microsoft offers SD-WAN services from a couple of SD-WAN vendors including Citrix, GloudGenix and 128 technologies as part of the overall virtual WAN offering. + +Under this model, you could, for example, have a 1G connection to Azure and you can run the SD-WAN vendor software within the location. You can use that software to route to other Azure locations. Now since you are using the SD-WAN, you get all the SD-WAN services on top of the Microsoft virtual WAN i.e. route around congestion and another brownout. This is contrary to the typical protocol that routes only around blackouts. + +Citrix WAN optimization features allow you to tune and configure the WAN to have more control as opposed to relying on the underlying network. Although, Citrix is very strong with WAN optimization, but it is IPsec based. Therefore, its overall scaling is eventually limited to the limitations of scaling IPsec. On the other hand, an SD-WAN offering from 128 technologies is not IPsec tunnel-based and doesn't have the overhead. Thence, it can more intelligently route traffic in a one-to-many vs tunnels that are point-to-point. + +Regarding in-built security on the WAN backbone, Microsoft provides the connectivity to integrate the security solution according to your choice. If you want security to be over and above, you can service-chain a firewall vendor or leverage security in place of an SD-WAN service. The majority of SD-WAN players have layer 1 to layer 4 built into them. They don't have the proxies or the Layer 5 or higher than the security solutions that you get from security companies, such as Pao Alto but you always have the option to service-chain. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][3]** + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438357/a-virtual-wan-moving-closer-to-the-enterprise.html + +作者:[Matt Conran][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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://techvisionresearch.com/sorell-slaymaker/ +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/contributor-network/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190913 How 6G will work- Terahertz-to-fiber conversion.md b/sources/talk/20190913 How 6G will work- Terahertz-to-fiber conversion.md new file mode 100644 index 0000000000..9dad34a936 --- /dev/null +++ b/sources/talk/20190913 How 6G will work- Terahertz-to-fiber conversion.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How 6G will work: Terahertz-to-fiber conversion) +[#]: via: (https://www.networkworld.com/article/3438337/how-6g-will-work-terahertz-to-fiber-conversion.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How 6G will work: Terahertz-to-fiber conversion +====== +For 6G wireless to become a reality, it must overcome a few technical hurdles, such as connecting terahertz spectrum to hard, optical transmission lines. Researchers at the Karlsruhe Institute of Technology say they have solved the problem. +Nelli Velichko / Getty Images + +Upcoming 6G wireless, superseding 5G and arriving possibly by 2030, is envisaged to function at hundreds of gigabits per second. Slowly, the technical advances needed are being made. + +A hole in the tech development thus far has been at the interface between terahertz spectrum and hard, optical transmission lines. How does one connect terahertz (THz), which is basically through-the-air spectrum found between microwave and infrared, to the transmission lines that will be needed for the longer-distance data sends? The curvature of the Earth, for one thing, limits line of sight, so hard-wiring is necessary for distances. Short distances, too, can be impeded by environmental obstructions: blocking by objects, even rain or fog, becomes more apparent the higher in spectrum one goes, as wavelengths get shorter. + +Researchers at the Karlsruhe Institute of Technology (KIT) say they know how to make the fiber link. They say, in a [press release][1], that one must develop modulators that operate on plasmonic nanophotonics, which is nano-scale, light-trapping technology (in this case, made with silicon) that will “directly couple the receiver antenna to a glass fiber.” The radio becomes part of the cable, in other words. It will “enable terahertz connections with very high data rates. Several hundred gigabits per second are feasible,” the researchers say. + +**Read also: [6G will achieve terabits-per-second speeds][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ** + +In tests, the research team demonstrated a terahertz link that was “seamlessly integrated” into fiber using a link at the terahertz receiver. They performed a terahertz-to-optical transmission rate of 50 gigabits per second. For comparison, current over-air wireless data rates with LTE technology and using radio are often around 20 megabits per second (Mbps)—nowhere near what the team produced. Verizon, now launching millimeter wave 5G in the U.S., [says typical speeds, for its fixed 5G service will be around 300 Mbps][4]. + +### Other 6G challenges + +The fiber-terahertz connection in 6G, though, isn’t the only area that must be addressed over the next few years. [Spatial multiplexing also needs to be mastered at terahertz to get the kinds of throughputs desired][5], experts say. Spatial multiplexing is where individual data signals are beamed out in streams. Every bit of the bandwidth thus gets used and reused continually, introducing bandwidth efficiency. + +Efficiency gains will also need to be obtained with more advanced MIMO antennas. That’s where antennas take advantage of multipath—signals sent over more than one route. + +Penetration loss also needs to be addressed. That’s the difference between the signal strength as it enters a building or structure and air. The loss increases with higher frequencies, as terahertz is; however, the amount of loss is dependent on the material that needs penetrating. Clear glass, for example, has less penetration loss overall than drywall, for example. That means construction materials used for upcoming buildings could be reimagined with new materials science to take advantage of 6G data throughput. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][6] ]** + +In March, [the FCC announced a new category of experimental spectrum licenses][7] for frequencies between 95 GHz and 3 THz. That’s so that telcos and scientists can work on the spectrum. + +We think “6G will emerge around 2030,” Ari Pouttu, a professor at the University of Oulu and a 5G system architect, [told me when I met him in Finland last year][2]. “It will eventually offer terabits per second,” along with millionth-of-a-second (microsecond) latency. + +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/3438337/how-6g-will-work-terahertz-to-fiber-conversion.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://www.kit.edu/kit/english/pi_2019_095_technologies-for-the-sixth-generation-cellular-network.php +[2]: https://www.networkworld.com/article/3305359/6g-will-achieve-terabits-per-second-speeds.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.verizonwireless.com/support/5g-home-faqs/ +[5]: https://www.networkworld.com/article/3285112/get-ready-for-upcoming-6g-wireless-too.html +[6]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[7]: https://www.fcc.gov/document/fcc-opens-spectrum-horizons-new-services-technologies +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190913 Why the Blockchain is Your Best Bet for Cyber Security.md b/sources/talk/20190913 Why the Blockchain is Your Best Bet for Cyber Security.md new file mode 100644 index 0000000000..5b980b3046 --- /dev/null +++ b/sources/talk/20190913 Why the Blockchain is Your Best Bet for Cyber Security.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why the Blockchain is Your Best Bet for Cyber Security) +[#]: via: (https://opensourceforu.com/2019/09/why-the-blockchain-is-your-best-bet-for-cyber-security/) +[#]: author: (Anna Aneena M G https://opensourceforu.com/author/anna-aneena/) + +Why the Blockchain is Your Best Bet for Cyber Security +====== + +[![][1]][2] + +_Blockchain is a tamper-proof, shared digital ledger that records the history of transactions between the peers in a peer-to-peer network. This article describes how blockchain technology can be used to protect data and the network from cyber-attacks._ + +Cyber security is a set of technologies, processes and controls designed to protect systems, devices, data, networks and programs from cyber-attacks. It secures data from threats such as theft or misuse, and also safeguards the system from viruses. + +In today’s world, cyber-attacks are major threats faced by each user. Most of us are responsive to the advertisements on various websites on the Internet, and if asked questions or any personal details, respond without even thinking of the consequences. Sharing one’s personal information is very risky, as one may lose whatever one has. In 2016, the search engine Yahoo! faced a major attack and around one billion accounts were compromised. The attackers were able to get the user names, passwords, phone numbers, and security questions and answers of e-mail users. On September 7, 2017, Equifax, one of the largest consumer credit recording agencies in the world, faced a massive cyber security threat. It is believed that someone gave unauthorised access to the data with this agency, from mid-May to July 2017. Around 145.5 million people felt threatened by the news as they had shared personal information like names, social security numbers, birthdays, addresses and driving license numbers with Equifax. + +Many people use weak or default passwords for their personal accounts on some Internet sites, which is very risky as these can be cracked, and their personal details can be compromised. This may be even more risky if people use default passwords for all their sites, just for convenience. If the attackers crack that password, then it can be used for all other sites, and all their personal details, including their credit card and bank details may be harvested. In this digital era, cyber-attacks are a matter of real concern. Cyber criminals are greatly increasing in number and are attempting to steal financial data, personal identifiable information (PII) as well as identities of the common Internet user. + +Businesses, the government, and the private as well as public sectors are continuously fighting against such frauds, malicious bugs and so on. Even as the hackers are increasing their expertise, the ways to cope with their attacks are also improving very fast. One of these ways is the blockchain. + +**Blockchain: A brief background** +Each block in a blockchain contains transaction data, a hash function and hash of the previous block. Blockchain is managed by a peer-to-peer (P2P) network. On the network, no central authority exists and all blocks are distributed among all the users in the network. Everyone in the network is responsible for verifying the data that is shared, and ensuring that no existing blocks are being altered and no false data is being added. Blockchain technology enables direct transaction between two individuals, without the involvement of a third party and hence provides transparency. When a transaction happens, the transaction information is shared amongst everyone in the blockchain network. These transactions are individually time stamped. When these transactions are put together in a block, they are time stamped again as a whole block. Blockchain can be used to prevent cyber-attacks in three ways – by being a trusted system, by being immutable and by network consensus. + +A blockchain based system runs on the concept of human trust. A blockchain network is built in such a way that it presumes any individual node could attack it at any time. The consensus protocol, like proof of work, ensures that even if this happens, the network completes its work as intended, regardless of human cheating or intervention. The blockchain allows one to secure stored data using various cryptographic properties such as digital signatures and hashing. As soon as the data enters a block in the blockchain, it cannot be tampered with and this property is called immutability. If anyone tries to tamper with the blockchain database, then the network consensus will recognise the fact and shut down the attempt. + +Blockchains are made up of nodes; these can be within one institution like a hospital, or can be all over the world on the computer of any citizen who wants to participate in the blockchain. For any decision to be made, the majority of the nodes need to come to a consensus. The blockchain has a democratic system instead of a central authoritarian figure. So if any one node is compromised due to malicious action, the rest of the nodes recognise the problem and do not execute the unacceptable activity. Though blockchain has a pretty incredible security feature, it is not used by everyone to store data. + +![Figure 1: Applications of blockchain][3] + +**Common use cases of blockchain in cyber security** +Mitigating DDoS attacks: A distributed denial-of-service attack is a cyber-attack; it involves multiple compromised computer systems that aim at a target and attack it, causing denial of service for users of the targeted resources. This causes the system to slow down and crash, hence denying services to legitimate users. There are some forms of DDoS software that are causing huge problems. One among them is Hide and Seek malware, which has the ability to act even after the system reboots and hence can cause the system to crash over and over again. Currently, the difficulty in handling DDoS attacks is due to the existing DNS (Domain Name System). A solution to this is the implementation of blockchain technology. It will decentralise the DNS, distributing the data to a greater number of nodes and making it impossible for the hackers to hack. + +**More secure DNS:** For hackers, DNS is an easy target. Hence DNS service providers like Twitter, PayPal, etc, can be brought down. Adding the blockchain to the DNS will enhance the security, because that one single target which can be compromised is removed. + +**Advanced confidentiality and data integrity:** Initially, blockchain had no particular access controls. But as it evolved, more confidentiality and access controls were added, ensuring that data as a whole or in part was not accessible to any wrong person or organisation. Private keys are generally used for signing documents and other purposes. Since these keys can be tampered with, they need to be protected. Blockchain replaces such secret keys with transparency. + +**Improved PKI:** PKI or Public Key Infrastructure is one of the most popular forms of public key cryptography which keeps the messaging apps, websites, emails and other forms of communications secure. The main issue with this cryptography is that most PKI implementations depend on trusted third party Certificate Authorities (CA). But these certificate authorities can easily be compromised by hackers and spoof user identities. When keys are published on the blockchain, the risk of false key generation is eliminated. Along with that, blockchain enables applications to verify the identity of the person you are communicating with. ‘Certain’ is the first implementation of blockchain based PKI. + +**The major roles of blockchain in cyber security** +**Eliminating the human factor from authentication:** Human intervention is eliminated from the process of authentication. With the help of blockchain technology, businesses are able to authenticate devices and users without the need for a password. Hence, blockchain avoids being a potential attack vector. + +**Decentralised storage:** Blockchain users’ data can be maintained on their computers in their network. This ensures that the chain won’t collapse. If someone other than the owner of a component of data (say, an attacker) attempts to destroy a block, the entire system checks each and every data block to identify the one that differs from the rest. If this block is identified or located by the system, it is recognised as false and is deleted from the chain. + +**Traceability:** All the transactions that are added to a private or public blockchain are time stamped and signed digitally. This means that companies can trace every transaction back to a particular time period. And they can also locate the corresponding party on the blockchain through their public address. + +**DDoS:** Blockchain transactions can be denied easily if the participating units are delayed from sending transactions. For example, the entire attendant infrastructure and the blockchain organisation can be crippled due to the DDoS attack on a set of entities or an entity. These kinds of attacks can introduce integrity risks to a blockchain. + +**Blockchain for cyber security** +One interesting use case is applying the strong integrity assurance feature of blockchain technology to strengthen the cyber security of many other technologies. For example, to ensure the integrity of software downloads like firmware updates, patches, installers, etc, blockchain can be used in the same way that we make use of MD5 hashes today. Our file download that we compare against the hash might be compromised on a vendor website and altered without our knowledge. With a higher level of confidence, we can make a comparison against what is permanently recorded in the blockchain. The use of blockchain technologies has great security potential, particularly in the world of cyber-physical systems (CPS) such as IoT, industrial controls, vehicles, robotics, etc. + +Summarising this, for cyber-physical systems the integrity of data is the key concern while the confidentiality in many cases is almost irrelevant. This is the key difference between cyber security for cyber-physical systems and cyber security for traditional enterprise IT systems. Blockchain technology is just what the doctor ordered to address the key cyber-physical systems’ security concerns. + +The key characteristics of a blockchain that establish trust are listed below. + + * _**Identification and authentication:**_ Access is granted via cryptographic keys and access rules. + * _**Transaction rules:**_ At every node standard rules are applied to every transaction. + * _**Transaction concatenation:**_ Every transaction is linked to its previous transaction. + * _**Consensus mechanism:**_ In order to agree upon the transaction integrity, mathematical puzzles are solved for all nodes. + * _**Distributed ledger:**_ There are standards for listing transactions on every node. + * _**Permissioned and unpermissioned:**_ Ability to participate in a blockchain can be open or pre-approved. + + + +**Is blockchain secure?** +Blockchain stores data using sophisticated and innovative software rules that are extremely difficult for attackers to manipulate. The best example is Bitcoin. In Bitcoin’s blockchain, the shared data is the history of every transaction made. Information is stored in multiple copies on a network of computers called nodes. Each time someone submits a transaction to the ledger, the node checks to make sure the transaction is valid or not. A subset of the package validates the transaction into blocks and adds them to the previous chain. + +The blockchain offers a higher level of security to every individual user. This is because it removes the need for easily compromised and weak online identities and passwords. + +**How does a blockchain protect data?** +Instead of uploading data to a cloud server or storing it in a single location, a blockchain breaks everything into several small nodes. A blockchain protects data because: + + * It is decentralised. + * It offers encryption and validation. + * It can be private or public. + * It is virtually impossible to hack. + * It offers quality assurance. + * It ensures fast, cheap and secure transfer of funds across the globe. + * It is well known for its traceability. + * Through it, transactions become more transparent. + + + +**Cyber security is a priority, not an afterthought** +It seems like in the digital age, comfort and convenience have overtaken things like privacy and security in very unfortunate ways. The handing over of personal information to companies like Facebook is a personal choice; however, no one wants to see information leaked to third parties without consent. The blockchain is all about security. It has provided us a simple, effective and affordable way of ensuring that our cyber security needs are not only met, but also exceeded. We need to understand that the technologies we use to improve our lives can also be used to harm us. That is the reality of the era we are living in, one where most of our personal data is on the cloud, on our mobile device, or on our computer. Because of that, it is vital to look at online safety and cyber security as priorities and not afterthoughts. The blockchain can assist us in turning that thought into reality, and allow us to build a future where online threats are kept to a minimum. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/why-the-blockchain-is-your-best-bet-for-cyber-security/ + +作者:[Anna Aneena M G][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://opensourceforu.com/author/anna-aneena/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1.png?resize=615%2C434&ssl=1 (1) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1.png?fit=615%2C434&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2.png?resize=350%2C219&ssl=1 diff --git a/sources/talk/20190913 Why the founder of Apache is all-in on blockchain.md b/sources/talk/20190913 Why the founder of Apache is all-in on blockchain.md new file mode 100644 index 0000000000..7487ee3626 --- /dev/null +++ b/sources/talk/20190913 Why the founder of Apache is all-in on blockchain.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why the founder of Apache is all-in on blockchain) +[#]: via: (https://opensource.com/article/19/9/podcast-interview-brian-behlendorf) +[#]: author: (Gordon Haff https://opensource.com/users/ghaffhttps://opensource.com/users/wonderchookhttps://opensource.com/users/sachinpbhttps://opensource.com/users/ron-mcfarland) + +Why the founder of Apache is all-in on blockchain +====== +Brian Behlendorf talks about starting Apache, the tension between +pragmatism and idealism, and why he’s excited about blockchain. +![Data container block with hexagons][1] + +Brian Behlendorf is perhaps best known for being a co-founder of the Apache Project, which became the Apache Software Foundation. Today, he's the executive director of the Hyperledger Foundation, an organization focused on enterprise-grade, open source, distributed ledgers (better known as blockchains). He also says he "put the first ad banner online and have been apologizing ever since." + +In a recent [conversation on my podcast][2], Behlendorf talks about the goals of the Apache Project, the role of foundations generally, and his hopes for blockchain. + +### Starting Apache + +As Behlendorf tells the story, [Apache][3] came out of an environment when "we might have had a more beneficent view of technology companies. We still thought of them as leading the fight for individual empowerment." + +At the same time, Behlendorf adds, "there was still a concern that, as the web grew, it would lose its character and its soul as this kind of funky domain, very flat space, supportive of freedoms of speech, freedoms of thought, freedoms of association that were completely novel to us at the time, but now we take for granted—or even we have found weaponized against us." + +This led him to want Apache to address concerns that were both pragmatic in nature and more idealistic. + +The pragmatic aspect stemmed from the fact that "iteratively improving upon the [NCSA web server][4] was just easier and certainly a lot cheaper than buying Netscape's commercial web server or thinking about [IIS][5] or any of the other commercial options at the time." Behlendorf also acknowledges, "it's nice to have other people out there who can review my code and [to] work together with." + +There was also an "idealistic notion that tapped into that zeitgeist in the '90s," Behlendorf says. "This is a printing press. We can help people publish their own blogs, help people publish their own websites, and get as much content liberated as possible and digitized as possible. That was kind of the web movement. In particular, we felt it would be important to make sure that the printing presses remained in the hands of the people." + +### Founding the Apache Software Foundation + +Once the [Apache HTTPD][6] web server project grew to the point that 70% of the web was running on top of Apache HTTPD, it was clear to the project's participants that more structure was needed. + +As Behlendorf describes it: "It was still being built by a group of people whose only connection to each other was that they were all on an email mailing list. All had commit to a CVS repository. All had shell on a Unix box that I maintained off of _Wired_'s internet connection. And otherwise [we] had no formalism between us. In a way, that was liberating; in a way, we were like, 'yeah, you know, we don't need overhead, we don't need stuffy bureaucrats.'" + +Behlendorf and the others weren't interested in incorporating a for-profit company, given that they all had other projects and startups and weren't looking to make Apache HTTPD a full-time job. However, they recognized the legal risks of not having some sort of corporate shield, especially as the portfolio of Apache projects grew. + +As Behlendorf puts it: "What happens if somebody who owned a patent decided to file a patent lawsuit against the developers of Apache and wanted something as simple and modest as a dollar per copy? If they won—and given patent laws, they certainly could win—they'd seek those tens or hundreds of millions of dollars from the Apache developers. For that crime of giving away free software, we could lose our homes." + +In response, the Apache Software Foundation was incorporated in 1999 as a US 501(c)(3) charitable organization that was explicitly membership-based, in contrast to foundations like the Linux Foundation that are organized more along the lines of industry consortia. (The Linux Foundation is a US 501(c)(6) nonprofit mutual benefit corporation.) + +Behlendorf observes that there are a lot of different models out there and he's happy "to see quite a few foundations out there and new ones showing up." Whatever the specific approach, however, he argues, "in general, if you're doing anything meaningful in open source software, your activities should be parked somewhere where there is a protective structure around it that helps answer the questions and the needs of the broader user community." + +### Joining blockchain + +Today, Behlendorf is executive director of the [Hyperledger Foundation][7], which he joined about three years ago, a few months after the first Hyperledger Fabric code drop in late 2015. He says, "with Hyperledger, one thing that pulled me in and got me excited was this notion that there are some really important problems we can solve with distributed systems, with distributed ledgers, and smart contract techniques. It wasn't programmable money, it wasn't regulatory arbitrage. It wasn't … the things people associate with cryptocurrencies that was the driver here. It was the sense that the digitalization of society had led to a future that looked a lot more like big, central systems. It was a very un-internet kind of worldview, but it seemed to be the trend line we were on." + +As a result, "blockchain technology seemed urgent to get involved in [and] that lined up with these idealistic and pragmatic impulses that I've had—and I think other people in open source have had," he adds. + +Specifically, it was the emergence of a set of use cases beyond programmable money that drew in Behlendorf. "I think the one that pulled me in was land titles and emerging markets," he recalls. It wasn't just about having a distributed database. It was about having a distributed ledger that "actually supported consensus, one that actually had the network enforcing rules about valid transactions versus invalid transactions. One that was programmable, with smart contracts on top. This started to make sense to me, and [it] was something that was appealing to me in a way that financial instruments and proof-of-work was not." + +Behlendorf makes the point that for blockchain technology to have a purpose, the network has to be decentralized. For example, you probably want "nodes that are being run by different technology partners or … nodes being run by end-user organizations themselves because otherwise, why not just use a central database run by a single vendor or a single technology partner?" he argues. + +### Growing open source today + +Behlendorf rounds out our interview by discussing how open source software has continued to grow in importance, often for totally pragmatic reasons. "I think there's an entirely rational, non-idealistic business argument for why we're seeing more and more companies, even the ones we traditionally associated with very proprietary business models, be it Microsoft, be it Uber, be it Facebook, actually recognizing open source is strategically interesting," Behlendorf says. + +He feels as if this is a continuation of the thinking the Apache Software Foundation had 20 years ago. "We thought that, if we just involved some of these parties in our projects and kept to our core principles of how to build software, of how our licenses work, how our development processes work publicly, if we made them play by our rules—we may still end up in a much better place and move further faster. I think that's been the story of the last 20 years,'" Behlendorf concludes. + +* * * + +**Listen to the [original podcast audio][8] [MP3, 28:42 minutes]. Download below.** + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/podcast-interview-brian-behlendorf + +作者:[Gordon Haff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ghaffhttps://opensource.com/users/wonderchookhttps://opensource.com/users/sachinpbhttps://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_container_block.png?itok=S8MbXEYw (Data container block with hexagons) +[2]: https://bitmason.blogspot.com/2019/08/hyperledgers-brian-behlendorf-on.html +[3]: https://www.apache.org/ +[4]: https://en.wikipedia.org/wiki/NCSA_HTTPd +[5]: https://en.wikipedia.org/wiki/Internet_Information_Services +[6]: https://en.wikipedia.org/wiki/Apache_HTTP_Server +[7]: https://www.hyperledger.org/ +[8]: https://grhpodcasts.s3.amazonaws.com/behlendorf_1908.mp3 diff --git a/sources/talk/20190916 3 strategies to simplify complex networks.md b/sources/talk/20190916 3 strategies to simplify complex networks.md new file mode 100644 index 0000000000..fa82881156 --- /dev/null +++ b/sources/talk/20190916 3 strategies to simplify complex networks.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 strategies to simplify complex networks) +[#]: via: (https://www.networkworld.com/article/3438840/3-strategies-to-simplify-complex-networks.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +3 strategies to simplify complex networks +====== +Innovations such as SD-WAN, Wi-Fi 6 and 5G have enabled networks to do more, but they’ve also made them complex. Software, machine learning, and automation will alleviate the problem. +Metamorworks / Getty Images + +As the cloud era meets the demands of digital transformation, networks must change. That means for enterprises, they must become simpler, said Juniper CEO Rami Rahim, speaking at the company's annual industry analyst conference last week. + +The past five years has seen more innovation in networking than in the previous 30. Things such as [SD-WAN][1], multi-cloud, [Wi-Fi 6][2], [5G][3], 400 Gig, and [edge computing][4] are on the near-term horizon for almost every company. While all of those technologies have enabled the network to do so much more than ever before, their complexity has also risen. + +[][5] Zeus Kerravala + +Juniper CEO Rami Rahim + +Network engineers face the harsh reality that they are being tasked with working faster but also more accurately to cut down on unplanned downtime. Networks must become simpler to run, which actually requires more engineering from the vendor. Think of the iPhone. It’s so simple, my dad can use it without calling me every hour. Making it easy requires a tremendous amount of innovation from Apple to mask the underlying complexity. + +**[ Related: [What is 5G wireless? And how it will change networking as we know it][6] ]** + +### How to simplify networks + +Vendors can help make networks simpler by executing on the following: + + * **Simplicity through software.** The pendulum has swung way too far on the “hardware doesn’t matter” theory. Of course it matters, particularly for networking where tasks such as deep-packet inspection, routing, and other functions are still best done in hardware. However, control and management of the hardware should be done in software because it can act as an abstraction layer for the underlying features in the actual boxes. For Juniper, Contrail Cloud and their software-delivered SD-WAN provides the centralized software overlay for simplified operations. + * **Machine learning-based operations.** Networks generate massive amounts of data that can use useful for operating the environment. The problem is that people can’t analyze the data fast enough to understand what it means – but machines can. This is where network professionals must be willing to cede some control to the computers. The purpose of machine learning isn’t to replace people, but to be a tool to let them work smarter and faster. [Juniper acquired Mist Systems earlier this year][7] to provide machine learning based operations to Wi-Fi, which is a great starting point because Wi-Fi troubleshooting is very difficult. Over time, I expect Mist’s benefit to be brought to the entire enterprise portfolio. + * **Vision of intent-based operations with purposeful automation.** The long-term goal of network operations is akin to a self-driving car where the network runs and secures itself. However, like with a self-driving car, the technology isn’t quite there yet. In the auto industry, there are many automation features, such as parallel park assist and lane change alerts that make drivers better. Similarly, network engineers can benefit by automating many of the mundane tasks associated with running a network, such as firmware upgrades, OS patching, and other things that need to be done but offer no strategic benefits. + + + +### To ASIC or not to ASIC + +As I mentioned, network hardware is still important. There’s currently a debate in the network industry as to whether companies like Juniper should be spinning their own silicon or leveraging merchant silicon. I believe ASICs allow vendors to bring new features to market faster than waiting for the silicon vendors to bake them into their chips. ASICs also give the network equipment manufacturer better control over product roadmaps. + +However, there is a wide range of silicon vendors that offer chips for a multitude of use cases that might be hard to replicate in custom chips. Also, some of the cloud providers know the specific feature set they are looking for and will dictate they want something like a Barefoot – Tofino-based switch. In this case, merchant silicon would provide a time to market advantage over custom. But both approaches are viable as long as the vendor has a clear roadmap and strategy of how to take advantage of hardware and software. + +Historically, Juniper has done a great job using custom chips for competitive advantage, and I don’t see that changing. Buyers should not shy away from one approach or the other. Rather they should look at vendor roadmaps and choose the one that meets its needs best. + +There’s no shortage of innovation in networking today, but new features and functions without simplicity can wreak havoc on a network and make things worse. One of my general rules of thumb for IT projects is that the solutions must be simpler than the original issue, and that’s not often the case in networking. Simplifying the network through software, machine learning, and automation enables businesses to take advantage of the new features without the risk associated with complexity. + +**[ Learn more about SDN: Find out [where SDN is going][8] and learn the [difference between SDN and NFV][9]. | Get regularly scheduled insights by [signing up for Network World newsletters][10]. ]** + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438840/3-strategies-to-simplify-complex-networks.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]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3311921/wi-fi-6-is-coming-to-a-router-near-you.html +[3]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[4]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[5]: https://images.idgesg.net/images/article/2019/09/juniper-ceo-rami-rahim-100811037-orig.jpg +[6]: https://www.networkworld.com/article/3203489/lan-wan/what-is-5g-wireless-networking-benefits-standards-availability-versus-lte.html +[7]: https://www.networkworld.com/article/3353042/juniper-grabs-mist-for-wireless-ai-cloud-service-delivery-technology.html +[8]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html +[9]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html +[10]: https://www.networkworld.com/newsletters/signup.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190916 How Cloud Billing Can Benefit Your Business.md b/sources/talk/20190916 How Cloud Billing Can Benefit Your Business.md new file mode 100644 index 0000000000..9e57b5b019 --- /dev/null +++ b/sources/talk/20190916 How Cloud Billing Can Benefit Your Business.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Cloud Billing Can Benefit Your Business) +[#]: via: (https://opensourceforu.com/2019/09/how-cloud-billing-can-benefit-your-business/) +[#]: author: (Aashima Sharma https://opensourceforu.com/author/aashima-sharma/) + +How Cloud Billing Can Benefit Your Business +====== + +[![][1]][2] + +_The Digital Age has led to many changes in the way we do business, and also in the way that businesses are run on a day to day basis. Computers are now ubiquitous – even in the smallest of businesses – and are utilised for a wide variety of purposes. When it comes to making things easier, a particularly efficient use of computer technology and software is cloud billing. Let us explain in a little more detail what it’s all about._ + +**What Cloud Billing?** +The idea of [_cloud billing_][3] is relatively simple. Cloud billing is designed to enable the user to perform a number of functions essential to the business – and it can be used in any business – without taking up unnecessary space on computer services. For example, you can use a cloud billing solution to ensure that invoices are sent at a certain time, subscriptions are efficiently managed, discounts are applied and many more regular or one-off functions. + +![Figure 1: Tridens Monetization][4] + +**How Cloud Billing Platform Can Benefit Your Business** +Let’s have a quick look at some of the major benefits of a cloud billing platform: + + * Lower costs on IT services: a cloud billing system, like any cloud-based IT solution, does not need to take up any space on your server. Nor does it require you to purchase software or hardware. You don’t need to engage the services of an IT professional, it’s all done via the service provider. + * Reduced operating costs: there is little in the way of operating costs when you use a cloud billing solution, as there is no extra equipment to maintain. + * Faster product to market: if you are rolling out new products or services on a regular basis, a cloud billing solution means you can cut out a lot of time that would normally be take up with the process. + * Grow with the business: if in the future you need to expand or add to your cloud billing solution, you can, and without any additional equipment or software. You pay for what you need and use, and no more. + * Quick start: once you decide you want to use cloud billing, there is very little to do before you are ready to go. No software to install, no computer servers or network, it’s all in the cloud. + + + +There are many more benefits to engaging the services of a cloud billing solutions provider, and finding the right one – a service provider you can trust and with whom you can build a reliable working relationship – is the important part of the deal. + +**Where to Get the Best Cloud Billing Platform?** +The market for cloud-based billing services is one that hotly contested, and there are many potential options for your business. There are many Cloud billing available, you can try [_Tridens Monetization_][3] or any of the open source billing software solutions that may be suitable for your business. + +Where the best cloud billing solutions come to the fore is in providing real-time ability and flexibility for various areas of industry and commerce. They are ideal, for example, for use in media and communications, in education and utilities, and in the healthcare industry as well as many others. No matter the size, type or are of your business, a cloud-based billing platform offers not just a cost-saving opportunity, but it will also help accelerate growth, engender brand loyalty thanks to more efficient service, and more. + +Use a cloud billing solution for recurring billing purposes, for invoicing and revenue management, or for producing a range of reports and real-time analysis of your business performance, and all without the need for expensive hardware and software, or costly in-house IT experts. The best such solutions can be connected to many payment gateways, can handle your business tax requirements, and will reduce the workload on your team, so that each can dedicate their time to what they do best. + +**Summary** +Put simply, your business needs a cloud billing platform if you want to grow, improve your efficiency – both for you and your clients – without the need for great expenditure and restructuring. We recommend you check it out further, and talk to the experts in more detail about your cloud billing requirements. + +**By: Alivia Mallan** + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/how-cloud-billing-can-benefit-your-business/ + +作者:[Aashima Sharma][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://opensourceforu.com/author/aashima-sharma/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/01/Young-man-with-the-head-in-the-clouds-thinking_15259762_xl.jpg?resize=579%2C606&ssl=1 (Young man with the head in the clouds thinking_15259762_xl) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/01/Young-man-with-the-head-in-the-clouds-thinking_15259762_xl.jpg?fit=579%2C606&ssl=1 +[3]: https://tridenstechnology.com/monetization/ +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/diagram-monetization-infinite-v2-1.png?resize=350%2C196&ssl=1 diff --git a/sources/talk/20190917 3 steps to developing psychological safety.md b/sources/talk/20190917 3 steps to developing psychological safety.md new file mode 100644 index 0000000000..ee77789bc4 --- /dev/null +++ b/sources/talk/20190917 3 steps to developing psychological safety.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 steps to developing psychological safety) +[#]: via: (https://opensource.com/open-organization/19/9/psychological-safety-leadership-behaviors) +[#]: author: (Kathleen Hayes https://opensource.com/users/khayes4dayshttps://opensource.com/users/khayes4dayshttps://opensource.com/users/mdoyle) + +3 steps to developing psychological safety +====== +The mindsets, behaviors, and communication patterns necessary for +establishing psychological safety in our organizations may not be our +defaults, but they are teachable and observable. +![Brain map][1] + +Psychological safety is a belief that one will not be punished or humiliated for speaking up with ideas, questions, concerns, or mistakes. And it's critical for high-performing teams in open organizations. + +Part one of this series introduced the concept of [psychological safety][2]. In this companion article, I'll recount my personal journey toward understanding psychological safety—and explain the fundamental shifts in mindset, behavior, and communication that anyone hoping to create psychologically safe teams and environments will need to make. + +### Mindset: Become the learner + +I have participated in a number of corporate cultures that fostered a "gotcha" mindset—one in which people were poised to pounce when something didn't go according to plan. Dropping this deeply ingrained mindset was a requirement for achieving psychological safety, and doing _that_ required a fundamental shift in the way I lived my life. + +_Guiding value: Become the learner, not the knower._ + +Life is a process; achieving perfection will never happen. Similarly, building an organization is a process; there is no "we've got it now" state. In most cases, we're traversing unchartered territories. Enormous uncertainty lies ahead. [We can't know what will happen][3], which is why it was important for me to become the learner in work, just as in life. + +On my first day as a new marketing leader, a team member was describing their collaboration with engineering and told me about "the F-You board." If a new program was rolled out and engineers complained that it missed the mark, was wrong, or was downright ridiculous, someone placed a tally on the F-You whiteboard. When they'd accumulated ten, the team would go out drinking. + +There is a lot to unpack in this dynamic. For our purposes, however, let's focus on a few actionable steps that helped me reframe the "gotcha" mentality into a learning mindset. + +First, I shaped marketing programs and campaigns as experiments, using the word "experiment" with intention not just _within_ the marketing department but _across_ the entire organization. Corporate-wide communications about upcoming rollouts concluded with, "If you see any glaring omissions or areas for refinement, please let me know," inviting engineers to surface blind spots and bring forward solutions—rather than point fingers after the work had concluded. + +Only after shifting my perspective from that of the knower to that of the learner did I open a genuine desire to understand another's perspective. + +Next, to stimulate the learning process in myself and others, I began fostering a "[try, learn, modify][4]" mindset, in which setbacks are not viewed as doomsday failures but as opportunities for clarification and improvement. To recover quickly when something doesn't go according to plan, I would ask four key questions: + + * What did we set out to do? + * What happened? + * What did we learn? + * How quickly can we improve upon it? + + + +It's nearly impossible for every project to be a home run. Setbacks will occur. As the ground-breaking research on psychological safety revealed, [learning happens through vulnerable conversations][5]. When engaged in psychologically safe environments, we can use these moments to cultivate more learning and less defensiveness. + +### Behavior: Model curiosity + +One way we can help our team drop their defensiveness is by _modeling curiosity_. + +As the "knower," I was adept at command and control. Quite often this meant playing the devil's advocate and shaming others into submitting to my point of view. + +In a meeting early in my career as a vice president, a colleague was rolling out a new program and asked each executive to share feedback. I was surprised as each person around the table gave a thumbs up. I had reservations about the direction and was concerned that no one else could see the issues that seemed so readily apparent to me. Rather than asking for clarification and [stimulating a productive dialog][6], I simply quipped, "Am I the only one that hasn't [sipped the purple Kool-Aid][7]?" Not my finest moment. + +As I look back, this behavior was fueled by a mixture of fear and overconfidence, a hostile combination resulting in a hostile psychological attitude. I wasn't curious because I was too busy being right, being the knower. By becoming the learner, I let a genuine interest in understanding others' perspectives come to the forefront. This helped me more deeply understand a fundamental fact about the human condition. + +_Guiding value: Situations are rarely, if ever, crystal clear._ + +The process of understanding is dynamic. We are constantly moving along a continuum from clear to unclear and back again. For large teams, this swing is more pronounced as each member brings a unique perspective to bear on an issue. And rightly so. There are seven billion people on this planet; it's nearly impossible for everyone to see a situation the same way. + +Recalibrating this attitude—the devil's advocate attitude of "I disagree" to the learner's space and behavior of "help me see what you see"—took practice. One thing that worked for me was intentionally using the phrase "I have a different perspective to share" when offering my opinion and, when clarifying, saying, "That is not consistent with my understanding. Can you tell me more about your perspective?" These tactics helped me move from my default of knowing and convincing. I also asked a trusted team member to privately point out when something or someone had triggered my old default. Over time, my self-awareness matured and, with practice, the intentional tactics evolved into a learned behavior. + +As I look back, this behavior was fueled by a mixture of fear and overconfidence, a hostile combination resulting in a hostile psychological attitude. I wasn't curious because I was too busy being right, being the knower. + +I feel compelled to share that without the right mindset these tactics would have been cheap communication gimmicks. Only after shifting my perspective from that of the knower to that of the learner did I open a genuine desire to understand another's perspective. This allowed me to develop the capacity to model curiosity and open the space for my team members—and me—to explore ideas with safety, vulnerability, and respect. + +### Communication: Deliver productive feedback + +Psychological safety does not imply a cozy situation in which people are necessarily close friends, nor does it suggest an absence of pressure or problems. When problems inevitably arise, we must hold ourselves and others accountable and deliver feedback without tiptoeing around the truth, or playing the blame game. However, giving productive feedback is [a skill most leaders have never learned][8]. + +_Guiding value: Clear is kind; unclear is unkind._ + +When problems arise during experiments in marketing, I am finding team communication to be incredibly productive when using that _try, learn, modify_ approach and modeling curiosity. One-on-one conversations about real deficits, however, have proven more difficult. + +I found so many creative reasons to delay or avoid these conversations. In a fast-paced startup, one of my favorites was, "They've only been in this role for a short while. Give them more time to get up to speed." That was an unfortunate approach, especially when coupled later with vague direction, like, "I need you to deliver more, more quickly." Because I was unable to clearly communicate what was expected, team members were not clear on what needed to be improved. This stall tactic and belittling innuendo masquerading as feedback was leading to more shame and blame than learning and growth. + +In becoming the learner, the guiding value of "clear is kind, unclear is unkind," crystalized for me when studying _Dare to Lead_. In her work, [Brené Brown explains][9]: + + * Feeding people half-truths to make them feel better, which is almost always about making ourselves feel more comfortable, is unkind. + * Not getting clear with people about your expectations because it feels too hard, yet holding them accountable or blaming them for not delivering, is unkind. + + + +Below are three actionable tips that are helping me deliver more clear, productive feedback. + +**Get specific.** Point to the specific lack in proficiency that needs to be addressed. Tie your comments to a shared vision of how this impacts career progression. When giving feedback on behavior, stay away from character and separate person from process. + +**Allow people to have feelings.** Rather than rushing in, give them space to feel. Learn how to hold the discomfort. + +**Think carefully about how you want to show up**. Work through how your conversation may unfold and where you might trigger blaming behaviors. Knowing puts you in a safer mindset for having difficult conversations. + +Teaching team members, reassessing skill gaps, reassigning them (or even letting them go) can become more empathetic processes when "clear is kind" is top of mind for leaders. + +### Closing + +The mindsets, behaviors, and communication patterns necessary for establishing psychological safety in our organizations may not be our defaults, but they are teachable and observable. Stay curious, ask questions, and deepen your understanding of others' perspectives. Do the difficult work of holding yourself and others accountable for showing up in a way that's aligned with cultivating a culture where your creativity—and your team members—thrive. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/9/psychological-safety-leadership-behaviors + +作者:[Kathleen Hayes][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/khayes4dayshttps://opensource.com/users/khayes4dayshttps://opensource.com/users/mdoyle +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_art-mindmap-520.png?itok=qQVBAoVw (Brain map) +[2]: https://opensource.com/open-organization/19/3/introduction-psychological-safety +[3]: https://opensource.com/open-organization/19/5/planning-future-unknowable +[4]: https://opensource.com/open-organization/18/3/try-learn-modify +[5]: https://www.youtube.com/watch?v=LhoLuui9gX8 +[6]: https://opensource.com/open-organization/19/5/productive-arguments +[7]: https://opensource.com/open-organization/15/7/open-organizations-kool-aid +[8]: https://opensource.com/open-organization/19/4/be-open-with-difficult-feedback +[9]: https://brenebrown.com/articles/2018/10/15/clear-is-kind-unclear-is-unkind/ diff --git a/sources/talk/20190917 How Ansible brought peace to my home.md b/sources/talk/20190917 How Ansible brought peace to my home.md new file mode 100644 index 0000000000..f569ba5f3d --- /dev/null +++ b/sources/talk/20190917 How Ansible brought peace to my home.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Ansible brought peace to my home) +[#]: via: (https://opensource.com/article/19/9/ansible-documentation-kids-laptops) +[#]: author: (James Farrell https://opensource.com/users/jamesfhttps://opensource.com/users/jlozadadhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/marcobravo) + +How Ansible brought peace to my home +====== +Configuring his young daughters' computers with Ansible made it simple +for this dad to manage the family's computers. +![Coffee and laptop][1] + +A few months ago, I read Marco Bravo's article [_How to use Ansible to document procedures_][2] on Opensource.com. I will admit, I didn't quite get it at the time. I was not actively using [Ansible][3], and I remember thinking it looked like more work than it was worth. But I had an open mind and decided to spend time looking deeper into Ansible. + +I soon found an excuse to embark on my first real Ansible adventure: repurposing old laptops like in [_How to make an old computer useful again_][4]. I've always liked playing with old computers, and the prospect of automating something with modern methods piqued my interest. + +### The task + +Earlier this year, I gave my seven-year-old daughter a repurposed Dell Mini 9 running some flavor of Ubuntu. At first, my six-year-old daughter didn't care much about it, but as the music played and she discovered the fun programs, her interest set in. + +I realized I would need to build another one for her soon. And any parent with small children close in age can likely identify with my dilemma. If both children don't get identical things, conflicts will arise. Similar toys, similar clothes, similar shoes … sometimes the color, shape, and blinking lights must be identical. I am sure they would notice any difference in laptop configuration, and it would become a point of contention. Therefore, I needed these laptops to have identical functionality. + +Also, with small children in the mix, I suspected I would be rebuilding these things a few times. Failures, accidents, upgrades, corruptions … this threatened to become a time sink. + +Since two young girls sharing one Dell Mini 9 was not really a workable solution, I grabbed a Dell D620 from my pile of old hardware, upgraded the RAM, put in an inexpensive SSD, and started to cook up a repeatable process to build the children's computer configuration. + +If you think about it, this task seems ideal for a configuration management system. I needed something to document what I was doing so it could be easily repeatable. + +### Ansible to the rescue + +I didn't try to set up a full-on pre-boot execution environment (PXE) to support an occasional laptop install. I wanted to teach my children to do some of the installation work for me (a different kind of automation, ha!). + +I decided to start from a minimal OS install and eventually broke down my Ansible approach into three parts: bootstrap, account setup, and software installation. I could have put everything into one giant script, but separating these functions allowed me to mix and match them for other projects and refine them individually over time. Ansible's YAML file readability helped keep things clear as I refined my systems. + +For this laptop experiment, I decided to use Debian 32-bit as my starting point, as it seemed to work best on my older hardware. The bootstrap YAML script is intended to take a bare-minimal OS install and bring it up to some standard. It relies on a non-root account to be available over SSH and little else. Since a minimal OS install usually contains very little that is useful to Ansible, I use the following to hit one host and prompt me to log in with privilege escalation: + + +``` +`$ ansible-playbook bootstrap.yml -i '192.168.0.100,' -u jfarrell -Kk` +``` + +The script makes use of Ansible's [raw][5] module to set some base requirements. It ensures Python is available, upgrades the OS, sets up an Ansible control account, transfers SSH keys, and configures sudo privilege escalation. When bootstrap completes, everything should be in place to have this node fully participate in my larger Ansible inventory. I've found that bootstrapping bare-minimum OS installs is nuanced (if there is interest, I'll write another article on this topic). + +The account YAML setup script is used to set up (or reset) user accounts for each family member. This keeps user IDs (UIDs) and group IDs (GIDs) consistent across the small number of machines we have, and it can be used to fix locked accounts when needed. Yes, I know I could have set up Network Information Service or LDAP authentication, but the number of accounts I have is very small, and I prefer to keep these systems very simple. Here is an excerpt I found especially useful for this: + + +``` +\--- +\- name: Set user accounts +  hosts: all +  gather_facts: false +  become: yes +  vars_prompt: +    - name: passwd +      prompt: "Enter the desired ansible password:" +      private: yes + +  tasks: +  - name: Add child 1 account +    user: +      state: present +      name: child1 +      password: "{{ passwd | password_hash('sha512') }}" +      comment: Child One +      uid: 888 +      group: users +      shell: /bin/bash +      generate_ssh_key: yes +      ssh_key_bits: 2048 +      update_password: always +      create_home: yes +``` + +The **vars_prompt** section prompts me for a password, which is put to a Jinja2 transformation to produce the desired password hash. This means I don't need to hardcode passwords into the YAML file and can run it to change passwords as needed. + +The software installation YAML file is still evolving. It includes a base set of utilities for the sysadmin and then the stuff my users need. This mostly consists of ensuring that the same graphical user interface (GUI) interface and all the same programs, games, and media files are installed on each machine. Here is a small excerpt of the software for my young children: + + +``` + - name: Install kids software +    apt: +      name: "{{ packages }}" +      state: present +    vars: +      packages: +     - lxde +      - childsplay +      - tuxpaint +      - tuxtype +      - pysycache +      - pysiogame +      - lmemory +      - bouncy +``` + +I created these three Ansible scripts using a virtual machine. When they were perfect, I tested them on the D620. Then converting the Mini 9 was a snap; I simply loaded the same minimal Debian install then ran the bootstrap, accounts, and software configurations. Both systems then functioned identically. + +For a while, both sisters enjoyed their respective computers, comparing usage and exploring software features. + +### The moment of truth + +A few weeks later came the inevitable. My older daughter finally came to the conclusion that her pink Dell Mini 9 was underpowered. Her sister's D620 had superior power and screen real estate. YouTube was the new rage, and the Mini 9 could not keep up. As you can guess, the poor Mini 9 fell into disuse; she wanted a new machine, and sharing her younger sister's would not do. + +I had another D620 in my pile. I replaced the BIOS battery, gave it a new SSD, and upgraded the RAM. Another perfect example of breathing new life into old hardware. + +I pulled my Ansible scripts from source control, and everything I needed was right there: bootstrap, account setup, and software. By this time, I had forgotten a lot of the specific software installation information. But details like account UIDs and all the packages to install were all clearly documented and ready for use. While I surely could have figured it out by looking at my other machines, there was no need to spend the time! Ansible had it all clearly laid out in YAML. + +Not only was the YAML documentation valuable, but Ansible's automation made short work of the new install. The minimal Debian OS install from USB stick took about 15 minutes. The subsequent shape up of the system using Ansible for end-user deployment only took another nine minutes. End-user acceptance testing was successful, and a new era of computing calmness was brought to my family (other parents will understand!). + +### Conclusion + +Taking the time to learn and practice Ansible with this exercise showed me the true value of its automation and documentation abilities. Spending a few hours figuring out the specifics for the first example saves time whenever I need to provision or fix a machine. The YAML is clear, easy to read, and—thanks to Ansible's idempotency—easy to test and refine over time. When I have new ideas or my children have new requests, using Ansible to control a local virtual machine for testing is a valuable time-saving tool. + +Doing sysadmin tasks in your free time can be fun. Spending the time to automate and document your work pays rewards in the future; instead of needing to investigate and relearn a bunch of things you've already solved, Ansible keeps your work documented and ready to apply so you can move onto other, newer fun things! + +I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/ansible-documentation-kids-laptops + +作者:[James Farrell][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/jamesfhttps://opensource.com/users/jlozadadhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://opensource.com/article/19/4/ansible-procedures +[3]: https://www.ansible.com/ +[4]: https://opensource.com/article/19/7/how-make-old-computer-useful-again +[5]: https://docs.ansible.com/ansible/2.3/raw_module.html diff --git a/sources/talk/20190918 Election fraud- Is there an open source solution.md b/sources/talk/20190918 Election fraud- Is there an open source solution.md new file mode 100644 index 0000000000..775afe501a --- /dev/null +++ b/sources/talk/20190918 Election fraud- Is there an open source solution.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Election fraud: Is there an open source solution?) +[#]: via: (https://opensource.com/article/19/9/voting-fraud-open-source-solution) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyashttps://opensource.com/users/mbrownhttps://opensource.com/users/luis-ibanezhttps://opensource.com/users/jhibbets) + +Election fraud: Is there an open source solution? +====== +The Trust The Vote project is developing open source technology to help +keep elections honest. +![Team checklist][1] + +Can open source technology help keep our elections honest? With its [Trust The Vote Project][2], the [Open Source Election Technology (OSET) Institute][3] is working on making that a reality for elections in the United States and around the world. + +The project is developing an open, adaptable, flexible, full-featured, and innovative elections technology platform called [ElectOS][4]. It will support all aspects of elections administration and voting, including creating, marking, casting, and counting ballots and managing all back-office functions. The software is freely available under an Open Source Initiative (OSI)-recognized public license for adoption, adaptation, and deployment by anyone, including elections jurisdictions directly or, more commonly, commercial vendors or systems integrators. + +With elections coming under more and more scrutiny due to vulnerable designs, aging machinery, hacking, foreign influence, and human incompetence, the OSET Institute is working on technology that will help ensure that every vote is counted as it was cast. + +### Mississippi churning + +The Mississippi Republican gubernatorial primary in August 2019 was called into question when a voting machine malfunctioned, denying a vote for candidate Bill Waller as the machine changed it to his opponent, Tate Reeves. The incident was [caught on camera][5]. + +"Around 40 states have voting machines that are a decade old or older," J. Alex Halderman, a computer science professor at the University of Michigan, tells [Politifact][6]. "There are reports of machines misbehaving in this manner after almost every election." That's rather alarming. Can open source be a solution to this problem? + +The OSET Institute was founded in January 2007 by venture capital advisers who are alumni of Apple, Mozilla, Netscape, and Sun Microsystems. It is a non-partisan, non-profit 501(c)3 organization that researches and designs public technology—open source technology—for use in the US and around the world. + +"For a long time, there have been systemic problems—market malformation and dysfunction—in the election industry. Due to market dynamics and industry performance issues, there has been no commercial incentive to make the investment in the necessary research and development to produce the kind of high-assurance, mission-critical systems for verifiable and accurate elections," says Gregory Miller, co-founder and COO of the OSET Institute. + +Reflecting back to the 2000 presidential election between Vice President Al Gore and Texas Governor George W. Bush, Miller says: "Nobody was thinking about digital attacks during the ['chadfest' of Florida][7] and even as recently as 2007." Miller adds that one of the most important aspects of public technology is that it must be entirely trustworthy. + +### Essential election technologies + +Most voting systems in use are based around proprietary, black-box hardware and software built on 1990s technology—Windows 2000 or older. Some newer machines are running Windows 7—which is scheduled to lose maintenance and support in January 2020. + +Miller says there are two crucial parts of the election process: the election administration systems and the voting systems. + + * Election administration systems in the back office are responsible for elections setup, administration, and operation, especially casting and counting ballots; voter registration; ballot design, layout, and distribution; poll-book configuration; ballot-marking device configuration; and election results reporting and analytics. + * Voting systems are simply the ballot marking, casting, and counting components. + + + +The most important element of the system is the bridge between the voting systems in polling places and the back-office administration systems. This behind-the-scenes process aggregates vote tallies into tabulations to determine the results. + +The key device—and arguably the Achilles Heel of the entire ecosystem—is the election management system (EMS), which is the connection between election administration and the voting systems. The EMS machine is a back-office element but also a component of the voting system. Because the EMS software typically resides on a desktop machine used for a variety of government functions that serve citizens, it is the element most vulnerable to attacks. + +Despite the vote-changing problem in the Mississippi primary, Miller warns, "the vulnerability of attack is not to the voting machinery in the polling place but to the tabulation component of the back-office EMS or other vital configuration tools, including the configuration of poll books (those stacks of papers, binders, or … apps that check a voter in to cast a ballot). As a result, attackers need only to find a highly contentious swing state precinct to be disruptive." + +### Code causes change + +Because voting security vulnerabilities are largely software-based, "code causes change," Miller declares. But, there are barriers to getting this done in time for the next US presidential election in November 2020. Foremost is the fact that there is little time left for OSET's team of 12 full-time people to finish the core voting platform and create separate EMS and voting system components, all based on a non-black box, non-proprietary model that uses public, open source technology with off-the-shelf hardware. + +However, there is a lot more to do in addition to developing code for off-the-shelf hardware. OSET is developing new open data standards with NIST and the Elections Assistance Commission (EAC). A new component-based certification process must be invented, and new design guidelines must be issued. + +Meanwhile, service contracts that last for decades or more are protecting legacy vendors and making migration to new systems a challenge. Miller explains, "there are three primary vendors that control 85% of voting systems in the US and 70% globally; with the barriers to entry that exist, it will take a finished system to display the opportunity for change." + +Getting there with open code is a process too. Miller says, "there is a very closely managed code-commit process, and the work faces far more scrutiny than an open source operating system, web server, or [content management system]. So, we are implementing a dual-sandbox model where one allows for wide-ranging, free-wheeling development and contributions. The other is the controlled environment that must pass security muster with the federal government in order for states to feel confident that the actual code for production systems is verifiable, accurate, secure, and transparent. We'll use a process for [passing] code across a review membrane that enables work in the less secure environment to be committed to the production environment. It's a process still in design." + +The licenses are a bit complex: for governments or vendors that have regulatory issues with procuring and deploying commercial systems comprised of open source software, commercial hardware, and professional services, OSET offers the OSET Public License (OPL), an OSI-approved open source license based on the Mozilla Public License. For other research, development, and non-commercial use, or commercial use where certain procurement regulations are not an issue, the code is available under the GPL 2.0 license. + +Of OSET's activities, Miller says, "85% is code development—a democracy software foundry. Another 10% is cybersecurity advisory for election administrators, and the final 5% of OSET's activity is public policy work (we are informers, not influencers in legislation). As a 501(c)3, we can not—and do not—perform lobbying, but a portion of our mission is education. So, our work remains steadfastly nonpartisan and philanthropically funded by grant-making organizations and the public. + +Explains Miller: "We have a fairly straightforward charter: to build a trustworthy codebase that can exist on an inherently untrustworthy hardware base. Certain types of election administration apps and services can live in the cloud, while the voting system—a marriage of that software layer and hardware, federally certified to be deployed—must be built up from a hardened Linux kernel. So, a portion of our R&D lies in the arenas of trusted boot with hardware attestation and other important security architectures such as computer-assisted code randomization and so forth." + +### Work with the code + +There are two levels of access for people who want to work with the OSET Institute's Trust the Vote code. One is to contact the project to request access to certain code to advance development efforts; all legitimate requests will be honored, but the code is not yet accessible in the public domain. The other access point is to the extensive work that the OSET Institute has done for third-party voter registration systems, such as Rock The Vote. That source code is publicly available [online][8]. + +One component of this is [RockyOVR][9] for online voter registration services (it is operated by the OSET Institute and Rock The Vote with support from AWS). Another is [Grommet][10], an Android-native mobile app used by voter registration drives. [Siggy][11] and [VoteReady][12] are prototypes for new voter services under development that will be announced soon. + +The OSET Institute is continually on the lookout for talented volunteers to advance the project. Top needs include system architecture and engineering and software development for both cloud-based and offline applications. These are not entry-level projects or positions, and in some cases, they require advanced skills in BIOS and firmware development; operating system internals; device drivers; and more. + +All developers at the OSET Institute start as volunteers, and the best are moved into contract and staff positions, as project funding allows, in a meritocratic process. The Institute is based in Palo Alto, Calif., but operations are distributed and virtual with offices and centers of development excellence in Arlington, Va.; Boston; Mountain View, Calif.; Portland, Ore.; San Francisco; and the University of Edinburgh, Scotland. + +The Open Election Data Initiative wants to give access to election data for a true picture of an... + +The pernicious effects of closed proprietary software reaches its peak of damaging the general... + +One of the ways Obama won the 2012 election was with technology. It wasn’t the only way, but... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/voting-fraud-open-source-solution + +作者:[Jeff Macharyas][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/jeffmacharyashttps://opensource.com/users/mbrownhttps://opensource.com/users/luis-ibanezhttps://opensource.com/users/jhibbets +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://trustthevote.org/ +[3]: https://www.osetfoundation.org/ +[4]: https://bit.ly/EOSt1 +[5]: https://twitter.com/STaylorRayburn/status/1166347828152680449 +[6]: https://www.politifact.com/truth-o-meter/article/2019/aug/29/viral-video-voting-machine-malfunction-mississippi/ +[7]: https://en.wikipedia.org/wiki/2000_United_States_presidential_election_in_Florida +[8]: https://github.com/TrustTheVote-Project +[9]: https://github.com/TrustTheVote-Project/Rocky-OVR +[10]: https://github.com/TrustTheVote-Project/Grommet +[11]: https://github.com/TrustTheVote-Project/Siggy +[12]: https://github.com/TrustTheVote-Project/VoteReady diff --git a/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md b/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md new file mode 100644 index 0000000000..6fbfa24bb0 --- /dev/null +++ b/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Protocols That Help Things to Communicate Over the Internet) +[#]: via: (https://opensourceforu.com/2019/09/the-protocols-that-help-things-to-communicate-over-the-internet/) +[#]: author: (Sapna Panchal https://opensourceforu.com/author/sapna-panchal/) + +The Protocols That Help Things to Communicate Over the Internet +====== + +[![][1]][2] + +_The Internet of Things is a system of connected, interrelated objects. These objects transmit data to servers for processing and, in turn, receive messages from the servers. These messages are sent and received using different protocols. This article discusses some of the protocols related to the IoT._ + +The Internet of Things (IoT) is beginning to pervade more and more aspects of our lives. Everyone, everywhere is using the Internet of Things. Using the Internet, connected things are used to collect information, convey/send information back, or do both. IoT is an architecture that is a combination of available technologies. It helps to make our daily lives more pleasant and convenient. + +![Figure 1: IoT architecture][3] + +![Figure 2: Messaging Queuing Telemetry protocol][4] + +**IoT architecture** +Basically, IoT architecture has four components. In this article, we will explore each component to understand the architecture better. + + * **Sensors:** These are present everywhere. They help to collect data from any location and then share it to the IoT gateway. As an example, sensors sense the temperature at different locations, which helps to gauge the weather conditions. And this information is shared or passed to the IoT gateway. This is a basic example of how the IoT operates. + * **IoT gateway:** Once the information is collected from the sensors, it is passed on to the gateway. The gateway is a mediator between sensor nodes and the World Wide Web. So basically, it processes the data that is collected from sensor nodes and then transmits this to the Internet infrastructure. + * **Cloud server:** Once data is transmitted through the gateway, it is stored and processed in the cloud server. + * **Mobile app:** Using a mobile application, the user can view and access the data processed in the cloud server. + + + +This is the basic idea of the IoT and its architecture, along with the components. We now move on to the basic ideas behind different IoT protocols. + +**IoT protocols** +As mentioned earlier, connected things are used to collect information, convey/send information back, or do both, using the Internet. This is the fundamental basis of the IoT. To convey/send information, we need a protocol, which is a set of procedures that is used to transmit the data between electronic devices. +Essentially, we have two types of IoT protocols — the IoT network protocols and the IoT data protocols. This article discusses the IoT data protocols. + +![Figure 3: Advance Message Queuing Protocol][5] + +![Figure 4: CoAP][6] + +**MQTT** +The Messaging Queuing Telemetry Transmit (MQTT) protocol was primarily designed for low bandwidth networks, but is very popular today as an IoT protocol. It is used to exchange data between clients and the server. It is a lightweight messaging protocol. + +This protocol has many advantages: + + * It is small in size and has low power usage. + * It is a lightweight protocol. + * It is based on low network usage. + * It works entirely in real-time. + + + +Considering all the above reasons, MQTT emerges as the perfect IoT data protocol. + +**How MQTT works:** MQTT is based on a client-server relationship. The server manages the requests that come from different clients and sends the required information to clients. MQTT is based on two operations. +i) _Publish:_ When the client sends data to the MQTT broker, this operation is known as ‘Publish’. +ii) _Subscribe:_ When the client receives data from the broker, this operation is known as‘Subscribe’. + +The MQTT broker is the mediator that handles these operations, primarily taking messages and delivering them to the application or client. + +Let’s look at the example of a device temperature sensor, which sends readings to the MQTT broker, and then information is delivered to desktop or mobile applications. As stated earlier, ‘Publish’ means sending readings to the MQTT broker and ‘Subscribe’ means delivering the information to the desktop/mobile application. + +**AMQP** +Advanced Message Queuing Protocol is a peer-to-peer protocol, where one peer plays the role of the client application and the other peer plays the role of the delivery service or broker. It is the combination of hard and fast components that basically routes and saves messages within the delivery service or broker carrier. + +The benefits of AMQP are: + + * It helps to send messages without them getting missed out. + * It helps to guarantee a ‘one-time only’ and secured delivery. + * It provides a secure connection. + * It always supports acknowledgments for message delivery or failure. + + + +**How AMQP works and its architecture:** The AMQP architecture is made up of the following parts. + +_**Exchange**_ – Messages that come from the publisher are accepted by Exchange, which routes them to the message queue. + +_**Message queue**_ – This is the combination of multiple queues and is helpful for processing the messages. + +_**Binding**_ – This helps to maintain the connectivity between Exchange and the message queue. +The combination of Exchange and the message queues is known as the broker or AMQP broker. + +![Figure 5: Constrained Application Protocol architecture][7] + +**Constrained Application Protocol (CoAP)** +This was initially used as a machine-to-machine (M2M) protocol, and later began to be used as an IoT protocol. It is a Web transfer protocol that is used with constrained nodes and constrained networks. CoAP uses the RESTful architecture, just like the HTTP protocol. +The advantages CoAP offers are: + + * It works as a REST model for small devices. + * As this is like HTTP, it’s easy for developers to work on. + * It is a one-to-one protocol for transferring information between the client and server, directly. + * It is very simple to parse. + + + +**How CoAP works and its architecture:** From Figure 4, we can understand that CoAP is the combination of ‘Request/Response and Message’. We can also say it has two layers – ‘Request/Response’and ‘Message’. +Figure 5 clearly explains that CoAP architecture is based on the client server relationship, where… + + * The client sends requests to the server. + * The server receives requests from the client and responds to them. + + + +**Extensible Messaging and Presence Protocol (XMPP)** +This protocol is used to exchange messages in real-time. It is used not only to communicate with others, but also to get information on the status of the user (away, offline, active). This protocol is widely used in real life, like in WhatsApp. +The Extensible Messaging and Presence Protocol should be used because: + + * It is free, open and easy to understand. Hence, it is very popular. + * It has secured authentication, is extensible and flexible. + + + +![Figure 6: Extensible Messaging and Presence Protocol][8] + +**How XMPP works and its architecture:** In the XMPP architecture, each client has a unique name associated with it and communicates to other clients via the XMPP server. The XMPP client has either the same domain or a different one. + +In Figure 6, the XMPP client belongs to the same domain in which one XMPP client sends the information to the XMPP server. The server translates it and conveys the information to another client. +Basically, this protocol is the backbone that provides universal connectivity between different endpoint protocols. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/the-protocols-that-help-things-to-communicate-over-the-internet/ + +作者:[Sapna Panchal][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://opensourceforu.com/author/sapna-panchal/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Internet-of-things-illustration.jpg?resize=696%2C439&ssl=1 (Internet of things illustration) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Internet-of-things-illustration.jpg?fit=1125%2C710&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-IoT-architecture.jpg?resize=350%2C133&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Messaging-Queuing-Telemetry-Transmit-protocol.jpg?resize=350%2C206&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-3-Advance-Message-Queuing-Protocol.jpg?resize=350%2C160&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-4-CoAP.jpg?resize=350%2C84&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-5-Constrained-Application-Protocol-architecture.jpg?resize=350%2C224&ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-6-Extensible-Messaging-and-Presence-Protocol.jpg?resize=350%2C46&ssl=1 diff --git a/sources/talk/20190918 The community-led renaissance of open source.md b/sources/talk/20190918 The community-led renaissance of open source.md new file mode 100644 index 0000000000..2cea5c3985 --- /dev/null +++ b/sources/talk/20190918 The community-led renaissance of open source.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The community-led renaissance of open source) +[#]: via: (https://opensource.com/article/19/9/community-led-renaissance) +[#]: author: (Donald Fischer https://opensource.com/users/dff) + +The community-led renaissance of open source +====== +Moving beyond the scarcity mindset of "open core." +![shapes of people symbols][1] + +With few commercial participants, early free software and open source communities were, by definition, community-led. Software was designed and created organically by communities of users in response to their needs and inspiration. The results, to a degree nobody predicted, were often magical. + +However, there were some missing pieces that prevented this magic from being unleashed at greater scale. As professional developers in larger organizations began to depend on open source software for key functions, they started looking for the same kinds of commercial support they were used to having for the proprietary software they purchased from companies like Microsoft, Oracle, and SAP. Someone to be accountable for fixing a new security vulnerability in a timely manner, or providing basic intellectual property assurances such as license verification and indemnification, or just delivering the everyday maintenance necessary to keep the software in good working order. + +First-generation open source businesses like Red Hat emerged to respond to these needs. They combined the best of both worlds: the flexibility and control of raw open source with the commercial support that enterprises depend on. These new open source businesses found their opportunity by _adding_ the missing—but necessary—commercial services to community-led open source projects. These services would be costly for organizations to provide on their own and potentially even more costly to do without. One early leader of that era, Cygnus Solutions, even adopted the counter-intuitive tagline "Making free software affordable." + +But back then, it was always overwhelmingly clear: The commercial vendors were in service of the community, filling in around the edges to enable commercial applications. The community was the star, and the companies were the supporting cast. + +### The dark ages of open core + +With the success of the original commercial open source companies like Red Hat, investment dollars flowed toward startups looking to harness the newfound commercial power of open source. + +Unfortunately, by and large, this generation of open source companies drew the wrong lessons from first-generation players like Red Hat. + +Witnessing the powerful combination of community-created technology with vendor-provided commercial capabilities, this new breed of company concluded that the vendors were the stars of the show, not the community. + +This marked a turning point for open source. + +In this vendor-centric view of the world, it was imagined that a single organization could generate the insights and set the roadmap for open source technologies. This drove a pervasive new belief that open source communities primarily represented a capital-efficient marketing channel rather than a new form of internet-enabled co-creation. + +These companies approached open source with a scarcity mindset. Instead of investing in community-led projects to unlock the potential of the crowd, they created vendor-dominated projects, released demo versions under open source licenses, and directed the bulk of their resources to companion proprietary technology that they withheld as paid-only, closed-source products. By reverting to some of [the worst aspects of traditional proprietary software][2]—like uncertain licensing terms, unclear support horizons, and unknowable cost—these businesses crowded out the best aspects of open source. + +As so often happens, this misreading of the open source model took on a new life when it was assigned an innocent-sounding brand name: "open core." + +The open core dog chased its tail into an escalating flurry of blog posts, pitch decks, and even dedicated open core conferences. In its worst moments, leading players in this movement even [sought to redefine the very meaning of the words open source][3]. + +In the worldview of open core, the vendors are at the center of the universe, and open source users are just a commodity to be exploited. + +### A community-led renaissance to restore balance + +While business interests whipped themselves into a frenzy around open core, the community of creators at the heart of open source just kept on building. While a handful of high-profile companies occupied the industry headlines, thousands of individual creators and teams kept on building software, one pull request at a time. + +It added up. Today, the modern application development platform isn't from a single vendor, or even a collection of vendors. It's the union of thousands of discrete open source packages—implemented in languages like JavaScript, Python, PHP, Ruby, Java, Go, .NET, Rust, R, and many others. Each element built for its own purpose, but together creating a beautiful tapestry that has become the foundation of all modern applications. + +In some cases, the creators behind these projects are assisted by organizations that arose naturally from the communities, like Ruby Together, the Apache Software Foundation, and the Python Software Foundation. But by and large, these creators are self-supported, making time in the margins of their day jobs and central pursuits to collaborate on the software that makes their work possible while collectively building a huge commons of open source software that's available for any individual or organization to use. + +But now, there's an emerging way for open source maintainers to participate in the value they create, which isn't about withholding value, but instead is about [creating _additional_ value][4]. + +In a revival and expansion of the principles that drove the first generation of community-led open source commercial players, creators are now coming together in a new form of collaboration. Rather than withholding software under a different license, they're partnering with each other to provide [the same kinds of professional assurances][5] that companies such as Red Hat discovered were necessary back in the day, but for the thousands of discrete components that make up the modern development platform. + +Today's generation of entrepreneurial open source creators is leaving behind the scarcity mindset that bore open core and its brethren. Instead, they're advancing an optimistic, additive, and still practical model that [adds missing commercial value][6] on top of raw open source. + +And by emulating first-generation open source companies, these creators are rediscovering a wide-open opportunity for value creation that benefits everyone. As commercial organizations engage with managed open source services sourced directly from the creators themselves, there's an immediate clarity in the alignment of interests between producers and consumers. + +The result? The end of the scarcity-mindset dark ages of open core, and a renaissance of technology driven by a new class of thriving, independent, full-time open source creators. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/community-led-renaissance + +作者:[Donald Fischer][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/dff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Open%20Pharma.png?itok=GP7zqNZE (shapes of people symbols) +[2]: https://blog.tidelift.com/the-closed-source-sustainability-crisis +[3]: https://opensource.com/article/19/4/fauxpen-source-bad-business +[4]: https://www.techrepublic.com/article/the-key-to-open-source-sustainability-is-good-old-fashioned-self-interest/ +[5]: https://tidelift.com/subscription/video/what-is-managed-open-source +[6]: https://blog.tidelift.com/what-is-managed-open-source diff --git a/sources/talk/20190919 A Network for All Edges- Why SD-WAN, SDP, and the Application Edge Must Converge in the Cloud.md b/sources/talk/20190919 A Network for All Edges- Why SD-WAN, SDP, and the Application Edge Must Converge in the Cloud.md new file mode 100644 index 0000000000..0b815096b3 --- /dev/null +++ b/sources/talk/20190919 A Network for All Edges- Why SD-WAN, SDP, and the Application Edge Must Converge in the Cloud.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Network for All Edges: Why SD-WAN, SDP, and the Application Edge Must Converge in the Cloud) +[#]: via: (https://www.networkworld.com/article/3440101/a-network-for-all-edges-why-sd-wan-sdp-and-the-application-edge-must-converge-in-the-cloud.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +A Network for All Edges: Why SD-WAN, SDP, and the Application Edge Must Converge in the Cloud +====== +Globalization, mobilization, the cloud, and now edge computing are complicating enterprise networking. Here’s why and how you can best prepare yourself. +NicoElNino + +The software-defined movement keeps marching on. [Software-defined WAN (SD-WAN)][1] is redefining the branch edge by displacing legacy technologies like MPLS, WAN optimizers, and routers. [Software-defined Perimeter (SDP)][2] is displacing whole network access via mobile VPN with secure and optimized access from any device to specific applications in physical and cloud datacenters. These seem like unrelated developments, despite the “software-defined” buzz, because enterprise IT thinks about physical locations, mobile users, and applications separately. Each enterprise edge, location, person, or application is usually served by different technologies and often by different teams. + +### Emerging Business Needs and Point Solutions, like SD-WAN and SDP, Make the Network Unmanageable + +In recent years, though, managing networking and security got even more complicated due to the accelerating trends of globalization, mobilization, and cloudification. + +Take global locations: Connecting and securing them create a unique set of challenges. Network latency is introduced by distance, requiring predictable long-haul network connectivity. There is often less support from local IT, so the technology footprint at the location must be minimized. Yet security can’t be compromised, so remote locations must still be protected as well as any other location. + +Next, mobile users introduce their own set of challenges. Optimizing and securing application access for mobile users require the extension of the network and security fabric to every user globally. Mobile VPNs are a very bad solution. Since the network is tied to key corporate locations, getting mobile traffic to a firewall at headquarters or to a VPN concentrator over the unpredictable public internet is a pain for road warriors and field workers. And doing so just so the traffic can be inspected on its way to the cloud creates the so-called “[Trombone Effect][3]” and makes performance even worse.  + +Finally, the move to cloud applications and cloud datacenters further increases complexity. Instead of optimizing the network for a single destination (the physical datacenter), we now need to optimize it for at least two (physical and cloud datacenters), and sometimes more if we include regional datacenter instances.  As the application “edge” got fragmented, a new set of technologies was introduced. These include cloud access security brokers (CASB) and cloud optimization solutions like AWS DirectConnect and Microsoft Azure ExpressRoute. Recently, edge computing is becoming a new megatrend – placing the application itself near the user, introducing new technologies into the mix such as AWS Outpost and Azure Stack. + +### Making the Network Manageable Again with a Converged Cloud-Native Architecture + +What is the remedy for this explosion in requirements and complexity? It seems enterprises are hard at work patching their networks with myriad point solutions to accommodate that shift in business requirements. There is an opportunity for forward-looking enterprises to transform their networks by holistically addressing **all** enterprise edges and distributing networking and security capabilities globally with a cloud-native network architecture. + +Here [are several key attributes of the cloud-native network][4]. + +**The Cloud is the Network** + +A cloud-native architecture is essential to serving all types of edges. Traditional appliance-centric designs are optimized for physical edges, not mobile or cloud ones. These legacy designs lock the networking and security capabilities into the physical location, making it difficult to serve other types of edges. This imbalance made sense where networks were mostly used to connect physical locations. We now need an [**edge-neutral** design that can serve any edge: location, user, or application.][5] + +What is this edge neutrality? It means that we place as many networking and security capabilities as possible away from the edge itself – in the cloud. These include global route optimization, WAN and cloud acceleration, and network security capabilities such [as NGFW, IPS, IDS, anti-malware, and cloud security][6]. With a cloud-native architecture, we can distribute these capabilities globally across multiple points of presence to create a dynamic fabric that is within a short distance from any edge. This architecture delivers enterprise-grade optimization and security down to a location, application, user, or device.  + +**Built from Scratch as a Multitenant Cloud Service** + +Cloud-native networks are built for the cloud from the ground up. In contrast, managed services that rely on hosted physical and virtual appliances can’t benefit from a cloud platform. Simply put, appliances don’t have any of the key attributes of cloud services. They are single-tenant entities unlike cloud services, which are multi-tenant. They aren't elastic or scalable, so dynamic workloads are difficult to accommodate. And they need to be managed individually, one instance at a time.  You can't build a cloud-native network by using appliance-based software.  + +**End-to-End Control** + +The cloud-native network has edge-to-edge visibility and control. Traditionally, IT decoupled network services (the transports) from the network functions (routing, optimization, and security). In other cases, the full range of services and functions was bundled by a service provider. By running traffic between all edges and to the Internet through the cloud network, it is possible to dynamically adjust routing based on global network behavior. This is markedly different from trying to use edge solutions that at best have limited visibility to last-mile ISPs or rely on dated protocols like BGP, which are not aware of actual network conditions. + +**Self-Healing by Design** + +Cloud-native networks are [resilient by design][7]. We are all familiar with the resiliency of cloud services like Amazon Web Services, Facebook, and Google. We don’t worry about infrastructure resiliency as we expect that the service will be up and running, masking the state of underlying components. Compare this with typical HA configurations of appliances within and across locations, and what it takes to plan, configure, test, and run these environments. + +### The Cloud-Native Network Is the Network for All Edges and All Functions + +To summarize, the cloud-native network represents a transformation of the legacy IT architecture. Instead of silos, point solutions for emerging requirements like SD-WAN and SDP, and a growing complexity, we must consider a network architecture that will serve the business into the future. By democratizing the network for all edges and delivering network and security functions through a cloud-first/thin-edge design, cloud-native networks are designed to rapidly evolve with the business even as new requirements—and new edges—emerge. + +Cato Networks built the world’s first cloud-native network using the global reach, self-service, and scalability of the cloud. To learn more about Cato Networks and the Cato Cloud, visit [here][8]. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440101/a-network-for-all-edges-why-sd-wan-sdp-and-the-application-edge-must-converge-in-the-cloud.html + +作者:[Cato Networks][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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/sd-wan?utm_source=idg +[2]: https://www.catonetworks.com/glossary-use-cases/software-defined-perimeter-sdp/ +[3]: https://www.catonetworks.com/news/is-your-network-suffering-from-the-trombone-effect/ +[4]: https://www.catonetworks.com/cato-cloud/global-private-backbone-3/#Cloud-native_Software_for_Faster_Innovation_and_Lower_Costs +[5]: https://www.catonetworks.com/cato-cloud +[6]: https://www.catonetworks.com/cato-cloud/enterprise-grade-security-as-a-service-built-directly-into-the-network/ +[7]: https://www.catonetworks.com/cato-cloud/global-private-backbone-3/#Self-healing_By_Design_for_24x7_Operation +[8]: http://www.networkworld.com/cms/article/catonetowrks.com/cato-cloud diff --git a/sources/talk/20190919 Linux on the mainframe- Then and now.md b/sources/talk/20190919 Linux on the mainframe- Then and now.md new file mode 100644 index 0000000000..9b35ce563b --- /dev/null +++ b/sources/talk/20190919 Linux on the mainframe- Then and now.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux on the mainframe: Then and now) +[#]: via: (https://opensource.com/article/19/9/linux-mainframes-part-2) +[#]: author: (Elizabeth K. Joseph https://opensource.com/users/pleia2https://opensource.com/users/pleia2https://opensource.com/users/lauren-pritchett) + +Linux on the mainframe: Then and now +====== +It's been two decades since IBM got onboard with Linux on the mainframe. +Here's what happened. +![Penguin driving a car with a yellow background][1] + +Last week, I introduced you to the origins of the [mainframe's origins from a community perspective][2]. Let's continue our journey, picking up at the end of 1999, which is when IBM got onboard with Linux on the mainframe (IBM Z). + +According to the [Linux on z Systems Wikipedia page][3]: + +> "IBM published a collection of patches and additions to the Linux 2.2.13 kernel on December 18, 1999, to start today's mainline Linux on Z. Formal product announcements quickly followed in 2000." + +These patches weren't part of the mainline Linux kernel yet, but they did get Linux running on z/VM (Virtual Machine for IBM Z), for anyone who was interested. Several efforts followed, including the first Linux distro—put together out of Marist College in Poughkeepsie, N.Y., and Think Blue Linux by Millenux in Germany. The first real commercial distribution came from SUSE on October 31, 2000; this is notable in SUSE history because the first edition of what is now known as SUSE Enterprise Linux (SLES) is that S/390 port. Drawing again from Wikipedia, the [SUSE Enterprise Linux page][4] explains: + +> "SLES was developed based on SUSE Linux by a small team led by Josué Mejía and David Áreas as principal developer who was supported by Joachim Schröder. It was first released on October 31, 2000 as a version for IBM S/390 mainframe machines… In April 2001, the first SLES for x86 was released." + +Red Hat quickly followed with support, and community-driven distributions, including Debian, Slackware, and Gentoo, followed, as they gained access to mainframe hardware to complete their builds. Over the next decade, teams at IBM and individual distributions improved support, even getting to the point where a VM was no longer required, and Linux could run on what is essentially "bare metal" alongside the traditional z/OS. With the release of Ubuntu 16.04 in 2016, Canonical also began official support for the platform. + +In 2015, some of the biggest news in Linux mainframe history occurred: IBM began offering a Linux-only mainframe called LinuxONE. With z/OS and similar traditional configurations, this was released as the IBM z13; with Linux, these mainframes were branded Rockhopper and Emperor. These two machines came only with Integrated Facility for Linux (IFL) processors, meaning it wasn't even possible to run z/OS, only Linux. This investment from IBM in an entire product line for Linux was profound. + +With the introduction of this machine, we also saw the first support for KVM on the mainframe. KVM can replace z/VM as the virtualization technology. This allows for all the standard tooling around KVM to be used for managing virtual machines on the mainframe, including libvirt and OpenStack. + +Also in 2015, The Linux Foundation announced the [Open Mainframe Project][5]. Both a community and a series of open source software projects geared specifically towards the mainframe, the flagship project, [Zowe][6], has gathered contributions from multiple companies in the mainframe ecosystem. While it is created for z/OS, Zowe has been a driving force behind the modernization of interactions with mainframes today. On the Linux on Z side, [ADE][7], announced in 2016, is used to detect "anomalous time slices and messages in Linux logs" so that they can be analyzed alongside other mainframe logs. + +In 2017, the z14 was released, and LinuxONE Rockhopper II and Emperor II were introduced. One of the truly revolutionary changes with this release was the size of the Rockhopper II: it's air-cooled and fits in the space of a 19" rack. No longer does a company need special space and consideration for this mainframe in their datacenter, it has standard connectors and fits in standard spaces. Then, on September 12, 2019, the z15 was launched alongside the LinuxONE III, and the really notable thing from an infrastructure perspective is the size. A considerable amount of effort was put into making it run happily alongside non-Z systems in the data center, so there is only a 19" version. + +![LinuxONE Emperor III mainframe][8] + +LinuxONE Emperor III mainframe | Used with permission, Copyright IBM + +There are one, two, three, or four-frame configurations, but they'll still fit in a standard datacenter spot. See inside a four-frame, water-cooled version. + +![Inside the water-cooled LinuxONE III][9] + +Inside the water-cooled LinuxONE III | Used with permission, Copyright IBM + +As a long-time x86 Linux systems administrator new to the mainframe world, I'm excited to be a part of it at IBM and to introduce my fellow systems administrators and developers to the platform. Looking forward, I see a future where mainframes continue to be used in tandem with cloud and edge technologies to leverage the best of all worlds. + +The modernization of the mainframe isn't stopping any time soon. The mainframe may have a long history, but it's not old. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-mainframes-part-2 + +作者:[Elizabeth K. Joseph][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/pleia2https://opensource.com/users/pleia2https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://opensource.com/article/19/9/linux-mainframes-part-1 +[3]: https://en.wikipedia.org/wiki/Linux_on_z_Systems +[4]: https://en.wikipedia.org/wiki/SUSE_Linux_Enterprise +[5]: https://www.openmainframeproject.org/ +[6]: https://www.zowe.org/ +[7]: https://www.openmainframeproject.org/projects/anomaly-detection-engine-for-linux-logs-ade +[8]: https://opensource.com/sites/default/files/uploads/linuxone_iii_pair.jpg (LinuxONE Emperor III mainframe) +[9]: https://opensource.com/sites/default/files/uploads/water-cooled_rear.jpg (Inside the water-cooled LinuxONE III) diff --git a/sources/talk/20190919 Space internet service closer to becoming reality.md b/sources/talk/20190919 Space internet service closer to becoming reality.md new file mode 100644 index 0000000000..72fc37c68e --- /dev/null +++ b/sources/talk/20190919 Space internet service closer to becoming reality.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Space internet service closer to becoming reality) +[#]: via: (https://www.networkworld.com/article/3439140/space-internet-service-closer-to-becoming-reality.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Space internet service closer to becoming reality +====== +OneWeb and SpaceX advance with their low-latency, satellite service offerings. Test results show promise, and service is expected by 2020. +Getty Images + +Test results from recent Low Earth Orbit internet satellite launches are starting to come in—and they're impressive.  + +OneWeb, which launched six Airbus satellites in February, says tests show [throughput speeds of over 400 megabits per second][1] and latency of 40 milliseconds.  + +Partnering with Intellian, developer of OneWeb user terminals, OneWeb streamed full high-definition video at 1080p resolution. The company tested for latency, speed, jitter, handover between satellites, and power control. + +OneWeb said it achieved the following during its tests: + + * Low latency, with an average of 32 milliseconds + * Seamless beam and satellite handovers + * Accurate antenna pointing and tracking + * Test speed rates of more than 400 Mbps + + + +**Also read: [The hidden cause of slow internet and how to fix it][2]** + +### Internet service for the Arctic + +Arctic internet blackspots above the 60th parallel, such as Alaska, will be the first to benefit from OneWeb’s partial constellation of Low Earth Orbit (LEO) broadband satellites, OneWeb says. + +“Substantial services will start towards the end of 2020,” the future ISP [says on its website][3]. “Full 24-hour coverage being provided by early 2021.” + +Currently 48% of the Arctic is without broadband coverage, according to figures OneWeb has published. + +The Arctic-footprint service will provide “enough capacity to give fiber-like connectivity to hundreds of thousands of homes, planes, and boats, connecting millions across the Arctic,” it says. + +### SpaceX also in the space internet race + +[SpaceX, too, is in the race to provide a new generation of internet-delivering satellites][4]. That constellation, like OneWeb’s, is positioned in Low Earth Orbit, which has less latency than traditional satellite internet service because it’s closer to Earth. + +SpaceX says through its offering, Starlink, it will be able[ provide service in the northern United States and Canada after six launches][5]. And it is trying to make two to six launches by the end of 2019. The company expects to provide worldwide coverage after 24 launches. In May, it successfully placed in orbit the first batch of 60 satellites. + +### SpaceX's plan to provide service sooner + +Interestingly, though, a SpaceX filing made with the U. S. Federal Communication Commission (FCC) at the end of August, ([discovered by][6] and subsequently [published (pdf) on Ars Technica’s website][7]), seeks to modify its original FCC application because of results it discovered in its initial satellite deployment. SpaceX is now asking for permission to “re-space” previously authorized, yet unlaunched satellites. The company says it can optimize its constellation better by spreading the satellites out more. + +“This adjustment will accelerate coverage to southern states and U.S. territories, potentially expediting coverage to the southern continental United States by the end of the next hurricane season and reaching other U.S. territories by the following hurricane season,” the document says. + +Satellite internet is used extensively in disaster recovery. Should SpaceX's request be approved, it will speed up service deployment for continental U.S. because fewer satellites will be needed. + +Because we are currently in a hurricane season (Atlantic basin hurricane seasons last from June 1 to Nov. 30 each year), one can assume they are talking about services at the end of 2020 and end of 2021, respectively. + +Interestingly, too, the document reinforces the likelihood of SpaceX’s intent to launch more internet-delivering satellites this year. “SpaceX currently expects to conduct several more Starlink launches before the end of 2019,” the document says. + +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/3439140/space-internet-service-closer-to-becoming-reality.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.oneweb.world/media-center/onewebs-satellites-deliver-real-time-hd-streaming-from-space +[2]: https://www.networkworld.com/article/3107744/internet/the-hidden-cause-of-slow-internet-and-how-to-fix-it.html +[3]: https://www.oneweb.world/media-center/oneweb-brings-fiber-like-internet-for-the-arctic-in-2020 +[4]: https://www.networkworld.com/article/3398940/space-internet-maybe-end-of-year-says-spacex.html +[5]: https://www.starlink.com/ +[6]: https://arstechnica.com/information-technology/2019/09/spacex-says-itll-deploy-satellite-broadband-across-us-faster-than-expected/ +[7]: https://cdn.arstechnica.net/wp-content/uploads/2019/09/spacex-orbital-plane-filing.pdf +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190919 Upgrade to Android Pie on Any Xiaomi Device with the Pixel Experience ROM.md b/sources/talk/20190919 Upgrade to Android Pie on Any Xiaomi Device with the Pixel Experience ROM.md new file mode 100644 index 0000000000..edfab07550 --- /dev/null +++ b/sources/talk/20190919 Upgrade to Android Pie on Any Xiaomi Device with the Pixel Experience ROM.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Upgrade to Android Pie on Any Xiaomi Device with the Pixel Experience ROM) +[#]: via: (https://opensourceforu.com/2019/09/upgrade-to-android-pie-on-any-xiaomi-device-with-the-pixel-experience-rom/) +[#]: author: (Swapnil Vivek Kulkarni https://opensourceforu.com/author/swapnil-vivek/) + +Upgrade to Android Pie on Any Xiaomi Device with the Pixel Experience ROM +====== + +[![][1]][2] + +_If you enjoy a hands-on experience and you own a Redmi device, this article will convince you to upgrade to Android Pie with a Pixel Experience ROM. Even if you don’t own a Redmi device, reading this article could help you to upgrade your own device._ + +Xiaomi is the market leader in mid-range Android devices. Redmi Note 4 was one of the most shipped Android devices in 2017. It became more popular because of its powerful hardware specifications that make the phone super smooth. The price offered by Xiaomi at that time was much lower than phones from other companies with similar configurations. + +Note 4 runs on MIUI 10, which is based on Android Nougat 7.1. The latest version of Android to hit the market is Android Pie, and Android Q is likely to be launched in the coming months. All users of Note 4 want the upgrade to the latest OS but sadly, the company has no such plans and is not pushing security patch updates either. + +In a recent announcement, the company declared that Note 4 and prior released devices will not get a MIUI 11 update. But don’t fret, because irrespective of this bad news, you can upgrade to the latest Android Pie using custom Android ROMs. + +If you are one of those who want to enjoy the latest features and security updates of Android Pie without blowing your budget by buying a new Android device, then read this article carefully. Many of us with Note 4 or other MI devices want to upgrade to the next generation Android Pie on our devices. This article is written for Redmi Note 4, but it is applicable for all Xiaomi devices that run on MIUI (Redmi 3, Redmi Note 3, Redmi Note 4, Redmi 4, Redmi Note 4A, Redmi Note 5, Redmi Note 5 Pro, Redmi 5, Redmi 5 Pro, Redmi 5A, and others in this series). +But before installing the latest Android ROM, let us go over some basic concepts that we really need to be clear about, regarding Android and custom ROMs. + +![Figure 1: Bootloader][3] + +**Things you should know before actual installation of custom ROM on any Android device** + +**What is a custom ROM?** +The acronym ROM stands for Read Only Memory. But this is a bit confusing with respect to custom Android ROM, which is firmware or software that has been permanently programmed into Read Only Memory, and directly interacts with hardware. +Android is an open source project, so any developer can edit, modify and compile the code for a variety of devices. Custom ROMs are developed entirely by the community, which comprises people who are passionate about modding. + +Android custom ROMs are available for smartphones, tablets, smart TVs, media players, smart watches, etc. When you buy a new Android device, it comes with company installed firmware or an operating system which is controlled by the manufacturer and has limited functionality. Here are some benefits of switching over to a custom ROM. + +**Performance:** Custom ROMs can give tremendous performance improvements. The device manufacturer locks the clock speed at an optimal level to balance heat and battery life. But custom ROMs do not have restrictions on clock speed. + +**Battery life:** Company installed firmware has lots of bloatware or OEM installed apps that are always running in the background, consuming processor resources, which drains the battery. + +**Updates:** It is very frustrating to wait for manufacturers to release updates. Custom ROMs are always updated, depending upon the active community behind the ROM. + +Here is a list of some of the Android custom ROMs available for Note 4 and corresponding Xiaomi devices: + + * Pixel Experience ROM + * Resurrection Remix ROM + * Lineage OS ROM + * Dot OS ROM + * cDroid ROM + + + +![Figure 2: Could not unlock][4] + +![Figure 3: Unlocked successfully][5] + +**Why the preference for Pixel Experience?** +After a lot of research, I came to the conclusion that Pixel Experience is best suited to general user requirements, so I decided to go with it. As the name suggests, it is supposed to give you a Google Pixel like experience on your device. This ROM comes with preloaded Google apps so there’s no need to flash externally. Over the air (OTA) updates are provided by the community regularly. I have used this ROM for the past six months, and am getting monthly security patch updates with other bug fixes and enhancements. +Pixel Experience is a lightweight and less customisable ROM, so it consumes less battery. The battery performance is outstanding and beyond expectations. + +**Are there security concerns when a custom ROM is installed?** +It is not true that the installation of a custom ROM compromises the security of a phone or device. Behind every custom ROM there is a large community and thousands of users who test it. +For custom ROM installation, you don’t need to root your device — it is 100 per cent safe and secure. If we keep this discussion specific to the Pixel Experience ROM, then it is a pure vanilla Android ROM developed for Nexus and Pixel devices, and ported by developers and maintainers to specific Android devices. + +Before installing a custom ROM, you need to unlock the bootloader. During the bootloader unlock process, you will see a warning from the vendor that states your phone will be less secure after unlocking the bootloader. The reason for this is that an unlocked phone can be used to install a fresh ROM without any permission from device manufacturers or the owner of the device. So, stolen or lost devices can be reused by flashing a ROM. Anyway, there are a number of methods that can be used to unlock the bootloader unofficially and install the ROM without permission from the manufacturer. + +Custom ROMs are more secure than stock ROMs because of the latest updates provided by the community. Device manufacturers are profit making companies. They want their customers to upgrade their phones after two years; so they stop providing support and stop pushing software updates! Custom ROMs, on the other hand, are driven by non-profit communities. They run on community support and donations. + +![Figure 4: Command adb][6] + +**What does it mean to root an Android device, and is this really required before flashing a custom ROM?** +On a Windows machine, there is an administrator account which has all the privileges. Similarly, in Linux too, there is the concept of a root account. Android uses the Linux kernel; so all the OS internals are the same as in Linux. + +Your Android phone uses Linux permissions and file system ownership. You are a user when you sign in and you can do only certain things based on your user permissions. In all Android devices, the root user is hidden by the vendor to avoid misuse. + +Rooting an Android phone is to jail-break the phone to allow the user to dive deep into the device. I personally recommend that you do not root your device, because doing so is really not required to flash a custom ROM to the device. + +Here are a few reasons why you should not root your device: + + 1. Rooting can give your apps complete control of the system, and there is a chance of misuse of power. + 2. Google officially does not support rooted devices. + 3. Banking applications, BHIM, UPI, Google Pay, PhonePe and Paytm will not work on rooted devices. + 4. There is a myth that rooting of a phone is required to flash a custom ROM, but that is not true. You only need to unlock the bootloader to do so. + + + +**What is a bootloader and why should you unlock it before flashing a custom ROM?** +A bootloader is the proprietary image responsible for bringing up the kernel on a device. It is nothing but a guard for the device, and is responsible for initialising trust between root and user. The bootloader may directly flash the OS to the partition or we can use custom recovery to do the same thing. + +In this article we will use Team Win custom recovery to flash the operating system in a device. + +In Microsoft Windows terminology, there is the concept of a BIOS which is the same as a bootloader. Let’s look at an example. When we install Linux alongside Windows on a laptop or PC, there is bootloader called GRUB which allows the user to boot either Windows or Linux. A bootloader points to the OS partition from the file system. At the press of the power button to start the phone, the bootloader initiates the process to boot the operating system installed in the file system. + +Most bootloaders are locked by vendors to make sure the user sticks to the operating system specifically designed by the vendor for that particular device. With a locked bootloader, it is impossible to flash a custom ROM and a wrong attempt may brick the device. Again, this is one of the security features provided by the vendor. + +The bootloader can be unlocked in two ways — one is the official method provided by the vendor, and the other is the unofficial method which may lead to a bricked device. + +![Figure 5: Team Win Recovery Project][7] + +**Installing Pixel Experience on a Xiaomi device** +The previous section covered concepts that we needed to be clear about before flashing a custom ROM. Now let’s go through a step by step procedure to install a custom ROM on any Android device. We’re working specifically on a Redmi device and this is based on my own experience. + +Here are some points to remember before unlocking the bootloader: + + * Take the phone’s backup on a PC/laptop (you are unlikely to lose any data, and this step is just a precaution). + * Unlocking the bootloader voids the warranty. + * Make sure that the zip file of the Android ROM is downloaded to the device’s internal memory or SD card. + * Make sure that the bootloader of the device is unlocked after the unlock process completes, because a wrong attempt may brick the device. + + + +_**Steps to follow on a laptop/PC**_ + + 1. On your laptop/PC, navigate to __ and click on the Unlock Now button. + 2. Log in to the MI account with the credentials you used to log into your device. + 3. Remember the credentials, since this is the most important step. + 4. As per the new MI unlock bootloader method, you don’t need permission from MI. To download the MIUI Unlock application, simply click on the button. The size is around 55MB. + 5. Go to where we downloaded the MIUI Unlock application in Step 4, and double click on _miflash_unlock.exe_. + 6. Log in using the MI account, which is used in Step 2. + 7. Make sure that the device is properly connected to the PC using a USB cable (the status will be shown in the application). + + + +_**Steps to follow on a mobile phone**_ + + 1. Go to _Settings->About phone_. + 2. Tap five times on the MIUI version; it will enable the _Developer option_ on your device. + 3. Go to _Settings->Additional Settings -> Developer options_ and tap on _OEM unlocking_. Do not enable this but click on the text to go inside. + 4. Enter your password/PIN (whichever is set to the device for confirmation) and enable the option. + 5. Go to Settings->Additional Settings -> Developer options, and then go to MIUI status and tap on Add account. This step will add the MI account to unlock the bootloader. Sometimes the account does not get added, in which case, restart the phone. + 6. Enable USB debugging from Settings->Additional Settings -> Developer options. + 7. Switch off the phone and press the Power button and the ‘volume down’ key simultaneously. + 8. Connect the USB cable to the device and laptop/PC. + + + +_**After completing these steps on the mobile, repeat the folliwing steps on your PC/laptop**_ + + 1. Click on the Unlock button. + 2. A dialogue box with the following message will appear: “Unlocking the phone will erase all phone data. Do you still want to continue to unlock the phone?” Click on Unlock anyway. + 3. You will see the message shown in Figure 2, if it did not unlock. There is a time specified after which you may try again. The time varies between 24 hours to 360 hours. In my case it was 360 hours, which is nothing but 15 days! + 4. After the specified period, carry out the same steps, and the bootloader will get unlocked and you will see the result shown in Figure 3. + + + +**Installing Team Win Recovery Project (TWRP)** +Team Win Recovery Project (TWRP) is an open source custom recovery image for Android based devices. It provides a touchscreen-enabled interface that allows users to install third-party firmware and back up the current system. It is installed on an Android device when flashing, installing or rooting Android devices. + + 1. Download the Pixel Experience ROM for your device from the official website __. In my case, the device is Redmi Note 4 (Mido); download and save the zip file in the phone memory. + 2. In a Web browser, navigate to the Android SDK tools website __. Under the download section you will find three links for your platform — Windows, Linux and Mac. Depending on your operating system, download the SDK, which is just around 7MB. + 3. In a Web browser, navigate to __ and search for your device. Here, remember that my device is Redmi Note 4 and the name is Xiaomi Redmi Note 4(x) (mido). Go to your device by simply clicking on the link. There is a section called Download links that you can click on. Choose the latest TWRP image and download it. + 4. Head to the _Downloads_ directory and extract the platform tool’s zip file downloaded in Step 1. + 5. Move the TWRP image file downloaded in Step 2 inside the Platform Tools folder. + 6. Connect your phone to a computer using a USB cable, and make sure that _USB debugging_ is ON. + 7. Open a command window and CD to the _Platform Tools_ directory. + 8. Run the following commands on the command prompt: +i. Run the command _adb devices_, and make sure that your device is listed (Figure 4). +ii. Run the command _adb bootloader._ It will take you to the bootloader. +iii. Now type _fastboot devices_. Your device will get listed here. +iv. Run the command _fastboot flash recovery twrp-image-file.img_. +v. Run the command _fastboot boot twrp-image-file.img_. +vi. Wait for a few moments and you will see the Team Win Recovery Project start on your device. + + + +**Steps to install custom ROM on Xiaomi device** + +**Installing the Pixel Experience ROM on a device** +Now you are already booted into TWRP. It is recommended that you take a backup. Press Backup, select the following options, and swipe right to backup. + + * System + * Data + * Vendor + * Recovery + * Boot + * System image + + + 1. Next, wipe the existing stock ROM from your device. To do so, go to _Wipe->Advanced wipe options,_ select the following options and wipe them: + + + * Dalvik + * System + * Data + * Cache + * Vendor + + + +ii. Come back to the _Install_ option and browse for the pixel experience zip file, select it and swipe to flash. It will take some time. Once it is completed, wipe the cache. +iii. Press the _Reboot_ to _start_ button. +Pixel Experience will get started on your device. +Congratulations, you now have successfully upgraded to Android Pie. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/upgrade-to-android-pie-on-any-xiaomi-device-with-the-pixel-experience-rom/ + +作者:[Swapnil Vivek Kulkarni][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://opensourceforu.com/author/swapnil-vivek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-12-15-58-26.png?resize=627%2C587&ssl=1 (Screenshot from 2019-09-12 15-58-26) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-12-15-58-26.png?fit=627%2C587&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Xiaomi1.png?resize=350%2C160&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Xiaomi2.png?resize=350%2C181&ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Xiaomi3.png?resize=350%2C171&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4-1.png?resize=350%2C169&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/5.png?resize=278%2C467&ssl=1 diff --git a/sources/talk/20190920 Code it, ship it, own it with full-service ownership.md b/sources/talk/20190920 Code it, ship it, own it with full-service ownership.md new file mode 100644 index 0000000000..deacc2b88c --- /dev/null +++ b/sources/talk/20190920 Code it, ship it, own it with full-service ownership.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Code it, ship it, own it with full-service ownership) +[#]: via: (https://opensource.com/article/19/9/full-service-ownership) +[#]: author: (Julie GundersonJustin Kearns https://opensource.com/users/juliegundhttps://opensource.com/users/juliegundhttps://opensource.com/users/juliegundhttps://opensource.com/users/kearnsjdhttps://opensource.com/users/ophir) + +Code it, ship it, own it with full-service ownership +====== +Making engineers responsible for their code and services in production +offers multiple advantages—for the engineer as well as the code. +![Gears above purple clouds][1] + +Software teams seeking to provide better products and services must focus on faster release cycles. But running reliable systems at ever-increasing speeds presents a big challenge. Software teams can have both quality and speed by adjusting their policies around ongoing service ownership. While on-call plays a large part in this model, advancement in knowledge, more resilient code, increased collaboration, and better practices mean engineers don't have to wake up to a nightmare. + +This four-part series will delve into the concepts of full-service ownership, psychological safety in transformation, the ethics of accountability, and the impact of ownership on the customer experience. + +### What is full-service ownership? + +![Code it, ship it, own it][2] + +Full-service ownership is the philosophy that engineers are responsible for the code and services they create in production. Using the "code it, ship it, own it," mentality means embracing the [DevOps principle][3] of no longer throwing code over the wall to operations nor relying on the [site reliability engineering (SRE) team][4] to ensure the reliability of services in the wild. Instead: + +> Accountability, reliability, and continuous improvement are the main objectives of full-service ownership. + +Putting engineers on-call for what they create brings accountability directly into the hands of that engineer and team. + +### Why accountability matters + +Digital transformation has changed how people work and how consumers consume. There is an implicit expectation in consumers' minds that services will work. For example, when I try to make an online purchase (almost always through my mobile device), I expect a seamless, secure, and efficient experience. When I am interrupted because a page won't load or throws an error, I simply move on to another company that can fulfill my request. According to the [PagerDuty State of Digital Operations 2017 UK report][5], 86.6% of consumers will do the same thing. + +![Amount of time consumers will wait for an unresponsive app][6] + +Empowering engineers to work on the edge of the customer experience by owning the full lifecycle of their code and services gives companies a competitive advantage. As well as benefiting the company, full-service ownership benefits the engineer. Accountability ensures high-quality work and gives engineers a direct line of sight into how the code or service is performing and impacting the customers' day-to-day. + +### Reliability beyond subject-matter experts + +Services will go down; it's an inevitable facet of operating in the digital world. However, how long those services are down—and the impact the outages have on customers—will be mitigated by bringing the + +subject matter expert (SME) or "owner" into the incident immediately. The SME is the engineer who created the code or service and has the intimate, technical knowledge to both respond to incidents and take corrective action to ensure their services experience fewer interruptions through continuous improvement. As the responsible party, the engineers are incented to automate, test, and create code that is as bulletproof as possible. + +Also, teams that adopt full-service ownership increase their overall knowledge. Through practices that include on-call handoffs, code reviews, daily standups, and Failure Friday exercises, individual engineers develop greater expertise around the entire codebase. New skills include systems thinking, collaboration, and working in non-siloed environments. Teams and individuals build necessary redundancy in skills and knowledge by sharing information. + +### Continuous improvement + +As engineers strive to improve their product, code, and/or services continuously, a side-effect of full-service ownership is the refinement of services and alerting. Alerts that interrupt time outside regular work hours must be actionable. If team members are repeatedly interrupted with non-actionable alerts, there is an opportunity to improve the system by analyzing the data. Cleaning up the monitoring system is an investment of time; however, committing to actionable alerting will make on-call better for everyone on the team and reduce alert fatigue—which will free up mental energy to focus on future releases and automation. + +Developers who write the code and define the alerts for that code are more likely to create actionable alerts. It will literally wake them up at night if they don't. Beyond actionable alerts, engineers are incented to produce the highest quality code, as better code equals fewer interruptions. + +While on-call can interrupt your personal life, on-call is not meant to be "always-on." Rather, it's a shared team responsibility to ensure high-quality code. Instead of looking at full-service ownership as an on-call requirement, you can argue that it is building in time to go "off-call." + +Imagine you are on the operations team triaging an incident; time is of the essence, and you need answers fast. Are you going to carefully run through a list of all members of the team responsible for that service? Or are you going to call the SME you know always answers the phone on a Sunday afternoon? Repeatedly calling the same one or two people places an undue burden on those individuals, potentially causing a single source of failure that can lead to burnout. With that said, an on-call rotation serves multiple functions: + + 1. Engineers know that their code and services are being covered when they are off-call so they can fully relax. + 2. The burden of being the "go-to" SME is parsed out to the rest of the team on rotation. + 3. Services become more reliable. + 4. Team knowledge and skills increase through deeper understanding of the codebase. + + + +By going beyond coding to shipping and owning, full-service ownership reduces the chaos associated with incidents by defining roles and responsibilities, removing unnecessary layers, and ultimately fostering a culture of empowerment and accountability. And, in the next article in this series, I'll share how full-service ownership can foster psychological safety. + +What has your experience been? Has being on-call helped you to become a better engineer? Do you loathe the thought of picking up a "pager"? Let us know your thoughts in the comments below or tweet [@julie_gund][7]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/full-service-ownership + +作者:[Julie GundersonJustin Kearns][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/juliegundhttps://opensource.com/users/juliegundhttps://opensource.com/users/juliegundhttps://opensource.com/users/kearnsjdhttps://opensource.com/users/ophir +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds) +[2]: https://opensource.com/sites/default/files/uploads/code_ship_own.png (Code it, ship it, own it) +[3]: https://opensource.com/article/18/1/getting-devops +[4]: https://opensource.com/article/18/10/sre-startup +[5]: https://www.pagerduty.com/resources/reports/digital-operations-uk/ +[6]: https://opensource.com/sites/default/files/uploads/unresponsiveapps.png (Amount of time consumers will wait for an unresponsive app) +[7]: https://twitter.com/julie_gund diff --git a/sources/talk/20190920 How to decommission a data center.md b/sources/talk/20190920 How to decommission a data center.md new file mode 100644 index 0000000000..1952fcb0a7 --- /dev/null +++ b/sources/talk/20190920 How to decommission a data center.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to decommission a data center) +[#]: via: (https://www.networkworld.com/article/3439917/how-to-decommission-a-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +How to decommission a data center +====== +Decommissioning a data center is lot more complicated than shutting down servers and switches. Here’s what you should keep in mind. +3dSculptor / Getty Images + +About the only thing harder than building a [data center][1] is dismantling one, because the potential for disruption of business is much greater when shutting down a data center than constructing one. + +The recent [decommissioning of the Titan supercomputer][2] at the Oak Ridge National Laboratory (ORNL) reveals just how complicated the process can be. More than 40 people were involved with the project, including staff from ORNL, supercomputer manufacturer Cray, and external subcontractors. Electricians were required to safely shut down the 9 megawatt-capacity system, and Cray staff was on hand to disassemble and recycle Titan’s electronics and its metal components and cabinets. A separate crew handled the cooling system. In the end, 350 tons of equipment and 10,800 pounds of refrigerant were removed from the site. + +**Read more data center stories** + + * [NVMe over Fabrics creates data-center storage disruption][3] + * [Data center workloads become more complex][4] + * [What is data-center management as a service (DMaaS)?][5] + * [Data center staff aging faster than equipment][6] + * [Micro-modular data centers set to multiply][7] + + + +While most enterprise IT pros aren’t likely to face decommissioning a computer the size of Titan, it is likely they’ll be involved with dismantling smaller-scale data centers given the trend for companies to [move away from on-premises data centers][8]. + +The pace of data center closure is going to accelerate over next three or four years, according to Rick Villars, research vice president, datacenter and cloud, at [IDC][9]. "Every company we’ve spoken to is planning to close 10% to 50% of their data centers over the next four years, and in some cases even 100%. No matter who you talk to, they absolutely have on the agenda they want to close data centers," Villars says. + +Successfully retiring a data center requires navigating many steps. Here’s how to get started. + +### Inventory data-center assets + +The first step is a complete inventory. However, given the preponderance of [zombie servers][10] in IT environments, it’s clear that a good number of IT departments don’t have a handle on data-center asset management. + +"They need to know what they have. That’s the most basic. What equipment do you have? What apps live on what device? And what data lives on each device?” says Ralph Schwarzbach, who worked as a security and decommissioning expert with Verisign and Symantec before retiring. + +All that information should be in a configuration management database (CMDB), which serves as a repository for configuration data pertaining to physical and virtual IT assets. A CMDB “is a popular tool, but having the tool and processes in place to maintain data accuracy are two distinct things," Schwarzbach says. + +A CMDB is a necessity for asset inventory, but “any good CMDB is only as good as the data you put in it,” says Al DeRose, a senior IT director responsible for infrastructure design, implementation and management at a large media firm. “If your asset management department is very good at entering data, your CMDB is great. [In] my experience, smaller companies will do a better job of assets. Larger companies, because of the breadth of their space, aren’t so good at knowing what their assets are, but they are getting better.” + +### Map dependences among data-center resources + +Preparation also includes mapping out dependencies in the data center. The older a data center is, the more dependencies you are likely to find. + +It’s important to segment what’s in the data center so that you can move things in orderly phases and limit the risk of something going wrong, says Andrew Wertkin, chief strategy officer with [BlueCat Networks][11], a networking connectivity provider that helps companies migrate to the cloud. "Ask how can I break this into phases that are independent – meaning ‘I can’t move that app front-end because it depends on this database,’" Wertkin says. + +The WAN is a good example. Connection points are often optimized, so when you start to disassemble it, you need to know who is getting what in terms of connections and optimized services so you don’t create SLA issues when you break the connection. Changing the IP addresses of well-known servers, even temporarily, also creates connection problems. The solution is to do it in steps, not all at once. + +### Questions to ask decomissioning providers + +Given the complexities and manpower needs of decommissioning a data center, it’s important to hire a professional who specializes in it. + +Experience and track record are everything when it comes to selecting a vendor, says Mike Satter, vice president at [OceanTech][12], which provides data center decommissioning and IT asset disposition services. There are a lot of small companies that say they can decommission a data center and fail because they lack experience and credentials, he says. "I can't tell you how many times we’ve come into a mess where we had to clean up what someone else did. There were servers all over the floor, hardware everywhere," Satter says. + +His advice? Ask a lot of questions. + +"I love having a client who asks a lot of questions," Satter says. “Don’t be shy to ask for references,” he adds. “If you are going to have someone do work on your house, you look up their references. You better know who the contractor will be. Maybe 10% of the time have I had people actually look into their contractor.” + +Among the processes you should ask about and conditions you should expect are: + + * Have the vendor provide you with a detailed statement of work laying out how they will handle every aspect of the data center decommissioning project. + * Ask the vendor to do a walkthrough with you, prior to the project, showing how they will execute each step. + * Find out if the vendor outsources any aspect of data center decommissioning, including labor or data destruction. + * Inquire about responsible recycling (see more below). + * Ask for references for the last three data center decommissioning clients the vendor serviced. + * Ask if the vendor will be able to recover value from your retired IT hardware. If so, find out how much and when you could expect to receive the compensation. + * Ask how data destruction will be handled. If the solution is software based, find out the name of the software. + * Learn about the vendor’s security protocols around data destruction. + * Find out where the truck goes when it leaves with the gear. + * Ask how hazardous materials will be disposed. + * Ask how metals and other components will be disposed. + + + +### Recycle electronics responsibly + +As gear is cleared out of the data center, it’s important to make sure it’s disposed of safely, from both a security and environmental standpoint. + +When it comes to electronics recycling, the key certification to look for is the [R2 Standard][13], Satter says. R2 – sometimes referred to as the responsible recycling certification – is a standard for electronics recyclers that requires certified companies to have a policy on managing used and end-of-life electronics equipment, components and materials for reuse, recovery and/or recycling. + +But R2 does more than that; it offers a traceable chain of custody for all equipment, tracking who touched every piece and its ultimate fate. R2 certified providers “aren’t outsourced Craigslist tech people. These are people who do it every day," Satter says. "There are techniques to remove that gear. They have a group to do data security on site, and a compliance project manager to make sure compliance is met and the chain of custody is met." + +And don’t be cheap, DeRose adds. "When I decommission a data center, I use a well-known company that does asset removal, asset destruction, chain of custody, provides certifications of destruction for hard drives, and proper disposal of toxic materials. All that needs to be very well documented not [only] for the environment’s protection but [also] for the company’s protection. You can’t wake up one morning and find your equipment was found dumped in a landfill or in a rainforest," DeRose says. + +Documentation is critical when disposing of electronic waste, echoes Schwarzbach. "The process must capture and store info related to devices being decommissioned: What is the intent for the device, recycling or new service life? What data resides on it? Who owns the data? And [what is] the category of data?" + +In the end, it isn't the liability of the disposal company if servers containing customer or medical information turn up at a used computer fair, it's the fault of the owners. "The creator of e-waste is ultimately liable for the e-waste," Schwarzbach says. + +### Control who's coming into the data center + +Shutting down a data center means one inevitability: You will have to bring in outside consultants to do the bulk of the work, as the ORNL example shows. Chances are, your typical data center doesn't let anywhere near 40 people inside during normal operations. But during decommissioning, you will have a lot of people going in and out, and this is not a step to be taken lightly. + +"In a normal scenario, the number of people allowed in the data center is selected. Now, all of a sudden, you got a bunch of contractors coming in to pack and ship, and maybe there’s another 50 people with access to your data center. It’s a process and security nightmare if all these people have access to your boxes and requires a whole other level of vetting," Wertkin says. His solution: Log people in and out and use video cameras. + +Any company hired to do a decommissioning project needs to clearly identify the people involved, DeRose says. "You need to know who your company is sending, and they need to show ID.” People are to be escorted in and out and never given a keycard. In addition, contractors should not to be left to decommission any room on their own. There should always be someone on staff overseeing the process, DeRose says. + +In short, the decommissioning process means lots of outside, non-staff being given access to your most sensitive systems, so vigilance is mandatory. + +None of the steps involved in a data center decommissioning should be hands-off, even when it requires outside experts. For the security and integrity of your data, the IT staff must be fully involved at all times, even if it is just to watch others do their work. When millions of dollars (even depreciated) of server gear goes out the door in the hands of non-employees, your involvement is paramount. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3439917/how-to-decommission-a-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/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.html +[3]: https://www.networkworld.com/article/3394296/nvme-over-fabrics-creates-data-center-storage-disruption.html +[4]: https://www.networkworld.com/article/3400086/data-center-workloads-become-more-complex-despite-promises-to-the-contrary.html +[5]: https://www.networkworld.com/article/3269265/data-center-management-what-does-dmaas-deliver-that-dcim-doesnt +[6]: https://www.networkworld.com/article/3301883/data-center/data-center-staff-are-aging-faster-than-the-equipment.html +[7]: https://www.networkworld.com/article/3238476/data-center/micro-modular-data-centers-set-to-multiply.html +[8]: https://www.networkworld.com/article/3391465/another-strong-cloud-computing-quarter-puts-pressure-on-data-centers.html +[9]: https://www.idc.com +[10]: https://www.computerworld.com/article/3196355/a-third-of-virtual-servers-are-zombies.html +[11]: https://www.bluecatnetworks.com/ +[12]: https://www.oceantech.com/services/data-center-decommissioning/ +[13]: https://sustainableelectronics.org/r2-standard +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190920 The Richest Man in History Shares his Thoughts- Jeff Bezos Top 5 Tips for Success.md b/sources/talk/20190920 The Richest Man in History Shares his Thoughts- Jeff Bezos Top 5 Tips for Success.md new file mode 100644 index 0000000000..6dd85f20c2 --- /dev/null +++ b/sources/talk/20190920 The Richest Man in History Shares his Thoughts- Jeff Bezos Top 5 Tips for Success.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Richest Man in History Shares his Thoughts: Jeff Bezos Top 5 Tips for Success) +[#]: via: (https://opensourceforu.com/2019/09/the-richest-man-in-history-shares-his-thoughts-jeff-bezos-top-5-tips-for-success/) +[#]: author: (Aashima Sharma https://opensourceforu.com/author/aashima-sharma/) + +The Richest Man in History Shares his Thoughts: Jeff Bezos Top 5 Tips for Success +====== + +[![][1]][2] + +_The story of Jeff Bezos and his immense success is not new, but it still can help the new generation of entrepreneurs and just young people to understand what it takes to become really successful in their field. Of course, you cannot just repeat what Bezos did and get the same result, but you can surely listen to some of Jeff Bezos advice and start your own unique path to prosperity. Brad Stone, the author of the book called The Everything Store: Jeff Bezos and the Age of Amazon, shares some of Bezos’ tips and ideas on what makes up for a [successful business][3], so follow along:_ + +**1\. Gather the Best People in Your Team** +Whether you are working on a team project in school or hiring people for your new business, you probably know how important it is to have reliable people in your team. Sharing some thoughts on Jeff Bezos success, we must also remember about the Two Pizza rule he introduced. As Bezos believes, the perfect size of the team is the one you can feed with two pizzas. Of course, there are more people than that working for Amazon, but they are all divided into smaller teams that consist of highly professional people. So, if you strive for success, make sure that you are surrounded by the best people equipped for the task you are up to. + +**2\. Learn From Mistakes** +We all make them; mistakes are unfortunate but important for all of us, and the best thing you can do with your mistake is to learn from it. Let’s say you are writing an essay and it does not go as well as you thought it would. Your professor does not like, and you get a low grade. Your choice is to either keep up with what you did before and fail again or to learn from it. Find some [_free essay sample_][4], go through it, make notes, use some assistance service, and craft a professional essay that will stun your professor. So, whenever you make a mistake, and there’s nothing you can do to promptly fix it — make it your teacher, that’s one of Amazon’s CEO tips we want you to remember. + +**3\. Be Brave** +While it might seem like an obvious tip, many students and young entrepreneurs get it wrong. If you are trying to do something new, let’s say start a business or just write some new essay, experimenting will be an integral part of your task. Experiments might fail, of course, but even if your experiment fails to deliver a desirable result, it is still going to be something new, something previously unseen. This is the best part of creating something new: you never know what you’ll end up with. And if you are brave, you are going to experiment on and on until one of your experiments brings you success and money. So, whether we talk writing your essays or starting a new business — you must be brave and ready to face both success and failure. + +**[![][5]][6]4\. Be Firm and Patient** +Braveness alone is not enough because even the bravest of us fail to achieve desired goals. So, the trick here is to be patient and keep pushing until you make it. If you are brave enough to start a new business or whatever it is new that you are planning to do, then you must also be patient and firm to withstand a potential failure. Many try and give up after the very first time they fail, and only a few like Jeff Bezos keep on pushing on until they reach their goals. Starting anew is always hard, especially if you have a couple of failures behind, some people lose faith in themselves and stop trying, so you must be firm in your desire to achieve [_success in life_][7]. Whatever you do and whatever challenges you face — keep on chasing your goal until you catch it. + +**5\. Think Big** +This very phrase might sound like a sort of cliche to some people, but if you start to comprehend what stands behind these words, it might make sense. When Bezos started his online retail service, his idea was not just to sell things, but to become the best retailer in the world. He accomplished his task brilliantly, and all of his achievements were only possible because he thought big. Bezos did not want to merely run business and make money, he wanted his company to be the best thing in the world. Over the years, he built a business empire that reflects the concept of thinking big at its best. + +**Wrap Up** +Of course, following this set of advice does not automatically make you a billionaire, but it might surely help on your way to achieving even some minor goals. Only a few of us will be able to become as successful as Jeff Bezos, and it might be you, why not? Just keep on pushing, be brave, learn from your mistakes, think big, and try to surround yourself with the best people. These are the top advice from the world’s richest men, so you might want to follow some of them in your daily life. Go ahead and strive for success, and maybe in a couple of years, someone will ask for your advice on how to reach success and become a billionaire. + +**By: Jessica Vainer** + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/the-richest-man-in-history-shares-his-thoughts-jeff-bezos-top-5-tips-for-success/ + +作者:[Aashima Sharma][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://opensourceforu.com/author/aashima-sharma/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/jeff1.jpg?resize=696%2C470&ssl=1 (jeff1) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/jeff1.jpg?fit=1200%2C810&ssl=1 +[3]: https://www.investopedia.com/articles/pf/08/make-money-in-business.asp +[4]: https://studymoose.com/ +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/jeff2.jpg?resize=350%2C233&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/jeff2.jpg?ssl=1 +[7]: https://www.success.com/10-tips-to-achieve-anything-you-want-in-life/ diff --git a/sources/talk/20190921 How spicy should a jalapeno be.md b/sources/talk/20190921 How spicy should a jalapeno be.md new file mode 100644 index 0000000000..6292afb1ee --- /dev/null +++ b/sources/talk/20190921 How spicy should a jalapeno be.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How spicy should a jalapeno be?) +[#]: via: (https://opensource.com/article/19/9/how-spicy-should-jalapeno-be) +[#]: author: (Peter Webb https://opensource.com/users/peterwebbhttps://opensource.com/users/mgifford) + +How spicy should a jalapeno be? +====== +Open source agriculture engages students in becoming problem solvers for +the future. +![Jalapenos][1] + +Everyone has opinions and preferences, especially when it comes to food. To establish a criterion when answering "How spicy should a jalapeño be?." the Scoville Heat Scale was developed as a standard to measure spiciness. This scale allows people to communicate and share information about how spicy we like our peppers. + +Similarly, open source technology standards, such as USB, I2C, MQTT, and others, were developed to enable global compatibility. Furthermore, open source hardware platforms have enabled communities to “speak the same language” without reinventing the wheel. For example, Raspberry Pi makes it easy for people to use their hardware as a baseline and then add onto it. This has created a revolution in many industries by enabling individuals, startups, and large corporations to apply hardware and software to complex problems without having to design them from the ground up. + +### MARSfarm: Using food to engage students in STEM + +[MARSfarm][2] is a program that aims to increase students’ engagement with science, technology, engineering, and math (STEM) by relating agriculture to real-life problems, such as growing more food with fewer resources. + +MARSfarm’s goal is to provide [engaging material to inspire individuals and students][3] to collaborate on solving big problems, like how we can sustainably survive on another planet, while simultaneously improving the food system here on our own planet. We do this by tying together the world of food and technology and enabling users to choose things like how spicy they want the jalapeño they are growing to be. More importantly, we want to alter other compounds besides spiciness (known as capsaicin by chemists), like Vitamin K, which is a concern for those who lack access to fresh fruits and vegetables, such as an astronaut living on Mars. With standardized open source hardware and software as a base, a user can focus on whatever unique objectives they have for their own “garden” while retaining the benefits of a larger community. + +### The importance of open source and standards + +When trying to define standards with food, there is no “right” answer. Food is very personal and influenced by socioeconomic factors as well as (perhaps most importantly) geographical region. + +We designed MARSfarm using open source principles to allow teachers to customize and add to the hardware and software in their classrooms. To make it more familiar and approachable, we tried to leverage existing standardized software and hardware platforms. By sticking with common software languages like Python and HTML and hardware like the Raspberry Pi, we reduce the potential barriers to entry for users who could be intimidated by a project of this magnitude. Other hardware we use, like PVC, Mylar, and full-spectrum LEDs, are globally accessible from brick-and-mortar storefronts and online retailers that adhere to industry standards to ensure consistency throughout the community. + +By keeping our hardware and software standard, we can also create a marketplace where users can exchange “recipes” for growing food. Similar to how [Thingverse][4] has enabled anyone with a 3D printer to make just about anything—without having to be an engineer—simply by exchanging CAD files, we want to enable our users to find climate recipes from around the world and grow them—without having to be a botanist. The way to achieve this is by having a large number of people growing the same plant but with different climate factors. The more data that is aggregated, the better we’ll understand how different climate factors affect things like taste and the time it takes a plant to grow. + +We also enlisted the support of open source agricultural projects like the [Open Agriculture Initiative][5] at the MIT Media Lab, where we’ve found many other individuals passionate about applying technology to optimize food. Another consistent source of innovation in agriculture has been NASA, which has achieved [record harvests and been a point of collaboration][6] between universities and countries for decades. + +### Building a _food computer_ + +Open source communities thrive when they’re applied to something both significant and personal. There is perhaps nothing more personal than the food we consume, the literal fuel that powers us. + +Until very recently, even within the last decade, many plants could not be grown in certain regions due to lack of available light, which is the most fundamental input a plant requires for its most basic process, photosynthesis. With the advent of technologies like LEDs, organizations (other than NASA) can afford to grow just about anything, anywhere, within the bounds of what the market demands and will pay for. + +As we continue living far away from where our food is produced, we continue to understand it less and less. When we forget our personal connection to food, we risk damaging not only our health but our communities and the planet where our species lives. To mitigate this risk, MARSfarm leads projects like the [$300 Food Computer][7], which makes indoor growing systems more affordable and accessible. These types of projects also put more of this technology in more classrooms. The more that individuals and students work with these projects, the more data we’ll have, and the better we will understand the best ways to grow our food. + +In fact, the improvement in lighting technology has been so dramatic that consumer products like [Aerogarden][8] have empowered thousands of individuals to grow edible plants at home, not only on their windowsills but on their countertops where there is no access to natural light. + +Because of these leaps in technology, we’re developing a world where there are “libraries” of plants that can be “forked” onto devices to be grown by anyone. If you’d like to get started, please to visit our [GitHub][9] where we host software for all of our ongoing projects. + +### Help spread the word + +We need your help to expose as many students as possible to the wonders of applying open source technology to agriculture. Please share this with at least one teacher you know and any students who have a passion for STEM. MARSfarm is actively working with open source contributors, recruiting employees, and conducting beta tests in schools. + +* * * + +_For more information about what the farmers of tomorrow are doing with open tools and principles today, watch the video [Farming for the Future][3]._ + +Co-authored by John Whitehead . For many people spring means a return to the bounty of fresh, local... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/how-spicy-should-jalapeno-be + +作者:[Peter Webb][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/peterwebbhttps://opensource.com/users/mgifford +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/jalepeno.jpg?itok=R_LWPTlm (Jalapenos) +[2]: https://marsfarm.io/ +[3]: https://www.redhat.com/en/open-source-stories/farming-for-the-future +[4]: https://www.thingiverse.com/ +[5]: https://forum.openag.media.mit.edu/ +[6]: https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20150015991.pdf +[7]: https://marsfarm.io/home/community/mvp-food-computer/ +[8]: https://www.aerogarden.com/ +[9]: https://github.com/futureag diff --git a/sources/talk/20190923 Deloitte Launches New Tool for Tracking the Trajectory of Open Source Technologies.md b/sources/talk/20190923 Deloitte Launches New Tool for Tracking the Trajectory of Open Source Technologies.md new file mode 100644 index 0000000000..aebc6cb011 --- /dev/null +++ b/sources/talk/20190923 Deloitte Launches New Tool for Tracking the Trajectory of Open Source Technologies.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Deloitte Launches New Tool for Tracking the Trajectory of Open Source Technologies) +[#]: via: (https://opensourceforu.com/2019/09/deloitte-launches-new-tool-for-tracking-the-trajectory-of-open-source-technologies/) +[#]: author: (Longjam Dineshwori https://opensourceforu.com/author/dineshwori-longjam/) + +Deloitte Launches New Tool for Tracking the Trajectory of Open Source Technologies +====== + + * _**Called Open Source Compass, the new open source analysis tool provides insights into 15 emergent technology domains**_ + * _**It can help software engineers in identifying potential platforms for prototyping, experimentation and scaled innovation.**_ + + + +Deloitte has launched a first-of-its-kind public data visualization tool, called Open Source Compass (OSC), which is intended to help C-suite leaders, product managers and software engineers understand the trajectory of open source development and emerging technologies. + +Deloitte collaborated with University of Toulouse Chair of Artificial and Natural Intelligence Toulouse Institute (ANITI) and co-founder of Datawheel, César Hidalgo to design and developed the tool. + +The tool enables users to search technology domains, projects, programming languages and locations of interest, explore emerging trends, run comparisons, and share and download data. + +“Open source software has been around since the early days of the internet and has incited a completely new kind of collaboration and productivity — especially in the realm of emerging technology,” said Bill Briggs, chief technology officer, Deloitte Consulting LLP. + +“Deloitte’s Open Source Compass can help provide insights that allow organizations to be more deliberate in their approach to innovation, while connecting to a pool of bourgeoning talent,” he added. + +**Free and open to the public** + +Open Source Compass will provide insights into 15 emergent technology domains, including cyber security, virtual/augmented reality, serverless computing and machine learning, to name a few. + +The site will offer a view into systemic trends on how the domains are evolving. The open source platform will also explore geographic trends based on project development, authors and knowledge sharing across cities and countries. It will also track how certain programming languages are being used and how fast they are growing. Free and open to the public, the site will enable users to query technology domains of interest, run their own comparisons and share or download data. + +**The benefits of using Open Source Compass** + +OSC analyzes data from the largest open source development platform which brings together over 36 million developers from around the world. OSC visualizes the scale and reach of emerging technology domains — over 100 million repositories/projects — in areas including blockchain, machine learning and the Internet of Things (IoT). + +Some of the key benefits of Deloitte’s new open source analysis tool include: + + * Exploring which specific open source projects are growing or stagnating in domains like machine learning. + * Identifying potential platforms for prototyping, experimentation and scaled innovation. + * Scouting for tech talent in specific technology domains and locations. + * Detecting and assessing technology risks. + * Understanding what programming languages are gaining or losing ground to inform training and recruitment + + + +According to Ragu Gurumurthy, global chief innovation officer for Deloitte Consulting LLP, Open Source Compass can address different organizational needs for different types of users based on their priorities. + +He explained, “A CTO could explore the latest project developments in machine learning to help drive experimentation, while a learning and development leader can find the most popular programming language for robotics that could then be taught as a new skill in an internal course offering.” + +Datawheel is an award-winning company specialized in the creation of data visualization solutions. “Making sense of large streams of data is one of the most pressing challenges of our day,” said Hidalgo. + +“In Open Source Compass, we used our latest technologies to create a platform that turns opaque and difficult to understand streams of data into simple and easy to understand visualizations,” he commented. +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/deloitte-launches-new-tool-for-tracking-the-trajectory-of-open-source-technologies/ + +作者:[Longjam Dineshwori][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://opensourceforu.com/author/dineshwori-longjam/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20190923 Simulating Smart Cities with CupCarbon.md b/sources/talk/20190923 Simulating Smart Cities with CupCarbon.md new file mode 100644 index 0000000000..78d8fb2eac --- /dev/null +++ b/sources/talk/20190923 Simulating Smart Cities with CupCarbon.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Simulating Smart Cities with CupCarbon) +[#]: via: (https://opensourceforu.com/2019/09/simulating-smart-cities-with-cupcarbon/) +[#]: author: (Dr Kumar Gaurav https://opensourceforu.com/author/dr-gaurav-kumar/) + +Simulating Smart Cities with CupCarbon +====== + +[![][1]][2] + +_CupCarbon is a smart city and IoT wireless sensor network (WSN) simulator. It is a new platform for 2D/3D design, visualisation and the simulation of radio propagation and interferences in IoT networks. It is particularly relevant in India today, since the development of smart cities is a priority of the government._ + +It was a wide range of devices interconnected through wireless technologies that gave birth to the Internet of Things (IoT). A number of smart gadgets and machines are now monitored and controlled using IoT protocols. Across the world, devices enjoy all-time connectivity because of the IoT. + +![Figure 1: Key element and components of a smart city project][3] + +![Figure 2: Official Web portal of the CupCarbon simulator][4] + +![Figure 3: Roads, objects and connections in the CupCarbon simulator][5] + +From the research reports of _Statista.com_, sales of smart home devices in the US went up from US$ 1.3 billion to US$ 4.5 billion, from 2016 to 2019. The _Economic Times_ reports that there will be around 2 billion units of eSIM based devices by 2025. An eSIM enables subscribers to use the digital SIM card for smart devices and the services can be activated without a physical SIM card. It is one of the recent and more secure applications of IoT. + +Beyond the traditional applications, IoT is being researched for purposes like monitoring the environment and providing prior notifications to regulating agencies so that appropriate action can be taken, when required. Reports from _LiveMint.com_ indicate that the Indian Institute of Technology, New Delhi and Ericsson are partnering to tackle the air pollution in Delhi. News reports from Grand View Research Inc. indicate that the global NB (Narrow Band)-IoT market size is predicted to touch more than US$ 6 billion by 2025. NB-IoT refers to the radio technology standard with a low-power wide-area network (LPWAN) that enables wide scale coverage and better performance of connected smart devices. + +![Figure 4: Working panel of the CupCarbon simulator][6] + +![Figure 5: Adding different types of sensor nodes in CupCarbon][7] + +![Figure 6: Option for the SenScript window in CupCarbon][8] + +**Free and open source tools for IoT implementation** +A wide range of free and open source simulators and frameworks is available to simulate IoT scenarios. These can be used for R&D so that the performance of different smart city and IoT algorithms can be analysed. Research projects for a smart city need to be simulated so that the citizen behaviour can be evaluated on multiple parameters before launching the actual IoT enabled smart city systems. + +**[![][9]][10]Installing and working with CupCarbon** +CupCarbon (__) is a prominent, multi-featured simulator that is used for the simulation of smart cities and IoT based advanced wireless network scenarios. + +It provides an effective graphical user interface (GUI) for the integration of objects in the smart city with wireless sensors. The sensor nodes and algorithms can be programmed in the SenScript Editor in CupCarbon. SenScript is the script that is used for the programming and control of sensors used in the simulation environment. In SenScript, a number of programming constructs and modules can be used so that the smart city environment can be simulated. + +![Figure 7: The SenScript Editor in CupCarbon for programming of sensors][11] + +![Figure 8: Integration of markers and route in CupCarbon][12] + +![Figure 9: Executing SenScript in CupCarbon to get an animated view of the smart city][13] + +**Creating dynamic scenarios for IoT and smart cities using the CupCarbon simulator** +The working environment of CupCarbon has numerous options to create and program sensors of different types. In the middle, there is a Map View, in which the smart city under simulation can be viewed dynamically. + +The sensors and smart objects are displayed in Map View. To program these smart devices and traffic objects, the toolbar of CupCarbon provides the programming modules so that the behaviour of every object can be controlled. + +Any number of nodes or motes can be imported in CupCarbon to program them in random positions. In addition, the weather conditions and environment factors can be added so that the smart city project can be simulated under specific environmental conditions. Using this option, the performance of the smart city can be evaluated under different situations with varying city temperatures. + +The SenScript editor provides the programming editor so that the functions and methods with each sensor or smart device can be executed. This editor has a wide range of inbuilt functions which can be called. These functions can be attached to the sensors and smart objects in the CupCarbon simulator. + +The markers and routes provide the traffic path for the vehicles in the smart city, so that these can follow the shortest path from source to destination, factoring in congestion or traffic jams. +On executing the code written in SenScript, an animated view of the smart city is produced, representing the mobility of vehicles, persons and traffic objects. This view enables the development team to check whether there is any probability of congestion or loss of performance. Using this process of visualisation, the algorithms and associated code of SenScript can be improved so that the proposed implementation performs better, with minimum resources. + +![Figure 10: Google Map View of a simulation in CupCarbon][14] + +![Figure 11: Analysing the energy consumption and research parameters in CupCarbon][15] + +In CupCarbon, the simulation scenario can be viewed like a Google Map including Satellite View. It can be changed to Satellite View with a single click. Using these options, the traffic, roads, towers, vehicles and even the congestion can be visualised in the simulation, for developers to get a sense of the real environment. + +[![][16]][17]Simulating a smart city scenario using CupCarbon is always required to analyse the performance of the network that is to be deployed. For such evaluations of a new smart city project, key parameters like energy, power and security also need to be investigated. CupCarbon integrates the options for energy consumption and other parameters, so that researchers and engineers can view the expected effectiveness of the project. + +Government agencies as well as corporate giants are getting involved in big smart city projects so that there is better control over the huge infrastructure and resources. Research scholars and practitioners can propose novel and effective algorithms for smart city implementations. The proposed algorithms can be simulated using smart city simulators and the performance parameters can be analysed. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/simulating-smart-cities-with-cupcarbon/ + +作者:[Dr Kumar Gaurav][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://opensourceforu.com/author/dr-gaurav-kumar/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Smart-Cities-3d-Simulating-1.jpg?resize=696%2C379&ssl=1 (Smart Cities 3d Simulating) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Smart-Cities-3d-Simulating-1.jpg?fit=800%2C436&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-Key-elements-and-components-of-a-smart-city-project.jpg?resize=253%2C243&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Official-Web-portal-of-the-CupCarbon-simulator.jpg?resize=350%2C174&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-3-Roads-objects-and-connections-in-the-CupCarbon-simulator.jpg?resize=350%2C193&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-4-Working-panel-of-the-CupCarbon-simulator.jpg?resize=350%2C130&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-5-Adding-different-types-of-sensor-nodes-in-CupCarbon.jpg?resize=350%2C240&ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-6-Option-for-the-SenScript-window-in-CupCarbon.jpg?resize=350%2C237&ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Smart-cities-and-advanced-wireless-scenarios-using-IoT.jpg?resize=350%2C259&ssl=1 +[10]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Smart-cities-and-advanced-wireless-scenarios-using-IoT.jpg?ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-7-The-SenScript-Editor-in-CupCarbon-for-programming-of-sensors.jpg?resize=350%2C172&ssl=1 +[12]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-8-Integration-of-markers-and-routes-in-CupCarbon.jpg?resize=350%2C257&ssl=1 +[13]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-9-Executing-SenScript-in-CupCarbon-to-get-an-animated-view-of-the-smart-city.jpg?resize=350%2C227&ssl=1 +[14]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-10-Google-Map-View-of-a-simulation-in-CupCarbon.jpg?resize=350%2C213&ssl=1 +[15]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-11-Analysing-the-energy-consumption-and-research-parameters-in-CupCarbon.jpg?resize=350%2C214&ssl=1 +[16]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Table-1-Free-and-open-source-simulators-for-IoT-integrated-smart-city-implementations.jpg?resize=350%2C181&ssl=1 +[17]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Table-1-Free-and-open-source-simulators-for-IoT-integrated-smart-city-implementations.jpg?ssl=1 diff --git a/sources/talk/20190925 6 Fintech Startups That Are Revolutionizing the Finance Space.md b/sources/talk/20190925 6 Fintech Startups That Are Revolutionizing the Finance Space.md new file mode 100644 index 0000000000..3dfd921b79 --- /dev/null +++ b/sources/talk/20190925 6 Fintech Startups That Are Revolutionizing the Finance Space.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Fintech Startups That Are Revolutionizing the Finance Space) +[#]: via: (https://opensourceforu.com/2019/09/6-fintech-startups-that-are-revolutionizing-the-finance-space/) +[#]: author: (Andrew Cioffi https://opensourceforu.com/author/andrew-cioffi/) + +6 Fintech Startups That Are Revolutionizing the Finance Space +====== + +[![][1]][2] + +_Financial technology “FinTech” is rapidly changing the way people all over the world interact with finances. This includes transactions, trading currencies, borrowing, or even obtaining business capital. Gone are the days when getting access to cash for various uses required changing a lot of hands or took days. Below are six fintech companies that are making a difference in people’s lives._ + +**MANGOPAY** + +This startup is shaking payment systems by eliminating the many partners needed to facilitate online payments. The company employs white-label technology to cover all activities required in payments processes, making them simpler. + +[![][3]][4]In this way, MANGOPAY also enables new startups to get a leg up in the market by covering the often daunting process of account opening and connecting to financial services. It also simplifies payment processes for companies with intricate payment processes which traditional payment channels cannot handle. An example is the online farmers market The Food Assembly, which now has a shorter and more convenient supply chain favorable to farmers, customers, and communities. + +**Xapo** + +[_Bitcoin_][5] owners can now access the currency easier and keep it more securely, thanks to Xapo. Since it’s a virtual currency, many investors fear that their accounts might be hacked, and the company eases those fears by providing ‘vaults’ for them to secure their money. + +[![][6]][7]These vaults are in the form of offline encrypted servers located around the world that permit access only by biometric identification. On top of that, the servers have round the clock video surveillance together with armed personnel. Xapo has also revolutionized payments by introducing a debit card backed to the Xapo Wallet that will allow users to use it as a standard debit card. + +**Kantox** + +Kantox is a multinational company that provides foreign currency exchange and international payment services for small businesses and individual customers. Its platform is designed to help clients gain more control over their currency transactions. + +[![][8]][9]Its foreign currency solutions include a free [_forex demo_][10] account to practice your forex trading skills, managing currency risks by the provision of hedging tools, etc. it also provides access to over 130 currencies including exotics like the Colombian Peso, The South Korean Won, the Djibouti Franc and many more. + +**TransferWise** + +TransferWise is an online transfer service that allows users to transfer money abroad in fast and affordably. In fact, the platform can save you up to 90% of the traditional bank charges. The service is a hit among expatriates and global travelers. TransferWise excels in the international money transfer space in these ways: + +[![][11]][12]You can send money overseas at a cost eight times cheaper than with your local bank +There are no hidden costs like a rise in exchange rates – all transaction charges are transparent +Internal money transfers are finalized within 24 hours, mostly in mere seconds, compared with the three or more days for mainstream banks +Money is sent directly to your recipient via their bank account +Both businesses and individuals can use the platform + +**Seedrs** + +Seedrs is a UK-based [_equity crowdfunding_][13] platform that makes it easier for startups and established companies to get funding. Unlike before, when it was difficult for aspiring entrepreneurs to kick start their businesses unless they had rich connections, Seedrs helps upcoming firms to get access to capital. + +[![][14]][15]Seedrs has also opened a pathway for people who are interested in investing in the asset class. This is because the platform eliminates all the time and money requirements that were required to invest in companies before. With as little as 20, 500, or 1,000 pounds, anyone can now invest in an inspiring business. This is a testimony to why the platform has been so successful – it has so far raised over £210 million for more than 490 startups. + +**Expensify** + +This is a fintech startup that enables small businesses to streamline the receipts and expenses payment function. It has partnered with reputable firms in the accounting space to design integrations to accounting packages, time tracking software, and other workflow solutions. With this, the company hopes to make all work functions as seamless and efficient as possible, allowing workers to focus energy on productive tasks. + +[![][16]][17]Even if you’re just launching your business and you can’t yet afford a complex digital platform, you can still access Expensify’s freemium version. This allows you to keep an audit trail of your expenses without financial stress. Expensify also works with thousands of nonprofits to streamline their socially important work. This enables them to focus on their mission and spend less time on managing expenses. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/6-fintech-startups-that-are-revolutionizing-the-finance-space/ + +作者:[Andrew Cioffi][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://opensourceforu.com/author/andrew-cioffi/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1.jpg?resize=696%2C464&ssl=1 (1) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1.jpg?fit=960%2C640&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-3.png?resize=350%2C233&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-3.png?ssl=1 +[5]: https://money.cnn.com/infographic/technology/what-is-bitcoin/index.html +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3-1.png?resize=350%2C164&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3-1.png?ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4-2.png?resize=350%2C230&ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4-2.png?ssl=1 +[10]: https://admiralmarkets.com/education/articles/forex-basics/forex-demo-account-benefits +[11]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/5-1.png?resize=350%2C177&ssl=1 +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/5-1.png?ssl=1 +[13]: https://www.forbes.com/sites/howardmarks/2018/12/19/what-is-equity-crowdfunding/#5f6e958f3b5d +[14]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/6.png?resize=236%2C240&ssl=1 +[15]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/6.png?ssl=1 +[16]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/7.png?resize=220%2C391&ssl=1 +[17]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/7.png?ssl=1 diff --git a/sources/talk/20190925 How a simpler mmWave architecture can connect IoT.md b/sources/talk/20190925 How a simpler mmWave architecture can connect IoT.md new file mode 100644 index 0000000000..2712e000ee --- /dev/null +++ b/sources/talk/20190925 How a simpler mmWave architecture can connect IoT.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How a simpler mmWave architecture can connect IoT) +[#]: via: (https://www.networkworld.com/article/3440498/how-a-simpler-mmwave-architecture-can-connect-iot.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How a simpler mmWave architecture can connect IoT +====== +Upcoming 5G millimeter wave frequencies are being bandied as a good, solid network for IoT. But some say they may be too elaborate. A stripped-down version of millimeter wave technology may be the solution. +Cofotoisme / Getty Images + +Current wireless technologies, such as Wi-Fi, won’t provide enough support for the billions of internet of things (IoT) sensors and networks that are expected to come on stream in the next few years, say researchers. More speed, efficiency and bandwidth will be needed. Plus, the equipment must cost significantly less than existing gear, including upcoming 5G equipment. + +To address the issue, scientists at University of Waterloo are developing a stripped-down version of millimeter wave technology. + +“A growing strain will be placed on requirements of wireless networks,” the researchers say in an [article announcing a new low-power, low-cost 5G network technology][1] that it calls mmX. They say the technology is specifically geared towards IoT. + +“Millimeter wave offers multi-gigahertz of unlicensed bandwidth. More than 200 times that allocated to today's Wi-Fi and cellular networks,” the article says. That’s “in comparison to Wi-Fi and Bluetooth, which are slow for many IoT applications.” + +**[ Also see: [What is edge computing?][2] and [How edge networking and IoT will reshape data centers][3] ]** + +However, upcoming, ultra-fast, ultra-high capacity 5G networks, which will take advantage of millimeter wave, use considerable amounts of electrical energy and computing power, the researchers say. That means they aren't good for the low-cost, low-power IoT devices of the kind we’re going to see in many use cases. New devices must be low-power because they need to stay up longer, preferably indefinitely. Therefore, the idea of just adding power-intensive millimeter radios to the networks defeats the object to a certain extent. There needs to be more of a stripped-down millimeter network. + +“We address the key challenges that prevent existing mmWave technology from being used for such IoT devices,” the researcher say in their [the SIGCOMM ’19-published paper][4]. + +The problem with current wireless technologies isn’t so much that there’s anything fundamentally wrong with them, but that new IoT devices have triggered changes in requirements from incumbent radios, such as in today’s smartphones, and also that new devices function with a low-rate modulation scheme—rates much lower than channel capacity, in other words. Both are inefficient in use of spectrum. + +**** From HPE: [ITaaS and Corporate Storage Technology][5]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** + +### Beam searching prevents mmWave from being used for IoT + +The researchers say they have identified high-power consumption, expensive hardware, and beam searching as the key culprits that will prevent mmWave from being adopted for IoT implementation. + +Beam searching, for example, is a limitation of regular mmWave. It’s where power is focused to prevent the signal path-loss from decaying, but it is computationally complex, is expensive, and uses a lot of energy. That all adds to overhead. The researchers say they can eliminate beam searching through a form of over-the-air modulation where the signal isn’t modulated before transmission but during the transmission. That “eliminates the need of beam searching in mmWave radios,” they say. They also reduce the amount of feedback data needed from access points, which also helps. + +Another special feature mmX offers is that its hardware is a simple Raspberry Pi add-on board, allowing the “networking community” to easily experiment. Twenty-five million Raspberry Pi development computers have reportedly been sold as of earlier this year.  + +Energy efficiency is “even lower than existing Wi-Fi modules,” the researchers claim. Their mmX is “a far more efficient and cost-effective architecture for imminent IoT applications,” they say. + +**More about edge networking:** + + * [How edge networking and IoT will reshape data centers][3] + * [Edge computing best practices][6] + * [How edge computing can help secure the IoT][7] + + + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440498/how-a-simpler-mmwave-architecture-can-connect-iot.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://uwaterloo.ca/news/news/researchers-develop-low-power-low-cost-network-5g +[2]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[3]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[4]: https://dl.acm.org/citation.cfm?id=3342068 +[5]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/ +[6]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html +[7]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md new file mode 100644 index 0000000000..191900c10a --- /dev/null +++ b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Most enterprise networks can't handle big data loads) +[#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Most enterprise networks can't handle big data loads +====== +As more data moves through the network, efforts to keep up are lagging due to leadership and technology issues. +Metamorworks / Getty Images + +Another week, another survey that finds IT cannot keep up with the ever-expanding data overload. This time the problem surrounds network bandwidth and overall performance. + +[A survey of 300 IT professionals][1] conducted by management consultant firm Accenture found the majority feel their enterprise networks are not up to the task of handling big data and internet of things (IoT) deployments. Only 43% of those companies polled said their networks are ready to support the cloud, IoT, and other digital technologies. + +**[ Learn more about SDN: Find out [where SDN is going][2] and learn the [difference between SDN and NFV][3]. | Get regularly scheduled insights: [Sign up for Network World newsletters][4]. ]** + +A key reason (58%) is a “misalignment between IT and business needs” that is slowing those rollouts. That is an unusual finding, since 85% of respondents also reported that their networks were completely or mostly ready to support the business’ digital initiatives. So which is it? + +The second and third most commonly cited barriers were “inherent complexities between business requirements and operational needs” and “demands for bandwidth, performance, etc. outpacing the ability to deliver” at 45% each. + +Network bottlenecks continue to grow as the sheer amount of data being pumped over the wires continues to increase thanks to analytics and other big data technologies. The survey found that bandwidth demands were not being met and current network performance continues to fall short. + +Other reasons cited were lack of networking skills, device sprawl, and aging equipment. + +### One solution to network performance woes: SDN + +Accenture found that most firms said [software-defined networks (SDN)][5] were the solution for bandwidth and performance challenges, with 77% of those surveyed reporting they were in the process of deploying SDN or have completed the deployment. It qualified that, noting that while SDN may be in place in parts of the organization, it is not always rolled out uniformly enterprise-wide. + +**** From HPE: [ITaaS and Corporate Storage Technology][6]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** + +Now, while it seems no one ever has enough budget for all of their IT ambitions, 31% of those surveyed describe funding network improvements as “easy” and within the network infrastructure team’s control, with CIOs/CTOs being much more likely to report the funding process as “easy” (40%), compared to their direct reports (13%) or directors and vice presidents of infrastructure/network (19%).  + +Saying, "Legacy networks alone cannot support the innovation and performance required in the digital age," the report calls for embracing new technologies, without saying SDN by name. It also called for greater collaboration between the C suite and their direct reports because it was clear there was a disconnect between how the two sides viewed things. + +"We believe a new network paradigm is needed to ensure networks meet current and future business needs. However, although there are signs of progress, the pace of change is slow. Companies must undertake significant work before they achieve a unified and standardized enterprise capability that will offer the bandwidth, performance and security necessary to support business needs today—and tomorrow," the report concluded. + +**[ Now see: [How network pros acquire skills for SDN, programmable networks][7] ]** + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.accenture.com/_acnmedia/pdf-107/accenture-network-readiness-survey.pdf#zoom=50 +[2]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html +[3]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html +[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/ +[7]: https://www.networkworld.com/article/3405522/how-network-pros-acquire-skills-for-sdn-programmable-networks.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190925 The 10 most powerful companies in IoT.md b/sources/talk/20190925 The 10 most powerful companies in IoT.md new file mode 100644 index 0000000000..b176b87fc8 --- /dev/null +++ b/sources/talk/20190925 The 10 most powerful companies in IoT.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The 10 most powerful companies in IoT) +[#]: via: (https://www.networkworld.com/article/3440857/the-10-most-powerful-companies-in-iot.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +The 10 most powerful companies in IoT +====== + +The [Internet of Things][1] is still very much a growth industry. As a technology area whose development is dictated by the needs of the operational side of any given business, it’s a new challenge for traditional IT companies – and one that gives them an unusual array of competitors. But there are always going to be a few companies that set the tone, and we’ve collected what we think are the 10 most powerful players in the IoT sector right now. + +A word on methodology. We began by looking at about 25 prominent corporate names in IoT, comparing them based on how innovative their technology is, their market share and solution depth and breadth. + +**More on IoT:** + + * [What is edge computing and how it’s changing the network][2] + * [10 Hot IoT startups to watch][3] + * [The 6 ways to make money in IoT][4] + * [What is digital twin technology, and why it's important to IoT][5] + * [Blockchain, service-centric networking key to IoT success][6] + * [Getting grounded in IoT networking and security][7] + * [Building IoT-ready networks must become a priority][8] + * [What is the Industrial IoT? [And why the stakes are so high]][9] + + + +What we mean by the latter two terms is fairly straightforward. Depth refers to how much of the stack in a given IoT implementation that a company’s products are designed to handle, while breadth refers to how many different verticals to which those products are relevant. + +Market share can be difficult to measure, so we offer those estimates based mostly on extensive conversations with and data provided by analysts. Finally, where innovation is concerned, we tried to get a sense of the degree to which a given company’s technology is unique or at least much-imitated by its competitors. + +Here's the 10 most powerful in alphabetical order. + +### Accenture + +_Innovation:_ Accenture isn’t known for its in-house technical wizardry, and the secret sauce here is the company’s expertise at bringing in hardware and software from its partners, including Microsoft, Amazon and Cisco, which in itself is quite an achievement. The company refers to it as “connected platforms as a service,” or CPaaS. + +_Market Share:_ Directly quantifying IoT market share is a difficult exercise, but Accenture’s one of the best-known integrators on the market, bringing together platform providers, hardware manufacturers and makers of specialist solutions. + +_Depth of solution:_ Per Gartner’s latest IIoT Magic Quadrant report, the combination of open-source IP and Accenture’s own, usually acquired, tech makes for an “extensible and configurable” IoT platform. Ironically, it can be something of a walled garden. Once you’re working with Accenture, you’re mostly locked into working with its partners, Gartner notes, but that partner ecosystem is still quite extensive. + +_Breadth of solution:_ Accenture’s made a successful business out of helping enterprises in a wide variety of industries get their technology to work for them, so they’ve got a broad base of vertical-specific knowledge to call on for IoT, which is a critically important thing to have. + +### Amazon Web Services + +_Innovation:_ The fully integrated approach to IoT analytics – which lets AWS bring its formidable array of data analysis and machine learning tools together with several purpose-built frameworks for IoT insights and control – is now par for the course among big public cloud providers offering themselves up as a general purpose IoT back-end. But AWS was the first one to pull all those elements together in a meaningful way and has set the standard. + +To continue reading this article register now + +[Get Free Access][10] + +[Learn More][11]   Existing Users [Sign In][10] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440857/the-10-most-powerful-companies-in-iot.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[3]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html +[4]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html +[5]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html +[6]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html +[7]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html +[8]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html +[9]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[10]: javascript:// +[11]: https://www.networkworld.com/learn-about-insider/ diff --git a/sources/talk/20190925 The Great Open Source Divide- ICE, Hippocratic License and the Controversy.md b/sources/talk/20190925 The Great Open Source Divide- ICE, Hippocratic License and the Controversy.md new file mode 100644 index 0000000000..bbb1fd64de --- /dev/null +++ b/sources/talk/20190925 The Great Open Source Divide- ICE, Hippocratic License and the Controversy.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Great Open Source Divide: ICE, Hippocratic License and the Controversy) +[#]: via: (https://itsfoss.com/hippocratic-license/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +The Great Open Source Divide: ICE, Hippocratic License and the Controversy +====== + +_**Coraline Ada Ehmke has created “Hippocratic License” that “add ethics to open source projects”. But this seems to be just the beginning of a controversy as the “Hippocratic License” may not be open source at all.**_ + +Coraline Ada Ehmke, better known for her [Contributor Covenant][1], has modified the MIT open source license into Hippocratic License that adds a couple of conditions to the existing MIT license. Before you learn what it is, let me give you the context on why it’s been created in the first place. + +### No Tech for ICE + +![No Tech For ICE | Image Credit Science for All][2] + +Immigration and Customs Enforcement agency of the US government, [ICE][3], has been condemned by human rights groups and activists for inhumane practices of separating children from their parents at the US-Mexico border under the new strict immigration policy. + +Some techies have been vocal against the actions of ICE and they don’t want ICE to use tech projects they work on as it helps ICE in one way or another. + +The “[No Tech for ICE][4]” movement has been going on for some time but it got highlighted once again this week when an engineer named [Seth Vargo took down his open source project after finding ICE was using it][5] through Chef. + +The project was called [Chef Sugar][6], a Ruby library for simplifying work with [Chef][7], a platform for configuration management. ICE is one of the clients for Chef. The project withdrawal momentarily impacted Chef and its clients. Chef swiftly fixed the problem by uploading the Chef Sugar project on its own GitHub repository. + +Despite the trouble it caused for a number of companies using Chef worldwide, Vargo made a point. The pressure tactic worked and after [initial resistance][8], Chef caved in and [agreed to not renew its contract with ICE][9]. + +Now Chef Sugar is an open source project and its developer cannot stop people from forking it and continue using it. And that’s where [Coraline Ada Ehmke][10] came up with a new licensing model called Hippocratic License. + +### What is Hippocratic License? + +![][11] + +To enable more developers to forbid unethical organizations like ICE from using their open source projects, Coraline Ada Ehmake introduced a new license called “Hippocratic License”. + +The term Hippocratic relates to ancient Greek physician [Hippocrates][12]. The [Hippocratic oath][13] is an ethical oath (historically taken by physicians) and one of the crucial part of the oath is “I will abstain from all intentional wrong-doing and harm”. This part of the oath is known as “Primum non nocere” or “First do no harm”. + +The entire terminology is significant. The license is called Hippocratic license and is hosted on a domain called [firstdonoharm.dev][14] and the idea is to enable the developers to be not part of ‘intentional wrong-doing’. + +The [Hippocratic License][14] is based on the popular [MIT open source license][15]. It adds this additional and crucial condition: + +> The software may not be used by individuals, corporations, governments, or other groups for systems or activities that actively and knowingly endanger, harm, or otherwise threaten the physical, mental, economic, or general well-being of underprivileged individuals or groups. + +### Is Hippocratic license really an open source license? + +No, it is not. That’s what [Open Source Initiative][16] (OSI) says. OSI is the community-recognized body for reviewing and approving licenses as Open Source Definition conformant. + +> The intro to the Hippocratic Licence might lead some to believe +> the license is an Open Source Software licence, and software distributed under the Hippocratic Licence is Open Source Software. +> +> As neither is true, we ask you to please modify the language to remove confusion. +> +> — OpenSourceInitiative (@OpenSourceOrg) [September 23, 2019][17] + +Coraline first [thanked][18] OSI for pointing it out and then goes on to attack it as an “open source problem”. + +> This is the problem: the current structure of open source specifically prohibits us from protecting our labor from use by organizations like ICE. +> +> That’s not a license problem. That’s an Open Source™ problem. +> +> — Coraline Ada Ehmke (@CoralineAda) [September 23, 2019][19] + +Coraline clearly doesn’t accept that OSI (open Source Initiative) and [FSF][20] (Free Software Foundation) has the authority on the matter of defining open source and free software. + +> OSI and FSF are not the real arbiters of what is Open Source and what is Free Software. +> +> We are. +> +> — Coraline Ada Ehmke (@CoralineAda) [September 22, 2019][21] + +So if OSI and FSF, the organizations created for the sole purpose of defining open source and free software, are not the authority on this subject then who is? The “we” in “we are” of Coraline’s statement is ambiguous. Does ‘we’ represents the people who agree to Coraline’s view or ‘we’ means the entire open source community? If it’s the latter, then Coraline doesn’t represent or speak for every person in the open source community. + +### Does it solve the problem or does it create more problems? Can open source be neutral? + +> Developers are (finally) becoming more aware of the impact that their work has on the world, and in particular on underprivileged people. +> +> It’s late to come to that realization, but not TOO LATE to do something about it. +> +> The lesson here is that TECH IS NOT NEUTRAL. +> +> — Coraline Ada Ehmke (@CoralineAda) [September 23, 2019][22] + +Everything looks good from an idealistic point of view at the first glance. It seems like this new license will solve the problem of evil people using open source projects. + +But I see a problem here and that problem is the perception of ‘evil’. What you consider evil depends on your point of view. + +A number of “No Tech for ICE” supporting techies are also supporters of ANTIFA. [ANTIFA has been indulging in physical violence from time to time][23]. What if a bunch of ‘cis white men’, who found [far-left organizations like ANTIFA][24] evil, stop them from using their open source projects? What if [Richard Stallman comes back from his forced retirement][25] and starts selecting people who can use GNU projects based on whether or not they agree with his views? + +The license condition also says “knowingly endanger, harm, or otherwise threaten the physical, mental, economic, or general well-being of underprivileged individuals or groups”. + +So the entire stuff is only applicable to “underprivileged individuals or groups”, not others? So the others don’t get the same rights anymore? This should not come as surprise because Coraline is the same person who took extreme measure to ‘harm’ the ‘economic well being’ of a developer ([Coraline disagreed with his views][26]) by doing everything in capacity to get him fired from his job. + +Until these concerns are addressed, the Hippocratic License will unfortunately remain hypocrite license. + +Where will this end? How many open source projects will be forked between sparring groups of different ideologies? Why should the rest of the world suffer from the American domestic politics? Can we not leave open source undivided? + +Your views are welcome. Please note that abusive comments won’t be published. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][27]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/hippocratic-license/ + +作者:[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.contributor-covenant.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/no-tech-for-ice.jpg?resize=800%2C340&ssl=1 +[3]: https://en.wikipedia.org/wiki/U.S._Immigration_and_Customs_Enforcement +[4]: https://notechforice.com/ +[5]: https://www.zdnet.com/article/developer-takes-down-ruby-library-after-he-finds-out-ice-was-using-it/ +[6]: https://github.com/sethvargo/chef-sugar +[7]: https://www.chef.io/ +[8]: https://blog.chef.io/2019/09/19/chefs-position-on-customer-engagement-in-the-public-and-private-sectors/ +[9]: https://www.vice.com/en_us/article/qvg3q5/chef-not-renewing-ice-immigration-customs-enforcement-contract-after-code-deleting-protest +[10]: https://where.coraline.codes/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/hippocratic-license.png?ssl=1 +[12]: https://en.wikipedia.org/wiki/Hippocrates +[13]: https://en.wikipedia.org/wiki/Hippocratic_Oath +[14]: https://firstdonoharm.dev/ +[15]: https://opensource.org/licenses/MIT +[16]: https://opensource.org/ +[17]: https://twitter.com/OpenSourceOrg/status/1176229398929977344?ref_src=twsrc%5Etfw +[18]: https://twitter.com/CoralineAda/status/1176246765676302336 +[19]: https://twitter.com/CoralineAda/status/1176262778459496454?ref_src=twsrc%5Etfw +[20]: https://www.fsf.org/ +[21]: https://twitter.com/CoralineAda/status/1175878569169432582?ref_src=twsrc%5Etfw +[22]: https://twitter.com/CoralineAda/status/1176207120133447680?ref_src=twsrc%5Etfw +[23]: https://www.aol.com/article/news/2017/05/04/what-is-antifa-controversial-far-left-group-defends-use-of-violence/22067671/?guccounter=1&guce_referrer=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnLw&guce_referrer_sig=AQAAAHYUcIrnC8zD4UX-W4N2Vshf-QVSVDTwNXlTNmy4gbUJUb9smDm7W9Bf1IelnBGz5x0QAdI-O3Zhm9obQjZcORvHjvp3J8tUgEbdlpKNef-jk1rTH8BTZOP7YJule2n7wbIc4wDHPMFjrZUsMx-kypQYVCpkjtEDltAHHo-73ZD_ +[24]: https://www.bbc.com/news/world-us-canada-40930831 +[25]: https://itsfoss.com/richard-stallman-controversy/ +[26]: https://itsfoss.com/linux-code-of-conduct/ +[27]: https://reddit.com/r/linuxusersgroup diff --git a/sources/talk/20190926 DeviceHive- The Scalable Open Source M2M Development Platform.md b/sources/talk/20190926 DeviceHive- The Scalable Open Source M2M Development Platform.md new file mode 100644 index 0000000000..f37750c13d --- /dev/null +++ b/sources/talk/20190926 DeviceHive- The Scalable Open Source M2M Development Platform.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DeviceHive: The Scalable Open Source M2M Development Platform) +[#]: via: (https://opensourceforu.com/2019/09/devicehive-the-scalable-open-source-m2m-development-platform/) +[#]: author: (Dr Anand Nayyar https://opensourceforu.com/author/anand-nayyar/) + +DeviceHive: The Scalable Open Source M2M Development Platform +====== + +[![][1]][2] + +_DeviceHive provides powerful instruments for smart devices to communicate and manage services. It incorporates three critical technologies that affect mobile developers and users— the cloud, mobile and embedded systems. It consists of a communication layer, control software and multi-platform libraries and clients to bootstrap the development of remote sensing, remote control, monitoring and automation, smart energy, etc._ + +Today, people look for easy ways to get things done and the best example of this is automation. Machine-to-machine (M2M) communication aims to connect everyday objects and allows them (these non-human content providers) to feed the Internet with data in various formats, frequently. M2M communication is the latest trend in the evolution of industry, combining technology with data communication between devices or machines. + +M2M technology was first implemented in the manufacturing and industrial sectors, where other technologies like SCADA and remote monitoring helped to remotely manage and control data from equipment. M2M communications is all about direct inter-device communications, through which a robot or machine controls other machines. It can be used to more effectively monitor the condition of critical public infrastructure such as water treatment facilities or bridges, with less human intervention. + +Making a machine-to-machine communications system work is a step by step procedure. The three main elements in this process are: sensors (that acquire data from the operational environment and transmit it wirelessly), peer-to-peer wireless networks, and Internet enabled PCs. The most common types of M2M communications are listed below. + + * _**Backend-to-backend:**_ This is all about transmitting device logs over the Internet to the cloud provider. It also works for schedulers, daemons and continuous processes. + * _**IoT devices:**_ These small connected units put together data from small, autonomous, specialised devices at the server. + * _**CLI clients:**_ This is the creation of CLI apps that have the necessary rights to perform the actions, but which are only available on certain computers. + + + +The following points highlight the architecture and components of M2M communication. + + * _**M2M devices:**_ These are devices that are capable of replying to the request for data contained within those devices or capable of transmitting data in an autonomous manner. Examples are sensors, WPAN technologies like ZigBee or Bluetooth, LoWPAN, etc. + * _**M2M area network (device domain):**_ This enables connectivity between M2M devices and M2M gateways. An example is a personal area network. + * _**M2M gateway:**_ This utilises M2M capabilities to ensure M2M devices are interoperable and interconnected to the communications network. Gateways and routers are endpoints of the operator’s network in scenarios where sensors and M2M devices connect to the network. + * _**M2M communication networks:**_ These comprise communication between M2M gateways and M2M applications. Examples are xDSL, LTE, WiMAX and WLAN. + * _**M2M applications:**_ All M2M applications are based on assets provided by the operator. Examples are IoT based smart homes, e-health, m-health, telemedicine and the Internet of Medical Things, vending machines, smart parking systems, autonomous store payments and wireless payment systems, digital control systems in factories, smart IIoT, industrial monitoring, etc. + + + +There are various M2M open source development platforms. In this article, the primary focus is on DeviceHive, an open source M2M development platform. + +![Figure 1: DeviceHive microservices architecture][3] + +**Introducing DeviceHive** +DeviceHive was created and launched by DataArt, a boutique software development and outsourcing company in New York city, as an open source M2M communications framework using which developers could design M2M projects. It provides powerful instruments for smart devices to communicate and manage services. It incorporates three critical technologies that affect mobile developers and users— the cloud, the mobile and embedded. It consists of a communications layer, control software and multi-platform libraries and clients to bootstrap the development of remote sensing, remote control, monitoring and automation, smart energy, etc. + +DeviceHive provides a strong foundation and building support to create or customise any IoT/M2M solution, bridging the gap between embedded development, cloud platforms, Big Data and client applications. It is a scalable, hardware and cloud agnostic microservice-based platform with device-management APIs in varied protocols, which allows end users to set up and monitor device connectivity, and perform data analytics. + +**Features** +Listed below are the features of DeviceHive. + + * **Deployment:** DeviceHive facilitates innumerable deployment options and is suitable for every organisation, whether a startup or big enterprise. It includes Docker Compose and Kubernetes deployment to facilitate the development of public, private or hybrid clouds. Various DeviceHive services are started using Docker Compose — DeviceHive Frontend service, DeviceHive backend service, DeviceHive Auth service, DeviceHive Admin Console, DeviceHive WebSocket Proxy, DeviceHive Nginx Proxy, Kafka, PostgreSQL and Hazelcast IMDG. + * **Scalability:** DeviceHive includes outstanding software design practices like a container service oriented architecture approach, managed and orchestrated by Kubernetes, which brings about scalability and availability in seconds. + * **Connectivity:** It supports connectivity with any device via the REST API, WebSockets or MQTT. It supports libraries written in varied languages — both Android and iOS. It even supports embedded devices like ESP8266. + * **Seamless integration:** DeviceHive supports seamless integration with voice assisted services like Google, Siri and Alexa by enabling users to run customised JavaScript code. + * **Smart analytics:** It supports smart analytics using ElasticSearch, Apache Spark, Cassandra and Kafka for real-time processes. It also facilitates machine learning support. + * **Open source:** Comes under the Apache 2.0 licence for free use, and end users are supported by DataArt’s IoT professionals. + + + +**Protocols, client libraries and devices supported by DeviceHive** +Protocols: DeviceHive supports the REST, WebSocket API and MQTT protocols. In addition to this, for all RESTful services, it provides the Swagger API tool to test installation and other capabilities. + +**Client/device libraries:** DeviceHive supports numerous device libraries — the .NET framework, .NET Micro Framework, C++, Python and C (microcontrollers). + +**Client libraries:** These include the .NET framework, iOS and the Web/JavaScript. +**Device support**: DeviceHive supports any device with Python, Node.js or Java based Linux boards via the DeviceHive Client library. It also supports the ESP8266 chip with a simple API to handle all types of sensors for things like temperature (DS18B20, LM75A/LM75B/LM75C, DHT11 and DHT22) and pressure (BMP180, BMP280, etc). + +DeviceHive is a microservice based system, with high scalability and availability. Figure 1 highlights the microservices architecture of DeviceHive. + +**Components of DeviceHive** +The following are the components of DeviceHive. + + * **PostgreSQL:** This is the backend database to store all the data with regard to devices, networks, users, device types and configuration settings. + * **Hazelcast IMDG:** This is a clustered, in-memory data grid that uses sharding for data distribution and supports monitoring. All notifications are saved to a distributed cache storage for speedy access, and this can be removed in 2 minutes. + * **Message Bus (Kafka):** This supports communication between services and load balancing, as Kafka is a fast, distributed and fault-tolerant messaging system. In DeviceHive, the WebSocket Kafka proxy is used. It is written in Node.js because of flexibility in messaging. + * **DeviceHive frontend service:** This supports the RESTful and WebSocket APIs, performing all sorts of primary checks, sending requests to backend services and delivering responses in an asynchronous manner. + * **DeviceHive backend service:** This stores data in Hazelcast to manage subscriptions and retrieve data via requests from other services, from Hazelcast or from the database. + * **DeviceHive Auth service:** This contains information regarding the access control of users, the devices connected, network types and device types. It provides the RESTful API for generating, validating and refreshing tokens. + * **DeviceHive plugin service:** DeviceHive plugin support can help users to register devices, and define network types with the required JWT tokens. All the plugins are created in Node.js, Python and Java. + + + +**DeviceHive API** +DeviceHive API acts as a central component of the framework to facilitate communication and interaction with varied components. The API is responsible for providing access to information regarding all the components registered in the system in order to exchange messages in real-time scenarios. +The DeviceHive API has three types of consumers: + + * Client + * Administrator + * Device + + + +_**Client:**_ This is regarded as an application to control and administer devices. It can be an interface or software to manage the entire network. + +_**Administrator:**_ This controls the whole environment with full access to all components. It can create and manage API users, device networks, and all notifications and commands. + +_**Device:**_ This is termed as an individual unit with a unique identifier, name and other meta-information to communicate with the API. It takes commands from other components and executes them in an efficient manner. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/devicehive-the-scalable-open-source-m2m-development-platform/ + +作者:[Dr Anand Nayyar][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://opensourceforu.com/author/anand-nayyar/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/DeviceHive-IoT-connectivity-Illustration.jpg?resize=696%2C412&ssl=1 (DeviceHive IoT connectivity Illustration) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/DeviceHive-IoT-connectivity-Illustration.jpg?fit=800%2C474&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-DeviceHive-microservices-architecture.jpg?resize=350%2C180&ssl=1 diff --git a/sources/talk/20190926 How to contribute to GitLab.md b/sources/talk/20190926 How to contribute to GitLab.md new file mode 100644 index 0000000000..06425e979f --- /dev/null +++ b/sources/talk/20190926 How to contribute to GitLab.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to contribute to GitLab) +[#]: via: (https://opensource.com/article/19/9/how-contribute-gitlab) +[#]: author: (Ray Paik https://opensource.com/users/rpaikhttps://opensource.com/users/barkerd427) + +How to contribute to GitLab +====== +Help the community by contributing to code, documentation, translations, +user experience design, and more. +![Woman programming][1] + +I think many people are familiar with GitLab—the company or the software. What many may not realize is that GitLab is also an open source community that started with this [first commit][2] from our co-founder [Dmitriy Zaporozhet][3] in 2011. As a matter of fact, we have [more than 2,000 contributors][4] from the wider community who have contributed to GitLab. + +The wider community contributions span code, documentation, translations, user experience design, etc. If you are interested in open source and in contributing to a complete DevOps platform, I'd like you to consider joining the GitLab community. + +You can find things that you can start contributing to by looking at issues with the "[Accepting merge requests" label sorted by weight][5]. Low-weight issues will be easier to accomplish. If you find an issue that you're interested in working on, be sure to add a comment on the issue saying that you'd like to work on this, and verify that no one is already working on it. If you cannot find an issue that you are interested in but have an idea for a contribution (e.g., bug fixes, documentation update, new features, etc.), we encourage you to open a new issue or even [open a merge request][6] (MR) to start working with reviewers or other community members. + +If you are interested, here are the different areas at GitLab where you can contribute and how you can get started. + +### Development + +Whether it's fixing bugs, adding new features, or helping with reviews, GitLab is a great open source community for developers from all backgrounds. Many contributors have started contributing to GitLab development without being familiar with languages like Ruby. You can follow the steps below to start contributing to GitLab development: + + 1. For GitLab development, you should download and set up the [GitLab Development Kit][7]. The GDK README has instructions on how you can get started. + 2. [Fork the GitLab project][8] that you want to contribute to. + 3. Add the feature or fix the bug you want to work on. + 4. If you work on a feature change that impacts users or admins, please also [update the documentation][9]. + 5. [Open an MR][6] to merge your code and its documentation. The earlier you open an MR, the sooner you can get feedback. You can mark your MR as a [Work in Progress][10] so that people know that you're not done yet. + 6. Add tests, if needed, as well as a [changelog entry][11] so you can be credited for your work. + 7. Make sure the test suite is passing. + 8. Wait for a reviewer. A "Community contribution" label will be added to your MR, and it will be triaged within a few days and a reviewer notified. You may need multiple reviews/iterations depending on the size of the change. If you don't hear from anyone in several days, feel free to mention the Merge Request Coaches by typing **@gitlab-org/coaches** in a comment. + + + +### Documentation + +Contributing to documentation is a great way to get familiar with the GitLab development process and to meet reviewers and other community members. From fixing typos to better organizing our documentation, you will find many areas where you can contribute. Here are the recommended steps for people interested in helping with documentation: + + 1. Visit [https://docs.gitlab.com][12] for the latest GitLab documentation. + 2. If you find a page that needs improvement, click the "Edit this page" link at the bottom of the page, fork the project, and modify the documentation. + 3. Open an MR and follow the [branch-naming convention for documentation][13] so you can speed up the continuous integration process. + 4. Wait for a reviewer. A "Community contribution" label will be added to your MR and it will be triaged within a few days and a reviewer notified. If you don't hear from a reviewer in several days, feel free to mention **@gl-docsteam** in a comment. + + + +You may also want to reference [GitLab Documentation Guidelines][9] as you contribute to documentation. + +### Translation + +GitLab is being translated into more than 35 languages, and this is driven primarily by wider community members. If you speak another language, you can join more than 1,500 community members who are helping translate GitLab. + +The translation is managed at using [CrowdIn][14]. First, a phrase (e.g., one that appears in the GitLab user interface or in error messages) needs to be internationalized before it can be translated. The internationalized phrases are then made available for translations on . Here's how you can help us speak your language: + + 1. Log into (you can use your GitLab login). + 2. Find a language you'd like to contribute to. + 3. Improve existing translations, vote on new translations, and/or contribute new translations to your given language. + 4. Once your translation is approved, it will be merged into future GitLab releases. + + + +### UX design + +In order to help make a product that is easy to use and built for a diverse group of people, we welcome contributions from the wider community. You can help us better understand how you use GitLab and your needs as you work with the GitLab UX team members. Here's how you can get started: + + 1. Visit the [https://design.gitlab.com][15] for an overview of GitLab's open source Design System. You may also find the [Get Started guide][16] to be helpful. + 2. Choose an [issue][17] to work on. If you can't find an issue that you are interested in, you can open a new issue to start a conversation and get early feedback. + 3. Create an MR to make changes that reflect the issue you're working on. + 4. Wait for a reviewer. A "Community contribution" label will be added to your MR, and it will be triaged within a few days and a reviewer notified. If you don't hear from anyone in several days, feel free to mention **@gitlab-com/gitlab-ux** in a comment. + + + +### Getting help + +If you need any help while contributing to GitLab, you can refer to the [Getting Help][18] section on our Contribute page for available resources. One thing I want to emphasize is that you should not feel afraid to [mention][19] people at GitLab in issues or MRs if you have any questions or if you feel like someone has not been responsive. GitLab team members should be responsive to other community members whether they work at GitLab or not. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/how-contribute-gitlab + +作者:[Ray Paik][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/rpaikhttps://opensource.com/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://gitlab.com/gitlab-org/gitlab-ce/commit/9ba1224867665844b117fa037e1465bb706b3685 +[3]: https://about.gitlab.com/company/team/#dzaporozhets +[4]: https://contributors.gitlab.com +[5]: https://gitlab.com/groups/gitlab-org/-/issues?assignee_id=None&label_name%5B%5D=Accepting+merge+requests&scope=all&sort=weight&state=opened&utf8=%E2%9C%93 +[6]: https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html +[7]: https://gitlab.com/gitlab-org/gitlab-development-kit +[8]: https://docs.gitlab.com/ee/workflow/forking_workflow.html#creating-a-fork +[9]: https://docs.gitlab.com/ee/development/documentation/ +[10]: https://docs.gitlab.com/ee/user/project/merge_requests/work_in_progress_merge_requests.html +[11]: https://docs.gitlab.com/ee/development/changelog.html +[12]: https://docs.gitlab.com/ +[13]: https://docs.gitlab.com/ee/development/documentation/index.html#branch-naming +[14]: https://crowdin.com/ +[15]: https://design.gitlab.com/ +[16]: https://design.gitlab.com/contribute/get-started/ +[17]: https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/issues +[18]: https://about.gitlab.com/community/contribute/#getting-help +[19]: https://docs.gitlab.com/ee/user/group/subgroups/#mentioning-subgroups diff --git a/sources/talk/20190927 10 counterintuitive takeaways from 10 years of DevOpsDays.md b/sources/talk/20190927 10 counterintuitive takeaways from 10 years of DevOpsDays.md new file mode 100644 index 0000000000..bb64f660b2 --- /dev/null +++ b/sources/talk/20190927 10 counterintuitive takeaways from 10 years of DevOpsDays.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 counterintuitive takeaways from 10 years of DevOpsDays) +[#]: via: (https://opensource.com/article/19/9/counterintuitive-takeaways-devopsdays) +[#]: author: (KrisBuytaert https://opensource.com/users/krisbuytaert) + +10 counterintuitive takeaways from 10 years of DevOpsDays +====== +DevOps veteran Kris Buytaert, who was there at the founding of +DevOpsDays, shares lessons learned that might surprise you. +![gears and lightbulb to represent innovation][1] + +Ten years ago, we started an accidental journey. We brought together some of our good friends in Ghent, Belgium, to discuss our agile, open source, and early cloud experiences. [Patrick Debois][2] coined the event #DevOpsdays after [John Allspaw][3] and [Paul Hammond][4]'s talk from Velocity 2009, "10+ deploys per day: dev and ops cooperation at Flickr" (which is well [worth watching][5]). + +![Celebrate 10 years of DevOps Days where it all began: Ghent][6] + +Now, 10 years later, the world is different. DevOps is everywhere, right? Or is it really? I have been going to [DevOpsDays][7] events since that founding, and I have learned quite a lot from my experience. Here are 10 takeaways I hope you can learn from as well. + +### 1\. There is no such thing as a DevOps engineer. + +Plenty of people now have "DevOps engineer" as a job title, and lots of them don't like the title. The title gives the false impression that DevOps is a job that a single "DevOp" can achieve. Most often, a DevOps engineer is a Linux engineer who, if they're lucky, does a little bit of automation. When recruiters start looking for a DevOps engineer, applicants need to ask themselves the right questions, starting with: "What does the company actually need from an applicant?" Are they looking for a build engineer, a senior developer who understands non-functional requirements, a senior operations person who can automate things, or something else entirely? Most often, what they are really looking for is someone who will turn their eyes away from the lack of agile principles in practice. + +In an organization with a lot of DevOps engineers, it very often means that no DevOps is happening. A DevOps title is a sign of a new silo, and an applicant could make good money and learn new skills on the job, but they will not be "doing DevOps." + +### 2\. There is no such thing as a DevOps team. + +In the early days, we often said DevOps is about removing the walls of confusion between different teams, developers, and ops, about breaking down the silos. Yet somewhere along the journey, we saw a new phenomenon: the rise of the DevOps team. + +"DevOps team" sounds like a new practice, but the inconsistencies across organizations are clear. In one organization, it's the team in charge of tooling, in another, it literally is the silo between the dev and the ops teams—a silo that creates more confusion, more frustration, and less collaboration. In the best of cases, it occasionally is the cross-functional team with end-to-end responsibility for the service they are building. Those teams typically prefer not to be called a DevOps team. + +Calling a team "DevOps," I have found, will likely hinder the outcomes you're aiming for with DevOps. + +### 3\. There is no such thing as a DevOps project. + +A "project" by nature is finite. It is something you build, deliver, and then move on from. A consistent theme from 10 years of talks is that DevOps is about continual improvement, and continual improvement is never complete. Similarly, the output of these supposed projects are long-term _services_, and a service is something you build, deliver, and keep running. + +It's only after we think about how services extend beyond projects that we start to see the things that are easily forgotten: non-functional requirements (NFRs). NFRs include functionality that does not fit neatly into a specific behavior. NFRs define how we judge the operation of a system. They often include all the "-ilities" you hear around DevOps: securability, reliability, usability, maintainability, and scalability. All of which are essential to the business outcome. + +There is risk in the lack of empathy needed to think in short-term projects. When you have moved on to another project, you won't be as concerned with NFRs, since you're busy with a new challenge and it's someone else's problem now. However, when you run a service, you do care, and it is in your best interest to reduce the friction to keep things running smoothly. + +### 4\. There is no such thing as a DevOps tool. + +While many vendors will try to [sell you one][8], even the ultimate one, DevOps is not about tooling. It is about humans and collaboration. Some tools help people collaborate; often they give people with different backgrounds a shared terminology and a shared ecosystem; but equally often, the popular tools work against collaboration. + +A tool-focused culture is one that can isolate people more than it helps them collaborate, as people become obsessed with their toolchain and distance themselves from those not using it. While technically, they might be awesome tools and help us in some areas, a bunch of the new, so-called DevOps tools have widened the gap between different groups. For instance, I often hear "it works in my container" is a statement that developers make to define that "their" work is done. Containers alone do not solve the collaboration challenges needed to run applications effectively. We can't let tools become the new silos. + +### 5\. There is no such thing as DevOps "certified." + +No multiple-choice test can confirm that you, as an individual, collaborate with your colleagues. Organizations that offer certifications may have the most excellent advice on technology and even principles of collaboration, but a certificate cannot show that someone is good at DevOps. + +It is unfortunate that management teams require certificates in something we can't be certified in. Be educated in your favorite software, hardware, or cloud. Attend a local university and read the books that will educate you, such as those by [Deming][9], [Forsgren][10], [Humble][11], and [others][12]. But don't expect to become excellent at DevOps from a certification; it's more important to work with your coworkers. + +### 6\. There is no such thing as a DevOps pipeline. + +"Is the DevOps done yet?" "The DevOps pipeline is running." "The DevOps pipeline is broken." Whenever I hear these statements, I wonder how we got to such a term. Did we just rebrand a delivery pipeline, or is it because some companies are starting DevOps teams that manage the infrastructure for the pipeline? Or is it because the developers call the ops when the pipeline is broken? + +While introducing continuous integration and continuous delivery (CI/CD) principles has a huge impact on an organization, the "DevOps pipeline" term is used in a way that I see as blame-inducing. Ops teams are at fault when the dev's pipeline is broken. Dev teams don't worry about failing pipelines as long as they wrote tests. + +The concept is also misleading. Pipelines are aligned to a service or application, not to all of DevOps. When we generalize pipelines, we run the risk of encouraging silos between teams, which will leave us far from the goals of DevOps. + +What I do recommend is what I've seen in hundreds of organizations across the world: Call the pipeline for Application X the Application X pipeline. This way, we'll know what application has trouble getting through its tests, getting deployed, or getting updated. We will also know the team responsible for Application X, which will be busy trying to fix it, maybe with some help from their ops friends. + +### 7\. There is no such thing as standard DevOps. + +The toughest news from thousands of DevOps stories across the globe is standardization. Just like we can't certify people, there is also no-one-size-fits-all standard; every organization is on a different step in their journey, a different journey than other organizations. There is no magic recipe in which you implement a number of tools, set up a number of automated flows, and suddenly you are DevOps. + +A standard DevOps would mean that you implement a recipe, and suddenly the organization starts to collaborate, drops office politics, improves quality, increases morale, and is on the fast track to higher earnings with fewer outages. + +DevOps is better understood as a body of practice similar to [ITIL][13]. Remember the L in ITIL stands for Library, a library with best practices to cherrypick from—not an instruction manual. Lots of the hate against ITIL came from those (failed) implementations that took the library as a detailed instruction manual. Standardized DevOps will bear the same fruits. + +### 8\. There is no such thing as DevSecOps. + +From the very beginning in 2009, we started DevOpsDays as a place to invite everybody. Sure, the initial battleground was visible with developers and operations people, but everybody was included: database administrators, testers, business, finance, and, yes, also security. Even as early as 2012, we were giving talks at [OWASP][14] meetups, evangelizing what we did. We joked that the "s" in DevOps stood for security, just like the "S" in HTTPS. + +DevOps is inherently about security. I have found the greatest success in organizational adoption of continuous delivery comes from security teams. CD is a security requirement: you _need_ to have the ability to deploy whenever you want so that you can deploy and upgrade when you need to for business or security reasons. + +On the one hand, it is sad that we have to invent a word to get the security folks included. On the other hand, it's good to have the discussion again. Fundamentally, there is no difference between DevSecOps and DevOps. Security has always been part of the development and operations mindset. I'll call it DevSecOps if that helps, but it's okay to just call it DevOps. + +### 9\. There is no such thing as a finished DevOps transition. + +Have you ever seen an organization that said, "We'll do the DevOps project in Q4, and by next year we'll be DevOps"—and succeeded? Neither have I. + +Software delivery never stops, technology always changes, maintenance will be required, and—ideally—the DevOps mindset stays around. Once you have improved your delivery approach, you will want to keep improving. It won't be because your application is feature-complete or that the ecosystem it lives in has stopped evolving. It will be because the quality of your work improves exponentially, and many experience a similar improvement in their quality of life. DevOps will continue long after someone calls the effort "done." + +### 10\. There is such a thing as DevOops. + +Unfortunately, many people have not caught onto the importance of collaboration. They, often unintentionally, build silos, hold tools in higher regard than practices, require certification, and believe all the other nine takeaways. And they will struggle to succeed in a way that I like to call DevOops. + +To DevOops is to hold the tools and the silos in higher regard than the principles of DevOps that will improve your work. May we all be more DevOpsy and less DevOopsy. + +### The main takeaway + +Throughout the 10 years of DevOpsDays events, many thousands of people around the world have learned from each other in a collaborative and open environment. Some concepts that I find to be counter to the goals of DevOps and agile are popular. Stay focused on making your services run well at your company, and learn along the way. That won't mean a copy-and-paste effort of tools or dashboards. It will mean focusing on continually improving in every way. + +Good luck, and I hope to see you at the 10 year celebration at [DevOpsDays Ghent October 29-30th][15]. We have a great line up of speakers, including:  + + * [Patrick Debois][2] will talk about [Connect all the business pipelines][16] + * [Bryan Liles][17] on [Sysadmins to DevOps: Where we came from and where we are going][18] + * [Bridget Kromhout][19] on [distributed DevOps][20] + * [Ant Stanley][21] on [how serverless design patterns change nothing [for DevOps]][22] + * [Julie Gundersen][23] on [being an Advocate for DevOps][24] + + + +See you soon, back where it all began. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/counterintuitive-takeaways-devopsdays + +作者:[KrisBuytaert][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/krisbuytaert +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://twitter.com/patrickdebois +[3]: https://twitter.com/allspaw +[4]: https://twitter.com/ph +[5]: https://www.youtube.com/watch?v=LdOe18KhtT4 +[6]: https://opensource.com/sites/default/files/uploads/devopsdays-ghent-2019-10year.png (Celebrate 10 years of DevOps Days where it all began: Ghent) +[7]: https://devopsdays.org/ +[8]: https://opensource.com/article/19/6/you-cant-buy-devops +[9]: https://mitpress.mit.edu/books/out-crisis +[10]: https://nicolefv.com/book +[11]: https://continuousdelivery.com/about/ +[12]: https://itrevolution.com/devops-books/ +[13]: https://en.wikipedia.org/wiki/ITIL +[14]: https://www.owasp.org +[15]: https://devopsdays.org/events/2019-ghent/registration +[16]: https://devopsdays.org/events/2019-ghent/program/patrick-debois/ +[17]: https://twitter.com/bryanl +[18]: https://devopsdays.org/events/2019-ghent/program/bryan-liles/ +[19]: https://twitter.com/bridgetkromhout +[20]: https://devopsdays.org/events/2019-ghent/program/bridget-kromhout/ +[21]: https://twitter.com/IamStan +[22]: https://devopsdays.org/events/2019-ghent/program/ant-stanley/ +[23]: https://twitter.com/Julie_Gund +[24]: https://devopsdays.org/events/2019-ghent/program/julie-gunderson/ diff --git a/sources/talk/20190927 Data center gear will increasingly move off-premises.md b/sources/talk/20190927 Data center gear will increasingly move off-premises.md new file mode 100644 index 0000000000..fabede3541 --- /dev/null +++ b/sources/talk/20190927 Data center gear will increasingly move off-premises.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data center gear will increasingly move off-premises) +[#]: via: (https://www.networkworld.com/article/3440746/data-center-gear-will-increasingly-move-off-premises.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Data center gear will increasingly move off-premises +====== +Cloud and colocation sites will account for half of all data center equipment in just five years, according to 451 Research. +artisteer / Getty Images + +I've said that [colocation][1] and [downsizing in favor of the cloud][2] is happening, and the latest research from 451 Research confirms the trend. More than half of global utilized racks will be located at off-premises facilities, such as cloud and colocation sites, by the end of 2024, the company found. + +As companies get out of data center ownership, hardware will move to colocation sites like Equinix and DRT or cloud providers. The result is the total worldwide data center installed-base growth will see a dip of 0.1% CAGR between 2019-2024, according to the report, but overall total capacity in terms of space, power, and racks will continue to shift toward larger data centers. + +**[ Read also: [Colocation facilities buck the cloud-data-center trend][1] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** + +Enterprises are moving to colocation sites and hyperscale cloud providers such as Amazon Web Services (AWS) and Microsoft Azure for different reasons. AWS and Microsoft tend to base their data centers in remote areas with cheap land and some form of renewable energy, while colocation providers tend to be in big cities. They are popular for edge-computing projects such as internet of things (IoT) implementations and autonomous vehicle data gathering. + +Either way, enterprise IT is moving outward and becoming more distributed and less reliant on their own data centers. + +"Across all owner types and geographic locations, cloud and service providers are driving expansion, with the hyperscalers representing the tip of the spear," said Greg Zwakman, vice president of market and competitive intelligence at 451 Research, in a statement. "We expect to see a decline in utilized racks across the enterprise, with a mid-single-digit CAGR increase in non-cloud colocation, and cloud and service providers expanding their utilized footprint over 13%." + +While all the focus is on large-scale data centers, the report found that server rooms and closets account for nearly 95% of total data centers, but only 23% of total utilized racks in 2019. Anyone who works in a remote office can probably relate to this. And 60% of enterprise data center space is less than 10,000 square feet. + +On the flipside, the top six hyperscalers account for 42% of total cloud and service providers' utilized racks in 2019. 451 Research expects that to grow at an 18% CAGR, reaching 50.4% by 2024. + +**** From HPE: [ITaaS and Corporate Storage Technology][4]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** + +So, the trend is rather clear: Owning your own gear is optional, and owning your data center is increasingly falling out of favor. + +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/3440746/data-center-gear-will-increasingly-move-off-premises.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/3407756/colocation-facilities-buck-the-cloud-data-center-trend.html +[2]: https://www.networkworld.com/article/3439917/how-to-decommission-a-data-center.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190927 How to contribute to Fedora.md b/sources/talk/20190927 How to contribute to Fedora.md new file mode 100644 index 0000000000..4c6b34de0f --- /dev/null +++ b/sources/talk/20190927 How to contribute to Fedora.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to contribute to Fedora) +[#]: via: (https://fedoramagazine.org/how-to-contribute-to-fedora/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +How to contribute to Fedora +====== + +![][1] + +One of the great things about open source software projects is that users can make meaningful contributions. With a large project like Fedora, there’s somewhere for almost everyone to contribute. The hard part is finding the thing that appeals to you. This article covers a few of the ways people participate in the Fedora community every day. + +The first step for contributing is to [create an account][2] in the Fedora Account System. After that, you can start finding areas to contribute. This article is not comprehensive. If you don’t see something you’re interested in, check out [What Can I Do For Fedora][3] or contact the [Join Special Interest Group][4] (SIG). + +### Software development + +This seems like an obvious place to get started, but Fedora has an “upstream first” philosophy. That means most of the software that ends up on your computer doesn’t originate in the Fedora Project, but with other open source communities. Even when Fedora package maintainers write code to add a feature or fix a bug, they work with the community to get those patches into the upstream project. + +Of course, there are some applications that are specific to Fedora. These are generally more about building and shipping operating systems than the applications that get shipped to the end users. The [Fedora Infrastructure project][5] on GitHub has several applications that help make Fedora happen. + +### Packaging applications + +Once software is written, it doesn’t just magically end up in Fedora. [Package maintainers are the ones who make that happen][6]. Fundamentally, the job of the package maintainer is to make sure the application successfully builds into an RPM package and to generally keep up-to-date with upstream releases. Sometimes, that’s as simple as editing a line in the RPM spec file and uploading the new source code. Other times, it involves diagnosing build problems or adding patches to fix bugs or apply configuration settings. + +Packagers are also often the first point of contact for user support. When something goes wrong with an application, the user (or [ABRT][7]) will file a bug in Red Hat Bugzilla. The Fedora package maintainer can help the user diagnose the problem and either fix it in the Fedora package or help file a bug in the upstream project’s issue tracker. + +### Writing + +Documentation is a key part of the success of any open source project. Without documentation, users don’t know how to use the software, contributors don’t know how to submit code or run test suites, and administrators don’t know how to install and run the application. The [Fedora Documentation team][8] writes [release notes][9], [in-depth guides][10], and short “[quick docs][11]” that provide task-specific information. Multi-lingual contributors can also help with translation and localization of both the documentation and software strings by joining the [localization (L10n) team][12]. + +Of course, Fedora Magazine is always looking for contributors to write articles. The [Contributing page][13] has more information. **[We’re partial to this way of contributing! — ed.]** + +### Testing + +Fedora users have come to rely on our releases working well. While we emphasize being on the leading edge, we want to make sure releases are usable, too. The [Fedora Quality Assurance team][14] runs a broad set of test cases and ensures all of the release criteria are met before anything ships. Before each release, the team arranges test days for various components. + +Once the release is out, testing continues. Each package update first goes to the [updates-testing repository][15] before being published to the main testing repository. This gives people who are willing to test the opportunity to try updates before they go to the wider community.  + +### Graphic design + +One of the first things that people notice when they install a new Fedora release is the desktop background. In fact, using a new desktop background is one of our release criteria. The [Fedora Design team][16] produces several backgrounds for each release. In addition, they design stickers, logos, infographics, and many other visual elements for teams within Fedora. As you contribute, you may notice that you get awarded [badges][17]; the [Badges team][18] produces the art for those. + +### Helping others + +Cooperative effort is a hallmark of open source communities. One of the best ways to contribute to any project is to help other users. In Fedora, that can mean answering questions on the [Ask Fedora][19] forum, the [users mailing list][20], or in the [#fedora IRC channel][21]. Many third-party social media and news aggregator sites have discussion related to Fedora where you can help out as well. + +### Spreading the word + +Why put so much effort into making something that no one knows about? Spreading the word helps our user and contributor communities grow. You can host a release party, speak at a conference, or share how you use Fedora on your blog or social media sites. The [Fedora Mindshare committee][22] has funds available to help with the costs of parties and other events. + +### Other contributions + +This article only shared a few of the areas where you can contribute to Fedora. [What Can I Do For Fedora][3] has more options. If there’s something you don’t see, you can just start doing it. If others see the value, they can join in and help you. We look forward to your contributions! + +* * * + +_Photo by _[_Anunay Mahajan_][23]_ on [Unsplash][24]_. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-contribute-to-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/2019/09/how-to-contribute-816x345.jpg +[2]: https://admin.fedoraproject.org/accounts/user/new +[3]: https://whatcanidoforfedora.org/ +[4]: https://fedoraproject.org/wiki/SIGs/Join +[5]: https://github.com/fedora-infra +[6]: https://fedoramagazine.org/day-life-fedora-packager/ +[7]: https://abrt.readthedocs.io/en/latest/index.html +[8]: https://docs.fedoraproject.org/en-US/fedora-docs/contributing/ +[9]: https://docs.fedoraproject.org/en-US/fedora/f30/release-notes/ +[10]: https://docs.fedoraproject.org/en-US/fedora/f30/ +[11]: https://docs.fedoraproject.org/en-US/quick-docs/ +[12]: https://fedoraproject.org/wiki/L10N +[13]: https://docs.fedoraproject.org/en-US/fedora-magazine/contributing/ +[14]: https://fedoraproject.org/wiki/QA +[15]: https://fedoraproject.org/wiki/QA:Updates_Testing +[16]: https://fedoraproject.org/wiki/Design +[17]: https://badges.fedoraproject.org/ +[18]: https://fedoraproject.org/wiki/Open_Badges?rd=Badges +[19]: https://ask.fedoraproject.org/ +[20]: https://lists.fedoraproject.org/archives/list/users%40lists.fedoraproject.org/ +[21]: https://fedoraproject.org/wiki/IRC_support_sig +[22]: https://docs.fedoraproject.org/en-US/mindshare-committee/ +[23]: https://unsplash.com/@anunaymahajan?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[24]: https://unsplash.com/s/photos/give?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/talk/20190927 What does an open source AI future look like.md b/sources/talk/20190927 What does an open source AI future look like.md new file mode 100644 index 0000000000..cfc97020b3 --- /dev/null +++ b/sources/talk/20190927 What does an open source AI future look like.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does an open source AI future look like?) +[#]: via: (https://opensource.com/article/19/9/open-source-ai-future) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +What does an open source AI future look like? +====== +Placing the fundamental building blocks of AI in the hands of the open +source community is advancing AI in multiple industries. +![A brain design in a head][1] + +The recent announcement about [Neuralink][2], Elon Musk's latest startup, added to the buzz already in the air about where tech is taking us in the not-so-distant future. Judging by its ambitious plans, which involve pairing computers wirelessly with the human brain, Neuralink demonstrates that the future is now. + +And a big part of that future is open source artificial intelligence (AI). Rapid advancements have opened up a whole new world of possibilities that startups can take advantage of right now. + +### How does open source AI work? + +Traditionally, tech innovations were held close to the vest and developed in secret; no one wanted to give a leg up to the competition. Open source technology, a concept that really gained traction in the '90s with the development of Linux, works on the same underlying principle that spurred the creation of the internet: the idea that information should be freely shared and available to all who want access. + +Open source supports [global collaboration][3] by allowing some of the most progressive minds in tech to work together and craft solutions, and it makes technology cheaper and more widely available for developers. The potential benefits for every industry and level of society are immense. + +When it comes to [artificial intelligence][4] and machine learning (ML), open source technology is all about high-speed innovation. If algorithm work was kept inside a closed system, growth would be stifled. But placing the fundamental building blocks of AI in the hands of the open source community has created a valuable feedback loop for all involved. + +When individuals or organizations contribute to an open source AI project, they typically share code at the algorithm level to allow others to understand their method for managing datasets and detecting patterns. Then other groups can reuse or tweak this code to integrate it with their own products and solutions. The following are some of the industries and areas benefiting the most from open source AI. + +### Autonomous vehicles + +One of the most popular use cases for AI and ML technologies is the development of self-driving cars and other types of vehicles. With all of the competition in the auto industry, you might think that companies would be desperate to keep their technology private. However, the opposite is true, as evidenced by the open source projects that are becoming more and more common. + +[Webviz][5] is an open source browser-based tool that lets developers visualize the huge amount of data being recorded by a self-driving car's various sensors. This becomes very valuable when trying to simulate different road conditions without running costly tests. There are over 1,000 engineers now contributing to Webviz, and it is also being used in various fields of robotics. + +### E-commerce + +Shopping online was once a novelty with a handful of storefronts. Now, thanks to trends in web design—away from custom content management systems—moving to [DIY website builders][6] and vendors like Shopify, even the smallest home business has an e-commerce website. In fact, not having an online option is the rarity now. + +One challenge that online retailers face is how to deal with customer inquiries and complaints efficiently. That's where open source AI projects have pushed technology forward. A machine learning library called [TensorFlow][7] is capable of running algorithms to automatically tag and categorize incoming email messages. The system then prioritizes the content so that humans can respond to the most urgent issues more quickly. + +### Cybersecurity and data privacy + +A recent article on Forbes' website synthesized many leading opinions when it claimed that [AI is the future of cybersecurity][8]. The report, which summarized Capgemini research, states that 61% of enterprises admit they wouldn't be able to detect breach attempts effectively without AI. Considering the increasing number of malware and virus attacks, the internet's threat surface has reached such a level that we have little prayer of securing it without an AI-powered system that is super-fast and learns on the fly how to detect threats as they occur and shuts them down without human interference. + +Popular cybersecurity software, like virtual private networks (VPNs), has been banned in a growing number of countries and is the target of regulatory extinction even in freedom-loving countries like Canada. Telecom giant Bell [asked NAFTA negotiators][9] to declare VPNs illegal due to their geoblocking feature, popular for [accessing Netflix content][10] when outside the United States. + +Companies need smarter solutions to keep their technology assets safe. Open source tools like the [Adversarial Robustness Toolbox][11] can scan AI neural networks and determine their level of risk. This can help prevent the algorithms from being manipulated by external hackers. + +### Banking and financial industries + +Financial services are being revolutionized by open AI. AI's ability to analyze and make recommendations will allow banking professionals to turn over a lot of their more mundane duties over to technology while they perfect the art of customer service. + +Currently, the primary use of open source by banks is on the analytics side, where they can leverage AI algorithms to filter large sets of data easily. But bigger changes could be coming soon, considering that popular cryptocurrencies like Bitcoin are based on open source machine learning platforms. + +Some FinTech advances to look out for are: + + * Banking APIs, such as [open banking][12], that allow banks to connect to customer data through third-party interfaces + * Microservices and containerization that remove old functions and replace them with new open cores and that eliminate functionalities one by one and reintroduce them as microservices + * Big data and machine learning applications that can coordinate data production, collection, processing, storage, and presentation + + + +### Final thoughts + +Machine learning technologies are powering forward with juggernaut speed as we speak. Many of them are making modern life possible and changing business in ways that most people may not fully realize. Although the technology [creates challenges][13] at times, it's difficult to imagine how we ever lived without many of these advancements, especially when we lose them, even temporarily. + +With artificial intelligence, the likelihood of system breakdowns and obsolescence decreases and efficiency improves exponentially. It's self-correcting, scalable, and progressive in ways that will enrich our world immeasurably. When technology is in control behind the scenes, it frees us to realize the full extent of our capabilities—or at least come closer than we were before. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/open-source-ai-future + +作者:[Sam Bocetta][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/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_patents4abstract_B.png?itok=6RHeRaYh (A brain design in a head) +[2]: https://www.theverge.com/2019/7/16/20697123/elon-musk-neuralink-brain-reading-thread-robot +[3]: https://www.iflscience.com/technology/why-big-tech-companies-are-open-sourcing-their-ai-systems/ +[4]: https://opensource.com/article/18/12/how-get-started-ai +[5]: https://webviz.io/ +[6]: https://webeminence.com/wysiwyg-wordpress-website-builders/ +[7]: https://www.tensorflow.org/ +[8]: https://www.forbes.com/sites/louiscolumbus/2019/07/14/why-ai-is-the-future-of-cybersecurity/#69a04c8f117e +[9]: https://www.vice.com/en_us/article/d3mvam/canadian-telecom-giant-bell-wanted-nafta-to-ban-some-vpns +[10]: https://privacycanada.net/best-vpn-netflix/ +[11]: https://adversarial-robustness-toolbox.readthedocs.io/en/latest/ +[12]: https://www.thebalance.com/what-is-open-banking-and-how-will-it-affect-you-4173727 +[13]: https://www.dataversity.net/for-better-or-worse-ai-is-eating-data-centers/ diff --git a/sources/talk/20190930 How Open Source Software Lets Us Push It to the Limit.md b/sources/talk/20190930 How Open Source Software Lets Us Push It to the Limit.md new file mode 100644 index 0000000000..53aa99933c --- /dev/null +++ b/sources/talk/20190930 How Open Source Software Lets Us Push It to the Limit.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Open Source Software Lets Us Push It to the Limit) +[#]: via: (https://opensourceforu.com/2019/09/how-open-source-software-lets-us-push-it-to-the-limit/) +[#]: author: (Ebbe Kernel https://opensourceforu.com/author/ebbe-kernel/) + +How Open Source Software Lets Us Push It to the Limit +====== + +[![best text editors for web development][1]][2] + +_Here is a conversation with Johan, a leading developer of an advanced proxy network. As his team tackles complex load-balancing problems, they are constantly forced to push their solutions beyond what the original developers imagined. He says that the decision to use an open source load-balancer HAProxy has made it possible to do what would not be possible with other solutions._ + +**Ebbe: Tell us a bit about why you chose HAProxy for load-balancing.** + +**Johan: **Even though we use both open source and private source solutions for our network, I am a real ambassador for open source in our team. I think HAProxy is a perfect example of a great solution for a particular problem that can be adapted in unforeseen ways precisely because it is open sourced. + +Ever since we started work developing our proxy network, I looked into using an open source solution for load-balancing. We tried Nginx and Squid, but we soon realized that HAProxy is an indisputable industry standard and the only option for our product. + +**Ebbe: What made it exemplary?** + +**Johan: **What I’ve found with great open source software is that it must be constantly evolving, updated and managed. And in the case of HAProxy, we get minor updates every month. At first we liked the quick bug fixes. But now we jumped the waggon on the new major release, as it offered new features we were aching to implement. + +Everyone knows that you do not update any working solutions until the last minute to make sure that early bugs are fixed, but good software [_offers features you can’t resist_][3]. We trust it because it is transparent and has a strong community that has proven it can tackle most issues quickly. + +**Ebbe: You mentioned the community, which often accompanies great open source solutions. Does it really have that much of an impact for your business?** + +**Johan:** Of course. In terms of scale, everything pales in comparison to the community that HAProxy has mustered over the years. Every issue we encounter is usually solved or already escalated, and, as more and more companies use HAProxy, the community becomes vaster and more intelligent. + +What we’ve found with other services we use, even enterprise solutions might not offer the freedom and flexibility we need. In our case, an active community is what makes it possible to adapt software in previously untested ways. + +**Ebbe: What in particular does it let you do?** + +**Johan: **Since we chose HAProxy to use in our network, we found that creating ‘add-ons’ with Lua let us fully customize it to our own logic and integrate it with all of the other services that make the network work. This was extremely important, as we have a lot of services that need to work together, including some that are not open source. + +Another great thing is that the community is always solving problems and bugs, so we do not really encounter stuff we couldn’t handle. Over the years, I’ve found that this is only possible for open source software. + +What makes it a truly exceptional open source solution is the documentation. Even though I’ve been working closely with HAProxy for over two years, I still find new things almost every month. + +I know it sounds like a lot of praise, but I really love HAProxy for its resilience to our constant attempts to break it. + +**Ebbe: What do you mean by ‘break it’?** + +**Johan: **Originally, HAProxy works great as [_a load balancer for a couple of dozen servers_][4], usually 10 to 20. But, since our network is several orders of magnitude larger, we’ve constantly pushed it to its limits. + +It’s not uncommon for our HAProxy instances to load-balance over 10,000 servers, and we are certain that the original developers haven’t thought about optimizing it for these kind of loads. Due to this, it sometimes fails, but we are constantly optimizing our own solutions to make everything work. And, thanks to HAProxy’s developers and community, we are able to solve most of the issues we encounter easily. + +**Ebbe: Doesn’t this downtime impact your product negatively?** + +**Johan: **First of all, our product would not work without HAProxy. At least not as successfully as it has over the years. As I’ve said, all other solutions on the market are less optimized for what we do than HAProxy. + +Also, ‘breaking’ a service is nothing bad in and of itself. We always have backup services in place to handle the network. Testing in production is what we do for a simple reason: since we ‘break’ the HAProxy so much, we cannot really test any updates before launching something on our network. We need the full scale of our network to run HAProxy instances and all the millions of servers to be available, and creating such a testing environment seems like a huge waste of resources. + +**Ebbe: Do you have anything to add to the community of OpenSourceForU.com?** + +**Johan: **My team and I want to thank everyone for supporting open source principles and making the world a better place! + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/how-open-source-software-lets-us-push-it-to-the-limit/ + +作者:[Ebbe Kernel][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://opensourceforu.com/author/ebbe-kernel/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2017/07/developer-blog.jpg?resize=696%2C433&ssl=1 (text editor) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2017/07/developer-blog.jpg?fit=750%2C467&ssl=1 +[3]: https://smartproxy.com/what-is-a-proxy +[4]: https://opensourceforu.com/2016/09/github-open-sources-internal-load-balancer/ diff --git a/sources/talk/20191001 Earning, spending, saving- The currency of influence in open source.md b/sources/talk/20191001 Earning, spending, saving- The currency of influence in open source.md new file mode 100644 index 0000000000..0fb67c9d80 --- /dev/null +++ b/sources/talk/20191001 Earning, spending, saving- The currency of influence in open source.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Earning, spending, saving: The currency of influence in open source) +[#]: via: (https://opensource.com/open-organization/19/10/gaining-influence-open-community) +[#]: author: (ldimaggi https://opensource.com/users/ldimaggi) + +Earning, spending, saving: The currency of influence in open source +====== +In open organizations, people gain influence primarily through +contribution—not formal title or position in a hierarchy. To make an +impact in yours, start here. +![Bees on a hive, connected by dots][1] + +The acquisition and application of influence is a vital aspect of any organization. But the manner in which people acquire influence can vary widely. In traditional, hierarchical organizations, for example, someone might acquire influence by virtue of their title or position in a hierarchy. In government organizations, someone might acquire influence by virtue of being elected. On social media, someone might acquire influence through endless self-promotion. Or someone might acquire influence through inheritance or wealth. + +In open source communities, influence operates differently. It can't be bought, inherited, elected through a ballot, bestowed through a job title, or gained through celebrity. In this world, influence must be _earned_ through the merit of the contributions one makes to a team, organization, or community. + +In [open organizations][2]—which often look to open source communities as models for a more dynamic, inclusive, and innovative way to operate, as Jim Whitehurst explains in _The Open Organization_—[influence operates the same way][3]. "Everyone has the ability to earn influence and to get his or her ideas heard," Whitehurst writes. "It simply related to how effective you are at presenting and getting people behind your ideas, throughout the organization." So anyone hoping to succeed in an open organization must understand how to acquire, manage, and leverage influence in ways that may not come naturally to them. + +In this two-part series, we'll draw on our experiences in open source software development to examine the mechanics of influence in open organizations. In this installment, we'll explain how influence is acquired in an open organization. We'll also offer advice on ways one might _earn_ influence in these organizations—and some tips on behaviors to avoid. + +### The currency of influence + +Even though you can't buy it, influence behaves like a form of virtual currency in an open source community: a scarce resource, always needed, but also always in short supply. One must earn it through contributions to an open source project or community. In contrast to monetary currency, however, influence is not _transferable_. You must earn it for yourself. You can neither give nor receive it as a gift. + +In traditional organizational structures, influence follows an organization's top-down, command and control pattern—and influence is largely the result of one's position in a hierarchy. People at the top of those hierarchical structures make decisions, and those decisions flow downward to everyone else. The model is relatively stable, frequently rigid, and [can encounter difficulties when conditions change][4]. + +But as Eric Raymond argues in _The Cathedral and the Bazaar,_ open source communities don't operate in this "cathedral"-style manner. They work more like "bazaars," where act activity, power, and influence cut across formal lines of command and control. In an open organization therefore, influence _must be earned_. Influence _not_ earned can be corrosive in an open organization. + +That's because open organizations [are more communal][2]. The modern word "community" has as its root the Latin word "communitas," which has as part of its definition "public spirit, a sense of duty and willingness to serve one's community." This definition (and how it relates to your motivation for being involved in a community) is an important place to begin thinking about what it means to have influence in an open organization—and how you can acquire that influence. + +### Acquiring influence + +In open source communities, influence operates differently. It can't be bought, inherited, elected through a ballot, bestowed through a job title, or gained through celebrity. + +When starting out—in an open source community or an open organization—you'll need a level of interest in and an honest commitment to the goals and mission of the community. + +Note our careful and intentional choice of the word "honest." Your intentions for acquiring influence must have at their root the goal of furthering the mission of the community. Your commitment must be to the _community itself_—not to the community insofar as it functions like a vehicle for self-promotion or padding your resume. Any attempts to use the community as a stepping stone will probably fail, as other members of the community will quickly discover your true motives. The open nature of an open source community means that insincerity has no place to hide, and when found, will be exposed. The "glue" that holds an open source community together is a commitment to the community's goals, the value that the community's projects provide, and ultimately, the community's output (most notably, the code it creates). The same is true in any open organization, no matter what it aims to produce. + +As with any durable and meaningful relationship, making a commitment to a community takes time. In order to acquire influence in a community, you'll need to _invest_ in that community. You cannot "parachute into" a community and acquire influence overnight. + +So how _can_ you begin? + +In open source communities, before you start churning out code and documentation, you have to _watch, listen, and learn_ before you act. You don't want to act in such a way that community members will think of you as an uninvited guest. Successful contributors are those that study a project and understand its goals, accomplishments, and challenges. They watch how the community _functions_. They figure out who the most active members are. They understand the types of contributions that accepted and which get rejected. Only then can they be ready to contribute. + +When preparing to attain influence in an open organization, look for problems that need solving. That way, your contributions take the form of _solutions_ as opposed to unwanted *additions (*new features, etc., in software communities). Occasionally you can make progress faster by moving _slowly_—easing into the community, as opposed to jumping into the pool and trying to make a big splash (you end up just spilling water into everyone's drinks). + +The level of influence that you can earn is directly proportional to the scope and value of the contributions that you make to the community. By becoming a _contributor_ to an open community, you also earn the _credibility_ you'll need to achieve some level of influence in that community and on its projects. + +Having your contributions noticed in and embraced by the community is always nice. When this happens, you will receive some notoriety (in open source code communities, for example, this can come in the form of pull request comments, recognition in blog posts, or other online acknowledgements and thanks). While it's fine for you to publicize these accomplishments and the growing influence in the community that these that these represent, refrain from public self-congratulations and self-promotion. The community should remain the center of attention. + +### Meritocracy != democracy + +When acquiring influence in an open community, always pay attention to that community's governance model. Most open source coding communities, for example, aren't democracies; [they're meritocracies][5]. Ideas presented to the teams must be vetted and critically reviewed by the team in order to ensure that they provide value to the community. Changes do not take place in a vacuum, as they can affect many other people's work. + +Practically speaking, this means that in open organizations everyone and anyone has the ability to voice an opinion. Transparency rules, and it's the key to giving everyone a fair opportunity to express opinions and thoughts. In an open source software project, for instance, anyone can open issues, respond to issues, provide code for features, influence new features, and so on. "Open" means, anyone and everyone can see the code, comment on it, raise issues against it, and provide fixes and features. Leaders in open source software communities derive their leadership capabilities from the merit of their contributions and respect these have garnered them from the community. + +When preparing to attain influence in an open organization, look for problems that need solving. That way, your contributions take the form of solutions as opposed to unwanted additions. + +However, these leaders don't _command_ the open source software communities or impose arbitrary rules or opinions—mainly because everyone would ignore their commands and leave if they tried to do so. Transparency and partnership is what attracts community members to a project and grows a community successfully. + +In the end, a leader in an open organization would fail miserably if he or she had to deliver everything personally. In fact, it's a mistake for a leader to attempt to do this. Contributions from the community are not a luxury "extra" for an open organization; they're vital to its success. + +### Patience and perseverance + +Think of a world-class athlete, someone born with an innate skill may quickly rise to the top of his or her sport at a young age. Overcoming a serious injury might force that athlete to learn patience (and perhaps some humility, too) during a long rehabilitation, where even small steps forwards are painful and time-consuming. + +Likewise, building credibility in an open source community is a long process. Influence can take years to develop. So patience and persistence are _crucial_. Early on, the process can seem daunting; the whole world is available to be influenced, yet you deploy patience by taking a step by step approach to starting small and thinking big. Like ripples in a pond when you drop a stone, your influence in your immediate circle of connections can grow through those connections to other people too and spread over time. In the second installment, then, we'll explain how influence, once acquired, can be applied in an open organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/gaining-influence-open-community + +作者:[ldimaggi][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/ldimaggi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_bees_network.png?itok=NFNRQpJi (Bees on a hive, connected by dots) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://opensource.com/open-organization/16/8/how-make-meritocracy-work +[4]: https://opensource.com/open-organization/16/3/fastest-result-isnt-always-best-result +[5]: https://opensource.com/open-organization/17/2/new-perspective-meritocracy diff --git a/sources/talk/20191001 How to keep your messages private with an open source app.md b/sources/talk/20191001 How to keep your messages private with an open source app.md new file mode 100644 index 0000000000..d6e017435d --- /dev/null +++ b/sources/talk/20191001 How to keep your messages private with an open source app.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to keep your messages private with an open source app) +[#]: via: (https://opensource.com/article/19/10/secure-private-messaging) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How to keep your messages private with an open source app +====== +Even encrypted messaging apps are leveraging your private data to sell +you things. +![Chat via email][1] + +Messaging apps have changed how we communicate. Where would we be today without [SMS][2]? Can you imagine returning to a world where near-instant communication is not pervasive? + +We have lots of messaging options in addition to SMS and [MMS][3]. There are [Skype][4], [iMessage][5], [Facebook Messenger][6], [Twitter][7] (with and without direct messages), [WeChat][8], [WhatsApp][9], [SnapChat][10], and more. Many of them are encrypted, and many people presume that their communications on these apps are private and secure. But are they really? Cloud-hosted applications that are harvesting metadata from your conversations, then using it to sell you products that support their services, may not be your friends after all. + +### Risks of using messaging systems + +Fellow Opensource.com Community Moderator [Chris Hermansen][11] shares my concern about the growing invasion of our privacy by online communication tools. Chris says, "in my household, it's safe to say that we're not comfortable with commercial interests recording our every online move and using every possible gap to promote goods, services, points of view, and so on, or to promote themselves to others based on using our data." + +[Employers are using social media account information][12] within their hiring and firing decision-making process, he says. And it's not just to check whether the candidate's or employee's online personality conflicts with company values; in many cases, candidates who don't have a social media presence are unlikely to get an interview. + +He is also concerned about certain apps that allow message senders to see when recipients open their messages. He says, "I did not opt into that kind of sharing, and it seems the only way to opt out is to use software that is specifically designed to block this kind of unauthorized abuse, which may, in turn, block me from other, legitimate web content." + +### Hide those prying eyes + +Chris recently told me about [Signal][13], which ticks all the right boxes for those of us who have had enough of these prying eyes. The organization behind Signal is open, so we can know what it's doing with our data. (The answer? [Not very much at all][14].) Moreover, the organization is dedicated to broadening the use of Signal without harvesting user data, and all communications are encrypted end-to-end with the keys stored on users' devices. + +In addition, the mobile app is robust and reliable and enables users to make video and voice calls over the internet. [Chris' family has been using Signal for the past 18 months][15] or so to communicate around the world, and he says that "the call quality is far, far better than with the competition." I also find that Signal provides extremely high voice and video call quality, even over long-distance connections that often bamboozle other communications applications. + +"I prefer to have Signal also manage my SMS traffic," says Chris, "and I'll often open my Signal app to make a call to a fellow Signal user rather than telephoning." + +Chris and I aren't the only ones who like using Signal. In 2017, the U.S. Senate Sergeant-at-Arms [approved][16] the app for lawmakers and their staffs to use. + +Chris has only a couple of complaints about Signal. The first is that the desktop application (in Linux, anyway) isn't as full-featured as the mobile application. For instance, the desktop app can't make video or voice calls nor send or receive SMS. This isn't a show-stopper, but it would surely be nice when your cellphone battery is low or when it's easier to use your big screen and headset than a small mobile device. + +### Using Signal + +It is easy to [install Signal][17] on [Android][18], [iOS][19], Windows, MacOS, and Debian-based Linux distributions, and it offers excellent support [documentation][20] with detailed installation instructions for each operating system. You can also link devices, like laptops and desktops, that run one of the supported operating systems. + +Signal uses your existing mobile number, provided it can send and receive SMS and phone calls. The first time you set Signal up on your mobile phone, the application can search your address book for any of your contacts who use it. + +Signal is openly licensed with the [GNU Public License 3.0][21], and you can inspect the source code on [GitHub][22]. + +### Signal's future + +In early 2018, Signal received $50 million in funding from WhatsApp co-founder [Brian Acton][23]. With that cash infusion, Signal founder [Moxie Marlinspike][24] and Acton founded a new non-profit, 501(c)(3) organization named the [Signal Foundation][25]. + +Marlinspike says Signal plans to use Acton's investment to "increase the size of our team, our capacity, and our ambitions. This means reduced uncertainty on the path to sustainability, and the strengthening of our long-term goals and values. Perhaps most significantly, the addition of Brian brings an incredibly talented engineer and visionary with decades of experience building successful products to our team." + +Signal is currently looking for [developers][26] who have skills with iOS, Rust, Android, and more, as well as people interested in supporting it with financial [donations][27]. + +To learn more, you can follow Signal on [Twitter][28], [Instagram][29], and its [blog][30]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/secure-private-messaging + +作者:[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/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://en.wikipedia.org/wiki/SMS +[3]: https://en.wikipedia.org/wiki/Multimedia_Messaging_Service +[4]: https://www.skype.com/en/ +[5]: https://en.wikipedia.org/wiki/IMessage +[6]: https://www.messenger.com/ +[7]: https://twitter.com/?lang=en +[8]: https://play.google.com/store/apps/details?id=com.tencent.mm&hl=en +[9]: https://www.whatsapp.com/ +[10]: https://www.snapchat.com/ +[11]: https://opensource.com/users/clhermansen +[12]: https://www.businessnewsdaily.com/2377-social-media-hiring.html +[13]: https://signal.org/ +[14]: https://en.wikipedia.org/wiki/Signal_(software) +[15]: https://opensource.com/article/19/3/open-messenger-client +[16]: https://thehill.com/policy/cybersecurity/333802-sen-staff-can-use-signal-for-encrypted-chat +[17]: https://signal.org/download/ +[18]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&referrer=utm_source%3DOWS%26utm_medium%3DWeb%26utm_campaign%3DNav +[19]: https://apps.apple.com/us/app/signal-private-messenger/id874139669 +[20]: https://support.signal.org +[21]: https://github.com/signalapp/Signal-iOS/blob/master/LICENSE +[22]: https://github.com/signalapp +[23]: https://en.wikipedia.org/wiki/Brian_Acton +[24]: https://moxie.org/ +[25]: https://signal.org/blog/signal-foundation/ +[26]: https://signal.org/workworkwork/ +[27]: https://signal.org/donate/ +[28]: https://twitter.com/signalapp +[29]: https://www.instagram.com/signal_app/ +[30]: https://signal.org/blog/ diff --git a/sources/talk/20191001 The monumental impact of C.md b/sources/talk/20191001 The monumental impact of C.md new file mode 100644 index 0000000000..7ab59a6574 --- /dev/null +++ b/sources/talk/20191001 The monumental impact of C.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The monumental impact of C) +[#]: via: (https://opensource.com/article/19/10/command-line-heroes-c) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +The monumental impact of C +====== +The season finale of Command Line Heroes offers a lesson in how a small +community of open source enthusiasts can change the world. +![In the finale of Command Line Heroes, we learn about the significant impact of C][1] + +C is the original general-purpose programming language. The Season 3 finale of the [Command Line Heroes][2] podcast explores C's origin story in a way that showcases the longevity and power of its design. It's a perfect synthesis of all the languages discussed throughout the podcast's third season and this [series of articles][3]. + +![The original C programming guide by two of the language authors, circa 1978][4] + +C is such a fundamental language that many of us forget how much it has changed. Technically a "high-level language," in the sense that it requires a compiler to be runnable, it's as close to assembly language as people like to get these days (outside of specialized, low-memory environments). It's also considered to be the language that made nearly all languages that came after it possible. + +### The path to C began with failure + +While the myth persists that all great inventions come from highly competitive garage dwellers, C's story is more fit for the Renaissance period. + +In the 1960s, Bell Labs in suburban New Jersey was one of the most innovative places of its time. Jon Gertner, author of [_The idea factory_][5], describes the culture of the time marked by optimism and the excitement to solve tough problems. Instead of monetization pressures with tight timelines, Bell Labs offered seemingly endless funding for wild ideas. It had a research and development ethos that aligns well with today's [open leadership principles][6]. The results were significant and prove that brilliance can come without the promise of VC funding or an IPO. + +The challenge back then was terminal sharing: finding a way for lots of people to access the (very limited number of) available computers. Before there was a scalable answer for that, and long before we had [a shell like Bash][7], there was the Multics project. It was a hypothetical operating system where hundreds or even thousands of developers could share time on the same system. This was a dream of John McCarty, creator of Lisp and the term artificial intelligence (AI), as I [recently explored][8]. + +Joy Lisi Ranken, author of [_A people's history of computing in the United States_][9], describes what happened next. There was a lot of public interest in driving forward with Multics' vision of more universally available timesharing. Academics, scientists, educators, and some in the broader public were looking forward to this computer-powered future. Many advocated for computing as a public utility, akin to electricity, and the push toward timesharing was a global movement. + +Up to that point, high-end mainframes topped out at 40-50 terminals per system. The change of scale was ambitious and eventually failed, as Warren Toomey writes in [IEEE Spectrum][10]: + +> "Over five years, AT&T invested millions in the Multics project, purchasing a GE-645 mainframe computer and dedicating to the effort many of the top researchers at the company's renowned Bell Telephone Laboratories—including Thompson and Ritchie, Joseph F. Ossanna, Stuart Feldman, M. Douglas McIlroy, and the late Robert Morris. But the new system was too ambitious, and it fell troublingly behind schedule. In the end, AT&T's corporate leaders decided to pull the plug." + +Bell Labs pulled out of the Multics program in 1969. Multics wasn't going to happen. + +### The fellowship of the C + +Funding wrapped up, and the powerful GE645 mainframe was assigned to other tasks inside Bell Labs. But that didn't discourage everyone. + +Among the last holdouts from the Multics project were four men who felt passionately tied to the project: Ken Thompson, Dennis Ritchie, Doug McIlroy, and J.F. Ossanna. These four diehards continued to muse and scribble ideas on paper. Thompson and Ritchie developed a game called Space Travel for the PDP-7 minicomputer. While they were working on that, Thompson started implementing all those crazy hand-written ideas about filesystems they'd developed among the wreckage of Multics. + +![A PDP-7 minicomputer][11] + +A PDP-7 minicomputer was not top of line technology at the time, but the team implemented foundational technologies that change the future of programming languages and operating systems alike. + +That's worth emphasizing: Some of the original filesystem specifications were written by hand and then programmed on what was effectively a toy compared to the systems they were using to build Multics. [Wikipedia's Ken Thompson page][12] dives deeper into what came next: + +> "While writing Multics, Thompson created the Bon programming language. He also created a video game called [Space Travel][13]. Later, Bell Labs withdrew from the MULTICS project. In order to go on playing the game, Thompson found an old [PDP-7][14] machine and rewrote Space Travel on it. Eventually, the tools developed by Thompson became the [Unix][15] [operating system][16]: Working on a PDP-7, a team of Bell Labs researchers led by Thompson and Ritchie, and including Rudd Canaday, developed a [hierarchical file system][17], the concepts of [computer processes][18] and [device files][19], a [command-line interpreter][20], [pipes][21] for easy inter-process communication, and some small utility programs. In 1970, [Brian Kernighan][22] suggested the name 'Unix,' in a pun on the name 'Multics.' After initial work on Unix, Thompson decided that Unix needed a system programming language and created [B][23], a precursor to Ritchie's [C][24]." + +As Walter Toomey documented in the IEEE Spectrum article mentioned above, Unix showed promise in a way the Multics project never materialized. After winning over the team and doing a lot more programming, the pathway to Unix was paved. + +### Getting from B to C in Unix + +Thompson quickly created a Unix language he called B. B inherited much from its predecessor BCPL, but it wasn't enough of a breakaway from older languages. B didn't know data types, for starters. It's considered a typeless language, which meant its "Hello World" program looked like this: + + +``` +main( ) { +extrn a, b, c; +putchar(a); putchar(b); putchar(c); putchar('!*n'); +} + +a 'hell'; +b 'o, w'; +c 'orld'; +``` + +Even if you're not a programmer, it's clear that carving up strings four characters at a time would be limiting. It's also worth noting that this text is considered the original "Hello World" from Brian Kernighan's 1972 book, [_A tutorial introduction to the language B_][25] (although that claim is not definitive). + +[![A diagram showing the key Unix and Unix-like operating systems][26]][27] + +Typelessness aside, B's assembly-language counterparts were still yielding programs faster than was possible using the B compiler's threaded-code technique. So, from 1971 to 1973, Ritchie modified B. He added a "character type" and built a new compiler so that it didn't have to use threaded code anymore. After two years of work, B had become C. + +### The right abstraction at the right time + +C's use of types and ease of compiling down to efficient assembly code made it the perfect language for the rise of minicomputers, which speak in bytecode. B was eventually overtaken by C. Once C became the language of Unix, it became the de facto standard across the budding computer industry. Unix was _the_ sharing platform of the pre-internet days. The more people wrote C, the better it got, and the more it was adopted. It eventually became an open standard itself. According to the [Brief history of C programming language][28]: + +> "For many years, the de facto standard for C was the version supplied with the Unix operating system. In the summer of 1983 a committee was established to create an ANSI (American National Standards Institute) standard that would define the C language. The standardization process took six years (much longer than anyone reasonably expected)." + +How influential is C today? A [quick review][29] reveals: + + * Parts of all major operating systems are written in C, including macOS, Windows, Linux, and Android. + * The world's most prolific databases, including DB2, MySQL, MS SQL, and PostgreSQL, are written in C. + * Many programming-language specifics begun in C, including Python, Go, Perl's core interpreter, and the R statistical language. + + + +Decades after they started as scrappy outsiders, Thompson and Ritchie are praised as titans of the programming world. They shared 1983's Turing Award, and in 1998, received the [National Medal of Science][30] for their work on the C language and Unix.  + +![Ritchie and Thompson receiving the National Medal of Technology from President Clinton, 1998][31] + +But Doug McIlroy and J.F. Ossanna deserve their share of praise, too. All four of them are true Command Line Heroes. + +### Wrapping up the season + +[Command Line Heroes][2] has completed an entire season of insights into the programming languages that affect how we code today. It's been a joy to learn about these languages and share them with you. I hope you've enjoyed it as well! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/command-line-heroes-c + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/commnad_line_hereos_ep8_header_opensourcedotcom.png?itok=d7MJQHFJ (In the finale of Command Line Heroes, we learn about the significant impact of C) +[2]: https://www.redhat.com/en/command-line-heroes +[3]: https://opensource.com/tags/command-line-heroes-podcast +[4]: https://opensource.com/sites/default/files/uploads/2482009942_6caea217e0_c.jpg (The original C programming guide by two of the language authors, circa 1978) +[5]: https://en.wikipedia.org/wiki/The_Idea_Factory +[6]: https://opensource.com/open-organization/18/12/what-is-open-leadership +[7]: https://opensource.com/19/9/command-line-heroes-bash +[8]: https://opensource.com/article/19/9/command-line-heroes-lisp +[9]: https://www.hup.harvard.edu/catalog.php?isbn=9780674970977 +[10]: https://spectrum.ieee.org/tech-history/cyberspace/the-strange-birth-and-long-life-of-unix +[11]: https://opensource.com/sites/default/files/uploads/800px-pdp7-oslo-2005.jpeg (A PDP-7 minicomputer) +[12]: https://en.wikipedia.org/wiki/Ken_Thompson +[13]: https://en.wikipedia.org/wiki/Space_Travel_(video_game) +[14]: https://en.wikipedia.org/wiki/PDP-7 +[15]: https://en.wikipedia.org/wiki/Unix +[16]: https://en.wikipedia.org/wiki/Operating_system +[17]: https://en.wikipedia.org/wiki/File_system#Aspects_of_file_systems +[18]: https://en.wikipedia.org/wiki/Process_(computing) +[19]: https://en.wikipedia.org/wiki/Device_file +[20]: https://en.wikipedia.org/wiki/Command-line_interface#Command-line_interpreter +[21]: https://en.wikipedia.org/wiki/Pipeline_(Unix) +[22]: https://en.wikipedia.org/wiki/Brian_Kernighan +[23]: https://en.wikipedia.org/wiki/B_(programming_language) +[24]: https://en.wikipedia.org/wiki/C_(programming_language) +[25]: https://www.bell-labs.com/usr/dmr/www/btut.pdf +[26]: https://opensource.com/sites/default/files/uploads/640px-unix_history-simple.svg_.png (A diagram showing the key Unix and Unix-like operating systems) +[27]: https://commons.wikimedia.org/w/index.php?curid=1801948 +[28]: http://cs-fundamentals.com/c-programming/history-of-c-programming-language.php +[29]: https://www.toptal.com/c/after-all-these-years-the-world-is-still-powered-by-c-programming +[30]: https://www.nsf.gov/od/nms/medal.jsp +[31]: https://opensource.com/sites/default/files/uploads/medal.jpeg (Ritchie and Thompson receiving the National Medal of Technology from President Clinton, 1998) diff --git a/sources/talk/20191003 Mobile App Security Tips to Secure Your Mobile Applications.md b/sources/talk/20191003 Mobile App Security Tips to Secure Your Mobile Applications.md new file mode 100644 index 0000000000..2feea9a568 --- /dev/null +++ b/sources/talk/20191003 Mobile App Security Tips to Secure Your Mobile Applications.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mobile App Security Tips to Secure Your Mobile Applications) +[#]: via: (https://opensourceforu.com/2019/10/mobile-app-security-tips-to-secure-your-mobile-applications/) +[#]: author: (Petr Kudlacek https://opensourceforu.com/author/petr-kudlacek/) + +Mobile App Security Tips to Secure Your Mobile Applications +====== + +[![][1]][2] + +  + +_The world has become a mobile as every new and then the person has a smartphone in the hands with the Internet Connection. By using mobile devices, you can do everything online from the comfort of your home. You are allowed to do banking, tracking your health and control Internet of Things at home._ + +Today, the use of the mobile application is also increasing constantly as it is completely dominating mobile internet usage. As per the Flurry report, mobile applications account approximately 86% of the average U.S. mobile user’s time that amounts to more than two hours per day. + +Moreover, applications that are obtainable through online app distributors like Google Play Store, Apple’s App Store and third-party marketplaces, are no doubting the dominant form of delivery value to users across the world. + +*[![][3]][4]*Moreover, companies and organizations are embracing mobile applications as a great way to boost employees’ skills and productivity, agile with their new agile and mobile lifestyle. But do you know that whether these mobile apps are safe and secure and protected from any kind of virus? + +**What to do to Secure Your Mobile App?** + +If you have decided to develop an application or already have one, there are chances that you may ignore to consider how to secure your mobile application, your data, and your customer’s data. However, a mobile application comes with a good sanitation to make it work, but there is a software code itself, the business logic on the back-end network and the client side, databases. + +Both are playing a significant role in the fabric of the app’s security. All those companies that have mobile apps in a packed, competitive market, it is essential for them to have a robust security as it would be a big differentiator. In this post, we are going to mention some of the few tips for you to consider with mobile app security. + +**Essential Tips to Secure Your Mobile Apps** + +_Ensure that You Secure Your Network Connections On The Back-end_ + +Servers and cloud servers, which are accessing an app’s API, need to have security measures in place in order to protect data and prevent unauthorized access. It is important that APIs and those accessing them need to be verified to prevent snooping on sensitive information passing from the client back to the application’s server and database. + + * If you want to securely store your data and important documents, containerization is one of the best methods of developing encrypted containers. + * You can get in touch with a professional network security analyst so that he can conduct a penetration testing and susceptibility assessments of your network to make sure that the right data is safe in the right ways. + * Today, the federation is the next-level security measure, which mainly spread resources across servers so that they are not all in one place, and separates main resources from users with encryption measures. + + + +**Make Sure to Secure Transaction – Regulate the Implementation of Risky Mobile Transactions** + +Today, mobile applications allow users to easily manage with enterprise services on the go, so the risk lenience for transactions will differ. Therefore, it is essential for organizations to adopt an approach of risk-aware transaction execution, which restricts client-side functionality based on different policies that ponder mobile risk factors like user location, device security attributes and the security of the network connection. + +Enterprise apps can easily leverage an enterprise mobile risk engine to associate risk factors like IP velocity – accessing to the same account from two different locations, which are far apart over a short period even when client transactions are allowed. + +It is one such approach that extends the enterprise’s ability to detect and respond to complex attacks which will span multiple interaction channels and outwardly unrelated security events. + +**[![][5]][6]Securing the Data – Stopping Data Theft and Leakage** + +When mobile applications are accessing enterprise data, documents and unstructured information often stored on the device. Whenever the device is lost or data is shared with non-enterprise apps, the potential for data loss is heightened. + +There are various enterprises that are already considering remote wipe capabilities to address taken or lost devices. Mobile data encryption can be easily used to secure data within the app sandbox against malware and other kinds of criminal access. When it comes to controlling the app’s data sharing on the device, individual data elements can be encrypted and controlled. + +**Testing Your App’s Software & The Test Again** + +It is important to test app’s code in the app development process. As we all know that applications are being produced so rapidly that it should be an essential step in the process that falls to the wayside to speed up a time to market. At the time of testing functionality and usability, experts recommend testing for security whether their app is a native, hybrid or web app. + +You can know the vulnerabilities in the code so that you can correct them before publishing your application on the web. There are some essential tips that you need to consider: + + * Make sure to test thoroughly for verification and authorization, data security issues and session management. + * Penetration testing needs purposely searching a network or system for weaknesses. + * Emulators for operating systems, devices and browsers allow you to test how an application can perform in a simulated environment. + + + +Today, mobile and mobile apps are increasingly where most of the users are; however, you will also find most of the hackers also there to seal your important and sensitive data and information. With creative mobile security strategy and an experienced mobile app developer, you can rapidly to threats and keep your app safer. Moreover, you consider above-mentioned tips as well for securing your mobile applications. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/mobile-app-security-tips-to-secure-your-mobile-applications/ + +作者:[Petr Kudlacek][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://opensourceforu.com/author/petr-kudlacek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD3.png?resize=626%2C419&ssl=1 (MOHD3) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD3.png?fit=626%2C419&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD1.png?resize=350%2C116&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD1.png?ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD2.png?resize=350%2C233&ssl=1 +[6]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/MOHD2.png?ssl=1 diff --git a/sources/talk/20191003 Sharing vs. free vs. public- The real definition of open source.md b/sources/talk/20191003 Sharing vs. free vs. public- The real definition of open source.md new file mode 100644 index 0000000000..31b4851639 --- /dev/null +++ b/sources/talk/20191003 Sharing vs. free vs. public- The real definition of open source.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sharing vs. free vs. public: The real definition of open source) +[#]: via: (https://opensource.com/article/19/10/shareware-vs-open-source) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +Sharing vs. free vs. public: The real definition of open source +====== +If you think open source is synonymous with shareware, freeware, and +public domain, you are not alone. +![Person in a field of dandelions][1] + +When you hear the term open source, do you think this is synonymous with terms such as shareware, freeware, or public domain? If so, you are not alone. Many people, both within and without the technology industry, think of these terms as one and the same. This article illustrates how these terms are different and how open source is a transformative licensing and development model. Perhaps the best way to explore the differences will be to share my experience with software provided under one of the above models. + +### Shareware and freeware + +My early years as a computer programmer started when I began to code in BASIC on my Apple II Plus in 1982. I recall going to the local computer store in my hometown and finding floppy diskettes in plastic bags containing software games and utilities for what seemed to be extraordinarily high prices. Keep in mind, this was from the perspective of a middle-schooler. + +There was, however, some software that was available for free or at a minimal price; this was referred to as shareware or freeware, depending on the exact licensing model. Under the shareware model, you could use the software for only a certain amount of time, and/or if you found it useful, then there was a request that you send in a check to the author of that software. + +Some shareware software, however, actually encouraged you to also make a copy and give it to your friends. This model is often referred to as freeware. That said, the exact definitions and differences between shareware and freeware are a bit soft, so it's collectively easiest to refer to both simply as "shareware." I cannot say for certain, but I doubt I ever provided money to any of the software authors for using their shareware, mainly because I had no money as an early teenager, but I sure enjoyed using these software programs and learned a lot about computers along the way. + +In retrospect, I realize now that I could have learned and accomplished so much more in my growth as a budding programmer if the software had been provided under open source license terms instead of shareware terms. This is because the source code (i.e., the human-readable form of software) is almost never provided with shareware. Shareware also contains licensing restrictions that prohibit the recipient from attempting to reveal the source code. Without access to the source code, it is extraordinarily difficult to learn how the software actually works, making it very difficult to expand or change its functionality. This leaves the end user completely dependent on the original shareware author for any changes or improvements. + +With the shareware model, it is practically impossible to enable any community of developers to leverage and further innovate around the code. There can also be further restrictions on redistribution and commercial usage. Although the shareware may be free in terms of price (at least initially), _it is not free in terms of freedom_ and does not allow you to learn and innovate by exploring the inner workings of the code. + +Which leads me to the big question: _How is this different from open source software?_ + +### The basics of open source licensing + +First, we need to understand that "open source" refers to a _licensing_ and a _software development model_ that are both significantly different than shareware. Under one form of open source called non-copyleft open source licensing, the user is provided key freedoms such as no restrictions on accessing source code; selling, using, or giving away the software for any purpose; or modifying the software. + +This form of license also does not require payment of any fee or royalty for use. One amazing outcome of this licensing model is its unique ability to enable countless software developers to collaborate on new and useful changes and innovations to the code because the license is highly permissive, requiring no negotiations for use. Although the source code is technically not required to be provided under such a license, it is almost always available for everyone to view, learn from, modify, and distribute to others. + +Another aspect of non-copyleft open source licensing is that any recipient of such software may add additional license restrictions. This means that the initial author that licensed the code under this form of license has no assurances that the recipient may not further license to others under more restrictive terms. For example: + +> _Let us assume an author, Noah, wrote some software and distributed it under a non-copyleft open source license to a recipient, Aviva. Aviva then modifies and improves Noah's software, which she is entitled to do under the non-copyleft open source license terms. Aviva could then decide to add further restrictions to any recipients of her software that could limit its use, such as where or how it may be used (e.g., Aviva could add in a restriction that the software may only be used within the geographical boundaries of California and never in any nuclear power plant). Aviva could also opt to never release the modified source code to others even though she had access to the source code._ + +Sadly, there are countless proprietary software companies that use non-copyleft open source licensed software in the way described immediately above. In fact, a shareware program could use non-copyleft open source licensed software by adding shareware-type restrictions (e.g., no access to source code or excluding commercial use) thereby converting non-copyleft open source licensed code to a shareware licensing model. + +Fortunately, many proprietary companies using non-copyleft open source licensed software see the benefits of releasing source code. These organizations often continue to perpetuate the open source model by providing their modified source code to their recipients or the broader open source community via software repositories like GitHub to enable a virtuous cycle of innovation. This isn't entirely out of benevolence (or at least it normally isn't): These companies want to encourage community innovation and further enhancements, which can benefit them further. + +At the same time, many proprietary companies do not opt to do this, which is well within the terms of non-copyleft open source licenses. + +### Copyleft-licensed open source software + +In 1989, a new open source license named the GNU General Public License, also known commonly as the GPL license, was developed with the objective to ensure that software should be inherently free (as in free speech) and that that these freedoms must always persist, unlike what sometimes happens with non-copyleft open source licensed software. In a unique application of copyright law, the GPL uses copyright law to ensure perpetual software freedoms, so long as the rules are followed (more on that later). This unique use of copyright is called copy**left**. + +Like non-copyleft open source software, this license allows recipients to use the software without restriction, examine the source code, change the software, and make further distributions of the original or modified software to other recipients. _Unlike_ a non-copyleft open source license, the copyleft open source license absolutely requires that any recipients are also provided these same freedoms. They can never be taken away unless the rules are not followed. + +What makes the copyleft open source license enforceable and an incentive for compliance is the application of copyright law. If one of the recipients of copyleft code does not comply with the license terms (e.g., by adding any additional restrictions on the use of the software or not providing the source code), then their license terminates, and they become a copyright infringer because they no longer have legal permission to use the software. In this way, the software freedoms are ensured for any downstream recipients of that copyleft software. + +### Beyond the basics: Other software license models + +I mentioned public domain earlier—while it's commonly conflated with open source, this model is a bit different. Public domain means that steps have been taken to see that there are no applicable copyright rights associated with the software, which most often happens when the software copyright expires or is disclaimed by the author. (In many countries, the mechanism to disclaim copyright is unclear, which is why some public domain software may provide an option to obtain an open source-type license as a fallback.) No license is required to use public domain software; whether this makes it "open source" or not is the subject of much debate, though many would consider public domain a form of open source if the source code were made available. + +Interestingly, there are a significant number of open source projects that make use of small modules of public domain software for certain functions. There are even entire programs that claim to be in the public domain, such as SQLite, which implements a SQL database engine and is used in many applications and devices. It is also common to see software with no license terms. + +Many people incorrectly assume that such unlicensed software is open source, in the public domain, or otherwise free to use without restriction. In most countries, including the United States, copyright in software exists when it is created. This means that it cannot be used without permission in the form of a license, unless the copyright is somehow disclaimed, rendering it in the public domain. Some exceptions exist to this general rule, like the laws of implied licenses or fair use, but these are quite complex in how they may apply to a specific situation. I do not recommend providing software with no license terms when the intention is for it to be under open source license terms as this leads to confusion and potential misuse. + +### Benefits of open source software + +As I said previously, open source enables an efficient software development model with enormous ability to drive innovation. But what does this really mean? + +One of the benefits of the open source licensing model is a significant reduction in the friction around innovation, especially innovation done by other users beyond the original creator. This friction is limited because using open source code generally does not require the negotiation of license terms, thereby greatly simplifying and lowering any cost burden for use. In turn, this creates a type of open source ecosystem that encourages rapid modification and combination of existing technologies to form something new. These changes are often provided back into this open source ecosystem, creating a cycle of innovation. + +There is an innumerable number of software programs that run everything from your toaster to Mars-going spacecraft that are the direct result of this effortless ability to combine various programs together… all enabled by the open source development model. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/shareware-vs-open-source + +作者:[Jeffrey Robert Kaufman][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/jkaufman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_dandelion_520x292.png?itok=-xhFQvUj (Person in a field of dandelions) diff --git a/sources/talk/20191003 XMPP- A Communication Protocol for the IoT.md b/sources/talk/20191003 XMPP- A Communication Protocol for the IoT.md new file mode 100644 index 0000000000..108867cfdd --- /dev/null +++ b/sources/talk/20191003 XMPP- A Communication Protocol for the IoT.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (XMPP: A Communication Protocol for the IoT) +[#]: via: (https://opensourceforu.com/2019/10/xmpp-a-communication-protocol-for-the-iot/) +[#]: author: (Neetesh Mehrotra https://opensourceforu.com/author/neetesh-mehrotra/) + +XMPP: A Communication Protocol for the IoT +====== + +[![][1]][2] + +_Formerly developed by the Jabber open source community in 1999 (and initially known as Jabber), the Extensible Messaging and Presence Protocol (XMPP) is now widely used as a communication protocol. Based on Extensible Markup Language (XML), XMPP enables fast, near-real-time exchange of data between multiple entities on a network._ + +In contrast to most direct messaging protocols, XMPP is described in an open standard and uses an open systems approach of development and application, by which anyone may implement an XMPP service and interoperate with other organisations’ implementations. Since XMPP is an open set of rules, implementations can be developed using any software licence, and many server, client, and library XMPP implementations are distributed as free and open source software. Numerous freeware and commercial software implementations also exist. + +**XMPP: An overview** +XMPP is an open set of rules for streaming XML elements in order to swap messages and presence information in close to real-time. The XMPP protocol is based on the typical client server architecture, in which the XMPP client uses the XMPP server with the TCP socket. +XMPP provides a general framework for messaging across a network, offering a multitude of applications beyond traditional instant messaging (IM) and the distribution of presence data. It enables the discovery of services residing locally or across a network, as well as finding out about the availability of these services. +XMPP is well-matched for cloud computing where virtual machines, networks and firewalls would otherwise present obstacles to alternative service discovery and presence-based solutions. Cloud computing and storage systems rely on diverse forms of communication over multiple levels, including not only messaging between systems to relay state but also the migration of the distribution of larger objects, like storage or virtual machines. Along with validation and in-transit data protection, XMPP can be useful at many levels and may prove ideal as an extensible middleware or a message-oriented middleware (MOM) protocol. + +![Figure 1: XMPP IM conversation][3] + +**Comparisons with MQTT** +Given below are a few comparisons between the XMPP and MQTT protocols. + + * MQTT is a lightweight publisher/subscriber protocol, which makes it a clear choice when implementing M2M on memory-constrained devices. + * MQTT does not define a message format; with XMPP you can define the message format and get structured data from devices. The defined structure helps validate messages, making it easier to handle and understand data coming from these connected devices. + * XMPP builds a device’s identity (also called a Jabber ID). In MQTT, identities are created and managed separately in broker implementations. + * XMPP supports federation, which means that devices from different manufacturers connected to different platforms can talk to each other with a standard communication protocol. + * MQTT has different levels of quality of service. This flexibility is not available in XMPP. + * MQTT deployments become difficult to manage when the number of devices increases, while XMPP scales very easily. + + + +**The pros and cons of XMPP** + +_**Pros**_ + + * Addressing scheme to recognise devices on the network + * Client-server architecture + * Decentralised + * Flexible + * Open standards and formalised + + + +_**Cons**_ + + * Text-based messaging and no provision for end-to-end encryption + * No provision for quality of service + * The data flow is usually more than 70 per cent of the XMPP protocol server, of which nearly 60 per cent is repeated; the XMPP protocol has a large overhead of data to multiple recipients + * Absence of binary data + * Limited scope for stability + + + +![Figure 2: XML stream establishment][4] + +**How the XMPP protocol manages communication between an XMPP client and server** +The features of the XMPP protocol that impact communication between the XMPP client and the XMPP server are described in Figure 1. +Figure 2 depicts an XML message swap between client ‘Mike’ and server ‘Ollie.org’. + + * XMPP uses Port 5222 for the client to server (C2S) communication. + * It utilises Port 5269 for server to server (S2S) communication. + * Discovery and XML streams are used for S2S and C2S communication. + * XMPP uses security mechanisms such as TLS (Transport Layer Security) and SASL (Simple Authentication and Security Layer). + * There are no in-between servers for federation, unlike e-mail. + + + +Direct messaging is used as a method for immediate message transmission to and reception from online users (Figure 3). + +![Figure 3: Client server communication][5] + +**XMPP via HTTP** +As an alternative to the TCP protocol, XMPP can be used with HTTP in two ways: polling and binding. The polling method, now deprecated, essentially implies that messages stored on a server-side database are acquired by an XMPP client by way of HTTP ‘GET’ and ‘POST’ requests. Binding methods are applied using bi-directional streams over synchronous HTTP permit servers to push messages to clients as soon as they are sent. This push model of notification is more efficient than polling, wherein many of the polls return no new data. +XMPP provides a lot of support for communication, making it well suited for use within the realm of the Internet of Things. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/xmpp-a-communication-protocol-for-the-iot/ + +作者:[Neetesh Mehrotra][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://opensourceforu.com/author/neetesh-mehrotra/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2017/06/IoT-Connecting-all-apps.jpg?resize=696%2C592&ssl=1 (IoT Connecting all apps) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2017/06/IoT-Connecting-all-apps.jpg?fit=1675%2C1425&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-XMPP-IM-conversation.jpg?resize=261%2C287&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-XML-stream-establishment-350x276.jpg?resize=350%2C276&ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-Client-server-communication.jpg?resize=350%2C146&ssl=1 diff --git a/sources/talk/20191004 Chuwi GBox Pro Mini PC Review for Linux Users.md b/sources/talk/20191004 Chuwi GBox Pro Mini PC Review for Linux Users.md new file mode 100644 index 0000000000..61e7fe5e7d --- /dev/null +++ b/sources/talk/20191004 Chuwi GBox Pro Mini PC Review for Linux Users.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chuwi GBox Pro Mini PC Review for Linux Users) +[#]: via: (https://itsfoss.com/chuwi-gbox-pro-review/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Chuwi GBox Pro Mini PC Review for Linux Users +====== + +Early computers filled entire rooms. Since then, there has been a huge drive among computer manufacturers to make things smaller and smaller. Even the regular desktops can be replaced with mini PCs these days. + +We have covered several [Linux mini-PCs][1] in the past. Today we shall take a look at Chuwi GBox Pro. + +Chuwi is a computer manufacturer based in China. They are known for making good-looking but inexpensive devices. A few years back, some resellers used to rebrand Chuwi computers and sell them under their own brand name. Chuwi is now trying to expand its own brand visibility by selling Chuwi systems to a global audience. + +Chuwi contacted It’s FOSS and offered us the GBox Pro device to review for Linux users. Just because they offered something for free, it doesn’t mean we are going to favor them unnecessarily. I used the sample GBox Pro device with Linux and I am sharing my experience with this device. It’s up to you to make a decision about purchasing this gadget. + +_The Amazon links in the article are affiliate links. Please_ [_read our affiliate policy_][2]_._ + +### Chuwi GBox Pro + +The [Chuwi GBox Pro][3] has a pretty small form factor. At 7.4 x 5.4 x 1.5 inches, it is about the size of a hardcover book. The body is made out of aluminum, so it is light. weighing only 1 lb 4 oz. It comes with an Intel Atom X7-E3950 quad-core CPU, Intel HD 505 graphics, 4 GB of DDR3 RAM, and 64 GB of storage on an eMMC. If that is not enough storage, you can add a 2.5 inch SATA drive to increase storage. + +![Chuwi GBox Pro on my desk][4] + +The GBox Pro is a fanless computer, so it depends on its special design to keep it cool. It has vents around the top and bottom to let air circulate. + +Besides using it as a desktop computer, you can also use the GBox Pro as a media center. It comes with a VESA mount so you can attach to a wall or behind or TV or monitor. Then, all you’d need is a No products found.. + +![Ubuntu On Gbox Pro][5] + +The GBox Pro comes with a good number of ports. It has 5 USB ports total: one for type C, two for USB 2.0 and two for USB 3.0. It also has a built-in MicroSD reader. For video output, you can choose between VGA and HDMI. It also has an Ethernet jack and an audio out port. It also has support for Bluetooth. + +![Chuwi GBox Pro Ports][6] + +### Installation + +The system came with Windows 10 preinstalled, but they mention on their website that it also supports Linux. So, I tested it with two distros: Ubuntu and Manjaro. + +Overwriting Windows 10 with stock Ubuntu was fairly easy. The only worry I had during the install was a message that one of the partitions was mounted and needed to be unmounted to continue. This was the first time I install Linux on an eMMC and I wonder if that was the issue. + +![Super Tux Kart On Gbox Pro][7] + +The GBox Pro didn’t run Ubuntu as well as I would have liked. I think GNOME might have been a little heavy for it. Overall performance wasn’t too bad, but when I had a couple of processes running at once (such as installing snaps and watching videos on YouTube) I felt a noticeable slowdown. Keep in mind, the GBox Pro has an Intel Atom CPU, not the more powerful core i3 or core i5. + +After I installed the [Manjaro Xfce edition][8], I didn’t feel like the bottom was dragging. It’s probably because [Xfce][9] is lighter than GNOME. On Manjaro, the system did everything I wanted quickly. + +![Manjaro Xfce on GBox Pro][10] + +### Experiencing Linux on Chuwi GBox Pro + +Overall, the GBox Pro is a nice little device with a few niggles that should be expected for this form-factor, chip setup, and general price. + +One of the main talking points of the GBox Pro is its ability to run high-quality graphics, both for movies and games. I tried out several games, including Super Tux Kart, Warzone 2100, and Mr. Rescue. (Yes, I’m not much of a gamer.) These games ran fine, except I ran into an issue with Super Tux Kart where some of the maps flickered so much that they were almost unplayable. + +![Rifftrax On Gbox Pro][11] + +I also wanted to try HD movie playback. I don’t own a lot of digital movies and the one site I do use isn’t quite Linux friendly. However, I was able to watch a couple of 1080p videos on [Rifftrax][12] without issue. Chuwi claims that GBox Pro supports 4K hard-decoding. I couldn’t test it though. + +As I mentioned above, you can add storage space by adding a SATA drive. I did not realize that was a feature until I started writing this review and I was looking at the pictures on the [GBox Pro's Amazon page][13]. As a result, I removed the bottom panel to take a look. I like the fact that this is an option, unfortunately, they used six tiny screws to hold the bottom panel in place. I was worried I’d lose a couple. It also looks like the bottom panel keeps the drive in place. There is no room to screw it into the mounts. + +### Final Thoughts on Chuwi GBox Pro + +![Chuwi GBox Pro is fanless and thermal conductive aluminum alloy provide effective cooling][14] + +Overall, I like the GBox Pro. It has a nice small form factor, which makes it easy to set up and move. On the website, they say that you can carry it in your pocket, but I would not want to risk it. The case has a cool design and I like the fact that it has a place to add a larger drive. + +It may not be as powerful as the [Intel NUC][15] but it is still a good enough device considering its modest price tag. You can use it for a [media server][16] or for medium to light computing. I didn’t use it as media server but it works well for an entry-level desktop system. + +It’s FOSS has also requested Chuwi team to launch Linux version of their devices with a relatively reduced pricing than the Windows ones. Let’s see if they consider it in future. + +If you think [Chuwi GBox Pro][17] is a good fit for your needs, it is available to order from Aliexpress and Amazon. I recommend ordering on Amazon though. Please refer to this page for [warranty information][18]. + +Preview | Product | Price | +---|---|---|--- +![CHUWI GBox Pro Fanless Mini PC, Intel Atom X7-E3950,Win10 \(64-bit\) Desktop Computer with 4GB DDR4/64GB eMMC, Support Gigabit Ethernet, Linux, BT 4.0, 4K, Dual WiFi][19] ![CHUWI GBox Pro Fanless Mini PC, Intel Atom X7-E3950,Win10 \(64-bit\) Desktop Computer with 4GB DDR4/64GB eMMC, Support Gigabit Ethernet, Linux, BT 4.0, 4K, Dual WiFi][19] | [CHUWI GBox Pro Fanless Mini PC, Intel Atom X7-E3950,Win10 (64-bit) Desktop Computer with 4GB...][20] | $189.99[][21] | [Buy on Amazon][22] + +Have you ever used the GBox Pro or any other Chuwi products? Please share your experience with us in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/chuwi-gbox-pro-review/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-based-mini-pc/ +[2]: https://itsfoss.com/affiliate-policy/ +[3]: https://www.chuwi.com/product/items/Chuwi-GBox-Pro.html +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/Chuwi-GBox-Pro.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/Ubuntu-on-GBox-Pro.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/chuwi-gbox-pro-ports.jpg?resize=800%2C230&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/Super-Tux-Kart-on-GBox-Pro.jpg?ssl=1 +[8]: https://manjaro.org/download/xfce/ +[9]: https://xfce.org/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/Manjaro-on-GBox-Pro.jpg?resize=800%2C470&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/RiffTrax-on-GBox-Pro.jpg?resize=800%2C450&ssl=1 +[12]: https://www.rifftrax.com/ +[13]: https://www.amazon.com/CHUWI-Fanless-X7-E3950-Computer-Ethernet/dp/B07THWPRS1?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07THWPRS1 (GBox Pro's Amazon page) +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/chuwi-gbox-pro.jpg?ssl=1 +[15]: https://itsfoss.com/install-linux-on-intel-nuc/ +[16]: https://itsfoss.com/best-linux-media-server/ +[17]: https://www.chuwi.com/product/buy/Chuwi-GBox-Pro.html +[18]: https://www.chuwi.com/warranty.html +[19]: https://i2.wp.com/images-na.ssl-images-amazon.com/images/I/41ZyikLlCGL._SL160_.jpg?ssl=1 +[20]: https://www.amazon.com/CHUWI-Fanless-X7-E3950-Computer-Ethernet/dp/B07THWPRS1?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07THWPRS1 (CHUWI GBox Pro Fanless Mini PC, Intel Atom X7-E3950,Win10 (64-bit) Desktop Computer with 4GB DDR4/64GB eMMC, Support Gigabit Ethernet, Linux, BT 4.0, 4K, Dual WiFi) +[21]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[22]: https://www.amazon.com/CHUWI-Fanless-X7-E3950-Computer-Ethernet/dp/B07THWPRS1?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07THWPRS1 (Buy on Amazon) diff --git a/sources/talk/20191004 DARPA looks for new NICs to speed up networks.md b/sources/talk/20191004 DARPA looks for new NICs to speed up networks.md new file mode 100644 index 0000000000..7b94190ae9 --- /dev/null +++ b/sources/talk/20191004 DARPA looks for new NICs to speed up networks.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DARPA looks for new NICs to speed up networks) +[#]: via: (https://www.networkworld.com/article/3443046/darpa-looks-for-new-nics-to-speed-up-networks.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +DARPA looks for new NICs to speed up networks +====== +The creator of the Internet now looks to speed it up by unclogging network bottlenecks. +RVLsoft / Shulz / Getty Images + +The government agency that gave us the Internet 50 years ago is now looking to drastically increase network speed to address bottlenecks and chokepoints for compute-intensive applications. + +The Defense Advanced Research Projects Agency (DARPA), an arm of the Pentagon, has unveiled a computing initiative, one of many, that will attempt to overhaul the network stack and interfaces that cannot keep up with high-end processors and are often the choke point for data-driven applications. + +[[Get regularly scheduled insights by signing up for Network World newsletters. ]][1] + +The DARPA initiative, Fast Network Interface Cards, or FastNICs, aims to boost network performance by a factor of 100 through a clean-slate transformation of the network stack from the application to the system software layers running on top of steadily faster hardware. DARPA is soliciting proposals from networking vendors. . + +**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][2] ]** + +“The true bottleneck for processor throughput is the network interface used to connect a machine to an external network, such as an Ethernet, therefore severely limiting a processor’s data ingest capability,” said Dr. Jonathan Smith, a program manager in DARPA’s Information Innovation Office (I2O) in a statement. + +“Today, network throughput on state-of-the-art technology is about 1014 bits per second (bps) and data is processed in aggregate at about 1014 bps. Current stacks deliver only about 1010 to 1011 bps application throughputs,” he added. + +Advertisement + +Many other elements of server design have seen leaps in performance, like memory, meshes, NVMe-over-Fabric, and PCI Express, but networking speed has been something of a laggard, getting minor bumps in speed and throughput by comparison. The fact is we’re still using Ethernet as our network protocol 56 years after Bob Metcalf invented it at Xerox PARC. + +So DARPA’s program managers are using an approach that reworks existing network architectures. The FastNICs programs will select a challenge application and provide it with the hardware support it needs, operating system software, and application interfaces that will enable an overall system acceleration that comes from having faster NICs. + +Researchers will design, implement, and demonstrate 10 Tbps network interface hardware using existing or road-mapped hardware interfaces. The hardware solutions must attach to servers via one or more industry-standard interface points, such as I/O buses, multiprocessor interconnection networks and memory slots to support the rapid transition of FastNICs technology. + +“It starts with the hardware; if you cannot get that right, you are stuck. Software can’t make things faster than the physical layer will allow so we have to first change the physical layer,” said Smith. + +The next step would be developing system software to manage FastNICs hardware. The open-source software based on at least one open-source OS would enable faster, parallel data transfer between network hardware and applications. + +Details on the proposal can be found [here][3]. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3443046/darpa-looks-for-new-nics-to-speed-up-networks.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/newsletters/signup.html +[2]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 +[3]: https://www.fbo.gov/index?s=opportunity&mode=form&id=fb5cfba969669de12025ff1ce2c99935&tab=core&_cview=1 +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191004 Quantum computing, the open source way.md b/sources/talk/20191004 Quantum computing, the open source way.md new file mode 100644 index 0000000000..d075fcb00c --- /dev/null +++ b/sources/talk/20191004 Quantum computing, the open source way.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Quantum computing, the open source way) +[#]: via: (https://opensource.com/article/19/10/open-source-quantum-future) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari) + +Quantum computing, the open source way +====== +Quantum computing is promising, provided we overcome hurdles preventing +it from moving deeper into the real world. +![A circuit design in lights][1] + +The quantum vision of reality is both strange and mesmerizing at the same time. As theoretical physicist [Michio Kaku][2] once said, "Common sense has no place in quantum mechanics." + +Knowing this is a new and uncommon place, we can expect quantum innovations to surpass anything we have seen before. The theory behind it will enable as-yet-unseen capabilities, but there are also some hurdles that are slowing it from being unleashed into the real world. + +By using the concepts of entanglement and superposition on quantum bits, a quantum computer can solve some problems faster than a classical computer. For example, quantum computers are useful for solving [NP-hard][3] problems, such as the [Boolean satisfiability problem][4], known as the SAT problem. Using [Grover's algorithm][5], the complexity of the evaluation of a boolean proposition of **$n$** variables goes down from **$O(n2^{n})$** to **$O(n2^{n/2})$** by applying its quantum version. + +An even more interesting more problem quantum computing can solve is the [Bernstein–Vazirani problem][6], where given a function **$f$**, such as **$f(x)=x.s=x_{1}s_{1} + x_{2}s_{2} + x_{3}s_{3} + ... x_{n}s_{n}$**, you have to find **$s$**. While the classical solution requires **$n$** queries to find the solution, the quantum version requires only one query. + +Quantum computing is very valuable for security issues. One interesting riddle it answers is: How can two communicating parties share a key to encrypt and decrypt their messages without any third party stealing it? + +A valid answer would use [quantum key distribution][7], which is a method of communication that implements cryptographic protocols that involve quantum mechanics. This method relies on a quantum principle that "the measurement of a system generally disturbs it." Knowing that a third party measuring the quantum state would disturb the system, the two communicating parties can thereby know if a communication is secure by establishing a threshold for eavesdropping. This method is used for securing bank transfers in China and transferring ballot results in Switzerland. + +However, there are some serious hurdles to the progress of quantum computing to meet the requirements for industrial-scale use and deployment. First, quantum computers operate at temperatures near absolute zero since any heat in the system can introduce errors. Second, there is a scalability issue for quantum chipsets. Knowing that there are chips in the order of 1,000 qubits, expanding to millions or billions of qubits for fully fault-tolerant systems, error-corrected algorithms will require significant work. + +The best way to tackle real-life problems with quantum solutions is to use a hybridization of classic and quantum algorithms using quantum hardware. This way, the part of the problem that can be solved faster using a quantum algorithm can be transferred to a quantum computer for processing. One example would be using a quantum support vector machine for solving a classification problem, where the matrix-exponentiation task is handled by the quantum computer. + +The [Quantum Open Source Foundation][8] is an initiative to support the development of open source tools for quantum computing. Its goal is to expand the role of open source software in quantum computing, focusing on using current or near-term quantum computing technologies. The foundation also offers links to open courses, papers, videos, development tools, and blogs about quantum computing. + +The foundation also supports [OQS-OpenSSH][9], an interesting project that concerns quantum cryptography. The project aims to construct a public-key cryptosystem that will be safe even against quantum computing. Since it is still under development, using hybrid-cryptography, with both quantum-safe public key and classic public-key algorithms, is recommended. + +A fun way to learn about quantum computing is by playing [Entanglion][10], a two-player game made by IBM Research. The goal is to rebuild a quantum computer from scratch. The game is very instructive and could be a great way to introduce youth to the quantum world. + +All in all, the mysteries of the quantum world haven't stopped amazing us, and they will surely continue into the future. The most exciting parts are yet to come! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-quantum-future + +作者:[Jaouhari Youssef][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/jaouhari +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/adi-goldstein-eusvweosble-unsplash.jpg?itok=8shMsRyC (Circuit design) +[2]: https://en.wikipedia.org/wiki/Michio_Kaku +[3]: https://en.wikipedia.org/wiki/NP-hardness +[4]: https://en.wikipedia.org/wiki/Boolean_satisfiability_problem +[5]: https://en.wikipedia.org/wiki/Grover%27s_algorithm +[6]: https://en.wikipedia.org/wiki/Bernstein%E2%80%93Vazirani_algorithm +[7]: https://en.wikipedia.org/wiki/Quantum_key_distribution +[8]: https://qosf.org/ +[9]: https://github.com/open-quantum-safe/openssh-portable +[10]: https://github.com/Entanglion/entanglion diff --git a/sources/talk/20191004 Secure Access Service Edge (SASE)- A reflection of our times.md b/sources/talk/20191004 Secure Access Service Edge (SASE)- A reflection of our times.md new file mode 100644 index 0000000000..3d8fc2f4ac --- /dev/null +++ b/sources/talk/20191004 Secure Access Service Edge (SASE)- A reflection of our times.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Secure Access Service Edge (SASE): A reflection of our times) +[#]: via: (https://www.networkworld.com/article/3442941/secure-access-service-edge-sase-a-reflection-of-our-times.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +Secure Access Service Edge (SASE): A reflection of our times +====== +Gartner makes the claim that the shift to SASE will make obsolete existing networking and security models. +RVLsoft / Shulz / Getty Images + +There’s a buzz in the industry about a new type of product that promises to change the way we secure and network our organizations. It is called the Secure Access Service Edge (SASE). It was first mentioned by Gartner, Inc. in its hype cycle for networking. Since then Barracuda highlighted SASE in a recent [PR update][1] and Zscaler also discussed it in their [earnings call][2]. Most recently, [Cato Networks][3] announced that it was mentioned by Gartner as a “sample vendor” in the hype cycle. + +Today, the enterprises have upgraded their portfolio and as a consequence, the ramifications of the network also need to be enhanced. What we are witnessing is cloud, mobility, and edge, which has resulted in increased pressure on the legacy network and security architecture. Enterprises are transitioning all users, applications, and data located on-premise, to a heavy reliance on the cloud, edge applications, and a dispersed mobile workforce.   + +### Our technologies must evolve + +Digital transformation improves agility and competitiveness. However, at the same time, it impacts the way we connect and secure these connections. Therefore, as the landscape evolves must our technologies. In such a scenario, the introduction of a SASE is a reflection of this change. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The new SASE category converges the capabilities of WAN with network security to support the needs of the digital enterprise. Some of these disparate networks and security services include SD-WAN, secure web gateway, CASB, software-defined perimeter, DNS protection, and firewall-as-a-service. + +Today, there are a number of devices that should be folded into a converged single software stack. There should be a fabric wherein all the network and security functionality can be controlled centrally. + +Advertisement + +### SD-WAN forms part of the picture + +The hardest thing is to accept what we have been doing in the past is not the best way forward for our organizations. The traditional methods to protect the mobile, cloud assets and sites are no longer the optimum way to support today's digital environment. Gartner claims that the shift to SASE will make the existing networking and security models obsolete. + +Essentially, SASE is not just about offering SD-WAN services. SD-WAN is just a part of the much bigger story since it doesn't address all the problems. For this, you need to support a full range of capabilities. This means you must support mobile users and cloud resources (from anywhere), in a way that doesn't require backhauling.  + +**[ Related: [MPLS explained – What you need to know about multi-protocol label switching][5]** + +Security should be embedded into the network which some SD-WAN vendors do not offer. Therefore, I could sense SASE saying that SD-WAN alone is insufficient. + +### An overview of the SASE requirements + +Primarily, to provide secure access in this new era and to meet the operational requirements will involve relying heavily on cloud-based services. This is contrary to a collection of on-premise network and security devices. + +Whereas, to be SASE enabled, the network and security domain should be folded in a cloud-native approach to networking and security. This provides significant support for all types of edges**.** + +To offer SASE services you need to fulfill a number of requirements: + + 1. The convergence of WAN edge and network security models + 2. Cloud-native, cloud-based service delivery + 3. A network designed for all edges + 4. Identity and network location + + + +### 1\. The convergence of WAN edge and network security models + +Firstly, it requires the convergence of the WAN edge and network security models. Why? It is because the customer demands simplicity, scalability, low latency and pervasive security which drive the requirement for the convergence of these models. + +So, we have a couple of options. One may opt to service the chain appliances; physical or virtual. Although this option does shorten the time to market but it will also result in inconsistent services, poor manageability, and high latency. + +Keep in mind the service insertion fragments as it makes two separate domains. There are two different entities that are being managed by limiting visibility. Service chaining solutions for Gartner is not SASE. + +The approach is to converge both networking and security into the cloud. This creates a global and cloud-native architecture that connects and secures all the locations, cloud resources, and mobile users everywhere. + +SASE offerings will be purpose-built for scale-out, cloud-native, and cloud-based delivery. This will notably optimize the solution to deliver low latency services. + +You need a cloud-native architecture to achieve the milestone of economy and agility. To deliver maximum flexibility with the lowest latency and resource requirements, cloud-native single-pass architecture is a very significant advantage. + +### 2\. Cloud-native, cloud-based service delivery + +Edge applications are latency sensitive. Hence, these require networking and security to be delivered in a distributed manner which is close to the endpoint. Edge is the new cloud that requires a paradigm shift to what cloud-based providers offer with a limited set of PoP. + +The geographical footprint is critical and to effectively support these edge applications requires a cloud-delivery-based approach. Such an approach favors providers with many points of presence. Since the users are global, so you must have global operations. + +It is not sufficient to offer a SASE service built solely on a hyper-scale. This limits the providers with the number of points of presence. You need to deliver where the customers are and to do this, you need a global footprint and the ability to instantiate a PoP in response to the customer demands. + +### 3\. A network designed for all edges + +The proliferation of the mobile workforce requires SASE services to connect with more than just sites. For this, you need to have an agent-based capability that should be managed as a cloud service. + +In plain words, SASE offerings that rely on the on-premises, box-oriented delivery model, or a limited number of cloud points of presence (without agent-based capability), will be unable to meet the requirements of an increasingly mobile workforce and the emerging latency-sensitive applications. + +### 4\. Identity and network location + +Let’s face it, now there are new demands on networks emerging from a variety of sources. This results in increased pressure on the traditional network and security architectures. Digital transformation and the adoption of mobile, cloud and edge deployment models, accompanied by the change in traffic patterns, make it imperative to rethink the place of legacy enterprise networks.  + +To support these changes, we must reassess how we view the traditional data center. We must evaluate the way we use IP addresses as an anchor for the network location and security enforcement. Please keep in mind that anything tied to an IP address is useless as it does not provide a valid hook for network and security policy enforcement. This is often referred to as the IP address conundrum. + +SASE is the ability to deliver network experience with the right level of security access. This access is based on the identity and real-time condition that is in accordance with company policy. Fundamentally, the traffic can be routed and prioritized in certain ways. This allows you to customize your level of security. For example, the user will get a different experience from a different location or device type. All policies are tied to the user identity and not based on the IP address.  + +Finally, the legacy data center should no longer be considered as the center of network architecture. The new center of secure access networking design is the identity with a policy that follows regardless. Identities can be associated with people, devices, IoT or edge computing locations. + +### A new market category + +The introduction of the new market category SASE is a reflection of our current times. Technologies have changed considerably. The cloud, mobility, and edge have put increased pressure on the legacy network and network security architectures. Therefore, for some use cases, SASE will make the existing models obsolete. + +For me, this is an exciting time to see a new market category and I will track this thoroughly with future posts. As we are in the early stages, there will be a lot of marketing buzz. My recommendation would be to line up who says they are claiming/mentioning SASE against the criteria set out in this post and see who does what. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][6]** + +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/3442941/secure-access-service-edge-sase-a-reflection-of-our-times.html + +作者:[Matt Conran][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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: http://www.backupreview.info/2019/09/11/new-release-of-barracuda-cloudgen-firewall-automates-and-secures-enterprise-migrations-to-public-cloud/ +[2]: https://seekingalpha.com/article/4290853-zscaler-inc-zs-ceo-jay-chaudhry-q4-2019-results-earnings-call-transcript +[3]: https://www.catonetworks.com/news/cato-networks-listed-for-sase-category-in-the-gartner-hype-cycle-2019 +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/2297171/sd-wan/network-security-mpls-explained.html +[6]: https://www.networkworld.com/contributor-network/signup.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191004 What-s in an open source name.md b/sources/talk/20191004 What-s in an open source name.md new file mode 100644 index 0000000000..e15ac57a28 --- /dev/null +++ b/sources/talk/20191004 What-s in an open source name.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's in an open source name?) +[#]: via: (https://opensource.com/article/19/10/open-source-name-origins) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +What's in an open source name? +====== +Ever wonder where the names of your favorite open source projects or +programming languages came from? Get the origin stories behind popular +tech nomenclature from A to Z. +![A person writing.][1] + +GNOME, Java, Jupyter, Python. If your friends or family members have ever eavesdropped on your work conversations, they might think you've made a career in Renaissance folklore, coffee roasting, astronomy, or zoology. Where did the names of these open source technologies come from? We asked our writer community for input and rounded up some of our favorite tech name origin stories. + +### Ansible + +The name "Ansible" is lifted directly from science fiction. Ursula Le Guin's book _Rocannon's World_ had devices allowing instantaneous (faster than light) communication called ansibles (derived, apparently, from the word "answerable"). Ansibles became a staple of science fiction, including in Orson Scott Card's _Ender's Game_ (which later became a popular film), where the device controlled many remote space ships. This seemed to be a good model for software that controls distributed machines, so Michael DeHaan (creator and founder of Ansible) borrowed the name. + +### Apache + +[Apache][2] is an open source web server that was originally released in 1995. Its name is not related to the famous Native American tribe; it instead refers to the repeated patches to its original software code. Hence, "A-patchy server." + +### awk + +"awk(1) Stands for Aho, Weinberger, Kernighan (authors)" —Michael Greenberg + +### Bash + +"The original Unix shell, the Bourne shell, was named after its creator. At the time Bash was being developed, csh (pronounced 'seashell') was actually more popular for interactive user logins. The Bash project aimed to give new life to the Bourne shell by making it more suitable for interactive use, thus it was named the 'Bourne again shell,' a pun on 'born again.'" —Ken Gaillot + +### C + +"In early days, Ken Thompson and Dennis Ritchie at AT&T found it interesting that you could use a higher-level programming language (instead of low-level and less-portable assembly programming) to write operating systems and tools. There was an early programming system called BCPL (Basic Combined Programming Language), and Thompson created a stripped-down version of BCPL called B. But B wasn't very flexible or fast. Ritchie then took the ideas of B and expanded it into a compiled language called C." —Jim Hall + +### dd + +"I don't think you can publish such an article without mentioning dd. My nickname is Didi. Correctly pronounced, it sounds like 'dd.' I first learned Unix, and then Linux, in 1993 as a student. Then I went to the army, arrived to one of the very few sections in my unit that used Unix (Ultrix) (the rest were mainly VMS), and one of the people there said: 'So, you are a hacker, right? You think you know Unix? OK, so what's the reason for the name dd?' I had no idea and tried to guess: "Data duplicator?" So he said, 'I'll tell you the story of dd. dd is short for _convert and copy_ (as anyone can still see today on the manpage), but since cc was already taken by the c compiler, it was named dd.' Only years later, I heard the true story about JCL's data definition and the non-uniform, semi-joking syntax for the Unix dd command somewhat being based on it." —Yedidyah Bar David + +### Emacs + +The classic anti-vi editor, the true etymology of the name is unremarkable, in that it derives from "Editing MACroS." Being an object of great religious opprobrium and worship it has, however, attracted many spoof bacronyms such as "Escape Meta Alt Control Shift" (to spoof its heavy reliance on keystrokes), "Eight Megabytes And Constantly Swapping" (from when that was a lot of memory), "Eventually malloc()s All Computer Storage," and "EMACS Makes A Computer Slow." —Adapted from the Jargon File/Hacker's Dictionary + +### Enarx + +[Enarx][3] is a new project in the confidential computing space. One of the project's design principles was that it should be "fungible." so an initial name was "psilocybin" (the famed magic mushroom). The general feeling was that manager types would probably be resistant, so new names were considered. The project's two founders, Mike Bursell and Nathaniel McCallum, are both ancient language geeks, so they considered lots of different ideas, including тайна (Tayna—Russian for secret or mystery—although Russian, admittedly, is not ancient, but hey), crypticon (total bastardization of Greek), cryptidion (Greek for small secret place), arcanus (Latin masculine adjective for secret), arcanum (Latin neuter adjective for secret), and ærn (Anglo-Saxon for place, secret place, closet, habitation, house, or cottage). In the end, for various reasons, including the availability of domains and GitHub project names, they settled on enarx, a combination of two Latin roots: en- (meaning within) and -arx (meaning citadel, stronghold, or fortress). + +### GIMP + +Where would we be without [GIMP][4]? The GNU Image Manipulation Project has been an open source staple for many years. [Wikipedia][5] states, "In 1995, [Spencer Kimball][6] and [Peter Mattis][7] began developing GIMP as a semester-long project at the University of California, Berkeley, for the eXperimental Computing Facility." + +### GNOME + +Have you ever wondered why GNOME is called GNOME? According to [Wikipedia][8], GNOME was originally an acronym that represented the "GNU Network Object Model Environment." Now that name no longer represents the project and has been dropped, but the name has stayed. [GNOME 3][9] is the default desktop environment for Fedora, Red Hat Enterprise, Ubuntu, Debian, SUSE Linux Enterprise, and more. + +### Java + +Can you imagine this programming language being named anything else? Java was originally called Oak, but alas, the legal team at Sun Microsystems vetoed that name due to its existing trademark. So it was back to the drawing board for the development team. [Legend has it][10] that a massive brainstorm was held by the language's working group in January 1995. Lots of other names were tossed around including Silk, DNA, WebDancer, and so on. The team did not want the new name to have anything to do with the overused terms, "web" or "net." Instead, they were searching for something more dynamic, fun, and easy to remember. Java met the requirements and miraculously, the team agreed! + +### Jupyter + +Many of today's data scientists and students use [Jupyter][11] notebooks in their work. The name Jupyter is an amalgamation of three open source computer languages that are used in the notebooks and prominent in data science: [Julia][12], [Python][13], and [R][14]. + +### Kubernetes + +Kubernetes is derived from the Greek word for helmsman. This etymology was corroborated in a [2015 Hacker News][15] response by a Kubernetes project founder, Craig McLuckie. Wanting to stick with the nautical theme, he explained that the technology drives containers, much like a helmsman or pilot drives a container ship. Thus, Kubernetes was the chosen name. Many of us are still trying to get the pronunciation right (koo-bur-NET-eez), so K8s is an acceptable substitute. Interestingly, it shares its etymology with the English word "governor," so has that in common with the mechanical negative-feedback device on steam engines. + +### KDE + +What about the K desktop? KDE originally represented the "Kool Desktop Environment." It was founded in 1996 by [Matthias Ettrich][16]. According to [Wikipedia][17], the name was a play on the words [Common Desktop Environment][18] (CDE) on Unix. + +### Linux + +[Linux][19] was named for its inventor, Linus Torvalds. Linus originally wanted to name his creation "Freax" as he thought that naming the creation after himself was too egotistical. According to [Wikipedia][19], "Ari Lemmke, Torvalds' coworker at the Helsinki University of Technology, who was one of the volunteer administrators for the FTP server at the time, did not think that 'Freax' was a good name. So, he named the project 'Linux' on the server without consulting Torvalds." + +Following are some of the most popular Linux distributions. + +#### CentOS + +[CentOS][20] is an acronym for Community Enterprise Operating System. It contains the upstream packages from Red Hat Enterprise Linux. + +#### Debian + +[Debian][21] Linux, founded in September 1993, is a portmanteau of its founder, Ian Murdock, and his then-girlfriend Debra Lynn. + +#### RHEL + +[Red Hat Linux][22] got its name from its founder Marc Ewing, who wore a red Cornell University fedora given to him by his grandfather. Red Hat was founded on March 26, 1993. [Fedora Linux][23] began as a volunteer project to provide extra software for the Red Hat distribution and got its name from Red Hat's "Shadowman" logo. + +#### Ubuntu + +[Ubuntu][24] aims to share open source widely and is named after the African philosophy of ubuntu, which can be translated as "humanity to others" or "I am what I am because of who we all are." + +### Moodle + +The open source learning platform [Moodle][25] is an acronym for "modular object-oriented dynamic learning environment." Moodle continues to be a leading platform for e-learning. There are nearly 104,000 registered Moodle sites worldwide. + +Two other popular open source content management systems are Drupal and Joomla. Drupal's name comes from the Dutch word for "druppel" which means "drop." Joomla is an [anglicized spelling][26] of the Swahili word "jumla," which means "all together" in Arabic, Urdu, and other languages, according to Wikipedia. + +### Mozilla + +[Mozilla][27] is an open source software community founded in 1998. According to its website, "The Mozilla project was created in 1998 with the release of the Netscape browser suite source code. It was intended to harness the creative power of thousands of programmers on the internet and fuel unprecedented levels of innovation in the browser market." The name was a portmanteau of [Mosaic][28] and Godzilla. + +### Nginx + +"Many tech people try to be cool and say it 'n' 'g' 'n' 'x'. Few actually did the basic actions of researching a bit more to find out very quickly that the name is actually supposed to be said as 'EngineX,' in reference to the powerful web server, like an engine." —Jean Sebastien Tougne + +### Perl + +Perl's founder Larry Wall originally named his project "Pearl." According to Wikipedia, Wall wanted to give the language a short name with positive connotations. Wall discovered the existing [PEARL][29] programming language before Perl's official release and changed the spelling of the name. + +### Piet and Mondrian + +"There are two programming language named after the artist Piet Mondrian. One is called 'Piet' and the other 'Mondrian.' [David Morgan-Mar [writes][30]]: 'Piet is a programming language in which programs look like abstract paintings. The language is named after Piet Mondrian, who pioneered the field of geometric abstract art. I would have liked to call the language Mondrian, but someone beat me to it with a rather mundane-looking scripting language. Oh well, we can't all be esoteric language writers, I suppose.'" —Yuval Lifshitz + +### Python + +The Python programming language received its unique name from its creator, Guido Van Rossum, who was a fan of the comedy group Monty Python. + +### Raspberry Pi + +Known for its tiny-but-mighty capabilities and wallet-friendly price tag, the Raspberry Pi is a favorite in the open source community. But where did its endearing (and yummy) name come from? In the '70s and '80s, it was a popular trend to name computers after fruit. Apple, Tangerine, Apricot... anyone getting hungry? According to a [2012 interview][31] with founder Eben Upton, the name "Raspberry Pi" is a nod to that trend. Raspberries are also tiny in size, yet mighty in flavor. The "Pi" in the name alludes to the fact that, originally, the computer could only run Python. + +### Samba + +[Server Message Block][32] for sharing Windows files on Linux. + +### ScummVM + +[ScummVM][33] (Script Creation Utility for Maniac Mansion Virtual Machine) is a program that makes it possible to run some classic computer adventure games on a modern computer. Originally, it was designed to play LucasArts adventure games that were built using SCUMM, which was originally used to develop Maniac Mansion before being used to develop most of LucasArts's other adventure games. Currently, ScummVM supports a large number of game engines, including Sierra Online's AGI and SCI, but still retains the name ScummVM. A related project, [ResidualVM][34], got its name because it covers the "residual" LucasArts adventure games not covered by ScummVM. The LucasArts games covered by ResidualVM were developed using GrimE (Grim Engine), which was first used to develop Grim Fandango, so the ResidualVM name is a double pun. + +### SQL + +"You may know [SQL] stands for Structured Query Language, but do you know why it's often pronounced 'sequel'? It was created as a follow-up (i.e. sequel) to the original 'QUEL' (QUEry Language)." —Ken Gaillot + +### XFCE + +[XFCE][35] is a popular desktop founded by [Olivier Fourdan][36]. It began as an alternative to CDE in 1996 and its name was originally an acronym for XForms Common Environment. + +### Zsh + +Zsh is an interactive login shell. In 1990, the first version of the shell was written by Princeton student Paul Falstad. He named it after seeing the login ID of Zhong Sha (zsh), then a teaching assistant at Princeton, and thought that it sounded like a [good name for a shell][37]. + +There are many more projects and names that we have not included in this list. Be sure to share your favorites in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-name-origins + +作者:[Joshua Allen Holm][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/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://httpd.apache.org/ +[3]: https://enarx.io +[4]: https://www.gimp.org/ +[5]: https://en.wikipedia.org/wiki/GIMP +[6]: https://en.wikipedia.org/wiki/Spencer_Kimball_(computer_programmer) +[7]: https://en.wikipedia.org/wiki/Peter_Mattis +[8]: https://en.wikipedia.org/wiki/GNOME +[9]: https://www.gnome.org/gnome-3/ +[10]: https://www.javaworld.com/article/2077265/so-why-did-they-decide-to-call-it-java-.html +[11]: https://jupyter.org/ +[12]: https://julialang.org/ +[13]: https://www.python.org/ +[14]: https://www.r-project.org/ +[15]: https://news.ycombinator.com/item?id=9653797 +[16]: https://en.wikipedia.org/wiki/Matthias_Ettrich +[17]: https://en.wikipedia.org/wiki/KDE +[18]: https://sourceforge.net/projects/cdesktopenv/ +[19]: https://en.wikipedia.org/wiki/Linux +[20]: https://www.centos.org/ +[21]: https://www.debian.org/ +[22]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[23]: https://getfedora.org/ +[24]: https://ubuntu.com/about +[25]: https://moodle.org/ +[26]: https://en.wikipedia.org/wiki/Joomla#Historical_background +[27]: https://www.mozilla.org/en-US/ +[28]: https://en.wikipedia.org/wiki/Mosaic_(web_browser) +[29]: https://en.wikipedia.org/wiki/PEARL_(programming_language) +[30]: http://www.dangermouse.net/esoteric/piet.html +[31]: https://www.techspot.com/article/531-eben-upton-interview/ +[32]: https://www.samba.org/ +[33]: https://www.scummvm.org/ +[34]: https://www.residualvm.org/ +[35]: https://www.xfce.org/ +[36]: https://en.wikipedia.org/wiki/Olivier_Fourdan +[37]: http://www.zsh.org/mla/users/2005/msg00951.html diff --git a/sources/talk/20191005 Machine Learning (ML) and IoT can Work Together to Improve Lives.md b/sources/talk/20191005 Machine Learning (ML) and IoT can Work Together to Improve Lives.md new file mode 100644 index 0000000000..8142c85416 --- /dev/null +++ b/sources/talk/20191005 Machine Learning (ML) and IoT can Work Together to Improve Lives.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Machine Learning (ML) and IoT can Work Together to Improve Lives) +[#]: via: (https://opensourceforu.com/2019/10/machine-learning-ml-and-iot-can-work-together-to-improve-lives/) +[#]: author: (Vinayak Ramachandra Adkoli https://opensourceforu.com/author/vinayak-adkoli/) + +Machine Learning (ML) and IoT can Work Together to Improve Lives +====== + +[![][1]][2] + +_IoT devices are becoming popular nowadays. The widespread use of IoT yields huge amounts of raw data. This data can be effectively processed by using machine learning to derive many useful insights that can become game changers and affect our lives deeply._ + +The field of machine learning is growing steadily, along with the growth of the IoT. Sensors, nano cameras, and other such IoT elements are now ubiquitous, placed in mobile phones, computers, parking stations, traffic control centres and even in home appliances. There are millions of IoT devices in the world and more are being manufactured every day. They collect huge amounts of data that is fed to machines via the Internet, enabling machines to ‘learn’ from the data and make them more efficient. + +In IoT, it is important to note that a single device/element can generate immense amounts of data every second. All this data from IoT is transmitted to servers or gateways to create better machine learning models. Data analytics software can convert this raw data into useful insights so that the machine can be made more intelligent, and perform better with cost-effectiveness and a long life. By the year 2020, the world will have an estimated 20 billion IoT devices. Data collected by these devices mostly pertains to machines. By using this data, machines can learn more effectively and can overcome their own drawbacks. + +Now let’s look at how machine learning and IoT can be combined together. Let us suppose that I have some bananas and apples. I have got a sophisticated nano camera and sensors to collect the data from these fruits. If the data collected by these elements is fed to my laptop through the Internet, my laptop will start analysing the information by using sophisticated data analytics software and the cloud platform. Now if my laptop shows graphically how many bananas and apples I have left, it probably means that my machine (laptop) hasn’t learnt enough. On the other had, if my laptop is able to describe graphically how many of these are now ripe enough to be eaten, how many are not quite ripe and how many are very raw, it proves that my machine (laptop) has learned enough and has become more intelligent. + +Storing, processing, analysing and being able to ‘reason out’ using IoT data requires numerous computational and financial resources to attain business and machine learning values. + +Today an Airbus aircraft is provided with thousands of sensors to measure temperature, speed, fuel consumption, air flow dynamics, mechanisms of working, etc. All this data provided by IoT devices is connected to cloud platforms such as IBM Watson, Microsoft Azure, etc, via the Internet. Using sophisticated data analytics software, useful information is fed back to the machine, i.e., the aircraft. Using this data, the machine can learn very fast to overcome its problems, so that its life span and performance can be greatly enhanced. + +Today, the IoT connects several sectors such as manufacturing industries, healthcare, buildings, vehicles, traffic, shopping centres and so on. Data gathered from such diverse domains can certainly make the infrastructure learn meaningfully to work more efficiently. + +**Giving a new deal to electronic vision** +Amazon DeepLens is a wireless-enabled video camera and is integrated with Amazon Cloud. It makes use of the latest AI tools to develop computer vision applications. Using deep learning frameworks such as Caffe, MxNet and Tensorflow, it can develop effective computer vision applications. The device can be effectively connected to Amazon IoT. It can be used to build custom models with Amazon Sage Market. Its efficiency can even be enhanced using Apache MxNet. In fact, Amazon DeepLens can be used in a variety of projects, ranging from safety and education to health and wellness. For example, individuals diagnosed with dementia have difficulty in recognising friends and even family, which can make them disoriented and confused when speaking with loved ones. Amazon DeepLens can greatly assist those who have difficulty in recognising other people. + +**Why postpone the smart city concept?** +Cities today are experiencing unprecedented population growth as more people move to urban areas, and are dealing with several problems such as pollution, surging energy demand, public safety concerns, etc. It is important to remember the lessons from such urban problems. It’s time now to view the smart city concept as an effective way to solve such problems. Smart city projects take advantage of IoT with advanced AI algorithms and machine learning, to relieve pressure on the infrastructure and staff while creating a better environment. + +Let us look at the example of smart parking — it effectively solves vehicle parking problems. IoT monitoring today can locate empty parking spaces and quickly direct vehicles to parking spots. Today, up to 30 per cent of traffic congestion is caused by drivers looking for places to park. Not only does the extra traffic clog roadways, it also strains infrastructure and raises carbon emissions. +Today, smart buildings can automate central heating, air conditioning, lighting, elevators, fire-safety systems, the opening of doors, kitchen appliances, etc, using the IoT and machine learning (ML) techniques. + +Another important problem faced by smart cities is vehicle platooning (flocking).This situation can be avoided by the construction of automated highways and by building smart cars. IoT and ML together offer better solutions to avoid vehicle platooning. This will result in greater fuel economy, reduced congestion and fewer traffic collisions. + +IoT and ML can be effectively implemented in machine prognostics — an engineering discipline that mainly focuses on predicting the time at which a system or component will no longer perform its intended function. So ML with IoT can be effectively implemented in system health management (SHM), e.g., in transportation applications, in vehicle health management (VHM) or engine health management (EHM). + +ML and IoT are rapidly attracting the attention of the defence and space sectors. Let’s look at the case of NASA, the US space exploration agency. As a part of a five-node network, Xbee and ZigBee will be used to monitor Exo-Brake devices in space to collect data, which includes three-axis acceleration in addition to temperature and air pressure. This data is relayed to the ground control station via NASA’s Iridium satellite to make the ML of the Exo-Brake instrument more efficient. + +Today, drones in military operations are programmed with ML algorithms. This enables them to determine which pieces of data collected by IoT are critical to the mission and which are not. They collect real-time data when in-flight. These drones assess all incoming data and automatically discard irrelevant data, effectively managing data payloads. + +In defence systems today, self-healing drones are slowly gaining widespread acceptance. Each drone has its own ML algorithm as it flies on a mission. Using this, a group of drones on a mission can detect when one member of the group has failed, and then communicate with other drones to regroup and continue the military mission without interruption. + +In both the lunar and Mars projects, NASA is using hardened sensors that can withstand extreme heat and cold, high radiation levels and other harsh environmental conditions found in space to make the ML algorithm of the Rovers more effective and hence increase their life span and reliability. + +In NASA ‘s Lunar Lander project, the energy choice was solar, which is limitless in space. NASA is planning to take advantage of IoT and ML technology in this sector as well. + +**IoT and ML can boost growth in agriculture** +Agriculture is one of the most fundamental human activities. Better technologies mean greater yield. This, in turn, keeps the human race happier and healthier. According to some estimates, worldwide food production will need to increase by 70 per cent by 2050 to keep up with global demand. + +Adoption of IoT and ML in the agricultural space is also increasing quickly with the total number of connected devices expected to grow from 30 million in 2015 to 75 million in 2020. + +In modern agriculture, all interactions between farmers and agricultural processes are becoming more and more data driven. Even analytical tools are providing the right information at the right time. Slowly but surely, ML is providing the impetus to scale and automate the agricultural sector. It is helping to learn patterns and extract information from large amounts of data, whether structured or unstructured. + +**ML and IoT ensure better healthcare** +Today, intelligent, assisted living environments for home based healthcare for chronic patients are very essential. The environment combines the patient’s clinical history and semantic representation of ICP (individual care process) with the ability to monitor the living conditions using IoT technologies. Thus the Semantic Web of Things (SWOT) and ML algorithms, when combined together, result in LDC (less differentiated caregiver). The resultant integrated healthcare framework can provide significant savings while improving general health. + +Machine learning algorithms, techniques and machinery are already present in the market to implement reasonable LDC processes. Thus, this technology is sometimes described as supervised or predictive ML. + +IoT in home healthcare systems comprises multi-tier area networks. These consist of body area networks (BAN), the LAN and ultimately the WAN. These also need highly secured hybrid clouds. +IoT devices in home healthcare include nano sensors attached to the skin of the patient’s body to measure blood pressure, sugar levels, the heart beat, etc. This raw data is transmitted to the patient’s database that resides in the highly secured cloud platform. The doctor can access the raw data, previous prescriptions, etc, using sophisticated ML algorithms to recommend specific drugs to patients at remote places if required. Thus, patients at home can be saved from life threatening health conditions such as sudden heart attacks, paralysis, etc. + +In this era of communication and connectivity, individuals have multiple technologies to support their day-to-day requirements. In this scenario, IoT together with ML is emerging as a practical solution for problems facing several sectors. + +Growth in IoT is fine but just how much of the data collected by IoT devices is actually useful, is the key question. To answer that, efficient data analytics software, open source platforms and cloud technologies should be used. Machine learning and IoT should work towards creating a better technology, which will ensure efficiency and productivity for all sectors. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/machine-learning-ml-and-iot-can-work-together-to-improve-lives/ + +作者:[Vinayak Ramachandra Adkoli][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://opensourceforu.com/author/vinayak-adkoli/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/ML-IoT_Sept-19.jpg?resize=696%2C458&ssl=1 (ML & IoT_Sept 19) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/ML-IoT_Sept-19.jpg?fit=1081%2C711&ssl=1 diff --git a/sources/talk/20191006 Cloud Native Computing- The Hidden Force behind Swift App Development.md b/sources/talk/20191006 Cloud Native Computing- The Hidden Force behind Swift App Development.md new file mode 100644 index 0000000000..6b29dcb37f --- /dev/null +++ b/sources/talk/20191006 Cloud Native Computing- The Hidden Force behind Swift App Development.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cloud Native Computing: The Hidden Force behind Swift App Development) +[#]: via: (https://opensourceforu.com/2019/10/cloud-native-computing-the-hidden-force-behind-swift-app-development/) +[#]: author: (Robert Shimp https://opensourceforu.com/author/robert-shimp/) + +Cloud Native Computing: The Hidden Force behind Swift App Development +====== + +[![][1]][2] + +_Cloud native computing can bolster the development of advanced applications powered by artificial intelligence, machine learning and the Internet of Things._ + +Modern enterprises are constantly adapting their business strategies and processes as they respond to evolving market conditions. This is especially true for enterprises serving fast-growing economies in the Asia Pacific, such as India and Australia. For these businesses, cloud computing is an invaluable means to accelerate change. From quickly deploying new applications to rapidly scaling infrastructure, enterprises are using cloud computing to create new value, build better solutions and expand business. + +Now cloud providers are introducing new ‘cloud native computing’ services that enable even more dynamic application development. This new technology will make cloud application developers more agile and efficient, even as it reduces deployment costs and increases cloud vendor independence. + +Many enterprises are intrigued but are also feeling overwhelmed by the rapidly changing cloud native technology landscape and hence, aren’t sure how to proceed. While cloud native computing has demonstrated success among early adopters, harnessing this technology has posed a challenge for many mainstream businesses. + +**Choosing the right cloud native open source projects** +There are several ways that an enterprise can bring cloud native computing on board. One option is to build its own cloud native environment using open source software. This comes at the price of carefully evaluating many different open source projects before choosing which software to use. Once the software is selected, the IT department will need to staff and train hard-to-find talent to provide in-house support. All in all, this can be an expensive and risky way to adopt new technology. + +A second option is to contract with a software vendor to provide a complete cloud native solution. But this compromises the organisation’s freedom to choose the best open source technologies in exchange for better vendor support, not to mention the added perils of a closed contract. + +This dilemma can be resolved by using a technology provider that offers the best of both worlds — i.e., delivering standards-based off-the-shelf software from the open source projects designated by the Cloud Native Computing Foundation (CNCF), and also providing integration, testing and enterprise-class support for the entire software stack. + +CNCF uses experts from across the industry to evaluate the maturity, quality and security of cloud native open source projects and give guidance on which ones are ready for enterprise use. Selected cloud native technologies cover the entire scope of containers, microservices, continuous integration, serverless functions, analytics and much more. + +Once CNCF declares these cloud native open source projects as having ‘graduated’, they can confidently be incorporated into an enterprise’s cloud native strategy with the knowledge that these are high quality, mainstream technologies that will get industry-wide support. + +**Finding that single vendor who offers multiple benefits** +But adopting CNCF’s rich cloud native technology framework is only half the battle won. You also must choose a technology provider who will package these CNCF-endorsed technologies without proprietary extensions that lock you in, and provide the necessary integration, testing, support, documentation, training and more. + +A well-designed software stack built based on CNCF guidelines and offered by a single vendor has many benefits. First, it reduces the risks associated with technology adoption. Second, it provides a single point of contact to rapidly get support when needed and resolve issues, which means faster time to market and higher customer satisfaction. Third, it helps make cloud native applications portable to any popular cloud. This flexibility can help enterprises improve their operating margins by reducing expenses and unlocking future revenue growth opportunities. + +Cloud native computing is becoming an everyday part of mainstream cloud application development. It can also bolster the development of advanced applications powered by artificial intelligence (AI), machine learning (ML) and the Internet of Things (IoT), among others. + +Leading users of cloud native technologies include R&D laboratories; high tech, manufacturing and logistics companies; critical service providers and many others. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/cloud-native-computing-the-hidden-force-behind-swift-app-development/ + +作者:[Robert Shimp][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://opensourceforu.com/author/robert-shimp/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Cloud-Native_Cloud-Computing.jpg?resize=696%2C459&ssl=1 (Cloud Native_Cloud Computing) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Cloud-Native_Cloud-Computing.jpg?fit=900%2C593&ssl=1 diff --git a/sources/talk/20191007 DevOps is Eating the World.md b/sources/talk/20191007 DevOps is Eating the World.md new file mode 100644 index 0000000000..f7571da4c1 --- /dev/null +++ b/sources/talk/20191007 DevOps is Eating the World.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps is Eating the World) +[#]: via: (https://opensourceforu.com/2019/10/devops-is-eating-the-world/) +[#]: author: (Jens Eckels https://opensourceforu.com/author/jens-eckels/) + +DevOps is Eating the World +====== + +[![][1]][2] + +_Ten years ago, DevOps wasn’t a thing. Now, if you’re not adopting DevOps practices, you’re in danger of being left behind the competition. Over the last decade, JFrog’s Liquid Software vision has driven a commitment to helping companies around the world adopt, mature and evolve their CI/CD pipelines. Why? DevOps powers the software that powers the world. Most companies today turn into Software companies with more and more applications to build and to update. They have to manage releases fast and secure with distributed development teams and a growing amount of data to manage._ + +**Our Mission** +JFrog is on a mission to enable continuous updates through liquid software, empowering developers to code high-quality applications that securely flow to end-users with zero downtime. We are the creators of [_Artifactory_][3], the heart of the end-to-end Universal DevOps platform for automating, managing, securing, distributing, and monitoring [_all types of technologies_][4]. As the leading universal, highly available enterprise DevOps Solution, the [_JFrog platform_][5] empowers customers with trusted and expedited software releases from code-to-production. Trusted by more than 5,500 customers, the world’s top brands, such as Amazon, Facebook, Google, Netflix, Uber, VMware, and Spotify depend on JFrog to manage their binaries for their mission-critical applications. + +**“Liquid Software”** +In its truest form, Liquid Software updates software continuously from code to the edge seamlessly, securely and with no downtime. No versions. No big buttons. Just flowing updates that frictionlessly power all the devices and applications around you. Why? To an edge device or browser or end-user, versions don’t really have to matter. What version of Facebook is on your phone? You don’t care – until it’s time to update it and you get annoyed. What is the current version of the operating system in your laptop? You might know, but again you don’t really care as long as it’s up to date. How about your version of Microsoft products? The version of your favorite website? You don’t care. You want it to work, and the more transparently it works the better. In fact, you’d prefer it most times if software would just update and you didn’t even need to click a button. JFrog is powering that change. + +**A fully Automated CI/CD Pipeline** +The idea of automating everything in the CI/CD pipeline is exciting and groundbreaking. Imagine a single platform where you could automate every step from code into production. It’s not a pipe dream (or a dream for your pipeline). It’s the Liquid Software vision: a world without versions. We’re excited about it, and eager to share the possibilities with you. + +**The Frog gives back!** +JFrog’s roots are in the many **open source** communities that are mainstays today. In addition to the many community contributions through global standards organizations, JFrog is proud to give enterprise-grade tools away for open source committers, as well as provide free versions of products for specific package types. There are “developer-first” companies that like to talk about their target market. JFrog is a developer company built by and for developers. We’re happy to support you. + +**JFrog is all over the world!** +JFrog has nine-and-counting global offices, including one in India, where we have a rapidly-growing team with R&D and support functions. **And, we’re hiring fast!** ([_see open positions_][6]). Join us and the Liquid Software revolution! + +**We are a proud sponsor of Open Source India** +As the sponsor of the DevOps track, we want to be sure that you see and have access to all the cool tools and methods available. So, we have a couple of amazing experiences you can enjoy: + + 1. Stop by the booth where we will be demonstrating the latest versions of the JFrog Platform, enabling Liquid Software. We’re excited to show you what’s possible. + 2. Join **Stephen Chin**, world-renowned speaker and night-hacker who will be giving a talk on the future of Liquid Software. Stephen spent many years at Sun and Oracle running teams of developer advocates. + + + +He’s a developer and advocate for your communities, and he’s excited to join you. + +**The bottom line:** JFrog is proud to be a developer company, serving your needs and the needs of the OSS communities around the globe with DevOps, DevSecOps and pipeline automation solutions that are changing how the world does business. We’re happy to help and eager to serve. + +JFrog products are available as [_open-source_][7], [_on-premise_][8], and [_on the cloud_][9] on [_AWS_][10], [_Microsoft Azure_][11], and [_Google Cloud_][12]. JFrog is privately held with offices across North America, Europe, and Asia. **Learn more at** [_jfrog.com_][13]. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/devops-is-eating-the-world/ + +作者:[Jens Eckels][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://opensourceforu.com/author/jens-eckels/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/07/DevOps-Statup-rising.jpg?resize=696%2C498&ssl=1 (DevOps Statup rising) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/07/DevOps-Statup-rising.jpg?fit=1460%2C1045&ssl=1 +[3]: https://jfrog.com/artifactory/ +[4]: https://jfrog.com/integration/ +[5]: https://jfrog.com/enterprise-plus-platform/ +[6]: https://join.jfrog.com/ +[7]: https://jfrog.com/open-source/ +[8]: https://jfrog.com/artifactory/free-trial/ +[9]: https://jfrog.com/artifactory/free-trial/#saas +[10]: https://jfrog.com/artifactory/cloud-native-aws/ +[11]: https://jfrog.com/artifactory/cloud-native-azure/ +[12]: https://jfrog.com/artifactory/cloud-native-gcp/ +[13]: https://jfrog.com/ diff --git a/sources/talk/20191008 Fight for the planet- Building an open platform and open culture at Greenpeace.md b/sources/talk/20191008 Fight for the planet- Building an open platform and open culture at Greenpeace.md new file mode 100644 index 0000000000..0e20d932f2 --- /dev/null +++ b/sources/talk/20191008 Fight for the planet- Building an open platform and open culture at Greenpeace.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fight for the planet: Building an open platform and open culture at Greenpeace) +[#]: via: (https://opensource.com/open-organization/19/10/open-platform-greenpeace) +[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger) + +Fight for the planet: Building an open platform and open culture at Greenpeace +====== +Global problems require global solutions. Global solutions require open +organizations. Learn how Greenpeace is opening up to address climate +change. +![The Open Organization at Greenpeace][1] + +Global problems require global solutions. + +Few organizations know this better than Greenpeace. For nearly 50 years, the non-profit has been campaigning for a greener and more peaceful future. + +But in 2015, Greenpeace found itself at a crossroads. To address the climate emergency, Greenpeace knew it needed to [shift its organizational culture][2]. + +The organization needed a bold, new way of _being_. It needed to invest in new priorities, including digital technology and data analysis, inclusive and agile organizational structures, leadership supportive of culture change, new engagement practices, digital systems thinking, and more. It needed to facilitate the collective power of activists to embody [distributed leadership][3] and help the organization drive change. It needed to become [more transparent, more adaptable, and more collaborative][4]—and imbue those same values into a platform that would help others do the same as they joined forces to save the world. + +To address the ecological problems of the 21st century, Greenpeace needed to become a more open organization. + +And I helped Greenpeace International do it. But—as with any open effort—I didn't work alone. + +As an [Open Organization Ambassador][5], a [writer in the open organization community][6], and co-founder [a cooperative][7] working to spread the culture, processes, and benefits of openness wherever it can, I connected Greenpeace with the combined resources, perspectives, and energy of communities working to make the world a better place. + +Working with an organization in the midst of a massive cultural transition presented plenty of challenges for me—but my colleagues at Greenpeace and partners in the open organization community shared both their experience and their tried-and-true solutions for infusing open principles into complex organizations. + +In this three-part series, I'll explain how [Greenpeace International][8] built its first fully free and open source project: [Planet 4][9], a global platform that connects activists and advocates in search of opportunities to impact the climate crisis. + +The work itself is open. But, just as importantly, so is the spirit that guides it. + +### From secretive to open + +But I'm getting ahead of myself. Let's rewind to 2015. + +To address the ecological problems of the 21st century, Greenpeace needed to become a more open organization. + +Like so many others concerned with the climate emergency I headed to [Greenpeace.org][10] to learn how I could join the legendary organization fight for the planet. What greeted me was an outdated, complicated, and difficult-to-use website. I (somehow) found my way to the organization's jobs page, applied, and landed an interview. + +As part of the interview process, I learned of an internal document circulating among Greenpeacers. In vivid and compelling terms, that document described [seven “shifts” Greenpeace would need to make][2] to its internal culture if it was to adapt to a changing social and political landscape. It was a new internal [storytelling][11] initiative aimed at helping Greenpeace both _imagine_ and _become_ the organization its staff wanted it to be. + +As I read the document—especially the part that described a desired shift “from secretive to open source”—I knew I could help. My entire career, I've used open principles to help guide people and projects to spark powerful, positive change in the world. Helping [a traditionally “secretive” organization][12] embrace openness to galvanize others in fighting for our planet. + +I was all in. + +### Getting off the ground + +Greenpeace needed to return to one of its founding values: _transparency._ Its founders were [open by default][13]. Like any organization, Greenpeace will always have secrets, from the locations activists plan to gather for protests to supporters' credit card numbers. But consensus was that Greenpeace had grown _too_ secretive. What good is being a global hub for activism if no one knows what you're doing—or how to help you? + +Likewise, Greenpeace sought new methods of collaboration, both internally and with populations around the world. Throughout the 1970s, people-powered strategies helped the organization unleash new modes of successful activism. But today's world required even _more_. Becoming more open would mean accepting more unsolicited help, allowing more people work toward shared goals in creative and ingenious ways, and extending greater trust and connection between the organization and its supporters. + +Greenpeace needed a new approach. And that approach would be embodied in a new platform codenamed “Planet 4.” + +### Enter Planet 4 + +Being as open as we can, pushing the boundaries of what it means to work openly, doesn't just impact our work. It impacts our identity. It's certainly part of mine, and it's part of what makes open source so successful—but I knew I'd need to work hard to help Greenpeace change its identity. + +Planet 4 would be a tool that drove people to action. We would harness modern technology to help people visualize their impact on the planet, then help them understand how they can drive change. We would publish calls to action and engage with our supporters in [a new and meaningful way][14]. + +Getting off the ground would require monumental effort—not just technical skill, but superior persuasive and educational ability to _explain_ the need for an open culture project (disguised as a software project) to people at Greenpeace. Before we wrote a single line of code, we needed to do some convincing. + +Being radically open is a scary prospect, especially for a global organization that the press loves to scrutinize. Working transparently while others are watching means accepting a certain kind of vulnerability. Some people never leave their house unless they look perfect. Others go to work in shorts and sandals. Asking the question of "when to be open" is kind of like asking "when do we want to be perfectly polished and where do we get to hang out in our pajamas?" + +Being as open as we can, pushing the boundaries of what it means to work openly, doesn't just impact our work. It impacts our _identity_. It's certainly part of mine, and it's part of what makes open source so successful—but I knew I'd need to work hard to help Greenpeace change its identity. + +As I tried to figure out how we could garner support for a fully open project, the solution presented itself at a monthly meeting of the [Open Organization Ambassador community][5]. One day in June 2016, fellow ambassador Rebecca Fernandez began describing one of her recent projects at Red Hat: the [Open Decision Framework][15]. + +_Listen to Rebecca Fernandez explain the Open Decision Framework._ + +And as she presented it, I knew right away I would be able to remix that tool into a language that would help Greenpeace leaders understand the power of thinking and acting openly. + +_Listen to Rebecca Fernandez explain Greenpeace's use of the Open Decision Framework._ + +It worked. And so began our journey with Planet 4. + +We had a huge task in front of us. We initiated a discovery phase to research what stakeholders needed from the new engagement platform. We held [community calls][16]. We published blog posts. We designed a software concept to rattle the bones of non-profit technology. We talked openly about our work. And we spent the next two years helping our glimmer of an idea become a functioning prototype launched in more than 35 countries all over the globe. + +We'd been successful. Yet the vision we'd developed—the vision of a platform built on modern technologies and capable of inspiring people to act on behalf of our planet—hadn't been fully realized. We needed help seeing the path from successful prototype to world-changing engagement platform. + +So with the support of a few strategic Greenpeacers, I reached out to some colleagues at Red Hat the only way I knew how—the open source way, by starting a conversation. We've started a collaboration between our two organizations, one that will enable us all to build and learn together. This effort will help us design community-driven, engaging, open systems that spur change. + +This is just the beginning of our story. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/open-platform-greenpeace + +作者:[Laura Hilliger][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/laurahilliger +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/images/open-org/open-org-greenpeace-article-blog-header-thumbnail.png?itok=M8Y0WQOT (The Open Organization at Greenpeace) +[2]: https://opensource.com/open-organization/16/1/greenpeace-makes-7-shifts-toward-open +[3]: https://opensource.com/open-organization/18/3/empowerment-and-leadership +[4]: https://opensource.com/open-organization/resources/open-org-definition +[5]: https://opensource.com/open-organization/resources/meet-ambassadors +[6]: https://opensource.com/users/laurahilliger +[7]: http://weareopen.coop +[8]: http://greenpeace.org/international +[9]: http://medium.com/planet4 +[10]: https://www.greenpeace.org/ +[11]: https://storytelling.greenpeace.org/ +[12]: https://opensource.com/open-organization/15/10/using-open-source-fight-man +[13]: https://www.youtube.com/watch?v=O49U2M1uczQ +[14]: https://medium.com/planet4/greenpeaces-engagement-content-vision-fbd6bb66018a#.u0gmrzf0f +[15]: https://opensource.com/open-organization/resources/open-decision-framework +[16]: https://opensource.com/open-organization/16/1/community-calls-will-increase-participation-your-open-organization diff --git a/sources/talk/20191009 -Open Standards Are The Key To Expanding IoT Innovation In India Market.md b/sources/talk/20191009 -Open Standards Are The Key To Expanding IoT Innovation In India Market.md new file mode 100644 index 0000000000..b359bddbe6 --- /dev/null +++ b/sources/talk/20191009 -Open Standards Are The Key To Expanding IoT Innovation In India Market.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (“Open Standards Are The Key To Expanding IoT Innovation In India Market”) +[#]: via: (https://opensourceforu.com/2019/10/open-standards-are-the-key-to-expanding-iot-innovation-in-india-market/) +[#]: author: (Ankita KS https://opensourceforu.com/author/ankita-ks/) + +“Open Standards Are The Key To Expanding IoT Innovation In India Market” +====== + +[![][1]][2] + +_With IoT creating a new digital realm today, it brings along intense connectivity requirements and standards for them to communicate with other devices through a common protocol. For these reasons, interoperability is the most defining and crucial element in the Internet of Things. To understand the landscape of IoT in India, the standards and interoperability challenges and the solutions for that **Ankita KS, Senior Technology Journalist** from **EFY group** spoke to **Dr. Aloknath De, Corporate Vice President**, and **Chief Technology Officer, Samsung R&D Institute India – Bangalore**. Excerpts follow.._ + +**Q: Many opine that IoT is just a buzzword coined to create hype by marketers? Do you agree with that line of thought? Or do you feel that IoT is opening an entirely new market?** + +**A.** IoT is not hype; so, I could not disagree more with that line of thought. I view IoT not only as ‘Internet of Things’, but also as ‘Integration of Technologies’. It allows multiple protocols for connectivity, various cloud technologies and humongous amounts of sensor data. Also, as multiple stakeholders are involved in this process of integration, every stakeholder has to be brought together, business cases have to be analyzed and revenue models have to be evolved. This process is time-consuming and takes efforts to fructify. + +**Q: In the past year what are the new developments in R&D with respect to IoT globally?** +**A.** Globally, different IoT technologies have emerged and some have been embraced. You can see new types of devices getting connected to the internet; this would not have been thought of 5 years ago. In the Home context, I group these IoT devices into three broad classes. First is the ‘Elephant Class’ – comprising of large appliances like Refrigerator, washing machine, AC, Television which sits in its primary location. Second is the ‘Horse Class’ comprising of Speaker, Smartphone, Smart Watch that “trots” with the person. And the Third is the ‘Rat Class’ comprising of smaller sensors like the thermostat, door sensor, occupancy sensor. Some of these devices do not benefit always from data, but they enrich the IoT system by feeding sensor data. Like the Smart Home scenario, we can also define devices in the context of Manufacturing, Industry and other verticals. + +Standards are emerging to cover multiple layers in IoT. Plug-fests are being done across the globe to test interoperability. Companies are investing in R&D to make devices smarter, securer and interoperable. Also, a trend is emerging in the control of home appliances over voice interactions. IoT in R&D is changing gears from mere automation to predictive services. ‘Sense, Analyze, React’ paradigm is shifting to ‘Sense, Analyze and Proact’. + +**Q. Are you satisfied at the rate of deployment of IoT solutions in India?** +**A.** Both Yes and No. The rate of deployment of IoT is different for different verticals. For some verticals, like Smart Home, Smart Manufacturing and Smart Logistics, it’s relatively going good. You can see smart security and surveillance being adopted in apartment complexes; predictive maintenance being adopted for heavy machinery in the industries; asset tracking and monitoring being adopted in Smart Logistics. + +Whereas for some verticals like Smart Cities initial steps have been taken. And then some verticals require more attention to resolve major technical challenges like Connected Healthcare (e.g. electronic health records, health regulations) and Smart Agriculture (e.g. Open spaces, placement of sensors, etc.). Overall, the Indian IoT market is still at its infancy; I would say in the exploratory phase with use cases being piloted primarily in the Home, Manufacturing and Logistics verticals. + +**Q. How do you see the IoT market (in India) evolving in the next 2-3 years?** +**A.** In the next 2-3 years, we expect the number of connected devices in India to increase significantly with demand generating from both consumer and industrial applications. Nasscom predicts that there will be 2.7 billion connected devices by 2020, leading to an economic impact of up to $15B USD. Indian IoT market will represent more than 5% of the global market size. However, more than half of this market growth is locked by the lack of interoperability standards. Standards will play a major role in bringing in the required interoperability and reducing the lead time to develop IoT solutions and services. Smaller companies including startups will join hands with the MNCs to participate in a bigger ecosystem as IoT is purely an ecosystem play rather than an individual company trying to solve problems. + +**Q. Which industry segments do you believe will be driving a larger chunk of demand for IoT in India? Why?** +**A.** On the consumer side, Smart Home and Building has been driving the demand for IoT as of today. Real Estate developers are offering Smart Homes with lighting automation and security as primary solutions. Access control, Smart Street Lighting, Common area surveillance are some primary use cases which are being deployed in a real-world scenario. + +On the Enterprise side, Smart Manufacturing and Logistics drive major demand. Predictive maintenance of machinery is a high revenue-driven business case helping in the drastic reduction of losses by tracking the downtime/uptime of machinery. Asset tracking and management have been there for a while but with multiple IoT sensors coming in like temperature, moisture, weight, etc., the continuous monitoring and tracking of the assets has improved inaccuracy. + +**Q. Almost everyone agrees that there is a dire need for standards for the IoT ecosystem to develop. And this is being stated for quite some time now. What’s causing the delay? What’s missing that needs to happen?** +**A.** India has moved from what and why to how in its IoT journey and evolution. IoT standards are still a work in progress in terms of its adoption. There are multiple standards available in the market with overlapping functionalities using different technical approaches battling out for IoT dominance. Some technologies are less proven than the others and so the goal of the standards body has to be to legitimize the technology and make customers feel safe in adopting it. Open standards are the key to expanding IoT innovation in India market. With open standards, there is a higher chance of finding the right resources to integrate the required technology into a successful IoT solution. + +**Q. For someone new to the concept—how would you explain the challenges caused by the lack of standards (interoperability)?** +**A.** With the rise of connected things and machines, there will be billions of connected devices including sensors, appliances, and machinery, etc. generating terabytes of data. Security becomes one of the biggest concerns with this much number of devices and data. Also, the IoT market has become so fragmented that it has led to the development of multiple vertical-specific standards, various connectivity protocols and smaller groups working towards solving individual problems. What the industry needs is a secure consolidation of standards to achieve true interoperability. + +**Q. What are the key areas in which standards needed first?** +**A.** Smart Manufacturing and Industry 4.0 would need the standards first. The Industrial Internet Consortium has already started working towards defining the standards for the industry vertical. It also has a liaison with the Open Connectivity Foundation to combine the best of both the frameworks. Smart Homes in India would not work in the Do-It-Yourself mode at least in the coming 2-3 years. The market penetration will happen primarily through the Real Estate Builders (B2B2C) working closely with System Integrators. So, the devices going into the homes needs to be standardized for seamless deployment of the smart home solution. Connected Health would be next and Agriculture a good to have. + +**Q. Would there be a need for different standards for different nations (e.g. India) or would it better to adopt global standards?** +**A.** Significant portions of Standards are applicable globally. However, every nation has its own set of requirements. For example, a connected fan is something which could be found only in India and other emerging countries. But building a standard from scratch for a specific country needs a lot of resources, time and investment. Bringing in best practices from global markets opens up a lot of opportunities for companies to learn from and also customize based on the country-specific requirements on top of the established core framework. Also, companies get access to a bigger global ecosystem by adopting global standards. + +Global standards are working together in a unified approach to address specific requirements and bring in the best of both through consolidation. One such example is the Asymmetrical bridge function between oneM2M and OCF exposing proximal OCF devices to distal oneM2M devices. While OCF is a device-centric common addressing framework with the current focus on Smart Home, oneM2M is a cloud service layer with a focus on Smart Cities; Working in tandem, they open up a whole new set of use cases and standards interworking. + +**Q. How does OCF aim to solve this challenge of standards & interoperability?** +**A.** OCF stands for Open Connectivity Foundation. It is an open-source consortium that delivers “just-works” interconnectivity for developers, manufacturers, and end-users. Through a common communication framework, OCF connects and manages information flow intelligently among devices. This framework is agnostic of device form factor, the operating system, manufacturer or even service provider + +**Q. What category of standards is OCF working on? And that’s not within OCF’s domain, but important for the IoT eco-system?** +**A.** OCF’s current focus is developing Standards for Smart Home and Buildings. It aims to build Standards for Health, Automotive, and Industry; possibly in conjunction with partners going forward. But OCF’s common addressing scheme and the core framework enables it to be easily adapted into other verticals + +**Q. What is the main vision and objectives behind OCF India Forum?** +**A.** OCF India Forum is a local chapter of OCF established in April 2019 with 45+ member companies and Nasscom CoE IoT as its Executive Office. The OCF India Steering Committee comprises of representatives from Nasscom, Samsung, Intel, L&T Technology Services and Granite River Labs. + +OCF India’s vision and objectives are twofold, one is to facilitate small size companies including SMEs & startups to easily build interoperable IoT products using the Open Source implementation of OCF spec (IoTivity) The second is to build & Engage the Indian IoT Ecosystem including Industry, Startups, University, Government, Dev community to work towards a common cause of IoT Standardization. + +**Q. What should happen within the next year, and the next three years—to indicate that OCF India is succeeding in its charter?** +**A.** Within a year more companies joining OCF India Forum; with 50 in 2019 and overall 100+ by 2020 and the developer community contributing actively into IoTivity. In the next 3 years, Indian MNCs will be adopting OCF to create a bigger IoT ecosystem for the startups. OCF is recognized as a National Standard alongside oneM2M covering ‘proximal’ and ‘distal’ devices and OCF will have a certification lab in India. + +**Q. What role are partners like NASSCOM playing in enabling OCF India to achieve its mission?** +**A.** The Center of Excellence (CoE) for IoT is a joint an initiative of Nasscom, MeiTy, and ERNET. It was established in India to jump-start the Indian IoT ecosystem by helping IoT startups to leverage cutting edge technology & build market-ready products. Nasscom CoE IoT will serve as the Executive Office of OCF India Forum. Having a neutral entity represent and drive the Standards the initiative encourages faster ecosystem growth and adoption. With a well-established network of Industry, Academia, Startups and Government, Nasscom CoE IoT will help OCF India towards a much-focused ecosystem engagement drive. + +**Q. Any initiatives executed, and any planned in the near future—by OCF India?** +**A.** OCF India has been participating in IoT events across India since 2018 in the form of Seminar, Exhibition Booth & Workshop; To name a few – IoTShow 2019, 3rd IoT India Expo 2019, 7th IoT Symposium 2018. Series of hands-on workshops are planned to engage the gov’t and dev community. Also, in line are some of the premiere IoT events in India where OCF India will participate this year like IoT India Congress 2019, IoTNext 2019. The Flagship event “OCF India Day” co-located with Open Source India 2019 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/open-standards-are-the-key-to-expanding-iot-innovation-in-india-market/ + +作者:[Ankita KS][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://opensourceforu.com/author/ankita-ks/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/samsung-aloknath.jpg?resize=640%2C360&ssl=1 (samsung-aloknath) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/samsung-aloknath.jpg?fit=640%2C360&ssl=1 diff --git a/sources/talk/20191009 Things You Should Know If You Want to Become a Machine Learning Engineer.md b/sources/talk/20191009 Things You Should Know If You Want to Become a Machine Learning Engineer.md new file mode 100644 index 0000000000..a404fd55af --- /dev/null +++ b/sources/talk/20191009 Things You Should Know If You Want to Become a Machine Learning Engineer.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Things You Should Know If You Want to Become a Machine Learning Engineer) +[#]: via: (https://opensourceforu.com/2019/10/things-you-should-know-if-you-want-to-become-a-machine-learning-engineer/) +[#]: author: (Samantha https://opensourceforu.com/author/samantha/) + +Things You Should Know If You Want to Become a Machine Learning Engineer +====== + +[![][1]][2] + +_Machine learning is the next big thing in the market. Have you seen machines that do activities without any human involvement? This is what machine learning engineers do. They develop machines and systems which can learn and apply knowledge._ + +**How is artificial intelligence changing the job scenario for machine learning engineers?** +Artificial intelligence and machine learning have been successful in touching almost every aspect of our daily life. It may be the voice-activated virtual assistants like Siri and Alexa, or Predictive technologies used by companies like Netflix and Amazon for a better understanding of the customers. + +Artificial intelligence makes the computer do the tasks which earlier needed human intelligence and machine learning is about building the algorithm for the machines which helps them to identify patterns and thus give a better insight into the data. Countries around the world are continuously working on strategies and initiatives to guide the development of artificial intelligence. + +Lately, organizations from almost every sector are investing in AI tools and techniques, thus boosting their companies. Currently, AI investments are being dominated by large tech companies like Baidu, Microsoft, Google, Apple, Facebook, and so on. And almost 10%-30% of non-tech companies are adopting artificial intelligence, depending upon their industry. + +There has been a considerable advancement in the automobile industry with the implementation of Artificial intelligence with vehicles. Self-driving cars were something impossible without IoT working closely with AI. Then there is the Facial recognition feature by Google, which helps to identify a person using digital images or patterns. These technologies are changing the way people have expected their life to be. + +As per a recent [_study_][3], Artificial intelligence will be creating almost 58 million new jobs by 2022, giving a major shift in quality, location, and permanency the new jobs. BY 2025 machines will be taking over the work tasks that are being performed by humans by almost 71%, with the human workforce focusing more on productive tasks. This creates the need for reskilling and upskilling of the current workforce. + +In a current report, the top decision-makers of IT/ITES observed that Machine learning and other AI-powered solutions would play a major role in shaping future workplaces. With the latest technological advancements, the tech companies are on the lookout for talents equipped with a better understanding of these technologies. + +Here are some of the skills needed for becoming a machine learning engineer. + +**Programming skills:** +Machine learning calls for a stronghold over programming and software development skills. It’s all about creating dynamic algorithms. Being clear with the fundamentals of analysis and design can be an added advantage for you. Here are the skills that you should be acquainted with: + + * **Fundamentals of Programming and CS: **Machine learning involves computation of huge sets of data which requires knowledge on the fundamentals concepts such as computer architecture, data structures, algorithms, etc. The basics of stacks, b-trees, sort logos, or the parallel programming problems come in handy when we talk about the fundamentals. + * **Software design: **Being a machine learning engineer, you will be creating algorithms and systems to integrate with existing ecosystems other software components. And for this, a stronghold over in Application Programming Interfaces (APIs) like web API’s, static and dynamic libraries, etc. are essential for sustenance in the future. + * **Programming languages: **Machine learning is known for its versatility and is not bound to any specific language. All it needs is the required components and features, and you can virtually use any language if it satisfies the above condition. ML libraries have got different programming languages, and each language can be used for a different task. + * **Python: **One of the popular languages used among machine learning engineers is Python. It has got many useful libraries like NumPy, SciPy, and Pandals which help in the efficient processing of data and better scientific computing. It has got some specialized libraries like Scikit-learn, Theano, and TensorFlow, which allow learning algorithms using different computing platforms. + * **R Language: **Developed by Ross Ihaka and Robert Gentleman, this one of the best languages used for machine learning tasks. Coming with a large number of algorithms and statistical models, it is specially tailored for data mining and statistical computing. + * **C/C++:** C/C++ use is pretty much lower when we talk about the programming languages needed for machine learning. But it cannot be as it is used to program the infrastructure and mechanics of machine learning. In fact, a number of ML libraries are actually developed in C/C++ and wrapped around with API calls to make it available for other languages. + + + +Although the language is a bit different from traditional languages, it is not difficult to learn. + +**Basic skills needed:** +Machine learning is a combination of math, data science, and software engineering. And no matter how many certifications you have got, but you should be well acquainted with these basic skills to be master in your domain: + + * **Data modeling:** +Data modeling is a process used to estimate the structure of a dataset, for finding patterns and at times when data is nonexistent. In machine learning, we have to analyze unstructured data, which relies wholly on data modeling. Data modeling and evaluation concepts are needed for creating sound algorithms. + * **Statistics:** +Statistics is mainly the creation of models from data. Most of the machine learning algorithms are building upon statistical models. It has got various other branches which are also used in the process like analysis of variance and hypothesis testing. + + + +Along with these two, there is one more basic skill, which is of utmost importance – Probability. The principles of probability and its derivative techniques like Markov Decision Processes and Bayes Nets help in dealing with the uncertainties and make reliable predictions. + +These are many skills which are needed to become a machine learning engineer, and many institutes provide professional [_Machine learning certification course_][4]. They are playing a major role in the rise of AI and efficient machine learning engineers by guiding the participants through the latest advancements and technical approaches in artificial intelligence technologies. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/things-you-should-know-if-you-want-to-become-a-machine-learning-engineer/ + +作者:[Samantha][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://opensourceforu.com/author/samantha/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Machine-Learning-Framework.jpg?resize=696%2C611&ssl=1 (machine-learning-framework) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Machine-Learning-Framework.jpg?fit=1389%2C1219&ssl=1 +[3]: https://www.forbes.com/sites/amitchowdhry/2018/09/18/artificial-intelligence-to-create-58-million-new-jobs-by-2022-says-report/#7830694a4d4b +[4]: https://www.simplilearn.com/big-data-and-analytics/machine-learning-certification-training-course diff --git a/sources/talk/20191009 Why to choose Rust as your next programming language.md b/sources/talk/20191009 Why to choose Rust as your next programming language.md new file mode 100644 index 0000000000..d8cad5c342 --- /dev/null +++ b/sources/talk/20191009 Why to choose Rust as your next programming language.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why to choose Rust as your next programming language) +[#]: via: (https://opensource.com/article/19/10/choose-rust-programming-language) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +Why to choose Rust as your next programming language +====== +Selecting a programming language can be complicated, but some +enterprises are finding that switching to Rust is a relatively easy +decision. +![Programming books on a shelf][1] + +Choosing a programming language for a project is often a complicated decision, particularly when it involves switching from one language to another. For many programmers, it is not only a technical exercise but also a deeply emotional one. The lack of known or measurable criteria for picking a language often means the choice digresses into a series of emotional appeals. + +I've been involved in many discussions about choosing a programming language, and they usually conclude in one of two ways: either the decision is made using measurable, yet unimportant criteria while ignoring relevant, yet hard to measure criteria; or it is made using anecdotes and emotional appeals. + +There has been one language selection process that I've been a part of that has gone—at least so far—rather smoothly: the growing [consideration inside Microsoft][2] for using [Rust][3]. + +This article will explore several issues related to choosing a programming language in general and Rust in particular. They are: What are the criteria usually used for selecting a programming language, especially in large businesses, and why does this process rarely end successfully? Why has the consideration of Rust in Microsoft gone smoothly so far, and are there some general best practices that can be gleaned from it? + +### Criteria for choosing a language + +There are many criteria for deciding whether to switch to a new programming language. In general, the criteria that are most easily measured are the ones that are most often talked about, even if they are less important than other, more difficult-to-measure criteria. + +#### Technical criteria + +The first group of criteria are the technical considerations; they are often the first that come to mind because they are the easiest to measure. + +Interestingly, the technical costs (e.g., build system integration, monitoring, tooling, support libraries, and more) are often easier to measure than the technical benefits. This is especially detrimental to the adoption of new programming languages, as the downsides of adoption are often the clearest part of the picture. + +While some technical benefits (like performance) can be measured relatively easily, others are much harder to measure. For example, what are the relative merits of a dynamic typing system (like in Python) to a relatively verbose and feature-poor system (like Java), and how does this change when compared to stronger typed systems like Scala or Haskell? Many people have strong gut feelings that such technical differences should be taken very seriously in language considerations, but they are no good ways to measure them. + +A side effect of the discrepancy in measurement ease is that the easiest-to-measure items are often given the most weight in the decision-making process even if that would not be the case with perfect information. This not only throws off the cost/benefit analysis but also the process of assigning importance to different costs and benefits. + +#### Organizational criteria + +Organizational criteria, which are the second consideration, include: + + * How easy will it be to hire developers in this language? + * How easy is it to enforce programming standards? + * How quickly, on average, will developers be able to deliver software? + + + +Costs and benefits of organizational criteria are hard to measure. People usually have vague, "gut feeling" answers to them, which create strong opinions on the matter. Unfortunately, however, it's often very difficult to measure these criteria. For example, it might be obvious to most that TypeScript allows programmers to deliver functioning, relatively bug-free software to customers more quickly than C does, but where is the data to back this up? + +Moreover, it's often extremely difficult to assign importance weights to these criteria. It's easy to see that Go enforces standardized coding practices more easily than Scala (due to the wide use of gofmt), but it is extremely difficult to measure the concrete benefits to a company from standardizing codebases. + +These criteria are still extremely important but, because of the difficulty in measuring them, they are often either ignored or reasoned about through anecdotes. + +#### Emotional criteria + +Third are the emotional criteria, which tend to be overlooked if not outright dismissed. + +Software programming has traditionally tried to emulate more true "engineering" practices, where technical considerations are generally the most important. Some would argue that programming languages are "just tools" and should be measured only against technical criteria. Others would argue that programming languages assist the programmer in some of the more artistic aspects of the job. These criteria are extremely difficult to measure in any meaningful way. + +In general, this comes down to how happy (and thus productive) programmers feel using this language. Such considerations can have a real impact on programmers, but how this translates to benefitting to an entire team is next to impossible to measure. + +Because of the difficulty of quantifying these criteria, this is often ignored. But does this mean that emotional considerations of programming languages have no significant impact on programmers or programming organizations? + +#### Unknown criteria + +Finally, there's a set of criteria that are often overlooked because a new programming language is usually judged by the criteria set by the language currently in use. New languages may have capabilities that have no equivalent in other languages, so many people will not be familiar with them. Having no exposure to those capabilities may mean the evaluator unknowingly ignores or downplays them. + +These criteria can be technical (e.g., the merits of Kotlin data classes over Java constructs), organizational (e.g., how helpful Elm error messages are for teaching those new to the language), or emotional (e.g., the way Ruby makes the programmer feel when writing it). + +Because these aspects are hard to measure, and someone completely unfamiliar with them has no existing framework for judging them based on experience, intuition, or anecdote, they are often undervalued versus more well-understood criteria—if not outright ignored. + +### Why Rust? + +This brings us back to the growing excitement for Rust in Microsoft. I believe the discussions around Rust adoption have gone relatively smoothly so far because Rust offers an extremely clear and compelling advantage—not only over the language it seeks to replace (C++)—but also over any other language practically available to industry: great performance, a high level of control, and being memory safe. + +Microsoft's decision to investigate Rust (and other languages) began due to the fact that roughly [70% of Common Vulnerabilities and Exposures][4] (CVEs) in Microsoft products were related to memory safety issues in C and C++. When it was discovered that most of the affected codebases could not be effectively rewritten in C# because of performance concerns, the search began. Rust was viewed as the only possible candidate to replace C++. It was similar enough that not everything had to be reworked, but it has a differentiator that makes it measurably better than the current alternative: being able to eliminate nearly 70% of Microsoft's most serious security vulnerabilities. + +There are other reasons beyond memory safety, performance, and control that make Rust appealing (e.g., strong type safety guarantees, being an extremely loved language, etc.) but as expected, they were hard to talk about because they were hard to measure. In general, most people involved in the selection process were more interested in verifying that these other aspects of the language weren't perceivably worse than C++ but, because measuring these aspects was so difficult, they weren't considered active reasons to adopt the language. + +However, the Microsoft teams that had already adopted Rust, like for the [IoT Edge Security Daemon][5], touted other aspects of the language (particularly "correctness" due to the advanced type system) as the reasons they were most keen on investing more in the language. These teams couldn't provide reliable measurements for these criteria, but they had clearly developed an intuition that this aspect of the language was extremely important. + +With Rust at Microsoft, the main criteria being judged happened to be an easily measurable one. But what happens when an organization's most important issues are hard to measure? These issues are no less important just because they are currently difficult to measure. + +### What now? + +Having clearly measurable criteria is important when adopting a new programming language, but this does not mean that hard-to-measure criteria aren't real and shouldn't be taken seriously. We simply lack the tools to evaluate new languages holistically. + +There has been some research into this question, but it has not yet produced anything that has been widely adopted by industry. While the case for Rust was relatively clear inside Microsoft, this doesn't mean new languages should be adopted only where there is one clear, technical reason to do so. We should become better at evaluating more aspects of programming languages beyond just the traditional ones (such as performance). + +The path to Rust adoption is just beginning at Microsoft, and having just one reason to justify investment in Rust is definitely not ideal. While we're beginning to form collective, anecdotal evidence to justify Rust adoption further, there is definitely a need to quantify this understanding better and be able to talk about it in more objective terms. + +We're still not quite sure how to do this, but stay tuned for more as we go down this path. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/choose-rust-programming-language + +作者:[Ryan Levick][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/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_programming_languages.jpg?itok=KJcdnXM2 (Programming books on a shelf) +[2]: https://msrc-blog.microsoft.com/tag/rust +[3]: https://www.rust-lang.org/ +[4]: https://github.com/microsoft/MSRC-Security-Research/blob/master/presentations/2019_02_BlueHatIL/2019_01%20-%20BlueHatIL%20-%20Trends%2C%20challenge%2C%20and%20shifts%20in%20software%20vulnerability%20mitigation.pdf +[5]: https://msrc-blog.microsoft.com/2019/09/30/building-the-azure-iot-edge-security-daemon-in-rust/ diff --git a/sources/talk/20191010 Climate challenges call for open solutions.md b/sources/talk/20191010 Climate challenges call for open solutions.md new file mode 100644 index 0000000000..41ba2a683b --- /dev/null +++ b/sources/talk/20191010 Climate challenges call for open solutions.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Climate challenges call for open solutions) +[#]: via: (https://opensource.com/open-organization/19/10/global-energy-climate-challenges) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Climate challenges call for open solutions +====== +We can meet global energy and climate change challenges with an open +mindset. +![Globe up in the clouds][1] + +Global climate change affects us all. It is, at its heart, an energy issue—a problem too large and too complex for any single person, company, university, research institute, science laboratory, nuclear trade association, or government to address alone. It will require a truly global, cooperative effort, one aimed at continued innovation across a range of technologies: renewables, batteries, carbon capture, nuclear power development, and more. + +Throughout the past year, I've been part of an initiative working on nuclear power decommissioning in Japan. As part of that work—which includes several meetings every month on this issue, as well as my own independent research on the subject—I've learned more about the ways various communities can play a role in understanding and impacting energy needs and climate discussions. + +In this article, I'll offer one example that illustrates how this is the case—that of "[Generation IV][2]" nuclear power plant development. This example demonstrates how [open organization principles][3] can influence future discussions about our global energy and climate change challenges. We must address these challenges with an open mindset. + +### Community purposes and frameworks + +Members of a community must [believe in a common purpose][4]. That sense of common purpose is not only what unites an open project but also what helps an open, distributed group maintain its focus and measure its success. Clear, public, and mutually agreed-upon statements of purpose are a basic feature of open organizations. + +So an open approach to global energy and climate change challenges should do the same. For example, when researching Generation IV nuclear power plant development, I've learned of a basic framework for task force goals: + + 1. There should be a desire to reduce current carbon dioxide (CO2) emissions and greenhouse gases. + 2. There should be a desire to reduce nuclear waste. + 3. There should be a desire to provide stable, low-cost electricity without increasing CO2 emissions globally, particularly in rural areas and developing countries where most of the future CO2 emissions will come from in the future. + 4. There should be a desire to improve safety in nuclear power energy production. This should include developing a nuclear fuel that cannot be converted to weapons, reducing the chance of nuclear weapon confrontation or terrorist attacks. + 5. There should be a desire to reduce global air, water, and land pollution. + + + +A successful open approach to these issues must begin by uniting a community around a common set of goals like these. + +### Building community: inclusivity and collaboration + +Once a community has clarified its motivations, desires, and goals, how does it attract people who share those desires? + +Once a community has clarified its motivations, desires, and goals, how does it attract people who _share_ those desires? + +One method is by developing associations and having global conferences. For example, the [Generation IV International Forum (GIF)][5] was formed to address some of the desires I listed above. Members represent countries like Argentina, Brazil, Canada, China, EU, France, Japan, S. Korea, South Africa, Switzerland, UK, USA, Australia, and Russia. They have symposia to allow countries to exchange information, build communities, and expand inclusivity. In 2018, the group held its fourth symposium in Paris. + +But in-person meetings aren't the only way to build community. Universities are working to build distributed, global communities focused on energy and climate challenges. MIT, for instance, is doing this with its own [energy initiative][6], which includes the "[Center for Advanced Nuclear Energy Systems][7]." The center's website facilitates discussions between like-minded advocates for energy solutions—a beautiful example of collaboration in action. Likewise, [Abilene Christian University][8] features a department in future nuclear power. That department collaborates with nuclear development institutes and works to inspire the next generation of nuclear scientists, which they hope will lead to: + + 1. raising people out of poverty worldwide through inexpensive, clean, safe and available energy, + 2. developing systems that provide clean water supply, and + 3. curing cancer. + + + +Those are goals worth collaborating on. + +### Community and passionate, purposeful participation + +As we know from studying open organizations, the more specific a community's goals, the more successful it will likely be. + +As we know from studying open organizations, _the more specific a community's goals, the more successful it will likely be._ This is especially true when working with _passionate_ communities, as keeping those communities focused ensures they're channeling their energy in appropriate, helpful directions. + +Global attempts to solve energy and climate problems should consider this. Once again in the case of Generation IV nuclear power, there is growing interest in one type of nuclear power plant concept, the [Molten-salt reactor][9] (MSR), which uses thorium in nuclear fuel. Proponents of MSR hope to create a safer type of fuel, so they've started their own association, the [Thorium Energy World][10], to advocate their cause. This conference centers on the use of thorium in the fuel of these type nuclear power plants. Experts meet to discuss their concepts and progress on MSR technology. + +But it's also true that communities are much more likely to invest in the ideas that _they_ specify—not necessarily those "handed down" from leadership. Whenever possible, communities focused on energy and climate change challenges should take their cues from members. + +Recall the Generation IV International Forum (GIF), which I mentioned above. That organization ran into a problem: too many competing concepts for next-generation nuclear power solutions. Rather than simply select one and demand that all members support it, the GIF created general categories and let participants select the concepts they favored from each. This resulted in a list of six concepts for future nuclear power plant development—one of which was MSR technology. + +Narrowing the community's focus on a smaller set of options should help that community have more detailed and productive technical discussions. But on top of that, letting the community itself select the parameters of its discussions should greatly increase its chances of success. + +### Community and transparency + +Once a community has formed, questions of transparency and collaboration often arise. How well will members interact, communicate, and work with each other? + +I've seen these issues firsthand while working with overseas distributors of the products I want them to sell for me. Why should they buy, stock, promote, advertise, and exhibit the products if at any time I could just cut them out and start selling to their competitors? + +Taking an open approach to building communities often involves making the communities' rules, responsibilities and norms explicit and transparent. + +Taking an open approach to building communities often involves making the communities' rules, responsibilities and norms _explicit_ and _transparent_. To solve my own problem with distributors, for instance, I entered into distributor agreements with them. These detailed both my responsibilities and theirs. With that clear agreement in-hand, we could actively and collaboratively promote the product. + +The Generation IV International Forum (GIF) faced a similar challenge with it member countries, specifically with regard to intellectual property. Each country knew it would be creating significant (and likely very valuable) intellectual property as part of its work exploring the six types of nuclear power. To ensure that knowledge sharing occurred effectively and amicably between the members, the group established guidelines for exchanging knowledge and research findings. It also granted a steering committee the authority to dismiss potential members who weren't operating according to the same standards of transparency and collaboration (less they become a burden on the growing community). + +They formed three types of agreements: "[Framework Agreements][11]" (in both French and English), System Arrangements (for each of the six systems I mentioned), and Memoranda of Understanding (MOU). With those agreements, the members could be more transparent, be more collaborative, and form more productive communities. + +### Growing demand—for energy and openness + +Increasing demand for electrical power in developing countries will impact global energy needs and climate change. The need for electricity and clean water for both health and agriculture will continue to grow. And the way we _address_ both those needs and that growth will determine how we meet next-generation energy and climate challenges. Adopting technologies like Generation IV nuclear power (and MSR) could help—but doing so will require a global, community-driven effort. An approach based on open organization principles will help us solve climate problems faster. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/global-energy-climate-challenges + +作者:[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/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://en.wikipedia.org/wiki/Generation_IV_reactor +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://opensource.com/open-organization/17/9/rediscovering-your-why +[5]: https://www.gen-4.org/gif/jcms/c_74878/generation-iv-international-forum-gif-symposium +[6]: http://energy.mit.edu/ +[7]: https://canes.mit.edu/ +[8]: https://www.youtube.com/watch?v=3pa35s6HKa8 +[9]: https://en.wikipedia.org/wiki/Molten_salt_reactor +[10]: http://www.thoriumenergyworld.com/ +[11]: http://www.gen-4.org/gif/upload/docs/application/pdf/2014-01/framework_agreement.pdf diff --git a/sources/talk/20191010 Reimagining-the-Internet project gets funding.md b/sources/talk/20191010 Reimagining-the-Internet project gets funding.md new file mode 100644 index 0000000000..4a908b1312 --- /dev/null +++ b/sources/talk/20191010 Reimagining-the-Internet project gets funding.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reimagining-the-Internet project gets funding) +[#]: via: (https://www.networkworld.com/article/3444765/reimagining-the-internet-project-gets-funding.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Reimagining-the-Internet project gets funding +====== +A National Science Foundation-financed Internet replacement testbed project lays out its initial plans. +Thinkstock + +The [Internet of Things][1] and 5G could be among the benefactors of an upcoming $20 million U.S. government cash injection designed to come up with new architectures to replace existing public internet. + +FABRIC, as the National Science Foundation-funded umbrella project is called, aims to come up with a proving ground to explore new ways to move, keep and compute data in shared infrastructure such as the public internet. The project “will allow scientists to explore what a new internet could look like at scale,” says the lead institution, the University of North Carolina at Chapel Hill, [in a media release][2]. And it “will help determine the internet architecture of the future.” + +[[Get regularly scheduled insights by signing up for Network World newsletters. ]][3] + +Bottlenecks, security and overall performance are infrastructure areas that the group are looking to improve on. The “Internet is showing its age and limitations,” Ilya Baldin, director of Network Research and Infrastructure at the Renaissance Computing Institute at UNC-Chapel Hill is quoted as saying in the release. “Especially when it comes to processing large amounts of data.” RENCI is involved in developing and deploying research technologies. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“Today’s internet was not designed for the massive datasets, machine-learning tools, advanced sensors and [Internet of Things devices][5],” FABRIC says, echoing others who, too, are envisioning a new internet: + +[I wrote, in July,][6] for example, about a team of network engineers known as NOIA, who also want to revolutionize global public internet traffic. That group wants to co-join a new software-defined public internet with a bandwidth- and routing-trading system based on blockchain. Others, such as companies [FileStorm and YottaChain, are working on distributed blockchain-like storage for Internet][7] adoption. + +Advertisement + +Another group led by researchers at University of Magdeburg, [whom I’ve also written about][8], want to completely restructure the internet. That university, which has received German government funding, says adapting IoT to existing networks won’t work. Centralized security that causes choke points, is just one trouble-spot that needs fixing, it thinks. “The internet, as we know it, is based on network architectures of the 70s and 80s, when it was designed for completely different applications,” those researchers say. + +FABRIC, the UNC project, which has begun to address ideas for the architecture it thinks will work best, says it will function using “storage, computational and network hardware nodes,” joined by 100Gbps and Terabit optical links. “Interconnected deeply programmable core nodes [will be] deployed across the country,” [it proposes in its media release][9]. Much like the original internet, in fact, universities, labs and [supercomputers][10] will be connected, this time in order for today’s massive datasets to be experimented with. + +“All major aspects of the FABRIC infrastructure will be programmable,” it says. It will be “an everywhere programmable nationwide instrument comprised of novel extensible network elements.” Machine learning and distributed network systems control will be included. + +The project asserts that it's the programmability that will let it customize the platform to experiment with specific aspects of public Internet: cybersecurity is one, it says; distributed architectures, could be another. + +“If computer scientists were to start over today, knowing what they now know, the Internet might be designed in a different way,” Baldin says. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3444765/reimagining-the-internet-project-gets-funding.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.zdnet.com/article/what-is-the-internet-of-things-everything-you-need-to-know-about-the-iot-right-now/ +[2]: https://uncnews.unc.edu/2019/09/17/unc-chapel-hill-to-lead-20-million-project-to-test-a-reimagined-internet/ +[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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3331676/iot-devices-proliferate-from-smart-bulbs-to-industrial-vibration-sensors.html +[6]: https://www.networkworld.com/article/3409783/public-internet-should-be-all-software-defined.html +[7]: https://www.networkworld.com/article/3390722/how-data-storage-will-shift-to-blockchain.html +[8]: https://www.networkworld.com/article/3407852/smarter-iot-concepts-reveal-creaking-networks.html +[9]: https://fabric-testbed.net/news/fabric-award +[10]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191010 SD-WAN- What is it and why you-ll use it one day.md b/sources/talk/20191010 SD-WAN- What is it and why you-ll use it one day.md new file mode 100644 index 0000000000..9e07a987bf --- /dev/null +++ b/sources/talk/20191010 SD-WAN- What is it and why you-ll use it one day.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SD-WAN: What is it and why you’ll use it one day) +[#]: via: (https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +SD-WAN: What is it and why you’ll use it one day +====== +Software-defined wide area networks, a software approach managing wide-area networks, offers ease of deployment, central manageability and reduced costs, and can improve connectivity to branch offices and the cloud. +Shutterstock + +There have been significant changes in wide-area networks over the past few years, none more important than software-defined WAN or SD-WAN, which is changing how network pros think about optimizing the use of connectivity that is as varied as Multiprotocol Label Switching ([MPLS][1]), frame relay and even DSL. + +### What is SD-WAN? + +As the name states, software-defined wide-area networks use software to control the connectivity, management and services between [data centers][2] and remote branches or cloud instances. Like its bigger technology brother, software-defined networking, SD-WAN decouples the control plane from the data plane. + +[[Get regularly scheduled insights by signing up for Network World newsletters. ]][3] + +An SD-WAN deployment can include, existing routers and switches or virtualized customer premises equipment (vCPE) all running some version of software that handles policy, security, networking functions and other management tools, depending on vendor and customer configuration. **  ** + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +One of SD-WAN’s chief features is the ability to manage multiple connections from MPLS to broadband to LTE. Another important piece is the ability to segment, partition and secure the traffic traversing the WAN.  + +SD-WAN's driving principle is to simplify the way big companies turn up new links to branch offices, better manage the way those links are utilized – for data, voice or video – and potentially save money in the process. + +Advertisement + +As a recent [Gartner][5] report said, SD-WAN and vCPE are key technologies to help enterprises transform their networks from “fragile to agile.” + +“We believe that emerging SD-WAN solutions and vCPE platforms will best address enterprise requirements for the next five years, as they provide the best mix of performance, price and flexibility compared to alternative hardware-centric approaches,” Gartner stated.   “Specifically, we predict that by 2023, more than 90% of WAN edge infrastructure refresh initiatives will be based on vCPE or SD-WAN appliances versus traditional routers (up from less than 40% today).” + +Network World / Gartner + +With all of its advanced features making it an attractive choice for customers, the market has also attracted a number of choices with more than 60 vendors – including [Cisco][6], VMware, Silver Peak, Riverbed, Aryaka, Fortinet, Nokia and Versa – that compete in the SD-WAN market; many with very specialized offerings, Gartner says.  [IDC says][7] that SD-WAN technology will grow at a 30.8% compound annual growth rate from 2018 to 2023 to reach $5.25 billion. + +From its VNI study, Cisco says that globally, SD-WAN traffic was 9 percent of business IP WAN traffic in 2017 and will be 29 percent of business IP WAN traffic by 2022.  In addition, SD-WAN traffic will grow five-fold from 2017 to 2022, a compound annual growth rate of 37 percent. + +“SD-WAN continues to be one of the fastest-growing segments of the network infrastructure market, driven by a variety of factors. First, traditional enterprise WANs are increasingly not meeting the needs of today's modern digital businesses, especially as it relates to supporting SaaS apps and multi- and hybrid-cloud usage. Second, enterprises are interested in easier management of multiple connection types across their WAN to improve application performance and end-user experience," said Rohit Mehra, IDC vice president, Network Infrastructure. "Combined with the rapid embrace of SD-WAN by leading communications service providers globally, these trends continue to drive deployments of SD-WAN, providing enterprises with dynamic management of hybrid WAN connections and the ability to guarantee high levels of quality of service on a per-application basis." + +### How does SD-WAN help network security? + +One of the bigger areas SD-WAN impacts is network security.  + +The tipping point for a lot of customers was the advent of applications like the cloud-based Office 365 and Amazon Web Services (AWS) applications that require secure remote access. said [Neil Anderson practice director, network solutions at World Wide Technology,][8] a technology service provider.  “SD-WAN lets customers set up secure regional zones or whatever the customer needs and lets them securely direct that traffic to where it needs to go based on internal security policies. SD-WAN is about architecting and incorporating security for apps like AWS and Office 365 into your connectivity fabric. It’s a big motivator to move toward SD-WAN.” + + “With SD-WAN, mission-critical traffic and assets can be partitioned and protected against vulnerabilities in other parts of the enterprise. This use case appears to be especially popular in verticals such as retail, healthcare, and financial,” [IDC wrote][9]. "SD-WAN can also protect application traffic from threats within the enterprise and from outside by leveraging a full stack of security solutions included in SD-WAN such as [next-gen firewalls][10], IPS, URL filtering, malware protection, and cloud security.” + +### What does SD-WAN mean for MPLS? + +One of the hotter SD-WAN debates is what the software technology would do to the use of MPLS, the packet-forwarding technology that uses labels in order to make data forwarding decisions. The most common use cases are branch offices, campus networks, metro Ethernet services and enterprises that need quality of service (QoS) for real-time applications. + +For the most part, networking vendors believe MPLS will be around for a long time and that SD-WAN won’t totally eliminate the need for it. The major slaps against MPLS are how traditionally expensive the service is and how complicated it is to set up. + +A recent report from [Avant Communications][11], a cloud services provider that specializes in SD-WAN, found that 83% of enterprises that use or are familiar with MPLS plan to increase their MPLS network infrastructure this year, and 40% say they will “significantly increase” their use of it. + +How that shakes out remains an unknown, but it seems both technologies will have role in near future enterprises anyway. + +“For us, MPLS is just another option.  We have never said that SD-WAN versus MPLS so that MPLS is going to get killed off or it needs to get killed off,” said [Sanjay Uppal,][12] vice president and general manager of VMware’s VeloCloud Business Unit.  + +Uppal said with MPLS, VMware at least is not finding that customers are turning off their MPLS in droves.  “They are capping it in several instances.  They are continuing to buy some more.  Maybe not as much as they probably had in the past but it’s really opening up applications to use more [of the the underlying network responsible for delivery of packets].  All kinds of underlay are being purchased.  MPLS is being purchased, more of broadband, direct internet access,” he said. + +Gartner says its clients hope to fund their WAN expansion/update by replacing or augmenting expensive MPLS connections with internet-based VPNs, often from alternate providers. However, suitability of internet connections varies widely by geography, and service providers mixing connections from multiple providers increases complexity. SD-WAN has dramatically simplified this approach for a number of reasons, Gartner says, including: + + * Due to the simpler operational environment and the ability to use multiple circuits from multiple carriers, enterprises can abstract the transport layer from the logical layer and be less dependent on their service providers. + * This decoupling of layers is enabling new MSPs to emerge to take advantage of the above for customers that still want to outsource their WANs. + * Traditional service providers are responding with Network Function Virtualization ([NFV][13])-based offerings that combine and orchestrate services (SD-WAN, security, WAN optimization) from multiple popular vendors.  NFV enables virtualized network functions including routing mobility and security. + + + +There are other reasons customers will use MPLS in the SD-WAN world, experts said.   “There is a concern about how customers will back up systems when there are outages,” Anderson said. “MPLS and other technologies have a role there.” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.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.networkworld.com/article/2297171/network-security-mpls-explained.html +[2]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.gartner.com/doc/reprints?id=1-5MNRUAO&ct=181019&st=sb&mkt_tok=eyJpIjoiTnpZNFlXTXpabU0xTVdNeSIsInQiOiJzSmZGdzFWZldRN0s0TUxWMVBKOFUxdnJVMCtEUk13Z3Y5VCs1Z1wvcUY5ZHQ1XC9uZG1WY1Uxbm5TOFFMZzcxQ3pybmhMSHo5RFdPVEVCVUZrbnJnODlGVklOZGtlT0pFQ1A1aFNaQ3N1ODk5Y1FaN0JqTDJiM0U5cnZpTVBMTnliIn0%3D +[6]: https://www.networkworld.com/article/3322937/what-will-be-hot-for-cisco-in-2019.html +[7]: https://www.idc.com/getdoc.jsp?containerId=prUS45380319 +[8]: https://www.wwt.com/profile/neil-anderson +[9]: https://www.cisco.com/c/dam/en/us/solutions/collateral/enterprise-networks/intelligent-wan/idc-tangible-benefits.pdf +[10]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[11]: http://www.networkworld.com/cms/article/Avant%20Communications,%20a%20cloud%20services%20provider%20that%20specializes%20in%20SD-WAN,%20recently%20issued%20a%20report%20entitled%20State%20of%20Disruption%20that%20found%20that%2083%25%20of%20enterprises%20that%20use%20or%20are%20familiar%20with%20MPLS%20plan%20to%20increase%20their%20MPLS%20network%20infrastructure%20this%20year,%20and%2040%25%20say%20they%20will%20 +[12]: https://www.networkworld.com/article/3387641/beyond-sd-wan-vmwares-vision-for-the-network-edge.html +[13]: https://www.networkworld.com/article/3253118/what-is-nfv-and-what-are-its-benefits.html diff --git a/sources/talk/20191010 The biggest risk to uptime- Your staff.md b/sources/talk/20191010 The biggest risk to uptime- Your staff.md new file mode 100644 index 0000000000..a595014cae --- /dev/null +++ b/sources/talk/20191010 The biggest risk to uptime- Your staff.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The biggest risk to uptime? Your staff) +[#]: via: (https://www.networkworld.com/article/3444762/the-biggest-risk-to-uptime-your-staff.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +The biggest risk to uptime? Your staff +====== +Human error is the chief cause of downtime, a new study finds. Imagine that. +Getty Images + +There was an old joke: "To err is human, but to really foul up you need a computer." Now it seems the reverse is true. The reliability of [data center][1] equipment is vastly improved but the humans running them have not kept up and it's a threat to uptime. + +The Uptime Institute has surveyed thousands of IT professionals throughout the year on outages and said the vast majority of data center failures are caused by human error, from 70 percent to 75 percent. + +[[Get regularly scheduled insights by signing up for Network World newsletters. ]][2] + +And some of them are severe. It found more than 30 percent of IT service and data center operators experienced downtime that they called a “severe degradation of service” over the last year, with 10 percent of the 2019 respondents reporting that their most recent incident cost more than $1 million. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +In Uptime's April 2019 survey, 60 percent of respondents believed that their most recent significant downtime incident could have been prevented with better management/processes or configuration. For outages that cost greater than $1 million, this figure jumped to 74 percent. + +However, the end fault is not necessarily with the staff, Uptime argues, but with management that has failed them. + +Advertisement + +"Perhaps there is simply a limit to what can be achieved in an industry that still relies heavily on people to perform many of the most basic and critical tasks and thus is subject to human error, which can never be completely eliminated," wrote Kevin Heslin, chief editor of the Uptime Institute Journal in a [blog post][4]. + +"However, a quick survey of the issues suggests that management failure — not human error — is the main reason that outages persist. By under-investing in training, failing to enforce policies, allowing procedures to grow outdated, and underestimating the importance of qualified staff, management sets the stage for a cascade of circumstances that leads to downtime," Heslin went on to say. + +Uptime noted that the complexity of a company’s infrastructure, especially the distributed nature of it, can increase the risk that simple errors will cascade into a service outage and said companies need to be aware of the greater risk involved with greater complexity. + +On the staffing side, it cautioned against expanding critical IT capacity faster than the company can attract and apply the resources to manage that infrastructure and to be aware of any staffing and skills shortage before they start to impair mission-critical operations. + +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/3444762/the-biggest-risk-to-uptime-your-staff.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/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://journal.uptimeinstitute.com/how-to-avoid-outages-try-harder/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191011 Everything you need to know about Grace Hopper in six books.md b/sources/talk/20191011 Everything you need to know about Grace Hopper in six books.md new file mode 100644 index 0000000000..4c077a80c1 --- /dev/null +++ b/sources/talk/20191011 Everything you need to know about Grace Hopper in six books.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Everything you need to know about Grace Hopper in six books) +[#]: via: (https://opensource.com/article/19/10/grace-hopper-books) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Everything you need to know about Grace Hopper in six books +====== +A reading list for people of all ages about the legendary Queen of Code. +![Book list, favorites][1] + +Grace Hopper is one of those iconic figures that really needs no introduction. During her long career in the United States Navy, she was a key figure in the early days of modern computing. If you have been involved in open source or technology in general, chances are you have already heard several anecdotes about Grace Hopper. The story of finding [the first computer bug][2], perhaps? Or maybe you have heard some of her nicknames: Queen of Code, Amazing Grace, or Grandma COBOL? + +While computing has certainly changed from the days of punch cards, Grace Hopper's legacy lives on. She was posthumously awarded a Presidential Medal of Freedom, the Navy named a warship after her, and the [Grace Hopper Celebration][3] is an annual conference with an emphasis on topics that are relevant to women in computing. Suffice it to say, Grace Hopper's name is going to live on for a very long time. + +Grace Hopper had a career anyone should be proud of, and she accomplished many great things. Like many historical figures who have accomplished great things, sometimes the anecdotes about her contributions start to drift towards the realm of tall tales, which does Grace Hopper a disservice. Her real accomplishments are already legendary, and there is no reason to try to turn her into the computer science version of [John Henry][4] or [Paul Bunyan][5]. + +To that end, here are six books that explore the life and legacy of Grace Hopper. No tall tales, just story after story of Grace Hopper, a woman who changed the world. + +## + +[broad_band_150.jpg][6] + +![Broad Band book cover][7] + +Broad Band: The Untold Story of the Women Who Made the Internet + +### by Claire L. Evans + +In [_Broad Band: The Untold Story of the Women Who Made the Internet_][8], Claire L. Evans explores the lives of several women whose contributions to technology helped to shape the internet. Starting with Ada Lovelace and moving towards modern times with Grace Hopper and others, Evans weaves an interesting narrative that highlights the roles various women played in early computing. While only part of the book focuses on Grace Hopper, the overarching narrative of Evans's work does an excellent job of showcasing Hopper's place in computing history. + +## + +[grace_hopper_admiral_of_the_cyber_sea_150.jpg][9] + +![Grace Hopper: Admiral of the Cyber Sea cover][10] + +I sat down with Leslie Hawthorn , Community Manager at Red Hat, and chatted with her about the 2012... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/grace-hopper-books + +作者:[Joshua Allen Holm][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/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/reading_book_stars_list.png?itok=Iwa1oBOl (Book list, favorites) +[2]: https://www.computerhistory.org/tdih/september/9/ +[3]: https://ghc.anitab.org/ +[4]: https://en.wikipedia.org/wiki/John_Henry_(folklore) +[5]: https://en.wikipedia.org/wiki/Paul_Bunyan +[6]: https://opensource.com/file/453331 +[7]: https://opensource.com/sites/default/files/uploads/broad_band_150.jpg (Broad Band book cover) +[8]: https://clairelevans.com/ +[9]: https://opensource.com/file/453336 +[10]: https://opensource.com/sites/default/files/uploads/grace_hopper_admiral_of_the_cyber_sea_150.jpg (Grace Hopper: Admiral of the Cyber Sea cover) diff --git a/sources/talk/20191011 FOSS in India- Perspectives of an American Anthropologist.md b/sources/talk/20191011 FOSS in India- Perspectives of an American Anthropologist.md new file mode 100644 index 0000000000..667449b238 --- /dev/null +++ b/sources/talk/20191011 FOSS in India- Perspectives of an American Anthropologist.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FOSS in India: Perspectives of an American Anthropologist) +[#]: via: (https://opensourceforu.com/2019/10/foss-in-india-perspectives-of-an-american-anthropologist-2/) +[#]: author: (Prof. C.N Krishnan https://opensourceforu.com/author/cn-krishnan/) + +FOSS in India: Perspectives of an American Anthropologist +====== + +[![][1]][2] + +_In her doctoral thesis done at the University of Manchester, UK, titled ‘Free and Open Source Software (FOSS) in India: Mobilising Technology for the National Good’, American anthropologist Dr Jasmine Folz addresses the question “What can the case of FOSS in India tell us about the roles and relationships between technology, autonomy, and the state?” This article gives a quick summary of some topics discussed in the thesis to convey a flavour of the work._ + +Dr Folz spent one year in India doing field work for her thesis, travelling and interacting extensively with many different players in the Indian FOSS space. Studies of FOSS in India have been very few and mostly lacking in depth, and even those that have been done are confined to its technological and economic aspects. This work is therefore unique and valuable in many ways as it provides the deeper insights and understanding that only anthropologists are capable of, and Dr Folz has maintained the rigour and focus of her profession in this effort. Among other things, it could help answer frequently asked questions like “Why is there very little contribution from India to the global FOSS corpus?” Much of this review quotes directly from the thesis itself. + +**Historical origins of FOSS in India** +Modern science and technology (S&T) came to India bundled with the European colonial project, and it was viewed with suspicion, if not hostility. Searching for alternatives to modern S&T (especially in the areas of healthcare, agriculture, village industries, etc) was thus a part of the freedom struggle, and it continued well beyond Independence. Even decades later, large corporations like IBM and Coca Cola came to be seen as symbols of continued western domination. When software and IT became a major force in the country from the 1980s onwards, driven by the global outsourcing industry, Microsoft too joined the list of such corporations. + +The Indian FOSS community took root in this context, with a strong nationalist position and in favour of the digitally disadvantaged sections of the population. In fact, FOSS can be considered a descendant of Gandhian Swadeshi, which includes self-rule via home grown craft and technology, though many in the FOSS community may be opposed to Gandhi on other issues. The Indian FOSS community has always been in conversation with larger issues of what role technology can or should play in Indian society; FOSS came to be seen as a way to develop the nation along particular moral and material pathways, and for that material development to be understood in moral terms. +While sections of the Indian government were sympathetic to FOSS, the former stayed rather ‘non-aligned’ between proprietary and free software, given how the former was the backbone of the country’s massively successful IT boom that was generating jobs and wealth. The FOSS community, too, mostly did not take any strong position on national political issues, considering that there were many differing ideological strands within the community itself. Yet, the community was quite united on the need to make essential software free and open in the country. + +**Notions of freedom, autonomy, individualism and FOSS** +Although FOSS is often free of cost, the FOSS community continues to emphasise that it uses the term ‘free’ to mean freedom itself, as a concept. FOSS was born in the USA, with Richard Stallman and the Free Software Foundation (FSF) that he created, driving it. The LINUX project of Linus Torvalds from Europe illustrated the process of community-based creation and support of FOSS. +Awareness of FOSS did reach India early on, though the approaches to engaging in and mobilising FOSS have been quite different in India compared to the US. These differences can be understood, to a large degree, as arising from the different conceptions of and relationships between freedom and individualism that exist in the two societies. Hence, they help to explain why FOSS acquired the status of a tool for nation building in India. + +To understand what American FOSS enthusiasts mean when they say “Free as in freedom” it is also necessary to understand American individualism. There are two liberal tenets integral to American individualism — free speech and intellectual property law, both of which are at the core of the FOSS ideology as it developed there. American individualism is utilitarian and premised on a core value of self-reliance so that individuals tend to negate the influence of family and class, even minimising personal responsibility to society. American software engineers who produce FOSS code are predominantly educated white men with high incomes and a strong sense of individualism. +For Western FOSS enthusiasts, then, freedom as in free speech is the central issue. The code is viewed as a form of speech and thus not to be owned. To them, the activity of writing code is a form of exploring and opening up physical and mental frontiers. The technical practice of creating FOSS is central to making ideas meaningful to the community. Stallman and the FSF do not view FOSS, per se, as standing for the promotion of socio-economic equality, though they would be for it. To Stallman and the FSF, large scale profiteering from FOSS (if it is possible), as such, would not be an issue, as long as the four freedoms of the code are scrupulously guaranteed. FOSS in the US takes no stand vis-a-vis capitalism, free markets or profit making. In fact, it enables participation in the market in a healthier and stronger manner. + +Concepts like freedom and individualism are not universal or uniform; they must be understood as products of unique cultural histories, and there are vast differences between the US and Indian societies, in this regard. It is not that the concept of individualism does not exist in India but it is more in the nature of a relational individualism as against the utilitarian individualism of the US. The relational individualists understand themselves as part of a community with shared beliefs and practices and, besides this, their personal duties and desires are bound to the collective. By ensuring that the goals of the collective are met, the rights of the individual are protected. Because Indian FOSS enthusiasts conceptualise individualism as inherently relational, their interpretation of the FOSS philosophy and its implications, includes the role and rights of the individual, but expands on this to include the community. Thus the ‘freedom imagined’ by the Indian FOSS community includes the wider socio-economic potential FOSS holds for their developing nation, to which they feel morally obligated to contribute as individuals. It can now be understood how so many Indian FOSS enthusiasts can, on the one hand accept that, “Free as in freedom” is the foundational underpinning of the FOSS philosophy and, on the other hand, emphasise the importance that FOSS is also “Free, as in cost.” + +While individual self-reliance is not a traditional cultural touchstone in India, national self-reliance is, as reflected in the Swadeshi movement and post-Independence political and economic policy. As a matter of fact, autonomy could be a more appropriate term than freedom for the Indian context. + +**The Indian FOSS community** +Members of the Indian FOSS community come overwhelmingly from middle-class, upper-caste backgrounds, but the majority of them are best understood as being ideologically closer to the ‘old middle class’ who historically engaged with the nation building process. Many of them stayed back in India rather than emigrate to the West as a commitment to improving India. There are strong ties between the FOSS community and earlier politically engaged science and technology based movements. A majority of the community conceives of FOSS as a technology that can be made Indian and that should be mobilised in efforts to improve the lives of all Indians. In this way, the community is using FOSS as a social as much as a technical tool. + +The Indian FOSS community is deeply committed to evangelising FOSS, both in terms of bringing in more people (particularly students) into its fold, as well as by lobbying with the government, academia, NGOs, industry, media, etc. Unlike in the US, it is not essential in India for one to contribute quality code to be accepted as an important member of the FOSS community. + +Another aspect that Dr Folz’s study examines is gender. The ways in which gender informs the IT industry generally and the FOSS community, specifically in India, are unique. While low participation of women in FOSS is a worldwide issue, within India it has played out in particular ways which have to do with how the male and female roles at home, work, and in public are conceived. ‘Respectable femininity’, which is a refraction of hegemonic masculinity, has provided women with the ‘right amount of freedom’ to participate in the lucrative IT industry so long as their essential identity as wives and mothers was not impacted. + +Women’s exclusion and discrimination in the Indian FOSS community is rooted in a different set of gendered assumptions and priorities from those in the West, where it is assumed women are not as intellectually capable as men. While Indian women are generally presumed to be as technically capable as men (because much of the work of the Indian FOSS community such as evangelising is social rather than technical and done in public, social settings), many women cannot participate because they do not have as much free time away from work and family obligations as men do. Further, due to the prevalence of homosociality, many women and men do not necessarily feel comfortable socialising together in the public sphere. + +For the most part, the Indian FOSS community is left-leaning, middle class and urban, though there are significant generational, regional, and gendered differences. The older generation (aged 50 +) is almost exclusively upper middle class and upper caste, and its members have held important positions in the government, academia, R&D, NGOs, etc. The younger generation, in its 20s and 30s, is most likely to be students or employed by IT companies, with a few entrepreneurs as well. In general, class, caste and gender inequalities are maintained in the FOSS community, though many members of the community are sincerely committed to making it more inclusive. + +FOSS offers Indians the possibility of exerting autonomy in the relationships between technology and the state. FOSS allows for the autonomy of states in relation to the market and it also, crucially, offers autonomy to citizens in relation to markets and the Indian state. The Indian FOSS community has taken a technology created in a Western context and mobilised it towards what can broadly be called nation building efforts, though to what extent these mobilisations lead to substantive societal change is yet to be seen. + +**Note:** Interested readers can obtain a copy of the entire thesis by writing to Dr Jasmine Folz at _[jasminefolz@gmail.com][3]_. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/foss-in-india-perspectives-of-an-american-anthropologist-2/ + +作者:[Prof. C.N Krishnan][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://opensourceforu.com/author/cn-krishnan/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Foss-Apps.jpg?resize=696%2C396&ssl=1 (Foss Apps) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Foss-Apps.jpg?fit=900%2C512&ssl=1 +[3]: mailto:jasminefolz@gmail.com diff --git a/sources/talk/20191011 How a business was built on podcasts for Linux- The story of Jupiter Broadcasting.md b/sources/talk/20191011 How a business was built on podcasts for Linux- The story of Jupiter Broadcasting.md new file mode 100644 index 0000000000..36fd17754f --- /dev/null +++ b/sources/talk/20191011 How a business was built on podcasts for Linux- The story of Jupiter Broadcasting.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How a business was built on podcasts for Linux: The story of Jupiter Broadcasting) +[#]: via: (https://opensource.com/article/19/10/linux-podcasts-Jupiter-Broadcasting) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +How a business was built on podcasts for Linux: The story of Jupiter Broadcasting +====== +Learn about Jupiter Broadcasting's origins and its future under the +Linux Academy wing in an interview with cofounder Chris Fisher. +![Woman programming][1] + +I spend a lot of time on the road and enjoy listening to podcasts about a variety of topics. One of my interests is keeping up with the latest news and information about Linux and open source, and that led me to [Jupiter Broadcasting][2], an open source (both in topics covered and its own license) podcasting network. I met Jupiter's cofounder [Chris Fisher][3] when I [visited System76][4]'s Denver headquarters in late 2018. + +Jupiter Broadcasting emerged from [The Linux Action Show][5], a podcast that began in 2006 and ended 10 years later in early 2017. The show was such a success that, in 2008, Chris and co-founder [Bryan Lunduke][6] decided to start Jupiter Broadcasting. Back then, the company only had two shows, The Linux Action Show and [CastaBlasta][7]. Now it offers 10 Linux-related podcasts with titles like [Linux Headlines][8], [Linux Action News][9], [Choose Linux][10], [Coder Radio][11], [Self-Hosted][12], and more. + +I was interested in learning more about Jupiter, so I was grateful when Chris agreed to do this interview (which has been lightly edited for length and clarity). + +**Don Watkins**: What is your background? + +**Chris Fisher**: I grew up during the transition from early '80s digital solutions to more "modern" networked solutions. In both schools and businesses, the world was slowly getting networked and online. Some people made early bets on DOS-based systems, and others held out completely for the move to digital. From a very young age, I was fortunate to have access to tech I could tinker with to learn. And right out of high school, I got to work migrating systems, standing up networks, and building out centralized authentication, storage, and early web services. + +**DW**: How did you get started with Linux? + +**CF**: Coming from a Microsoft and Novell admin background, distros like Debian Linux and the open source services that run on top of it were like discovering a new world of solutions. I quickly became very enthusiastic about open source software and the long-term possibilities of Linux. It didn't take long for me to **rm -rf** my root partition and be blown away with how powerful Linux was. From that moment, I had to have it on the desktop and found more and more uses for it on the server. + +**DW**: What is your favorite distribution? Why is it your favorite? + +**CF**: I really do enjoy something about all of them. These days, my studio runs Ubuntu LTS, my servers run Fedora (as does my Thinkpad), and my workstation runs Xubuntu. From Gentoo to MX, I like to try them all. But I often stick to the classics on my production systems. + +**DW**: What was the genesis of Jupiter Broadcasting? + +**CF**: It really started as an outlet to share things my friends and I are passionate about. Over time, as we started more podcasts, it made a lot of sense to put it all under one roof. Podcasts grew into a real industry, we started taking advertisers, and after a few years of working a few jobs at once, I was able to go full time. Fast forward some 10+ years later, and one year ago, we merged with [Linux Academy][13]. They have enabled us to give our podcasts away to the community without advertising and while investing in the crew to make them better than ever. We're on a mission to keep people informed and passionate about Linux and open source, and that fits in really great with our bigger mission at Linux Academy to train people on the stacks we talk about. + +**DW**: There are 10 different podcasts at Jupiter Broadcasting. How do you stay on top of all of that? + +**CF**: It can be a big job, more than ever these days. We just launched two new podcasts: Linux Headlines—a daily Linux, open source, and cloud news show in three minutes or less, and Self-Hosted, a podcast all about hosting services on your LAN with open source software and leveraging the cloud in a secure, under-your-control way, when it makes sense. + +Just getting those efforts off the ground, while also keeping the existing shows fresh and packed with good content, is a lot of work! Especially combined with a fair bit of travel required for the job. Now that we're part of Linux Academy, I have a good team behind me—from a core of full-timers to a raft of co-hosts from various areas in the industry—and they're all really good at their jobs. + +I am constantly finding my balance and working with the team to take that on. It's definitely an ongoing process. And I'm really thankful I get to make these podcasts as a living. + +**DW**: Do you use open source hardware and software to record the content? + +**CF**: Our shows are recorded on Linux, and we use the amazing REAPER editor on Linux. It's not open source, but it's a great example of what kind of powerful, workstation-grade software you can get when you have an open platform underneath it enabling it. + +**DW**: How large is your audience? + +**CF**: I'm not sure we have ever shared numbers, but I'm thrilled to say it's well over 1 million unique downloads a quarter. Without advertising, we don't have to track very aggressively and have turned our focus on the content. So now we work with some high-level numbers for health checks. + +**DW**: Do you have a favorite topic on a particular show? + +**CF**: I love the #askerror questions that come into our [User Error][14] podcast. They're always a source of great conversation among the guys. The moment that show hits my podcast player, I hit Play. + +But I'm a real newshound, so my favorite topics in the shows I do are driven by the news cycle. + +**DW**: How is your content licensed? + +**CF**: Attribution-ShareAlike 4.0 International. + +**DW**: How do we support you? + +**CF**: For us—and for all content creators in this space—word of mouth. People trust direct recommendations, and that means a lot in this area. It's hard to find good content that avoids clickbait and does its research. By the very nature of not chasing that clickbait, it limits the viral discovery of content that is working very hard to get right. So taking a few minutes to tell a friend, or share a post, or anything that helps spread awareness is real support! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/linux-podcasts-Jupiter-Broadcasting + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://www.jupiterbroadcasting.com/ +[3]: https://twitter.com/ChrisLAS +[4]: https://opensource.com/article/19/5/system76-secret-sauce +[5]: https://www.jupiterbroadcasting.com/tag/linux-action-show/ +[6]: https://twitter.com/BryanLunduke +[7]: https://www.jupiterbroadcasting.com/show/castablasta/ +[8]: https://linuxheadlines.show/ +[9]: https://linuxactionnews.com/ +[10]: https://chooselinux.show/ +[11]: https://coder.show/ +[12]: https://www.jupiterbroadcasting.com/show/self-hosted/ +[13]: https://linuxacademy.com/ +[14]: https://www.jupiterbroadcasting.com/show/error/ diff --git a/sources/talk/20191012 How the oil and gas industry exploits IoT.md b/sources/talk/20191012 How the oil and gas industry exploits IoT.md new file mode 100644 index 0000000000..d78a6ad967 --- /dev/null +++ b/sources/talk/20191012 How the oil and gas industry exploits IoT.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the oil and gas industry exploits IoT) +[#]: via: (https://www.networkworld.com/article/3445204/how-the-oil-and-gas-industry-exploits-iot.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +How the oil and gas industry exploits IoT +====== +The energy industry has embraced IoT technology in its operations, from monitoring well production to predicting when its gear will need maintenance. +Like many traditional industries that have long-standing, tried-and-true methods of operation, the oil-and-gas sector hasn’t been the quickest to embrace [IoT][1] technology – despite having had instrumentation on drilling rigs, pipelines and refining facilities for decades, the extraction industry has only recently begun to work with modern IoT. + +Part of the issue has been interoperability, according to Mark Carrier, oil-and-gas development director for RTI, which produces connectivity software for industrial companies. Energy companies are most comfortable working with the same vendors they’ve worked with before, but that tendency means there isn’t a strong impetus toward sharing data across platforms. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“On a very low level, things are pretty well-connected, at the connectivity to the back-end they’re well-connected, but there’s a huge expense in understanding what that data is,” he said. + +Christine Boles, a vice president in Intel’s IoT group, said that the older systems still being used by the industry have been tough to displace. + +“The biggest challenge they’re facing is aging infrastructrure, and how they get to a more standardized, interoperable version,” she said. + +Changes are coming, however, in part because energy prices have taken a hit in recent years. Oil companies have been looking to cut costs, and one of the easiest places to do that is in integration and automation. On a typical oil well, said Carrier, a driller will have up to 70 different companies’ products working – sensors covering everything from flow rates to temperature and pressure to azimuth and incline, different components of the drill itself – but until fairly recently, these all had to be independently monitored. + +An IoT solution that can tie all these various threads of data together, of late, has become an attractive option for companies looking to minimize human error and glean real-time insights from the wide range of instrumentation present on the average oil rig. + +Those threads are numerous, with a lot of vertically unique sensor and endpoint types. Mud pulse telemetry uses a module in a drill head to create slight fluctuations in the pressure of drilling fluid to pulse information to a receiver on the surface. Temperature and pressure sensors operating in the extreme environmental conditions of an active borehole might use heavily ruggedized serial cable to push data back aboveground. + +Andre Kindness, a principal analyst at Forrester Research, said that the wide range of technologies, manufacturers and standards in use at any given oil-and-gas facility is the product of cutthroat competition + +To continue reading this article register now + +[Get Free Access][3] + +[Learn More][4]   Existing Users [Sign In][3] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3445204/how-the-oil-and-gas-industry-exploits-iot.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: javascript:// +[4]: https://www.networkworld.com/learn-about-insider/ diff --git a/sources/talk/20191012 The Role of Open Source Tools and Concepts in IoT Security.md b/sources/talk/20191012 The Role of Open Source Tools and Concepts in IoT Security.md new file mode 100644 index 0000000000..ed650062c6 --- /dev/null +++ b/sources/talk/20191012 The Role of Open Source Tools and Concepts in IoT Security.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Role of Open Source Tools and Concepts in IoT Security) +[#]: via: (https://opensourceforu.com/2019/10/the-role-of-open-source-tools-and-concepts-in-iot-security/) +[#]: author: (Shashidhar Soppin https://opensourceforu.com/author/shashidhar-soppin/) + +The Role of Open Source Tools and Concepts in IoT Security +====== + +[![][1]][2] + +_With IoT devices permeating the commercial and personal space, their security becomes important. Hackers and malicious agents are always trying to exploit vulnerabilities in order to control these devices. The advantages of using open source rather than proprietary software needs no elaboration. Here is a selection of open source tools popular in the IoT field._ + +Security is one of the key factors to consider while choosing any IoT platform. The IoT market is very large and is growing constantly. Scary hacks and security breaches are happening to IoT related devices on a regular basis. These could be DoS (Denial of Service) attacks or may completely wipe out the firmware sitting on top of the device. Early detection and prevention of these attacks is a major concern for any enterprise or organisation. Many companies are adopting open source security tools and solutions and laying out predefined best practices for IoT security. + +![Figure 1: The Mirai botnet][3] + +**Recent security attacks** +As explained earlier, many attacks and threats targeting IoT systems have happened during the last few years. Let’s look at some of the major ones. + +_**The Silex malware attack**_: In 2019, a 14-year-old hacker bricked at least around 4,000 IoT devices with a new strain of malware called Silex, which was used to abruptly shut down command and control servers. Larry Cashdollar, who is a senior security intelligence response engineer at Akamai, first discovered this malware on his honeypot. Like the BrickerBot malware in 2017, Silex too targeted insecure IoT devices and made them unusable. + +Silex trashes an IoT device’s storage, dropping firewall rules, removing the network configuration and then halting the device completely. It is as destructive as it can get without actually frying the IoT device’s circuits. To recover, victims must manually reinstall the device’s firmware, a task too complicated for most device owners. (__) + +_**The BrickerBot attack**_: The BrickerBot malware attack took place in 2017 and its author has claimed that 60,000 modems and routers across India lost Internet connectivity. The incident affected modems and routers belonging to two Indian state-owned telecommunications service providers, Bharat Sanchar Nigam Limited (BSNL) and Mahanagar Telephone Nigam Limited (MTNL). The attack was so intensive that from July 25 and up to July 29, users reported losing Internet connectivity as routers and modems became stuck with their red LED remaining always on. The main purpose of this bot is to brick devices so they will not be usable once attacked. (__) + +![Figure 2: Princeton IoT Icon][4] + +**Note:** _Bricking is the process of changing the code of the device so that the hardware can no longer be used, thereby turning the device essentially into a brick (totally unusable)._ + +**The Mirai botnet attack:** The Mirai botnet attack took place in 2016. This was a major malware/virus attack. Mirai is a self-propagating botnet virus. The source code for it was made publicly available by the author after a successful and well-publicised attack on the Krebbs website. Since then, the source code has been built and used by many others to launch attacks on Internet infrastructure, causing major damage. The Mirai botnet code infects poorly protected Internet devices by using telnet to find those that are still using their factory default usernames and passwords. The effectiveness of Mirai is due to its ability to infect tens of thousands of these insecure devices and co-ordinate them to mount a DDoS attack against a chosen victim. (__) + +**Detection and prevention of security attacks** +The major cause of concern in IoT devices is the use of the Linux OS by the device vendors instead of developing a custom OS, which is time consuming and expensive. Most of the attackers/hackers know this and so target these devices. + +Some time back, Symantec came up with a solution for this by using a router called Norton Core (__). This was not a success as it was expensive and had a monthly maintenance cost. In addition, people felt that it was too early to use such a router that came with a monthly subscription, since most homes still do not have enough IoT enabled devices to make such an investment worthwhile. + +**Open source security tools** +Subsequently, many state-of-art security tools with multiple security features have been launched. Some of the most used and popular open source security tools are featured below. + +**Princeton IoT-Inspector** +This is an open source desktop tool with a one-click, easy-to-install process. It has many built-in security validation features: + + * Automatically discovers IoT devices and analyses their network traffic. + * Helps one to identify security and privacy issues with graphs and tables. + * Requires minimal technical skills and no special hardware. + + + +This tool can be configured on Linux/Mac (Windows support is still under discussion). + +**What data does IoT Inspector collect?** For each IoT device in the network, IoT Inspector collects the following information and sends it to identified secure servers at the Princeton University: + + * Device manufacturers, based on the first six characters of the MAC address of each device on the network + * DNS requests and responses + * Destination IP addresses and ports contacted — but not the public-facing IP address (i.e., the one that your ISP assigns to you) + * Scrambled MAC addresses (i.e., those with a salted hash) + * Aggregate traffic statistics, i.e., the number of bytes sent and received over a period of time + * The names of devices on the identified network + + + +By collecting the above types of data, there are some risks involved, such as: + + * Performance degradation + * Data breaches + * Best-effort support + + + +![Figure 3: OWASP IoT][5] + +_**How the security validation is done:**_ Princeton releases its findings in a journal/conference publication. When consumers are unsure about whether to buy a new IoT device or not, they can read the relevant papers before making a decision, checking if the device of interest features in the Princeton data. Otherwise, the consumer can always buy the product, analyse it with IoT Inspector, and return it if the results are unsatisfactory. + +**Open Web Application Security Project (OWASP) set of standards** +OWASP is an open community dedicated to enabling organisations to conceive, develop, acquire, operate and maintain applications that can be trusted. + +_**Testing an IoT device for poor authentication/authorisation (OWASP I2):**_ When we think of weak authentication, we might think of passwords that are not changed on a regular basis, six-to-eight character passwords that are nonetheless easy to guess, or of systems without multi-factor authentication mechanisms. Unfortunately, with many smart devices, weak authentication causes major havoc. +Many of the IoT devices are secured with default passwords like ‘1234’, ‘password’, or ‘ABCD’. Users put their password checks in client-side Java code, send credentials without using HTTPS or other encrypted transport protocols, or require no passwords at all. This kind of mismanagement of passwords causes a lot of damage to devices. +Many OWASP l2 to I10 standards provide different levels of security, which are listed in Figure 3. + + * I1 – Insecure Web interface + * I2 – Insufficient authentication/authorisation + * I3 – Insecure network services + * I4 – Lack of transport encryption + * I5 – Privacy concerns + * I6 – Insecure cloud interface + * I7 – Insecure mobile interface + * I8 – Insufficient security configurability + * I9 – Insecure software/firmware + * I10 – Poor physical security + + + +**Mainflux platform: For authentication and authorisation** +Mainflux is an open source IoT platform providing features like edge computing and consulting services. Mainflux Labs is a technology company offering an end-to-end, open source patent-free IoT platform, an LF EdgeX Foundry compliant IoT edge gateway with an interoperable ecosystem of plug-and-play components, and consulting services for the software and hardware layers of the IoT technology. It provides enhanced and fine-grained security via the deployment-ready Mainflux authentication and authorisation server, with an access control scheme based on customisable API keys and scoped JWT. It also offers mutual TLS (mTLS) authentication using X.509 certificates, NGINX reverse proxy for security, load balancing and termination of TLS and DTLS connections, etc. Many of these features can be explored and used according to the need of the hour. + +**Best practices for building a secure IoT framework** +To prevent/avoid attacks on any IoT device, environment or ecosystem, the following best practices need to be applied: + + * Always use strong passwords for device accounts and Wi-Fi networks. + * It is a best practice to always change default passwords. + * Use stronger and most recent encryption methods when setting up Wi-Fi networks such as WPA2. + * Develop the habit of disabling or protecting the remote access to IoT devices when not needed. + * Use wired connections instead of wireless, where possible. + * Be careful when buying used IoT devices, as they could have been tampered with. It is better to consult a genuine authority and confirm the device’s validation or buy from a certified authority. + * Research the vendor’s device security measures as well as the features that they support. + * Modify the privacy and security settings of the device to meet your needs immediately after buying the device. + * It is better to disable features that are not used frequently. + * Install updates regularly, when they become available. It is a best practice to use the latest firmware updates. + * Ensure that an outage due to jamming or a network failure does not result in an insecure state of the installation. + * Verify if the smart features are required or if a normal device suffices for the purpose. + + + +**Best practices for designers of IoT frameworks and device manufacturers** + + * Always use SSL/TLS-encrypted connections for communication purposes. + * Check the SSL certificate and the certificate revocation list. + * Allow and encourage the use of strong passwords and change default passwords immediately. + * Provide a simple and secure update process with a chain of trust. + * Provide a standalone option that works without Internet and cloud connections. + * Prevent brute-force attacks at the login stage through account lockout measures or with multi-factor types of authentication mechanisms. + * Implement a smart fail-safe mechanism when the connection or power is lost or jammed. + * Remove unused tools and allow only trusted applications and software. + * Where applicable, security analytics features should be provided in the device management strategy. + + + +IoT developers and designers should include security at the start of the device development process, irrespective of whether the device is for the consumer market, the enterprise or industry. Incorporating security at the design phase always helps. Enabling security by default is very critical, as is providing the most recent operating systems and using secure hardware with the latest firmware versions. + +**Enabling PKI and digital certificates** +Public key infrastructure (PKI) and 509 digital certificates play important and critical roles in the development of secure IoT devices. It is always a best practice to provide the trust and control needed to distribute and identify public encryption keys, secure data exchanges over networks and verify the identity. + +**API (application performance indicator) security** +For any IoT environment, API security is essential to protect the integrity of data. As this data is being sent from IoT devices to back-end systems, we always have to make sure only authorised devices, developers and apps communicate with these APIs. + +**Patch management/continuous software updates** +This is one crucial aspect in IoT security management. Providing the means of updating devices and software either over network connections or through automation is critical. Having a coordinated disclosure of vulnerabilities is also important to updating devices as soon as possible. Consider end-of-life strategies as well. + +Always remember that hard coded credentials should never be used nor be part of the design process. If there are any default credentials, users should immediately update them using strong passwords as described earlier, or follow multi-factor or biometric authentication mechanisms. + +**Hardware security** +It is absolutely essential to make devices tamper-proof or tamper-evident, and this can be achieved by endpoint hardening. + +Strong encryption is critical to securing communication between devices. It is always a best practice to encrypt data at rest and in transit using cryptographic algorithms. + +IoT and operating system security are new to many security teams. It is critical to keep security staff up to date with new or unknown systems, enabling them to learn new architectures and programming languages to be ready for new security challenges. C-level and cyber security teams should receive regular training to keep up with modern threats and security measures. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-role-of-open-source-tools-and-concepts-in-iot-security/ + +作者:[Shashidhar Soppin][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://opensourceforu.com/author/shashidhar-soppin/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Security-of-IoT-devices.jpg?resize=696%2C550&ssl=1 (Security of IoT devices) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Security-of-IoT-devices.jpg?fit=900%2C711&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-The-Mirai-botnet.jpg?resize=350%2C188&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-Princeton-IoT-Icon.jpg?resize=350%2C329&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-OWASP-IoT.jpg?resize=350%2C147&ssl=1 diff --git a/sources/talk/20191014 A Primer on Open Source IoT Middleware for the Integration of Enterprise Applications.md b/sources/talk/20191014 A Primer on Open Source IoT Middleware for the Integration of Enterprise Applications.md new file mode 100644 index 0000000000..96c4558da0 --- /dev/null +++ b/sources/talk/20191014 A Primer on Open Source IoT Middleware for the Integration of Enterprise Applications.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Primer on Open Source IoT Middleware for the Integration of Enterprise Applications) +[#]: via: (https://opensourceforu.com/2019/10/a-primer-on-open-source-iot-middleware-for-the-integration-of-enterprise-applications/) +[#]: author: (Gopala Krishna Behara https://opensourceforu.com/author/gopalakrishna-behara/) + +A Primer on Open Source IoT Middleware for the Integration of Enterprise Applications +====== + +[![][1]][2] + +_The Internet of Things (IoT) integrates a virtual world of information to the real world of devices through a layered architecture. IoT middleware is an interface between the physical world (hardware layer) of devices with the virtual world (application layer), which is responsible for interacting with devices and information management systems. This article discusses IoT middleware, the characteristics of open source IoT middleware, IoT middleware platform architecture and key open source IoT middleware platforms._ + +With billions of devices generating trillions of bytes of data, there is a need for heterogeneous IoT device management and application enablement. This requires a revamp of existing architectures. There is a need to identify industry agnostic application middleware to address the complexity of IoT solutions, future changes, the integration of IoT with mobile devices, various types of machinery, equipment and tablets, among other devices. + +According to Statista, the total installed base of IoT connected devices is projected to be 75.44 billion worldwide by 2025. + +Most of the IoT applications are heterogeneous, and domain specific. Deciding on the appropriate IoT middleware for app development is the major challenge faced by developers today. The functionalities provided by different middleware vendors are almost similar but differ mainly in their underlying technologies. Middleware services provided by different IoT vendors include data acquisition, device management, data storage, security and analytics. Selecting the right middleware platform is one of the critical steps in application development. + +The important parameters for choosing the right middleware for an IoT application are scalability, availability, the ability to handle huge amounts of data, a high processing speed, flexibility, integration with varied analytical tools, security and cost. + +**Industry adoption of open source middleware in IoT** +The market for IoT middleware was valued at US$ 6.44 billion in 2018 and is expected to reach a value of US$ 18.68 billion by 2024 at a CAGR of 19.72 per cent, over the forecast period 2019-2024 (__). + +According to an Ericsson forecast (__), there will be around 29 billion connected devices in use by 2022, of which around 18 billion will be related to IoT. Gartner forecasts that 14.2 billion connected things will be in use in 2019, and that the total will reach 25 billion by 2021, producing immense volume of data. + +**IoT middleware and its features** +Middleware acts as an agent between the service providers (IoT devices) and service consumers (enterprise applications). It is a software layer that sits in between applications and objects. It is a mediator interface that enables the interaction between the Internet and ‘things’. It hides the heterogeneity among the devices, components and technology of an IoT system. Middleware provides solutions to frequently encountered problems, such as interoperability, security and dependability. The following are the important features of middleware, which improve the performance of devices. + +**Flexibility:** This feature helps in establishing better connectivity, which improves the communication between applications and things. There are different kinds of flexibility (e.g., response time, faster to evolve and change). + +**Transparency:** Middleware hides many complexities and architectural information details from both the application and the object sides, so that the two can communicate with minimum knowledge of either side. + +**Interoperability:** This functionality allows two sets of applications on interconnected networks to exchange data and services meaningfully with different assumptions on protocols, data models, and configurations. + +**Platform portability:** An IoT platform should be able to communicate from everywhere, anytime with any device. Middleware runs on the user side and can provide independence from network protocols, programming languages, OSs and others. + +**Re-usability:** This feature makes designing and developing easier by modifying system components and assets for specific requirements, which results in cost efficiency. + +**Maintainability:** Maintainability has a fault tolerance approximation. Middleware performs maintainability efficiently and extends the network. + +**Security:** Middleware should provide different security measures for ubiquitous applications and pervasive environments. Authentication, authorisation and access control helps in verification and accountability. + +**Characteristics of open source IoT middleware** +An open source IoT middleware platform should be fault-tolerant and highly available. It has the following characteristics: + + * No vendor lock-in, and it comes with the surety of seamless integration of enterprise-wide tools, applications, products and systems developed and deployed by different organisations and vendors. + * Open source middleware increases the productivity, speeds up time to market, reduces risk and increases quality. + * Adoption of open source middleware enhances the interoperability with other enterprise applications because of the ability to reuse recommended software stacks, libraries and components. + * IoT middleware platforms should support open APIs, deployment models of the cloud, and be highly available. + * It should support open data formats like RestAPI, JSON, XML and Java, and be freely available + * An IoT middleware platform should support multi-service and heterogeneous devices, and be compatible with the hardware for sensing environmental information. + * Migration to any new platform or system should be seamless. It should be possible to adopt or integrate with any solution. + * The information data model should be distributed and extensible, providing availability and scalability to the system. + * An IoT middleware platform should support major communication protocols like MQTT, CoAP, HTTP, WebSockets, etc. + * An IoT middleware platform should support different security features like encryption, authentication, authorisation and auditing. + * It should support technologies such as M2M applications, real-time analytics, machine learning, artificial intelligence, analytics, visualisation and event reporting. + + + +**IoT middleware architecture** +The middleware mediates between IoT data producers and the consumers. APIs for interactions with the middleware are based on standard application protocols. + +API endpoints for accessing the data and services should be searchable via an open catalogue, and should contain linked metadata about the resources. + +The device manager communicates messages to the devices. The database needs to access and deliver messages to the devices with minimum latency. + +Data processing involves data translation, aggregation and data filtering on the incoming data, which enables real-time decision making at the edge. The database needs to support high-speed reads and writes with sub-millisecond latency. It helps in performing complex analytical computations on the data. + +The IoT data stream normalises the data to a common format and sends it to enterprise systems. The database needs to perform the data transformation operations efficiently. + +Middleware supports the authentication of users, organisations, applications and devices. It supports functionalities like certificates, password credentials, API keys, tokens, etc. It should also support single sign-on, time based credentials, application authentication (via signatures) and device authentication (via certificates). + +Logging is necessary for both system debugging as well as auditing. Middleware manages the logging of system debugging and auditing details. It helps to track the status of the various services, APIs, etc, and administers them. + +**Key open source IoT middleware platforms** +Holistically, an IoT implementation covers data collection and insertion through sensors as well as giving control back to devices. The different types of IoT middleware are categorised as: + + * Application-centric (application and data management) + * Platform-centric (application enablement, device management and connectivity management) + * Industry-specific (manufacturing, healthcare, energy and utilities, transportation and logistics, agriculture, etc) + + + +![Figure 1: IoT middleware architecture][3] + +Selecting the right middleware during various stages of IoT implementation depends on multiple factors like the size of the enterprise, the nature of the business, the development and operational perspectives, etc.The following are some of the top open source middleware platforms for IoT based applications. + +**Kaa** is platform-centric middleware. It manages an unlimited number of connected devices with cross-device interoperability. It performs real-time device monitoring, remote device provisioning and configuration, collection and analysis of sensor data. It has microservices based portability, horizontal scalability and a highly available IoT platform. It supports on premise, public cloud and hybrid models of deployment. Kaa is built on open components like Kafka, Cassandra, MongoDB, Redis, NATS, Spring, React, etc. + +**SiteWhere** is platform-centric middleware. It provides ingestion, storage, processing and integration of device data. It supports multi-tenancy, MQTT, AMQP, Stomp, CoAP and WebSocket. It seamlessly integrates with Android, iOS, and multiple SDKs. It is built on open source technology stacks like MongoDB, Eclipse Californium, InfluxDB, HBase and many others. + +**IoTSyS** is platform-centric and industry-specific middleware. It uses IPv6 for non-IP IoT devices and systems. It is used in smart city and smart grid projects to make the automation infrastructure smart. IoTSyS provides interoperable Web technologies for sensors and actuator networks. + +**DeviceHive** is cloud agnostic, microservices based, platform-centric middleware used for device connectivity and management. It has the ability to connect to any device via MQTT, REST or WebSockets. It supports Big Data solutions like ElasticSearch, Apache Spark, Cassandra and Kafka for real-time and batch processing. + +**EclipseIoT (Kura)** provides device connectivity, data transformation and business logic with intelligent routing, edge processing/analytics and real-time decisions. + +**Zetta** is application-centric middleware. It is a service-oriented open source IoT platform built on Node.js combining REST API, WebSockets and reactive programming. It can run on cloud platforms like Heroku to create geo-distributed networks and stream data into machine analytics systems like Splunk. + +**MainFlux** is application-centric middleware providing solutions based on the cloud. It has been developed as microservices, containerised by Docker and orchestrated with Kubernetes. The architecture is flexible and allows seamless integration with enterprise systems like ERP, BI and CRM. It can also integrate with databases, analytics, backend systems and cloud services easily. In addition, it supports REST, MQTT, WebSocket and CoAP. + +**Distributed Services Architecture (DSA)** facilitates decentralised device inter-communication, allowing protocol translation and data integration to and from third party data sources. + +**OpenRemote** is application-centric middleware used to connect any device regardless of vendor or protocol, to create meaningful connections by converting data points into smart applications. It finds use in home automation, commercial buildings, public space and healthcare. Data visualisation is integrated with devices and sensors, and turns data into smart applications. + +**OpenIoT** is application-centric open source middleware for pulling information from sensors. It incorporates Sensing-as-a-Service for deploying and providing services in cloud environments. + +**ThingsBoard** is an open source IoT platform for data collection, processing, data visualisation and device management. It supports IoT protocols like MQTT, CoA, and HTTP with on-premise and cloud deployment. It is horizontally scalable, stores data in Cassandra DB, HSQLDB and PostgreSQL. + +**NATS.io** is a simple, secure and high performance open source messaging system for cloud native solutions. It is developed as microservices architecture with high performance, secure and resilient capabilities. + +**Benefits of open source IoT middleware** +Open source middleware for the IoT has the following advantages over proprietary options: + + * It is easy to upgrade to new technologies with open source middleware. + * It has the ability to connect with upcoming device protocols and backend applications. + * Open source middleware ensures lower overall software costs, and is easier to use when changing technology and open source APIs for integration. + * It has a microservices based architecture and is built using open source technologies, resulting in high performance, scalability and fault-tolerance. + * It provides multi-protocol support and is hardware-agnostic. It supports connectivity for any device and any application. + * It has the flexibility to allow the cloud service provider to be changed. + * It is very important to choose the right set of open source middleware for an IoT solution. This is a big challenge as the market offers a vast choice. + + + +Analyse the business problem and arrive at the solution as a first step. Break the solution into services and understand the middleware needs of these services. This will help to narrow down the middleware choices. + +IoT middleware helps overcome the problems associated with the heterogeneity of the entire Internet of Things by enabling smooth communication among devices and components from different vendors and based on different technologies. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/a-primer-on-open-source-iot-middleware-for-the-integration-of-enterprise-applications/ + +作者:[Gopala Krishna Behara][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://opensourceforu.com/author/gopalakrishna-behara/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Middle-were-architecture-illustration.jpg?resize=696%2C426&ssl=1 (Middle were architecture illustration) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Middle-were-architecture-illustration.jpg?fit=800%2C490&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-IoT-middleware-architecture.jpg?resize=350%2C162&ssl=1 diff --git a/sources/talk/20191014 Pros and cons of event-driven security.md b/sources/talk/20191014 Pros and cons of event-driven security.md new file mode 100644 index 0000000000..b65a9153e5 --- /dev/null +++ b/sources/talk/20191014 Pros and cons of event-driven security.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pros and cons of event-driven security) +[#]: via: (https://opensource.com/article/19/10/event-driven-security) +[#]: author: (Yuriy Andamasov https://opensource.com/users/yuriy-andamasov) + +Pros and cons of event-driven security +====== +Event-driven security is not an impenetrable wall, but it may be cheaper +and better than what you've been doing to prevent data breaches. +![Three closed doors][1] + +Great news, everyone! Forrester Research says that [95% of all recorded breaches][2] in 2016 came from only three industries: government, technology, and retail. Everyone else is safe... ish, right? + +Hold on for a moment. Tech? Retail? What kind of industry diversification is this? We are, after all, living in 2019, where every business is a tech business. And all of us are continuously selling something, whether it’s an innovative product or an amazing service. + +So what the report should have said is that 95% of all recorded breaches came from attacks on 95% of all businesses both online and offline. And some of the attackers went for the .gov. + +More on the matter, [43% of attackers target small businesses][3]—and that’s a lot considering that, on average, a hack attempt takes place every 39 seconds. + +To top things off, the average cost of a data breach in 2020 is expected to exceed [$150 million][4]. These stats sound a bit more terrifying out of context, but the threat is still very much real. Ouch. + +What are our options then? + +Well, either the developers, stakeholders, decision-makers, and business owners willingly risk the integrity and security of their solutions by doing nothing, or they can consider fortifying their digital infrastructure. + +Sure, the dilemma doesn’t seem like it offers too many options, and that’s only because it doesn’t. That said, establishing efficient network security is easier said than done. + +### The cost of safety + +Clearly, security is an expensive endeavor, a luxury even. + + * Cybersecurity costs increased by 22.7% in only a year from 2016 to 2017. + * According to Gartner, organizations spent a total of $81.6 billion on cybersecurity, a $17.7 billion increase! + * And the worst part yet—the problem doesn’t seem like it’s going away regardless of how much money we throw at it. + + + +Perhaps we are doing something wrong? Maybe it’s the way that we perceive network security that’s flawed? Maybe, just maybe, there’s a cheaper AND better solution? + +### Scalability: Bad? + +Software, network, and architecture development have evolved dramatically over the last decade. We’ve moved from the age-old monolithic approach to leaner, more dynamic methodologies that allow faster reactions to the ever-shifting demands of the modern market. + +That said, flexibility comes at a cost. A monolith is a solid, stable element of infrastructure where a small change can crash the whole thing like a house of cards. But said change—regardless of its potential danger—is easily traceable. + +Today, the architecture is mostly service-based, where every single piece of functionality is like a self-contained Lego block. An error in one of the blocks won’t discard the entire system. It may not even affect the blocks standing near it. + +This approach, while adding scalability, has a downside—it’s really hard to trace a single malicious change, especially in an environment where every element is literally bombarded with new data coming anywhere from an HR or security update to, well, a malicious code attack. + +Does this mean it’s best if we sacrifice scalability in favor of security? + +Not at all. We’ve moved away from the monolith for a reason. Going back now will probably cost you your entire project. The tricky part is in effectively identifying what is and what isn’t a threat, as this is where the flaw of microservices lies. + +We need preventive measures. + +### Events, alerts, and incidents + +Everything that happens within your network can be described in one of three words: event, alert, or incident. + +An **event** is any observed change taking place in a network, environment, or workflow. So, for example, when a new firewall policy is pushed, you may consider that the event has happened. When the routers are updated, another event has happened, and so on and so forth. + +An **alert** is an event that requires action. In simpler words, if you or your team need to do something due to the event taking place, it is considered an alert. + +According to the CERT NISTT 800-61 definition, an **incident** is an event that violates your security policies. Or, in simpler words, it is an event that negatively impacts the business like a worm spreading through the network, a phishing attempt, or the loss of sensitive data. + +By this logic, your infrastructure developers, security officers, and net admins are tasked with a very simple mission: establishing efficient preventive measures against any and all incidents. + +Again, easier said than done. + +There are simply too many different events taking place at one time. Every change, shift, or update differs, one from another, resulting in dozens of false-positive incidents. Add the fact that the mischievous events are very keen on disguising themselves, and you’ll get why your net admins look like they’ve lived on coffee and Red Bull for (at least) the past few weeks. + +Is there anything we, as a responsible community of developers, managers, stakeholders, product, and business owners, can do? + +### Event-driven security in a nutshell + +What’s the one thing everything you ignore, act upon, or react to shares in common? + +An event. + +Something needs to happen for you to respond to it in any shape or form. Additionally, many events are similar to one another and can be categorized as a stream. + +Here’s an example. + +Let’s say you have an e-commerce store. One of your clients adds an item to his cart (event) and then removes it (event) or proceeds with the purchase (event). + +Need I say that, other than simply categorizing them, we can analyze these events to identify behavioral patterns, and this makes it easier to identify threats in real time (or even empower HR/dev/marketing teams with additional data)? + +#### Event vs. command + +So event-driven security is essentially based on following up events. Were we ever _not_ following up on them? Didn’t we have commands for that? + +Yes, yes, we have, and that’s partially the problem. Here’s an example of an event versus a command: + +_> Event: I sit on the couch, and the TV turns on._ +_> Command: I sit on the couch and turn on the TV._ + +See the difference? I had to perform an action in the second scenario; in the first, the TV reacted to the event (me sitting on the couch generated the TV turning on) on its own. + +The first approach ensures the integrity of your network through efficient use of automation, essentially allowing the software to operate on its own and decide whether to launch the next season of _Black Mirror_ on Netflix or to quarantine an upcoming threat. + +#### Isolation + +Any event is essentially a trigger that launches the next application in the architecture. A user inputs his login, and the system validates its correctness, requests confirmation from the database, and tests the input for the presence of code. + +So far, so good. Not much has changed, right? + +Here’s the thing—every process and every app run autonomously like separate events, each triggering their own chains. None of the apps know if other apps have been triggered and whether they are running any processes or not. + +Think of them as separate, autonomous clusters. If one is compromised, it will not affect the entirety of the system, as it simply doesn’t know if anything else exists. That said, a malfunction in one of the clusters will trigger an alert, thus preventing the incident. + +#### An added bonus + +Isolated apps are not dependent on one another, meaning you’ll be able to plug in as many of them as you need without any of them risking or affecting the rest of the system. + +Call it scalability out of the box, if you will. + +### Pros of the event-driven approach + +We’ve already discussed most of the pros of the event-driven approach. Let’s summarize them here in the form of short bullet points. + + * **Encapsulation:** Every process has a set of clear, easily executed boundaries. + * **Decoupling:** The processes are independent and unaware of one another. + * **Scalability:** It’s easy to add new functionality, apps, and processes. + * **Data generation:** Event strings generate predictable data patterns you can easily analyze. + + + +### Cons of the event-driven approach + +Sadly, despite an impressive array of benefits to the business, event-driven architecture and security are not silver bullets. The approach has its flaws. + +For starters, developing any architecture with an insane level of scalability is hard, expensive, and time-consuming. + +Event-driven security is far from being a truly impenetrable wall. Hackers evolve and adapt rather quickly. They’ll likely find a breach in any system if they put their mind to it, whether through coding or through phishing. + +Luckily, you don’t have to build a Fort Knox. All you need is a solid system that’s hard enough to crack for the hacker to give up and move to an easier target. The event-driven approach to network security does just that. + +Moreover, it minimizes your losses if an incident actually happens, so you have that going for you, which is nice. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/event-driven-security + +作者:[Yuriy Andamasov][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/yuriy-andamasov +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_UnspokenBlockers_1110_A.png?itok=x8A9mqVA (Three closed doors) +[2]: https://www.techrepublic.com/article/forrester-what-can-we-learn-from-a-disastrous-year-of-hacks-and-breaches/ +[3]: https://www.cybintsolutions.com/industries-likely-to-get-hacked/ +[4]: https://www.cybintsolutions.com/cyber-security-facts-stats/ diff --git a/sources/talk/20191015 Beamforming explained- How it makes wireless communication faster.md b/sources/talk/20191015 Beamforming explained- How it makes wireless communication faster.md new file mode 100644 index 0000000000..d2ff87a163 --- /dev/null +++ b/sources/talk/20191015 Beamforming explained- How it makes wireless communication faster.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Beamforming explained: How it makes wireless communication faster) +[#]: via: (https://www.networkworld.com/article/3445039/beamforming-explained-how-it-makes-wireless-communication-faster.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +Beamforming explained: How it makes wireless communication faster +====== +Beamforming uses the science of electromagnetic interference to make Wi-Fi and 5G connections more precise. +Thinkstock + +Beamforming is a technique that focuses a wireless signal towards a specific receiving device, rather than having the signal spread in all directions from a broadcast antenna, as it normally would. The resulting more direct connection is faster and more reliable than it would be without beamforming. + +Although the principles of beamforming have been known since the 1940s, in recent years beamforming technologies have introduced incremental improvements in Wi-Fi networking. Today, beamforming is crucial to the [5G networks][1] that are just beginning to roll out. + +[5G versus 4G: How speed, latency and application support differ][1] + +### How beamforming works + +A single antenna broadcasting a wireless signal radiates that signal in all directions (unless it's blocked by some physical object). That's the nature of how electromagnetic waves work. But what if you wanted to focus that signal in a specific direction, to form a targeted beam of electromagnetic energy? One technique for doing this involves having multiple antennas in close proximity, all broadcasting the same signal at slightly different times. The overlapping waves will produce interference that in some areas is _constructive_ (it makes the signal stronger) and in other areas is _destructive_ (it makes the signal weaker, or undetectable). If executed correctly, this beamforming process can focus your signal where you want it to go. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +[][3] ojogabonitoo / Getty Images + +The mathematics behind beamforming is very complex (the [Math Encounters blog][4] has an introduction, if you want a taste), but the application of beamforming techniques is not new. Any form of energy that travels in waves, including sound, can benefit from beamforming techniques; they were first developed to [improve sonar during World War II][5] and are [still important to audio engineering][6]. But we're going to limit our discussion here to wireless networking and communications.   + +### Beamforming benefits and limitations + +By focusing a signal in a specific direction, beamforming allows you deliver higher signal quality to your receiver — which in practice means faster information transfer and fewer errors — without needing to boost broadcast power. That's basically the holy grail of wireless networking and the goal of most techniques for improving wireless communication. As an added benefit, because you aren't broadcasting your signal in directions where it's not needed, beamforming can reduce interference experienced by people trying to pick up other signals. + +The limitations of beamforming mostly involve the computing resources it requires; there are many scenarios where the time and power resources required by beamforming calculations end up negating its advantages. But continuing improvements in processor power and efficiency have made beamforming techniques affordable enough to build into consumer networking equipment. + +### Wi-Fi beamforming routers: 802.11n vs. 802.11ac + +Beamforming began to appear in routers back in 2008, with the advent of the [802.11n Wi-Fi standard][7]. 802.11n was the first version of Wi-Fi to support multiple-input multiple-output, or MIMO, technology, which beamforming needs in order to send out multiple overlapping signals. Beamforming with 802.11n equipment never really took off, however, because the spec doesn't lay out how beamforming should be implemented. A few vendors put out proprietary implementations that required purchasing matching routers and wireless cards to work, and they were not popular. + +With the emergence of the [802.11ac standard][8] in 2016, that all changed. There's now a set of specified beamforming techniques for Wi-Fi gear, and while 802.11ac routers aren't required by the specification to implement beamforming, if they do (and almost all on the market now do) they do so in a vendor-neutral and interoperable way. While some offerings might tout branded names, such as D-Link's AC Smart Beam, these are all implementations of the same standard. (The even newer [802.11ax standard][9] continues to support ac-style beamforming.) + +### Beamforming and MU-MIMO + +Beamforming is key for the support of multiuser MIMO, or [MU-MIMO][10], which is becoming more popular as 802.11ax routers roll out. As the name implies, MU-MIMO involves multiple users that can each communicate to multiple antennas on the router. MU-MIMO [uses beamforming][11] to make sure communication from the router is efficiently targeted to each connected client. + +### Explicit beamforming vs. implicit beamforming + +There are a couple of ways that Wi-Fi beamforming can work. If both the router and the endpoint support 802.11ac-compliant beamforming, they'll begin their communication session with a little "handshake" that helps both parties establish their respective locations and the channel on which they'll communicate; this improves the quality of the connection and is known as _explicit_ beamforming. But there are still plenty of network cards in use that only support 802.11n or even older versions of Wi-Fi. A beamforming router can still attempt to target these devices, but without help from the endpoint, it won't be able to zero in as precisely. This is known as _implicit_ beamforming, or sometimes as _universal_ beamforming, because it works in theory with any Wi-Fi device. + +In many routers, implicit beamforming is a feature you can turn on and off. Is enabling implicit beamforming worth it? The [Router Guide suggests][12] that you test how your network operates with it on and off to see if you get a boost from it. It's possible that devices such as phones that you carry around your house can see dropped connections with implicit beamforming. + +### 5G beamforming + +To date, local Wi-Fi networks is where the average person is most likely to encounter beamforming in the wild. But with the rollout of wide-area 5G networks now under way, that's about to change. 5G uses radio frequencies between 30 and 300 GHz, which can transmit data much more quickly but are also much more prone to interference and encounter more difficulty passing through physical objects. A host of technologies are required to overcome these problems, including smaller cells, massive MIMO — basically cramming tons of antennas onto 5G base stations — and, yes, [beamforming][13]. If 5G takes off in the way that vendors are counting on, the time will come soon enough when we'll all be using beamforming (behind the scenes) every day. + +**Learn more about wireless networking** + + * [How to determine if Wi-Fi 6 is right for you][14] + * [What is 5G? How is it better than 4G?][13] + * [Cisco exec details how Wi-Fi 6 and 5G will fire-up enterprises][15] + * [Wi-Fi 6 is coming to a router near you][16] + * [Wi-Fi analytics get real][17] + + + +Join the Network World communities on [Facebook][18] and [LinkedIn][19] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3445039/beamforming-explained-how-it-makes-wireless-communication-faster.html + +作者:[Josh Fruhlinger][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/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3330603/5g-versus-4g-how-speed-latency-and-application-support-differ.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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://images.idgesg.net/images/article/2019/10/nw_wifi_router_traditional-and-beamformer_foundational_networking_internet-100814037-orig.jpg +[4]: https://www.mathscinotes.com/2012/01/beamforming-math/ +[5]: https://apps.dtic.mil/dtic/tr/fulltext/u2/a250189.pdf +[6]: https://www.mathworks.com/company/newsletters/articles/making-all-the-right-noises-shaping-sound-with-audio-beamforming.html +[7]: https://www.networkworld.com/article/2270718/the-role-of-beam-forming-in-11n.html +[8]: https://www.networkworld.com/article/3067702/mu-mimo-makes-wi-fi-better.html +[9]: https://www.networkworld.com/article/3258807/what-is-802-11ax-wi-fi-and-what-will-it-mean-for-802-11ac.html +[10]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html +[11]: https://www.networkworld.com/article/3256905/13-things-you-need-to-know-about-mu-mimo-wi-fi.html +[12]: https://routerguide.net/enable-beamforming-on-or-off/ +[13]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[14]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[15]: https://www.networkworld.com/article/3342158/cisco-exec-details-how-wi-fi-6-and-5g-will-fire-up-enterprises-in-2019-and-beyond.html +[16]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html +[17]: https://www.networkworld.com/article/3305583/wi-fi/wi-fi-analytics-get-real.html +[18]: https://www.facebook.com/NetworkWorld/ +[19]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191015 How GNOME uses Git.md b/sources/talk/20191015 How GNOME uses Git.md new file mode 100644 index 0000000000..f64057287e --- /dev/null +++ b/sources/talk/20191015 How GNOME uses Git.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How GNOME uses Git) +[#]: via: (https://opensource.com/article/19/10/how-gnome-uses-git) +[#]: author: (Molly de Blanc https://opensource.com/users/mollydb) + +How GNOME uses Git +====== +The GNOME project's decision to centralize on GitLab is creating +benefits across the community—even beyond the developers. +![red panda][1] + +“What’s your GitLab?” is one of the first questions I was asked on my first day working for the [GNOME Foundation][2]—the nonprofit that supports GNOME projects, including the [desktop environment][3], [GTK][4], and [GStreamer][5]. The person was referring to my username on [GNOME’s GitLab instance][6]. In my time with GNOME, I’ve been asked for my GitLab a lot. + +We use GitLab for basically everything. In a typical day, I get several issues and reference bug reports, and I occasionally need to modify a file. I don’t do this in the capacity of being a developer or a sysadmin. I’m involved with the Engagement and Inclusion & Diversity (I&D) teams. I write newsletters for Friends of GNOME and interview contributors to the project. I work on sponsorships for GNOME events. I don’t write code, and I use GitLab every day. + +The GNOME project has been managed a lot of ways over the past two decades. Different parts of the project used different systems to track changes to code, collaborate, and share information both as a project and as a social space. However, the project made the decision that it needed to become more integrated and it took about a year from conception to completion. + +There were a number of reasons GNOME wanted to switch to a single tool for use across the community. External projects touch GNOME, and providing them an easier way to interact with resources was important for the project, both to support the community and to grow the ecosystem. We also wanted to better track metrics for GNOME—the number of contributors, the type and number of contributions, and the developmental progress of different parts of the project. + +When it came time to pick a collaboration tool, we considered what we needed. One of the most important requirements was that it must be hosted by the GNOME community; being hosted by a third party didn’t feel like an option, so that discounted services like GitHub and Atlassian. And, of course, it had to be free software. It quickly became obvious that the only real contender was GitLab. We wanted to make sure contribution would be easy. GitLab has features like single sign-on, which allows people to use GitHub, Google, GitLab.com, and GNOME accounts. + +We agreed that GitLab was the way to go, and we began to migrate from many tools to a single tool. GNOME board member [Carlos Soriano][7] led the charge. With lots of support from GitLab and the GNOME community, we completed the process in May 2018. + +There was a lot of hope that moving to GitLab would help grow the community and make contributing easier. Because GNOME previously used so many different tools, including Bugzilla and CGit, it’s hard to quantitatively measure how the switch has impacted the number of contributions. We can more clearly track some statistics though, such as the nearly 10,000 issues closed and 7,085 merge requests merged between June and November 2018. People feel that the community has grown and become more welcoming and that contribution is, in fact, easier. + +People come to free software from all sorts of different starting points, and it’s important to try to even out the playing field by providing better resources and extra support for people who need them. Git, as a tool, is widely used, and more people are coming to participate in free software with those skills ready to go. Self-hosting GitLab provides the perfect opportunity to combine the familiarity of Git with the feature-rich, user-friendly environment provided by GitLab. + +It’s been a little over a year, and the change is really noticeable. Continuous integration (CI) has been a huge benefit for development, and it has been completely integrated into nearly every part of GNOME. Teams that aren’t doing code development have also switched to using the GitLab ecosystem for their work. Whether it’s using issue tracking to manage assigned tasks or version control to share and manage assets, even teams like Engagement and I&D have taken up using GitLab. + +It can be hard for a community, even one developing free software, to adapt to a new technology or tool. It is especially hard in a case like GNOME, a project that [recently turned 22][8]. After more than two decades of building a project like GNOME, with so many parts used by so many people and organizations, the migration was an endeavor that was only possible thanks to the hard work of the GNOME community and generous assistance from GitLab. + +I find a lot of convenience in working for a project that uses Git for version control. It’s a system that feels comfortable and is familiar—it’s a tool that is consistent across workplaces and hobby projects. As a new member of the GNOME community, it was great to be able to jump in and just use GitLab. As a community builder, it’s inspiring to see the results: more associated projects coming on board and entering the ecosystem; new contributors and community members making their first contributions to the project; and increased ability to measure the work we’re doing to know it’s effective and successful. + +It’s great that so many teams doing completely different things (such as what they’re working on and what skills they’re using) agree to centralize on any tool—especially one that is considered a standard across open source. As a contributor to GNOME, I really appreciate that we’re using GitLab. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-gnome-uses-git + +作者:[Molly de Blanc][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/mollydb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna (red panda) +[2]: https://www.gnome.org/foundation/ +[3]: https://gnome.org/ +[4]: https://www.gtk.org/ +[5]: https://gstreamer.freedesktop.org/ +[6]: https://gitlab.gnome.org/ +[7]: https://twitter.com/csoriano1618?lang=en +[8]: https://opensource.com/article/19/8/poll-favorite-gnome-version diff --git a/sources/talk/20191015 The Emergence of Edge Analytics in the IoT Ecosystem.md b/sources/talk/20191015 The Emergence of Edge Analytics in the IoT Ecosystem.md new file mode 100644 index 0000000000..e7cca334fb --- /dev/null +++ b/sources/talk/20191015 The Emergence of Edge Analytics in the IoT Ecosystem.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Emergence of Edge Analytics in the IoT Ecosystem) +[#]: via: (https://opensourceforu.com/2019/10/the-emergence-of-edge-analytics-in-the-iot-ecosystem/) +[#]: author: (Shashidhar Soppin https://opensourceforu.com/author/shashidhar-soppin/) + +The Emergence of Edge Analytics in the IoT Ecosystem +====== + +[![][1]][2] + +_Edge analytics involves processing, collecting and analysing data near its source so that not all of it is sent to the cloud. This is crucial when massive volumes of data are generated by numerous devices. It saves a lot of time and reduces latency._ + +The exponential proliferation of IoT devices and IoT based platforms is leading to multiple complex scenarios. Such sudden growth and scalability need a lot of analytics to be done for better predictions and choices. IoT analytics will become more complex and challenging when the number of IoT devices grows even further. A good analytics system will become crucial for any IoT environment to succeed and be more robust. + +Making any sense out of IoT data needs good and efficient analytics. This may not always be Big Data (volume, velocity and variety of data). There are many other categories of analytics, like simple past event review, or more advanced analytics using historical data to make predictions about outcomes, etc. + +**What is analytics?** +Analytics (for IoT) is the science and art of trying to find matching patterns in the huge quantity of data (it could be Big Data, or otherwise) generated by connected and smart devices. In layman’s terms, this can be defined as simply as monitoring trends and finding any abnormalities. + +Listed below are some of the well-known analytics methodologies or types: + + * Descriptive analytics tells us what is happening + * Diagnostics analytics tells us why it happened + * Predictive analytics tells us what is likely to happen + * Prescriptive analytics tells us what should be done to prevent something from happening + + + +Today, there are various tools and technologies available for analytics. Many of the enterprises now expect to have intelligence or analytics sit on the platform itself for better monitoring and live streaming capabilities. Processing historical data from the cloud or any other outside means takes time and adds latency to the entire response time. Analytics using microservices based technologies is also one trend observed recently. + +Each of the existing IoT solutions may not need analytics to be done. Listed below are some types of analytics that can be performed: + + * Generating basic reports + * Real-time stream analytics + * Long-term data analytics + * Large-scale data analytics + * Advanced data analytics + + + +Once the data is acquired from any selected source, it has to be pre-processed to identify missing values and for the purpose of scaling the data. Once the pre-processing is done,‘feature extraction’ needs to be carried out. From feature extraction, we can identify any significant information that helps in improving subsequent steps. + +**Basic analysis** +This analysis typically involves Big Data and will, most of the time, involve descriptive and diagnostic kinds of analytics. + +This is the era of edge analytics. Many of the industries that work on IoT based solutions and frameworks use it, and it is expected to become ‘the next big thing’ in the coming days. At present, there are many tools and technologies that deal with edge analytics. + +**Edge analytics and the IoT tools** +This is an analysis done at the source, by processing, collecting and analysing the data instead of sending it to the cloud or server for processing and analysis. This saves a lot of time and avoids latency. By using edge analytics, most problems in today’s world can be solved. + +According to Gartner’s predictions, by 2020, more than half the major new business processes and systems will incorporate some element of IoT. Analytics will become one of the key aspects of any of these IoT systems/sub-systems. It will support the decision-making process in related operations and help in business transformation. +A brief introduction of some of the well-known open source IoT tools for edge analytics follows. + +**EdgeX Foundry:** This is an open source project that is hosted by the Linux Foundation. It provides interoperability, can be hosted within the hardware and is an OS-agnostic software platform. The EdgeX ecosystem can be used as plug-and-play with support for multiple components, and this can be easily deployed as an IoT solution with edge analytics. EdgeX Foundry can be deployed using microservices as well. + +**Website:** __ + +**Eclipse Kura:** Eclipse Kura is one more popular open source IoT edge framework. It is based on Java/OSGi and offers API based access to the underlying hardware interface of IoT gateways (for serial ports, watchdog, GPS, I2C, etc). The Kura architecture can be found at __. + +Kura components are designed as configurable OSGi based and declarative services, which are exposed service APIs. Most of the Kura components are purely Java based, while others can be invoked through JNI, and generally have a dependency on the Linux operating system. + +**Eclipse Kapua:** Eclipse Kapua is a modular IoT cloud platform that is mainly used to manage and integrate devices and their data. Kapua comes loaded with the following features. + + * **Connect:** Many of the IoT devices can be connected to Kapua using MQTT and other protocols. + * **Manage:** The management of a device’s applications, configurations and resources can be easily done. + * **Store and analyse:** Kapua helps in storing and indexing the data published by IoT devices for quick and easy analysis, and later visualisation in the dashboard. + * **Integrate:** Kapua services can be easily integrated with various IT applications through flexible message routing and ReST based APIs. + + + +**Website:** __ + +As mentioned earlier and based on Gartner analysis, edge analytics will become one of the leading tech trends in the coming months. The more analysis that is done at the edge, the more sophisticated and advanced the whole IoT ecosystem will become. There will come a day where M2M communication may happen independently, without much human intervention. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-emergence-of-edge-analytics-in-the-iot-ecosystem/ + +作者:[Shashidhar Soppin][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://opensourceforu.com/author/shashidhar-soppin/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Graph-Analytics-1.jpg?resize=696%2C464&ssl=1 (Graph Analytics) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Graph-Analytics-1.jpg?fit=800%2C533&ssl=1 diff --git a/sources/talk/20191015 The software-defined data center drives agility.md b/sources/talk/20191015 The software-defined data center drives agility.md new file mode 100644 index 0000000000..3223692cad --- /dev/null +++ b/sources/talk/20191015 The software-defined data center drives agility.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The software-defined data center drives agility) +[#]: via: (https://www.networkworld.com/article/3446040/the-software-defined-data-center-drives-agility.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +The software-defined data center drives agility +====== +The value of SDN is doing as much as possible in the software so you don’t depend on the delivery of new features to come from a new generation of the hardware. +monsitj / Getty Images + +In this day and age, demands on networks are coming from a variety of sources, internal end-users, external customers and via changes in the application architecture. Such demands put pressure on traditional architectures. + +To deal effectively with these demands requires the network domain to become more dynamic. For this, we must embrace digital transformation. However, current methods are delaying this much-needed transition. One major pain point that networks suffer from is the necessity to dispense with manual working, which lacks fabric wide automation. This must be addressed if organizations are to implement new products and services ahead of the competition. + +So, to evolve, to be in line with the current times and use technology as an effective tool, one must drive the entire organization to become a digital enterprise. The network components do play a key role, but the digital transformation process is an enterprise-wide initiative. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Digital transformation and network visibility + +As a part of this transformation, the network is no longer considered a black box. Now the network is a source for deep visibility that can aid a large set of use cases like network performance, monitoring, security and capacity planning, to name a few. However, in spite of such critical importance visibility is often overlooked. + +We need the ability to provide deep visibility for the application at a flow level. Rationally, today if you want anything comparable, you would deploy a redundant monitoring network. Such a network would consist of probes, packet brokers and various tools to process the packet for metadata. + +A more viable solution would integrate the network visibility into the fabric and therefore would not need a bunch of components. This enables us to do more with the data and aids with agility for ongoing network operations. There will always be some kind of requirement for application optimization or a security breach. And this is where visibility can help you iron out such issues quickly. + +### Gaining agility with SDN + +When increasing agility, what is useful is the building of a complete network overlay. An overlay is a solution that is abstracted from the underlying physical infrastructure in a certain way. + +**[ Related: [MPLS explained – What you need to know about multi-protocol label switching][2]** + +What this means is that we are separating and disaggregating the customer applications or services from the network infrastructure. This is more like a sandbox or private network for each application that is on an existing network. This way we are empowered with both the SDN controller and controllerless options. Both [data center architectures][3] _[Disclaimer: The author is employed by Network Insight]_ have their advantages and disadvantages. + +Traditionally, the deployment of an application to the network involves propagating the policy to work through the entire infrastructure. Why? Because the network simply acts as an underlay and the segmentation rules configured on this underlay are needed to separate different applications and services. This, ultimately, creates a very rigid architecture that is unable to react quickly and adapt to the changes, therefore lacking agility. In essence, the applications and the physical network are tightly coupled. + +[Virtual networks][4] are mostly built from either the servers or ToR switches. Either way, the underlying network transports the traffic and doesn’t need to be configured to accommodate the customer application. That is all carried in the overlay. By and large, everything happens in the overlay network which is most efficient when done in a fully distributed manner. + +Now the application and service deployment occur without touching the network. Once the tight coupling between the application and network is removed, increased agility and simplicity of deploying applications and services are created. + +### Where do your features live? + +Some vendors build into the hardware the differentiator of the offering. With different hardware, you can accelerate the services. With this design, the hardware level is manipulated, but it does not use the standard Open Networking protocols. The result is that you are 100% locked, unable to move as the cost of moving is too much. + +You could have numerous generations: for example, line cards, all the line cards have different capabilities, resulting in a complex feature matrix. When the Cisco Nexus platform first came out, I was onsite as a TDA trying to bring in some redundancy into the edge/access layer. + +When the virtual PortChannel (vPC) came out they were several topologies and some of these topologies were only available on certain hardware. As it’s just a topology, it would have been useful to have it across all line cards. This is the world of closed networking, which has been accepted as the norm until now. + +### Open networking + +Traditionally, networking products were a combination of the hardware and software that had to be purchased together as an integrated solution. Open Networking, on the other hand, is the disaggregation of hardware from the software. This basically allows IT to mix and match at will. + +With Open Networking, you are not reinventing the way packets are forwarded, or the way routers communicate with each other. Why? Because, with Open Networking, you are never alone and never the only vendor. You need to adapt and fit, and for this, you need to use open protocols. + +The value of SDN is doing as much as possible in the software so you don’t depend on the delivery of new features to come from a new generation of the hardware. You want to put as much intelligence as possible into the software, thus removing the intelligence from the physical layer. + +You don’t want to build the hardware features; instead, you want to use the software to provide the new features. This is an important philosophy and is the essence of Open Networking. From the customer's point of view, they get more agility as they can move from generation to generation of services without having hardware dependency. They don’t have to incur the operational costs of swapping out the hardware constantly. + +### First steps + +It is agreed that agility is a necessity. So, what is the prime step? One of the key steps is to create a software-defined data center that will allow the rapid deployment of compute and storage for the workloads. In addition to software-defined compute and storage, the network must be automated and not be an impediment. + +Many organizations assume that to achieve agility, we must move everything to the cloud. Migrating workloads to the cloud indeed allow organizations to be competitive and equipped with the capabilities of a much larger organization. + +Only a small proportion can adopt a fully cloud-native design. More often than not, there will always be some kind of application that needs to stay on-premise. In this case, the agility in the cloud needs to be matched by the on-premise infrastructure. This requires the virtualization of the on-premise compute, storage and network components. + +Compute and storage, affordable software control, and virtualization have progressed dramatically. However, the network can cause a lag. Solutions do exist but they are complex, expensive and return on investment (ROI) is a stretch. Therefore, such solutions are workable only for the largest enterprises. This creates a challenge for mid-sized businesses that want to virtualize the network components. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446040/the-software-defined-data-center-drives-agility.html + +作者:[Matt Conran][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/Matt-Conran/ +[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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/2297171/sd-wan/network-security-mpls-explained.html +[3]: https://network-insight.net/2014/08/data-center-topologies/ +[4]: https://youtu.be/-Yjk0GiysLI +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191016 Drupal shows leadership on diversity and inclusion.md b/sources/talk/20191016 Drupal shows leadership on diversity and inclusion.md new file mode 100644 index 0000000000..945d92acef --- /dev/null +++ b/sources/talk/20191016 Drupal shows leadership on diversity and inclusion.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drupal shows leadership on diversity and inclusion) +[#]: via: (https://opensource.com/article/19/10/drupals-diversity-initiatives) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +Drupal shows leadership on diversity and inclusion +====== +Drupal's Diversity & Inclusion Group is taking an innovative approach to +bringing attention to underrepresented groups in open source. +![Two diverse hands holding a globe][1] + +I didn't expect [DrupalCon Seattle][2]'s opening keynote to address the barriers that hold people back from making open source contributions. So imagine my surprise when Dries Buytaert, Drupal's project lead and co-founder and CTO of Acquia, which created Drupal, [used his time onstage][3] to share an apology. + +> _"I used to think anyone could contribute to Drupal if they just had the will. I was wrong—many people don't contribute to open source because they don't have the time."_ +> — Dries Buytaert + +Buytaert [disproved the long-held belief][4] that open source is a meritocracy. The truth is that anyone who has free time to do ongoing, unpaid work is more privileged than most. If you're working a second job, caring for aging parents, or earning less due to systemic wage gaps for people of color, you can't start your open source career on equal ground. + +> I wonder if a personal story will help :) In the past year, I dedicated my life to [#drupaldiversity][5]. The bridges that helped us achieve success at the highest level this year were often at a personal cost of my nights, weekends, and personal life. +> +> — Fatima (she/her) (@sugaroverflow) [April 15, 2019][6] + +### Increasing diversity and inclusion in Drupal + +Buytaert's keynote highlighted the Drupal project's commitment to diversity—and diversifying. + +For example, the Drupal Association awards grants, scholarships, and money from its inclusion fund to contributors of minority status so they can travel and attend the Association's DrupalCon events. Recently, 18 contributors [received awards][7] to attend [DrupalCon Amsterdam][8] in late October. + +In addition, the all-volunteer [Drupal Diversity & Inclusion][9] (DDI) collective works to diversify Drupal's speaker base. All of DDI's projects are open for anyone to work on in the [Drupal Diversity][10] or [DDI Contrib][11] project repositories. + +In its August newsletter, DDI shared another way it seeks to expand awareness of diverse populations. The group starts each of its weekly meetings by asking members where they're from and to acknowledge the indigenous history of the land they live on. In July, DDI launched a related project: [Land Acknowledgements][12], which invites Drupal community members to research their homelands' indigenous histories and share them in a community blog post. + +This project caught my eye, and I made a [contribution][13] about the indigenous history of Montgomery County, Maryland, where I live. This project is still open: [anyone can add their research][14] to the blog post. + +To learn more, I interviewed [Alanna Burke][15], a Drupal developer who helps lead the Land Acknowledgements project. Our conversation has been edited for length and clarity. + +### Acknowledging indigenous history + +**Lauren Maffeo:** Describe Drupal's Land Acknowledgments project. How did the idea for this project come about, and what is its end goal? + +**Alanna Burke:** In our weekly Slack meetings, we ask everyone to introduce themselves and do a land acknowledgment. I'm not sure when we started doing that. One week, I had the idea that it would be really neat to have folks do a little more research and contribute it back into a blog post—we do these acknowledgments, but without more context or research, they're not very meaningful. We wanted people to find out more about the land that they live on and the indigenous people who, in many cases, still live there. + +**LM:** How long will you accept contributions to the project? Do you have an ultimate goal for project contributions? + +**AB:** Right now, we intend to accept contributions for as long as people want to send them in! + +**LM:** How many contributions have you received thus far? + +**AB:** We've had four contributions, plus mine. I think folks have been busy, but that's why we made the decision to keep contributions open. We don't have a goal in terms of numbers, but I'd love to see more people do the research into their land, learn about it, and find out something interesting they didn't know before. + +**LM:** Describe the response to this project so far. Do you have plans to expand it beyond Drupal to the broader open source community? + +**AB:** Folks seemed to think it was a really great idea! There were definitely a lot of people who wanted to participate but haven't found the time or who just mentioned that it was cool. We haven't discussed any plans to expand it, since we focus on the Drupal community, but I'd encourage any community to take this idea and run with it, see what your community members come up with! + +**LM:** Which leaders in the Drupal community have created and maintained this project? + +**AB:** Myself and the other members of the DDI leadership team: Tara King, Fatima Khalid, Marc Drummond, Elli Ludwigson, Alex Laughnan, and Alex McCabe + +**LM:** What are some 2019 highlights of Drupal's Diversity & Inclusion initiative? Which goals do you aim to achieve in 2020? + +**AB:** Our biggest highlight this year was the Speaker Diversity Workshop, which we held on September 28th. Jill Binder of the WordPress community led this free online workshop aimed at helping underrepresented folks prepare for speaking at camps and conferences. + +We are also going to hold an online [train-the-trainers workshop][16] on November 16th so communities can hold their own speaker workshops. + +In 2020, we'd like to build on these successes. We did a lot of fundraising and created a lot of great relationships in order to make this happen. We have a [handful of initiatives][17] that we are working on at any given time, so we'll be continuing to work on those. + +**LM:** How can Opensource.com readers contribute to the Land Acknowledgements post and other Drupal D&I initiatives? + +**AB:** Check out [the doc][14] in the issue. Spend a little time doing research, write up a few paragraphs, and submit it! Or, start up an initiative in your community to do land acknowledgments in your meetings or do a collaborative post like ours. Do land acknowledgments as part of events like camps and conferences. + +To get involved in DDI, check out our [guide][18]. We have [an issue queue][10], and we meet in Slack every Thursday for a text-only meeting. + +**LM:** Do you have statistics for how many women and people of minority status (gender, sexuality, religion, etc.) contribute to the Drupal project? If so, what are they? + +**AB:** We have some numbers—we'd love to have more. This [post][19] has some breakdowns, but here's the gist from 2017-2018, the latest we have: + + * [Drupal.org][20] received code contributions from 7,287 different individuals and 1,002 different organizations. + * The reported data shows that only 7% of the recorded contributions were made by contributors that do not identify as male, which continues to indicate a steep gender gap. + * When measuring geographic diversity, we saw individual contributors from six different continents and 123 different countries. + + + +Recently, we have implemented [Open Demographics][21] on Drupal.org, a project by DDI's founder, Nikki Stevens. We hope this will give us better demographic data in the future. + +### Closing the diversity gap in open source + +Drupal is far from alone among [open source communities with a diversity gap][22], and I think it deserves a lot of credit for tackling these issues head-on. Diversity and inclusion is a much broader topic than most of us realize. Before I read DDI's August newsletter, the history of indigenous people in my community was something that I hadn't really thought about before. Thanks to DDI's project, I'm not only aware of the people who lived in Maryland long before me, but I've come to appreciate and respect what they brought to this land. + +I encourage you to learn about the native people in your homeland and record their history in DDI's Land Acknowledgements blog. If you're a member of another open source project, consider replicating this project there.  + +Open source research often paints the community as a homogeneous landscape. I have collected... + +Egle Sigler, Kavit Munshi, and Carol Barrett talk about the importance of diversity in the... + +Diversity has a new full-time ally. Marina Zhurakhinskaya recently won an O'Reilly award for her... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/drupals-diversity-initiatives + +作者:[Lauren Maffeo][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/lmaffeo +[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://events.drupal.org/seattle2019 +[3]: https://www.youtube.com/watch?v=BNoCn6T9Xf8 +[4]: https://dri.es/the-privilege-of-free-time-in-open-source +[5]: https://twitter.com/hashtag/drupaldiversity?src=hash&ref_src=twsrc%5Etfw +[6]: https://twitter.com/sugaroverflow/status/1117876869590728705?ref_src=twsrc%5Etfw +[7]: https://events.drupal.org/amsterdam2019/grants-scholarships +[8]: https://events.drupal.org/amsterdam2019 +[9]: https://opencollective.com/drupal-diversity-and-inclusion +[10]: https://www.drupal.org/project/issues/diversity +[11]: https://www.drupal.org/project/issues/ddi_contrib +[12]: https://www.drupaldiversity.com/blog/2019/land-acknowledgments +[13]: https://www.drupal.org/project/diversity/issues/3063065#comment-13234777 +[14]: https://www.drupal.org/project/diversity/issues/3063065 +[15]: https://www.drupal.org/u/aburke626 +[16]: https://www.drupaldiversity.com/blog/2019/learn-how-hold-your-own-speaker-diversity-workshop-saturday-november-16 +[17]: https://www.drupaldiversity.com/initiatives +[18]: https://www.drupaldiversity.com/get-involved +[19]: https://dri.es/who-sponsors-drupal-development-2018 +[20]: http://Drupal.org +[21]: https://www.drupal.org/project/open_demographics +[22]: https://opensource.com/resources/diversity-open-source diff --git a/sources/talk/20191017 Data center liquid-cooling to gain momentum.md b/sources/talk/20191017 Data center liquid-cooling to gain momentum.md new file mode 100644 index 0000000000..fb1ea1cdac --- /dev/null +++ b/sources/talk/20191017 Data center liquid-cooling to gain momentum.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data center liquid-cooling to gain momentum) +[#]: via: (https://www.networkworld.com/article/3446027/data-center-liquid-cooling-to-gain-momentum.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Data center liquid-cooling to gain momentum +====== +The serious number-crunching demands of AI, IoT and big data - and the heat they generate - may mean air cooling is on its way out. +artisteer / Getty Images + +Concern over escalating energy costs is among reasons liquid-cooling solutions could gain traction in the [data center][1]. + +Schneider Electric, a major energy-management specialist, this month announced refreshed impetus to a collaboration conceived in 2014 with [liquid-cooling specialist Iceotope][2]. Now, [technology solutions company Avnet has been brought into that collaboration][3]. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +The three companies will develop chassis-level immersive liquid cooling for data centers, Schneider Electric says in a [press release][5]. Liquid-cooling systems submerge server components in a dielectric fluid as opposed to air-cooled systems which create ambient cooled air. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +One reason for the shift: “Compute-intensive applications like AI and [IoT][7] are driving the need for better chip performance,” Kevin Brown, CTO and SVP of Innovation, Secure Power, Schneider Electric, is quoted as saying. + +“Liquid Cooling [is] more efficient and less costly for power-dense applications,” the company explains. That’s in part because the use of Graphical Processing Units (GPUs) is replacing some traditional processing, and is gaining ground. GPUs are better suited to data-mining-type applications than traditional processors. They parallel-process and are now used extensively in artificial intelligence compute environments and processor-hungry analytics churning big data. + +“This makes traditional data-center air-cooled architectures impractical, or costly and less efficient than liquid-cooled approaches.” Reasons liquid-cooling may become a new go-to cooling solution is also related to “space constraints, water usage restrictions and harsh IT environments,” [Schneider said in a white paper earlier this year][8]: + +As chip density increases, and the resulting rack-space that is required to hold the gear decreases, the need for traditional air-based cooling-equipment space keeps going up. So even as greater computing density decreases the space the equipment occupies, the space required for air-cooling it increases. The heat created is so great with GPUs that it stops being practical to air-cool. + +Additionally, as edge data centers become more important there’s an advantage to using IT that can be placed anywhere. “As the demand for IT deployments in urban areas, high rise buildings, and at the Edge increase, the need for placement in constrained locations will increase,” the paper says. In such scenarios, not requiring space for hot and cold aisles would be an advantage. + +Liquid cooling would allow for silent operation, too; there aren’t any fans and pumps making disruptive noise. + +Liquid cooling would also address restrictions on water useage that can affect the ability to use evaporative cooling and cooling towers to carry off heat generated by data centers. Direct-to-chip liquid-cooling systems of the kind the three companies want to concentrate their efforts on narrowly target the cooling at the server, not at the building level. + +In harsh environments such as factories and [industrial IoT][9] deployments, heat and air quality can hinder air-cooling systems. Liquid-cooling systems can be self-contained in sealed units, thus being protected from dust, for example. + +Interestingly, as serious computer gamers will know, liquid cooling isn’t a new technology, [Wendy Torell points out in a Schneider blog post][10] pitching the technology. “It’s been around for decades and has historically focused on mainframes, high-performance computing (HPC), and gaming applications,” she explains. “Demand for IoT, artificial intelligence, machine learning, big data analytics, and edge applications is once again bringing it into the limelight.” + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446027/data-center-liquid-cooling-to-gain-momentum.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/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: http://www.iceotope.com/about +[3]: https://www.avnet.com/wps/portal/us/about-avnet/overview/ +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.prnewswire.com/news-releases/schneider-electric-announces-partnership-with-avnet-and-iceotope-to-develop-liquid-cooled-data-center-solutions-300929586.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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[8]: https://www.schneider-electric.us/en/download/search/liquid%20cooling/?langFilterDisabled=true +[9]: https://www.networkworld.com/article/3243928/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[10]: https://blog.se.com/datacenter/2019/07/11/not-just-about-chip-density-five-reasons-consider-liquid-cooling-data-center/ +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191017 Measuring the business value of open source communities.md b/sources/talk/20191017 Measuring the business value of open source communities.md new file mode 100644 index 0000000000..d270340f91 --- /dev/null +++ b/sources/talk/20191017 Measuring the business value of open source communities.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Measuring the business value of open source communities) +[#]: via: (https://opensource.com/article/19/10/measuring-business-value-open-source) +[#]: author: (Jon Lawrence https://opensource.com/users/the3rdlaw) + +Measuring the business value of open source communities +====== +Corporate constituencies are interested in finding out the business +value of open source communities. Find out how to answer key questions +with the right metrics. +![Lots of people in a crowd.][1] + +In _[Measuring the health of open source communities][2]_, I covered some of the key questions and metrics that we’ve explored as part of the [CHAOSS project][3] as they relate to project founders, maintainers, and contributors. In this article, we focus on open source corporate constituents (such as open source program offices, business risk and legal teams, human resources, and others) and end users. + +Where the bulk of the metrics for core project teams are quantitative, for the remaining constituents our metrics must reflect a much broader range of interests, and address many more qualitative measures. From the metrics collection standpoint, much of the data collection for qualitative measures is much more manual and subjective, but it is nonetheless within the scope CHAOSS hopes to be able to address as the project matures. + +While people on the business side of things do sometimes care about the metrics in use by the project itself, there are only two fundamental questions that corporate constituencies have. The first is about _value_: "Will this choice help our business make more money sooner?" The second is about _risk_: "Will this choice hurt our business’s chances of making money?" + +Those questions can come in many different iterations across disciplines, from human resources to legal counsel and executive offices. But, at the end of the day, having answers that are based on data can make open source engagement more efficient, effective, and less risky. + +Once again, the information below is structured in a Goal-Question-Metric format: + + * Open source program offices (OSPOs) + * As an OSPO leader, I care about prioritizing our resources toward healthy communities: + * How [active][4] is the community? +**Metric:** [Code development][5] \- The number of commits and pull requests, review time for new code commits and pull requests, code reviews and merges, the number of accepted vs. rejected pull requests, and the frequency of new version releases. +**Metric:** [Issue resolution][6] \- The number of new issues, closed issues, the ratio of new vs. closed issues, and the average open time per issue. +**Metric:** Social - Social media mention counts, social media sentiment analysis, the activity of community blog, and news releases (_future release_). + * What is the [value][7] of our contributions to the project? (This is an area in active development.) +**Metric:** Time value - Time saved for training developers on new technologies, and time saved maintaining custom development once the improvements are upstreamed. +**Metric:** Dollar value - How much would it have cost to maintain changes and custom solutions internally, versus contributing upstream and ensuring compatibility with future community releases + * What is the value of contributions to the project by other contributors and organizations? +**Metric:** Time value - Time to market, new community-developed features released, and support for the project by the community versus the company. +**Metric:** Dollar value - How much would it cost to internally rebuild the features provided by the community, and what is the opportunity cost of lagging behind innovations in open source projects? + * Downstream value: How many other projects list our project as a dependency? +**Metric:** The value of the ecosystem that is around a project. + * How many forks of our project have there been? +**Metric:** Are core developers more active in the mainline or a fork? +**Metric:** Are the forks contributing back to the mainline, or developing in new directions? + * Engineering leadership + * As an approving architect, I care most about good design patterns that introduce a minimum of technical debt. +**Metric:** [Test Coverage][8] \- What percentage of the code is tested? +**Metric:** What is the percentage of code undergoing code reviews? +**Metric:** Does the project follow [Core][9] [Infrastructure][9] [Initiative (CII) Best Practices][9]? + * As an engineering executive, I care most about minimizing time-to-market and bugs, and maximizing platform stability and reliability. +**Metric:** The defect resolution velocity. +**Metric:** The defect density. +**Metric:** The feature development velocity. + * I also want social proofs that give me a level of comfort. +**Metric:** Sentiment analysis of social media related to the project. +**Metric:** Count of white papers. +**Metric:** Code Stability - Project version numbers and the frequency of new releases. + + + +There is also the issue of legal counsel. This goal statement is: "As legal counsel, I care most about minimizing our company’s chances of getting sued." The question is: "What kind of license does the software have, and what obligations do we have under the license?" + +The metrics involved here are: + + * **Metric:** [License Count][10] \- How many different licenses are declared in a given project? + * **Metric:** [License Declaration][11] \- What kinds of licenses are declared in a given project? + * **Metric:** [License Coverage][12] \- How much of a given codebase is covered by the declared license? + + + +Lastly, there are further goals our project is considering to measure the impact of corporate open source policy as it relates to talent acquisition and retention. The goal for human resource managers is: "As an HR manager, I want to attract and retain the best talent I can." The questions and metrics are as follows: + + * What impact do our open source policies have on talent acquisition? +**Metric:** Talent acquisition - Measure over time how many candidates report that it’s important to them that they get to work with open source technologies. + * What impact do our open source policies have on talent retention? +**Metric:** Talent retention - Measure how much employee churn can be reduced because of people being able to work with or use open source technologies. + * What is the impact on training employees who can learn from engaging in open source projects? +**Metric:** Talent development - Measure over time the importance to employees of being able to use open source tech effectively. + * How does allowing employees to work in a community outside of the company impact job satisfaction? +**Metric:** Talent satisfaction - Measure over time the importance to employees of being able to contribute to open source tech. +**Source:** Internal surveys. +**Source:** Exit interviews. Did our policies around open source technologies at all influence your decision to leave? + + + +### Wrapping up + +It is still the early days of building a platform for bringing together these disparate data sources. The CHAOSS core of [Augur][13] and [GrimoireLab][14] currently supports over two dozen sources, and I’m excited to see what lies ahead for this project. + +As the CHAOSS frameworks mature, I’m optimistic that teams and projects that implement these types of measurement will be able to make better real-world decisions that result in healthier and more productive software development lifecycles. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/measuring-business-value-open-source + +作者:[Jon Lawrence][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/the3rdlaw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community_1.png?itok=rT7EdN2m (Lots of people in a crowd.) +[2]: https://opensource.com/article/19/8/measure-project +[3]: https://github.com/chaoss/ +[4]: https://github.com/chaoss/wg-evolution/blob/master/focus_areas/community_growth.md +[5]: https://github.com/chaoss/wg-evolution#metrics +[6]: https://github.com/chaoss/wg-evolution/blob/master/focus_areas/issue_resolution.md +[7]: https://github.com/chaoss/wg-value +[8]: https://chaoss.community/metric-test-coverage/ +[9]: https://github.com/coreinfrastructure/best-practices-badge +[10]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Count.md +[11]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Declared.md +[12]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Coverage.md +[13]: https://github.com/chaoss/augur +[14]: https://github.com/chaoss/grimoirelab diff --git a/sources/talk/20191017 Pennsylvania school district tackles network modernization.md b/sources/talk/20191017 Pennsylvania school district tackles network modernization.md new file mode 100644 index 0000000000..aac55035c6 --- /dev/null +++ b/sources/talk/20191017 Pennsylvania school district tackles network modernization.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pennsylvania school district tackles network modernization) +[#]: via: (https://www.networkworld.com/article/3445976/pennsylvania-school-district-tackles-network-modernization.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Pennsylvania school district tackles network modernization +====== +NASD upgrades its campus core to be the foundation for digital learning. +Wenjie Dong / Getty Images + +Success in business and education today starts with infrastructure modernization. In fact, my research has found that digitally-forward organizations spend more than twice what their non-digital counterparts spend on evolving their IT infrastructure. However, most of the focus from IT has been on upgrading the application and compute infrastructure with little thought given to a critical ingredient – the network. Organizations can only be as agile as the least agile component of their infrastructure, and for most companies, that’s the network. + +### Manual processes plague network reliability + +Legacy networks have outlived their useful life. The existing three+ tier architecture was designed for an era when network traffic was considered “best-effort,” where there was no way to guarantee performance or reserve bandwidth, and delivered non-mission-critical applications. Employees and educators ran applications locally, and the majority of critical data resided on workstations. + +Today, everything has changed. Applications have moved to the cloud, workers are constantly on the go, and companies are connecting things to business networks at an unprecedented rate. One could argue that, for most organizations, the network is the business. Consider what’s happened in our personal lives. People stream content, communicate using video, shop online, and rely on the network for almost every aspect of their lives. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The same thing is happening to digital organizations. Companies today must support the needs of applications that are becomingly increasingly dynamic and distributed. An unavailable or poorly performing network means the organization comes to a screeching halt. + +Yet network engineering teams working with legacy networks can’t keep up with demands; the rigid and manual processes required to hard-code configuration are slow and error-prone. In fact, ZK Research found that the largest cause of downtime with legacy networks is from human errors. + +Given the importance of the network, this kind of madness must stop. Businesses will never be able to harness the potential of digital transformation without modernizing the network. + +What’s required is a network that is more dynamic and intelligent, one that simplifies operations via automation. This can lead to better control and faster error detection, diagnosis and resolution. These buzzwords have been tossed around by many vendors and customers as the vision of where we are headed – yet it's been difficult to find actual customer deployments. + +### NASD modernizes wired and wireless network to support digital curriculum + +The Nazareth Area School District (NASD).recently went through a network modernization project. + +The Eastern Pennsylvania school district, which has roughly 4,800 students, has a bold vision: to inspire students to be innovative, collaborative and constructive members of the community who embrace the tenets of diversity, value, education and honesty. NASD aims to accomplish its vision by helping students build a strong worth ethic and sense of responsibility and by challenging them to be leaders and good global citizens. + +To support its goals, NASD set out to completely revamp the way it teaches. The district embraced a number of modern technologies that would foster immersive learning and collaboration. + +There's a heavy emphasis on science, technology, engineering, arts and mathematics (STEAM), which drives more focus on coding, robotics, and virtual and augmented reality. For example, the teachers are using Google Expeditions VR Classroom kits to integrate VR into the classroom. In addition, NASD has converted many of its classrooms into “affinity rooms” where students can work together on different projects in the areas of VR, AR, robotics, stop motion photography, and other advanced technologies. + +NASD understood that modernizing education requires a modernized network. If new tools and applications don’t perform as expected, it can hurt the learning process as students sit around waiting while network problems are solved. The district knew it needed to upgrade its network to one that was more intelligent, reliable and easier to diagnose. + +NASD chose Aruba, a Hewlett Packard Enterprise company, to be its wired and wireless networking supplier. + +In my opinion, the decision to upgrade the wired and wireless networks at the same time is a smart one. Many organizations put in a new Wi-Fi network only to find the wired backbone can’t support the traffic or doesn’t have the necessary reliability. + +The high-availability switches are running the new ArubaOS-CX operating system designed for the digital transformation era. The network devices are configured through a centralized graphical interface and not a command line interface (CLI), and they have an onboard Network Analytics Engine to reduce the complexity of running the network. + +NASD selected two Aruba 8320 switches to be the core of its network, to provide “utility-grade networking” that is always on and always available, much like power. + +“By running two switches in tandem, we would gain a fully redundant network that made failovers, whether planned or unplanned, completely undetectable by our users,” said Mike Fahey, senior application and network administrator at NASD. + +### Wanted: utility-grade Wi-Fi + +Utility-grade Wi-Fi was a must for NASD as almost all of the new learning tools connect via Wi-Fi only. The school system had been using two Wi-Fi vendors, neither of which performed well and required long troubleshooting periods. + +The Nazareth IT staff initially replaced the most problematic APs with Aruba APs. As this happened, Michael Uelses, director of IT, said that the teachers noticed a marked difference in Wi-Fi performance. Now, the entire school has standardized on Aruba’s gigabit Wi-Fi and has expanded it to outdoor locations. This has enabled the school to expand its security strategy and new emergency preparedness application to include playgrounds, parking lots and other outdoor areas where Wi-Fi previously did not reach. + +Supporting gigabit Wi-Fi required upgrading the backbone network to 10 Gigabit, which the Aruba 8320 switches support. The switches can also be upgraded to high speeds, up to 100 Gigabit, if the need arises. NASD is planning to expand the use of bandwidth-hungry apps such as VR to immerse students in subjects including biology and engineering. The option to upgrade the switches gives NASD the confidence it has made the right network choices for the future. + +What NASD is doing should be a message to all schools. Digital tools are here to stay and can change the way students learn. Success with digital education requires a rock-solid wired and wireless network to deliver utility-like services that are always on so students can always be learning. + +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/3445976/pennsylvania-school-district-tackles-network-modernization.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]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&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 diff --git a/sources/talk/20191018 VMware on AWS gets an on-premises option.md b/sources/talk/20191018 VMware on AWS gets an on-premises option.md new file mode 100644 index 0000000000..bfae9b8523 --- /dev/null +++ b/sources/talk/20191018 VMware on AWS gets an on-premises option.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware on AWS gets an on-premises option) +[#]: via: (https://www.networkworld.com/article/3446796/vmware-on-aws-gets-an-on-premises-option.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware on AWS gets an on-premises option +====== +Amazon Relational Database Service on VMware automates database provisioning for customers running VMware vSphere 6.5 or later, and it supports Microsoft SQL Server, PostgreSQL, and MySQL. +Getty Images + +VMware has taken another step to integrate its virtual kingdom with Amazon Web Services' world with an [on-premise service][1] that will let customers automate database provisioning and management.  + +The package, [Amazon Relational Database Service][2] (RDS) on VMware is available now for customers running VMware vSphere 6.5 or later and supports Microsoft SQL Server, PostgreSQL, and MySQL. Other DBs will be supported in the future, the companies said. + +****[**** Read also: [How to plan a software-defined data-center network][3] ****|**** [Get regularly scheduled insights by signing up for Network World newsletters.][4]**]** + +The RDS lets customers run native RDS Database instances on a vSphere platform and manage those instances from the AWS Management Console in the cloud. It automates database provisioning, operating-system and database patching, backups, point-in-time restore and compute scaling, as well as database-instance health management, VMware said. + +[][5] + +BrandPost Sponsored by HPE + +[HPE Synergy For Dummies][5] + +Here’s how IT can provide an anytime, anywhere, any workload infrastructure. + +With the service customers such as software developers and database administrators get native access to the Amazon Relational Database Service using their familiar AWS Management Console, CLI, and RDS APIs,  Chris Wolf, vice president and CTO, global field and industry at VMware wrote in a [blog][6] about the service. “Operations teams can quickly stand up an RDS instance anywhere they run vSphere, and manage it using all of their existing tools and processes.” + +Wolf said the service should greatly simplify managing databases linked to its flagship vSphere system.  + +Advertisement + +Managing databases on vSphere or natively has always been a tedious exercise that steals the focus of highly skilled database administrators, Wolf stated. “VMware customers will now be able to expand the benefits of automation and standardization of their database workloads inside of vSphere and focus more of their time and energy on improving their applications for their customers.” + +The RDS is just the part of the enterprise data center/cloud integration work VMware and AWS have been up to in the past year. + +In August [VMware said it added VMware HCX][7] capabilities to enable push-button migration and interconnectivity between VMware Cloud on AWS Software-Defined Data Centers running in different AWS Regions. It has also added new Elastic vSAN support to bolster storage scaling. + +Once applications are migrated to the cloud, customers can extend their capabilities  through the integration of native AWS services. In the future, through technology such as Bitfusion and partnerships with other vendors such as NVIDIA, customers will be able to enrich existing applications and power new enterprise applications. + +VMware and NVIDIA also announced their intent to deliver accelerated GPU services for VMware Cloud on AWS.  These services will let customers migrate VMware vSphere-based applications and containers to the cloud, unchanged, where they can be modernized to take advantage of high-performance computing, machine learning, data analytics and video-processing applications, VMware said. + +And last November [AWS tied in VMware][8] to its on-premises Outposts development, which comes in two versions. The first, VMware Cloud on AWS Outposts, lets customers  use the same VMware control plane and APIs they currently deploy. The other is an AWS-native variant that lets customers use the same APIs and control plane they use to run in the AWS cloud, but on premises, according to AWS. + +Outposts can be upgraded with the latest hardware and next-generation instances to run all native AWS and VMware applications, [AWS stated][9]. A second version, VMware Cloud on AWS Outposts, lets customers use a VMware control plane and APIs to run the hybrid environment. + +The idea with Outposts is that customers can use the same programming interface, same APIs, same console and CLI they use on the AWS cloud for on-premises applications, develop and maintain a single code base, and use the same deployment tools in the AWS cloud and on premises, AWS wrote. + +VMware isn’t the only vendor cozying up to AWS. Cisco has done a variety of integration work with the cloud service provider as well.  In [April Cisco released Cloud ACI for AWS][10] to let users configure inter-site connectivity, define policies and monitor the health of network infrastructure across hybrid environments, Cisco said. The AWS service utilizes the Cisco Cloud APIC [Application Policy Infrastructure Controller] to provide connectivity, policy translation and enhanced visibility of workloads in the public cloud, Cisco said. + +“This solution brings a suite of capabilities to extend your on-premises data center into true multi-cloud architectures, helping to drive policy and operational consistency, independent of where your applications or data reside. [It] uses the native AWS constructs for policy translation and gives end-to-end visibility into the customer's multi-cloud workloads and connectivity,” Cisco said. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446796/vmware-on-aws-gets-an-on-premises-option.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://aws.amazon.com/blogs/aws/now-available-amazon-relational-database-service-rds-on-vmware/ +[2]: https://blogs.vmware.com/vsphere/2019/10/how-amazon-rds-on-vmware-works.html +[3]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE19718&utm_content=sidebar (HPE Synergy For Dummies) +[6]: https://cloud.vmware.com/community/2019/10/16/announcing-general-availability-amazon-rds-vmware/ +[7]: https://www.networkworld.com/article/3434397/vmware-fortifies-its-hybrid-cloud-portfolio-with-management-automation-aws-and-dell-offerings.html +[8]: https://www.networkworld.com/article/3324043/aws-does-hybrid-cloud-with-on-prem-hardware-vmware-help.html +[9]: https://aws.amazon.com/outposts/ +[10]: https://www.networkworld.com/article/3388679/cisco-taps-into-aws-for-data-center-cloud-applications.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191019 To space and beyond with open source.md b/sources/talk/20191019 To space and beyond with open source.md new file mode 100644 index 0000000000..8bbb552e15 --- /dev/null +++ b/sources/talk/20191019 To space and beyond with open source.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (To space and beyond with open source) +[#]: via: (https://opensource.com/article/19/10/open-source-space-exploration) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari) + +To space and beyond with open source +====== +Open source projects are helping to satisfy our curiosity about what +lies far beyond Earth's atmosphere. +![Person looking up at the stars][1] + +Carl Sagan once said, "The universe is a pretty big place. If it's just us, seems like an awful waste of space." In that vast desert of seeming nothingness hides some of the most mysterious and beautiful creations humankind ever has—or ever will—witness. + +Our ancient ancestors looked up into the night sky and dreamed about space, just as we do today. Starting with simple, naked-eye observations of the sky and progressing to create [space telescopes][2] that uncover far reaches of the universe, we've come a long way toward understanding and redefining the concepts of time, space, and matter. Our exploration has provided some answers to humanity's enduring questions about the existence of extraterrestrial life, about the finite or infinite nature and origin of the universe, and so much more. And we still have so much to discover. + +### Curiosity, a crucial component for space exploration + +The Cambridge Dictionary defines [curiosity][3] as "an eager wish to know or learn about something." It's curiosity that fuels our drive to acquire knowledge about outer space, but what drives our curiosity, our "eager wish," in the first place? + +I believe that our curiosity is driven by the desire to escape the unpleasant feeling of uncertainty that is triggered by acknowledging our lack of knowledge. The intrinsic reward that comes from escaping uncertainty pushes us to find a correct (or at least a less wrong) answer to whatever question is at hand. + +If we want space discovery to advance at a faster pace, we need more people to become aware of the rewards that are waiting for them when they make the effort and discover answers for their questions about the universe. Space discovery is admittedly not an easy task, because finding correct answers requires following rigorous methods on a long-term scale. + +Luckily, open source initiatives are emerging that make it easier for people to get started exploring and enjoying the beauty of outer space. + +### Two open source initiatives for space discovery + +#### OpenSpace Project + +One of the most beautiful tools for exploring space is [OpenSpace][4], an open source visualization tool of the entire known universe. It is an incredible way to visualize the environment of other planets, such as Mars and Jupiter, galaxies, and more. + +![The Moon visualized by the OpenSpace project][5] + +To enjoy a smooth experience from the OpenSpace simulation (e.g., a minimum 30fps), you need a powerful GPU; check the [GitHub repository][6] for more information. + +#### Libre Space Foundation + +The [Libre Space Foundation][7]'s mission is "to promote, advance, and develop libre (free and open source) technologies and knowledge for space." Among other things, the project is working to create an open source network of satellite ground stations that can communicate with satellites, spaceships, and space stations. It also supports the [UPSat project][8], which aspires to be the first completely open source satellite launched. + +### Advancing the human species + +I believe that the efforts made by these open source initiatives are contributing to the advancement of the human species in space. By increasing our interest in space, we are creating opportunities to upgrade our civilization's technological level, moving further up on the [Kardashev scale][9] and possibly becoming a multi-planetary species. Maybe one day, we will build a [Dyson sphere][10] around the sun to capture energy emissions, thereby harnessing an energy resource that exceeds any found on Earth and opening up a whole new world of possibilities. + +### Satisfy your curiosity + +Our solar system is only a tiny dot swimming in a universe of gems, and the outer space environment has never stopped amazing and intriguing us. + +If your curiosity is piqued and you want to learn more about outer space, check out [Kurzgesagt's][11] YouTube videos, which cover topics ranging from the origin of the universe to the strangest stars in a beautiful and concise manner. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-space-exploration + +作者:[Jaouhari Youssef][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/jaouhari +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) +[2]: https://en.wikipedia.org/wiki/List_of_space_telescopes +[3]: https://dictionary.cambridge.org/us/dictionary/english/curiosity +[4]: https://www.openspaceproject.com/ +[5]: https://opensource.com/sites/default/files/uploads/moon.png (The Moon visualized by the OpenSpace project) +[6]: https://github.com/OpenSpace/OpenSpace +[7]: https://libre.space/ +[8]: https://upsat.gr/ +[9]: https://en.wikipedia.org/wiki/Kardashev_scale +[10]: https://en.wikipedia.org/wiki/Dyson_sphere +[11]: https://kurzgesagt.org/ diff --git a/sources/talk/20191020 Project Trident Ditches BSD for Linux.md b/sources/talk/20191020 Project Trident Ditches BSD for Linux.md new file mode 100644 index 0000000000..1197c440e2 --- /dev/null +++ b/sources/talk/20191020 Project Trident Ditches BSD for Linux.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Project Trident Ditches BSD for Linux) +[#]: via: (https://itsfoss.com/bsd-project-trident-linux/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Project Trident Ditches BSD for Linux +====== + +Recently a BSD distribution announced that it was going to rebase on Linux. Yep, you heard me correctly. Project Trident is moving to Void Linux. + +### What is Going on with Project Trident? + +Recently, Project Trident [announced][1] that they had been working behind the scenes to move away from FreeBSD. This is quite a surprising move (and an unprecedented one). + +According to a [later post][2], the move was motivated by long-standing issues with FreeBSD. These issues include “hardware compatibility, communications standards, or package availability continue to limit Project Trident users”. According to a conversation on [Telegram][3], FreeBSD has just updated its build of the Telegram client and it was nine release behind everyone else. + +The lead dev of Project Trident, [Ken Moore][4], is also the main developer of the Lumina Desktop. The [Lumina Desktop][5] has been on hold for a while because the [Project Trident][6] team had to do so much work just to keep their packages updated. (Once they complete the transition to Void Linux, Ken will start working on Lumina again.) + +After much searching and testing, the Project Trident team decided to use [Void Linux][7] as their new base. + +According to the Project Trident team, the move to Void Linux will have the [following benefits][2]: + + * Better GPU support + * Better sound card and streaming support + * Better wireless support + * Bluetooth support for the first time + * Up to date versions of applications + * Faster boot times + * Hybrid EFI/Legacy installation and boot support + + + +### Moving Plans + +![][8] + +Project Trident currently has two different versions available: Trident-stable and Trident-release. Trident-stable is based on FreeBSD 12 and will continue to get updates until January of 2020 with the ports repo being deleted in April of 2020. On the other hand, Trident-release (which is based on FreeBSD 13) will receive no further updates. That ports repo will be deleted in January of 2020. + +The first Void Linux-based releases should be available in January of 2020. Ken said that they might issue an alpha iso or two to show off their progress, but they would be for testing purposes only. + +Currently, Ken said that they are working to port all of their “in-house utilities over to work natively on Void Linux”. Void Linux does not support ZFS-on-root, which is a big part of the BSDs. However, Project Trident is planning to use their knowledge of ZFS to add support for it to Void. + +There will not be a migration path from the FreeBSD-based version to the Void-based version. If you are currently using Project Trident, you will need to backup your `/home/*` directory before performing a clean install of the new version. + +### Final Thoughts + +I’m looking forward to trying out the new Void Linux-based Project Trident. I have installed and used Void Linux in the past. I have also tried out [TrueOS][9] (the precursor of Project Trident). However, I could never get Project Trident to work on my laptop. + +When I was using Void Linux, I ran into two main issues: installing a desktop environment was a pain and the GUI package manager wasn’t that great. Project Trident plans to address these issues. Their original goal was to find an operating system that didn’t come with a desktop environment as default and their distro would add desktop support out-of-the-box. They won’t be able to port the AppCafe package manager to Void because it is a part of TrueOS’ SysAdm utility. They do plan to “develop a new graphical front-end to the XBPS package manager for Void Linux”. + +Interestingly, Void Linux was created by a former NetBSD developer. I asked Ken if that fact influenced their decision. He said, “Actually none! I liked the way that Void Linux was set up and that most/all of the utilities were either MIT or BSD licensed, but I never guessed that it was created by a former NetBSD developer. That definitely helps to explain why Void Linux “feels” more comfortable to me since I have been using FreeBSD exclusively for the last 7 or more years.” + +I’ve seen some people on the web speaking disparagingly of the move to Void Linux. They mentioned that the name changes (from PC-BSD to TrueOS to Project Trident) and the changes in architecture (from FreeBSD to TrueOS/FreeBSD to Void Linux) show that the developers don’t know what they are doing. On the other hand, I believe that Project Trident has finally found its niche where it will be able to grow and blossom. I will be watching the future of Project Trident with much anticipation. You will probably be reading a review of the new version when it is released. + +Have you ever used Project Trident? What is your favorite BSD? 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][10]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bsd-project-trident-linux/ + +作者:[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://project-trident.org/post/train_changes/ +[2]: https://project-trident.org/post/os_migration/ +[3]: https://t.me/ProjectTrident +[4]: https://github.com/beanpole135 +[5]: https://lumina-desktop.org/ +[6]: https://itsfoss.com/project-trident-interview/ +[7]: https://voidlinux.org/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/bsd-linux.jpg?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/trueos-bsd-review/ +[10]: https://reddit.com/r/linuxusersgroup diff --git a/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md b/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md new file mode 100644 index 0000000000..540e09df54 --- /dev/null +++ b/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enterprises find new uses for mainframes: blockchain and containerized apps) +[#]: via: (https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Enterprises find new uses for mainframes: blockchain and containerized apps +====== +Blockchain and containerized microservices can benefit from the mainframe’s integrated security and massive parallelization capabilities. +Thinkstock + +News flash: Mainframes still aren't dead. + +On the contrary, mainframe use is increasing, and not to run COBOL, either. Mainframes are being eyed for modern technologies including blockchain and containers. + +A survey of 153 IT decision makers found that 50% of organizations will continue with the mainframe and increase its use over the next two years, while just 5% plan to decrease or remove mainframe activity. The survey was conducted by Forrester Research and commissioned by Ensono, a hybrid IT services provider, and Wipro Limited, a global IT consulting services company. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +**READ MORE:** [Data center workloads become more complex despite promises to the contrary][2] + +That kind of commitment to the mainframe is a bit of a surprise, given the trend to reduce or eliminate the on-premises data center footprint and move to the cloud. However, enterprises are now taking a hybrid approach to their infrastructure, migrating some applications to the cloud while keeping the most business-critical applications on-premises and on mainframes. + +Forrester's research found mainframes continue to be considered a critical piece of infrastructure for the modern business – and not solely to run old technologies. Of course, traditional enterprise applications and workloads remain firmly on the mainframe, with 48% of ERP apps, 45% of finance and accounting apps, 44% of HR management apps, and 43% of ECM apps staying on mainframes. + +But that's not all. Among survey respondents, 25% said that mobile sites and applications were being put into the mainframe, and 27% said they're running new blockchain initiatives and containerized applications. Blockchain and containerized applications benefit from the integrated security and massive parallelization inherent in a mainframe, Forrester said in its report. + +"We believe this research challenges popular opinion that mainframe is for legacy," said Brian Klingbeil, executive vice president of technology and strategy at Ensono, in a statement. "Mainframe modernization is giving enterprises not only the ability to continue to run their legacy applications, but also allows them to embrace new technologies such as containerized microservices, blockchain and mobile applications." + +Wipro's Kiran Desai, senior vice president and global head of cloud and infrastructure services, added that enterprises should adopt two strategies to take full advantage of mainframes. The first is to refactor applications to take advantage of cloud, while the second is to adopt DevOps to modernize mainframes. + +**Learn more about mixing cloud and on-premises workloads** + + * [5 times when cloud repatriation makes sense][3] + * [Network monitoring in the hybrid cloud/multi-cloud era][4] + * [Data center workloads become more complex][2] + * [The benefits of mixing private and public cloud services][5] + + + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.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/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/3400086/data-center-workloads-become-more-complex-despite-promises-to-the-contrary.html +[3]: https://www.networkworld.com/article/3388032/5-times-when-cloud-repatriation-makes-sense.html +[4]: https://www.networkworld.com/article/3398482/network-monitoring-in-the-hybrid-cloudmulti-cloud-era.html +[5]: https://www.networkworld.com/article/3233132/what-is-hybrid-cloud-computing.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md b/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md new file mode 100644 index 0000000000..1213813bf8 --- /dev/null +++ b/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tokalabs Software Defined Labs automates configuration of lab test-beds) +[#]: via: (https://www.networkworld.com/article/3446816/tokalabs-software-defined-labs-automates-configuration-of-lab-test-beds.html) +[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) + +Tokalabs Software Defined Labs automates configuration of lab test-beds +====== +The primary challenge of running a test lab is the amount of time it takes to provision the test beds within the lab. This software defined lab platform automates the setup and configuration process so that tests can be accelerated. +7Postman / Getty Images + +Network environments have become so complex that companies such as systems integrators, equipment manufacturers and enterprise organizations feel compelled to test their configurations and equipment in lab environments before deployment. Performance test labs are used extensively for quality, proof of concept, customer support, and technical sales initiatives. Labs are the perfect place to see how well something performs before it’s put into a production environment. + +The primary challenge of running a test lab is the amount of time it takes to provision the test environments. A network lab infrastructure might include switches, routers, servers, [virtual machines][1] running on various server clusters, security services, cloud resources, software and so on. It takes considerable time to wire the configurations, physically build the desired test beds, login to each individual device and load the proper software configurations. Quite often, lab staffers spend more time on setup than they do on conducting actual tests. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +This is a problem that the networking company Allied Telesis was having in building test beds for its own development engineers. The company developed an application for internal use that would ease the setup and reconfiguration problem. The equipment could be physically cabled once and then configured and controlled centrally through software. The application worked so well that Allied Telesis spun it off for others to use, and this is the origin of [Tokalabs Software Defined Labs][3] (SDL) technology. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Tokalabs provides a platform that enables engineers to manage a lab-network infrastructure and create sandboxes or topologies that can be used for R&D, product development and quality testing, customer support, sales demos, competitive benchmarking, driving proof of concept efforts, etc. There’s an automation sequencer built into the platform that allows users to automate test cases, sales demos, troubleshooting methods, image upgrades and the like.  + +The Tokalabs SDL controller is a virtual appliance that can be imported into any virtualization environment. Once installed, the customer can access the controller’s UI using a web browser. The controller has an auto-discovery mechanism that inventories everything within a specified range of IP addresses, including cloud resources. + +Tokalabs probes the addresses to figure out what ports are open on them, what management types are supported, and the vendor information of the devices. This results in an inventory of hundreds of devices that are discovered by the SDL controller. + +On the hardware side, lab engineers only need to cable and configure their lab devices once, which eliminates the cumbersome setup and tear down processes. These devices are abstracted and managed centrally through the SDL controller, which maintains a centralized networking fabric. Lab engineers have full visibility of every physical and virtual device and every public and [private cloud][5] instance within their domain. + +Engineers can use the Tokalabs SDL controller to dynamically create and reserve test-bed resources and then save them as a template for future use. Engineers also can automate and schedule test executions and the controller will release the resources once the tests are done. The controller’s codeless automation feature means users don’t need to know how to write scripts to orchestrate and automate a pretty comprehensive configuration and test scenario. They can use the controller to automate sequences without writing code or instruct the controller to execute external scripts developed by an engineer. + +The automation is helpful to set up a specific configuration quickly. For example, a customer-support engineer might need to replicate a scenario that one of its customers has in order to troubleshoot an issue. Using the controller’s automation feature, devices can be configured and loaded with specific firmware quickly to ease the setup process. + +Tokalabs logs everything that transpires through its controller, so a lab administrator has oversight into how the equipment is being used or what types of tests are being created and executed. This helps with resource capacity planning, to ensure that there is enough equipment without having devices sit idle for too long. + +One leader in cybersecurity became an early adopter of Tokalabs. This vendor has a test lab to conduct comparative benchmark numbers with competitors’ products in order to close large deals and to confirm their product strengths and performance numbers for marketing materials. + +Prior to using the Tokalabs SDL controller, engineering teams would physically cable the topologies, configure the devices and execute various benchmark tests. Then they would tear down that configuration and start all over again for every set of devices and firmware revisions. + +Given that this is a multi-billion-dollar equipment manufacturer, there are a lot of new product releases and updates to existing products. That means there’s a heck of a lot of work for the engineers in the lab to test each product and compare it to competitors’ offerings. They can’t really afford the time spent configuring rather than testing, so they turned to Tokalabs’ technology to manage the lab infrastructure and to automate the configurations and scheduling of test executions. They chose this solution largely for the ease of setup and use. + +Now, each engineer can create hundreds of reusable templates, thus eliminating the repetitive work of creating test beds, and also automate test scripts using the Tokalabs’ automation sequencer. Additionally, all their existing test scripts are available to use through the SDL controller. This has helped the team reduce its backlog and keep up with the product release cycles. + +Beyond this use case for comparative benchmark tests, some of the other uses for Tokalabs SDL include: + + * Creating a portal for others to use lab resources; for example, for training purposes or for customers to test network environments prior to purchasing them + * Doing sales demonstrations and customer PoCs in order to showcase a feature, an application, or even an entire configuration + * Automating bringing up virtualized environments + + + +Tokalabs claims to work closely with its customers to tailor the Software Defined Labs platform to specific use cases and customer needs. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446816/tokalabs-software-defined-labs-automates-configuration-of-lab-test-beds.html + +作者:[Linda Musthaler][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/Linda-Musthaler/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3234795/what-is-virtualization-definition-virtual-machine-hypervisor.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://tokalabs.com/ +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md b/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md new file mode 100644 index 0000000000..25587ad532 --- /dev/null +++ b/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (“Making software liquid: a DevOps company founder’s journey from OSS community to billion-dollar darling”) +[#]: via: (https://opensourceforu.com/2019/10/making-software-liquid-a-devops-company-founders-journey-from-oss-community-to-billion-dollar-darling/) +[#]: author: (Editor Team https://opensourceforu.com/author/editor/) + +“Making software liquid: a DevOps company founder’s journey from OSS community to billion-dollar darling” +====== + +![][1] + +_JFrog claims to make software development easier and faster, and enable firms to reduce their development costs. To understand the basis of this promise, **Rahul Chopra, editorial director, EFY Group**, spoke to **Fred Simon, co-founder and chief architect, JFrog** and here’s what he discovered…_ + +**Q. How would you explain JFrog’s solutions to a senior business decision maker?** + +**A.** It’s a fair question, as we have been – and continue to be – a developer-driven company that makes tools and solutions for developers. Originally, we were a team of engineers working on Java and had the task of solving some package management pain during the J2EE (now Java EE) transformation. So, it was all hyper-technical and hard to explain to non-engineers. + +Today, it’s a bit easier. As the world moves towards cloud-native applications as the default and every company is now a software company, the benefits of software management and delivery are now mission-critical. We see that as this industry maturity has taken place, software conversations are now management-level conversations. So, it’s now a very simple proposition: You are getting business demands for faster, smarter, more secure software. And you must “release software fast, or you die,” as we like to say. Competition is fierce, so if you can provide value to the end-user faster and smarter without downtime – what we call “Liquid Software,” you have a competitive edge. JFrog helps you achieve these goals faster as a DevOps organization. + +**Q. How does the explanation change, when explaining it to a senior techie like a CTO?** + +**A.** At this level, it is even simpler. You have historically released software once a quarter or even once a year or more. You know that this demand has changed with cloud, microservices and agility movements. We give you the ability to get a new version rapidly, control where the version was validated and how it ends up in runtime as quickly as possible. We’ve been doing this for more than 10 years at scale. When we started, our customers managed a gigabyte, then later a terabyte and today we have customers with petabytes of binary software creating dozens or hundreds of builds a day. + +**Q. You mentioned the word ‘control’. But, a lot of developers do not like control. So, how would you explain JFrog’s promise to them, what would your pitch be?** + +**A.** The word “control” to a developer’s ear can sound like something being imposed on them. It’s “someone else’s” control. But the developer roots of JFrog demand that we provide speed and agility to developers, giving them as much control over their environments as possible without sacrificing their speed. + +**Q. According to you, the drivers within the company are the developers, who then take it to DevOps, then to CTO and the CEO signs the cheque? Is that how it works?** + +**A.** Yes. JFrog to date has only had an inside sales force with no outbound sales. The first time we ever talked to a company was because the developer said that they needed a professional version of JFrog tools. Then we started the discussion with the managers and so on up the chain. Developers – as some like our friends at RedMonk have said – are still the kingmakers. + +**Q. Can you explain the term ‘Liquid Software’ that’s been mentioned quite a few times on your website?** + +**A.** The concept of Liquid Software is to enable continuous, secure, seamless updates of every piece of software that is running without any downtime. This is very different than the traditional build, package, distribute once a year model. The old way doesn’t scale. The new world of Liquid Software makes the update process nearly seamless from code to end device. + +**Q. Has the shift to “everything-as-a-service” become the main driver for this concept of Liquid Software?** + +**A.** Yes. People are not making software as a service, they are delivering services. They are using our Liquid Software pipeline delivery process for every kind of delivery. It’s important to note that “as a service” isn’t just for cloud, but is in fact the standard for every type of software delivery. + +**Q. How’s JFrog connected with open source and how does it shift to an enterprise paid version? What is the licensing model at JFrog?** + +**A.** We have an open-source version licensed under AGPL. This open source version allows you to do many Java-related works, and is sometimes where developers start to “kick the tires.”.There is also an edition specifically for C/C++ developer utilizing the Conan framework. Since most development shops do more than one type of development, our commercial versions – starting with a Pro subscription – universally support all package types. From there, there are other plans available that include HA, Security and Compliance tools, Distribution and more. We have also recently added JFrog Pipelines for  full automation of your pipelines across the organization. So, you can choose what makes the most sense for them, and JFrog can grow alongside your needs as you mature your DevOps and DevSecOps infrastructure. + +**Q. Do you have a different set of solutions for developers depending on whether they are developing for the web, mobile, IoT?** + +**A.** No, we are universal. You don’t need to re-install different things for different technology. So, if you are a Ruby developer or a Python developer or if you have Docker, Debian, Microsoft or NuGet, then you get everything in one single tool. Pipelines are so unique to each organization that we need to support all of it. + +**Q. Are there any specific solutions or capabilities that you have developed for IoT?** + +**A.** Yes. Quite early on we worked with customers on an IoT offering. We provided an IoT-specific solution, which is an extension of Debian for IoT, and we also have Conan and Yocto. Controlling and increasing the speed of delivery is something that is in the early stages of the IoT environment. So we are helping in this integration and providing tools that are enabling different technologies on your JFrog platform that are tailored to an IoT environment. + +**Q. Overall, how important is India, both as development and tech-support centre for JFrog globally as well as a market for JFrog?** + +**A.** JFrog opened its first office in India more than three years ago, with a development office working on JFrog Insight and JFrog Mission Control (which provide pipeline tooling and performance visibility). We purchased an organization called Shippable at the beginning of this year for their technology and their R&D team, who then created JFrog Pipelines product. They are also located in India, so India has been and is increasingly important from both an R&D and support perspective. A lot of our senior support force is in India, so we need really good developers working at JFrog to handle the high-tech support volume. We are already at 60 employees in Bangalore and have recently appointed a General Manager. As you know, JFrog is now a company of more than 500 people. We are also growing our marketing and sales teams in India that will help drive the DevOps revolution for Indian customers. + +**Q. Are these more of a global account that have shops in India or are these Indian companies?** + +**A.** Both. We started with the global companies with R&D in India. Today, we have companies throughout India that are directly buying from us. + +**Q. A little bit about your personal journey, when and how did you connect with the open-source world?** + +**A.** I will date myself and say that in 1992, I used to play with Mosaic while I was in University, and I created a web server based on open source web stacks. Gloriously geeky stuff, but it put me in the OSS community right from the beginning. When I was a kid, I used to share code and OSS was the way I learned how to code in the first place. It’s clear to me that OSS is the future for creating innovative software, and I – and JFrog – continue to support and contribute to development communities globally. I look forward to seeing OSS and OSS communities drive the innovations of the future. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/making-software-liquid-a-devops-company-founders-journey-from-oss-community-to-billion-dollar-darling/ + +作者:[Editor Team][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://opensourceforu.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Copy-of-IMG_0219a-_39_-new.jpg?resize=350%2C472&ssl=1 diff --git a/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md b/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md new file mode 100644 index 0000000000..fb3af2e634 --- /dev/null +++ b/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gartner: 10 infrastructure trends you need to know) +[#]: via: (https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Gartner: 10 infrastructure trends you need to know +====== +Gartner names the most important factors affecting infrastructure and operations +[Daniel Páscoa][1] [(CC0)][2] + +ORLANDO – Corporate network infrastructure is only going to get more  involved  over the next two to three years as automation, network challenges and hybrid cloud become more integral to the enterprise. + +Those were some of the main infrastructure trend themes espoused by Gartner vice president and distinguished analyst [David Cappuccio][3] at the research firm’s IT Symposium/XPO here this week. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +Cappuccio noted that Gartner’s look at the top infrastructure and operational trends reflect offshoots of technologies – such as cloud computing, automation and networking advances the company’s [analysts have talked][5] about many times before. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Gartners “Top Ten Trends Impacting Infrastructure and Operations” list is: + +### Automation-strategy rethink + +[Automation][7] has been going on at some level for years, Cappuccio said, but the level of complexity as it is developed and deployed further is what’s becoming confusing.  The amounts and types of automation need to be managed and require a shift to a team development approach led by an automation architect that can be standardized across business units. Cappuccio said.  What would help?  Gartner says by 2025, more than 90 percent of enterprises will have an automation architect, up from less than 20 percent today. + +Advertisement + +### Hybrid IT Impacts Disaster Recovery Confidence + +Hybrid IT which includes a mix of data center, SAAS, PAAS, branch offices, [edge computing][8] and security services makes it hard to promise enterprise resources will be available or backed-up, Cappuccio said. Overly-simplistic IT disaster recovery plans may only deliver partial success.  By 2021, the root cause of 90 percent of cloud-based availability issues will be the failure to fully use cloud service provider native redundancy capabilities, he said.  Enterprises need to leverage their automation investments and other IT tools to refocus how systems are recovered. + +### Scaling DevOps agility demands platform rethinking + +IT’s role in many companies has almost become that of a product manager for all its different DevOps teams. IT needs to build consistency across the enterprise because they don’t want islands of DeVOps teams across the company. By 2023, 90 percent of enterprises will fail to scale DevOps initiatives if shared self-service platform approaches are not adopted, Gartner stated.  + +### Infrastructure - and your data - are everywhere + +By 2022, more than 50 percent of enterprise-generated data will be created and processed outside the [data cente][9]r or cloud, up from less than 10 percent in 2019.  Infrastructure is everywhere, Cappuccio said and every time data is moved it creates challenges. How does IT manage data-everywhere scenarios?  Cappuccio advocated mandating data-driven infrastructure impact-assessment at early stages of design, investing in infrastructure tools to manage data wherever it resides, and modernizing existing backup architectures to be able to protect data wherever it resides. + +### Overwhelming Impact of IoT + +The issue here is that most [IoT][10] implementations are not driven by IT, and they typically involve different protocols and vendors that don’t usually deal with an IT organization. In the end, who controls and manages IoT becomes an issue and it creates security and operational risks. Cappuccio said companies need to engage with business leaders to shape IoT strategies and establish a center of excellence for IoT. + +### Distributed cloud + +The methods of putting cloud services or cloud-like services on-premises but letting a vendor manage that cloud are increasing. Google has Athos and AWS will soon roll out OutPosts, for example, so this environment is going to change a lot in the next two years, Cappuccio said. This is a nascent market so customers should beware. Enterprises should also be prepared to set boundaries and determine who is responsible for software upgrades, patching and performance. + +### Immersive Experience + +Humans used to learn about and adapt to technology. Today, technology learns and adapts to humans, Cappuccio said. “We have created a world where customers have a serious expectation of perfection. We have designed applications where perfection is the norm.” Such systems are great for mindshare, marketshare and corporate reputation, but as soon as there’s one glitch that’s all out the window. + +### Democratization of IT + +Application development is no longer the realm of specialists. There has been the rollout of simpler development tools like [low code][11] or [no code][12] packages and a focus on bringing new applications to market quickly. That may bring a quicker time-to-market for the business but could be riskier for IT, Cappuccio said.  IT leaders perhaps can’t control such rapid development, but it needs to understand what’s happening. + +### What's next for networking? + +There are tons of emerging trends around networking such as mesh, secure-access service edge, network automation, network-on-demand service, network automation, and firewalls as a service. “After decades of focusing on network performance and availability, future network innovation will target operational simplicity, automation, reliability and flexible business models,” Cappuccio said.  Enterprises need to automate “everywhere” and balance what technologies are safe vs. what is agile, he said. + +### Hybrid digital-infrastructure management + +The general idea here is that CIOs face the challenge of selecting the right mixture of cloud and traditional IT for the organization.  The mix of many different elements such as edge, [hybrid cloud][13], workflow and management creates complex infrastructures. Gartner recommends a focus on workflow visualization – utilizing an in integrated toolset and developing a center of excellence to work on the issues, Cappuccio said. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.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://unsplash.com/photos/tjiPN3e45WE +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.linkedin.com/in/davecappuccio/ +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/2160904/gartner--10-critical-it-trends-for-the-next-five-years.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=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3223189/how-network-automation-can-speed-deployments-and-improve-security.html +[8]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[9]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[10]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[11]: https://www.mendix.com/low-code-guide/ +[12]: https://kissflow.com/no-code/ +[13]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md b/sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md new file mode 100644 index 0000000000..8dbe791467 --- /dev/null +++ b/sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Disney’s Streaming Service is Having Troubles with Linux) +[#]: via: (https://itsfoss.com/disney-plus-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Disney’s Streaming Service is Having Troubles with Linux +====== + +You might be already using Amazon Prime Video (comes free with [Amazon Prime membership][1]) or [Netflix on your Linux system][2]. Google Chrome supports these streaming services out of the box. You can also [watch Netflix on Firefox in Linux][3] but you have to explicitly enable DRM content. + +However we just learned that Disney’s upcoming streaming service, Disney+ does not work in the same way. + +A user, Hans de Goede, on [LiveJournal][4] revealed this from his experience with Disney+ in the testing period. In fact, the upcoming streaming service Disney+ does not support Linux at all, at least for now. + +### The trouble with Disney+ and DRM + +![][5] + +As Hans explains in his [post][4], he subscribed to the streaming service in the testing period because of the availability of Disney+ in Netherlands. + +Hans tested it on Fedora with mainstream browsers like Firefox and Chrome. However, every time, an error was encountered – “**Error Code 83**“. + +So, he reached out to Disney support to solve the issue – but interestingly they weren’t even properly aware of the issue as it took them a week to give him a response. + +Here’s how he puts his experience: + +> So I mailed the Disney helpdesk about this, explaining how Linux works fine with Netflix, AmazonPrime video and even the web-app from my local cable provider. They promised to get back to me in 24 hours, the eventually got back to me in about a week. They wrote: “We are familiar with Error 83. This often happens if you want to play Disney + via the web browser or certain devices. Our IT department working hard to solve this. In the meantime, I want to advise you to watch Disney + via the app on a phone or tablet. If this error code still occurs in a few days, you can check the help center …” this was on September 23th. + +They just blatantly advised him to use his phone/tablet to access the streaming service instead. That’s genius! + +### Disney should reconsider their DRM implementation + +What is DRM? + +Digital Rights Management ([DRM][6]) technologies attempt to control what you can and can’t do with the media and hardware you’ve purchased. + +Even though they want to make sure that their content remains protected from pirates (which won’t make a difference either), it creates a problem with the support for multiple platforms. + +How on earth do you expect more people to subscribe to your streaming service when you do not even support platforms like Linux? So many media center devices run on Linux. This will be a big setback if Disney continues like this. + +To shed some light on the issue, a user on [tweakers.net][7] found out that it is a [Widevine][8] error. Here, it generally means that your device is incompatible with the security level of DRM implemented. + +It turns out that it isn’t just limited to Linux – but a lot of users are encountering the same error on other platforms as well. + +In addition to the wave of issues, the Widevine error also points to a fact that Disney+ may not even work on Chromebooks, some Android smartphones, and Linux desktops in general. + +Seriously, Disney? + +### Go easy, Disney! + +A common DRM (low-level security) implementation with Disney+ should make it accessible on every platform including Linux systems. + +Disney+ might want to re-think about the DRM implementation if they want to compete with other streaming platforms like Netflix and Amazon Prime Video. + +Personally, I would prefer to stay with Netflix if Disney does not care about supporting multiple platforms. + +It is not actually about supporting “Linux” but conveniently making the streaming service available for more platforms which could justify its subscription fee. + +What do you think about this? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disney-plus-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.amazon.com/tryprimefree?tag=chmod7mediate-20 +[2]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[3]: https://itsfoss.com/netflix-firefox-linux/ +[4]: https://hansdegoede.livejournal.com/22338.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disney-plus-linux.jpg?resize=800%2C450&ssl=1 +[6]: https://www.eff.org/issues/drm +[7]: https://tweakers.net/nieuws/157224/disney+-start-met-gratis-proefperiode-van-twee-maanden-in-nederland.html?showReaction=13428408#r_13428408 +[8]: https://www.widevine.com/ diff --git a/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md b/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md new file mode 100644 index 0000000000..1a0b2ad9a0 --- /dev/null +++ b/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IT-as-a-Service Simplifies Hybrid IT) +[#]: via: (https://www.networkworld.com/article/3447342/it-as-a-service-simplifies-hybrid-it.html) +[#]: author: (Anne Taylor https://www.networkworld.com/author/Anne-Taylor/) + +IT-as-a-Service Simplifies Hybrid IT +====== +Consumption-based model reduces complexity, improves IT infrastructure. +iStock + +The data center must rapidly change. Companies are increasingly moving toward hybrid IT models, with some workloads in the cloud and others staying on premises. The burden of ever-growing apps and data is placing pressure on infrastructure in both worlds, but especially the data center. + +Organizations are struggling to reach the required speed and flexibility — with the same public-cloud economics — from their on-premises data centers. That’s likely because they’re dealing with legacy systems acquired over the years, possibly inherited as the result of mergers and acquisitions. + +These complex environments create headaches when trying to accommodate for IT capacity fluctuations. When extra storage is needed, for example, 67% of IT departments buy too much, according to [Futurum Research][1]. They don’t have the visibility into resources, nor the ability to effectively scale up and down. + +Meanwhile, lines of business need solutions fast, and if IT can’t deliver, they’ll go out and buy their own cloud-based services or solutions. IT must think strategically about how all this technology strings together — efficiently, securely, and cost-effectively. + +Enter IT-as-a-Service (ITaaS). + +**1) How does ITaaS work?** + +Unlike other as-a-service models, ITaaS is not cloud based, although the concept can be applied to cloud environments. Rather, the focus is about shifting IT operations toward managed services on an as-needed, pay-as-you-go basis. 1 + +For example, HPE GreenLake delivers infrastructure capacity based on actual metered usage, where companies only pay for what is used. There are no upfront costs, extended purchasing and implementation timeframes, or overprovisioning headaches. Infrastructure capacity can be scaled up or down as needed. + +**2) What are the benefits of ITaaS?** + +Some of the most significant advantages include: scalable infrastructure and resources, improved workload management, greater availability, and reduced burden on IT, including network admins. + + * _Infrastructure_. Resource needs are often in flux depending on business demands and market changes. Using ITaaS not only enhances infrastructure usage, it also helps network admins better plan for and manage bandwidth, switches, routers, and other network gear. + * _Workloads_. ITaaS can immediately tackle cloud bursting to better manage application flow. Companies might also, for example, choose to use the consumption-based model for workloads that are unpredictable in their growth — such as big data, storage, and private cloud. + * _Availability_. It’s critical to have zero network downtime. Using a consumption-based IT model, companies can opt to adopt services such as continuous network monitoring or expertise on-call with a 24/7 network help desk. + * _Reduced burden on IT_. All of the above benefits affect day-to-day operations. By simplifying network management, ITaaS frees personnel to use their expertise where it is best served. + + + +Furthermore, a consumption-based IT model helps organizations gain end-to-end visibility into storage resources, so that admins can ensure the highest levels of service, performance, and availability. + +**HPE GreenLake: The Answer** + +As hybrid IT takes hold, IT organizations must get a grip on their infrastructure resources to ensure agility and scalability for the business, while maintaining IT cost-effectiveness. + +HPE GreenLake enables a simplified IT environment where companies pay only for the resources they actually use, while providing the business with the speed and agility it requires. + +[Learn more at hpe.com/greenlake.][2] + +Minimum commitment may apply + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447342/it-as-a-service-simplifies-hybrid-it.html + +作者:[Anne Taylor][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/Anne-Taylor/ +[b]: https://github.com/lujun9972 +[1]: https://h20195.www2.hpe.com/v2/Getdocument.aspx?docname=a00079768enw +[2]: https://www.hpe.com/us/en/services/flexible-capacity.html diff --git a/sources/talk/20191023 Psst- Wanna buy a data center.md b/sources/talk/20191023 Psst- Wanna buy a data center.md new file mode 100644 index 0000000000..26ac4617b8 --- /dev/null +++ b/sources/talk/20191023 Psst- Wanna buy a data center.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Psst! Wanna buy a data center?) +[#]: via: (https://www.networkworld.com/article/3447657/psst-wanna-buy-a-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Psst! Wanna buy a data center? +====== +Data centers are being bought and sold at an increasing rate, although since they are often private transactions, solid numbers can be hard to come by. +artisteer / Getty Images + +When investment bank Bear Stearns collapsed in 2008, there was nothing left of value to auction off except its [data centers][1]. JP Morgan bought the company's carcass for just $270 million, but the only thing of value was Bear's NYC headquarters and two data centers. + +Since then there have been numerous sales of data centers under better conditions. There are even websites ([Datacenters.com][2], [Five 9s Digital][3]) that list data centers for sale. You can buy an empty building, but in most cases, you get the equipment, too. + +There are several reasons why, the most common being companies want to get out of owning a data center. It's an expensive capex and opex investment, and if the cloud is a good alternative, then that's where they go. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +But there are other reasons, too, said Jon Lin, president of the Equinix Americas office. He said enterprises have overbuilt because of their initial long-term forecasts fell short, partially driven by increased use of cloud. He also said there is an increase in the amount of private equity and real estate investors interested in diversifying into data centers. + +But that doesn't mean Equinix takes every data center they are offered. He cited three reasons why Equinix would pass on an offer: + +1) It is difficult to repurpose an enterprise data center designed around a very tailored customer into a general purpose, multi-tenant data center without significant investment in order to tailor it to the company's satisfaction. + +2) Most of these sites were not built to Equinix standards, diminishing their value. + +**[ Learn more about SDN: Find out [where SDN is going][5] and learn the [difference between SDN and NFV][6]. | Get regularly scheduled insights by [signing up for Network World newsletters][7]. ]** + +3) Enterprise data centers are usually located where the company HQ is for convenience, and not near the interconnection points or infrastructure locations Equinix would prefer for fiber and power. + +Just how much buying and selling is going on is hard to tell. Most of these firms are privately held and thus no disclosure is required. Kelly Morgan, research vice president with 451 Research who tracks the data center market, put the dollar figure for data center sales in 2019 so far at $5.4 billion. That's way down from $19.5 billion just two years ago. + +She says that back then there were very big deals, like when Verizon sold its data centers to Equinix in 2017 for $3.6 billion while AT&T sold its data centers to Brookfield Infrastructure Partners, which buys and managed infrastructure assets, for $1.1 billion. + +These days, she says, the main buyers are big real estate-oriented pension funds that have a different perspective on why they buy vs. traditional real estate investors. Pension funds like the steady income, even in a recession. Private equity firms were buying data centers to buy up the assets, group them, then sell them and make a double-digit return, she said. + +Enterprises do look to sell their data centers, but it's a more challenging process. She echoes what Lin said about the problem with specialty data centers. "They tend to be expensive and often in not great locations for multi-tenant situations. They are often at company headquarters or the town where the company is headquartered. So they are hard to sell," she said. + +Enterprises want to sell their data center to get out of data center ownership, since they are often older -- the average age of corporate data centers is from 10 years to 25 years old – for the obvious reasons. "When we ask enterprises why they are selling or closing their data centers, they say they are consolidating multiple data centers into one, plus moving half their stuff to the cloud," said Morgan. + +There is still a good chunk of companies who build or acquire data centers, either because they are consolidating or just getting rid of older facilities. Some add space because they are moving to a new geography. However, Morgan said they almost never buy. "They lease one from someone else. Enterprise data centers for sale are not bought by other enterprises, they are bought by service providers who will lease it. Enterprises build a new one," she said. + +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/3447657/psst-wanna-buy-a-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/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.datacenters.com/real-estate/data-centers-for-sale +[3]: https://five9sdigital.com/data-centers/ +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html +[6]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md b/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md new file mode 100644 index 0000000000..349e2b7e2a --- /dev/null +++ b/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Protocols That Help Things to Communicate Over the Internet) +[#]: via: (https://opensourceforu.com/2019/10/the-protocols-that-help-things-to-communicate-over-the-internet-2/) +[#]: author: (Sapna Panchal https://opensourceforu.com/author/sapna-panchal/) + +The Protocols That Help Things to Communicate Over the Internet +====== + +[![][1]][2] + +_The Internet of Things is a system of connected, interrelated objects. These objects transmit data to servers for processing and, in turn, receive messages from the servers. These messages are sent and received using different protocols. This article discusses some of the protocols related to the IoT._ + +The Internet of Things (IoT) is beginning to pervade more and more aspects of our lives. Everyone everywhere is using the Internet of Things. Using the Internet, connected things are used to collect information, convey/send information back, or do both. IoT is an architecture that is a combination of available technologies. It helps to make our daily lives more pleasant and convenient. + +![Figure 1: IoT architecture][3] + +![Figure 2: Messaging Queuing Telemetry Transmit protocol][4] + +**IoT architecture** +Basically, IoT architecture has four components. In this article, we will explore each component to understand the architecture better. + +**Sensors:** These are present everywhere. They help to collect data from any location and then share it to the IoT gateway. As an example, sensors sense the temperature at different locations, which helps to gauge the weather conditions. And this information is shared or passed to the IoT gateway. This is a basic example of how the IoT operates. + +**IoT gateway:** Once the information is collected from the sensors, it is passed on to the gateway. The gateway is a mediator between sensor nodes and the World Wide Web. So basically, it processes the data that is collected from sensor nodes and then transmits this to the Internet infrastructure. +**Cloud server:** Once data is transmitted through the gateway, it is stored and processed in the cloud server. +**Mobile app:** Using a mobile application, the user can view and access the data processed in the cloud server. +This is the basic idea of the IoT and its architecture, along with the components. We now move on to the basic ideas behind different IoT protocols. + +![Figure 3: Advance Message Queuing Protocol][5] + +![Figure 4: CoAP][6] + +**IoT protocols** +As mentioned earlier, connected things are used to collect information, convey/send information back, or do both, using the Internet. This is the fundamental basis of the IoT. To convey/send information, we need a protocol, which is a set of procedures that is used to transmit the data between electronic devices. +Essentially, we have two types of IoT protocols — the IoT network protocols and the IoT data protocols. This article discusses the IoT data protocols. + +![Figure 5: Constrained Application Protocol architecture][7] + +**MQTT** +The Messaging Queuing Telemetry Transmit (MQTT) protocol was primarily designed for low bandwidth networks, but is very popular today as an IoT protocol. It is used to exchange data between clients and the server. It is a lightweight messaging protocol. + +This protocol has many advantages: + + * It is small in size and has low power usage. + * It is a lightweight protocol. + * It is based on low network usage. + * It works entirely in real-time. + + + +Considering all the above reasons, MQTT emerges as the perfect IoT data protocol. + +**How MQTT works:** MQTT is based on a client-server relationship. The server manages the requests that come from different clients and sends the required information to clients. MQTT is based on two operations. + +i) _Publish:_ When the client sends data to the MQTT broker, this operation is known as ‘Publish’. +ii) _Subscribe:_ When the client receives data from the broker, this operation is known as ‘Subscribe’. + +The MQTT broker is the mediator that handles these operations, primarily taking messages and delivering them to the application or client. + +Let’s look at the example of a device temperature sensor, which sends readings to the MQTT broker, and then information is delivered to desktop or mobile applications. As stated earlier, ‘Publish’ means sending readings to the MQTT broker and ‘Subscribe’ means delivering the information to the desktop/mobile application. + +**AMQP** +Advanced Message Queuing Protocol is a peer-to-peer protocol, where one peer plays the role of the client application and the other peer plays the role of the delivery service or broker. It is the combination of hard and fast components that basically routes and saves messages within the delivery service or broker carrier. +The benefits of AMQP are: + + * It helps to send messages without them getting missed out. + * It helps to guarantee a ‘one-time-only’ and secured delivery. + * It provides a secure connection. + * It always supports acknowledgements for message delivery or failure. + + + +**How AMQP works and its architecture:** The AMQP architecture is made up of the following parts. + +_**Exchange**_ – Messages that come from the publisher are accepted by Exchange, which routes them to the message queue. +_**Message queue**_ – This is the combination of multiple queues and is helpful for processing the messages. +_**Binding**_ – This helps to maintain the connectivity between Exchange and the message queue. +The combination of Exchange and the message queues is known as the broker or AMQP broker. + +![Figure 6: Extensible Messaging and Presence Protocol][8] + +**Constrained Application Protocol (CoAP)** +This was initially used as a machine-to-machine (M2M) protocol and later began to be used as an IoT protocol. It is a Web transfer protocol that is used with constrained nodes and constrained networks. CoAP uses the RESTful architecture, just like the HTTP protocol. +The advantages CoAP offers are: + + * It works as a REST model for small devices. + * As this is like HTTP, it’s easy for developers to work on. + * It is a one-to-one protocol for transferring information between the client and server, directly. + * It is very simple to parse. + + + +**How CoAP works and its architecture:** From Figure 4, we can understand that CoAP is the combination of ‘Request/Response and Message’. We can also say it has two layers – ‘Request/Response’and ‘Message’. +Figure 5 clearly explains that CoAP architecture is based on the client server relationship, where… + + * The client sends requests to the server. + * The server receives requests from the client and responds to them. + + + +**Extensible Messaging and Presence Protocol (XMPP)** + +This protocol is used to exchange messages in real-time. It is used not only to communicate with others, but also to get information on the status of the user (away, offline, active). This protocol is widely used in real life, like in WhatsApp. + +The Extensible Messaging and Presence Protocol should be used because: + + * It is free, open and easy to understand. Hence, it is very popular. + * It has secured authentication, is extensible and flexible. + + + +**How XMPP works and its architecture:** In the XMPP architecture, each client has a unique name associated with it and communicates to other clients via the XMPP server. The XMPP client has either the same domain or a different one. + +In Figure 6, the XMPP client belongs to the same domain in which one XMPP client sends the information to the XMPP server. The server translates it and conveys the information to another client. +Basically, this protocol is the backbone that provides universal connectivity between different endpoint protocols. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-protocols-that-help-things-to-communicate-over-the-internet-2/ + +作者:[Sapna Panchal][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://opensourceforu.com/author/sapna-panchal/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Internet-of-things-illustration.jpg?resize=696%2C439&ssl=1 (Internet of things illustration) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Internet-of-things-illustration.jpg?fit=1125%2C710&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-IoT-architecture.jpg?resize=350%2C133&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-Messaging-Queuing-Telemetry-Transmit-protocol.jpg?resize=350%2C206&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-Advance-Message-Queuing-Protocol.jpg?resize=350%2C160&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-4-CoAP.jpg?resize=350%2C84&ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-5-Constrained-Application-Protocol-architecture.jpg?resize=350%2C224&ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-6-Extensible-Messaging-and-Presence-Protocol.jpg?resize=350%2C46&ssl=1 diff --git a/sources/talk/20191024 4 ways developers can have a say in what agile looks like.md b/sources/talk/20191024 4 ways developers can have a say in what agile looks like.md new file mode 100644 index 0000000000..1c247c622e --- /dev/null +++ b/sources/talk/20191024 4 ways developers can have a say in what agile looks like.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways developers can have a say in what agile looks like) +[#]: via: (https://opensource.com/article/19/10/ways-developers-what-agile) +[#]: author: (Clement Verna https://opensource.com/users/cverna) + +4 ways developers can have a say in what agile looks like +====== +How agile is implemented—versus imposed—plays a big role in what +developers gain from it. +![Person on top of a mountain, arm raise][1] + +Agile has become the default way of developing software; sometimes, it seems like every organization is doing (or wants to do) agile. But, instead of trying to change their culture to become agile, many companies try to impose frameworks like scrum onto developers, looking for a magic recipe to increase productivity. This has unfortunately created some bad experiences and leads developers to feel like agile is something they would rather avoid. This is a shame because, when it's done correctly, developers and their projects benefit from becoming involved in it. Here are four reasons why. + +### Agile, back to the basics + +The first way for developers to be unafraid of agile is to go back to its basics and remember what agile is really about. Many people see agile as a synonym for scrum, kanban, story points, or daily stand-ups. While these are important parts of the [agile umbrella][2], this perception takes people away from the original spirit of agile. + +Going back to agile's origins means looking at the [Agile Manifesto][3], and what I believe is its most important part, the introduction: + +> We are uncovering better ways of developing software by doing it and helping others do it. + +I'm a believer in continuous improvement, and this sentence resonates with me. It emphasizes the importance of having a [growth mindset][4] while being a part of an agile team. In fact, I think this outlook is a solution to most of the problems a team may face when adopting agile. + +Scrum is not working for your team? Right, let's discover a better way of organizing it. You are working in a distributed team across multiple timezones, and having a daily standup is not ideal? No problem, let's find a better way to communicate and share information. + +Agile is all about flexibility and being able to adapt to change, so be open-minded and creative to discover better ways of collaborating and developing software. + +### Agile metrics as a way to improve, not control + +Indeed, agile is about adopting and embracing change. Metrics play an important part in this process, as they help the team determine if it is heading in the right direction. As an agile developer, you want metrics to provide the data your team needs to support its decisions, including whether it should change directions. This process of learning from facts and experience is known as empiricism, and it is well-illustrated by the three pillars of agile. + +![Three pillars of agile][5] + +Unfortunately, in most of the teams I've worked with, metrics were used by project management as an indicator of the team's performance, which causes people on the team to be afraid of implementing changes or to cut corners to meet expectations. + +In order to avoid those outcomes, developers need to be in control of their team's metrics. They need to know exactly what is measured and, most importantly, why it's being measured. Once the team has a good understanding of those factors, it will be easier for them to try new practices and measure their impact. + +Rather than using metrics to measure your team's performance, engage with management to find a better way to define what success means to your team. + +### Developer power is in the team + +As a member of an agile team, you have more power than you think to help build a team that has a great impact. The [Toyota Production System][6] recognized this long ago. Indeed, Toyota considered that employees, not processes, were the key to building great products. + +This means that, even if a team uses the best process possible, if the people on the team are not comfortable working with each other, there is a high chance that the team will fail. As a developer, invest time to build trust inside your team and to understand what motivates its members. + +If you are curious about how to do this, I recommend reading Alexis Monville's book [_Changing Your Team from the Inside_][7]. + +### Making developer work visible + +A big part of any agile methodology is to make information and work visible; this is often referred to as an [information radiator][8]. In his book [_Teams of Teams_][9], Gen. Stanley McChrystal explains how the US Army had to transform itself from an organization that was optimized on productivity to one optimized to adapt. What we learn from his book is that the world in which we live has changed. The problem of becoming more productive was mostly solved at the end of the 20th century, and the challenge that companies now face is how to adapt to a world in constant evolution. + +![A lot of sticky notes on a whiteboard][10] + +I particularly like Gen. McChrystal's explanation of how he created a powerful information radiator. When he took charge of the [Joint Special Operations Command][11], Gen. McChrystal began holding a daily call with his high commanders to discuss and plan future operations. He soon realized that this was not optimal and instead started running 90-minute briefings every morning for 7,000 people around the world. This allowed every task force to acquire the knowledge necessary to accomplish their missions and made them aware of other task forces' assignments and situations. Gen. McChrystal refers to this as "shared consciousness." + +So, as a developer, how can you help build a shared consciousness in your team? Start by simply sharing what you are working on and/or plan to work on and get curious about what your colleagues are doing. + +* * * + +If you're using agile in your development organization, what do you think are its main benefits? And if you aren't using agile, what barriers are holding your team back? Please share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/ways-developers-what-agile + +作者:[Clement Verna][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/cverna +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/developer_mountain_cloud_top_strong_win.jpg?itok=axK3EX-q (Person on top of a mountain, arm raise) +[2]: https://confluence.huit.harvard.edu/display/WGAgile/2014/07/01/The+Agile+Umbrella +[3]: https://agilemanifesto.org/ +[4]: https://www.edglossary.org/growth-mindset/ +[5]: https://opensource.com/sites/default/files/uploads/3pillarsofagile.png (Three pillars of agile) +[6]: https://en.wikipedia.org/wiki/Toyota_Production_System#Respect_for_people +[7]: https://leanpub.com/changing-your-team-from-the-inside#packages +[8]: https://www.agilealliance.org/glossary/information-radiators/ +[9]: https://www.mcchrystalgroup.com/insights-2/teamofteams/ +[10]: https://opensource.com/sites/default/files/uploads/stickynotes.jpg (A lot of sticky notes on a whiteboard) +[11]: https://en.wikipedia.org/wiki/Joint_Special_Operations_Command diff --git a/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md b/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md new file mode 100644 index 0000000000..76bd69c4fa --- /dev/null +++ b/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gartner crystal ball: Looking beyond 2020 at the top IT-changing technologies) +[#]: via: (https://www.networkworld.com/article/3447759/gartner-looks-beyond-2020-to-foretell-the-top-it-changing-technologies.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Gartner crystal ball: Looking beyond 2020 at the top IT-changing technologies +====== +Gartner’s top strategic predictions for 2020 and beyond is heavily weighted toward the human side of technology +[Thinkstock][1] + +ORLANDO –  Forecasting long-range IT technology trends is a little herding cats – things can get a little crazy. + +But Gartner analysts have specialized in looking forwardth, boasting an 80 percent  accuracy rate over the years, Daryl Plummer, distinguished vice president and Gartner Fellow told the IT crowd at this year’s [IT Symposium/XPO][2].  Some of those successful prediction have included the rise of automation, robotics, AI technology  and other ongoing trends. + +[Now see how AI can boost data-center availability and efficiency][3] + +Like some of the [other predictions][4] Gartner has made at this event, this year’s package of predictions for 2020 and beyond is heavily weighted toward the human side of technology rather than technology itself.  + +**[ [Become a Microsoft Office 365 administrator in record time with this quick start course from PluralSight.][5] ]** + + “Beyond offering insights into some of the most critical areas of technology evolution, this year’s predictions help us move beyond thinking about mere notions of technology adoption and draw us more deeply into issues surrounding what it means to be human in the digital world.” Plummer said. + +The list this year goes like this: + +**By 2023, the number of people with disabilities employed will triple due to AI and emerging technologies, reducing barriers to access.** + +Technology is going to make it easier for people with  disabilities  to connect to the business world. “People with disabilities constitute an untapped pool of critically skilled talent,” Plummer said. + +“[Artificial intelligence (AI)][6], augmented reality (AR), virtual reality (VR) and other [emerging technologies][7] have made work more accessible for employees with disabilities. For example, select restaurants are starting to pilot AI robotics technology that enables paralyzed employees to control robotic waiters remotely. Organizations that actively employ people with disabilities will not only cultivate goodwill from their communities, but also see 89 percent higher retention rates, a 72 percent increase in employee productivity, and a 29 percent increase in profitability,” Plummer said. + +**By 2024, AI identification of emotions will influence more than half of the online advertisements you see.** + +Computer vision, which allows AI to identify and interpret physical environments, is one of the key technologies used for emotion recognition and has been ranked by Gartner as one of the most important technologies in the next three to five years.  [Artificial emotional intelligence (AEI)][8] is the next frontier for AI development, Plummer said.  Twenty-eight percent of marketers ranked AI and machine learning (ML) among the top three technologies that will drive future marketing impact, and 87 percent of marketing organizations are currently pursuing some level of personalization, according to Gartner. By 2022, 10 percent of personal devices will have emotion AI capabilities, Gartner predicted. + +“AI makes it possible for both digital and physical experiences to become hyper personalized, beyond clicks and browsing history but actually on how customers _feel_ in a specific purchasing moment. With the promise to measure and engage consumers based on something once thought to be intangible, this area of ‘empathetic marketing’ holds tremendous value for both brands and consumers when used within the proper [privacy][9] boundaries,” said Plummer. + +**Through 2023, 30% of IT organizations will extend BYOD policies with “bring your own enhancement” (BYOE) to address augmented humans in the workforce.** + +The concept of augmented workers has gained traction in social media conversations in 2019 due to advancements in wearable technology. Wearables are driving workplace productivity and safety across most verticals, including automotive, oil and gas, retail and healthcare. + +Wearables are only one example of physical augmentations available today, but humans will look to additional physical augmentations that will enhance their personal lives and help do their jobs. Gartner defines human augmentation as creating cognitive and physical improvements as an integral part of the human body. An example is using active control systems to create limb prosthetics with characteristics that can exceed the highest natural human performance. + +“IT leaders certainly see these technologies as impactful, but it is the consumers’ desire to physically enhance themselves that will drive the adoption of these technologies first,” Plummer said. “Enterprises need to balance the control of these devices in their enterprises while also enabling users to use them for the benefit of the organization.” + +**By 2025, 50% of people with a smartphone but without a bank account will use a mobile-accessible cryptocurrency account.** + +Currently 30 percent of people have no bank account and 71 percent will subscribe to mobile services by 2025.  Major online marketplaces and social media platforms will start supporting cryptocurrency payments by the end of next year. By 2022, Facebook, Uber, Airbnb, eBay, PayPal and other digital e-commerce companies will support over 750 million customer, Gartner predicts. + +At least half the globe’s citizens who do not use a bank account will instead use these new mobile-enabled cryptocurrency account services offered by global digital platforms by 2025, Gartner said. + +**By 2023, a self-regulating association for oversight of AI and machine-learning designers will be established in at least four of the G7 countries.** + +By 2021, multiple incidents involving non-trivial AI-produced harm to hundreds or thousands of individuals can be expected, Gartner said.  Public demand for protection from the consequences of malfunctioning algorithms will in turn produce pressure to assign legal liability for the harmful consequences of algorithm failure. The immediate impact of regulation of process will be to increase cycle times for AI and ML algorithm development and deployment. Enterprises can also expect to spend more for training and certification for practitioners and documentation of processes, as well as higher salaries for certified personnel.  + +“Regulation of products as complex as AI and ML algorithms is no easy task. Consequences of algorithm failures at scale that occur within major societal functions are becoming more visible. For instance, AI-related failures in autonomous vehicles and aircraft have already killed people and attracted widespread attention in recent months,” said Plummer. + +**By 2023, 40% of professional workers will orchestrate their business application experiences and capabilities like they do their music streaming experience.** + +The human desire to have a work environment that is similar to their personal environment continues to rise — one where they can assemble their own applications to meet job and personal requirements in a [self-service fashion][10]. The consumerization of technology and introduction of new applications have elevated the expectations of employees as to what is possible from their business applications. Gartner says through 2020, the top 10 enterprise-application vendors will expose over 90 percent of their application capabilities through APIs. + +“Applications used to define our jobs. Nowadays, we are seeing organizations designing application experiences around the employee. For example, mobile and cloud technologies are freeing many workers from coming into an office and instead supporting a work-anywhere environment, outpacing traditional application business models,”  Plummer said. “Similar to how humans customize their streaming experience, they can increasingly customize and engage with new application experiences.” + +**By 2023, up to 30 percent of world news and video content will be authenticated as real by blockchain countering deep fake technology.** + +Fake news represents deliberate disinformation, such as propaganda that is presented to viewers as real news. Its rapid proliferation in recent years can be attributed to bot-controlled accounts on social media, attracting more viewers than authentic news and manipulating human intake of information, Plummer said. Fake content, exacerbated by AI can pose an existential threat to an organization. + +By 2021, at least 10 major news organizations will use [blockchain][11] to track and prove the authenticity of their published content to readers and consumers. Likewise, governments, technology giants and other entities are fighting back through industry groups and proposed regulations. “The IT organization must work with content-production teams to establish and track the origin of enterprise-generated content using blockchain technology,” Plummer said.   + +**On average, through 202, digital transformation initiatives will take large traditional enterprises  twice as long and cost twice as much as anticipated.** + +Business leaders’ expectations for revenue growth are unlikely to be realized from digital optimization strategies, due to the cost of technology modernization and the unanticipated costs of simplifying operational interdependencies. Such operational complexity also impedes the pace of change along with the degree of innovation and adaptability required to operate as a digital business. + +“In most traditional organizations, the gap between digital ambition and reality is large,” Plummer said. “We expect CIOs’ budget allocation for IT modernization to grow 7 percent year-over-year through 2021 to try to close that gap.” + +**By 2023, individual activities will be tracked digitally by an “Internet of Behavior” to influence, benefit and service eligibility for 40% of people worldwide.** + +Through facial recognition, location tracking and big data, organizations are starting to monitor individual behavior and link that behavior to other digital actions, like buying a train ticket. The Internet of Things (IoT) – where physical things are directed to do a certain thing based on a set of observed operating parameters relative to a desired set of operating parameters — is now being extended to people, known as the Internet of Behavior (IoB).  Through 2020 watch for examples of usage-based and behaviorally-based business models to expand into health insurance or financial services, Plummer said. + +“With IoB, value judgements are applied to behavioral events to create a desired state of behavior,” Plummer said. “What level of tracking will we accept? Will it be hard to get life insurance if your Fitbit tracker doesn’t see 10,000 steps a day?” + +“Over the long term, it is likely that almost everyone living in a modern society will be exposed to some form of IoB that melds with cultural and legal norms of our existing predigital societies,”  Plummer said + +**By 2024, the World Health Organization will identify online shopping as an  addictive disorder, as millions abuse digital commerce and encounter financial stress.** + +Consumer spending via digital commerce platforms will continue to grow over 10 percent year-over-year through 2022. In addition watch for an increased number of digital commerce orders predicted by, and initiated by, AI. + +The ease of online shopping will cause financial stress for millions of people, as online retailers increasingly use AI and personalization to effectively target consumers and prompt them to spend income that they do not have. The resulting debt and personal bankruptcies will cause depression and other health concerns caused by stress, which is capturing the attention of the WHO. + +“The side effects of technology that promote addictive behavior are not exclusive to consumers. CIOs must also consider the possibility of lost productivity among employees who put work aside for online shopping and other digital distractions. In addition, regulations in support of responsible online retail practices might force companies to provide warnings to prospective customers who are ready to make online purchases, similar to casinos or cigarette companies,” Plummer said. + +Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447759/gartner-looks-beyond-2020-to-foretell-the-top-it-changing-technologies.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]: http://thinkstockphotos.com +[2]: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html +[3]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[4]: https://www.networkworld.com/article/3447401/gartner-top-10-strategic-technology-trends-for-2020.html +[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fadministering-office-365-quick-start +[6]: https://www.gartner.com/en/newsroom/press-releases/2019-07-15-gartner-survey-reveals-leading-organizations-expect-t +[7]: https://www.gartner.com/en/newsroom/press-releases/2018-08-20-gartner-identifies-five-emerging-technology-trends-that-will-blur-the-lines-between-human-and-machine +[8]: https://www.gartner.com/smarterwithgartner/13-surprising-uses-for-emotion-ai-technology/ +[9]: https://www.gartner.com/smarterwithgartner/how-to-balance-personalization-with-data-privacy/ +[10]: https://www.gartner.com/en/newsroom/press-releases/2019-05-28-gartner-says-the-future-of-self-service-is-customer-l +[11]: https://www.gartner.com/smarterwithgartner/the-cios-guide-to-blockchain/ +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md b/sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md new file mode 100644 index 0000000000..c9e32f85e2 --- /dev/null +++ b/sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux Story: Why introduce people to the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/10/new-linux-open-source-users) +[#]: author: (RolandBerberich https://opensource.com/users/rolandberberich) + +My Linux Story: Why introduce people to the Raspberry Pi +====== +Learn why I consider the Raspberry Pi one of our best opportunities to +invite more people to the open source community. +![Team of people around the world][1] + +My first steps into Linux happened around 2003 or 2004 when I was a student. The experiment lasted an hour or two. Being used to Windows, I was confused and quickly frustrated at having to learn the most basic stuff again. + +By 2018, I was curious enough to try Ubuntu before settling on Fedora 29 on an unused laptop, and to get a Pi3B+ and Pi4, both currently running Raspbian. What changed? Well, first of all, Linux has certainly changed. Also, by that time I was not only curious but more patient than my younger self by that time. Reflecting on this experience, I reckon that patience to overcome the perceived usability gap is the key to Linux satisfaction. Just one year later, I can confidently say I am productive in both Windows as well as (my) Linux environments. + +This experience has brought up two questions. First, why are more people not using Linux (or other open source software)? Second, what can the savvier among us could do to improve these numbers? Of course, these questions assume the open source world has advantages over the more common alternatives, and that some of us would go to ends of the Earth to convince the non-believers. + +Believe it or not, this last issue is one of the problems. By far, I am not a Linux pro. I would rather describe myself as a "competent user" able to solve a few issues by myself. Admittedly, internet search engines are my friend, but step-by-step I accumulated the expertise and confidence to work outside the omnipresent Windows workspace. + +On the other hand, how technophile is the standard user? Probably not at all. The internet is full of "have you switched it on" examples to illustrate the incompetence of users. Now, imagine someone suggests you are incompetent and then offers (unsolicited) advice on how to improve. How well would you take that, especially if you consider yourself "operational" (meaning that you have no problems at work or surfing the web)? + +### Introduce them to the Raspberry Pi + +Overcoming this initial barrier is crucial, and we cannot do so with a superiority complex. Personally, I consider the Raspberry Pi one of our best opportunities to invite more people to the open source community. The Raspberry Pi’s simplicity combined with its versatility and affordability could entice more people to get and use one. + +I recently upgraded my Pi3B+ to the new Pi4B, and with the exception of my usual reference manager, this unit fully replaces my (Windows) desktop. My next step is to use a Pi3B+ as a media center and gaming console. The point is that if we want people to use open source software, we need to make it accessible for everyday tasks such as the above. Realizing it isn't that difficult will do more for user numbers than aloof superiority from open source advocates, or Linux clubs at university. + +It is one thing to keep preaching the many advantages of open source, but a more convincing experience can only be a personal one. Obviously, people will realize the cost advantage of, say, a Pi4 running Linux over a standard supermarket Windows PC. And humans are curious. An affordable gadget where mistakes are easy to correct (clone your card, it is not hard) will entice more and more users to fiddle around and get first hand IT knowledge. Maybe none of us will be an expert (I count myself among this crowd) but the least that will happen is wider use of open source software with users realizing that is is a viable alternative. + +With curiosity rampant, a Pi club at school or university could make younger workers competent in Linux. Some of these workers perhaps will bring their SD card to work, plug it into any Raspberry Pi provided, and start being productive. Imagine the potential savings in regards to IT. Imagine the flexibility of choosing any space in the office and having your own work environment with you. + +Wider use of open source solutions will not only add flexibility. Targetting mainly Windows environments, your systems will be somewhat safer from attacks, and with more demand, more resources will pour into further development. Consequently, this trend will force propriety software developers to up their game, which is also good for users of course. + +In summary, my point is to reflect as a community how we can improve our resource base by following my journey. We can only do so by starting early, accessibly, and affordably, and by showing that open source is a real alternative for any professional application on a daily basis. + +There are lots of non-code ways to contribute to open source: Here are three alternatives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/new-linux-open-source-users + +作者:[RolandBerberich][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/rolandberberich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) diff --git a/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md b/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md new file mode 100644 index 0000000000..2990d249cb --- /dev/null +++ b/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The evolution to Secure Access Service Edge (SASE) is being driven by necessity) +[#]: via: (https://www.networkworld.com/article/3448276/the-evolution-to-secure-access-service-edge-sase-is-being-driven-by-necessity.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +The evolution to Secure Access Service Edge (SASE) is being driven by necessity +====== +The users and devices are everywhere. As a result, secure access services also need to be everywhere. +MF3d / Getty Images + +The WAN consists of network and security stacks, both of which have gone through several phases of evolution. Initially, we began with the router, introduced WAN optimization, and then edge SD-WAN. From the perspective of security, we have a number of firewall generations that lead to network security-as-a-service. In today’s scenario, we have advanced to another stage that is more suited to today’s environment. This stage is the convergence of network and security in the cloud. + +For some, the network and security trends have been thought of in terms of silos. However, the new market category of secure access service edge (SASE) challenges this ideology and recommends a converged cloud-delivered secure access service edge. + +Gartner proposes that the future of the network and network security is in the cloud. This is similar to what [Cato Networks][1] has been offering for quite some time – the convergence of networking and security-as-a-service capabilities into a private, global cloud. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +We all know; when we employ anything new, there will be noise. Therefore, it's difficult to dissect the right information and understand who is doing what and if SASE actually benefits your organization. And this is the prime motive of this post. However, before we proceed, I have a question for you. + +Will combining the comprehensive WAN capabilities with comprehensive network security functions be the next evolution? In the following sections, I would like to discuss each of the previous network and security stages to help you answer the same question. So, first, let’s begin with networking. + +### The networking era + +### The router + +We started with the router at the WAN edge, configured with routing protocols. Routing protocols do not make a decision on global information and are limited to the routing loop restrictions. This restricts the number of paths that the application traffic can take. + +For a redundant WAN design, we need the complex BGP tuning to the load balance between the border edges along with the path attributes. This is because these path attributes may not choose the best performing path. By and large, the shortest path is not necessarily the best path. + +**[ Now read [20 hot jobs ambitious IT pros should shoot for][3]. ]** + +The WAN edge exhibited a rigid network topology that applications had to fit into. Security was provided by pushing the traffic from one appliance to another. With the passage of time, we began to see the rise of real-time voice and video traffic which are highly sensitive to latency and jitter. Hence, the WAN optimization was a welcomed feature. + +### WAN optimization + +The basic WAN optimization includes a range of TCP optimizations and basic in-line compression. The advanced WAN optimization includes deduplication, file-based caching and protocol-specific optimizations. This, indeed, helped in managing the latency-sensitive applications and applications where large amounts of data must be transferred across the WAN. + +However, it was a complex deployment. A WAN optimization physical appliance was needed at both ends of the connection and had to be used for all the applications. At that time, it was an all or nothing approach and you couldn’t roll out WAN optimization per application. Besides, it had no effect on the remote workers where the users were not located in the office. + +Subsequently, SD-WAN started to appear in 2015. During this year, I was consulting an Azure migration and attempting to [create my own DIY SD-WAN][4] _[Disclaimer: the author works for Network Insight]_ with a protocol called Tina from Barracuda. Since I was facing some challenges, so I welcomed the news of SD-WAN with open arms. For the first time, we had a decent level of abstraction in the WAN that was manageable. + +Deploying SD-WAN allows me to have all the available bandwidth. Contrarily, many of the WAN optimization techniques such as data compression and deduplication are not as useful. + +But others, such as error correction, protocol, and application acceleration could still be useful and are widely used today. Regardless of how many links you bundle, it might still result in latency and packet loss unless of course, you privatize as much as possible. + +### The security era + +### Packet filters + +Elementally, the firewall is classed in a number of generations. We started with the first-generation firewalls that are just simple packet filters. These packet filters match on layer 2 to 4 headers. Since most of them do not match on the TCP SYN flags it’s impossible to identify the established sessions. + +### Stateful devices + +The second-generation firewalls refer to stateful devices. Stateful firewalls keep the state connections and the return traffic is permitted if the state for that flow is in the connection table. + +These stateful firewalls did not inspect at an application level. The second-generation firewalls were stateful and could track the state of the session. However, they could not go deeper into the application, for example, examining the HTTP content and inspecting what users are doing. + +### Next-generation firewalls + +Just because a firewall is stateful doesn’t mean it can examine the application layer and determine what users are doing. Therefore, we switched to the third-generation firewalls. + +These firewall types are often termed as the next-generation firewalls because they offer layer 7 inspections combined with other network device filtering functionalities. Some examples could be an application firewall using an in-line deep packet inspection (DPI) or intrusion prevention system (IPS). + +Eventually, other niche devices started to emerge, called application-level firewalls. These devices are usually only concerned with the HTTP traffic, also known as web application firewalls (WAF). The WAF has similar functionality to reverse the web proxy, thereby terminating the HTTP session. + +From my experience, while designing the on-premises active/active firewalls with a redundant WAN, you must keep an eye on the asymmetric traffic flows. If the firewall receives a packet that does not have any connection/state information for that packet, it will drop the packet. + +Having an active/active design is complicated, whereas the active/passive design with an idle firewall is expensive. Anyways, if you manage to piece together a redundant design, most firewall vendors will require the management of security boxes instead of delivering policy-based security services. + +### Network Security-as-a-Service + +We then witnessed some major environmental changes. The introduction of the cloud and workload mobility changed the network and security paradigm completely. Workload fluidity and the movement of network state put pressure on the traditional physical security devices. + +The physical devices cannot follow workloads and you can’t move a physical appliance around the network. There is also considerable operational overhead. We have to constantly maintain these devices which literally becomes a race against time. For example, when a new patch is issued there will be a test, stage and deploy phase. All of this needs to be done before the network becomes prone to vulnerability. + +Network Security-as-a-Service was one solution to this problem. Network security functions, such as the CASB, FWaaS cloud SWG are now pushed to the cloud. + +### Converging network and security + +All the technologies described above have a time and a place. But these traditional networks and network security architectures are becoming increasingly ineffective. + +Now, we have more users, devices, applications, services and data located outside of an enterprise than inside. Hence, with the emergence of edge and cloud-based service, we need a completely different type of architecture. + +The SASE proposes combining the network-as-a-service capabilities (SD-WAN, WAN optimization, etc.) with the Security-as-a-Service (SWG, CASB, FWaaS, etc.) to support the dynamic secure access. It focuses extensively on the identity of the user and/or device, not the data center. + +Then policy can be applied to the identity and context. Following this model inverts our thinking about network and security. To be fair, we have seen the adoption of some cloud-based services including cloud-based SWG, content delivery network (CDN) and the WAF. However, the overarching design stays the same – the data center is still the center of most enterprise networks and network security architectures. Yet, the user/identity should be the new center of its operations. + +In the present era, we have dynamic secure access requirements. The users and devices are everywhere. As a result, secure access services need to be everywhere and distributed closer to the systems and devices that require access. When pursuing a data-centric approach to cloud security, one must follow the data everywhere it goes. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3448276/the-evolution-to-secure-access-service-edge-sase-is-being-driven-by-necessity.html + +作者:[Matt Conran][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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/blog/the-secure-access-service-edge-sase-as-described-in-gartners-hype-cycle-for-enterprise-networking-2019/ +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html +[4]: https://network-insight.net/2015/07/azure-expressroute-cloud-ix-barracuda/ +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md b/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md new file mode 100644 index 0000000000..0439e944c9 --- /dev/null +++ b/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NICT successfully demos petabit-per-second network node) +[#]: via: (https://www.networkworld.com/article/3447857/nict-successfully-demos-petabit-per-second-network-node.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +NICT successfully demos petabit-per-second network node +====== +One-petabit-per-second signals could send 8K resolution video to 10 million people simultaneously, researchers say. Japan’s national research agency says it has just successfully demoed a networked version of it. +Thinkstock + +Petabit-class networks will support more than 100-times the capacity of existing networks, according to scientists who have just demonstrated an optical switching rig designed to handle the significant amounts of data that would pour through future petabit cables. One petabit is equal to a thousand terabits, or a million gigabits. + +Researchers at the [National Institute of Information and Communications Technology][1] (NICT) in Japan routed signals with capacities ranging from 10 terabits per second to 1 petabit per second through their node. Those kinds of capacities, which could send 8K resolution video to 10 million people simultaneously, are going to be needed for future broadband video streaming and Internet of Things at scale, researchers believe. In-data-center applications and backhaul could benefit. + +“Petabit-class transmission requires petabit-class switching technologies to manage and reliably direct large amounts of data through complex networks, NICT said in a [press release][2]. “Up to now, such technologies have been beyond reach, because the existing approaches are limited by complexity and, or performance.” + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +In this case, NICT used “large-scale” spatial optical switching with spatial-division multiplexing to build its node. Three types of multicore fibers were incorporated, all with different capacities, in order to represent different scenarios, like metropolitan or regional networks. MEMS technology, too, was incorporated. That’s equipment built on micro-electro-mechanical systems, or a kind of merging of micrometer-measured, nanoscale electronics devices with moving parts. + +NICT says that within its testing, it was able to not only perform the one petabit optical switching, but also was able to run a redundant configuration at one petabit per second. That’s to support network failures such as breaks in the fiber. It used 22-core fiber for both of those scenarios. + +Additionally, NICT branched the one petabit signals into other multicore optical fibers with miscellaneous capacities. It used 22-Core Fiber, 7-Core Fiber and 3-Mode Fiber. Finally, running at a slower 10 terabits per second, it managed that lower capacity signal within the capacious one petabit per second network— NICT says that that kind of application would be most suitable for regional networks, whereas the other scenarios apply best to metro networks. + +Actual, straight, petabit-class transmissions over fiber have been achieved before. In 2015 NICT was involved in the successful testing of a 2.15 petabit per second signal over a single 22-core fiber. Then, it said, [in a press release][4], that it was making “progress to the practical realization of an over one petabit per second optical fiber.” (Typical [real-world limits][5], right now, include 26.2 terabits, in an experiment, over a transatlantic cable, and an 800 gigabit fiber data center solution Ciena is pitching.) + +**More about SD-WAN**: [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][6] • [How to pick an off-site data-backup method][7] •  [SD-Branch: What it is and why you’ll need it][8] • [What are the options for security SD-WAN?][9] + +In 2018 NICT said, in another [news release][10], that it had tested a petabit transmission over thinner 4-core, 3-mode fiber with a diameter of 0.16 mm (0.006 inches): There’s an advantage to getting the cladding diameter as small as possible—smaller diameter fiber has less propensity to mechanical stress damage, such as bending or pulling, NICT explains. It can also be connected less problematically if it has a similar diameter to existing fiber cables, already run. + +“This is a major step forward towards practical petabit-class backbone networks,” NICT says of its current 22-core fiber, one petabit per second switch capacity experiments. These will end up being “backbone optical networks capable of supporting the increasing requirements of internet services,” it says. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447857/nict-successfully-demos-petabit-per-second-network-node.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.nict.go.jp/en/about/index.html +[2]: https://www.nict.go.jp/en/press/2019/10/17-1.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.nict.go.jp/en/press/2015/10/13-1.html +[5]: https://www.networkworld.com/article/3374545/data-center-fiber-to-jump-to-800-gigabits-in-2019.html +[6]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html +[7]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[8]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html +[9]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html +[10]: https://www.nict.go.jp/en/press/2018/11/21-1.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191025 Why I made the switch from Mac to Linux.md b/sources/talk/20191025 Why I made the switch from Mac to Linux.md new file mode 100644 index 0000000000..342a6c9bd3 --- /dev/null +++ b/sources/talk/20191025 Why I made the switch from Mac to Linux.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I made the switch from Mac to Linux) +[#]: via: (https://opensource.com/article/19/10/why-switch-mac-linux) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Why I made the switch from Mac to Linux +====== +Thanks to a lot of open source developers, it's a lot easier to use +Linux as your daily driver than ever before. +![Hands programming][1] + +I have been a huge Mac fan and power user since I started in IT in 2004. But a few months ago—for several reasons—I made the commitment to shift to Linux as my daily driver. This isn't my first attempt at fully adopting Linux, but I'm finding it easier than ever. Here is what inspired me to switch. + +### My first attempt at Linux on the desktop + +I remember looking up at the projector, and it looking back at me. Neither of us understood why it wouldn't display. VGA cords were fully seated with no bent pins to be found. I tapped every key combination I could think of to signal my laptop that it's time to get over the stage fright. + +I ran Linux in college as an experiment. My manager in the IT department was an advocate for the many flavors out there, and as I grew more confident in desktop support and writing scripts, I wanted to learn more about it. IT was far more interesting to me than my computer science degree program, which felt so abstract and theoretical—"who cares about binary search trees?" I thought—while our sysadmin team's work felt so tangible. + +This story ends with me logging into a Windows workstation to get through my presentation for class, and marks the end of my first attempt at Linux as my day-to-day OS. I admired its flexibility, but compatibility was lacking. I would occasionally write a script that SSHed into a box to run another script, but I stopped using Linux on a day-to-day basis. + +### A fresh look at Linux compatibility + +When I decided to give Linux another go a few months ago, I expected more of the same compatibility nightmare, but I couldn't be more wrong. + +Right after the installation process completed, I plugged in a USB-C hub to see what I'd gotten myself into. Everything worked immediately. The HDMI-connected extra-wide monitor popped up as a mirrored display to my laptop screen, and I easily adjusted it to be a second monitor. The USB-connected webcam, which is essential to my [work-from-home life][2], showed up as a video with no trouble at all. Even my Mac charger, which was already plugged into the hub since I've been using a Mac, started to charge my very-not-Mac hardware. + +My positive experience was probably related to some updates to USB-C, which received some needed attention in 2018 to compete with other OS experiences. As [Phoronix explained][3]: + +> "The USB Type-C interface offers an 'Alternate Mode' extension for non-USB signaling and the biggest user of this alternate mode in the specification is allowing DisplayPort support. Besides DP, another alternate mode is the Thunderbolt 3 support. The DisplayPort Alt Mode supports 4K and even 8Kx4K video output, including multi-channel audio. +> +> "While USB-C alternate modes and DisplayPort have been around for a while now and is common in the Windows space, the mainline Linux kernel hasn't supported this functionality. Fortunately, thanks to Intel, that is now changing." + +Thinking beyond ports, a quick scroll through the [Linux on Laptops][4] hardware options shows a much more complete set of choices than I experienced in the early 2000s. + +This has been a night-and-day difference from my first attempt at Linux adoption, and it's one I welcome with open arms. + +### Breaking out of Apple's walled garden + +Using Linux has added new friction to my daily workflow, and I love that it has. + +My Mac workflow was seamless: hop on an iPad in the morning, write down some thoughts on what my day will look like, and start to read some articles in Safari; slide over my iPhone to continue reading; then log into my MacBook where years of fine-tuning have worked out how all these pieces connect. Keyboard shortcuts are built into my brain; user experiences are as they've mostly always been. It's wildly comfortable. + +That comfort comes with a cost. I largely forgot how my environment functions, and I couldn't answer questions I wanted to answer. Did I customize some [PLIST files][5] to get that custom shortcut, or did I remember to check it into [my dotfiles][6]? How did I get so dependent on Safari and Chrome when Firefox has a much better mission? Or why, specifically, won't I use an Android-based phone instead of my i-things? + +On that note, I've often thought about shifting to an Android-based phone, but I would lose the connection I have across all these devices and the little conveniences designed into the ecosystem. For instance, I wouldn't be able to type in searches from my iPhone for the Apple TV or share a password with AirDrop with my other Apple-based friends. Those features are great benefits of homogeneous device environments, and it is remarkable engineering. That said, these conveniences come at a cost of feeling trapped by the ecosystem. + +I love being curious about how devices work. I want to be able to explain environmental configurations that make it fun or easy to use my systems, but I also want to see what adding some friction does for my perspective. To paraphrase [Marcel Proust][7], "The real voyage of discovery consists not in seeking new lands but seeing with new eyes." My use of technology has been so convenient that I stopped being curious about how it all works. Linux gives me an opportunity to see with new eyes again. + +### Inspired by you + +All of the above is reason enough to explore Linux, but I have also been inspired by you. While all operating systems are welcome in the open source community, Opensource.com writers' and readers' joy for Linux is infectious. It inspired me to dive back in, and I'm enjoying the journey. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/why-switch-mac-linux + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/article/19/8/rules-remote-work-sanity +[3]: https://www.phoronix.com/scan.php?page=news_item&px=Linux-USB-Type-C-Port-DP-Driver +[4]: https://www.linux-laptop.net/ +[5]: https://fileinfo.com/extension/plist +[6]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[7]: https://www.age-of-the-sage.org/quotations/proust_having_seeing_with_new_eyes.html diff --git a/sources/talk/20191028 6 signs you might be a Linux user.md b/sources/talk/20191028 6 signs you might be a Linux user.md new file mode 100644 index 0000000000..d66d08cf35 --- /dev/null +++ b/sources/talk/20191028 6 signs you might be a Linux user.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 signs you might be a Linux user) +[#]: via: (https://opensource.com/article/19/10/signs-linux-user) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 signs you might be a Linux user +====== +If you're a heavy Linux user, you'll probably recognize these common +tendencies. +![Tux with binary code background][1] + +Linux users are a diverse bunch, but many of us share a few habits. You might not have any of the telltale signs listed in this article, and if you're a new Linux user, you may not recognize many of them... yet. + +Here are six signs you might be a Linux user. + +### 1\. As far as you know, the world began on January 1, 1970. + +There are many rumors about why a Unix computer clock always sets itself back to 1970-01-01 when it resets. But the mundane truth is that the Unix "epoch" serves as a common and simple reference point for synchronization. For example, Halloween is the 304th day of this year in the Julian calendar, but we commonly refer to the holiday as being "on the 31st". We know which 31st we mean because we have common reference points: We know that Halloween is celebrated in October and that October is the 10th month of the year, and we know how many days each preceding month contains. Without these values, we could use traditional methods of timekeeping, such as phases of the moon, to keep track of special seasonal events, but of course, a computer doesn't have that ability. + +A computer requires firm and clearly defined values, so the value 1970-01-01T00:00:00Z was chosen as the beginning of the Unix epoch. Any time a [POSIX][2] computer loses track of time, a service like the Network Time Protocol (NTP) can provide it the number of seconds since 1970-01-01T00:00:00Z, which the computer can convert to a human-friendly date. + +Date and time are a famously complex thing to track in computing, largely because there are exceptions to nearly standard. A month doesn't always have 30 days, a year doesn't always have 365 days, and even seconds tend to drift a little each year. If you're looking for a fun and frustrating programming exercise, try to program a reliable calendaring application! + +### 2\. You think it's a chore to type anything over two letters to get something done. + +The most common Unix commands are famously short. In addition to commands like **cd** and **ls** and **mv**, there's one command that literally can't get any shorter: **w** (which shows who is currently logged in according to the **/var/run/utmp** file). + +On the one hand, extremely short commands seem unintuitive. A new user probably isn't going to guess that typing **ls** would _list_ directories. Once you learn the commands, though, the shorter they are, the better. If you spend all day in a terminal, the fewer keystrokes you have to type means you can spend more time getting your work done. + +Luckily, single-letter commands are far and few between, which means you can use most letters for aliases. For example, I use Emacs often enough that I consider **emacs** too long to type, so I alias it to **e** by adding this line to my **.bashrc** file: + + +``` +`alias e='emacs'` +``` + +You can also alias commands temporarily. For instance, if you find yourself running [firewall-cmd][3] repeatedly while you troubleshoot a network issue, then you can create an alias just for your current session: + + +``` +$ alias f='firewall-cmd' +$ f +usage: see firewall-cmd man page +No option specified. +``` + +As long as the terminal is open, your alias persists. Once the terminal is closed, it's forgotten. + +### 3\. You think it's a chore to click more than two times to get something done. + +Linux users are fond of efficiency. While not every Linux user is always in a hurry to get things done, there are conventions in Linux desktops that seek to reduce the number of actions required to accomplish any given task. Here are some examples. + + * In the KDE file manager Dolphin, a single click opens a file or directory. It's assumed that if you want to select a file, you can either click and drag or else Ctrl+Click instead. This may confuse users who are used to double-clicking everything, but once you've tried single-click actions, you usually can't go back to laborious double-clicks. + * On most Linux desktops, a middle-click pastes the most recent contents of the clipboard. + * On many Linux desktops, drag actions can be modified by pressing the Alt, Ctrl, or Shift keys. For instance, Alt+Drag moves a window in KDE, and Ctrl+Drag in GNOME causes a file to be copied instead of moved. + + + +### 4\. You've never performed any action on a computer more than three times because you've already automated it by the third time. + +Pardon the hyperbole, but many Linux users expect their computer to work harder than they do. While it takes time to learn how to automate common tasks, it tends to be easier on Linux than on other platforms because the Linux terminal and the Linux operating system are so tightly integrated. The easy things to automate are the actions you already do in a terminal because commands are just strings that you type into an interpreter, and that interpreter (the terminal) doesn't care whether you typed the strings out manually or whether you're just pointing it to a script. + +For instance, if you find yourself frequently moving a set of files from one place to another, then you can probably use the same sequence of instructions as a script, which you can trigger with a single command. Imagine you are doing this manually each morning: + + +``` +$ cd Documents +$ trash reports-latest.txt +$ wget myserver.local/reports/daily/report-latest.txt +$ cp report-latest.txt reports_daily/2019-31-10.log +``` + +It's a simple sequence, but repeating it daily isn't the most efficient way of spending your time. With a little bit of abstraction, you could automate it with a simple script: + + +``` +#!/bin/sh + +trash $HOME/Documents/reports-latest.txt + +wget myserver.local/reports/daily/report-latest.txt \ +-P $HOME/Documents/udpates_daily/`date --iso-8601`.log + +cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ +$HOME/Documents/reports-latest.txt +``` + +You could call your script **get-reports.sh** and launch it manually each morning, or you could even enter it into your crontab so that your computer performs the task without requiring any intervention from you. + +This can be confusing for a new user because it's not always obvious what's integrated with what. For instance, if you regularly find yourself opening images and scaling them down by 50%, then you're probably used to doing something like this: + + 1. Opening up your photo viewer or editor + 2. Scaling the image + 3. Exporting the image as a modified file + 4. Closing the application + + + +If you did this several times a day, you would probably get tired of the repetition. However, because you perform those actions in the graphical user interface (GUI), you would need to know how to script the GUI to automate it. Some applications, like [GIMP][4], have a rich scripting interface, but the process is obviously different than just adapting a bunch of commands and dumping those into a file. + +Then again, sometimes there are command-line equivalents to things you do in a GUI. Converting documents from one text format to another can be done with [Pandoc][5], images can be manipulated with [Image Magick][6], music and video can be edited and converted, and so on. It's a matter of knowing what to look for, and usually learning a new (and sometimes complex) command. Scaling images down, however, is notably simpler in the terminal than in a GUI: + + +``` +#!/bin/sh + +convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg +``` + +It's worth investigating those bothersome, repetitious tasks. You never know how simple and fast your work is for a computer to do! + +### 5\. You distro hop + +I'm an ardent Slackware user at home and a RHEL user at work. Actually, that's not true; I'm a Fedora user at work now. Except when I use CentOS. And there was that time I ran [Mageia][7] for a while. + +![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] + +Debian on a PowerPC64 box + +It doesn't matter how great a distribution is; part of the guilty pleasure of being a Linux user is the freedom to be indecisive about which distro you run. At a glance, they're all basically the same, and that's refreshing. But depending on your mood, you might prefer the stability of CentOS to the constant updates of Fedora, or you might truly enjoy the centralized control center of Mageia one day and then frolic in the modularity of raw [Debian][9] configuration files another. And sometimes you turn to an alternate OS altogether. + +![OpenBSD, image CC BY SA Claudio Miranda][10] + +OpenBSD, not a Linux distro + +The point is, Linux distributions are passion projects, and it's fun to be a part of other people's open source passions. + +### 6\. You have a passion for open source. + +Regardless of your experience, if you're a Linux user, you undoubtedly have a passion for open source. Whether you express that on a daily basis through [Creative Commons artwork][11] or code or you sublimate it and just get your work done in a liberating (and liberated) environment, you're living in and building upon open source. It's because of you that there's an open source community, and the community is richer for having you as a member. + +There are lots of things I haven't mentioned. What else betrays you as a Linux user? Let us know in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/signs-linux-user + +作者:[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/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://www.gimp.org/ +[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[6]: https://opensource.com/article/17/8/imagemagick +[7]: http://mageia.org +[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) +[9]: http://debian.org +[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) +[11]: http://freesvg.org diff --git a/sources/talk/20191028 Building trust in the Linux community.md b/sources/talk/20191028 Building trust in the Linux community.md new file mode 100644 index 0000000000..d4f7e22114 --- /dev/null +++ b/sources/talk/20191028 Building trust in the Linux community.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building trust in the Linux community) +[#]: via: (https://opensource.com/article/19/10/trust-linux-community) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Building trust in the Linux community +====== +Everyone should be empowered to use whatever software they wish, +regardless of platform. +![Tall building with windows][1] + +I recently listened to an interesting interview on [Linux for everyone][2]. Host [Jason Evangelho][3] interviewed [Christopher Scott][4], senior premier field engineer (open source) at Microsoft. Christopher is a Linux advocate who has a unique perspective as an avid Linux user who works for Microsoft. There was a time when there was little trust between Redmond and the Linux world. There are some who fear that Microsoft’s embrace of Linux is sinister. Christopher is trying to dispel that notion and build trust where mistrust has existed in the past. Listening to the interview invited my curiosity. Anxious to learn more, I contacted Christopher on [Twitter][5] and requested an interview (which has been lightly edited for length and clarity). He graciously agreed. + +**Don Watkins:** What is your background? + +**Christopher Scott:** In short, I’m a geek who loves technology, especially hardware. The first computer I got to spend any time with was our 486SX 20MHz 4MB RAM 171MB HDD IBM-compatible machine. My mom spent $2,500 on the setup at the time, which seemed outrageous. It wasn’t long after that I bought Comanche Maximum Overkill (PC Game) and realized I didn’t have a CD-ROM drive, nor a compatible sound card, so I bought those and installed them. That started it right there. I had to play games on our Windows 3.1 machine. That was really the focus of my interest in computers growing up: video games. I had the NES in 1984 and an SNES after, along with many other game systems since, but there was always something about PC gaming that caught my attention. + +My first love, however, was cars. My dad was into hot rods and such, so I read his magazines growing up. I had high aspirations of building my own first car. After finding college to not be for me and realizing that minimum wage jobs wouldn’t secure my future, I went back to school and learned a trade: automotive paint and body repair. I got a job thanks to my instructor and did this for several years, but I wasn’t satisfied that most of the jobs were insurance claim-based. I wanted to focus on the attention to detail aspects and make every job come out perfectly, but insurance companies don’t pay for that type of detail with a "just good enough" mentality. + +I wasn’t able to find work in a custom paint and body shop, so I looked to my second love, computers. I found a company that had training courses on Windows 2000 certification preparation. It was outrageously priced at something like $8,000, but I got a student loan (so I could carry that debt with me for many years after) and started class. I didn’t get a job immediately after, that took a number of months, but I worked my way into a temp job at Timex’s call center in the advanced products division. + +I had been at Timex for a year-and-a-half or so when I was able to get a job offer at a "real computer company." It wasn’t temp work and it had benefits, so it seemed perfect. This company provided managed IT services for their customers, so I started doing PC and network support over the phone and in person. I met my wife while working for this company, too. Since then, I’ve done help desk support, litigation support, SharePoint, Skype for Business, Microsoft Teams, and all of the Office 365 Suite. Today I’m a happily married father of three with two grandsons. + +**DW**: How did you get started with Linux and open source? + +**CS**: Roughly 20 years ago, while I was taking classes on Windows 2000 Server, I started acquiring parts of older machines that were slated for disposal and managed to piece together at least one fully working system with a monitor, keyboard, and mouse. The home computer at the time was running Windows 98 or ME, I can’t recall, but I didn’t have any OS to put on this older system. Somehow, I stumbled across Mandrake Linux and loaded it up. It all seemed to work okay from what I could tell, so I put an ad in the local newspaper classifieds to see if anyone needed a computer for free. I got exactly one response to that ad. I packed up the computer and took it to their house. I found out it was a family with a special needs son and they wanted to get him learning on the computer. I set it up on the little table they wanted to use as a desk, they thanked me, and I left. I sure hope it was helpful for them. At the time, all I really knew of Linux was that I could have a fully working system without having to go to a store to buy a disk. + +Since that point, I would consider myself a Linux hobbyist and enthusiast. I am a distro hopper, always trying out different distros and desktop environments, never making any one of them truly home. I’ve always had my heartstrings pulled between Ubuntu-based systems and Fedora. For some reason, I really like **`apt`** and **DEB**, but always loved getting faster updates from Fedora. I’ve always appreciated the way open source projects are open to the community for feedback and extra dev support, and how the code is freely available for anyone to use, reuse, and review. + +Until recently, I wasn’t able to make Linux my primary OS. I’ve tried over the years and often it came back to games. They would either not run at all, or ran poorly by comparison, so I ended up returning to Windows. With the improvements to Proton and tools like Lutris, that landscape has changed dramatically. I run Linux on my primary desktop and laptop now. Currently, Pop!_OS and Ubuntu 18.04 respectively, but I do have a soft spot for Manjaro (which is on a third machine). + +Admittedly, I do make concessions by having Linux as my primary OS for work. I mostly lean on web-based access to things I need, but I still have a VM for specific applications that won’t run outside of Windows and are required for my job. To be clear on this, I don’t hate Windows. I dislike some of the things it does and some of the things it doesn’t do. Linux, too, has things I like and dislike. My decision on what to run is based on what annoys me the least and what gives me the features and software I want or need. Some distros just don’t appeal to me or annoy me in a number of ways that I just cannot get over. Every OS has its pros and cons. + +**DW**: What invited you to work for Microsoft? + +**CS**: Short answer: A recruiter on LinkedIn. Long answer: Like many people who get into SharePoint, it fell into my lap a number of years ago. Okay, I volunteered, but no one else on the three-person IT team was going to learn it and our CEO wanted it. Fast forward about three years later, I got hired as a SharePoint admin for, what I thought, was a quite large company of 700 users. At that point, I considered Microsoft to be the top option to work for considering that’s who owns SharePoint, but I figured that I was five years or so away from being at the level I needed to be to even be considered. After working at this job for a year, I was contacted by a recruiter on LinkedIn. We chatted, I interviewed, and I got hired. Since then, I have jumped technologies to Skype/Teams and now open source software (OSS) and have gone from leading one team to over 20, all in sort of a non-traditional way. + +To be more to the point, I wanted to move into an OSS role to see more of what Microsoft is doing in this space, which was something I couldn’t see in other roles while supporting other technologies. + +**DW**: How are you building trust for the Linux community at Microsoft? + +**CS**: The first step is to listen. I can’t assume to know, even though I consider myself part of the Linux community, what it would take to build that trust. So, I reached out to get that feedback. My goal is to take action against that feedback as merely an employee looking to make the software landscape better for Linux users who would appreciate the option of running Microsoft software on their chosen platform (as one example). + +**DW**: What Microsoft products besides Visual Studio are wins for the Linux and open source community? + +**CS**: Honestly, it depends on which part of the community you refer to. For developers, there are other things that were released/open-sourced by Microsoft that carry great benefits, like .NET and C++ libraries. Even [Windows Subsystem for Linux][6] (WSL) and the [new Windows Terminal][7] can be seen as big wins. However, there is another component of the community that wants something that impacts their daily, personal lives (if I were to summarize). In a sense, each individual has taken the stance to decide for themselves what constitutes a win and what doesn’t. That issue makes it more difficult at times when they request that Windows or the whole software catalog be open-sourced completely before even considering that Microsoft is doing anything valid. + +Essentially, from how I view Microsoft’s standpoint, the company is focused on the cloud, namely Azure. Who in the Linux and open source community should be targeted that aligns with that? People who manage Linux servers, people who want to use open source software in Azure, and people who develop open source software that can run on Azure. To that market, there have been many wins. The catalog of OSS that runs in the context of Azure is huge. + +**DW**: Some tech writers see the Linux kernel replacing the NT kernel. Do you disagree? + +**CS**: I do disagree. There’s far too much incompatibility to just replace the underpinnings. It’s not realistic, in my opinion. + +**DW**: What is the future of Linux at Microsoft? + +**CS**: I’ll say what I expect and what I hope. I expect continued growth of Linux on Azure, and continued growth in open source used on Azure and written by Microsoft. I hope that this drives further investment into the Linux desktop, essentially, by bringing Windows software to run well on Linux. This topic is what the community wants to see, too, but it will take the customers, the individuals, within the enterprise speaking up to push this to reality. + +Would I like to see, as an example, one code base for Office that runs on all desktop platforms whether through Wine or some other compatibility layer? Yes, of course. I think this would be optimal, really. Office for Mac has never seen all the same features as the Windows versions. Everyone should be empowered to use whatever software they wish, regardless of platform. I believe that Microsoft can get there, I just don’t know if it will, so that’s where I step in to do what I can to try to make this happen. I hope that we can see Linux desktop users have the same options for software from Microsoft as Windows and macOS. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/trust-linux-community + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://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://linuxforeveryone.fireside.fm/10-the-microsoft-linux-interview +[3]: https://opensource.com/article/19/9/found-linux-video-gaming +[4]: https://www.linkedin.com/in/christophersscott/ +[5]: https://twitter.com/chscott_msft +[6]: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux +[7]: https://github.com/Microsoft/Terminal diff --git a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md deleted file mode 100644 index 7683868979..0000000000 --- a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md +++ /dev/null @@ -1,614 +0,0 @@ -qfzy1233 is translating - - - -数码文件与文件夹收纳术(以照片为例) -====== -更新 2014-05-14:增加了一些具体实例 - -更新 2015-03-16:根据照片的 GPS 坐标过滤图片 - -更新 2016-08-29:以新的 `filetags--filter` (LCTT译注:文件标签过滤器)替换已经过时的 `show-sel.sh` 脚本(LCTT译注:show-sel 为 show firmware System Event Log records 即硬件系统事件及日志显示) - -Update 2017-08-28: Email comment on geeqie video thumbnails -更新 2017-08-28: -I am a passionate photographer when being on vacation or whenever I see something beautiful. This way, I collected many [JPEG][1] files over the past years. Here, I describe how I manage my digital photographs while avoiding any [vendor lock-in][2] which binds me to a temporary solution and leads to loss of data. Instead, I prefer solutions where I am able to **invest my time and effort for a long-term relationship**. - -This (very long) entry is **not about image files only** : I am going to explain further things like my folder hierarchy, file name convention, and so forth. Therefore, this information applies to all kind of files I process. - -Before I start explaining my method, we should come to an agreement whether or not we do have the same set of requirements I am trying to match with my method. If you are into [raw image formats][3], storing your photographs somewhere in the cloud or anything else very special to you (and not to me), you might not get satisfied with the things described here. Decide yourself. - -### My requirements - -For **getting the photographs (and movies) from my digital camera to my computer** , I just want to put the SD card into my computer and invoke the fetch-workflow. This thing also has to **pre-process the files** to meet my file name convention (described further down) and to rotate images that are in portrait orientation (and not in landscape). - -Those files are written to my photography inbox folder `$HOME/tmp/digicam/`. In this folder, I want to **look through my image files and play movies** to **sort out/delete, rename, add/remove tags, and put sets of related files into separate destination folders**. - -After that, I want to **navigate through my set of folders** containing the sets of image/movie files. In rare occasions, I want to **open an image file in an independent image processing tool** like [the GIMP][4]. Just for **rotating JPEG files** , I want to have a quick method which does not require an image processing tool and which is rotating JPEG images [in a loss-less way][5]. - -My digital camera has now support for tagging images with [GPS][6] coordinates. Therefore, I need a method to **visualize GPS coordinates for single files as well as for a set of files** showing the path I was walking. - -There is another nice feature I want to use: imagine a beautiful vacation in Venice where you took hundreds of photographs. Each of them is so beautiful so that you do not want to delete some of them. On the other side, you might want to get a smaller set of photographs for presenting to your friends at home. And they are only expecting maybe two dozens of files before being too jealous. Therefore, I want to be able to **define and show a certain sub-set of photos**. - -In terms of being independent and **avoid lock-in effects** , I do not want to use a tool I am not able to use when a company discontinues a product or service. For the very same reason and because I am a privacy-aware person, **I do not want to use any cloud-based service**. In order to keep myself open for new possibilities, I do not want to invest any effort in something which is only available on one specific operating system platform. **Basic stuff has to be available on any platform** (viewing, navigation, ...). But the **full set of requirements have to work on GNU/Linux** , in my case Debian GNU/Linux. - -Before I describe my current solutions to this fairly large set of requirements mentioned above, I have to explain my general folder structure and file naming convention I also use for digital photographs. But first, there is an important fact you have to consider: - -#### iPhoto, Picasa, and such considered harmful - -Software tools which manage collections of photographs do provide pretty cool features. They offer a nice user interface and try to give you cozy work-flows for all kinds of requirements. - -The big issue I do have got with them is numerous. They mostly use proprietary storage formats for almost everything: image files, meta-data, and so forth. This is a huge issue, when you are going to change to a different software in a couple of years. Trust me: **you are going to switch** , some day, in any case, for multiple reasons. - -If you are in the position where you need to switch your tool, you are going to realize that iPhoto or Picasa do store original image files and everything you did to them separately. Rotation of images, adding description to image files, tags, cropping, and so forth: **everything will be lost forever** if you are not able to export it and re-import it to the new tool. Chances are very high that you are not going to do this without loss of information or data. - -I do not want to invest any effort in a tool which locks away my work. **I refuse to lock-in myself to any proprietary tool.** Been there, done that. Learned my lessons. - -This is the reason why I keep time-stamps, image descriptions, or tags in the file name itself. File names are permanent unless I manually change them. They do not get lost when I backup my photographs or when I copy them to USB memory sticks or other operating systems. Everybody is able to read them. Any future system is able to process them. - -### My file name convention - -All my files which do have a relation to a specific day or a time I start with a **date-stamp** or a **time-stamp** according to an adopted [ISO 8601][7]. - -Example file name with a date-stamp and two tags: `2014-05-09 Budget export for project 42 -- finance company.csv` - -Example file name with a time-stamp (even including optional seconds) and two tags: `2014-05-09T22.19.58 Susan presenting her new shoes -- family clothing.jpg` - -I have to use adopted ISO time-stamps because colons are not suitable for the Windows [file system NTFS][8]. Therefore, I replaced colons with dots for separating hours from minutes from the optional seconds. - -In case of **time or date duration** , I separate the two date- or time-stamps with two minus signs: "`2014-05-09--2014-05-13 Jazz festival Graz -- folder tourism music.pdf`". - -Time/date-stamps in file names have the advantage that they remain unchanged until I manually change them. Meta-data which is included in the file content itself (like [Exif][9]) tends to get lost when files are processed via tools that do not take care of those meta-data. Additionally, starting a file name with such a date/time-stamp ensures that files are displayed in a temporal order instead of alphabetic order. The alphabet is a [totally artificial sort order][10] and it is typically less practical for locating files by the user. - -When I want to associate **tags** to a file name, I place them between the original file name and the [file name extension][11] separated by a space, two minus signs and an additional space: "`--`". My tags are lower case English words which do not contain spaces or special characters. Sometimes, I might use concatenated words like `quantifiedself` or `usergenerated`. I [tend to prefer general categories][12] instead of more (too) more specific describing tags. I re-use my tags on Twitter [hashtags][13], file names, folder names, bookmarks, blog entries like this one, and so forth. - -Tags as part of the file name have several advantages. You are able to locate files with the help of tags by using your usual desktop search engine. Tags in file-names can not be lost because of copying on different storage media. This usually happens, whenever a system uses a different storage place than the file name: meta-data data-base, [dot-files][14], [alternate data streams][15], and so forth. - -Of course, please do **avoid special characters** , umlauts, colons, and so forth in file and folder names in general. Especially when you synchronize files between different operating system platforms. - -My **file name convention for folders** is the same as for files. - -Note: Because of the clever [filenametimestamps][16]-module of [Memacs][17], all files and folders with a date/time-stamp appear on the very same time/day on my Org-mode calendar (agenda). This way, I get a very cool overview on what happened when on which day including all photographs I took. - -### My general folder structure - -In this section, I will describe my most important folders within my home folder. NOTE: this might get moved to an independent page somewhere in the future. Or not. Time will tell. :-) - -Lots of stuff is only of interest for a certain period of time. These are things like downloads to quickly skim through its content, unpack ZIP files to examine the files contained, minor interesting stuff, and so forth. For **temporary stuff** I do have the `$HOME/tmp/` sub-hierarchy. New photographs are placed in `$HOME/tmp/digicam/`. Stuff I temporary copy from a CD, DVD, or USB memory stick are put in `$HOME/tmp/fromcd/`. Whenever a software tool needs temporary data within my user folder hierarchy, I use `$HOME/tmp/Tools/` as an starting point. A very frequent folder for me is `$HOME/tmp/2del/`: "2del" means "ready for being deleted any time". All my browser are using this folder as the default download folder for example. In case I need to free space on a machine, I firstly look at this `2del`-folder for stuff to delete. - -In contrast to the temporary stuff described above, I certainly want to keep files **for a longer period of time** as well. Those files gets moved to my `$HOME/archive/` sub-hierarchy. Its got several sub-folders for backups, web/download-stuff I want to keep, binary files I want to archive, index files of removable media (CD, DVD, memory sticks, external hard drives), and a folder where I place stuff I want to archive (and look for a decent destination folder) in the near future. Sometimes, I am too busy or impatient for the moment to file things properly. Yes, that's me I even have a "do not bug me now"-folder. Is this weird to you? :-) - -The most important sub-hierarchy within my archive is `$HOME/archive/events_memories/` and its sub/folders `2014/`, `2013/`, `2012/`, and so forth. As you might have guessed already, there is one **sub-folder per year**. Within each of them, there are single files and folders. The files are named according to my file name convention described in the previous section. Folder names start with an [ISO 8601][7] datestamp in the form "YYYY-MM-DD" followed by a hopefully descriptive name like `$HOME/archive/events_memories/2014/2014-05-08 Business marathon with colleagues/`. Within those date-related folders I keep all kinds of files which are related to a certain event: photographs, (scanned) PDF-files, text files, and so forth. - -For **sharing data** , I maintain a `$HOME/share/` sub-hierarchy. There is my Dropbox folder, folders for important people I share data using all kinds of methods (like [unison][18]). I also share data among my set of devices: Mac Mini at home, GNU/Linux notebook at home, Android phone, root-server (my personal cloud), Windows-notebook at work. I don't want to elaborate on my synchronization set-up here. There might be another blog entry for this if you ask nicely. :-) - -Within my `$HOME/templates_labels/` sub-hierarchy, I keep all kinds of **template files** ([LaTeX][19], scripts, ...), cliparts and **logos** , and so forth. - -My **Org-mode** files, I mostly keep within `$HOME/org/`. I practice retentiveness and do not explain how much I love [Emacs/Org-mode][20] and how much I get out of it this time. You probably have read or heard me elaborating the awesome things I do with it. Just look out for [my `emacs` tag][21] on my blog and its [hashtag `#orgmode`][22] on twitter. - -So far about my most important folder sub-hierarchies. - -### My workflows - -Tataaaa, after you learned about my folder structure and file name convention, here are my current workflows and tools I use for the requirements I described further up. - -Please note that **you have to know, what you are doing**. My examples here contain folder paths and more that **only works on my machine or my set-up**. **You have to adopt stuff** like paths, file names, and so forth to meet your requirements! - -#### Workflow: Moving files from my SD card to the laptop, rotating portrait images, and renaming files - -When I want to move data from my digital camera to my GNU/Linux notebook, I take out its Mini-SD storage card and put it in my notebook. Then it gets mounted on `/media/digicam` automatically. - -Then, I invoke [getdigicamdata.sh][23] which does several things: it moves the files from the SD card to a temporary folder for processing. The original file names are being converted to lower-case characters. All portrait photographs are rotated using [jhead][24]. Also with jhead, I generate file-name time-stamps from the Exif header time-stamps. Using [date2name][25] I add time-stamps also to the movie files. After processing all those files, they get moved to the destination folder for new digicam files: $HOME/tmp/digicam/tmp/~. - -#### Workflow: Folder navigation, viewing, renaming, deleting image files - -For skimming through my image and movie files, I prefer to use [geeqie][26] on GNU/Linux. It is a fairly lightweight image browser which has one big advantage other file browsers are missing: I can add external scripts/tools that can be invoked by a keyboard shortcut. This way, I am able to extend the feature-set of the image browser by arbitrary external commands. - -Basic image management functionality is built-in to geeqie: navigating my folder hierarchy, viewing image files in window-mode and in full-screen more (shortcut `f`), renaming file names, deleting files, showing Exif meta-data (shortcut `Ctrl-e`). - -On OS X, I use [Xee][27]. Unlike geeqie, it is not extendable by external commands. However, the basic navigation, viewing, and renaming functions are available as well. - -#### Workflow: Adding and removing tags - -I created a Python script called [filetags][28] which I use for adding and removing tags to single files as well as a set of files. - -For digital photographs, I use tags like, e.g., `specialL` for landscape images that I consider suitable for desktop backgrounds and so forth, `specialP` for portrait photographs I would like to show to others, `sel` for a selection, and many more. - -##### Initial set-up of filetags with geeqie - -Adding filetags to geeqie is a manual step: `Edit > Preferences > Configure Editors ...`. Then create an additional entry with `New`. There, you can define a new desktop-file which looks like this: - -add-tags.desktop -``` -[Desktop Entry] -Name=filetags -GenericName=filetags -Comment= -Exec=/home/vk/src/misc/vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh %F -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/*;video/*;image/mpo;image/thm -Categories=X-Geeqie; - -``` - -The wrapper-script `vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh` is necessary because I want a new terminal window to pop-up in order to add tags to my files: - -vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh -``` -#!/bin/sh - -/usr/bin/gnome-terminal \ - --geometry=85x15+330+5 \ - --tab-with-profile=big \ - --hide-menubar \ - -x /home/vk/src/filetags/filetags.py --interactive "${@}" - -#end - -``` - -In geeqie, you can add a keyboard shortcut in `Edit > Preferences > Preferences ... > Keyboard`. I associated `t` with the `filetags` command. - -The filetags script is also able to remove tags from a single file or a set of files. It basically uses the same method as described above. The only difference is the additional `--remove` parameter for the filetags script: - -remove-tags.desktop -``` -[Desktop Entry] -Name=filetags-remove -GenericName=filetags-remove -Comment= -Exec=/home/vk/src/misc/vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh %F -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/*;video/*;image/mpo;image/thm -Categories=X-Geeqie; - -``` - -vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh -``` -#!/bin/sh - -/usr/bin/gnome-terminal \ - --geometry=85x15+330+5 \ - --tab-with-profile=big \ - --hide-menubar \ - -x /home/vk/src/filetags/filetags.py --interactive --remove "${@}" - -#end - -``` - -For removing tags, I created a keyboard shortcut for `T`. - -##### Using filetags within geeqie - -When I skim though image files in the geeqie file browser, I select files I want to tag (one to many) and press `t`. Then, a small window pops up and asks me for one or more tags. After confirming with `Return`, these tags gets added to the file names. - -The same goes for removing tags: selecting multiple files, pressing `T`, entering tags to be removed, and confirming with `Return`. That's it. There is [almost no simpler way to add or remove tags to files][29]. - -#### Workflow: Advanced file renaming with appendfilename - -##### Without appendfilename - -Renaming a large set of files can be a tedious process. With original file names like `2014-04-20T17.09.11_p1100386.jpg`, the process to add a description to its file name is quite annoying. You are going to press `Ctrl-r` (rename) in geeqie which opens the file rename dialog. The base-name (file-name without the file extension) is marked by default. So if you do not want to delete/overwrite the file name (but append to it), you have to press the cursor key for ``. Then, the cursor is placed between the base name and the extension. Type in your description (don't forget the initial space character) and confirm with `Return`. - -##### Using appendfilename with geeqie - -With [appendfilename][30], my process is simplified to gain maximum user experience for appending text to file names: When I press `a` (append) in geeqie, a dialog window pops up, asking for a text. After confirming with `Return`, the entered text gets placed between the time-stamp and the optional tags. - -For example when I press `a` on `2014-04-20T17.09.11_p1100386.jpg` and I type `Pick-nick in Graz`, the file name gets changed to `2014-04-20T17.09.11_p1100386 Pick-nick in Graz.jpg`. When I press `a` once again and enter `with Susan`, the file name gets changed to `2014-04-20T17.09.11_p1100386 Pick-nick in Graz with Susan.jpg`. When the file name got tags as well, the appended text gets appended before the tag-separator. - -This way, I do not have to be afraid to overwrite time-stamps or tags. The process for renaming gets much more enjoyable for me! - -And the best part: when I want to add the same text to multiple selected files, this also works with appendfilename. - -##### Initial set-up of appendfilename with geeqie - -Add an additional editor to geeqie: `Edit > Preferences > Configure Editors ... > New`. Then enter the desktop file definition: - -appendfilename.desktop -``` -[Desktop Entry] -Name=appendfilename -GenericName=appendfilename -Comment= -Exec=/home/vk/src/misc/vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh %F -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/*;video/*;image/mpo;image/thm -Categories=X-Geeqie; - -``` - -Once again, I do use a wrapper-script that provides me the terminal window: - -vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh -``` -#!/bin/sh - -/usr/bin/gnome-terminal \ - --geometry=90x5+330+5 \ - --tab-with-profile=big \ - --hide-menubar \ - -x /home/vk/src/appendfilename/appendfilename.py "${@}" - -#end - -``` - -#### Workflow: Play movie files - -On GNU/Linux, I use [mplayer][31] to play-back video files. Since geeqie does not play movie files on itself, I have to create a set-up where I can open a movie file in mplayer. - -##### Initial set-up of mplayer with geeqie - -I did already associate movie file extensions to mplayer using [xdg-open][32]. Therefore, I only had to create a general "open" command to geeqie which uses xdg-open to open any file with its associated application. - -Once again, visit `Edit > Preferences > Configure Editors ...` in geeqie and add an entry for `open`: - -open.desktop -``` -[Desktop Entry] -Name=open -GenericName=open -Comment= -Exec=/usr/bin/xdg-open %F -Icon= -Terminal=true -Type=Application -hidden=false -NOMimeType=*; -MimeType=image/*;video/* -Categories=X-Geeqie; - -``` - -When you also associate the shortcut `o` (see above) to geeqie, you are able to open video files (and other files) with their associated application. - -##### Opening movie files (and others) with xdg-open - -After the set-up process from above, you just have to press `o` when your geeqie cursor is above the file. That's it. - -#### Workflow: Open in an external image editor - -I rarely want to be able to quickly edit image files in the GIMP. Therefore, I added a shortcut `g` and associated it with the external editor "GNU Image Manipulation Program" (GIMP) which was already created by default by geeqie. - -This way, only pressing `g` opens the current image file in the GIMP. - -#### Workflow: Move to archive folder - -Now that I have added comments to my file names, I want to move single files to `$HOME/archive/events_memories/2014/` or set of files to new folders within this folder like `$HOME/archive/events_memories/2014/2014-05-08 Business-Marathon After-Show-Party`. - -The usual way is to select one or multiple files and move them to a folder with the shortcut `Ctrl-m`. - -So booooring. - -Therefore, I (again) wrote a Python script which does this job for me: [move2archive][33] (in short: `m2a`) expects one or more files as command line parameters. Then, a dialog appears where I am able to enter an optional folder name. When I do not enter anything at all but press `Return`, the files gets moved to the folder of the corresponding year. When I enter a folder name like `Business-Marathon After-Show-Party`, the date-stamp of the first image file is appended to the folder (`$HOME/archive/events_memories/2014/2014-05-08 Business-Marathon After-Show-Party`), the resulting folder gets created, and the files gets moved. - -Once again: I am in geeqie, select one or more files, press `m` (move) and either press only `Return` (no special sub-folder) or enter a descriptive text which is the name of the sub-folder to be created (optionally without date-stamp). - -**No image managing tool is as quick and as fun to use as my geeqie with appendfilename and move2archive via shotcuts.** - -##### Initial set-up of m2a with geeqie - -Once again, adding `m2a` to geeqie is a manual step: `Edit > Preferences > Configure Editors ...`. Then create an additional entry with `New`. There, you can define a new desktop-file which looks like this: - -m2a.desktop -``` -[Desktop Entry] -Name=move2archive -GenericName=move2archive -Comment=Moving one or more files to my archive folder -Exec=/home/vk/src/misc/vk-m2a-interactive-wrapper-with-gnome-terminal.sh %F -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/*;video/*;image/mpo;image/thm -Categories=X-Geeqie; - -``` - -The wrapper-script `vk-m2a-interactive-wrapper-with-gnome-terminal.sh` is necessary because I want a new terminal window to pop-up in order to enter my desired destination folder for my files: - -vk-m2a-interactive-wrapper-with-gnome-terminal.sh -``` -#!/bin/sh - -/usr/bin/gnome-terminal \ - --geometry=157x56+330+5 \ - --tab-with-profile=big \ - --hide-menubar \ - -x /home/vk/src/m2a/m2a.py --pauseonexit "${@}" - -#end - -``` - -In geeqie, you can add a keyboard shortcut in `Edit > Preferences > Preferences ... > Keyboard`. I associated `m` with the `m2a` command. - -#### Workflow: Rotate images (loss-less) - -Usually, portrait photographs are being marked automatically as portrait photographs by my digital camera. However, there are certain situations (like taking a photograph from above the motif) where my camera gets it wrong. In those **rare cases** , I have to manually fix the orientation. - -You have to know that the JPEG file format is a lossy format which should be used only for photographs and not for computer-generated stuff like screen-shots or diagrams. Rotating a JPEG image file in the dumb way usually results in decompressing/visualizing the image file, rotating the resulting image, and re-encoding the result once again. This causes a resulting image with [much worse image quality than the original image][5]. - -Therefore, you should use a lossless method to rotate you JPEG image files. - -Once again, I add an "external editor" to geeqie: `Edit > Preferences > Configure Editors ... > New`. There, I add two entries: one for rotating 270 degrees (which is 90 degrees counter-clock-wise) and one for rotating 90 degrees (clock-wise) using [exiftran][34]: - -rotate-270.desktop -``` -[Desktop Entry] -Version=1.0 -Type=Application -Name=Losslessly rotate JPEG image counterclockwise - -# call the helper script -TryExec=exiftran -Exec=exiftran -p -2 -i -g %f - -# Desktop files that are usable only in Geeqie should be marked like this: -Categories=X-Geeqie; -OnlyShowIn=X-Geeqie; - -# Show in menu "Edit/Orientation" -X-Geeqie-Menu-Path=EditMenu/OrientationMenu - -MimeType=image/jpeg; - -``` - -rotate-90.desktop -``` -[Desktop Entry] -Version=1.0 -Type=Application -Name=Losslessly rotate JPEG image clockwise - -# call the helper script -TryExec=exiftran -Exec=exiftran -p -9 -i -g %f - -# Desktop files that are usable only in Geeqie should be marked like this: -Categories=X-Geeqie; -OnlyShowIn=X-Geeqie; - -# Show in menu "Edit/Orientation" -X-Geeqie-Menu-Path=EditMenu/OrientationMenu - -# It can be made verbose -# X-Geeqie-Verbose=true - -MimeType=image/jpeg; - -``` - -I created geeqie keyboard shortcuts for `[` (counter-clock-wise) and `]` (clock-wise). - -#### Workflow: Visualizing GPS coordinates - -My digital camera has a GPS sensor which stores the current geographic location within the Exif meta-data of the JPEG files. The location data gets stored in [WGS 84][35] format like "47, 58, 26.73; 16, 23, 55.51" (latitude; longitude). This is not human-readable in the sense I would expect: either a map or a location name. Therefore, I added functionality to geeqie so, that I am able to see the location of a single image file on [OpenStreetMap][36]: `Edit > Preferences > Configure Editors ... > New` - -photolocation.desktop -``` -[Desktop Entry] -Name=vkphotolocation -GenericName=vkphotolocation -Comment= -Exec=/home/vk/src/misc/vkphotolocation.sh %F -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-gray;image/x-icb;image/x-ico;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/x-pcx;image/svg+xml;image/svg+xml-compressed;image/vnd.wap.wbmp; - -``` - -This calls my wrapper-script named `vkphotolocation.sh` which uses [ExifTool][37] to extract the coordinates in a suitable format that [Marble][38] is able to read and visualize: - -vkphotolocation.sh -``` -#!/bin/sh - -IMAGEFILE="${1}" -IMAGEFILEBASENAME=`basename ${IMAGEFILE}` - -COORDINATES=`exiftool -c %.6f "${IMAGEFILE}" | awk '/GPS Position/ { print $4 " " $6 }'` - -if [ "x${COORDINATES}" = "x" ]; then - zenity --info --title="${IMAGEFILEBASENAME}" --text="No GPS-location found in the image file." -else - /usr/bin/marble --latlon "${COORDINATES}" --distance 0.5 -fi - -#end - -``` - -Mapped to the keyboard shortcut `G`, I can quickly get to the **map position of its location of a single image file**. - -When I want to visualize the **positions of multiple JPEG image files as a path** , I am using [GpsPrune][39]. I was not able to derive a method where GpsPrune takes a set of files as command line parameters. And because of this, I have to manually start GpsPrune, select a set of files or a folder with `File > Add photos`. - -This way, I get a dot for each JPEG location on a map of OpenStreetMap (if configured so). By clicking on such a dot, I get details of the corresponding image. - -If you happen to be abroad while taking photographs, visualizing the GPS positions is a **great help for adding descriptions** to the file name! - -#### Workflow: Filtering photographs according to their GPS coordinates - -This is no workflow of mine. For the sake of completeness, I list features of tools that make this workflow possible. What I would like to do is looking for only those photographs out of a big pile of images, that are within a certain area (rectangle or point + distance). - -So far, I found only [DigiKam][40] which is able to [filter according to a rectangle][41]. If you know another tool, please add it to the comments below or write an email. - -#### Workflow: Showing a sub-set of a given set - -As described in the requirements above, I want to be able to define a sub-set of files within a folder in order to present this small collection to other people. - -The work-flow is pretty simple: I add a tag (via `t`/filetags) to the files of the selection. For this, I use the tag `sel` which is short for "selection". After I tagged the set of files, I can press `s` which I associated with a script that shows only the files tagged with `sel`. - -Of course, this also works with any tag or tag combination. Therefore, with the same method, you are able to get a decent overview on all photos of your wedding that are tagged with "church" and "rings". - -Nifty feature, isn't it? :-) - -##### Initial set-up of filetags for filtering according to tags + geeqie - -You have to define an additional "external editor": `Edit > Preferences > Configure Editors ... > New`: - -filter-tags.desktop -``` -[Desktop Entry] -Name=filetag-filter -GenericName=filetag-filter -Comment= -Exec=/home/vk/src/misc/vk-filetag-filter-wrapper-with-gnome-terminal.sh -Icon= -Terminal=true -Type=Application -Categories=Application;Graphics; -hidden=false -MimeType=image/*;video/*;image/mpo;image/thm -Categories=X-Geeqie; - -``` - -This once again calls a wrapper-script I wrote: - -vk-filetag-filter-wrapper-with-gnome-terminal.sh -``` -#!/bin/sh - -/usr/bin/gnome-terminal \ - --geometry=85x15+330+5 \ - --hide-menubar \ - -x /home/vk/src/filetags/filetags.py --filter - -#end - -``` - -What `filetags` with parameter `--filter` does is basically the following: the user gets asked to enter one or more tags. Then, all matching files of the current folder are linked to `$HOME/.filetags_tagfilter/` using [symbolic links][42]. Then, a new geeqie instance is started which shows the linked files. - -After quitting this new geeqie instance, you see the old geeqie instance, from where you invoked the selection process. - -#### Summary with a real world example - -Wow, this was a very long blog entry. No wonder that you might have lost the overview here and there. To sum up the things I am able to do within geeqie (that extends the standard feature set), I have this cool table below: - -shortcut function `m` m2a `o` open (for non-images) `a` add text to file name `t` filetags (add) `T` filetags (remove) `s` filetags (filter) `g` gimp `G` show GPS position `[` lossless rotate counterclockwise `]` lossless rotate clockwise `Ctrl-e` EXIF `f` full-screen - -Parts of a file name (including its path) and tools I use to manipulate the components accordingly: -``` - /this/is/a/folder/2014-04-20T17.09 Pick-nick in Graz -- food graz.jpg - [ m2a ] [ date2name ] [ appendfilename ] [filetags] - -``` - -In practice, I do the following steps to get my photographs from the camera to my archive: I put the SD memory card into my SD card reader of my computer. Then I start [getdigicamdata.sh][23]. After it is finished, I open `$HOME/tmp/digicam/tmp/` within geeqie. I skim through the photographs and delete the ones that did not work out. If there is an image with the wrong orientation, I correct it by `[` or `]`. - -In a second run, I add descriptions to files I consider worth commenting on (`a`). Whenever I want to add tags I do so as well: I quickly mark all files that should share a tag (`Ctrl` \+ mouse-click) and tag them using [filetags][28] (`t`). - -To combine files from a given event, I select corresponding files and move them to their "event-folder" within the yearly archive folder by typing the event description in [move2archive][33] (`m`). The rest (no special event folder) is moved to the yearly archive directly by move2archive (`m`) without stating a event description. - -To finish my work-flow, I delete all files on my SD card, dismount it from the operating system, and put it back into my digital camera. - -That's it. - -Because this work-flow requires almost no overhead at all, commenting, tagging, and filing photographs is not a tedious job any more. - -### Finally - -So, this is a detailed description of my work-flows related to photographs and movies I make. You probably have found additional stuff I might be interested in. So please do not hesitate and leave a comment or email by using the links below. - -I also would like to get feed-back if my work-flow works for you as well. And: if you have published your work-flows or find descriptions of other peoples work-flows, please do leave a comment as well! - -Have fun and don't waste your time with the wrong tools or inefficient methods! - -### Other Tools - -Read about [gThumb in this article][43]. - -Please do suggest your tools of choice when you've got the feeling that they fit my requirements mentioned above. - -### Email Comments - -> Date: Sat, 26 Aug 2017 22:05:09 +0200 -> Hello Karl, -> I like your articles and work with memacs and of course orgmode but I am not very familiar with python by the way... in your blog post of "managing-digital-photographs" you write about to open videos with [Geeqie][26]. -> It works, but I cant see any video thumbnails in the browser of Geeqie. Do you have any suggestions to get this to work? -> Thank you, Thomas - -Hi Thomas, - -Thanks for your kind words. I always feel great when somebody finds my work useful in his/her life. Unfortunately most of the time, I never hear of them. - -Yes, I sometimes use Geeqie to visualize folders that not only contain image files but movie files as well. In those cases, I don't see any thumbnail image of the video. You're absolutely right, there are many file browsers out there which are able to display some kind of preview image of a video. - -Quite frankly, I never thought of video thumbnails and I don't miss them. A quick research in the preferences and with my search engine did not suggest that there is a possible way to enable video previews in Geeqie. So no luck here. - --------------------------------------------------------------------------------- - -via: http://karl-voit.at/managing-digital-photographs/ - -作者:[Karl Voit][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://karl-voit.at -[1]:https://en.wikipedia.org/wiki/Jpeg -[2]:http://en.wikipedia.org/wiki/Vendor_lock-in -[3]:https://en.wikipedia.org/wiki/Raw_image_format -[4]:http://www.gimp.org/ -[5]:http://petapixel.com/2012/08/14/why-you-should-always-rotate-original-jpeg-photos-losslessly/ -[6]:https://en.wikipedia.org/wiki/Gps -[7]:https://en.wikipedia.org/wiki/Iso_date -[8]:https://en.wikipedia.org/wiki/Ntfs -[9]:https://en.wikipedia.org/wiki/Exif -[10]:http://www.isisinform.com/reinventing-knowledge-the-medieval-controversy-of-alphabetical-order/ -[11]:https://en.wikipedia.org/wiki/File_name_extension -[12]:http://karl-voit.at/tagstore/en/papers.shtml -[13]:https://en.wikipedia.org/wiki/Hashtag -[14]:https://en.wikipedia.org/wiki/Dot-file -[15]:https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_.28ADS.29 -[16]:https://github.com/novoid/Memacs/blob/master/docs/memacs_filenametimestamps.org -[17]:https://github.com/novoid/Memacs -[18]:http://www.cis.upenn.edu/~bcpierce/unison/ -[19]:https://github.com/novoid/LaTeX-KOMA-template -[20]:http://orgmode.org/ -[21]:http://karl-voit.at/tags/emacs -[22]:https://twitter.com/search?q%3D%2523orgmode&src%3Dtypd -[23]:https://github.com/novoid/getdigicamdata.sh -[24]:http://www.sentex.net/%3Ccode%3Emwandel/jhead/ -[25]:https://github.com/novoid/date2name -[26]:http://geeqie.sourceforge.net/ -[27]:http://xee.c3.cx/ -[28]:https://github.com/novoid/filetag -[29]:http://karl-voit.at/tagstore/ -[30]:https://github.com/novoid/appendfilename -[31]:http://www.mplayerhq.hu -[32]:https://wiki.archlinux.org/index.php/xdg-open -[33]:https://github.com/novoid/move2archive -[34]:http://manpages.ubuntu.com/manpages/raring/man1/exiftran.1.html -[35]:https://en.wikipedia.org/wiki/WGS84#A_new_World_Geodetic_System:_WGS_84 -[36]:http://www.openstreetmap.org/ -[37]:http://www.sno.phy.queensu.ca/~phil/exiftool/ -[38]:http://userbase.kde.org/Marble/Tracking -[39]:http://activityworkshop.net/software/gpsprune/ -[40]:https://en.wikipedia.org/wiki/DigiKam -[41]:https://docs.kde.org/development/en/extragear-graphics/digikam/using-kapp.html#idp7659904 -[42]:https://en.wikipedia.org/wiki/Symbolic_link -[43]:http://karl-voit.at/2017/02/19/gthumb diff --git a/sources/tech/20140929 A Word from The Beegoist - Richard Kenneth Eng - Medium.md b/sources/tech/20140929 A Word from The Beegoist - Richard Kenneth Eng - Medium.md deleted file mode 100644 index 707c2942a7..0000000000 --- a/sources/tech/20140929 A Word from The Beegoist - Richard Kenneth Eng - Medium.md +++ /dev/null @@ -1,623 +0,0 @@ -A Word from The Beegoist – Richard Kenneth Eng – Medium -====== -I like the [Go programming language][22]. I sought to use Go to write web applications. To this end, I examined two of the “full stack” web frameworks available to Go developers (aka “Gophers”): [Beego][23] and [Revel][24]. - -The reason I looked for full stack was because of my prior experience with [web2py][25], a Python-based framework with extraordinary capability that was also [deliciously easy to get started and be highly productive in][26]. (I also cut my teeth on Smalltalk-based [Seaside][27], which has the same qualities.) In my opinion, full stack is the only way to go because developers should not waste time and effort on the minutiae of tool configuration and setup. The focus should be almost entirely on writing your application. - -Between Beego and Revel, I chose the former. It seemed to be more mature and better documented. It also had a built-in [ORM][28]. - -To be sure, Beego isn’t as easy and productive as web2py, but I believe in Go, so it is worth the effort to give Beego my best shot. To get started with Beego, I needed a project, a useful exercise that covered all the bases, such as database management, CSS styling, email capability, form validation, etc., and also provided a useful end product. - -The project I selected was a user account management component for web applications. All of my previous applications required user registration/login, and Beego did not appear to have anything like that available. - -Now that I’ve completed the project, I believe it would be an excellent foundation for a Beego tutorial. I do not pretend that the code is optimal, nor do I pretend that it is bug-free, but if there are any bugs, it would be a good exercise for a novice to resolve them. - -The inspiration for this tutorial arose from my failure to find good, thorough tutorials when I first started learning Beego. There is one 2-part tutorial that is often mentioned, but I found Part 2 sorely lacking. Throwing source code at you for you to figure out on your own is no way to teach. Thus, I wanted to offer my take on a tutorial. Only history will determine whether it was successful. - -So, without further ado, let’s begin. The word is “Go!” - -### Basic Assumptions - -You have some familiarity with the Go language. I highly recommend you follow this [Go tutorial][1]. - -You’ve installed [Go][2] and [Beego][3] on your computer. There are plenty of good online resources to help you here (for [example][4]). It’s really quite easy. - -You have basic knowledge of CSS, HTML, and databases. You have at least one database package installed on your computer such as [MySQL][5] (Community Edition) or [SQLite][6]. I have SQLite because it’s much easier to use. - -You have some experience writing software; basic skills are assumed. If you studied computer programming in school, then you’re off to a good start. - -You will be using your favourite programming editor in conjunction with the command line. I use [LiteIDE][7] (on the Mac), but I can suggest alternatives such as [TextMate][8] for the Mac, [Notepad++][9] for Windows, and [vim][10] for Linux. - -These basic assumptions define the target audience for the tutorial. If you’re a programming veteran, though, you’ll breeze through it and hopefully gain much useful knowledge, as well. - -### Creating the Project - -First, we must create a Beego project. We’ll call it ‘[ACME][11]’. From the command line, change directory (cd) to $GOPATH/src and enter: -``` -$ bee new acme - -``` - -The following directory structure will be created: -``` -acme -....conf -....controllers -....models -....routers -....static -........css -........img -........js -....tests -....views - -``` - -Note that Beego is a MVC framework (Model/View/Controller), which means that your application will be separated into three general sections. Model refers to the internal database structure of your application. View is all about how your application looks on the computer screen; in our case, this includes HTML and CSS code. And Controller is where you have your business logic and user interactions. - -You can immediately compile and run your application by changing directory (cd acme) and typing: -``` -$ bee run - -``` - -In your browser, go to to see the running application. It doesn’t do anything fancy right now; it simply greets you. But upon this foundation, we shall raise an impressive edifice. - -### The Source Code - -To follow along, you may [download the source code][12] for this tutorial. Cd to $GOPATH/src and unzip the file. [When you download the source, the filename that Github uses is ‘acme-master’. You must change it to ‘acme’.] - -### Program Design - -The user account management component provides the following functionality: - - 1. User registration (account creation) - 2. Account verification (via email) - 3. Login (create a session) - 4. Logout (delete the session) - 5. User profile (can change name, email, or password) - 6. Remove user account - - - -The essence of a web application is the mapping of URLs (webpages) to the server functions that will process the HTTP requests. This mapping is what generates the work flow in the application. In Beego, the mapping is defined within the ‘router’. Here’s the code for our router (look at router.go in the ‘routers’ directory): -``` -beego.Router("/home", &controllers.MainController{}) -beego.Router("/user/login/:back", &controllers.MainController{}, "get,post:Login") -beego.Router("/user/logout", &controllers.MainController{}, "get:Logout") -beego.Router("/user/register", &controllers.MainController{}, "get,post:Register") -beego.Router("/user/profile", &controllers.MainController{}, "get,post:Profile") -beego.Router("/user/verify/:uuid({[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}})", &controllers.MainController{}, "get:Verify") -beego.Router("/user/remove", &controllers.MainController{}, "get,post:Remove") -beego.Router("/notice", &controllers.MainController{}, "get:Notice") - -``` - -For example, in the line for ‘login’, “get,post:Login” says that both the GET and POST operations are handled by the ‘Login’ function. The ‘:back’ is a request parameter; in this case, it tells us what page to return to after successful login. - -In the line for ‘verify’, the ‘:uuid’ is a request parameter that must match the [regular expression][13] for a Version 4 UUID. The GET operation is handled by the ‘Verify’ function. - -More on this when we talk about controllers. - -Note that I’ve added ‘/home’ to the first line in the router (it was originally ‘/’). This makes it convenient to go to the home page, which we often do in our application. - -### Model - -The database model for a user account is represented by the following struct: -``` -package models - -``` -``` -import ( - "github.com/astaxie/beego/orm" - "time" -) - -``` -``` -type AuthUser struct { - Id int - First string - Last string - Email string `orm:"unique"` - Password string - Reg_key string - Reg_date time.Time `orm:"auto_now_add;type(datetime)"` -} - -``` -``` -func init() { - orm.RegisterModel(new(AuthUser)) -} - -``` - -Place this in models.go in the ‘models’ directory. Ignore the init() for the time being. - -‘Id’ is the primary key which is auto-incremented in the database. We also have ‘First’ and ‘Last’ names. ‘Password’ contains the hexadecimal representation of the [PBKDF2 hash][14] of the plaintext password. - -‘Reg_key’ contains the [UUID][15] string that is used for account verification (via email). ‘Reg_date’ is the timestamp indicating the time of registration. - -The funny-looking string literals associated with both ‘Email’ and ‘Reg_date’ are used to tell the database the special requirements of these fields. ‘Email’ must be a unique key. ‘Reg_date’ will be automatically assigned the date and time of database insertion. - -By the way, don’t be scared of the PBKDF2 and UUID references. PBKDF2 is simply a way to securely store a user’s password in the database. A UUID is a unique identifier that can be used to ensure the identity of the user for verification purposes. - -### View - -For our CSS template design, I’ve chosen the [Stardust][16] theme (pictured at the start of this article). We will use its index.html as a basis for the view layout. - -Place the appropriate files from the Stardust theme into the ‘css’ and ‘img’ directories of ‘static’ directory. The link statement in the header of index.html must be amended to: -``` - - -``` - -And all references to image gifs and jpegs in index.html and default.css must point to ‘/static/img/’. - -The view layout contains a header section, a footer section, a sidebar section, and the central section where most of the action will take place. We will be using Go’s templating facility which allows us to replace embedded codes, signified by ‘{{‘ and ‘}}’, with actual HTML. Here’s our basic-layout.tpl (.tpl for ‘template’): -``` -{{.Header}} -{{.LayoutContent}} -{{.Sidebar}} -{{.Footer}} - -``` - -Since every webpage in our application will need to adhere to this basic layout, we need a common method to set it up (look at default.go): -``` -func (this *MainController) activeContent(view string) { - this.Layout = "basic-layout.tpl" - this.LayoutSections = make(map[string]string) - this.LayoutSections["Header"] = "header.tpl" - this.LayoutSections["Sidebar"] = "sidebar.tpl" - this.LayoutSections["Footer"] = "footer.tpl" - this.TplNames = view + ".tpl" - -``` -``` - sess := this.GetSession("acme") - if sess != nil { - this.Data["InSession"] = 1 // for login bar in header.tpl - m := sess.(map[string]interface{}) - this.Data["First"] = m["first"] - } -} - -``` - -The template parameters, such as ‘.Sidebar’, correspond to the keys used in the LayoutSections map. ‘.LayoutContent’ is a special, implicit template parameter. We’ll get to the GetSession stuff further below. - -Of course, we need to create the various template files (such as footer.tpl) in the ‘views’ directory. From index.html, we can carve out the header section for header.tpl: -``` - - - - -StarDust by Free Css Templates - - - - - -``` -``` - - -
- -
- - -
- -``` - -I leave it as an exercise for you to carve out the sections for sidebar.tpl and footer.tpl. - -Note the lines in bold. I added them to facilitate a “login bar” at the top of every webpage. Once you’ve logged into the application, you will see the bar as so: - -![][17] - -This login bar works in conjunction with the GetSession code snippet we saw in activeContent(). The logic is, if the user is logged in (ie, there is a non-nil session), then we set the InSession parameter to a value (any value), which tells the templating engine to use the “Welcome” bar instead of “Login”. We also extract the user’s first name from the session so that we can present the friendly affectation “Welcome, Richard”. - -The home page, represented by index.tpl, uses the following snippet from index.html: -``` - -
-
-

Welcome to StarDust

- // to save space, I won't enter the remainder - // of the snippet -
- - -``` - -#### Special Note - -The template files for the user module reside in the ‘user’ directory within ‘views’, just to keep things tidy. So, for example, the call to activeContent() for login is: -``` -this.activeContent("user/login") - -``` - -### Controller - -A controller handles requests by handing them off to the appropriate function or ‘method’. We only have one controller for our application and it’s defined in default.go. The default method Get() for handling a GET operation is associated with our home page: -``` -func (this *MainController) Get() { - this.activeContent("index") - -``` -``` - //bin //boot //dev //etc //home //lib //lib64 //media //mnt //opt //proc //root //run //sbin //speedup //srv //sys //tmp //usr //var This page requires login - sess := this.GetSession("acme") - if sess == nil { - this.Redirect("/user/login/home", 302) - return - } - m := sess.(map[string]interface{}) - fmt.Println("username is", m["username"]) - fmt.Println("logged in at", m["timestamp"]) -} - -``` - -I’ve made login a requirement for accessing this page. Logging in means creating a session, which by default expires after 3600 seconds of inactivity. A session is typically maintained on the client side by a ‘cookie’. - -In order to support sessions in the application, the ‘SessionOn’ flag must be set to true. There are two ways to do this: - - 1. Insert ‘beego.SessionOn = true’ in the main program, main.go. - 2. Insert ‘sessionon = true’ in the configuration file, app.conf, which can be found in the ‘conf’ directory. - - - -I chose #1. (But note that I used the configuration file to set ‘EnableAdmin’ to true: ‘enableadmin = true’. EnableAdmin allows you to use the Supervisor Module in Beego that keeps track of CPU, memory, Garbage Collector, threads, etc., via port 8088: .) - -#### The Main Program - -The main program is also where we initialize the database to be used with the ORM (Object Relational Mapping) component. ORM makes it more convenient to perform database activities within our application. The main program’s init(): -``` -func init() { - orm.RegisterDriver("sqlite", orm.DR_Sqlite) - orm.RegisterDataBase("default", "sqlite3", "acme.db") - name := "default" - force := false - verbose := false - err := orm.RunSyncdb(name, force, verbose) - if err != nil { - fmt.Println(err) - } -} - -``` - -To use SQLite, we must import ‘go-sqlite3', which can be installed with the command: -``` -$ go get github.com/mattn/go-sqlite3 - -``` - -As you can see in the code snippet, the SQLite driver must be registered and ‘acme.db’ must be registered as our SQLite database. - -Recall in models.go, there was an init() function: -``` -func init() { - orm.RegisterModel(new(AuthUser)) -} - -``` - -The database model has to be registered so that the appropriate table can be generated. To ensure that this init() function is executed, you must import ‘models’ without actually using it within the main program, as follows: -``` -import _ "acme/models" - -``` - -RunSyncdb() is used to autogenerate the tables when you start the program. (This is very handy for creating the database tables without having to **manually** do it in the database command line utility.) If you set ‘force’ to true, it will drop any existing tables and recreate them. - -#### The User Module - -User.go contains all the methods for handling login, registration, profile, etc. There are several third-party packages we need to import; they provide support for email, PBKDF2, and UUID. But first we must get them into our project… -``` -$ go get github.com/alexcesaro/mail/gomail -$ go get github.com/twinj/uuid - -``` - -I originally got **github.com/gokyle/pbkdf2** , but this package was pulled from Github, so you can no longer get it. I’ve incorporated this package into my source under the ‘utilities’ folder, and the import is: -``` -import pk "acme/utilities/pbkdf2" - -``` - -The ‘pk’ is a convenient alias so that I don’t have to type the rather unwieldy ‘pbkdf2'. - -#### ORM - -It’s pretty straightforward to use ORM. The basic pattern is to create an ORM object, specify the ‘default’ database, and select which ORM operation you want, eg, -``` -o := orm.NewOrm() -o.Using("default") -err := o.Insert(&user) // or -err := o.Read(&user, "Email") // or -err := o.Update(&user) // or -err := o.Delete(&user) - -``` - -#### Flash - -By the way, Beego provides a way to present notifications on your webpage through the use of ‘flash’. Basically, you create a ‘flash’ object, give it your notification message, store the flash in the controller, and then retrieve the message in the template file, eg, -``` -flash := beego.NewFlash() -flash.Error("You've goofed!") // or -flash.Notice("Well done!") -flash.Store(&this.Controller) - -``` - -And in your template file, reference the Error flash with: -``` -{{if .flash.error}} -

{{.flash.error}}

-  -{{end}} - -``` - -#### Form Validation - -Once the user posts a request (by pressing the Submit button, for example), our handler must extract and validate the form input. So, first, check that we have a POST operation: -``` -if this.Ctx.Input.Method() == "POST" { - -``` - -Let’s get a form element, say, email: -``` -email := this.GetString("email") - -``` - -The string “email” is the same as in the HTML form: -``` - - -``` - -To validate it, we create a validation object, specify the type of validation, and then check to see if there are any errors: -``` -valid := validation.Validation{} -valid.Email(email, "email") // must be a proper email address -if valid.HasErrors() { - for _, err := range valid.Errors { - -``` - -What you do with the errors is up to you. I like to present all of them at once to the user, so as I go through the range of valid.Errors, I add them to a map of errors that will eventually be used in the template file. Hence, the full snippet: -``` -if this.Ctx.Input.Method() == "POST" { - email := this.GetString("email") - password := this.GetString("password") - valid := validation.Validation{} - valid.Email(email, "email") - valid.Required(password, "password") - if valid.HasErrors() { - errormap := []string{} - for _, err := range valid.Errors { - errormap = append(errormap, "Validation failed on "+err.Key+": "+err.Message+"\n") - } - this.Data["Errors"] = errormap - return - } - -``` - -### The User Management Methods - -We’ve looked at the major pieces of the controller. Now, we get to the meat of the application, the user management methods: - - * Login() - * Logout() - * Register() - * Verify() - * Profile() - * Remove() - - - -Recall that we saw references to these functions in the router. The router associates each URL (and HTTP request) with the corresponding controller method. - -#### Login() - -Let’s look at the pseudocode for this method: -``` -if the HTTP request is "POST" then - Validate the form (extract the email address and password). - Read the password hash from the database, keying on email. - Compare the submitted password with the one on record. - Create a session for this user. -endif - -``` - -In order to compare passwords, we need to give pk.MatchPassword() a variable with members ‘Hash’ and ‘Salt’ that are **byte slices**. Hence, -``` -var x pk.PasswordHash - -``` -``` -x.Hash = make([]byte, 32) -x.Salt = make([]byte, 16) -// after x has the password from the database, then... - -``` -``` -if !pk.MatchPassword(password, &x) { - flash.Error("Bad password") - flash.Store(&this.Controller) - return -} - -``` - -Creating a session is trivial, but we want to store some useful information in the session, as well. So we make a map and store first name, email address, and the time of login: -``` -m := make(map[string]interface{}) -m["first"] = user.First -m["username"] = email -m["timestamp"] = time.Now() -this.SetSession("acme", m) -this.Redirect("/"+back, 302) // go to previous page after login - -``` - -Incidentally, the name “acme” passed to SetSession is completely arbitrary; you just need to reference the same name to get the same session. - -#### Logout() - -This one is trivially easy. We delete the session and redirect to the home page. - -#### Register() -``` -if the HTTP request is "POST" then - Validate the form. - Create the password hash for the submitted password. - Prepare new user record. - Convert the password hash to hexadecimal string. - Generate a UUID and insert the user into database. - Send a verification email. - Flash a message on the notification page. -endif - -``` - -To send a verification email to the user, we use **gomail** … -``` -link := "http://localhost:8080/user/verify/" + u // u is UUID -host := "smtp.gmail.com" -port := 587 -msg := gomail.NewMessage() -msg.SetAddressHeader("From", "acmecorp@gmail.com", "ACME Corporation") -msg.SetHeader("To", email) -msg.SetHeader("Subject", "Account Verification for ACME Corporation") -msg.SetBody("text/html", "To verify your account, please click on the link: "+link+"

Best Regards,
ACME Corporation") -m := gomail.NewMailer(host, "youraccount@gmail.com", "YourPassword", port) -if err := m.Send(msg); err != nil { - return false -} - -``` - -I chose Gmail as my email relay (you will need to open your own account). Note that Gmail ignores the “From” address (in our case, “[acmecorp@gmail.com][18]”) because Gmail does not permit you to alter the sender address in order to prevent phishing. - -#### Notice() - -This special router method is for displaying a flash message on a notification page. It’s not really a user module function; it’s general enough that you can use it in many other places. - -#### Profile() - -We’ve already discussed all the pieces in this function. The pseudocode is: -``` -Login required; check for a session. -Get user record from database, keyed on email (or username). -if the HTTP request is "POST" then - Validate the form. - if there is a new password then - Validate the new password. - Create the password hash for the new password. - Convert the password hash to hexadecimal string. - endif - Compare submitted current password with the one on record. - Update the user record. - - update the username stored in session -endif - -``` - -#### Verify() - -The verification email contains a link which, when clicked by the recipient, causes Verify() to process the UUID. Verify() attempts to read the user record, keyed on the UUID or registration key, and if it’s found, then the registration key is removed from the database. - -#### Remove() - -Remove() is pretty much like Login(), except that instead of creating a session, you delete the user record from the database. - -### Exercise - -I left out one user management method: What if the user has forgotten his password? We should provide a way to reset the password. I leave this as an exercise for you. All the pieces you need are in this tutorial. (Hint: You’ll need to do it in a way similar to Registration verification. You should add a new Reset_key to the AuthUser table. And make sure the user email address exists in the database before you send the Reset email!) - -[Okay, so I’ll give you the [exercise solution][19]. I’m not cruel.] - -### Wrapping Up - -Let’s review what we’ve learned. We covered the mapping of URLs to request handlers in the router. We showed how to incorporate a CSS template design into our views. We discussed the ORM package, and how it’s used to perform database operations. We examined a number of third-party utilities useful in writing our application. The end result is a component useful in many scenarios. - -This is a great deal of material in a tutorial, but I believe it’s the best way to get started in writing a practical application. - -[For further material, look at the [sequel][20] to this article, as well as the [final edition][21].] - --------------------------------------------------------------------------------- - -via: https://medium.com/@richardeng/a-word-from-the-beegoist-d562ff8589d7 - -作者:[Richard Kenneth Eng][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://medium.com/@richardeng?source=post_header_lockup -[1]:http://tour.golang.org/ -[2]:http://golang.org/ -[3]:http://beego.me/ -[4]:https://medium.com/@richardeng/in-the-beginning-61c7e63a3ea6 -[5]:http://www.mysql.com/ -[6]:http://www.sqlite.org/ -[7]:https://code.google.com/p/liteide/ -[8]:http://macromates.com/ -[9]:http://notepad-plus-plus.org/ -[10]:https://medium.com/@richardeng/back-to-the-future-9db24d6bcee1 -[11]:http://en.wikipedia.org/wiki/Acme_Corporation -[12]:https://github.com/horrido/acme -[13]:http://en.wikipedia.org/wiki/Regular_expression -[14]:http://en.wikipedia.org/wiki/PBKDF2 -[15]:http://en.wikipedia.org/wiki/Universally_unique_identifier -[16]:http://www.freewebtemplates.com/download/free-website-template/stardust-141989295/ -[17]:https://cdn-images-1.medium.com/max/1600/1*1OpYy1ISYGUaBy0U_RJ75w.png -[18]:mailto:acmecorp@gmail.com -[19]:https://github.com/horrido/acme-exercise -[20]:https://medium.com/@richardeng/a-word-from-the-beegoist-ii-9561351698eb -[21]:https://medium.com/@richardeng/a-word-from-the-beegoist-iii-dbd6308b2594 -[22]: http://golang.org/ -[23]: http://beego.me/ -[24]: http://revel.github.io/ -[25]: http://www.web2py.com/ -[26]: https://medium.com/@richardeng/the-zen-of-web2py-ede59769d084 -[27]: http://www.seaside.st/ -[28]: http://en.wikipedia.org/wiki/Object-relational_mapping diff --git a/sources/tech/20151127 Research log- gene signatures and connectivity map.md b/sources/tech/20151127 Research log- gene signatures and connectivity map.md new file mode 100644 index 0000000000..f4e7faa4bc --- /dev/null +++ b/sources/tech/20151127 Research log- gene signatures and connectivity map.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Research log: gene signatures and connectivity map) +[#]: via: (https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Research log: gene signatures and connectivity map +====== + +Happy Thanksgiving everyone! + +### Context + +This is the third post in my continuing series on my attempts at research. Previously we talked about: + + * [what I’m doing, cell states, and microarrays][1] + * and then [more about microarrays and R][2]. + + + +By the end of last week we had discussed how to get a table of normalized gene expression intensities that looks like this: + +``` +ENSG00000280099_at 0.15484421 +ENSG00000280109_at 0.16881395 +ENSG00000280178_at -0.19621641 +ENSG00000280316_at 0.08622216 +ENSG00000280401_at 0.15966256 +ENSG00000281205_at -0.02085352 +... +``` + +The reason for doing this is to figure out which genes are related, and perhaps more importantly, what a cell is even doing. + +_Summary:_ new post, also, I’m bringing back the short section summaries. + +### Cell lines + +The first thing to do when trying to figure out what cells are doing is to choose a cell. There’s all sorts of cells. Healthy brain cells, cancerous blood cells, bruised skin cells, etc. + +For any experiment, you’ll need a control to eliminate noise and apply statistical tests for validity. If you don’t use a control, the effect you’re seeing may not even exist, and so for any experiment with cells, you will need a control cell. + +Cells often divide, which means that a cell, once chosen, will duplicate itself for you in the presence of the appropriate resources. Not all cells divide ad nauseam which provides some challenges, but many cells under study luckily do. + +So, a _cell line_ is simply a set of cells that have all replicated from a specific chosen initial cell. Any set of cells from a cell line will be as identical as possible (unless you screwed up! geez). They will be the same type of cell with the same traits and behaviors, at least, as much as possible. + +_Summary:_ a cell line is a large amount of cells that are as close to being the same as possible. + +### Perturbagens + +There are many things that might affect what a cell is doing. Drugs, agitation, temperature, disease, cancer, gene splicing, small molecules (maybe you give a cell more iron or calcium or something), hormones, light, Jello, ennui, etc. Given any particular cell line, giving a cell from that cell line one of these _perturbagens_, or, perturbing the cell in a specific way, when compared to a control will say what that cell does differently in the face of that perturbagen. + +If you’d like to find out what exactly a certain type of cell does when you give it lemon lime soda, then you choose the right cell line, leave out some control cells and give the rest of the cells soda. + +Then, you measure gene expression intensities for both the control cells and the perturbed cells. The _differential expression_ of genes between the perturbed cells and the controls cells is likely due to the introduction of the lemon lime soda. + +Genes that end up getting expressed _more_ in the presence of the soda are considered _up-regulated_, whereas genes that end up getting expressed _less_ are considered _down-regulated_. The degree to which a gene is up or down regulated constitutes how much of an effect the soda may have had on that gene. + +Of course, all of this has such a significant amount of experimental noise that you could find pretty much anything. You’ll need to replicate your experiment independently a few times before you publish that lemon lime soda causes increased expression in the [Sonic hedgehog gene][3]. + +_Summary:_ A perturbagen is something you introduce/do to a cell to change its behavior, such as drugs or throwing it at a wall or something. The wall perturbagen. + +### Gene signature + +For a given change or perturbagen to a cell, we now have enough to compute lists of up-regulated and down-regulated genes and the magnitude change in expression for each gene. + +This gene expression pattern for some subset of important genes (perhaps the most changed in expression) is called a _gene signature_, and gene signatures are very useful. By comparing signatures, you can: + + * identify or compare cell states + * find sets of positively or negatively correlated genes + * find similar disease signatures + * find similar drug signatures + * find drug signatures that might counteract opposite disease signatures. + + + +(That last bullet point is essentially where I’m headed with my research.) + +_Summary:_ a gene signature is a short summary of the most important gene expression differences a perturbagen causes in a cell. + +### Drugs! + +The pharmaceutical industry is constantly on the lookout for new breakthrough drugs that might represent huge windfalls in cash, and drugs don’t always work as planned. Many drugs spend years in research and development, only to ultimately find poor efficacy or adoption. Sometimes drugs even become known [much more for their side-effects than their originally intended therapy][4]. + +The practical upshot is that there’s countless FDA-approved drugs that represent decades of work that are simply underused or even unused entirely. These drugs have already cleared many challenging regulatory hurdles, but are simply and quite literally cures looking for a disease. + +If even just one of these drugs can be given a new lease on life for some yet-to-be-cured disease, then perhaps we can give some people new leases on life! + +_Summary:_ instead of developing new drugs, there’s already lots of drugs that aren’t being used. Maybe we can find matching diseases! + +### The Connectivity Map project + +The [Broad Institute’s Connectivity Map project][5] isn’t particularly new anymore, but it represents a ground breaking and promising idea - we can dump a bunch of signatures into a database and construct all sorts of new hypotheses we might not even have thought to check before. + +To prove out the usefulness of this idea, the Connectivity Map (or cmap) project chose 5 different cell lines (all cancer cells, which are easy to get to replicate!) and a library of FDA approved drugs, and then gave some cells these drugs. + +They then constructed a database of all of the signatures they computed for each possible perturbagen they measured. Finally, they constructed a web interface where a user can upload a gene signature and get a result list back of all of the signatures they collected, ordered by the most to least similar. You can totally go sign up and [try it out][5]. + +This simple tool is surprisingly powerful. It allows you to find similar drugs to a drug you know, but it also allows you to find drugs that might counteract a disease you’ve created a signature for. + +Ultimately, the project led to [a number of successful applications][6]. So useful was it that the Broad Institute has doubled down and created the much larger and more comprehensive [LINCS Project][7] that targets an order of magnitude more cell lines (77) and more perturbagens (42,532, compared to cmap’s 6100). You can sign up and use that one too! + +_Summary_: building a system that supports querying signature connections has already proved to be super useful. + +### Whew + +Alright, I wrote most of this on a plane yesterday but since I should now be spending time with family I’m going to cut it short here. + +Stay tuned for next week! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[2]: https://www.jtolio.com/writing/2015/11/research-log-r-and-more-microarrays/ +[3]: https://en.wikipedia.org/wiki/Sonic_hedgehog +[4]: https://en.wikipedia.org/wiki/Sildenafil#History +[5]: https://www.broadinstitute.org/cmap/ +[6]: https://www.broadinstitute.org/cmap/publications.jsp +[7]: http://www.lincscloud.org/ diff --git a/sources/tech/20160302 Go channels are bad and you should feel bad.md b/sources/tech/20160302 Go channels are bad and you should feel bad.md new file mode 100644 index 0000000000..0ad2a5ed97 --- /dev/null +++ b/sources/tech/20160302 Go channels are bad and you should feel bad.md @@ -0,0 +1,443 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go channels are bad and you should feel bad) +[#]: via: (https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Go channels are bad and you should feel bad +====== + +_Update: If you’re coming to this blog post from a compendium titled “Go is not good,” I want to make it clear that I am ashamed to be on such a list. Go is absolutely the least worst programming language I’ve ever used. At the time I wrote this, I wanted to curb a trend I was seeing, namely, overuse of one of the more warty parts of Go. I still think channels could be much better, but overall, Go is wonderful. It’s like if your favorite toolbox had [this][1] in it; the tool can have uses (even if it could have had more uses), and it can still be your favorite toolbox!_ + +_Update 2: I would be remiss if I didn’t point out this excellent survey of real issues: [Understanding Real-World Concurrency Bugs In Go][2]. A significant finding of this survey is that… Go channels cause lots of bugs._ + +I’ve been using Google’s [Go programming language][3] on and off since mid-to-late 2010, and I’ve had legitimate product code written in Go for [Space Monkey][4] since January 2012 (before Go 1.0!). My initial experience with Go was back when I was researching Hoare’s [Communicating Sequential Processes][5] model of concurrency and the [π-calculus][6] under [Matt Might][7]’s [UCombinator research group][8] as part of my ([now redirected][9]) PhD work to better enable multicore development. Go was announced right then (how serendipitous!) and I immediately started kicking tires. + +It quickly became a core part of Space Monkey development. Our production systems at Space Monkey currently account for over 425k lines of pure Go (_not_ counting all of our vendored libraries, which would make it just shy of 1.5 million lines), so not the most Go you’ll ever see, but for the relatively young language we’re heavy users. We’ve [written about our Go usage][10] before. We’ve open-sourced some fairly heavily used libraries; many people seem to be fans of our [OpenSSL bindings][11] (which are faster than [crypto/tls][12], but please keep openssl itself up-to-date!), our [error handling library][13], [logging library][14], and [metric collection library/zipkin client][15]. We use Go, we love Go, we think it’s the least bad programming language for our needs we’ve used so far. + +Although I don’t think I can talk myself out of mentioning my widely avoided [goroutine-local-storage library][16] here either (which even though it’s a hack that you shouldn’t use, it’s a beautiful hack), hopefully my other experience will suffice as valid credentials that I kind of know what I’m talking about before I explain my deliberately inflamatory post title. + +![][17] + +### Wait, what? + +If you ask the proverbial programmer on the street what’s so special about Go, she’ll most likely tell you that Go is most known for channels and goroutines. Go’s theoretical underpinnings are heavily based in Hoare’s CSP model, which is itself incredibly fascinating and interesting and I firmly believe has much more to yield than we’ve appropriated so far. + +CSP (and the π-calculus) both use communication as the core synchronization primitive, so it makes sense Go would have channels. Rob Pike has been fascinated with CSP (with good reason) for a [considerable][18] [while][19] [now][20]. + +But from a pragmatic perspective (which Go prides itself on), Go got channels wrong. Channels as implemented are pretty much a solid anti-pattern in my book at this point. Why? Dear reader, let me count the ways. + +#### You probably won’t end up using just channels. + +Hoare’s Communicating Sequential Processes is a computational model where essentially the only synchronization primitive is sending or receiving on a channel. As soon as you use a mutex, semaphore, or condition variable, bam, you’re no longer in pure CSP land. Go programmers often tout this model and philosophy through the chanting of the [cached thought][21] “[share memory by communicating][22].” + +So let’s try and write a small program using just CSP in Go! Let’s make a high score receiver. All we will do is keep track of the largest high score value we’ve seen. That’s it. + +First, we’ll make a `Game` struct. + +``` +type Game struct { + bestScore int + scores chan int +} +``` + +`bestScore` isn’t going to be protected by a mutex! That’s fine, because we’ll simply have one goroutine manage its state and receive new scores over a channel. + +``` +func (g *Game) run() { + for score := range g.scores { + if g.bestScore < score { + g.bestScore = score + } + } +} +``` + +Okay, now we’ll make a helpful constructor to start a game. + +``` +func NewGame() (g *Game) { + g = &Game{ + bestScore: 0, + scores: make(chan int), + } + go g.run() + return g +} +``` + +Next, let’s assume someone has given us a `Player` that can return scores. It might also return an error, cause hey maybe the incoming TCP stream can die or something, or the player quits. + +``` +type Player interface { + NextScore() (score int, err error) +} +``` + +To handle the player, we’ll assume all errors are fatal and pass received scores down the channel. + +``` +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +Yay! Okay, we have a `Game` type that can keep track of the highest score a `Player` receives in a thread-safe way. + +You wrap up your development and you’re on your way to having customers. You make this game server public and you’re incredibly successful! Lots of games are being created with your game server. + +Soon, you discover people sometimes leave your game. Lots of games no longer have any players playing, but nothing stopped the game loop. You are getting overwhelmed by dead `(*Game).run` goroutines. + +**Challenge:** fix the goroutine leak above without mutexes or panics. For real, scroll up to the above code and come up with a plan for fixing this problem using just channels. + +I’ll wait. + +For what it’s worth, it totally can be done with channels only, but observe the simplicity of the following solution which doesn’t even have this problem: + +``` +type Game struct { + mtx sync.Mutex + bestScore int +} + +func NewGame() *Game { + return &Game{} +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.mtx.Lock() + if g.bestScore < score { + g.bestScore = score + } + g.mtx.Unlock() + } +} +``` + +Which one would you rather work on? Don’t be deceived into thinking that the channel solution somehow makes this more readable and understandable in more complex cases. Teardown is very hard. This sort of teardown is just a piece of cake with a mutex, but the hardest thing to work out with Go-specific channels only. Also, if anyone replies that channels sending channels is easier to reason about here it will cause me an immediate head-to-desk motion. + +Importantly, this particular case might actually be _easily_ solved _with channels_ with some runtime assistance Go doesn’t provide! Unfortunately, as it stands, there are simply a surprising amount of problems that are solved better with traditional synchronization primitives than with Go’s version of CSP. We’ll talk about what Go could have done to make this case easier later. + +**Exercise:** Still skeptical? Try making both solutions above (channel-only vs. mutex-only) stop asking for scores from `Players` once `bestScore` is 100 or greater. Go ahead and open your text editor. This is a small, toy problem. + +The summary here is that you will be using traditional synchronization primitives in addition to channels if you want to do anything real. + +#### Channels are slower than implementing it yourself + +One of the things I assumed about Go being so heavily based in CSP theory is that there should be some pretty killer scheduler optimizations the runtime can make with channels. Perhaps channels aren’t always the most straightforward primitive, but surely they’re efficient and fast, right? + +![][23] + +As [Dustin Hiatt][24] points out on [Tyler Treat’s post about Go][25], + +> Behind the scenes, channels are using locks to serialize access and provide threadsafety. So by using channels to synchronize access to memory, you are, in fact, using locks; locks wrapped in a threadsafe queue. So how do Go’s fancy locks compare to just using mutex’s from their standard library `sync` package? The following numbers were obtained by using Go’s builtin benchmarking functionality to serially call Put on a single set of their respective types. + +``` +> BenchmarkSimpleSet-8 3000000 391 ns/op +> BenchmarkSimpleChannelSet-8 1000000 1699 ns/o +> +``` + +It’s a similar story with unbuffered channels, or even the same test under contention instead of run serially. + +Perhaps the Go scheduler will improve, but in the meantime, good old mutexes and condition variables are very good, efficient, and fast. If you want performance, you use the tried and true methods. + +#### Channels don’t compose well with other concurrency primitives + +Alright, so hopefully I have convinced you that you’ll at least be interacting with primitives besides channels sometimes. The standard library certainly seems to prefer traditional synchronization primitives over channels. + +Well guess what, it’s actually somewhat challenging to use channels alongside mutexes and condition variables correctly! + +One of the interesting things about channels that makes a lot of sense coming from CSP is that channel sends are synchronous. A channel send and channel receive are intended to be synchronization barriers, and the send and receive should happen at the same virtual time. That’s wonderful if you’re in well-executed CSP-land. + +![][26] + +Pragmatically, Go channels also come in a buffered variety. You can allocate a fixed amount of space to account for possible buffering so that sends and receives are disparate events, but the buffer size is capped. Go doesn’t provide a way to have arbitrarily sized buffers - you have to allocate the buffer size in advance. _This is fine_, I’ve seen people argue on the mailing list, _because memory is bounded anyway._ + +Wat. + +This is a bad answer. There’s all sorts of reasons to use an arbitrarily buffered channel. If we knew everything up front, why even have `malloc`? + +Not having arbitrarily buffered channels means that a naive send on _any_ channel could block at any time. You want to send on a channel and update some other bookkeeping under a mutex? Careful! Your channel send might block! + +``` +// ... +s.mtx.Lock() +// ... +s.ch <- val // might block! +s.mtx.Unlock() +// ... +``` + +This is a recipe for dining philosopher dinner fights. If you take a lock, you should quickly update state and release it and not do anything blocking under the lock if possible. + +There is a way to do a non-blocking send on a channel in Go, but it’s not the default behavior. Assume we have a channel `ch := make(chan int)` and we want to send the value `1` on it without blocking. Here is the minimum amount of typing you have to do to send without blocking: + +``` +select { +case ch <- 1: // it sent +default: // it didn't +} +``` + +This isn’t what naturally leaps to mind for beginning Go programmers. + +The summary is that because many operations on channels block, it takes careful reasoning about philosophers and their dining to successfully use channel operations alongside and under mutex protection, without causing deadlocks. + +#### Callbacks are strictly more powerful and don’t require unnecessary goroutines. + +![][27] + +Whenever an API uses a channel, or whenever I point out that a channel makes something hard, someone invariably points out that I should just spin up a goroutine to read off the channel and make whatever translation or fix I need as it reads of the channel. + +Um, no. What if my code is in a hotpath? There’s very few instances that require a channel, and if your API could have been designed with mutexes, semaphores, and callbacks and no additional goroutines (because all event edges are triggered by API events), then using a channel forces me to add another stack of memory allocation to my resource usage. Goroutines are much lighter weight than threads, yes, but lighter weight doesn’t mean the lightest weight possible. + +As I’ve formerly [argued in the comments on an article about using channels][28] (lol the internet), your API can _always_ be more general, _always_ more flexible, and take drastically less resources if you use callbacks instead of channels. “Always” is a scary word, but I mean it here. There’s proof-level stuff going on. + +If someone provides a callback-based API to you and you need a channel, you can provide a callback that sends on a channel with little overhead and full flexibility. + +If, on the other hand, someone provides a channel-based API to you and you need a callback, you have to spin up a goroutine to read off the channel _and_ you have to hope that no one tries to send more on the channel when you’re done reading so you cause blocked goroutine leaks. + +For a super simple real-world example, check out the [context interface][29] (which incidentally is an incredibly useful package and what you should be using instead of [goroutine-local storage][16]): + +``` +type Context interface { + ... + // Done returns a channel that closes when this work unit should be canceled. + Done() <-chan struct{} + + // Err returns a non-nil error when the Done channel is closed + Err() error + ... +} +``` + +Imagine all you want to do is log the corresponding error when the `Done()` channel fires. What do you have to do? If you don’t have a good place you’re already selecting on a channel, you have to spin up a goroutine to deal with it: + +``` +go func() { + <-ctx.Done() + logger.Errorf("canceled: %v", ctx.Err()) +}() +``` + +What if `ctx` gets garbage collected without closing the channel `Done()` returned? Whoops! Just leaked a goroutine! + +Now imagine we changed `Done`’s signature: + +``` +// Done calls cb when this work unit should be canceled. +Done(cb func()) +``` + +First off, logging is so easy now. Check it out: `ctx.Done(func() { log.Errorf("canceled: %v", ctx.Err()) })`. But lets say you really do need some select behavior. You can just call it like this: + +``` +ch := make(chan struct{}) +ctx.Done(func() { close(ch) }) +``` + +Voila! No expressiveness lost by using a callback instead. `ch` works like the channel `Done()` used to return, and in the logging case we didn’t need to spin up a whole new stack. I got to keep my stack traces (if our log package is inclined to use them); I got to avoid another stack allocation and another goroutine to give to the scheduler. + +Next time you use a channel, ask yourself if there’s some goroutines you could eliminate if you used mutexes and condition variables instead. If the answer is yes, your code will be more efficient if you change it. And if you’re trying to use channels just to be able to use the `range` keyword over a collection, I’m going to have to ask you to put your keyboard away or just go back to writing Python books. + +![more like Zooey De-channel, amirite][30] + +#### The channel API is inconsistent and just cray-cray + +Closing or sending on a closed channel panics! Why? If you want to close a channel, you need to either synchronize its closed state externally (with mutexes and so forth that don’t compose well!) so that other writers don’t write to or close a closed channel, or just charge forward and close or write to closed channels and expect you’ll have to recover any raised panics. + +This is such bizarre behavior. Almost every other operation in Go has a way to avoid a panic (type assertions have the `, ok =` pattern, for example), but with channels you just get to deal with it. + +Okay, so when a send will fail, channels panic. I guess that makes some kind of sense. But unlike almost everything else with nil values, sending to a nil channel won’t panic. Instead, it will block forever! That’s pretty counter-intuitive. That might be useful behavior, just like having a can-opener attached to your weed-whacker might be useful (and found in Skymall), but it’s certainly unexpected. Unlike interacting with nil maps (which do implicit pointer dereferences), nil interfaces (implicit pointer dereferences), unchecked type assertions, and all sorts of other things, nil channels exhibit actual channel behavior, as if a brand new channel was just instantiated for this operation. + +Receives are slightly nicer. What happens when you receive on a closed channel? Well, that works - you get a zero value. Okay that makes sense I guess. Bonus! Receives allow you to do a `, ok =`-style check if the channel was open when you received your value. Thank heavens we get `, ok =` here. + +But what happens if you receive from a nil channel? _Also blocks forever!_ Yay! Don’t try and use the fact that your channel is nil to keep track of if you closed it! + +### What are channels good for? + +Of course channels are good for some things (they are a generic container after all), and there are certain things you can only do with them (`select`). + +#### They are another special-cased generic datastructure + +Go programmers are so used to arguments about generics that I can feel the PTSD coming on just by bringing up the word. I’m not here to talk about it so wipe the sweat off your brow and let’s keep moving. + +Whatever your opinion of generics is, Go’s maps, slices, and channels are data structures that support generic element types, because they’ve been special-cased into the language. + +In a language that doesn’t allow you to write your own generic containers, _anything_ that allows you to better manage collections of things is valuable. Here, channels are a thread-safe datastructure that supports arbitrary value types. + +So that’s useful! That can save some boilerplate I suppose. + +I’m having trouble counting this as a win for channels. + +#### Select + +The main thing you can do with channels is the `select` statement. Here you can wait on a fixed number of inputs for events. It’s kind of like epoll, but you have to know upfront how many sockets you’re going to be waiting on. + +This is truly a useful language feature. Channels would be a complete wash if not for `select`. But holy smokes, let me tell you about the first time you decide you might need to select on multiple things but you don’t know how many and you have to use `reflect.Select`. + +### How could channels be better? + +It’s really tough to say what the most tactical thing the Go language team could do for Go 2.0 is (the Go 1.0 compatibility guarantee is good but hand-tying), but that won’t stop me from making some suggestions. + +#### Select on condition variables! + +We could just obviate the need for channels! This is where I propose we get rid of some sacred cows, but let me ask you this, how great would it be if you could select on any custom synchronization primitive? (A: So great.) If we had that, we wouldn’t need channels at all. + +#### GC could help us? + +In the very first example, we could easily solve the high score server cleanup with channels if we were able to use directionally-typed channel garbage collection to help us clean up. + +![][31] + +As you know, Go has directionally-typed channels. You can have a channel type that only supports reading (`<-chan`) and a channel type that only supports writing (`chan<-`). Great! + +Go also has garbage collection. It’s clear that certain kinds of book keeping are just too onerous and we shouldn’t make the programmer deal with them. We clean up unused memory! Garbage collection is useful and neat. + +So why not help clean up unused or deadlocked channel reads? Instead of having `make(chan Whatever)` return one bidirectional channel, have it return two single-direction channels (`chanReader, chanWriter := make(chan Type)`). + +Let’s reconsider the original example: + +``` +type Game struct { + bestScore int + scores chan<- int +} + +func run(bestScore *int, scores <-chan int) { + // we don't keep a reference to a *Game directly because then we'd be holding + // onto the send side of the channel. + for score := range scores { + if *bestScore < score { + *bestScore = score + } + } +} + +func NewGame() (g *Game) { + // this make(chan) return style is a proposal! + scoreReader, scoreWriter := make(chan int) + g = &Game{ + bestScore: 0, + scores: scoreWriter, + } + go run(&g.bestScore, scoreReader) + return g +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +If garbage collection closed a channel when we could prove no more values are ever coming down it, this solution is completely fixed. Yes yes, the comment in `run` is indicative of the existence of a rather large gun aimed at your foot, but at least the problem is easily solveable now, whereas it really wasn’t before. Furthermore, a smart compiler could probably make appropriate proofs to reduce the damage from said foot-gun. + +#### Other smaller issues + + * **Dup channels?** \- If we could use an equivalent of the `dup` syscall on channels, then we could also solve the multiple producer problem quite easily. Each producer could close their own `dup`-ed channel without ruining the other producers. + * **Fix the channel API!** \- Close isn’t idempotent? Send on closed channel panics with no way to avoid it? Ugh! + * **Arbitrarily buffered channels** \- If we could make buffered channels with no fixed buffer size limit, then we could make channels that don’t block. + + + +### What do we tell people about Go then? + +If you haven’t yet, please go take a look at my current favorite programming post: [What Color is Your Function][32]. Without being about Go specifically, this blog post much more eloquently than I could lays out exactly why goroutines are Go’s best feature (and incidentally one of the ways Go is better than Rust for some applications). + +If you’re still writing code in a programming language that forces keywords like `yield` on you to get high performance, concurrency, or an event-driven model, you are living in the past, whether or not you or anyone else knows it. Go is so far one of the best entrants I’ve seen of languages that implement an M:N threading model that’s not 1:1, and dang that’s powerful. + +So, tell folks about goroutines. + +If I had to pick one other leading feature of Go, it’s interfaces. Statically-typed [duck typing][33] makes extending and working with your own or someone else’s project so fun and amazing it’s probably worth me writing an entirely different set of words about it some other time. + +### So… + +I keep seeing people charge in to Go, eager to use channels to their full potential. Here’s my advice to you. + +**JUST STAHP IT** + +When you’re writing APIs and interfaces, as bad as the advice “never” can be, I’m pretty sure there’s never a time where channels are better, and every Go API I’ve used that used channels I’ve ended up having to fight. I’ve never thought “oh good, there’s a channel here;” it’s always instead been some variant of _**WHAT FRESH HELL IS THIS?**_ + +So, _please, please use channels where appropriate and only where appropriate._ + +In all of my Go code I work with, I can count on one hand the number of times channels were really the best choice. Sometimes they are. That’s great! Use them then. But otherwise just stop. + +![][34] + +_Special thanks for the valuable feedback provided by my proof readers Jeff Wendling, [Andrew Harding][35], [George Shank][36], and [Tyler Treat][37]._ + +If you want to work on Go with us at Space Monkey, please [hit me up][38]! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://blog.codinghorror.com/content/images/uploads/2012/06/6a0120a85dcdae970b017742d249d5970d-800wi.jpg +[2]: https://songlh.github.io/paper/go-study.pdf +[3]: https://golang.org/ +[4]: http://www.spacemonkey.com/ +[5]: https://en.wikipedia.org/wiki/Communicating_sequential_processes +[6]: https://en.wikipedia.org/wiki/%CE%A0-calculus +[7]: http://matt.might.net +[8]: http://www.ucombinator.org/ +[9]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[10]: https://www.jtolio.com/writing/2014/04/go-space-monkey/ +[11]: https://godoc.org/github.com/spacemonkeygo/openssl +[12]: https://golang.org/pkg/crypto/tls/ +[13]: https://godoc.org/github.com/spacemonkeygo/errors +[14]: https://godoc.org/github.com/spacemonkeygo/spacelog +[15]: https://godoc.org/gopkg.in/spacemonkeygo/monitor.v1 +[16]: https://github.com/jtolds/gls +[17]: https://www.jtolio.com/images/wat/darth-helmet.jpg +[18]: https://en.wikipedia.org/wiki/Newsqueak +[19]: https://en.wikipedia.org/wiki/Alef_%28programming_language%29 +[20]: https://en.wikipedia.org/wiki/Limbo_%28programming_language%29 +[21]: https://lesswrong.com/lw/k5/cached_thoughts/ +[22]: https://blog.golang.org/share-memory-by-communicating +[23]: https://www.jtolio.com/images/wat/jon-stewart.jpg +[24]: https://twitter.com/HiattDustin +[25]: http://bravenewgeek.com/go-is-unapologetically-flawed-heres-why-we-use-it/ +[26]: https://www.jtolio.com/images/wat/obama.jpg +[27]: https://www.jtolio.com/images/wat/yael-grobglas.jpg +[28]: http://www.informit.com/articles/article.aspx?p=2359758#comment-2061767464 +[29]: https://godoc.org/golang.org/x/net/context +[30]: https://www.jtolio.com/images/wat/zooey-deschanel.jpg +[31]: https://www.jtolio.com/images/wat/joel-mchale.jpg +[32]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ +[33]: https://en.wikipedia.org/wiki/Duck_typing +[34]: https://www.jtolio.com/images/wat/michael-cera.jpg +[35]: https://github.com/azdagron +[36]: https://twitter.com/taterbase +[37]: http://bravenewgeek.com +[38]: https://www.jtolio.com/contact/ diff --git a/sources/tech/20170115 Magic GOPATH.md b/sources/tech/20170115 Magic GOPATH.md new file mode 100644 index 0000000000..1d4cd16e24 --- /dev/null +++ b/sources/tech/20170115 Magic GOPATH.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Magic GOPATH) +[#]: via: (https://www.jtolio.com/2017/01/magic-gopath) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Magic GOPATH +====== + +_**Update:** With the advent of Go 1.11 and [Go modules][1], this whole post is now useless. Unset your GOPATH entirely and switch to Go modules today!_ + +Maybe someday I’ll start writing about things besides Go again. + +Go requires that you set an environment variable for your workspace called your `GOPATH`. The `GOPATH` is one of the most confusing aspects of Go to newcomers and even relatively seasoned developers alike. It’s not immediately clear what would be better, but finding a good `GOPATH` value has implications for your source code repository layout, how many separate projects you have on your computer, how default project installation instructions work (via `go get`), and even how you interoperate with other projects and libraries. + +It’s taken until Go 1.8 to decide to [set a default][2] and that small change was one of [the most talked about code reviews][3] for the 1.8 release cycle. + +After [writing about GOPATH himself][4], [Dave Cheney][5] [asked me][6] to write a blog post about what I do. + +### My proposal + +I set my `GOPATH` to always be the current working directory, unless a parent directory is clearly the `GOPATH`. + +Here’s the relevant part of my `.bashrc`: + +``` +# bash command to output calculated GOPATH. +calc_gopath() { + local dir="$PWD" + + # we're going to walk up from the current directory to the root + while true; do + + # if there's a '.gopath' file, use its contents as the GOPATH relative to + # the directory containing it. + if [ -f "$dir/.gopath" ]; then + ( cd "$dir"; + # allow us to squash this behavior for cases we want to use vgo + if [ "$(cat .gopath)" != "" ]; then + cd "$(cat .gopath)"; + echo "$PWD"; + fi; ) + return + fi + + # if there's a 'src' directory, the parent of that directory is now the + # GOPATH + if [ -d "$dir/src" ]; then + echo "$dir" + return + fi + + # we can't go further, so bail. we'll make the original PWD the GOPATH. + if [ "$dir" == "/" ]; then + echo "$PWD" + return + fi + + # now we'll consider the parent directory + dir="$(dirname "$dir")" + done +} + +my_prompt_command() { + export GOPATH="$(calc_gopath)" + + # you can have other neat things in here. I also set my PS1 based on git + # state +} + +case "$TERM" in +xterm*|rxvt*) + # Bash provides an environment variable called PROMPT_COMMAND. The contents + # of this variable are executed as a regular Bash command just before Bash + # displays a prompt. Let's only set it if we're in some kind of graphical + # terminal I guess. + PROMPT_COMMAND=my_prompt_command + ;; +*) + ;; +esac +``` + +The benefits are fantastic. If you want to quickly `go get` something and not have it clutter up your workspace, you can do something like: + +``` +cd $(mktemp -d) && go get github.com/the/thing +``` + +On the other hand, if you’re jumping between multiple projects (whether or not they have the full workspace checked in or are just library packages), the `GOPATH` is set accurately. + +More flexibly, if you have a tree where some parent directory is outside of the `GOPATH` but you want to set the `GOPATH` anyways, you can create a `.gopath` file and it will automatically set your `GOPATH` correctly any time your shell is inside that directory. + +The whole thing is super nice. I kinda can’t imagine doing something else anymore. + +### Fin. + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2017/01/magic-gopath + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more +[2]: https://rakyll.org/default-gopath/ +[3]: https://go-review.googlesource.com/32019/ +[4]: https://dave.cheney.net/2016/12/20/thinking-about-gopath +[5]: https://dave.cheney.net/ +[6]: https://twitter.com/davecheney/status/811334240247812097 diff --git a/sources/tech/20170320 Whiteboard problems in pure Lambda Calculus.md b/sources/tech/20170320 Whiteboard problems in pure Lambda Calculus.md new file mode 100644 index 0000000000..02200befe7 --- /dev/null +++ b/sources/tech/20170320 Whiteboard problems in pure Lambda Calculus.md @@ -0,0 +1,836 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Whiteboard problems in pure Lambda Calculus) +[#]: via: (https://www.jtolio.com/2017/03/whiteboard-problems-in-pure-lambda-calculus) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Whiteboard problems in pure Lambda Calculus +====== + +My team at [Vivint][1], the [Space Monkey][2] group, stopped doing whiteboard interviews a while ago. We certainly used to do them, but we’ve transitioned to homework problems or actually just hiring a candidate as a short term contractor for a day or two to solve real work problems and see how that goes. Whiteboard interviews are kind of like [Festivus][3] but in a bad way: you get the feats of strength and then the airing of grievances. Unfortunately, modern programming is nothing like writing code in front of a roomful of strangers with only a whiteboard and a marker, so it’s probably not best to optimize for that. + +Nonetheless, [Kyle][4]’s recent (wonderful, amazing) post titled [acing the technical interview][5] got me thinking about fun ways to approach whiteboard problems as an interviewee. Kyle’s [Church-encodings][6] made me wonder how many “standard” whiteboard problems you could solve in pure lambda calculus. If this isn’t seen as a feat of strength by your interviewers, there will certainly be some airing of grievances. + +➡️️ **Update**: I’ve made a lambda calculus web playground so you can run lambda calculus right in your browser! I’ve gone through and made links to examples in this post with it. Check it out at + +### Lambda calculus + +Wait, what is lambda calculus? Did I learn that in high school? + +Big-C “Calculus” of course usually refers to derivatives, integrals, Taylor series, etc. You might have learned about Calculus in high school, but this isn’t that. + +More generally, a little-c “calculus” is really just any system of calculation. The [lambda calculus][7] is essentially a formalization of the smallest set of primitives needed to make a completely [Turing-complete][8] programming language. Expressions in the language can only be one of three things. + + * An expression can define a function that takes exactly one argument (no more, no less) and then has another expression as the body. + * An expression can call a function by applying two subexpressions. + * An expression can reference a variable. + + + +Here is the entire grammar: + +``` + ::= + | `λ` `.` + | `(` `)` +``` + +That’s it. There’s nothing else you can do. There are no numbers, strings, booleans, pairs, structs, anything. Every value is a function that takes one argument. All variables refer to these functions, and all functions can do is return another function, either directly, or by calling yet another function. There’s nothing else to help you. + +To be honest, it’s a little surprising that this is even Turing-complete. How do you do branches or loops or recursion? This seems too simple to work, right? + +A common whiteboard problem is the [fizz buzz problem][9]. The goal is to write a function that prints out all the numbers from 0 to 100, but instead of printing numbers divisible by 3 it prints “fizz”, and instead of printing numbers divisible by 5 it prints “buzz”, and in the case of both it prints “fizzbuzz”. It’s a simple toy problem but it’s touted as a good whiteboard problem because evidently many self-proclaimed programmers can’t solve it. Maybe part of that is cause whiteboard problems suck? I dunno. + +Anyway, here’s fizz buzz in pure lambda calculus: + +``` +(λU.(λY.(λvoid.(λ0.(λsucc.(λ+.(λ*.(λ1.(λ2.(λ3.(λ4.(λ5.(λ6.(λ7.(λ8.(λ9.(λ10.(λnum.(λtrue.(λfalse.(λif.(λnot.(λand.(λor.(λmake-pair.(λpair-first.(λpair-second.(λzero?.(λpred.(λ-.(λeq?.(λ/.(λ%.(λnil.(λnil?.(λcons.(λcar.(λcdr.(λdo2.(λdo3.(λdo4.(λfor.(λprint-byte.(λprint-list.(λprint-newline.(λzero-byte.(λitoa.(λfizzmsg.(λbuzzmsg.(λfizzbuzzmsg.(λfizzbuzz.(fizzbuzz (((num 1) 0) 1)) λn.((for n) λi.((do2 (((if (zero? ((% i) 3))) λ_.(((if (zero? ((% i) 5))) λ_.(print-list fizzbuzzmsg)) λ_.(print-list fizzmsg))) λ_.(((if (zero? ((% i) 5))) λ_.(print-list buzzmsg)) λ_.(print-list (itoa i))))) (print-newline nil)))) ((cons (((num 0) 7) 0)) ((cons (((num 1) 0) 5)) ((cons (((num 1) 2) 2)) ((cons (((num 1) 2) 2)) ((cons (((num 0) 9) 8)) ((cons (((num 1) 1) 7)) ((cons (((num 1) 2) 2)) ((cons (((num 1) 2) 2)) nil))))))))) ((cons (((num 0) 6) 6)) ((cons (((num 1) 1) 7)) ((cons (((num 1) 2) 2)) ((cons (((num 1) 2) 2)) nil))))) ((cons (((num 0) 7) 0)) ((cons (((num 1) 0) 5)) ((cons (((num 1) 2) 2)) ((cons (((num 1) 2) 2)) nil))))) λn.(((Y λrecurse.λn.λresult.(((if (zero? n)) λ_.(((if (nil? result)) λ_.((cons zero-byte) nil)) λ_.result)) λ_.((recurse ((/ n) 10)) ((cons ((+ zero-byte) ((% n) 10))) result)))) n) nil)) (((num 0) 4) 8)) λ_.(print-byte (((num 0) 1) 0))) (Y λrecurse.λl.(((if (nil? l)) λ_.void) λ_.((do2 (print-byte (car l))) (recurse (cdr l)))))) PRINT_BYTE) λn.λf.((((Y λrecurse.λremaining.λcurrent.λf.(((if (zero? remaining)) λ_.void) λ_.((do2 (f current)) (((recurse (pred remaining)) (succ current)) f)))) n) 0) f)) λa.do3) λa.do2) λa.λb.b) λl.(pair-second (pair-second l))) λl.(pair-first (pair-second l))) λe.λl.((make-pair true) ((make-pair e) l))) λl.(not (pair-first l))) ((make-pair false) void)) λm.λn.((- m) ((* ((/ m) n)) n))) (Y λ/.λm.λn.(((if ((eq? m) n)) λ_.1) λ_.(((if (zero? ((- m) n))) λ_.0) λ_.((+ 1) ((/ ((- m) n)) n)))))) λm.λn.((and (zero? ((- m) n))) (zero? ((- n) m)))) λm.λn.((n pred) m)) λn.(((λn.λf.λx.(pair-second ((n λp.((make-pair (f (pair-first p))) (pair-first p))) ((make-pair x) x))) n) succ) 0)) λn.((n λ_.false) true)) λp.(p false)) λp.(p true)) λx.λy.λt.((t x) y)) λa.λb.((a true) b)) λa.λb.((a b) false)) λp.λt.λf.((p f) t)) λp.λa.λb.(((p a) b) void)) λt.λf.f) λt.λf.t) λa.λb.λc.((+ ((+ ((* ((* 10) 10)) a)) ((* 10) b))) c)) (succ 9)) (succ 8)) (succ 7)) (succ 6)) (succ 5)) (succ 4)) (succ 3)) (succ 2)) (succ 1)) (succ 0)) λm.λn.λx.(m (n x))) λm.λn.λf.λx.((((m succ) n) f) x)) λn.λf.λx.(f ((n f) x))) λf.λx.x) λx.(U U)) (U λh.λf.(f λx.(((h h) f) x)))) λf.(f f)) +``` + +➡️️ [Try it out in your browser!][10] + +(This program expects a function to be defined called `PRINT_BYTE` which takes a Church-encoded numeral, turns it into a byte, writes it to `stdout`, and then returns the same Church-encoded numeral. Expecting a function that has side-effects might arguably disqualify this from being pure, but it’s definitely arguable.) + +Don’t be deceived! I said there were no native numbers or lists or control structures in lambda calculus and I meant it. `0`, `7`, `if`, and `+` are all _variables_ that represent _functions_ and have to be constructed before they can be used in the code block above. + +### What? What’s happening here? + +Okay let’s start over and build up to fizz buzz. We’re going to need a lot. We’re going to need to build up concepts of numbers, logic, and lists all from scratch. Ask your interviewers if they’re comfortable cause this might be a while. + +Here is a basic lambda calculus function: + +``` +λx.x +``` + +This is the identity function and it is equivalent to the following Javascript: + +``` +function(x) { return x; } +``` + +It takes an argument and returns it! We can call the identity function with another value. Function calling in many languages looks like `f(x)`, but in lambda calculus, it looks like `(f x)`. + +``` +(λx.x y) +``` + +This will return `y`. Once again, here’s equivalent Javascript: + +``` +function(x) { return x; }(y) +``` + +Aside: If you’re already familiar with lambda calculus, my formulation of precedence is such that `(λx.x y)` is not the same as `λx.(x y)`. `(λx.x y)` applies `y` to the identity function `λx.x`, and `λx.(x y)` is a function that applies `y` to its argument `x`. Perhaps not what you’re used to, but the parser was way more straightforward, and programming with it this way seems a bit more natural, believe it or not. + +Okay, great. We can call functions. What if we want to pass more than one argument? + +### Currying + +Imagine the following Javascript function: + +``` +let s1 = function(f, x) { return f(x); } +``` + +We want to call it with two arguments, another function and a value, and we want the function to then be called on the value, and have its result returned. Can we do this while using only one argument? + +[Currying][11] is a technique for dealing with this. Instead of taking two arguments, take the first argument and return another function that takes the second argument. Here’s the Javascript: + +``` +let s2 = function(f) { + return function(x) { + return f(x); + } +}; +``` + +Now, `s1(f, x)` is the same as `s2(f)(x)`. So the equivalent lambda calculus for `s2` is then + +``` +λf.λx.(f x) +``` + +Calling this function with `g` for `f` and `y` for `x` is like so: + +``` +((s2 g) y) +``` + +or + +``` +((λf.λx.(f x) g) y) +``` + +The equivalent Javascript here is: + +``` +function(f) { + return function(x) { + f(x) + } +}(g)(y) +``` + +### Numbers + +Since everything is a function, we might feel a little stuck with what to do about numbers. Luckily, [Alonzo Church][12] already figured it out for us! When you have a number, often what you want to do is represent how many times you might do something. + +So let’s represent a number as how many times we’ll apply a function to a value. This is called a [Church numeral][13]. If we have `f` and `x`, `0` will mean we don’t call `f` at all, and just return `x`. `1` will mean we call `f` one time, `2` will mean we call `f` twice, and so on. + +Here are some definitions! (N.B.: assignment isn’t actually part of lambda calculus, but it makes writing down definitions easier) + +``` +0 = λf.λx.x +``` + +Here, `0` takes a function `f`, a value `x`, and never calls `f`. It just returns `x`. `f` is called 0 times. + +``` +1 = λf.λx.(f x) +``` + +Like `0`, `1` takes `f` and `x`, but here it calls `f` exactly once. Let’s see how this continues for other numbers. + +``` +2 = λf.λx.(f (f x)) +3 = λf.λx.(f (f (f x))) +4 = λf.λx.(f (f (f (f x)))) +5 = λf.λx.(f (f (f (f (f x))))) +``` + +`5` is a function that takes `f`, `x`, and calls `f` 5 times! + +Okay, this is convenient, but how are we going to do math on these numbers? + +### Successor + +Let’s make a _successor_ function that takes a number and returns a new number that calls `f` just one more time. + +``` +succ = λn. λf.λx.(f ((n f) x)) +``` + +`succ` is a function that takes a Church-encoded number, `n`. The spaces after `λn.` are ignored. I put them there to indicate that we expect to usually call `succ` with one argument, curried or no. `succ` then returns another Church-encoded number, `λf.λx.(f ((n f) x))`. What is it doing? Let’s break it down. + + * `((n f) x)` looks like that time we needed to call a function that took two “curried” arguments. So we’re calling `n`, which is a Church numeral, with two arguments, `f` and `x`. This is going to call `f` `n` times! + * `(f ((n f) x))` This is calling `f` again, one more time, on the result of the previous value. + + + +So does `succ` work? Let’s see what happens when we call `(succ 1)`. We should get the `2` we defined earlier! + +``` + (succ 1) +-> (succ λf.λx.(f x)) # resolve the variable 1 +-> (λn.λf.λx.(f ((n f) x)) λf.λx.(f x)) # resolve the variable succ +-> λf.λx.(f ((λf.λx.(f x) f) x)) # call the outside function. replace n + # with the argument + +let's sidebar and simplify the subexpression + (λf.λx.(f x) f) +-> λx.(f x) # call the function, replace f with f! + +now we should be able to simplify the larger subexpression + ((λf.λx.(f x) f) x) +-> (λx.(f x) x) # sidebar above +-> (f x) # call the function, replace x with x! + +let's go back to the original now + λf.λx.(f ((λf.λx.(f x) f) x)) +-> λf.λx.(f (f x)) # subexpression simplification above +``` + +and done! That last line is identical to the `2` we defined originally! It calls `f` twice. + +### Math + +Now that we have the successor function, if your interviewers haven’t checked out, tell them that fizz buzz isn’t too far away now; we have [Peano Arithmetic][14]! They can then check their interview bingo cards and see if they’ve increased their winnings. + +No but for real, since we have the successor function, we can now easily do addition and multiplication, which we will need for fizz buzz. + +First, recall that a number `n` is a function that takes another function `f` and an initial value `x` and applies `f` _n_ times. So if you have two numbers _m_ and _n_, what you want to do is apply `succ` to `m` _n_ times! + +``` ++ = λm.λn.((n succ) m) +``` + +Here, `+` is a variable. If it’s not a lambda expression or a function call, it’s a variable! + +Multiplication is similar, but instead of applying `succ` to `m` _n_ times, we’re going to add `m` to `0` `n` times. + +First, note that if `((+ m) n)` is adding `m` and `n`, then that means that `(+ m)` is a _function_ that adds `m` to its argument. So we want to apply the function `(+ m)` to `0` `n` times. + +``` +* = λm.λn.((n (+ m)) 0) +``` + +Yay! We have multiplication and addition now. + +### Logic + +We’re going to need booleans and if statements and logic tests and so on. So, let’s talk about booleans. Recall how with numbers, what we kind of wanted with a number `n` is to do something _n_ times. Similarly, what we want with booleans is to do one of two things, either/or, but not both. Alonzo Church to the rescue again. + +Let’s have booleans be functions that take two arguments (curried of course), where the `true` boolean will return the first option, and the `false` boolean will return the second. + +``` +true = λt.λf.t +false = λt.λf.f +``` + +So that we can demonstrate booleans, we’re going to define a simple sample function called `zero?` that returns `true` if a number `n` is zero, and `false` otherwise: + +``` +zero? = λn.((n λ_.false) true) +``` + +To explain: if we have a Church numeral for 0, it will call the first argument it gets called with 0 times and just return the second argument. In other words, 0 will just return the second argument and that’s it. Otherwise, any other number will call the first argument at least once. So, `zero?` will take `n` and give it a function that throws away its argument and always returns `false` whenever it’s called, and start it off with `true`. Only zero values will return `true`. + +➡️️ [Try it out in your browser!][15] + +We can now write an `if'` function to make use of these boolean values. `if'` will take a predicate value `p` (the boolean) and two options `a` and `b`. + +``` +if' = λp.λa.λb.((p a) b) +``` + +You can use it like this: + +``` +((if' (zero? n) + (something-when-zero x)) + (something-when-not-zero y)) +``` + +One thing that’s weird about this construction is that the interpreter is going to evaluate both branches (my lambda calculus interpreter is [eager][16] instead of [lazy][17]). Both `something-when-zero` and `something-when-not-zero` are going to be called to determine what to pass in to `if'`. To make it so that we don’t actually call the function in the branch we don’t want to run, let’s protect the logic in another function. We’ll name the argument to the function `_` to indicate that we want to just throw it away. + +``` +((if (zero? n) + λ_. (something-when-zero x)) + λ_. (something-when-not-zero y)) +``` + +This means we’re going to have to make a new `if` function that calls the correct branch with a throwaway argument, like `0` or something. + +``` +if = λp.λa.λb.(((p a) b) 0) +``` + +Okay, now we have booleans and `if`! + +### Currying part deux + +At this point, you might be getting sick of how calling something with multiple curried arguments involves all these extra parentheses. `((f a) b)` is annoying, can’t we just do `(f a b)`? + +It’s not part of the strict grammar, but my interpreter makes this small concession. `(a b c)` will be expanded to `((a b) c)` by the parser. `(a b c d)` will be expanded to `(((a b) c) d)` by the parser, and so on. + +So, for the rest of the post, for ease of explanation, I’m going to use this [syntax sugar][18]. Observe how using `if` changes: + +``` +(if (zero? n) + λ_. (something-when-zero x) + λ_. (something-when-not-zero y)) +``` + +It’s a little better. + +### More logic + +Let’s talk about `and`, `or`, and `not`! + +`and` returns true if and only if both `a` and `b` are true. Let’s define it! + +``` +and = λa.λb. + (if (a) + λ_. b + λ_. false) +``` + +`or` returns true if `a` is true or if `b` is true: + +``` +or = λa.λb. + (if (a) + λ_. true + λ_. b) +``` + +`not` just returns the opposite of whatever it was given: + +``` +not = λa. + (if (a) + λ_. false + λ_. true) +``` + +It turns out these can be written a bit more simply, but they’re basically doing the same thing: + +``` +and = λa.λb.(a b false) +or = λa.λb.(a true b) +not = λp.λt.λf.(p f t) +``` + +➡️️ [Try it out in your browser!][19] + +### Pairs! + +Sometimes it’s nice to keep data together. Let’s make a little 2-tuple type! We want three functions. We want a function called `make-pair` that will take two arguments and return a “pair”, we want a function called `pair-first` that will return the first element of the pair, and we want a function called `pair-second` that will return the second element. How can we achieve this? You’re almost certainly in the interview room alone, but now’s the time to yell “Alonzo Church”! + +``` +make-pair = λx.λy. λa.(a x y) +``` + +`make-pair` is going to take two arguments, `x` and `y`, and they will be the elements of the pair. The pair itself is a function that takes an “accessor” `a` that will be given `x` and `y`. All `a` has to do is take the two arguments and return the one it wants. + +Here is someone making a pair with variables `1` and `2`: + +``` +(make-pair 1 2) +``` + +This returns: + +``` +λa.(a 1 2) +``` + +There’s a pair! Now we just need to access the values inside. + +Remember how `true` takes two arguments and returns the first one and `false` takes two arguments and returns the second one? + +``` +pair-first = λp.(p true) +pair-second = λp.(p false) +``` + +`pair-first` is going to take a pair `p` and give it `true` as the accessor `a`. `pair-second` is going to give the pair `false` as the accessor. + +Voilà, you can now store 2-tuples of values and recover the data from them. + +➡️️ [Try it out in your browser!][20] + +### Lists! + +We’re going to construct [linked lists][21]. Each list item needs two things: the value at the current position in the list and a reference to the rest of the list. + +One additional caveat is we want to be able to identify an empty list, so we’re going to store whether or not the current value is the end of a list as well. In [LISP][22]-based programming languages, the end of the list is the special value `nil`, and checking if we’ve hit the end of the list is accomplished with the `nil?` predicate. + +Because we want to distinguish `nil` from a list with a value, we’re going to store three things in each linked list item. Whether or not the list is empty, and if not, the value and the rest of the list. So we need a 3-tuple. + +Once we have pairs, other-sized tuples are easy. For instance, a 3-tuple is just one pair with another pair inside for one of the slots. + +For each list element, we’ll store: + +``` +[not-empty [value rest-of-list]] +``` + +As an example, a list element with a value of `1` would look like: + +``` +[true [1 remainder]] +``` + +whereas `nil` will look like + +``` +[false whatever] +``` + +That second part of `nil` just doesn’t matter. + +First, let’s define `nil` and `nil?`: + +``` +nil = (make-pair false false) +nil? = λl. (not (pair-first l)) +``` + +The important thing about `nil` is that the first element in the pair is `false`. + +Now that we have an empty list, let’s define how to add something to the front of it. In LISP-based languages, the operation to _construct_ a new list element is called `cons`, so we’ll call this `cons`, too. + +`cons` will take a value and an existing list and return a new list with the given value at the front of the list. + +``` +cons = λvalue.λlist. + (make-pair true (make-pair value list)) +``` + +`cons` is returning a pair where, unlike `nil`, the first element of the pair is `true`. This represents that there’s something in the list here. The second pair element is what we wanted in our linked list: the value at the current position, and a reference to the rest of the list. + +So how do we access things in the list? Let’s define two functions called `head` and `tail`. `head` is going to return the value at the front of the list, and `tail` is going to return everything but the front of the list. In LISP-based languages, these functions are sometimes called `car` and `cdr` for surprisingly [esoteric reasons][23]. `head` and `tail` have undefined behavior here when called on `nil`, so let’s just assume `nil?` is false for the list and keep going. + +``` +head = λlist. (pair-first (pair-second list)) +tail = λlist. (pair-second (pair-second list)) +``` + +Both `head` and `tail` first get `(pair-second list)`, which returns the tuple that has the value and reference to the remainder. Then, they use either `pair-first` or `pair-second` to get the current value or the rest of the list. + +Great, we have lists! + +➡️️ [Try it out in your browser!][24] + +### Recursion and loops + +Let’s make a simple function that sums up a list of numbers. + +``` +sum = λlist. + (if (nil? list) + λ_. 0 + λ_. (+ (head list) (sum (tail list)))) +``` + +If the list is empty, let’s return 0. If the list has an element, let’s add that element to the sum of the rest of the list. [Recursion][25] is a cornerstone tool of computer science, and being able to assume a solution to a subproblem to solve a problem is super neat! + +Okay, except, this doesn’t work like this in lambda calculus. Remember how I said assignment wasn’t something that exists in lambda calculus? If you have: + +``` +x = y + +``` + +This really means you have: + +``` +(λx. y) +``` + +In the case of our sum definition, we have: + +``` +(λsum. + + + λlist. + (if (nil? list) + λ_. 0 + λ_. (+ (head list) (sum (tail list))))) +``` + +What that means is `sum` doesn’t have any access to itself. It can’t call itself like we’ve written, because when it tries to call `sum`, it’s undefined! + +This is a pretty crushing blow, but it turns out there’s a mind bending and completely unexpected trick the universe has up its sleeve. + +Assume we wrote `sum` so that it takes two arguments. A reference to something like `sum` we’ll call `helper` and then the list. If we could figure out how to solve the recursion problem, then we could use this `sum`. Let’s do that. + +``` +sum = λhelper.λlist. + (if (nil? list) + λ_. 0 + λ_. (+ (head list) (helper (tail list)))) +``` + +But hey! When we call `sum`, we have a reference to `sum` then! Let’s just give `sum` itself before the list. + +``` +(sum sum list) +``` + +This seems promising, but unfortunately now the `helper` invocation inside of `sum` is broken. `helper` is just `sum` and `sum` expects a reference to itself. Let’s try again, changing the `helper` call: + +``` +sum = λhelper.λlist. + (if (nil? list) + λ_. 0 + λ_. (+ (head list) (helper helper (tail list)))) + +(sum sum list) +``` + +We did it! This actually works! We engineered recursion out of math! At no point does `sum` refer to itself inside of itself, and yet we managed to make a recursive function anyways! + +➡️️ [Try it out in your browser!][26] + +Despite the minor miracle we’ve just performed, we’ve now ruined how we program recursion to involve calling recursive functions with themselves. This isn’t the end of the world, but it’s a little annoying. Luckily for us, there’s a function that cleans this all right up called the [Y combinator][27]. + +The _Y combinator_ is probably now more famously known as [a startup incubator][28], or perhaps even more so as the domain name for one of the most popular sites that has a different name than its URL, [Hacker News][29], but fixed point combinators such as the Y combinator have had a longer history. + +The Y combinator can be defined in different ways, but definition I’m using is: + +``` +Y = λf.(λx.(x x) λx.(f λy.((x x) y))) +``` + +You might consider reading more about how the Y combinator can be derived from an excellent tutorial such as [this one][30] or [this one][31]. + +Anyway, `Y` will make our original `sum` work as expected. + +``` +sum = (Y λhelper.λlist. + (if (nil? list) + λ_. 0 + λ_. (+ (head list) (helper (tail list))))) +``` + +We can now call `(sum list)` without any wacky doubling of the function name, either inside or outside of the function. Hooray! + +➡️️ [Try it out in your browser!][32] + +### More math + +“Get ready to do more math! We now have enough building blocks to do subtraction, division, and modulo, which we’ll need for fizz buzz,” you tell the security guards that are approaching you. + +Just like addition, before we define subtraction we’ll define a predecessor function. Unlike addition, the predecessor function `pred` is much more complicated than the successor function `succ`. + +The basic idea is we’re going to create a pair to keep track of the previous value. We’ll start from zero and build up `n` but also drag the previous value such that at `n` we also have `n - 1`. Notably, this solution does not figure out how to deal with negative numbers. The predecessor of 0 will be 0, and negatives will have to be dealt with some other time and some other way. + +First, we’ll make a helper function that takes a pair of numbers and returns a new pair where the first number in the old pair is the second number in the new pair, and the new first number is the successor of the old first number. + +``` +pred-helper = λpair. + (make-pair (succ (pair-first pair)) (pair-first pair)) +``` + +Make sense? If we call `pred-helper` on a pair `[0 0]`, the result will be `[1 0]`. If we call it on `[1 0]`, the result will be `[2 1]`. Essentially this helper slides older numbers off to the right. + +Okay, so now we’re going to call `pred-helper` _n_ times, with a starting pair of `[0 0]`, and then get the _second_ value, which should be `n - 1` when we’re done, from the pair. + +``` +pred = λn. + (pair-second (n pred-helper (make-pair 0 0))) +``` + +We can combine these two functions now for the full effect: + +``` +pred = λn. + (pair-second + (n + λpair.(make-pair (succ (pair-first pair)) (pair-first pair)) + (make-pair 0 0))) +``` + +➡️️ [Try it out in your browser!][33] + +Now that we have `pred`, subtraction is easy! To subtract `n` from `m`, we’re going to apply `pred` to `m` _n_ times. + +``` +- = λm.λn.(n pred m) +``` + +Keep in mind that if `n` is equal to _or greater than_ `m`, the result of `(- m n)` will be zero, since there are no negative numbers and the predecessor of `0` is `0`. This fact means we can implement some new logic tests. Let’s make `(ge? m n)` return `true` if `m` is greater than or equal to `n` and make `(le? m n)` return `true` if `m` is less than or equal to `n`. + +``` +ge? = λm.λn.(zero? (- n m)) +le? = λm.λn.(zero? (- m n)) +``` + +If we have greater-than-or-equal-to and less-than-or-equal-to, then we can make equal! + +``` +eq? = λm.λn.(and (ge? m n) (le? m n)) +``` + +Now we have enough for integer division! The idea for integer division of `n` and `m` is we will keep count of the times we can subtract `m` from `n` without going past zero. + +``` +/ = (Y λ/.λm.λn. + (if (eq? m n) + λ_. 1 + λ_. (if (le? m n) + λ_. 0 + λ_. (+ 1 (/ (- m n) n))))) +``` + +Once we have subtraction, multiplication, and integer division, we can create modulo. + +``` +% = λm.λn. (- m (* (/ m n) n)) +``` + +➡️️ [Try it out in your browser!][34] + +### Aside about performance + +You might be wondering about performance at this point. Every time we subtract one from 100, we count up from 0 to 100 to generate 99. This effect compounds itself for division and modulo. The truth is that Church numerals and other encodings aren’t very performant! Just like how tapes in Turing machines aren’t a particularly efficient way to deal with data, Church encodings are most interesting from a theoretical perspective for proving facts about computation. + +That doesn’t mean we can’t make things faster though! + +Lambda calculus is purely functional and side-effect free, which means that all sorts of optimizations can applied. Functions can be aggressively memoized. In other words, once a specific function and its arguments have been computed, there’s no need to compute them ever again. The result of that function will always be the same anyways. Further, functions can be computed lazily and only if needed. What this means is if a branch of your program’s execution renders a result that’s never used, the compiler can decide to just not run that part of the program and end up with the exact same result. + +[My interpreter][35] does have side effects, since programs written in it can cause the system to write output to the user via the special built-in function `PRINT_BYTE`. As a result, I didn’t choose lazy evaluation. The only optimization I chose was aggressive memoization for all functions that are side-effect free. The memoization still has room for improvement, but the result is much faster than a naive implementation. + +### Output + +“We’re rounding the corner on fizz buzz!” you shout at the receptionist as security drags you around the corner on the way to the door. “We just need to figure out how to communicate results to the user!” + +Unfortunately, lambda calculus can’t communicate with your operating system kernel without some help, but a small concession is all we need. [Sheepda][35] provides a single built-in function `PRINT_BYTE`. `PRINT_BYTE` takes a number as its argument (a Church encoded numeral) and prints the corresponding byte to the configured output stream (usually `stdout`). + +With `PRINT_BYTE`, we’re going to need to reference a number of different [ASCII bytes][36], so we should make writing numbers in code easier. Earlier we defined numbers 0 - 5, so let’s start and define numbers 6 - 10. + +``` +6 = (succ 5) +7 = (succ 6) +8 = (succ 7) +9 = (succ 8) +10 = (succ 9) +``` + +Now let’s define a helper to create three digit decimal numbers. + +``` +num = λa.λb.λc.(+ (+ (* (* 10 10) a) (* 10 b)) c) +``` + +The newline byte is decimal 10. Here’s a function to print newlines! + +``` +print-newline = λ_.(PRINT_BYTE (num 0 1 0)) +``` + +### Doing multiple things + +Now that we have this `PRINT_BYTE` function, we have functions that can cause side-effects. We want to call `PRINT_BYTE` but we don’t care about its return value. We need a way to call multiple functions in sequence. + +What if we make a function that takes two arguments and throws away the first one again? + +``` +do2 = λ_.λx.x +``` + +Here’s a function to print every value in a list: + +``` +print-list = (Y λrecurse.λlist. + (if (nil? list) + λ_. 0 + λ_. (do2 (PRINT_BYTE (head list)) + (recurse (tail list))))) +``` + +And here’s a function that works like a for loop. It calls `f` with every number from `0` to `n`. It uses a small helper function that continues to call itself until `i` is equal to `n`, and starts `i` off at `0`. + +``` +for = λn.λf.( + (Y λrecurse.λi. + (if (eq? i n) + λ_. void + λ_. (do2 (f i) + (recurse (succ i))))) + 0) +``` + +### Converting an integer to a string + +The last thing we need to complete fizz buzz is a function that turns a number into a string of bytes to print. You might have noticed the `print-num` calls in some of the web-based examples above. We’re going to see how to make it! Writing this function is sometimes a whiteboard problem in its own right. In C, this function is called `itoa`, for integer to ASCII. + +Here’s an example of how it works. Imagine the number we’re converting to bytes is `123`. We can get the `3` out by doing `(% 123 10)`, which will be `3`. Then we can divide by `10` to get `12`, and then start over. `(% 12 10)` is `2`. We’ll loop down until we hit zero. + +Once we have a number, we can convert it to ASCII by adding the value of the `'0'` ASCII byte. Then we can make a list of ASCII bytes for use with `print-list`. + +``` +zero-char = (num 0 4 8) # the ascii code for the byte that represents 0. + +itoa = λn.( + (Y λrecurse.λn.λresult. + (if (zero? n) + λ_. (if (nil? result) + λ_. (cons zero-char nil) + λ_. result) + λ_. (recurse (/ n 10) (cons (+ zero-char (% n 10)) result)))) + n nil) + +print-num = λn.(print-list (itoa n)) +``` + +### Fizz buzz + +“Here we go,” you shout at the building you just got kicked out of, “here’s how you do fizz buzz.” + +First, we need to define three strings: “Fizz”, “Buzz”, and “Fizzbuzz”. + +``` +fizzmsg = (cons (num 0 7 0) # F + (cons (num 1 0 5) # i + (cons (num 1 2 2) # z + (cons (num 1 2 2) # z + nil)))) +buzzmsg = (cons (num 0 6 6) # B + (cons (num 1 1 7) # u + (cons (num 1 2 2) # z + (cons (num 1 2 2) # z + nil)))) +fizzbuzzmsg = (cons (num 0 7 0) # F + (cons (num 1 0 5) # i + (cons (num 1 2 2) # z + (cons (num 1 2 2) # z + (cons (num 0 9 8) # b + (cons (num 1 1 7) # u + (cons (num 1 2 2) # z + (cons (num 1 2 2) # z + nil)))))))) +``` + +Okay, now let’s define a function that will run from 0 to `n` and output numbers, fizzes, and buzzes: + +``` +fizzbuzz = λn. + (for n λi. + (do2 + (if (zero? (% i 3)) + λ_. (if (zero? (% i 5)) + λ_. (print-list fizzbuzzmsg) + λ_. (print-list fizzmsg)) + λ_. (if (zero? (% i 5)) + λ_. (print-list buzzmsg) + λ_. (print-list (itoa i)))) + (print-newline 0))) +``` + +Let’s do the first 20! + +``` +(fizzbuzz (num 0 2 0)) +``` + +➡️️ [Try it out in your browser!][37] + +### Reverse a string + +“ENCORE!” you shout to no one as the last cars pull out of the company parking lot. Everyone’s gone home but this is your last night before the restraining order goes through. + +``` +reverse-list = λlist.( + (Y λrecurse.λold.λnew. + (if (nil? old) + λ_.new + λ_.(recurse (tail old) (cons (head old) new)))) + list nil) +``` + +➡️️ [Try it out in your browser!][38] + +### Sheepda + +As I mentioned, I wrote a lambda calculus interpreter called [Sheepda][35] for playing around. By itself it’s pretty interesting if you’re interested in learning more about how to write programming language interpreters. Lambda calculus is as simple of a language as you can make, so the interpreter is very simple itself! + +It’s written in Go and thanks to [GopherJS][39] it’s what powers the [web playground][40]. + +There are some fun projects if someone’s interested in getting more involved. Using the library to prune lambda expression trees and simplify expressions if possible would be a start! I’m sure my fizz buzz implementation isn’t as minimal as it could be, and playing [code golf][41] with it would be pretty neat! + +Feel free to fork , star it, bop it, twist it, or even pull it! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2017/03/whiteboard-problems-in-pure-lambda-calculus + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.vivint.com/ +[2]: https://www.spacemonkey.com/ +[3]: https://en.wikipedia.org/wiki/Festivus +[4]: https://twitter.com/aphyr +[5]: https://aphyr.com/posts/340-acing-the-technical-interview +[6]: https://en.wikipedia.org/wiki/Church_encoding +[7]: https://en.wikipedia.org/wiki/Lambda_calculus +[8]: https://en.wikipedia.org/wiki/Turing_completeness +[9]: https://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ +[10]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBZmFsc2UlMkMlMjJvdXRwdXQlMjIlM0ElMjJvdXRwdXQlMjIlMkMlMjJjb2RlJTIyJTNBJTIyKCVDRSVCQlUuKCVDRSVCQlkuKCVDRSVCQnZvaWQuKCVDRSVCQjAuKCVDRSVCQnN1Y2MuKCVDRSVCQiUyQi4oJUNFJUJCKi4oJUNFJUJCMS4oJUNFJUJCMi4oJUNFJUJCMy4oJUNFJUJCNC4oJUNFJUJCNS4oJUNFJUJCNi4oJUNFJUJCNy4oJUNFJUJCOC4oJUNFJUJCOS4oJUNFJUJCMTAuKCVDRSVCQm51bS4oJUNFJUJCdHJ1ZS4oJUNFJUJCZmFsc2UuKCVDRSVCQmlmLiglQ0UlQkJub3QuKCVDRSVCQmFuZC4oJUNFJUJCb3IuKCVDRSVCQm1ha2UtcGFpci4oJUNFJUJCcGFpci1maXJzdC4oJUNFJUJCcGFpci1zZWNvbmQuKCVDRSVCQnplcm8lM0YuKCVDRSVCQnByZWQuKCVDRSVCQi0uKCVDRSVCQmVxJTNGLiglQ0UlQkIlMkYuKCVDRSVCQiUyNS4oJUNFJUJCbmlsLiglQ0UlQkJuaWwlM0YuKCVDRSVCQmNvbnMuKCVDRSVCQmNhci4oJUNFJUJCY2RyLiglQ0UlQkJkbzIuKCVDRSVCQmRvMy4oJUNFJUJCZG80LiglQ0UlQkJmb3IuKCVDRSVCQnByaW50LWJ5dGUuKCVDRSVCQnByaW50LWxpc3QuKCVDRSVCQnByaW50LW5ld2xpbmUuKCVDRSVCQnplcm8tYnl0ZS4oJUNFJUJCaXRvYS4oJUNFJUJCZml6em1zZy4oJUNFJUJCYnV6em1zZy4oJUNFJUJCZml6emJ1enptc2cuKCVDRSVCQmZpenpidXp6LihmaXp6YnV6eiUyMCgoKG51bSUyMDEpJTIwMCklMjAxKSklMjAlQ0UlQkJuLigoZm9yJTIwbiklMjAlQ0UlQkJpLigoZG8yJTIwKCgoaWYlMjAoemVybyUzRiUyMCgoJTI1JTIwaSklMjAzKSkpJTIwJUNFJUJCXy4oKChpZiUyMCh6ZXJvJTNGJTIwKCglMjUlMjBpKSUyMDUpKSklMjAlQ0UlQkJfLihwcmludC1saXN0JTIwZml6emJ1enptc2cpKSUyMCVDRSVCQl8uKHByaW50LWxpc3QlMjBmaXp6bXNnKSkpJTIwJUNFJUJCXy4oKChpZiUyMCh6ZXJvJTNGJTIwKCglMjUlMjBpKSUyMDUpKSklMjAlQ0UlQkJfLihwcmludC1saXN0JTIwYnV6em1zZykpJTIwJUNFJUJCXy4ocHJpbnQtbGlzdCUyMChpdG9hJTIwaSkpKSkpJTIwKHByaW50LW5ld2xpbmUlMjBuaWwpKSkpJTIwKChjb25zJTIwKCgobnVtJTIwMCklMjA3KSUyMDApKSUyMCgoY29ucyUyMCgoKG51bSUyMDEpJTIwMCklMjA1KSklMjAoKGNvbnMlMjAoKChudW0lMjAxKSUyMDIpJTIwMikpJTIwKChjb25zJTIwKCgobnVtJTIwMSklMjAyKSUyMDIpKSUyMCgoY29ucyUyMCgoKG51bSUyMDApJTIwOSklMjA4KSklMjAoKGNvbnMlMjAoKChudW0lMjAxKSUyMDEpJTIwNykpJTIwKChjb25zJTIwKCgobnVtJTIwMSklMjAyKSUyMDIpKSUyMCgoY29ucyUyMCgoKG51bSUyMDEpJTIwMiklMjAyKSklMjBuaWwpKSkpKSkpKSklMjAoKGNvbnMlMjAoKChudW0lMjAwKSUyMDYpJTIwNikpJTIwKChjb25zJTIwKCgobnVtJTIwMSklMjAxKSUyMDcpKSUyMCgoY29ucyUyMCgoKG51bSUyMDEpJTIwMiklMjAyKSklMjAoKGNvbnMlMjAoKChudW0lMjAxKSUyMDIpJTIwMikpJTIwbmlsKSkpKSklMjAoKGNvbnMlMjAoKChudW0lMjAwKSUyMDcpJTIwMCkpJTIwKChjb25zJTIwKCgobnVtJTIwMSklMjAwKSUyMDUpKSUyMCgoY29ucyUyMCgoKG51bSUyMDEpJTIwMiklMjAyKSklMjAoKGNvbnMlMjAoKChudW0lMjAxKSUyMDIpJTIwMikpJTIwbmlsKSkpKSklMjAlQ0UlQkJuLigoKFklMjAlQ0UlQkJyZWN1cnNlLiVDRSVCQm4uJUNFJUJCcmVzdWx0LigoKGlmJTIwKHplcm8lM0YlMjBuKSklMjAlQ0UlQkJfLigoKGlmJTIwKG5pbCUzRiUyMHJlc3VsdCkpJTIwJUNFJUJCXy4oKGNvbnMlMjB6ZXJvLWJ5dGUpJTIwbmlsKSklMjAlQ0UlQkJfLnJlc3VsdCkpJTIwJUNFJUJCXy4oKHJlY3Vyc2UlMjAoKCUyRiUyMG4pJTIwMTApKSUyMCgoY29ucyUyMCgoJTJCJTIwemVyby1ieXRlKSUyMCgoJTI1JTIwbiklMjAxMCkpKSUyMHJlc3VsdCkpKSklMjBuKSUyMG5pbCkpJTIwKCgobnVtJTIwMCklMjA0KSUyMDgpKSUyMCVDRSVCQl8uKHByaW50LWJ5dGUlMjAoKChudW0lMjAwKSUyMDEpJTIwMCkpKSUyMChZJTIwJUNFJUJCcmVjdXJzZS4lQ0UlQkJsLigoKGlmJTIwKG5pbCUzRiUyMGwpKSUyMCVDRSVCQl8udm9pZCklMjAlQ0UlQkJfLigoZG8yJTIwKHByaW50LWJ5dGUlMjAoY2FyJTIwbCkpKSUyMChyZWN1cnNlJTIwKGNkciUyMGwpKSkpKSklMjBQUklOVF9CWVRFKSUyMCVDRSVCQm4uJUNFJUJCZi4oKCgoWSUyMCVDRSVCQnJlY3Vyc2UuJUNFJUJCcmVtYWluaW5nLiVDRSVCQmN1cnJlbnQuJUNFJUJCZi4oKChpZiUyMCh6ZXJvJTNGJTIwcmVtYWluaW5nKSklMjAlQ0UlQkJfLnZvaWQpJTIwJUNFJUJCXy4oKGRvMiUyMChmJTIwY3VycmVudCkpJTIwKCgocmVjdXJzZSUyMChwcmVkJTIwcmVtYWluaW5nKSklMjAoc3VjYyUyMGN1cnJlbnQpKSUyMGYpKSkpJTIwbiklMjAwKSUyMGYpKSUyMCVDRSVCQmEuZG8zKSUyMCVDRSVCQmEuZG8yKSUyMCVDRSVCQmEuJUNFJUJCYi5iKSUyMCVDRSVCQmwuKHBhaXItc2Vjb25kJTIwKHBhaXItc2Vjb25kJTIwbCkpKSUyMCVDRSVCQmwuKHBhaXItZmlyc3QlMjAocGFpci1zZWNvbmQlMjBsKSkpJTIwJUNFJUJCZS4lQ0UlQkJsLigobWFrZS1wYWlyJTIwdHJ1ZSklMjAoKG1ha2UtcGFpciUyMGUpJTIwbCkpKSUyMCVDRSVCQmwuKG5vdCUyMChwYWlyLWZpcnN0JTIwbCkpKSUyMCgobWFrZS1wYWlyJTIwZmFsc2UpJTIwdm9pZCkpJTIwJUNFJUJCbS4lQ0UlQkJuLigoLSUyMG0pJTIwKCgqJTIwKCglMkYlMjBtKSUyMG4pKSUyMG4pKSklMjAoWSUyMCVDRSVCQiUyRi4lQ0UlQkJtLiVDRSVCQm4uKCgoaWYlMjAoKGVxJTNGJTIwbSklMjBuKSklMjAlQ0UlQkJfLjEpJTIwJUNFJUJCXy4oKChpZiUyMCh6ZXJvJTNGJTIwKCgtJTIwbSklMjBuKSkpJTIwJUNFJUJCXy4wKSUyMCVDRSVCQl8uKCglMkIlMjAxKSUyMCgoJTJGJTIwKCgtJTIwbSklMjBuKSklMjBuKSkpKSkpJTIwJUNFJUJCbS4lQ0UlQkJuLigoYW5kJTIwKHplcm8lM0YlMjAoKC0lMjBtKSUyMG4pKSklMjAoemVybyUzRiUyMCgoLSUyMG4pJTIwbSkpKSklMjAlQ0UlQkJtLiVDRSVCQm4uKChuJTIwcHJlZCklMjBtKSklMjAlQ0UlQkJuLigoKCVDRSVCQm4uJUNFJUJCZi4lQ0UlQkJ4LihwYWlyLXNlY29uZCUyMCgobiUyMCVDRSVCQnAuKChtYWtlLXBhaXIlMjAoZiUyMChwYWlyLWZpcnN0JTIwcCkpKSUyMChwYWlyLWZpcnN0JTIwcCkpKSUyMCgobWFrZS1wYWlyJTIweCklMjB4KSkpJTIwbiklMjBzdWNjKSUyMDApKSUyMCVDRSVCQm4uKChuJTIwJUNFJUJCXy5mYWxzZSklMjB0cnVlKSklMjAlQ0UlQkJwLihwJTIwZmFsc2UpKSUyMCVDRSVCQnAuKHAlMjB0cnVlKSklMjAlQ0UlQkJ4LiVDRSVCQnkuJUNFJUJCdC4oKHQlMjB4KSUyMHkpKSUyMCVDRSVCQmEuJUNFJUJCYi4oKGElMjB0cnVlKSUyMGIpKSUyMCVDRSVCQmEuJUNFJUJCYi4oKGElMjBiKSUyMGZhbHNlKSklMjAlQ0UlQkJwLiVDRSVCQnQuJUNFJUJCZi4oKHAlMjBmKSUyMHQpKSUyMCVDRSVCQnAuJUNFJUJCYS4lQ0UlQkJiLigoKHAlMjBhKSUyMGIpJTIwdm9pZCkpJTIwJUNFJUJCdC4lQ0UlQkJmLmYpJTIwJUNFJUJCdC4lQ0UlQkJmLnQpJTIwJUNFJUJCYS4lQ0UlQkJiLiVDRSVCQmMuKCglMkIlMjAoKCUyQiUyMCgoKiUyMCgoKiUyMDEwKSUyMDEwKSklMjBhKSklMjAoKColMjAxMCklMjBiKSkpJTIwYykpJTIwKHN1Y2MlMjA5KSklMjAoc3VjYyUyMDgpKSUyMChzdWNjJTIwNykpJTIwKHN1Y2MlMjA2KSklMjAoc3VjYyUyMDUpKSUyMChzdWNjJTIwNCkpJTIwKHN1Y2MlMjAzKSklMjAoc3VjYyUyMDIpKSUyMChzdWNjJTIwMSkpJTIwKHN1Y2MlMjAwKSklMjAlQ0UlQkJtLiVDRSVCQm4uJUNFJUJCeC4obSUyMChuJTIweCkpKSUyMCVDRSVCQm0uJUNFJUJCbi4lQ0UlQkJmLiVDRSVCQnguKCgoKG0lMjBzdWNjKSUyMG4pJTIwZiklMjB4KSklMjAlQ0UlQkJuLiVDRSVCQmYuJUNFJUJCeC4oZiUyMCgobiUyMGYpJTIweCkpKSUyMCVDRSVCQmYuJUNFJUJCeC54KSUyMCVDRSVCQnguKFUlMjBVKSklMjAoVSUyMCVDRSVCQmguJUNFJUJCZi4oZiUyMCVDRSVCQnguKCgoaCUyMGgpJTIwZiklMjB4KSkpKSUyMCVDRSVCQmYuKGYlMjBmKSklNUNuJTIyJTdE +[11]: https://en.wikipedia.org/wiki/Currying +[12]: https://en.wikipedia.org/wiki/Alonzo_Church +[13]: https://en.wikipedia.org/wiki/Church_encoding#Church_numerals +[14]: https://en.wikipedia.org/wiki/Peano_axioms#Arithmetic +[15]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBZmFsc2UlMkMlMjJvdXRwdXQlMjIlM0ElMjJyZXN1bHQlMjIlMkMlMjJjb2RlJTIyJTNBJTIyMCUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC54JTVDbjElMjAlM0QlMjAlQ0UlQkJmLiVDRSVCQnguKGYlMjB4KSU1Q24yJTIwJTNEJTIwJUNFJUJCZi4lQ0UlQkJ4LihmJTIwKGYlMjB4KSklNUNuc3VjYyUyMCUzRCUyMCVDRSVCQm4uJUNFJUJCZi4lQ0UlQkJ4LihmJTIwKChuJTIwZiklMjB4KSklNUNuJTVDbnRydWUlMjAlMjAlM0QlMjAlQ0UlQkJ0LiVDRSVCQmYudCU1Q25mYWxzZSUyMCUzRCUyMCVDRSVCQnQuJUNFJUJCZi5mJTVDbiU1Q256ZXJvJTNGJTIwJTNEJTIwJUNFJUJCbi4oKG4lMjAlQ0UlQkJfLmZhbHNlKSUyMHRydWUpJTVDbiU1Q24lMjMlMjB0cnklMjBjaGFuZ2luZyUyMHRoZSUyMG51bWJlciUyMHplcm8lM0YlMjBpcyUyMGNhbGxlZCUyMHdpdGglNUNuKHplcm8lM0YlMjAwKSU1Q24lNUNuJTIzJTIwdGhlJTIwb3V0cHV0JTIwd2lsbCUyMGJlJTIwJTVDJTIyJUNFJUJCdC4lQ0UlQkJmLnQlNUMlMjIlMjBmb3IlMjB0cnVlJTIwYW5kJTIwJTVDJTIyJUNFJUJCdC4lQ0UlQkJmLmYlNUMlMjIlMjBmb3IlMjBmYWxzZS4lMjIlN0Q= +[16]: https://en.wikipedia.org/wiki/Eager_evaluation +[17]: https://en.wikipedia.org/wiki/Lazy_evaluation +[18]: https://en.wikipedia.org/wiki/Syntactic_sugar +[19]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBZmFsc2UlMkMlMjJvdXRwdXQlMjIlM0ElMjJyZXN1bHQlMjIlMkMlMjJjb2RlJTIyJTNBJTIyMCUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC54JTVDbjElMjAlM0QlMjAlQ0UlQkJmLiVDRSVCQnguKGYlMjB4KSU1Q24yJTIwJTNEJTIwJUNFJUJCZi4lQ0UlQkJ4LihmJTIwKGYlMjB4KSklNUNuMyUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMChmJTIwKGYlMjB4KSkpJTVDbnN1Y2MlMjAlM0QlMjAlQ0UlQkJuLiVDRSVCQmYuJUNFJUJCeC4oZiUyMCgobiUyMGYpJTIweCkpJTVDbiU1Q250cnVlJTIwJTIwJTNEJTIwJUNFJUJCdC4lQ0UlQkJmLnQlNUNuZmFsc2UlMjAlM0QlMjAlQ0UlQkJ0LiVDRSVCQmYuZiU1Q24lNUNuemVybyUzRiUyMCUzRCUyMCVDRSVCQm4uKChuJTIwJUNFJUJCXy5mYWxzZSklMjB0cnVlKSU1Q24lNUNuaWYlMjAlM0QlMjAlQ0UlQkJwLiVDRSVCQmEuJUNFJUJCYi4oKChwJTIwYSklMjBiKSUyMDApJTVDbmFuZCUyMCUzRCUyMCVDRSVCQmEuJUNFJUJCYi4oYSUyMGIlMjBmYWxzZSklNUNub3IlMjAlM0QlMjAlQ0UlQkJhLiVDRSVCQmIuKGElMjB0cnVlJTIwYiklNUNubm90JTIwJTNEJTIwJUNFJUJCcC4lQ0UlQkJ0LiVDRSVCQmYuKHAlMjBmJTIwdCklNUNuJTVDbiUyMyUyMHRyeSUyMGNoYW5naW5nJTIwdGhpcyUyMHVwISU1Q24oaWYlMjAob3IlMjAoemVybyUzRiUyMDEpJTIwKHplcm8lM0YlMjAwKSklNUNuJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAyJTVDbiUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwMyklMjIlN0Q= +[20]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBZmFsc2UlMkMlMjJvdXRwdXQlMjIlM0ElMjJyZXN1bHQlMjIlMkMlMjJjb2RlJTIyJTNBJTIyMCUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC54JTVDbjElMjAlM0QlMjAlQ0UlQkJmLiVDRSVCQnguKGYlMjB4KSU1Q24yJTIwJTNEJTIwJUNFJUJCZi4lQ0UlQkJ4LihmJTIwKGYlMjB4KSklNUNuMyUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMChmJTIwKGYlMjB4KSkpJTVDbiU1Q250cnVlJTIwJTIwJTNEJTIwJUNFJUJCdC4lQ0UlQkJmLnQlNUNuZmFsc2UlMjAlM0QlMjAlQ0UlQkJ0LiVDRSVCQmYuZiU1Q24lNUNubWFrZS1wYWlyJTIwJTNEJTIwJUNFJUJCeC4lQ0UlQkJ5LiUyMCVDRSVCQmEuKGElMjB4JTIweSklNUNucGFpci1maXJzdCUyMCUzRCUyMCVDRSVCQnAuKHAlMjB0cnVlKSU1Q25wYWlyLXNlY29uZCUyMCUzRCUyMCVDRSVCQnAuKHAlMjBmYWxzZSklNUNuJTVDbiUyMyUyMHRyeSUyMGNoYW5naW5nJTIwdGhpcyUyMHVwISU1Q25wJTIwJTNEJTIwKG1ha2UtcGFpciUyMDIlMjAzKSU1Q24ocGFpci1zZWNvbmQlMjBwKSUyMiU3RA== +[21]: https://en.wikipedia.org/wiki/Linked_list +[22]: https://en.wikipedia.org/wiki/Lisp_%28programming_language%29 +[23]: https://en.wikipedia.org/wiki/CAR_and_CDR#Etymology +[24]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBZmFsc2UlMkMlMjJvdXRwdXQlMjIlM0ElMjJyZXN1bHQlMjIlMkMlMjJjb2RlJTIyJTNBJTIyMCUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC54JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwMSUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMHgpJTIwJTIwJTIwJTIwJTIwMiUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMChmJTIweCkpJTIwJTIwJTIwJTIwMyUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMChmJTIwKGYlMjB4KSkpJTVDbnRydWUlMjAlMjAlM0QlMjAlQ0UlQkJ0LiVDRSVCQmYudCUyMCUyMCUyMCUyMGZhbHNlJTIwJTNEJTIwJUNFJUJCdC4lQ0UlQkJmLmYlNUNuJTVDbm1ha2UtcGFpciUyMCUzRCUyMCVDRSVCQnguJUNFJUJCeS4lMjAlQ0UlQkJhLihhJTIweCUyMHkpJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcGFpci1maXJzdCUyMCUzRCUyMCVDRSVCQnAuKHAlMjB0cnVlKSUyMCUyMCUyMCUyMCUyMHBhaXItc2Vjb25kJTIwJTNEJTIwJUNFJUJCcC4ocCUyMGZhbHNlKSU1Q24lNUNubmlsJTIwJTNEJTIwKG1ha2UtcGFpciUyMGZhbHNlJTIwZmFsc2UpJTIwJTIwJTIwJTIwJTIwbmlsJTNGJTIwJTNEJTIwJUNFJUJCbC4lMjAobm90JTIwKHBhaXItZmlyc3QlMjBsKSklNUNuY29ucyUyMCUzRCUyMCVDRSVCQnZhbHVlLiVDRSVCQmxpc3QuKG1ha2UtcGFpciUyMHRydWUlMjAobWFrZS1wYWlyJTIwdmFsdWUlMjBsaXN0KSklNUNuJTVDbmhlYWQlMjAlM0QlMjAlQ0UlQkJsaXN0LiUyMChwYWlyLWZpcnN0JTIwKHBhaXItc2Vjb25kJTIwbGlzdCkpJTVDbnRhaWwlMjAlM0QlMjAlQ0UlQkJsaXN0LiUyMChwYWlyLXNlY29uZCUyMChwYWlyLXNlY29uZCUyMGxpc3QpKSU1Q24lNUNuJTIzJTIwdHJ5JTIwY2hhbmdpbmclMjB0aGlzJTIwdXAhJTVDbmwlMjAlM0QlMjAoY29ucyUyMDElMjAoY29ucyUyMDIlMjAoY29ucyUyMDMlMjBuaWwpKSklNUNuKGhlYWQlMjAodGFpbCUyMGwpKSUyMiU3RA== +[25]: https://en.wikipedia.org/wiki/Recursion +[26]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjJzdW0lMjAlM0QlMjAlQ0UlQkJoZWxwZXIuJUNFJUJCbGlzdC4lNUNuJTIwJTIwKGlmJTIwKG5pbCUzRiUyMGxpc3QpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwMCU1Q24lMjAlMjAlMjAlMjAlMjAlMjAlQ0UlQkJfLiUyMCglMkIlMjAoaGVhZCUyMGxpc3QpJTIwKGhlbHBlciUyMGhlbHBlciUyMCh0YWlsJTIwbGlzdCkpKSklNUNuJTVDbnJlc3VsdCUyMCUzRCUyMChzdW0lMjBzdW0lMjAoY29ucyUyMDElMjAoY29ucyUyMDIlMjAoY29ucyUyMDMlMjBuaWwpKSkpJTVDbiU1Q24lMjMlMjB3ZSdsbCUyMGV4cGxhaW4lMjBob3clMjBwcmludC1udW0lMjB3b3JrcyUyMGxhdGVyJTJDJTIwYnV0JTIwd2UlMjBuZWVkJTIwaXQlMjB0byUyMHNob3clMjB0aGF0JTIwc3VtJTIwaXMlMjB3b3JraW5nJTVDbihwcmludC1udW0lMjByZXN1bHQpJTIyJTdE +[27]: https://en.wikipedia.org/wiki/Fixed-point_combinator#Fixed_point_combinators_in_lambda_calculus +[28]: https://www.ycombinator.com/ +[29]: https://news.ycombinator.com/ +[30]: http://matt.might.net/articles/implementation-of-recursive-fixed-point-y-combinator-in-javascript-for-memoization/ +[31]: http://kestas.kuliukas.com/YCombinatorExplained/ +[32]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjJZJTIwJTNEJTIwJUNFJUJCZi4oJUNFJUJCeC4oeCUyMHgpJTIwJUNFJUJCeC4oZiUyMCVDRSVCQnkuKCh4JTIweCklMjB5KSkpJTVDbiU1Q25zdW0lMjAlM0QlMjAoWSUyMCVDRSVCQmhlbHBlci4lQ0UlQkJsaXN0LiU1Q24lMjAlMjAoaWYlMjAobmlsJTNGJTIwbGlzdCklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAwJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwKCUyQiUyMChoZWFkJTIwbGlzdCklMjAoaGVscGVyJTIwKHRhaWwlMjBsaXN0KSkpKSklNUNuJTVDbiUyMyUyMHdlJ2xsJTIwZXhwbGFpbiUyMGhvdyUyMHRoaXMlMjB3b3JrcyUyMGxhdGVyJTJDJTIwYnV0JTIwd2UlMjBuZWVkJTIwaXQlMjB0byUyMHNob3clMjB0aGF0JTIwc3VtJTIwaXMlMjB3b3JraW5nJTVDbnByaW50LW51bSUyMCUzRCUyMCVDRSVCQm4uKHByaW50LWxpc3QlMjAoaXRvYSUyMG4pKSU1Q24lNUNuKHByaW50LW51bSUyMChzdW0lMjAoY29ucyUyMDElMjAoY29ucyUyMDIlMjAoY29ucyUyMDMlMjBuaWwpKSkpKSUyMiU3RA +[33]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjIwJTIwJTNEJTIwJUNFJUJCZi4lQ0UlQkJ4LnglNUNuMSUyMCUzRCUyMCVDRSVCQmYuJUNFJUJCeC4oZiUyMHgpJTVDbjIlMjAlM0QlMjAlQ0UlQkJmLiVDRSVCQnguKGYlMjAoZiUyMHgpKSU1Q24zJTIwJTNEJTIwJUNFJUJCZi4lQ0UlQkJ4LihmJTIwKGYlMjAoZiUyMHgpKSklNUNuJTVDbnByZWQlMjAlM0QlMjAlQ0UlQkJuLiU1Q24lMjAlMjAocGFpci1zZWNvbmQlNUNuJTIwJTIwJTIwJTIwKG4lNUNuJTIwJTIwJTIwJTIwJTIwJUNFJUJCcGFpci4obWFrZS1wYWlyJTIwKHN1Y2MlMjAocGFpci1maXJzdCUyMHBhaXIpKSUyMChwYWlyLWZpcnN0JTIwcGFpcikpJTVDbiUyMCUyMCUyMCUyMCUyMChtYWtlLXBhaXIlMjAwJTIwMCkpKSU1Q24lNUNuJTIzJTIwd2UnbGwlMjBleHBsYWluJTIwaG93JTIwcHJpbnQtbnVtJTIwd29ya3MlMjBsYXRlciElNUNuKHByaW50LW51bSUyMChwcmVkJTIwMykpJTVDbiUyMiU3RA== +[34]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjIlMkIlMjAlM0QlMjAlQ0UlQkJtLiVDRSVCQm4uKG0lMjBzdWNjJTIwbiklNUNuKiUyMCUzRCUyMCVDRSVCQm0uJUNFJUJCbi4obiUyMCglMkIlMjBtKSUyMDApJTVDbi0lMjAlM0QlMjAlQ0UlQkJtLiVDRSVCQm4uKG4lMjBwcmVkJTIwbSklNUNuJTJGJTIwJTNEJTIwKFklMjAlQ0UlQkIlMkYuJUNFJUJCbS4lQ0UlQkJuLiU1Q24lMjAlMjAoaWYlMjAoZXElM0YlMjBtJTIwbiklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAxJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwKGlmJTIwKGxlJTNGJTIwbSUyMG4pJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwMCU1Q24lMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlQ0UlQkJfLiUyMCglMkIlMjAxJTIwKCUyRiUyMCgtJTIwbSUyMG4pJTIwbikpKSkpJTVDbiUyNSUyMCUzRCUyMCVDRSVCQm0uJUNFJUJCbi4lMjAoLSUyMG0lMjAoKiUyMCglMkYlMjBtJTIwbiklMjBuKSklNUNuJTVDbihwcmludC1udW0lMjAoJTI1JTIwNyUyMDMpKSUyMiU3RA== +[35]: https://github.com/jtolds/sheepda/ +[36]: https://en.wikipedia.org/wiki/ASCII#Code_chart +[37]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjIlMjMlMjBkZWZpbmUlMjB0aGUlMjBtZXNzYWdlcyU1Q25maXp6bXNnJTIwJTNEJTIwKGNvbnMlMjAobnVtJTIwMCUyMDclMjAwKSUyMChjb25zJTIwKG51bSUyMDElMjAwJTIwNSklMjAoY29ucyUyMChudW0lMjAxJTIwMiUyMDIpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDIlMjAyKSUyMG5pbCkpKSklNUNuYnV6em1zZyUyMCUzRCUyMChjb25zJTIwKG51bSUyMDAlMjA2JTIwNiklMjAoY29ucyUyMChudW0lMjAxJTIwMSUyMDcpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDIlMjAyKSUyMChjb25zJTIwKG51bSUyMDElMjAyJTIwMiklMjBuaWwpKSkpJTVDbmZpenpidXp6bXNnJTIwJTNEJTIwKGNvbnMlMjAobnVtJTIwMCUyMDclMjAwKSUyMChjb25zJTIwKG51bSUyMDElMjAwJTIwNSklMjAoY29ucyUyMChudW0lMjAxJTIwMiUyMDIpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDIlMjAyKSU1Q24lMjAlMjAlMjAlMjAoY29ucyUyMChudW0lMjAwJTIwOSUyMDgpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDElMjA3KSUyMChjb25zJTIwKG51bSUyMDElMjAyJTIwMiklMjAoY29ucyUyMChudW0lMjAxJTIwMiUyMDIpJTIwbmlsKSkpKSkpKSklNUNuJTVDbiUyMyUyMGZpenpidXp6JTVDbmZpenpidXp6JTIwJTNEJTIwJUNFJUJCbi4lNUNuJTIwJTIwKGZvciUyMG4lMjAlQ0UlQkJpLiU1Q24lMjAlMjAlMjAlMjAoZG8yJTVDbiUyMCUyMCUyMCUyMCUyMCUyMChpZiUyMCh6ZXJvJTNGJTIwKCUyNSUyMGklMjAzKSklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAoaWYlMjAoemVybyUzRiUyMCglMjUlMjBpJTIwNSkpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwKHByaW50LWxpc3QlMjBmaXp6YnV6em1zZyklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAocHJpbnQtbGlzdCUyMGZpenptc2cpKSU1Q24lMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlQ0UlQkJfLiUyMChpZiUyMCh6ZXJvJTNGJTIwKCUyNSUyMGklMjA1KSklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4lMjAocHJpbnQtbGlzdCUyMGJ1enptc2cpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCVDRSVCQl8uJTIwKHByaW50LWxpc3QlMjAoaXRvYSUyMGkpKSkpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMChwcmludC1uZXdsaW5lJTIwbmlsKSkpJTVDbiU1Q24lMjMlMjBydW4lMjBmaXp6YnV6eiUyMDIwJTIwdGltZXMlNUNuKGZpenpidXp6JTIwKG51bSUyMDAlMjAyJTIwMCkpJTIyJTdE +[38]: https://jtolds.github.io/sheepda/#JTdCJTIyc3RkbGliJTIyJTNBdHJ1ZSUyQyUyMm91dHB1dCUyMiUzQSUyMm91dHB1dCUyMiUyQyUyMmNvZGUlMjIlM0ElMjJoZWxsby13b3JsZCUyMCUzRCUyMChjb25zJTIwKG51bSUyMDAlMjA3JTIwMiklMjAoY29ucyUyMChudW0lMjAxJTIwMCUyMDEpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDAlMjA4KSUyMChjb25zJTIwKG51bSUyMDElMjAwJTIwOCklMjAoY29ucyUyMChudW0lMjAxJTIwMSUyMDEpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMChjb25zJTIwKG51bSUyMDAlMjA0JTIwNCklMjAoY29ucyUyMChudW0lMjAwJTIwMyUyMDIpJTIwKGNvbnMlMjAobnVtJTIwMSUyMDElMjA5KSUyMChjb25zJTIwKG51bSUyMDElMjAxJTIwMSklMjAoY29ucyUyMChudW0lMjAxJTIwMSUyMDQpJTVDbiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMChjb25zJTIwKG51bSUyMDElMjAwJTIwOCklMjAoY29ucyUyMChudW0lMjAxJTIwMCUyMDApJTIwKGNvbnMlMjAobnVtJTIwMCUyMDMlMjAzKSUyMG5pbCkpKSkpKSkpKSkpKSklNUNuJTVDbnJldmVyc2UtbGlzdCUyMCUzRCUyMCVDRSVCQmxpc3QuKCU1Q24lMjAlMjAoWSUyMCVDRSVCQnJlY3Vyc2UuJUNFJUJCb2xkLiVDRSVCQm5ldy4lNUNuJTIwJTIwJTIwJTIwKGlmJTIwKG5pbCUzRiUyMG9sZCklNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy5uZXclNUNuJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJUNFJUJCXy4ocmVjdXJzZSUyMCh0YWlsJTIwb2xkKSUyMChjb25zJTIwKGhlYWQlMjBvbGQpJTIwbmV3KSkpKSU1Q24lMjAlMjBsaXN0JTIwbmlsKSU1Q24lNUNuKGRvNCU1Q24lMjAlMjAocHJpbnQtbGlzdCUyMGhlbGxvLXdvcmxkKSU1Q24lMjAlMjAocHJpbnQtbmV3bGluZSUyMHZvaWQpJTVDbiUyMCUyMChwcmludC1saXN0JTIwKHJldmVyc2UtbGlzdCUyMGhlbGxvLXdvcmxkKSklNUNuJTIwJTIwKHByaW50LW5ld2xpbmUlMjB2b2lkKSklMjIlN0Q= +[39]: https://github.com/gopherjs/gopherjs +[40]: https://jtolds.github.io/sheepda/ +[41]: https://en.wikipedia.org/wiki/Code_golf diff --git a/sources/tech/20180207 23 open source audio-visual production tools.md b/sources/tech/20180207 23 open source audio-visual production tools.md index fd196200ce..b6b748ec39 100644 --- a/sources/tech/20180207 23 open source audio-visual production tools.md +++ b/sources/tech/20180207 23 open source audio-visual production tools.md @@ -1,3 +1,4 @@ +luming translating 23 open source audio-visual production tools ====== diff --git a/sources/tech/20180319 How to not be a white male asshole, by a former offender.md b/sources/tech/20180319 How to not be a white male asshole, by a former offender.md new file mode 100644 index 0000000000..3478787ea1 --- /dev/null +++ b/sources/tech/20180319 How to not be a white male asshole, by a former offender.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to not be a white male asshole, by a former offender) +[#]: via: (https://www.jtolio.com/2018/03/how-to-not-be-a-white-male-asshole-by-a-former-offender) +[#]: author: (jtolio.com https://www.jtolio.com/) + +How to not be a white male asshole, by a former offender +====== + +_Huge thanks to Caitlin Jarvis for editing, contributing to, and proofreading to this post._ + +First off, let’s start off with some assumptions. You, dear reader, don’t intend to cause anyone harm. You have good intentions, see yourself as a good person, and are interested in self improvement. That’s great! + +Second, I don’t actually know for sure if I’m not still a current offender. I might be! It’s certainly something I’ll never be done working on. + +### 1\. You don’t know what others are going through + +Unfortunately, your good intentions are not enough to make sure the experiences of others are, in fact, good because we live in a world of asymmetric information. If another person’s dog just died unbeknownst to you and you start talking excitedly about how great dogs are to try and cheer a sad person up, you may end up causing them to be even sadder. You know things other people don’t, and others know things you don’t. + +So when I say that if you are a white man, there is an invisible world of experiences happening all around you that you are inherently blind to, it’s because of asymmetric information. You can’t know what others are going through because you are not an impartial observer of a system. _You exist within the system._ + +![][1] + +Let me show you what I mean: did you know a recent survey found that _[81 percent of women have experienced sexual harassment of some kind][2]_? Fully 1 out of every 2 women you know have had to deal specifically with _unwanted sexual touching_. + +What should have been most amazing about the [#MeToo movement][3] was not how many women reported harassment, but how many men were surprised. + +### 2\. You can inadvertently contribute to a racist, sexist, or prejudiced society + +I [previously wrote a lot about how small little interactions can add up][4], illustrating that even if you don’t intend to subject someone to racism, sexism, or some other prejudice, you might be doing it anyway. Intentions are meaningless when your actions amplify the negative experience of someone else. + +An example from [Maisha Johnson in Everyday Feminism][5]: + +> Black women deal with people touching our hair a lot. Now you know. Okay, there’s more to it than that: Black women deal with people touching our hair a _hell_ of a lot. +> +> If you approach a Black woman saying “I just have to feel your hair,” it’s pretty safe to assume this isn’t the first time she’s heard that. +> +> Everyone who asks me if they can touch follows a long line of people othering me – including strangers who touch my hair without asking. The psychological impact of having people constantly feel entitled my personal space has worn me down. + +Another example is that men frequently demand proof. Even though it makes sense in general to check your sources for something, the predominant response of men when confronted with claims of sexist treatment is to [ask for evidence][6]. Because this happens so frequently, this action _itself_ contributes to the sexist subjugation of women. The parallel universe women live in is so distinct from the experiences of men that men can’t believe their ears, and treat the report of a victim with skepticism. + +As you might imagine, this sort of effect is not limited to asking women for evidence or hair touching. Microaggressions are real and everywhere; the accumulation of lots of small things can be enormous. + +If you’re someone in charge of building things, this can be even more important and an even greater responsibility. If you build an app that is blind to the experiences of people who don’t look or act like you, you can significantly amplify negative experiences for others by causing systemic and system-wide issues. + +### 3\. The only way to stop contributing is to continually listen to others + +If you don’t already know what others are going through, and by not knowing what others are going through you may be subjecting them to prejudice even if you don’t mean to, what can you do to help others avoid prejudice? You can listen to them! People who are experiencing prejudice _don’t want to be experiencing prejudice_ and tend to be vocal about the experience. It is your job to really listen and then turn around and change the way you approach these situations in the future. + +### 4\. How do I listen? + +To listen to someone, you need to have empathy. You need to actually care about them. You need to process what they’re saying and not treat them with suspicion. + +Listening is very different from interjecting and arguing. Listening to others is different from making them do the work to educate you. It is your job to find the experiences of others you haven’t had and learn from them without demanding a curriculum. + +When people say you should just believe marginalized people, [no one is asking you to check your critical thinking at the door][7]. What you’re being asked to do is to be aware that your incredulity is a further reminder that you are not experiencing the same thing. Worse - white men acting incredulous is _so unbelievably common_ that it itself is a microaggression. Don’t be a sea lion: + +![][8] + +#### Aside about diversity of experience vs. diversity of thought. + +When trying to find others to listen to, who should you find? Recently, a growing number of people have echoed that all that’s really required of diversity is different viewpoints, and having diversity of thought is the ultimate goal. + +I want to point out that this is not the kind of diversity that will be useful to you. It’s easy to have a bunch of different opinions and then reject them when they complicate your life. What you want to be listening to is diversity of _experience_. Some experiences can’t be chosen. You can choose to be contrarian, but you can’t choose the color of your skin. + +### 5\. Where do I listen? + +What you need is a way to be a fly on the wall and observe the life experiences of others through their words and perspectives. Being friends and hanging out with people who are different from you is great. Getting out of monocultures is fantastic. Holding your company to diversity and inclusion initiatives is wonderful. + +But if you still need more or you live somewhere like Utah? + +What if there was a website where people from all walks of life opted in to talking about their day and what they’re feeling and experiencing from their viewpoint in a way you could read? It’d be almost like seeing the world through their eyes. + +Yep, this blog post is an unsolicited Twitter ad. Twitter definitely has its share of problems, but after [writing about how I finally figured out Twitter][9], in 2014 I decided to embark on a year-long effort to use Twitter (I wasn’t really using it before) to follow mostly women or people of color in my field and just see what the field is like for them on a day to day basis. + +Listening to others in this way blew my mind clean open. Suddenly I was aware of this invisible world around me, much of which is still invisible. Now, I’m looking for it, and I catch glimpses. I would challenge anyone and everyone to do this. Make sure the content you’re consuming is predominantly viewpoints from life experiences you haven’t had. + +If you need a start, here are some links to accounts to fill your Twitter feed up with: + + * [200 Women of Color in Tech on Twitter][10] + * [Women Engineers on Twitter][11] + + + +You can also check out [who I follow][12], though I should warn I also follow a lot of political accounts, joke accounts, and my following of someone is not an endorsement. + +It’s also worth pointing out that no individual can possibly speak for an entire class of people, but if 38 out of 50 women are saying they’re dealing with something, you should listen. + +### 6\. Does this work? + +Listening to others works, but you don’t have to just take my word for it. Here are two specific and recent experience reports of people turning their worldview for the better by listening to others: + + * [A professor at the University of New Brunswick][13] + * [A senior design developer at Microsoft][14] + + + +You can see how much of a profound and fast impact this had on me because by early 2015, only a few months into my Twitter experiment, I was worked up enough to write [my unicycle post][4] in response to what I was reading on Twitter. + +Having diverse perspectives in a workplace has even been shown to [increase productivity][15] and [increase creativity][16]. + +### 7\. Don’t stop there! + +Not everyone is as growth-oriented as you. Just because you’re listening now doesn’t mean others are hearing the same distribution of experiences. + +If this is new to you, it’s not new to marginalized people. Imagine how tired they must be in trying to convince everyone their experiences are real, valid, and ongoing. Help get the word out! Repeat and retweet what women and minorities say. Give them credit. In meetings at your work, give credit to others for their ideas and amplify their voices. + +Did you know that [non-white or female bosses who push diversity are judged negatively by their peers and managers][17] but white male bosses are not? If you’re a white male, use your position where others can’t. + +If you need an example list of things your company can do, [here’s a list Susan Fowler wrote after her experience at Uber][18]. + +Speak up, use your experiences to help others. + +### 8\. Am I not prejudiced now? + +The asymmetry of experiences we all have means we’re all inherently prejudiced to some degree and will likely continue to contribute to a prejudiced society. That said, the first step to fixing it is admitting it! + +There will always be work to do. You will always need to keep listening, keep learning, and work to improve every day. + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2018/03/how-to-not-be-a-white-male-asshole-by-a-former-offender + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.jtolio.com/images/mrmouse.jpg +[2]: https://www.npr.org/sections/thetwo-way/2018/02/21/587671849/a-new-survey-finds-eighty-percent-of-women-have-experienced-sexual-harassment +[3]: https://en.wikipedia.org/wiki/Me_Too_movement +[4]: https://www.jtolio.com/2015/03/what-riding-a-unicycle-can-teach-us-about-microaggressions/ +[5]: https://everydayfeminism.com/2015/09/dont-touch-black-womens-hair/ +[6]: https://twitter.com/ArielDumas/status/970692180766490630 +[7]: https://www.elle.com/culture/career-politics/a13977980/me-too-movement-false-accusations-believe-women/ +[8]: https://www.jtolio.com/images/sealion.png +[9]: https://www.jtolio.com/2009/03/i-finally-figured-out-twitter/ +[10]: http://peopleofcolorintech.com/articles/a-list-of-200-women-of-color-on-twitter/ +[11]: https://github.com/ryanburgess/female-engineers-twitter +[12]: https://twitter.com/jtolds/following +[13]: https://www.theglobeandmail.com/opinion/ill-start-2018-by-recognizing-my-white-privilege/article37472875/ +[14]: https://micahgodbolt.com/blog/changing-your-worldview/ +[15]: http://edis.ifas.ufl.edu/hr022 +[16]: https://faculty.insead.edu/william-maddux/documents/PSPB-learning-paper.pdf +[17]: https://digest.bps.org.uk/2017/07/12/non-white-or-female-bosses-who-push-diversity-are-judged-negatively-by-their-peers-and-managers/ +[18]: https://www.susanjfowler.com/blog/2017/5/20/five-things-tech-companies-can-do-better diff --git a/sources/tech/20180330 Go on very small hardware Part 1.md b/sources/tech/20180330 Go on very small hardware Part 1.md deleted file mode 100644 index 3ca498ada3..0000000000 --- a/sources/tech/20180330 Go on very small hardware Part 1.md +++ /dev/null @@ -1,506 +0,0 @@ -Go on very small hardware (Part 1) -============================================================ - - -How low we can  _Go_  and still do something useful? - -I recently bought this ridiculously cheap board: - - [![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)][2] - -I bought it for three reasons. First, I have never dealt (as a programmer) with STM32F0 series. Second, the STM32F10x series is getting old. MCUs belonging to the STM32F0 family are just as cheap if not cheaper and has newer peripherals, with many improvements and bugs fixed. Thirdly, I chose the smallest member of the family for the purpose of this article, to make the whole thing a little more intriguing. - -### The Hardware - -The [STM32F030F4P6][3] is impresive piece of hardware: - -* CPU: [Cortex M0][1] 48 MHz (only 12000 logic gates, in minimal configuration), - -* RAM: 4 KB, - -* Flash: 16 KB, - -* ADC, SPI, I2C, USART and a couple of timers, - -all enclosed in TSSOP20 package. As you can see, it is very small 32-bit system. - -### The software - -If you hoped to see how to use [genuine Go][4] to program this board, you need to read the hardware specification one more time. You must face the truth: there is a negligible chance that someone will ever add support for Cortex-M0 to the Go compiler and this is just the beginning of work. - -I’ll use [Emgo][5], but don’t worry, you will see that it gives you as much Go as it can on such small system. - -There was no support for any F0 MCU in [stm32/hal][6] before this board arrived to me. After brief study of [RM][7], the STM32F0 series appeared to be striped down STM32F3 series, which made work on new port easier. - -If you want to follow subsequent steps of this post, you need to install Emgo - -``` -cd $HOME -git clone https://github.com/ziutek/emgo/ -cd emgo/egc -go install - -``` - -and set a couple environment variables - -``` -export EGCC=path_to_arm_gcc # eg. /usr/local/arm/bin/arm-none-eabi-gcc -export EGLD=path_to_arm_linker # eg. /usr/local/arm/bin/arm-none-eabi-ld -export EGAR=path_to_arm_archiver # eg. /usr/local/arm/bin/arm-none-eabi-ar - -export EGROOT=$HOME/emgo/egroot -export EGPATH=$HOME/emgo/egpath - -export EGARCH=cortexm0 -export EGOS=noos -export EGTARGET=f030x6 - -``` - -A more detailed description can be found on the [Emgo website][8]. - -Ensure that egc is on your PATH. You can use `go build` instead of `go install` and copy egc to your  _$HOME/bin_  or  _/usr/local/bin_ . - -Now create new directory for your first Emgo program and copy example linker script there: - -``` -mkdir $HOME/firstemgo -cd $HOME/firstemgo -cp $EGPATH/src/stm32/examples/f030-demo-board/blinky/script.ld . - -``` - -### Minimal program - -Lets create minimal program in  _main.go_  file: - -``` -package main - -func main() { -} - -``` - -It’s actually minimal and compiles witout any problem: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 7452 172 104 7728 1e30 cortexm0.elf - -``` - -The first compilation can take some time. The resulting binary takes 7624 bytes of Flash (text+data), quite a lot for a program that does nothing. There are 8760 free bytes left to do something useful. - -What about traditional  _Hello, World!_  code: - -``` -package main - -import "fmt" - -func main() { - fmt.Println("Hello, World!") -} - -``` - -Unfortunately, this time it went worse: - -``` -$ egc -/usr/local/arm/bin/arm-none-eabi-ld: /home/michal/P/go/src/github.com/ziutek/emgo/egpath/src/stm32/examples/f030-demo-board/blog/cortexm0.elf section `.text' will not fit in region `Flash' -/usr/local/arm/bin/arm-none-eabi-ld: region `Flash' overflowed by 10880 bytes -exit status 1 - -``` - - _Hello, World!_  requires at last STM32F030x6, with its 32 KB of Flash. - -The  _fmt_  package forces to include whole  _strconv_  and  _reflect_  packages. All three are pretty big, even a slimmed-down versions in Emgo. We must forget about it. There are many applications that don’t require fancy formatted text output. Often one or more LEDs or seven segment display are enough. However, in Part 2, I’ll try to use  _strconv_  package to format and print some numbers and text over UART. - -### Blinky - -Our board has one LED connected between PA4 pin and VCC. This time we need a bit more code: - -``` -package main - -import ( - "delay" - - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" -) - -var led gpio.Pin - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(false) - led = gpio.A.Pin(4) - - cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} - led.Setup(cfg) -} - -func main() { - for { - led.Clear() - delay.Millisec(100) - led.Set() - delay.Millisec(900) - } -} - -``` - -By convention, the  _init_  function is used to initialize the basic things and configure peripherals. - -`system.SetupPLL(8, 1, 48/8)` configures RCC to use PLL with external 8 MHz oscilator as system clock source. PLL divider is set to 1, multipler to 48/8 = 6 which gives 48 MHz system clock. - -`systick.Setup(2e6)` setups Cortex-M SYSTICK timer as system timer, which runs the scheduler every 2e6 nanoseconds (500 times per second). - -`gpio.A.EnableClock(false)` enables clock for GPIO port A.  _False_  means that this clock should be disabled in low-power mode, but this is not implemented int STM32F0 series. - -`led.Setup(cfg)` setups PA4 pin as open-drain output. - -`led.Clear()` sets PA4 pin low, which in open-drain configuration turns the LED on. - -`led.Set()` sets PA4 to high-impedance state, which turns the LED off. - -Lets compile this code: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 9772 172 168 10112 2780 cortexm0.elf - -``` - -As you can see, blinky takes 2320 bytes more than minimal program. There are still 6440 bytes left for more code. - -Let’s see if it works: - -``` -$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' -Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) -Licensed under GNU GPL v2 -For bug reports, read - http://openocd.org/doc/doxygen/bugs.html -debug_level: 0 -adapter speed: 1000 kHz -adapter_nsrst_delay: 100 -none separate -adapter speed: 950 kHz -target halted due to debug-request, current mode: Thread -xPSR: 0xc1000000 pc: 0x0800119c msp: 0x20000da0 -adapter speed: 4000 kHz -** Programming Started ** -auto erase enabled -target halted due to breakpoint, current mode: Thread -xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000da0 -wrote 10240 bytes from file cortexm0.elf in 0.817425s (12.234 KiB/s) -** Programming Finished ** -adapter speed: 950 kHz - -``` - -For this article, the first time in my life, I converted short video to [animated PNG][9] sequence. I’m impressed, goodbye YouTube and sorry IE users. See [apngasm][10] for more info. I should study HTML5 based alternative, but for now, APNG is my preffered way for short looped videos. - -![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/blinky.png) - -### More Go - -If you aren’t a Go programmer but you’ve heard something about Go language, you can say: “This syntax is nice, but not a significant improvement over C. Show me  _Go language_ , give mi  _channels_  and  _goroutines!_ ”. - -Here you are: - -``` -import ( - "delay" - - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" -) - -var led1, led2 gpio.Pin - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(false) - led1 = gpio.A.Pin(4) - led2 = gpio.A.Pin(5) - - cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} - led1.Setup(cfg) - led2.Setup(cfg) -} - -func blinky(led gpio.Pin, period int) { - for { - led.Clear() - delay.Millisec(100) - led.Set() - delay.Millisec(period - 100) - } -} - -func main() { - go blinky(led1, 500) - blinky(led2, 1000) -} - -``` - -Code changes are minor: the second LED was added and the previous  _main_  function was renamed to  _blinky_  and now requires two parameters.  _Main_  starts first  _blinky_  in new goroutine, so both LEDs are handled  _concurrently_ . It is worth mentioning that  _gpio.Pin_  type supports concurrent access to different pins of the same GPIO port. - -Emgo still has several shortcomings. One of them is that you have to specify a maximum number of goroutines (tasks) in advance. It’s time to edit  _script.ld_ : - -``` -ISRStack = 1024; -MainStack = 1024; -TaskStack = 1024; -MaxTasks = 2; - -INCLUDE stm32/f030x4 -INCLUDE stm32/loadflash -INCLUDE noos-cortexm - -``` - -The size of the stacks are set by guess, and we’ll not care about them at the moment. - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 10020 172 172 10364 287c cortexm0.elf - -``` - -Another LED and goroutine costs 248 bytes of Flash. - -![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/goroutines.png) - -### Channels - -Channels are the [preffered way][11] in Go to communicate between goroutines. Emgo goes even further and allows to use  _buffered_  channels by  _interrupt handlers_ . The next example actually shows such case. - -``` -package main - -import ( - "delay" - "rtos" - - "stm32/hal/gpio" - "stm32/hal/irq" - "stm32/hal/system" - "stm32/hal/system/timer/systick" - "stm32/hal/tim" -) - -var ( - leds [3]gpio.Pin - timer *tim.Periph - ch = make(chan int, 1) -) - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(false) - leds[0] = gpio.A.Pin(4) - leds[1] = gpio.A.Pin(5) - leds[2] = gpio.A.Pin(9) - - cfg := &gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain} - for _, led := range leds { - led.Set() - led.Setup(cfg) - } - - timer = tim.TIM3 - pclk := timer.Bus().Clock() - if pclk < system.AHB.Clock() { - pclk *= 2 - } - freq := uint(1e3) // Hz - timer.EnableClock(true) - timer.PSC.Store(tim.PSC(pclk/freq - 1)) - timer.ARR.Store(700) // ms - timer.DIER.Store(tim.UIE) - timer.CR1.Store(tim.CEN) - - rtos.IRQ(irq.TIM3).Enable() -} - -func blinky(led gpio.Pin, period int) { - for range ch { - led.Clear() - delay.Millisec(100) - led.Set() - delay.Millisec(period - 100) - } -} - -func main() { - go blinky(leds[1], 500) - blinky(leds[2], 500) -} - -func timerISR() { - timer.SR.Store(0) - leds[0].Set() - select { - case ch <- 0: - // Success - default: - leds[0].Clear() - } -} - -//c:__attribute__((section(".ISRs"))) -var ISRs = [...]func(){ - irq.TIM3: timerISR, -} - -``` - -Changes compared to the previous example: - -1. Thrid LED was added and connected to PA9 pin (TXD pin on UART header). - -2. The timer (TIM3) has been introduced as a source of interrupts. - -3. The new  _timerISR_  function handles  _irq.TIM3_  interrupt. - -4. The new buffered channel with capacity 1 is intended for communication between  _timerISR_  and  _blinky_  goroutines. - -5. The  _ISRs_  array acts as  _interrupt vector table_ , a part of bigger  _exception vector table_ . - -6. The  _blinky’s for statement_  was replaced with a  _range statement_ . - -For convenience, all LEDs, or rather their pins, have been collected in the  _leds_  array. Additionally, all pins have been set to a known initial state (high), just before they were configured as outputs. - -In this case, we want the timer to tick at 1 kHz. To configure TIM3 prescaler, we need to known its input clock frequency. According to RM the input clock frequency is equal to APBCLK when APBCLK = AHBCLK, otherwise it is equal to 2 x APBCLK. - -If the CNT register is incremented at 1 kHz, then the value of ARR register corresponds to the period of counter  _update event_  (reload event) expressed in milliseconds. To make update event to generate interrupts, the UIE bit in DIER register must be set. The CEN bit enables the timer. - -Timer peripheral should stay enabled in low-power mode, to keep ticking when the CPU is put to sleep: `timer.EnableClock(true)`. It doesn’t matter in case of STM32F0 but it’s important for code portability. - -The  _timerISR_  function handles  _irq.TIM3_  interrupt requests. `timer.SR.Store(0)` clears all event flags in SR register to deassert the IRQ to [NVIC][12]. The rule of thumb is to clear the interrupt flags immedaitely at begining of their handler, because of the IRQ deassert latency. This prevents unjustified re-call the handler again. For absolute certainty, the clear-read sequence should be performed, but in our case, just clearing is enough. - -The following code: - -``` -select { -case ch <- 0: - // Success -default: - leds[0].Clear() -} - -``` - -is a Go way to non-blocking sending on a channel. No one interrupt handler can afford to wait for a free space in the channel. If the channel is full, the default case is taken, and the onboard LED is set on, until the next interrupt. - -The  _ISRs_  array contains interrupt vectors. The `//c:__attribute__((section(".ISRs")))` causes that the linker will inserted it into .ISRs section. - -The new form of  _blinky’s for_  loop: - -``` -for range ch { - led.Clear() - delay.Millisec(100) - led.Set() - delay.Millisec(period - 100) -} - -``` - -is the equivalent of: - -``` -for { - _, ok := <-ch - if !ok { - break // Channel closed. - } - led.Clear() - delay.Millisec(100) - led.Set() - delay.Millisec(period - 100) -} - -``` - -Note that in this case we aren’t interested in the value received from the channel. We’re interested only in the fact that there is something to receive. We can give it expression by declaring the channel’s element type as empty struct `struct{}` instead of  _int_  and send `struct{}{}` values instead of 0, but it can be strange for newcomer’s eyes. - -Lets compile this code: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 11096 228 188 11512 2cf8 cortexm0.elf - -``` - -This new example takes 11324 bytes of Flash, 1132 bytes more than the previous one. - -With the current timings, both  _blinky_  goroutines consume from the channel much faster than the  _timerISR_  sends to it. So they both wait for new data simultaneously and you can observe the randomness of  _select_ , required by the [Go specification][13]. - -![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/channels1.png) - -The onboard LED is always off, so the channel overrun never occurs. - -Let’s speed up sending, by changing `timer.ARR.Store(700)` to `timer.ARR.Store(200)`. Now the  _timerISR_ sends 5 messages per second but both recipients together can receive only 4 messages per second. - -![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/channels2.png) - -As you can see, the  _timerISR_  lights the yellow LED which means there is no space in the channel. - -This is where I finish the first part of this article. You should know that this part didn’t show you the most important thing in Go language,  _interfaces_ . - -Goroutines and channels are only nice and convenient syntax. You can replace them with your own code - not easy but feasible. Interfaces are the essence of Go, and that’s what I will start with in the [second part][14] of this article. - -We still have some free space on Flash. - --------------------------------------------------------------------------------- - -via: https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html - -作者:[ Michał Derkacz][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://ziutek.github.io/ -[1]:https://en.wikipedia.org/wiki/ARM_Cortex-M#Cortex-M0 -[2]:https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html -[3]:http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32f0-series/stm32f0x0-value-line/stm32f030f4.html -[4]:https://golang.org/ -[5]:https://github.com/ziutek/emgo -[6]:https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/hal -[7]:http://www.st.com/resource/en/reference_manual/dm00091010.pdf -[8]:https://github.com/ziutek/emgo -[9]:https://en.wikipedia.org/wiki/APNG -[10]:http://apngasm.sourceforge.net/ -[11]:https://blog.golang.org/share-memory-by-communicating -[12]:http://infocenter.arm.com/help/topic/com.arm.doc.ddi0432c/Cihbecee.html -[13]:https://golang.org/ref/spec#Select_statements -[14]:https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html diff --git a/sources/tech/20180507 Multinomial Logistic Classification.md b/sources/tech/20180507 Multinomial Logistic Classification.md new file mode 100644 index 0000000000..01fb7b2e90 --- /dev/null +++ b/sources/tech/20180507 Multinomial Logistic Classification.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Multinomial Logistic Classification) +[#]: via: (https://www.jtolio.com/2018/05/multinomial-logistic-classification) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Multinomial Logistic Classification +====== + +_This article was originally a problem I wrote for a coding competition I hosted, Vivint’s 2017 Game of Codes (now offline). The goal of this problem was not only to be a fun challenge but also to teach contestants almost everything they needed to know to build a neural network from scratch. I thought it might be neat to revive on my site! If machine learning is still scary sounding and foreign to you, you should feel much more at ease after working through this problem. I left out the details of [back-propagation][1], and a single-layer neural network isn’t really a neural network, but in this problem you can learn how to train and run a complete model! There’s lots of maybe scary-looking math but honestly if you can [multiply matrices][2] you should be fine._ + +In this problem, you’re going to build and train a machine learning model… from scratch! Don’t be intimidated - it will be much easier than it sounds! + +### What is machine learning? + +_Machine learning_ is a broad and growing range of topics, but essentially the idea is to teach the computer how to find patterns in large amounts of data, then use those patterns to make predictions. Surprisingly, the techniques that have been developed allow computers to translate languages, drive cars, recognize cats, synthesize voice, understand your music tastes, cure diseases, and even adjust your thermostat! + +You might be surprised to learn that since about 2010, the entire artificial intelligence and machine learning community has reorganized around a surprisingly small and common toolbox for all of these problems. So, let’s dive in to this toolbox! + +### Classification + +One of the most fundamental ways of solving problems in machine learning is by recasting problems as _classification_ problems. In other words, if you can describe a problem as data that needs labels, you can use machine learning! + +Machine learning will go through a phase of _training_, where data and existing labels are provided to the system. As a motivating example, imagine you have a large collection of photos that either contain hot dogs or don’t. Some of your photos have already been labeled if they contain a hot dog or not, but the other photos we want to build a system that will automatically label them “hotdog” or “nothotdog.” During training, we attempt to build a model of what exactly the essence of each label is. In this case, we will run all of our existing labeled photos through the system so it can learn what makes a hot dog a hot dog. + +After training, we run the unseen photos through the model and use the model to generate classifications. If you provide a new photo to your hotdog/nothotdog model, your model should be able to tell you if the photo contains a hot dog, assuming your model had a good training data set and was able to capture the core concept of what a hot dog is. + +Many different types of problems can be described as classification problems. As an example, perhaps you want to predict which word comes next in a sequence. Given four input words, a classifier can label those four words as “likely the fourth word follows the last three words” or “not likely.” Alternatively, the classification label for three words could be the most likely word to follow those three. + +### How I learned to stop worrying and love multinomial logistic classification + +Okay, let’s do the simplest thing we can think of to take input data and classify it. + +Let’s imagine our data that we want to classify is a big list of values. If what we have is a 16 by 16 pixel picture, we’re going to just put all the pixels in one big row so we have 256 pixel values in a row. So we’ll say \\(\mathbf{x}\\) is a vector in 256 dimensions, and each dimension is the pixel value. + +We have two labels, “hotdog” and “nothotdog.” Just like any other machine learning system, our system will never be 100% confident with a classification, so we will need to output confidence probabilities. The output of our system will be a two-dimensional vector, \\(\mathbf{p}\\). \\(p_0\\) will represent the probability that the input should be labeled “hotdog” and \\(p_1\\) will represent the probability that the input should be labeled “nothotdog.” + +How do we take a vector in 256 (or \\(\dim(\mathbf{x})\\)) dimensions and make something in just 2 (or \\(\dim(\mathbf{p})\\)) dimensions? Why, [matrix multiplication][2] of course! If you have a matrix with 2 rows and 256 columns, multiplying it by a 256-dimensional vector will result in a 2-dimensional one. + +Surprisingly, this is actually really close to the final construction of our classifier, but there are two problems: + + 1. If one of the input \\(\mathbf{x}\\)s is all zeros, the output will have to be zeros. But we need one of the output dimensions to not be zero! + 2. There’s nothing guaranteeing the probabilities in the output will be non-negative and all sum to 1. + + + +The first problem is easy, we add a bias vector \\(\mathbf{b}\\), turning our matrix multiplication into a standard linear equation of the form \\(\mathbf{W}\cdot\mathbf{x}+\mathbf{b}=\mathbf{y}\\). + +The second problem can be solved by using the [softmax function][3]. For a given vector \\(\mathbf{v}\\), softmax is defined as: + +In case the \\(\sum\\) scares you, \\(\sum_{j=0}^{n-1}\\) is basically a math “for loop.” All it’s saying is that we’re going to add together everything that comes after it (\\(e^{v_j}\\)) for every \\(j\\) value from 0 to \\(n-1\\). + +Softmax is a neat function! The output will be a vector where the largest dimension in the input will be the closest number to 1, no dimensions will be less than zero, and all dimensions sum to 1. Here are some examples: + +Unbelievably, these are all the building blocks you need for a linear model! Let’s put all the blocks together. If you already have \\(\mathbf{W}\cdot\mathbf{x}+\mathbf{b}=\mathbf{y}\\), your prediction \\(\mathbf{p}\\) can be found as \\(\text{softmax}\left(\mathbf{y}\right)\\). More fully, given an input \\(\mathbf{x}\\) and a trained model \\(\left(\mathbf{W},\mathbf{b}\right)\\), your prediction \\(\mathbf{p}\\) is: + +Once again, in this context, \\(p_0\\) is the probability given the model that the input should be labeled “hotdog” and \\(p_1\\) is the probability given the model that the input should be labeled “nothotdog.” + +It’s kind of amazing that all you need for good success with things even as complex as handwriting recognition is a linear model such as this one. + +### Scoring + +How do we find \\(\mathbf{W}\\) and \\(\mathbf{b}\\)? It might surprise you but we’re going to start off by guessing some random numbers and then changing them until we aren’t predicting things too badly (via a process known as [gradient descent][4]). But what does “too badly” mean? + +Recall that we have data that we’ve already labeled. We already have photos labeled “hotdog” and “nothotdog” in what’s called our _training set_. For each photo, we’re going to take whatever our current model is (\\(\mathbf{W}\\) and \\(\mathbf{b}\\)) and find \\(\mathbf{p}\\). Perhaps for one photo (that really is of a hot dog) our \\(\mathbf{p}\\) looks like this: + +This isn’t great! Our model says that the photo should be labeled “nothotdog” with 60% probability, but it is a hot dog. + +We need a bit more terminology. So far, we’ve only talked about one sample, one label, and one prediction at a time, but obviously we have lots of samples, lots of labels, and lots of predictions, and we want to score how our model does not just on one sample, but on all of our training samples. Assume we have \\(s\\) training samples, each sample has \\(d\\) dimensions, and there are \\(l\\) labels. In the case of our 16 by 16 pixel hot dog photos, \\(d = 256\\) and \\(l = 2\\). We’ll refer to sample \\(i\\) as \\(\mathbf{x}^{(i)}\\), our prediction for sample \\(i\\) as \\(\mathbf{p}^{(i)}\\), and the correct label vector for sample \\(i\\) as \\(\mathbf{L}^{(i)}\\). \\(\mathbf{L}^{(i)}\\) is a vector that is all zeros except for the dimension corresponding to the correct label, where that dimension is a 1. In other words, we have \\(\mathbf{W}\cdot\mathbf{x}^{(i)}+\mathbf{b} = \mathbf{p}^{(i)}\\) and we want \\(\mathbf{p}^{(i)}\\) to be as close to \\(\mathbf{L}^{(i)}\\) as possible, for all \\(s\\) samples. + +To score our model, we’re going to compute something called the _average cross entropy loss_. In general, [loss][5] is used to mean how off the mark a machine learning model is. While there are many ways of calculating loss, we’re going to use average [cross entropy][6] because it has some nice properties. + +Here’s the definition of the average cross entropy loss across all samples: + +All we need to do is find \\(\mathbf{W}\\) and \\(\mathbf{b}\\) that make this loss smallest. How do we do that? + +### Training + +As we said before, we will start \\(\mathbf{W}\\) and \\(\mathbf{b}\\) off with random values. For each value, choose a floating-point random number between -1 and 1. + +Of course, we’ll need to correct these values given the training data, and we now have enough information to describe how we will back-propagate corrections. + +The plan is to process all of the training data enough times that the loss drops to an “acceptable level.” Each time through the training data we’ll collect all of the predictions, and at the end we’ll update \\(\mathbf{W}\\) and \\(\mathbf{b}\\) with the information we’ve found. + +One problem that can occur is that your model might overcorrect after each run. A simple way to limit overcorrection some is to add a “learning rate”, usually designated \\(\alpha\\), which is some small fraction. You get to choose the learning rate! A good default choice for \\(\alpha\\) is 0.1. + +At the end of each run through all of the training data, here’s how you update \\(\mathbf{W}\\) and \\(\mathbf{b}\\): + +Just because this syntax is starting to get out of hand, let’s refresh what each symbol means. + + * \\(W_{m,n}\\) is the cell in weight matrix \\(\mathbf{W}\\) at row \\(m\\) and column \\(n\\). + * \\(b_m\\) is the \\(m\\)-th dimension in the “bias” vector \\(\mathbf{b}\\). + * \\(\alpha\\) is again your learning rate, 0.1, and \\(s\\) is how many training samples you have. + * \\(x_n^{(i)}\\) is the \\(n\\)-th dimension of sample \\(i\\). + * Likewise, \\(p_m^{(i)}\\) and \\(L_m^{(i)}\\) are the \\(m\\)-th dimensions of our prediction and true labels for sample \\(i\\), respectively. Remember that for each sample \\(i\\), \\(L_m^{(i)}\\) is zero for all but the dimension corresponding to the correct label, where it is 1. + + + +If you’re curious how we got these equations, we applied the [chain rule][7] to calculate partial derivatives of the total loss. It’s hairy, and this problem description is already too long! + +Anyway, once you’ve updated your \\(\mathbf{W}\\) and \\(\mathbf{b}\\), you start the whole process over! + +### When do we stop? + +Knowing when to stop is a hard problem. How low your loss goes is a function of your learning rate, how many iterations you run over your training data, and a huge number of other factors. On the flip side, if you train your model so your loss is too low, you run the risk of overfitting your model to your training data, so it won’t work well on data it hasn’t seen before. + +One of the more common ways of deciding when to [stop training][8] is to have a separate validation set of samples we check our success on and stop when we stop improving. But for this problem, to keep things simple what we’re going to do is just keep track of how our loss changes and stop when the loss stops changing as much. + +After the first 10 iterations, your loss will have changed 9 times (there was no change from the first time since it was the first time). Take the average of those 9 changes and stop training when your loss change is less than a hundredth the average loss change. + +### Tie it all together + +Alright! If you’ve stuck with me this far, you’ve learned to implement a multinomial logistic classifier using gradient descent, [back-propagation][1], and [one-hot encoding][9]. Good job! + +You should now be able to write a program that takes labeled training samples, trains a model, then takes unlabeled test samples and predicts labels for them! + +### Your program + +As input your program should take vectors of floating-point values, followed by a label. Some of the labels will be question marks. Your program should output the correct label for all of the question marks it sees. The label your program should output will always be one it has seen training examples of. + +Your program will pass the tests if it labels 75% or more of the unlabeled data correctly. + +### Where to learn more + +If you want to learn more or dive deeper into optimizing your solution, you may be interested in the first section of [Udacity’s free course on Deep Learning][10], or [Dom Luma’s tutorial on building a mini-TensorFlow][11]. + +### Example + +#### Input + +``` + 0.93 -1.52 1.32 0.05 1.72 horse + 1.57 -1.74 0.92 -1.33 -0.68 staple + 0.18 1.24 -1.53 1.53 0.78 other + 1.96 -1.29 -1.50 -0.19 1.47 staple + 1.24 0.15 0.73 -0.22 1.15 battery + 1.41 -1.56 1.04 1.09 0.66 horse +-0.70 -0.93 -0.18 0.75 0.88 horse + 1.12 -1.45 -1.26 -0.43 -0.05 staple + 1.89 0.21 -1.45 0.47 0.62 other +-0.60 -1.87 0.82 -0.66 1.86 staple +-0.80 -1.99 1.74 0.65 1.46 horse +-0.03 1.35 0.11 -0.92 -0.04 battery +-0.24 -0.03 0.58 1.32 -1.51 horse +-0.60 -0.70 1.61 0.56 -0.66 horse + 1.29 -0.39 -1.57 -0.45 1.63 staple + 0.87 1.59 -1.61 -1.79 1.47 battery + 1.86 1.92 0.83 -0.34 1.06 battery +-1.09 -0.81 1.47 1.82 0.06 horse +-0.99 -1.00 -1.45 -1.02 -1.06 staple +-0.82 -0.56 0.82 0.79 -1.02 horse +-1.86 0.77 -0.58 0.82 -1.94 other + 0.15 1.18 -0.87 0.78 2.00 other + 1.18 0.79 1.08 -1.65 -0.73 battery + 0.37 1.78 0.01 0.06 -0.50 other +-0.35 0.31 1.18 -1.83 -0.57 battery + 0.91 1.14 -1.85 0.39 0.07 other +-1.61 0.28 -0.31 0.93 0.77 other +-0.11 -1.75 -1.66 -1.55 -0.79 staple + 0.05 1.03 -0.23 1.49 1.66 other +-1.99 0.43 -0.99 1.72 0.52 other +-0.30 0.40 -0.70 0.51 0.07 other +-0.54 1.92 -1.13 -1.53 1.73 battery +-0.52 0.44 -0.84 -0.11 0.10 battery +-1.00 -1.82 -1.19 -0.67 -1.18 staple +-1.81 0.10 -1.64 -1.47 -1.86 battery +-1.77 0.53 -1.28 0.55 -1.15 other + 0.29 -0.28 -0.41 0.70 1.80 horse +-0.91 0.02 1.60 -1.44 -1.89 battery + 1.24 -0.42 -1.30 -0.80 -0.54 staple +-1.98 -1.15 0.54 -0.14 -1.24 staple + 1.26 -1.02 -1.08 -1.27 1.65 ? + 1.97 1.14 0.51 0.96 -0.36 ? + 0.99 0.14 -0.97 -1.90 -0.87 ? + 1.54 -1.83 1.59 1.98 -0.41 ? +-1.81 0.34 -0.83 0.90 -1.60 ? +``` + +#### Output + +``` +staple +other +battery +horse +other +``` + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2018/05/multinomial-logistic-classification + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Backpropagation +[2]: https://en.wikipedia.org/wiki/Matrix_multiplication +[3]: https://en.wikipedia.org/wiki/Softmax_function +[4]: https://en.wikipedia.org/wiki/Gradient_descent +[5]: https://en.wikipedia.org/wiki/Loss_function +[6]: https://en.wikipedia.org/wiki/Cross_entropy +[7]: https://en.wikipedia.org/wiki/Chain_rule +[8]: https://en.wikipedia.org/wiki/Early_stopping +[9]: https://en.wikipedia.org/wiki/One-hot +[10]: https://classroom.udacity.com/courses/ud730 +[11]: https://nbviewer.jupyter.org/github/domluna/labs/blob/master/Build%20Your%20Own%20TensorFlow.ipynb diff --git a/sources/tech/20180704 BASHing data- Truncated data items.md b/sources/tech/20180704 BASHing data- Truncated data items.md deleted file mode 100644 index 33a9dd636b..0000000000 --- a/sources/tech/20180704 BASHing data- Truncated data items.md +++ /dev/null @@ -1,107 +0,0 @@ -BASHing data: Truncated data items -====== -### Truncated data items - -**truncated** (adj.): abbreviated, abridged, curtailed, cut off, clipped, cropped, trimmed... - -One way to truncate a data item is to enter it into a database field that has a character limit shorter than the data item. For example, the string - ->Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE of Yermo CA - -is 60 characters long. If you enter it into a "Locality" field with a 50-character limit, you get - ->Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE #Ends with a whitespace - -Truncations can also be data entry errors. You meant to enter - ->Sally Ann Hunter (aka Sally Cleveland) - -but you forgot the closing bracket - ->Sally Ann Hunter (aka Sally Cleveland - -leaving the data user to wonder whether Sally has other aliases that were trimmed off the data item. - -Truncated data items are very difficult to detect. When auditing data I use three different methods to find possible truncations, but I probably miss some. - -**Item length distribution.** The first method catches most of the truncations I find in individual fields. I pass the field to an AWK command that tallies up data items by field width, then I use **sort** to print the tallies in reverse order of width. For example, to check field 33 in the tab-separated file "midges": - -``` -awk -F"\t" 'NR>1 {a[length($33)]++} \ -END {for (i in a) print i FS a[i]}' midges | sort -nr -``` - -![distro1][1] - -The longest entries have exactly 50 characters, which is suspicious, and there's a "bulge" of data items at that width, which is even more suspicious. Inspection of those 50-character-wide items reveals truncations: - -![distro2][2] - -Other tables I've checked this way had bulges at 100, 200 and 255 characters. In each case the bulges contained apparent truncations. - -**Unmatched brackets**. The second method looks for data items like "...(Sally Cleveland" above. A good starting point is a tally of all the punctuation in the data table. Here I'm checking the file "mag2": - -grep -o "[[:punct:]]" file | sort | uniqc - -![punct][3] - -Note that the numbers of opening and closing round brackets in "mag2" aren't equal. To see what's going on, I use the function "unmatched", which takes three arguments and checks all fields in a data table. The first argument is the filename and the second and third are the opening and closing brackets, enclosed in quotes. - -``` -unmatched() -{ -awk -F"\t" -v start="$2" -v end="$3" \ -'{for (i=1;i<=NF;i++) \ -if (split($i,a,start) != split($i,b,end)) \ -print "line "NR", field "i":\n"$i}' "$1" - -} -``` - -"unmatched" reports line number and field number if it finds a mismatch between opening and closing brackets in the field. It relies on AWK's **split** function, which returns the number of elements (including blank space) separated by the splitting character. This number will always be one more than the number of splitters: - -![split][4] - -Here "ummatched" checks the round brackets in "mag2" and finds some likely truncations: - -![unmatched][5] - -I use "unmatched" to locate unmatched round brackets (), square brackets [], curly brackets {} and arrows <>, but the function can be used for any paired punctuation characters. - -**Unexpected endings**. The third method looks for data items that end in a trailing space or a non-terminal punctuation mark, like a comma or a hyphen. This can be done on a single field with **cut** piped to **grep** , or in one step with AWK. Here I'm checking field 47 of the tab-separated table "herp5", and pulling out suspect data items and their line numbers: - -``` -cut -f47 herp5 | grep -n "[ ,;:-]$" - -awk -F"\t" '$47 ~ /[ ,;:-]$/ {print NR": "$47}' herp5 -``` - -![herps5][6] - -The all-fields version of the AWK command for a tab-separated file is: - -``` -awk -F"\t" '{for (i=1;i<=NF;i++) if ($i ~ /[ ,;:-]$/) \ -print "line "NR", field "i":\n"$i}' file -``` - -**Cautionary thoughts**. Truncations also appear during the validation tests I do on fields. For example, I might be checking for plausible 4-digit entries in a "Year" field, and there's a 198 that hints at 198n. Or is it 1898? Truncated data items with their lost characters are mysteries. As a data auditor I can only report (possible) character losses and suggest that the (possibly) missing characters be restored by the data compilers or managers. - --------------------------------------------------------------------------------- - -via: https://www.polydesmida.info/BASHing/2018-07-04.html - -作者:[polydesmida][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.polydesmida.info/ -[1]:https://www.polydesmida.info/BASHing/img1/2018-07-04_1.png -[2]:https://www.polydesmida.info/BASHing/img1/2018-07-04_2.png -[3]:https://www.polydesmida.info/BASHing/img1/2018-07-04_3.png -[4]:https://www.polydesmida.info/BASHing/img1/2018-07-04_4.png -[5]:https://www.polydesmida.info/BASHing/img1/2018-07-04_5.png -[6]:https://www.polydesmida.info/BASHing/img1/2018-07-04_6.png diff --git a/sources/tech/20180708 Building a Messenger App- Conversations.md b/sources/tech/20180708 Building a Messenger App- Conversations.md new file mode 100644 index 0000000000..1a5c7d251a --- /dev/null +++ b/sources/tech/20180708 Building a Messenger App- Conversations.md @@ -0,0 +1,351 @@ +[#]: collector: (lujun9972) +[#]: translator: (PsiACE) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Conversations) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversations/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Conversations +====== + +This post is the 3rd in a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + + + +In our messenger app, messages are stacked by conversations between two participants. You start a conversation providing the user you want to chat with, the conversations is created (if not exists already) and you can start sending messages to that conversations. + +On the front-end we’re interested in showing a list of the lastest conversations. There we’ll show the last message of it and the name and avatar of the other participant. + +In this post, we’ll code the endpoints to start a conversation, list the latest and find a single one. + +Inside the `main()` function add this routes. + +``` +router.HandleFunc("POST", "/api/conversations", requireJSON(guard(createConversation))) +router.HandleFunc("GET", "/api/conversations", guard(getConversations)) +router.HandleFunc("GET", "/api/conversations/:conversationID", guard(getConversation)) +``` + +These three endpoints require authentication so we use the `guard()` middleware. There is a new middleware that checks for the request content type JSON. + +### Require JSON Middleware + +``` +func requireJSON(handler http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + if ct := r.Header.Get("Content-Type"); !strings.HasPrefix(ct, "application/json") { + http.Error(w, "Content type of application/json required", http.StatusUnsupportedMediaType) + return + } + handler(w, r) + } +} +``` + +If the request isn’t JSON, it responds with a `415 Unsupported Media Type` error. + +### Create Conversation + +``` +type Conversation struct { + ID string `json:"id"` + OtherParticipant *User `json:"otherParticipant"` + LastMessage *Message `json:"lastMessage"` + HasUnreadMessages bool `json:"hasUnreadMessages"` +} +``` + +So, a conversation holds a reference to the other participant and the last message. Also has a bool field to tell if it has unread messages. + +``` +type Message struct { + ID string `json:"id"` + Content string `json:"content"` + UserID string `json:"-"` + ConversationID string `json:"conversationID,omitempty"` + CreatedAt time.Time `json:"createdAt"` + Mine bool `json:"mine"` + ReceiverID string `json:"-"` +} +``` + +Messages are for the next post, but I define the struct now since we are using it. Most of the fields are the same as the database table. We have `Mine` to tell if the message is owned by the current authenticated user and `ReceiverID` will be used to filter messanges once we add realtime capabilities. + +Lets write the HTTP handler then. It’s quite long but don’t be scared. + +``` +func createConversation(w http.ResponseWriter, r *http.Request) { + var input struct { + Username string `json:"username"` + } + defer r.Body.Close() + if err := json.NewDecoder(r.Body).Decode(&input); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + input.Username = strings.TrimSpace(input.Username) + if input.Username == "" { + respond(w, Errors{map[string]string{ + "username": "Username required", + }}, http.StatusUnprocessableEntity) + return + } + + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() + + var otherParticipant User + if err := tx.QueryRowContext(ctx, ` + SELECT id, avatar_url FROM users WHERE username = $1 + `, input.Username).Scan( + &otherParticipant.ID, + &otherParticipant.AvatarURL, + ); err == sql.ErrNoRows { + http.Error(w, "User not found", http.StatusNotFound) + return + } else if err != nil { + respondError(w, fmt.Errorf("could not query other participant: %v", err)) + return + } + + otherParticipant.Username = input.Username + + if otherParticipant.ID == authUserID { + http.Error(w, "Try start a conversation with someone else", http.StatusForbidden) + return + } + + var conversationID string + if err := tx.QueryRowContext(ctx, ` + SELECT conversation_id FROM participants WHERE user_id = $1 + INTERSECT + SELECT conversation_id FROM participants WHERE user_id = $2 + `, authUserID, otherParticipant.ID).Scan(&conversationID); err != nil && err != sql.ErrNoRows { + respondError(w, fmt.Errorf("could not query common conversation id: %v", err)) + return + } else if err == nil { + http.Redirect(w, r, "/api/conversations/"+conversationID, http.StatusFound) + return + } + + var conversation Conversation + if err = tx.QueryRowContext(ctx, ` + INSERT INTO conversations DEFAULT VALUES + RETURNING id + `).Scan(&conversation.ID); err != nil { + respondError(w, fmt.Errorf("could not insert conversation: %v", err)) + return + } + + if _, err = tx.ExecContext(ctx, ` + INSERT INTO participants (user_id, conversation_id) VALUES + ($1, $2), + ($3, $2) + `, authUserID, conversation.ID, otherParticipant.ID); err != nil { + respondError(w, fmt.Errorf("could not insert participants: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to create conversation: %v", err)) + return + } + + conversation.OtherParticipant = &otherParticipant + + respond(w, conversation, http.StatusCreated) +} +``` + +For this endpoint you do a POST request to `/api/conversations` with a JSON body containing the username of the user you want to chat with. + +So first it decodes the request body into an struct with the username. Then it validates that the username is not empty. + +``` +type Errors struct { + Errors map[string]string `json:"errors"` +} +``` + +This is the `Errors` struct. It’s just a map. If you enter an empty username you get this JSON with a `422 Unprocessable Entity` error. + +``` +{ + "errors": { + "username": "Username required" + } +} +``` + +Then, we begin an SQL transaction. We only received an username, but we need the actual user ID. So the first part of the transaction is to query for the id and avatar of that user (the other participant). If the user is not found, we respond with a `404 Not Found` error. Also, if the user happens to be the same as the current authenticated user, we respond with `403 Forbidden`. There should be two different users, not the same. + +Then, we try to find a conversation those two users have in common. We use `INTERSECT` for that. If there is one, we redirect to that conversation `/api/conversations/{conversationID}` and return there. + +If no common conversation was found, we continue by creating a new one and adding the two participants. Finally, we `COMMIT` the transaction and respond with the newly created conversation. + +### Get Conversations + +This endpoint `/api/conversations` is to get all the conversations of the current authenticated user. + +``` +func getConversations(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + + rows, err := db.QueryContext(ctx, ` + SELECT + conversations.id, + auth_user.messages_read_at < messages.created_at AS has_unread_messages, + messages.id, + messages.content, + messages.created_at, + messages.user_id = $1 AS mine, + other_users.id, + other_users.username, + other_users.avatar_url + FROM conversations + INNER JOIN messages ON conversations.last_message_id = messages.id + INNER JOIN participants other_participants + ON other_participants.conversation_id = conversations.id + AND other_participants.user_id != $1 + INNER JOIN users other_users ON other_participants.user_id = other_users.id + INNER JOIN participants auth_user + ON auth_user.conversation_id = conversations.id + AND auth_user.user_id = $1 + ORDER BY messages.created_at DESC + `, authUserID) + if err != nil { + respondError(w, fmt.Errorf("could not query conversations: %v", err)) + return + } + defer rows.Close() + + conversations := make([]Conversation, 0) + for rows.Next() { + var conversation Conversation + var lastMessage Message + var otherParticipant User + if err = rows.Scan( + &conversation.ID, + &conversation.HasUnreadMessages, + &lastMessage.ID, + &lastMessage.Content, + &lastMessage.CreatedAt, + &lastMessage.Mine, + &otherParticipant.ID, + &otherParticipant.Username, + &otherParticipant.AvatarURL, + ); err != nil { + respondError(w, fmt.Errorf("could not scan conversation: %v", err)) + return + } + + conversation.LastMessage = &lastMessage + conversation.OtherParticipant = &otherParticipant + conversations = append(conversations, conversation) + } + + if err = rows.Err(); err != nil { + respondError(w, fmt.Errorf("could not iterate over conversations: %v", err)) + return + } + + respond(w, conversations, http.StatusOK) +} +``` + +This handler just does a query to the database. It queries to the conversations table with some joins… First, to the messages table to get the last message. Then to the participants, but it adds a condition to a participant whose ID is not the one of the current authenticated user; this is the other participant. Then it joins to the users table to get his username and avatar. And finally joins with the participants again but with the contrary condition, so this participant is the current authenticated user. We compare `messages_read_at` with the message `created_at` to know whether the conversation has unread messages. And we use the message `user_id` to check if it’s “mine” or not. + +Note that this query assumes that a conversation has just two users. It only works for that scenario. Also, if you want to show a count of the unread messages, this design isn’t good. I think you could add a `unread_messages_count` `INT` field on the `participants` table and increment it each time a new message is created and reset it when the user read them. + +Then it iterates over the rows, scan each one to make an slice of conversations and respond with those at the end. + +### Get Conversation + +This endpoint `/api/conversations/{conversationID}` respond with a single conversation by its ID. + +``` +func getConversation(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + var conversation Conversation + var otherParticipant User + if err := db.QueryRowContext(ctx, ` + SELECT + IFNULL(auth_user.messages_read_at < messages.created_at, false) AS has_unread_messages, + other_users.id, + other_users.username, + other_users.avatar_url + FROM conversations + LEFT JOIN messages ON conversations.last_message_id = messages.id + INNER JOIN participants other_participants + ON other_participants.conversation_id = conversations.id + AND other_participants.user_id != $1 + INNER JOIN users other_users ON other_participants.user_id = other_users.id + INNER JOIN participants auth_user + ON auth_user.conversation_id = conversations.id + AND auth_user.user_id = $1 + WHERE conversations.id = $2 + `, authUserID, conversationID).Scan( + &conversation.HasUnreadMessages, + &otherParticipant.ID, + &otherParticipant.Username, + &otherParticipant.AvatarURL, + ); err == sql.ErrNoRows { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } else if err != nil { + respondError(w, fmt.Errorf("could not query conversation: %v", err)) + return + } + + conversation.ID = conversationID + conversation.OtherParticipant = &otherParticipant + + respond(w, conversation, http.StatusOK) +} +``` + +The query is quite similar. We’re not interested in showing the last message, so we omit those fields, but we need the message to know whether the conversation has unread messages. This time we do a `LEFT JOIN` instead of an `INNER JOIN` because the `last_message_id` is `NULLABLE`; in other case we won’t get any rows. We use an `IFNULL` in the `has_unread_messages` comparison for that reason too. Lastly, we filter by ID. + +If the query returns no rows, we respond with a `404 Not Found` error, otherwise `200 OK` with the found conversation. + +* * * + +Yeah, that concludes with the conversation endpoints. + +Wait for the next post to create and list messages 👋 + +[Souce Code][3] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ + +作者:[Nicolás Parada][a] +选题:[lujun9972][b] +译者:[PsiACE](https://github.com/PsiACE) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/sources/tech/20180710 Building a Messenger App- Messages.md new file mode 100644 index 0000000000..55e596df64 --- /dev/null +++ b/sources/tech/20180710 Building a Messenger App- Messages.md @@ -0,0 +1,315 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Messages) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-messages/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Messages +====== + +This post is the 4th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + + + +In this post we’ll code the endpoints to create a message and list them, also an endpoint to update the last time the participant read messages. Start by adding these routes in the `main()` function. + +``` +router.HandleFunc("POST", "/api/conversations/:conversationID/messages", requireJSON(guard(createMessage))) +router.HandleFunc("GET", "/api/conversations/:conversationID/messages", guard(getMessages)) +router.HandleFunc("POST", "/api/conversations/:conversationID/read_messages", guard(readMessages)) +``` + +Messages goes into conversations so the endpoint includes the conversation ID. + +### Create Message + +This endpoint handles POST requests to `/api/conversations/{conversationID}/messages` with a JSON body with just the message content and return the newly created message. It has two side affects: it updates the conversation `last_message_id` and updates the participant `messages_read_at`. + +``` +func createMessage(w http.ResponseWriter, r *http.Request) { + var input struct { + Content string `json:"content"` + } + defer r.Body.Close() + if err := json.NewDecoder(r.Body).Decode(&input); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + errs := make(map[string]string) + input.Content = removeSpaces(input.Content) + if input.Content == "" { + errs["content"] = "Message content required" + } else if len([]rune(input.Content)) > 480 { + errs["content"] = "Message too long. 480 max" + } + if len(errs) != 0 { + respond(w, Errors{errs}, http.StatusUnprocessableEntity) + return + } + + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() + + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } + + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } + + var message Message + if err := tx.QueryRowContext(ctx, ` + INSERT INTO messages (content, user_id, conversation_id) VALUES + ($1, $2, $3) + RETURNING id, created_at + `, input.Content, authUserID, conversationID).Scan( + &message.ID, + &message.CreatedAt, + ); err != nil { + respondError(w, fmt.Errorf("could not insert message: %v", err)) + return + } + + if _, err := tx.ExecContext(ctx, ` + UPDATE conversations SET last_message_id = $1 + WHERE id = $2 + `, message.ID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update conversation last message ID: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to create a message: %v", err)) + return + } + + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() + + message.Content = input.Content + message.UserID = authUserID + message.ConversationID = conversationID + // TODO: notify about new message. + message.Mine = true + + respond(w, message, http.StatusCreated) +} +``` + +First, it decodes the request body into an struct with the message content. Then, it validates the content is not empty and has less than 480 characters. + +``` +var rxSpaces = regexp.MustCompile("\\s+") + +func removeSpaces(s string) string { + if s == "" { + return s + } + + lines := make([]string, 0) + for _, line := range strings.Split(s, "\n") { + line = rxSpaces.ReplaceAllLiteralString(line, " ") + line = strings.TrimSpace(line) + if line != "" { + lines = append(lines, line) + } + } + return strings.Join(lines, "\n") +} +``` + +This is the function to remove spaces. It iterates over each line, remove more than two consecutives spaces and returns with the non empty lines. + +After the validation, it starts an SQL transaction. First, it queries for the participant existance in the conversation. + +``` +func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversationID string) (bool, error) { + if ctx == nil { + ctx = context.Background() + } + var exists bool + if err := tx.QueryRowContext(ctx, `SELECT EXISTS ( + SELECT 1 FROM participants + WHERE user_id = $1 AND conversation_id = $2 + )`, userID, conversationID).Scan(&exists); err != nil { + return false, err + } + return exists, nil +} +``` + +I extracted it into a function because it’s reused later. + +If the user isn’t participant of the conversation, we return with a `404 Not Found` error. + +Then, it inserts the message and updates the conversation `last_message_id`. Since this point, `last_message_id` cannot by `NULL` because we don’t allow removing messages. + +Then it commits the transaction and we update the participant `messages_read_at` in a goroutine. + +``` +func updateMessagesReadAt(ctx context.Context, userID, conversationID string) error { + if ctx == nil { + ctx = context.Background() + } + + if _, err := db.ExecContext(ctx, ` + UPDATE participants SET messages_read_at = now() + WHERE user_id = $1 AND conversation_id = $2 + `, userID, conversationID); err != nil { + return err + } + return nil +} +``` + +Before responding with the new message, we must notify about it. This is for the realtime part we’ll code in the next post so I left a comment there. + +### Get Messages + +This endpoint handles GET requests to `/api/conversations/{conversationID}/messages`. It responds with a JSON array with all the messages in the conversation. It also has the same side affect of updating the participant `messages_read_at`. + +``` +func getMessages(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() + + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } + + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } + + rows, err := tx.QueryContext(ctx, ` + SELECT + id, + content, + created_at, + user_id = $1 AS mine + FROM messages + WHERE messages.conversation_id = $2 + ORDER BY messages.created_at DESC + `, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query messages: %v", err)) + return + } + defer rows.Close() + + messages := make([]Message, 0) + for rows.Next() { + var message Message + if err = rows.Scan( + &message.ID, + &message.Content, + &message.CreatedAt, + &message.Mine, + ); err != nil { + respondError(w, fmt.Errorf("could not scan message: %v", err)) + return + } + + messages = append(messages, message) + } + + if err = rows.Err(); err != nil { + respondError(w, fmt.Errorf("could not iterate over messages: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to get messages: %v", err)) + return + } + + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() + + respond(w, messages, http.StatusOK) +} +``` + +First, it begins an SQL transaction in readonly mode. Checks for the participant existance and queries all the messages. In each message, we use the current authenticated user ID to know whether the user owns the message (`mine`). Then it commits the transaction, updates the participant `messages_read_at` in a goroutine and respond with the messages. + +### Read Messages + +This endpoint handles POST requests to `/api/conversations/{conversationID}/read_messages`. Without any request or response body. In the frontend we’ll make this request each time a new message arrive in the realtime stream. + +``` +func readMessages(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + if err := updateMessagesReadAt(ctx, authUserID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update messages read at: %v", err)) + return + } + + w.WriteHeader(http.StatusNoContent) +} +``` + +It uses the same function we’ve been using to update the participant `messages_read_at`. + +* * * + +That concludes it. Realtime messages is the only part left in the backend. Wait for it in the next post. + +[Souce Code][4] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-messages/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md new file mode 100644 index 0000000000..71479495b2 --- /dev/null +++ b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Realtime Messages) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Realtime Messages +====== + +This post is the 5th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + + + +For realtime messages we’ll use [Server-Sent Events][5]. This is an open connection in which we can stream data. We’ll have and endpoint in which the user subscribes to all the messages sended to him. + +### Message Clients + +Before the HTTP part, let’s code a map to have all the clients listening for messages. Initialize this globally like so: + +``` +type MessageClient struct { + Messages chan Message + UserID string +} + +var messageClients sync.Map +``` + +### New Message Created + +Remember in the [last post][4] when we created the message, we left a “TODO” comment. There we’ll dispatch a goroutine with this function. + +``` +go messageCreated(message) +``` + +Insert that line just where we left the comment. + +``` +func messageCreated(message Message) error { + if err := db.QueryRow(` + SELECT user_id FROM participants + WHERE user_id != $1 and conversation_id = $2 + `, message.UserID, message.ConversationID). + Scan(&message.ReceiverID); err != nil { + return err + } + + go broadcastMessage(message) + + return nil +} + +func broadcastMessage(message Message) { + messageClients.Range(func(key, _ interface{}) bool { + client := key.(*MessageClient) + if client.UserID == message.ReceiverID { + client.Messages <- message + } + return true + }) +} +``` + +The function queries for the recipient ID (the other participant ID) and sends the message to all the clients. + +### Subscribe to Messages + +Lets go to the `main()` function and add this route: + +``` +router.HandleFunc("GET", "/api/messages", guard(subscribeToMessages)) +``` + +This endpoint handles GET requests on `/api/messages`. The request should be an [EventSource][6] connection. It responds with an event stream in which the data is JSON formatted. + +``` +func subscribeToMessages(w http.ResponseWriter, r *http.Request) { + if a := r.Header.Get("Accept"); !strings.Contains(a, "text/event-stream") { + http.Error(w, "This endpoint requires an EventSource connection", http.StatusNotAcceptable) + return + } + + f, ok := w.(http.Flusher) + if !ok { + respondError(w, errors.New("streaming unsupported")) + return + } + + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + + h := w.Header() + h.Set("Cache-Control", "no-cache") + h.Set("Connection", "keep-alive") + h.Set("Content-Type", "text/event-stream") + + messages := make(chan Message) + defer close(messages) + + client := &MessageClient{Messages: messages, UserID: authUserID} + messageClients.Store(client, nil) + defer messageClients.Delete(client) + + for { + select { + case <-ctx.Done(): + return + case message := <-messages: + if b, err := json.Marshal(message); err != nil { + log.Printf("could not marshall message: %v\n", err) + fmt.Fprintf(w, "event: error\ndata: %v\n\n", err) + } else { + fmt.Fprintf(w, "data: %s\n\n", b) + } + f.Flush() + } + } +} +``` + +First it checks for the correct request headers and checks the server supports streaming. We create a channel of messages to make a client and store it in the clients map. Each time a new message is created, it will go in this channel, so we can read from it with a `for-select` loop. + +Server-Sent Events uses this format to send data: + +``` +data: some data here\n\n +``` + +We are sending it in JSON format: + +``` +data: {"foo":"bar"}\n\n +``` + +We are using `fmt.Fprintf()` to write to the response writter in this format and flushing the data in each iteration of the loop. + +This will loop until the connection is closed using the request context. We defered the close of the channel and the delete of the client, so when the loop ends, the channel will be closed and the client won’t receive more messages. + +Note aside, the JavaScript API to work with Server-Sent Events (EventSource) doesn’t support setting custom headers 😒 So we cannot set `Authorization: Bearer `. And that’s the reason why the `guard()` middleware reads the token from the URL query string also. + +* * * + +That concludes the realtime messages. I’d like to say that’s everything in the backend, but to code the frontend I’ll add one more endpoint to login. A login that will be just for development. + +[Souce Code][7] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events +[6]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource +[7]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180712 Building a Messenger App- Development Login.md b/sources/tech/20180712 Building a Messenger App- Development Login.md new file mode 100644 index 0000000000..e12fb3c56a --- /dev/null +++ b/sources/tech/20180712 Building a Messenger App- Development Login.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Development Login) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-dev-login/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Development Login +====== + +This post is the 6th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + + + +We already implemented login through GitHub, but if we want to play around with the app, we need a couple of users to test it. In this post we’ll add an endpoint to login as any user just giving an username. This endpoint will be just for development. + +Start by adding this route in the `main()` function. + +``` +router.HandleFunc("POST", "/api/login", requireJSON(login)) +``` + +### Login + +This function handles POST requests to `/api/login` with a JSON body with just an username and returns the authenticated user, a token and expiration date of it in JSON format. + +``` +func login(w http.ResponseWriter, r *http.Request) { + if origin.Hostname() != "localhost" { + http.NotFound(w, r) + return + } + + var input struct { + Username string `json:"username"` + } + if err := json.NewDecoder(r.Body).Decode(&input); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + defer r.Body.Close() + + var user User + if err := db.QueryRowContext(r.Context(), ` + SELECT id, avatar_url + FROM users + WHERE username = $1 + `, input.Username).Scan( + &user.ID, + &user.AvatarURL, + ); err == sql.ErrNoRows { + http.Error(w, "User not found", http.StatusNotFound) + return + } else if err != nil { + respondError(w, fmt.Errorf("could not query user: %v", err)) + return + } + + user.Username = input.Username + + exp := time.Now().Add(jwtLifetime) + token, err := issueToken(user.ID, exp) + if err != nil { + respondError(w, fmt.Errorf("could not create token: %v", err)) + return + } + + respond(w, map[string]interface{}{ + "authUser": user, + "token": token, + "expiresAt": exp, + }, http.StatusOK) +} +``` + +First it checks we are on localhost or it responds with `404 Not Found`. It decodes the body skipping validation since this is just for development. Then it queries to the database for a user with the given username, if none is found, it returns with `404 Not Found`. Then it issues a new JSON web token using the user ID as Subject. + +``` +func issueToken(subject string, exp time.Time) (string, error) { + token, err := jwtSigner.Encode(jwt.Claims{ + Subject: subject, + Expiration: json.Number(strconv.FormatInt(exp.Unix(), 10)), + }) + if err != nil { + return "", err + } + return string(token), nil +} +``` + +The function does the same we did [previously][2]. I just moved it to reuse code. + +After creating the token, it responds with the user, token and expiration date. + +### Seed Users + +Now you can add users to play with to the database. + +``` +INSERT INTO users (id, username) VALUES + (1, 'john'), + (2, 'jane'); +``` + +You can save it to a file and pipe it to the Cockroach CLI. + +``` +cat seed_users.sql | cockroach sql --insecure -d messenger +``` + +* * * + +That’s it. Once you deploy the code to production and use your own domain this login function won’t be available. + +This post concludes the backend. + +[Souce Code][6] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180716 Building a Messenger App- Access Page.md b/sources/tech/20180716 Building a Messenger App- Access Page.md new file mode 100644 index 0000000000..21671b92f6 --- /dev/null +++ b/sources/tech/20180716 Building a Messenger App- Access Page.md @@ -0,0 +1,459 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Access Page) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-access-page/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Access Page +====== + +This post is the 7th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + * [Part 6: Development Login][6] + + + +Now that we’re done with the backend, lets move to the frontend. I will go with a single-page application. + +Lets start by creating a file `static/index.html` with the following content. + +``` + + + + + + Messenger + + + + + + +``` + +This HTML file must be server for every URL and JavaScript will take care of rendering the correct page. + +So lets go the the `main.go` for a moment and in the `main()` function add the following route: + +``` +router.Handle("GET", "/...", http.FileServer(SPAFileSystem{http.Dir("static")})) + +type SPAFileSystem struct { + fs http.FileSystem +} + +func (spa SPAFileSystem) Open(name string) (http.File, error) { + f, err := spa.fs.Open(name) + if err != nil { + return spa.fs.Open("index.html") + } + return f, nil +} +``` + +We use a custom file system so instead of returning `404 Not Found` for unknown URLs, it serves the `index.html`. + +### Router + +In the `index.html` we loaded two files: `styles.css` and `main.js`. I leave styling to your taste. + +Lets move to `main.js`. Create a `static/main.js` file with the following content: + +``` +import { guard } from './auth.js' +import Router from './router.js' + +let currentPage +const disconnect = new CustomEvent('disconnect') +const router = new Router() + +router.handle('/', guard(view('home'), view('access'))) +router.handle('/callback', view('callback')) +router.handle(/^\/conversations\/([^\/]+)$/, guard(view('conversation'), view('access'))) +router.handle(/^\//, view('not-found')) + +router.install(async result => { + document.body.innerHTML = '' + if (currentPage instanceof Node) { + currentPage.dispatchEvent(disconnect) + } + currentPage = await result + if (currentPage instanceof Node) { + document.body.appendChild(currentPage) + } +}) + +function view(pageName) { + return (...args) => import(`/pages/${pageName}-page.js`) + .then(m => m.default(...args)) +} +``` + +If you are follower of this blog, you already know how this works. That router is the one showed [here][7]. Just download it from [@nicolasparada/router][8] and save it to `static/router.js`. + +We registered four routes. At the root `/` we show the home or access page whether the user is authenticated. At `/callback` we show the callback page. On `/conversations/{conversationID}` we show the conversation or access page whether the user is authenticated and for every other URL, we show a not found page. + +We tell the router to render the result to the document body and dispatch a `disconnect` event to each page before leaving. + +We have each page in a different file and we import them with the new dynamic `import()`. + +### Auth + +`guard()` is a function that given two functions, executes the first one if the user is authenticated, or the sencond one if not. It comes from `auth.js` so lets create a `static/auth.js` file with the following content: + +``` +export function isAuthenticated() { + const token = localStorage.getItem('token') + const expiresAtItem = localStorage.getItem('expires_at') + if (token === null || expiresAtItem === null) { + return false + } + + const expiresAt = new Date(expiresAtItem) + if (isNaN(expiresAt.valueOf()) || expiresAt <= new Date()) { + return false + } + + return true +} + +export function guard(fn1, fn2) { + return (...args) => isAuthenticated() + ? fn1(...args) + : fn2(...args) +} + +export function getAuthUser() { + if (!isAuthenticated()) { + return null + } + + const authUser = localStorage.getItem('auth_user') + if (authUser === null) { + return null + } + + try { + return JSON.parse(authUser) + } catch (_) { + return null + } +} +``` + +`isAuthenticated()` checks for `token` and `expires_at` from localStorage to tell if the user is authenticated. `getAuthUser()` gets the authenticated user from localStorage. + +When we login, we’ll save all the data to localStorage so it will make sense. + +### Access Page + +![access page screenshot][9] + +Lets start with the access page. Create a file `static/pages/access-page.js` with the following content: + +``` +const template = document.createElement('template') +template.innerHTML = ` +

Messenger

+ Access with GitHub +` + +export default function accessPage() { + return template.content +} +``` + +Because the router intercepts all the link clicks to do its navigation, we must prevent the event propagation for this link in particular. + +Clicking on that link will redirect us to the backend, then to GitHub, then to the backend and then to the frontend again; to the callback page. + +### Callback Page + +Create the file `static/pages/callback-page.js` with the following content: + +``` +import http from '../http.js' +import { navigate } from '../router.js' + +export default async function callbackPage() { + const url = new URL(location.toString()) + const token = url.searchParams.get('token') + const expiresAt = url.searchParams.get('expires_at') + + try { + if (token === null || expiresAt === null) { + throw new Error('Invalid URL') + } + + const authUser = await getAuthUser(token) + + localStorage.setItem('auth_user', JSON.stringify(authUser)) + localStorage.setItem('token', token) + localStorage.setItem('expires_at', expiresAt) + } catch (err) { + alert(err.message) + } finally { + navigate('/', true) + } +} + +function getAuthUser(token) { + return http.get('/api/auth_user', { authorization: `Bearer ${token}` }) +} +``` + +The callback page doesn’t render anything. It’s an async function that does a GET request to `/api/auth_user` using the token from the URL query string and saves all the data to localStorage. Then it redirects to `/`. + +### HTTP + +There is an HTTP module. Create a `static/http.js` file with the following content: + +``` +import { isAuthenticated } from './auth.js' + +async function handleResponse(res) { + const body = await res.clone().json().catch(() => res.text()) + + if (res.status === 401) { + localStorage.removeItem('auth_user') + localStorage.removeItem('token') + localStorage.removeItem('expires_at') + } + + if (!res.ok) { + const message = typeof body === 'object' && body !== null && 'message' in body + ? body.message + : typeof body === 'string' && body !== '' + ? body + : res.statusText + throw Object.assign(new Error(message), { + url: res.url, + statusCode: res.status, + statusText: res.statusText, + headers: res.headers, + body, + }) + } + + return body +} + +function getAuthHeader() { + return isAuthenticated() + ? { authorization: `Bearer ${localStorage.getItem('token')}` } + : {} +} + +export default { + get(url, headers) { + return fetch(url, { + headers: Object.assign(getAuthHeader(), headers), + }).then(handleResponse) + }, + + post(url, body, headers) { + const init = { + method: 'POST', + headers: getAuthHeader(), + } + if (typeof body === 'object' && body !== null) { + init.body = JSON.stringify(body) + init.headers['content-type'] = 'application/json; charset=utf-8' + } + Object.assign(init.headers, headers) + return fetch(url, init).then(handleResponse) + }, + + subscribe(url, callback) { + const urlWithToken = new URL(url, location.origin) + if (isAuthenticated()) { + urlWithToken.searchParams.set('token', localStorage.getItem('token')) + } + const eventSource = new EventSource(urlWithToken.toString()) + eventSource.onmessage = ev => { + let data + try { + data = JSON.parse(ev.data) + } catch (err) { + console.error('could not parse message data as JSON:', err) + return + } + callback(data) + } + const unsubscribe = () => { + eventSource.close() + } + return unsubscribe + }, +} +``` + +This module is a wrapper around the [fetch][10] and [EventSource][11] APIs. The most important part is that it adds the JSON web token to the requests. + +### Home Page + +![home page screenshot][12] + +So, when the user login, the home page will be shown. Create a `static/pages/home-page.js` file with the following content: + +``` +import { getAuthUser } from '../auth.js' +import { avatar } from '../shared.js' + +export default function homePage() { + const authUser = getAuthUser() + const template = document.createElement('template') + template.innerHTML = ` +
+
+ ${avatar(authUser)} + ${authUser.username} +
+ +
+ + + ` + const page = template.content + page.getElementById('logout-button').onclick = onLogoutClick + return page +} + +function onLogoutClick() { + localStorage.clear() + location.reload() +} +``` + +For this post, this is the only content we render on the home page. We show the current authenticated user and a logout button. + +When the user clicks to logout, we clear all inside localStorage and do a reload of the page. + +### Avatar + +That `avatar()` function is to show the user’s avatar. Because it’s used in more than one place, I moved it to a `shared.js` file. Create the file `static/shared.js` with the following content: + +``` +export function avatar(user) { + return user.avatarUrl === null + ? `
` + : `${user.username}'s avatar` +} +``` + +We use a small figure with the user’s initial in case the avatar URL is null. + +You can show the initial with a little of CSS using the `attr()` function. + +``` +.avatar[data-initial]::after { + content: attr(data-initial); +} +``` + +### Development Login + +![access page with login form screenshot][13] + +In the previous post we coded a login for development. Lets add a form for that in the access page. Go to `static/pages/access-page.js` and modify it a little. + +``` +import http from '../http.js' + +const template = document.createElement('template') +template.innerHTML = ` +

Messenger

+
+ + +
+ Access with GitHub +` + +export default function accessPage() { + const page = template.content.cloneNode(true) + page.getElementById('login-form').onsubmit = onLoginSubmit + return page +} + +async function onLoginSubmit(ev) { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + const submitButton = form.querySelector('button') + + input.disabled = true + submitButton.disabled = true + + try { + const payload = await login(input.value) + input.value = '' + + localStorage.setItem('auth_user', JSON.stringify(payload.authUser)) + localStorage.setItem('token', payload.token) + localStorage.setItem('expires_at', payload.expiresAt) + + location.reload() + } catch (err) { + alert(err.message) + setTimeout(() => { + input.focus() + }, 0) + } finally { + input.disabled = false + submitButton.disabled = false + } +} + +function login(username) { + return http.post('/api/login', { username }) +} +``` + +I added a login form. When the user submits the form. It does a POST requets to `/api/login` with the username. Saves all the data to localStorage and reloads the page. + +Remember to remove this form once you are done with the frontend. + +* * * + +That’s all for this post. In the next one, we’ll continue with the home page to add a form to start conversations and display a list with the latest ones. + +[Souce Code][14] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/js-router/ +[8]: https://unpkg.com/@nicolasparada/router +[9]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page.png +[10]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API +[11]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource +[12]: https://nicolasparada.netlify.com/img/go-messenger-access-page/home-page.png +[13]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page-v2.png +[14]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/sources/tech/20180719 Building a Messenger App- Home Page.md new file mode 100644 index 0000000000..ddec2c180f --- /dev/null +++ b/sources/tech/20180719 Building a Messenger App- Home Page.md @@ -0,0 +1,255 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Home Page) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-home-page/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Home Page +====== + +This post is the 8th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + * [Part 6: Development Login][6] + * [Part 7: Access Page][7] + + + +Continuing the frontend, let’s finish the home page in this post. We’ll add a form to start conversations and a list with the latest ones. + +### Conversation Form + +![conversation form screenshot][8] + +In the `static/pages/home-page.js` file add some markup in the HTML view. + +``` +
+ +
+``` + +Add that form just below the section in which we displayed the auth user and logout button. + +``` +page.getElementById('conversation-form').onsubmit = onConversationSubmit +``` + +Now we can listen to the “submit” event to create the conversation. + +``` +import http from '../http.js' +import { navigate } from '../router.js' + +async function onConversationSubmit(ev) { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + + input.disabled = true + + try { + const conversation = await createConversation(input.value) + input.value = '' + navigate('/conversations/' + conversation.id) + } catch (err) { + if (err.statusCode === 422) { + input.setCustomValidity(err.body.errors.username) + } else { + alert(err.message) + } + setTimeout(() => { + input.focus() + }, 0) + } finally { + input.disabled = false + } +} + +function createConversation(username) { + return http.post('/api/conversations', { username }) +} +``` + +On submit we do a POST request to `/api/conversations` with the username and redirect to the conversation page (for the next post). + +### Conversation List + +![conversation list screenshot][9] + +In the same file, we are going to make the `homePage()` function async to load the conversations first. + +``` +export default async function homePage() { + const conversations = await getConversations().catch(err => { + console.error(err) + return [] + }) + /*...*/ +} + +function getConversations() { + return http.get('/api/conversations') +} +``` + +Then, add a list in the markup to render conversations there. + +``` +
    +``` + +Add it just below the current markup. + +``` +const conversationsOList = page.getElementById('conversations') +for (const conversation of conversations) { + conversationsOList.appendChild(renderConversation(conversation)) +} +``` + +So we can append each conversation to the list. + +``` +import { avatar, escapeHTML } from '../shared.js' + +function renderConversation(conversation) { + const messageContent = escapeHTML(conversation.lastMessage.content) + const messageDate = new Date(conversation.lastMessage.createdAt).toLocaleString() + + const li = document.createElement('li') + li.dataset['id'] = conversation.id + if (conversation.hasUnreadMessages) { + li.classList.add('has-unread-messages') + } + li.innerHTML = ` + +
    + ${avatar(conversation.otherParticipant)} + ${conversation.otherParticipant.username} +
    +
    +

    ${messageContent}

    + +
    +
    + ` + return li +} +``` + +Each conversation item contains a link to the conversation page and displays the other participant info and a preview of the last message. Also, you can use `.hasUnreadMessages` to add a class to the item and do some styling with CSS. Maybe a bolder font or accent the color. + +Note that we’re escaping the message content. That function comes from `static/shared.js`: + +``` +export function escapeHTML(str) { + return str + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') +} +``` + +That prevents displaying as HTML the message the user wrote. If the user happens to write something like: + +``` + +``` + +It would be very annoying because that script will be executed 😅 +So yeah, always remember to escape content from untrusted sources. + +### Messages Subscription + +Last but not least, I want to subscribe to the message stream here. + +``` +const unsubscribe = subscribeToMessages(onMessageArrive) +page.addEventListener('disconnect', unsubscribe) +``` + +Add that line in the `homePage()` function. + +``` +function subscribeToMessages(cb) { + return http.subscribe('/api/messages', cb) +} +``` + +The `subscribe()` function returns a function that once called it closes the underlying connection. That’s why I passed it to the “disconnect” event; so when the user leaves the page, the event stream will be closed. + +``` +async function onMessageArrive(message) { + const conversationLI = document.querySelector(`li[data-id="${message.conversationID}"]`) + if (conversationLI !== null) { + conversationLI.classList.add('has-unread-messages') + conversationLI.querySelector('a > div > p').textContent = message.content + conversationLI.querySelector('a > div > time').textContent = new Date(message.createdAt).toLocaleString() + return + } + + let conversation + try { + conversation = await getConversation(message.conversationID) + conversation.lastMessage = message + } catch (err) { + console.error(err) + return + } + + const conversationsOList = document.getElementById('conversations') + if (conversationsOList === null) { + return + } + + conversationsOList.insertAdjacentElement('afterbegin', renderConversation(conversation)) +} + +function getConversation(id) { + return http.get('/api/conversations/' + id) +} +``` + +Every time a new message arrives, we go and query for the conversation item in the DOM. If found, we add the `has-unread-messages` class to the item, and update the view. If not found, it means the message is from a new conversation created just now. We go and do a GET request to `/api/conversations/{conversationID}` to get the conversation in which the message was created and prepend it to the conversation list. + +* * * + +That covers the home page 😊 +On the next post we’ll code the conversation page. + +[Souce Code][10] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[8]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-form.png +[9]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-list.png +[10]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/sources/tech/20180720 Building a Messenger App- Conversation Page.md new file mode 100644 index 0000000000..c721b48161 --- /dev/null +++ b/sources/tech/20180720 Building a Messenger App- Conversation Page.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Conversation Page) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Conversation Page +====== + +This post is the 9th and last in a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + * [Part 6: Development Login][6] + * [Part 7: Access Page][7] + * [Part 8: Home Page][8] + + + +In this post we’ll code the conversation page. This page is the chat between the two users. At the top we’ll show info about the other participant, below, a list of the latest messages and a message form at the bottom. + +### Chat heading + +![chat heading screenshot][9] + +Let’s start by creating the file `static/pages/conversation-page.js` with the following content: + +``` +import http from '../http.js' +import { navigate } from '../router.js' +import { avatar, escapeHTML } from '../shared.js' + +export default async function conversationPage(conversationID) { + let conversation + try { + conversation = await getConversation(conversationID) + } catch (err) { + alert(err.message) + navigate('/', true) + return + } + + const template = document.createElement('template') + template.innerHTML = ` +
    + ← Back + ${avatar(conversation.otherParticipant)} + ${conversation.otherParticipant.username} +
    + + + ` + const page = template.content + return page +} + +function getConversation(id) { + return http.get('/api/conversations/' + id) +} +``` + +This page receives the conversation ID the router extracted from the URL. + +First it does a GET request to `/api/conversations/{conversationID}` to get info about the conversation. In case of error, we show it and redirect back to `/`. Then we render info about the other participant. + +### Conversation List + +![chat heading screenshot][10] + +We’ll fetch the latest messages too to display them. + +``` +let conversation, messages +try { + [conversation, messages] = await Promise.all([ + getConversation(conversationID), + getMessages(conversationID), + ]) +} +``` + +Update the `conversationPage()` function to fetch the messages too. We use `Promise.all()` to do both request at the same time. + +``` +function getMessages(conversationID) { + return http.get(`/api/conversations/${conversationID}/messages`) +} +``` + +A GET request to `/api/conversations/{conversationID}/messages` gets the latest messages of the conversation. + +``` +
      +``` + +Now, add that list to the markup. + +``` +const messagesOList = page.getElementById('messages') +for (const message of messages.reverse()) { + messagesOList.appendChild(renderMessage(message)) +} +``` + +So we can append messages to the list. We show them in reverse order. + +``` +function renderMessage(message) { + const messageContent = escapeHTML(message.content) + const messageDate = new Date(message.createdAt).toLocaleString() + + const li = document.createElement('li') + if (message.mine) { + li.classList.add('owned') + } + li.innerHTML = ` +

      ${messageContent}

      + + ` + return li +} +``` + +Each message item displays the message content itself with its timestamp. Using `.mine` we can append a different class to the item so maybe you can show the message to the right. + +### Message Form + +![chat heading screenshot][11] + +``` +
      + + +
      +``` + +Add that form to the current markup. + +``` +page.getElementById('message-form').onsubmit = messageSubmitter(conversationID) +``` + +Attach an event listener to the “submit” event. + +``` +function messageSubmitter(conversationID) { + return async ev => { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + const submitButton = form.querySelector('button') + + input.disabled = true + submitButton.disabled = true + + try { + const message = await createMessage(input.value, conversationID) + input.value = '' + const messagesOList = document.getElementById('messages') + if (messagesOList === null) { + return + } + + messagesOList.appendChild(renderMessage(message)) + } catch (err) { + if (err.statusCode === 422) { + input.setCustomValidity(err.body.errors.content) + } else { + alert(err.message) + } + } finally { + input.disabled = false + submitButton.disabled = false + + setTimeout(() => { + input.focus() + }, 0) + } + } +} + +function createMessage(content, conversationID) { + return http.post(`/api/conversations/${conversationID}/messages`, { content }) +} +``` + +We make use of [partial application][12] to have the conversation ID in the “submit” event handler. It takes the message content from the input and does a POST request to `/api/conversations/{conversationID}/messages` with it. Then prepends the newly created message to the list. + +### Messages Subscription + +To make it realtime we’ll subscribe to the message stream in this page also. + +``` +page.addEventListener('disconnect', subscribeToMessages(messageArriver(conversationID))) +``` + +Add that line in the `conversationPage()` function. + +``` +function subscribeToMessages(cb) { + return http.subscribe('/api/messages', cb) +} + +function messageArriver(conversationID) { + return message => { + if (message.conversationID !== conversationID) { + return + } + + const messagesOList = document.getElementById('messages') + if (messagesOList === null) { + return + + } + messagesOList.appendChild(renderMessage(message)) + readMessages(message.conversationID) + } +} + +function readMessages(conversationID) { + return http.post(`/api/conversations/${conversationID}/read_messages`) +} +``` + +We also make use of partial application to have the conversation ID here. +When a new message arrives, first we check if it’s from this conversation. If it is, we go a prepend a message item to the list and do a POST request to `/api/conversations/{conversationID}/read_messages` to updated the last time the participant read messages. + +* * * + +That concludes this series. The messenger app is now functional. + +~~I’ll add pagination on the conversation and message list, also user searching before sharing the source code. I’ll updated once it’s ready along with a hosted demo 👨‍💻~~ + +[Souce Code][13] • [Demo][14] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[8]: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ +[9]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/heading.png +[10]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/list.png +[11]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/form.png +[12]: https://en.wikipedia.org/wiki/Partial_application +[13]: https://github.com/nicolasparada/go-messenger-demo +[14]: https://go-messenger-demo.herokuapp.com/ diff --git a/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md b/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md deleted file mode 100644 index ec02690b6e..0000000000 --- a/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md +++ /dev/null @@ -1,143 +0,0 @@ -Top 5 CAD Software Available for Linux in 2018 -====== -[Computer Aided Design (CAD)][1] is an essential part of many streams of engineering. CAD is professionally used is architecture, auto parts design, space shuttle research, aeronautics, bridge construction, interior design, and even clothing and jewelry. - -A number of professional grade CAD software like SolidWorks and Autodesk AutoCAD are not natively supported on the Linux platform. So today we will be having a look at the top CAD software available for Linux. Let’s dive right in. - -### Best CAD Software available for Linux - -![CAD Software for Linux][2] - -Before you see the list of CAD software for Linux, you should keep one thing in mind that not all the applications listed here are open source. We included some non-FOSS CAD software to help average Linux user. - -Installation instructions of Ubuntu-based Linux distributions have been provided. You may check the respective websites to learn the installation procedure for other distributions. - -The list is not any specific order. CAD application at number one should not be considered better than the one at number three and so on. - -#### 1\. FreeCAD - -For 3D Modelling, FreeCAD is an excellent option which is both free (beer and speech) and open source. FreeCAD is built with keeping mechanical engineering and product design as target purpose. FreeCAD is multiplatform and is available on Windows, Mac OS X+ along with Linux. - -![freecad][3] - -Although FreeCAD has been the choice of many Linux users, it should be noted that FreeCAD is still on version 0.17 and therefore, is not suitable for major deployment. But the development has picked up pace recently. - -[FreeCAD][4] - -FreeCAD does not focus on direct 2D drawings and animation of organic shapes but it’s great for design related to mechanical engineering. FreeCAD version 0.15 is available in the Ubuntu repositories. You can install it by running the below command. -``` -sudo apt install freecad - -``` - -To get newer daily builds (0.17 at the moment), open a terminal (ctrl+alt+t) and run the commands below one by one. -``` -sudo add-apt-repository ppa:freecad-maintainers/freecad-daily - -sudo apt update - -sudo apt install freecad-daily - -``` - -#### 2\. LibreCAD - -LibreCAD is a free, opensource, 2D CAD solution. Generally, CAD tends to be a resource-intensive task, and if you have a rather modest hardware, then I’d suggest you go for LibreCAD as it is really lightweight in terms of resource usage. LibreCAD is a great candidate for geometric constructions. - -![librecad][5] -As a 2D tool, LibreCAD is good but it cannot work on 3D models and renderings. It might be unstable at times but it has a dependable autosave which won’t let your work go wasted. - -[LibreCAD][6] - -You can install LibreCAD by running the following command -``` -sudo apt install librecad - -``` - -#### 3\. OpenSCAD - -OpenSCAD is a free 3D CAD software. OpenSCAD is very lightweight and flexible. OpenSCAD is not interactive. You need to ‘program’ the model and OpenSCAD interprets that code to render a visual model. It is a compiler in a sense. You cannot draw the model. You describe the model. - -![openscad][7] - -OpenSCAD is the most complicated tool on this list but once you get to know it, it provides an enjoyable work experience. - -[OpenSCAD][8] - -You can use the following commands to install OpenSCAD. -``` -sudo apt-get install openscad - -``` - -#### 4\. BRL-CAD - -BRL-CAD is one of the oldest CAD tools out there. It also has been loved by Linux/UNIX users as it aligns itself with *nix philosophies of modularity and freedom. - -![BRL-CAD rendering by Sean][9] - -BRL-CAD was started in 1979, and it is still developed actively. Now, BRL-CAD is not AutoCAD but it is still a great choice for transport studies such as thermal and ballistic penetration. BRL-CAD underlies CSG instead of boundary representation. You might need to keep that in mind while opting for BRL-CAD. You can download BRL-CAD from its official website. - -[BRL-CAD][10] - -#### 5\. DraftSight (not open source) - -If You’re used to working on AutoCAD, then DraftSight would be the perfect alternative for you. - -DraftSight is a great CAD tool available on Linux. It has a rather similar workflow to AutoCAD, which makes migrating easier. It even provides a similar look and feel. DrafSight is also compatible with the .dwg file format of AutoCAD. But DrafSight is a 2D CAD software. It does not support 3D CAD as of yet. - -![draftsight][11] - -Although DrafSight is a commercial software with a starting price of $149. A free version is also made available on the[DraftSight website][12]. You can download the .deb package and install it on Ubuntu based distributions. need to register your free copy using your email ID to start using DraftSight. - -[DraftSight][12] - -#### Honorary mentions - - * With a huge growth in cloud computing technologies, cloud CAD solutions like [OnShape][13] have been getting popular day by day. - * [SolveSpace][14] is another open-source project worth mentioning. It supports 3D modeling. - * Siemens NX is an industrial grade CAD solution available on Windows, Mac OS and Linux, but it is ridiculously expensive, so omitted in this list. - * Then you have [LeoCAD][15], which is a CAD software where you use LEGO blocks to build stuff. What you do with this information is up to you. - - - -#### CAD on Linux, in my opinion - -Although gaming on Linux has picked up, I always tell my hardcore gaming friends to stick to Windows. Similarly, if You are an engineering student with CAD in your curriculum, I’d recommend that you use the software that your college prescribes (AutoCAD, SolidEdge, Catia), which generally tend to run on Windows only. - -And for the advanced professionals, these tools are simply not up to the mark when we’re talking about industry standards. - -For those of you thinking about running AutoCAD in WINE, although some older versions of AutoCAD can be installed on WINE, they simply do not perform, with glitches and crashes ruining the experience. - -That being said, I highly respect the work that has been put by the developers of the above-listed software. They have enriched the FOSS world. And it’s great to see software like FreeCAD developing with an accelerated pace in the recent years. - -Well, that’s it for today. Do share your thoughts with us using the comments section below and don’t forget to share this article. Cheers. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/cad-software-linux/ - -作者:[Aquil Roshan][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://itsfoss.com/author/aquil/ -[1]:https://en.wikipedia.org/wiki/Computer-aided_design -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cad-software-linux.jpeg -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freecad.jpg -[4]:https://www.freecadweb.org/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/librecad.jpg -[6]:https://librecad.org/ -[7]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/openscad.jpg -[8]:http://www.openscad.org/ -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/brlcad.jpg -[10]:https://brlcad.org/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/draftsight.jpg -[12]:https://www.draftsight2018.com/ -[13]:https://www.onshape.com/ -[14]:http://solvespace.com/index.pl -[15]:https://www.leocad.org/ diff --git a/sources/tech/20180906 What a shell dotfile can do for you.md b/sources/tech/20180906 What a shell dotfile can do for you.md deleted file mode 100644 index 35593e1e32..0000000000 --- a/sources/tech/20180906 What a shell dotfile can do for you.md +++ /dev/null @@ -1,238 +0,0 @@ -What a shell dotfile can do for you -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) - -Ask not what you can do for your shell dotfile, but what a shell dotfile can do for you! - -I've been all over the OS map, but for the past several years my daily drivers have been Macs. For a long time, I used Bash, but when a few friends started proselytizing [zsh][1], I gave it a shot. It didn't take long for me to appreciate it, and several years later, I strongly prefer it for many of the little things that it does. - -I've been using zsh (provided via [Homebrew][2], not the system installed), and the [Oh My Zsh enhancement][3]. - -The examples in this article are for my personal `.zshrc`. Most will work directly in Bash, and I don't believe that any rely on Oh My Zsh, but your mileage may vary. There was a period when I was maintaining a shell dotfile for both zsh and Bash, but I did eventually give up on my `.bashrc`. - -### We're all mad here - -If you want the possibility of using the same dotfile across OS's, you'll want to give your dotfile a little smarts. -``` -### Mac Specifics -if [[ "$OSTYPE" == "darwin"* ]]; then -        # Mac-specific stuff here. -fi -``` - -For instance, I expect the Alt + arrow keys to move the cursor by the word rather than by a single space. To make this happen in [iTerm2][4] (my preferred shell), I add this snippet to the Mac-specific portion of my .zshrc: -``` -### Mac Specifics -if [[ "$OSTYPE" == "darwin"* ]]; then -        ### Mac cursor commands for iTerm2; map ctrl+arrows or alt+arrows to fast-move -        bindkey -e -        bindkey '^[[1;9C' forward-word -        bindkey '^[[1;9D' backward-word -        bindkey '\e\e[D' backward-word -        bindkey '\e\e[C' forward-word -fi -``` - -### What about Bob? - -While I came to love my shell dotfile, I didn't always want the same things available on my home machines as on my work machines. One way to solve this is to have supplementary dotfiles to use at home but not at work. Here's how I accomplished this: -``` -if [[ `egrep 'dnssuffix1|dnssuffix2' /etc/resolv.conf` ]]; then -        if [ -e $HOME/.work ] -                source $HOME/.work -        else -                echo "This looks like a work machine, but I can't find the ~/.work file" -        fi -fi -``` - -In this case, I key off of my work dns suffix (or multiple suffixes, depending on your situation) and source a separate file that makes my life at work a little better. - -### That thing you do - -Now is probably a good time to quit using the tilde (`~`) to represent your home directory when writing scripts. You'll find that there are some contexts where it's not recognized. Getting in the habit of using the environment variable `$HOME` will save you a lot of troubleshooting time and headaches later on. - -The logical extension would be to have OS-specific dotfiles to include if you are so inclined. - -### Memory, all alone in the moonlight - -I've written embarrassing amounts of shell, and I've come to the conclusion that I really don't want to write more. It's not that shell can't do what I need most of the time, but I find that if I'm writing shell, I'm probably slapping together a duct-tape solution rather than permanently solving the problem. - -Likewise, I hate memorizing things, and throughout my career, I have had to do radical context shifting during the course of a day. The practical consequence is that I've had to re-learn many things several times over the years. ("Wait... which for-loop structure does this language use?") - -So, every so often I decide that I'm tired of looking up how to do something again. One way that I improve my life is by adding aliases. - -A common scenario for anyone who works with systems is finding out what's taking up all of the disk. Unfortunately, I have never been able to remember this incantation, so I made a shell alias, creatively called `bigdirs`: -``` -alias bigdirs='du --max-depth=1 2> /dev/null | sort -n -r | head -n20' -``` - -While I could be less lazy and actually memorize it, well, that's just not the Unix way... - -### Typos, and the people who love them - -Another way that using shell aliases improves my life is by saving me from typos. I don't know why, but I've developed this nasty habit of typing a `w` after the sequence `ea`, so if I want to clear my terminal, I'll often type `cleawr`. Unfortunately, that doesn't mean anything to my shell. Until I add this little piece of gold: -``` -alias cleawr='clear' -``` - -In one instance of Windows having an equivalent, but better, command, I find myself typing `cls`. It's frustrating to see your shell throw up its hands, so I add: -``` -alias cls='clear' -``` - -Yes, I'm aware of `ctrl + l`, but I never use it. - -### Amuse yourself - -Work can be stressful. Sometimes you just need to have a little fun. If your shell doesn't know the command that it clearly should just do, maybe you want to shrug your shoulders right back at it! You can do this with a function: -``` -shrug() { echo "¯\_(ツ)_/¯"; } -``` - -If that doesn't work, maybe you need to flip a table: -``` -fliptable() { echo "(╯°□°)╯ ┻━┻"; } # Flip a table. Example usage: fsck -y /dev/sdb1 || fliptable -``` - -Imagine my chagrin and frustration when I needed to flip a desk and I couldn't remember what I had called it. So I added some more shell aliases: -``` -alias flipdesk='fliptable' -alias deskflip='fliptable' -alias tableflip='fliptable' -``` - -And sometimes you need to celebrate: -``` -disco() { -        echo "(•_•)" -        echo "<)   )╯" -        echo " /    \ " -        echo "" -        echo "\(•_•)" -        echo " (   (>" -        echo " /    \ " -        echo "" -        echo " (•_•)" -        echo "<)   )>" -        echo " /    \ " -} -``` - -Typically, I'll pipe the output of these commands to `pbcopy `and paste it into the relevant chat tool I'm using. - -I got this fun function from a Twitter account that I follow called "Command Line Magic:" [@climagic][5]. Since I live in Florida now, I'm very happy that this is the only snow in my life: -``` -snow() { -        clear;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS));sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH*\033[0;0H",a[x],x;}}' -} - -``` - -### Fun with functions - -We've seen some examples of functions that I use. Since few of these examples require an argument, they could be done as aliases. I use functions out of personal preference when it's more than a single short statement. - -At various times in my career, I've run [Graphite][6], an open-source, scalable, time-series metrics solution. There have been enough instances where I needed to transpose a metric path (delineated with periods) to a filesystem path (delineated with slashes), or vice versa, that it became useful to have dedicated functions for these tasks: -``` -# Useful for converting between Graphite metrics and file paths -function dottoslash() { -        echo $1 | sed 's/\./\//g' -} -function slashtodot() { -        echo $1 | sed 's/\//\./g' -} -``` - -During another time in my career, I was running a lot of Kubernetes. If you aren't familiar with running Kubernetes, you need to write a lot of YAML. Unfortunately, it's not hard to write invalid YAML. Worse, Kubernetes doesn't validate YAML before trying to apply it, so you won't find out it's invalid until you apply it. Unless you validate it first: -``` -function yamllint() { -        for i in $(find . -name '*.yml' -o -name '*.yaml'); do echo $i; ruby -e "require 'yaml';YAML.load_file(\"$i\")"; done -} -``` - -Because I got tired of embarrassing myself and occasionally breaking a customer's setup, I wrote this little snippet and added it as a pre-commit hook to all of my relevant repos. Something similar would be very helpful as part of your continuous integration process, especially if you're working as part of a team. - -### Oh, fingers, where art thou? - -I was once an excellent touch-typist. Those days are long gone. I typo more than I would have believed possible. - -At different times, I have used a fair amount of either Chef or Kubernetes. Fortunately for me, I never used both at the same time. - -Part of the Chef ecosystem is Test Kitchen, a suite of tools that facilitate testing, which is invoked with the commands `kitchen test`. Kubernetes is managed with a CLI tool `kubectl`. Both commands require several subcommands, and neither rolls off the fingers particularly fluidly. - -Rather than create a bunch of "typo aliases," I aliased those commands to `k`: -``` -alias k='kitchen test $@' -``` - -or -``` -alias k='kubectl $@' -``` - -### Timesplitters - -The last half of my career has involved writing more code with other people. I've worked in many environments where we have forked copies of repos on our account and use pull requests as part of the review process. When I want to make sure that my fork of a given repo is up to date with the parent, I use `fetchupstream`: -``` -alias fetchupstream='git fetch upstream && git checkout master && git merge upstream/master && git push' -``` - -### Mine eyes have seen the glory of the coming of color - -I like color. It can make things like diffs easier to use. -``` -alias diff='colordiff' -``` - -I thought that colorized man pages was a neat trick, so I incorporated this function: -``` -# Colorized man pages, from: -# http://boredzo.org/blog/archives/2016-08-15/colorized-man-pages-understood-and-customized -man() { -        env \ -                LESS_TERMCAP_md=$(printf "\e[1;36m") \ -                LESS_TERMCAP_me=$(printf "\e[0m") \ -                LESS_TERMCAP_se=$(printf "\e[0m") \ -                LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ -                LESS_TERMCAP_ue=$(printf "\e[0m") \ -                LESS_TERMCAP_us=$(printf "\e[1;32m") \ -                man "$@" -} -``` - -I love the command `which`. It simply tells you where in the filesystem the command you're running comes from—unless it's a shell function. After multiple cascading dotfiles, sometimes it's not clear where a function is defined or what it does. It turns out that the `whence` and `type` commands can help with that. -``` -# Where is a function defined? -whichfunc() { -        whence -v $1 -        type -a $1 -} -``` - -### Conclusion - -I hope this article helps and inspires you to find ways to improve your daily shell-using experience. They don't need to be huge, novel, or complex. They might solve a minor but frequent bit of friction, create a shortcut, or even offer a solution to reducing common typos. - -You're welcome to look through my [dotfiles repo][7], but I warn you that it could use a lot of cleaning up. Feel free to use anything that you find helpful, and please be excellent to one another. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/shell-dotfile - -作者:[H.Waldo Grunenwald][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/gwaldo -[1]: http://www.zsh.org/ -[2]: https://brew.sh/ -[3]: https://github.com/robbyrussell/oh-my-zsh -[4]: https://www.iterm2.com/ -[5]: https://twitter.com/climagic -[6]: https://github.com/graphite-project/ -[7]: https://github.com/gwaldo/dotfiles diff --git a/sources/tech/20181111 Some notes on running new software in production.md b/sources/tech/20181111 Some notes on running new software in production.md new file mode 100644 index 0000000000..bfdfb66a44 --- /dev/null +++ b/sources/tech/20181111 Some notes on running new software in production.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some notes on running new software in production) +[#]: via: (https://jvns.ca/blog/2018/11/11/understand-the-software-you-use-in-production/) +[#]: author: (Julia Evans https://jvns.ca/) + +Some notes on running new software in production +====== + +I’m working on a talk for kubecon in December! One of the points I want to get across is the amount of time/investment it takes to use new software in production without causing really serious incidents, and what that’s looked like for us in our use of Kubernetes. + +To start out, this post isn’t blanket advice. There are lots of times when it’s totally fine to just use software and not worry about **how** it works exactly. So let’s start by talking about when it’s important to invest. + +### when it matters: 99.99% + +If you’re running a service with a low SLO like 99% I don’t think it matters that much to understand the software you run in production. You can be down for like 2 hours a month! If something goes wrong, just fix it and it’s fine. + +At 99.99%, it’s different. That’s 45 minutes / year of downtime, and if you find out about a serious issue for the first time in production it could easily take you 20 minutes or to revert the change. That’s half your uptime budget for the year! + +### when it matters: software that you’re using heavily + +Also, even if you’re running a service with a 99.99% SLO, it’s impossible to develop a super deep understanding of every single piece of software you’re using. For example, a web service might use: + + * 100 library dependencies + * the filesystem (so there’s linux filesystem code!) + * the network (linux networking code!) + * a database (like postgres) + * a proxy (like nginx/haproxy) + + + +If you’re only reading like 2 files from disk, you don’t need to do a super deep dive into Linux filesystems internals, you can just read the file from disk. + +What I try to do in practice is identify the components which we rely on the (or have the most unusual use cases for!), and invest time into understanding those. These are usually pretty easy to identify because they’re the ones which will cause the most problems :) + +### when it matters: new software + +Understanding your software especially matters for newer/less mature software projects, because it’s morely likely to have bugs & or just not have matured enough to be used by most people without having to worry. I’ve spent a bunch of time recently with Kubernetes/Envoy which are both relatively new projects, and neither of those are remotely in the category of “oh, it’ll just work, don’t worry about it”. I’ve spent many hours debugging weird surprising edge cases with both of them and learning how to configure them in the right way. + +### a playbook for understanding your software + +The playbook for understanding the software you run in production is pretty simple. Here it is: + + 1. Start using it in production in a non-critical capacity (by sending a small percentage of traffic to it, on a less critical service, etc) + 2. Let that bake for a few weeks. + 3. Run into problems. + 4. Fix the problems. Go to step 3. + + + +Repeat until you feel like you have a good handle on this software’s failure modes and are comfortable running it in a more critical capacity. Let’s talk about that in a little more detail, though: + +### what running into bugs looks like + +For example, I’ve been spending a lot of time with Envoy in the last year. Some of the issues we’ve seen along the way are: (in no particular order) + + * One of the default settings resulted in retry & timeout headers not being respected + * Envoy (as a client) doesn’t support TLS session resumption, so servers with a large amount of Envoy clients get DDOSed by TLS handshakes + * Envoy’s active healthchecking means that you services get healthchecked by every client. This is mostly okay but (again) services with many clients can get overwhelmed by it. + * Having every client independently healthcheck every server interacts somewhat poorly with services which are under heavy load, and can exacerbate performance issues by removing up-but-slow clients from the load balancer rotation. + * Envoy doesn’t retry failed connections by default + * it frequently segfaults when given incorrect configuration + * various issues with it segfaulting because of resource leaks / memory safety issues + * hosts running out of disk space between we didn’t rotate Envoy log files often enough + + + +A lot of these aren’t bugs – they’re just cases where what we expected the default configuration to do one thing, and it did another thing. This happens all the time, and it can result in really serious incidents. Figuring out how to configure a complicated piece of software appropriately takes a lot of time, and you just have to account for that. + +And Envoy is great software! The maintainers are incredibly responsive, they fix bugs quickly and its performance is good. It’s overall been quite stable and it’s done well in production. But just because something is great software doesn’t mean you won’t also run into 10 or 20 relatively serious issues along the way that need to be addressed in one way or another. And it’s helpful to understand those issues **before** putting the software in a really critical place. + +### try to have each incident only once + +My view is that running new software in production inevitably results in incidents. The trick: + + 1. Make sure the incidents aren’t too serious (by making ‘production’ a less critical system first) + 2. Whenever there’s an incident (even if it’s not that serious!!!), spend the time necessary to understand exactly why it happened and how to make sure it doesn’t happen again + + + +My experience so far has been that it’s actually relatively possible to pull off “have every incident only once”. When we investigate issues and implement remediations, usually that issue **never comes back**. The remediation can either be: + + * a configuration change + * reporting a bug upstream and either fixing it ourselves or waiting for a fix + * a workaround (“this software doesn’t work with 10,000 clients? ok, we just won’t use it with in cases where there are that many clients for now!“, “oh, a memory leak? let’s just restart it every hour”) + + + +Knowledge-sharing is really important here too – it’s always unfortunate when one person finds an incident in production, fixes it, but doesn’t explain the issue to the rest of the team so somebody else ends up causing the same incident again later because they didn’t hear about the original incident. + +### Understand what is ok to break and isn’t + +Another huge part of understanding the software I run in production is understanding which parts are OK to break (aka “if this breaks, it won’t result in a production incident”) and which aren’t. This lets me **focus**: I can put big boxes around some components and decide “ok, if this breaks it doesn’t matter, so I won’t pay super close attention to it”. + +For example, with Kubernetes: + +ok to break: + + * any stateless control plane component can crash or be cycled out or go down for 5 minutes at any time. If we had 95% uptime for the kubernetes control plane that would probably be fine, it just needs to be working most of the time. + * kubernetes networking (the system where you give every pod an IP addresses) can break as much as it wants because we decided not to use it to start + + + +not ok: + + * for us, if etcd goes down for 10 minutes, that’s ok. If it goes down for 2 hours, it’s not + * containers not starting or crashing on startup (iam issues, docker not starting containers, bugs in the scheduler, bugs in other controllers) is serious and needs to be looked at immediately + * containers not having access to the resources they need (because of permissions issues, etc) + * pods being terminated unexpectedly by Kubernetes (if you configure kubernetes wrong it can terminate your pods!) + + + +with Envoy, the breakdown is pretty different: + +ok to break: + + * if the envoy control plane goes down for 5 minutes, that’s fine (it’ll keep working with stale data) + * segfaults on startup due to configuration errors are sort of okay because they manifest so early and they’re unlikely to surprise us (if the segfault doesn’t happen the 1st time, it shouldn’t happen the 200th time) + + + +not ok: + + * Envoy crashes / segfaults are not good – if it crashes, network connections don’t happen + * if the control server serves incorrect or incomplete data that’s extremely dangerous and can result in serious production incidents. (so downtime is fine, but serving incorrect data is not!) + + + +Neither of these lists are complete at all, but they’re examples of what I mean by “understand your sofware”. + +### sharing ok to break / not ok lists is useful + +I think these “ok to break” / “not ok” lists are really useful to share, because even if they’re not 100% the same for every user, the lessons are pretty hard won. I’d be curious to hear about your breakdown of what kinds of failures are ok / not ok for software you’re using! + +Figuring out all the failure modes of a new piece of software and how they apply to your situation can take months. (this is is why when you ask your database team “hey can we just use NEW DATABASE” they look at you in such a pained way). So anything we can do to help other people learn faster is amazing +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/11/11/understand-the-software-you-use-in-production/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 diff --git a/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md b/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md new file mode 100644 index 0000000000..f95f17db01 --- /dev/null +++ b/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An example of how C++ destructors are useful in Envoy) +[#]: via: (https://jvns.ca/blog/2018/11/18/c---destructors---really-useful/) +[#]: author: (Julia Evans https://jvns.ca/) + +An example of how C++ destructors are useful in Envoy +====== + +For a while now I’ve been working with a C++ project (Envoy), and sometimes I need to contribute to it, so my C++ skills have gone from “nonexistent” to “really minimal”. I’ve learned what an initializer list is and that a method starting with `~` is a destructor. I almost know what an lvalue and an rvalue are but not quite. + +But the other day when writing some C++ code I figured out something exciting about how to use destructors that I hadn’t realized! (the tl;dr of this post for people who know C++ is “julia finally understands what RAII is and that it is useful” :)) + +### what’s a destructor? + +C++ has objects. When an C++ object goes out of scope, the compiler inserts a call to its destructor. So if you have some code like + +``` +function do_thing() { + Thing x{}; // this calls the Thing constructor + return 2; +} +``` + +there will be a call to x’s destructor at the end of the `do_thing` function. so the code c++ generates looks something like: + + * make new thing + * call the new thing’s destructor + * return 2 + + + +Obviously destructors are way more complicated like this. They need to get called when there are exceptions! And sometimes they get called manually. And for lots of other reasons too. But there are 10 million things to know about C++ and that is not what we’re doing today, we are just talking about one thing. + +### what happens in a destructor? + +A lot of the time memory gets freed, which is how you avoid having memory leaks. But that’s not what we’re talking about in this post! We are talking about something more interesting. + +### the thing we’re interested in: Envoy circuit breakers + +So I’ve been working with Envoy a lot. 3 second Envoy refresher: it’s a HTTP proxy, your application makes requests to Envoy, which then proxies the request to the servers the application wants to talk to. + +One very useful feature Envoy has is this thing called “circuit breakers”. Basically the idea with is that if your application makes 50 billion connections to a service, that will probably overwhelm the service. So Envoy keeps track how many TCP connections you’ve made to a service, and will stop you from making new requests if you hit the limit. The default `max_connection` limit + +### how do you track connection count? + +To maintain a circuit breaker on the number of TCP connections, that means you need to keep an accurate count of how many TCP connections are currently open! How do you do that? Well, the way it works is to maintain a `connections` counter and: + + * every time a connection is opened, increment the counter + * every time a connection is destroyed (because of a reset / timeout / whatever), decrement the counter + * when creating a new connection, check that the `connections` counter is not over the limit + + + +that’s all! And incrementing the counter when creating a new connection is pretty easy. But how do you make sure that the counter gets _decremented_ wheh the connection is destroyed? Connections can be destroyed in a lot of ways (they can time out! they can be closed by Envoy! they can be closed by the server! maybe something else I haven’t thought of could happen!) and it seems very easy to accidentally miss a way of closing them. + +### destructors to the rescue + +The way Envoy solves this problem is to create a connection object (called `ActiveClient` in the HTTP connection pool) for every connection. + +Then it: + + * increments the counter in the constructor ([code][1]) + * decrements the counter in the destructor ([code][2]) + * checks the counter when a new connection is created ([code][3]) + + + +The beauty of this is that now you don’t need to make sure that the counter gets decremented in all the right places, you now just need to organize your code so that the `ActiveClient` object’s destructor gets called when the connection has closed. + +Where does the `ActiveClient` destructor get called in Envoy? Well, Envoy maintains 2 lists of clients (`ready_clients` and `busy_clients`), and when a connection gets closed, Envoy removes the client from those lists. And when it does that, it doesn’t need to do any extra cleanup!! In C++, anytime a object is removed from a list, its destructor is called. So `client.removeFromList(ready_clients_);` takes care of all the cleanup. And there’s no chance of forgetting to decrement the counter!! It will definitely always happen unless you accidentally leave the object on one of these lists, which would be a bug anyway because the connection is closed :) + +### RAII + +This pattern Envoy is using here is an extremely common C++ programming pattern called “resource acquisition is initialization”. I find that name very confusing but that’s what it’s called. basically the way it works is: + + * identify a resource (like “connection”) where a lot of things need to happen when the connection is initialized / finished + * make a class for that connection + * put all the initialization / finishing code in the constructor / destructor + * make sure the object’s destructor method gets called when appropriate! (by removing it from a vector / having it go out of scope) + + + +Previously I knew about using this pattern for kind of obvious things (make sure all the memory gets freed in the destructor, or make sure file descriptors get closed). But I didn’t realize it was also useful for cases that are slightly less obviously a resource like “decrement a counter”. + +The reason this pattern works is because the C++ compiler/standard library does a bunch of work to make sure that destructors get called when you’re done with an object – the compiler inserts destructor calls at the end of each block of code, after exceptions, and many standard library collections make sure destructors are called when you remove an object from a collection. + +### RAII gives you prompt, deterministic, and hard-to-screw-up cleanup of resources + +The exciting thing here is that this programming pattern gives you a way to schedule cleaning up resources that’s: + + * easy to ensure always happens (when the object goes away, it always happens, even if there was an exception!) + * prompt & determinstic (it happens right away and it’s guaranteed to happen!) + + + +### what languages have RAII? + +C++ and Rust have RAII. Probably other languages too. Java, Python, Go, and garbage collected languages in general do not. In a garbage collected language you can often set up destructors to be run when the object is GC’d. But often (like in this case, which the connection count) you want things to be cleaned up **right away** when the object is no longer in use, not some indeterminate period later whenever GC happens to run. + +Python context managers are a related idea, you could do something like: + +``` +with conn_pool.connection() as conn: + do stuff +``` + +### that’s all for now! + +Hopefully this explanation of RAII is interesting and mostly correct. Thanks to Kamal for clarifying some RAII things for me! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/11/18/c---destructors---really-useful/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L301 +[2]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L315 +[3]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L97 diff --git a/sources/tech/20181209 How do you document a tech project with comics.md b/sources/tech/20181209 How do you document a tech project with comics.md new file mode 100644 index 0000000000..02d4981875 --- /dev/null +++ b/sources/tech/20181209 How do you document a tech project with comics.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How do you document a tech project with comics?) +[#]: via: (https://jvns.ca/blog/2018/12/09/how-do-you-document-a-tech-project-with-comics/) +[#]: author: (Julia Evans https://jvns.ca/) + +How do you document a tech project with comics? +====== + +Every so often I get email from people saying basically “hey julia! we have an open source project! we’d like to use comics / zines / art to document our project! Can we hire you?“. + +spoiler: the answer is “no, you can’t hire me” – I don’t do commissions. But I do think this is a cool idea and I’ve often wished I had something more useful to say to people than “no”, so if you’re interested in this, here are some ideas about how to accomplish it! + +### zine != drawing + +First, a terminology distinction. One weird thing I’ve noticed is that people frequently refer to individual tech drawings as “zines”. I think this is due to me communicating poorly somehow, but – drawings are not zines! A zine is a **printed booklet**, like a small maga**zine**. You wouldn’t call a photo of a model in Vogue a magazine! The magazine has like a million pages! An individual drawing is a drawing/comic/graphic/whatever. Just clarifying this because I think it causes a bit of unnecessary confusion. + +### comics without good information are useless + +Usually when folks ask me “hey, could we make a comic explaining X”, it doesn’t seem like they have a clear idea of what information exactly they want to get across, they just have a vague idea that maybe it would be cool to draw some comics. This makes sense – figuring out what information would be useful to tell people is very hard!! It’s 80% of what I spend my time on when making comics. + +You should think about comics the same way as any kind of documentation – start with the information you want to convey, who your target audience is, and how you want to distribute it (twitter? on your website? in person?), and figure out how to illustrate it after :). The information is the main thing, not the art! + +Once you have a clear story about what you want to get across, you can start trying to think about how to represent it using illustrations! + +### focus on concepts that don’t change + +Drawing comics is a much bigger investment than writing documentation (it takes me like 5x longer to convey the same information in a comic than in writing). So use it wisely! Because it’s not that easy to edit, if you’re going to make something a comic you want to focus on concepts that are very unlikely to change. So talk about the core ideas in your project instead of the exact command line arguments it takes! + +Here are a couple of options for how you could use comics/illustrations to document your project! + +### option 1: a single graphic + +One format you might want to try is a single, small graphic explaining what your project is about and why folks might be interested in it. For example: [this zulip comic][1] + +This is a short thing, you could post it on Twitter or print it as a pamphlet to give out. The information content here would probably be basically what’s on your project homepage, but presented in a more fun/exciting way :) + +You can put a pretty small amount of information in a single comic. With that Zulip comic, the things I picked out were: + + * zulip is sort of like slack, but it has threads + * it’s easy to keep track of threads even if the conversation takes place over several days + * you can much more easily selectively catch up with Zulip + * zulip is open source + * there’s an open zulip server you can try out + + + +That’s not a lot of information! It’s 50 words :). So to do this effectively you need to distill your project down to 50 words in a way that’s still useful. It’s not easy! + +### option 2: many comics + +Another approach you can take is to make a more in depth comic / illustration, like [google’s guide to kubernetes][2] or [the children’s illustrated guide to kubernetes][3]. + +To do this, you need a much stronger concept than “uh, I want to explain our project” – you want to have a clear target audience in mind! For example, if I were drawing a set of Docker comics, I’d probably focus on folks who want to use Docker in production. so I’d want to discuss: + + * publishing your containers to a public/private registry + * some best practices for tagging your containers + * how to make sure your hosts don’t run out of disk space from downloading too many containers + * how to use layers to save on disk space / download less stuff + * whether it’s reasonable to run the same containers in production & in dev + + + +That’s totally different from the set of comics I’d write for folks who just want to use Docker to develop locally! + +### option 3: a printed zine + +The main thing that differentiates this from “many comics” is that zines are printed! Because of that, for this to make sense you need to have a place to give out the printed copies! Maybe you’re going present your project at a major conference? Maybe you give workshops about your project and want to give our the zine to folks in the workshop as notes? Maybe you want to mail it to people? + +### how to hire someone to help you + +There are basically 3 ways to hire someone: + + 1. Hire someone who both understands (or can quickly learn) the technology you want to document and can illustrate well. These folks are tricky to find and probably expensive (I certainly wouldn’t do a project like this for less than $10,000 even if I did do commissions), just because programmers can usually charge a pretty high consulting rate. I’d guess that the main failure mode here is that it might be impossible/very hard to find someone, and it might be expensive. + 2. Collaborate with an illustrator to draw it for you. The main failure mode here is that if you don’t give the illustrator clear explanations of your tech to work with, you.. won’t end up with a clear and useful explanation. From what I’ve seen, **most folks underinvest in writing clear explanations for their illustrators** – I’ve seen a few really adorable tech comics that I don’t find useful or clear at all. I’d love to see more people do a better job of this. What’s the point of having an adorable illustration if it doesn’t teach anyone anything? :) + 3. Draw it yourself :). This is what I do, obviously. stick figures are okay! + + + +Most people seem to use method #2 – I’m not actually aware of any tech folks who have done commissioned comics (though I’m sure it’s happened!). I think method #2 is a great option and I’d love to see more folks do it. Paying illustrators is really fun! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/09/how-do-you-document-a-tech-project-with-comics/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/986444234365521920 +[2]: https://cloud.google.com/kubernetes-engine/kubernetes-comic/ +[3]: https://thenewstack.io/kubernetes-gets-childrens-book/ diff --git a/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md b/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md new file mode 100644 index 0000000000..93755329c7 --- /dev/null +++ b/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New talk: High Reliability Infrastructure Migrations) +[#]: via: (https://jvns.ca/blog/2018/12/15/new-talk--high-reliability-infrastructure-migrations/) +[#]: author: (Julia Evans https://jvns.ca/) + +New talk: High Reliability Infrastructure Migrations +====== + +On Tuesday I gave a talk at KubeCon called [High Reliability Infrastructure Migrations][1]. The abstract was: + +> For companies with high availability requirements (99.99% uptime or higher), running new software in production comes with a lot of risks. But it’s possible to make significant infrastructure changes while maintaining the availability your customers expect! I’ll give you a toolbox for derisking migrations and making infrastructure changes with confidence, with examples from our Kubernetes & Envoy experience at Stripe. + +### video + +#### slides + +Here are the slides: + +since everyone always asks, I drew them in the Notability app on an iPad. I do this because it’s faster than trying to use regular slides software and I can make better slides. + +### a few notes + +Here are a few links & notes about things I mentioned in the talk + +#### skycfg: write functions, not YAML + +I talked about how my team is working on non-YAML interfaces for configuring Kubernetes. The demo is at [skycfg.fun][2], and it’s [on GitHub here][3]. It’s based on [Starlark][4], a configuration language that’s a subset of Python. + +My coworker [John][5] has promised that he’ll write a blog post about it at some point, and I’m hoping that’s coming soon :) + +#### no haunted forests + +I mentioned a deploy system rewrite we did. John has a great blog post about when rewrites are a good idea and how he approached that rewrite called [no haunted forests][6]. + +#### ignore most kubernetes ecosystem software + +One small point that I made in the talk was that on my team we ignore almost all software in the Kubernetes ecosystem so that we can focus on a few core pieces (Kubernetes & Envoy, plus some small things like kiam). I wanted to mention this because I think often in Kubernetes land it can seem like everyone is using Cool New Things (helm! istio! knative! eep!). I’m sure those projects are great but I find it much simpler to stay focused on the basics and I wanted people to know that it’s okay to do that if that’s what works for your company. + +I think the reality is that actually a lot of folks are still trying to work out how to use this new software in a reliable and secure way. + +#### other talks + +I haven’t watched other Kubecon talks yet, but here are 2 links: + +I heard good things about [this keynote from melanie cebula about kubernetes at airbnb][7], and I’m excited to see [this talk about kubernetes security][8]. The [slides from that security talk look useful][9] + +Also I’m very excited to see Kelsey Hightower’s keynote as always, but that recording isn’t up yet. If you have other Kubecon talks to recommend I’d love to know what they are. + +#### my first work talk I’m happy with + +I usually give talks about debugging tools, or side projects, or how I approach my job at a high level – not on the actual work that I do at my job. What I talked about in this talk is basically what I’ve been learning how to do at work for the last ~2 years. Figuring out how to make big infrastructure changes safely took me a long time (and I’m not done!), and so I hope this talk helps other folks do the same thing. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/15/new-talk--high-reliability-infrastructure-migrations/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=obB2IvCv-K0 +[2]: http://skycfg.fun +[3]: https://github.com/stripe/skycfg +[4]: https://github.com/bazelbuild/starlark +[5]: https://john-millikin.com/ +[6]: https://john-millikin.com/sre-school/no-haunted-forests +[7]: https://www.youtube.com/watch?v=ytu3aUCwlSg&index=127&t=0s&list=PLj6h78yzYM2PZf9eA7bhWnIh_mK1vyOfU +[8]: https://www.youtube.com/watch?v=a03te8xEjUg&index=65&list=PLj6h78yzYM2PZf9eA7bhWnIh_mK1vyOfU&t=0s +[9]: https://schd.ws/hosted_files/kccna18/1c/KubeCon%20NA%20-%20This%20year%2C%20it%27s%20about%20security%20-%2020181211.pdf diff --git a/sources/tech/20181227 Linux commands for measuring disk activity.md b/sources/tech/20181227 Linux commands for measuring disk activity.md deleted file mode 100644 index badda327dd..0000000000 --- a/sources/tech/20181227 Linux commands for measuring disk activity.md +++ /dev/null @@ -1,252 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux commands for measuring disk activity) -[#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Linux commands for measuring disk activity -====== -![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg) -Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system, and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity. - -Probably one of the easiest and most obvious of these commands is **dstat**. - -### dtstat - -In spite of the fact that the **dstat** command begins with the letter "d", it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the **-d** option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second. - -``` -$ dstat -d --dsk/total- - read writ - 949B 73k - 65k 0 <== first second - 0 24k <== second second - 0 16k - 0 0 ^C -``` - -Including a number after the -d option will set the interval to that number of seconds. - -``` -$ dstat -d 10 --dsk/total- - read writ - 949B 73k - 65k 81M <== first five seconds - 0 21k <== second five second - 0 9011B ^C -``` - -Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes). - -Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches. - -``` -$ dstat -You did not select any stats, using -cdngy by default. ---total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- -usr sys idl wai stl| read writ| recv send| in out | int csw - 0 0 100 0 0| 949B 73k| 0 0 | 0 3B| 38 65 - 0 0 100 0 0| 0 0 | 218B 932B| 0 0 | 53 68 - 0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C -``` - -The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features. For more insight into the other information that the dstat command can provide, refer to this post on the [dstat][1] command. - -### iostat - -The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It's sometimes used to evaluate the balance of activity between disks. - -``` -$ iostat -Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) - -avg-cpu: %user %nice %system %iowait %steal %idle - 0.07 0.01 0.03 0.05 0.00 99.85 - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -loop0 0.00 0.00 0.00 1048 0 -loop1 0.00 0.00 0.00 365 0 -loop2 0.00 0.00 0.00 1056 0 -loop3 0.00 0.01 0.00 16169 0 -loop4 0.00 0.00 0.00 413 0 -loop5 0.00 0.00 0.00 1184 0 -loop6 0.00 0.00 0.00 1062 0 -loop7 0.00 0.00 0.00 5261 0 -sda 1.06 0.89 72.66 2837453 232735080 -sdb 0.00 0.02 0.00 48669 40 -loop8 0.00 0.00 0.00 1053 0 -loop9 0.01 0.01 0.00 18949 0 -loop10 0.00 0.00 0.00 56 0 -loop11 0.00 0.00 0.00 7090 0 -loop12 0.00 0.00 0.00 1160 0 -loop13 0.00 0.00 0.00 108 0 -loop14 0.00 0.00 0.00 3572 0 -loop15 0.01 0.01 0.00 20026 0 -loop16 0.00 0.00 0.00 24 0 -``` - -Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the **-p** option, which allows you to just look at your disks — as shown in the commands below. - -``` -$ iostat -p sda -Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) - -avg-cpu: %user %nice %system %iowait %steal %idle - 0.07 0.01 0.03 0.05 0.00 99.85 - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -sda 1.06 0.89 72.54 2843737 232815784 -sda1 1.04 0.88 72.54 2821733 232815784 -``` - -Note that **tps** refers to transfers per second. - -You can also get iostat to provide repeated reports. In the example below, we're getting measurements every five seconds by using the **-d** option. - -``` -$ iostat -p sda -d 5 -Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -sda 1.06 0.89 72.51 2843749 232834048 -sda1 1.04 0.88 72.51 2821745 232834048 - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -sda 0.80 0.00 11.20 0 56 -sda1 0.80 0.00 11.20 0 56 -``` - -If you prefer to omit the first (stats since boot) report, add a **-y** to your command. - -``` -$ iostat -p sda -d 5 -y -Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -sda 0.80 0.00 11.20 0 56 -sda1 0.80 0.00 11.20 0 56 -``` - -Next, we look at our second disk drive. - -``` -$ iostat -p sdb -Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) - -avg-cpu: %user %nice %system %iowait %steal %idle - 0.07 0.01 0.03 0.05 0.00 99.85 - -Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn -sdb 0.00 0.02 0.00 48669 40 -sdb2 0.00 0.00 0.00 4861 40 -sdb1 0.00 0.01 0.00 35344 0 -``` - -### iotop - -The **iotop** command is top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms in disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself, overwriting the previous output. - -``` -$ sudo iotop -d 5 -Total DISK READ: 0.00 B/s | Total DISK WRITE: 1585.31 B/s -Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s - TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND -32492 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [kworker/u8:1-ev~_power_efficient] - 208 be/3 root 0.00 B/s 1585.31 B/s 0.00 % 0.11 % [jbd2/sda1-8] - 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init splash - 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] - 3 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_gp] - 4 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_par_gp] - 8 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mm_percpu_wq] -``` - -### ioping - -The **ioping** command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems. - -``` -$ sudo ioping /dev/sda1 -4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=1 time=960.2 us (warmup) -4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=2 time=841.5 us -4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=3 time=831.0 us -4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=4 time=1.17 ms -^C ---- /dev/sda1 (block device 111.8 GiB) ioping statistics --- -3 requests completed in 2.84 ms, 12 KiB read, 1.05 k iops, 4.12 MiB/s -generated 4 requests in 3.37 s, 16 KiB, 1 iops, 4.75 KiB/s -min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us -``` - -### atop - -The **atop** command, like **top** provides a lot of information on system performance, including some stats on disk activity. - -``` -ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed -PRC | sys 0.03s | user 0.01s | #proc 179 | #zombie 0 | #exit 6 | -CPU | sys 1% | user 0% | irq 0% | idle 199% | wait 0% | -cpu | sys 1% | user 0% | irq 0% | idle 99% | cpu000 w 0% | -CPL | avg1 0.00 | avg5 0.00 | avg15 0.00 | csw 677 | intr 470 | -MEM | tot 5.8G | free 223.4M | cache 4.6G | buff 253.2M | slab 394.4M | -SWP | tot 2.0G | free 2.0G | | vmcom 1.9G | vmlim 4.9G | -DSK | sda | busy 0% | read 0 | write 7 | avio 1.14 ms | -NET | transport | tcpi 4 | tcpo stall 8 | udpi 1 | udpo 0swout 2255 | -NET | network | ipi 10 | ipo 7 | ipfrw 0 | deliv 60.67 ms | -NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms | - - PID SYSCPU USRCPU VGROW RGROW ST EXC THR S CPUNR CPU CMD 1/1673e4 | - 3357 0.01s 0.00s 672K 824K -- - 1 R 0 0% atop - 3359 0.01s 0.00s 0K 0K NE 0 0 E - 0% - 3361 0.00s 0.01s 0K 0K NE 0 0 E - 0% - 3363 0.01s 0.00s 0K 0K NE 0 0 E - 0% -31357 0.00s 0.00s 0K 0K -- - 1 S 1 0% bash - 3364 0.00s 0.00s 8032K 756K N- - 1 S 1 0% sleep - 2931 0.00s 0.00s 0K 0K -- - 1 I 1 0% kworker/u8:2-e - 3356 0.00s 0.00s 0K 0K -E 0 0 E - 0% - 3360 0.00s 0.00s 0K 0K NE 0 0 E - 0% - 3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% -``` - -If you want to look at _just_ the disk stats, you can easily manage that with a command like this: - -``` -$ atop | grep DSK -$ atop | grep DSK -DSK | sda | busy 0% | read 122901 | write 3318e3 | avio 0.67 ms | -DSK | sdb | busy 0% | read 1168 | write 103 | avio 0.73 ms | -DSK | sda | busy 2% | read 0 | write 92 | avio 2.39 ms | -DSK | sda | busy 2% | read 0 | write 94 | avio 2.47 ms | -DSK | sda | busy 2% | read 0 | write 99 | avio 2.26 ms | -DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | -DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | -DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms | -^C -``` - -### Being in the know with disk I/O - -Linux provides enough commands to give you good insights into how hard your disks are working and help you focus on potential problems or slowdowns. Hopefully, one of these commands will tell you just what you need to know when it's time to question disk performance. Occasional use of these commands will help ensure that especially busy or slow disks will be obvious when you need to check them. - -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/3330497/linux/linux-commands-for-measuring-disk-activity.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/3291616/linux/examining-linux-system-performance-with-dstat.html -[2]: https://www.facebook.com/NetworkWorld/ -[3]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20181229 Some nonparametric statistics math.md b/sources/tech/20181229 Some nonparametric statistics math.md new file mode 100644 index 0000000000..452c295781 --- /dev/null +++ b/sources/tech/20181229 Some nonparametric statistics math.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some nonparametric statistics math) +[#]: via: (https://jvns.ca/blog/2018/12/29/some-initial-nonparametric-statistics-notes/) +[#]: author: (Julia Evans https://jvns.ca/) + +Some nonparametric statistics math +====== + +I’m trying to understand nonparametric statistics a little more formally. This post may not be that intelligible because I’m still pretty confused about nonparametric statistics, there is a lot of math, and I make no attempt to explain any of the math notation. I’m working towards being able to explain this stuff in a much more accessible way but first I would like to understand some of the math! + +There’s some MathJax in this post so the math may or may not render in an RSS reader. + +Some questions I’m interested in: + + * what is nonparametric statistics exactly? + * what guarantees can we make? are there formulas we can use? + * why do methods like the bootstrap method work? + + + +since these notes are from reading a math book and math books are extremely dense this is basically going to be “I read 7 pages of this math book and here are some points I’m confused about” + +### what’s nonparametric statistics? + +Today I’m looking at “all of nonparametric statistics” by Larry Wasserman. He defines nonparametric inference as: + +> a set of modern statistical methods that aim to keep the number of underlying assumptions as weak as possible + +Basically my interpretation of this is that – instead of assuming that your data comes from a specific family of distributions (like the normal distribution) and then trying to estimate the paramters of that distribution, you don’t make many assumptions about the distribution (“this is just some data!!“). Not having to make assumptions is nice! + +There aren’t **no** assumptions though – he says + +> we assume that the distribution $F$ lies in some set $\mathfrak{F}$ called a **statistical model**. For example, when estimating a density $f$, we might assume that $$ f \in \mathfrak{F} = \left\\{ g : \int(g^{\prime\prime}(x))^2dx \leq c^2 \right\\}$$ which is the set of densities that are not “too wiggly”. + +I have not too much intuition for the condition $\int(g^{\prime\prime}(x))^2dx \leq c^2$. I calculated that integral for [the normal distribution on wolfram alpha][1] and got 4, which is a good start. (4 is not infinity!) + +some questions I still have about this definition: + + * what’s an example of a probability density function that _doesn’t_ satisfy that $\int(g^{\prime\prime}(x))^2dx \leq c^2$ condition? (probably something with an infinite number of tiny wiggles, and I don’t think any distribution i’m interested in in practice would have an infinite number of tiny wiggles?) + * why does the density function being “too wiggly” cause problems for nonparametric inference? very unclear as yet. + + + +### we still have to assume independence + +One assumption we **won’t** get away from is that the samples in the data we’re dealing with are independent. Often data in the real world actually isn’t really independent, but I think the what people do a lot of the time is to make a good effort at something approaching independence and then close your eyes and pretend it is? + +### estimating the density function + +Okay! Here’s a useful section! Let’s say that I have 100,000 data points from a distribution. I can draw a histogram like this of those data points: + +![][2] + +If I have 100,000 data points, it’s pretty likely that that histogram is pretty close to the actual distribution. But this is math, so we should be able to make that statement precise, right? + +For example suppose that 5% of the points in my sample are more than 100. Is the probability that a point is greater than 100 **actually** 0.05? The book gives a nice formula for this: + +$$ \mathbb{P}(|\widehat{P}_n(A) - P(A)| > \epsilon ) \leq 2e^{-2n\epsilon^2} $$ + +(by [“Hoeffding’s inequality”][3] which I’ve never heard of before). Fun aside about that inequality: here’s a nice jupyter notebook by henry wallace using it to [identify the most common Boggle words][4]. + +here, in our example: + + * n is 1000 (the number of data points we have) + * $A$ is the set of points more than 100 + * $\widehat{P}_n(A)$ is the empirical probability that a point is more than 100 (0.05) + * $P(A)$ is the actual probability + * $\epsilon$ is how certain we want to be that we’re right + + + +So, what’s the probability that the **real** probability is between 0.04 and 0.06? $\epsilon = 0.01$, so it’s $2e^{-2 \times 100,000 \times (0.01)^2} = 4e^{-9} $ ish (according to wolfram alpha) + +here is a table of how sure we can be: + + * 100,000 data points: 4e-9 (TOTALLY CERTAIN that 4% - 6% of points are more than 100) + * 10,000 data points: 0.27 (27% probability that we’re wrong! that’s… not bad?) + * 1,000 data points: 1.6 (we know the probability we’re wrong is less than.. 160%? that’s not good!) + * 100 data points: lol + + + +so basically, in this case, using this formula: 100,000 data points is AMAZING, 10,000 data points is pretty good, and 1,000 is much less useful. If we have 1000 data points and we see that 5% of them are more than 100, we DEFINITELY CANNOT CONCLUDE that 4% to 6% of points are more than 100. But (using the same formula) we can use $\epsilon = 0.04$ and conclude that with 92% probability 1% to 9% of points are more than 100. So we can still learn some stuff from 1000 data points! + +This intuitively feels pretty reasonable to me – like it makes sense to me that if you have NO IDEA what your distribution that with 100,000 points you’d be able to make quite strong inferences, and that with 1000 you can do a lot less! + +### more data points are exponentially better? + +One thing that I think is really cool about this estimating the density function formula is that how sure you can be of your inferences scales **exponentially** with the size of your dataset (this is the $e^{-n\epsilon^2}$). And also exponentially with the square of how sure you want to be (so wanting to be sure within 0.01 is VERY DIFFERENT than within 0.04). So 100,000 data points isn’t 10x better than 10,000 data points, it’s actually like 10000000000000x better. + +Is that true in other places? If so that seems like a super useful intuition! I still feel pretty uncertain about this, but having some basic intuition about “how much more useful is 10,000 data points than 1,000 data points?“) feels like a really good thing. + +### some math about the bootstrap + +The next chapter is about the bootstrap! Basically the way the bootstrap works is: + + 1. you want to estimate some statistic (like the median) of your distribution + 2. the bootstrap lets you get an estimate and also the variance of that estimate + 3. you do this by repeatedly sampling with replacement from your data and then calculating the statistic you want (like the median) on your samples + + + +I’m not going to go too much into how to implement the bootstrap method because it’s explained in a lot of place on the internet. Let’s talk about the math! + +I think in order to say anything meaningful about bootstrap estimates I need to learn a new term: a **consistent estimator**. + +### What’s a consistent estimator? + +Wikipedia says: + +> In statistics, a **consistent estimator** or **asymptotically consistent estimator** is an estimator — a rule for computing estimates of a parameter $\theta_0$ — having the property that as the number of data points used increases indefinitely, the resulting sequence of estimates converges in probability to $\theta_0$. + +This includes some terms where I forget what they mean (what’s “converges in probability” again?). But this seems like a very good thing! If I’m estimating some parameter (like the median), I would DEFINITELY LIKE IT TO BE TRUE that if I do it with an infinite amount of data then my estimate works. An estimator that is not consistent does not sound very useful! + +### why/when are bootstrap estimators consistent? + +spoiler: I have no idea. The book says the following: + +> Consistency of the boostrap can now be expressed as follows. +> +> **3.19 Theorem**. Suppose that $\mathbb{E}(X_1^2) < \infty$. Let $T_n = g(\overline{X}_n)$ where $g$ is continuously differentiable at $\mu = \mathbb{E}(X_1)$ and that $g\prime(\mu) \neq 0$. Then, +> +> $$ \sup_u | \mathbb{P}_{\widehat{F}_n} \left( \sqrt{n} (T( \widehat{F}_n*) - T( \widehat{F}_n) \leq u \right) - \mathbb{P}_{\widehat{F}} \left( \sqrt{n} (T( \widehat{F}_n) - T( \widehat{F}) \leq u \right) | \rightarrow^\text{a.s.} 0 $$ +> +> **3.21 Theorem**. Suppose that $T(F)$ is Hadamard differentiable with respect to $d(F,G)= sup_x|F(x)-G(x)|$ and that $0 < \int L^2_F(x) dF(x) < \infty$. Then, +> +> $$ \sup_u | \mathbb{P}_{\widehat{F}_n} \left( \sqrt{n} (T( \widehat{F}_n*) - T( \widehat{F}_n) \leq u \right) - \mathbb{P}_{\widehat{F}} \left( \sqrt{n} (T( \widehat{F}_n) - T( \widehat{F}) \leq u \right) | \rightarrow^\text{P} 0 $$ + +things I understand about these theorems: + + * the two formulas they’re concluding are the same, except I think one is about convergence “almost surely” and one about “convergence in probability”. I don’t remember what either of those mean. + * I think for our purposes of doing Regular Boring Things we can replace “Hadamard differentiable” with “differentiable” + * I think they don’t actually show the consistency of the bootstrap, they’re actually about consistency of the bootstrap confidence interval estimate (which is a different thing) + + + +I don’t really understand how they’re related to consistency, and in particular the $\sup_u$ thing is weird, like if you’re looking at $\mathbb{P}(something < u)$, wouldn’t you want to minimize $u$ and not maximize it? Maybe it’s a typo and it should be $\inf_u$? + +it concludes: + +> there is a tendency to treat the bootstrap as a panacea for all problems. But the bootstrap requires regularity conditions to yield valid answers. It should not be applied blindly. + +### this book does not seem to explain why the bootstrap is consistent + +In the appendix (3.7) it gives a sketch of a proof for showing that estimating the **median** using the bootstrap is consistent. I don’t think this book actually gives a proof anywhere that bootstrap estimates in general are consistent, which was pretty surprising to me. It gives a bunch of references to papers. Though I guess bootstrap confidence intervals are the most important thing? + +### that’s all for now + +This is all extremely stream of consciousness and I only spent 2 hours trying to work through this, but some things I think I learned in the last couple hours are: + + 1. maybe having more data is exponentially better? (is this true??) + 2. “consistency” of an estimator is a thing, not all estimators are consistent + 3. understanding when/why nonparametric bootstrap estimators are consistent in general might be very hard (the proof that the bootstrap median estimator is consistent already seems very complicated!) + 4. boostrap confidence intervals are not the same thing as bootstrap estimators. Maybe I’ll learn the difference next! + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/29/some-initial-nonparametric-statistics-notes/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.wolframalpha.com/input/?i=integrate+(d%2Fdx(d%2Fdx(exp(-x%5E2))))%5E2++dx+from+x%3D-infinity+to+infinity +[2]: https://jvns.ca/images/nonpar-histogram.png +[3]: https://en.wikipedia.org/wiki/Hoeffding%27s_inequality +[4]: https://nbviewer.jupyter.org/github/henrywallace/games/blob/master/boggle/boggle.ipynb#Estimating-Word-Probabilities diff --git a/sources/tech/20190129 A few early marketing thoughts.md b/sources/tech/20190129 A few early marketing thoughts.md new file mode 100644 index 0000000000..79cc6b1b1d --- /dev/null +++ b/sources/tech/20190129 A few early marketing thoughts.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A few early marketing thoughts) +[#]: via: (https://jvns.ca/blog/2019/01/29/marketing-thoughts/) +[#]: author: (Julia Evans https://jvns.ca/) + +A few early marketing thoughts +====== + +At some point last month I said I might write more about business, so here are some very early marketing thoughts for my zine business (!). The question I’m trying to make some progress on in this post is: “how to do marketing in a way that feels good?” + +### what’s the point of marketing? + +Okay! What’s marketing? What’s the point? I think the ideal way marketing works is: + + 1. you somehow tell a person about a thing + 2. you explain somehow why the thing will be useful to them / why it is good + 3. they buy it and they like the thing because it’s what they expected + + + +(or, when you explain it they see that they don’t want it and don’t buy it which is good too!!) + +So basically as far as I can tell good marketing is just explaining what the thing is and why it is good in a clear way. + +### what internet marketing techniques do people use? + +I’ve been thinking a bit about internet marketing techniques I see people using on me recently. Here are a few examples of internet marketing techniques I’ve seen: + + 1. word of mouth (“have you seen this cool new thing?!”) + 2. twitter / instagram marketing (build a twitter/instagram account) + 3. email marketing (“build a mailing list with a bajillion people on it and sell to them”) + 4. email marketing (“tell your existing users about features that they already have that they might want to use”) + 5. social proof marketing (“jane from georgia bought a sweater”), eg fomo.com + 6. cart notifications (“you left this sweater in your cart??! did you mean to buy it? maybe you should buy it!“) + 7. content marketing (which is fine but whenever people refer to my writing as ‘content’ I get grumpy :)) + + + +### you need _some_ way to tell people about your stuff + +Something that is definitely true about marketing is that you need some way to tell new people about the thing you are doing. So for me when I’m thinking about running a business it’s less about “should i do marketing” and more like “well obviously i have to do marketing, how do i do it in a way that i feel good about?” + +### what’s up with email marketing? + +I feel like every single piece of internet marketing advice I read says “you need a mailing list”. This is advice that I haven’t really taken to heart – technically I have 2 mailing lists: + + 1. the RSS feed for this blog, which sends out new blog posts to a mailing list for folks who don’t use RSS (which 3000 of you get) + 2. ’s list, for comics / new zine announcements (780 people subscribe to that! thank you!) + + + +but definitely neither of them is a Machine For Making Sales and I’ve put in almost no efforts in that direction yet. + +here are a few things I’ve noticed about marketing mailing lists: + + * most marketing mailing lists are boring but some marketing mailing lists are actually interesting! For example I kind of like [amy hoy][1]’s emails. + * Someone told me recently that they have 200,000 people on their mailing list (?!!) which made the “a mailing list is a machine for making money” concept make a lot more sense to me. I wonder if people who make a lot of money from their mailing lists all have huge 10k+ person mailing lists like this? + + + +### what works for me: twitter + +Right now for my zines business I’d guess maybe 70% of my sales come from Twitter. The main thing I do is tweet pages from zines I’m working on (for example: yesterday’s [comic about ss][2]). The comics are usually good and fun so invariably they get tons of retweets, which means that I end up with lots of followers, which means that when I later put up the zine for sale lots of people will buy it. + +And of course people don’t _have_ to buy the zines, I post most of what ends up in my zines on twitter for free, so it feels like a nice way to do it. Everybody wins, I think. + +(side note: when I started getting tons of new followers from my comics I was actually super worried that it would make my experience of Twitter way worse. That hasn’t happened! the new followers all seem totally reasonable and I still get a lot of really interesting twitter replies which is wonderful ❤) + +I don’t try to hack/optimize this really: I just post comics when I make them and I try to make them good. + +### a small Twitter innovation: putting my website on the comics + +Here’s one small marketing change that I made that I think makes sense! + +In the past, I didn’t put anything about how to buy my comics on the comics I posted on Twitter, just my Twitter username. Like this: + +![][3] + +After a while, I realized people were asking me all the time “hey, can I buy a book/collection? where do these come from? how do I get more?“! I think a marketing secret is “people actually want to buy things that are good, it is useful to tell people where they can buy things that are good”. + +So just recently I’ve started adding my website and a note about my current project on the comics I post on Twitter. It doesn’t say much: just “❤ these comics? buy a collection! wizardzines.com” and “page 11 of my upcoming bite size networking zine”. Here’s what it looks like: + +![][4] + +I feel like this strikes a pretty good balance between “julia you need to tell people what you’re doing otherwise how are they supposed to buy things from you” and “omg too many sales pitches everywhere”? I’ve only started doing this recently so we’ll see how it goes. + +### should I work on a mailing list? + +It seems like the same thing that works on twitter would work by email if I wanted to put in the time (email people comics! when a zine comes out, email them about the zine and they can buy it if they want!). + +One thing I LOVE about Twitter though is that people always reply to the comics I post with their own tips and tricks that they love and I often learn something new. I feel like email would be nowhere near as fun :) + +But I still think this is a pretty good idea: keeping up with twitter can be time consuming and I bet a lot of people would like to get occasional email with programming drawings. (would you?) + +One thing I’m not sure about is – a lot of marketing mailing lists seem to use somewhat aggressive techniques to get new emails (a lot of popups on a website, or adding everyone who signs up to their service / buys a thing to a marketing list) and while I’m basically fine with that (unsubscribing is easy!), I’m not sure that it’s what I’d want to do, and maybe less aggressive techniques will work just as well? We’ll see. + +### should I track conversion rates? + +A piece of marketing advice I assume people give a lot is “be data driven, figure out what things convert the best, etc”. I don’t do this almost at all – gumroad used to tell me that most of my sales came from Twitter which was good to know, but right now I have basically no idea how it works. + +Doing a bunch of work to track conversion rates feels bad to me: it seems like it would be really easy to go down a dumb rabbit hole of “oh, let’s try to increase conversion by 5%” instead of just focusing on making really good and cool things. + +My guess is that what will work best for me for a while is to have some data that tells me in broad strokes how the business works (like “about 70% of sales come from twitter”) and just leave it at that. + +### should I do advertising? + +I had a conversation with Kamal about this post that went: + + * julia: “hmm, maybe I should talk about ads?” + * julia: “wait, are ads marketing?” + * kamal: “yes ads are marketing” + + + +So, ads! I don’t know anything about advertising except that you can advertise on Facebook or Twitter or Google. Some non-ethical questions I have about advertising: + + * how do you choose what keywords to advertise on? + * are there actually cheap keywords, like is ‘file descriptors’ cheap? + * how much do you need to pay per click? (for some weird linux keywords, google estimated 20 cents a click?) + * can you use ads effectively for something that costs $10? + + + +This seems nontrivial to learn about and I don’t think I’m going to try soon. + +### other marketing things + +a few other things I’ve thought about: + + * I learned about “social proof marketing” sites like fomo.com yesterday which makes popups on your site like “someone bought COOL THING 3 hours ago”. This seems like it has some utility (people are actually buying things from me all the time, maybe that’s useful to share somehow?) but those popups feel a bit cheap to me and I don’t really think it’s something I’d want to do right now. + * similarly a lot of sites like to inject these popups like “HELLO PLEASE SIGN UP FOR OUR MAILING LIST”. similar thoughts. I’ve been putting an email signup link in the footer which seems like a good balance between discoverable and annoying. As an example of a popup which isn’t too intrusive, though: nate berkopec has [one on his site][5] which feels really reasonable! (scroll to the bottom to see it) + + + +Maybe marketing is all about “make your things discoverable without being annoying”? :) + +### that’s all! + +Hopefully some of this was interesting! Obviously the most important thing in all of this is to make cool things that are useful to people, but I think cool useful writing does not actually sell itself! + +If you have thoughts about what kinds of marketing have worked well for you / you’ve felt good about I would love to hear them! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/01/29/marketing-thoughts/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://stackingthebricks.com/ +[2]: https://twitter.com/b0rk/status/1090058524137345025 +[3]: https://jvns.ca/images/kill.jpeg +[4]: https://jvns.ca/images/ss.jpeg +[5]: https://www.speedshop.co/2019/01/10/three-activerecord-mistakes.html diff --git a/sources/tech/20190129 Create an online store with this Java-based framework.md b/sources/tech/20190129 Create an online store with this Java-based framework.md deleted file mode 100644 index b72a8551de..0000000000 --- a/sources/tech/20190129 Create an online store with this Java-based framework.md +++ /dev/null @@ -1,235 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Create an online store with this Java-based framework) -[#]: via: (https://opensource.com/article/19/1/scipio-erp) -[#]: author: (Paul Piper https://opensource.com/users/madppiper) - -Create an online store with this Java-based framework -====== -Scipio ERP comes with a large range of applications and functionality. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0) - -So you want to sell products or services online, but either can't find a fitting software or think customization would be too costly? [Scipio ERP][1] may just be what you are looking for. - -Scipio ERP is a Java-based open source e-commerce framework that comes with a large range of applications and functionality. The project was forked from [Apache OFBiz][2] in 2014 with a clear focus on better customization and a more modern appeal. The e-commerce component is quite extensive and works in a multi-store setup, internationally, and with a wide range of product configurations, and it's also compatible with modern HTML frameworks. The software also provides standard applications for many other business cases, such as accounting, warehouse management, or sales force automation. It's all highly standardized and therefore easy to customize, which is great if you are looking for more than a virtual cart. - -The system makes it very easy to keep up with modern web standards, too. All screens are constructed using the system's "[templating toolkit][3]," an easy-to-learn macro set that separates HTML from all applications. Because of it, every application is already standardized to the core. Sounds confusing? It really isn't—it all looks a lot like HTML, but you write a lot less of it. - -### Initial setup - -Before you get started, make sure you have Java 1.8 (or greater) SDK and a Git client installed. Got it? Great! Next, check out the master branch from GitHub: - -``` -git clone https://github.com/ilscipio/scipio-erp.git -cd scipio-erp -git checkout master -``` - -To set up the system, simply run **./install.sh** and select either option from the command line. Throughout development, it is best to stick to an **installation for development** (Option 1), which will also install a range of demo data. For professional installations, you can modify the initial config data ("seed data") so it will automatically set up the company and catalog data for you. By default, the system will run with an internal database, but it [can also be configured][4] with a wide range of relational databases such as PostgreSQL and MariaDB. - -![Setup wizard][6] - -Follow the setup wizard to complete your initial configuration, - -Start the system with **./start.sh** and head over to **** to complete the configuration. If you installed with demo data, you can log in with username **admin** and password **scipio**. During the setup wizard, you can set up a company profile, accounting, a warehouse, your product catalog, your online store, and additional user profiles. Keep the website entries on the product store configuration screen for now. The system allows you to run multiple webstores with different underlying code; unless you want to do that, it is easiest to stick to the defaults. - -Congratulations, you just installed Scipio ERP! Play around with the screens for a minute or two to get a feel for the functionality. - -### Shortcuts - -Before you jump into the customization, here are a few handy commands that will help you along the way: - - * Create a shop-override: **./ant create-component-shop-override** - * Create a new component: **./ant create-component** - * Create a new theme component: **./ant create-theme** - * Create admin user: **./ant create-admin-user-login** - * Various other utility functions: **./ant -p** - * Utility to install & update add-ons: **./git-addons help** - - - -Also, make a mental note of the following locations: - - * Scripts to run Scipio as a service: **/tools/scripts/** - * Log output directory: **/runtime/logs** - * Admin application: **** - * E-commerce application: **** - - - -Last, Scipio ERP structures all code in the following five major directories: - - * Framework: framework-related sources, the application server, generic screens, and configurations - * Applications: core applications - * Addons: third-party extensions - * Themes: modifies the look and feel - * Hot-deploy: your own components - - - -Aside from a few configurations, you will be working within the hot-deploy and themes directories. - -### Webstore customizations - -To really make the system your own, start thinking about [components][7]. Components are a modular approach to override, extend, and add to the system. Think of components as self-contained web modules that capture information on databases ([entity][8]), functions ([services][9]), screens ([views][10]), [events and actions][11], and web applications. Thanks to components, you can add your own code while remaining compatible with the original sources. - -Run **./ant create-component-shop-override** and follow the steps to create your webstore component. A new directory will be created inside of the hot-deploy directory, which extends and overrides the original e-commerce application. - -![component directory structure][13] - -A typical component directory structure. - -Your component will have the following directory structure: - - * config: configurations - * data: seed data - * entitydef: database table definitions - * script: Groovy script location - * servicedef: service definitions - * src: Java classes - * webapp: your web application - * widget: screen definitions - - - -Additionally, the **ivy.xml** file allows you to add Maven libraries to the build process and the **ofbiz-component.xml** file defines the overall component and web application structure. Apart from the obvious, you will also find a **controller.xml** file inside the web apps' **WEB-INF** directory. This allows you to define request entries and connect them to events and screens. For screens alone, you can also use the built-in CMS functionality, but stick to the core mechanics first. Familiarize yourself with **/applications/shop/** before introducing changes. - -#### Adding custom screens - -Remember the [templating toolkit][3]? You will find it used on every screen. Think of it as a set of easy-to-learn macros that structure all content. Here's an example: - -``` -<@section title="Title"> -    <@heading id="slider">Slider -    <@row> -        <@cell columns=6> -            <@slider id="" class="" controls=true indicator=true> -                <@slide link="#" image="https://placehold.it/800x300">Just some content… -                <@slide title="This is a title" link="#" image="https://placehold.it/800x300"> -            -        -        <@cell columns=6>Second column -    - -``` - -Not too difficult, right? Meanwhile, themes contain the HTML definitions and styles. This hands the power over to your front-end developers, who can define the output of each macro and otherwise stick to their own build tools for development. - -Let's give it a quick try. First, define a request on your own webstore. You will modify the code for this. A built-in CMS is also available at **** , which allows you to create new templates and screens in a much more efficient way. It is fully compatible with the templating toolkit and comes with example templates that can be adopted to your preferences. But since we are trying to understand the system here, let's go with the more complicated way first. - -Open the **[controller.xml][14]** file inside of your shop's webapp directory. The controller keeps track of request events and performs actions accordingly. The following will create a new request under **/shop/test** : - -``` - - -      -      - -``` - -You can define multiple responses and, if you want, you could use an event or a service call inside the request to determine which response you may want to use. I opted for a response of type "view." A view is a rendered response; other types are request-redirects, forwards, and alike. The system comes with various renderers and allows you to determine the output later; to do so, add the following: - -``` - - -``` - -Replace **my-component** with your own component name. Then you can define your very first screen by adding the following inside the tags within the **widget/CommonScreens.xml** file: - -``` - -       
      -            -            -            -                -                    -                        -                    -                -            -       
      -   
      -``` - -Screens are actually quite modular and consist of multiple elements ([widgets, actions, and decorators][15]). For the sake of simplicity, leave this as it is for now, and complete the new webpage by adding your very first templating toolkit file. For that, create a new **webapp/mycomponent/test/test.ftl** file and add the following: - -``` -<@alert type="info">Success! -``` - -![Custom screen][17] - -A custom screen. - -Open **** and marvel at your own accomplishments. - -#### Custom themes - -Modify the look and feel of the shop by creating your very own theme. All themes can be found as components inside of the themes folder. Run **./ant create-theme** to add your own. - -![theme component layout][19] - -A typical theme component layout. - -Here's a list of the most important directories and files: - - * Theme configuration: **data/*ThemeData.xml** - * Theme-specific wrapping HTML: **includes/*.ftl** - * Templating Toolkit HTML definition: **includes/themeTemplate.ftl** - * CSS class definition: **includes/themeStyles.ftl** - * CSS framework: **webapp/theme-title/*** - - - -Take a quick look at the Metro theme in the toolkit; it uses the Foundation CSS framework and makes use of all the things above. Afterwards, set up your own theme inside your newly constructed **webapp/theme-title** directory and start developing. The Foundation-shop theme is a very simple shop-specific theme implementation that you can use as a basis for your own work. - -Voila! You have set up your own online store and are ready to customize! - -![Finished Scipio ERP shop][21] - -A finished shop based on Scipio ERP. - -### What's next? - -Scipio ERP is a powerful framework that simplifies the development of complex e-commerce applications. For a more complete understanding, check out the project [documentation][7], try the [online demo][22], or [join the community][23]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/scipio-erp - -作者:[Paul Piper][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/madppiper -[b]: https://github.com/lujun9972 -[1]: https://www.scipioerp.com -[2]: https://ofbiz.apache.org/ -[3]: https://www.scipioerp.com/community/developer/freemarker-macros/ -[4]: https://www.scipioerp.com/community/developer/installation-configuration/configuration/#database-configuration -[5]: /file/419711 -[6]: https://opensource.com/sites/default/files/uploads/setup_step5_sm.jpg (Setup wizard) -[7]: https://www.scipioerp.com/community/developer/architecture/components/ -[8]: https://www.scipioerp.com/community/developer/entities/ -[9]: https://www.scipioerp.com/community/developer/services/ -[10]: https://www.scipioerp.com/community/developer/views-requests/ -[11]: https://www.scipioerp.com/community/developer/events-actions/ -[12]: /file/419716 -[13]: https://opensource.com/sites/default/files/uploads/component_structure.jpg (component directory structure) -[14]: https://www.scipioerp.com/community/developer/views-requests/request-controller/ -[15]: https://www.scipioerp.com/community/developer/views-requests/screen-widgets-decorators/ -[16]: /file/419721 -[17]: https://opensource.com/sites/default/files/uploads/success_screen_sm.jpg (Custom screen) -[18]: /file/419726 -[19]: https://opensource.com/sites/default/files/uploads/theme_structure.jpg (theme component layout) -[20]: /file/419731 -[21]: https://opensource.com/sites/default/files/uploads/finished_shop_1_sm.jpg (Finished Scipio ERP shop) -[22]: https://www.scipioerp.com/demo/ -[23]: https://forum.scipioerp.com/ diff --git a/sources/tech/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md b/sources/tech/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md deleted file mode 100644 index 3b9af595d6..0000000000 --- a/sources/tech/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Earliest Linux Distros: Before Mainstream Distros Became So Popular) -[#]: via: (https://itsfoss.com/earliest-linux-distros/) -[#]: author: (Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/) - -The Earliest Linux Distros: Before Mainstream Distros Became So Popular -====== - -In this throwback history article, we’ve tried to look back into how some of the earliest Linux distributions evolved and came into being as we know them today. - -![][1] - -In here we have tried to explore how the idea of popular distros such as Red Hat, Debian, Slackware, SUSE, Ubuntu and many others came into being after the first Linux kernel became available. - -As Linux was initially released in the form of a kernel in 1991, the distros we know today was made possible with the help of numerous collaborators throughout the world with the creation of shells, libraries, compilers and related packages to make it a complete Operating System. - -### 1\. The first known “distro” by HJ Lu - -The way we know Linux distributions today goes back to 1992, when the first known distro-like tools to get access to Linux were released by HJ Lu. It consisted of two 5.25” floppy diskettes: - -![Linux 0.12 Boot and Root Disks | Photo Credit][2] - - * **LINUX 0.12 BOOT DISK** : The “boot” disk was used to boot the system first. - * **LINUX 0.12 ROOT DISK** : The second “root” disk for getting a command prompt for access to the Linux file system after booting. - - - -To install 0.12 on a hard drive, one had to use a hex editor to edit its master boot record (MBR) and that was quite a complex process, especially during that era. - -Feeling too nostalgic? - -You can [install cool-retro-term application][3] that gives you a Linux terminal in the vintage looks of the 90’s computers. - -### 2\. MCC Interim Linux - -![MCC Linux 0.99.14, 1993 | Image Credit][4] - -Initially released in the same year as “LINUX 0.12” by Owen Le Blanc of Manchester Computing Centre in England, MCC Interim Linux was the first Linux distribution for novice users with a menu driven installer and end user/programming tools. Also in the form of a collection of diskettes, it could be installed on a system to provide a basic text-based environment. - -MCC Interim Linux was much more user-friendly than 0.12 and the installation process on a hard drive was much easier and similar to modern ways. It did not require using a hex editor to edit the MBR. - -Though it was first released in February 1992, it was also available for download through FTP since November that year. - -### 3\. TAMU Linux - -![TAMU Linux | Image Credit][5] - -TAMU Linux was developed by Aggies at Texas A&M with the Texas A&M Unix & Linux Users Group in May 1992 and was called TAMU 1.0A. It was the first Linux distribution to offer the X Window System instead of just a text based operating system. - -### 4\. Softlanding Linux System (SLS) - -![SLS Linux 1.05, 1994 | Image Credit][6] - -“Gentle Touchdowns for DOS Bailouts” was their slogan! SLS was released by Peter McDonald in May 1992. SLS was quite widely used and popular during its time and greatly promoted the idea of Linux. But due to a decision by the developers to change the executable format in the distro, users stopped using it. - -Many of the popular distros the present community is most familiar with, evolved via SLS. Two of them are: - - * **Slackware** : One of the earliest Linux distros, Slackware was created by Patrick Volkerding in 1993. Slackware is based on SLS and was one of the very first Linux distributions. - * **Debian** : An initiative by Ian Murdock, Debian was also released in 1993 after moving on from the SLS model. The very popular Ubuntu distro we know today is based on Debian. - - - -### 5\. Yggdrasil - -![LGX Yggdrasil Fall 1993 | Image Credit][7] - -Released on December 1992, Yggdrasil was the first distro to give birth to the idea of Live Linux CDs. It was developed by Yggdrasil Computing, Inc., founded by Adam J. Richter in Berkeley, California. It could automatically configure itself on system hardware as “Plug-and-Play”, which is a very regular and known feature in today’s time. The later versions of Yggdrasil included a hack for running any proprietary MS-DOS CD-ROM driver within Linux. - -![Yggdrasil’s Plug-and-Play Promo | Image Credit][8] - -Their motto was “Free Software For The Rest of Us”. - -In the late 90s, one very popular distro was [Mandriva][9], first released in 1998, by unifying the French _Mandrake Linux_ distribution with the Brazilian _Conectiva Linux_ distribution. It had a release lifetime of 18 months for updates related to Linux and system software and desktop based updates were released every year. It also had server versions with 5 years of support. Now we have [Open Mandriva][10]. - -If you have more nostalgic distros to share from the earliest days of Linux release, please share with us in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/earliest-linux-distros/ - -作者:[Avimanyu Bandyopadhyay][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/avimanyu/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/earliest-linux-distros.png?resize=800%2C450&ssl=1 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-0.12-Floppies.jpg?ssl=1 -[3]: https://itsfoss.com/cool-retro-term/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/MCC-Interim-Linux-0.99.14-1993.jpg?fit=800%2C600&ssl=1 -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/TAMU-Linux.jpg?ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/SLS-1.05-1994.jpg?ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/LGX_Yggdrasil_CD_Fall_1993.jpg?fit=781%2C800&ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Yggdrasil-Linux-Summer-1994.jpg?ssl=1 -[9]: https://en.wikipedia.org/wiki/Mandriva_Linux -[10]: https://www.openmandriva.org/ diff --git a/sources/tech/20190217 Organizing this blog into categories.md b/sources/tech/20190217 Organizing this blog into categories.md new file mode 100644 index 0000000000..e8a03f1bdd --- /dev/null +++ b/sources/tech/20190217 Organizing this blog into categories.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organizing this blog into categories) +[#]: via: (https://jvns.ca/blog/2019/02/17/organizing-this-blog-into-categories/) +[#]: author: (Julia Evans https://jvns.ca/) + +Organizing this blog into categories +====== + +Today I organized the front page of this blog ([jvns.ca][1]) into CATEGORIES! Now it is actually possible to make some sense of what is on here!! There are 28 categories (computer networking! learning! “how things work”! career stuff! many more!) I am so excited about this. + +How it works: Every post is in only 1 category. Obviously the categories aren’t “perfect” (there is a “how things work” category and a “kubernetes” category and a “networking” category, and so for a “how container networking works in kubernetes” I need to just pick one) but I think it’s really nice and I’m hoping that it’ll make the blog easier for folks to navigate. + +If you’re interested in more of the story of how I’m thinking about this: I’ve been a little dissatisfied for a long time with how this blog is organized. Here’s where I started, in 2013, with a pretty classic blog layout (this is Octopress, which was a Jekyll Wordpress-lookalike theme that was cool back then and which served me very well for a long time): + +![][2] + +### problem with “show the 5 most recent posts”: you don’t know what the person’s writing is about! + +This is a super common way to organize a blog: on the homepage of your blog, you display maybe the 5 most recent posts, and then maybe have a “previous” link. + +The thing I find tricky about this (as a blog reader) is that + + 1. it’s hard to hunt through their back catalog to find cool things they’ve written + 2. it’s SO HARD to get an overall sense for the body of a person’s work by reading 1 blog post at a time + + + +### next attempt: show every post in chronological order + +My next attempt at blog organization was to show every post on the homepage in chronological order. This was inspired by [Dan Luu’s blog][3], which takes a super minimal approach. I switched to this (according to the internet archive) sometime in early 2016. Here’s what it looked like (with some CSS issues :)) + +![][4] + +The reason I like this “show every post in chronological order” approach more is that when I discover a new blog, I like to obsessively binge read through the whole thing to see all the cool stuff the person has written. [Rachel by the bay][5] also organizes her writing this way, and when I found her blog I was like OMG WOW THIS IS AMAZING I MUST READ ALL OF THIS NOW and being able to look through all the entries quickly and start reading ones that caught my eye was SO FUN. + +[Will Larson’s blog][6] also has a “list of all posts” page which I find useful because it’s a good blog, and sometimes I want to refer back to something he wrote months ago and can’t remember what it was called, and being able to scan through all the titles makes it easier to do that. + +I was pretty happy with this and that’s how it’s been for the last 3 years. + +### problem: a chronological list of 390 posts still kind of sucks + +As of today, I have 390 posts here (360,000 words! that’s, like, 4 300-page books! eep!). This is objectively a lot of writing and I would like people new to the blog to be able to navigate it and actually have some idea what’s going on. + +And this blog is not actually just a totally disorganized group of words! I have a lot of specific interests: I’ve written probably 30 posts about computer networking, 15ish on ML/statistics, 20ish career posts, etc. And when I write a new Kubernetes post or whatever, it’s usually at least sort of related to some ongoing train of thought I have about Kubernetes. And it’s totally obvious to _me_ what other posts that post is related to, but obviously to a new person it’s not at all clear what the trains of thought are in this blog. + +### solution for now: assign every post 1 (just 1) category + +My new plan is to assign every post a single category. I got this idea from [Itamar Turner-Trauring’s site][7]. + +Here are the initial categories: + + * Cool computer tools / features / ideas + * Computer networking + * How a computer thing works + * Kubernetes / containers + * Zines / comics + * On writing comics / zines + * Conferences + * Organizing conferences + * Businesses / marketing + * Statistics / machine learning / data analysis + * Year in review + * Infrastructure / operations engineering + * Career / work + * Working with others / communication + * Remote work + * Talks transcripts / podcasts + * On blogging / speaking + * On learning + * Rust + * Linux debugging / tracing tools + * Debugging stories + * Fan posts about awesome work by other people + * Inclusion + * rbspy + * Performance + * Open source + * Linux systems stuff + * Recurse Center (my daily posts during my RC batch) + + + +I guess you can tell this is a systems-y blog because there are 8 different systems-y categories (kubernetes, infrastructure, linux debugging tools, rust, debugging stories, performance, and linux systems stuff, how a computer thing works) :). + +But it was nice to see that I also have this huge career / work category! And that category is pretty meaningful to me, it includes a lot of things that I struggled with and were hard for me to learn. And I get to put all my machine learning posts together, which is an area I worked in for 3 years and am still super interested in and every so often learn a new thing about! + +### How I assign the categories: a big text file + +I came up with a scheme for assigning the categories that I thought was really fun! I knew immediately that coming up with categories in advance would be impossible (how was I supposed to know that “fan posts about awesome work by other people” was a substantial category?) + +So instead, I took kind of a Marie Kondo approach: I wrote a script to just dump all the titles of every blog post into a text file, and then I just used vim to organize them roughly into similar sections. Seeing everything in one place (a la marie kondo) really helped me see the patterns and figure out what some categories were. + +[Here’s the final result of that text file][8]. I think having a lightweight way of organizing the posts all in one file made a huge difference and that it would have been impossible for me to seen the patterns otherwise. + +### How I implemented it: a hugo taxonomy + +Once I had that big text file, I wrote [a janky python script][9] to assign the categories in that text file to the actual posts. + +I use Hugo for this blog, and so I also needed to tell Hugo about the categories. This blog already technically has tags (though they’re woefully underused, I didn’t want to delete them). I use Hugo, and it turns out that in Hugo you can define arbitrary taxonomies. So I defined a new taxonomy for these sections (right now it’s called, unimaginitively, `juliasections`). + +The details of how I did this are pretty boring but [here’s the hugo template that makes it display on the homepage][10]. I used this [Hugo documentation page on taxonomies a lot][11]. + +### organizing my site is cool! reverse chronology maybe isn’t the best possible thing! + +Amy Hoy has this interesting article called [how the blog broke the web][12] about how the rise of blog software made people adopt a site format that maybe didn’t serve what they were writing the best. + +I don’t personally feel that mad about the blog / reverse chronology organization: I like blogging! I think it was nice for the first 6 years or whatever to be able to just write things that I think are cool without thinking about where they “fit”. It’s worked really well for me. + +But today, 360,000 words in, I think it makes sense to add a little more structure :). + +### what it looks like now! + +Here’s what the new front page organization looks like! These are the blogging / learning / rust sections! I think it’s cool how you can see the evolution of some of my thinking (I sure have written a lot of posts about asking questions :)). + +![][13] + +### I ❤ the personal website + +This is also part of why I love having a personal website that I can organize any way I want: for both of my main sites ([jvns.ca][1] and now [wizardzines.com][14]) I have total control over how they appear! And I can evolve them over time at my own pace if I decide something a little different will work better for me. I’ve gone from a jekyll blog to octopress to a custom-designed octopress blog to Hugo and made a ton of little changes over time. It’s so nice. + +I think it’s fun that these 3 screenshots are each 3 years apart – what I wanted in 2013 is not the same as 2016 is not the same as 2019! This is okay! + +And I really love seeing how other people choose to organize their personal sites! Please keep making cool different personal sites. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/02/17/organizing-this-blog-into-categories/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca +[2]: https://jvns.ca/images/website-2013.png +[3]: https://danluu.com +[4]: https://jvns.ca/images/website-2016.png +[5]: https://rachelbythebay.com/w/ +[6]: https://lethain.com/all-posts/ +[7]: https://codewithoutrules.com/worklife/ +[8]: https://github.com/jvns/jvns.ca/blob/2f7b2723994628a5348069dd87b3df68c2f0285c/scripts/titles.txt +[9]: https://github.com/jvns/jvns.ca/blob/2f7b2723994628a5348069dd87b3df68c2f0285c/scripts/parse_titles.py +[10]: https://github.com/jvns/jvns.ca/blob/25d239a3ba36c1bae1d055d2b7d50a4f1d0489ef/themes/orange/layouts/index.html#L39-L59 +[11]: https://gohugo.io/templates/taxonomy-templates/ +[12]: https://stackingthebricks.com/how-blogs-broke-the-web/ +[13]: https://jvns.ca/images/website-2019.png +[14]: https://wizardzines.com diff --git a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md deleted file mode 100644 index 5bfa0fa915..0000000000 --- a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (beamrolling) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) -[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install VirtualBox on Ubuntu [Beginner’s Tutorial] -====== - -**This beginner’s tutorial explains various ways to install VirtualBox on Ubuntu and other Debian-based Linux distributions.** - -Oracle’s free and open source offering [VirtualBox][1] is an excellent virtualization tool, specially for desktop operating systems. I prefer using it over [VMWare Workstation in Linux][2], another virtualization tool. - -You can use virtualization software like VirtualBox for installing and using another operating system within a virtual machine. - -For example, you can [install Linux on VirtualBox inside Windows][3]. Similarly, you can also [install Windows inside Linux using VirtualBox][4]. - -You can also use VirtualBox for installing another Linux distribution in your current Linux system. Actually, this is what I use it for. If I hear about a nice Linux distribution, instead of installing it on a real system, I test it on a virtual machine. It’s more convenient when you just want to try out a distribution before making a decision about installing it on your actual machine. - -![Linux installed inside Linux using VirtualBox][5]Ubuntu 18.10 installed inside Ubuntu 18.04 - -In this beginner’s tutorial, I’ll show you various ways of installing Oracle VirtualBox on Ubuntu and other Debian-based distributions. - -### Installing VirtualBox on Ubuntu and Debian based Linux distributions - -The installation methods mentioned here should also work for other Debian and Ubuntu-based Linux distributions such as Linux Mint, elementary OS etc. - -#### Method 1: Install VirtualBox from Ubuntu Repository - -**Pros** : Easy installation - -**Cons** : Installs older version - -The easiest way to install VirtualBox on Ubuntu would be to search for it in the Software Center and install it from there. - -![VirtualBox in Ubuntu Software Center][6]VirtualBox is available in Ubuntu Software Center - -You can also install it from the command line using the command: - -``` -sudo apt install virtualbox -``` - -However, if you [check the package version before installing it][7], you’ll see that the VirtualBox provided by Ubuntu’s repository is quite old. - -For example, the current VirtualBox version at the time of writing this tutorial is 6.0 but the one in Software Center is 5.2. This means you won’t get the newer features introduced in the [latest version of VirtualBox][8]. - -#### Method 2: Install VirtualBox using Deb file from Oracle’s website - -**Pros** : Easily install the latest version - -**Cons** : Can’t upgrade to newer version - -If you want to use the latest version of VirtualBox on Ubuntu, the easiest way would be to [use the deb file][9]. - -Oracle provides read to use binary files for VirtualBox releases. If you look at its download page, you’ll see the option to download the deb installer files for Ubuntu and other distributions. - -![VirtualBox Linux Download][10] - -You just have to download this deb file and double click on it to install it. It’s as simple as that. - -However, the problem with this method is that you won’t get automatically updated to the newer VirtualBox releases. The only way is to remove the existing version, download the newer version and install it again. That’s not very convenient, is it? - -#### Method 3: Install VirualBox using Oracle’s repository - -**Pros** : Automatically updates with system updates - -**Cons** : Slightly complicated installation - -Now this is the command line method and it may seem complicated to you but it has advantages over the previous two methods. You’ll get the latest version of VirtualBox and it will be automatically updated to the future releases. That’s what you would want, I presume. - -To install VirtualBox using command line, you add the Oracle VirtualBox’s repository in your list of repositories. You add its GPG key so that your system trusts this repository. Now when you install VirtualBox, it will be installed from Oracle’s repository instead of Ubuntu’s repository. If there is a new version released, VirtualBox install will be updated along with the system updates. Let’s see how to do that. - -First, add the key for the repository. You can download and add the key using this single command. - -``` -wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - -``` - -``` -Important for Mint users - -The next step will work for Ubuntu only. If you are using Linux Mint or some other distribution based on Ubuntu, replace $(lsb_release -cs) in the command with the Ubuntu version your current version is based on. For example, Linux Mint 19 series users should use bionic and Mint 18 series users should use xenial. Something like this - -sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“ -``` - -Now add the Oracle VirtualBox repository in the list of repositories using this command: - -``` -sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" -``` - -If you have read my article on [checking Ubuntu version][11], you probably know that ‘lsb_release -cs’ will print the codename of your Ubuntu system. - -**Note** : If you see [add-apt-repository command not found][12] error, you’ll have to install software-properties-common package. - -Now that you have the correct repository added, refresh the list of available packages through these repositories and install VirtualBox. - -``` -sudo apt update && sudo apt install virtualbox-6.0 -``` - -**Tip** : A good idea would be to type sudo apt install **virtualbox–** and hit tab to see the various VirtualBox versions available for installation and then select one of them by typing it completely. - -![Install VirtualBox via terminal][13] - -### How to remove VirtualBox from Ubuntu - -Now that you have learned to install VirtualBox, I would also mention the steps to remove it. - -If you installed it from the Software Center, the easiest way to remove the application is from the Software Center itself. You just have to find it in the [list of installed applications][14] and click the Remove button. - -Another ways is to use the command line. - -``` -sudo apt remove virtualbox virtualbox-* -``` - -Note that this will not remove the virtual machines and the files associated with the operating systems you installed using VirtualBox. That’s not entirely a bad thing because you may want to keep them safe to use it later or in some other system. - -**In the end…** - -I hope you were able to pick one of the methods to install VirtualBox. I’ll also write about using it effectively in another article. For the moment, if you have and tips or suggestions or any questions, feel free to leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-virtualbox-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://www.virtualbox.org -[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[3]: https://itsfoss.com/install-linux-in-virtualbox/ -[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 -[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ -[8]: https://itsfoss.com/oracle-virtualbox-release/ -[9]: https://itsfoss.com/install-deb-files-ubuntu/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 -[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[12]: https://itsfoss.com/add-apt-repository-command-not-found/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 -[14]: https://itsfoss.com/list-installed-packages-ubuntu/ diff --git a/sources/tech/20190301 Guide to Install VMware Tools on Linux.md b/sources/tech/20190301 Guide to Install VMware Tools on Linux.md deleted file mode 100644 index e6a43bcde1..0000000000 --- a/sources/tech/20190301 Guide to Install VMware Tools on Linux.md +++ /dev/null @@ -1,143 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Guide to Install VMware Tools on Linux) -[#]: via: (https://itsfoss.com/install-vmware-tools-linux) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Guide to Install VMware Tools on Linux -====== - -**VMware Tools enhances your VM experience by allowing you to share clipboard and folder among other things. Learn how to install VMware tools on Ubuntu and other Linux distributions.** - -In an earlier tutorial, you learned to [install VMware Workstation on Ubuntu][1]. You can further enhance the functionality of your virtual machines by installing VMware Tools. - -If you have already installed a guest OS on VMware, you must have noticed the requirement for [VMware tools][2] – even though not completely aware of what it is needed for. - -In this article, we will highlight the importance of VMware tools, the features it offers, and the method to install VMware tools on Ubuntu or any other Linux distribution. - -### VMware Tools: Overview & Features - -![Installing VMware Tools on Ubuntu][3]Installing VMware Tools on Ubuntu - -For obvious reasons, the virtual machine (your Guest OS) will not behave exactly like the host. There will be certain limitations in terms of its performance and operationg. And, that is why a set of utilities (VMware Tools) was introduced. - -VMware tools help in managing the guest OS in an efficient manner while also improving its performance. - -#### What exactly is VMware tool responsible for? - -![How to Install VMware tools on Linux][4] - -You have got a vague idea of what it does – but let us talk about the details: - - * Synchronize the time between the guest OS and the host to make things easier. - * Unlocks the ability to pass messages from host OS to guest OS. For example, you copy a text on the host to your clipboard and you can easily paste it to your guest OS. - * Enables sound in guest OS. - * Improves video resolution. - * Improves the cursor movement. - * Fixes incorrect network speed data. - * Eliminates inadequate color depth. - - - -These are the major changes that happen when you install VMware tools on Guest OS. But, what exactly does it contain / feature in order to unlock/enhance these functionalities? Let’s see.. - -#### VMware tools: Core Feature Details - -![Sharing clipboard between guest and host OS with VMware Tools][5]Sharing clipboard between guest and host OS with VMware Tools - -If you do not want to know what it includes to enable the functionalities, you can skip this part. But, for the curious readers, let us briefly discuss about it: - -**VMware device drivers:** It really depends on the OS. Most of the major operating systems do include device drivers by default. So, you do not have to install it separately. This generally involves – memory control driver, mouse driver, audio driver, NIC driver, VGA driver and so on. - -**VMware user process:** This is where things get really interesting. With this, you get the ability to copy-paste and drag-drop between the host and the guest OS. You can basically copy and paste the text from the host to the virtual machine or vice versa. - -You get to drag and drop files as well. In addition, it enables the pointer release/lock when you do not have an SVGA driver installed. - -**VMware tools lifecycle management** : Well, we will take a look at how to install VMware tools below – but this feature helps you easily install/upgrade VMware tools in the virtual machine. - -**Shared Folders** : In addition to these, VMware tools also allow you to have shared folders between the guest OS and the host. - -![Sharing folder between guest and host OS using VMware Tools in Linux][6]Sharing folder between guest and host OS using VMware Tools in Linux - -Of course, what it does and facilitates also depends on the host OS. For example, on Windows, you get a Unity mode on VMware to run programs on virtual machine and operate it from the host OS. - -### How to install VMware Tools on Ubuntu & other Linux distributions - -**Note:** For Linux guest operating systems, you should already have “Open VM Tools” suite installed, eliminating the need of installing VMware tools separately, most of the time. - -Most of the time, when you install a guest OS, you will get a prompt as a software update or a popup telling you to install VMware tools if the operating system supports [Easy Install][7]. - -Windows and Ubuntu does support Easy Install. So, even if you are using Windows as your host OS or trying to install VMware tools on Ubuntu, you should first get an option to install the VMware tools easily as popup message. Here’s how it should look like: - -![Pop-up to install VMware Tools][8]Pop-up to install VMware Tools - -This is the easiest way to get it done. So, make sure you have an active network connection when you setup the virtual machine. - -If you do not get any of these pop ups – or options to easily install VMware tools. You have to manually install it. Here’s how to do that: - -1\. Launch VMware Workstation Player. - -2\. From the menu, navigate through **Virtual Machine - > Install VMware tools**. If you already have it installed, and want to repair the installation, you will observe the same option to appear as “ **Re-install VMware tools** “. - -3\. Once you click on that, you will observe a virtual CD/DVD mounted in the guest OS. - -4\. Open that and copy/paste the **tar.gz** file to any location of your choice and extract it, here we choose the **Desktop**. - -![][9] - -5\. After extraction, launch the terminal and navigate to the folder inside by typing in the following command: - -``` -cd Desktop/VMwareTools-10.3.2-9925305/vmware-tools-distrib -``` - -You need to check the name of the folder and path in your case – depending on the version and where you extracted – it might vary. - -![][10] - -Replace **Desktop** with your storage location (such as cd Downloads) and the rest should remain the same if you are installing **10.3.2 version**. - -6\. Now, simply type in the following command to start the installation: - -``` -sudo ./vmware-install.pl -d -``` - -![][11] - -You will be asked the password for permission to install, type it in and you should be good to go. - -That’s it. You are done. These set of steps should be applicable to almost any Ubuntu-based guest operating system. If you want to install VMware tools on Ubuntu Server, or any other OS. - -**Wrapping Up** - -Installing VMware tools on Ubuntu Linux is pretty easy. In addition to the easy method, we have also explained the manual method to do it. If you still need help, or have a suggestion regarding the installation, let us know in the comments down below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-vmware-tools-linux - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[2]: https://kb.vmware.com/s/article/340 -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-downloading.jpg?fit=800%2C531&ssl=1 -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/install-vmware-tools-linux.png?resize=800%2C450&ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-features.gif?resize=800%2C500&ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-shared-folder.jpg?fit=800%2C660&ssl=1 -[7]: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/15.0/com.vmware.player.linux.using.doc/GUID-3F6B9D0E-6CFC-4627-B80B-9A68A5960F60.html -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools.jpg?fit=800%2C481&ssl=1 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-extraction.jpg?fit=800%2C564&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-folder.jpg?fit=800%2C487&ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-installation-ubuntu.jpg?fit=800%2C492&ssl=1 diff --git a/sources/tech/20190315 New zine- Bite Size Networking.md b/sources/tech/20190315 New zine- Bite Size Networking.md new file mode 100644 index 0000000000..cd47c5619a --- /dev/null +++ b/sources/tech/20190315 New zine- Bite Size Networking.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: Bite Size Networking!) +[#]: via: (https://jvns.ca/blog/2019/03/15/new-zine--bite-size-networking-/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: Bite Size Networking! +====== + +Last week I released a new zine: Bite Size Networking! It’s the third zine in the “bite size” series: + + 1. [Bite Size Linux][1] + 2. [Bite Size Command Line][2] + 3. [Bite Size Networking][3] + + + +You can get it for $10 at ! (or $150/$250/$600 for the corporate rate). + +Here’s the cover and table of contents! + +[![][4]][5] + +A few people have asked for a 3-pack with all 3 “bite size” zines which is coming soon! + +### why this zine? + +In last few years I’ve been doing a lot of networking at work, and along the way I’ve gone from “uh, what even is tcpdump” to “yes I can just type in `sudo tcpdump -c 200 -n port 443 -i lo`” without even thinking twice about it. As usual this zine is the resource I wish I had 4 years ago. There are so many things it took me a long time to figure out how to do like: + + * inspect SSL certificates + * make DNS queries + * figure out what server is using that port + * find out whether the firewall is causing you problems or not + * capture / search network traffic on a machine + + + +and as often happens with computers none of them are really that hard!! But the man pages for the tols you need to do these things are Very Long and as usual don’t differentiate between “everybody always uses this option and you 10000% need to know it” and “you will never use this option it does not matter”. So I spent a long time staring sadly at the tcpdump man page. + +the pitch for this zine is: + +> It’s Thursday afternoon and your users are reporting SSL errors in production and you don’t know why. Or a HTTP header isn’t being set correctly and it’s breaking the site. Or you just got a notification that your site’s SSL certificate is expiring in 2 days. Or you need to update DNS to point to a new server. Or a server suddenly isn’t able to connect to a service. And networking maybe isn’t your full time job, but you still need to get the problem fixed. + +Kamal (my partner) proofreads all my zines and we hit an exciting milestone with this one: this is the first zine where he was like “wow, I really did not know a lot of the stuff in this zine”. This is of course because I’ve spent a lot more time than him debugging weird networking things, and when you practice something you get better at it :) + +### a couple of example pages + +Here are a couple of example pages, to give you an idea of what’s in the zine: + +![][6] ![][7] + +### next thing to get better at: getting feedback! + +One thing I’ve realized that while I get a ton of help from people while writing these zines (I read probably a thousand tweets from people suggesting ideas for things to include in the zine), I don’t get as much feedback from people about the final product as I’d like! + +I often hear positive things (“I love them!”, “thank you so much!”, “this helped me in my job!”) but I’d really love to hear more about which bits specifically helped the most and what didn’t make as much sense or what you would have liked to see more of. So I’ll probably be asking a few questions about that to people who buy this zine! + +### selling zines is going well + +When I made the switch about a year ago from “every zine I release is free” to “the old zines are free but all the new ones are not free” it felt scary! It’s been startlingly totally fine and a very positive thing. Sales have been really good, people take the work more seriously, I can spend more time on them, and I think the quality has gone up. + +And I’ve been doing occasional [giveaways][8] for people who can’t afford a $10 zine, which feels like a nice way to handle “some people legitimately can’t afford $10 and I would like to get them information too”. + +### what’s next? + +I’m not sure yet! A few options: + + * kubernetes + * more about linux concepts (bite size linux part II) + * how to do statistics using simulations + * something else! + + + +We’ll see what I feel most inspired by :) + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/03/15/new-zine--bite-size-networking-/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com/zines/bite-size-linux/ +[2]: https://wizardzines.com/zines/bite-size-command-line/ +[3]: https://wizardzines.com/zines/bite-size-networking/ +[4]: https://jvns.ca/images/bite-size-networking-cover.png +[5]: https://gum.co/bite-size-networking +[6]: https://jvns.ca/images/ngrep.png +[7]: https://jvns.ca/images/ping.png +[8]: https://twitter.com/b0rk/status/1104368319816220674 diff --git a/sources/tech/20190320 Move your dotfiles to version control.md b/sources/tech/20190320 Move your dotfiles to version control.md deleted file mode 100644 index 7d070760c7..0000000000 --- a/sources/tech/20190320 Move your dotfiles to version control.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Move your dotfiles to version control) -[#]: via: (https://opensource.com/article/19/3/move-your-dotfiles-version-control) -[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) - -Move your dotfiles to version control -====== -Back up or sync your custom configurations across your systems by sharing dotfiles on GitLab or GitHub. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documents_papers_file_storage_work.png?itok=YlXpAqAJ) - -There is something truly exciting about customizing your operating system through the collection of hidden files we call dotfiles. In [What a Shell Dotfile Can Do For You][1], H. "Waldo" Grunenwald goes into excellent detail about the why and how of setting up your dotfiles. Let's dig into the why and how of sharing them. - -### What's a dotfile? - -"Dotfiles" is a common term for all the configuration files we have floating around our machines. These files usually start with a **.** at the beginning of the filename, like **.gitconfig** , and operating systems often hide them by default. For example, when I use **ls -a** on MacOS, it shows all the lovely dotfiles that would otherwise not be in the output. - -``` -dotfiles on master -➜ ls -README.md  Rakefile   bin       misc    profiles   zsh-custom - -dotfiles on master -➜ ls -a -.               .gitignore      .oh-my-zsh      README.md       zsh-custom -..              .gitmodules     .tmux           Rakefile -.gemrc          .global_ignore .vimrc           bin -.git            .gvimrc         .zlogin         misc -.gitconfig      .maid           .zshrc          profiles -``` - -If I take a look at one, **.gitconfig** , which I use for Git configuration, I see a ton of customization. I have account information, terminal color preferences, and tons of aliases that make my command-line interface feel like mine. Here's a snippet from the **[alias]** block: - -``` -87   # Show the diff between the latest commit and the current state -88   d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" -89 -90   # `git di $number` shows the diff between the state `$number` revisions ago and the current state -91   di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" -92 -93   # Pull in remote changes for the current repository and all its submodules -94   p = !"git pull; git submodule foreach git pull origin master" -95 -96   # Checkout a pull request from origin (of a github repository) -97   pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr" -``` - -Since my **.gitconfig** has over 200 lines of customization, I have no interest in rewriting it on every new computer or system I use, and either does anyone else. This is one reason sharing dotfiles has become more and more popular, especially with the rise of the social coding site GitHub. The canonical article advocating for sharing dotfiles is Zach Holman's [Dotfiles Are Meant to Be Forked][2] from 2008. The premise is true to this day: I want to share them, with myself, with those new to dotfiles, and with those who have taught me so much by sharing their customizations. - -### Sharing dotfiles - -Many of us have multiple systems or know hard drives are fickle enough that we want to back up our carefully curated customizations. How do we keep these wonderful files in sync across environments? - -My favorite answer is distributed version control, preferably a service that will handle the heavy lifting for me. I regularly use GitHub and continue to enjoy GitLab as I get more experienced with it. Either one is a perfect place to share your information. To set yourself up: - - 1. Sign into your preferred Git-based service. - 2. Create a repository called "dotfiles." (Make it public! Sharing is caring.) - 3. Clone it to your local environment.* - 4. Copy your dotfiles into the folder. - 5. Symbolically link (symlink) them back to their target folder (most often **$HOME** ). - 6. Push them to the remote repository. - - - -* You may need to set up your Git configuration commands to clone the repository. Both GitHub and GitLab will prompt you with the commands to run. - -![](https://opensource.com/sites/default/files/uploads/gitlab-new-project.png) - -Step 4 above is the crux of this effort and can be a bit tricky. Whether you use a script or do it by hand, the workflow is to symlink from your dotfiles folder to the dotfiles destination so that any updates to your dotfiles are easily pushed to the remote repository. To do this for my **.gitconfig** file, I would enter: - -``` -$ cd dotfiles/ -$ ln -nfs .gitconfig $HOME/.gitconfig -``` - -The flags added to the symlinking command offer a few additional benefits: - - * **-s** creates a symbolic link instead of a hard link - * **-f** continues with other symlinking when an error occurs (not needed here, but useful in loops) - * **-n** avoids symlinking a symlink (same as **-h** for other versions of **ln** ) - - - -You can review the IEEE and Open Group [specification of **ln**][3] and the version on [MacOS 10.14.3][4] if you want to dig deeper into the available parameters. I had to look up these flags since I pulled them from someone else's dotfiles. - -You can also make updating simpler with a little additional code, like the [Rakefile][5] I forked from [Brad Parbs][6]. Alternatively, you can keep it incredibly simple, as Jeff Geerling does [in his dotfiles][7]. He symlinks files using [this Ansible playbook][8]. Keeping everything in sync at this point is easy: you can cron job or occasionally **git push** from your dotfiles folder. - -### Quick aside: What not to share - -Before we move on, it is worth noting what you should not add to a shared dotfile repository—even if it starts with a dot. Anything that is a security risk, like files in your **.ssh/** folder, is not a good choice to share using this method. Be sure to double-check your configuration files before publishing them online and triple-check that no API tokens are in your files. - -### Where should I start? - -If Git is new to you, my [article about the terminology][9] and [a cheat sheet][10] of my most frequently used commands should help you get going. - -There are other incredible resources to help you get started with dotfiles. Years ago, I came across [dotfiles.github.io][11] and continue to go back to it for a broader look at what people are doing. There is a lot of tribal knowledge hidden in other people's dotfiles. Take the time to scroll through some and don't be shy about adding them to your own. - -I hope this will get you started on the joy of having consistent dotfiles across your computers. - -What's your favorite dotfile trick? Add a comment or tweet me [@mbbroberg][12]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/move-your-dotfiles-version-control - -作者:[Matthew Broberg][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mbbroberg -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/9/shell-dotfile -[2]: https://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/ -[3]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ln.html -[4]: https://www.unix.com/man-page/FreeBSD/1/ln/ -[5]: https://github.com/mbbroberg/dotfiles/blob/master/Rakefile -[6]: https://github.com/bradp/dotfiles -[7]: https://github.com/geerlingguy/dotfiles -[8]: https://github.com/geerlingguy/mac-dev-playbook -[9]: https://opensource.com/article/19/2/git-terminology -[10]: https://opensource.com/downloads/cheat-sheet-git -[11]: http://dotfiles.github.io/ -[12]: https://twitter.com/mbbroberg?lang=en diff --git a/sources/tech/20190326 Why are monoidal categories interesting.md b/sources/tech/20190326 Why are monoidal categories interesting.md new file mode 100644 index 0000000000..37aaef753a --- /dev/null +++ b/sources/tech/20190326 Why are monoidal categories interesting.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why are monoidal categories interesting?) +[#]: via: (https://jvns.ca/blog/2019/03/26/what-are-monoidal-categories/) +[#]: author: (Julia Evans https://jvns.ca/) + +Why are monoidal categories interesting? +====== + +Hello! Someone on Twitter asked a question about tensor categories recently and I remembered “oh, I know something about that!! These are a cool thing!“. Monoidal categories are also called “tensor categories” and I think that term feels a little more concrete: one of the biggest examples of a tensor category is the category of vector spaces with the tensor product as the way you combine vectors / functions. “Monoidal” means “has an associative binary operation with an identity”, and with vector spaces the tensor product is the “associative binary operation” it’s referring to. So I’m going to mostly use “tensor categories” in this post instead. + +So here’s a quick stab at explaining why tensor categories are cool. I’m going to make a lot of oversimplifications which I figure is better than trying to explain category theory from the ground up. I’m not a category theorist (though I spent 2 years in grad school doing a bunch of category theory) and I will almost certainly say wrong things about category theory. + +In this post I’m going to try to talk about [Seven Sketches in Compositionality: An Invitation to Applied Category Theory][1] using mostly plain English. + +### tensor categories aren’t monads + +If you have been around functional programming for a bit, you might see the word “monoid” and “categories” and wonder “oh, is julia writing about monads, like in Haskell”? I am not!! + +There is a sentence “monads are a monoid in the category of endofunctors” which includes both the word “monoid” and “category” but that is not what I am talking about at all. We’re not going to talk about types or Haskell or monads or anything. + +#### tensor categories are about proving (or defining) things with pictures + +Here’s what I think is a really nice example from this [“seven sketches in compositionality”](() PDF (on page 47): + +![][2] + +The idea here is that you have 3 inequalities + + 1. `t <= v + w` + 2. `w + u <= x + z` + 3. `v + x <= y`, + + + +and you want to prove that `t + u <= y + z`. + +You can do this algebraically pretty easily. + +But in this diagram they’ve done something really different! They’ve sort of drawn the inequalities as boxes with lines coming out of them for each variable, and then you can see that you end up with a `t` and a `u` on the left and a `y` and a `z` on the right, and so maybe that means that `t + u <= y + z`. + +The first time I saw something like this in a math class I felt like – what? what is happening? you can’t just draw PICTURES to prove things?!! And of course you can’t _just_ draw pictures to prove things. + +What’s actually happening in pictures like this is that when you put 2 things next to each other in the picture (like `t` and `u`), that actually represents the “tensor product” of `t` and `u`. In this case the “tensor product” is defined to be addition. And the tensor product (addition in this case) has some special properties – + + 1. it’s associative + 2. if `a <= b` and `c <= d` then `a + c <= b + d` + + + +so saying that this picture proves that `t + u <= y + z` **actually** means that you can read a proof off the diagram in a straightforward way: + +``` + t + u +<= (v + w) + u += v + (w + u) +<= v + (x + z) += (v + x) + z +<= y + z +``` + +So all the things that “look like they would work” according to the picture actually do work in practice because our tensor product thing is associative and because addition works nicely with the `<=` relationship. The book explains all this in a lot more detail. + +### draw vector spaces with “string diagrams” + +Proving this simple inequality is kind of boring though! We want to do something more interesting, so let’s talk about vector spaces! Here’s a diagram that includes some vector spaces (U1, U2, V1, V2) and some functions (f,g) between them. + +![][3] + +Again, here what it means to have U1 stacked on top of U2 is that we’re taking a tensor product of U1 and U2. And the tensor product is associative, so there’s no ambiguity if we stack 3 or 4 vector spaces together! + +This is all explained in a lot more detail in this nice blog post called [introduction to string diagrams][4] (which I took that picture from). + +### define the trace of a matrix with a picture + +So far this is pretty boring! But in a [follow up blog post][5], they talk about something more outrageous: you can (using vector space duality) take the lines in one of these diagrams and move them **backwards** and make loops. So that lets us define the trace of a function `f : V -> V` like this: + +![][6] + +This is a really outrageous thing! We’ve said, hey, we have a function and we want to get a number in return right? Okay, let’s just… draw a circle around it so that there are no lines left coming out of it, and then that will be a number! That seems a lot more natural and prettier than the usual way of defining the trace of a matrix (“sum up the numbers on the diagonal”)! + +When I first saw this I thought it was super cool that just drawing a circle is actually a legitimate way of defining a mathematical concept! + +### how are tensor category diagrams different from regular category theory diagrams? + +If you see “tensor categories let you prove things with pictures” you might think “well, the whole point of category theory is to prove things with pictures, so what?“. I think there are a few things that are different in tensor category diagrams: + + 1. with string diagrams, the lines are objects and the boxes are functions which is the opposite of how usual category theory diagrams are + 2. putting things next to each other in the diagram has a specific meaning (“take the tensor product of those 2 things”) where as in usual category theory diagrams it doesn’t. being able to combine things in this way is powerful! + 3. half circles have a specific meaning (“take the dual”) + 4. you can use specific elements of a (eg vector space) in a diagram which usually you wouldn’t do in a category theory diagram (the objects would be the whole vector space, not one element of that vector space) + + + +### what does this have to do with programming? + +Even though this is usually a programming blog I don’t know whether this particular thing really has anything to do with programming, I just remembered I thought it was cool. I wrote my [master’s thesis][7] (which i will link to even though it’s not very readable) on topological quantum computing which involves a bunch of monoidal categories. + +Some of the diagrams in this post are sort of why I got interested in that area in the first place – I thought it was really cool that you could formally define / prove things with pictures. And useful things, like the trace of a matrix! + +### edit: some ways this might be related to programming + +Someone pointed me to a couple of twitter threads (coincidentally from this week!!) that relate tensor categories & diagrammatic methods to programming: + + 1. [this thread from @KenScambler][8] (“My best kept secret* is that string & wiring diagrams–plucked straight out of applied category theory–are _fabulous_ for software and system design.) + 2. [this other thread by him of 31 interesting related things to this topic][9] + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/03/26/what-are-monoidal-categories/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://arxiv.org/pdf/1803.05316.pdf +[2]: https://jvns.ca/images/monoidal-preorder.png +[3]: https://jvns.ca/images/tensor-vector.png +[4]: https://qchu.wordpress.com/2012/11/05/introduction-to-string-diagrams/ +[5]: https://qchu.wordpress.com/2012/11/06/string-diagrams-duality-and-trace/ +[6]: https://jvns.ca/images/trace.png +[7]: https://github.com/jvns/masters-thesis/raw/master/thesis.pdf +[8]: https://twitter.com/KenScambler/status/1108738366529400832 +[9]: https://twitter.com/KenScambler/status/1109474342822244353 diff --git a/sources/tech/20190401 Build and host a website with Git.md b/sources/tech/20190401 Build and host a website with Git.md deleted file mode 100644 index 32a07d3490..0000000000 --- a/sources/tech/20190401 Build and host a website with Git.md +++ /dev/null @@ -1,226 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Build and host a website with Git) -[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Build and host a website with Git -====== -Publishing your own website is easy if you let Git help you out. Learn -how in the first article in our series about little-known Git uses. -![web development and design, desktop and browser][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. - -Creating a website used to be both sublimely simple and a form of black magic all at once. Back in the old days of Web 1.0 (that's not what anyone actually called it), you could just open up any website, view its source code, and reverse engineer the HTML—with all its inline styling and table-based layout—and you felt like a programmer after an afternoon or two. But there was still the matter of getting the page you created on the internet, which meant dealing with servers and FTP and webroot directories and file permissions. While the modern web has become far more complex since then, self-publication can be just as easy (or easier!) if you let Git help you out. - -### Create a website with Hugo - -[Hugo][3] is an open source static site generator. Static sites are what the web used to be built on (if you go back far enough, it was _all_ the web was). There are several advantages to static sites: they're relatively easy to write because you don't have to code them, they're relatively secure because there's no code executed on the pages, and they can be quite fast because there's no processing aside from transferring whatever you have on the page. - -Hugo isn't the only static site generator out there. [Grav][4], [Pico][5], [Jekyll][6], [Podwrite][7], and many others provide an easy way to create a full-featured website with minimal maintenance. Hugo happens to be one with GitLab integration built in, which means you can generate and host your website with a free GitLab account. - -Hugo has some pretty big fans, too. For instance, if you've ever gone to the Let's Encrypt website, then you've used a site built with Hugo. - -![Let's Encrypt website][8] - -#### Install Hugo - -Hugo is cross-platform, and you can find installation instructions for MacOS, Windows, Linux, OpenBSD, and FreeBSD in [Hugo's getting started resources][9]. - -If you're on Linux or BSD, it's easiest to install Hugo from a software repository or ports tree. The exact command varies depending on what your distribution provides, but on Fedora you would enter: - -``` -$ sudo dnf install hugo -``` - -Confirm you have installed it correctly by opening a terminal and typing: - -``` -$ hugo help -``` - -This prints all the options available for the **hugo** command. If you don't see that, you may have installed Hugo incorrectly or need to [add the command to your path][10]. - -#### Create your site - -To build a Hugo site, you must have a specific directory structure, which Hugo will generate for you by entering: - -``` -$ hugo new site mysite -``` - -You now have a directory called **mysite** , and it contains the default directories you need to build a Hugo website. - -Git is your interface to get your site on the internet, so change directory to your new **mysite** folder and initialize it as a Git repository: - -``` -$ cd mysite -$ git init . -``` - -Hugo is pretty Git-friendly, so you can even use Git to install a theme for your site. Unless you plan on developing the theme you're installing, you can use the **\--depth** option to clone the latest state of the theme's source: - -``` -$ git clone --depth 1 \ - -themes/mero -``` - - -Now create some content for your site: - -``` -$ hugo new posts/hello.md -``` - -Use your favorite text editor to edit the **hello.md** file in the **content/posts** directory. Hugo accepts Markdown files and converts them to themed HTML files at publication, so your content must be in [Markdown format][11]. - -If you want to include images in your post, create a folder called **images** in the **static** directory. Place your images into this folder and reference them in your markup using the absolute path starting with **/images**. For example: - -``` -![A picture of a thing](/images/thing.jpeg) -``` - -#### Choose a theme - -You can find more themes at [themes.gohugo.io][12], but it's best to stay with a basic theme while testing. The canonical Hugo test theme is [Ananke][13]. Some themes have complex dependencies, and others don't render pages the way you might expect without complex configuration. The Mero theme used in this example comes bundled with a detailed **config.toml** configuration file, but (for the sake of simplicity) I'll provide just the basics here. Open the file called **config.toml** in a text editor and add three configuration parameters: - -``` - -languageCode = "en-us" -title = "My website on the web" -theme = "mero" - -[params] - author = "Seth Kenlon" - description = "My hugo demo" -``` - -#### Preview your site - -You don't have to put anything on the internet until you're ready to publish it. While you work, you can preview your site by launching the local-only web server that ships with Hugo. - -``` -$ hugo server --buildDrafts --disableFastRender -``` - -Open a web browser and navigate to **** to see your work in progress. - -### Publish with Git to GitLab - -To publish and host your site on GitLab, create a repository for the contents of your site. - -To create a repository in GitLab, click on the **New Project** button in your GitLab Projects page. Create an empty repository called **yourGitLabUsername.gitlab.io** , replacing **yourGitLabUsername** with your GitLab user name or group name. You must use this scheme as the name of your project. If you want to add a custom domain later, you can. - -Do not include a license or a README file (because you've started a project locally, adding these now would make pushing your data to GitLab more complex, and you can always add them later). - -Once you've created the empty repository on GitLab, add it as the remote location for the local copy of your Hugo site, which is already a Git repository: - -``` -$ git remote add origin git@gitlab.com:skenlon/mysite.git -``` - -Create a GitLab site configuration file called **.gitlab-ci.yml** and enter these options: - -``` -image: monachus/hugo - -variables: - GIT_SUBMODULE_STRATEGY: recursive - -pages: - script: - - hugo - artifacts: - paths: - - public - only: - - master -``` - -The **image** parameter defines a containerized image that will serve your site. The other parameters are instructions telling GitLab's servers what actions to execute when you push new code to your remote repository. For more information on GitLab's CI/CD (Continuous Integration and Delivery) options, see the [CI/CD section of GitLab's docs][14]. - -#### Set the excludes - -Your Git repository is configured, the commands to build your site on GitLab's servers are set, and your site ready to publish. For your first Git commit, you must take a few extra precautions so you're not version-controlling files you don't intend to version-control. - -First, add the **/public** directory that Hugo creates when building your site to your **.gitignore** file. You don't need to manage the finished site in Git; all you need to track are your source Hugo files. - -``` -$ echo "/public" >> .gitignore -``` - -You can't maintain a Git repository within a Git repository without creating a Git submodule. For the sake of keeping this simple, move the embedded **.git** directory so that the theme is just a theme. - -Note that you _must_ add your theme files to your Git repository so GitLab will have access to the theme. Without committing your theme files, your site cannot successfully build. - -``` -$ mv themes/mero/.git ~/.local/share/Trash/files/ -``` - -Alternately, use a **trash** command such as [Trashy][15]: - -``` -$ trash themes/mero/.git -``` - -Now you can add all the contents of your local project directory to Git and push it to GitLab: - -``` -$ git add . -$ git commit -m 'hugo init' -$ git push -u origin HEAD -``` - -### Go live with GitLab - -Once your code has been pushed to GitLab, take a look at your project page. An icon indicates GitLab is processing your build. It might take several minutes the first time you push your code, so be patient. However, don't be _too_ patient, because the icon doesn't always update reliably. - -![GitLab processing your build][16] - -While you're waiting for GitLab to assemble your site, go to your project settings and find the **Pages** panel. Once your site is ready, its URL will be provided for you. The URL is **yourGitLabUsername.gitlab.io/yourProjectName**. Navigate to that address to view the fruits of your labor. - -![Previewing Hugo site][17] - -If your site fails to assemble correctly, GitLab provides insight into the CI/CD pipeline logs. Review the error message for an indication of what went wrong. - -### Git and the web - -Hugo (or Jekyll or similar tools) is just one way to leverage Git as your web publishing tool. With server-side Git hooks, you can design your own Git-to-web pipeline with minimal scripting. With the community edition of GitLab, you can self-host your own GitLab instance or you can use an alternative like [Gitolite][18] or [Gitea][19] and use this article as inspiration for a custom solution. Have fun! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/building-hosting-website-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) -[2]: https://git-scm.com/ -[3]: http://gohugo.io -[4]: http://getgrav.org -[5]: http://picocms.org/ -[6]: https://jekyllrb.com -[7]: http://slackermedia.info/podwrite/ -[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website) -[9]: https://gohugo.io/getting-started/installing -[10]: https://opensource.com/article/17/6/set-path-linux -[11]: https://commonmark.org/help/ -[12]: https://themes.gohugo.io/ -[13]: https://themes.gohugo.io/gohugo-theme-ananke/ -[14]: https://docs.gitlab.com/ee/ci/#overview -[15]: http://slackermedia.info/trashy -[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build) -[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site) -[18]: http://gitolite.com -[19]: http://gitea.io diff --git a/sources/tech/20190402 Manage your daily schedule with Git.md b/sources/tech/20190402 Manage your daily schedule with Git.md deleted file mode 100644 index 8f5d7d89bb..0000000000 --- a/sources/tech/20190402 Manage your daily schedule with Git.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Manage your daily schedule with Git) -[#]: via: (https://opensource.com/article/19/4/calendar-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Manage your daily schedule with Git -====== -Treat time like source code and maintain your calendar with the help of -Git. -![website design image][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at using Git to keep track of your calendar. - -### Keep track of your schedule with Git - -What if time itself was but source code that could be managed and version controlled? While proving or disproving such a theory is probably beyond the scope of this article, it happens that you can treat time like source code and manage your daily schedule with the help of Git. - -The reigning champion for calendaring is the [CalDAV][3] protocol, which drives popular open source calendaring applications like [NextCloud][4] as well as popular closed source ones. There's nothing wrong with CalDAV (commenters, take heed). But it's not for everyone, and besides there's nothing less inspiring than a mono-culture. - -Because I have no interest in becoming invested in largely GUI-dependent CalDAV clients (although if you're looking for a good terminal CalDAV viewer, see [khal][5]), I started investigating text-based alternatives. Text-based calendaring has all the usual benefits of working in [plaintext][6]. It's lightweight, it's highly portable, and as long as it's structured, it's easy to parse and beautify (whatever _beauty_ means to you). - -And best of all, it's exactly what Git was designed to manage. - -### Org mode not in a scary way - -If you don't impose structure on your plaintext, it quickly falls into a pandemonium of off-the-cuff thoughts and devil-may-care notation. Luckily, a markup syntax exists for calendaring, and it's contained in the venerable productivity Emacs mode, [Org mode][7] (which, admit it, you've been meaning to start using anyway). - -The amazing thing about Org mode that many people don't realize is [you don't need to know or even use Emacs][8] to take advantage of conventions established by Org mode. You get a lot of great features if you _do_ use Emacs, but if Emacs intimidates you, then you can implement a Git-based Org-mode calendaring system without so much as installing Emacs. - -The only part of Org mode that you need to know is its syntax. Org-mode syntax is low-maintenance and fairly intuitive. The biggest difference in calendaring with Org mode instead of a GUI calendaring app is the workflow: instead of going to a calendar and finding the day you want to schedule a task, you create a list of tasks and then assign each one a day and time. - -Lists in Org mode use asterisks (*) as bullets. Here's my gaming task list: **** - -``` -* Gaming -** Build Stardrifter character -** Read Stardrifter rules -** Stardrifter playtest - -** Blue Planet @ Mike's - -** Run Rappan Athuk -*** Purchase hard copy -*** Skim Rappan Athuk -*** Build Rappan Athuk maps in maptool -*** Sort Rappan Athuk tokens -``` - -If you're familiar with [CommonMark][9] or Markdown, you'll notice that instead of using whitespace to create a subtask, Org mode favors the more explicit use of additional bullets. Whatever your background with lists, this is an intuitive and easy way to build a list, and it obviously is not inherently tied to Emacs (although using Emacs provides you with shortcuts so you can rearrange your list quickly). - -To turn your list into scheduled tasks or events in a calendar, go back through and add the keywords **SCHEDULED** and, optionally, **:CATEGORY:**. - -``` -* Gaming -:CATEGORY: Game -** Build Stardrifter character -SCHEDULED: <2019-03-22 18:00-19:00> -** Read Stardrifter rules -SCHEDULED: <2019-03-22 19:00-21:00> -** Stardrifter playtest -SCHEDULED: <2019-03-25 0900-1300> -** Blue Planet @ Mike's -SCHEDULED: <2019-03-18 18:00-23:00 +1w> - -and so on... -``` - -The **SCHEDULED** keyword marks the entry as an event that you expect to be notified about and the optional **:CATEGORY:** keyword is an arbitrary tagging system for your own use (and in Emacs, you can color-code entries according to category). - -For a repeating event, you can use notation such as **+1w** to create a weekly event or **+2w** for a fortnightly event, and so on. - -All the fancy markup available for Org mode is [documented][10], so don't hesitate to find more tricks to help it fit your needs. - -### Put it into Git - -Without Git, your Org-mode appointments are just a file on your local machine. It's the 21st century, though, so you at least need your calendar on your mobile phone, if not on all of your personal computers. You can use Git to publish your calendar for yourself and others. - -First, create a directory for your **.org** files. I store mine in **~/cal**. - -``` -$ mkdir ~/cal -``` - -Change into your directory and make it a Git repository: - -``` -$ cd cal -$ git init -``` - -Move your **.org** file to your local Git repo. In practice, I maintain one **.org** file per category. - -``` -$ mv ~/*.org ~/cal -$ ls -Game.org Meal.org Seth.org Work.org -``` - -Stage and commit your files: - -``` -$ git add *.org -$ git commit -m 'cal init' -``` - -### Create a Git remote - -To make your calendar available from anywhere, you must have a Git repository on the internet. Your calendar is plaintext, so any Git repository will do. You can put your calendar on [GitLab][11] or any other public Git hosting service (even proprietary ones), and as long as your host allows it, you can even mark the repository as private. If you don't want to post your calendar to a server you don't control, it's easy to host a Git repository yourself, either using a bare repository for a single user or using a frontend service like [Gitolite][12] or [Gitea][13]. - -In the interest of simplicity, I'll assume a self-hosted bare Git repository. You can create a bare remote repository on any server you have SSH access to with one Git command: -``` -$ ssh -p 22122 [seth@example.com][14] -[remote]$ mkdir cal.git -[remote]$ cd cal.git -[remote]$ git init --bare -[remote]$ exit -``` - -This bare repository can serve as your calendar's home on the internet. - -Set it as the remote source for your local (on your computer, not your server) Git repository: - -``` -$ git remote add origin seth@example.com:/home/seth/cal.git -``` - -And then push your calendar data to the server: - -``` -$ git push -u origin HEAD -``` - -With your calendar in a Git repository, it's available to you on any device running Git. That means you can make updates and changes to your schedule and push your changes upstream so it updates everywhere. - -I use this method to keep my calendar in sync between my work laptop and my home workstation. Since I use Emacs every day for most of the day, being able to view and edit my calendar in Emacs is a major convenience. The same is true for most people with a mobile device, so the next step is to set up an Org-mode calendaring system on a mobile. - -### Mobile Git - -Since your calendar data is in plaintext, strictly speaking, you can "use" it on any device that can read a text file. That's part of the beauty of this system; you're never without, at the very least, your raw data. But to integrate your calendar on a mobile device the way you'd expect a modern calendar to work, you need two components: a mobile Git client and a mobile Org-mode viewer. - -#### Git client for mobile - -[MGit][15] is a good Git client for Android. There are Git clients for iOS, as well. - -Once you've installed MGit (or a similar Git client), you must clone your calendar repository so your phone has a copy. To access your server from your mobile device, you must set up an SSH key for authentication. MGit can generate and store a key for you, which you must add to your server's **~/.ssh/authorized_keys** file or to your SSH keys in the settings of your hosted Git account. - -You must do this manually. MGit does not have an interface to log into your server or hosted Git account. If you do not do this, your mobile device cannot access your server to access your calendar data. - -I did it by copying the key file I generated in MGit to my laptop over [KDE Connect][16] (but you can do the same over Bluetooth, or with an SD card reader, or a USB cable, depending on your preferred method of accessing data on your phone). I copied the key (a file called **calkey** to my server with this command: - -``` -$ cat calkey | ssh seth@example.com "cat >> /home/seth/.ssh/authorized_keys" -``` - -You may have a different way of doing it, but if you ever set your server up for passwordless login, this is exactly the same process. If you're using a hosted Git service like GitLab, you must copy and paste the contents of your key file into your user account's SSH Key panel. - -![Adding key file data to GitLab][17] - -Once that's done, your mobile device can authorize to your server, but it still needs to know where to go to find your calendar data. Different apps may use different notation, but MGit uses plain old Git-over-SSH. That means if you're using a non-standard SSH port, you must specify the SSH port to use: - -``` -$ git clone ssh://seth@example.com:22122//home/seth/git/cal.git -``` - -![Specifying SSH port in MGit][18] - -If you use a different app, it may use a different syntax that allows you to provide a port in a special field or drop the **ssh://** prefix. Refer to the app documentation if you experience issues. - -Clone the repository to your phone. - -![Cloned repositories][19] - -Few Git apps are set to automatically update the repository. There are a few apps you can use to automate pulls, or you can set up Git hooks to push updates from your server—but I won't get into that here. For now, after you make an update to your calendar, be sure to pull new changes manually in MGit (or if you change events on your phone, push the changes to your server). - -![MGit push/pull settings][20] - -#### Mobile calendar - -There are a few different apps that provide frontends for Org mode on a mobile device. [Orgzly][21] is a great open source Android app that provides an interface for Org mode's greatest features, from the Agenda mode to the TODO lists. Install and launch it. - -From the Main menu, choose Setting Sync Repositories and select the directory containing your calendar files (i.e., the Git repository you cloned from your server). - -Give Orgzly a moment to import the data, then use Orgzly's [hamburger][22] menu to select the Agenda view. - -![Orgzly's agenda view][23] - -In Orgzly's Settings Reminders menu, you can choose which event types trigger a notification on your phone. You can get notifications for **SCHEDULED** tasks, **DEADLINE** tasks, or anything with an event time assigned to it. If you use your phone as your taskmaster, you'll never miss an event with Org mode and Orgzly. - -![Orgzly notification][24] - -Orgzly isn't just a parser. You can edit and update events, and even mark events **DONE**. - -![Orgzly to-do list][25] - -### Designed for and by you - -The important thing to understand about using Org mode and Git is that both applications are highly flexible, and it's expected that you'll customize how and what they do so they will adapt to your needs. If something in this article is an affront to how you organize your life or manage your weekly schedule, but you like other parts of what this proposal offers, then throw out the part you don't like. You can use Org mode in Emacs if you want, or you can just use it as calendar markup. You can set your phone to pull Git data right off your computer at the end of the day instead of a server on the internet, or you can configure your computer to sync calendars whenever your phone is plugged in, or you can manage it daily as you load up your phone with all the stuff you need for the workday. It's up to you, and that's the most significant thing about Git, about Org mode, and about open source. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/calendar-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/web-design-monitor-website.png?itok=yUK7_qR0 (website design image) -[2]: https://git-scm.com/ -[3]: https://tools.ietf.org/html/rfc4791 -[4]: http://nextcloud.com -[5]: https://github.com/pimutils/khal -[6]: https://plaintextproject.online/ -[7]: https://orgmode.org -[8]: https://opensource.com/article/19/1/productivity-tool-org-mode -[9]: https://commonmark.org/ -[10]: https://orgmode.org/manual/ -[11]: http://gitlab.com -[12]: http://gitolite.com/gitolite/index.html -[13]: https://gitea.io/en-us/ -[14]: mailto:seth@example.com -[15]: https://f-droid.org/en/packages/com.manichord.mgit -[16]: https://community.kde.org/KDEConnect -[17]: https://opensource.com/sites/default/files/uploads/gitlab-add-key.jpg (Adding key file data to GitLab) -[18]: https://opensource.com/sites/default/files/uploads/mgit-0.jpg (Specifying SSH port in MGit) -[19]: https://opensource.com/sites/default/files/uploads/mgit-1.jpg (Cloned repositories) -[20]: https://opensource.com/sites/default/files/uploads/mgit-2.jpg (MGit push/pull settings) -[21]: https://f-droid.org/en/packages/com.orgzly/ -[22]: https://en.wikipedia.org/wiki/Hamburger_button -[23]: https://opensource.com/sites/default/files/uploads/orgzly-agenda.jpg (Orgzly's agenda view) -[24]: https://opensource.com/sites/default/files/uploads/orgzly-cal-notify.jpg (Orgzly notification) -[25]: https://opensource.com/sites/default/files/uploads/orgzly-cal-todo.jpg (Orgzly to-do list) diff --git a/sources/tech/20190403 Use Git as the backend for chat.md b/sources/tech/20190403 Use Git as the backend for chat.md deleted file mode 100644 index e564bbc6e7..0000000000 --- a/sources/tech/20190403 Use Git as the backend for chat.md +++ /dev/null @@ -1,141 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Git as the backend for chat) -[#]: via: (https://opensource.com/article/19/4/git-based-chat) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use Git as the backend for chat -====== -GIC is a prototype chat application that showcases a novel way to use Git. -![Team communication, chat][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at GIC, a Git-based chat application - -### Meet GIC - -While the authors of Git probably expected frontends to be created for Git, they undoubtedly never expected Git would become the backend for, say, a chat client. Yet, that's exactly what developer Ephi Gabay did with his experimental proof-of-concept [GIC][3]: a chat client written in [Node.js][4] using Git as its backend database. - -GIC is by no means intended for production use. It's purely a programming exercise, but it's one that demonstrates the flexibility of open source technology. What's astonishing is that the client consists of just 300 lines of code, excluding the Node libraries and Git itself. And that's one of the best things about the chat client and about open source; the ability to build upon existing work. Seeing is believing, so you should give GIC a look for yourself. - -### Get set up - -GIC uses Git as its engine, so you need an empty Git repository to serve as its chatroom and logger. The repository can be hosted anywhere, as long as you and anyone who needs access to the chat service has access to it. For instance, you can set up a Git repository on a free Git hosting service like GitLab and grant chat users contributor access to the Git repository. (They must be able to make commits to the repository, because each chat message is a literal commit.) - -If you're hosting it yourself, create a centrally located bare repository. Each user in the chat must have an account on the server where the bare repository is located. You can create accounts specific to Git with Git hosting software like [Gitolite][5] or [Gitea][6], or you can give them individual user accounts on your server, possibly using **git-shell** to restrict their access to Git. - -Performance is best on a self-hosted instance. Whether you host your own or you use a hosting service, the Git repository you create must have an active branch, or GIC won't be able to make commits as users chat because there is no Git HEAD. The easiest way to ensure that a branch is initialized and active is to commit a README or license file upon creation. If you don't do that, you can create and commit one after the fact: - -``` -$ echo "chat logs" > README -$ git add README -$ git commit -m 'just creating a HEAD ref' -$ git push -u origin HEAD -``` - -### Install GIC - -Since GIC is based on Git and written in Node.js, you must first install Git, Node.js, and the Node package manager, npm (which should be bundled with Node). The command to install these differs depending on your Linux or BSD distribution, but here's an example command on Fedora: - -``` -$ sudo dnf install git nodejs -``` - -If you're not running Linux or BSD, follow the installation instructions on [git-scm.com][7] and [nodejs.org][8]. - -There's no install process, as such, for GIC. Each user (Alice and Bob, in this example) must clone the repository to their hard drive: - -``` -$ git cone https://github.com/ephigabay/GIC GIC -``` - -Change directory into the GIC directory and install the Node.js dependencies with **npm** : - -``` -$ cd GIC -$ npm install -``` - -Wait for the Node modules to download and install. - -### Configure GIC - -The only configuration GIC requires is the location of your Git chat repository. Edit the **config.js** file: - -``` -module.exports = { -gitRepo: '[seth@example.com][9]:/home/gitchat/chatdemo.git', -messageCheckInterval: 500, -branchesCheckInterval: 5000 -}; -``` - - -Test your connection to the Git repository before trying GIC, just to make sure your configuration is sane: - -``` -$ git clone --quiet seth@example.com:/home/gitchat/chatdemo.git > /dev/null -``` - -Assuming you receive no errors, you're ready to start chatting. - -### Chat with Git - -From within the GIC directory, start the chat client: - -``` -$ npm start -``` - -When the client first launches, it must clone the chat repository. Since it's nearly an empty repository, it won't take long. Type your message and press Enter to send a message. - -![GIC][10] - -A Git-based chat client. What will they think of next? - -As the greeting message says, a branch in Git serves as a chatroom or channel in GIC. There's no way to create a new branch from within the GIC UI, but if you create one in another terminal session or in a web UI, it shows up immediately in GIC. It wouldn't take much to patch some IRC-style commands into GIC. - -After chatting for a while, take a look at your Git repository. Since the chat happens in Git, the repository itself is also a chat log: - -``` -$ git log --pretty=format:"%p %cn %s" -4387984 Seth Kenlon Hey Chani, did you submit a talk for All Things Open this year? -36369bb Chani No I didn't get a chance. Did you? -[...] -``` - -### Exit GIC - -Not since Vim has there been an application as difficult to stop as GIC. You see, there is no way to stop GIC. It will continue to run until it is killed. When you're ready to stop GIC, open another terminal tab or window and issue this command: - -``` -$ kill `pgrep npm` -``` - -GIC is a novelty. It's a great example of how an open source ecosystem encourages and enables creativity and exploration and challenges us to look at applications from different angles. Try GIC out. Maybe it will give you ideas. At the very least, it's a great excuse to spend an afternoon with Git. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/git-based-chat - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://git-scm.com/ -[3]: https://github.com/ephigabay/GIC -[4]: https://nodejs.org/en/ -[5]: http://gitolite.com -[6]: http://gitea.io -[7]: http://git-scm.com -[8]: http://nodejs.org -[9]: mailto:seth@example.com -[10]: https://opensource.com/sites/default/files/uploads/gic.jpg (GIC) diff --git a/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md b/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md deleted file mode 100644 index b5650680bc..0000000000 --- a/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md +++ /dev/null @@ -1,352 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (luming) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A beginner's guide to building DevOps pipelines with open source tools) -[#]: via: (https://opensource.com/article/19/4/devops-pipeline) -[#]: author: (Bryant Son https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter) - -A beginner's guide to building DevOps pipelines with open source tools -====== -If you're new to DevOps, check out this five-step process for building -your first pipeline. -![Shaking hands, networking][1] - -DevOps has become the default answer to fixing software development processes that are slow, siloed, or otherwise dysfunctional. But that doesn't mean very much when you're new to DevOps and aren't sure where to begin. This article explores what a DevOps pipeline is and offers a five-step process to create one. While this tutorial is not comprehensive, it should give you a foundation to start on and expand later. But first, a story. - -### My DevOps journey - -I used to work for the cloud team at Citi Group, developing an Infrastructure-as-a-Service (IaaS) web application to manage Citi's cloud infrastructure, but I was always interested in figuring out ways to make the development pipeline more efficient and bring positive cultural change to the development team. I found my answer in a book recommended by Greg Lavender, who was the CTO of Citi's cloud architecture and infrastructure engineering, called _[The Phoenix Project][2]_. The book reads like a novel while it explains DevOps principles. - -A table at the back of the book shows how often different companies deploy to the release environment: - -Company | Deployment Frequency ----|--- -Amazon | 23,000 per day -Google | 5,500 per day -Netflix | 500 per day -Facebook | 1 per day -Twitter | 3 per week -Typical enterprise | 1 every 9 months - -How are the frequency rates of Amazon, Google, and Netflix even possible? It's because these companies have figured out how to make a nearly perfect DevOps pipeline. - -This definitely wasn't the case before we implemented DevOps at Citi. Back then, my team had different staged environments, but deployments to the development server were very manual. All developers had access to just one development server based on IBM WebSphere Application Server Community Edition. The problem was the server went down whenever multiple users simultaneously tried to make deployments, so the developers had to let each other know whenever they were about to make a deployment, which was quite a pain. In addition, there were problems with low code test coverages, cumbersome manual deployment processes, and no way to track code deployments with a defined task or a user story. - -I realized something had to be done, and I found a colleague who felt the same way. We decided to collaborate to build an initial DevOps pipeline—he set up a virtual machine and a Tomcat application server while I worked on Jenkins, integrating with Atlassian Jira and BitBucket, and code testing coverages. This side project was hugely successful: we almost fully automated the development pipeline, we achieved nearly 100% uptime on our development server, we could track and improve code testing coverage, and the Git branch could be associated with the deployment and Jira task. And most of the tools we used to construct our DevOps pipeline were open source. - -I now realize how rudimentary our DevOps pipeline was, as we didn't take advantage of advanced configurations like Jenkins files or Ansible. However, this simple process worked well, maybe due to the [Pareto][3] principle (also known as the 80/20 rule). - -### A brief introduction to DevOps and the CI/CD pipeline - -If you ask several people, "What is DevOps? you'll probably get several different answers. DevOps, like agile, has evolved to encompass many different disciplines, but most people will agree on a few things: DevOps is a software development practice or a software development lifecycle (SDLC) and its central tenet is cultural change, where developers and non-developers all breathe in an environment where formerly manual things are automated; everyone does what they are best at; the number of deployments per period increases; throughput increases; and flexibility improves. - -While having the right software tools is not the only thing you need to achieve a DevOps environment, some tools are necessary. A key one is continuous integration and continuous deployment (CI/CD). This pipeline is where the environments have different stages (e.g., DEV, INT, TST, QA, UAT, STG, PROD), manual things are automated, and developers can achieve high-quality code, flexibility, and numerous deployments. - -This article describes a five-step approach to creating a DevOps pipeline, like the one in the following diagram, using open source tools. - -![Complete DevOps pipeline][4] - -Without further ado, let's get started. - -### Step 1: CI/CD framework - -The first thing you need is a CI/CD tool. Jenkins, an open source, Java-based CI/CD tool based on the MIT License, is the tool that popularized the DevOps movement and has become the de facto standard. - -So, what is Jenkins? Imagine it as some sort of a magical universal remote control that can talk to many many different services and tools and orchestrate them. On its own, a CI/CD tool like Jenkins is useless, but it becomes more powerful as it plugs into different tools and services. - -Jenkins is just one of many open source CI/CD tools that you can leverage to build a DevOps pipeline. - -Name | License ----|--- -[Jenkins][5] | Creative Commons and MIT -[Travis CI][6] | MIT -[CruiseControl][7] | BSD -[Buildbot][8] | GPL -[Apache Gump][9] | Apache 2.0 -[Cabie][10] | GNU - -Here's what a DevOps process looks like with a CI/CD tool. - -![CI/CD tool][11] - -You have a CI/CD tool running in your localhost, but there is not much you can do at the moment. Let's follow the next step of DevOps journey. - -### Step 2: Source control management - -The best (and probably the easiest) way to verify that your CI/CD tool can perform some magic is by integrating with a source control management (SCM) tool. Why do you need source control? Suppose you are developing an application. Whenever you build an application, you are programming—whether you are using Java, Python, C++, Go, Ruby, JavaScript, or any of the gazillion programming languages out there. The programming codes you write are called source codes. In the beginning, especially when you are working alone, it's probably OK to put everything in your local directory. But when the project gets bigger and you invite others to collaborate, you need a way to avoid merge conflicts while effectively sharing the code modifications. You also need a way to recover a previous version—and the process of making a backup and copying-and-pasting gets old. You (and your teammates) want something better. - -This is where SCM becomes almost a necessity. A SCM tool helps by storing your code in repositories, versioning your code, and coordinating among project members. - -Although there are many SCM tools out there, Git is the standard and rightly so. I highly recommend using Git, but there are other open source options if you prefer. - -Name | License ----|--- -[Git][12] | GPLv2 & LGPL v2.1 -[Subversion][13] | Apache 2.0 -[Concurrent Versions System][14] (CVS) | GNU -[Vesta][15] | LGPL -[Mercurial][16] | GNU GPL v2+ - -Here's what the DevOps pipeline looks like with the addition of SCM. - -![Source control management][17] - -The CI/CD tool can automate the tasks of checking in and checking out source code and collaborating across members. Not bad? But how can you make this into a working application so billions of people can use and appreciate it? - -### Step 3: Build automation tool - -Excellent! You can check out the code and commit your changes to the source control, and you can invite your friends to collaborate on the source control development. But you haven't yet built an application. To make it a web application, it has to be compiled and put into a deployable package format or run as an executable. (Note that an interpreted programming language like JavaScript or PHP doesn't need to be compiled.) - -Enter the build automation tool. No matter which build tool you decide to use, all build automation tools have a shared goal: to build the source code into some desired format and to automate the task of cleaning, compiling, testing, and deploying to a certain location. The build tools will differ depending on your programming language, but here are some common open source options to consider. - -Name | License | Programming Language ----|---|--- -[Maven][18] | Apache 2.0 | Java -[Ant][19] | Apache 2.0 | Java -[Gradle][20] | Apache 2.0 | Java -[Bazel][21] | Apache 2.0 | Java -[Make][22] | GNU | N/A -[Grunt][23] | MIT | JavaScript -[Gulp][24] | MIT | JavaScript -[Buildr][25] | Apache | Ruby -[Rake][26] | MIT | Ruby -[A-A-P][27] | GNU | Python -[SCons][28] | MIT | Python -[BitBake][29] | GPLv2 | Python -[Cake][30] | MIT | C# -[ASDF][31] | Expat (MIT) | LISP -[Cabal][32] | BSD | Haskell - -Awesome! You can put your build automation tool configuration files into your source control management and let your CI/CD tool build it. - -![Build automation tool][33] - -Everything is good, right? But where can you deploy it? - -### Step 4: Web application server - -So far, you have a packaged file that might be executable or deployable. For any application to be truly useful, it has to provide some kind of a service or an interface, but you need a vessel to host your application. - -For a web application, a web application server is that vessel. An application server offers an environment where the programming logic inside the deployable package can be detected, render the interface, and offer the web services by opening sockets to the outside world. You need an HTTP server as well as some other environment (like a virtual machine) to install your application server. For now, let's assume you will learn about this along the way (although I will discuss containers below). - -There are a number of open source web application servers available. - -Name | License | Programming Language ----|---|--- -[Tomcat][34] | Apache 2.0 | Java -[Jetty][35] | Apache 2.0 | Java -[WildFly][36] | GNU Lesser Public | Java -[GlassFish][37] | CDDL & GNU Less Public | Java -[Django][38] | 3-Clause BSD | Python -[Tornado][39] | Apache 2.0 | Python -[Gunicorn][40] | MIT | Python -[Python Paste][41] | MIT | Python -[Rails][42] | MIT | Ruby -[Node.js][43] | MIT | Javascript - -Now the DevOps pipeline is almost usable. Good job! - -![Web application server][44] - -Although it's possible to stop here and integrate further on your own, code quality is an important thing for an application developer to be concerned about. - -### Step 5: Code testing coverage - -Implementing code test pieces can be another cumbersome requirement, but developers need to catch any errors in an application early on and improve the code quality to ensure end users are satisfied. Luckily, there are many open source tools available to test your code and suggest ways to improve its quality. Even better, most CI/CD tools can plug into these tools and automate the process. - -There are two parts to code testing: _code testing frameworks_ that help write and run the tests, and _code quality suggestion tools_ that help improve code quality. - -#### Code test frameworks - -Name | License | Programming Language ----|---|--- -[JUnit][45] | Eclipse Public License | Java -[EasyMock][46] | Apache | Java -[Mockito][47] | MIT | Java -[PowerMock][48] | Apache 2.0 | Java -[Pytest][49] | MIT | Python -[Hypothesis][50] | Mozilla | Python -[Tox][51] | MIT | Python - -#### Code quality suggestion tools - -Name | License | Programming Language ----|---|--- -[Cobertura][52] | GNU | Java -[CodeCover][53] | Eclipse Public (EPL) | Java -[Coverage.py][54] | Apache 2.0 | Python -[Emma][55] | Common Public License | Java -[JaCoCo][56] | Eclipse Public License | Java -[Hypothesis][50] | Mozilla | Python -[Tox][51] | MIT | Python -[Jasmine][57] | MIT | JavaScript -[Karma][58] | MIT | JavaScript -[Mocha][59] | MIT | JavaScript -[Jest][60] | MIT | JavaScript - -Note that most of the tools and frameworks mentioned above are written for Java, Python, and JavaScript, since C++ and C# are proprietary programming languages (although GCC is open source). - -Now that you've implemented code testing coverage tools, your DevOps pipeline should resemble the DevOps pipeline diagram shown at the beginning of this tutorial. - -### Optional steps - -#### Containers - -As I mentioned above, you can host your application server on a virtual machine or a server, but containers are a popular solution. - -[What are][61] [containers][61]? The short explanation is that a VM needs the huge footprint of an operating system, which overwhelms the application size, while a container just needs a few libraries and configurations to run the application. There are clearly still important uses for a VM, but a container is a lightweight solution for hosting an application, including an application server. - -Although there are other options for containers, Docker and Kubernetes are the most popular. - -Name | License ----|--- -[Docker][62] | Apache 2.0 -[Kubernetes][63] | Apache 2.0 - -To learn more, check out these other [Opensource.com][64] articles about Docker and Kubernetes: - - * [What Is Docker?][65] - * [An introduction to Docker][66] - * [What is Kubernetes?][67] - * [From 0 to Kubernetes][68] - - - -#### Middleware automation tools - -Our DevOps pipeline mostly focused on collaboratively building and deploying an application, but there are many other things you can do with DevOps tools. One of them is leveraging Infrastructure as Code (IaC) tools, which are also known as middleware automation tools. These tools help automate the installation, management, and other tasks for middleware software. For example, an automation tool can pull applications, like a web application server, database, and monitoring tool, with the right configurations and deploy them to the application server. - -Here are several open source middleware automation tools to consider: - -Name | License ----|--- -[Ansible][69] | GNU Public -[SaltStack][70] | Apache 2.0 -[Chef][71] | Apache 2.0 -[Puppet][72] | Apache or GPL - -For more on middleware automation tools, check out these other [Opensource.com][64] articles: - - * [A quickstart guide to Ansible][73] - * [Automating deployment strategies with Ansible][74] - * [Top 5 configuration management tools][75] - - - -### Where can you go from here? - -This is just the tip of the iceberg for what a complete DevOps pipeline can look like. Start with a CI/CD tool and explore what else you can automate to make your team's job easier. Also, look into [open source communication tools][76] that can help your team work better together. - -For more insight, here are some very good introductory articles about DevOps: - - * [What is DevOps][77] - * [5 things to master to be a DevOps engineer][78] - * [DevOps is for everyone][79] - * [Getting started with predictive analytics in DevOps][80] - - - -Integrating DevOps with open source agile tools is also a good idea: - - * [What is agile?][81] - * [4 steps to becoming an awesome agile developer][82] - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/devops-pipeline - -作者:[Bryant Son (Red Hat, Community Moderator)][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/brson/users/milindsingh/users/milindsingh/users/dscripter -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) -[2]: https://www.amazon.com/dp/B078Y98RG8/ -[3]: https://en.wikipedia.org/wiki/Pareto_principle -[4]: https://opensource.com/sites/default/files/uploads/1_finaldevopspipeline.jpg (Complete DevOps pipeline) -[5]: https://github.com/jenkinsci/jenkins -[6]: https://github.com/travis-ci/travis-ci -[7]: http://cruisecontrol.sourceforge.net -[8]: https://github.com/buildbot/buildbot -[9]: https://gump.apache.org -[10]: http://cabie.tigris.org -[11]: https://opensource.com/sites/default/files/uploads/2_runningjenkins.jpg (CI/CD tool) -[12]: https://git-scm.com -[13]: https://subversion.apache.org -[14]: http://savannah.nongnu.org/projects/cvs -[15]: http://www.vestasys.org -[16]: https://www.mercurial-scm.org -[17]: https://opensource.com/sites/default/files/uploads/3_sourcecontrolmanagement.jpg (Source control management) -[18]: https://maven.apache.org -[19]: https://ant.apache.org -[20]: https://gradle.org/ -[21]: https://bazel.build -[22]: https://www.gnu.org/software/make -[23]: https://gruntjs.com -[24]: https://gulpjs.com -[25]: http://buildr.apache.org -[26]: https://github.com/ruby/rake -[27]: http://www.a-a-p.org -[28]: https://www.scons.org -[29]: https://www.yoctoproject.org/software-item/bitbake -[30]: https://github.com/cake-build/cake -[31]: https://common-lisp.net/project/asdf -[32]: https://www.haskell.org/cabal -[33]: https://opensource.com/sites/default/files/uploads/4_buildtools.jpg (Build automation tool) -[34]: https://tomcat.apache.org -[35]: https://www.eclipse.org/jetty/ -[36]: http://wildfly.org -[37]: https://javaee.github.io/glassfish -[38]: https://www.djangoproject.com/ -[39]: http://www.tornadoweb.org/en/stable -[40]: https://gunicorn.org -[41]: https://github.com/cdent/paste -[42]: https://rubyonrails.org -[43]: https://nodejs.org/en -[44]: https://opensource.com/sites/default/files/uploads/5_applicationserver.jpg (Web application server) -[45]: https://junit.org/junit5 -[46]: http://easymock.org -[47]: https://site.mockito.org -[48]: https://github.com/powermock/powermock -[49]: https://docs.pytest.org -[50]: https://hypothesis.works -[51]: https://github.com/tox-dev/tox -[52]: http://cobertura.github.io/cobertura -[53]: http://codecover.org/ -[54]: https://github.com/nedbat/coveragepy -[55]: http://emma.sourceforge.net -[56]: https://github.com/jacoco/jacoco -[57]: https://jasmine.github.io -[58]: https://github.com/karma-runner/karma -[59]: https://github.com/mochajs/mocha -[60]: https://jestjs.io -[61]: /resources/what-are-linux-containers -[62]: https://www.docker.com -[63]: https://kubernetes.io -[64]: http://Opensource.com -[65]: https://opensource.com/resources/what-docker -[66]: https://opensource.com/business/15/1/introduction-docker -[67]: https://opensource.com/resources/what-is-kubernetes -[68]: https://opensource.com/article/17/11/kubernetes-lightning-talk -[69]: https://www.ansible.com -[70]: https://www.saltstack.com -[71]: https://www.chef.io -[72]: https://puppet.com -[73]: https://opensource.com/article/19/2/quickstart-guide-ansible -[74]: https://opensource.com/article/19/1/automating-deployment-strategies-ansible -[75]: https://opensource.com/article/18/12/configuration-management-tools -[76]: https://opensource.com/alternatives/slack -[77]: https://opensource.com/resources/devops -[78]: https://opensource.com/article/19/2/master-devops-engineer -[79]: https://opensource.com/article/18/11/how-non-engineer-got-devops -[80]: https://opensource.com/article/19/1/getting-started-predictive-analytics-devops -[81]: https://opensource.com/article/18/10/what-agile -[82]: https://opensource.com/article/19/2/steps-agile-developer diff --git a/sources/tech/20190409 Working with variables on Linux.md b/sources/tech/20190409 Working with variables on Linux.md deleted file mode 100644 index da4fec5ea9..0000000000 --- a/sources/tech/20190409 Working with variables on Linux.md +++ /dev/null @@ -1,267 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Working with variables on Linux) -[#]: via: (https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html#tk.rss_all) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Working with variables on Linux -====== -Variables often look like $var, but they also look like $1, $*, $? and $$. Let's take a look at what all these $ values can tell you. -![Mike Lawrence \(CC BY 2.0\)][1] - -A lot of important values are stored on Linux systems in what we call “variables,” but there are actually several types of variables and some interesting commands that can help you work with them. In a previous post, we looked at [environment variables][2] and where they are defined. In this post, we're going to look at variables that are used on the command line and within scripts. - -### User variables - -While it's quite easy to set up a variable on the command line, there are a few interesting tricks. To set up a variable, all you need to do is something like this: - -``` -$ myvar=11 -$ myvar2="eleven" -``` - -To display the values, you simply do this: - -``` -$ echo $myvar -11 -$ echo $myvar2 -eleven -``` - -You can also work with your variables. For example, to increment a numeric variable, you could use any of these commands: - -``` -$ myvar=$((myvar+1)) -$ echo $myvar -12 -$ ((myvar=myvar+1)) -$ echo $myvar -13 -$ ((myvar+=1)) -$ echo $myvar -14 -$ ((myvar++)) -$ echo $myvar -15 -$ let "myvar=myvar+1" -$ echo $myvar -16 -$ let "myvar+=1" -$ echo $myvar -17 -$ let "myvar++" -$ echo $myvar -18 -``` - -With some of these, you can add more than 1 to a variable's value. For example: - -``` -$ myvar0=0 -$ ((myvar0++)) -$ echo $myvar0 -1 -$ ((myvar0+=10)) -$ echo $myvar0 -11 -``` - -With all these choices, you'll probably find at least one that is easy to remember and convenient to use. - -You can also _unset_ a variable — basically undefining it. - -``` -$ unset myvar -$ echo $myvar -``` - -Another interesting option is that you can set up a variable and make it **read-only**. In other words, once set to read-only, its value cannot be changed (at least not without some very tricky command line wizardry). That means you can't unset it either. - -``` -$ readonly myvar3=1 -$ echo $myvar3 -1 -$ ((myvar3++)) --bash: myvar3: readonly variable -$ unset myvar3 --bash: unset: myvar3: cannot unset: readonly variable -``` - -You can use any of those setting and incrementing options for assigning and manipulating variables within scripts, but there are also some very useful _internal variables_ for working within scripts. Note that you can't reassign their values or increment them. - -### Internal variables - -There are quite a few variables that can be used within scripts to evaluate arguments and display information about the script itself. - - * $1, $2, $3 etc. represent the first, second, third, etc. arguments to the script. - * $# represents the number of arguments. - * $* represents the string of arguments. - * $0 represents the name of the script itself. - * $? represents the return code of the previously run command (0=success). - * $$ shows the process ID for the script. - * $PPID shows the process ID for your shell (the parent process for the script). - - - -Some of these variables also work on the command line but show related information: - - * $0 shows the name of the shell you're using (e.g., -bash). - * $$ shows the process ID for your shell. - * $PPID shows the process ID for your shell's parent process (for me, this is sshd). - - - -If we throw all of these variables into a script just to see the results, we might do this: - -``` -#!/bin/bash - -echo $0 -echo $1 -echo $2 -echo $# -echo $* -echo $? -echo $$ -echo $PPID -``` - -When we call this script, we'll see something like this: - -``` -$ tryme one two three -/home/shs/bin/tryme <== script name -one <== first argument -two <== second argument -3 <== number of arguments -one two three <== all arguments -0 <== return code from previous echo command -10410 <== script's process ID -10109 <== parent process's ID -``` - -If we check the process ID of the shell once the script is done running, we can see that it matches the PPID displayed within the script: - -``` -$ echo $$ -10109 <== shell's process ID -``` - -Of course, we're more likely to use these variables in considerably more useful ways than simply displaying their values. Let's check out some ways we might do this. - -Checking to see if arguments have been provided: - -``` -if [ $# == 0 ]; then - echo "$0 filename" - exit 1 -fi -``` - -Checking to see if a particular process is running: - -``` -ps -ef | grep apache2 > /dev/null -if [ $? != 0 ]; then - echo Apache is not running - exit -fi -``` - -Verifying that a file exists before trying to access it: - -``` -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -fi - -if [ ! -f $2 ]; then - echo "Error: File $2 not found" - exit 2 -else - head -$1 $2 -fi -``` - -And in this little script, we check if the correct number of arguments have been provided, if the first argument is numeric, and if the second argument is an existing file. - -``` -#!/bin/bash - -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -fi - -if [[ $1 != [0-9]* ]]; then - echo "Error: $1 is not numeric" - exit 2 -fi - -if [ ! -f $2 ]; then - echo "Error: File $2 not found" - exit 3 -else - echo top of file - head -$1 $2 -fi -``` - -### Renaming variables - -When writing a complicated script, it's often useful to assign names to the script's arguments rather than continuing to refer to them as $1, $2, and so on. By the 35th line, someone reading your script might have forgotten what $2 represents. It will be a lot easier on that person if you assign an important parameter's value to $filename or $numlines. - -``` -#!/bin/bash - -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -else - numlines=$1 - filename=$2 -fi - -if [[ $numlines != [0-9]* ]]; then - echo "Error: $numlines is not numeric" - exit 2 -fi - -if [ ! -f $ filename]; then - echo "Error: File $filename not found" - exit 3 -else - echo top of file - head -$numlines $filename -fi -``` - -Of course, this example script does nothing more than run the head command to show the top X lines in a file, but it is meant to show how internal parameters can be used within scripts to help ensure the script runs well or fails with at least some clarity. - -**[ Watch Sandra Henry-Stocker's Two-Minute Linux Tips[to learn how to master a host of Linux commands][3] ]** - -Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/04/variable-key-keyboard-100793080-large.jpg -[2]: https://www.networkworld.com/article/3385516/how-to-manage-your-linux-environment.html -[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md b/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md deleted file mode 100644 index a4669a2eb0..0000000000 --- a/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md +++ /dev/null @@ -1,83 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0 – What Is Ethereum [Part 9]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/) -[#]: author: (editor https://www.ostechnix.com/author/editor/) - -Blockchain 2.0 – What Is Ethereum [Part 9] -====== - -![Ethereum][1] - -In the previous guide of this series, we discussed about [**Hyperledger Project (HLP)**][2], a fastest growing product developed by **Linux Foundation**. In this guide, we are going to discuss about what is **Ethereum** and its features in detail. Many researchers opine that the future of the internet will be based on principles of decentralized computing. Decentralized computing was in fact among one of the broader objectives of having the internet in the first place. However, the internet took another turn owing to differences in computing capabilities available. While modern server capabilities make the case for server-side processing and execution, lack of decent mobile networks in large parts of the world make the case for the same on the client side. Modern smartphones now have **SoCs** (system on a chip or system on chip) capable of handling many such operations on the client side itself, however, limitations owing to retrieving and storing data securely still pushes developers to have server-side computing and data management. Hence, a bottleneck in regards to data transfer capabilities is currently observed. - -All of that might soon change because of advancements in distributed data storage and program execution platforms. [**The blockchain**][3], for the first time in the history of the internet, basically allows for secure data management and program execution on a distributed network of users as opposed to central servers. - -**Ethereum** is one such blockchain platform that gives developers access to frameworks and tools used to build and run applications on such a decentralized network. Though more popularly known in general for its cryptocurrency, Ethereum is more than just **ethers** (the cryptocurrency). It’s a full **Turing complete programming language** that is designed to develop and deploy **DApps** or **Distributed APPlications** [1]. We’ll look at DApps in more detail in one of the upcoming posts. - -Ethereum is an open-source, supports by default a public (non-permissioned) blockchain, and features an extensive smart contract platform **(Solidity)** underneath. Ethereum provides a virtual computing environment called the **Ethereum virtual machine** to run applications and [**smart contracts**][4] as well[2]. The Ethereum virtual machine runs on thousands of participating nodes all over the world, meaning the application data while being secure, is almost impossible to be tampered with or lost. - -### Getting behind Ethereum: What sets it apart - -In 2017, a 30 plus group of the who’s who of the tech and financial world got together to leverage the Ethereum blockchain’s capabilities. Thus, the **Ethereum Enterprise Alliance (EEA)** was formed by a long list of supporting members including _Microsoft_ , _JP Morgan_ , _Cisco Systems_ , _Deloitte_ , and _Accenture_. JP Morgan already has **Quorum** , a decentralized computing platform for financial services based on Ethereum currently in operation, while Microsoft has Ethereum based cloud services it markets through its Azure cloud business[3]. - -### What is ether and how is it related to Ethereum - -Ethereum creator **Vitalik Buterin** understood the true value of a decentralized processing platform and the underlying blockchain tech that powered bitcoin. He failed to gain majority agreement for his idea of proposing that Bitcoin should be developed to support running distributed applications (DApps) and programs (now referred to as smart contracts). - -Hence in 2013, he proposed the idea of Ethereum in a white paper he published. The original white paper is still maintained and available for readers **[here][5]**. The idea was to develop a blockchain based platform to run smart contracts and applications designed to run on nodes and user devices instead of servers. - -The Ethereum system is often mistaken to just mean the cryptocurrency ether, however, it has to be reiterated that Ethereum is a full stack platform for developing applications and executing them as well and has been so since inception whereas bitcoin isn’t. **Ether is currently the second biggest cryptocurrency** by market capitalization and trades at an average of $170 per ether at the time of writing this article[4]. - -### Features and technicalities of the platform[5] - - * As we’ve already mentioned, the cryptocurrency called ether is simply one of the things the platform features. The purpose of the system is more than taking care of financial transactions. In fact, the key difference between the Ethereum platform and Bitcoin is in their scripting capabilities. Ethereum is developed in a Turing complete programming language which means it has scripting and application capabilities similar to other major programming languages. Developers require this feature to create DApps and complex smart contracts on the platform, a feature that bitcoin misses on. - * The “mining” process of ether is more stringent and complex. While specialized ASICs may be used to mine bitcoin, the basic hashing algorithm used by Ethereum **(EThash)** reduces the advantage that ASICs have in this regard. - * The transaction fees itself to be paid as an incentive to miners and node operators for running the network is calculated using a computational token called **Gas**. Gas improves the system’s resilience and resistance to external hacks and attacks by requiring the initiator of the transaction to pay ethers proportionate to the number of computational resources that are required to carry out that transaction. This is in contrast to other platforms such as Bitcoin where the transaction fee is measured in tandem with the transaction size. As such, the average transaction costs in Ethereum is radically less than Bitcoin. This also implies that running applications running on the Ethereum virtual machine will require a fee depending straight up on the computational problems that the application is meant to solve. Basically, the more complex an execution, the more the fee. - * The block time for Ethereum is estimated to be around _**10-15 seconds**_. The block time is the average time that is required to timestamp and create a block on the blockchain network. Compared to the 10+ minutes the same transaction will take on the bitcoin network, it becomes apparent that _**Ethereum is much faster**_ with respect to transactions and verification of blocks. - * _It is also interesting to note that there is no hard cap on the amount of ether that can be mined or the rate at which ether can be mined leading to less radical system design than bitcoin._ - - - -### Conclusion - -While Ethereum is comparable and far outpaces similar platforms, the platform itself lacked a definite path for development until the Ethereum enterprise alliance started pushing it. While the definite push for enterprise developments are made by the Ethereum platform, it has to be noted that Ethereum also caters to small-time developers and individuals as well. As such developing the platform for end users and enterprises leave a lot of specific functionality out of the loop for Ethereum. Also, the blockchain model proposed and developed by the Ethereum foundation is a public model whereas the one proposed by projects such as the Hyperledger project is private and permissioned. - -While only time can tell which platform among the ones put forward by Ethereum, Hyperledger, and R3 Corda among others will find the most fans in real-world use cases, such systems do prove the validity behind the claim of a blockchain powered future. - -**References:** - - * [1] [**Gabriel Nicholas, “Ethereum Is Coding’s New Wild West | WIRED,” Wired , 2017**][6]. - * [2] [**What is Ethereum? — Ethereum Homestead 0.1 documentation**][7]. - * [3] [**Ethereum, a Virtual Currency, Enables Transactions That Rival Bitcoin’s – The New York Times**][8]. - * [4] [**Cryptocurrency Market Capitalizations | CoinMarketCap**][9]. - * [5] [**Introduction — Ethereum Homestead 0.1 documentation**][10]. - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ - -作者:[editor][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/editor/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Ethereum-720x340.png -[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ -[3]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ -[4]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ -[5]: https://github.com/ethereum/wiki/wiki/White-Paper -[6]: https://www.wired.com/story/ethereum-is-codings-new-wild-west/ -[7]: http://www.ethdocs.org/en/latest/introduction/what-is-ethereum.html#ethereum-virtual-machine -[8]: https://www.nytimes.com/2016/03/28/business/dealbook/ethereum-a-virtual-currency-enables-transactions-that-rival-bitcoins.html -[9]: https://coinmarketcap.com/ -[10]: http://www.ethdocs.org/en/latest/introduction/index.html diff --git a/sources/tech/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md b/sources/tech/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md deleted file mode 100644 index c685af487c..0000000000 --- a/sources/tech/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0 – Introduction To Hyperledger Fabric [Part 10]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-introduction-to-hyperledger-fabric/) -[#]: author: (sk https://www.ostechnix.com/author/sk/) - -Blockchain 2.0 – Introduction To Hyperledger Fabric [Part 10] -====== - -![Hyperledger Fabric][1] - -### Hyperledger Fabric - -The [**Hyperledger project**][2] is an umbrella organization of sorts featuring many different modules and systems under development. Among the most popular among these individual sub-projects is the **Hyperledger Fabric**. This post will explore the features that would make the Fabric almost indispensable in the near future once blockchain systems start proliferating into main stream use. Towards the end we will also take a quick look at what developers and enthusiasts need to know regarding the technicalities of the Hyperledger Fabric. - -### Inception - -In the usual fashion for the Hyperledger project, Fabric was “donated” to the organization by one of its core members, **IBM** , who was previously the principle developer of the same. The technology platform shared by IBM was put to joint development at the Hyperledger project with contributions from over a 100 member companies and institutions. - -Currently running on **v1.4** of the LTS version, Fabric has come a long way and is currently seen as the go to enterprise solution for managing business data. The core vision that surrounds the Hyperledger project inevitably permeates into the Fabric as well. The Hyperledger Fabric system carries forward all the enterprise ready and scalable features that are hard coded into all projects under the Hyperledger organization. - -### Highlights Of Hyperledger Fabric - -Hyperledger Fabric offers a wide variety of features and standards that are built around the mission of supporting fast development and modular architectures. Furthermore, compared to its competitors (primarily **Ripple** and [**Ethereum**][3]), Fabric takes an explicit stance toward closed and [**permissioned blockchains**][4]. Their core objective here is to develop a set of tools which will aid blockchain developers in creating customized solutions and not to create a standalone ecosystem or a product. - -Some of the highlights of the Hyperledger Fabric are given below: - - * **Permissioned blockchain systems** - - - -This is a category where other platforms such as Ethereum and Ripple differ quite a lot with Hyperledger Fabric. The Fabric by default is a tool designed to implement a private permissioned blockchain. Such blockchains cannot be accessed by everyone and the nodes working to offer consensus or to verify transactions are chosen by a central authority. This might be important for some applications such as banking and insurance, where transactions have to be verified by the central authority rather than participants. - - * **Confidential and controlled information flow** - - - -The Fabric has built in permission systems that will restrict information flow within a specific group or certain individuals as the case may be. Unlike a public blockchain where anyone and everyone who runs a node will have a copy and selective access to data stored in the blockchain, the admin of the system can choose how to and who to share access to the information. There are also subsystems which will encrypt the stored data at better security standards compared to existing competition. - - * **Plug and play architecture** - - - -Hyperledger Fabric has a plug and play type architecture. Individual components of the system may be chosen to be implemented and components of the system that developers don’t see a use for maybe discarded. The Fabric takes a highly modular and customizable route to development rather than a one size fits all approach taken by its competitors. This is especially attractive for firms and companies looking to build a lean system fast. This combined with the interoperability of the Fabric with other Hyperledger components implies that developers and designers now have access to a diverse set of standardized tools instead of having to pull code from different sources and integrate them afterwards. It also presents a rather fail-safe way to build robust modular systems. - - * **Smart contracts and chaincode** - - - -A distributed application running on a blockchain is called a [**Smart contract**][5]. While the smart contract term is more or less associated with the Ethereum platform, chaincode is the name given to the same in the Hyperledger camp. Apart from possessing all the benefits of **DApps** being present in chaincode applications, what sets Hyperledger apart is the fact that the code for the same may be written in multiple high-level programming language. It supports [**Go**][6] and **JavaScript** out of the box and supports many other after integration with appropriate compiler modules as well. Though this fact might not mean much at this point, the fact remains that if existing talent can be used for ongoing projects involving blockchain that has the potential to save companies billions of dollars in personnel training and management in the long run. Developers can code in languages they’re comfortable in to start building applications on the Hyperledger Fabric and need not learn nor train in platform specific languages and syntax. This presents flexibility which current competitors of the Hyperledger Fabric do not offer. - - * The Hyperledger Fabric is a back-end driver platform and is mainly aimed at integration projects where a blockchain or another distributed ledger technology is required. As such it does not provide any user facing services except for minor scripting capabilities. (Think of it to be more like a scripting language.) - * Hyperledger Fabric supports building sidechains for specific use-cases. In case, the developer wishes to isolate a set of users or participants to a specific part or functionality of the application, they may do so by implementing side-chains. Side-chains are blockchains that derive from a main parent, but form a different chain after their initial block. This block which gives rise to the new chain will stay immune to further changes in the new chain and the new chain remains immutable even if new information is added to the original chain. This functionality will aid in scaling the platform being developed and usher in user specific and case specific processing capabilities. - * The previous feature also means that not all users will have an “exact” copy of all the data in the blockchain as is expected usually from public chains. Participating nodes will have a copy of data that is only relevant to them. For instance, consider an application similar to PayTM in India. The app has wallet functionality as well as an e-commerce end. However, not all its wallet users use PayTM to shop online. In this scenario, only active shoppers will have the corresponding chain of transactions on the PayTM e-commerce site, whereas the wallet users will just have a copy of the chain that stores wallet transactions. This flexible architecture for data storage and retrieval is important while scaling, since massive singular blockchains have been shown to increase lead times for processing transactions. The chain can be kept lean and well categorised this way. - - - -We will look at other modules under the Hyperledger Project in detail in upcoming posts. - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-introduction-to-hyperledger-fabric/ - -作者:[sk][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ -[3]: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ -[4]: https://www.ostechnix.com/blockchain-2-0-public-vs-private-blockchain-comparison/ -[5]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ -[6]: https://www.ostechnix.com/install-go-language-linux/ diff --git a/sources/tech/20190528 A Quick Look at Elvish Shell.md b/sources/tech/20190528 A Quick Look at Elvish Shell.md deleted file mode 100644 index 82927332a7..0000000000 --- a/sources/tech/20190528 A Quick Look at Elvish Shell.md +++ /dev/null @@ -1,107 +0,0 @@ -Translating by name1e5s -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A Quick Look at Elvish Shell) -[#]: via: (https://itsfoss.com/elvish-shell/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -A Quick Look at Elvish Shell -====== - -Everyone who comes to this site has some knowledge (no matter how slight) of the Bash shell that comes default of so many systems. There have been several attempts to create shells that solve some of the shortcomings of Bash that have appeared over the years. One such shell is Elvish, which we will look at today. - -### What is Elvish Shell? - -![Pipelines In Elvish][1] - -[Elvish][2] is more than just a shell. It is [also][3] “an expressive programming language”. It has a number of interesting features including: - - * Written in Go - * Built-in file manager, inspired by the [Ranger file manager][4] (`Ctrl + N`) - * Searchable command history (`Ctrl + R`) - * History of directories visited (`Ctrl + L`) - * Powerful pipelines that support structured data, such as lists, maps, and functions - * Includes a “standard set of control structures: conditional control with `if`, loops with `for` and `while`, and exception handling with `try`“ - * Support for [third-party modules via a package manager to extend Elvish][5] - * Licensed under the BSD 2-Clause license - - - -“Why is it named Elvish?” I hear you shout. Well, according to [their website][6], they chose their current name because: - -> In roguelikes, items made by the elves have a reputation of high quality. These are usually called elven items, but “elvish” was chosen because it ends with “sh”, a long tradition of Unix shells. It also rhymes with fish, one of the shells that influenced the philosophy of Elvish. - -### How to Install Elvish Shell - -Elvish is available in several mainstream distributions. - -Note that the software is very young. The most recent version is 0.12. According to the project’s [GitHub page][3]: “Despite its pre-1.0 status, it is already suitable for most daily interactive use.” - -![Elvish Control Structures][7] - -#### Debian and Ubuntu - -Elvish packages were introduced into Debian Buster and Ubuntu 17.10. Unfortunately, those packages are out of date and you will need to use a [PPA][8] to install the latest version. You will need to use the following commands: - -``` -sudo add-apt-repository ppa:zhsj/elvish -sudo apt update -sudo apt install elvish -``` - -#### Fedora - -Elvish is not available in the main Fedora repos. You will need to add the [FZUG Repository][9] to install Evlish. To do so, you will need to use these commands: - -``` -sudo dnf config-manager --add-repo=http://repo.fdzh.org/FZUG/FZUG.repol -sudo dnf install elvish -``` - -#### Arch - -Elvish is available in the [Arch User Repository][10]. - -I believe you know [how to change shell in Linux][11] so after installing you can switch to Elvish to use it. - -### Final Thoughts on Elvish Shell - -Personally, I have no reason to install Elvish on any of my systems. I can get most of its features by installing a couple of small command line programs or using already installed programs. - -For example, the search past commands feature already exists in Bash and it works pretty well. If you want to improve your ability to search past commands, I would recommend installing [fzf][12] instead. Fzf uses fuzzy search, so you don’t need to remember the exact command you are looking for. Fzf also allows you to preview and open files. - -I do think that the fact that Elvish is also a programming language is neat, but I’ll stick with Bash shell scripting until Elvish matures a little more. - -Have you every used Elvish? Do you think it would be worthwhile to install Elvish? What is your favorite Bash replacement? 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][13]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/elvish-shell/ - -作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/pipelines-in-elvish.png?fit=800%2C421&ssl=1 -[2]: https://elv.sh/ -[3]: https://github.com/elves/elvish -[4]: https://ranger.github.io/ -[5]: https://github.com/elves/awesome-elvish -[6]: https://elv.sh/ref/name.html -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/Elvish-control-structures.png?fit=800%2C425&ssl=1 -[8]: https://launchpad.net/%7Ezhsj/+archive/ubuntu/elvish -[9]: https://github.com/FZUG/repo/wiki/Add-FZUG-Repository -[10]: https://aur.archlinux.org/packages/elvish/ -[11]: https://linuxhandbook.com/change-shell-linux/ -[12]: https://github.com/junegunn/fzf -[13]: http://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20190603 How many browser tabs do you usually have open.md b/sources/tech/20190603 How many browser tabs do you usually have open.md deleted file mode 100644 index 7777477029..0000000000 --- a/sources/tech/20190603 How many browser tabs do you usually have open.md +++ /dev/null @@ -1,44 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How many browser tabs do you usually have open?) -[#]: via: (https://opensource.com/article/19/6/how-many-browser-tabs) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst) - -How many browser tabs do you usually have open? -====== -Plus, get a few tips for browser productivity. -![Browser of things][1] - -Here's a potentially loaded question: How many browser tabs do you usually have open at one time? Do you have multiple windows, each with multiple tabs? Or are you a minimalist, and only have a couple of tabs open at once. Another option is to move a 20-tabbed browser window to a different monitor so that it is out of the way while working on a particular task. Does your approach differ between work, personal, and mobile browsers? Is your browser strategy related to your [productivity habits][2]? - -### 4 tips for browser productivity - - 1. Know your browser shortcuts to save clicks. Whether you use Firefox or Chrome, there are plenty of keyboard shortcuts to help make switching between tabs and performing certain functions a breeze. For example, Chrome makes it easy to open up a blank Google document. Use the shortcut **"Ctrl + t"** to open a new tab, then type **"doc.new"**. The same can be done for spreadsheets, slides, and forms. - 2. Organize your most frequent tasks with bookmark folders. When it's time to start a particular task, simply open all of the bookmarks in the folder **(Ctrl + click)** to check it off your list quickly. - 3. Get the right browser extensions for you. There are thousands of browser extensions out there all claiming to improve productivity. Before you install, make sure you're not just adding more distractions to your screen. - 4. Reduce screen time by using a timer. It doesn't matter if you use an old-fashioned egg timer or a fancy browser extension. To prevent eye strain, implement the 20/20/20 rule. Every 20 minutes, take a 20-second break from your screen and look at something 20 feet away. - - - -Take our poll to share how many browser tabs you like to have open at once. Be sure to tell us about your favorite browser tricks in the comments. - -There are two components of productivity—doing the right things and doing those things efficiently... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/how-many-browser-tabs - -作者:[Lauren Pritchett][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/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst -[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://enterprisersproject.com/article/2019/1/5-time-wasting-habits-break-new-year diff --git a/sources/tech/20190603 How to stream music with GNOME Internet Radio.md b/sources/tech/20190603 How to stream music with GNOME Internet Radio.md deleted file mode 100644 index fc21d82d0b..0000000000 --- a/sources/tech/20190603 How to stream music with GNOME Internet Radio.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to stream music with GNOME Internet Radio) -[#]: via: (https://opensource.com/article/19/6/gnome-internet-radio) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/r3bl) - -How to stream music with GNOME Internet Radio -====== -If you're looking for a simple, straightforward interface that gets your -streams playing, try GNOME's Internet Radio plugin. -![video editing dashboard][1] - -Internet radio is a great way to listen to stations from all over the world. Like many developers, I like to turn on a station as I code. You can listen to internet radio with a media player for the terminal like [MPlayer][2] or [mpv][3], which is what I use to listen via the Linux command line. However, if you prefer using a graphical user interface (GUI), you may want to try [GNOME Internet Radio][4], a nifty plugin for the GNOME desktop. You can find it in the package manager. - -![GNOME Internet Radio plugin][5] - -Listening to internet radio with a graphical desktop operating system generally requires you to launch an application such as [Audacious][6] or [Rhythmbox][7]. They have nice interfaces, plenty of options, and cool audio visualizers. But if you want a simple, straightforward interface that gets your streams playing, GNOME Internet Radio is for you. - -After installing it, a small icon appears in your toolbar, which is where you do all your configuration and management. - -![GNOME Internet Radio icons][8] - -The first thing I did was go to the Settings menu. I enabled the following two options: show title notifications and show volume adjustment. - -![GNOME Internet Radio Settings][9] - -GNOME Internet Radio includes a few pre-configured stations, and it is really easy to add others. Just click the ( **+** ) sign. You'll need to enter a channel name, which can be anything you prefer (including the station name), and the station address. For example, I like to listen to Synthetic FM. I enter the name, e.g., "Synthetic FM," and the stream address, i.e., . - -Then click the star next to the stream to add it to your menu. - -However you listen to music and whatever genre you choose, it is obvious—coders need their music! The GNOME Internet Radio plugin makes it simple to get your favorite internet radio station queued up. - -In honor of the Gnome desktop's 18th birthday on August 15, we've rounded up 18 reasons to toast... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/gnome-internet-radio - -作者:[Alan Formy-Duval][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/alanfdoss/users/r3bl -[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/18/12/linux-toy-mplayer -[3]: https://mpv.io/ -[4]: https://extensions.gnome.org/extension/836/internet-radio/ -[5]: https://opensource.com/sites/default/files/uploads/packagemanager_s.png (GNOME Internet Radio plugin) -[6]: https://audacious-media-player.org/ -[7]: https://help.gnome.org/users/rhythmbox/stable/ -[8]: https://opensource.com/sites/default/files/uploads/titlebaricons.png (GNOME Internet Radio icons) -[9]: https://opensource.com/sites/default/files/uploads/gnomeinternetradio_settings.png (GNOME Internet Radio Settings) diff --git a/sources/tech/20190614 What is a Java constructor.md b/sources/tech/20190614 What is a Java constructor.md deleted file mode 100644 index 66cd30110d..0000000000 --- a/sources/tech/20190614 What is a Java constructor.md +++ /dev/null @@ -1,158 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is a Java constructor?) -[#]: via: (https://opensource.com/article/19/6/what-java-constructor) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree) - -What is a Java constructor? -====== -Constructors are powerful components of programming. Use them to unlock -the full potential of Java. -![][1] - -Java is (disputably) the undisputed heavyweight in open source, cross-platform programming. While there are many [great][2] [cross-platform][2] [frameworks][3], few are as unified and direct as [Java][4]. - -Of course, Java is also a pretty complex language with subtleties and conventions all its own. One of the most common questions about Java relates to **constructors** : What are they and what are they used for? - -Put succinctly: a constructor is an action performed upon the creation of a new **object** in Java. When your Java application creates an instance of a class you have written, it checks for a constructor. If a constructor exists, Java runs the code in the constructor while creating the instance. That's a lot of technical terms crammed into a few sentences, but it becomes clearer when you see it in action, so make sure you have [Java installed][5] and get ready for a demo. - -### Life without constructors - -If you're writing Java code, you're already using constructors, even though you may not know it. All classes in Java have a constructor because even if you haven't created one, Java does it for you when the code is compiled. For the sake of demonstration, though, ignore the hidden constructor that Java provides (because a default constructor adds no extra features), and take a look at life without an explicit constructor. - -Suppose you're writing a simple Java dice-roller application because you want to produce a pseudo-random number for a game. - -First, you might create your dice class to represent a physical die. Knowing that you play a lot of [Dungeons and Dragons][6], you decide to create a 20-sided die. In this sample code, the variable **dice** is the integer 20, representing the maximum possible die roll (a 20-sided die cannot roll more than 20). The variable **roll** is a placeholder for what will eventually be a random number, and **rand** serves as the random seed. - - -``` -import java.util.Random; - -public class DiceRoller { -private int dice = 20; -private int roll; -private [Random][7] rand = new [Random][7](); -``` - -Next, create a function in the **DiceRoller** class to execute the steps the computer must take to emulate a die roll: Take an integer from **rand** and assign it to the **roll** variable, add 1 to account for the fact that Java starts counting at 0 but a 20-sided die has no 0 value, then print the results. - - -``` -public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); -} -``` - -Finally, spawn an instance of the **DiceRoller** class and invoke its primary function, **Roller** : - - -``` -// main loop -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); - -DiceRoller App = new DiceRoller(); -App.Roller(); -} -} -``` - -As long as you have a Java development environment installed (such as [OpenJDK][10]), you can run your application from a terminal: - - -``` -$ java dice.java -You rolled a 12 -``` - -In this example, there is no explicit constructor. It's a perfectly valid and legal Java application, but it's a little limited. For instance, if you set your game of Dungeons and Dragons aside for the evening to play some Yahtzee, you would need 6-sided dice. In this simple example, it wouldn't be that much trouble to change the code, but that's not a realistic option in complex code. One way you could solve this problem is with a constructor. - -### Constructors in action - -The **DiceRoller** class in this example project represents a virtual dice factory: When it's called, it creates a virtual die that is then "rolled." However, by writing a custom constructor, you can make your Dice Roller application ask what kind of die you'd like to emulate. - -Most of the code is the same, with the exception of a constructor accepting some number of sides. This number doesn't exist yet, but it will be created later. - - -``` -import java.util.Random; - -public class DiceRoller { -private int dice; -private int roll; -private [Random][7] rand = new [Random][7](); - -// constructor -public DiceRoller(int sides) { -dice = sides; -} -``` - -The function emulating a roll remains unchanged: - - -``` -public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); -} -``` - -The main block of code feeds whatever arguments you provide when running the application. Were this a complex application, you would parse the arguments carefully and check for unexpected results, but for this sample, the only precaution taken is converting the argument string to an integer type: - - -``` -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); -DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) ); -App.Roller(); -} -} -``` - -Launch the application and provide the number of sides you want your die to have: - - -``` -$ java dice.java 20 -You rolled a 10 -$ java dice.java 6 -You rolled a 2 -$ java dice.java 100 -You rolled a 44 -``` - -The constructor has accepted your input, so when the class instance is created, it is created with the **sides** variable set to whatever number the user dictates. - -Constructors are powerful components of programming. Practice using them to unlock the full potential of Java. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/what-java-constructor - -作者:[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/users/ashleykoree -[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 -[2]: https://opensource.com/resources/python -[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython -[4]: https://opensource.com/resources/java -[5]: https://openjdk.java.net/install/index.html -[6]: https://opensource.com/article/19/5/free-rpg-day -[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random -[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[10]: https://openjdk.java.net/ -[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer diff --git a/sources/tech/20190623 What does debugging a program look like.md b/sources/tech/20190623 What does debugging a program look like.md new file mode 100644 index 0000000000..7cc7c1432e --- /dev/null +++ b/sources/tech/20190623 What does debugging a program look like.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does debugging a program look like?) +[#]: via: (https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/) +[#]: author: (Julia Evans https://jvns.ca/) + +What does debugging a program look like? +====== + +I was debugging with a friend who’s a relatively new programmer yesterday, and showed them a few debugging tips. Then I was thinking about how to teach debugging this morning, and [mentioned on Twitter][1] that I’d never seen a really good guide to debugging your code. (there are a ton of really great replies by Anne Ogborn to that tweet if you are interested in debugging tips) + +As usual, I got a lot of helpful answers and now I have a few ideas about how to teach debugging skills / describe the process of debugging. + +### a couple of debugging resources + +I was hoping for more links to debugging books/guides, but here are the 2 recommendations I got: + +**“Debugging” by David Agans**: Several people recommended the book [Debugging][2], which looks like a nice and fairly short book that explains a debugging strategy. I haven’t read it yet (though I ordered it to see if I should be recommending it) and the rules laid out in the book (“understand the system”, “make it fail”, “quit thinking and look”, “divide and conquer”, “change one thing at a time”, “keep an audit trail”, “check the plug”, “get a fresh view”, and “if you didn’t fix it, it ain’t fixed”) seem extremely resaonable :). He also has a charming [debugging poster][3]. + +**“How to debug” by John Regehr**: [How to Debug][4] is a very good blog post based on Regehr’s experience teaching a university embedded systems course. Lots of good advice. He also has a [blog post reviewing 4 books about debugging][5], including Agans’ book. + +### reproduce your bug (but how do you do that?) + +The rest of this post is going to be an attempt to aggregate different ideas about debugging people tweeted at me. + +Somewhat obviously, everybody agrees that being able to consistently reproduce a bug is important if you want to figure out what’s going on. I have an intuitive sense for how to do this but I’m not sure how to **explain** how to go from “I saw this bug twice” to “I can consistently reproduce this bug on demand on my laptop”, and I wonder whether the techniques you use to do this depend on the domain (backend web dev, frontend, mobile, games, C++ programs, embedded etc). + +### reproduce your bug _quickly_ + +Everybody also agrees that it’s extremely useful be able to reproduce the bug quickly (if it takes you 3 minutes to check if every change helped, iterating is VERY SLOW). + +A few suggested approaches: + + * for something that requires clicking on a bunch of things in a browser to reproduce, recording what you clicked on with [Selenium][6] and getting Selenium to replay the UI interactions (suggested [here][7]) + * writing a unit test that reproduces the bug (if you can). bonus: you can add this to your test suite later if it makes sense + * writing a script / finding a command line incantation that does it (like `curl MY_APP.local/whatever`) + + + +### accept that it’s probably your code’s fault + +Sometimes I see a problem and I’m like “oh, library X has a bug”, “oh, it’s DNS”, “oh, SOME OTHER THING THAT IS NOT MY CODE is broken”. And sometimes it’s not my code! But in general between an established library and my code that I wrote last month, usually it’s my code that I wrote last month that’s the problem :). + +### start doing experiments + +@act_gardner gave a [nice, short explanation of what you have to do after you reproduce your bug][8] + +> I try to encourage people to first fully understand the bug - What’s happening? What do you expect to happen? When does it happen? When does it not happen? Then apply their mental model of the system to guess at what could be breaking and come up with experiments. +> +> Experiments could be changing or removing code, making API calls from a REPL, trying new inputs, poking at memory values with a debugger or print statements. + +I think the loop here may be: + + * make guess about one aspect about what might be happening (“this variable is set to X where it should be Y”, “the server is being sent the wrong request”, “this code is never running at all”) + * do experiment to check that guess + * repeat until you understand what’s going on + + + +### change one thing at a time + +Everybody definitely agrees that it is important to change one thing a time when doing an experiment to verify an assumption. + +### check your assumptions + +A lot of debugging is realizing that something you were **sure** was true (“wait this request is going to the new server, right, not the old one???“) is actually… not true. I made an attempt to [list some common incorrect assumptions][9]. Here are some examples: + + * this variable is set to X (“that filename is definitely right”) + * that variable’s value can’t possibly have changed between X and Y + * this code was doing the right thing before + * this function does X + * I’m editing the right file + * there can’t be any typos in that line I wrote it is just 1 line of code + * the documentation is correct + * the code I’m looking at is being executed at some point + * these two pieces of code execute sequentially and not in parallel + * the code does the same thing when compiled in debug / release mode (or with -O2 and without, or…) + * the compiler is not buggy (though this is last on purpose, the compiler is only very rarely to blame :)) + + + +### weird methods to get information + +There are a lot of normal ways to do experiments to check your assumptions / guesses about what the code is doing (print out variable values, use a debugger, etc). Sometimes, though, you’re in a more difficult environment where you can’t print things out and don’t have access to a debugger (or it’s inconvenient to do those things, maybe because there are too many events). Some ways to cope: + + * [adding sounds on mobile][10]: “In the mobile world, I live on this advice. Xcode can play a sound when you hit a breakpoint (and continue without stopping). I place them certain places in the code, and listen for buzzing Tink to indicate tight loops or Morse/Pop pairs to catch unbalanced events” (also [this tweet][11]) + * there’s a very cool talk about [using XCode to play sound for iOS debugging here][12] + * [adding LEDs][13]: “When I did embedded dev ages ago on grids of transputers, we wired up an LED to an unused pin on each chip. It was surprisingly effective for diagnosing parallelism issues.” + * [string][14]: “My networks prof told me about a hack he saw at Xerox in the early days of Ethernet: a tap in the coax with an amp and motor and piece of string. The busier the network was, the faster the string twirled.” + * [peep][15] is a “network auralizer” that translates what’s happening on your system into sounds. I spent 10 minutes trying to get it to compile and failed so far but it looks very fun and I want to try it!! + + + +The point here is that information is the most important thing and you need to do whatever’s necessary to get information. + +### write your code so it’s easier to debug + +Another point a few people brought up is that you can improve your program to make it easier to debug. tef has a nice post about this: [Write code that’s easy to delete, and easy to debug too.][16] here. I thought this was very true: + +> Debuggable code isn’t necessarily clean, and code that’s littered with checks or error handling rarely makes for pleasant reading. + +I think one interpretation of “easy to debug” is “every single time there’s an error, the program reports to you exactly what happened in an easy to understand way”. Whenever my program has a problem and says sometihng “error: failure to connect to SOME_IP port 443: connection timeout” I’m like THANK YOU THAT IS THE KIND OF THING I WANTED TO KNOW and I can check if I need to fix a firewall thing or if I got the wrong IP for some reason or what. + +One simple example of this recently: I was making a request to a server I wrote and the reponse I got was “upstream connect error or disconnect/reset before headers”. This is an nginx error which basically in this case boiled down to “your program crashed before it sent anything in response to the request”. Figuring out the cause of the crash was pretty easy, but having better error handling (returning an error instead of crashing) would have saved me a little time because instead of having to go check the cause of the crash, I could have just read the error message and figured out what was going on right away. + +### error messages are better than silently failing + +To get closer to the dream of “every single time there’s an error, the program reports to you exactly what happened in an easy to understand way” you also need to be disciplined about immediately returning an error message instead of silently writing incorrect data / passing a nonsense value to another function which will do WHO KNOWS WHAT with it and cause you a gigantic headache. This means adding code like this: + +``` +if UNEXPECTED_THING: + raise "oh no THING happened" +``` + +This isn’t easy to get right (it’s not always obvious where you should be raising errors!“) but it really helps a lot. + +### failure: print out a stack of errors, not just one error. + +Related to returning helpful errors that make it easy to debug: Rust has a really incredible error handling library [called failure][17] which basicaly lets you return a chain of errors instead of just one error, so you can print out a stack of errors like: + +``` +"error starting server process" caused by +"error initializing logging backend" caused by +"connection failure: timeout connecting to 1.2.3.4 port 1234". +``` + +This is SO MUCH MORE useful than just `connection failure: timeout connecting to 1.2.3.4 port 1234` by itself because it tells you the significance of 1.2.3.4 (it’s something to do with the logging backend!). And I think it’s also more useful than `connection failure: timeout connecting to 1.2.3.4 port 1234` with a stack trace, because it summarizes at a high level the parts that went wrong instead of making you read all the lines in the stack trace (some of which might not be relevant!). + +tools like this in other languages: + + * Go: the idiom to do this seems to be to just concatenate your stack of errors together as a big string so you get “error: thing one: error: thing two : error: thing three” which works okay but is definitely a lot less structured than `failure`’s system + * Java: I hear you can give exceptions causes but haven’t used that myself + * Python 3: you can use `raise ... from` which sets the `__cause__` attribute on the exception and then your exceptions will be separated by `The above exception was the direct cause of the following exception:..` + + + +If you know how to do this in other languages I’d be interested to hear! + +### understand what the error messages mean + +One sub debugging skill that I take for granted a lot of the time is understanding what error messages mean! I came across this nice graphic explaining [common Python errors and what they mean][18], which breaks down things like `NameError`, `IOError`, etc. + +I think a reason interpreting error messages is hard is that understanding a new error message might mean learning a new concept – `NameError` can mean “Your code uses a variable outside the scope where it’s defined”, but to really understand that you need to understand what variable scope is! I ran into this a lot when learning Rust – the Rust compiler would be like “you have a weird lifetime error” and I’d like be “ugh ok Rust I get it I will go actually learn about how lifetimes work now!“. + +And a lot of the time error messages are caused by a problem very different from the text of the message, like how “upstream connect error or disconnect/reset before headers” might mean “julia, your server crashed!“. The skill of understanding what error messages mean is often not transferable when you switch to a new area (if I started writing a lot of React or something tomorrow, I would probably have no idea what any of the error messages meant!). So this definitely isn’t just an issue for beginner programmers. + +### that’s all for now! + +I feel like the big thing I’m missing when talking about debugging skills is a stronger understanding of where people get stuck with debugging – it’s easy to say “well, you need to reproduce the problem, then make a more minimal reproduction, then start coming up with guesses and verifying them, and improve your mental model of the system, and then figure it out, then fix the problem and hopefully write a test to make it not come back”, but – where are people actually getting stuck in practice? What are the hardest parts? I have some sense of what the hardest parts usually are for me but I’m still not sure what the hardest parts usually are for someone newer to debugging their code. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/1142825259546140673 +[2]: http://debuggingrules.com/ +[3]: http://debuggingrules.com/?page_id=40 +[4]: https://blog.regehr.org/archives/199 +[5]: https://blog.regehr.org/archives/849 +[6]: https://www.seleniumhq.org/ +[7]: https://twitter.com/AnnieTheObscure/status/1142843984642899968 +[8]: https://twitter.com/act_gardner/status/1142838587437830144 +[9]: https://twitter.com/b0rk/status/1142812831420768257 +[10]: https://twitter.com/cocoaphony/status/1142847665690030080 +[11]: https://twitter.com/AnnieTheObscure/status/1142842421954244608 +[12]: https://qnoid.com/2013/06/08/Sound-Debugging.html +[13]: https://twitter.com/wombatnation/status/1142887843963867136 +[14]: https://twitter.com/irvingreid/status/1142887472441040896 +[15]: http://peep.sourceforge.net/intro.html +[16]: https://programmingisterrible.com/post/173883533613/code-to-debug +[17]: https://github.com/rust-lang-nursery/failure +[18]: https://pythonforbiologists.com/29-common-beginner-errors-on-one-page/ diff --git a/sources/tech/20190627 RPM packages explained.md b/sources/tech/20190627 RPM packages explained.md deleted file mode 100644 index 3fb3cee6b2..0000000000 --- a/sources/tech/20190627 RPM packages explained.md +++ /dev/null @@ -1,339 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (RPM packages explained) -[#]: via: (https://fedoramagazine.org/rpm-packages-explained/) -[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) - -RPM packages explained -====== - -![][1] - -Perhaps the best known way the Fedora community pursues its [mission of promoting free and open source software and content][2] is by developing the [Fedora software distribution][3]. So it’s not a surprise at all that a very large proportion of our community resources are spent on this task. This post summarizes how this software is “packaged” and the underlying tools such as _rpm_ that make it all possible. - -### RPM: the smallest unit of software - -The editions and flavors ([spins][4]/[labs][5]/[silverblue][6]) that users get to choose from are all very similar. They’re all composed of various software that is mixed and matched to work well together. What differs between them is the exact list of tools that goes into each. That choice depends on the use case that they target. The basic unit of all of these is an RPM package file. - -RPM files are archives that are similar to ZIP files or tarballs. In fact, they uses compression to reduce the size of the archive. However, along with files, RPM archives also contain metadata about the package. This can be queried using the _rpm_ tool: -``` - -``` - -$ rpm -q fpaste -fpaste-0.3.9.2-2.fc30.noarch - -$ rpm -qi fpaste -Name        : fpaste -Version     : 0.3.9.2 -Release     : 2.fc30 -Architecture: noarch -Install Date: Tue 26 Mar 2019 08:49:10 GMT -Group       : Unspecified -Size        : 64144 -License     : GPLv3+ -Signature   : RSA/SHA256, Thu 07 Feb 2019 15:46:11 GMT, Key ID ef3c111fcfc659b9 -Source RPM  : fpaste-0.3.9.2-2.fc30.src.rpm -Build Date  : Thu 31 Jan 2019 20:06:01 GMT -Build Host  : buildhw-07.phx2.fedoraproject.org -Relocations : (not relocatable) -Packager    : Fedora Project -Vendor      : Fedora Project -URL         : -Bug URL     : -Summary     : A simple tool for pasting info onto sticky notes instances -Description : -It is often useful to be able to easily paste text to the Fedora -Pastebin at and this simple script -will do that and return the resulting URL so that people may -examine the output. This can hopefully help folks who are for -some reason stuck without X, working remotely, or any other -reason they may be unable to paste something into the pastebin - -$ rpm -ql fpaste -/usr/bin/fpaste -/usr/share/doc/fpaste -/usr/share/doc/fpaste/README.rst -/usr/share/doc/fpaste/TODO -/usr/share/licenses/fpaste -/usr/share/licenses/fpaste/COPYING -/usr/share/man/man1/fpaste.1.gz -``` - -``` - -When an RPM package is installed, the _rpm_ tools know exactly what files were added to the system. So, removing a package also removes these files, and leaves the system in a consistent state. This is why installing software using _rpm_ is preferred over installing software from source whenever possible. - -### Dependencies - -Nowadays, it is quite rare for software to be completely self-contained. Even [fpaste][7], a simple one file Python script, requires that the Python interpreter be installed. So, if the system does not have Python installed (highly unlikely, but possible), _fpaste_ cannot be used. In packager jargon, we say that “Python is a **run-time dependency** of _fpaste_“. - -When RPM packages are built (the process of building RPMs is not discussed in this post), the generated archive includes all of this metadata. That way, the tools interacting with the RPM package archive know what else must must be installed so that fpaste works correctly: -``` - -``` - -$ rpm -q --requires fpaste -/usr/bin/python3 -python3 -rpmlib(CompressedFileNames) &lt;= 3.0.4-1 -rpmlib(FileDigests) &lt;= 4.6.0-1 -rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1 -rpmlib(PayloadIsXz) &lt;= 5.2-1 - -$ rpm -q --provides fpaste -fpaste = 0.3.9.2-2.fc30 - -$ rpm -qi python3 -Name        : python3 -Version     : 3.7.3 -Release     : 3.fc30 -Architecture: x86_64 -Install Date: Thu 16 May 2019 18:51:41 BST -Group       : Unspecified -Size        : 46139 -License     : Python -Signature   : RSA/SHA256, Sat 11 May 2019 17:02:44 BST, Key ID ef3c111fcfc659b9 -Source RPM  : python3-3.7.3-3.fc30.src.rpm -Build Date  : Sat 11 May 2019 01:47:35 BST -Build Host  : buildhw-05.phx2.fedoraproject.org -Relocations : (not relocatable) -Packager    : Fedora Project -Vendor      : Fedora Project -URL         : -Bug URL     : -Summary     : Interpreter of the Python programming language -Description : -Python is an accessible, high-level, dynamically typed, interpreted programming -language, designed with an emphasis on code readability. -It includes an extensive standard library, and has a vast ecosystem of -third-party libraries. - -The python3 package provides the "python3" executable: the reference -interpreter for the Python language, version 3. -The majority of its standard library is provided in the python3-libs package, -which should be installed automatically along with python3. -The remaining parts of the Python standard library are broken out into the -python3-tkinter and python3-test packages, which may need to be installed -separately. - -Documentation for Python is provided in the python3-docs package. - -Packages containing additional libraries for Python are generally named with -the "python3-" prefix. - -$ rpm -q --provides python3 -python(abi) = 3.7 -python3 = 3.7.3-3.fc30 -python3(x86-64) = 3.7.3-3.fc30 -python3.7 = 3.7.3-3.fc30 -python37 = 3.7.3-3.fc30 -``` - -``` - -### Resolving RPM dependencies - -While _rpm_ knows the required dependencies for each archive, it does not know where to find them. This is by design: _rpm_ only works on local files and must be told exactly where they are. So, if you try to install a single RPM package, you get an error if _rpm_ cannot find the package’s run-time dependencies. This example tries to install a package downloaded from the Fedora package set: -``` - -``` - -$ ls -python3-elephant-0.6.2-3.fc30.noarch.rpm - -$ rpm -qpi python3-elephant-0.6.2-3.fc30.noarch.rpm -Name        : python3-elephant -Version     : 0.6.2 -Release     : 3.fc30 -Architecture: noarch -Install Date: (not installed) -Group       : Unspecified -Size        : 2574456 -License     : BSD -Signature   : (none) -Source RPM  : python-elephant-0.6.2-3.fc30.src.rpm -Build Date  : Fri 14 Jun 2019 17:23:48 BST -Build Host  : buildhw-02.phx2.fedoraproject.org -Relocations : (not relocatable) -Packager    : Fedora Project -Vendor      : Fedora Project -URL         : -Bug URL     : -Summary     : Elephant is a package for analysis of electrophysiology data in Python -Description : -Elephant - Electrophysiology Analysis Toolkit Elephant is a package for the -analysis of neurophysiology data, based on Neo. - -$ rpm -qp --requires python3-elephant-0.6.2-3.fc30.noarch.rpm -python(abi) = 3.7 -python3.7dist(neo) >= 0.7.1 -python3.7dist(numpy) >= 1.8.2 -python3.7dist(quantities) >= 0.10.1 -python3.7dist(scipy) >= 0.14.0 -python3.7dist(six) >= 1.10.0 -rpmlib(CompressedFileNames) &lt;= 3.0.4-1 -rpmlib(FileDigests) &lt;= 4.6.0-1 -rpmlib(PartialHardlinkSets) &lt;= 4.0.4-1 -rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1 -rpmlib(PayloadIsXz) &lt;= 5.2-1 - -$ sudo rpm -i ./python3-elephant-0.6.2-3.fc30.noarch.rpm -error: Failed dependencies: -        python3.7dist(neo) >= 0.7.1 is needed by python3-elephant-0.6.2-3.fc30.noarch -        python3.7dist(quantities) >= 0.10.1 is needed by python3-elephant-0.6.2-3.fc30.noarch -``` - -``` - -In theory, one could download all the packages that are required for _python3-elephant_, and tell _rpm_ where they all are, but that isn’t convenient. What if _python3-neo_ and _python3-quantities_ have other run-time requirements and so on? Very quickly, the **dependency chain** can get quite complicated. - -#### Repositories - -Luckily, _dnf_ and friends exist to help with this issue. Unlike _rpm_, _dnf_ is aware of **repositories**. Repositories are collections of packages, with metadata that tells _dnf_ what these repositories contain. All Fedora systems come with the default Fedora repositories enabled by default: -``` - -``` - -$ sudo dnf repolist -repo id              repo name                             status -fedora               Fedora 30 - x86_64                    56,582 -fedora-modular       Fedora Modular 30 - x86_64               135 -updates              Fedora 30 - x86_64 - Updates           8,573 -updates-modular      Fedora Modular 30 - x86_64 - Updates     138 -updates-testing      Fedora 30 - x86_64 - Test Updates      8,458 -``` - -``` - -There’s more information on [these repositories][8], and how they [can be managed][9] on the Fedora quick docs. - -_dnf_ can be used to query repositories for information on the packages they contain. It can also search them for software, or install/uninstall/upgrade packages from them: -``` - -``` - -$ sudo dnf search elephant -Last metadata expiration check: 0:05:21 ago on Sun 23 Jun 2019 14:33:38 BST. -============================================================================== Name &amp; Summary Matched: elephant ============================================================================== -python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python -python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python - -$ sudo dnf list \\*elephant\\* -Last metadata expiration check: 0:05:26 ago on Sun 23 Jun 2019 14:33:38 BST. -Available Packages -python3-elephant.noarch      0.6.2-3.fc30      updates-testing -python3-elephant.noarch      0.6.2-3.fc30              updates -``` - -``` - -#### Installing dependencies - -When installing the package using _dnf_ now, it _resolves_ all the required dependencies, then calls _rpm_ to carry out the _transaction_: -``` - -``` - -$ sudo dnf install python3-elephant -Last metadata expiration check: 0:06:17 ago on Sun 23 Jun 2019 14:33:38 BST. -Dependencies resolved. -============================================================================================================================================================================================== - Package                                      Architecture                     Version                                                        Repository                                 Size -============================================================================================================================================================================================== -Installing: - python3-elephant                             noarch                           0.6.2-3.fc30                                                   updates-testing                           456 k -Installing dependencies: - python3-neo                                  noarch                           0.8.0-0.1.20190215git49b6041.fc30                              fedora                                    753 k - python3-quantities                           noarch                           0.12.2-4.fc30                                                  fedora                                    163 k -Installing weak dependencies: - python3-igor                                 noarch                           0.3-5.20150408git2c2a79d.fc30                                  fedora                                     63 k - -Transaction Summary -============================================================================================================================================================================================== -Install  4 Packages - -Total download size: 1.4 M -Installed size: 7.0 M -Is this ok [y/N]: y -Downloading Packages: -(1/4): python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch.rpm                                                                                                  222 kB/s |  63 kB     00:00 -(2/4): python3-elephant-0.6.2-3.fc30.noarch.rpm                                                                                                               681 kB/s | 456 kB     00:00 -(3/4): python3-quantities-0.12.2-4.fc30.noarch.rpm                                                                                                            421 kB/s | 163 kB     00:00 -(4/4): python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch.rpm                                                                                               840 kB/s | 753 kB     00:00 -\---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -Total                                                                                                                                                         884 kB/s | 1.4 MB     00:01 -Running transaction check -Transaction check succeeded. -Running transaction test -Transaction test succeeded. -Running transaction -  Preparing        :                                                                                                                                                                      1/1 -  Installing       : python3-quantities-0.12.2-4.fc30.noarch                                                                                                                              1/4 -  Installing       : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch                                                                                                                    2/4 -  Installing       : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch                                                                                                                 3/4 -  Installing       : python3-elephant-0.6.2-3.fc30.noarch                                                                                                                                 4/4 -  Running scriptlet: python3-elephant-0.6.2-3.fc30.noarch                                                                                                                                 4/4 -  Verifying        : python3-elephant-0.6.2-3.fc30.noarch                                                                                                                                 1/4 -  Verifying        : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch                                                                                                                    2/4 -  Verifying        : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch                                                                                                                 3/4 -  Verifying        : python3-quantities-0.12.2-4.fc30.noarch                                                                                                                              4/4 - -Installed: -  python3-elephant-0.6.2-3.fc30.noarch   python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch   python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch   python3-quantities-0.12.2-4.fc30.noarch - -Complete! -``` - -``` - -Notice how dnf even installed _python3-igor_, which isn’t a direct dependency of _python3-elephant_. - -### DnfDragora: a graphical interface to DNF - -While technical users may find _dnf_ straightforward to use, it isn’t for everyone. [Dnfdragora][10] addresses this issue by providing a graphical front end to _dnf_. - -![dnfdragora \(version 1.1.1-2 on Fedora 30\) listing all the packages installed on a system.][11] - -From a quick look, dnfdragora appears to provide all of _dnf_‘s main functions. - -There are other tools in Fedora that also manage packages. GNOME Software, and Discover are two examples. GNOME Software is focused on graphical applications only. You can’t use the graphical front end to install command line or terminal tools such as _htop_ or _weechat_. However, GNOME Software does support the installation of [Flatpaks][12] and Snap applications which _dnf_ does not. So, they are different tools with different target audiences, and so provide different functions. - -This post only touches the tip of the iceberg that is the life cycle of software in Fedora. This article explained what RPM packages are, and the main differences between using _rpm_ and using _dnf_. - -In future posts, we’ll speak more about: - - * The processes that are needed to create these packages - * How the community tests them to ensure that they are built correctly - * The infrastructure that the community uses to get them to community users in future posts. - - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/rpm-packages-explained/ - -作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg -[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about -[3]: https://getfedora.org -[4]: https://spins.fedoraproject.org/ -[5]: https://labs.fedoraproject.org/ -[6]: https://silverblue.fedoraproject.org/ -[7]: https://src.fedoraproject.org/rpms/fpaste -[8]: https://docs.fedoraproject.org/en-US/quick-docs/repositories/ -[9]: https://docs.fedoraproject.org/en-US/quick-docs/adding-or-removing-software-repositories-in-fedora/ -[10]: https://src.fedoraproject.org/rpms/dnfdragora -[11]: https://fedoramagazine.org/wp-content/uploads/2019/06/dnfdragora-1024x558.png -[12]: https://fedoramagazine.org/getting-started-flatpak/ diff --git a/sources/tech/20190628 Get your work recognized- write a brag document.md b/sources/tech/20190628 Get your work recognized- write a brag document.md new file mode 100644 index 0000000000..e13dd2a07b --- /dev/null +++ b/sources/tech/20190628 Get your work recognized- write a brag document.md @@ -0,0 +1,256 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get your work recognized: write a brag document) +[#]: via: (https://jvns.ca/blog/brag-documents/) +[#]: author: (Julia Evans https://jvns.ca/) + +Get your work recognized: write a brag document +====== + +There’s this idea that, if you do great work at your job, people will (or should!) automatically recognize that work and reward you for it with promotions / increased pay. In practice, it’s often more complicated than that – some kinds of important work are more visible/memorable than others. It’s frustrating to have done something really important and later realize that you didn’t get rewarded for it just because the people making the decision didn’t understand or remember what you did. So I want to talk about a tactic that I and lots of people I work with have used! + +This blog post isn’t just about being promoted or getting raises though. The ideas here have actually been more useful to me to help me reflect on themes in my work, what’s important to me, what I’m learning, and what I’d like to be doing differently. But they’ve definitely helped with promotions! + +You can also [skip to the brag document template at the end][1]. + +### you don’t remember everything you did + +One thing I’m always struck by when it comes to performance review time is a feeling of “wait, what _did_ I do in the last 6 months?“. This is a kind of demoralizing feeling and it’s usually not based in reality, more in “I forgot what cool stuff I actually did”. + +I invariably end up having to spend a bunch of time looking through my pull requests, tickets, launch emails, design documents, and more. I always end up finding small (and sometimes not-so-small) things that I completely forgot I did, like: + + * mentored an intern 5 months ago + * did a small-but-important security project + * spent a few weeks helping get an important migration over the line + * helped X put together this design doc + * etcetera! + + + +### your manager doesn’t remember everything you did + +And if you don’t remember everything important you did, your manager (no matter how great they are!) probably doesn’t either. And they need to explain to other people why you should be promoted or given an evaluation like “exceeds expectations” (“X’s work is so awesome!!!!” doesn’t fly). + +So if your manager is going to effectively advocate for you, they need help. + +### here’s the tactic: write a document listing your accomplishments + +The tactic is pretty simple! Instead of trying to remember everything you did with your brain, maintain a “brag document” that lists everything so you can refer to it when you get to performance review season! This is a pretty common tactic – when I started doing this I mentioned it to more experienced people and they were like “oh yeah, I’ve been doing that for a long time, it really helps”. + +Where I work we call this a “brag document” but I’ve heard other names for the same concept like “hype document” or “list of stuff I did” :). + +There’s a basic template for a brag document at the end of this post. + +### share your brag document with your manager + +When I first wrote a brag document I was kind of nervous about sharing it with my manager. It felt weird to be like “hey, uh, look at all the awesome stuff I did this year, I wrote a long document listing everything”. But my manager was really thankful for it – I think his perspective was “this makes my job way easier, now I can look at the document when writing your perf review instead of trying to remember what happened”. + +Giving them a document that explains your accomplishments will really help your manager advocate for you in discussions about your performance and come to any meetings they need to have prepared. + +Brag documents also **really** help with manager transitions – if you get a new manager 3 months before an important performance review that you want to do well on, giving them a brag document outlining your most important work & its impact will help them understand what you’ve been doing even though they may not have been aware of any of your work before. + +### share it with your peer reviewers + +Similarly, if your company does peer feedback as part of the promotion/perf process – share your brag document with your peer reviewers!! Every time someone shares their doc with me I find it SO HELPFUL with writing their review for much the same reasons it’s helpful to share it with your manager – it reminds me of all the amazing things they did, and when they list their goals in their brag document it also helps me see what areas they might be most interested in feedback on. + +On some teams at work it’s a team norm to share a brag document with peer reviewers to make it easier for them. + +### explain the big picture + +In addition to just listing accomplishments, in your brag document you can write the narrative explaining the big picture of your work. Have you been really focused on security? On building your product skills & having really good relationships with your users? On building a strong culture of code review on the team? + +In my brag document, I like to do this by making a section for areas that I’ve been focused on (like “security”) and listing all the work I’ve done in that area there. This is especially good if you’re working on something fuzzy like “building a stronger culture of code review” where all the individual actions you do towards that might be relatively small and there isn’t a big shiny ship. + +### use your brag document to notice patterns + +In the past I’ve found the brag document useful not just to hype my accomplishments, but also to reflect on the work I’ve done. Some questions it’s helped me with: + + * What work do I feel most proud of? + * Are there themes in these projects I should be thinking about? What’s the big picture of what I’m working on? (am I working a lot on security? localization?). + * What do I wish I was doing more / less of? + * Which of my projects had the effect I wanted, and which didn’t? Why might that have been? + * What could have gone better with project X? What might I want to do differently next time? + + + +### you can write it all at once or update it every 2 weeks + +Many people have told me that it works best for them if they take a few minutes to update their brag document every 2 weeks ago. For me it actually works better to do a single marathon session every 6 months or every year where I look through everything I did and reflect on it all at once. Try out different approaches and see what works for you! + +### don’t forget to include the fuzzy work + +A lot of us work on fuzzy projects that can feel hard to quantify, like: + + * improving code quality on the team / making code reviews a little more in depth + * making on call easier + * building a more fair interview process / performance review system + * refactoring / driving down technical debt + + + +A lot of people will leave this kind of work out because they don’t know how to explain why it’s important. But I think this kind of work is especially important to put into your brag document because it’s the most likely to fall under the radar! One way to approach this is to, for each goal: + + 1. explain your goal for the work (why do you think it’s important to refactor X piece of code?) + 2. list some things you’ve done towards that goal + 3. list any effects you’ve seen of the work, even if they’re a little indirect + + + +If you tell your coworkers this kind of work is important to you and tell them what you’ve been doing, maybe they can also give you ideas about how to do it more effectively or make the effects of that work more obvious! + +### encourage each other to celebrate accomplishments + +One nice side effect of having a shared idea that it’s normal/good to maintain a brag document at work is that I sometimes see people encouraging each other to record & celebrate their accomplishments (“hey, you should put that in your brag doc, that was really good!”). It can be hard to see the value of your work sometimes, especially when you’re working on something hard, and an outside perspective from a friend or colleague can really help you see why what you’re doing is important. + +Brag documents are good when you use them on your own to advocate for yourself, but I think they’re better as a collaborative effort to recognize where people are excelling. + +Next, I want to talk about a couple of structures that we’ve used to help people recognize their accomplishments. + +### the brag workshop: help people list their accomplishments + +The way this “brag document” practice started in the first place is that my coworker [Karla][2] and I wanted to help other women in engineering advocate for themselves more in the performance review process. The idea is that some people undersell their accomplishments more than they should, so we wanted to encourage those people to “brag” a little bit and write down what they did that was important. + +We did this by running a “brag workshop” just before performance review season. The format of the workshop is like this: + +**Part 1: write the document: 1-2 hours**. Everybody sits down with their laptop, starts looking through their pull requests, tickets they resolved, design docs, etc, and puts together a list of important things they did in the last 6 months. + +**Part 2: pair up and make the impact of your work clearer: 1 hour**. The goal of this part is to pair up, review each other’s documents, and identify places where people haven’t bragged “enough” – maybe they worked on an extremely critical project to the company but didn’t highlight how important it was, maybe they improved test performance but didn’t say that they made the tests 3 times faster and that it improved everyone’s developer experience. It’s easy to accidentally write “I shipped $feature” and miss the follow up (“… which caused $thing to happen”). Another person reading through your document can help you catch the places where you need to clarify the impact. + +### biweekly brag document writing session + +Another approach to helping people remember their accomplishments: my friend Dave gets some friends together every couple of weeks or so for everyone to update their brag documents. It’s a nice way for people to talk about work that they’re happy about & celebrate it a little bit, and updating your brag document as you go can be easier than trying to remember everything you did all at once at the end of the year. + +These don’t have to be people in the same company or even in the same city – that group meets over video chat and has people from many different companies doing this together from Portland, Toronto, New York, and Montreal. + +In general, especially if you’re someone who really cares about your work, I think it’s really positive to share your goals & accomplishments (and the things that haven’t gone so well too!) with your friends and coworkers. It makes it feel less like you’re working alone and more like everyone is supporting each other in helping them accomplish what they want. + +### thanks + +Thanks to Karla Burnett who I worked with on spreading this idea at work, to Dave Vasilevsky for running brag doc writing sessions, to Will Larson who encouraged me to start one [of these][3] in the first place, to my manager Jay Shirley for always being encouraging & showing me that this is a useful way to work with a manager, and to Allie, Dan, Laura, Julian, Kamal, Stanley, and Vaibhav for reading a draft of this. + +I’d also recommend the blog post [Hype Yourself! You’re Worth It!][4] by Aashni Shah which talks about a similar approach. + +## Appendix: brag document template + +Here’s a template for a brag document! Usually I make one brag document per year. (“Julia’s 2017 brag document”). I think it’s okay to make it quite long / comprehensive – 5-10 pages or more for a year of work doesn’t seem like too much to me, especially if you’re including some graphs/charts / screenshots to show the effects of what you did. + +One thing I want to emphasize, for people who don’t like to brag, is – **you don’t have to try to make your work sound better than it is**. Just make it sound **exactly as good as it is**! For example “was the primary contributor to X new feature that’s now used by 60% of our customers and has gotten Y positive feedback”. + +### Goals for this year: + + * List your major goals here! Sharing your goals with your manager & coworkers is really nice because it helps them see how they can support you in accomplishing those goals! + + + +### Goals for next year + + * If it’s getting towards the end of the year, maybe start writing down what you think your goals for next year might be. + + + +### Projects + +For each one, go through: + + * What your contributions were (did you come up with the design? Which components did you build? Was there some useful insight like “wait, we can cut scope and do what we want by doing way less work” that you came up with?) + * The impact of the project – who was it for? Are there numbers you can attach to it? (saved X dollars? shipped new feature that has helped sell Y big deals? Improved performance by X%? Used by X internal users every day?). Did it support some important non-numeric company goal (required to pass an audit? helped retain an important user?) + + + +Remember: don’t forget to explain what the results of you work actually were! It’s often important to go back a few months later and fill in what actually happened after you launched the project. + +### Collaboration & mentorship + +Examples of things in this category: + + * Helping others in an area you’re an expert in (like “other engineers regularly ask me for one-off help solving weird bugs in their CSS” or “quoting from the C standard at just the right moment”) + * Mentoring interns / helping new team members get started + * Writing really clear emails/meeting notes + * Foundational code that other people built on top of + * Improving monitoring / dashboards / on call + * Any code review that you spent a particularly long time on / that you think was especially important + * Important questions you answered (“helped Risha from OTHER_TEAM with a lot of questions related to Y”) + * Mentoring someone on a project (“gave Ben advice from time to time on leading his first big project”) + * Giving an internal talk or workshop + + + +### Design & documentation + +List design docs & documentation that you worked on + + * Design docs: I usually just say “wrote design for X” or “reviewed design for X” + * Documentation: maybe briefly explain the goal behind this documentation (for example “we were getting a lot of questions about X, so I documented it and now we can answer the questions more quickly”) + + + +### Company building + +This is a category we have at work – it basically means “things you did to help the company overall, not just your project / team”. Some things that go in here: + + * Going above & beyond with interviewing or recruiting (doing campus recruiting, etc) + * Improving important processes, like the interview process or writing better onboarding materials + + + +### What you learned + +My friend Julian suggested this section and I think it’s a great idea – try listing important things you learned or skills you’ve acquired recently! Some examples of skills you might be learning or improving: + + * how to do performance analysis & make code run faster + * internals of an important piece of software (like the JVM or Postgres or Linux) + * how to use a library (like React) + * how to use an important tool (like the command line or Firefox dev tools) + * about a specific area of programming (like localization or timezones) + * an area like product management / UX design + * how to write a clear design doc + * a new programming language + + + +It’s really easy to lose track of what skills you’re learning, and usually when I reflect on this I realize I learned a lot more than I thought and also notice things that I’m _not_ learning that I wish I was. + +### Outside of work + +It’s also often useful to track accomplishments outside of work, like: + + * blog posts + * talks/panels + * open source work + * Industry recognition + + + +I think this can be a nice way to highlight how you’re thinking about your career outside of strictly what you’re doing at work. + +This can also include other non-career-related things you’re proud of, if that feels good to you! Some people like to keep a combined personal + work brag document. + +### General prompts + +If you’re feeling stuck for things to mention, try: + + * If you were trying to convince a friend to come join your company/team, what would you tell them about your work? + * Did anybody tell you you did something well recently? + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/brag-documents/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: tmp.nd0Dg3RXQE#template +[2]: https://karla.io/ +[3]: https://lethain.com/career-narratives/ +[4]: http://blog.aashni.me/2019/01/hype-yourself-youre-worth-it/ diff --git a/sources/tech/20190628 How to Install and Use R on Ubuntu.md b/sources/tech/20190628 How to Install and Use R on Ubuntu.md deleted file mode 100644 index 84699fbc8e..0000000000 --- a/sources/tech/20190628 How to Install and Use R on Ubuntu.md +++ /dev/null @@ -1,209 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Use R on Ubuntu) -[#]: via: (https://itsfoss.com/install-r-ubuntu/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Install and Use R on Ubuntu -====== - -_**Brief: This tutorial teaches you to install R on Ubuntu. You’ll also learn how to run your first R program in Ubuntu using various methods.**_ - -[R][1], together with Python, is the most commonly used programming language for statistical computing and graphics, making it easy to work with data. With the growing interest in data analysis, data visualization, data science (the machine learning craze), it is now more popular than ever and is a great tool for anyone looking to dive into this fields. - -The good thing about R is that its syntax is pretty straight-forward and you can find many tutorials/guides on how R is used in the real world. - -In this article, I’ll cover how to install R on Ubuntu Linux. I’ll also show you how to run your first R program in Linux. - -![][2] - -### Installing R on Ubuntu - -**R** is included in the Ubuntu repositories. It can be easily installed using: - -``` -sudo apt install r-base -``` - -Do note that this may install a slightly older version. At the time of writing this article, Ubuntu offers version 3.4 whereas the latest is version 3.6. - -_I advise sticking with whichever version Ubuntu provides unless you must use the newer version._ - -In order to get the latest version (or any specific version for that matter), you must use **[CRAN][3]** (The Comprehensive R Archive Network). This is a list of mirrors for downloading the latest version of R. Click on the next section to learn how to install the latest version of R on Ubuntu. - -**How to install latest R version 3.6 on Ubuntu (click to expand)** - -To get the R version 3.6, you need to add the mirror to your sources list. I have simplified it for you in this command: - -``` -sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran35/" -``` - -Now you should add the key for the repository: - -``` -sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 -``` - -And then update the repository information and install R: - -``` -sudo apt update -sudo apt install r-base -``` - -That’s it. - -[][4] - -Suggested read  How to Create a Bootable Windows 10 USB in Linux - -### Using R programming on Ubuntu - -R has more than one use. I’ll go over several methods you can use to run R programs. - -#### Interactive Mode in R - -After having installed **R**, you can run the console using: - -``` -R -``` - -This should open up the interactive mode: - -![R Interactive Mode][5] - -This R console is very similar to the **Python** and **Haskell** interactive prompts. You can enter any **R** command and you can do basic mathematical computations. For example: - -``` -> 20+40 -[1] 60 - -> print ("Hello World!") -[1] "Hello World!" -``` - -You could test plotting too: - -![R Plotting][6] - -You can **quit** using **q()** or pressing **CTRL+c**. When doing so, you will be asked if you want to save a workspace ****image; a workspace ****is an environment for created variables. - -#### Running R program with Rscript - -The second way to run R programs is in directly on the Linux command line. You can do so using **RScript**, a utility included with **r-base**. - -First, you have to save your R program to a file using your [favorite code editor on Linux][7]. The file extension should be .r. - -This is my sample R program printing “Hello World”. I have saved it in a file name hello.r. - -``` -print("Hello World!") -a <- rnorm(100) -plot(a) -``` - -To run the R program, use the command like this: - -``` -Rscript hello.r -``` - -You should get back the output: - -``` -[1] "Hello World!" -``` - -The plot is going to be saved in the working directory, to a file named **Rplots.pdf**: - -![Rplots.pdf][8] - -**Note:** _**Rscript**_ _doesn’t load the_ _**methods**_ _package by default. Make sure to [load it explicitly][9] in your script_. - -#### Run R scripts with RStudio in Ubuntu - -The most common way to use **R** is using [RStudio][10], a great cross-platform open source IDE. You can [install it using deb file in Ubuntu][11]. Download the deb file from the link below. You’ll have to scroll down a bit to locate the DEB files for Ubuntu. - -[Download RStudio for Ubuntu][12] - -Once you download the DEB file, just double click on it to install it. - -Once installed, search for it in the menu and start it. The home window of the application should pop up: - -![RStudio Home][13] - -Here you have a working console, just like the one you got in the terminal with the **R** command. - -[][14] - -Suggested read  Setting Up Python Environments In Linux and Unix Systems - -To create a file, in the top bar click on **File** and select **New File > Rscript** (or **CTRL+Shift+n)**: - -![RStudio New File][15] - -Press **CTRL+s** to save the file and choose a location and a name it: - -![RStudio Save File][16] - -After doing so, click on **Session > Set Working Directory > To Source File Location** to change the working directory to the location of your script: - -![RStudio Working Directory][17] - -You are now ready to go! Write in your code and click run. You should be able to see output both in the console and in the plotting window: - -![RStudio Run][18] - -**Wrapping Up** - -In this article, I showed you step by step how to get started using the **R** programming language on an Ubuntu system. I covered several ways you can go about this: **R console** – useful for testing, **Rscript** – for the terminal lover, **RStudio** – the IDE for your needs. - -Whether you are willing to get into data science or simply love statistics, **R** is a good addition to your programming arsenal, being the perfect tool for analyzing data. - -If you are absolutely new to R, let me recommend you this excellent book that will teach you fundamentals of R. It’s available on Amazon Kindle. - -Preview | Product | Price | ----|---|---|--- -![Learn R in a Day][19] ![Learn R in a Day][19] | [Learn R in a Day][20] | | [Buy on Amazon][21] - -Do you use **R**? Are you just getting into it? Let us know more about how and why you use or want to learn to use **R**! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-r-ubuntu/ - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://www.r-project.org/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/install-r-on-ubuntu.jpg?resize=800%2C450&ssl=1 -[3]: https://cran.r-project.org/ -[4]: https://itsfoss.com/bootable-windows-usb-linux/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_interactive_mode.png?fit=800%2C516&ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_plotting.jpg?fit=800%2C434&ssl=1 -[7]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rplots_pdf.png?fit=800%2C539&ssl=1 -[9]: https://www.dummies.com/programming/r/how-to-install-load-and-unload-packages-in-r/ -[10]: https://www.rstudio.com/ -[11]: https://itsfoss.com/install-deb-files-ubuntu/ -[12]: https://www.rstudio.com/products/rstudio/download/#download -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_home.jpg?fit=800%2C603&ssl=1 -[14]: https://itsfoss.com/python-setup-linux/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_new_file.png?fit=800%2C392&ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_save_file.png?fit=800%2C258&ssl=1 -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_working_directory.png?fit=800%2C394&ssl=1 -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_run.jpg?fit=800%2C626&ssl=1 -[19]: https://i1.wp.com/images-na.ssl-images-amazon.com/images/I/51oIJTbUlnL._SL160_.jpg?ssl=1 -[20]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Learn R in a Day) -[21]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Buy on Amazon) diff --git a/sources/tech/20190701 Get modular with Python functions.md b/sources/tech/20190701 Get modular with Python functions.md deleted file mode 100644 index 57d363f4e6..0000000000 --- a/sources/tech/20190701 Get modular with Python functions.md +++ /dev/null @@ -1,337 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get modular with Python functions) -[#]: via: (https://opensource.com/article/19/7/get-modular-python-functions) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins) - -Get modular with Python functions -====== -Minimize your coding workload by using Python functions for repeating -tasks. -![OpenStack source code \(Python\) in VIM][1] - -Are you confused by fancy programming terms like functions, classes, methods, libraries, and modules? Do you struggle with the scope of variables? Whether you're a self-taught programmer or a formally trained code monkey, the modularity of code can be confusing. But classes and libraries encourage modular code, and modular code can mean building up a collection of multipurpose code blocks that you can use across many projects to reduce your coding workload. In other words, if you follow along with this article's study of [Python][2] functions, you'll find ways to work smarter, and working smarter means working less. - -This article assumes enough Python familiarity to write and run a simple script. If you haven't used Python, read my [intro to Python][3] article first. - -### Functions - -Functions are an important step toward modularity because they are formalized methods of repetition. If there is a task that needs to be done again and again in your program, you can group the code into a function and call the function as often as you need it. This way, you only have to write the code once, but you can use it as often as you like. - -Here is an example of a simple function: - - -``` -#!/usr/bin/env python3 - -import time - -def Timer(): -        print("Time is " + str(time.time() ) ) -``` - -Create a folder called **mymodularity** and save the function code as **timestamp.py**. - -In addition to this function, create a file called **__init__.py** in the **mymodularity** directory. You can do this in a file manager or a Bash shell: - - -``` -`$ touch mymodularity/__init__.py` -``` - -You have now created your own Python library (a "module," in Python lingo) in your Python package called **mymodularity**. It's not a very useful module, because all it does is import the **time** module and print a timestamp, but it's a start. - -To use your function, treat it just like any other Python module. Here's a small application that tests the accuracy of Python's **sleep()** function, using your **mymodularity** package for support. Save this file as **sleeptest.py** _outside_ the **mymodularity** directory (if you put this _into_ **mymodularity**, then it becomes a module in your package, and you don't want that). - - -``` -#!/usr/bin/env python3 - -import time -from mymodularity import timestamp - -print("Testing Python sleep()...") - -# modularity -timestamp.Timer() -time.sleep(3) -timestamp.Timer() -``` - -In this simple script, you are calling your **timestamp** module from your **mymodularity** package (twice). When you import a module from a package, the usual syntax is to import the module you want from the package and then use the _module name + a dot + the name of the function you want to call_ (e.g., **timestamp.Timer()**). - -You're calling your **Timer()** function twice, so if your **timestamp** module were more complicated than this simple example, you'd be saving yourself quite a lot of repeated code. - -Save the file and run it: - - -``` -$ python3 ./sleeptest.py -Testing Python sleep()... -Time is 1560711266.1526039 -Time is 1560711269.1557732 -``` - -According to your test, the sleep function in Python is pretty accurate: after three seconds of sleep, the timestamp was successfully and correctly incremented by three, with a little variance in microseconds. - -The structure of a Python library might seem confusing, but it's not magic. Python is _programmed_ to treat a folder full of Python code accompanied by an **__init__.py** file as a package, and it's programmed to look for available modules in its current directory _first_. This is why the statement **from mymodularity import timestamp** works: Python looks in the current directory for a folder called **mymodularity**, then looks for a **timestamp** file ending in **.py**. - -What you have done in this example is functionally the same as this less modular version: - - -``` -#!/usr/bin/env python3 - -import time -from mymodularity import timestamp - -print("Testing Python sleep()...") - -# no modularity -print("Time is " + str(time.time() ) ) -time.sleep(3) -print("Time is " + str(time.time() ) ) -``` - -For a simple example like this, there's not really a reason you wouldn't write your sleep test that way, but the best part about writing your own module is that your code is generic so you can reuse it for other projects. - -You can make the code more generic by passing information into the function when you call it. For instance, suppose you want to use your module to test not the _computer's_ sleep function, but a _user's_ sleep function. Change your **timestamp** code so it accepts an incoming variable called **msg**, which will be a string of text controlling how the **timestamp** is presented each time it is called: - - -``` -#!/usr/bin/env python3 - -import time - -# updated code -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -``` - -Now your function is more abstract than before. It still prints a timestamp, but what it prints for the user is undefined. That means you need to define it when calling the function. - -The **msg** parameter your **Timer** function accepts is arbitrarily named. You could call the parameter **m** or **message** or **text** or anything that makes sense to you. The important thing is that when the **timestamp.Timer** function is called, it accepts some text as its input, places whatever it receives into a variable, and uses the variable to accomplish its task. - -Here's a new application to test the user's ability to sense the passage of time correctly: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press the RETURN key. Count to 3, and press RETURN again.") - -input() -timestamp.Timer("Started timer at ") - -print("Count to 3...") - -input() -timestamp.Timer("You slept until ") -``` - -Save your new application as **response.py** and run it: - - -``` -$ python3 ./response.py -Press the RETURN key. Count to 3, and press RETURN again. - -Started timer at 1560714482.3772075 -Count to 3... - -You slept until 1560714484.1628013 -``` - -### Functions and required parameters - -The new version of your timestamp module now _requires_ a **msg** parameter. That's significant because your first application is broken because it doesn't pass a string to the **timestamp.Timer** function: - - -``` -$ python3 ./sleeptest.py -Testing Python sleep()... -Traceback (most recent call last): -  File "./sleeptest.py", line 8, in <module> -    timestamp.Timer() -TypeError: Timer() missing 1 required positional argument: 'msg' -``` - -Can you fix your **sleeptest.py** application so it runs correctly with the updated version of your module? - -### Variables and functions - -By design, functions limit the scope of variables. In other words, if a variable is created within a function, that variable is available to _only_ that function. If you try to use a variable that appears in a function outside the function, an error occurs. - -Here's a modification of the **response.py** application, with an attempt to print the **msg** variable from the **timestamp.Timer()** function: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press the RETURN key. Count to 3, and press RETURN again.") - -input() -timestamp.Timer("Started timer at ") - -print("Count to 3...") - -input() -timestamp.Timer("You slept for ") - -print(msg) -``` - -Try running it to see the error: - - -``` -$ python3 ./response.py -Press the RETURN key. Count to 3, and press RETURN again. - -Started timer at 1560719527.7862902 -Count to 3... - -You slept for 1560719528.135406 -Traceback (most recent call last): -  File "./response.py", line 15, in <module> -    print(msg) -NameError: name 'msg' is not defined -``` - -The application returns a **NameError** message because **msg** is not defined. This might seem confusing because you wrote code that defined **msg**, but you have greater insight into your code than Python does. Code that calls a function, whether the function appears within the same file or if it's packaged up as a module, doesn't know what happens inside the function. A function independently performs its calculations and returns what it has been programmed to return. Any variables involved are _local_ only: they exist only within the function and only as long as it takes the function to accomplish its purpose. - -#### Return statements - -If your application needs information contained only in a function, use a **return** statement to have the function provide meaningful data after it runs. - -They say time is money, so modify your timestamp function to allow for an imaginary charging system: - - -``` -#!/usr/bin/env python3 - -import time - -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -    charge = .02 -    return charge -``` - -The **timestamp** module now charges two cents for each call, but most importantly, it returns the amount charged each time it is called. - -Here's a demonstration of how a return statement can be used: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press RETURN for the time (costs 2 cents).") -print("Press Q RETURN to quit.") - -total = 0 - -while True: -    kbd = input() -    if kbd.lower() == "q": -        print("You owe $" + str(total) ) -        exit() -    else: -        charge = timestamp.Timer("Time is ") -        total = total+charge -``` - -In this sample code, the variable **charge** is assigned as the endpoint for the **timestamp.Timer()** function, so it receives whatever the function returns. In this case, the function returns a number, so a new variable called **total** is used to keep track of how many changes have been made. When the application receives the signal to quit, it prints the total charges: - - -``` -$ python3 ./charge.py -Press RETURN for the time (costs 2 cents). -Press Q RETURN to quit. - -Time is 1560722430.345412 - -Time is 1560722430.933996 - -Time is 1560722434.6027434 - -Time is 1560722438.612629 - -Time is 1560722439.3649364 -q -You owe $0.1 -``` - -#### Inline functions - -Functions don't have to be created in separate files. If you're just writing a short script specific to one task, it may make more sense to just write your functions in the same file. The only difference is that you don't have to import your own module, but otherwise the function works the same way. Here's the latest iteration of the time test application as one file: - - -``` -#!/usr/bin/env python3 - -import time - -total = 0 - -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -    charge = .02 -    return charge - -print("Press RETURN for the time (costs 2 cents).") -print("Press Q RETURN to quit.") - -while True: -    kbd = input() -    if kbd.lower() == "q": -        print("You owe $" + str(total) ) -        exit() -    else: -        charge = Timer("Time is ") -        total = total+charge -``` - -It has no external dependencies (the **time** module is included in the Python distribution), and produces the same results as the modular version. The advantage is that everything is located in one file, and the disadvantage is that you cannot use the **Timer()** function in some other script you are writing unless you copy and paste it manually. - -#### Global variables - -A variable created outside a function has nothing limiting its scope, so it is considered a _global_ variable. - -An example of a global variable is the **total** variable in the **charge.py** example used to track current charges. The running total is created outside any function, so it is bound to the application rather than to a specific function. - -A function within the application has access to your global variable, but to get the variable into your imported module, you must send it there the same way you send your **msg** variable. - -Global variables are convenient because they seem to be available whenever and wherever you need them, but it can be difficult to keep track of their scope and to know which ones are still hanging around in system memory long after they're no longer needed (although Python generally has very good garbage collection). - -Global variables are important, though, because not all variables can be local to a function or class. That's easy now that you know how to send variables to functions and get values back. - -### Wrapping up functions - -You've learned a lot about functions, so start putting them into your scripts—if not as separate modules, then as blocks of code you don't have to write multiple times within one script. In the next article in this series, I'll get into Python classes. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/get-modular-python-functions - -作者:[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/users/xd-deng/users/nhuntwalker/users/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) -[2]: https://www.python.org/ -[3]: https://opensource.com/article/17/10/python-101 diff --git a/sources/tech/20190718 What you need to know to be a sysadmin.md b/sources/tech/20190718 What you need to know to be a sysadmin.md index bd482f3ca4..55947b8456 100644 --- a/sources/tech/20190718 What you need to know to be a sysadmin.md +++ b/sources/tech/20190718 What you need to know to be a sysadmin.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (WangYueScream ) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190719 Buying a Linux-ready laptop.md b/sources/tech/20190719 Buying a Linux-ready laptop.md deleted file mode 100644 index f63f9276e4..0000000000 --- a/sources/tech/20190719 Buying a Linux-ready laptop.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Buying a Linux-ready laptop) -[#]: via: (https://opensource.com/article/19/7/linux-laptop) -[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-eshttps://opensource.com/users/greg-phttps://opensource.com/users/chrisodhttps://opensource.com/users/victorhckhttps://opensource.com/users/hankghttps://opensource.com/users/noplanman) - -Buying a Linux-ready laptop -====== -Tuxedo makes it easy to buy an out-of-the-box "penguin-ready" laptop. -![Penguin with green background][1] - -Recently, I bought and started using a Tuxedo Book BC1507, a Linux laptop computer. Ten years ago, if someone had told me that, by the end of the decade, I could buy top-quality, "penguin-ready" laptops from companies such as [System76][2], [Slimbook][3], and [Tuxedo][4], I probably would have laughed. Well, now I'm laughing, but with joy! - -Going beyond designing computers for free/libre open source software (FLOSS), all three companies recently [announced][5] they are trying to eliminate proprietary BIOS software by switching to [Coreboot][6]. - -### Buying it - -Tuxedo Computers is a German company that builds Linux-ready laptops. In fact, if you want a different operating system, it costs more. - -Buying the computer was incredibly easy. Tuxedo offers many payment methods: not only credit cards but also PayPal and even bank transfers. Just fill out the bank transfer form on Tuxedo's web page, and the company will send you the bank coordinates. - -Tuxedo builds every computer on demand, and picking exactly what you want is as easy as selecting the basic model and exploring the drop-down menus to select different components. There is a lot of information on the page to guide you in the purchase. - -If you pick a different Linux distribution from the recommended one, Tuxedo does a "net install," so have a network cable ready to finish the installation, or you can burn your preferred image onto a USB key. I used a DVD with the openSUSE Leap 15.1 installer through an external DVD reader instead, but you get the idea. - -The model I chose accepts up to two disks: one SSD and the other either an SSD or a conventional hard drive. As I was already over budget, I decided to pick a conventional 1TB disk and increase the RAM to 16GB. The processor is an 8th Generation i5 with four cores. I selected a back-lit Spanish keyboard, a 1920×1080/96dpi screen, and an SD card reader—all in all, a great system. - -If you're fine with the default English or German keyboard, you can even ask for a penguin icon on the Meta key! I needed a Spanish keyboard, which doesn't offer this option. - -### Receiving and using it - -The perfectly packaged computer arrived in total safety to my door just six working days after the payment was registered. After unpacking the computer and unlocking the battery, I was ready to roll. - -![Tuxedo Book BC1507][7] - -The new toy on top of my (physical) desktop. - -The computer's design is really nice and feels solid. Even though the chassis on this model is not aluminum, it stays cool. The fan is really quiet, and the airflow goes to the back edge, not to the sides, as in many other laptops. The battery provides several hours of autonomy from an electrical outlet. An option in the BIOS called FlexiCharger stops charging the battery after it reaches a certain percentage, so you don't need to remove the battery when you work for a long time while plugged in. - -The keyboard is really comfortable and surprisingly quiet. Even the touchpad keys are quiet! Also, you can easily adjust the light intensity on the back-lit keyboard. - -Finally, it's easy to access every component in the laptop so the computer can be updated or repaired without problems. Tuxedo even sends spare screws! - -### Conclusion - -After a month of heavy use, I'm really happy with the system. I got exactly what I asked for, and everything works perfectly. - -Because they are usually high-end systems, Linux-included computers tend to be on the expensive side of the spectrum. If you compare the price of a Tuxedo or Slimbook computer with something with similar specifications from a more established brand, the prices are not that different. If you are after a powerful system to use with free software, don't hesitate to support these companies: What they offer is worth the price. - -Let's us know in the comments about your experience with Tuxedo and other "penguin-friendly" companies. - -* * * - -_This article is based on "[My new 'penguin ready' laptop: Tuxedo-Book-BC1507][8]," published on Ricardo's blog, [From Mind to Type][9]._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/linux-laptop - -作者:[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-eshttps://opensource.com/users/greg-phttps://opensource.com/users/chrisodhttps://opensource.com/users/victorhckhttps://opensource.com/users/hankghttps://opensource.com/users/noplanman -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) -[2]: https://system76.com/ -[3]: https://slimbook.es/en/ -[4]: https://www.tuxedocomputers.com/ -[5]: https://www.tuxedocomputers.com/en/Infos/News/Tuxedo-Computers-stands-for-Free-Software-and-Security-.tuxedo -[6]: https://coreboot.org/ -[7]: https://opensource.com/sites/default/files/uploads/tuxedo-600_0.jpg (Tuxedo Book BC1507) -[8]: https://frommindtotype.wordpress.com/2019/06/17/my-new-penguin-ready-laptop-tuxedo-book-bc1507/ -[9]: https://frommindtotype.wordpress.com/ diff --git a/sources/tech/20190730 How to manage logs in Linux.md b/sources/tech/20190730 How to manage logs in Linux.md deleted file mode 100644 index cebfbc5f99..0000000000 --- a/sources/tech/20190730 How to manage logs in Linux.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to manage logs in Linux) -[#]: via: (https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How to manage logs in Linux -====== -Log files on Linux systems contain a LOT of information — more than you'll ever have time to view. Here are some tips on how you can make use of it without ... drowning in it. -![Greg Lobinski \(CC BY 2.0\)][1] - -Managing log files on Linux systems can be incredibly easy or painful. It all depends on what you mean by log management. - -If all you mean is how you can go about ensuring that your log files don’t eat up all the disk space on your Linux server, the issue is generally quite straightforward. Log files on Linux systems will automatically roll over, and the system will only maintain a fixed number of the rolled-over logs. Even so, glancing over what can easily be a group of 100 files can be overwhelming. In this post, we'll take a look at how the log rotation works and some of the most relevant log files. - -**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][2] ]** - -### Automatic log rotation - -Log files rotate frequently. What is the current log acquires a slightly different file name and a new log file is established. Take the syslog file as an example. This file is something of a catch-all for a lot of normal system messages. If you **cd** over to **/var/log** and take a look, you’ll probably see a series of syslog files like this: - -``` -$ ls -l syslog* --rw-r----- 1 syslog adm 28996 Jul 30 07:40 syslog --rw-r----- 1 syslog adm 71212 Jul 30 00:00 syslog.1 --rw-r----- 1 syslog adm 5449 Jul 29 00:00 syslog.2.gz --rw-r----- 1 syslog adm 6152 Jul 28 00:00 syslog.3.gz --rw-r----- 1 syslog adm 7031 Jul 27 00:00 syslog.4.gz --rw-r----- 1 syslog adm 5602 Jul 26 00:00 syslog.5.gz --rw-r----- 1 syslog adm 5995 Jul 25 00:00 syslog.6.gz --rw-r----- 1 syslog adm 32924 Jul 24 00:00 syslog.7.gz -``` - -Rolled over at midnight each night, the older syslog files are kept for a week and then the oldest is deleted. The syslog.7.gz file will be tossed off the system and syslog.6.gz will be renamed syslog.7.gz. The remainder of the log files will follow suit until syslog becomes syslog.1 and a new syslog file is created. Some syslog files will be larger than others, but in general, none will likely ever get very large and you’ll never see more than eight of them. This gives you just over a week to review any data they collect. - -The number of files maintained for any particular log file depends on the log file itself. For some, you may have as many as 13. Notice how the older files – both for syslog and dpkg – are gzipped to save space. The thinking here is likely that you’ll be most interested in the recent logs. Older logs can be unzipped with **gunzip** as needed. - -``` -# ls -t dpkg* -dpkg.log dpkg.log.3.gz dpkg.log.6.gz dpkg.log.9.gz dpkg.log.12.gz -dpkg.log.1 dpkg.log.4.gz dpkg.log.7.gz dpkg.log.10.gz -dpkg.log.2.gz dpkg.log.5.gz dpkg.log.8.gz dpkg.log.11.gz -``` - -Log files can be rotated based on age, as well as by size. Keep this in mind as you examine your log files. - -Log file rotation can be configured differently if you are so inclined, though the defaults work for most Linux sysadmins. Take a look at files like **/etc/rsyslog.conf** and **/etc/logrotate.conf** for some of the details. - -### Making use of your log files - -Managing log files should also include using them from time to time. The first step in making use of log files should probably include getting used to what each log file can tell you about how your system is working and what problems it might have run into. Reading log files from top to bottom is almost never a good option, but knowing how to pull information from them can be of great benefit when you want to get a sense of how well your system is working or need to track down a problem. This also suggests that you have a general idea what kind of information is stored in each file. For example: - -``` -$ who wtmp | tail -10 show the most recent logins -$ who wtmp | grep shark show recent logins for a particular user -$ grep "sudo:" auth.log see who is using sudo -$ tail dmesg look at kernel messages -$ tail dpkg.log see recently installed and updated packages -$ more ufw.log see firewall activity (i.e., if you are using ufw) -``` - -Some commands that you run will also extract information from your log files. If you want to see, for example, a list of system reboots, you can use a command like this: - -``` -$ last reboot -reboot system boot 5.0.0-20-generic Tue Jul 16 13:19 still running -reboot system boot 5.0.0-15-generic Sat May 18 17:26 - 15:19 (21+21:52) -reboot system boot 5.0.0-13-generic Mon Apr 29 10:55 - 15:34 (18+04:39) -``` - -### Using more advanced log managers - -While you can write scripts to make it easier to find interesting information in your log files, you should also be aware that there are some very sophisticated tools available for log file analysis. Some correlate information from multiple sources to get a fuller picture of what’s happening on your network. They may provide real-time monitoring, as well. Tools such as [Solarwinds Log & Event Manager][3] and [PRTG Network Monitor][4] (which includes log monitoring) come to mind. - -There are also some free tools that can help with analyzing log files. These include: - - * **Logwatch** — program to scan system logs for interesting lines - * **Logcheck** — system log analyzer and reporter - - - -I'll provide some insights and help on these tools in upcoming posts. - -**[ Also see: [Invaluable tips and tricks for troubleshooting Linux][5] ]** - -Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.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://images.idgesg.net/images/article/2019/07/logs-100806633-large.jpg -[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[3]: https://www.esecurityplanet.com/products/solarwinds-log-event-manager-siem.html -[4]: https://www.paessler.com/prtg -[5]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md new file mode 100644 index 0000000000..b4e1a2667b --- /dev/null +++ b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md @@ -0,0 +1,508 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn how to Install LXD / LXC Containers in Ubuntu) +[#]: via: (https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/) +[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) + +Learn how to Install LXD / LXC Containers in Ubuntu +====== + +Let me start by explaining what a container is, it is normal process on the host machine (any Linux based m/c) with following characteristics, + + * It feels like a VM, but it is not. + * Uses the host Kernel. + * Cannot boot a different Operating System. + * Can’t have its own modules. + * Does not need “**init”** as PID (Process id) as “1” + + + +[![Learn-LXD-LXC-Containers][1]][2] + +LXC (**LinuX Containers**) technology was developed long ago and is an Operating System level virtualization technology. This was existing from the days of BSD and System-V Release 4 (Popular Unix flavors during 1980-90’s). But until recently, no one new how much it can help us in saving in terms of resource utilization. Because of this technology change, all enterprises are moving towards adoption of virtualization (be it Cloud or be it Docker containers). This also helped in better management of **OpEX(Operational expenditures)** and **CaPEX(Captial expenditures)** costs. Using this technique, we can create and run multiple and isolated Linux virtual environments on a single Linux host machine (called control host). LXC mainly uses Linux’s cgroups and namespaces functionalities, which were introduced in version 2.6.24(kernel version) onwards. In parallel many advancements in hypervisors happened like that of **KVM**, **QEMU**, **Hyper-V**, **ESXi** etc. Especially KVM (Kernel Virtual Machine) which is core of Linux OS, helped in this kind of advancement. + +Difference between LXC and LXD is that LXC is the original and older way to manage containers but it is still supported, all commands of LXC starts with “**lxc-“** like “**lxc-create**” & “**lxc-info**“, whereas LXD is a new way to manage containers and lxc command is used for all containers operations and management. + +All of us know that “**Docker**” utilizes LXC and was developed using Go language, cgroups, namespaces and finally the Linux Kernel itself. Complete Docker has been built and developed using LXC as the basic foundation block. Docker is completely dependent on underlying infrastructure & hardware and using the Operating System as the medium. However, Docker is a portable and easily deployable container engine; all its dependencies are run using a virtual container on most of the Linux based servers. Groups, and Namespaces are the building block concepts for both LXC and Docker containers. Following are the brief description of these concepts. + +### C Groups (Control Groups) + +With Cgroups each resource will have its own hierarchy. + + * CPU, Memory, I/O etc will have their own control group hierarchy. Following are various characterics of Cgroups, + *  Each process is in each node + * Each hierarchy starts with one node + * Initially all processes start at the root node. Therefore “each node” is equivalent to “group of processes”. + * Hierarchies are independent, ex: CPU, Block I/O, memory etc + + + +As explained earlier there are various Cgroup types as listed below, + +1) **Memory Cgroups** + +a) Keeps track of pages used by each group. + +b) File read/write/mmap from block devices + +c) Anonymous memory(stack, heap etc) + +d) Each memory page is charged to a group + +e) Pages can be shared across multiple groups + +2) **CPU Cgroups** + +a) Track users/system cpu time + +b)  Track usage per CPU + +c) Allows set to weights + +d) Can’t set cpu limits + +3) **Block IO Cgroup** + +a) Keep track of read/write(I/O’s) + +b) Set throttle (limits) for each group (per block device) + +c) Set real weights for each group (per block device) + +4) **Devices Cgroup** + +a) Controls what the group can do on device nodes + +b) Permission include /read/write/mknode + +5) **Freezer Cgroup** + +a) Allow to freeze/thaw a group  of processes + +b) Similar to SIGSTOP/SIGCONT + +c) Cannot be detected by processes + +### NameSpaces + +Namespaces provide processes with their own system view. Each process is in name space of each type. + +There are multiple namespaces like, + + * PID – Process within a PID name space only see processes in the same PID name space + * Net – Processes within a given network namespace get their own private network stack. + * Mnt – Processes can have their own “root” and private “mount” points. + * Uts –  Have container its own hostname + * IPC – Allows processes to have own IPC semaphores, IPC message queues and shared memory + * USR – Allows to map UID/GID + + + +### Installation and configuration of LXD containers + +To have LXD installed on Ubuntu system (18.04 LTS) , we can start with LXD installation using below apt command + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install lxd -y +``` + +Once the LXD is installed, we can start with its initialization as below, (most of the times use the default options) + +``` +root@linuxtechi:~$ sudo lxd init +``` + +![lxc-init-ubuntu-system][1] + +Once the LXD is initialized successfully, run the below command to verify information + +``` +root@linuxtechi:~$ sudo lxc info | more +``` + +![lxc-info-command][1] + +Use below command to list if there is any container is downloaded on our host, + +``` +root@linuxtechi:~$ sudo lxc image list ++-------+-------------+--------+-------------+------+------+-------------+ +| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | ++-------+-------------+--------+-------------+------+------+-------------+ +root@linuxtechi:~$ +``` + +Quick and easy way to start the first container on Ubuntu 18.04 (or any supported Ubuntu flavor) use the following command. The container name we have provided is “shashi” + +``` +root@linuxtechi:~$ sudo lxc launch ubuntu:18.04 shashi +Creating shashi +Starting shashi +root@linuxtechi:~$ +``` + +To list out what are the LXC containers that are in the system + +``` +root@linuxtechi:~$ sudo lxc list ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +| shashi | RUNNING | 10.122.140.140 (eth0) | fd42:49da:7c44:cebe:216:3eff:fea4:ea06 (eth0) | PERSISTENT | 0 | ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +root@linuxtechi:~$ +``` + +Other Container management commands for LXD are listed below : + +**Note:** In below examples, shashi is my container name + +**How to take bash shell of your LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc exec shashi bash +root@linuxtechi:~# +``` + +**How Stop, Start & Restart LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc stop shashi +root@linuxtechi:~$ sudo lxc list ++--------+---------+------+------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+------+------+------------+-----------+ +| shashi | STOPPED | | | PERSISTENT | 0 | ++--------+---------+------+------+------------+-----------+ +root@linuxtechi:~$ +root@linuxtechi:~$ sudo lxc start shashi +root@linuxtechi:~$ sudo lxc restart shashi +``` + +**How to delete a LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc stop shashi +root@linuxtechi:~$ sudo lxc delete shashi +root@linuxtechi:~$ sudo lxc list ++------+-------+------+------+------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+-------+------+------+------+-----------+ +root@linuxtechi:~$ +``` + +**How to take snapshot of LXD container and then restore it?** + +Let’s assume we have pkumar container based on centos7 image, so to take the snapshot use the following, + +``` +root@linuxtechi:~$ sudo lxc snapshot pkumar pkumar_snap0 +``` + +Use below command to verify the snapshot + +``` +root@linuxtechi:~$ sudo lxc info pkumar | grep -i Snapshots -A2 +Snapshots: + pkumar_snap0 (taken at 2019/08/02 19:39 UTC) (stateless) +root@linuxtechi:~$ +``` + +Use below command to restore the LXD container from their snapshot + +Syntax: + +$ lxc restore {container_name} {snapshot_name} + +``` +root@linuxtechi:~$ sudo lxc restore pkumar pkumar_snap0 +root@linuxtechi:~$ +``` + +**How to delete LXD container snapshot?** + +``` +$ sudo lxc delete +``` + +**How to set Memory, CPU and Disk Limit on LXD container?** + +Syntax to set Memory limit: + +# lxc config set <container_name> limits.memory <Memory_Size>KB/MB/GB + +Syntax to set CPU limit: + +# lxc config set <container_name>  limits.cpu {Number_of_CPUs} + +Syntax to Set Disk limit: + +# lxc config device set <container_name> root size <Size_MB/GB> + +**Note:** To set a disk limit (it requires btrfs or ZFS filesystem) + +Let’s set limit on Memory and CPU on container shashi using the following commands, + +``` +root@linuxtechi:~$ sudo lxc config set shashi limits.memory 256MB +root@linuxtechi:~$ sudo lxc config set shashi limits.cpu 2 +``` + +### Install and configure LXC container (commands and operations) + +To install lxc on your ubuntu system, use the beneath apt command, + +``` +root@linuxtechi:~$ sudo apt install lxc -y +``` + +In earlier version of LXC, the command “**lxc-clone**” was used and later it was deprecated. Now, “**lxc-copy**” command is widely used for cloning operation. + +**Note:** To get “lxc-copy” command working, use the following installation steps, + +``` +root@linuxtechi:~$ sudo apt install lxc1 -y +``` + +**Creating Linux Containers using the templates** + +LXC provides ready-made templates for easy installation of Linux containers. Templates are usually found in the directory path /usr/share/lxc/templates, but in fresh installation we will not get the templates, so to download the templates in your local system , run the beneath command, + +``` +root@linuxtechi:~$ sudo apt install lxc-templates -y +``` + +Once the lxc-templates are installed successfully then templates will be available, + +``` +root@linuxtechi:~$ sudo ls /usr/share/lxc/templates/ +lxc-alpine lxc-centos lxc-fedora lxc-oci lxc-plamo lxc-sparclinux lxc-voidlinux +lxc-altlinux lxc-cirros lxc-fedora-legacy lxc-openmandriva lxc-pld lxc-sshd +lxc-archlinux lxc-debian lxc-gentoo lxc-opensuse lxc-sabayon lxc-ubuntu +lxc-busybox lxc-download lxc-local lxc-oracle lxc-slackware lxc-ubuntu-cloud +root@linuxtechi:~$ +``` + +Let’s Launch a container using template, + +Syntax: lxc-create -n <container_name> lxc -t <template_name> + +``` +root@linuxtechi:~$ sudo lxc-create -n shashi_lxc -t ubuntu +……………………… +invoke-rc.d: could not determine current runlevel +invoke-rc.d: policy-rc.d denied execution of start. +Current default time zone: 'Etc/UTC' +Local time is now: Fri Aug 2 11:46:42 UTC 2019. +Universal Time is now: Fri Aug 2 11:46:42 UTC 2019. + +## +# The default user is 'ubuntu' with password 'ubuntu'! +# Use the 'sudo' command to run tasks as root in the container. +## +……………………………………… +root@linuxtechi:~$ +``` + +Once the complete template is created, we can login into this console using the following steps + +``` +root@linuxtechi:~$ sudo lxc-start -n shashi_lxc -d +root@linuxtechi:~$ sudo lxc-console -n shashi_lxc + +Connected to tty 1 +Type to exit the console, to enter Ctrl+a itself + +Ubuntu 18.04.2 LTS shashi_lxc pts/0 + +shashi_lxc login: ubuntu +Password: +Last login: Fri Aug 2 12:00:35 UTC 2019 on pts/0 +Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-20-generic x86_64) +To run a command as administrator (user "root"), use "sudo ". +See "man sudo_root" for details. + +root@linuxtechi_lxc:~$ free -h + total used free shared buff/cache available +Mem: 3.9G 23M 3.8G 112K 8.7M 3.8G +Swap: 1.9G 780K 1.9G +root@linuxtechi_lxc:~$ grep -c processor /proc/cpuinfo +1 +root@linuxtechi_lxc:~$ df -h / +Filesystem Size Used Avail Use% Mounted on +/dev/sda1 40G 7.4G 31G 20% / +root@linuxtechi_lxc:~$ +``` + +Now logout or exit from the container and go back to host machine login window. With the lxc-ls command we can see that shashi-lxc container is created. + +``` +root@linuxtechi:~$ sudo lxc-ls +shashi_lxc +root@linuxtechi:~$ +``` + +“**lxc-ls -f**” command provides details with ip address of the container and the same is as below, + +``` +root@linuxtechi:~$ sudo lxc-ls -f +NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED +shashi_lxc RUNNING 0 - 10.0.3.190 - false +root@linuxtechi:~$ +``` + +“**lxc-info -n <container_name>**” command provides with all the required details along with State, ip address etc. + +``` +root@linuxtechi:~$ sudo lxc-info -n shashi_lxc +Name: shashi_lxc +State: RUNNING +PID: 6732 +IP: 10.0.3.190 +CPU use: 2.38 seconds +BlkIO use: 240.00 KiB +Memory use: 27.75 MiB +KMem use: 5.04 MiB +Link: vethQ7BVGU + TX bytes: 2.01 KiB + RX bytes: 9.52 KiB + Total bytes: 11.53 KiB +root@linuxtechi:~$ +``` + +**How to Start, Stop, Restart and Delete LXC containers** + +``` +$ lxc-start -n +$ lxc-stop -n +$ lxc-destroy -n +``` + +**LXC Cloning operation** + +Now the main cloning operation to be performed on the LXC container. The following steps are followed + +As described earlier LXC offers a feature of cloning a container from the existing container, by running the following command to clone an existing “shashi_lxc” container to a new container “shashi_lxc_clone”. + +**Note:** We have to make sure that before starting the cloning operation, first we have to stop the existing container using the “**lxc-stop**” command. + +``` +root@linuxtechi:~$ sudo lxc-stop -n shashi_lxc +root@linuxtechi:~$ sudo lxc-copy -n shashi_lxc -N shashi_lxc_clone +root@linuxtechi:~$ sudo lxc-ls +shashi_lxc shashi_lxc_clone +root@linuxtechi:~$ +``` + +Now start the cloned container + +``` +root@linuxtechi:~$ sudo lxc-start -n shashi_lxc_clone +root@linuxtechi:~$ sudo lxc-ls -f +NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED +shashi_lxc STOPPED 0 - - - false +shashi_lxc_clone RUNNING 0 - 10.0.3.201 - false +root@linuxtechi:~$ +``` + +With the above set of commands, cloning operation is done and the new clone “shashi_lxc_clone” got created. We can login into this lxc container console with below steps, + +``` +root@linuxtechi:~$ sudo lxc-console -n shashi_lxc_clone + +Connected to tty 1 +Type to exit the console, to enter Ctrl+a itself +Ubuntu 18.04.2 LTS shashi_lxc pts/0 + +shashi_lxc login: +``` + +**LXC Network configuration and commands** + +We can attach to the newly created container, but to remotely login into this container using SSH or any other means, we have to do some minimal configuration changes as explained below, + +``` +root@linuxtechi:~$ sudo lxc-attach -n shashi_lxc_clone +root@linuxtechi_lxc:/# +root@linuxtechi_lxc:/# useradd -m shashi +root@linuxtechi_lxc:/# passwd shashi +Enter new UNIX password: +Retype new UNIX password: +passwd: password updated successfully +root@linuxtechi_lxc:/# +``` + +First install the ssh server using the following command so that smooth “ssh” connect can be established. + +``` +root@linuxtechi_lxc:/# apt install openssh-server -y +``` + +Now get the IP address of the existing lxc container using the following command, + +``` +root@linuxtechi_lxc:/# ip addr show eth0|grep inet + inet 10.0.3.201/24 brd 10.0.3.255 scope global dynamic eth0 + inet6 fe80::216:3eff:fe82:e251/64 scope link +root@linuxtechi_lxc:/# +``` + +From the host machine with a new console window, use the following command to connect to this container over ssh + +``` +root@linuxtechi:~$ ssh 10.0.3.201 +root@linuxtechi's password: +$ +``` + +Now, we have logged in a container using ssh session. + +**LXC process related commands** + +``` +root@linuxtechi:~$ ps aux|grep lxc|grep -v grep +``` + +![lxc-process-ubuntu-system][1] + +**LXC snapshot operation** + +Snapshotting is one of the main operations which will help in taking point in time snapshot of the lxc container images. These same snapshot images can be used later for further use. + +``` +root@linuxtechi:~$ sudo lxc-stop -n shashi_lxc +root@linuxtechi:~$ sudo lxc-snapshot -n shashi_lxc +root@linuxtechi:~$ +``` + +The snapshot path can be located using the following command. + +``` +root@linuxtechi:~$ sudo lxc-snapshot -L -n shashi_lxc +snap0 (/var/lib/lxc/shashi_lxc/snaps) 2019:08:02 20:28:49 +root@linuxtechi:~$ +``` + +**Conclusion:** + +LXC, LinuX containers is one of the early container technologies. Understanding the concepts and learning about LXC will help in deeper understanding of any other containers like Docker Containers. This article has provided deeper insights on Cgroup and Namespaces which are also very much required concepts for better understanding of Containers and like. Many of the LXC operations like cloning, snapshotting, network operation etc are covered with command line examples. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/ + +作者:[Shashidhar Soppin][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.linuxtechi.com/author/shashidhar/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Learn-LXD-LXC-Containers.jpg diff --git a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md deleted file mode 100644 index 8b9677ba83..0000000000 --- a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md +++ /dev/null @@ -1,267 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) -[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Install and Configure PostgreSQL on Ubuntu -====== - -_**In this tutorial, you’ll learn how to install and use the open source database PostgreSQL on Ubuntu Linux.**_ - -[PostgreSQL][1] (or Postgres) is a powerful, free and open-source relational database management system ([RDBMS][2]) that has a strong reputation for reliability, feature robustness, and performance. It is designed to handle various tasks, of any size. It is cross-platform, and the default database for [macOS Server][3]. - -PostgreSQL might just be the right tool for you if you’re a fan of a simple to use SQL database manager. It supports SQL standards and offers additional features, while also being heavily extendable by the user as the user can add data types, functions, and do many more things. - -Earlier I discussed [installing MySQL on Ubuntu][4]. In this article, I’ll show you how to install and configure PostgreSQL, so that you are ready to use it to suit whatever your needs may be. - -![][5] - -### Installing PostgreSQL on Ubuntu - -PostgreSQL is available in Ubuntu main repository. However, like many other development tools, it may not be the latest version. - -First check the PostgreSQL version available in [Ubuntu repositories][6] using this [apt command][7] in the terminal: - -``` -apt show postgresql -``` - -In my Ubuntu 18.04, it showed that the available version of PostgreSQL is version 10 (10+190 means version 10) whereas PostgreSQL version 11 is already released. - -``` -Package: postgresql -Version: 10+190 -Priority: optional -Section: database -Source: postgresql-common (190) -Origin: Ubuntu -``` - -Based on this information, you can make your mind whether you want to install the version available from Ubuntu or you want to get the latest released version of PostgreSQL. - -I’ll show both methods to you. - -#### Method 1: Install PostgreSQL from Ubuntu repositories - -In the terminal, use the following command to install PostgreSQL - -``` -sudo apt update -sudo apt install postgresql postgresql-contrib -``` - -Enter your password when asked and you should have it installed in a few seconds/minutes depending on your internet speed. Speaking of that, feel free to check various [network bandwidth in Ubuntu][8]. - -What is postgresql-contrib? - -The postgresql-contrib or the contrib package consists some additional utilities and functionalities that are not part of the core PostgreSQL package. In most cases, it’s good to have the contrib package installed along with the PostgreSQL core. - -[][9] - -Suggested read  Fix gvfsd-smb-browse Taking 100% CPU In Ubuntu 16.04 - -#### Method 2: Installing the latest version 11 of PostgreSQL in Ubuntu - -To install PostgreSQL 11, you need to add the official PostgreSQL repository in your sources.list, add its certificate and then install it from there. - -Don’t worry, it’s not complicated. Just follow these steps. - -Add the GPG key first: - -``` -wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - -``` - -Now add the repository with the below command. If you are using Linux Mint, you’ll have to manually replace the `lsb_release -cs` the Ubuntu version your Mint release is based on. - -``` -sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' -``` - -Everything is ready now. Install PostgreSQL with the following commands: - -``` -sudo apt update -sudo apt install postgresql postgresql-contrib -``` - -PostgreSQL GUI application - -You may also install a GUI application (pgAdmin) for managing PostgreSQL databases: - -_sudo apt install pgadmin4_ - -### Configuring PostgreSQL - -You can check if **PostgreSQL** is running by executing: - -``` -service postgresql status -``` - -Via the **service** command you can also **start**, **stop** or **restart** **postgresql**. Typing in **service postgresql** and pressing **Enter** should output all options. Now, onto the users. - -By default, PostgreSQL creates a special user postgres that has all rights. To actually use PostgreSQL, you must first log in to that account: - -``` -sudo su postgres -``` - -Your prompt should change to something similar to: - -``` -[email protected]:/home/ubuntu$ -``` - -Now, run the **PostgreSQL Shell** with the utility **psql**: - -``` -psql -``` - -You should be prompted with: - -``` -postgress=# -``` - -You can type in **\q** to **quit** and **\?** for **help**. - -To see all existing tables, enter: - -``` -\l -``` - -The output will look similar to this (Hit the key **q** to exit this view): - -![PostgreSQL Tables][10] - -With **\du** you can display the **PostgreSQL users**: - -![PostgreSQLUsers][11] - -You can change the password of any user (including **postgres**) with: - -``` -ALTER USER postgres WITH PASSWORD 'my_password'; -``` - -**Note:** _Replace **postgres** with the name of the user and **my_password** with the wanted password._ Also, don’t forget the **;** (**semicolumn**) after every statement. - -It is recommended that you create another user (it is bad practice to use the default **postgres** user). To do so, use the command: - -``` -CREATE USER my_user WITH PASSWORD 'my_password'; -``` - -If you run **\du**, you will see, however, that **my_user** has no attributes yet. Let’s add **Superuser** to it: - -``` -ALTER USER my_user WITH SUPERUSER; -``` - -You can **remove users** with: - -``` -DROP USER my_user; -``` - -To **log in** as another user, quit the prompt (**\q**) and then use the command: - -``` -psql -U my_user -``` - -You can connect directly to a database with the **-d** flag: - -``` -psql -U my_user -d my_db -``` - -You should call the PostgreSQL user the same as another existing user. For example, my use is **ubuntu**. To log in, from the terminal I use: - -``` -psql -U ubuntu -d postgres -``` - -**Note:** _You must specify a database (by default it will try connecting you to the database named the same as the user you are logged in as)._ - -If you have a the error: - -``` -psql: FATAL: Peer authentication failed for user "my_user" -``` - -Make sure you are logging as the correct user and edit **/etc/postgresql/11/main/pg_hba.conf** with administrator rights: - -``` -sudo vim /etc/postgresql/11/main/pg_hba.conf -``` - -**Note:** _Replace **11** with your version (e.g. **10**)._ - -Here, replace the line: - -``` -local all postgres peer -``` - -With: - -``` -local all postgres md5 -``` - -Then restart **PostgreSQL**: - -``` -sudo service postgresql restart -``` - -Using **PostgreSQL** is the same as using any other **SQL** type database. I won’t go into the specific commands, since this article is about getting you started with a working setup. However, here is a [very useful gist][12] to reference! Also, the man page (**man psql**) and the [documentation][13] are very helpful. - -[][14] - -Suggested read  [How To] Share And Sync Any Folder With Dropbox in Ubuntu - -**Wrapping Up** - -Reading this article has hopefully guided you through the process of installing and preparing PostgreSQL on an Ubuntu system. If you are new to SQL, you should read this article to know the [basic SQL commands][15]: - -[Basic SQL Commands][15] - -If you have any issues or questions, please feel free to ask in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-postgresql-ubuntu/ - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://www.postgresql.org/ -[2]: https://www.codecademy.com/articles/what-is-rdbms-sql -[3]: https://www.apple.com/in/macos/server/ -[4]: https://itsfoss.com/install-mysql-ubuntu/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1 -[6]: https://itsfoss.com/ubuntu-repositories/ -[7]: https://itsfoss.com/apt-command-guide/ -[8]: https://itsfoss.com/network-speed-monitor-linux/ -[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1 -[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546 -[13]: https://www.postgresql.org/docs/manuals/ -[14]: https://itsfoss.com/sync-any-folder-with-dropbox/ -[15]: https://itsfoss.com/basic-sql-commands/ diff --git a/sources/tech/20190809 Mutation testing is the evolution of TDD.md b/sources/tech/20190809 Mutation testing is the evolution of TDD.md deleted file mode 100644 index 766d2a4285..0000000000 --- a/sources/tech/20190809 Mutation testing is the evolution of TDD.md +++ /dev/null @@ -1,285 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Mutation testing is the evolution of TDD) -[#]: via: (https://opensource.com/article/19/8/mutation-testing-evolution-tdd) -[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) - -Mutation testing is the evolution of TDD -====== -Since test-driven development is modeled on how nature works, mutation -testing is the natural next step in the evolution of DevOps. -![Ants and a leaf making the word "open"][1] - -In "[Failure is a feature in blameless DevOps][2]," I discussed the central role of failure in delivering quality by soliciting feedback. This is the failure agile DevOps teams rely on to guide them and drive development. [Test-driven development (TDD)][3] is the _[conditio sine qua non][4]_ of any agile DevOps value stream delivery. Failure-centric TDD methodology only works if it is paired with measurable tests. - -TDD methodology is modeled on how nature works and how nature produces winners and losers in the evolutionary game. - -### Natural selection - -![Charles Darwin][5] - -In 1859, [Charles Darwin][6] proposed the theory of evolution in his book _[On the Origin of Species][7]_. Darwin's thesis was that natural variability is caused by the combination of spontaneous mutations in individual organisms and environmental pressures. These pressures eliminate less-adapted organisms while favoring other, more fit organisms. Each and every living being mutates its chromosomes, and those spontaneous mutations are carried to the next generation (the offspring). The newly emerged variability is then tested under natural selection—the environmental pressures that exist due to the variability of environmental conditions. - -This simplified diagram illustrates the process of adjusting to environmental conditions. - -![Environmental pressures on fish][8] - -Fig. 1. Different environmental pressures result in different outcomes governed by natural selection. Image screenshot from a [video by Richard Dawkins][9]. - -This illustration shows a school of fish in their natural habitat. The habitat varies (darker or lighter gravel at the bottom of the sea or riverbed), as does each fish (darker or lighter body patterns and colors). - -It also shows two situations (i.e., two variations of the environmental pressure): - - 1. The predator is present - 2. The predator is absent - - - -In the first situation, fish that are easier to spot against the gravel shade are at higher risk of being picked off by predators. When the gravel is darker, the lighter portion of the fish population is thinned out. And vice versa—when the gravel is a lighter shade, the darker portion of the fish population suffers the thinning out scenario. - -In the second situation, fish are sufficiently relaxed to engage in mating. In the absence of predators and in the presence of the mating ritual, the opposite results can be expected: The fish that stand out against the background have a better chance of being picked for mating and transferring their characteristics to offspring. - -### Selection criteria - -When selecting among variability, the process is never arbitrary, capricious, whimsical, nor random. The decisive factor is always measurable. That decisive factor is usually called a _test_ or a _goal_. - -A simple mathematical example can illustrate this process of decision making. (Only in this case it won't be governed by natural selection, but by artificial selection.) Suppose someone asks you to build a little function that will take a positive number and calculate that number's square root. How would you go about doing that? - -The agile DevOps way is to _fail fast_. Start with humility, admitting upfront that you don't really know how to develop that function. All you know, at this point, is how to _describe_ what you'd like to do. In technical parlance, you are ready to engage in crafting a _unit test_. - -"Unit test" describes your specific expectation. It could simply be formulated as "given the number 16, I expect the square root function to return number 4." You probably know that the square root of 16 is 4. However, you don't know the square root for some larger numbers (such as 533). - -At the very least, you have formulated your selection criteria, your test or goal. - -### Implement the failing test - -The [.NET Core][10] platform can illustrate the implementation. .NET typically uses [xUnit.net][11] as a unit-testing framework. (To follow the coding examples, please install .NET Core and xUnit.net.) - -Open the command line and create a folder where your square root solution will be implemented. For example, type: - - -``` -`mkdir square_root` -``` - -Then type: - - -``` -`cd square_root` -``` - -Create a separate folder for unit tests: - - -``` -`mkdir unit_tests` -``` - -Move into the **unit_tests** folder (**cd unit_tests**) and initiate the xUnit framework: - - -``` -`dotnet new xunit` -``` - -Now, move one folder up to the **square_root** folder, and create the **app** folder: - - -``` -mkdir app -cd app -``` - -Create the scaffold necessary for the C# code: - - -``` -`dotnet new classlib` -``` - -Now open your favorite editor and start cracking! - -In your code editor, navigate to the **unit_tests** folder and open **UnitTest1.cs**. - -Replace auto-generated code in **UnitTest1.cs** with: - - -``` -using System; -using Xunit; -using app; - -namespace unit_tests{ - -   public class UnitTest1{ -       Calculator calculator = new Calculator(); - -       [Fact] -       public void GivenPositiveNumberCalculateSquareRoot(){ -           var expected = 4; -           var actual = calculator.CalculateSquareRoot(16); -           Assert.Equal(expected, actual); -       } -   } -} -``` - -This unit test describes the expectation that the variable **expected** should be 4. The next line describes the **actual** value. It proposes to calculate the **actual** value by sending a message to the component called **calculator**. This component is described as capable of handling the **CalculateSquareRoot** message by accepting a numeric value. That component hasn't been developed yet. But it doesn't really matter, because this merely describes the expectations. - -Finally, it describes what happens when the message is triggered to be sent. At that point, it asserts whether the **expected** value is equal to the **actual** value. If it is, the test passed and the goal is reached. If the **expected** value isn't equal to the **actual value**, the test fails. - -Next, to implement the component called **calculator**, create a new file in the **app** folder and call it **Calculator.cs**. To implement a function that calculates the square root of a number, add the following code to this new file: - - -``` -namespace app { -   public class Calculator { -       public double CalculateSquareRoot(double number) { -           double bestGuess = number; -           return bestGuess; -       } -   } -} -``` - -Before you can test this implementation, you need to instruct the unit test how to find this new component (**Calculator**). Navigate to the **unit_tests** folder and open the **unit_tests.csproj** file. Add the following line in the **<ItemGroup>** code block: - - -``` -`` -``` - -Save the **unit_test.csproj** file. Now you are ready for your first test run. - -Go to the command line and **cd** into the **unit_tests** folder. Run the following command: - - -``` -`dotnet test` -``` - -Running the unit test will produce the following output: - -![xUnit output after the unit test run fails][12] - -Fig. 2. xUnit output after the unit test run fails. - -As you can see, the unit test failed. It expected that sending number 16 to the **calculator** component would result in the number 4 as the output, but the output (the **actual** value) was the number 16. - -Congratulations! You have created your first failure. Your unit test provided strong, immediate feedback urging you to fix the failure. - -### Fix the failure - -To fix the failure, you must improve **bestGuess**. Right now, **bestGuess** merely takes the number the function receives and returns it. Not good enough. - -But how do you figure out a way to calculate the square root value? I have an idea—how about looking at how Mother Nature solves problems. - -### Emulate Mother Nature by iterating - -It is extremely hard (pretty much impossible) to guess the correct value from the first (and only) attempt. You must allow for several attempts at guessing to increase your chances of solving the problem. And one way to allow for multiple attempts is to _iterate_. - -To iterate, store the **bestGuess** value in the **previousGuess** variable, transform the **bestGuess** value, and compare the difference between the two values. If the difference is 0, you solved the problem. Otherwise, keep iterating. - -Here is the body of the function that produces the correct value for the square root of any positive number: - - -``` -double bestGuess = number; -double previousGuess; - -do { -   previousGuess = bestGuess; -   bestGuess = (previousGuess + (number/previousGuess))/2; -} while((bestGuess - previousGuess) != 0); - -return bestGuess; -``` - -This loop (iteration) converges bestGuess values to the desired solution. Now your carefully crafted unit test passes! - -![Unit test successful][13] - -Fig. 3. Unit test successful, 0 tests failed. - -### The iteration solves the problem - -Just like Mother Nature's approach, in this exercise, iteration solves the problem. An incremental approach combined with stepwise refinement is the guaranteed way to arrive at a satisfactory solution. The decisive factor in this game is having a measurable goal and test. Once you have that, you can keep iterating until you hit the mark. - -### Now the punchline! - -OK, this was an amusing experiment, but the more interesting discovery comes from playing with this newly minted solution. Until now, your starting **bestGuess** was always equal to the number the function receives as the input parameter. What happens if you change the initial **bestGuess**? - -To test that, you can run a few scenarios. First, observe the stepwise refinement as the iteration loops through a series of guesses as it tries to calculate the square root of 25: - -![Code iterating for the square root of 25][14] - -Fig. 4. Iterating to calculate the square root of 25. - -Starting with 25 as the **bestGuess**, it takes eight iterations for the function to calculate the square root of 25. But what would happen if you made a comical, ridiculously wrong stab at the **bestGuess**? What if you started with a clueless second guess, that 1 million might be the square root of 25? What would happen in such an obviously erroneous situation? Would your function be able to deal with such idiocy? - -Take a look at the horse's mouth. Rerun the scenario, this time starting from 1 million as the **bestGuess**: - -![Stepwise refinement][15] - -Fig. 5. Stepwise refinement when calculating the square root of 25 by starting with 1 million as the initial **bestGuess**. - -Oh wow! Starting with a ludicrously large number, the number of iterations only tripled (from eight iterations to 23). Not nearly as dramatic an increase as you might intuitively expect. - -### The moral of the story - -The _Aha!_ moment arrives when you realize that, not only is iteration guaranteed to solve the problem, but it doesn't matter whether your search for the solution begins with a good or a terribly botched initial guess. However erroneous your initial understanding, the process of iteration, coupled with a measurable test/goal, puts you on the right track and delivers the solution. Guaranteed. - -Figures 4 and 5 show a steep and dramatic burndown. From a wildly incorrect starting point, the iteration quickly burns down to an absolutely correct solution. - -This amazing methodology, in a nutshell, is the essence of agile DevOps. - -### Back to some high-level observations - -Agile DevOps practice stems from the recognition that we live in a world that is fundamentally based on uncertainty, ambiguity, incompleteness, and a healthy dose of confusion. From the scientific/philosophical point of view, these traits are well documented and supported by [Heisenberg's Uncertainty Principle][16] (covering the uncertainty part), [Wittgenstein's Tractatus Logico-Philosophicus][17] (the ambiguity part), [Gödel's incompleteness theorems][18] (the incompleteness aspect), and the [Second Law of Thermodynamics][19] (the confusion caused by relentless entropy). - -In a nutshell, no matter how hard you try, you can never get complete information when trying to solve any problem. It is, therefore, more profitable to abandon an arrogant stance and adopt a more humble approach to solving problems. Humility pays big dividends in rewarding you—not only with the hoped-for solution but also with the byproduct of a well-structured solution. - -### Conclusion - -Nature works incessantly—it's a continuous flow. Nature has no master plan; everything happens as a response to what happened earlier. The feedback loops are very tight, and apparent progress/regress is piecemeal. Everywhere you look in nature, you see stepwise refinement, in one shape or form or another. - -Agile DevOps is a very interesting outcome of the engineering model's gradual maturation. DevOps is based on the recognition that the information you have available is always incomplete, so you'd better proceed cautiously. Obtain a measurable test (e.g., a hypothesis, a measurable expectation), make a humble attempt at satisfying it, most likely fail, then collect the feedback, fix the failure, and continue. There is no plan other than agreeing that, with each step of the way, there must be a measurable hypothesis/test. - -In the next article in this series, I'll take a closer look at how mutation testing provides much-needed feedback that drives value. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/mutation-testing-evolution-tdd - -作者:[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/osdc_520X292_openanttrail-2.png?itok=xhD3WmUd (Ants and a leaf making the word "open") -[2]: https://opensource.com/article/19/7/failure-feature-blameless-devops -[3]: https://en.wikipedia.org/wiki/Test-driven_development -[4]: https://www.merriam-webster.com/dictionary/conditio%20sine%20qua%20non -[5]: https://opensource.com/sites/default/files/uploads/darwin.png (Charles Darwin) -[6]: https://en.wikipedia.org/wiki/Charles_Darwin -[7]: https://en.wikipedia.org/wiki/On_the_Origin_of_Species -[8]: https://opensource.com/sites/default/files/uploads/environmentalconditions2.png (Environmental pressures on fish) -[9]: https://www.youtube.com/watch?v=MgK5Rf7qFaU -[10]: https://dotnet.microsoft.com/ -[11]: https://xunit.net/ -[12]: https://opensource.com/sites/default/files/uploads/xunit-output.png (xUnit output after the unit test run fails) -[13]: https://opensource.com/sites/default/files/uploads/unit-test-success.png (Unit test successful) -[14]: https://opensource.com/sites/default/files/uploads/iterating-square-root.png (Code iterating for the square root of 25) -[15]: https://opensource.com/sites/default/files/uploads/bestguess.png (Stepwise refinement) -[16]: https://en.wikipedia.org/wiki/Uncertainty_principle -[17]: https://en.wikipedia.org/wiki/Tractatus_Logico-Philosophicus -[18]: https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems -[19]: https://en.wikipedia.org/wiki/Second_law_of_thermodynamics diff --git a/sources/tech/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md b/sources/tech/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md deleted file mode 100644 index cd5e3dac06..0000000000 --- a/sources/tech/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md +++ /dev/null @@ -1,245 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina)?) -[#]: via: (https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/) -[#]: author: (2daygeek http://www.2daygeek.com/author/2daygeek/) - -How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina)? -====== - -Linux Mint 19.2 “Tina” was released on Aug 02nd 2019, it is a long term support release, which is based on Ubuntu 18.04 LTS (Bionic Beaver). - -It will be supported until 2023. It comes with updated software and brings refinements and many new features to make your desktop even more comfortable to use. - -Linux Mint 19.2 features with Cinnamon 4.2, Linux kernel 4.15, and Ubuntu 18.04 package base. - -**`Note:`**` ` Don’t forget to take backup of your important data. If something goes wrong you can restore the data from the backup after fresh installation. - -Backup can be done either rsnapshot or timeshift. - -Linux Mint 19.2 “Tina” Release notes can be found in the following link. - - * **[Linux Mint 19.2 (Tina) Release Notes][1]** - - - -There are three ways that we can upgrade to Linux Mint 19.2 “Tina”. - - * Upgrade Linux Mint 19.2 (Tina) Using Native Method - * Upgrade Linux Mint 19.2 (Tina) Using Mintupgrade Utility - * Upgrade Linux Mint 19.2 (Tina) Using GUI - - - -### How to Perform The Upgrade from Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina)? - -Upgrading the Linux Mint system is an easy and painless task. It can be done three ways. - -### Method-1: Upgrade Linux Mint 19.2 (Tina) Using Native Method - -This is one of the native and standard method to perform the upgrade for Linux Mint system. - -To do so, follow the below procedures. - -Make sure that your current Linux Mint system is up-to-date. - -Update your existing software to latest available version using the following commands. - -### Step-1: - -Refresh the repositories index by running the following command. - -``` -$ sudo apt update -``` - -Run the following command to install the available updates on system. - -``` -$ sudo apt upgrade -``` - -Run the following command to perform the available minor upgrade with in version. - -``` -$ sudo apt full-upgrade -``` - -By default, it will remove obsolete packages by running the above command. However, i advise you to run the below commands. - -``` -$ sudo apt autoremove - -$ sudo apt clean -``` - -You may need to reboot the system, if a new kernel is installed. If so, run the following command. - -``` -$ sudo shutdown -r now -``` - -Finally check the currently installed version. - -``` -$ lsb_release -a - -No LSB modules are available. -Distributor ID: Linux Mint -Description: Linux Mint 19.1 (Tessa) -Release: 19.1 -Codename: Tessa -``` - -### Step-2: Update/Modify the /etc/apt/sources.list file - -After reboot, modify the sources.list file and point from Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina). - -First backup the below config files using the cp command. - -``` -$ sudo cp /etc/apt/sources.list /root -$ sudo cp -r /etc/apt/sources.list.d/ /root -``` - -Modify the “sources.list” file and point to Linux Mint 19.1 (Tina). - -``` -$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list -$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list.d/* -``` - -Refresh the repositories index by running the following command. - -``` -$ sudo apt update -``` - -Run the following command to install the available updates on system. During the upgrade you may need to confirm for service restart and config file replace so, just follow on-screen instructions. - -The upgrade may take some time depending on the number of updates and your Internet speed. - -``` -$ sudo apt upgrade -``` - -Run the following command to perform a complete upgrade of the system. - -``` -$ sudo apt full-upgrade -``` - -By default, the above command will remove obsolete packages. However, i advise you to run the below commands once again. - -``` -$ sudo apt autoremove - -$ sudo apt clean -``` - -Finally reboot the system to boot with Linux Mint 19.2 (Tina). - -``` -$ sudo shutdown -r now -``` - -The upgraded Linux Mint version can be verified by running the following command. - -``` -$ lsb_release -a - -No LSB modules are available. -Distributor ID: Linux Mint -Description: Linux Mint 19.2 (Tina) -Release: 19.2 -Codename: Tina -``` - -### Method-2: Upgrade Linux Mint 19.2 (Tina) Using Mintupgrade Utility - -This is Mint official utility that allow us to perform the smooth upgrade for Linux Mint system. - -Use the below command to install mintupgrade package. - -``` -$ sudo apt install mintupgrade -``` - -Make sure you have installed the latest version of mintupgrade package. - -``` -$ apt version mintupgrade -``` - -Run the below command as a normal user to simulate an upgrade and follow on-screen instructions. - -``` -$ mintupgrade check -``` - -Use the below command to download the packages necessary to upgrade to Linux Mint 19.2 (Tina) and follow on screen instructions. - -``` -$ mintupgrade download -``` - -Run the following command to apply the upgrades and follow on-screen instructions. - -``` -$ mintupgrade upgrade -``` - -Once upgrade done successfully, Reboot the system and check the upgraded version. - -``` -$ lsb_release -a - -No LSB modules are available. -Distributor ID: Linux Mint -Description: Linux Mint 19.2 (Tina) -Release: 19.2 -Codename: Tina -``` - -### Method-3: Upgrade Linux Mint 19.2 (Tina) Using GUI - -Alternatively, we can perform the upgrade through GUI. - -### Step-1: - -Create a system snapshot through Timeshift. If anything goes wrong, you can easily restore your operating system to its previous state. - -### Step-2: - -Open the Update Manager, click on the Refresh button to check for any new version of mintupdate and mint-upgrade-info. If there are updates for these packages, apply them. - -Launch the System Upgrade by clicking on “Edit->Upgrade to Linux Mint 19.2 Tina”. -[![][2]![][2]][3] - -Follow the instructions on the screen. If asked whether to keep or replace configuration files, choose to replace them. -[![][2]![][2]][4] - -### Step-3: - -Once the upgrade is finished, reboot your computer. - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/ - -作者:[2daygeek][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.2daygeek.com/author/2daygeek/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechnews.com/linux-mint-19-2-tina-released-check-what-is-new-feature/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade.png -[4]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade-1.png diff --git a/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md b/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md deleted file mode 100644 index cbc42dbbbd..0000000000 --- a/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cloud-native Java, open source security, and more industry trends) -[#]: via: (https://opensource.com/article/19/8/cloud-native-java-and-more) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Cloud-native Java, open source security, 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. - -## [Why is modern web development so complicated?][2] - -> Modern frontend web development is a polarizing experience: many love it, others despise it. -> -> I am a huge fan of modern web development, though I would describe it as "magical"—and magic has its upsides and downsides... Recently I’ve been needing to explain “modern web development workflows” to folks who only have a cursory of vanilla web development workflows and… It is a LOT to explain! Even a hasty explanation ends up being pretty long. So in the effort of writing more of my explanations down, here is the beginning of a long yet hasty explanation of the evolution of web development.. - -**The impact:** Specific enough to be useful to (especially new) frontend developers, but simple and well explained enough to help non-developers understand better some of the frontend developer problems. By the end, you'll (kinda) know the difference between Javascript and WebAPIs and how 2019 Javascript is different than 2006 Javascript. - -## [Open sourcing the Kubernetes security audit][3] - -> Last year, the Cloud Native Computing Foundation (CNCF) began the process of performing and open sourcing third-party security audits for its projects in order to improve the overall security of our ecosystem. The idea was to start with a handful of projects and gather feedback from the CNCF community as to whether or not this pilot program was useful. The first projects to undergo this process were [CoreDNS][4], [Envoy][5] and [Prometheus][6]. These first public audits identified security issues from general weaknesses to critical vulnerabilities. With these results, project maintainers for CoreDNS, Envoy and Prometheus have been able to address the identified vulnerabilities and add documentation to help users. -> -> The main takeaway from these initial audits is that a public security audit is a great way to test the quality of an open source project along with its vulnerability management process and more importantly, how resilient the open source project’s security practices are. With CNCF [graduated projects][7] especially, which are used widely in production by some of the largest companies in the world, it is imperative that they adhere to the highest levels of security best practices. - -**The impact:** A lot of companies are placing big bets on Kubernetes being to the cloud what Linux is to that data center. Seeing 4 of those companies working together to make sure the project is doing what it should be from a security perspective inspires confidence. Sharing that research shows that open source is so much more than code in a repository; it is the capturing and sharing of expert opinions in a way that benefits the community at large rather than the interests of a few. - -## [Quarkus—what's next for the lightweight Java framework?][8] - -> What does “container first” mean? What are the strengths of Quarkus? What’s new in 0.20.0? What features can we look forward to in the future? When will version 1.0.0 be released? We have so many questions about Quarkus and Alex Soto was kind enough to answer them all. _With the release of Quarkus 0.20.0, we decided to get in touch with [JAX London speaker][9], Java Champion, and Director of Developer Experience at Red Hat – Alex Soto. He was kind enough to answer all our questions about the past, present, and future of Quarkus. It seems like we have a lot to look forward to with this exciting lightweight framework!_ - -**The impact**: Someone clever recently told me that Quarkus has the potential to make Java "possibly one of the best languages for containers and serverless environments". That made me do a double-take; while Java is one of the most popular programming languages ([if not the most popular][10]) it probably isn't the first one that jumps to mind when you hear the words "cloud native." Quarkus could extend and grow the value of the skills held by a huge chunk of the developer workforce by allowing them to apply their experience to new challenges. - -## [Julia programming language: Users reveal what they love and hate the most about it][11] - -> The most popular technical feature of Julia is speed and performance followed by ease of use, while the most popular non-technical feature is that users don't have to pay to use it.  -> -> Users also report their biggest gripes with the language. The top one is that packages for add-on features aren't sufficiently mature or well maintained to meet their needs.  - -**The impact:** The Julia 1.0 release has been out for a year now, and has seen impressive growth in a bunch of relevant metrics (downloads, GitHub stars, etc). It is a language aimed squarely at some of our biggest current and future challenges ("scientific computing, machine learning, data mining, large-scale linear algebra, distributed and parallel computing") so finding out how it's users are feeling about it gives an indirect read on how well those challenges are being addressed. - -## [Multi-cloud by the numbers: 11 interesting stats][12] - -> If you boil our recent dive into [interesting stats about Kubernetes][13] down to its bottom line, it looks something like this: [Kubernetes'][14] popularity will continue for the foreseeable future. -> -> Spoiler alert: When you dig up recent numbers about [multi-cloud][15] usage, they tell a similar story: Adoption is soaring. -> -> This congruity makes sense. Perhaps not every organization will use Kubernetes to manage its multi-cloud and/or [hybrid cloud][16] infrastructure, but the two increasingly go hand-in-hand. Even when they don’t, they both reflect a general shift toward more distributed and heterogeneous IT environments, as well as [cloud-native development][17] and other overlapping trends. - -**The impact**: Another explanation of increasing adoption of "multi-cloud strategies" is they retroactively legitimize decisions taken in separate parts of an organization without consultation as "strategic." "Wait, so you bought hours from who? And you bought hours from the other one? Why wasn't that in the meeting minutes? I guess we're a multi-cloud company now!" Of course I'm joking, I'm sure most big companies are a lot better coordinated than that, right? - -_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/19/8/cloud-native-java-and-more - -作者:[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.vrk.dev/2019/07/11/why-is-modern-web-development-so-complicated-a-long-yet-hasty-explanation-part-1/ -[3]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ -[4]: https://coredns.io/2018/03/15/cure53-security-assessment/ -[5]: https://github.com/envoyproxy/envoy/blob/master/docs/SECURITY_AUDIT.pdf -[6]: https://cure53.de/pentest-report_prometheus.pdf -[7]: https://www.cncf.io/projects/ -[8]: https://jaxenter.com/quarkus-whats-next-for-the-lightweight-java-framework-160793.html -[9]: https://jaxlondon.com/cloud-kubernetes-serverless/java-particle-acceleration-using-quarkus/ -[10]: https://opensource.com/article/19/8/possibly%20one%20of%20the%20best%20languages%20for%20containers%20and%20serverless%20environments. -[11]: https://www.zdnet.com/article/julia-programming-language-users-reveal-what-they-love-and-hate-the-most-about-it/#ftag=RSSbaffb68 -[12]: https://enterprisersproject.com/article/2019/8/multi-cloud-statistics -[13]: https://enterprisersproject.com/article/2019/7/kubernetes-statistics-13-compelling -[14]: https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA -[15]: https://www.redhat.com/en/topics/cloud-computing/what-is-multicloud?intcmp=701f2000000tjyaAAA -[16]: https://enterprisersproject.com/hybrid-cloud -[17]: https://enterprisersproject.com/article/2018/10/how-explain-cloud-native-apps-plain-english diff --git a/sources/tech/20190812 How Hexdump works.md b/sources/tech/20190812 How Hexdump works.md deleted file mode 100644 index 25907fe05f..0000000000 --- a/sources/tech/20190812 How Hexdump works.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (0x996) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How Hexdump works) -[#]: via: (https://opensource.com/article/19/8/dig-binary-files-hexdump) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/shishz) - -How Hexdump works -====== -Hexdump helps you investigate the contents of binary files. Learn how -hexdump works. -![Magnifying glass on code][1] - -Hexdump is a utility that displays the contents of binary files in hexadecimal, decimal, octal, or ASCII. It’s a utility for inspection and can be used for [data recovery][2], reverse engineering, and programming. - -### Learning the basics - -Hexdump provides output with very little effort on your part and depending on the size of the file you’re looking at, there can be a lot of output. For the purpose of this article, create a 1x1 PNG file. You can do this with a graphics application such as [GIMP][3] or [Mtpaint][4], or you can create it in a terminal with [ImageMagick][5]. - -Here’s a command to generate a 1x1 pixel PNG with ImageMagick: - - -``` -$ convert -size 1x1 canvas:black pixel.png -``` - -You can confirm that this file is a PNG with the **file** command: - - -``` -$ file pixel.png -pixel.png: PNG image data, 1 x 1, 1-bit grayscale, non-interlaced -``` - -You may wonder how the **file** command is able to determine what kind of file it is. Coincidentally, that’s what **hexdump** will reveal. For now, you can view your one-pixel graphic in the image viewer of your choice (it looks like this: **.** ), or you can view what’s inside the file with **hexdump**: - - -``` -$ hexdump pixel.png -0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244 -0000010 0000 0100 0000 0100 0001 0000 3700 f96e -0000020 0024 0000 6704 4d41 0041 b100 0b8f 61fc -0000030 0005 0000 6320 5248 004d 7a00 0026 8000 -0000040 0084 fa00 0000 8000 00e8 7500 0030 ea00 -0000050 0060 3a00 0098 1700 9c70 51ba 003c 0000 -0000060 6202 474b 0044 dd01 138a 00a4 0000 7407 -0000070 4d49 0745 07e3 081a 3539 a487 46b0 0000 -0000080 0a00 4449 5441 d708 6063 0000 0200 0100 -0000090 21e2 33bc 0000 2500 4574 7458 6164 6574 -00000a0 633a 6572 7461 0065 3032 3931 302d 2d37 -00000b0 3532 3254 3a30 3735 353a 2b33 3231 303a -00000c0 ac30 5dcd 00c1 0000 7425 5845 6474 7461 -00000d0 3a65 6f6d 6964 7966 3200 3130 2d39 3730 -00000e0 322d 5435 3032 353a 3a37 3335 312b 3a32 -00000f0 3030 90dd 7de5 0000 0000 4549 444e 42ae -0000100 8260 -0000102 -``` - -What you’re seeing is the contents of the sample PNG file through a lens you may have never used before. It’s the exact same data you see in an image viewer, encoded in a way that’s probably unfamiliar to you. - -### Extracting familiar strings - -Just because the default data dump seems meaningless, that doesn’t mean it’s devoid of valuable information. You can translate this output or at least the parts that actually translate, to a more familiar character set with the **\--canonical** option: - - -``` -$ hexdump --canonical foo.png -00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR| -00000010  00 00 00 01 00 00 00 01  01 00 00 00 00 37 6e f9  |.............7n.| -00000020  24 00 00 00 04 67 41 4d  41 00 00 b1 8f 0b fc 61  |$....gAMA......a| -00000030  05 00 00 00 20 63 48 52  4d 00 00 7a 26 00 00 80  |.... cHRM..z&...| -00000040  84 00 00 fa 00 00 00 80  e8 00 00 75 30 00 00 ea  |...........u0...| -00000050  60 00 00 3a 98 00 00 17  70 9c ba 51 3c 00 00 00  |`..:....p..Q<...| -00000060  02 62 4b 47 44 00 01 dd  8a 13 a4 00 00 00 07 74  |.bKGD..........t| -00000070  49 4d 45 07 e3 07 1a 08  39 35 87 a4 b0 46 00 00  |IME.....95...F..| -00000080  00 0a 49 44 41 54 08 d7  63 60 00 00 00 02 00 01  |..IDAT..c`......| -00000090  e2 21 bc 33 00 00 00 25  74 45 58 74 64 61 74 65  |.!.3...%tEXtdate| -000000a0  3a 63 72 65 61 74 65 00  32 30 31 39 2d 30 37 2d  |:create.2019-07-| -000000b0  32 35 54 32 30 3a 35 37  3a 35 33 2b 31 32 3a 30  |25T20:57:53+12:0| -000000c0  30 ac cd 5d c1 00 00 00  25 74 45 58 74 64 61 74  |0..]....%tEXtdat| -000000d0  65 3a 6d 6f 64 69 66 79  00 32 30 31 39 2d 30 37  |e:modify.2019-07| -000000e0  2d 32 35 54 32 30 3a 35  37 3a 35 33 2b 31 32 3a  |-25T20:57:53+12:| -000000f0  30 30 dd 90 e5 7d 00 00  00 00 49 45 4e 44 ae 42  |00...}....IEND.B| -00000100  60 82                                             |`.| -00000102 -``` - -In the right column, you see the same data that’s on the left but presented as ASCII. If you look carefully, you can pick out some useful information, such as the file’s format (PNG) and—toward the bottom—the date and time the file was created and last modified. The dots represent symbols that aren’t present in the ASCII character set, which is to be expected because binary formats aren’t restricted to mundane letters and numbers. - -The **file** command knows from the first 8 bytes what this file is. The [libpng specification][6] alerts programmers what to look for. You can see that within the first 8 bytes of this image file, specifically, is the string **PNG**. That fact is significant because it reveals how the **file** command knows what kind of file to report. - -You can also control how many bytes **hexdump** displays, which is useful with files larger than one pixel: - - -``` -$ hexdump --length 8 pixel.png -0000000 5089 474e 0a0d 0a1a -0000008 -``` - -You don’t have to limit **hexdump** to PNG or graphic files. You can run **hexdump** against binaries you run on a daily basis as well, such as [ls][7], [rsync][8], or any binary format you want to inspect. - -### Implementing cat with hexdump - -If you read the PNG spec, you may notice that the data in the first 8 bytes looks different than what **hexdump** provides. Actually, it’s the same data, but it’s presented using a different conversion. So, the output of **hexdump** is true, but not always directly useful to you, depending on what you’re looking for. For that reason, **hexdump** has options to format and convert the raw data it dumps. - -The conversion options can get complex, so it’s useful to practice with something trivial first. Here’s a gentle introduction to formatting **hexdump** output by reimplementing the [**cat**][9] command. First, run **hexdump** on a text file to see its raw data. You can usually find a copy of the [GNU General Public License (GPL)][10] license somewhere on your hard drive, or you can use any text file you have handy. Your output may differ, but here’s how to find a copy of the GPL on your system (or at least part of it): - - -``` -$ find /usr/share/doc/ -type f -name "COPYING" | tail -1 -/usr/share/doc/libblkid-devel/COPYING -``` - -Run **hexdump** against it: - - -``` -$ hexdump /usr/share/doc/libblkid-devel/COPYING -0000000 6854 7369 6c20 6269 6172 7972 6920 2073 -0000010 7266 6565 7320 666f 7774 7261 3b65 7920 -0000020 756f 6320 6e61 7220 6465 7369 7274 6269 -0000030 7475 2065 7469 6120 646e 6f2f 0a72 6f6d -0000040 6964 7966 6920 2074 6e75 6564 2072 6874 -0000050 2065 6574 6d72 2073 666f 7420 6568 4720 -0000060 554e 4c20 7365 6573 2072 6547 656e 6172 -0000070 206c 7550 6c62 6369 4c0a 6369 6e65 6573 -0000080 6120 2073 7570 6c62 7369 6568 2064 7962 -[...] -``` - -If the file’s output is very long, use the **\--length** (or **-n** for short) to make it manageable for yourself. - -The raw data probably means nothing to you, but you already know how to convert it to ASCII: - - -``` -hexdump --canonical /usr/share/doc/libblkid-devel/COPYING -00000000  54 68 69 73 20 6c 69 62  72 61 72 79 20 69 73 20  |This library is | -00000010  66 72 65 65 20 73 6f 66  74 77 61 72 65 3b 20 79  |free software; y| -00000020  6f 75 20 63 61 6e 20 72  65 64 69 73 74 72 69 62  |ou can redistrib| -00000030  75 74 65 20 69 74 20 61  6e 64 2f 6f 72 0a 6d 6f  |ute it and/or.mo| -00000040  64 69 66 79 20 69 74 20  75 6e 64 65 72 20 74 68  |dify it under th| -00000050  65 20 74 65 72 6d 73 20  6f 66 20 74 68 65 20 47  |e terms of the G| -00000060  4e 55 20 4c 65 73 73 65  72 20 47 65 6e 65 72 61  |NU Lesser Genera| -00000070  6c 20 50 75 62 6c 69 63  0a 4c 69 63 65 6e 73 65  |l Public.License| -[...] -``` - -That output is helpful but unwieldy and difficult to read. To format **hexdump**’s output beyond what’s offered by its own options, use **\--format** (or **-e**) along with specialized formatting codes. The shorthand used for formatting is similar to what the **printf** command uses, so if you are familiar with **printf** statements, you may find **hexdump** formatting easier to learn. - -In **hexdump**, the character sequence **%_p** tells **hexdump** to print a character in your system’s default character set. All formatting notation for the **\--format** option must be enclosed in _single quotes_: - - -``` -$ hexdump -e'"%_p"' /usr/share/doc/libblkid-devel/COPYING -This library is fre* - software; you can redistribute it and/or.modify it under the terms of the GNU Les* -er General Public.License as published by the Fre* - Software Foundation; either.version 2.1 of the License, or (at your option) any later.version..* -The complete text of the license is available in the..* -/Documentation/licenses/COPYING.LGPL-2.1-or-later file.. -``` - -This output is better, but still inconvenient to read. Traditionally, UNIX text files assume an 80-character output width (because long ago, monitors tended to fit only 80 characters across). - -While this output isn’t bound by formatting, you can force **hexdump** to process 80 bytes at a time with additional options. Specifically, by dividing 80 by one, you can tell **hexdump** to treat 80 bytes as one unit: - - -``` -$ hexdump -e'80/1 "%_p"' /usr/share/doc/libblkid-devel/COPYING -This library is free software; you can redistribute it and/or.modify it under the terms of the GNU Lesser General Public.License as published by the Free Software Foundation; either.version 2.1 of the License, or (at your option) any later.version...The complete text of the license is available in the.../Documentation/licenses/COPYING.LGPL-2.1-or-later file.. -``` - -Now the file is processed in 80-byte chunks, but it’s lost any sense of new lines. You can add your own with the **\n** character, which in UNIX represents a new line: - - -``` -$ hexdump -e'80/1 "%_p""\n"' -This library is free software; you can redistribute it and/or.modify it under th -e terms of the GNU Lesser General Public.License as published by the Free Softwa -re Foundation; either.version 2.1 of the License, or (at your option) any later. -version...The complete text of the license is available in the.../Documentation/ -licenses/COPYING.LGPL-2.1-or-later file.. -``` - -You have now (approximately) implemented the **cat** command with **hexdump** formatting. - -### Controlling the output - -Formatting is, realistically, how you make **hexdump** useful. Now that you’re familiar, in principle at least, with **hexdump** formatting, you can make the output of **hexdump -n 8** match the output of the PNG header as described by the official **libpng** spec. - -First, you know that you want **hexdump** to process the PNG file in 8-byte chunks. Furthermore, you may know by integer recognition that the PNG spec is documented in decimal, which is represented by **%d** according to the **hexdump** documentation: - - -``` -$ hexdump -n8 -e'8/1 "%d""\n"' pixel.png -13780787113102610 -``` - -You can make the output perfect by adding a blank space after each integer: - - -``` -$ hexdump -n8 -e'8/1 "%d ""\n"' pixel.png -137 80 78 71 13 10 26 10 -``` - -The output is now a perfect match to the PNG specification. - -### Hexdumping for fun and profit - -Hexdump is a fascinating tool that not only teaches you more about how computers process and convert information, but also about how file formats and compiled binaries function. You should try running **hexdump** on files at random throughout the day as you work. You never know what kinds of information you may find, nor when having that insight may be useful. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/dig-binary-files-hexdump - -作者:[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/sethhttps://opensource.com/users/shishz -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) -[2]: https://www.redhat.com/sysadmin/find-lost-files-scalpel -[3]: http://gimp.org -[4]: https://opensource.com/article/17/2/mtpaint-pixel-art-animated-gifs -[5]: https://opensource.com/article/17/8/imagemagick -[6]: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html -[7]: https://opensource.com/article/19/7/master-ls-command -[8]: https://opensource.com/article/19/5/advanced-rsync -[9]: https://opensource.com/article/19/2/getting-started-cat-command -[10]: https://en.wikipedia.org/wiki/GNU_General_Public_License diff --git a/sources/tech/20190812 Why const Doesn-t Make C Code Faster.md b/sources/tech/20190812 Why const Doesn-t Make C Code Faster.md deleted file mode 100644 index c30d5bddfe..0000000000 --- a/sources/tech/20190812 Why const Doesn-t Make C Code Faster.md +++ /dev/null @@ -1,402 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why const Doesn't Make C Code Faster) -[#]: via: (https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html) -[#]: author: (Simon Arneaud https://theartofmachinery.com) - -Why const Doesn't Make C Code Faster -====== - -In a post a few months back I said [it’s a popular myth that `const` is helpful for enabling compiler optimisations in C and C++][1]. I figured I should explain that one, especially because I used to believe it was obviously true, myself. I’ll start off with some theory and artificial examples, then I’ll do some experiments and benchmarks on a real codebase: Sqlite. - -### A simple test - -Let’s start with what I used to think was the simplest and most obvious example of how `const` can make C code faster. First, let’s say we have these two function declarations: - -``` -void func(int *x); -void constFunc(const int *x); -``` - -And suppose we have these two versions of some code: - -``` -void byArg(int *x) -{ - printf("%d\n", *x); - func(x); - printf("%d\n", *x); -} - -void constByArg(const int *x) -{ - printf("%d\n", *x); - constFunc(x); - printf("%d\n", *x); -} -``` - -To do the `printf()`, the CPU has to fetch the value of `*x` from RAM through the pointer. Obviously, `constByArg()` can be made slightly faster because the compiler knows that `*x` is constant, so there’s no need to load its value a second time after `constFunc()` does its thing. It’s just printing the same thing. Right? Let’s see the assembly code generated by GCC with optimisations cranked up: - -``` -$ gcc -S -Wall -O3 test.c -$ view test.s -``` - -Here’s the full assembly output for `byArg()`: - -``` -byArg: -.LFB23: - .cfi_startproc - pushq %rbx - .cfi_def_cfa_offset 16 - .cfi_offset 3, -16 - movl (%rdi), %edx - movq %rdi, %rbx - leaq .LC0(%rip), %rsi - movl $1, %edi - xorl %eax, %eax - call __printf_chk@PLT - movq %rbx, %rdi - call func@PLT # The only instruction that's different in constFoo - movl (%rbx), %edx - leaq .LC0(%rip), %rsi - xorl %eax, %eax - movl $1, %edi - popq %rbx - .cfi_def_cfa_offset 8 - jmp __printf_chk@PLT - .cfi_endproc -``` - -The only difference between the generated assembly code for `byArg()` and `constByArg()` is that `constByArg()` has a `call constFunc@PLT`, just like the source code asked. The `const` itself has literally made zero difference. - -Okay, that’s GCC. Maybe we just need a sufficiently smart compiler. Is Clang any better? - -``` -$ clang -S -Wall -O3 -emit-llvm test.c -$ view test.ll -``` - -Here’s the IR. It’s more compact than assembly, so I’ll dump both functions so you can see what I mean by “literally zero difference except for the call”: - -``` -; Function Attrs: nounwind uwtable -define dso_local void @byArg(i32*) local_unnamed_addr #0 { - %2 = load i32, i32* %0, align 4, !tbaa !2 - %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) - tail call void @func(i32* %0) #4 - %4 = load i32, i32* %0, align 4, !tbaa !2 - %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) - ret void -} - -; Function Attrs: nounwind uwtable -define dso_local void @constByArg(i32*) local_unnamed_addr #0 { - %2 = load i32, i32* %0, align 4, !tbaa !2 - %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) - tail call void @constFunc(i32* %0) #4 - %4 = load i32, i32* %0, align 4, !tbaa !2 - %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) - ret void -} -``` - -### Something that (sort of) works - -Here’s some code where `const` actually does make a difference: - -``` -void localVar() -{ - int x = 42; - printf("%d\n", x); - constFunc(&x); - printf("%d\n", x); -} - -void constLocalVar() -{ - const int x = 42; // const on the local variable - printf("%d\n", x); - constFunc(&x); - printf("%d\n", x); -} -``` - -Here’s the assembly for `localVar()`, which has two instructions that have been optimised out of `constLocalVar()`: - -``` -localVar: -.LFB25: - .cfi_startproc - subq $24, %rsp - .cfi_def_cfa_offset 32 - movl $42, %edx - movl $1, %edi - movq %fs:40, %rax - movq %rax, 8(%rsp) - xorl %eax, %eax - leaq .LC0(%rip), %rsi - movl $42, 4(%rsp) - call __printf_chk@PLT - leaq 4(%rsp), %rdi - call constFunc@PLT - movl 4(%rsp), %edx # not in constLocalVar() - xorl %eax, %eax - movl $1, %edi - leaq .LC0(%rip), %rsi # not in constLocalVar() - call __printf_chk@PLT - movq 8(%rsp), %rax - xorq %fs:40, %rax - jne .L9 - addq $24, %rsp - .cfi_remember_state - .cfi_def_cfa_offset 8 - ret -.L9: - .cfi_restore_state - call __stack_chk_fail@PLT - .cfi_endproc -``` - -The LLVM IR is a little clearer. The `load` just before the second `printf()` call has been optimised out of `constLocalVar()`: - -``` -; Function Attrs: nounwind uwtable -define dso_local void @localVar() local_unnamed_addr #0 { - %1 = alloca i32, align 4 - %2 = bitcast i32* %1 to i8* - call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #4 - store i32 42, i32* %1, align 4, !tbaa !2 - %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42) - call void @constFunc(i32* nonnull %1) #4 - %4 = load i32, i32* %1, align 4, !tbaa !2 - %5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) - call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #4 - ret void -} -``` - -Okay, so, `constLocalVar()` has sucessfully elided the reloading of `*x`, but maybe you’ve noticed something a bit confusing: it’s the same `constFunc()` call in the bodies of `localVar()` and `constLocalVar()`. If the compiler can deduce that `constFunc()` didn’t modify `*x` in `constLocalVar()`, why can’t it deduce that the exact same function call didn’t modify `*x` in `localVar()`? - -The explanation gets closer to the heart of why C `const` is impractical as an optimisation aid. C `const` effectively has two meanings: it can mean the variable is a read-only alias to some data that may or may not be constant, or it can mean the variable is actually constant. If you cast away `const` from a pointer to a constant value and then write to it, the result is undefined behaviour. On the other hand, it’s okay if it’s just a `const` pointer to a value that’s not constant. - -This possible implementation of `constFunc()` shows what that means: - -``` -// x is just a read-only pointer to something that may or may not be a constant -void constFunc(const int *x) -{ - // local_var is a true constant - const int local_var = 42; - - // Definitely undefined behaviour by C rules - doubleIt((int*)&local_var); - // Who knows if this is UB? - doubleIt((int*)x); -} - -void doubleIt(int *x) -{ - *x *= 2; -} -``` - -`localVar()` gave `constFunc()` a `const` pointer to non-`const` variable. Because the variable wasn’t originally `const`, `constFunc()` can be a liar and forcibly modify it without triggering UB. So the compiler can’t assume the variable has the same value after `constFunc()` returns. The variable in `constLocalVar()` really is `const`, though, so the compiler can assume it won’t change — because this time it _would_ be UB for `constFunc()` to cast `const` away and write to it. - -The `byArg()` and `constByArg()` functions in the first example are hopeless because the compiler has no way of knowing if `*x` really is `const`. - -But why the inconsistency? If the compiler can assume that `constFunc()` doesn’t modify its argument when called in `constLocalVar()`, surely it can go ahead an apply the same optimisations to other `constFunc()` calls, right? Nope. The compiler can’t assume `constLocalVar()` is ever run at all. If it isn’t (say, because it’s just some unused extra output of a code generator or macro), `constFunc()` can sneakily modify data without ever triggering UB. - -You might want to read the above explanation and examples a few times, but don’t worry if it sounds absurd: it is. Unfortunately, writing to `const` variables is the worst kind of UB: most of the time the compiler can’t know if it even would be UB. So most of the time the compiler sees `const`, it has to assume that someone, somewhere could cast it away, which means the compiler can’t use it for optimisation. This is true in practice because enough real-world C code has “I know what I’m doing” casting away of `const`. - -In short, a whole lot of things can prevent the compiler from using `const` for optimisation, including receiving data from another scope using a pointer, or allocating data on the heap. Even worse, in most cases where `const` can be used by the compiler, it’s not even necessary. For example, any decent compiler can figure out that `x` is constant in the following code, even without `const`: - -``` -int x = 42, y = 0; -printf("%d %d\n", x, y); -y += x; -printf("%d %d\n", x, y); -``` - -TL;DR: `const` is almost useless for optimisation because - - 1. Except for special cases, the compiler has to ignore it because other code might legally cast it away - 2. In most of the exceptions to #1, the compiler can figure out a variable is constant, anyway - - - -### C++ - -There’s another way `const` can affect code generation if you’re using C++: function overloads. You can have `const` and non-`const` overloads of the same function, and maybe the non-`const` can be optimised (by the programmer, not the compiler) to do less copying or something. - -``` -void foo(int *p) -{ - // Needs to do more copying of data -} - -void foo(const int *p) -{ - // Doesn't need defensive copies -} - -int main() -{ - const int x = 42; - // const-ness affects which overload gets called - foo(&x); - return 0; -} -``` - -On the one hand, I don’t think this is exploited much in practical C++ code. On the other hand, to make a real difference, the programmer has to make assumptions that the compiler can’t make because they’re not guaranteed by the language. - -### An experiment with Sqlite3 - -That’s enough theory and contrived examples. How much effect does `const` have on a real codebase? I thought I’d do a test on the Sqlite database (version 3.30.0) because - - * It actually uses `const` - * It’s a non-trivial codebase (over 200KLOC) - * As a database, it includes a range of things from string processing to arithmetic to date handling - * It can be tested with CPU-bound loads - - - -Also, the author and contributors have put years of effort into performance optimisation already, so I can assume they haven’t missed anything obvious. - -#### The setup - -I made two copies of [the source code][2] and compiled one normally. For the other copy, I used this hacky preprocessor snippet to turn `const` into a no-op: - -``` -#define const -``` - -(GNU) `sed` can add that to the top of each file with something like `sed -i '1i#define const' *.c *.h`. - -Sqlite makes things slightly more complicated by generating code using scripts at build time. Fortunately, compilers make a lot of noise when `const` and non-`const` code are mixed, so it was easy to detect when this happened, and tweak the scripts to include my anti-`const` snippet. - -Directly diffing the compiled results is a bit pointless because a tiny change can affect the whole memory layout, which can change pointers and function calls throughout the code. Instead I took a fingerprint of the disassembly (`objdump -d libsqlite3.so.0.8.6`), using the binary size and mnemonic for each instruction. For example, this function: - -``` -000000000005d570 : - 5d570: 4c 8d 05 59 a2 ff ff lea -0x5da7(%rip),%r8 # 577d0 - 5d577: e9 04 fe ff ff jmpq 5d380 - 5d57c: 0f 1f 40 00 nopl 0x0(%rax) -``` - -would turn into something like this: - -``` -sqlite3_blob_read 7lea 5jmpq 4nopl -``` - -I left all the Sqlite build settings as-is when compiling anything. - -#### Analysing the compiled code - -The `const` version of libsqlite3.so was 4,740,704 bytes, about 0.1% larger than the 4,736,712 bytes of the non-`const` version. Both had 1374 exported functions (not including low-level helpers like stuff in the PLT), and a total of 13 had any difference in fingerprint. - -A few of the changes were because of the dumb preprocessor hack. For example, here’s one of the changed functions (with some Sqlite-specific definitions edited out): - -``` -#define LARGEST_INT64 (0xffffffff|(((int64_t)0x7fffffff)<<32)) -#define SMALLEST_INT64 (((int64_t)-1) - LARGEST_INT64) - -static int64_t doubleToInt64(double r){ - /* - ** Many compilers we encounter do not define constants for the - ** minimum and maximum 64-bit integers, or they define them - ** inconsistently. And many do not understand the "LL" notation. - ** So we define our own static constants here using nothing - ** larger than a 32-bit integer constant. - */ - static const int64_t maxInt = LARGEST_INT64; - static const int64_t minInt = SMALLEST_INT64; - - if( r<=(double)minInt ){ - return minInt; - }else if( r>=(double)maxInt ){ - return maxInt; - }else{ - return (int64_t)r; - } -} -``` - -Removing `const` makes those constants into `static` variables. I don’t see why anyone who didn’t care about `const` would make those variables `static`. Removing both `static` and `const` makes GCC recognise them as constants again, and we get the same output. Three of the 13 functions had spurious changes because of local `static const` variables like this, but I didn’t bother fixing any of them. - -Sqlite uses a lot of global variables, and that’s where most of the real `const` optimisations came from. Typically they were things like a comparison with a variable being replaced with a constant comparison, or a loop being partially unrolled a step. (The [Radare toolkit][3] was handy for figuring out what the optimisations did.) A few changes were underwhelming. `sqlite3ParseUri()` is 487 instructions, but the only difference `const` made was taking this pair of comparisons: - -``` -test %al, %al -je -cmp $0x23, %al -je -``` - -And swapping their order: - -``` -cmp $0x23, %al -je -test %al, %al -je -``` - -#### Benchmarking - -Sqlite comes with a performance regression test, so I tried running it a hundred times for each version of the code, still using the default Sqlite build settings. Here are the timing results in seconds: - -| const | No const ----|---|--- -Minimum | 10.658s | 10.803s -Median | 11.571s | 11.519s -Maximum | 11.832s | 11.658s -Mean | 11.531s | 11.492s - -Personally, I’m not seeing enough evidence of a difference worth caring about. I mean, I removed `const` from the entire program, so if it made a significant difference, I’d expect it to be easy to see. But maybe you care about any tiny difference because you’re doing something absolutely performance critical. Let’s try some statistical analysis. - -I like using the Mann-Whitney U test for stuff like this. It’s similar to the more-famous t test for detecting differences in groups, but it’s more robust to the kind of complex random variation you get when timing things on computers (thanks to unpredictable context switches, page faults, etc). Here’s the result: - -| const | No const ----|---|--- -N | 100 | 100 -Mean rank | 121.38 | 79.62 -Mann-Whitney U | 2912 ----|--- -Z | -5.10 -2-sided p value | <10-6 -HL median difference | -.056s -95% confidence interval | -.077s – -0.038s - -The U test has detected a statistically significant difference in performance. But, surprise, it’s actually the non-`const` version that’s faster — by about 60ms, or 0.5%. It seems like the small number of “optimisations” that `const` enabled weren’t worth the cost of extra code. It’s not like `const` enabled any major optimisations like auto-vectorisation. Of course, your mileage may vary with different compiler flags, or compiler versions, or codebases, or whatever, but I think it’s fair to say that if `const` were effective at improving C performance, we’d have seen it by now. - -### So, what’s `const` for? - -For all its flaws, C/C++ `const` is still useful for type safety. In particular, combined with C++ move semantics and `std::unique_pointer`s, `const` can make pointer ownership explicit. Pointer ownership ambiguity was a huge pain in old C++ codebases over ~100KLOC, so personally I’m grateful for that alone. - -However, I used to go beyond using `const` for meaningful type safety. I’d heard it was best practices to use `const` literally as much as possible for performance reasons. I’d heard that when performance really mattered, it was important to refactor code to add more `const`, even in ways that made it less readable. That made sense at the time, but I’ve since learned that it’s just not true. - --------------------------------------------------------------------------------- - -via: https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html - -作者:[Simon Arneaud][a] -选题:[lujun9972][b] -译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://theartofmachinery.com -[b]: https://github.com/lujun9972 -[1]: https://theartofmachinery.com/2019/04/05/d_as_c_replacement.html#const-and-immutable -[2]: https://sqlite.org/src/doc/trunk/README.md -[3]: https://rada.re/r/ diff --git a/sources/tech/20190819 Moving files on Linux without mv.md b/sources/tech/20190819 Moving files on Linux without mv.md deleted file mode 100644 index 6bf44ff584..0000000000 --- a/sources/tech/20190819 Moving files on Linux without mv.md +++ /dev/null @@ -1,189 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Moving files on Linux without mv) -[#]: via: (https://opensource.com/article/19/8/moving-files-linux-without-mv) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/seth) - -Moving files on Linux without mv -====== -Sometimes the mv command isn't the best option when you need to move a -file. So how else do you do it? -![Hand putting a Linux file folder into a drawer][1] - -The humble **mv** command is one of those useful tools you find on every POSIX box you encounter. Its job is clearly defined, and it does it well: Move a file from one place in a file system to another. But Linux is nothing if not flexible, and there are other options for moving files. Using different tools can provide small advantages that fit perfectly with a specific use case. - -Before straying too far from **mv**, take a look at this command’s default results. First, create a directory and generate some files with permissions set to 777: - - -``` -$ mkdir example -$ touch example/{foo,bar,baz} -$ for i in example/*; do ls /bin > "${i}"; done -$ chmod 777 example/* -``` - -You probably don't think about it this way, but files exist as entries, called index nodes (commonly known as **inodes**), in a [filesystem][2]. You can see what inode a file occupies with the [ls command][3] and its **\--inode** option: - - -``` -$ ls --inode example/foo -7476868 example/foo -``` - -As a test, move that file from the example directory to your current directory and then view the file’s attributes: - - -``` -$ mv example/foo . -$ ls -l -G -g --inode -7476868 -rwxrwxrwx. 1 29545 Aug  2 07:28 foo -``` - -As you can see, the original file—along with its existing permissions—has been "moved", but its inode has not changed. - -That’s the way the **mv** tool is programmed to move a file: Leave the inode unchanged (unless the file is being moved to a different filesystem), and preserve its ownership and permissions. - -Other tools provide different options. - -### Copy and remove - -On some systems, the move action is a true move action: Bits are removed from one point in the file system and reassigned to another. This behavior has largely fallen out of favor. Move actions are now either attribute reassignments (an inode now points to a different location in your file organization) or amalgamations of a copy action followed by a remove action. -The philosophical intent of this design is to ensure that, should a move fail, a file is not left in pieces. - -The **cp** command, unlike **mv**, creates a brand new data object in your filesystem. It has a new inode location, and it is subject to your active umask. You can mimic a move using the **cp** and **rm** (or [trash][4] if you have it) commands: - - -``` -$ cp example/foo . -$ ls -l -G -g --inode -7476869 -rwxrwxr-x. 29545 Aug  2 11:58 foo -$ trash example/foo -``` - -The new **foo** file in this example got 775 permissions because the location’s umask specifically excludes write permissions: - - -``` -$ umask -0002 -``` - -For more information about umask, read Alex Juarez’s article about [file permissions][5]. - -### Cat and remove - -Similar to a copy and remove, using the [cat][6] (or **tac**, for that matter) command assigns different permissions when your "moved" file is created. Assuming a fresh test environment with no **foo** in the current directory: - - -``` -$ cat example/foo > foo -$ ls -l -G -g --inode -7476869 -rw-rw-r--. 29545 Aug 8 12:21 foo -$ trash example/foo -``` - -This time, a new file was created with no prior permissions set. The result is entirely subject to the umask setting, which blocks no permission bit for the user and group (the executable bit is not granted for new files regardless of umask), but it blocks the write (value two) bit from others. The result is a file with 664 permission. - -### Rsync - -The **rsync** command is a robust multipurpose tool to send files between hosts and file system locations. This command has many options available to it, including the ability to make its destination mirror its source. - -You can copy and then remove a file with **rsync** using the **\--remove-source-files** option, along with whatever other option you choose to perform the synchronization (a common, general-purpose one is **\--archive**): - - -``` -$ rsync --archive --remove-source-files example/foo . -$ ls example -bar  baz -$ ls -lGgi -7476870 -rwxrwxrwx. 1 seth users 29545 Aug 8 12:23 foo -``` - -Here you can see that file permission and ownership was retained, the timestamp was updated, and the source file was removed. - -**A word of warning:** Do not confuse this option for **\--delete**, which removes files from your _destination_ directory. Misusing **\--delete** can wipe out most of your data, and it’s recommended that you avoid this option except in a test environment. - -You can override some of these defaults, changing permission and modification settings: - - -``` -$ rsync --chmod=666 --times \ -\--remove-source-files example/foo . -$ ls example -bar  baz -$ ls -lGgi -7476871 -rw-rw-r--. 1 seth users 29545 Aug 8 12:55 foo -``` - -Here, the destination’s umask is respected, so the **\--chmod=666** option results in a file with 664 permissions. - -The benefits go beyond just permissions, though. The **rsync** command has [many][7] useful [options][8] (not the least of which is the **\--exclude** flag so you can exempt items from a large move operation) that make it a more robust tool than the simple **mv** command. For example, to exclude all backup files while moving a collection of files: - - -``` -$ rsync --chmod=666 --times \ -\--exclude '*~' \ -\--remove-source-files example/foo . -``` - -### Set permissions with install - -The **install** command is a copy command specifically geared toward developers and is mostly invoked as part of the install routine of software compiling. It’s not well known among users (and I do often wonder why it got such an intuitive name, leaving mere acronyms and pet names for package managers), but **install** is actually a useful way to put files where you want them. - -There are many options for the **install** command, including **\--backup** and **\--compare** command (to avoid "updating" a newer copy of a file). - -Unlike **cp** and **cat**, but exactly like **mv**, the **install** command can copy a file while preserving its timestamp: - - -``` -$ install --preserve-timestamp example/foo . -$ ls -l -G -g --inode -7476869 -rwxr-xr-x. 1 29545 Aug  2 07:28 foo -$ trash example/foo -``` - -Here, the file was copied to a new inode, but its **mtime** did not change. The permissions, however, were set to the **install** default of **755**. - -You can use **install** to set the file’s permissions, owner, and group: - - -``` -$ install --preserve-timestamp \ -\--owner=skenlon \ -\--group=dialout \ -\--mode=666 example/foo . -$ ls -li -7476869 -rw-rw-rw-. 1 skenlon dialout 29545 Aug  2 07:28 foo -$ trash example/foo -``` - -### Move, copy, and remove - -Files contain data, and the really important files contain _your_ data. Learning to manage them wisely is important, and now you have the toolkit to ensure that your data is handled in exactly the way you want. - -Do you have a different way of managing your data? Tell us your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/moving-files-linux-without-mv - -作者:[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/sethhttps://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) -[2]: https://opensource.com/article/18/11/partition-format-drive-linux#what-is-a-filesystem -[3]: https://opensource.com/article/19/7/master-ls-command -[4]: https://gitlab.com/trashy -[5]: https://opensource.com/article/19/8/linux-permissions-101#umask -[6]: https://opensource.com/article/19/2/getting-started-cat-command -[7]: https://opensource.com/article/19/5/advanced-rsync -[8]: https://opensource.com/article/17/1/rsync-backup-linux diff --git a/sources/tech/20190820 A guided tour of Linux file system types.md b/sources/tech/20190820 A guided tour of Linux file system types.md deleted file mode 100644 index 8d8916a08e..0000000000 --- a/sources/tech/20190820 A guided tour of Linux file system types.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A guided tour of Linux file system types) -[#]: via: (https://www.networkworld.com/article/3432990/a-guided-tour-of-linux-file-system-types.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -A guided tour of Linux file system types -====== -Linux file systems have evolved over the years, and here's a look at file system types -![Andreas Lehner / Flickr \(CC BY 2.0\)][1] - -While it may not be obvious to the casual user, Linux file systems have evolved significantly over the last decade or so to make them more resistant to corruption and performance problems. - -Most Linux systems today use a file system type called **ext4**. The “ext” part stands for “extended” and the 4 indicates that this is the 4th generation of this file system type. Features added over time include the ability to provide increasingly larger file systems (currently as large as 1,000,000 TiB) and much larger files (up to 16 TiB), more resistance to system crashes and less fragmentation (scattering single files as chunks in multiple locations) which improves performance. - -The **ext4** file system type also came with other improvements to performance, scalability and capacity. Metadata and journal checksums were implemented for reliability. Timestamps now track changes down to nanoseconds for better file time-stamping (e.g., file creation and last updates). And, with two additional bits in the timestamp field, the year 2038 problem (when the digitally stored date/time fields will roll over from maximum to zero) has been put off for more than 400 years (to 2446). - -### File system types - -To determine the type of file system on a Linux system, use the **df** command. The **T** option in the command shown below provides the file system type. The **h** makes the disk sizes “human-readable”; in other words, adjusting the reported units (such as M and G) in a way that makes the most sense to the people reading them. - -``` -$ df -hT | head -10 -Filesystem Type Size Used Avail Use% Mounted on -udev devtmpfs 2.9G 0 2.9G 0% /dev -tmpfs tmpfs 596M 1.5M 595M 1% /run -/dev/sda1 ext4 110G 50G 55G 48% / -/dev/sdb2 ext4 457G 642M 434G 1% /apps -tmpfs tmpfs 3.0G 0 3.0G 0% /dev/shm -tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock -tmpfs tmpfs 3.0G 0 3.0G 0% /sys/fs/cgroup -/dev/loop0 squashfs 89M 89M 0 100% /snap/core/7270 -/dev/loop2 squashfs 142M 142M 0 100% /snap/hexchat/42 -``` - -Notice that the **/** (root) and **/apps** file systems are both **ext4** file systems while **/dev** is a **devtmpfs** file system – one with automated device nodes populated by the kernel. Some of the other file systems shown are **tmpfs** – temporary file systems that reside in memory and/or swap partitions and **squashfs** – file systems that are read-only compressed file systems and are used for snap packages. - -There's also proc file systems that stores information on running processes. - -``` -$ df -T /proc -Filesystem Type 1K-blocks Used Available Use% Mounted on -proc proc 0 0 0 - /proc -``` - -There are a number of other file system types that you might encounter as you're moving around the overall file system. When you've moved into a directory, for example, and want to ask about the related file system, you can run a command like this: - -``` -$ cd /dev/mqueue; df -T . -Filesystem Type 1K-blocks Used Available Use% Mounted on -mqueue mqueue 0 0 0 - /dev/mqueue -$ cd /sys; df -T . -Filesystem Type 1K-blocks Used Available Use% Mounted on -sysfs sysfs 0 0 0 - /sys -$ cd /sys/kernel/security; df -T . -Filesystem Type 1K-blocks Used Available Use% Mounted on -securityfs securityfs 0 0 0 - /sys/kernel/security -``` - -As with other Linux commands, the . in these commands refers to the current location in the overall file system. - -These and other unique file-system types provide some special functions. For example, securityfs provides file system support for security modules. - -Linux file systems need to be resistant to corruption, have the ability to survive system crashes and provide fast and reliable performance. The improvements provided by the generations of **ext** file systems and the new generation on purpose-specific file system types have made Linux systems easier to manage and more reliable. - -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/3432990/a-guided-tour-of-linux-file-system-types.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://images.idgesg.net/images/article/2019/08/guided-tour-on-the-flaker_people-in-horse-drawn-carriage_germany-by-andreas-lehner-flickr-100808681-large.jpg -[2]: https://www.facebook.com/NetworkWorld/ -[3]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190821 Getting Started with Go on Fedora.md b/sources/tech/20190821 Getting Started with Go on Fedora.md deleted file mode 100644 index 8cd00e0270..0000000000 --- a/sources/tech/20190821 Getting Started with Go on Fedora.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting Started with Go on Fedora) -[#]: via: (https://fedoramagazine.org/getting-started-with-go-on-fedora/) -[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/) - -Getting Started with Go on Fedora -====== - -![][1] - -The [Go][2] programming language was first publicly announced in 2009, since then the language has become widely adopted. In particular Go has become a reference in the world of cloud infrastructure with big projects like [Kubernetes][3], [OpenShift][4] or [Terraform][5] for example. - -Some of the main reasons for Go’s increasing popularity are the performances, the ease to write fast concurrent application, the simplicity of the language and fast compilation time. So let’s see how to get started with Go on Fedora. - -### Install Go in Fedora - -Fedora provides an easy way to install the Go programming language via the official repository. - -``` -$ sudo dnf install -y golang -$ go version -go version go1.12.7 linux/amd64 -``` - -Now that Go is installed, let’s write a simple program, compile it and execute it. - -### First program in Go - -Let’s write the traditional “Hello, World!” program in Go. First create a _main.go_ file and type or copy the following. - -``` -package main - -import "fmt" - -func main() { - fmt.Println("Hello, World!") -} -``` - -Running this program is quite simple. - -``` -$ go run main.go -Hello, World! -``` - -This will build a binary from main.go in a temporary directory, execute the binary, then delete the temporary directory. This command is really great to quickly run the program during development and it also highlights the speed of Go compilation. - -Building an executable of the program is as simple as running it. - -``` -$ go build main.go -$ ./main -Hello, World! -``` - -### Using Go modules - -Go 1.11 and 1.12 introduce preliminary support for modules. Modules are a solution to manage application dependencies. This solution is based on 2 files _go.mod_ and _go.sum_ used to explicitly define the version of the dependencies. - -To show how to use modules, let’s add a dependency to the hello world program. - -Before changing the code, the module needs to be initialized. - -``` -$ go mod init helloworld -go: creating new go.mod: module helloworld -$ ls -go.mod main main.go -``` - -Next modify the main.go file as follow. - -``` -package main - -import "github.com/fatih/color" - -func main () { - color.Blue("Hello, World!") -} -``` - -In the modified main.go, instead of using the standard library “_fmt_” to print the “Hello, World!”. The application uses an external library which makes it easy to print text in color. - -Let’s run this version of the application. - -``` -$ go run main.go -Hello, World! -``` - -Now that the application is depending on the _github.com/fatih/color_ library, it needs to download all the dependencies before compiling it. The list of dependencies is then added to _go.mod_ and the exact version and commit hash of these dependencies is recorded in _go.sum_. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/getting-started-with-go-on-fedora/ - -作者:[Clément Verna][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/cverna/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/go-article-816x345.jpg -[2]: https://golang.org/ -[3]: https://kubernetes.io/ -[4]: https://www.openshift.com/ -[5]: https://www.terraform.io/ diff --git a/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md b/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md deleted file mode 100644 index ab12c95ddd..0000000000 --- a/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A Raspberry Pi Based Open Source Tablet is in Making and it’s Called CutiePi) -[#]: via: (https://itsfoss.com/cutiepi-open-source-tab/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -A Raspberry Pi Based Open Source Tablet is in Making and it’s Called CutiePi -====== - -CutiePie is an 8-inch open-source tablet built on top of Raspberry Pi. For now, it is just a working prototype which they announced on [Raspberry Pi forums][1]. - -In this article, you’ll get to know more details on the specifications, price, and availability of CutiePi. - -They have made the Tablet using a custom-designed Compute Model (CM3) carrier board. The [official website][2] mentions the purpose of a custom CM3 carrier board as: - -> A custom CM3/CM3+ carrier board designed for portable use, with enhanced power management and Li-Po battery level monitoring features; works with selected HDMI or MIPI DSI displays. - -So, this is what makes the Tablet thin enough while being portable. - -### CutiePi Specifications - -![CutiePi Board][3] - -I was surprised to know that it rocks an 8-inch IPS LCD display – which is a good thing for starters. However, you won’t be getting a true HD screen because the resolution is 1280×800 – as mentioned officially. - -It is also planned to come packed with Li-Po 4800 mAh battery (the prototype had a 5000 mAh battery). Well, for a Tablet, that isn’t bad at all. - -Connectivity options include the support for Wi-Fi and Bluetooth 4.0. In addition to this, a USB Type-A, 6x GPIO pins, and a microSD card slot is present. - -![CutiePi Specifications][4] - -The hardware is officially compatible with [Raspbian OS][5] and the user interface is built with [Qt][6] for a fast and intuitive user experience. Also, along with the in-built apps, it is expected to support Raspbian PIXEL apps via XWayland. - -### CutiePi Source Code - -You can second-guess the pricing of this tablet by analyzing the bill for the materials used. CutiePi follows a 100% open-source hardware design for this project. So, if you are curious, you can check out their GitHub page for more information on the hardware design and stuff. - -[CutiePi on GitHub][7] - -### CutiePi Pricing, Release Date & Availability - -CutiePi plans to work on [DVT][8] batch PCBs in August (this month). And, they target to launch the final product by the end of 2019. - -Officially, they expect it to launch it at around $150-$250. This is just an approximate for the range and should be taken with a pinch of salt. - -Obviously, the price will be a major factor in order to make it a success – even though the product itself sounds promising. - -**Wrapping Up** - -CutiePi is not the first project to use a [single board computer like Raspberry Pi][9] to make a tablet. We have the upcoming [PineTab][10] which is based on Pine64 single board computer. Pine also has a laptop called [Pinebook][11] based on the same. - -Judging by the prototype – it is indeed a product that we can expect to work. However, the pre-installed apps and the apps that it will support may turn the tide. Also, considering the price estimate – it sounds promising. - -What do you think about it? Let us know your thoughts in the comments below or just play this interactive poll. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/cutiepi-open-source-tab/ - -作者:[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.raspberrypi.org/forums/viewtopic.php?t=247380 -[2]: https://cutiepi.io/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-board.png?ssl=1 -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-specifications.jpg?ssl=1 -[5]: https://itsfoss.com/raspberry-pi-os-desktop/ -[6]: https://en.wikipedia.org/wiki/Qt_%28software%29 -[7]: https://github.com/cutiepi-io/cutiepi-board -[8]: https://en.wikipedia.org/wiki/Engineering_validation_test#Design_verification_test -[9]: https://itsfoss.com/raspberry-pi-alternatives/ -[10]: https://www.pine64.org/pinetab/ -[11]: https://itsfoss.com/pinebook-pro/ diff --git a/sources/tech/20190822 How to move a file in Linux.md b/sources/tech/20190822 How to move a file in Linux.md deleted file mode 100644 index c38f9445e1..0000000000 --- a/sources/tech/20190822 How to move a file in Linux.md +++ /dev/null @@ -1,286 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to move a file in Linux) -[#]: via: (https://opensource.com/article/19/8/moving-files-linux-depth) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/doni08521059) - -How to move a file in Linux -====== -Whether you're new to moving files in Linux or experienced, you'll learn -something in this in-depth writeup. -![Files in a folder][1] - -Moving files in Linux can seem relatively straightforward, but there are more options available than most realize. This article teaches beginners how to move files in the GUI and on the command line, but also explains what’s actually happening under the hood, and addresses command line options that many experience users have rarely explored. - -### Moving what? - -Before delving into moving files, it’s worth taking a closer look at what actually happens when _moving_ file system objects. When a file is created, it is assigned to an _inode_, which is a fixed point in a file system that’s used for data storage. You can what inode maps to a file with the [ls][2] command: - - -``` -$ ls --inode example.txt -7344977 example.txt -``` - -When you move a file, you don’t actually move the data from one inode to another, you only assign the file object a new name or file path. In fact, a file retains its permissions when it’s moved, because moving a file doesn’t change or re-create it. - -File and directory inodes never imply inheritance and are dictated by the filesystem itself. Inode assignment is sequential based on when the file was created and is entirely independent of how you organize your computer. A file "inside" a directory may have a lower inode number than its parent directory, or a higher one. For example: - - -``` -$ mkdir foo -$ mv example.txt foo -$ ls --inode -7476865 foo -$ ls --inode foo -7344977 example.txt -``` - -When moving a file from one hard drive to another, however, the inode is very likely to change. This happens because the new data has to be written onto a new filesystem. For this reason, in Linux the act of moving and renaming files is literally the same action. Whether you move a file to another directory or to the same directory with a new name, both actions are performed by the same underlying program. - -This article focuses on moving files from one directory to another. - -### Moving with a mouse - -The GUI is a friendly and, to most people, familiar layer of abstraction on top of a complex collection of binary data. It’s also the first and most intuitive way to move files on Linux. If you’re used to the desktop experience, in a generic sense, then you probably already know how to move files around your hard drive. In the GNOME desktop, for instance, the default action when dragging and dropping a file from one window to another is to move the file rather than to copy it, so it’s probably one of the most intuitive actions on the desktop: - -![Moving a file in GNOME.][3] - -The Dolphin file manager in the KDE Plasma desktop defaults to prompting the user for an action. Holding the **Shift** key while dragging a file forces a move action: - -![Moving a file in KDE.][4] - -### Moving on the command line - -The shell command intended for moving files on Linux, BSD, Illumos, Solaris, and MacOS is **mv**. A simple command with a predictable syntax, **mv <source> <destination>** moves a source file to the specified destination, each defined by either an [absolute][5] or [relative][6] file path. As mentioned before, **mv** is such a common command for [POSIX][7] users that many of its additional modifiers are generally unknown, so this article brings a few useful modifiers to your attention whether you are new or experienced. - -Not all **mv** commands were written by the same people, though, so you may have GNU **mv**, BSD **mv**, or Sun **mv**, depending on your operating system. Command options differ from implementation to implementation (BSD **mv** has no long options at all) so refer to your **mv** man page to see what’s supported, or install your preferred version instead (that’s the luxury of open source). - -#### Moving a file - -To move a file from one folder to another with **mv**, remember the syntax **mv <source> <destination>**. For instance, to move the file **example.txt** into your **Documents** directory: - - -``` -$ touch example.txt -$ mv example.txt ~/Documents -$ ls ~/Documents -example.txt -``` - -Just like when you move a file by dragging and dropping it onto a folder icon, this command doesn’t replace **Documents** with **example.txt**. Instead, **mv** detects that **Documents** is a folder, and places the **example.txt** file into it. - -You can also, conveniently, rename the file as you move it: - - -``` -$ touch example.txt -$ mv example.txt ~/Documents/foo.txt -$ ls ~/Documents -foo.txt -``` - -That’s important because it enables you to rename a file even when you don’t want to move it to another location, like so: - - -``` -`$ touch example.txt $ mv example.txt foo2.txt $ ls foo2.txt` -``` - -#### Moving a directory - -The **mv** command doesn’t differentiate a file from a directory the way [**cp**][8] does. You can move a directory or a file with the same syntax: - - -``` -$ touch file.txt -$ mkdir foo_directory -$ mv file.txt foo_directory -$ mv foo_directory ~/Documents -``` - -#### Moving a file safely - -If you copy a file to a directory where a file of the same name already exists, the **mv** command replaces the destination file with the one you are moving, by default. This behavior is called _clobbering_, and sometimes it’s exactly what you intend. Other times, it is not. - -Some distributions _alias_ (or you might [write your own][9]) **mv** to **mv --interactive**, which prompts you for confirmation. Some do not. Either way, you can use the **\--interactive** or **-i** option to ensure that **mv** asks for confirmation in the event that two files of the same name are in conflict: - - -``` -$ mv --interactive example.txt ~/Documents -mv: overwrite '~/Documents/example.txt'? -``` - -If you do not want to manually intervene, use **\--no-clobber** or **-n** instead. This flag silently rejects the move action in the event of conflict. In this example, a file named **example.txt** already exists in **~/Documents**, so it doesn't get moved from the current directory as instructed: - - -``` -$ mv --no-clobber example.txt ~/Documents -$ ls -example.txt -``` - -#### Moving with backups - -If you’re using GNU **mv**, there are backup options offering another means of safe moving. To create a backup of any conflicting destination file, use the **-b** option: - - -``` -$ mv -b example.txt ~/Documents -$ ls ~/Documents -example.txt    example.txt~ -``` - -This flag ensures that **mv** completes the move action, but also protects any pre-existing file in the destination location. - -Another GNU backup option is **\--backup**, which takes an argument defining how the backup file is named: - - * **existing**: If numbered backups already exist in the destination, then a numbered backup is created. Otherwise, the **simple** scheme is used. - * **none**: Does not create a backup even if **\--backup** is set. This option is useful to override a **mv** alias that sets the backup option. - * **numbered**: Appends the destination file with a number. - * **simple**: Appends the destination file with a **~**, which can conveniently be hidden from your daily view with the **\--ignore-backups** option for **[ls][2]**. - - - -For example: - - -``` -$ mv --backup=numbered example.txt ~/Documents -$ ls ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt --rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ -``` - -A default backup scheme can be set with the environment variable VERSION_CONTROL. You can set environment variables in your **~/.bashrc** file or dynamically before your command: - - -``` -$ VERSION_CONTROL=numbered mv --backup example.txt ~/Documents -$ ls ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt --rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ --rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ -``` - -The **\--backup** option still respects the **\--interactive** or **-i** option, so it still prompts you to overwrite the destination file, even though it creates a backup before doing so: - - -``` -$ mv --backup=numbered example.txt ~/Documents -mv: overwrite '~/Documents/example.txt'? y -$ ls ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt --rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ --rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ --rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt.~3~ -``` - -You can override **-i** with the **\--force** or **-f** option. - - -``` -$ mv --backup=numbered --force example.txt ~/Documents -$ ls ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:26 example.txt --rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ --rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ --rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt.~3~ --rw-rw-r--. 1 seth users 128 Aug  1 17:25 example.txt.~4~ -``` - -The **\--backup** option is not available in BSD **mv**. - -#### Moving many files at once - -When moving multiple files, **mv** treats the final directory named as the destination: - - -``` -$ mv foo bar baz ~/Documents -$ ls ~/Documents -foo   bar   baz -``` - -If the final item is not a directory, **mv** returns an error: - - -``` -$ mv foo bar baz -mv: target 'baz' is not a directory -``` - -The syntax of GNU **mv** is fairly flexible. If you are unable to provide the **mv** command with the destination as the final argument, use the **\--target-directory** or **-t** option: - - -``` -$ mv --target-directory=~/Documents foo bar baz -$ ls ~/Documents -foo   bar   baz -``` - -This is especially useful when constructing **mv** commands from the output of some other command, such as the **find** command, **xargs**, or [GNU Parallel][10]. - -#### Moving based on mtime - -With GNU **mv**, you can define a move action based on whether the file being moved is newer than the destination file it would replace. This option is possible with the **\--update** or **-u** option, and is not available in BSD **mv**: - - -``` -$ ls -l ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:32 example.txt -$ ls -l --rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt -$ mv --update example.txt ~/Documents -$ ls -l ~/Documents --rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt -$ ls -l -``` - -This result is exclusively based on the files’ modification time, not on a diff of the two files, so use it with care. It’s easy to fool **mv** with a mere **touch** command: - - -``` -$ cat example.txt -one -$ cat ~/Documents/example.txt -one -two -$ touch example.txt -$ mv --update example.txt ~/Documents -$ cat ~/Documents/example.txt -one -``` - -Obviously, this isn’t the most intelligent update function available, but it offers basic protection against overwriting recent data. - -### Moving - -There are more ways to move data than just the **mv** command, but as the default program for the job, **mv** is a good universal option.  Now that you know what options you have available, you can use **mv** smarter than ever before. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/moving-files-linux-depth - -作者:[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/sethhttps://opensource.com/users/doni08521059 -[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://opensource.com/article/19/7/master-ls-command -[3]: https://opensource.com/sites/default/files/uploads/gnome-mv.jpg (Moving a file in GNOME.) -[4]: https://opensource.com/sites/default/files/uploads/kde-mv.jpg (Moving a file in KDE.) -[5]: https://opensource.com/article/19/7/understanding-file-paths-and-how-use-them -[6]: https://opensource.com/article/19/7/navigating-filesystem-relative-paths -[7]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[8]: https://opensource.com/article/19/7/copying-files-linux -[9]: https://opensource.com/article/19/7/bash-aliases -[10]: https://opensource.com/article/18/5/gnu-parallel diff --git a/sources/tech/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md b/sources/tech/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md deleted file mode 100644 index 436dd84c37..0000000000 --- a/sources/tech/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Check Your IP Address in Ubuntu [Beginner’s Tip]) -[#]: via: (https://itsfoss.com/check-ip-address-ubuntu/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How To Check Your IP Address in Ubuntu [Beginner’s Tip] -====== - -Wonder what’s your IP address? Here are several ways to check IP address in Ubuntu and other Linux distributions. - -![][1] - -### What is an IP Address? - -An **Internet Protocol address** (commonly referred to as **IP address**) is a numerical label assigned to each device connected to a computer network (using the Internet Protocol). An IP address serves both the purpose of identification and localisation of a machine. - -The **IP address** is _unique_ within the network, allowing the communication between all connected devices. - -You should also know that there are two **types of IP addresses**: **public** and **private**. The **public IP address** is the address used to communicate over the Internet, the same way your physical address is used for postal mail. However, in the context of a local network (such as a home where are router is used), each device is assigned a **private IP address** unique within this sub-network. This is used inside this local network, without directly exposing the public IP (which is used by the router to communicate with the Internet). - -Another distinction can be made between **IPv4** and **IPv6** protocol. **IPv4** is the classic IP format,consisting of a basic 4 part structure, with four bytes separated by dots (e.g. 127.0.0.1). However, with the growing number of devices, IPv4 will soon be unable to offer enough addresses. This is why **IPv6** was invented, a format using **128-bit addresses** (compared to the **32-bit addresses** used by **IPv4**). - -## Checking your IP Address in Ubuntu [Terminal Method] - -The fastest and the simplest way to check your IP address is by using the ip command. You can use this command in the following fashion: - -``` -ip addr show -``` - -It will show you both IPv4 and IPv6 addresses: - -![Display IP Address in Ubuntu Linux][2] - -Actually, you can further shorten this command to just `ip a`. It will give you the exact same result. - -``` -ip a -``` - -If you prefer to get minimal details, you can also use **hostname**: - -``` -hostname -I -``` - -There are some other [ways to check IP address in Linux][3] but these two commands are more than enough to serve the purpose. - -[][4] - -Suggested read  How to Disable IPv6 on Ubuntu Linux - -What about ifconfig? - -Long-time users might be tempted to use ifconfig (part of net-tools), but that program is deprecated. Some newer Linux distributions don’t include this package anymore and if you try running it, you’ll see ifconfig command not found error. - -## Checking IP address in Ubuntu [GUI Method] - -If you are not comfortable with the command line, you can also check IP address graphically. - -Open up the Ubuntu Applications Menu (**Show Applications** in the bottom-left corner of the screen) and search for **Settings** and click on the icon: - -![Applications Menu Settings][5] - -This should open up the **Settings Menu**. Go to **Network**: - -![Network Settings Ubuntu][6] - -Pressing on the **gear icon** next to your connection should open up a window with more settings and information about your link to the network, including your IP address: - -![IP Address GUI Ubuntu][7] - -## Bonus Tip: Checking your Public IP Address (for desktop computers) - -First of all, to check your **public IP address** (used for communicating with servers etc.) you can [use curl command][8]. Open up a terminal and enter the following command: - -``` -curl ifconfig.me -``` - -This should simply return your IP address with no additional bulk information. I would recommend being careful when sharing this address, since it is the equivalent to giving out your personal address. - -**Note:** _If **curl** isn’t installed on your system, simply use **sudo apt install curl -y** to solve the problem, then try again._ - -Another simple way you can see your public IP address is by searching for **ip address** on Google. - -**Summary** - -In this article I went through the different ways you can find your IP address in Uuntu Linux, as well as giving you a basic overview of what IP addresses are used for and why they are so important for us. - -I hope you enjoyed this quick guide. Let us know if you found this explanation helpful in the comments section! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/check-ip-address-ubuntu/ - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/checking-ip-address-ubuntu.png?resize=800%2C450&ssl=1 -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_addr_show.png?fit=800%2C493&ssl=1 -[3]: https://linuxhandbook.com/find-ip-address/ -[4]: https://itsfoss.com/disable-ipv6-ubuntu-linux/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?fit=800%2C309&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/network_settings_ubuntu.jpg?fit=800%2C591&ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_address_gui_ubuntu.png?fit=800%2C510&ssl=1 -[8]: https://linuxhandbook.com/curl-command-examples/ diff --git a/sources/tech/20190823 How to Delete Lines from a File Using the sed Command.md b/sources/tech/20190823 How to Delete Lines from a File Using the sed Command.md deleted file mode 100644 index 4cec658e7d..0000000000 --- a/sources/tech/20190823 How to Delete Lines from a File Using the sed Command.md +++ /dev/null @@ -1,407 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hello-wn) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Delete Lines from a File Using the sed Command) -[#]: via: (https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How to Delete Lines from a File Using the sed Command -====== - -Sed command stands for Stream Editor, is used to perform basic text transformations in Linux. - -sed is one of the important command, which plays major role for file manipulation. It can be used to delete or remove specific lines which matches a given pattern. - -Also, it’s used to remove a particular line in a file. - -It’s capable to delete expressions as well from a file, which can be identified by a specifying delimiter (such as a comma, tab, or space). - -There are fifteen examples are listed in this article, which helps you to become a master in sed command. - -If you understand and remember all these commands that can be useful in many ways. Also, it saves lot of time when you have some requirements to perform sed command. - -**`Note:`**` ` Since it’s demonstration purpose so, i use sed command without `-i` option which prints the contents of the file on Linux terminal by removing the lines. - -But, if you would like to remove the lines from the source file in real environment then use `-i` option with sed command. - -To test this, i have created the sed-demo.txt file and added the following contents with line number for better understanding. - -``` -# cat sed-demo.txt - -1 Linux Operating System -2 Unix Operating System -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 1) How to Delete First Line from a File? - -If you would like to delete first line from a file, use the following syntax. - -**`N`**` ` denotes Nth line in a file and d option in sed command is used to delete a line. - -**Syntax:** - -``` -sed 'Nd' file -``` - -The below sed command removes the first line in sed-demo.txt file. - -``` -# sed '1d' sed-demo.txt - -2 Unix Operating System -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 2) How to Delete Last Line from a File? - -If you would like to delete first line from a file, use the following syntax. - -The **`$`**` ` denotes the last line of a file. - -The below sed command removes the last line in sed-demo.txt file. - -``` -# sed '$d' sed-demo.txt - -1 Linux Operating System -2 Unix Operating System -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -``` - -### 3) How to Delete Particular Line from a File? - -The below sed command removes the third line in sed-demo.txt file. - -``` -# sed '3d' sed-demo.txt - -1 Linux Operating System -2 Unix Operating System -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 4) How to Delete Range of Lines from a File? - -The below sed command removes the lines ranging from 5 to 7. - -``` -# sed '5,7d' sed-demo.txt - -1 Linux Operating System -2 Unix Operating System -3 RHEL -4 Red Hat -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 5) How to Delete Multiple Lines from a File? - -The sed command is capable to removes set of given lines. - -In this example, the following sed command removes 1st line, 5th line, 9th line, and last line. - -``` -# sed '1d;5d;9d;$d' sed-demo.txt - -2 Unix Operating System -3 RHEL -4 Red Hat -6 Arch Linux -7 CentOS -8 Debian -``` - -### 5a) How to Delete Lines Other Than the Specified Range from a File? - -Use the following sed command to remove all the lines from the file only except specified range. - -``` -# sed '3,6!d' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -``` - -### 6) How to Delete Empty or Blank Lines from a File? - -The following sed command removes the empty or blank lines from sed-demo.txt file. - -``` -# sed '/^$/d' sed-demo.txt - -1 Linux Operating System -2 Unix Operating System -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 7) How to Delete Lines That Contain a Pattern from a File? - -The following sed command removes the lines in sed-demo.txt file which match the **`System`**` ` pattern. - -``` -# sed '/System/d' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 8) How to Delete Lines That Containing One of Multiple Strings from a File? - -The following sed command removes the lines in sed-demo.txt file which match the **`System`**` ` or **`Linux`**` ` pattern. - -``` -# sed '/System\|Linux/d' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 9) How to Delete Lines That Begin with Specified Character from a File? - -The following sed command removes all the lines that start with given character. - -To test this, i have created another file called sed-demo-1.txt with following contents. - -``` -# cat sed-demo-1.txt - -Linux Operating System -Unix Operating System -RHEL -Red Hat -Fedora -debian -ubuntu -Arch Linux - 1 -2 - Manjaro -3 4 5 6 -``` - -The following sed command removes all the lines that start with character **`R`**` `. - -``` -# sed '/^R/d' sed-demo-1.txt - -Linux Operating System -Unix Operating System -Fedora -debian -ubuntu -Arch Linux - 1 -2 - Manjaro -3 4 5 6 -``` - -The following sed command removes all the lines that start with character either **`R`**` ` or **`F`**` `. - -``` -# sed '/^[RF]/d' sed-demo-1.txt - -Linux Operating System -Unix Operating System -debian -ubuntu -Arch Linux - 1 -2 - Manjaro -3 4 5 6 -``` - -### 10) How to Delete Lines That End with Specified Character from a File? - -The following sed command removes all the lines that end with character **`m`**` `. - -``` -# sed '/m$/d' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -The following sed command removes all the lines that end with character either **`x`**` ` or **`m`**` `. - -``` -# sed '/[xm]$/d' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 11) How to Delete All Lines That Start with Capital Letters - -Use the following sed command to remove all the lines that start with entirely in capital letters. - -``` -# sed '/^[A-Z]/d' sed-demo-1.txt - -debian -ubuntu -2 - Manjaro -3 4 5 6 -``` - -### 12) How to Delete a Matching Pattern Lines with Specified Range in a File? - -The below sed command removes the pattern **`Linux`**` ` only if it is present in the lines from 1 to 6. - -``` -# sed '1,6{/Linux/d;}' sed-demo.txt - -2 Unix Operating System -3 RHEL -4 Red Hat -5 Fedora -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 13) How to Delete Pattern Matching Line and also the Next Line? - -Use the following sed command to delete the line which containing the pattern ‘System’ and also the next line. - -``` -# sed '/System/{N;d;}' sed-demo.txt - -3 RHEL -4 Red Hat -5 Fedora -6 Arch Linux -7 CentOS -8 Debian -9 Ubuntu -10 openSUSE -``` - -### 14) How Delete lines that contains Digits from a File? - -The below sed command removes all the lines that contains digits. - -``` -# sed '/[0-9]/d' sed-demo-1.txt - -Linux Operating System -Unix Operating System -RHEL -Red Hat -Fedora -debian -ubuntu -``` - -The below sed command removes all the lines Begin with digits. - -``` -# sed '/^[0-9]/d' sed-demo-1.txt - -Linux Operating System -Unix Operating System -RHEL -Red Hat -Fedora -debian -ubuntu -Arch Linux - 1 -``` - -The below sed command removes all the lines End with digits. - -``` -# sed '/[0-9]$/d' sed-demo-1.txt - -Linux Operating System -Unix Operating System -RHEL -Red Hat -Fedora -debian -ubuntu -2 - Manjaro -``` - -### 15) How Delete lines that contains Alphabetic Characters from a File? - -The below sed command removes all the lines that contains alphabetic characters. - -``` -# sed '/[A-Za-z]/d' sed-demo-1.txt - -3 4 5 6 -``` --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/ - -作者:[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 diff --git a/sources/tech/20190823 Managing credentials with KeePassXC.md b/sources/tech/20190823 Managing credentials with KeePassXC.md deleted file mode 100644 index 9e48eceb3f..0000000000 --- a/sources/tech/20190823 Managing credentials with KeePassXC.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Managing credentials with KeePassXC) -[#]: via: (https://fedoramagazine.org/managing-credentials-with-keepassxc/) -[#]: author: (Marco Sarti https://fedoramagazine.org/author/msarti/) - -Managing credentials with KeePassXC -====== - -![][1] - -A [previous article][2] discussed password management tools that use server-side technology. These tools are very interesting and suitable for a cloud installation. -In this article we will talk about KeePassXC, a simple multi-platform open source software that uses a local file as a database. -The main advantage of this type of password management is simplicity. No server-side technology expertise is required and can therefore be used by any type of user. - -### Introducing KeePassXC - -KeePassXC is an open source cross platform password manager: its development started as a fork of KeePassX, a good product but with a not very active development. It saves the secrets in an encrypted database with AES algorithm using 256 bit key, this makes it reasonably safe to save the database in a cloud drive storage such as pCloud or Dropbox. - -In addition to the passwords, KeePassXC allows you to save various information and attachments in the encrypted wallet. It also has a valid password generator that helps the user to correctly manage his credentials. - -### Installation - -The program is available both in the standard Fedora repository and in the Flathub repository. Unfortunately the integration with the browser does not work with the application running in the sandbox, so I suggest to install the program via dnf: -``` - -``` - -sudo dnf install keepassxc -``` - -``` - -### Creating your wallet - -To create a new database there are two important steps: - - * Choose the encryption settings: the default settings are reasonably safe, increasing the transform rounds also increases the decryption time. - * Choose the master key and additional protections: the master key must be easy to remember (if you lose it your wallet is lost!) but strong enough, a passphrase with at least 4 random words can be a good choice. As additional protection you can choose a key file (remember: you must always have it available otherwise you cannot open the wallet) and / or a YubiKey hardware key. - - - -![][3] - -![][4] - -The database file will be saved to the file system. If you want to share with other computers / devices you can save it on a USB key or in a cloud storage like pCloud or Dropbox. Of course, if you choose a cloud storage, a particularly strong master password is recommended, better if accompanied by additional protection. - -### Creating your first entry - -Once the database has been created, you can start creating your first entry. For a web login specify a username, password and url in the Entry tab. Optionally you can specify an expiration date for the credentials based on your personal policy: also by pressing the button on the right the favicon of the site is downloaded and associated as an icon of the entry, this is a nice feature. - -![][5] - -![][6] - -KeePassXC also offers a good password / passphrase generator, you can choose length and complexity and check the degree of resistance to a brute force attack: - -![][7] - -### Browser integration - -KeePassXC has an extension available for all major browsers. The extension allows you to fill in the login information for all the entries whose URL is specified. - -Browser integration must be enabled on KeePassXC (Tools menu -> Settings) specifying which browsers you intend to use: - -![][8] - -Once the extension is installed, it is necessary to create a connection with the database. To do this, press the extension button and then the Connect button: if the database is open and unlocked the extension will create an association key and save it in the database, the key is unique to the browser so I suggest naming it appropriately : - -![][9] - -When you reach the login page specified in the Url field and the database is unlocked, the extension will offer you all the credentials you have associated with that page: - -![][10] - -In this way, browsing with KeePassXC running you will have your internet credentials available without necessarily saving them in the browser. - -### SSH agent integration - -Another interesting feature of KeePassXC is the integration with SSH. If you have ssh-agent running KeePassXC is able to interact and add the ssh keys that you have uploaded as attachments to your entries. - -First of all in the general settings (Tools menu -> Settings) you have to enable the ssh agent and restart the program: - -![][11] - -At this point it is required to upload your ssh key pair as an attachment to your entry. Then in the “SSH agent” tab select the private key in the attachment drop-down list, the public key will be populated automatically. Don’t forget to select the two checkboxes above to allow the key to be added to the agent when the database is opened / unlocked and removed when the database is closed / locked: - -![][12] - -Now with the database open and unlocked you can log in ssh using the keys saved in your wallet. - -The only limitation is in the maximum number of keys that can be added to the agent: ssh servers do not accept by default more than 5 login attempts, for security reasons it is not recommended to increase this value. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/managing-credentials-with-keepassxc/ - -作者:[Marco Sarti][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/msarti/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/keepassxc-816x345.png -[2]: https://fedoramagazine.org/manage-your-passwords-with-bitwarden-and-podman/ -[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-33-27.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-48-21.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-30-07.png -[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-43-11.png -[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-49-22.png -[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-48-09.png -[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-05-57.png -[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-13-29.png -[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-47-21.png -[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-46-35.png diff --git a/sources/tech/20190823 The Linux kernel- Top 5 innovations.md b/sources/tech/20190823 The Linux kernel- Top 5 innovations.md deleted file mode 100644 index 95e35bc309..0000000000 --- a/sources/tech/20190823 The Linux kernel- Top 5 innovations.md +++ /dev/null @@ -1,105 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Linux kernel: Top 5 innovations) -[#]: via: (https://opensource.com/article/19/8/linux-kernel-top-5-innovations) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/mhaydenhttps://opensource.com/users/mralexjuarez) - -The Linux kernel: Top 5 innovations -====== -Want to know what the actual (not buzzword) innovations are when it -comes to the Linux kernel? Read on. -![Penguin with green background][1] - -The word _innovation_ gets bandied about in the tech industry almost as much as _revolution_, so it can be difficult to differentiate hyperbole from something that’s actually exciting. The Linux kernel has been called innovative, but then again it’s also been called the biggest hack in modern computing, a monolith in a micro world. - -Setting aside marketing and modeling, Linux is arguably the most popular kernel of the open source world, and it’s introduced some real game-changers over its nearly 30-year life span. - -### Cgroups (2.6.24) - -Back in 2007, Paul Menage and Rohit Seth got the esoteric [_control groups_ (cgroups)][2] feature added to the kernel (the current implementation of cgroups is a rewrite by Tejun Heo.) This new technology was initially used as a way to ensure, essentially, quality of service for a specific set of tasks. - -For example, you could create a control group definition (cgroup) for all tasks associated with your web server, another cgroup for routine backups, and yet another for general operating system requirements. You could then control a percentage of resources for each cgroup, such that your OS and web server gets the bulk of system resources while your backup processes have access to whatever is left. - -What cgroups has become most famous for, though, is its role as the technology driving the cloud today: containers. In fact, cgroups were originally named [process containers][3]. It was no great surprise when they were adopted by projects like [LXC][4], [CoreOS][5], and Docker. - -The floodgates being opened, the term _containers_ justly became synonymous with Linux, and the concept of microservice-style cloud-based “apps” quickly became the norm. These days, it’s hard to get away from cgroups, they’re so prevalent. Every large-scale infrastructure (and probably your laptop, if you run Linux) takes advantage of cgroups in a meaningful way, making your computing experience more manageable and more flexible than ever. - -For example, you might already have installed [Flathub][6] or [Flatpak][7] on your computer, or maybe you’ve started using [Kubernetes][8] and/or [OpenShift][9] at work. Regardless, if the term “containers” is still hazy for you, you can gain a hands-on understanding of containers from [Behind the scenes with Linux containers][10]. - -### LKMM (4.17) - -In 2018, the hard work of Jade Alglave, Alan Stern, Andrea Parri, Luc Maranget, Paul McKenney, and several others, got merged into the mainline Linux kernel to provide formal memory models. The Linux Kernel Memory [Consistency] Model (LKMM) subsystem is a set of tools describing the Linux memory coherency model, as well as producing _litmus tests_ (**klitmus**, specifically) for testing. - -As systems become more complex in physical design (more CPU cores added, cache and RAM grow, and so on), the harder it is for them to know which address space is required by which CPU, and when. For example, if CPU0 needs to write data to a shared variable in memory, and CPU1 needs to read that value, then CPU0 must write before CPU1 attempts to read. Similarly, if values are written in one order to memory, then there’s an expectation that they are also read in that same order, regardless of which CPU or CPUs are doing the reading. - -Even on a single CPU, memory management requires a specific task order. A simple action such as **x = y** requires a CPU to load the value of **y** from memory, and then store that value in **x**. Placing the value stored in **y** into the **x** variable cannot occur _before_ the CPU has read the value from memory. There are also address dependencies: **x[n] = 6** requires that **n** is loaded before the CPU can store the value of six. - -LKMM helps identify and trace these memory patterns in code. It does this in part with a tool called **herd**, which defines the constraints imposed by a memory model (in the form of logical axioms), and then enumerates all possible outcomes consistent with these constraints. - -### Low-latency patch (2.6.38) - -Long ago, in the days before 2011, if you wanted to do "serious" [multimedia work on Linux][11], you had to obtain a low-latency kernel. This mostly applied to [audio recording][12] while adding lots of real-time effects (such as singing into a microphone and adding reverb, and hearing your voice in your headset with no noticeable delay). There were distributions, such as [Ubuntu Studio][13], that reliably provided such a kernel, so in practice it wasn't much of a hurdle, just a significant caveat when choosing your distribution as an artist. - -However, if you weren’t using Ubuntu Studio, or you had some need to update your kernel before your distribution got around to it, you had to go to the rt-patches web page, download the kernel patches, apply them to your kernel source code, compile, and install manually. - -And then, with the release of kernel version 2.6.38, this process was all over. The Linux kernel suddenly, as if by magic, had low-latency code (according to benchmarks, latency decreased by a factor of 10, at least) built-in by default. No more downloading patches, no more compiling. Everything just worked, and all because of a small 200-line patch implemented by Mike Galbraith. - -For open source multimedia artists the world over, it was a game-changer. Things got so good from 2011 on that in 2016, I challenged myself to [build a Digital Audio Workstation (DAW) on a Raspberry Pi v1 (model B)][14] and found that it worked surprisingly well. - -### RCU (2.5) - -RCU, or Read-Copy-Update, is a system defined in computer science that allows multiple processor threads to read from shared memory. It does this by deferring updates, but also marking them as updated, to ensure that the data’s consumers read the latest version. Effectively, this means that reads happen concurrently with updates. - -The typical RCU cycle is a little like this: - - 1. Remove pointers to data to prevent other readers from referencing it. - 2. Wait for readers to complete their critical processes. - 3. Reclaim the memory space. - - - -Dividing the update stage into removal and reclamation phases means the updater performs the removal immediately while deferring reclamation until all active readers are complete (either by blocking them or by registering a callback to be invoked upon completion). - -While the concept of read-copy-update was not invented for the Linux kernel, its implementation in Linux is a defining example of the technology. - -### Collaboration (0.01) - -The final answer to the question of what the Linux kernel innovated will always be, above all else, collaboration. Call it good timing, call it technical superiority, call it hackability, or just call it open source, but the Linux kernel and the many projects that it enabled is a glowing example of collaboration and cooperation. - -And it goes well beyond just the kernel. People from all walks of life have contributed to open source, arguably _because_ of the Linux kernel. The Linux was, and remains to this day, a major force of [Free Software][15], inspiring users to bring their code, art, ideas, or just themselves, to a global, productive, and diverse community of humans. - -### What’s your favorite innovation? - -This list is biased toward my own interests: containers, non-uniform memory access (NUMA), and multimedia. I’ve surely left your favorite kernel innovation off the list. Tell me about it in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/linux-kernel-top-5-innovations - -作者:[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/sethhttps://opensource.com/users/mhaydenhttps://opensource.com/users/mralexjuarez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) -[2]: https://en.wikipedia.org/wiki/Cgroups -[3]: https://lkml.org/lkml/2006/10/20/251 -[4]: https://linuxcontainers.org -[5]: https://coreos.com/ -[6]: http://flathub.org -[7]: http://flatpak.org -[8]: http://kubernetes.io -[9]: https://www.redhat.com/sysadmin/learn-openshift-minishift -[10]: https://opensource.com/article/18/11/behind-scenes-linux-containers -[11]: http://slackermedia.info -[12]: https://opensource.com/article/17/6/qtractor-audio -[13]: http://ubuntustudio.org -[14]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker -[15]: http://fsf.org diff --git a/sources/tech/20190823 The lifecycle of Linux kernel testing.md b/sources/tech/20190823 The lifecycle of Linux kernel testing.md deleted file mode 100644 index 65bab32536..0000000000 --- a/sources/tech/20190823 The lifecycle of Linux kernel testing.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The lifecycle of Linux kernel testing) -[#]: via: (https://opensource.com/article/19/8/linux-kernel-testing) -[#]: author: (Major Hayden https://opensource.com/users/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden) - -The lifecycle of Linux kernel testing -====== -The Continuous Kernel Integration (CKI) project aims to prevent bugs -from entering the Linux kernel. -![arrows cycle symbol for failing faster][1] - -In _[Continuous integration testing for the Linux kernel][2]_, I wrote about the [Continuous Kernel Integration][3] (CKI) project and its mission to change how kernel developers and maintainers work. This article is a deep dive into some of the more technical aspects of the project and how all the pieces fit together. - -### It all starts with a change - -Every exciting feature, improvement, and bug in the kernel starts with a change proposed by a developer. These changes appear on myriad mailing lists for different kernel repositories. Some repositories focus on certain subsystems in the kernel, such as storage or networking, while others focus on broad aspects of the kernel. The CKI project springs into action when developers propose a change, or patchset, to the kernel or when a maintainer makes changes in the repository itself. - -The CKI project maintains triggers that monitor these patchsets and take action. Software projects such as [Patchwork][4] make this process much easier by collating multi-patch contributions into a single patch series. This series travels as a unit through the CKI system and allows for publishing a single report on the series. - -Other triggers watch the repository for changes. This occurs when kernel maintainers merge patchsets, revert patches, or create new tags. Testing these critical changes ensures that developers always have a solid baseline to use as a foundation for writing new patches. - -All of these changes make their way into a GitLab pipeline and pass through multiple stages and multiple systems. - -### Prepare the build - -Everything starts with getting the source ready for compile time. This requires cloning the repository, applying the patchset proposed by the developer, and generating a kernel config file. These config files have thousands of options that turn features on or off, and config files differ incredibly between different system architectures. For example, a fairly standard x86_64 system may have a ton of options available in its config file, but an s390x system (IBM zSeries mainframes) likely has much fewer options. Some options might make sense on that mainframe but they have no purpose on a consumer laptop. - -The kernel moves forward and transforms into a source artifact. The artifact contains the entire repository, with patches applied, and all kernel configuration files required for compiling. Upstream kernels move on as a tarball, while Red Hat kernels become a source RPM for the next step. - -### Piles of compiles - -Compiling the kernel turns the source code into something that a computer can boot up and use. The config file describes what to build, scripts in the kernel describe how to build it, and tools on the system (like GCC and glibc) do the building. This process takes a while to complete, but the CKI project needs it done quickly for four architectures: aarch64 (64-bit ARM), ppc64le (POWER), s390x (IBM zSeries), and x86_64. It's important that we compile kernels quickly so that we keep our backlog manageable and developers receive prompt feedback. - -Adding more CPUs provides plenty of speed improvements, but every system has its limits. The CKI project compiles kernels within containers in an OpenShift deployment; although OpenShift allows for tons of scalability, the deployment still has a finite number of CPUs available. The CKI team allocates 20 virtual CPUs for compiling each kernel. With four architectures involved, this balloons to 80 CPUs! - -Another speed increase comes from a tool called [ccache][5]. Kernel development moves quickly, but a large amount of the kernel remains unchanged even between multiple releases. The ccache tool caches the built objects (small pieces of the overall kernel) during the compile on a disk. When another kernel compile comes along later, ccache looks for unchanged pieces of the kernel that it saw before. Ccache pulls the cached object from the disk and reuses it. This allows for faster compiles and lower overall CPU usage. Kernels that took 20 minutes to compile now race to the finish line in less than a few minutes. - -### Testing time - -The kernel moves onto its last step: testing on real hardware. Each kernel boots up on its native architecture using Beaker, and myriad tests begin poking it to find problems. Some tests look for simple problems, such as issues with containers or error messages on boot-up. Other tests dive deep into various kernel subsystems to find regressions in system calls, memory allocation, and threading. - -Large testing frameworks, such as the [Linux Test Project][6] (LTP), contain tons of tests that look for troublesome regressions in the kernel. Some of these regressions could roll back critical security fixes, and there are tests to ensure those improvements remain in the kernel. - -One critical step remains when tests finish: reporting. Kernel developers and maintainers need a concise report that tells them exactly what worked, what did not work, and how to get more information. Each CKI report contains details about the source code used, the compile parameters, and the testing output. That information helps developers know where to begin looking to fix an issue. Also, it helps maintainers know when a patchset needs to be held for another look before a bug makes its way into their kernel repository. - -### Summary - -The CKI project team strives to prevent bugs from entering the Linux kernel by providing timely, automated feedback to kernel developers and maintainers. This work makes their job easier by finding the low-hanging fruit that leads to kernel bugs, security issues, and performance problems. - -* * * - -_To learn more, you can attend the [CKI Hackfest][7] on September 12-13 following the [Linux Plumbers Conference][8] September 9-11 in Lisbon, Portugal._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/linux-kernel-testing - -作者:[Major Hayden][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/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) -[2]: https://opensource.com/article/19/6/continuous-kernel-integration-linux -[3]: https://cki-project.org/ -[4]: https://github.com/getpatchwork/patchwork -[5]: https://ccache.dev/ -[6]: https://linux-test-project.github.io -[7]: https://cki-project.org/posts/hackfest-agenda/ -[8]: https://www.linuxplumbersconf.org/ diff --git a/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md b/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md deleted file mode 100644 index 0740c0b3a0..0000000000 --- a/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md +++ /dev/null @@ -1,225 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to compile a Linux kernel in the 21st century) -[#]: via: (https://opensource.com/article/19/8/linux-kernel-21st-century) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) - -How to compile a Linux kernel in the 21st century -====== -You don't have to compile the Linux kernel but you can with this quick -tutorial. -![and old computer and a new computer, representing migration to new software or hardware][1] - -In computing, a kernel is the low-level software that handles communication with hardware and general system coordination. Aside from some initial firmware built into your computer's motherboard, when you start your computer, the kernel is what provides awareness that it has a hard drive and a screen and a keyboard and a network card. It's also the kernel's job to ensure equal time (more or less) is given to each component so that your graphics and audio and filesystem and network all run smoothly, even though they're running concurrently. - -The quest for hardware support, however, is ongoing, because the more hardware that gets released, the more stuff a kernel must adopt into its code to make the hardware work as expected. It's difficult to get accurate numbers, but the Linux kernel is certainly among the top kernels for hardware compatibility. Linux operates innumerable computers and mobile phones, embedded system on a chip (SoC) boards for hobbyist and industrial uses, RAID cards, sewing machines, and much more. - -Back in the 20th century (and even in the early years of the 21st), it was not unreasonable for a Linux user to expect that when they purchased a very new piece of hardware, they would need to download the very latest kernel source code, compile it, and install it so that they could get support for the device. Lately, though, you'd be hard-pressed to find a Linux user who compiles their own kernel except for fun or profit by way of highly specialized custom hardware. It generally isn't required these days to compile the Linux kernel yourself. - -Here are the reasons why, plus a quick tutorial on how to compile a kernel when you need to. - -### Update your existing kernel - -Whether you've got a brand new laptop featuring a fancy new graphics card or WiFi chipset or you've just brought home a new printer, your operating system (called either GNU+Linux or just Linux, which is also the name of the kernel) needs a driver to open communication channels to that new component (graphics card, WiFi chip, printer, or whatever). It can be deceptive, sometimes, when you plug in a new device and your computer _appears_ to acknowledge it. But don't let that fool you. Sometimes that _is_ all you need, but other times your OS is just using generic protocols to probe a device that's attached. - -For instance, your computer may be able to identify your new network printer, but sometimes that's only because the network card in the printer is programmed to identify itself to a network so it can gain a DHCP address. It doesn't necessarily mean that your computer knows what instructions to send to the printer to produce a page of printed text. In fact, you might argue that the computer doesn't even really "know" that the device is a printer; it may only display that there's a device on the network at a specific address and the device identifies itself with the series of characters _p-r-i-n-t-e-r_. The conventions of human language are meaningless to a computer; what it needs is a driver. - -Kernel developers, hardware manufacturers, support technicians, and hobbyists all know that new hardware is constantly being released. Many of them contribute drivers, submitted straight to the kernel development team for inclusion in Linux. For example, Nvidia graphic card drivers are often written into the [Nouveau][2] kernel module and, because Nvidia cards are common, the code is usually included in any kernel distributed for general use (such as the kernel you get when you download [Fedora][3] or [Ubuntu][4]. Where Nvidia is less common, for instance in embedded systems, the Nouveau module is usually excluded. Similar modules exist for many other devices: printers benefit from [Foomatic][5] and [CUPS][6], wireless cards have [b43, ath9k, wl][7] modules, and so on. - -Distributions tend to include as much as they reasonably can in their Linux kernel builds because they want you to be able to attach a device and start using it immediately, with no driver installation required. For the most part, that's what happens, especially now that many device vendors are now funding Linux driver development for the hardware they sell and submitting those drivers directly to the kernel team for general distribution. - -Sometimes, however, you're running a kernel you installed six months ago with an exciting new device that just hit the stores a week ago. In that case, your kernel may not have a driver for that device. The good news is that very often, a driver for that device may exist in a very recent edition of the kernel, meaning that all you have to do is update what you're running. - -Generally, this is done through a package manager. For instance, on RHEL, CentOS, and Fedora: - - -``` -`$ sudo dnf update kernel` -``` - -On Debian and Ubuntu, first get your current kernel version: - - -``` -$ uname -r -4.4.186 -``` - -Search for newer versions: - - -``` -$ sudo apt update -$ sudo apt search linux-image -``` - -Install the latest version you find. In this example, the latest available is 5.2.4: - - -``` -`$ sudo apt install linux-image-5.2.4` -``` - -After a kernel upgrade, you must [reboot][8] (unless you're using kpatch or kgraft). Then, if the device driver you need is in the latest kernel, your hardware will work as expected. - -### Install a kernel module - -Sometimes a distribution doesn't expect that its users often use a device (or at least not enough that the device driver needs to be in the Linux kernel). Linux takes a modular approach to drivers, so distributions can ship separate driver packages that can be loaded by the kernel even though the driver isn't compiled into the kernel itself. This is useful, although it can get complicated when a driver isn't included in a kernel but is needed during boot, or when the kernel gets updated out from under the modular driver. The first problem is solved with an **initrd** (initial RAM disk) and is out of scope for this article, and the second is solved by a system called **kmod**. - -The kmod system ensures that when a kernel is updated, all modular drivers installed alongside it are also updated. If you install a driver manually, you miss out on the automation that kmod provides, so you should opt for a kmod package whenever it is available. For instance, while Nvidia drivers are built into the kernel as the Nouveau driver, the official Nvidia drivers are distributed only by Nvidia. You can install Nvidia-branded drivers manually by going to the website, downloading the **.run** file, and running the shell script it provides, but you must repeat that same process after you install a new kernel, because nothing tells your package manager that you manually installed a kernel driver. Because Nvidia drives your graphics, updating the Nvidia driver manually usually means you have to perform the update from a terminal, because you have no graphics without a functional graphics driver. - -![Nvidia configuration application][9] - -However, if you install the Nvidia drivers as a kmod package, updating your kernel also updates your Nvidia driver. On Fedora and related: - - -``` -`$ sudo dnf install kmod-nvidia` -``` - -On Debian and related: - - -``` -$ sudo apt update -$ sudo apt install nvidia-kernel-common nvidia-kernel-dkms nvidia-glx nvidia-xconfig nvidia-settings nvidia-vdpau-driver vdpau-va-driver -``` - -This is only an example, but if you're installing Nvidia drivers in real life, you must also blacklist the Nouveau driver. See your distribution's documentation for the best steps. - -### Download and install a driver - -Not everything is included in the kernel, and not everything _else_ is available as a kernel module. In some cases, you have to download a special driver written and bundled by the hardware vendor, and other times, you have the driver but not the frontend to configure driver options. - -Two common examples are HP printers and [Wacom][10] illustration tablets. If you get an HP printer, you probably have generic drivers that can communicate with your printer. You might even be able to print. But the generic driver may not be able to provide specialized options specific to your model, such as double-sided printing, collation, paper tray choices, and so on. [HPLIP][11] (the HP Linux Imaging and Printing system) provides options to manage jobs, adjust printing options, select paper trays where applicable, and so on. - -HPLIP is usually bundled in package managers; just search for "hplip." - -![HPLIP in action][12] - -Similarly, drivers for Wacom tablets, the leading illustration tablet for digital artists, are usually included in your kernel, but options to fine-tune settings, such as pressure sensitivity and button functionality, are only accessible through the graphical control panel included by default with GNOME but installable as the extra package **kde-config-tablet** on KDE. - -There are likely some edge cases that don't have drivers in the kernel but offer kmod versions of driver modules as an RPM or DEB file that you can download and install through your package manager. - -### Patching and compiling your own kernel - -Even in the futuristic utopia that is the 21st century, there are vendors that don't understand open source enough to provide installable drivers. Sometimes, such companies provide source code for a driver but expect you to download the code, patch a kernel, compile, and install manually. - -This kind of distribution model has the same disadvantages as installing packaged drivers outside of the kmod system: an update to your kernel breaks the driver because it must be re-integrated into your kernel manually each time the kernel is swapped out for a new one. - -This has become rare, happily, because the Linux kernel team has done an excellent job of pleading loudly for companies to communicate with them, and because companies are finally accepting that open source isn't going away any time soon. But there are still novelty or hyper-specialized devices out there that provide only kernel patches. - -Officially, there are distribution-specific preferences for how you should compile a kernel to keep your package manager involved in upgrading such a vital part of your system. There are too many package managers to cover each; as an example, here is what happens behind the scenes when you use tools like **rpmdev** on Fedora or **build-essential** and **devscripts** on Debian. - -First, as usual, find out which kernel version you're running: - - -``` -`$ uname -r` -``` - -In most cases, it's safe to upgrade your kernel if you haven't already. After all, it's possible that your problem will be solved in the latest release. If you tried that and it didn't work, then you should download the source code of the kernel you are running. Most distributions provide a special command for that, but to do it manually, you can find the source code on [kernel.org][13]. - -You also must download whatever patch you need for your kernel. Sometimes, these patches are specific to the kernel release, so choose carefully. - -It's traditional, or at least it was back when people regularly compiled their own kernels, to place the source code and patches in **/usr/src/linux**. - -Unarchive the kernel source and the patch files as needed: - - -``` -$ cd /usr/src/linux -$ bzip2 --decompress linux-5.2.4.tar.bz2 -$ cd  linux-5.2.4 -$ bzip2 -d ../patch*bz2 -``` - -The patch file may have instructions on how to do the patch, but often they're designed to be executed from the top level of your tree: - - -``` -`$ patch -p1 < patch*example.patch` -``` - -Once the kernel code is patched, you can use your old configuration to prepare the patched kernel config: - - -``` -`$ make oldconfig` -``` - -The **make oldconfig** command serves two purposes: it inherits your current kernel's configuration, and it allows you to configure new options introduced by the patch. - -You may need to run the **make menuconfig** command, which launches an ncurses-based, menu-driven list of possible options for your new kernel. The menu can be overwhelming, but since it starts with your old config as a foundation, you can look through the menu and disable modules for hardware that you know you do not have and do not anticipate needing. Alternately, if you know that you have some piece of hardware and see it is not included in your current configuration, you may choose to build it, either as a module or directly into the kernel. In theory, this isn't necessary because presumably, your current kernel was treating you well but for the missing patch, and probably the patch you applied has activated all the necessary options required by whatever device prompted you to patch your kernel in the first place. - -Next, compile the kernel and its modules: - - -``` -$ make bzImage -$ make modules -``` - -This leaves you with a file named **vmlinuz**, which is a compressed version of your bootable kernel. Save your old version and place the new one in your **/boot** directory: - - -``` -$ sudo mv /boot/vmlinuz /boot/vmlinuz.nopatch -$ sudo cat arch/x86_64/boot/bzImage > /boot/vmlinuz -$ sudo mv /boot/System.map /boot/System.map.stock -$ sudo cp System.map /boot/System.map -``` - -So far, you've patched and built a kernel and its modules, you've installed the kernel, but you haven't installed any modules. That's the final build step: - - -``` -`$ sudo make modules_install` -``` - -The new kernel is in place, and its modules are installed. - -The final step is to update your bootloader so that the part of your computer that loads before the kernel knows where to find Linux. The GRUB bootloader makes this process relatively simple: - - -``` -`$ sudo grub2-mkconfig` -``` - -### Real-world compiling - -Of course, nobody runs those manual commands now. Instead, refer to your distribution for instructions on modifying a kernel using the developer toolset that your distribution's maintainers use. This toolset will probably create a new installable package with all the patches incorporated, alert the package manager of the upgrade, and update your bootloader for you. - -### Kernels - -Operating systems and kernels are mysterious things, but it doesn't take much to understand what components they're built upon. The next time you get a piece of tech that appears to not work on Linux, take a deep breath, investigate driver availability, and go with the path of least resistance. Linux is easier than ever—and that includes the kernel. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/linux-kernel-21st-century - -作者:[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/sethhttps://opensource.com/users/greg-p -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) -[2]: https://nouveau.freedesktop.org/wiki/ -[3]: http://fedoraproject.org -[4]: http://ubuntu.com -[5]: https://wiki.linuxfoundation.org/openprinting/database/foomatic -[6]: https://www.cups.org/ -[7]: https://wireless.wiki.kernel.org/en/users/drivers -[8]: https://opensource.com/article/19/7/reboot-linux -[9]: https://opensource.com/sites/default/files/uploads/nvidia.jpg (Nvidia configuration application) -[10]: https://linuxwacom.github.io -[11]: https://developers.hp.com/hp-linux-imaging-and-printing -[12]: https://opensource.com/sites/default/files/uploads/hplip.jpg (HPLIP in action) -[13]: https://www.kernel.org/ diff --git a/sources/tech/20190826 How RPM packages are made- the source RPM.md b/sources/tech/20190826 How RPM packages are made- the source RPM.md new file mode 100644 index 0000000000..4629db3580 --- /dev/null +++ b/sources/tech/20190826 How RPM packages are made- the source RPM.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the source RPM) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +How RPM packages are made: the source RPM +====== + +![][1] + +In a [previous post, we looked at what RPM packages are][2]. They are archives that contain files and metadata. This metadata tells RPM where to create or remove files from when an RPM is installed or uninstalled. The metadata also contains information on “dependencies”, which you will remember from the previous post, can either be “runtime” or “build time”. + +As an example, we will look at _fpaste_. You can download the RPM using _dnf_. This will download the latest version of _fpaste_ that is available in the Fedora repositories. On Fedora 30, this is currently 0.3.9.2: + +``` +$ dnf download fpaste + +... +fpaste-0.3.9.2-2.fc30.noarch.rpm +``` + +Since this is the built RPM, it contains only files needed to use _fpaste_: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.noarch.rpm +/usr/bin/fpaste +/usr/share/doc/fpaste +/usr/share/doc/fpaste/README.rst +/usr/share/doc/fpaste/TODO +/usr/share/licenses/fpaste +/usr/share/licenses/fpaste/COPYING +/usr/share/man/man1/fpaste.1.gz +``` + +### Source RPMs + +The next link in the chain is the source RPM. All software in Fedora must be built from its source code. We do not include pre-built binaries. So, for an RPM file to be made, RPM (the tool) needs to be: + + * given the files that have to be installed, + * told how to generate these files, if they are to be compiled, for example, + * told where these files must be installed, + * what other dependencies this particular software needs to work properly. + + + +The source RPM holds all of this information. Source RPMs are similar archives to RPM, but as the name suggests, instead of holding the built binary files, they contain the source files for a piece of software. Let’s download the source RPM for _fpaste_: + +``` +$ dnf download fpaste --source +... +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +Notice how the file ends with “src.rpm”. All RPMs are built from source RPMs. You can easily check what source RPM a “binary” RPM comes from using dnf too: + +``` +$ dnf repoquery --qf "%{SOURCERPM}" fpaste +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +Also, since this is the source RPM, it does not contain built files. Instead, it contains the sources and instructions on how to build the RPM from them: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +Here, the first file is simply the source code for _fpaste_. The second is the “spec” file. The spec file is the recipe that tells RPM (the tool) how to create the RPM (the archive) using the sources contained in the source RPM—all the information that RPM (the tool) needs to build RPMs (the archives) are contained in spec files. When we package maintainers add software to Fedora, most of our time is spent writing and perfecting the individual spec files. When a software package needs an update, we go back and tweak the spec file. You can see the spec files for ALL packages in Fedora at our source repository at + +Note that one source RPM may contain the instructions to build multiple RPMs. _fpaste_ is a very simple piece of software, where one source RPM generates one “binary” RPM. Python, on the other hand is more complex. While there is only one source RPM, it generates multiple binary RPMs: + +``` +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3 +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-devel +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-libs +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-idle +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-tkinter +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm +``` + +In RPM jargon, “python3” is the “main package”, and so the spec file will be called “python3.spec”. All the other packages are “sub-packages”. You can download the source RPM for python3 and see what’s in it too. (Hint: patches are also part of the source code): + +``` +$ dnf download --source python3 +python3-3.7.4-1.fc30.src.rpm + +$ rpm -qpl ./python3-3.7.4-1.fc30.src.rpm +00001-rpath.patch +00102-lib64.patch +00111-no-static-lib.patch +00155-avoid-ctypes-thunks.patch +00170-gc-assertions.patch +00178-dont-duplicate-flags-in-sysconfig.patch +00189-use-rpm-wheels.patch +00205-make-libpl-respect-lib64.patch +00251-change-user-install-location.patch +00274-fix-arch-names.patch +00316-mark-bdist_wininst-unsupported.patch +Python-3.7.4.tar.xz +check-pyc-timestamps.py +idle3.appdata.xml +idle3.desktop +python3.spec +``` + +### Building an RPM from a source RPM + +Now that we have the source RPM, and know what’s in it, we can rebuild our RPM from it. Before we do so, though, we should set our system up to build RPMs. First, we install the required tools: + +``` +$ sudo dnf install fedora-packager +``` + +This will install the rpmbuild tool. rpmbuild requires a default layout so that it knows where each required component of the source rpm is. Let’s see what they are: + +``` +# Where should the spec file go? +$ rpm -E %{_specdir} +/home/asinha/rpmbuild/SPECS + +# Where should the sources go? +$ rpm -E %{_sourcedir} +/home/asinha/rpmbuild/SOURCES + +# Where is temporary build directory? +$ rpm -E %{_builddir} +/home/asinha/rpmbuild/BUILD + +# Where is the buildroot? +$ rpm -E %{_buildrootdir} +/home/asinha/rpmbuild/BUILDROOT + +# Where will the source rpms be? +$ rpm -E %{_srcrpmdir} +/home/asinha/rpmbuild/SRPMS + +# Where will the built rpms be? +$ rpm -E %{_rpmdir} +/home/asinha/rpmbuild/RPMS +``` + +I have all of this set up on my system already: + +``` +$ cd +$ tree -L 1 rpmbuild/ +rpmbuild/ +├── BUILD +├── BUILDROOT +├── RPMS +├── SOURCES +├── SPECS +└── SRPMS + +6 directories, 0 files +``` + +RPM provides a tool that sets it all up for you too: + +``` +$ rpmdev-setuptree +``` + +Then we ensure that we have all the build dependencies for _fpaste_ installed: + +``` +sudo dnf builddep fpaste-0.3.9.2-3.fc30.src.rpm +``` + +For _fpaste_ you only need Python and that must already be installed on your system (dnf uses Python too). The builddep command can also be given a spec file instead of an source RPM. Read more in the man page: + +``` +$ man dnf.plugin.builddep +``` + +Now that we have all that we need, building an RPM from a source RPM is as simple as: + +``` +$ rpmbuild --rebuild fpaste-0.3.9.2-3.fc30.src.rpm +.. +.. + +$ tree ~/rpmbuild/RPMS/noarch/ +/home/asinha/rpmbuild/RPMS/noarch/ +└── fpaste-0.3.9.2-3.fc30.noarch.rpm + +0 directories, 1 file +``` + +rpmbuild will install the source RPM and build your RPM from it. You can now install the RPM to use it as you do–using dnf. Of course, as said before, if you want to change anything in the RPM, you must modify the spec file—we’ll cover spec files in next post. + +### Summary + +To summarise this post in two short points: + + * the RPMs we generally install to use software are “binary” RPMs that contain built versions of the software + * these are built from source RPMs that include the source code and the spec file that are needed to generate the binary RPMs. + + + +If you’d like to get started with building RPMs, and help the Fedora community maintain the massive amount of software we provide, you can start here: + +For any queries, post to the [Fedora developers mailing list][3]—we’re always happy to help! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://fedoramagazine.org/rpm-packages-explained/ +[3]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/sources/tech/20190826 Using variables in Bash.md b/sources/tech/20190826 Using variables in Bash.md new file mode 100644 index 0000000000..51959ef2ad --- /dev/null +++ b/sources/tech/20190826 Using variables in Bash.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using variables in Bash) +[#]: via: (https://opensource.com/article/19/8/using-variables-bash) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jpnc) + +Using variables in Bash +====== +Take advantage of Bash variables with our miniseries: Variables in +shells. +![bash logo on green background][1] + +In computer science (and casual computing), a variable is a location in memory that holds arbitrary information for later use. In other words, it’s a temporary storage container for you to put data into and get data out of. In the Bash shell, that data can be a word (a _string_, in computer lingo) or a number (an _integer_). + +You may have never (knowingly) used a variable before on your computer, but you probably have used a variable in other areas of your life. When you say things like "give me that" or "look at this," you’re using grammatical variables (you think of them as _pronouns_), because the meaning of "this" and "that" depends on whatever you’re picturing in your mind, or whatever you’re pointing to so your audience knows what you’re referring to. When you do math, you use variables to stand in for an unknown value, even though you probably don’t call it a variable. + +Here’s a quick and easy demonstration of a Bash variable you may not realize you use every day. The **PS1** variable holds information about how you want your terminal prompt to appear. For instance, you can set it to something very simple—like a percent sign (**%**)—by redefining the **PS1** variable: + + +``` +$ PS1="% " +% +``` + +This article addresses variables in a Bash shell running on Linux, BSD, Mac, or Cygwin. Users of Microsoft’s open source [PowerShell][2] should refer to my article about [variables in PowerShell][3]. + +### What are variables for? + +Whether you need variables in Bash depends on what you do in a terminal. For some users, variables are an essential means of managing data, while for others they’re minor and temporary conveniences, and for still others, they may as well not exist. + +Ultimately, variables are a tool. You can use them when you find a use for them, or leave them alone in the comfort of knowing they’re managed by your OS. Knowledge is power, though, and understanding how variables work in Bash can lead you to all kinds of unexpected creative problem-solving. + +### How to set a variable + +You don’t need special permissions to create a variable. They’re free to create, free to use, and generally harmless. In a Bash shell (on Linux and Mac), you can set them by defining a variable name, and then setting its value. The following example creates a new variable called **FOO** and sets the value to the string **/home/seth/Documents**: + + +``` +`$ declare FOO="/home/seth/Documents"` +``` + +Success is eerily silent, so you may not feel confident that your variable got set. You can see the results for yourself with the **echo command**, recalling your variable by prepending it with a dollar sign (**$**). To ensure that the variable is read exactly as you defined it, you can also wrap it in braces and quotes. Doing this preserves any special characters that might appear in the variable; in this example, that doesn’t apply, but it’s still a good habit to form: + + +``` +$ echo "${FOO}" +/home/seth/Documents +``` + +Setting variables can be a common thing for people who use the shell often, so the process has become somewhat informal. When a string is followed by an equal sign (**=**) and a value, Bash quietly assumes that you’re setting a variable, making the **declare** keyword unnecessary: + + +``` +`$ FOO="/home/seth/Documents"` +``` + +Variables usually are meant to convey information from one system to another. In this simple example, your variable is not very useful, but it can still communicate information. For instance, because the content of the **FOO** variable is a [file path][4], you can use the variable as a shortcut to the **~/Documents** directory: + + +``` +$ pwd +/home/seth +$ cd "${FOO}" +$ pwd +/home/seth/Documents +``` + +Variables can be any non-reserved string (along with integers and underscores). They don't have to be capitalized, but they often are so that they're easy to identify as variables. + +### How to clear a variable + +You can clear a variable with the **unset** command: + + +``` +$ unset FOO +$ echo $FOO +``` + +In practice, this action is not usually necessary. Variables are relatively "cheap," so you can create them and then forget them when you don’t need them anymore. However, there may be times you want to ensure a variable is empty to avoid conveying incorrect information to another process that might read the variable. + +### Create a new variable with collision protection + +Sometimes, you may have reason to believe a variable was already set by you or a process. If you would rather not override it, there’s a special syntax to set a variable to its existing value unless its existing value is empty. + +For this example, assume that **FOO** is set to **/home/seth/Documents**: + + +``` +$ FOO=${FOO:-"bar"} +$ echo $FOO +/home/seth/Documents +``` + +The colon-dash **:-** notation causes **declare** to default to an existing value. To see this process work the other way, clear the variable, and try again: + + +``` +$ unset FOO +$ echo $FOO + +$ FOO=${FOO:-"bar"} +$ echo $FOO +bar +``` + +### Pass variables to a child process + +When you create a variable, you are creating what is called a _local variable_. This means that the variable is known to your current shell and only your current shell. + +This setup is an intentional limitation of a variable’s _scope_. Variables, by design, tend to default to being locally available only, in an attempt to keep information sharing on a need-to-know basis. If you foolishly create a variable containing an important password in clear text, for example, it’s nice to know that your system won’t allow a remote shell or rogue daemon (or anything else outside the one session that created the variable) access that password. + +Use the example from the beginning of this article to change your prompt, but then launch a new shell within your current one: + + +``` +$ PS1="% " +% bash +$ +``` + +When you launch a new shell, the new value of **PS1** is the default prompt instead of your new prompt: A child process does not inherit variables set in its parent. If you kill the child process, you return to the parent shell, and you see your custom **PS1** prompt again: + + +``` +$ exit +% +``` + +If you want to pass a variable to a child process, you can _prepend_ a command with variable definitions, or you can _export_ the variable to the child process. + +### Prepending variables + +You can prepend any number of variables before running a command. ****Whether the variables are used by the child process is up to the process, but you can pass the variables to it no matter what: + + +``` +$ FOO=123 bash +$ echo $FOO +123 +$ +``` + +Prepending can be a useful trick when you’re running an application requiring a special location for certain libraries (using the **LD_LIBRARY_PATH** variable), or when you’re compiling software with a non-standard compiler (using the **CC** variable), and so on. + +### Exporting variables + +Another way to make variables available to a child process is the **export** keyword, a command built into Bash. The **export** command broadens the scope of whatever variable or variables you specify: + + +``` +$ PS1="% " +$ FOO=123 +$ export PS1 +$ export FOO +% bash +% echo $PS1 +% +% echo $FOO +123 +``` + +In both cases, it’s not just a child shell that has access to a local variable that’s been passed to it or exported, it’s any child process of that shell. You can launch an application from the same shell, and that variable is available as an environment variable from within the application. + +Variables exported for everything on your system to use are called _environment variables_, which is a topic for a future article. In the meantime, try using some variables for everyday tasks to see what they bring to your workflow. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/using-variables-bash + +作者:[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/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jpnc +[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) +[2]: https://github.com/PowerShell/PowerShell +[3]: https://opensource.com/article/19/8/variables-powershell +[4]: https://opensource.com/article/19/8/understanding-file-paths-linux diff --git a/sources/tech/20190827 Best Email Services For Privacy Concerned People.md b/sources/tech/20190827 Best Email Services For Privacy Concerned People.md new file mode 100644 index 0000000000..4cc0c72004 --- /dev/null +++ b/sources/tech/20190827 Best Email Services For Privacy Concerned People.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Email Services For Privacy Concerned People) +[#]: via: (https://itsfoss.com/secure-private-email-services/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Best Email Services For Privacy Concerned People +====== + +Email services like Gmail, Outlook, and a couple of other email service providers are quite popular. Well, they’re definitely secure in a way – but not necessarily private (i.e they do not respect your privacy with utmost care). + +Maybe, you want to share something confidential and you want it to be well-protected. Or, maybe, you just want to talk about Area 51? (_shh, CIA wants to know your location!_) Or you just don’t want to the service providers to read your emails to serve you ads. + +No matter what. If you are concerned about the privacy and security of your email conversation and want them to be as private as possible – this article shall help you find the best email services for the job. + +**Note**: _Judging by the privacy policies and given the work of these services (advocating about privacy & protecting users’ data) – we have hand-picked the services as recommendations for you. But, we advise you to believe that nothing is 100% foolproof and will never be. So, always be cautious – no matter what service it is._ + +### Email Services to Secure Your Privacy + +![][1] + +Our list includes free/paid services which may offer standalone applications for multiple platforms (here – Linux will be the priority) or could be web-based email service providers as usual. + +#### 1\. ProtonMail + +![][2] + +Key Highlights: + + * Open Source + * End-to-end encrypted + * Swiss-based (protected by legal privacy laws) + * Free & Paid options available + * Custom Domain supported (requires premium subscription) + * Self-destruct message functionality + * 2FA Available + + + +ProtonMail is a quite popular Swiss-based email service which follows an ad-free model to protect your privacy. It lets you specify an expiration time for an email to self-destruct itself. In addition to all the security features, it is open source in nature. So, you can review the open-source encryption libraries or other stuff to be sure. + +To add a custom domain, you need to have a premium subscription. You can use it for free with limited features or choose to upgrade it to a premium subscription (and supporting the company behind it). + +[ProtonMail][3] + +#### 2\. Tutanota + +![][4] + +Key Highlights: + + * Open Source + * End-to-end encrypted + * 2FA Available + * Free & Paid options available + * Custom Domains supported (requires premium subscription) + * Whitelabel for business available + + + +Tutanota is yet another privacy-friendly email service provider fit for personal and business use. In contrast to ProtonMail, it provides 1 GB of storage (instead of 500 MB) for free users. And, you can add more storage to your account as well. + +[][5] + +Suggested read  4 Best Free and Open Source Tools for RAW Image Processing in Linux + +You would need a premium subscription in order to add a custom domain. If you want, you can also opt for the ability to whitelabel the service for your business. + +[Tutanota][6] + +#### 3\. Librem Mail + +![][7] + +Key Highlights: + + * Decentralized + * End-to-end encrypted + + + +Librem Mail is a part of [Librem One][8] suite of services by Purism. Unlike others, it isn’t free. You need to opt for the premium subscription of Librem One in order to get access to Librem Mail. + +Personally, I haven’t used it. But, it looks like a decent end-to-end encrypted ad-free email service given the history of Purism to protect users’ privacy. + +[Librem One Suite][8] + +#### 4\. Criptext + +![Criptext][9] + +Key Highlights: + + * Decentralized + * End-to-end encrypted + * Open Source Signal Protocol Encryption + * Standalone Desktop Applications (Linux, Windows, & Mac) + * Real-time email tracking + * Unsend option + + + +Criptext is a completely free email service available across desktops and mobile phones. It does not support custom domains (or Whitelabel). However, it utilizes the open source encryption (Signal Protocol) – which you might have heard of if you have used “Signal” messenger. + +They plan to introduce premium subscriptions with added benefits – but for now as it stands, it is free for all. + +[Criptext][10] + +#### 5\. Mailfence + +![][11] + +Key Highlights: + + * End-to-end encrypted + * Free & Paid options + * Custom domain support available + * 2FA Available + * Browser-based only (no mobile apps) + + + +Mailfence is a decent privacy-focused email service which enforces OpenPGP end-to-end encryption. You can start using it for free with limited storage (500 MB) and features. In either case, you also get the ability to upgrade your subscription to increase the storage space, unlock the ability to use a custom domain and so on. + +The only downside that can be seen here is the lack of mobile apps. So, you need to launch a browser and sign-in in order to use across multiple devices. + +[Mailfence][12] + +#### 6\. TorGuard’s Private-Mail + +![][13] + +Key Highlights: + + * OpenPGP end-to-end encryption + * Standalone Desktop app (Windows for now) + * Free and paid options + * Custom domain option available with premium subscription + + + +Private-mail ticks all the points that you normally look for in a privacy-focused email service. If you want it for free, you will only get 100 MB of storage with encryption and webmail access only. + +[][14] + +Suggested read  11 Open Source Tools for Writers + +If you want to access the service across multiple devices (that includes your smartphone) – you may want to upgrade your subscription. For now, a desktop client for Windows is available. According to their download page – it is coming to Linux soon enough. + +[Private-Mail][15] + +#### 7\. Hushmail + +![][16] + +Key Highlights: + + * 14-Days Trial for Personal Use + * Separate plans & pricing for business users (small businesses, healthcare, law, non-profits, & enterprise) + * OpenPGP end-to-end encryption + * Ability to create 2 web forms to let people reach out to you + + + +Hushmail is an interesting email service provider for privacy concerned people. For personal use, it allows you to access a 14-day trial period. + +But, for businesses – it categorizes them and offers different pricing. For example, if you want to utilize a secure email service for your Healthcare company – it offers you HIPAA compliant service. Similarly, different plans for law firms, non-profits, enterprises, and small businesses. + +In addition to the ability to add a custom domain for businesses, it also lets everyone create web forms (both personal and business users). + +[Hushmail][17] + +#### 8\. CounterMail + +![][18] + +Key Highlights: + + * OpenPGP end-to-end encryption + * Custom domain support + * Web form support + * Windows, Linux, & MacOS X support + + + +CounterMail is yet another alternative as a secure email service to the others mentioned above. It lets you try the service for one week absolutely for free. In addition to the encryption, it lets you have your own domain and create web forms – no matter what level of subscription you have. + +The more you spend, the more storage you get. But, the features remain the same – which is a good thing in a way. + +[CounterMail][19] + +**Wrapping Up** + +You may have to face some inconvenience when using a privacy-focused email service, such as – mediocre UI and some personalization features. However, that’s a trade-off that you have to bear with if you want to prioritize your privacy over anything else. + +Did we miss any of your favorites? Do you hate one of the services mentioned above? Feel free to let us what you think in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/secure-private-email-services/ + +作者:[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/2019/08/secure-email-services.png?resize=800%2C450&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/protonmail.jpg?fit=800%2C424&ssl=1 +[3]: http://proton.go2cloud.org/SH1V +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/tutanota.jpg?fit=800%2C441&ssl=1 +[5]: https://itsfoss.com/raw-image-tools-linux/ +[6]: https://tutanota.com/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/librem-mail.jpg?fit=800%2C470&ssl=1 +[8]: https://librem.one/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/criptext.jpg?fit=800%2C477&ssl=1 +[10]: https://criptext.com +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/mailfence.png?fit=800%2C295&ssl=1 +[12]: https://mailfence.com/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/private-mail.jpg?fit=800%2C304&ssl=1 +[14]: https://itsfoss.com/open-source-tools-writers/ +[15]: https://privatemail.com/ +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/hushmail.png?fit=800%2C357&ssl=1 +[17]: https://www.hushmail.com +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/countermail-1.jpg?fit=800%2C454&ssl=1 +[19]: https://countermail.com/?p=start diff --git a/sources/tech/20190827 curl exercises.md b/sources/tech/20190827 curl exercises.md new file mode 100644 index 0000000000..36eae2743b --- /dev/null +++ b/sources/tech/20190827 curl exercises.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (curl exercises) +[#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) +[#]: author: (Julia Evans https://jvns.ca/) + +curl exercises +====== + +Recently I’ve been interested in how people learn things. I was reading Kathy Sierra’s great book [Badass: Making Users Awesome][1]. It talks about the idea of _deliberate practice_. + +The idea is that you find a small micro-skill that can be learned in maybe 3 sessions of 45 minutes, and focus on learning that micro-skill. So, as an exercise, I was trying to think of a computer skill that I thought could be learned in 3 45-minute sessions. + +I thought that making HTTP requests with `curl` might be a skill like that, so here are some curl exercises as an experiment! + +### what’s curl? + +curl is a command line tool for making HTTP requests. I like it because it’s an easy way to test that servers or APIs are doing what I think, but it’s a little confusing at first! + +Here’s a drawing explaining curl’s most important command line arguments (which is page 6 of my [Bite Size Networking][2] zine). You can click to make it bigger. + + + +### fluency is valuable + +With any command line tool, I think having fluency is really helpful. It’s really nice to be able to just type in the thing you need. For example recently I was testing out the Gumroad API and I was able to just type in: + +``` +curl https://api.gumroad.com/v2/sales \ + -d "access_token=" \ + -X GET -d "before=2016-09-03" +``` + +and get things working from the command line. + +### 21 curl exercises + +These exercises are about understanding how to make different kinds of HTTP requests with curl. They’re a little repetitive on purpose. They exercise basically everything I do with curl. + +To keep it simple, we’re going to make a lot of our requests to the same website: . httpbin is a service that accepts HTTP requests and then tells you what request you made. + + 1. Request + 2. Request . httpbin.org/anything will look at the request you made, parse it, and echo back to you what you requested. curl’s default is to make a GET request. + 3. Make a POST request to + 4. Make a GET request to , but this time add some query parameters (set `value=panda`). + 5. Request google’s robots.txt file ([www.google.com/robots.txt][3]) + 6. Make a GET request to and set the header `User-Agent: elephant`. + 7. Make a DELETE request to + 8. Request and also get the response headers + 9. Make a POST request to with the JSON body `{"value": "panda"}` + 10. Make the same POST request as the previous exercise, but set the Content-Type header to `application/json` (because POST requests need to have a content type that matches their body). Look at the `json` field in the response to see the difference from the previous one. + 11. Make a GET request to and set the header `Accept-Encoding: gzip` (what happens? why?) + 12. Put a bunch of a JSON in a file and then make a POST request to with the JSON in that file as the body + 13. Make a request to and set the header ‘Accept: image/png’. Save the output to a PNG file and open the file in an image viewer. Try the same thing with with different `Accept:` headers. + 14. Make a PUT request to + 15. Request , save it to a file, and open that file in your image editor. + 16. Request . You’ll get an empty response. Get curl to show you the response headers too, and try to figure out why the response was empty. + 17. Make any request to and just set some nonsense headers (like `panda: elephant`) + 18. Request and . Request them again and get curl to show the response headers. + 19. Request and set a username and password (with `-u username:password`) + 20. Download the Twitter homepage () in Spanish by setting the `Accept-Language: es-ES` header. + 21. Make a request to the Stripe API with curl. (see for how, they give you a test API key). Try making exactly the same request to . + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/08/27/curl-exercises/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.amazon.com/Badass-Making-Awesome-Kathy-Sierra/dp/1491919019 +[2]: https://wizardzines.com/zines/bite-size-networking +[3]: http://www.google.com/robots.txt diff --git a/sources/tech/20190828 Introduction to the Linux chmod command.md b/sources/tech/20190828 Introduction to the Linux chmod command.md new file mode 100644 index 0000000000..334158ba6c --- /dev/null +++ b/sources/tech/20190828 Introduction to the Linux chmod command.md @@ -0,0 +1,313 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to the Linux chmod command) +[#]: via: (https://opensource.com/article/19/8/linux-chmod-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://opensource.com/users/seth) + +Introduction to the Linux chmod command +====== +Chmod, which sets read, write, and execute permissions, is one of the +most important Linux security commands. +![5 pengiuns floating on iceburg][1] + +Every object on your Linux system has a permission mode that describes what actions a user can perform on it. There are three types of permissions: read (**r**), write (**w**), and execute (**x**). + +To **read** a file is to view its contents. For example, a text file must have **read** permission for someone to read the text within. If the user wants to add a sentence to that file, it needs **write** permission. The **execute** permission enables someone to run a file, such as a shell script or a binary program file. + +### Basic permissions + +The **ls -l** command displays the permissions assigned to a file. For example: + + +``` +ls -l +-rw-rw-r-- 1 bruce bruce    0 Jul 30 16:25 schedule1.txt +``` + +Some permissions (**rw**) appear more than once because they are referring to different entities: _user_, _group_, and _other_. _User_ is synonymous with the owner, and _group_ refers to the user's primary group, both of which are **bruce**. _Other_ refers to all other users. + +The first position denotes the object's type: **-** for a file, **d** for a directory, and **l** for a symbolic link. The next nine positions are grouped in threes and describe the permission mode. The positions are ordered **r**,**w**,**x**, and the groups are ordered **user**, **group**, **other**. + +\--- --- --- | rwx rwx rwx +---|--- +uuu ggg ooo | u=user, g=group, o=other + +#### Files + +A file with read, write, and execute bits set for all entities would appear: + + +``` +`rwxrwxrwx` +``` + +Of course, we don't usually configure files this permissively in the real world; this is just an illustration of how each position is used. + +In the following example, a file is configured for its owner (**pablo**) to have read and write permissions, for members of the group to only have read permission, and for everyone else to have no permissions. + + +``` +`-rw-r----- 1 pablo pablo    0 Jul 30 16:25 textfile` +``` + +The **chmod** command modifies the permission mode of objects in the system. It is one of the most used and important commands in the set of Linux security commands. + +A plus (**+**) symbol adds a permission, and a minus (**-**) symbol removes a permission. You can read **chmod u+r** as "user plus read," as it gives the user _read_ permission. The command **chmod u-r** means "user minus read," as it takes the _read_ permission away from the user. + +#### Directories + +The same three permissions also apply to a directory. A directory must have the _read_ permission for a user to view its contents. It will need _write_ permission for a user to add to the directory (e.g., to create a new file). For a user to change to a directory (**cd**), it must have _execute_ permission. + + +``` +`drw-rw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS` +``` + +Pablo may be the owner of the JBOSS directory, but since he doesn't have execute permission, he can not **cd** into it. He can use the command **chmod u+x** to add the permission, and then he can **cd** into it. + + +``` +$ cd JBOSS +bash: cd: JBOSS: Permission denied +$ chmod u+x JBOSS +$ ls -l +drwxrw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS +$ cd JBOSS +$ pwd +/opt/JBOSS +``` + +#### Combined arguments + +You can combine arguments using a comma. In this example, you only need one command to set permissions so the group cannot write to a file nor can the rest of the world read it: + + +``` +$ chmod o-r,g-w readme.txt +$ ls -l +-rw-r----- 1 pablo share 0 Jul 31 13:34 readme.txt +``` + +You can read this as "others minus read and group minus write." + +Suppose Denise has written a Bash script called **home_backup.sh** and wants to give it _execute_ permission. She also wants to prevent anyone else from reading, writing, or executing it. One way to do this is with the plus and minus symbols: + + +``` +`$ chmod go-rw,u+x home_backup.sh` +``` + +Another way is by using the equals (**=**) symbol. This will set the permissions absolutely without regard for previous settings. Note that there is a space after the second equals; this indicates a value of **none**: + + +``` +`$ chmod u=rwx,go= home_backup.sh` +``` + +You can read this as "permissions for user equal read, write, and execute and permissions for group and other equal none." + +### Numeric mode + +Chmod also supports a numeric mode, which uses values assigned to each position: + +owner + +group + +other + +r + +w + +x + +r + +w + +x + +r + +w + +x + +400 + +200 + +100 + +40 + +20 + +10 + +4 + +2 + +1 + +The total value of a set of permissions can be calculated and passed to the chmod command as a single argument. Take the example with Denise and her backup script. If she uses numeric mode to set the permissions on her script, she must first calculate the value total: + + +``` +`-rwx------ 1 denise denise 0 Jul 31 13:53 home_backup.sh` +``` + +Denise adds the numbers that correspond to each permission she wants to apply: + +**400 + 200 + 100 = 700** + +Her command will be **chmod 700 home_backup.sh**. Suppose Denise wanted to reset the original permissions on the file: + + +``` +`-rw-rw-r-- 1 denise denise 0 Jul 31 13:53 home_backup.sh` +``` + +The value of these permissions calculates to 664: + +**400 + 200 + 40 + 20 + 4 = 664** + +Denise can use the command **chmod 664 home_backup.sh** to restore the original permissions. + +### Special modes + +Three other modes can be set on an object: + +name | symbolic | numeric +---|---|--- +setuid | s | 4000 +setgid | s | 2000 +sticky | t | 1000 + +The **SetUID** bit enforces user ownership on an executable file. When it is set, the file will execute with the file owner's user ID, not the person running it. + + +``` +`$ chmod u+s` +``` + +The **SetGID** bit enforces group ownership on files and directories. When it is set, any file or directory created in a directory will get the directory's group ownership, not the user's. When it is set on a file, the file will always be executed as its owning group rather than as the user: + + +``` +`$ chmod g+s` +``` + +The **sticky** bit, also referred to as the "restricted deletion flag," can be set on a directory to prevent anyone except the directory's owner from deleting a file in that directory: + + +``` +`$ chmod o+t` +``` + +The sticky bit can be set in numerical mode by adding its value to those of the other permissions. If you have an object with a value of 755 and you want to set the sticky bit, add 1000: + +**1000 + 400 + 200 + 100 + 40 + 10 + 4 + 1 = 1755** + +This command would be **chmod 1755**. Several symbolic methods are equivalent; one example is **chmod u=rwx,go=rx,o+t**. + +### Extras + +The letter **a** is a shortcut to assign permissions to all users. The command **chmod a+rwx** is equivalent to **chmod ugo+rwx**. + +#### Recursive + +Like many other Linux commands, chmod has a recursive argument, **-R**, which allows you to operate on a directory and its contents recursively. By recursive, It is meant that the command will attempt to operate on all objects below the specified directory rather than just the directory itself. This example starts in an empty directory and adds the **-v** (verbose) argument, so chmod will report what it is doing: + + +``` +$ ls -l . conf +.: +drwxrwxr-x 2 alan alan 4096 Aug  5 15:33 conf + +conf: +-rw-rw-r-- 1 alan alan 0 Aug  5 15:33 conf.xml +$ chmod -vR 700 conf +mode of 'conf' changed from 0775 (rwxrwxr-x) to 0700 (rwx------) +mode of 'conf/conf.xml' changed from 0664 (rw-rw-r--) to 0700 (rwx------) +``` + +#### Reference + +A reference file command (**\--reference=RFILE**) can be used to duplicate the mode of another file (**RFILE**), known as a reference file. This is handy when you are changing modes on files to match a certain configuration or when you don't know the exact mode—or don't want to take time to calculate it: + + +``` +$ ls -l +-rw-r--r-x 1 alan alan 0 Aug  5 17:10 notes.txt +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 readme.txt +$ chmod --reference=readme.txt notes.txt +$ ls -l +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 notes.txt +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 readme.txt +``` + +#### Report changes + +The chmod command also has a **-c** (**\--changes**) argument, which tells chmod to report only when a change is made (versus **-v**, or **-verbose**, which tells chmod to report all its output). Chmod will still report other things, such as if an operation is not allowed. + +The argument **-f** (**\--silent**, **\--quiet**) suppresses most error messages. Using this argument with **-c** will show only real changes. + +#### Preserve root + +The root (**/**) of the Linux filesystem should be treated with great respect. If someone makes a command mistake at this level, the consequences can be terrible and leave a system completely useless, particularly when you are running a recursive command that will make any kind of change—or worse: deletions. Fortunately, the chmod command's **\--preserve-root** argument will protect and preserve the root. If the argument is used with a recursive chmod command on the root, nothing will happen, and you will see this message: + + +``` +[alan@localhost ~]# chmod -cfR --preserve-root a+w / +chmod: it is dangerous to operate recursively on '/' +chmod: use --no-preserve-root to override this failsafe +``` + +The option has no effect when it is not used with recursive. However, if the root user runs the command, the permissions of the **/** will change, but not those of other files or directories. + + +``` +[alan@localhost ~]$ chmod -c --preserve-root a+w / +chmod: changing permissions of '/': Operation not permitted +[root@localhost /]# chmod -c --preserve-root a+w / +mode of '/' changed from 0555 (r-xr-xr-x) to 0777 (rwxrwxrwx) +``` + +Surprisingly, this is not the default argument; **\--no-preserve-root** is. If you run a command without the "preserve" option, it will default to "no preserve" mode and possibly change permissions on files that shouldn't be changed. + + +``` +[alan@localhost ~]$ chmod -cfR a+x / +mode of '/proc/1525/task/1525/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1541/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1580/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1592/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1557/task/1557/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1558/task/1558/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1561/task/1561/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +``` + +### Conclusion + +All objects on a Linux system have a set of permissions. It is important to check and maintain them occasionally to prevent unwanted access. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-chmod-command + +作者:[Alan Formy-Duval][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/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) diff --git a/sources/tech/20190828 Using GNS3 with Fedora.md b/sources/tech/20190828 Using GNS3 with Fedora.md new file mode 100644 index 0000000000..70a230f3f9 --- /dev/null +++ b/sources/tech/20190828 Using GNS3 with Fedora.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using GNS3 with Fedora) +[#]: via: (https://fedoramagazine.org/using-gns3-with-fedora/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Using GNS3 with Fedora +====== + +![][1] + +GNS3 is [an amazing tool][2] that allows IT professionals to, quite simply, create a virtual lab. The software can virtualize or emulate a variety of systems called appliances. These appliances range from Cisco routers and switches to nodes such as Windows Server, CentOS, and Fedora. GNS3 also has the capability to utilize [containers][3]. If you’re designing and testing proof-of-concept ideas, recreating environments for troubleshooting, or want to delve into the world of network engineering, GNS3 might be for you. + +As seen on their website, GNS3 is well acquainted in the enterprise world. Companies using it span from tech businesses like Intel, to scientific organizations like NASA. Even renown banks and telecom companies are included in the list. This adds great credibility to the power and reliability this open-source tool provides. + +### Installation + +For Fedora users, GNS3 can be easily installed from the official repository. From the command-line type: + +``` +sudo dnf install gns3-server gns3-gui +``` + +The reason for the separate packages is because GNS3 can be configured as a dedicated server. This is useful for teams to collaborate while working on a project, or problem. The dedicated servers can be installed on bare-metal or as a virtual machine. + +GNS3 requires a computer with virtualization capabilities. This allows the software to utilize the computer’s hardware to increase the performance when running the appliances. To use Spice/VNC as a console install the _virt-viewer_ package. + +When the installation is complete, an icon will be placed among the applications for GNS3. + +![][4] + +### Initial setup + +Opening GNS3 for the first time will open the Setup Wizard. The options on the first screen allow users to either setup an isolated VM environment, run the topologies from the local computer, or to use a remote server. The examples in this article are performed on the local machine. + +The next screen configures the application to connect to the local machine running GNS3 server. Here we see the path to the application installed locally on the server, host binding address, and port. These settings can be tweaked to match your setup. However, for a quick setup it’s best to accept the defaults. + +Once the settings are verified, a confirmation will appear stating the connection to the local server was successful. The last screen in the wizard will provide a summary. Click the **Finish** button to complete the setup. + +![][5] + +### Finding appliances in the GNS3 Marketplace + +Before venturing into the GUI, this would be a good time to visit the [GNS3 Marketplace][6]. The marketplace contains appliances, pre-configured labs, and software for use with GNS3. The options in the Marketplace are vast and beyond the scope of this article. However, let’s download an appliance to see how it works. + +First, select the appliance you want (the examples in this article will use OpenWRT). Select the template for that appliance to download. Appliance templates are JSON files with the extension _gns3a_. + +You can also install OS nodes without a template, or create your own. [OSBoxes.org][7] has a variety of pre-built VMWare images (VMDK) that are compatible with GNS3. For this article we’ll use the Fedora 64-bit VMWare image. You can also find images for many other distributions such as CentOS, Ubuntu, and Kali Linux. + +To use Cisco appliances a service agreement or subscription to VIRL is needed to download the IOS images from Cisco. For links and guides to legally download Cisco IOS, check out David Bombal’s site at . + +You may also need to install Dynamips which is not included in the official repos. However, a simple web search will point to the RPM package. + +![][8] + +### Importing appliances to GNS3 + +Now that we have some appliances let’s build a small and simple topology using the templates and images we just downloaded. + +After the initial setup the **New appliance template** window will open. From here we can import template files like the _gns3a_ file downloaded from the Marketplace. Other options for adding appliances without a template include IOS devices, VMs, and Docker containers. + +To add the OpenWRT router, click **Import an appliance template file**. This will open the **Add appliance** wizard. Review the information on the first screen which shows the category, vendor, architecture, and KVM status for that appliance, and click **Next**. Now select the **Server type** to run the appliance and click **Next**. This is where we can specify whether we want to run it on a remote server, in a GNS3 VM, or on the local machine. After verifying the server requirements click **Next** to continue the installation. + +At this point it’s time to install the image file for the OpenWRT appliance. Select the version and click the **Download** button. This will go to the site containing the image file and download it. This article will use OpenWRT 18.06.4 downloaded from the project’s website. If the version of the image is not in the list, click the button to **Create a new version**, and enter the version number (in this case 18.06.4). Select the filename and click **Import** to import the image. GNS3 will then ask if you would like to copy the image and decompress it (if necessary). Accept it and complete the install. + +![][9] + +### Adding appliances without a template + +To add the Fedora VM downloaded from OSBoxes, click on one of the icons on the left and select **New appliance template** near the bottom. Select **Add a Qemu virtual machine** and click **Next**. Enter a name for the appliance (in this case Fedora 30) then click **Next**. Verify the QEMU binary path and input the amount of RAM to use for the VM, then select the **Console type**. On the next screen select **New image** and browse for the VMDK file. Depending on the file-size it may take a few moments. To copy/import the image select **Yes** and once it’s completed click **Finish**. + +![][10] + +### Adding and connecting nodes in GNS3 + +Now that we have some appliances, let’s build a simple topology with OpenWRT and Fedora in GNS3. The icons on the left represent Routers, Switches, End devices, and Security devices. The second-last shows all appliances, and the bottom option is to _Add a link_ which connects the nodes to each other. + +Click on the **Routers** icon and drag the OpenWRT router onto the empty workspace to the right. Click on the **End devices** icon and do the same for the computer node. Depending on how large the file is, it may take a few moments for the PC node to appear in the workspace. To connect the nodes, click **Add a link** then click on a node, select the interface (i.e. Ethernet0), then do the same with the other node (as seen in the demo below). + +You can customize the consoles by going to the menu bar and selecting **Edit > Preferences > General**. Select the tab for **Console applications** and click the **Edit** button. From here you can choose your favourite terminal in the drop-down menu and even customize it in the text-box below. + +Once everything is in place, start the nodes by clicking the green (play) button at the top. The lights in the Topology Summary section will turn green indicating the nodes are on. To open the consoles for the nodes, click the **Console to all devices** button to the left (it looks like a terminal icon). The Remote Viewer window for Fedora and a terminal window for OpenWRT will open. + +Once complete you can turn off the nodes individually by right-clicking on the node and selecting **Stop**, or to stop all nodes click the red **Stop** button in the top bar. + +![][11] + +### Conclusion + +GNS3 is a powerful piece of software with features that are beyond the scope of this article. The software is similar to Cisco’s Packet Tracer. However, Packet Tracer is a simulator with limitations to the program’s coding. GNS3 on the other hand virtualizes/emulates the nodes using the hardware’s actual OS. This provides full functionality and a closer experience to the actual hardware. + +The [GNS3 documentation][12] site offers an enormous amount of resources that delve further into the workings of the application. They also offer training courses for those interested in digging deep into the workings of the software. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-gns3-with-fedora/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3.png-816x345.jpg +[2]: https://gns3.com +[3]: https://fedoramagazine.org/running-containers-with-podman/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-app-icon-1024x768.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-initial-setup.gif +[6]: https://www.gns3.com/marketplace +[7]: https://www.osboxes.org +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-marketplace.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-appliance-template.gif +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-vm-image-without-template.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-demo.gif +[12]: https://docs.gns3.com diff --git a/sources/tech/20190828 What are environment variables in Bash.md b/sources/tech/20190828 What are environment variables in Bash.md new file mode 100644 index 0000000000..abe9020362 --- /dev/null +++ b/sources/tech/20190828 What are environment variables in Bash.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What are environment variables in Bash?) +[#]: via: (https://opensource.com/article/19/8/what-are-environment-variables) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +What are environment variables in Bash? +====== +Learn about environment variables in Bash in our miniseries: Variables +in shells. +![x sign ][1] + +Environment variables contain information about your login session, stored for the system shell to use when executing commands. They exist whether you’re using Linux, Mac, or Windows. Many of these variables are set by default during installation or user creation. + +While environment variables apply to all modern systems, this article specifically addresses environment variables in the Bash shell on Linux, BSD, Mac, and Cygwin. + +### Understanding environment variables + +Environment variables are no different, technically, than variables. They can be set, recalled, and cleared with exactly the same syntax used for variables. If you’re not used to using variables in Bash, read my [variables in Bash][2] article before continuing. + +You don’t often use environment variables directly. They’re referenced by individual applications and daemons as needed. For instance, your home directory is set as an environment variable when you log in. For example, on Linux you can see your **HOME** environment variable's contents like this: + + +``` +$ echo $HOME +HOME=/home/seth +``` + +On a Mac: + + +``` +$ echo $HOME +HOME=/Users/bogus +``` + +On Windows: + + +``` +`C:\Users\bogus` +``` + +You can view all environment variables set on your system with the **env** command. ****The list is long, so pipe the output through **more** to make it easier to read: + + +``` +$ env | more +TERM=xterm-256color +LESSOPEN=||/usr/bin/lesspipe.sh %s +USER=seth +SUDO_EDITOR=emacs +WWW_HOME= +VISUAL=emacs +DISPLAY=:0 +PS1=$ +XDG_DATA_DIRS=/home/seth/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/ +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin +GDMSESSION=gnome +MAIL=/var/spool/mail/seth +[...] +``` + +Environment variables can be useful when you want to override default settings, or when you need to manage new settings that your system has no reason to create on its own. For instance, when you type a command, the only reason your computer knows how to _find_ the application corresponding to that command is that the **PATH** environment variable tells it where to look. This variable lists valid directories for your operating system to search for commands, whether that command is [**ls**][3] or [cp][4], or a graphical application like Firefox or [Lutris][5], or anything else. + +Different environment variables get used by different systems. Your **PATH** variable is vital to your terminal emulator, for instance, but a lot less significant to, say, Java (which has its own paths, which point to important Java libraries). However, the **USER** variable is used by several systems as a way to identify who is requesting a service. For example, if you’re on a multiuser system and need to check your local mailbox, your mail command knows which mail spool to retrieve based on the **MAIL** and **USER** variables. + +### Setting an environment variable + +Usually, the installer program, whether it’s **dnf** on Fedora, **apt** on Ubuntu, **brew** on Mac, or a custom installer, updates your environment variables for a new application. Sometimes, though, when you’re installing something outside of your distribution’s intended toolset, you may have to manage an environment variable yourself. Or you might choose to add an environment variable to suit your preferences. If you decide you want to keep some applications in a **bin** folder located in your home directory, then you must add that directory to your **PATH** so your operating system knows to look there for applications to run when you issue a command. + +#### Temporary environment variables + +You can add a location to your path the way you create throw-away variables. It works, but only as long as the shell you used to modify your system path remains open. For instance, open a Bash shell and modify your system path: + + +``` +$ export PATH=$PATH:/home/seth/bin +``` + +Confirm the result: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin +``` + +Close the session: + + +``` +$ exit +``` + +Open a new one and take a look at the **PATH** variable: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin +``` + +This variable has reverted to its default state because **PATH** isn’t getting set with each new shell. For that, you must configure your variables to load any time a shell is launched. + +#### Permanent environment variables + +You can set your own persistent environment variables in your shell configuration file, the most common of which is **~/.bashrc**. If you’re a system administrator managing several users, you can also set environment variables in a script placed in the **/etc/profile.d** directory. + +The syntax for setting a variable by configuration file is the same as setting a variable in your shell: + + +``` +export PATH=$PATH:/snap/bin:/home/seth/bin +``` + +Close the current shell, or else force it to load the updated config: + + +``` +$ . ~/.bashrc +``` + +Finally, take another look at your system path: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin +``` + +It is now set correctly to include your additional custom directory. + +### Discovering other environment variables + +You can create and manipulate environment variables at will, and some applications do just that. This fact means that many of your environment variables aren’t used by most of your applications, and if you add your own arbitrary variables then some could be used by nothing at all. So the question is: How do you find out which environment variables are meaningful? + +The answer lies in an application’s documentation. For instance, to find out what options are available to you for your general Bash environment, you can read the Bash documentation. While the Bash man page mentions many important variables, the GNU info page for Bash features two exhaustive lists of useful Bourne Shell and Bash environment variables, and how each is used. + +For example, in the info page list: + + +``` +'HISTCONTROL' +     A colon-separated list of values controlling how commands are saved +     on the history list.  If the list of values includes 'ignorespace', +     lines which begin with a space character are not saved in the +     history list.  A value of 'ignoredups' causes lines which match the +     previous history entry to not be saved.  A value of 'ignoreboth' is +     shorthand for 'ignorespace' and 'ignoredups'. +     [...] +``` + +This output tells you that the **HISTCONTROL** environment variable controls how your Bash history is presented, and what values you can use to customize that experience. In this example, the **ignoredups** value tells the output of the **history** command to ignore duplicate lines. + +You can test this one easily. First, issue the same command twice in a row: + + +``` +$ echo "hello world" +hello world +$ echo "hello world" +hello world +``` + +View your history, or at least the most recent entries: + + +``` +$ history | tail -5 + 996  man bash + 997  info bash + 998  echo "hello world" + 999  echo "hello world" + 1000 history +``` + +You can see that duplicate entries are indeed listed now. + +Set a new environment variable in your **.bashrc** file based on what you read in the info page: + + +``` +export HISTCONTROL=$HISTCONTROL:ignorespace:ignoredups +``` + +Save and then load your new configuration: + + +``` +$ source ~/.bashrc +``` + +Issue two commands twice in a row: + + +``` +$ echo "hello once" +hello once +$ echo "hello once" +hello once +``` + +View the most recent entries in your history: + + +``` +$ history | tail -5 + 1000 history + 1001 emacs ~/.bashrc + 1002 source ~/.bashrc + 1003 echo "hello once" + 1004 history +``` + +Duplicate entries are now collapsed into one entry because of your new environment variable, just as the info page specified. + +Finding relevant environment variables is usually a matter of reading the documentation for the application you want to affect. Most environment variables are specific to what one application needs to run smoothly. For general entries, your shell’s documentation is the logical place to look. If you write scripts or applications that require new environment variables, be sure to define those variables in your own documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/what-are-environment-variables + +作者:[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/x_stop_terminate_program_kill.jpg?itok=9rM8i9x8 (x sign ) +[2]: https://opensource.com/article/19/8/using-variables-bash +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://opensource.com/article/19/8/copying-files-linux +[5]: https://opensource.com/article/18/10/lutris-open-gaming-platform diff --git a/sources/tech/20190829 Variables in PowerShell.md b/sources/tech/20190829 Variables in PowerShell.md new file mode 100644 index 0000000000..6d522610c1 --- /dev/null +++ b/sources/tech/20190829 Variables in PowerShell.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Variables in PowerShell) +[#]: via: (https://opensource.com/article/19/8/variables-powershell) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Variables in PowerShell +====== +In our miniseries Variables in Shells, learn how to handle local +variables in PowerShell. +![Shells in a competition][1] + +In computer science (and casual computing), a variable is a location in memory that holds arbitrary information for later use. In other words, it’s a temporary storage container for you to put data into and get data out of. In the Bash shell, that data can be a word (a _string_, in computer lingo) or a number (an _integer_). + +You may have never (knowingly) used a variable before on your computer, but you probably have used a variable in another area of your life. When you say things like "give me that" or "look at this," you’re using grammatical variables (you think of them as _pronouns_). The meaning of "this" and "that" depends on whatever you’re picturing in your mind, or whatever you’re pointing to as an indicator for your audience to know what you’re referring to. When you do math, you use variables to stand in for unknown values, even though you probably don’t call them variables. + +This article addresses variables in [PowerShell][2], which runs on Windows, Linux, or Mac. Users of the open source [Bash][3] shell should refer to my article about variables in the Bash shell instead (although you can run PowerShell on Linux, and it is open source, so you can still follow along with this article). + +**Note:** The examples in this article are from a PowerShell session running on the open source operating system Linux, so if you’re on Windows or Mac the file paths will differ. However, Windows converts **/** to **\** automatically, and all examples work across all platforms, provided that you substitute obvious differences (for instance, it is statistically unlikely that your username is **seth**). + +### What are variables for? + +Whether you need variables in PowerShell depends on what you do in a terminal. For some users, variables are an essential means of managing data, while for others they’re minor and temporary conveniences, or for some, they may as well not exist. + +Ultimately, variables are a tool. You can use them when you find a use for them, or leave them alone in the comfort of knowing they’re managed by your OS. Knowledge is power, though, and understanding how variables work in Bash can lead you to all kinds of unexpected creative problem-solving. + +### Set a variable + +You don’t need special permissions to create a variable. They’re free to create, free to use, and generally harmless. In PowerShell, you create a variable by defining a variable name and then setting its value with the **Set-Variable** command. The example below creates a new variable called **FOO** and sets its value to the string **$HOME/Documents**: + + +``` +`PS> Set-Variable -Name FOO -Value "$HOME/Documents"` +``` + +Success is eerily silent, so you may not feel confident that your variable got set. You can see the results for yourself with the **Get-Variable** (**gv** for short) command. To ensure that the variable is read exactly as you defined it, you can also wrap it in quotes. Doing so preserves any special characters that might appear in the variable; in this example, that doesn’t apply, but it’s still a good habit to form: + + +``` +PS> Get-Variable "FOO" -valueOnly +/home/seth/Documents +``` + +Notice that the contents of **FOO** aren’t exactly what you set. The literal string you set for the variable was **$HOME/Documents**, but now it’s showing up as **/home/seth/Documents**. This happened because you can nest variables. The **$HOME** variable points to the current user’s home directory, whether it’s in **C:\Users** on Windows, **/home** on Linux, or **/Users** on Mac. Since **$HOME** was embedded in **FOO**, that variable gets _expanded_ when recalled. Using default variables in this way helps you write portable scripts that operate across platforms. + +Variables usually are meant to convey information from one system to another. In this simple example, your variable is not very useful, but it can still communicate information. For instance, because the content of the **FOO** variable is a [file path][4], you can use **FOO** as a shortcut to the directory its value references. + +To reference the variable **FOO**’s _contents_ and not the variable itself, prepend the variable with a dollar sign (**$**): + + +``` +PS> pwd +/home/seth +PS> cd "$FOO" +PS> pwd +/home/seth/Documents +``` + +### Clear a variable + +You can remove a variable with the **Remove-Variable** command: + + +``` +PS> Remove-Variable -Name "FOO" +PS> gv "FOO" +gv : Cannot find a variable with the name 'FOO'. +[...] +``` + +In practice, removing a variable is not usually necessary. Variables are relatively "cheap," so you can create them and forget them when you don’t need them anymore. However, there may be times you want to ensure a variable is empty to avoid conveying unwanted information to another process that might read that variable. + +### Create a new variable with collision protection + +Sometimes, you may have reason to believe a variable was already set by you or some other process. If you would rather not override it, you can either use **New-Variable**, which is designed to fail if a variable with the same name already exists, or you can use a conditional statement to check for a variable first: + + +``` +PS> New-Variable -Name FOO -Value "example" +New-Variable : A variable with name 'FOO' already exists. +``` + +**Note:** In these examples, assume that **FOO** is set to **/home/seth/Documents**. + +Alternately, you can construct a simple **if** statement to check for an existing variable: + + +``` +PS> if ( $FOO ) +>> { gv FOO } else +>> { Set-Variable -Name "FOO" -Value "quux" } +``` + +### Add to a variable + +Instead of overwriting a variable, you can add to an existing one. In PowerShell, variables have diverse types, including string, integer, and array. When choosing to create a variable with, essentially, more than one value, you must decide whether you need a [character-delimited string][5] or an [array][6]. You may not care one way or the other, but the application receiving the variable’s data may expect one or the other, so make your choice based on your target. + +To append data to a string variable, use the **=+** syntax: + + +``` +PS> gv FOO +foo +PS> $FOO =+ "$FOO,bar" +PS> gv FOO +foo,bar +PS> $FOO.getType().Name +String +``` + +Arrays are special types of variables in PowerShell and require an ArrayList object. That’s out of scope for this article, as it requires delving deeper into PowerShell’s .NET internals. + +### Go global with environment variables + +So far the variables created in this article have been _local_, meaning that they apply only to the PowerShell session you create them in. To create variables that are accessible to other processes, you can create environment variables, which will be covered in a future article. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/variables-powershell + +作者:[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/shelloff.png?itok=L8pjHXjW (Shells in a competition) +[2]: https://en.wikipedia.org/wiki/PowerShell +[3]: https://www.gnu.org/software/bash/ +[4]: https://opensource.com/article/19/8/understanding-file-paths-linux +[5]: https://en.wikipedia.org/wiki/Delimiter +[6]: https://en.wikipedia.org/wiki/Array_data_structure diff --git a/sources/tech/20190829 What is an Object in Java.md b/sources/tech/20190829 What is an Object in Java.md new file mode 100644 index 0000000000..033fdd5403 --- /dev/null +++ b/sources/tech/20190829 What is an Object in Java.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is an Object in Java?) +[#]: via: (https://opensource.com/article/19/8/what-object-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansenhttps://opensource.com/users/mdowdenhttps://opensource.com/users/sethhttps://opensource.com/users/drmjghttps://opensource.com/users/jamesfhttps://opensource.com/users/clhermansen) + +What is an Object in Java? +====== +Java's approach to object-oriented programming is the basis for almost +everything in the language. Here's what you need to know. +![Coffee beans and a cup of coffee][1] + +Java is an object-oriented programming language, which views the world as a collection of objects that have both _properties_ and _behavior_. Java's version of object-orientedness is pretty straightforward, and it's the basis for almost everything in the language. Because it's so essential to Java, I'll explain a bit about what's under the covers to help anyone new to the language. + +### Inheritance + +In general, all [Cartesian geometric objects][2], like circles, squares, triangles, lines, and points, have basic properties, like location and extension. Objects with zero extension, like points, usually don't have anything more than that. Objects like lines have more—e.g., the start and endpoint of a line segment or two points along a line (if it's a "true line"). Objects like squares or triangles have still more—the corner points, for example—whereas circles may have a center and radius. + +We can see there is a simple hierarchy at work here: The general geometric object can be _extended_ into specific geometric objects, like points, lines, squares, etc. Each specific geometric object _inherits_ the basic geometric properties of location and extension and adds its own properties. + +This is an example of _single inheritance_. Java's original object-oriented model allowed only single inheritance, where objects cannot belong to more than one inheritance hierarchy. This design decision comes out of the kinds of ambiguities programmers found themselves facing in [complex multiple-inheritance scenarios][3], typically in cases where "interesting design decisions" led to several possible implementations of the function **foo()** as defined (and re-defined) in the hierarchy. + +Since Java 8, there has been a limited multiple inheritance structure in place that requires specific actions on behalf of the programmer to ensure there are no ambiguities. + +### Strong and static typing + +Java is _strongly_ and _statically_ typed. What does this mean? + +A _statically_ typed language is one where the type of a variable is known at compile time. In this situation, it is not possible to assign a value of type B to a variable whose declared type is A, unless there is a conversion mechanism to turn a value of type B into a value of type A. An example of this type of conversion is turning an integer value, like 1, 2, or 42, into a floating-point value, like 1.0, 2.0, or 42.0. + +A _strongly_ typed language is one where very few (or perhaps no) type conversions are applied automatically. For example, whereas a strongly typed language might permit automatic conversion of _integer_ to _real_, it will never permit automatic conversion of _real_ to _integer_ since that conversion requires either rounding or truncation in the general case. + +### Primitive types, classes, and objects + +Java provides a number of primitive types: _byte_ (an eight-bit signed integer); _short_ (a 16-bit signed integer); _int_ (a 32-bit signed integer); _long_ (a 64-bit signed integer); _float_ (a single precision 32-bit IEEE floating-point number); _double_ (a double precision 64-bit IEEE floating-point number); _boolean_ (true or false); and _char_ (a 16-bit Unicode character). + +Beyond those primitive types, Java allows the programmer to create new types using _class declarations_. Class declarations are used to define object templates, including their properties and behavior. Once a class is declared, _instances_ of that class can generally be created using the **new** keyword. These instances correspond directly to the "objects" we have been discussing. Java comes with a library of useful class definitions, including some simple basic classes such as _String_, which is used to hold a sequence of characters like "Hello, world." + +Let's define a simple message class that contains the name of the sender as well as the message text: + + +``` +class Message { +        [String][4] sender; +        [String][4] text; +        public Message([String][4] sender, [String][4] text) { +                this.sender = sender; +                this.text = text; +        } +} +``` + +There are several important things to note in this class declaration: + + 1. The class is (by convention) always declared with a leading capital letter. + 2. The **Message** class contains two properties (or fields): +– a String field called **sender** +– a String field called **text** +Properties or fields are (by convention) always declared with a leading lower-case letter. + 3. There is some kind of thing that starts with **public Message**. +– It is a _method_ (methods define the behavior of an object). +– It is used to _construct_ instances of the class **Message**. +– Constructor methods always take the same name as the class and are understood to return an instance of the class once it's constructed. +– Other methods are (by convention) always declared with a leading lower-case letter. +– This constructor is "public," meaning any caller can access it. + 4. As part of the construction process, some lines start with **this**. +– **this** refers to the present instance of the class. +– Thus **this.sender** refers to the sender property of the object. +– Whereas plain **sender** refers to the parameter of the **Message** constructor method. +– Therefore, these two lines are copying the values provided in the call to the constructor into the fields of the object itself. + + + +So we have the **Method** class definition. How do we use it? The following code excerpt shows one possible way: + + +``` +`Message message = new Message("system", "I/O error");` +``` + +Here we see: + + 1. The declaration of the variable **message** of type **Message** + 2. The creation of a new instance of the **Message** class with **sender** set to "system" and **text** set to "I/O error" + 3. The assignment of that new instance of **Message** to the variable **message** + 4. If later in the code, the variable **message** is assigned a different value (another instance of **Message**) and no other variable was created that referred to this instance of **Message**, then this instance is no longer used by anything and can be garbage-collected. + + + +The key thing happening here is that we are creating an object of type **Message** and keeping a reference to that object in the variable **message**. + +We can now use that message; for instance, we can print the values in the **sender** and **text** properties, like this: + + +``` +[System][5].out.println("message sender = " + message.sender); +[System][5].out.println("message text = " + message.text); +``` + +This is a very simple and unsophisticated class definition. We can modify this class definition in a number of ways: + + 1. We can make the implementation details of properties invisible to callers by using the keyword **private** in front of the declarations, allowing us to change the implementation without affecting callers. + 2. If we choose to conceal properties in the class, we would then typically define procedures for _getting_ and _setting_ those properties; by convention in Java these would be defined as: +– **public String getSender()** +– **public String getText()** +– **public void setSender(String sender)** +– **public void setText(String text)** + 3. In some cases, we may wish to have "read-only" properties; in those cases, we would not define setters for such properties. + 4. We can make the constructor of the class invisible to callers by using the **private** keyword instead of **public**. We might wish to do this when we have another class whose responsibility is creating and managing a pool of messages (possibly executing in another process or even on another system). + + + +Now, suppose we want a kind of message that records when it was generated. We could declare it this like: + + +``` +class TimedMessage extends Message { +        long creationTime; +        public TimedMessage([String][4] sender, [String][4] text) { +                super(sender, text); +                this.creationTime = [System][5].currentTimeMillis(); +        } +} +``` + +Here we see some new things: + + 1. **TimedMessage** is _extending_ the **Message** class—that is, **TimedMessage** is inheriting properties and behavior from **Message**. + 2. The constructor calls the constructor in its parent, or _superclass_, with the values of **sender** and **text** passed in, as **super(sender, text)**, in order to make sure its inherited properties are properly initialized. + 3. **TimedMessage** adds a new property, **creationTime**, and the constructor sets it to be the current system time in milliseconds. + 4. Time in milliseconds in Java is kept as a long (64-bit) value (0 is 1 January, 1970 00:00:00 UTC). + 5. As a bit of an aside, the name **creationTime** suggests it should be a read-only property, which also suggests that the other properties be read-only; that is, **TimedMessage** instances should probably not be reused nor have their properties altered. + + + +### The Object class + +"The Object class" sounds like a kind of contradiction in terms, doesn't it? But notice that the first class we defined, **Message**, did not _appear_ to extend anything—but it _actually_ did. All classes that don't specifically extend another class have the class **Object** as their immediate and only parent; therefore, all classes have the **Object** class as their ultimate superclass. + +You can [learn more about the **Object** class][6] in Java's docs. Let's (briefly) review some interesting details: + + 1. **Object** has the constructor **Object()**, that is, with no parameters. + 2. **Object** provides some useful methods to all of its subclasses, including: +– **clone()**, which creates and returns a copy of the instance at hand +– **equals(Object anotherObject)**, which determines whether **anotherObject** is equal to the instance of **Object** at hand +– **finalize()**, which is used to garbage-collect the instance at hand when it is no longer used (see above) +– **getClass()**, which returns the class used to declare the instance at hand +— The value returned by this is an instance of the [**Class** class][7], which permits learning about the declaring class at runtime—a process referred to _introspection_. + 3. **hashCode()** is an integer value that gives a nearly unique value for the instance at hand. +– If the hash codes of two distinct instances are equal, then they may be equal; a detailed comparison of the properties (and perhaps methods) is necessary to determine complete equality; +– If the hash codes are not equal, then the instances are also not equal. +– Therefore, hash codes can speed up equality tests. +– A hash code can also be used to create a [**HashMap**][8] (a map is an associative array or dictionary that uses the hash code to speed up lookups) and a [**HashSet**][9] (a set is a collection of objects; the programmer can test whether an instance is in a set or not; hash codes are used to speed up the test). + 4. **notify()**, **notifyAll()**, **wait()**, **wait(long timeout)**, and **wait(long timeout, int nanos)** communicate between collaborating instances executing on separate threads. + 5. **toString()** produces a printable version of the instance. + + + +### Concluding thoughts + +We've touched on some important aspects of object-oriented programming, Java-style. There are six important, related topics that will be covered in future articles: + + * Namespaces and packages + * Overriding methods in subclasses—for instance, the String class has its own specific **hashCode()** method that recognizes its meaning as an array of characters; this is accomplished by overriding the **hashCode()** method inherited from Object + * Interfaces, which permit describing behavior that must be provided by a class that implements the interface; instances of classes that implement a given interface can be referred to by that interface when the only thing of interest is that specific behavior + * Arrays of primitives or classes and collections of classes (such as lists, maps, and sets) + * Overloading of methods—where several methods with the same name and similar behavior have different parameters + * Using libraries that don't come with the Java distribution + + + +Is there anything you would like to read next? Let us know in the comments and stay tuned! + +Michael Dowden takes a look at four Java web frameworks built for scalability. + +Optimizing your Java code requires an understanding of how the different elements in Java interact... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/what-object-java + +作者:[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/clhermansenhttps://opensource.com/users/mdowdenhttps://opensource.com/users/sethhttps://opensource.com/users/drmjghttps://opensource.com/users/jamesfhttps://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://en.wikipedia.org/wiki/Analytic_geometry +[3]: https://en.wikipedia.org/wiki/Multiple_inheritance +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[6]: https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html +[7]: https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html +[8]: https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html +[9]: https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html diff --git a/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md b/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md new file mode 100644 index 0000000000..7781fb5a16 --- /dev/null +++ b/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Command line quick tips: Using pipes to connect tools) +[#]: via: (https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Command line quick tips: Using pipes to connect tools +====== + +![][1] + +One of the most powerful concepts of Linux is carried on from its predecessor, UNIX. Your Fedora system has a bunch of useful, single-purpose utilities available for all sorts of simple operations. Like building blocks, you can attach them in creative and complex ways. _Pipes_ are key to this concept. + +Before you hear about pipes, though, it’s helpful to know the basic concept of input and output. Many utilities in your Fedora system can operate against files. But they can often take input not stored on a disk. You can think of input flowing freely into a process such as a utility as its _standard input_ (also sometimes called _stdin_). + +Similarly, a tool or process can display information to the screen by default. This is often because its default output is connected to the terminal. You can think of the free-flowing output of a process as its _standard output_ (or _stdout_ — go figure!). + +### Examples of standard input and output + +Often when you run a tool, it outputs to the terminal. Take for instance this simple sequence command using the _seq_ tool: + +``` +$ seq 1 6 +1 +2 +3 +4 +5 +6 +``` + +The output, which is simply to count integers up from 1 to 6, one number per line, comes to the screen. But you could also send it to a file using the **>** character. The shell interpreter uses this character to mean “redirect _standard output_ to a file whose name follows.” So as you can guess, this command puts the output into a file called _six.txt:_ + +``` +$ seq 1 6 > six.txt +``` + +Notice nothing comes to the screen. You’ve sent the ouptut into a file instead. If you run the command _cat six.txt_ you can verify that. + +You probably remember the simple use of the _grep_ command [from a previous article][2]. You could ask _grep_ to search for a pattern in a file by simply declaring the file name. But that’s simply a convenience feature in _grep_. Technically it’s built to take _standard input_, and search that. + +The shell uses the **<** character similarly to mean “redirect _standard input_ from a file whose name follows.” So you could just as well search for the number **4** in the file _six.txt_ this way: + +``` +$ grep 4 < six.txt +4 +``` + +Of course the output here is, by default, the content of any line with a match. So _grep_ finds the digit **4** in the file and outputs that line to _standard output_. + +### Introducing pipes + +Now imagine: what if you took the standard output of one tool, and instead of sending it to the terminal, you sent it into another tool’s standard input? This is the essence of the pipe. + +Your shell uses the vertical bar character **|** to represent a pipe between two commands. You can find it on most keyboard above the backslash **\** character. It’s used like this: + +``` +$ command1 | command2 +``` + +For most simple utilities, you wouldn’t use an output filename option on _command1_, nor an input file option on _command2_. (You might use other options, though.) Instead of using files, you’re sending the output of _command1_ directly into _command2_. You can use as many pipes in a row as needed, creating complex pipelines of several commands in a row. + +This (relatively useless) example combines the commands above: + +``` +$ seq 1 6 | grep 4 +4 +``` + +What happened here? The _seq_ command outputs the integers 1 through 6, one line at a time. The _grep_ command processes that output line by line, searching for a match on the digit **4**, and outputs any matching line. + +Here’s a slightly more useful example. Let’s say you want to find out if TCP port 22, the _ssh_ port, is open on your system. You could find this out using the _ss_ command* by looking through its copious output. Or you could figure out its filter language and use that. Or you could use pipes. For example, pipe it through _grep_ looking for the _ssh_ port label: + +``` +$ ss -tl | grep ssh +LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* +LISTEN 0 128 [::]:ssh [::]:* +``` + +_* Those readers familiar with the venerable_ netstat _command may note it is mostly obsolete, as stated in its [man page][3]._ + +That’s a lot easier than reading through many lines of output. And of course, you can combine redirectors and pipes, for instance: + +``` +$ ss -tl | grep ssh > ssh-listening.txt +``` + +This is barely scratching the surface of pipes. Let your imagination run wild. Have fun piping! + +* * * + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg +[2]: https://fedoramagazine.org/command-line-quick-tips-searching-with-grep/ +[3]: https://linux.die.net/man/8/netstat diff --git a/sources/tech/20190901 How to write zines with simple tools.md b/sources/tech/20190901 How to write zines with simple tools.md new file mode 100644 index 0000000000..05b21f047e --- /dev/null +++ b/sources/tech/20190901 How to write zines with simple tools.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write zines with simple tools) +[#]: via: (https://jvns.ca/blog/2019/09/01/ways-to-write-zines-without-fancy-tools/) +[#]: author: (Julia Evans https://jvns.ca/) + +How to write zines with simple tools +====== + +People often ask me what tools I use to write my zines ([the answer is here][1]). Answering this question as written has always felt slightly off to me, though, and I couldn’t figure out why for a long time. + +I finally realized last week that instead of “what tools do you use to write zines?” some people may have actually wanted to know “how can I do this myself?”! And “buy a $500 iPad” is not a terribly useful answer to that question – it’s not how I got started, iPads are kind of a weird fancy way to write zines, and most people don’t have them. + +So this blog post is about more traditional (and easier to get started with) ways to write zines. + +We’re going to start out by talking about the mechanics of how to write the zine, and then talk about how to assemble it into a booklet. + +### Way 1: Write it on paper + +This is how I made my first zine (spying on your programs with strace) which you can see here: . + +Here’s an example of a page I drew on paper this morning pretty quickly. It looks kind of bad because I scanned it with my phone, but if you use a real scanner (like I did with the strace PDF above), the scanned version comes out better. + + + +### Way 2: Use a Google doc + +The next option is to use a Google doc (or whatever other word processor you prefer). [Here’s the Google doc I wrote for the below image][2], and here’s what it looks like: + + + +They key thing about this Google doc approach is to apply some “less is more”. It’s intended to be printed as part of a booklet on **half** a sheet of letter paper, which means everything needs to be twice as big for it to look good. + +### Way 3: Use an iPad + +This is what I do (use the Notability app on iPad). I’m not going to talk about this method much because this post is about using more readily available tools. + + + +### Way 4: Use a single sheet of paper + +This is a subset of “Write it on paper” – the [Wikibooks page on zine making][3] has a great guide that shows how to write out a tiny zine on 1 piece of paper and then fold it up to make a little booklet. Here are the pictures of the steps from the Wikibooks page: + + + +Sumana Harihareswara’s [Playing with python][4] zine is a nice example of a zine that’s intended to be folded up in that way. + +### Way 5: Adobe Illustrator + +I’ve never used Adobe Illustrator so I’m not going to pretend that I know anything about it or put together an example using it, but I hear it’s a way people do book layout. + +### booklets: the photocopier method + +So you’ve written a bunch of pages and want to assemble them into a booklet. One way to do this (and what I did for my first zine about strace!) is the photocopier method. There’s a great guide by Julia Gfrörer in [this tweet][5], which I’m going to reproduce here: + +![][6] +![][7] +![][8] +![][9] + +That explanation is excellent and I don’t have anything to add. I did it that way and it worked great. + +If you want to buy a print copy of that how-to-make-zines zine from Thruban Press, you can [get it here on Etsy][10]. + +### booklets: the computer method + +If you’ve made your zine in Google Docs or in another computery way, you probably want a more computery way of assembling the pages into a booklet. + +**what I use: pdflatex** + +I do this using the `pdfpages` LaTeX extension. This sounds complicated but it’s not really, you don’t need to learn latex or anything. You just need to have pdflatex on your system, which is a `sudo apt install texlive-base` away on Ubuntu. The steps are: + + 1. Get a PDF with the pages from your zine (pages need to be a multiple of 4) + 2. Get the latex file from [this gist][11] + 3. Replace `/home/bork/http-zine.pdf` with the path to your PDF and `1-28` with `1-however many pages are in your zine`. + 4. run `pdflatex formatted-zine.tex` + 5. Tweak the parameters until it looks the way you want. The [documentation for the pdfpages package is here][12] + + + +I like using this relatively complicated method because there are always small tweaks I want to make like “oh, the right margin is too big, crop it a little bit” and the pdfpages package has tons of options that let me make those tweaks. + +**other methods** + + 1. On Linux you can use the `pdfjam` bash script, which is just a wrapper around the pdfpages latex package. This is what I used to do but today I find it simpler to use the pdfpages latex package directly. + 2. There’s a program called [Booklet Creator][13] for Mac and Windows that [@mrfb uses][14]. It looks pretty simple to use. + 3. If you convert your PDF to a ps file (with `pdf2ps` for instance), `psnup` can do this. I tried `cat file.ps | psbook | psnup -2 > booklet.ps` and it worked, though the resulting PDFs are a little slow to load in my PDF viewer for some reason. + 4. there are probably a ton more ways to do this, if you know more let me know + + + +### making zines is easy and low tech + +That’s all! I mostly wanted to explain that zines are an easy low tech thing to do and if you think making them sounds fun, you definitely 100% do not need to use any fancy expensive tools to do it, you can literally use some sheets of paper, a Sharpie, a pen, and spend $3 at your local print shop to use the photocopier. + +### resources + +summary of the resources I linked to: + + * Guide to putting together zines with a photocopier by Julia Gfrörer: [this tweet][5], [get it on Etsy][10] + * [Wikibooks page on zine making][3] + * Notes on making zines using Google Docs: [this twitter thread][14] + * [Stolen Sharpie Revolution][15] (the first book I read about making zines). You can also get it on Amazon if you want but it’s probably better to buy directly from their site. + * [Booklet Creator][13] + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/01/ways-to-write-zines-without-fancy-tools/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/1160171769833185280 +[2]: https://docs.google.com/document/d/1byzfXC0h6hNFlWXaV9peJpX-GamJOrJ70x9nu1dZ-m0/edit?usp=sharing +[3]: https://en.m.wikibooks.org/wiki/Zine_Making/Putting_pages_together +[4]: https://www.harihareswara.net/pix/playing-with-python-zine/playing-with-python-zine.pdf +[5]: https://twitter.com/thorazos/status/1158556879485906944 +[6]: https://pbs.twimg.com/media/EBQFUC0X4AAPTU1?format=jpg&name=small +[7]: https://pbs.twimg.com/media/EBQFUC0XsAEBhHf?format=jpg&name=small +[8]: https://pbs.twimg.com/media/EBQFUC1XUAAKDIB?format=jpg&name=small +[9]: https://pbs.twimg.com/media/EBQFUDRX4AMkIAr?format=jpg&name=small +[10]: https://www.etsy.com/thorazos/listing/693692176/thuban-press-guide-to-analog-self?utm_source=Copy&utm_medium=ListingManager&utm_campaign=Share&utm_term=so.lmsm&share_time=1565113962419 +[11]: https://gist.github.com/jvns/b3de1d658e2b44aebb485c35fb1a7a0f +[12]: http://texdoc.net/texmf-dist/doc/latex/pdfpages/pdfpages.pdf +[13]: https://www.bookletcreator.com/ +[14]: https://twitter.com/mrfb/status/1159478532545888258 +[15]: http://www.stolensharpierevolution.org/ diff --git a/sources/tech/20190902 How RPM packages are made- the spec file.md b/sources/tech/20190902 How RPM packages are made- the spec file.md new file mode 100644 index 0000000000..c5dace0332 --- /dev/null +++ b/sources/tech/20190902 How RPM packages are made- the spec file.md @@ -0,0 +1,299 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the spec file) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +How RPM packages are made: the spec file +====== + +![][1] + +In the [previous article on RPM package building][2], you saw that source RPMS include the source code of the software, along with a “spec” file. This post digs into the spec file, which contains instructions on how to build the RPM. Again, this article uses _fpaste_ as an example. + +### Understanding the source code + +Before you can start writing a spec file, you need to have some idea of the software that you’re looking to package. Here, you’re looking at fpaste, a very simple piece of software. It is written in Python, and is a one file script. When a new version is released, it’s provided here on Pagure: + +The current version, as the archive shows, is 0.3.9.2. Download it so you can see what’s in the archive: + +``` +$ wget https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz +$ tar -tvf fpaste-0.3.9.2.tar.gz +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/ +-rw-rw-r-- root/root 25 2018-07-25 02:58 fpaste-0.3.9.2/.gitignore +-rw-rw-r-- root/root 3672 2018-07-25 02:58 fpaste-0.3.9.2/CHANGELOG +-rw-rw-r-- root/root 35147 2018-07-25 02:58 fpaste-0.3.9.2/COPYING +-rw-rw-r-- root/root 444 2018-07-25 02:58 fpaste-0.3.9.2/Makefile +-rw-rw-r-- root/root 1656 2018-07-25 02:58 fpaste-0.3.9.2/README.rst +-rw-rw-r-- root/root 658 2018-07-25 02:58 fpaste-0.3.9.2/TODO +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/ +-rw-rw-r-- root/root 3867 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/fpaste.1 +-rwxrwxr-x root/root 24884 2018-07-25 02:58 fpaste-0.3.9.2/fpaste +lrwxrwxrwx root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/fpaste.py -> fpaste +``` + +The files you want to install are: + + * _fpaste.py_: which should go be installed to /usr/bin/. + * _docs/man/en/fpaste.1_: the manual, which should go to /usr/share/man/man1/. + * _COPYING_: the license text, which should go to /usr/share/license/fpaste/. + * _README.rst, TODO_: miscellaneous documentation that goes to /usr/share/doc/fpaste. + + + +Where these files are installed depends on the Filesystem Hierarchy Standard. To learn more about it, you can either read here: or look at the man page on your Fedora system: + +``` +$ man hier +``` + +#### Part 1: What are we building? + +Now that we know what files we have in the source, and where they are to go, let’s look at the spec file. You can see the full file here: + +Here is the first part of the spec file: + +``` +Name: fpaste +Version: 0.3.9.2 +Release: 3%{?dist} +Summary: A simple tool for pasting info onto sticky notes instances +BuildArch: noarch +License: GPLv3+ +URL: https://pagure.io/fpaste +Source0: https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz + +Requires: python3 + +%description +It is often useful to be able to easily paste text to the Fedora +Pastebin at http://paste.fedoraproject.org and this simple script +will do that and return the resulting URL so that people may +examine the output. This can hopefully help folks who are for +some reason stuck without X, working remotely, or any other +reason they may be unable to paste something into the pastebin +``` + +_Name_, _Version_, and so on are called _tags_, and are defined in RPM. This means you can’t just make up tags. RPM won’t understand them if you do! The tags to keep an eye out for are: + + * _Source0_: tells RPM where the source archive for this software is located. + * _Requires_: lists run-time dependencies for the software. RPM can automatically detect quite a few of these, but in some cases they must be mentioned manually. A run-time dependency is a capability (often a package) that must be on the system for this package to function. This is how _[dnf][3]_ detects whether it needs to pull in other packages when you install this package. + * _BuildRequires_: lists the build-time dependencies for this software. These must generally be determined manually and added to the spec file. + * _BuildArch_: the computer architectures that this software is being built for. If this tag is left out, the software will be built for all supported architectures. The value _noarch_ means the software is architecture independent (like fpaste, which is written purely in Python). + + + +This section provides general information about fpaste: what it is, which version is being made into an RPM, its license, and so on. If you have fpaste installed, and look at its metadata, you can see this information included in the RPM: + +``` +$ sudo dnf install fpaste +$ rpm -qi fpaste +Name : fpaste +Version : 0.3.9.2 +Release : 2.fc30 +... +``` + +RPM adds a few extra tags automatically that represent things that it knows. + +At this point, we have the general information about the software that we’re building an RPM for. Next, we start telling RPM what to do. + +#### Part 2: Preparing for the build + +The next part of the spec is the preparation section, denoted by _%prep_: + +``` +%prep +%autosetup +``` + +For fpaste, the only command here is %autosetup. This simply extracts the tar archive into a new folder and keeps it ready for the next section where we build it. You can do more here, like apply patches, modify files for different purposes, and so on. If you did look at the contents of the source rpm for Python, you would have seen lots of patches there. These are all applied in this section. + +Typically anything in a spec file with the **%** prefix is a macro or label that RPM interprets in a special way. Often these will appear with curly braces, such as _%{example}_. + +#### Part 3: Building the software + +The next section is where the software is built, denoted by “%build”. Now, since fpaste is a simple, pure Python script, it doesn’t need to be built. So, here we get: + +``` +%build +#nothing required +``` + +Generally, though, you’d have build commands here, like: + +``` +configure; make +``` + +The build section is often the hardest section of the spec, because this is where the software is being built from source. This requires you to know what build system the tool is using, which could be one of many: Autotools, CMake, Meson, Setuptools (for Python) and so on. Each has its own commands and style. You need to know these well enough to get the software to build correctly. + +#### Part 4: Installing the files + +Once the software is built, it needs to be installed in the _%install_ section: + +``` +%install +mkdir -p %{buildroot}%{_bindir} +make install BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir} +``` + +RPM doesn’t tinker with your system files when building RPMs. It’s far too risky to add, remove, or modify files to a working installation. What if something breaks? So, instead RPM creates an artificial file system and works there. This is referred to as the _buildroot_. So, here in the buildroot, we create _/usr/bin_, represented by the macro _%{_bindir}_, and then install the files to it using the provided Makefile. + +At this point, we have a built version of fpaste installed in our artificial buildroot. + +#### Part 5: Listing all files to be included in the RPM + +The last section of the spec file is the files section, _%files_. This is where we tell RPM what files to include in the archive it creates from this spec file. The fpaste file section is quite simple: + +``` +%files +%{_bindir}/%{name} +%doc README.rst TODO +%{_mandir}/man1/%{name}.1.gz +%license COPYING +``` + +Notice how, here, we do not specify the buildroot. All of these paths are relative to it. The _%doc_ and _%license_ commands simply do a little more—they create the required folders and remember that these files must go there. + +RPM is quite smart. If you’ve installed files in the _%install_ section, but not listed them, it’ll tell you this, for example. + +#### Part 6: Document all changes in the change log + +Fedora is a community based project. Lots of contributors maintain and co-maintain packages. So it is imperative that there’s no confusion about what changes have been made to a package. To ensure this, the spec file contains the last section, the Changelog, _%changelog_: + +``` +%changelog +* Thu Jul 25 2019 Fedora Release Engineering < ...> - 0.3.9.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering < ...> - 0.3.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jul 24 2018 Ankur Sinha - 0.3.9.2-1 +- Update to 0.3.9.2 + +* Fri Jul 13 2018 Fedora Release Engineering < ...> - 0.3.9.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering < ..> - 0.3.9.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Sep 10 2017 Vasiliy N. Glazov < ...> - 0.3.9.1-2 +- Cleanup spec + +* Fri Sep 08 2017 Ankur Sinha - 0.3.9.1-1 +- Update to latest release +- fixes rhbz 1489605 +... +.... +``` + +There must be a changelog entry for _every_ change to the spec file. As you see here, while I’ve updated the spec as the maintainer, others have too. Having the changes documented clearly helps everyone know what the current status of the spec is. For all packages installed on your system, you can use rpm to see their changelogs: + +``` +$ rpm -q --changelog fpaste +``` + +### Building the RPM + +Now we are ready to build the RPM. If you want to follow along and run the commands below, please ensure that you followed the steps [in the previous post][2] to set your system up for building RPMs. + +We place the fpaste spec file in _~/rpmbuild/SPECS_, the source code archive in _~/rpmbuild/SOURCES/_ and can now create the source RPM: + +``` +$ cd ~/rpmbuild/SPECS +$ wget https://src.fedoraproject.org/rpms/fpaste/raw/master/f/fpaste.spec + +$ cd ~/rpmbuild/SOURCES +$ wget https://pagure.io/fpaste/archive/0.3.9.2/fpaste-0.3.9.2.tar.gz + +$ cd ~/rpmbuild/SOURCES +$ rpmbuild -bs fpaste.spec +Wrote: /home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +``` + +Let’s have a look at the results: + +``` +$ ls ~/rpmbuild/SRPMS/fpaste* +/home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm + +$ rpm -qpl ~/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +There we are — the source rpm has been built. Let’s build both the source and binary rpm together: + +``` +$ cd ~/rpmbuild/SPECS +$ rpmbuild -ba fpaste.spec +.. +.. +.. +``` + +RPM will show you the complete build output, with details on what it is doing in each section that we saw before. This “build log” is extremely important. When builds do not go as expected, we packagers spend lots of time going through them, tracing the complete build path to see what went wrong. + +That’s it really! Your ready-to-install RPMs are where they should be: + +``` +$ ls ~/rpmbuild/RPMS/noarch/ +fpaste-0.3.9.2-3.fc30.noarch.rpm +``` + +### Recap + +We’ve covered the basics of how RPMs are built from a spec file. This is by no means an exhaustive document. In fact, it isn’t documentation at all, really. It only tries to explain how things work under the hood. Here’s a short recap: + + * RPMs are of two types: _source_ and _binary_. + * Binary RPMs contain the files to be installed to use the software. + * Source RPMs contain the information needed to build the binary RPMs: the complete source code, and the instructions on how to build the RPM in the spec file. + * The spec file has various sections, each with its own purpose. + + + +Here, we’ve built RPMs locally, on our Fedora installations. While this is the basic process, the RPMs we get from repositories are built on dedicated servers with strict configurations and methods to ensure correctness and security. This Fedora packaging pipeline will be discussed in a future post. + +Would you like to get started with building packages, and help the Fedora community maintain the massive amount of software we provide? You can [start here by joining the package collection maintainers][4]. + +For any queries, post to the [Fedora developers mailing list][5]—we’re always happy to help! + +### References + +Here are some useful references to building RPMs: + + * + * + * + * + + + +* * * + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ +[3]: https://fedoramagazine.org/managing-packages-fedora-dnf/ +[4]: https://fedoraproject.org/wiki/Join_the_package_collection_maintainers +[5]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md b/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md new file mode 100644 index 0000000000..10811483db --- /dev/null +++ b/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith) +[#]: via: (https://itsfoss.com/regolith-linux-desktop/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith +====== + +_**Brief: Using tiling window manager in Linux can be tricky with all those configuration. Regolith gives you an out of box i3wm experience within Ubuntu.**_ + +Perhaps you have come across desktop screenshot like the one below in some forums. If you haven’t, try checking this [subreddit][1]. You might have wondered how could people make their Linux desktop look so beautiful. + +![Linux Ricing Example | Image Source][2] + +Of course, you can make your own desktop look good by changing the icon, theme and wallpaper but you might still not achieve the same result. + +In majority of cases, a tiling window manager is used instead of the regular floating window manager. Ahmm! what’s a tiling window manager? Let me quickly explain it to you. + +### Tiling window manager + +The concept of tiling window manager is simple. Instead of stacking new program window over the other programs, it tiles the programs side by side. So the first program takes up the entire screen. The next one is tiled to its side either horizontally or vertically and so on. + +![AwesomeWM Tiling Window Manager][3] + +Sounds good but what happens when you have tens of programs open? It will be unusable won’t it? This is where the workspaces save your day. You can switch to new workspace and open new programs here. Switching between workspaces is just one or two keystroke away. + +Tiling window manager can be overwhelming for you if you have never used it. It requires you to remember keyboard shortcuts to use it efficiently. But that’s not the end of trouble. Even if you install a tiling window manager like [i3wm][4] or [awesome][5], you won’t get a beautiful desktop out of the box. In fact, it could even look uglier than before. + +You see, all those mesmerizing desktops are result of personal customization. The [tiling window managers are highly configurable but you need to learn to customize them][6]. That’s not very comforting specially for someone who has never used a tiling window manager. + +If you are one of those people who wanted to have a good looking desktop with tiling window manager but could never configured them properly, the Linux ricing gods have heard your prayers. + +### Regolith is dream come true for tiling window noobs + +![Regolith Linux Desktop][7] + +[Regolith][8] is a Linux distribution that brings Ubuntu’s simplicity, GNOME’s configuration and i3wm’s tiling interface together. + +Wait! Don’t we already have enough of Ubuntu-based distributions that change nothing more than the theme and wallpaper? Regolith doesn’t want to be that kind of distribution. In fact, Regolith doesn’t pretend to be a standalone distribution. + +Its [developer experimented with i3wm][9], tweaked it to his liking but soon realized that he had to do it all over again on all the systems he used. That’s when he decided to package it so that he could use it easily on new system. And hence Regolith Linux was born as a customized version of Ubuntu. + +The developer totally understands that not everyone would be willing to replace their existing Ubuntu system just to get a tiling window manager and this is why he has made it available as a desktop as well. This means if you are already running Ubuntu, you can install Regolith desktop and use it beside your regular desktop environment. + +### Install Regolith desktop on Ubuntu + +Regolith desktop is available through [PPA in Ubuntu][10] 18.04 and higher versions. You can install it using the following commands: + +``` +sudo add-apt-repository -y ppa:kgilmer/regolith-stable +sudo apt install regolith-desktop +``` + +Once you have installed it, reboot your system. At the user login screen, click the username and you should see a gear symbol, Click on it and it would give you the option to change the desktop environment. + +![Switch to Regolith Desktop][11] + +### Using tiling window manager with Regolith + +When you log in to the Regolith desktop, you’ll see a plain simple screen with some keyboard shortcuts displayed on the right side, a thin bottom panel with only a few system information. You can find the keyboard shortcut information on [this page][12] as well. + +The keyboard shortcut will help you get started. You can search for an application or settings by pressing Super (Windows) and space key. + +![Regolith App Launcher][13] + +By default, the new program windows are tiled vertically. You can toggle that with Super+Backspace key. Do note that the tiling and toggling is related to the program window in focus. If you have three program windows and you are using the first program window, the next program will be tiled (vertically or horizontally) after it, not after the third program window. It takes some time in getting used to this concept. + +![Multiple Program Windows in Regolith Desktop][14] + +If you don’t like the layout of the windows, you can move them around using the Super+Shift+Arrow keys. You can move between the application windows using Super and Arrow keys. + +If your screen is filled with applications and you want to breath fresh, press Super key and 2 (or 3 or 4, depending upon number of workspaces in use) and start afresh with a new workspace. The new workspace has the keyboard shortcut on the display. You can toggle it with Super+Shift+? key combination. + +Regolith uses GNOME underneath so you can still use GNOME tools to change the system settings. + +Regolith comes with four different color themes with solarized dark being the default. It uses Arc icon themes. Changing the icon theme is same as Ubuntu but if you want to change the color, you need to do some minor tweaking in the configuration file. You can find the configuration information on [this page][15]. + +![Regolith Desktop With Nord Color Scheme][16] + +You can log out of Regolith using the Super+Shift+E key combination. The keyboard shortcuts displayed on the desktop is not correct for logging out. + +Since I have never used i3wm or any other tiling window manager, I find it weird that there is no shutdown option here. You’ll have to use [command line to shutdown Ubuntu here][17]. + +You can find some [useful information to get started with Regolith desktop here][18]. + +### Getting rid of Regolith desktop + +I can understand if you didn’t like Regolith enough to use it as your main desktop. Tiling window manager is not everyone’s cup of tea (or coffee). The good thing is that you can go back to your regular desktop environment the same way you switch to Regolith. + +Log out of your account. Click on the username and you’ll see the gear icon. Click on it and select the desktop environment you want to use. + +Once you are back to the other desktop environment, you may even choose to remove Regolith completely. Note that you MUST be using some other desktop environment while removing Regolith. + +Open a terminal and use the following commands: + +``` +sudo apt remove regolith-desktop +``` + +You can [remove the PPA][19] as well: + +``` +sudo add-apt-repository --remove ppa:kgilmer/regolith-stable +``` + +### To tile, or not to tile, that is the question + +![Regolith Desktop on my Ubuntu 18.04 LTS][20] + +Personally, I am happy to have discovered Regolith desktop. I have been fascinated by the tiling window managers but I didn’t want to spend time on figuring out the configuration. Regolith gives me the comfort of using i3wm out of the box with my main distribution, Ubuntu. + +I like it more as a desktop than a distribution. It gives the opportunity to try out tiling window manager without a lot of hassle. + +Do you like the concept of Regolith desktop? Are you willing to give it a try? How’s your experience with tiling window manager (if any)? Do share your views in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/regolith-linux-desktop/ + +作者:[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.reddit.com/r/unixporn/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-ricing-example.jpg?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/awesome-window-anager.jpg?resize=800%2C450&ssl=1 +[4]: https://i3wm.org/ +[5]: https://awesomewm.org/ +[6]: https://fedoramagazine.org/getting-started-i3-window-manager/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-linux-desktop-screenshot-apps.jpg?ssl=1 +[8]: https://regolith-linux.org/ +[9]: https://regolith-linux.org/motivations.html +[10]: https://itsfoss.com/ppa-guide/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/change-to-regolith-desktop.jpg?resize=800%2C400&ssl=1 +[12]: https://regolith-linux.org/keybindings.html +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-app-launcher.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-tiled-windows.jpg?ssl=1 +[15]: https://regolith-linux.org/configuring.html +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-with-nord-color-scheme.jpg?ssl=1 +[17]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[18]: https://regolith-linux.org/getting_started.html +[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-screenshot.jpg?ssl=1 diff --git a/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md b/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md new file mode 100644 index 0000000000..b5626f9abb --- /dev/null +++ b/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Humbleness key to open source success, Kubernetes security struggles, and more industry trends) +[#]: via: (https://opensource.com/article/19/9/kubernetes-security-struggles-and-more) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Humbleness key to open source success, Kubernetes security struggles, 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. + +## [How will open source deal with success?][2] + +> “The old school model is quarterly growth and never over-extend yourself,” Wright explained. “The newer model is very different. You look at it as a big upfront investment and then capture the most mindshare or market share that you possibly can and growth is more important than profitability. If you flip that from a business context to an open source community context, if the metrics are all about growth and not about sustainability then you are going to incentive the wrong kind of behavior and that’s the thing that worries me.” + +**The impact:** The importance of this could easily be summarized as "be humble." A hot streak can easily change the thinking from "we can do anything together" to "nothing can stop this" and of course pride comes before the fall. + +## [10 Quarkus videos to get you up to speed with supersonic, subatomic Java][3] + +> Maybe you’ve heard about [Quarkus][4], also known as supersonic, subatomic Java. According to [Quarkus.io][5], it’s a [Kubernetes][6]-native Java stack tailored for GraalVM and OpenJDK HotSpot, crafted from the best of breed Java libraries and standards. +> +> To help you learn more, we’ve rounded up 10 talks showing Quarkus in action. These videos will take your Quarkus knowledge to the next level. + +**The impact**: The promise of the second sentence is to help you understand what the first one means. Videos 4 (Taste of serverless application development) and 9 (Build Eclipse MicroProfile apps quickly with Quarkus) are probably the most practical. + +## [exFAT in the Linux kernel? Yes!][7] + +> It’s important to us that the Linux community can make use of exFAT included in the Linux kernel with confidence. To this end, we will be making Microsoft’s technical specification for exFAT publicly available to facilitate development of conformant, interoperable implementations. We also support the eventual inclusion of a Linux kernel with exFAT support in a future revision of the Open Invention Network’s Linux System Definition, where, once accepted, the code will benefit from the defensive patent commitments of OIN’s 3040+ members and licensees. + +**The impact**: exFAT is a lowest common denominator filesystem (your microwave can probably read exFAT-formatted USB drives). At the very least, Apple no longer has to license the format. Open sourcing it could just be a good way to squeeze out the last little bit of juice. + +## [Announcing the CNCF Kubernetes Project Journey Report][8] + +> We wanted to create a series of reports that help explain our nurturing efforts and some of the positive trends and outcomes we see developing around our hosted projects. This report attempts to objectively assess the state of the Kubernetes project and how the CNCF has impacted the progress and growth of Kubernetes. We recognize that it’s impossible to sort out correlation and causation but this report attempts to document correlations. For the report, we pulled data from multiple sources, particularly CNCF’s own [DevStats tool][9], which provides detailed development statistics for all CNCF projects. + +**The impact**: On the one hand the CNCF clearly has an interest in making donor organizations feel like their money is being well spent. On the other hand, the money is clearly being well spent: the year-on-year stats improvement is incredible. + +## [The continuing rise of Kubernetes analysed: Security struggles and lifecycle learnings][10] + +> In an early sign of Kubernetes going mainstream, in 2016 Niantic released the massively popular mobile game Pokémon Go, which was built on Kubernetes and deployed in Google Container Engine. At launch, the game experienced usability issues caused by a massive user interest in U.S—the number of users logging in ended up being 50x the original estimation, and 10x the prediction for worst case scenario. By using the inherent scalability advantages of Kubernetes, Pokémon Go went on to successfully launch in Japan two weeks later despite traffic tripling what was experienced during the U.S launch. + +**The impact**: Two things stood out to me: 1) Kubernetes powers Pokemon (!?!) and 2) 2016 seems like so long ago. Sure, the stuff about containers and Kubernetes pushing organizations to adopt new security approaches and the bit about their biggest security concerns (misconfiguration) is interesting but... Pokemon! + +_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/19/9/kubernetes-security-struggles-and-more + +作者:[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.sdxcentral.com/articles/opinion-editorial/how-will-open-source-deal-with-success/2019/08/ +[3]: https://developers.redhat.com/blog/2019/08/26/10-quarkus-videos-to-get-you-up-to-speed-with-supersonic-subatomic-java/ +[4]: https://developers.redhat.com/blog/2019/05/09/create-your-first-quarkus-project-with-eclipse-ide-red-hat-codeready-studio/ +[5]: https://quarkus.io/ +[6]: https://developers.redhat.com/topics/kubernetes/ +[7]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[8]: https://www.cncf.io/blog/2019/08/29/announcing-the-cncf-kubernetes-project-journey-report/ +[9]: https://k8s.devstats.cncf.io/d/12/dashboards?orgId=1&refresh=15m +[10]: https://www.cloudcomputing-news.net/news/2019/aug/29/continuing-rise-kubernetes-analysed-security-struggles-and-lifecycle-learnings/ diff --git a/sources/tech/20190904 Environment variables in PowerShell.md b/sources/tech/20190904 Environment variables in PowerShell.md new file mode 100644 index 0000000000..9345aa0230 --- /dev/null +++ b/sources/tech/20190904 Environment variables in PowerShell.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Environment variables in PowerShell) +[#]: via: (https://opensource.com/article/19/9/environment-variables-powershell) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/seth) + +Environment variables in PowerShell +====== +Up your PowerShell game with environment variables, in Part 2.5 of the +"Variables in shells" miniseries. +![Hands programming][1] + +Environment variables are global settings for your Linux, Mac, or Windows computer, stored for the system shell to use when executing commands. Many are set by default during installation or user creation. + +For instance, your home directory is set as an environment variable when you log in. How it looks in PowerShell depends on your operating system. + +On Windows: + + +``` +PS C:\Users\bogus> Get-Variable HOME -valueOnly +C:\Users\bogus +``` + +On Linux: + + +``` +pwsh> Get-Variable HOME -valueOnly +HOME=/home/seth +``` + +On a Mac: + + +``` +pwsh> Get-Variable HOME -valueOnly +HOME=/Users/bogus +``` + +You usually don’t use environment variables directly, but they’re referenced by individual applications and daemons as needed. However, environment variables can be useful when you want to override default settings, or when you need to manage new settings that your system has no reason to create on its own. + +This article is about environment variables in the open source PowerShell environment, and so it’s applicable to PowerShell running on Windows, Linux, and Mac. Users of the Bash shell should refer to my article about [Bash environment variables][2]. + +For this article, I ran PowerShell on the open source operating system Linux. The commands are the same regardless of your platform, although the output will differ (for instance, it is statistically unlikely that your username is **seth**). + +### What are environment variables? + +Environment variables in PowerShell are special kinds of variables that provide the system with information about the operating system environment. With environment variables, you can view and change variables in the Windows registry, as well as variables set for a particular session. + +In PowerShell, environment variables are stored in the **Env:** "drive", accessible through the _PowerShell environment provider_, a subsystem of PowerShell. This isn’t a physical drive, but a virtual file system. + +Because environment variables exist in the **Env:** drive, you must prepend **Env:** to the variable name when you reference them. Alternatively, you can set your working location to the **Env:** drive with the **Set-Location** command so you can treat all environment variables as local variables: + + +``` +PS> Set-Location Env: +PS> pwd + +Path +\---- +Env:/ +``` + +Environment variables convey information about your login session to your computer. For instance, when an application needs to determine where to save a data file by default, it usually calls upon the **HOME** environment variable. You probably never set the **HOME** variable yourself, and yet it exists because most environment variables are managed by your operating system. + +You can view all environment variables set on your system with the **Get-ChildItem** command from within the **Env:** drive. The list is long, so pipe the output through **out-host -paging** to make it easy to read: + + +``` +PS> Get-ChildItem | out-host -paging +LOGNAME      seth +LS_COLORS    rs=0:mh=00:bd=48;5;232;38;5; +MAIL         /var/spool/mail/seth +MODULEPATH   /etc/scl/modulefiles:/etc/scl/modulefiles +MODULESHOME  /usr/share/Modules +OLDPWD       /home/seth +PATH         /opt/microsoft/powershell/6:/usr/share/Modules/bin +PSModulePath /home/seth/.local/share/powershell/Modules +PWD          /home/seth +[...] +``` + +If you’re not in the **Env:** drive, then you can do the same thing by adding **Env: **to your command: + + +``` +PS> Get-ChildItem Env: | out-host -paging +LOGNAME      seth +LS_COLORS    rs=0:mh=00:bd=48;5;232;38;5; +MAIL         /var/spool/mail/seth +MODULEPATH   /etc/scl/modulefiles:/etc/scl/modulefiles +``` + +Environment variables can be set, recalled, and cleared with some of the same syntax used for normal variables. Like other variables, anything you set during a session only applies to that particular session. + +If you want to make permanent changes to a variable, you must change them in Windows Registry on Windows, or in a shell configuration file (such as **~/.bashrc**) on Linux or Mac. If you’re not familiar with using variables in PowerShell, read my [variables in PowerShell][3] article before continuing. + +### What are environment variables used for? + +Different environment variables get used by several different systems within your computer. Your **PATH** variable is vital to your shell, for instance, but a lot less significant to, say, Java (which also has paths, but they’re paths to important Java libraries rather than general system folders). However, the **USER** variable is used by several different processes to identify who is requesting a service. + +An installer wizard, like the open source [Nullsoft Scriptable Install System (NSIS)][4] framework, updates your environment variables when you’re installing a new application. Sometimes, when you’re installing something outside of your operating system’s intended toolset, you may have to manage an environment variable yourself. Or, you might choose to add an environment variable to suit your preferences. + +### How are they different from regular variables? + +When you create a normal variable, the variable is considered local, meaning that it’s not defined outside of the shell that created it. + +For example, create a variable: + + +``` +PS> Set-Variable -Name VAR -Value "example" +PS> gv VAR -valueOnly +example +``` + +Launch a new shell, even from within your current shell: + + +``` +PS> pwsh +PS c:\> gv VAR -valueOnly +gv : Cannot find a variable with the name 'example'. +``` + +Environment variables, on the other hand, are meant to be global in scope. They exist separately from the shell that created them and are available to other processes. + +### How do you set an environment variable? + +When setting an environment variable, you should be explicit that it is an environment variable by using the **$Env:** notation: + + +``` +PS Env:/> $Env:FOO = "hello world" +PS Env:/> Get-ChildItem FOO +hello world +``` + +As a test, launch a new session and access the variable you’ve just created. Because the variable is an environment variable, though, you must prepend it with **$Env:**: + + +``` +PS Env:/> pwsh +PS c:\> $Env.FOO +hello world +``` + +Even though you’ve made a variable available to child processes, it’s still just a temporary variable. It works, you can verify that it exists, you can use it from any process, but it is destroyed when the shell that created it is closed. + +### How do you set environment variables in your profile? + +To force an environment variable to persist across sessions, you must add it to your PowerShell profile, such as your **CurrentUser,AllHosts** profile, located in **HOME/Documents/Profile.ps1**: + + +``` +PS> Add-Content -Path $Profile.CurrentUserAllHosts -Value '$Env:FOO = "hello world"' +``` + +With this line added, any PowerShell session launched instantiates the **FOO** environment variable and sets its value to **hello world**. + +There are currently six default profiles controlling PowerShell sessions, so refer to the [Microsoft dev blog][5] for more information. + +### How do you discover new environment variables? + +You can create and manipulate environment variables at will, and some applications do just that. This fact means that many of your environment variables aren’t used by most of your applications, and if you add your own arbitrary variables then some could be used by nothing at all. + +So the question is: How do you find out which environment variables are meaningful? The answer lies in an application’s documentation. + +Python, for instance, offers to add the appropriate Python path to your **Path** environment variable during install. **[Note: PATH?]** If you decline, you can set the value yourself now that you know how to modify environment variables. + +The same is true for any application you install: The installer is expected to add the appropriate variables to your environment, so you should never need to modify **Env:** manually. If you’re developing an application, then your installer should do the same for your users. + +To discover significant variables for individual applications, refer to their user and developer documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/environment-variables-powershell + +作者:[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/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/article/19/8/what-are-environment-variables +[3]: https://opensource.com/article/19/8/variables-powershell +[4]: https://sourceforge.net/projects/nsis/ +[5]: https://devblogs.microsoft.com/scripting/understanding-the-six-powershell-profiles diff --git a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md new file mode 100644 index 0000000000..44b4d6cd24 --- /dev/null +++ b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md @@ -0,0 +1,255 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building CI/CD pipelines with Jenkins) +[#]: via: (https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +Building CI/CD pipelines with Jenkins +====== +Build continuous integration and continuous delivery (CI/CD) pipelines +with this step-by-step Jenkins tutorial. +![pipelines][1] + +In my article [_A beginner's guide to building DevOps pipelines with open source tools_][2], I shared a story about building a DevOps pipeline from scratch. The core technology driving that initiative was [Jenkins][3], an open source tool to build continuous integration and continuous delivery (CI/CD) pipelines. + +At Citi, there was a separate team that provided dedicated Jenkins pipelines with a stable master-slave node setup, but the environment was only used for quality assurance (QA), staging, and production environments. The development environment was still very manual, and our team needed to automate it to gain as much flexibility as possible while accelerating the development effort. This is the reason we decided to build a CI/CD pipeline for DevOps. And the open source version of Jenkins was the obvious choice due to its flexibility, openness, powerful plugin-capabilities, and ease of use. + +In this article, I will share a step-by-step walkthrough on how you can build a CI/CD pipeline using Jenkins. + +### What is a pipeline? + +Before jumping into the tutorial, it's helpful to know something about CI/CD pipelines. + +To start, it is helpful to know that Jenkins itself is not a pipeline. Just creating a new Jenkins job does not construct a pipeline. Think about Jenkins like a remote control—it's the place you click a button. What happens when you do click a button depends on what the remote is built to control. Jenkins offers a way for other application APIs, software libraries, build tools, etc. to plug into Jenkins, and it executes and automates the tasks. On its own, Jenkins does not perform any functionality but gets more and more powerful as other tools are plugged into it. + +A pipeline is a separate concept that refers to the groups of events or jobs that are connected together in a sequence: + +> A **pipeline** is a sequence of events or jobs that can be executed. + +The easiest way to understand a pipeline is to visualize a sequence of stages, like this: + +![Pipeline example][4] + +Here, you should see two familiar concepts: _Stage_ and _Step_. + + * **Stage:** A block that contains a series of steps. A stage block can be named anything; it is used to visualize the pipeline process. + * **Step:** A task that says what to do. Steps are defined inside a stage block. + + + +In the example diagram above, Stage 1 can be named "Build," "Gather Information," or whatever, and a similar idea is applied for the other stage blocks. "Step" simply says what to execute, and this can be a simple print command (e.g., **echo "Hello, World"**), a program-execution command (e.g., **java HelloWorld**), a shell-execution command (e.g., **chmod 755 Hello**), or any other command—as long as it is recognized as an executable command through the Jenkins environment. + +The Jenkins pipeline is provided as a _codified script_ typically called a **Jenkinsfile**, although the file name can be different. Here is an example of a simple Jenkins pipeline file. + + +``` +// Example of Jenkins pipeline script + +pipeline { +  stages { +    stage("Build") { +       steps { +          // Just print a Hello, Pipeline to the console +          echo "Hello, Pipeline!" +          // Compile a Java file. This requires JDKconfiguration from Jenkins +          javac HelloWorld.java +          // Execute the compiled Java binary called HelloWorld. This requires JDK configuration from Jenkins +          java HelloWorld +          // Executes the Apache Maven commands, clean then package. This requires Apache Maven configuration from Jenkins +          mvn clean package ./HelloPackage +          // List the files in current directory path by executing a default shell command +          sh "ls -ltr" +       } +   } +   // And next stages if you want to define further... + } // End of stages +} // End of pipeline +``` + +It's easy to see the structure of a Jenkins pipeline from this sample script. Note that some commands, like **java**, **javac**, and **mvn**, are not available by default, and they need to be installed and configured through Jenkins. Therefore: + +> A **Jenkins pipeline** is the way to execute a Jenkins job sequentially in a defined way by codifying it and structuring it inside multiple blocks that can include multiple steps containing tasks. + +OK. Now that you understand what a Jenkins pipeline is, I'll show you how to create and execute a Jenkins pipeline. At the end of the tutorial, you will have built a Jenkins pipeline like this: + +![Final Result][5] + +### How to build a Jenkins pipeline + +To make this tutorial easier to follow, I created a sample [GitHub repository][6] and a video tutorial. + +Before starting this tutorial, you'll need: + + * **Java Development Kit:** If you don't already have it, install a JDK and add it to the environment path so a Java command (like **java jar**) can be executed through a terminal. This is necessary to leverage the Java Web Archive (WAR) version of Jenkins that is used in this tutorial (although you can use any other distribution). + * **Basic computer operations:** You should know how to type some code, execute basic Linux commands through the shell, and open a browser. + + + +Let's get started. + +#### Step 1: Download Jenkins + +Navigate to the [Jenkins download page][7]. Scroll down to **Generic Java package (.war)** and click on it to download the file; save it someplace where you can locate it easily. (If you choose another Jenkins distribution, the rest of tutorial steps should be pretty much the same, except for Step 2.) The reason to use the WAR file is that it is a one-time executable file that is easily executable and removable. + +![Download Jenkins as Java WAR file][8] + +#### Step 2: Execute Jenkins as a Java binary + +Open a terminal window and enter the directory where you downloaded Jenkins with **cd <your path>**. (Before you proceed, make sure JDK is installed and added to the environment path.) Execute the following command, which will run the WAR file as an executable binary: + + +``` +`java -jar ./jenkins.war` +``` + +If everything goes smoothly, Jenkins should be up and running at the default port 8080. + +![Execute as an executable JAR binary][9] + +#### Step 3: Create a new Jenkins job + +Open a web browser and navigate to **localhost:8080**. Unless you have a previous Jenkins installation, it should go straight to the Jenkins dashboard. Click **Create New Jobs**. You can also click **New Item** on the left. + +![Create New Job][10] + +#### Step 4: Create a pipeline job + +In this step, you can select and define what type of Jenkins job you want to create. Select **Pipeline** and give it a name (e.g., TestPipeline). Click **OK** to create a pipeline job. + +![Create New Pipeline Job][11] + +You will see a Jenkins job configuration page. Scroll down to find** Pipeline section**. There are two ways to execute a Jenkins pipeline. One way is by _directly writing a pipeline script_ on Jenkins, and the other way is by retrieving the _Jenkins file from SCM_ (source control management). We will go through both ways in the next two steps. + +#### Step 5: Configure and execute a pipeline job through a direct script + +To execute the pipeline with a direct script, begin by copying the contents of the [sample Jenkinsfile][6] from GitHub. Choose **Pipeline script** as the **Destination** and paste the **Jenkinsfile** contents in **Script**. Spend a little time studying how the Jenkins file is structured. Notice that there are three Stages: Build, Test, and Deploy, which are arbitrary and can be anything. Inside each Stage, there are Steps; in this example, they just print some random messages. + +Click **Save** to keep the changes, and it should automatically take you back to the Job Overview. + +![Configure to Run as Jenkins Script][12] + +To start the process to build the pipeline, click **Build Now**. If everything works, you will see your first pipeline (like the one below). + +![Click Build Now and See Result][13] + +To see the output from the pipeline script build, click any of the Stages and click **Log**. You will see a message like this. + +![Visit sample GitHub with Jenkins get clone link][14] + +#### Step 6: Configure and execute a pipeline job with SCM + +Now, switch gears: In this step, you will Deploy the same Jenkins job by copying the **Jenkinsfile** from a source-controlled GitHub. In the same [GitHub repository][6], pick up the repository URL by clicking **Clone or download** and copying its URL. + +![Checkout from GitHub][15] + +Click **Configure** to modify the existing job. Scroll to the **Advanced Project Options** setting, but this time, select the **Pipeline script from SCM** option in the **Destination** dropdown. Paste the GitHub repo's URL in the **Repository URL**, and type **Jenkinsfile** in the **Script Path**. Save by clicking the **Save** button. + +![Change to Pipeline script from SCM][16] + +To build the pipeline, once you are back to the Task Overview page, click **Build Now** to execute the job again. The result will be the same as before, except you have one additional stage called **Declaration: Checkout SCM**. + +![Build again and verify][17] + +To see the pipeline's output from the SCM build, click the Stage and view the **Log** to check how the source control cloning process went. + +![Verify Checkout Procedure][18] + +### Do more than print messages + +Congratulations! You've built your first Jenkins pipeline! + +"But wait," you say, "this is very limited. I cannot really do anything with it except print dummy messages." That is OK. So far, this tutorial provided just a glimpse of what a Jenkins pipeline can do, but you can extend its capabilities by integrating it with other tools. Here are a few ideas for your next project: + + * Build a multi-staged Java build pipeline that takes from the phases of pulling dependencies from JAR repositories like Nexus or Artifactory, compiling Java codes, running the unit tests, packaging into a JAR/WAR file, and deploying to a cloud server. + * Implement the advanced code testing dashboard that will report back the health of the project based on the unit test, load test, and automated user interface test with Selenium.  + * Construct a multi-pipeline or multi-user pipeline automating the tasks of executing Ansible playbooks while allowing for authorized users to respond to task in progress. + * Design a complete end-to-end DevOps pipeline that pulls the infrastructure resource files and configuration files stored in SCM like GitHub and executing the scripts through various runtime programs. + + + +Follow any of the tutorials at the end of this article to get into these more advanced cases. + +#### Manage Jenkins + +From the main Jenkins dashboard, click **Manage Jenkins**. + +![Manage Jenkins][19] + +#### Global tool configuration + +There are many options available, including managing plugins, viewing the system log, etc. Click **Global Tool Configuration**. + +![Global Tools Configuration][20] + +#### Add additional capabilities + +Here, you can add the JDK path, Git, Gradle, and so much more. After you configure a tool, it is just a matter of adding the command into your Jenkinsfile or executing it through your Jenkins script. + +![See Various Options for Plugin][21] + +### Where to go from here? + +This article put you on your way to creating a CI/CD pipeline using Jenkins, a cool open source tool. To find out about many of the other things you can do with Jenkins, check out these other articles on Opensource.com: + + * [Getting started with Jenkins X][22] + * [Install an OpenStack cloud with Jenkins][23] + * [Running Jenkins builds in containers][24] + * [Getting started with Jenkins pipelines][25] + * [How to run JMeter with Jenkins][26] + * [Integrating OpenStack into your Jenkins workflow][27] + + + +You may be interested in some of the other articles I've written to supplement your open source journey: + + * [9 open source tools for building a fault-tolerant system][28] + * [Understanding software design patterns][29] + * [A beginner's guide to building DevOps pipelines with open source tools][2] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pipe-pipeline-grid.png?itok=kkpzKxKg (pipelines) +[2]: https://opensource.com/article/19/4/devops-pipeline +[3]: https://jenkins.io/ +[4]: https://opensource.com/sites/default/files/uploads/diagrampipeline.jpg (Pipeline example) +[5]: https://opensource.com/sites/default/files/uploads/0_endresultpreview_0.jpg (Final Result) +[6]: https://github.com/bryantson/CICDPractice +[7]: https://jenkins.io/download/ +[8]: https://opensource.com/sites/default/files/uploads/2_downloadwar.jpg (Download Jenkins as Java WAR file) +[9]: https://opensource.com/sites/default/files/uploads/3_runasjar.jpg (Execute as an executable JAR binary) +[10]: https://opensource.com/sites/default/files/uploads/4_createnewjob.jpg (Create New Job) +[11]: https://opensource.com/sites/default/files/uploads/5_createpipeline.jpg (Create New Pipeline Job) +[12]: https://opensource.com/sites/default/files/uploads/6_runaspipelinescript.jpg (Configure to Run as Jenkins Script) +[13]: https://opensource.com/sites/default/files/uploads/7_buildnow4script.jpg (Click Build Now and See Result) +[14]: https://opensource.com/sites/default/files/uploads/8_seeresult4script.jpg (Visit sample GitHub with Jenkins get clone link) +[15]: https://opensource.com/sites/default/files/uploads/9_checkoutfromgithub.jpg (Checkout from GitHub) +[16]: https://opensource.com/sites/default/files/uploads/10_runsasgit.jpg (Change to Pipeline script from SCM) +[17]: https://opensource.com/sites/default/files/uploads/11_seeresultfromgit.jpg (Build again and verify) +[18]: https://opensource.com/sites/default/files/uploads/12_verifycheckout.jpg (Verify Checkout Procedure) +[19]: https://opensource.com/sites/default/files/uploads/13_managingjenkins.jpg (Manage Jenkins) +[20]: https://opensource.com/sites/default/files/uploads/14_globaltoolsconfiguration.jpg (Global Tools Configuration) +[21]: https://opensource.com/sites/default/files/uploads/15_variousoptions4plugin.jpg (See Various Options for Plugin) +[22]: https://opensource.com/article/18/11/getting-started-jenkins-x +[23]: https://opensource.com/article/18/4/install-OpenStack-cloud-Jenkins +[24]: https://opensource.com/article/18/4/running-jenkins-builds-containers +[25]: https://opensource.com/article/18/4/jenkins-pipelines-with-cucumber +[26]: https://opensource.com/life/16/7/running-jmeter-jenkins-continuous-delivery-101 +[27]: https://opensource.com/business/15/5/interview-maish-saidel-keesing-cisco +[28]: https://opensource.com/article/19/3/tools-fault-tolerant-system +[29]: https://opensource.com/article/19/7/understanding-software-design-patterns diff --git a/sources/tech/20190905 Don-t force allocations on the callers of your API.md b/sources/tech/20190905 Don-t force allocations on the callers of your API.md new file mode 100644 index 0000000000..eca6cc3732 --- /dev/null +++ b/sources/tech/20190905 Don-t force allocations on the callers of your API.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don’t force allocations on the callers of your API) +[#]: via: (https://dave.cheney.net/2019/09/05/dont-force-allocations-on-the-callers-of-your-api) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Don’t force allocations on the callers of your API +====== + +This is a post about performance. Most of the time when worrying about the performance of a piece of code the overwhelming advice should be (with apologies to Brendan Gregg) _don’t worry about it, yet._ However there is one area where I counsel developers to think about the performance implications of a design, and that is API design. + +Because of the high cost of retrofitting a change to an API’s signature to address performance concerns, it’s worthwhile considering the performance implications of your API’s design on its caller. + +### A tale of two API designs + +Consider these two `Read` methods: + +``` +func (r *Reader) Read(buf []byte) (int, error) +func (r *Reader) Read() ([]byte, error) +``` + +The first method takes a `[]byte` buffer and returns the number of bytes read into that buffer and possibly an `error` that occurred while reading. The second takes no arguments and returns some data as a `[]byte` or an `error`. + +This first method should be familiar to any Go programmer, it’s `io.Reader.Read`. As ubiquitous as `io.Reader` is, it’s not the most convenient API to use. Consider for a moment that `io.Reader` is the only Go interface in widespread use that returns _both_ a result _and_ an error. Meditate on this for a moment. The standard Go idiom, checking the error and iff it is `nil` is it safe to consult the other return values, does not apply to `Read`. In fact the caller must do the opposite. First they must record the number of bytes read into the buffer, reslice the buffer, process that data, and only then, consult the error. This is an unusual API for such a common operation and one that frequently catches out newcomers. + +### A trap for young players? + +Why is it so? Why is one of the central APIs in Go’s standard library written like this? A superficial answer might be `io.Reader`‘s signature is a reflection of the underlying `read(2)` syscall, which is indeed true, but misses the point of this post. + +If we compare the API of `io.Reader` to our alternative, `func Read() ([]byte, error)`, this API seems easier to use. Each call to `Read()` will return the data that was read, no need to reslice buffers, no need to remember the special case to do this before checking the error. Yet this is not the signature of `io.Reader.Read`. Why would one of Go’s most pervasive interfaces choose such an awkward API? The answer, I believe, lies in the performance implications of the APIs signature on the _caller_. + +Consider again our alternative `Read` function, `func Read() ([]byte, error)`. On each call `Read` will read some data into a buffer[1][1] and return the buffer to the caller. Where does this buffer come from? Who allocates it? The answer is the buffer is allocated _inside_ `Read`. Therefore each call to `Read` is guaranteed to allocate a buffer which would escape to the heap. The more the program reads, the faster it reads data, the more streams of data it reads concurrently, the more pressure it places on the garbage collector. + +The standard libraries’ `io.Reader.Read` forces the caller to supply a buffer because if the caller is concerned with the number of allocations their program is making this is precisely the kind of thing they want to control. Passing a buffer into `Read` puts the control of the allocations into the caller’s hands. If they aren’t concerned about allocations they can use higher level helpers like `ioutil.ReadAll` to read the contents into a `[]byte`, or `bufio.Scanner` to stream the contents instead. + +The opposite, starting with a method like our alternative `func Read() ([]byte, error)` API, prevents callers from pooling or reusing allocations–no amount of helper methods can fix this. As an API author, if the API cannot be changed you’ll be forced to add a second form to your API taking a supplied buffer and reimplementing your original API in terms of the newer form. Consider, for example, `io.CopyBuffer`. Other examples of retrofitting APIs for performance reasons are the `fmt` [package][2] and the `net/http` [package][3] which drove the introduction of the `sync.Pool` type precisely because the Go 1 guarantee prevented the APIs of those packages from changing. + +* * * + +If you want to commit to an API for the long run, consider how its design will impact the size and frequency of allocations the caller will have to make to use it. + + 1. This API has other problems, such as, _how much data should be read?_ or _should it try to read as much as possible, or return promptly if the read would block?_[][4] + + + +#### Related posts: + + 1. [Friday pop quiz: the smallest buffer][5] + 2. [Constant errors][6] + 3. [Simple test coverage with Go 1.2][7] + 4. [Struct composition with Go][8] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/09/05/dont-force-allocations-on-the-callers-of-your-api + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: tmp.9E95iAQGkb#easy-footnote-bottom-1-3821 (This API has other problems, such as, how much data should be read? or should it try to read as much as possible, or return promptly if the read would block?) +[2]: https://golang.org/cl/43990043 +[3]: https://golang.org/cl/44080043 +[4]: tmp.9E95iAQGkb#easy-footnote-1-3821 +[5]: https://dave.cheney.net/2015/06/05/friday-pop-quiz-the-smallest-buffer (Friday pop quiz: the smallest buffer) +[6]: https://dave.cheney.net/2016/04/07/constant-errors (Constant errors) +[7]: https://dave.cheney.net/2013/10/07/simple-test-coverage-with-go-1-2 (Simple test coverage with Go 1.2) +[8]: https://dave.cheney.net/2015/05/22/struct-composition-with-go (Struct composition with Go) diff --git a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md new file mode 100644 index 0000000000..d1523f33c3 --- /dev/null +++ b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Open Source Paint Applications for Linux Users) +[#]: via: (https://itsfoss.com/open-source-paint-apps/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +6 Open Source Paint Applications for Linux Users +====== + +As a child, when I started using computer (with Windows XP), my favorite application was Paint. I spent hours doodling on it. Surprisingly, children still love the paint apps. And not just children, the simple paint app comes handy in a number of situations. + +You will find a bunch of applications that let you draw/paint or manipulate images. However, some of them are proprietary. While you’re a Linux user – why not focus on open source paint applications? + +In this article, we are going to list some of the best open source paint applications which are worthy alternatives to proprietary painting software available on Linux. + +### Open Source paint & drawing applications + +![][1] + +**Note:** _The list is in no particular order of ranking._ + +#### 1\. Pinta + +![][2] + +Key Highlights: + + * Great alternative to Paint.NET / MS Paint + * Add-on support (WebP Image support available) + * Layer Support + + + +[Pinta][3] is an impressive open-source paint application which is perfect for drawing and basic image editing. In other words, it is a simple paint application with some fancy features. + +You may consider [Pinta][4] as an alternative to MS Paint on Linux – but with layer support and more. Not just MS Paint, but it acts as a Linux replacement for Paint.NET software available for Windows. Even though Paint.NET is better – Pinta seems to be a decent alternative to it. + +A couple of add-ons can be utilized to enhance the functionality, like the [support for WebP images on Linux][5]. In addition to the layer support, you can easily resize the images, add effects, make adjustments (brightness, contrast, etc.), and also adjust the quality when exporting the image. + +#### How to install Pinta? + +You should be able to easily find it in the Software Center / App Center / Package Manager. Just type in “**Pinta**” and get started installing it. In either case, try the [Flatpak][6] package. + +Or, you can enter the following command in the terminal (Ubuntu/Debian): + +``` +sudo apt install pinta +``` + +For more information on the download packages and installation instructions, refer the [official download page][7]. + +#### 2\. Krita + +![][8] + +Key Highlights: + + * HDR Painting + * PSD Support + * Layer Support + * Brush stabilizers + * 2D Animation + + + +Krita is one of the most advanced open source paint applications for Linux. Of course, for this article, it helps you draw sketches and wreak havoc upon the canvas. But, in addition to that, it offers a whole lot of features. + +[][9] + +Suggested read  Things To Do After Installing Fedora 24 + +For instance, if you have a shaky hand, it can help you stabilize the brush strokes. You also get built-in vector tools to create comic panels and other interesting things. If you are looking for a full-fledged color management support, drawing assistants, and layer management, Krita should be your preferred choice. + +#### How to install Krita? + +Similar to pinta, you should be able to find it listed in the Software Center/App Center or the package manager. It’s also available in the [Flatpak repository][10]. + +Thinking to install it via terminal? Type in the following command: + +``` +sudo apt install krita +``` + +In either case, you can head down to their [official download page][11] to get the **AppImage** file and run it. + +If you have no idea on AppImage files, check out our guide on – [how to use AppImage][12]. + +#### 3\. Tux Paint + +![][13] + +Key Highlights: + + * A no-nonsense paint application for kids + + + +I’m not kidding, Tux Paint is one of the best open-source paint applications for kids between 3-12 years of age. Of course, you do not want options when you want to just scribble. So, Tux Paint seems to be the best option in that case (even for adults!). + +#### How to install Tuxpaint? + +Tuxpaint can be downloaded from the Software Center or Package manager. In either case, to install it on Ubuntu/Debian, type in the following command in the terminal: + +``` +sudo apt install tuxpaint +``` + +For more information on it, head to the [official site][14]. + +#### 4\. Drawpile + +![][15] + +Key Highlights: + + * Collaborative Drawing + * Built-in chat to interact with other users + * Layer support + * Record drawing sessions + + + +Drawpile is an interesting open-source paint application where you get to collaborate with other users in real-time. To be precise, you can simultaneously draw in a single canvas. In addition to this unique feature, you have the layer support, ability to record your drawing session, and even a chat facility to interact with the users collaborating. + +You can host/join a public session or start a private session with your friend which requires a code. By default, the server will be your computer. But, if you want a remote server, you can select it as well. + +Do note, that you will need to [sign up for a Drawpile account][16] in order to collaborate. + +#### How to install Drawpile? + +As far as I’m aware of, you can only find it listed in the [Flatpak repository][17]. + +[][18] + +Suggested read  OCS Store: One Stop Shop All of Your Linux Software Customization Needs + +#### 5\. MyPaint + +![][19] + +Key Highlights: + + * Easy-to-use tool for digital painters + * Layer management support + * Lots of options to tweak your brush and drawing + + + +[MyPaint][20] is a simple yet powerful tool for digital painters. It features a lot of options to tweak in order to make the perfect digital brush stroke. I’m not much of a digital artist (but a scribbler) but I observed quite a few options to adjust the brush, the colors, and an option to add a scratchpad panel. + +It also supports layer management – in case you want that. The latest stable version hasn’t been updated for a few years now, but the recent alpha build (which I tested) works just fine. If you are looking for an open source paint application on Linux – do give this a try. + +#### How to install MyPaint? + +MyPaint is available in the official repository. However, that’s the old version. If you still want to proceed, you can search for it in the Software Center or type the following command in the terminal: + +``` +sudo apt install mypaint +``` + +You can head to its official [GitHub release page][21] for the latest alpha build and get the [AppImage file][12] (any version) to make it executable and launch the app. + +#### 6\. KolourPaint + +![][22] + +Key Highlights: + + * A simple alternative to MS Paint on Linux + * No layer management support + + + +If you aren’t looking for any Layer management support and just want an open source paint application to draw stuff – this is it. + +[KolourPaint][23] is originally tailored for KDE desktop environments but it works flawlessly on others too. + +#### How to install KolourPaint? + +You can install KolourPaint right from the Software Center or via the terminal using the following command: + +``` +sudo apt install kolourpaint4 +``` + +In either case, you can utilize [Flathub][24] as well. + +**Wrapping Up** + +If you are wondering about applications like GIMP/Inkscape, we have those listed in another separate article on the [best Linux Tools for digital artists][25]. If you’re curious about more options, I recommend you to check that out. + +Here, we try to compile a list of best open source paint applications available for Linux. If you think we missed something, feel free to tell us about it in the comments section below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-paint-apps/ + +作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/open-source-paint-apps.png?resize=800%2C450&ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/pinta.png?ssl=1 +[3]: https://pinta-project.com/pintaproject/pinta/ +[4]: https://itsfoss.com/pinta-1-6-ubuntu-linux-mint/ +[5]: https://itsfoss.com/webp-ubuntu-linux/ +[6]: https://www.flathub.org/apps/details/com.github.PintaProject.Pinta +[7]: https://pinta-project.com/pintaproject/pinta/releases +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1 +[9]: https://itsfoss.com/things-to-do-after-installing-fedora-24/ +[10]: https://www.flathub.org/apps/details/org.kde.krita +[11]: https://krita.org/en/download/krita-desktop/ +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/tux-paint.jpg?ssl=1 +[14]: http://www.tuxpaint.org/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/drawpile.png?ssl=1 +[16]: https://drawpile.net/accounts/signup/ +[17]: https://flathub.org/apps/details/net.drawpile.drawpile +[18]: https://itsfoss.com/ocs-store/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mypaint.png?ssl=1 +[20]: https://mypaint.org/ +[21]: https://github.com/mypaint/mypaint/releases +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/kolourpaint.png?ssl=1 +[23]: http://kolourpaint.org/ +[24]: https://flathub.org/apps/details/org.kde.kolourpaint +[25]: https://itsfoss.com/best-linux-graphic-design-software/ diff --git a/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md b/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md new file mode 100644 index 0000000000..2c88ffc6e5 --- /dev/null +++ b/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to monitoring with Pandora FMS) +[#]: via: (https://opensource.com/article/19/9/introduction-monitoring-pandora-fms) +[#]: author: (Sancho Lerena https://opensource.com/users/slerenahttps://opensource.com/users/jimmyolanohttps://opensource.com/users/alanfdoss) + +Introduction to monitoring with Pandora FMS +====== +Open source, all-purpose monitoring software monitors network equipment, +servers, virtual environments, applications, and much more. +![A network diagram][1] + +Pandora Flexible Monitoring Solution (FMS) is all-purpose monitoring software, which means it can control network equipment, servers (Linux and Windows), virtual environments, applications, databases, and a lot more. It can do both remote monitoring and monitoring based on agents installed on the servers. You can get collected data in reports and graphs and raise alerts if something goes wrong. + +Pandora FMS is offered in two versions: the [open source community edition][2] is aimed at private users and organizations of any size and is fully functional and totally free, while the [enterprise version][3] is designed to facilitate the work of companies, as it has support services and special features for large environments. Both versions are updated every month and accessible directly from the console. + +### Installing Pandora FMS + +#### Getting started + +Linux is the Pandora FMS's preferred operating system, but it also works perfectly under Windows. CentOS 7 is the recommended distribution, and there are installation packages in Debian/Ubuntu and SUSE Linux. If you feel brave, you can install it from source on other distros or FreeBSD or Solaris, but professional support is available only in Linux. + +For a small test, you will need a server with at least 4GB of RAM and about 20GB of free disk space. With this environment, you can monitor 200 to 300 servers easily. Pandora FMS has different ways to scale, and it can monitor several thousand servers in a single instance. By combining several instances, clients with even 100,000 devices can be monitored. + +#### ISO installation + +The easiest way to install Pandora FMS is to use the ISO image, which contains a CentOS 7 version with all the dependencies. The following steps will get Pandora FMS ready to use in just five minutes. + + 1. [Download][4] the ISO from Pandora FMS's website. + 2. Burn it onto a DVD or USB stick, or boot it from your virtual infrastructure manager (e.g., VMware, Xen, VirtualBox). + 3. Boot the image and proceed to the guided setup (a standard CentOS setup process). Set a unique password for the root user. + 4. Identify the IP address of your new system. + 5. Access the Pandora FMS console, using the IP address of the system where you installed Pandora FMS. Open a web browser and enter **http://<pandora_ip_address>/pandora_console** and log in as **admin** using the default password **pandora**. + + + +Congratulations, you're in! You can skip the other installation methods and [jump ahead][5] to start monitoring something real. + +#### Docker installation + + 1. First, launch Pandora FMS with this command: [code]`curl -sSL http://pandorafms.org/getpandora | sh`[/code] You can also run Pandora FMS as a container by executing: [code] docker run --rm -ti -p 80:80 -p 443:443 \ +  --name pandorafms pandorafms/pandorafms:latest +``` + 2. Once Pandora FMS is running, open your browser and enter  +**http://<ip address>/pandora_console**. Log in as **admin** with the default password **pandora**. + + + +The Docker container is at [hub.docker.com/r/pandorafms/pandorafms][6]. + +### Yum installation + +You can install Pandora FMS for Red Hat Enterprise Linux or CentOS 7 in just five steps. + + 1. Activate CentOS Updates, CentOS Extras, and EPEL in [your repository's library][7]. + + 2. Add the official Pandora FMS repo to your system: [code] [artica_pandorafms] + +name=CentOS7 - PandoraFMS official repo +baseurl= +gpgcheck=0 +enabled=1 +``` + + 3. Install the packages from the repo and solve all dependencies: [code]`yum install pandorafms_console pandorafms_server mariadb-server` +``` + 4. Reload services if you need to install Apache or MySQL/MariaDB: [code] service httpd reload (or equivalent) + +service mysqld reload (or equivalent) +``` + + 5. Open your browser and enter **http://<ip address>/pandora_console**. Proceed with the setup process. After accepting the license and doing a few pre-checks, you should see something like this: + + + + +![Pandora FMS environment and database setup][8] + +This screen is only needed when you install using the RPM, DEB, or source code (Git, tarball, etc.). This step of the console configuration uses MySQL credentials (which you need to know) to create a database and a username and password for Pandora FMS console and server. You need to set up the server password manually (yep! Vim or Nano?) by editing the **/etc/pandora/pandora_server.conf** file (follow the [instructions in the documentation][9]). + +Restart the Pandora FMS server, and everything should be ready. + +#### Other ways to install Pandora FMS + +If none of these installation methods work with your setup, other options include a Git checkout, tarball with sources, DEB package (with the .deb online repo), and SUSE RPM. You can learn more about these installation methods in the [installing wiki][10]. + +Grabbing the code is pretty easy with Git: + + +``` +`git clone https://github.com/pandorafms/pandorafms.git` +``` + +### Monitoring with Pandora FMS + +When you log into the console, you will see a welcome screen. + +![Pandora FMS welcome screen][11] + +#### Monitoring something connected to the network + +Let's begin with the most simple thing to do: ping to a host. First, create an agent by selecting **Resources** then **Manage Agents** from the menu. + +![Locating the Manage Agents menu][12] + +Click on **Create** at the bottom of the page, and fill the basic information (don't go crazy, just add your IP address and name). + +![Enter basic data in the Agent Manager][13] + +Go to the **Modules** tab and create a network module. + +![Create a network module][14] + +Use the Module component (which comes from an internal library pre-defined in Pandora FMS) to choose the ping by selecting **Network Management** and entering **Host Alive**. + +![Choosing Host Alive ping][15] + +Click on **Save** and go back to the "view" interface by clicking the "eye" icon on the right. + +![Menu bar with "eye" icon][16] + +Congratulations! Your ping is running (you know it because it's green). + +![Console showing ping is running][17] + +This is the manual way; you can also use the wizard to grab an entire Simple Network Management Protocol (SNMP) device to show interfaces, or you can use a bulk operation to copy a configuration from one device to another, or you can use the command-line interface (CLI) API to do configurations automatically. Review the [online wiki][18], with over 1200 articles of documentation, to learn more. + +The following shows an old Sonicwall NSA 250M Firewall monitored with the SNMP wizard. It shows data on status interfaces, active connections, CPU usage, active VPN, and a lot more. + +![Console showing firewall monitoring][19] + +Remote monitoring supports SNMP v.1, 2, and 3; Windows Management Instrumentation (WMI); remote SSH calls; SNMP trap capturing; and NetFlow monitoring. + +#### Monitoring a server with an agent + +Installing a Linux agent in Red Hat/CentOS is simple. Enter: + + +``` +`yum install pandorafms_agent_unix` +``` + +Edit **/etc/pandora/pandora_agent.conf** and set up the IP address of your Pandora FMS server: + + +``` +`server_ip   ` +``` + +Restart the agent and wait a few seconds for the console to show the data. + +![Console monitoring a Linux agent][20] + +In the main agent view, you can see events, data, and history; define the threshold for status change; and set up alerts to warn you when something is wrong. Months worth of data is available for graphs, reports, and service-level agreement (SLA) compliance. + +Installing a Windows agent is even easier because the installer supports automation for unattended setups. Start by downloading the agent and doing some usual routines. At some point, it will ask you for your server IP and the name for the agent, but that's all. + +![Pandora FMS Windows setup screen][21] + +Windows agents support grabbing service status and processes, executing local commands to get information, getting Windows events, native WMI calls, obtaining performance counters directly from the system, and providing a lot more information than the basic CPU/RAM/disk stuff. It uses the same configuration file as the Linux version (pandora_agent.conf), which you can edit with a text editor like Notepad. Editing is very easy; you should be able to add your own checks in less than a minute. + +### Creating graphs, reports, and SLA checks + +Pandora FMS has lots of options for graphs and reports, including on SLA compliance, in both the open source and enterprise versions. + +![Pandora FMS SLA compliance report][22] + +Pandora FMS's Visual Map feature allows you to create a map of information that combines status, data, graphs, icons, and more. You can edit it using an online editor. Pandora FMS is 100% operable from the console; no desktop application or Java is needed, nor do you need to execute commands from the console. + +Here are three examples. + +![Pandora FMS support ticket graph][23] + +![Pandora FMS network status graph][24] + +![Pandora FMS server status graph][25] + +If you would like to learn more about Pandora FMS, visit the [website][2] or ask questions in the [forum][26]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-monitoring-pandora-fms + +作者:[Sancho Lerena][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/slerenahttps://opensource.com/users/jimmyolanohttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_fedora_cla.png?itok=O927VLkU (A network diagram) +[2]: https://pandorafms.org/ +[3]: https://pandorafms.com/ +[4]: http://pandorafms.org/features/free-download-monitoring-software/ +[5]: tmp.jGrBq9KQnv#Monitoring +[6]: https://hub.docker.com/r/pandorafms/pandorafms +[7]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing#Installation_in_Red_Hat_Enterprise_Linux_.2F_Fedora_.2F_CentOS +[8]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-1.png (Pandora FMS environment and database setup) +[9]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing#Server_Initialization_and_Basic_Configuration +[10]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing +[11]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-2.png (Pandora FMS welcome screen) +[12]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-3.png (Locating the Manage Agents menu) +[13]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-4.png (Enter basic data in the Agent Manager) +[14]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-5.png (Create a network module) +[15]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-6.png (Choosing Host Alive ping) +[16]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-7.png (Menu bar with "eye" icon) +[17]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-8.png (Console showing ping is running) +[18]: https://pandorafms.com/docs/index.php?title=Main_Page +[19]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-9.png (Console showing firewall monitoring) +[20]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-10.png (Console monitoring a Linux agent) +[21]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-11.png (Pandora FMS Windows setup screen) +[22]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-12.png (Pandora FMS SLA compliance report) +[23]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-1.jpg (Pandora FMS support ticket graph) +[24]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-2.jpg (Pandora FMS network status graph) +[25]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-3.png (Pandora FMS server status graph) +[26]: https://pandorafms.org/forum/ diff --git a/sources/tech/20190906 Performing storage management tasks in Cockpit.md b/sources/tech/20190906 Performing storage management tasks in Cockpit.md new file mode 100644 index 0000000000..133d1437a9 --- /dev/null +++ b/sources/tech/20190906 Performing storage management tasks in Cockpit.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Performing storage management tasks in Cockpit) +[#]: via: (https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Performing storage management tasks in Cockpit +====== + +![][1] + +In the [previous article][2] we touched upon some of the new features introduced to Cockpit over the years. This article will look into some of the tools within the UI to perform everyday storage management tasks. To access these functionalities, install the _cockpit-storaged_ package: + +``` +sudo dnf install cockpit-storaged +``` + +From the main screen, click the **Storage** menu option in the left column. Everything needed to observe and manage disks is available on the main Storage screen. Also, the top of the page displays two graphs for the disk’s reading and writing performance with the local filesystem’s information below. In addition, the options to add or modify RAID devices, volume groups, iSCSI devices, and drives are available as well. In addition, scrolling down will reveal a summary of recent logs. This allows admins to catch any errors that require immediate attention. + +![][3] + +### Filesystems + +This section lists the system’s mounted partitions. Clicking on a partition will display information and options for that mounted drive. Growing and shrinking partitions are available in the **Volume** sub-section. There’s also a filesystem subsection that allows you to change the label and configure the mount. + +If it’s part of a volume group, other logical volumes in that group will also be available. Each standard partition has the option to delete and format. Also, logical volumes have an added option to deactivate the partition. + +![][4] + +### RAID devices + +Cockpit makes it super-easy to manage RAID drives. With a few simple clicks the RAID drive is created, formatted, encrypted, and mounted. For details, or a how-to on creating a RAID device from the CLI check out the article [Managing RAID arrays with mdadm][5]. + +To create a RAID device, start by clicking the add (**+**) button. Enter a name, select the type of RAID level and the available drives, then click **Create**. The RAID section will show the newly created device. Select it to create the partition table and format the drive(s). You can always remove the device by clicking the **Stop** and **Delete** buttons in the top-right corner. + +![][6] + +### Logical volumes + +By default, the Fedora installation uses LVM when creating the partition scheme. This allows users to create groups, and add volumes from different disks to those groups. The article, [Use LVM to Upgrade Fedora][7], has some great tips and explanations on how it works in the command-line. + +Start by clicking the add (**+**) button next to “Volume Groups”. Give the group a name, select the disk(s) for the volume group, and click **Create**. The new group is available in the Volume Groups section. The example below demonstrates a new group named “vgraiddemo”. + +Now, click the newly made group then select the option to **Create a New Logical Volume**. Give the LV a name and select the purpose: Block device for filesystems, or pool for thinly provisioning volumes. Adjust the amount of storage, if necessary, and click the **Format** button to finalize the creation. + +![][8] + +Cockpit can also configure current volume groups. To add a drive to an existing group, click the name of the volume group, then click the add (**+**) button next to “Physical Volumes”. Select the disk from the list and click the **Add** button. In one shot, not only has a new PV, been created, but it’s also added to the group. From here, we can add the available storage to a partition, or create a new LV. The example below demonstrates how the additional space is used to grow the root filesystem. + +![][9] + +### iSCSI targets + +Connecting to an iSCSI server is a quick process and requires two things, the initiator’s name, which is assigned to the client, and the name or IP of the server, or target. Therefore we will need to change the initiator’s name on the system to match the configurations on the target server. + +To change the initiator’s name, click the button with the pencil icon, enter the name, and click **Change**. + +To add the iSCSI target, click the add (**+**) button, enter the server’s address, the username and password, if required, and click **Next**. Select the target — verify the name, address, and port, — and click **Add** to finalize the process. + +To remove a target, click the “checkmark” button. A red trashcan will appear beside the target(s). Click it to remove the target from the setup list. + +![][10] + +### NFS mount + +Cockpit even allows sysadmins to configure NFS shares within the UI. To add NFS shares, click the add (**+**) button in the NFS mounts section. Enter the server’s address, the path of the share on the server, and a location on the local machine to mount the share. Adjust the mount options if needed and click **Add** to view information about the share. We also have the options to unmount, edit, and remove the share. The example below demonstrates how the NFS share on SERVER02 is mounted to the _/mnt_ directory. + +![][11] + +### Conclusion + +As we’ve seen in this article, a lot of the storage-related tasks that require lengthy, and multiple, lines of commands can be easily done within the web UI with just a few clicks. Cockpit is continuously evolving and every new feature makes the project better and better. In the next article we’ll explore the features and components on the networking side of things. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-storage-816x345.png +[2]: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-storage-main-screen.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-filesystem.png +[5]: https://fedoramagazine.org/managing-raid-arrays-with-mdadm/ +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-raid.gif +[7]: https://fedoramagazine.org/use-lvm-upgrade-fedora/ +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-lvm-volgroup.gif.gif +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-lvm-pv_lv.gif.gif +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-iscsi-storage.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-nfs-storage.gif diff --git a/sources/tech/20190911 10 Ansible modules you need to know.md b/sources/tech/20190911 10 Ansible modules you need to know.md new file mode 100644 index 0000000000..51b0078f86 --- /dev/null +++ b/sources/tech/20190911 10 Ansible modules you need to know.md @@ -0,0 +1,381 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible modules you need to know) +[#]: via: (https://opensource.com/article/19/9/must-know-ansible-modules) +[#]: author: (DirectedSoul https://opensource.com/users/directedsoulhttps://opensource.com/users/markphttps://opensource.com/users/rich-butkevichttps://opensource.com/users/jairojuniorhttps://opensource.com/users/marcobravohttps://opensource.com/users/johnsimcall) + +10 Ansible modules you need to know +====== +See examples and learn the most important modules for automating +everyday tasks with Ansible. +![Text editor on a browser, in blue][1] + +[Ansible][2] is an open source IT configuration management and automation platform. It uses human-readable YAML templates so users can program repetitive tasks to happen automatically without having to learn an advanced programming language. + +Ansible is agentless, which means the nodes it manages do not require any software to be installed on them. This eliminates potential security vulnerabilities and makes overall management smoother. + +Ansible [modules][3] are standalone scripts that can be used inside an Ansible playbook. A playbook consists of a play, and a play consists of tasks. These concepts may seem confusing if you're new to Ansible, but as you begin writing and working more with playbooks, they will become familiar. + +There are some modules that are frequently used in automating everyday tasks; those are the ones that we will cover in this article. + +Ansible has three main files that you need to consider: + + * **Host/inventory file:** Contains the entry of the nodes that need to be managed + * **Ansible.cfg file:** Located by default at **/etc/ansible/ansible.cfg**, it has the necessary privilege escalation options and the location of the inventory file + * **Main file:** A playbook that has modules that perform various tasks on a host listed in an inventory or host file + + + +### Module 1: Package management + +There is a module for most popular package managers, such as DNF and APT, to enable you to install any package on a system. Functionality depends entirely on the package manager, but usually these modules can install, upgrade, downgrade, remove, and list packages. The names of relevant modules are easy to guess. For example, the DNF module is [dnf_module][4], the old YUM module (required for Python 2 compatibility) is [yum_module][5], while the APT module is [apt_module][6], the Slackpkg module is [slackpkg_module][7], and so on. + +Example 1: + + +``` +\- name: install the latest version of Apache and MariaDB +  dnf: +    name: +     - httpd +      - mariadb-server +    state: latest +``` + +This installs the Apache web server and the MariaDB SQL database. + +#### Example 2: + + +``` +\- name: Install a list of packages +  yum: +    name: +     - nginx +      - postgresql +      - postgresql-server +    state: present +``` + +This installs the list of packages and helps download multiple packages. + +### Module 2: Service + +After installing a package, you need a module to start it. The [service module][8] enables you to start, stop, and reload installed packages; this comes in pretty handy. + +#### Example 1: + + +``` +\- name: Start service foo, based on running process /usr/bin/foo +  service: +    name: foo +    pattern: /usr/bin/foo +    state: started +``` + +This starts the service **foo**. + +#### Example 2: + + +``` +\- name: Restart network service for interface eth0 +  service: +    name: network +    state: restarted +    args: eth0 +``` + +This restarts the network service of the interface **eth0**. + +### Module 3: Copy + +The [copy module][9] copies a file from the local or remote machine to a location on the remote machine. + +#### Example 1: + + +``` +\- name: Copy a new "ntp.conf file into place, backing up the original if it differs from the copied version +  copy: +    src: /mine/ntp.conf +    dest: /etc/ntp.conf +    owner: root +    group: root +    mode: '0644' +    backup: yes +``` + +#### Example 2: + + +``` +\- name: Copy file with owner and permission, using symbolic representation +  copy: +    src: /srv/myfiles/foo.conf +    dest: /etc/foo.conf +    owner: foo +    group: foo +    mode: u=rw,g=r,o=r +``` + +### Module 4: Debug + +The [debug module][10] prints statements during execution and can be useful for debugging variables or expressions without having to halt the playbook. + +#### Example 1: + + +``` +\- name: Display all variables/facts known for a host +  debug: +    var: hostvars[inventory_hostname] +    verbosity: 4 +``` + +This displays all the variable information for a host that is defined in the inventory file. + +#### Example 2: + + +``` +\- name: Write some content in a file /tmp/foo.txt +  copy: +    dest: /tmp/foo.txt +    content: | +     Good Morning! +      Awesome sunshine today. +    register: display_file_content +\- name: Debug display_file_content +    debug: +      var: display_file_content +      verbosity: 2 +``` + +This registers the content of the copy module output and displays it only when you specify verbosity as 2. For example: + + +``` +`ansible-playbook demo.yaml -vv` +``` + +### Module 5: File + +The [file module][11] manages the file and its properties. + + * It sets attributes of files, symlinks, or directories. + * It also removes files, symlinks, or directories. + + + +#### Example 1: + + +``` +\- name: Change file ownership, group and permissions +  file: +    path: /etc/foo.conf +    owner: foo +    group: foo +    mode: '0644' +``` + +This creates a file named **foo.conf** and sets the permission to **0644**. + +#### Example 2: + + +``` +\- name: Create a directory if it does not exist +  file: +    path: /etc/some_directory +    state: directory +    mode: '0755' +``` + +This creates a directory named **some_directory** and sets the permission to **0755**. + +### Module 6: Lineinfile + +The [lineinfile module][12] manages lines in a text file. + + * It ensures a particular line is in a file or replaces an existing line using a back-referenced regular expression. + * It's primarily useful when you want to change just a single line in a file. + + + +#### Example 1: + + +``` +\- name: Ensure SELinux is set to enforcing mode +  lineinfile: +    path: /etc/selinux/config +    regexp: '^SELINUX=' +    line: SELINUX=enforcing +``` + +This sets the value of **SELINUX=enforcing**. + +#### Example 2: + + +``` +\- name: Add a line to a file if the file does not exist, without passing regexp +  lineinfile: +    path: /etc/resolv.conf +    line: 192.168.1.99 foo.lab.net foo +    create: yes +``` + +This adds an entry for the IP and hostname in the **resolv.conf** file. + +### Module 7: Git + +The [git module][13] manages git checkouts of repositories to deploy files or software. + +#### Example 1: + + +``` +# Example Create git archive from repo +\- git: +    repo: +    dest: /src/ansible-examples +    archive: /tmp/ansible-examples.zip +``` + +#### Example 2: + + +``` +\- git: +    repo: +    dest: /src/ansible-examples +    separate_git_dir: /src/ansible-examples.git +``` + +This clones a repo with a separate Git directory. + +### Module 8: Cli_command + +The [cli_command module][14], first available in Ansible 2.7, provides a platform-agnostic way of pushing text-based configurations to network devices over the **network_cli connection** plugin. + +#### Example 1: + + +``` +\- name: commit with comment +  cli_config: +    config: set system host-name foo +    commit_comment: this is a test +``` + +This sets the hostname for a switch and exits with a commit message. + +#### Example 2: + + +``` +\- name: configurable backup path +  cli_config: +    config: "{{ lookup('template', 'basic/config.j2') }}" +    backup: yes +    backup_options: +      filename: backup.cfg +      dir_path: /home/user +``` + +This backs up a config to a different destination file. + +### Module 9: Archive + +The [archive module][15] creates a compressed archive of one or more files. By default, it assumes the compression source exists on the target. + +#### Example 1: + + +``` +\- name: Compress directory /path/to/foo/ into /path/to/foo.tgz +  archive: +    path: /path/to/foo +    dest: /path/to/foo.tgz +``` + +#### Example 2: + + +``` +\- name: Create a bz2 archive of multiple files, rooted at /path +  archive: +    path: +   - /path/to/foo +    - /path/wong/foo +    dest: /path/file.tar.bz2 +    format: bz2 +``` + +### Module 10: Command + +One of the most basic but useful modules, the [command module][16] takes the command name followed by a list of space-delimited arguments. + +#### Example 1: + + +``` +\- name: return motd to registered var +  command: cat /etc/motd +  register: mymotd +``` + +#### Example 2: + + +``` +\- name: Change the working directory to somedir/ and run the command as db_owner if /path/to/database does not exist. +  command: /usr/bin/make_database.sh db_user db_name +  become: yes +  become_user: db_owner +  args: +    chdir: somedir/ +    creates: /path/to/database +``` + +### Conclusion + +There are tons of modules available in Ansible, but these ten are the most basic and powerful ones you can use for an automation job. As your requirements change, you can learn about other useful modules by entering **ansible-doc <module-name>** on the command line or refer to the [official documentation][17]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/must-know-ansible-modules + +作者:[DirectedSoul][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/directedsoulhttps://opensource.com/users/markphttps://opensource.com/users/rich-butkevichttps://opensource.com/users/jairojuniorhttps://opensource.com/users/marcobravohttps://opensource.com/users/johnsimcall +[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.ansible.com/ +[3]: https://docs.ansible.com/ansible/latest/user_guide/modules.html +[4]: https://docs.ansible.com/ansible/latest/modules/dnf_module.html +[5]: https://docs.ansible.com/ansible/latest/modules/yum_module.html +[6]: https://docs.ansible.com/ansible/latest/modules/apt_module.html +[7]: https://docs.ansible.com/ansible/latest/modules/slackpkg_module.html +[8]: https://docs.ansible.com/ansible/latest/modules/service_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/copy_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/debug_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[13]: https://docs.ansible.com/ansible/latest/modules/git_module.html#git-module +[14]: https://docs.ansible.com/ansible/latest/modules/cli_command_module.html +[15]: https://docs.ansible.com/ansible/latest/modules/archive_module.html +[16]: https://docs.ansible.com/ansible/latest/modules/command_module.html +[17]: https://docs.ansible.com/ diff --git a/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md b/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md new file mode 100644 index 0000000000..194fd077e6 --- /dev/null +++ b/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Collect System and Application Metrics using Metricbeat) +[#]: via: (https://www.linuxtechi.com/collect-system-application-metrics-metricbeat/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Collect System and Application Metrics using Metricbeat +====== + +**Metricbeat** is a lightweight shipper (or agent) which is used to collect system’s metrics and application metrics and send them to Elastic Stack Server (i.e **Elasticsearch**). Here system’s metrics refers to CPU, Memory, Disk and Network Stats (IOPS) and application metrics means monitoring and collecting metrics of applications like **Apache**, **NGINX**, **Docker**, **Kubernetes** and **Redis** etc. For metricbeat to work first we must make sure that we have a healthy elastic stack setup up and running.  Please refer the below url to setup elastic stack: + +**[How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8][1]** + +In this article we will demonstrate how install metricbeat on linux servers and then how metricbeat sends data to Elastic Stack Server (i.e Elasticsearch) and then we will verify from kiabana GUI whether metrics data is visible or not. + +### Install Metricbeat on CentOS / RHEL Servers + +On CentOS / RHEL Servers, metricbeat is installed using the following rpm command, + +``` +[root@linuxtechi ~]# rpm -ivh https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.3.1-x86_64.rpm +``` + +For Debian based systems, use below command to install metricbeat. + +``` +~]# curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.3.1-amd64.deb +~]# dpkg -i metricbeat-7.3.1-amd64.deb +``` + +Add the following lines in /etc/hosts file, as we will be using FQDN of Elasticsearch and Kibana in metricbeat config file and command, + +**Note:** Change the IPs and Hostname as per  your setup + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +192.168.56.10 kibana.linuxtechi.local +``` + +### Configure Metricbeat on Linux Server (CentOS / RHEL / Debian) + +Whenever metricbeat rpm & deb package is installed then its configuration file (**metricbeat.yml**) is created under “**/etc/metricbeat/**“. Let’s edit this configuration file and inform system to send system and application metrics data to Elasticsearch servers. + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/metricbeat.yml + +setup.kibana: + host: "kibana.linuxtechi.local:5601" +output.elasticsearch: + hosts: ["elasticsearch1.linuxtechi.local:9200","elasticsearch2.linuxtechi.local:9200","elasticsearch3.linuxtechi.local:9200"] +``` + +Save and exit the file + +**Note:** Replace Elasticsearch and Kibana details that suits to your environment. + +Run following metricbeat command so that metric dashboard become available in Kibana GUI. + +``` +[root@linuxtechi ~]# metricbeat setup -e -E output.elasticsearch.hosts=['elasticsearch1.linuxtechi.local:9200','elasticsearch2.linuxtechi.local:9200','elasticsearch3.linuxtechi.local:9200'] -E setup.kibana.host=kibana.linuxtechi.local:5601 +``` + +Output of above command would be something like below: + +![metricbeat-command-output-linuxserver][2] + +Above output confirms that metrics dashboard is loaded successfully in Kibana GUI. Now via metricbeat it will send the metrics data to Elastic Stack server every 10 seconds. + +Let’s start and enable metricbeat service using following commands, + +``` +[root@linuxtechi ~]# systemctl start metricbeat +[root@linuxtechi ~]# systemctl enable metricbeat +``` + +Now go to Kibana GUI and click on Dashboard from left side bar, + +[![Kibana-GUI-Dashbaord-Option][2]][3] + +In the next window we will see available metrics dashboards, search ‘**system**’ and then choose System Metrics Dashboard, + +[![Choose-Metric-Dashbaord-Kibana][2]][4] + +[![Metricbeat-System-Overview-ECS-Kibana][2]][5] + +As we can see System’s metrics data is available on the dashboard, these metrics are collected based on entries mentioned in the file “**/etc/metricbeat/modules.d/system.yml**” + +Let’s suppose we want to collect application’s metrics data as well then we have to first enable their respective modules, to enable Apache and MySQL metric module ,run the following command from client machine, + +``` +[root@linuxtechi ~]# metricbeat modules enable apache mysql +Enabled apache +Enabled mysql +[root@linuxtechi ~]# +``` + +Once we enable the modules, we can edit their yml file, + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/modules.d/apache.yml +… +- module: apache + period: 10s + hosts: ["http://192.168.56.70"] +… +``` + +Change IP in host parameter that suits to your environment. + +Similarly edit mysql yml file, Change mysql root credentials that suits to your environment + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/modules.d/mysql.yml +……… +- module: mysql + metricsets: + - status + - galera_status + period: 10s +hosts: ["root:root@linuxtechi(127.0.0.1:3306)/"] +……… +``` + +After making the changes restart the metricbeat service, + +``` +[root@linuxtechi ~]# systemctl restart metricbeat +``` + +Now Go to Kibana GUI and under Dashboard option, look for MySQL metrics, + +[![Metricbeat-MySQL-Overview-ECS-Kibana][2]][6] + +As we can see above, MySQL metrics data is visible, this confirms that we have successfully installed and configure metricbeat. + +That’s all from tutorial, If these steps help you to setup metricbeat then please do share your feedback and comment. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/collect-system-application-metrics-metricbeat/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Kibana-GUI-Dashbaord-Option.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Metric-Dashbaord-Kibana.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Metricbeat-System-Overview-ECS-Kibana.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Metricbeat-MySQL-Overview-ECS-Kibana.jpg diff --git a/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md new file mode 100644 index 0000000000..c373e85502 --- /dev/null +++ b/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) +[#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) +[#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) + +How to fix common pitfalls with the Python ORM tool SQLAlchemy +====== +Seemingly small choices made when using SQLAlchemy can have important +implications on the object-relational mapping toolkit's performance. +![A python with a package.][1] + +Object-relational mapping ([ORM][2]) makes life easier for application developers, in no small part because it lets you interact with a database in a language you may know (such as Python) instead of raw SQL queries. [SQLAlchemy][3] is a Python ORM toolkit that provides access to SQL databases using Python. It is a mature ORM tool that adds the benefit of model relationships, a powerful query construction paradigm, easy serialization, and much more. Its ease of use, however, makes it easy to forget what is going on behind the scenes. Seemingly small choices made using SQLAlchemy can have important performance implications. + +This article explains some of the top performance issues developers encounter when using SQLAlchemy and how to fix them. + +### Retrieving an entire result set when you only need the count + +Sometimes a developer just needs a count of results, but instead of utilizing a database count, all the results are fetched and the count is done with **len** in Python. + + +``` +`count = len(User.query.filter_by(acct_active=True).all())` +``` + +Using SQLAlchemy's **count** method instead will do the count on the server side, resulting in far less data sent to the client. Calling **all()** in the prior example also results in the instantiation of model objects, which can become expensive quickly, given enough rows. + +Unless more than the count is required, just use the **count** method. + + +``` +`count = User.query.filter_by(acct_active=True).count()` +``` + +### Retrieving entire models when you only need a few columns + +In many cases, only a few columns are needed when issuing a query. Instead of returning entire model instances, SQLAlchemy can fetch only the columns you're interested in. This not only reduces the amount of data sent but also avoids the need to instantiate entire objects. Working with tuples of column data instead of models can be quite a bit faster. + + +``` +result = User.query.all() +for user in result: +    print(user.name, user.email) +``` + +Instead, select only what is needed using the **with_entities** method. + + +``` +result = User.query.with_entities(User.name, User.email).all() +for (username, email) in result: +    print(username, email) +``` + +### Updating one object at a time inside a loop + +Avoid using loops to update collections individually. While the database may execute a single update very quickly, the roundtrip time between the application and database servers will quickly add up. In general, strive for fewer queries where reasonable. + + +``` +for user in users_to_update: +  user.acct_active = True +  db.session.add(user) +``` + +Use the bulk update method instead. + + +``` +query = User.query.filter(user.id.in_([user.id for user in users_to_update])) +query.update({"acct_active": True}, synchronize_session=False) +``` + +### Triggering cascading deletes + +ORM allows easy configuration of relationships on models, but there are some subtle behaviors that can be surprising. Most databases maintain relational integrity through foreign keys and various cascade options. SQLAlchemy allows you to define models with foreign keys and cascade options, but the ORM has its own cascade logic that can preempt the database. + +Consider the following models. + + +``` +class Artist(Base): +    __tablename__ = "artist" + +    id = Column(Integer, primary_key=True) +    songs = relationship("Song", cascade="all, delete") + +class Song(Base): +    __tablename__ = "song" + +    id = Column(Integer, primary_key=True) +    artist_id = Column(Integer, ForeignKey("artist.id", ondelete="CASCADE")) +``` + +Deleting artists will cause the ORM to issue **delete** queries on the Song table, thus preventing the deletes from happening as a result of the foreign key. This behavior can become a bottleneck with complex relationships and a large number of records. + +Include the **passive_deletes** option to ensure that the database is managing relationships. Be sure, however, that your database is capable of this. SQLite, for example, does not manage foreign keys by default. + + +``` +`songs = relationship("Song", cascade="all, delete", passive_deletes=True)` +``` + +### Relying on lazy loading when eager loading should be used + +Lazy loading is the default SQLAlchemy approach to relationships. Building from the last example, this implies that loading an artist does not simultaneously load his or her songs. This is usually a good idea, but the separate queries can be wasteful if certain relationships always need to be loaded. + +Popular serialization frameworks like [Marshmallow][4] can trigger a cascade of queries if relationships are allowed to load in a lazy fashion. + +There are a few ways to control this behavior. The simplest method is through the relationship function itself. + + +``` +`songs = relationship("Song", lazy="joined", cascade="all, delete")` +``` + +This will cause a left join to be added to any query for artists, and as a result, the **songs** collection will be immediately available. Although more data is returned to the client, there are potentially far fewer roundtrips. + +SQLAlchemy offers finer-grained control for situations where such a blanket approach can't be taken. The **joinedload()** function can be used to toggle joined loading on a per-query basis. + + +``` +from sqlalchemy.orm import joinedload + +artists = Artist.query.options(joinedload(Artist.songs)) +print(artists.songs) # Does not incur a roundtrip to load +``` + +### Using the ORM for a bulk record import + +The overhead of constructing full model instances becomes a major bottleneck when importing thousands of records. Imagine, for example, loading thousands of song records from a file where each song has first been converted to a dictionary. + + +``` +for song in songs: +    db.session.add(Song(**song)) +``` + +Instead, bypass the ORM and use just the parameter binding functionality of core SQLAlchemy. + + +``` +batch = [] +insert_stmt = Song.__table__.insert() +for song in songs: +    if len(batch) > 1000: +       db.session.execute(insert_stmt, batch) +       batch.clear() +    batch.append(song) +if batch: +    db.session.execute(insert_stmt, batch) +``` + +Keep in mind that this method naturally skips any client-side ORM logic you might depend on, such as Python-based column defaults. While this method is faster than loading objects as full model instances, your database may have bulk loading methods that are faster. PostgreSQL, for example, has the **COPY** command that offers perhaps the best performance for loading large numbers of records. + +### Calling commit or flush prematurely + +There are many occasions when you need to associate a child record to its parent, or vice versa. One obvious way of doing this is to flush the session so that the record in question will be assigned an ID. + + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +db.session.add(artist) +db.session.flush() + +song.artist_id = artist.id +``` + +Committing or flushing more than once per request is usually unnecessary and undesirable. A database flush involves forcing disk writes on the database server, and in most circumstances, the client will block until the server can acknowledge that the data has been written. + +SQLAlchemy can track relationships and manage keys behind the scenes. + + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +artist.songs.append(song) +``` + +### Wrapping up + +I hope this list of common pitfalls can help you avoid these issues and keep your application running smoothly. As always, when diagnosing a performance problem, measurement is key. Most databases offer performance diagnostics that can help you pinpoint issues, such as the PostgreSQL **pg_stat_statements** module. + +* * * + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/common-pitfalls-python + +作者:[Zach Todd][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/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_snake_file_box.jpg?itok=UuDVFLX- (A python with a package.) +[2]: https://en.wikipedia.org/wiki/Object-relational_mapping +[3]: https://www.sqlalchemy.org/ +[4]: https://marshmallow.readthedocs.io/en/stable/ diff --git a/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md b/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md new file mode 100644 index 0000000000..85e3a6428a --- /dev/null +++ b/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md @@ -0,0 +1,197 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: HTTP: Learn your browser's language!) +[#]: via: (https://jvns.ca/blog/2019/09/12/new-zine-on-http/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: HTTP: Learn your browser's language! +====== + +Hello! I’ve released a new zine! It’s called “HTTP: Learn your browsers language!” + +You can get it for $12 at . If you buy it, you’ll get a PDF that you can either read on your computer or print out. + +Here’s the cover and table of contents: + +[![][1]][2] + +### why http? + +I got the idea for this zine from talking to [Marco Rogers][3] – he mentioned that he thought that new web developers / mobile developers would really benefit from understanding the fundamentals of HTTP better, I thought “OOH I LOVE TALKING ABOUT HTTP”, wrote a few pages about HTTP, saw they were helping people, and decided to write a whole zine about HTTP. + +HTTP is important to understand because it runs the entire web – if you understand how HTTP requests and responses work, then it makes it WAY EASIER to debug why your web application isn’t working properly. Caching, cookies, and a lot of web security are implemented using HTTP headers, so if you don’t understand HTTP headers those things seem kind of like impenetrable magic. But actually the HTTP protocol is fundamentally pretty simple – there are a lot of complicated details but the basics are pretty easy to understand. + +So the goal of this zine is to teach you the basics so you can easily look up and understand the details when you need them. + +### what it looks like printed out + +All of my zines are best printed out (though you get a PDF you can read on your computer too!), so here are a couple of pictures of what it looks like when printed. I always ask my illustrator to make both a black and white version and a colour version of the cover so that it looks great when printed on a black and white printer. + +[![][4]][2] + +(if you click on that “same origin policy” image, you can make it bigger) + +The zine comes with 4 print PDFs in addition to a PDF you can just read on your computer/phone: + + * letter / colour + * letter / b&w + * a4 / colour + * a4 / b&w + + + +### zines for your team + +You can also buy this zine for your team members at work to help them learn HTTP! + +I’ve been trying to get the pricing right for this for a while – I used to do it based on size of company, but that didn’t seem quite right because sometimes people would want to buy the zine for a small team at a big company. So I’ve switched to pricing based on the number of copies you want to distribute at your company. + +Here’s the link: [zines for your team!][5]. + +### the tweets + +When I started writing zines, I would just sit down, write down the things I thought were important, and be done with it. + +In the last year and a half or so I’ve taken a different approach – instead of writing everything and then releasing it, instead I write a page at a time, post the page to Twitter, and then improve it and decide what page to write next based on the questions/comments I get on Twitter. If someone replies to the tweet and asks a question that shows that what I wrote is unclear, I can improve it! (I love getting replies on twitter asking clarifiying questions!). + +Here are all the initial drafts of the pages I wrote and posted on twitter, in chronological order. Some of the pages didn’t make it into the zine at all, and I needed to do a lot of editing at the end to figure out the right order and make them all work coherently together in a zine instead of being a bunch of independent tweets. + + * Jul 1: [http status codes][6] + * Jul 2: [anatomy of a HTTP response][7] + * Jul 2: [POST requests][8] + * Jul 2: [an example POST request][9] + * Jul 28: [the same origin policy][10] + * Jul 28: [what’s HTTP?][11] + * Jul 30: [the most important HTTP request headers][12] + * Jun 30: [anatomy of a HTTP request][13] + * Aug 4: [content delivery networks][14] + * Aug 6: [caching headers][15] + * Aug 6: [how cookies work][16] + * Aug 7: [redirects][17] + * Aug 8: [45 seconds on the Accept-Language HTTP header][18] + * Aug 9: [HTTPS: HTTP + security][19] + * Aug 9: [today in 45 second video experiments: the Range header][20] + * Aug 9: [some HTTP exercises to try][21] + * Aug 10: [some security headers][22] + * Aug 12: [using HTTP APIs][23] + * Aug 13: [what’s with those headers that start with x-?][24] + * Aug 13: [important HTTP response headers][25] + * Aug 14: [HTTP request methods (part 1)][26] + * Aug 14: [HTTP request methods (part 2)][27] + * Aug 15: [how URLs work][28] + * Aug 16: [CORS][29] + * Aug 19: [why the same origin policy matters][30] + * Aug 21: [HTTP headers][31] + * Aug 24: [how to learn more about HTTP][32] + * Aug 25: [HTTP/2][33] + * Aug 27: [certificates][34] + + + +Writing zines one tweet at a time has been really fun. I think it improves the quality a lot, because I get a ton of feedback along the way that I can use to make the zine better. There are also some experimental 45 second tiny videos in that list, which are definitely not part of the zine, but which were fun to make and which I might expand on in the future. + +### examplecat.com + +One tiny easter egg in the zine: I have a lot of examples of HTTP requests, and I wasn’t sure for a long time what domain I should use for the examples. I used example.com a bunch, and google.com and twitter.com sometimes, but none of those felt quite right. + +A couple of days before publishing the zine I finally had an epiphany – my example on the cover was requesting a picture of a cat, so I registered which just has a single picture of a cat. It also has an ASCII cat if you’re browsing in your terminal. + +``` +$ curl https://examplecat.com/cat.txt -i +HTTP/2 200 +accept-ranges: bytes +cache-control: public, max-age=0, must-revalidate +content-length: 33 +content-type: text/plain; charset=UTF-8 +date: Thu, 12 Sep 2019 16:48:16 GMT +etag: "ac5affa59f554a1440043537ae973790-ssl" +strict-transport-security: max-age=31536000 +age: 5 +server: Netlify +x-nf-request-id: c5060abc-0399-4b44-94bf-c481e22c2b50-1772748 + +\ /\ + ) ( ') +( / ) + \(__)| +``` + +### more zines at wizardzines.com + +If you’re interested in the idea of programming zines and haven’t seen my zines before, I have a bunch more at . There are 6 free zines there: + + * [so you want to be a wizard][35] + * [let’s learn tcpdump!][36] + * [spying on your programs with strace][37] + * [networking! ACK!][38] + * [linux debugging tools you’ll love][39] + * [profiling and tracing with perf][40] + + + +### next zine: not sure yet! + +Some things I’m considering for the next zine: + + * debugging skills (I started writing a bunch of pages about debugging but switched gears to the HTTP zine because I got really excited about that. but debugging is my favourite thing so I’d like to get this done at some point) + * gdb (a short zine in the spirit of [let’s learn tcpdump][36]) + * relational databases (what’s up with transactions?) + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/12/new-zine-on-http/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/images/http-zine-cover.png +[2]: https://gum.co/http-zine +[3]: https://twitter.com/polotek +[4]: https://jvns.ca/images/http-zine-cover.jpeg +[5]: https://wizardzines.com/zines-team/ +[6]: https://twitter.com/b0rk/status/1145824140462608387 +[7]: https://twitter.com/b0rk/status/1145896193077256197 +[8]: https://twitter.com/b0rk/status/1146054159214567424 +[9]: https://twitter.com/b0rk/status/1146065212560179202 +[10]: https://twitter.com/b0rk/status/1155493682885341184 +[11]: https://twitter.com/b0rk/status/1155318552129396736 +[12]: https://twitter.com/b0rk/status/1156048630220017665 +[13]: https://twitter.com/b0rk/status/1145362860136177664 +[14]: https://twitter.com/b0rk/status/1158012032651862017 +[15]: https://twitter.com/b0rk/status/1158726129508868097 +[16]: https://twitter.com/b0rk/status/1158848054142873603 +[17]: https://twitter.com/b0rk/status/1159163613938167808 +[18]: https://twitter.com/b0rk/status/1159492669384658944 +[19]: https://twitter.com/b0rk/status/1159812119099060224 +[20]: https://twitter.com/b0rk/status/1159829608595804160 +[21]: https://twitter.com/b0rk/status/1159839824594915335 +[22]: https://twitter.com/b0rk/status/1160185182323970050 +[23]: https://twitter.com/b0rk/status/1160933788949655552 +[24]: https://twitter.com/b0rk/status/1161283690925834241 +[25]: https://twitter.com/b0rk/status/1161262574031265793 +[26]: https://twitter.com/b0rk/status/1161679906415218690 +[27]: https://twitter.com/b0rk/status/1161680137865367553 +[28]: https://twitter.com/b0rk/status/1161997141876903936 +[29]: https://twitter.com/b0rk/status/1162392625057583104 +[30]: https://twitter.com/b0rk/status/1163460967067541504 +[31]: https://twitter.com/b0rk/status/1164181027469832196 +[32]: https://twitter.com/b0rk/status/1165277002791829510 +[33]: https://twitter.com/b0rk/status/1165623594917007362 +[34]: https://twitter.com/b0rk/status/1166466933912494081 +[35]: https://wizardzines.com/zines/wizard/ +[36]: https://wizardzines.com/zines/tcpdump/ +[37]: https://wizardzines.com/zines/strace/ +[38]: https://wizardzines.com/zines/networking/ +[39]: https://wizardzines.com/zines/debugging/ +[40]: https://wizardzines.com/zines/perf/ diff --git a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md new file mode 100644 index 0000000000..877845b87a --- /dev/null +++ b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -0,0 +1,197 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) +[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Configure SFTP Server with Chroot in Debian 10 +====== + +**SFTP** stands for Secure File Transfer Protocol / SSH File Transfer Protocol, it is one of the most common method which is used to transfer files securely over ssh from our local system to remote server and vice-versa. The main advantage of sftp is that we don’t need to install any additional package except ‘**openssh-server**’, in most of the Linux distributions ‘openssh-server’ package is the part of default installation. Other benefit of sftp is that we can allow user to use sftp only not ssh. + +[![Configure-sftp-debian10][1]][2] + +Recently Debian 10, Code name ‘Buster’ has been released, in this article we will demonstrate how to configure sftp with Chroot ‘Jail’ like environment in Debian 10 System. Here Chroot Jail like environment means that user’s cannot go beyond from their respective home directories or users cannot change directories from their home directories.  Following are the lab details: + + * OS = Debian 10 + * IP Address = 192.168.56.151 + + + +Let’s jump into SFTP Configuration Steps, + +### Step:1) Create a Group for sftp using groupadd command + +Open the terminal, create a group with a name “**sftp_users**” using below groupadd command, + +``` +root@linuxtechi:~# groupadd sftp_users +``` + +### Step:2) Add Users to Group ‘sftp_users’ and set permissions + +In case you want to create new user and want to add that user to ‘sftp_users’ group, then run the following command, + +**Syntax:** #  useradd -m -G sftp_users <user_name> + +Let’s suppose user name is ’Jonathan’ + +``` +root@linuxtechi:~# useradd -m -G sftp_users jonathan +``` + +set the password using following chpasswd command, + +``` +root@linuxtechi:~# echo "jonathan:" | chpasswd +``` + +In case you want to add existing users to ‘sftp_users’ group then run beneath usermod command, let’s suppose already existing user name is ‘chris’ + +``` +root@linuxtechi:~# usermod -G sftp_users chris +``` + +Now set the required permissions on Users, + +``` +root@linuxtechi:~# chown root /home/jonathan /home/chris/ +``` + +Create an upload folder in both the user’s home directory and set the correct ownership, + +``` +root@linuxtechi:~# mkdir /home/jonathan/upload +root@linuxtechi:~# mkdir /home/chris/upload +root@linuxtechi:~# chown jonathan /home/jonathan/upload +root@linuxtechi:~# chown chris /home/chris/upload +``` + +**Note:** User like Jonathan and Chris can upload files and directories to upload folder from their local systems. + +### Step:3) Edit sftp configuration file (/etc/ssh/sshd_config) + +As we have already stated that sftp operations are done over the ssh, so it’s configuration file is “**/etc/ssh/sshd_config**“, Before making any changes I would suggest first take the backup and then edit this file and add the following content, + +``` +root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org +root@linuxtechi:~# vim /etc/ssh/sshd_config +……… +#Subsystem sftp /usr/lib/openssh/sftp-server +Subsystem sftp internal-sftp + +Match Group sftp_users + X11Forwarding no + AllowTcpForwarding no + ChrootDirectory %h + ForceCommand internal-sftp +………… +``` + +Save & exit the file. + +To make above changes into the affect, restart ssh service using following systemctl command + +``` +root@linuxtechi:~# systemctl restart sshd +``` + +In above ‘sshd_config’ file we have commented out the line which starts with “Subsystem” and added new entry “Subsystem       sftp    internal-sftp” and new lines like, + +“**Match Group sftp_users”**  –> It means if a user is a part of ‘sftp_users’ group then apply rules which are mentioned below to this entry. + +“**ChrootDierctory %h**” –> It means users can only change directories within their respective home directories, they cannot go beyond their home directories, or in other words we can say users are not permitted to change directories, they will get jai like environment within their directories and can’t access any other user’s and system’s directories. + +“**ForceCommand internal-sftp**” –> It means users are limited to sftp command only. + +### Step:4) Test and Verify sftp + +Login to any other Linux system which is on the same network of your sftp server and then try to ssh sftp server via the users that we have mapped in ‘sftp_users’ group. + +``` +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# +``` + +Above confirms that users are not allowed to SSH , now try sftp using following commands, + +``` +[root@linuxtechi ~]# sftp root@linuxtechi +root@linuxtechi's password: +Connected to 192.168.56.151. +sftp> ls -l +drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs +-rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt +drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload +``` + +Let’s try to download a file using sftp ‘**get**‘ command + +``` +sftp> get devops-actions.txt +Fetching /devops-actions.txt to devops-actions.txt +/devops-actions.txt 100% 155 0.2KB/s 00:00 +sftp> +sftp> cd /etc +Couldn't stat remote file: No such file or directory +sftp> cd /root +Couldn't stat remote file: No such file or directory +sftp> +``` + +Above output confirms that we are able to download file from our sftp server to local machine and apart from this we have also tested that users cannot change directories. + +Let’s try to upload a file under “**upload**” folder, + +``` +sftp> cd upload/ +sftp> put metricbeat-7.3.1-amd64.deb +Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb +metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 +sftp> ls -l +-rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb +sftp> +``` + +This confirms that we have successfully uploaded a file from our local system to sftp server. + +Now test the SFTP server with winscp tool, enter the sftp server ip address along user’s credentials, + +[![Winscp-sftp-debian10][1]][3] + +Click on Login and then try to download and upload files + +[![Download-file-winscp-debian10-sftp][1]][4] + +Now try to upload files in upload folder, + +[![Upload-File-using-winscp-Debian10-sftp][1]][5] + +Above window confirms that uploading is also working fine, that’s all from this article. If these steps help you to configure SFTP server with chroot environment in Debian 10 then please do share your feedback and comments. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/sources/tech/20190916 Constraint programming by example.md b/sources/tech/20190916 Constraint programming by example.md new file mode 100644 index 0000000000..c434913c5e --- /dev/null +++ b/sources/tech/20190916 Constraint programming by example.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Constraint programming by example) +[#]: via: (https://opensource.com/article/19/9/constraint-programming-example) +[#]: author: (Oleksii Tsvietnov https://opensource.com/users/oleksii-tsvietnovhttps://opensource.com/users/oleksii-tsvietnov) + +Constraint programming by example +====== +Understand constraint programming with an example application that +converts a character's case and ASCII codes. +![Math formulas in green writing][1] + +There are many different ways to solve problems in computing. You might "brute force" your way to a solution by calculating as many possibilities as you can, or you might take a procedural approach and carefully establish the known factors that influence the correct answer. In [constraint programming][2], a problem is viewed as a series of limitations on what could possibly be a valid solution. This paradigm can be applied to effectively solve a group of problems that can be translated to variables and constraints or represented as a mathematic equation. In this way, it is related to the Constraint Satisfaction Problem ([CSP][3]). + +Using a declarative programming style, it describes a general model with certain properties. In contrast to the imperative style, it doesn't tell _how_ to achieve something, but rather _what_ to achieve. Instead of defining a set of instructions with only one obvious way to compute values, constraint programming declares relationships between variables within constraints. A final model makes it possible to compute the values of variables regardless of direction or changes. Thus, any change in the value of one variable affects the whole system (i.e., all other variables), and to satisfy defined constraints, it leads to recomputing the other values. + +As an example, let's take Pythagoras' theorem: **a² + b² = c²**. The _constraint_ is represented by this equation, which has three _variables_ (a, b, and c), and each has a _domain_ (non-negative). Using the imperative programming style, to compute any of the variables if we have the other two, we would need to create three different functions (because each variable is computed by a different equation): + + * c = √(a² + b²) + * a = √(c² - b²) + * b = √(c² - a²) + + + +These functions satisfy the main constraint, and to check domains, each function should validate the input. Moreover, at least one more function would be needed for choosing an appropriate function according to the provided variables. This is one of the possible solutions: + + +``` +def pythagoras(*, a=None, b=None, c=None): +    ''' Computes a side of a right triangle ''' + +    # Validate +    if len([i for i in (a, b, c) if i is None or i <= 0]) != 1: +        raise SystemExit("ERROR: you need to define any of two non-negative variables") + +    # Compute +    if a is None: +        return (c**2 - b**2)**0.5 +    elif b is None: +        return (c**2 - a**2)**0.5 +    else: +        return (a**2 + b**2)**0.5 +``` + +To see the difference with the constraint programming approach, I'll show an example of a "problem" with four variables and a constraint that is not represented by a straight mathematic equation. This is a converter that can change characters' cases (lower-case to/from capital/upper-case) and return the ASCII codes for each. Hence, at any time, the converter is aware of all four values and reacts immediately to any changes. The idea of creating this example was fully inspired by John DeNero's [Fahrenheit-Celsius converter][4]. + +Here is a diagram of a constraint system: + +![Constraint system model][5] + +The represented "problem" is translated into a constraint system that consists of nodes (constraints) and connectors (variables). Connectors provide an interface for getting and setting values. They also check the variables' domains. When one value changes, that particular connector notifies all its connected nodes about the change. Nodes, in turn, satisfy constraints, calculate new values, and propagate them to other connectors across the system by "asking" them to set a new value. Propagation is done using the message-passing technique that means connectors and nodes get messages (synchronously) and react accordingly. For instance, if the system gets the **A** letter on the "capital letter" connector, the other three connectors provide an appropriate result according to the defined constraint on the nodes: 97, a, and 65. It's not allowed to set any other lower-case letters (e.g., b) on that connector because each connector has its own domain. + +When all connectors are linked to nodes, which are defined by constraints, the system is fully set and ready to get values on any of four connectors. Once it's set, the system automatically calculates and sets values on the rest of the connectors. There is no need to check what variable was set and which functions should be called, as is required in the imperative approach—that is relatively easy to achieve with a few variables but gets interesting in case of tens or more. + +### How it works + +The full source code is available in my [GitHub repo][6]. I'll dig a little bit into the details to explain how the system is built. + +First, define the connectors by giving them names and setting domains as a function of one argument: + + +``` +import constraint_programming as cp + +small_ascii = cp.connector('Small Ascii', lambda x: x >= 97 and x <= 122) +small_letter = cp.connector('Small Letter', lambda x: x >= 'a' and x <= 'z') +capital_ascii = cp.connector('Capital Ascii', lambda x: x >= 65 and x <= 90) +capital_letter = cp.connector('Capital Letter', lambda x: x >= 'A' and x <= 'Z') +``` + +Second, link these connectors to nodes. There are two types: _code_ (translates letters back and forth to ASCII codes) and _aA_ (translates small letters to capital and back): + + +``` +code(small_letter, small_ascii) +code(capital_letter, capital_ascii) +aA(small_letter, capital_letter) +``` + +These two nodes differ in which functions should be called, but they are derived from a general constraint function: + + +``` +def code(conn1, conn2): +    return cp.constraint(conn1, conn2, ord, chr) + +def aA(conn1, conn2): +    return cp.constraint(conn1, conn2, str.upper, str.lower) +``` + +Each node has only two connectors. If there is an update on a first connector, then a first function is called to calculate the value of another connector (variable). The same happens if a second connector's value changes. For example, if the _code_ node gets **A** on the **conn1** connector, then the function **ord** will be used to get its ASCII code. And, the other way around, if the _aA_ node gets **A** on the **conn2** connector, then it needs to use the **str.lower** function to get the correct small letter on the **conn1**. Every node is responsible for computing new values and "sending" a message to another connector that there is a new value to set. This message is conveyed with the name of a node that is asking to set a new value and also a new value. + + +``` +def set_value(src_constr, value): +    if (not domain is None) and (not domain(value)): +        raise ValueOutOfDomain(link, value) +    link['value'] = value +    for constraint in constraints: +        if constraint is not src_constr: +            constraint['update'](link) +``` + +When a connector receives the **set** message, it runs the **set_value** function to check a domain, sets a new value, and sends the "update" message to another node. It is just a notification that the value on that connector has changed. + + +``` +def update(src_conn): +    if src_conn is conn1: +        conn2['set'](node, constr1(conn1['value'])) +    else: +        conn1['set'](node, constr2(conn2['value'])) +``` + +Then, the notified node requests this new value on the connector, computes a new value for another connector, and so on until the whole system changes. That's how the propagation works. + +But how does the message passing happen? It is implemented as accessing keys of dictionaries. Both functions (connector and constraint) return a _dispatch dictionary_. Such a dictionary contains _messages_ as keys and _closures_ as values. By accessing a key, let's say, **set**, a dictionary returns the function **set_value** (closure) that has access to all local names of the "connector" function. + + +``` +# A dispatch dictionary +link = { 'name': name, +         'value': None, +         'connect': connect, +         'set': set_value, +         'constraints': get_constraints } + +return link +``` + +Having a dictionary as a return value makes it possible to create multiple closures (functions) with access to the same local state to operate on. Then these closures are callable by using keys as a type of message. + +### Why use Constraint programming? + +Constraint programming can give you a new perspective to difficult problems. It's not something you can use in every situation, but it may well open new opportunities for solutions in certain situations. If you find yourself up against an equation that seems difficult to reliably solve in code, try looking at it from a different angle. If the angle that seems to work best is constraint programming, you now have an example of how it can be implemented. + +* * * + +_This article was originally published on [Oleksii Tsvietnov's blog][7] and is reprinted with his permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/constraint-programming-example + +作者:[Oleksii Tsvietnov][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/oleksii-tsvietnovhttps://opensource.com/users/oleksii-tsvietnov +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/edu_math_formulas.png?itok=B59mYTG3 (Math formulas in green writing) +[2]: https://en.wikipedia.org/wiki/Constraint_programming +[3]: https://vorakl.com/articles/csp/ +[4]: https://composingprograms.com/pages/24-mutable-data.html#propagating-constraints +[5]: https://opensource.com/sites/default/files/uploads/constraint-system.png (Constraint system model) +[6]: https://github.com/vorakl/composingprograms.com/tree/master/char_converter +[7]: https://vorakl.com/articles/char-converter/ diff --git a/sources/tech/20190916 The Emacs Series Exploring ts.el.md b/sources/tech/20190916 The Emacs Series Exploring ts.el.md new file mode 100644 index 0000000000..06e724d4ab --- /dev/null +++ b/sources/tech/20190916 The Emacs Series Exploring ts.el.md @@ -0,0 +1,366 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Emacs Series Exploring ts.el) +[#]: via: (https://opensourceforu.com/2019/09/the-emacs-series-exploring-ts-el/) +[#]: author: (Shakthi Kannan https://opensourceforu.com/author/shakthi-kannan/) + +The Emacs Series Exploring ts.el +====== + +[![][1]][2] + +_In this article, the author reviews the ts.el date and time library for Emacs. Written by Adam Porter, ts.el is still in the development phase and has been released under the GNU General Public License v3.0._ + +The ts.el package uses intuitive names for date and time functions. It internally uses UNIX timestamps and depends on both the ‘dash’ and ‘s’ Emacs libraries. The parts of the date are computed lazily and also cached for performance. The source code is available at __. In this article, we will explore the API functions available from the ts.el library. + +**Installation** +The package does not have a tagged release yet; hence, you should download it from and add it to your Emacs load path to use it. You should also have the ‘dash’ and ‘s’ libraries installed and loaded in your Emacs environment. You can then load the library using the following command: + +``` +(require ‘ts) +``` + +**Usage** +Let us explore the various functions available to retrieve parts of the date from the ts.el library. When the examples were executed, the date was ‘Friday July 5, 2019’. The ts-dow function can be used to obtain the day of the week, as shown below: + +``` +(ts-dow (ts-now)) +5 +``` + +_ts-now_ is a Lisp construct that returns a timestamp set. It is defined in ts.el as follows: + +``` +(defsubst ts-now () +“Return `ts’ struct set to now.” +(make-ts :unix (float-time))) +``` + +The day of the week starts from Monday (1) and hence Friday has the value of 5. An abbreviated form of the day can be fetched using the _ts-day-abbr_ function. In the following example, ‘Friday’ is shortened to‘Fri’. + +``` +(ts-day-abbr (ts-now)) +"Fri" +``` + +The day of the week in full form can be obtained using the _ts-day-name_ function, as shown below: + +``` +(ts-day-name (ts-now)) +“Friday” +``` + +The twelve months from January to December are numbered from 1 to 12 respectively. Hence, for the month of July, the index number is 7. This numeric value for the month can be retrieved using the ‘ts-month’ API. For example: + +``` +(ts-month (ts-now)) +7 +``` + +If you want a three-character abbreviation for the month’s name, you can use the ts-month-abbr function as shown below: + +``` +(ts-month-abbr (ts-now)) +“Jul” +``` + +The _ts-month-name_ function can be used to obtain the full name of the month. For example: + +``` +(ts-month-name (ts-now)) +“July” +``` + +The day of the week starts from Monday and has an index 1, while Sunday has an index 7. If you need the numeric value for the day of the week, use the ts-day function as indicated below: + +``` +(ts-day (ts-now)) +5 +``` + +The _ts-year_ API returns the year. In our example, it is ‘2019’ as shown below: + +``` +(ts-year (ts-now)) +2019 +``` + +The hour, minute and seconds can be retrieved using the _ts-hour, ts-minute_ and _ts-second_ functions, respectively. Examples of these functions are given below: + +``` +(ts-hour (ts-now)) +18 + +(ts-minute (ts-now)) +19 + +(ts-second (ts-now)) +5 +``` + +The UNIX timestamps are in UTC, by default. The _ts-tz-offset_ function returns the offset from UTC. The Indian Standard Time (IST) is five-and-a-half-hours ahead of UTC and hence this function returns ‘+0530’ as shown below: + +``` +(ts-tz-offset (ts-now)) +"+0530" +``` + +The _ts-tz-abbr_ API returns an abbreviated form of the time zone. In our case, ‘IST’ is returned for the Indian Standard Time. + +``` +(ts-tz-abbr (ts-now)) +"IST" +``` + +The _ts-adjustf_ function applies the time adjustments passed to the timestamp and the _ts-format_ function formats the timestamp as a string. A couple of examples are given below: + +``` +(let ((ts (ts-now))) +(ts-adjustf ts ‘day 1) +(ts-format nil ts)) +“2019-07-06 18:23:24 +0530” + +(let ((ts (ts-now))) +(ts-adjustf ts ‘year 1 ‘month 3 ‘day 5) +(ts-format nil ts)) +“2020-10-10 18:24:07 +0530” +``` + +You can use the _ts-dec_ function to decrement the timestamp. For example: + +``` +(ts-day-name (ts-dec ‘day 1 (ts-now))) +“Thursday” +``` + +The threading macro syntax can also be used with the ts-dec function as shown below: + +``` +(->> (ts-now) (ts-dec ‘day 2) ts-day-name) +“Wednesday” +``` + +The UNIX epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT). The ts-unix function returns an epoch UNIX timestamp as illustrated below: + +``` +(ts-unix (ts-adjust ‘day -2 (ts-now))) +1562158551.0 ;; Wednesday, July 3, 2019 6:25:51 PM GMT+05:30 +``` + +An hour has 3600 seconds and a day has 86400 seconds. You can compare epoch timestamps as shown in the following example: + +``` +(/ (- (ts-unix (ts-now)) +(ts-unix (ts-adjust ‘day -4 (ts-now)))) +86400) +4 +``` + +The _ts-difference_ function returns the difference between two timestamps, while the _ts-human-duration_ function returns the property list (_plist_) values of years, days, hours, minutes and seconds. For example: + +``` +(ts-human-duration +(ts-difference (ts-now) +(ts-dec ‘day 3 (ts-now)))) +(:years 0 :days 3 :hours 0 :minutes 0 :seconds 0) +``` + +A number of aliases are available for the hour, minute, second, year, month and day format string constructors. A few examples are given below: + +``` +(ts-hour (ts-now)) +18 +(ts-H (ts-now)) +18 + + +(ts-minute (ts-now)) +46 +(ts-min (ts-now)) +46 +(ts-M (ts-now)) +46 + +(ts-second (ts-now)) +16 +(ts-sec (ts-now)) +16 +(ts-S (ts-now)) +16 + +(ts-year (ts-now)) +2019 +(ts-Y (ts-now)) +2019 + +(ts-month (ts-now)) +7 +(ts-m (ts-now)) +7 + +(ts-day (ts-now)) +5 +(ts-d (ts-now)) +5 +``` + +You can parse a string into a timestamp object using the ts-parse function. For example: + +``` +(ts-format nil (ts-parse “Fri Dec 6 2019 18:48:00”)) +“2019-12-06 18:48:00 +0530” +``` + +You can also format the difference between two timestamps in a human readable format as shown in the following example: + +``` +(ts-human-format-duration +(ts-difference (ts-now) +(ts-adjust ‘day -1 ‘hour -3 ‘minute -2 ‘second -4 (ts-now)))) +“1 days, 3 hours, 2 minutes, 4 seconds” +``` + +The timestamp comparator operations are also defined in ts.el. The ts< function compares if one epoch UNIX timestamp is less than the other. Its definition is as follows: + +``` +(defun ts< (a b) +“Return non-nil if timestamp A is less than timestamp B.” +(< (ts-unix a) (ts-unix b))) +``` + +In the example given below, the current timestamp is not less than the previous day and hence it returns nil. + +``` +(ts< (ts-now) (ts-adjust ‘day -1 (ts-now))) +nil +``` + +Similarly, we have other comparator functions like ts>, ts=, ts>= and ts<=. A few examples of these function use cases are given below: + +``` +(ts> (ts-now) (ts-adjust ‘day -1 (ts-now))) +t + +(ts= (ts-now) (ts-now)) +nil + +(ts>= (ts-now) (ts-adjust ‘day -1 (ts-now))) +t + +(ts<= (ts-now) (ts-adjust ‘day -2 (ts-now))) +nil +``` + +**Benchmarking** +A few performance tests can be conducted to compare the Emacs internal time values versus the UNIX timestamps. The benchmarking tests can be executed by including the bench-multi macro and bench-multi-process-results function available from __ in your Emacs environment. +You will also need to load the dash-functional library to use the -on function. + +``` +(require ‘dash-functional) +``` + +The following tests have been executed on an Intel(R) Core(TM) i7-3740QM CPU at 2.70GHz with eight cores, 16GB RAM and running Ubuntu 18.04 LTS. + +**Formatting** +The first benchmarking exercise is to compare the formatting of the UNIX timestamp and the Emacs internal time. The Emacs Lisp code to run the test is shown below: + +``` +(let ((format “%Y-%m-%d %H:%M:%S”)) +(bench-multi :times 100000 +:forms ((“Unix timestamp” (format-time-string format 1544311232)) +(“Internal time” (format-time-string format ‘(23564 20962 864324 108000)))))) +``` + +The output appears as an s-expression: + +``` +((“Form” “x faster than next” “Total runtime” “# of GCs” “Total GC runtime”) +hline + +(“Internal time” “1.11” “2.626460” 13 “0.838733”) +(“Unix timestamp” “slowest” “2.921408” 13 “0.920814”)) +``` + +The abbreviation ‘GC’ refers to garbage collection. A tabular representation of the above results is given below: + +[![][3]][4] + +We observe that formatting the internal time is slightly faster. + +**Getting the current time** +The functions to obtain the current time can be compared using the following test: + +``` +(bench-multi :times 100000 +:forms ((“Unix timestamp” (float-time)) +(“Internal time” (current-time)))) +``` + +The results are shown below: + +[![][5]][6] + +We observe that using the Unix timestamp is faster. + +**Parsing** +The third benchmarking exercise is to compare parsing functions on a date timestamp string. The corresponding test code is given below: + +``` +(let* ((s “Wed 10 Jul 2019”)) +(bench-multi :times 100000 +:forms ((“ts-parse” (ts-parse s)) +(“ts-parse ts-unix” (ts-unix (ts-parse s)))))) +``` + +The _ts-parse_ function is slightly faster than the ts-parse _ts-unix_ function, as seen in the results: + +[![][7]][8] + +**A new timestamp versus blanking fields** +The last performance comparison is between creating a new timestamp and blanking the fields. The relevant test code is as follows: + +``` +(let* ((a (ts-now))) +(bench-multi :times 100000 +:ensure-equal t +:forms ((“New” (let ((ts (copy-ts a))) +(setq ts (ts-fill ts)) +(make-ts :unix (ts-unix ts)))) +(“Blanking” (let ((ts (copy-ts a))) +(setq ts (ts-fill ts)) +(ts-reset ts)))))) +``` + +The output of the benchmarking exercise is given below: + +[![][9]][10] + +We observe that creating a new timestamp is slightly faster than blanking the fields. +You are encouraged to read the ts.el README and notes.org from the GitHub repository __ for more information. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/the-emacs-series-exploring-ts-el/ + +作者:[Shakthi Kannan][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://opensourceforu.com/author/shakthi-kannan/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/GPL-emacs-1.jpg?resize=696%2C435&ssl=1 (GPL emacs) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/GPL-emacs-1.jpg?fit=800%2C500&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1-1.png?resize=350%2C151&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1-1.png?ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-1.png?resize=350%2C191&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-1.png?ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3.png?resize=350%2C144&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3.png?ssl=1 +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4.png?resize=350%2C149&ssl=1 +[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4.png?ssl=1 diff --git a/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md b/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md new file mode 100644 index 0000000000..795f4c731b --- /dev/null +++ b/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Talking to machines: Lisp and the origins of AI) +[#]: via: (https://opensource.com/article/19/9/command-line-heroes-lisp) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg) + +Talking to machines: Lisp and the origins of AI +====== +The Command Line Heroes podcast explores the invention of Lisp and the +rise of thinking computers powered by open source software. +![Listen to the Command Line Heroes Podcast][1] + +Artificial intelligence (AI) is all the rage today, and its massive impact on the world is still to come, says the[ Association for the Advancement of Artificial Intelligence][2] (AAAI). According to an article on [Nanalyze][3]: + +> "The vast majority of nearly 2,000 experts polled by the Pew Research Center in 2014 said they anticipate robotics and artificial intelligence will permeate wide segments of daily life by 2025. A 2015 study covering 17 countries found that artificial intelligence and related technologies added an estimated 0.4 percentage point on average to those countries' annual GDP growth between 1993 and 2007, accounting for just over one-tenth of those countries' overall GDP growth during that time." + +However, this is the second time has AI garnered so much attention. When was AI first popular, and what does that have to do with the obscure-but-often-loved programming language Lisp? + +The second-to-last podcast of [Command Line Heroes][4]' third season dives into these topics and leaves us thinking about open source at the core of AI. + +### Before the term AI + +Thinking machines have been a curiosity for centuries, long before they could be realized. In the 1800s, computer science pioneers Charles Babbage and Ada Lovelace imagined an analytical engine capable of predictions far beyond human skills, such as correctly selecting the winning horse in a race. + +In the 1940s and '50s, Alan Turing defined what it would look like for intelligent machines to emulate human intelligence; that's what we now call the Turing Test. In his 1950 [research paper][5], Turing's "imitation game" set out to convince someone they were communicating with a human in another room when, in reality, it was a machine. + +While these theories inspired imaginative debate, they became less theoretical as computer hardware began providing enough power to begin experimenting. + +### Why Lisp is at the heart of AI theory + +John McCarthy, the person to coin the term "artificial intelligence," is also the person who reinvented how we program to create thinking machines. His reimagined approach was codified into the Lisp programming language. As [Paul Graham][6] wrote: + +> "In 1960, [John McCarthy][7] published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for 'List Processing,' because one of his key ideas was to use a simple data structure called a list for both code and data. +> +> "It's worth understanding what McCarthy discovered, not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been [moving steadily][8] toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection." + +I remember when I first wrote Lisp for a computer science class. After wrapping my head around its seemingly infinite number of parentheses, I uncovered a beautiful pattern of thought: Can I think through what I want this software to do? + +![The elegance of Lisp programming is timeless][9] + +That sounds silly: computers process what we code them to do, but there's something about recursion that made me think in a wildly different light. It's exciting to learn that 15 years ago, I may have been tapping into the big-picture changes McCarthy was describing. + +### Why the slowdown in AI? + +By the mid-to-late 1960s, McCarthy's work made way to a new field of research, where AI, machine learning (ML), and deep learning all became possibilities. And Lisp became the accepted standard in this emerging field. It's said that in 1968, McCarthy made a wager with David Levy, a Scottish chess master, that in 10 years a computer would be able to beat Levy in a chess match. Why did it take nearly 30 years to get to the famous [Deep Blue vs. Garry Kasparov][10] match? + +Command Line Heroes explores one theory: that for-profit investment in AI pulled essential talent from academia, where they were advancing the science, and pushed them onto a different path. Whether or not this was the reason, the world of AI fell into a "winter," where the people pursuing it were considered unrealistic. + +This AI winter lasted for quite some time. In 2005, The [_New York Times_ reported][11] that AI had become so stigmatized that "some computer scientists and software engineers avoided the term artificial intelligence for fear of being viewed as wild-eyed dreamers." + +### Where is AI now? + +Fast forward to today, when talking about AI or ML is a fast pass to getting people's attention—but that attention isn't always positive. Many are concerned that AI will remove millions of jobs from the world. Others say it will [create][12] millions of more jobs than are lost. + +The verdict is still out. [McKinsey's research][13] on the job loss vs. job gain debate is fascinating. When you take into account growing world consumption, aging populations, "marketization" of previously unpaid domestic work, and other factors, you find that the answer depends on your outlook. + +One thing is for sure: AI will be a significant part of our lives, and it will have much wider implications than other areas of tech. For this reason (among others), examining the [misconceptions around ethics and bias in AI][14] is essential. + +### Open source and AI + +McCarthy had a dream that machines could have common sense. His AI goals included open source from the very beginning; this is visualized on Red Hat's beautifully animated webpage on the [origins of AI and its open source roots][15]. + +[![Origins of AI and open source screenshot][16]][15] + +If we are to achieve the goals of McCarthy, Turing, or other AI pioneers, I believe it will be because of the open source community behind the technology. Part of the reason AI's popularity bounced back is because of open source: languages, frameworks, and the datasets we analyze are increasingly open. Here are a handful of things to explore: + + * [Learn enough Python and R][17] to be part of this future + * [Explore Python libraries][18] that will bulk up your skills + * Understand how [AI and ML are related][19] + * Explore [free and open datasets][20] + * Use modern implementations of Lisp, [available under open source licenses][21] + + + +It's possible that early AI explored the right ideas in the wrong decade. World-class computers back then weren't even as powerful as today's cellphones, and each one was shared by dozens of individuals. Today, many of us own multiple supercomputers and carry them with us all the time. For this reason, among others, the future of AI is strong and its highest achievements are yet to come. + +_Command Line Heroes has covered programming languages for all of Season 3. [Subscribe so that you don't miss the last episode of the season][4], and I would love to hear your thoughts in the comments below._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/command-line-heroes-lisp + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_hereoes_ep7_blog-header-292x521.png?itok=lI4DXvq2 (Listen to the Command Line Heroes Podcast) +[2]: http://aaai.org/ +[3]: https://www.nanalyze.com/2016/11/artificial-intelligence-definition/ +[4]: https://www.redhat.com/en/command-line-heroes +[5]: https://www.csee.umbc.edu/courses/471/papers/turing.pdf +[6]: http://www.paulgraham.com/rootsoflisp.html +[7]: http://www-formal.stanford.edu/jmc/index.html +[8]: http://www.paulgraham.com/diff.html +[9]: https://opensource.com/sites/default/files/uploads/lisp_cycles.png (The elegance of Lisp programming is timeless) +[10]: https://en.wikipedia.org/wiki/Deep_Blue_versus_Garry_Kasparov +[11]: https://www.nytimes.com/2005/10/14/technology/behind-artificial-intelligence-a-squadron-of-bright-real-people.html +[12]: https://singularityhub.com/2019/01/01/ai-will-create-millions-more-jobs-than-it-will-destroy-heres-how/ +[13]: https://www.mckinsey.com/featured-insights/future-of-work/jobs-lost-jobs-gained-what-the-future-of-work-will-mean-for-jobs-skills-and-wages +[14]: https://opensource.com/article/19/8/4-misconceptions-ethics-and-bias-ai +[15]: https://www.redhat.com/en/open-source-stories/ai-revolutionaries/origins-ai-open-source +[16]: https://opensource.com/sites/default/files/uploads/origins_aiopensource.png (Origins of AI and open source screenshot) +[17]: https://opensource.com/article/19/5/learn-python-r-data-science +[18]: https://opensource.com/article/18/5/top-8-open-source-ai-technologies-machine-learning +[19]: https://opensource.com/tags/ai-and-machine-learning +[20]: https://opensource.com/article/19/2/learn-data-science-ai +[21]: https://www.cliki.net/Common+Lisp+implementation diff --git a/sources/tech/20190917 What-s Good About TensorFlow 2.0.md b/sources/tech/20190917 What-s Good About TensorFlow 2.0.md new file mode 100644 index 0000000000..a00306d6c5 --- /dev/null +++ b/sources/tech/20190917 What-s Good About TensorFlow 2.0.md @@ -0,0 +1,328 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s Good About TensorFlow 2.0?) +[#]: via: (https://opensourceforu.com/2019/09/whats-good-about-tensorflow-2-0/) +[#]: author: (Siva Rama Krishna Reddy B https://opensourceforu.com/author/siva-krishna/) + +What’s Good About TensorFlow 2.0? +====== + +[![][1]][2] + +_Version 2.0 of TensorFlow is focused on simplicity and ease of use. It has been strengthened with updates like eager execution and intuitive higher level APIs accompanied by flexible model building. It is platform agnostic, and makes APIs more consistent, while removing those that are redundant._ + +Machine learning and artificial intelligence are experiencing a revolution these days, primarily due to three major factors. The first is the increased computing power available within small form factors such as GPUs, NPUs and TPUs. The second is the breakthrough in machine learning algorithms. State-of-art algorithms and hence models are available to infer faster. Finally, huge amounts of labelled data is essential for deep learning models to perform better, and this is now available. + +TensorFlow is an open source AI framework from Google which arms researchers and developers with the right tools to build novel models. It was made open source in 2015 and, in the past few years, has evolved with various enhancements covering operator support, programming languages, hardware support, data sets, official models, and distributed training and deployment strategies. + +TensorFlow 2.0 was released recently at the TensorFlow Developer Summit. It has major changes across the stack, some of which will be discussed from the developers’ point of view. + +TensorFlow 2.0 is primarily focused on the ease-of-use, power and scalability aspects. Ease is ensured in terms of simplified APIs, Keras being the main high level API interface; eager execution is available by default. Version 2.0 is powerful in the sense of being flexible and running much faster than earlier, with more optimisation. Finally, it is more scalable since it can be deployed on high-end distributed environments as well as on small edge devices. + +This new release streamlines the various components involved, from data preparation all the way up to deployment on various targets. High speed data processing pipelines are offered by tf.data, high level APIs are offered by tf.keras, and there are simplified APIs to access various distribution strategies on targets like the CPU, GPU and TPU. TensorFlow 2.0 offers a unique packaging format called SavedModel that can be deployed over the cloud through a TensorFlow Serving. Edge devices can be deployed through TensorFlow Lite, and Web applications through the newly introduced TensorFlow.js and various other language bindings that are also available. + +![Figure 1: The evolution of TensorFlow][3] + +TensorFlow.js was announced at the developer summit with off-the-shelf pretrained models for the browser, node, desktop and mobile native applications. The inclusion of Swift was also announced. Looking at some of the performance improvements since last year, the latest release claims a training speedup of 1.8x on NVIDIA Tesla V100, a 1.6x training speedup on Google Cloud TPUv2 and a 3.3.x inference speedup on Intel Skylake. + +**Upgrade to 2.0** +The new release offers a utility _tf_upgrade_v2_ to convert a 1.x Python application script to a 2.0 compatible script. It does most of the job in converting the 1.x deprecated API to a newer compatibility API. An example of the same can be seen below: + +``` +test-pc:~$cat test-infer-v1.py + +# Tensorflow imports +import tensorflow as tf + +save_path = ‘checkpoints/dev’ +with tf.gfile.FastGFile(“./trained-graph.pb”, ‘rb’) as f: +graph_def = tf.GraphDef() +graph_def.ParseFromString(f.read()) +tf.import_graph_def(graph_def, name=’’) + +with tf.Session(graph=tf.get_default_graph()) as sess: +input_data = sess.graph.get_tensor_by_name(“DecodeJPGInput:0”) +output_data = sess.graph.get_tensor_by_name(“final_result:0”) + +image = ‘elephant-299.jpg’ +if not tf.gfile.Exists(image): +tf.logging.fatal(‘File does not exist %s’, image) +image_data = tf.gfile.FastGFile(image, ‘rb’).read() + +result = sess.run(output_data, {‘DecodeJPGInput:0’: image_data}) +print(result) + +test-pc:~$ tf_upgrade_v2 --infile test-infer-v1.py --outfile test-infer-v2.py + +INFO line 5:5: Renamed ‘tf.gfile.FastGFile’ to ‘tf.compat.v1.gfile.FastGFile’ +INFO line 6:16: Renamed ‘tf.GraphDef’ to ‘tf.compat.v1.GraphDef’ +INFO line 10:9: Renamed ‘tf.Session’ to ‘tf.compat.v1.Session’ +INFO line 10:26: Renamed ‘tf.get_default_graph’ to ‘tf.compat.v1.get_default_graph’ +INFO line 15:15: Renamed ‘tf.gfile.Exists’ to ‘tf.io.gfile.exists’ +INFO line 16:12: Renamed ‘tf.logging.fatal’ to ‘tf.compat.v1.logging.fatal’ +INFO line 17:21: Renamed ‘tf.gfile.FastGFile’ to ‘tf.compat.v1.gfile.FastGFile’ +TensorFlow 2.0 Upgrade Script +----------------------------- +Converted 1 files +Detected 0 issues that require attention +------------------------------------------------------------- +Make sure to read the detailed log ‘report.txt’ + +test-pc:~$ cat test-infer-v2.py + +# Tensorflow imports +import tensorflow as tf + +save_path = ‘checkpoints/dev’ +with tf.compat.v1.gfile.FastGFile(“./trained-graph.pb”, ‘rb’) as f: +graph_def = tf.compat.v1.GraphDef() +graph_def.ParseFromString(f.read()) +tf.import_graph_def(graph_def, name=’’) + +with tf.compat.v1.Session(graph=tf.compat.v1.get_default_graph()) as sess: +input_data = sess.graph.get_tensor_by_name(“DecodeJPGInput:0”) +output_data = sess.graph.get_tensor_by_name(“final_result:0”) + +image = ‘elephant-299.jpg’ +if not tf.io.gfile.exists(image): +tf.compat.v1.logging.fatal(‘File does not exist %s’, image) +image_data = tf.compat.v1.gfile.FastGFile(image, ‘rb’).read() + +result = sess.run(output_data, {‘DecodeJPGInput:0’: image_data}) +print(result) +``` + +As we can see here, the _tf_upgrade_v2_ utility converts all the deprecated APIs to compatible v1 APIs, to make them work with 2.0. + +**Eager execution:** Eager execution allows real-time evaluation of Tensors without calling _session.run_. A major advantage with eager execution is that we can print the Tensor values any time for debugging. +With TensorFlow 1.x, the code is: + +``` +test-pc:~$python3 +Python 3.6.7 (default, Oct 22 2018, 11:32:17) +[GCC 8.2.0] on linux +Type “help”, “copyright”, “credits” or “license” for more information. +>>> import tensorflow as tf +>>> print(tf.__version__) +1.14.0 +>>> tf.add(2,3) + +``` + +TensorFlow 2.0, on the other hand, evaluates the result that we call the API: + +``` +test-pc:~$python3 +Python 3.6.7 (default, Oct 22 2018, 11:32:17) +[GCC 8.2.0] on linux +Type “help”, “copyright”, “credits” or “license” for more information. +>>> import tensorflow as tf +>>> print(tf.__version__) +2.0.0-beta1 +>>> tf.add(2,3) + +``` + +In v1.x, the resulting Tensor doesn’t display the value and we need to execute the graph under a session to get the value, but in v2.0 the values are implicitly computed and available for debugging. + +**Keras** +Keras (_tf.keras_) is now the official high level API. It has been enhanced with many compatible low level APIs. The redundancy across Keras and TensorFlow is removed, and most of the APIs are now available with Keras. The low level operators are still accessible through tf.raw_ops. +We can now save the Keras model directly as a Tensorflow SavedModel, as shown below: + +``` +# Save Model to SavedModel +saved_model_path = tf.keras.experimental.export_saved_model(model, ‘/path/to/model’) + +# Load the SavedModel +new_model = tf.keras.experimental.load_from_saved_model(saved_model_path) + +# new_model is now keras Model object. +new_model.summary() +``` + +Earlier, APIs related to various layers, optimisers, metrics and loss functions were distributed across Keras and native TensorFlow. Latest enhancements unify them as _tf.keras.optimizer.*, tf.keras.metrics.*, tf.keras.losses.* and tf.keras.layers.*._ +The RNN layers are now much more simplified compared to v 1.x. +With TensorFlow 1.x, the commands given are: + +``` +if tf.test.is_gpu_available(): +model.add(tf.keras.layers.CudnnLSTM(32)) +else +model.add(tf.keras.layers.LSTM(32)) +``` + +With TensorFlow 2.0, the commands given are: + +``` +# This will use Cudnn kernel when the GPU is available. +model.add(tf.keras.layer.LSTM(32)) +``` + +TensorBoard integration is now a simple call back, as shown below: + +``` +tb_callbaclk = tf.keras.callbacks.TensorBoard(log_dir=log_dir) + +model.fit( +x_train, y_train, epocha=5, +validation_data = [x_test, y_test], +Callbacks = [tb_callbacks]) +``` + +With this simple call back addition, TensorBoard is up on the browser to look for all the statistics in real-time. +Keras offers unified distribution strategies, and a few lines of code can enable the required strategy as shown below: + +``` +strategy = tf.distribute.MirroredStrategy() + +with strategy.scope() +model = tf.keras.models.Sequential([ +tf.keras.layers.Dense(64, input_shape=[10]), +tf.keras.layers.Dense(64, activation=’relu’), +tf.keras.layers.Dense(10, activation=’softmax’)]) + +model.compile(optimizer=’adam’, +loss=’categorical_crossentropy’, +metrics=[‘accuracy’]) +``` + +As shown above, the model definition under the desired scope is all we need to apply the desired strategy. Very soon, there will be support for multi-node synchronous and TPU strategy, and later, for parameter server strategy. + +![Figure 2: Coral products with edge TPU][4] + +**TensorFlow function** +Function is a major upgrade that impacts the way we write TensorFlow applications. The new version introduces tf.function, which simplifies the applications and makes it very close to writing a normal Python application. +A sample _tf.function_ definition looks like what’s shown in the code snippet below. Here the _tf.function_ declaration makes the user define a function as a TensorFlow operator, and all optimisation is applied automatically. Also, the function is faster than eager execution. APIs like _tf.control_dependencies_, _tf.global_variable_initializer_, and _tf.cond, tf.while_loop_ are no longer needed with _tf.function_. The user defined functions are polymorphic by default, i.e., we may pass mixed type tensors. + +``` +test-pc:~$ cat tf-test.py +import tensorflow as tf + +print(tf.__version__) + +@tf.function +def add(a, b): +return (a+b) + +print(add(tf.ones([2,2]), tf.ones([2,2]))) + +test-pc:~$ python3 tf-test.py +2.0.0-beta1 +tf.Tensor( +[[2. 2.] +[2. 2.]], shape=(2, 2), dtype=float32) +``` + +Here is another example to demonstrate automatic control flows and Autograph in action. Autograph automatically converts the conditions, while it loops Python to TensorFlow operators. + +``` +test-pc:~$ cat tf-test-control.py +import tensorflow as tf + +print(tf.__version__) + +@tf.function +def f(x): +while tf.reduce_sum(x) > 1: +x = tf.tanh(x) +return x + +print(f(tf.random.uniform([10]))) + +test-pc:~$ python3 tf-test-control.py + +2.0.0-beta1 +tf.Tensor( +[0.10785562 0.11102211 0.11347286 0.11239681 0.03989326 0.10335539 +0.11030331 0.1135259 0.11357211 0.07324989], shape=(10,), dtype=float32) +``` + +We can see Autograph in action with the following API over the function. + +``` +print(tf.autograph.to_code(f)) # f is the function name +``` + +**TensorFlow Lite** +The latest advancements in edge devices add neural network accelerators. Google has released EdgeTPU, Intel has the edge inference platform Movidius, Huawei mobile devices have the Kirin based NPU, Qualcomm has come up with NPE SDK to accelerate on the Snapdragon chipsets using Hexagon power and, recently, Samsung released Exynos 9 with NPU. An edge device optimised framework is necessary to support these hardware ecosystems. + +Unlike TensorFlow, which is widely used in high power-consuming server infrastructure, edge devices are challenging in terms of reduced computing power, limited memory and battery constraints. TensorFlow Lite is aimed at bringing in TensorFlow models directly onto the edge with minimal effort. The TF Lite model format is different from TensorFlow. A TF Lite converter is available to convert a TensorFlow SavedBundle to a TF Lite model. + +Though TensorFlow Lite is evolving, there are limitations too, such as in the number of operations supported, and the unsupported semantics like control-flows and RNNs. In its early days, TF Lite used a TOCO converter and there were a few challenges for the developer community. A brand new 2.0 converter is planned to be released soon. There are claims that using TF Lite results in huge improvements across the CPU, GPU and TPU. + +TF Lite introduces delegates to accelerate parts of the graph on an accelerator. We may choose a specific delegate for a specific sub-graph, if needed. + +``` +#import “tensorflow/lite/delegates/gpu/metal_delegate.h” + +// Initialize interpreter with GPU delegate +std::unique_ptr interpreter; +InterpreterBuilder(*model, resolver)(&interpreter); +auto* delegate = NewGpuDelegate(nullptr); // default config +if (interpreter->ModifyGraphWithDelegate(delegate) != kTfLiteOk) return false; + +// Run inference +while (true) { +WriteToInputTensor(interpreter->typed_input_tensor(0)); +if (interpreter->Invoke() != kTfLiteOk) return false; +ReadFromOutputTensor(interpreter->typed_output_tensor(0)); +} + +// Clean up +interpreter = nullptr; +DeleteGpuDelegate(delegate); +``` + +As shown above, we can choose GPUDelegate, and modify the graph with the respective kernel’s runtime. TF Lite is going to support the Android NNAPI delegate, in order to support all the hardware that is supported by NNAPI. For edge devices, CPU optimisation is also important, as not all edge devices are equipped with accelerators; hence, there is a plan to support further optimisations for ARM and x86. + +Optimisations based on quantisation and pruning are evolving to reduce the size and processing demands of models. Quantisation generally can reduce model size by 4x (i.e., 32-bit to 8-bit). Models with more convolution layers may get faster by 10 to 50 per cent on the CPU. Fully connected and RNN layers may speed up operation by 3x. + +TF Lite now supports post-training quantisation, which reduces the size along with compute demands greatly. TensorFlow 2.0 offers simplified APIs to build models with quantisation and by pruning optimisations. +A normal dense layer without quantisation looks like what follows: + +``` +tf.keras.layers.Dense(512, activation=’relu’) +``` + +Whereas a quality dense layer looks like what’s shown below: + +``` +quantize.Quantize(tf.keras.layers.Dense(512, activation=’relu’)) +``` + +Pruning is a technique used to drop connections that are ineffective. In general, ‘dense’ layers contain lots of connections which don’t influence the output. Such connections can be dropped by making the weight zero. Tensors with lots of zeros may be represented as ‘sparse’ and can be compressed. Also, the number of operations in a sparse tensor is less. +Building a layer with _prune_ is as simple as using the following command: + +``` +prune.Prune(tf.keras.layers.Dense(512, activation=’relu’)) +``` + +In a pipeline, there is Keras based quantised training and Keras based connection pruning. These optimisations may push TF Lite further ahead of the competition, with regard to other frameworks. + +**Coral** +Coral is a new platform for creating products with on-device ML acceleration. The first product here features Google’s Edge TPU in SBC and USB form factors. TensorFlow Lite is officially supported on this platform, with the salient features being very fast inference speed, privacy and no reliance on network connection. + +More details related to hardware specifications, pricing, and a getting started guide can be found at __. + +With these advances as well as a wider ecosystem, it’s very evident that TensorFlow may become the leading framework for artificial intelligence and machine learning, similar to how Android evolved in the mobile world. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/whats-good-about-tensorflow-2-0/ + +作者:[Siva Rama Krishna Reddy B][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://opensourceforu.com/author/siva-krishna/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2018/09/ML-with-tensorflow.jpg?resize=696%2C328&ssl=1 (ML with tensorflow) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2018/09/ML-with-tensorflow.jpg?fit=1200%2C565&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-The-evolution-of-TensorFlow.jpg?resize=350%2C117&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Coral-products-with-edge-TPU.jpg?resize=350%2C198&ssl=1 diff --git a/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md b/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md new file mode 100644 index 0000000000..67b4779680 --- /dev/null +++ b/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to audio processing and machine learning using Python) +[#]: via: (https://opensource.com/article/19/9/audio-processing-machine-learning-python) +[#]: author: (Jyotika Singh https://opensource.com/users/jyotika-singhhttps://opensource.com/users/jroakeshttps://opensource.com/users/don-watkinshttps://opensource.com/users/clhermansenhttps://opensource.com/users/greg-p) + +An introduction to audio processing and machine learning using Python +====== +The pyAudioProcessing library classifies audio into different categories +and genres. +![abstract illustration with black background][1] + +At a high level, any machine learning problem can be divided into three types of tasks: data tasks (data collection, data cleaning, and feature formation), training (building machine learning models using data features), and evaluation (assessing the model). Features, [defined][2] as "individual measurable propert[ies] or characteristic[s] of a phenomenon being observed," are very useful because they help a machine understand the data and classify it into categories or predict a value. + +![Machine learning at a high level][3] + +Different data types use very different processing techniques. Take the example of an image as a data type: it looks like one thing to the human eye, but a machine sees it differently after it is transformed into numerical features derived from the image's pixel values using different filters (depending on the application). + +![Data types and feature formation in images][4] + +[Word2vec][5] works great for processing bodies of text. It represents words as vectors of numbers, and the distance between two word vectors determines how similar the words are. If we try to apply Word2vec to numerical data, the results probably will not make sense. + +![Word2vec for analyzing a corpus of text][6] + +So, there are processing techniques specific to the audio data type that works well with audio. + +### What are audio signals? + +Audio signals are signals that vibrate in the audible frequency range. When someone talks, it generates air pressure signals; the ear takes in these air pressure differences and communicates with the brain. That's how the brain helps a person recognize that the signal is speech and understand what someone is saying. + +There are a lot of MATLAB tools to perform audio processing, but not as many exist in Python. Before we get into some of the tools that can be used to process audio signals in Python, let's examine some of the features of audio that apply to audio processing and machine learning. + +![Examples of audio terms to learn][7] + +Some data features and transformations that are important in speech and audio processing are Mel-frequency cepstral coefficients ([MFCCs][8]), Gammatone-frequency cepstral coefficients (GFCCs), Linear-prediction cepstral coefficients (LFCCs), Bark-frequency cepstral coefficients (BFCCs), Power-normalized cepstral coefficients (PNCCs), spectrum, cepstrum, spectrogram, and more. + +We can use some of these features directly and extract features from some others, like spectrum, to train a machine learning model. + +### What are spectrum and cepstrum? + +Spectrum and cepstrum are two particularly important features in audio processing. + +![Spectrum and cepstrum][9] + +Mathematically, a spectrum is the [Fourier transform][10] of a signal. A Fourier transform converts a time-domain signal to the frequency domain. In other words, a spectrum is the frequency domain representation of the input audio's time-domain signal. + +A [cepstrum][11] is formed by taking the log magnitude of the spectrum followed by an inverse Fourier transform. This results in a signal that's neither in the frequency domain (because we took an inverse Fourier transform) nor in the time domain (because we took the log magnitude prior to the inverse Fourier transform). The domain of the resulting signal is called the quefrency. + +### What does this have to do with hearing? + +The reason we care about the signal in the frequency domain relates to the biology of the ear. Many things must happen before we can process and interpret a sound. One happens in the cochlea, a fluid-filled part of the ear with thousands of tiny hairs that are connected to nerves. Some of the hairs are short, and some are relatively longer. The shorter hairs resonate with higher sound frequencies, and the longer hairs resonate with lower sound frequencies. Therefore, the ear is like a natural Fourier transform analyzer! + +![How the ear works][12] + +Another fact about human hearing is that as the sound frequency increases above 1kHz, our ears begin to get less selective to frequencies. This corresponds well with something called the Mel filter bank. + +![MFCC][13] + +Passing a spectrum through the Mel filter bank, followed by taking the log magnitude and a [discrete cosine transform][14] (DCT) produces the Mel cepstrum. DCT extracts the signal's main information and peaks. It is also widely used in JPEG and MPEG compressions. The peaks are the gist of the audio information. Typically, the first 13 coefficients extracted from the Mel cepstrum are called the MFCCs. These hold very useful information about audio and are often used to train machine learning models. + +Another filter inspired by human hearing is the Gammatone filter bank. This filter bank is used as a front-end simulation of the cochlea. Thus, it has many applications in speech processing because it aims to replicate how we hear. + +![GFCC][15] + +GFCCs are formed by passing the spectrum through Gammatone filter bank, followed by loudness compression and DCT. The first (approximately) 22 features are called GFCCs. GFCCs have a number of applications in speech processing, such as speaker identification. + +Other features useful in audio processing tasks (especially speech) include LPCC, BFCC, PNCC, and spectral features like spectral flux, entropy, roll off, centroid, spread, and energy entropy. + +### Building a classifier + +As a quick experiment, let's try building a classifier with spectral features and MFCC, GFCC, and a combination of MFCCs and GFCCs using an open source Python-based library called [pyAudioProcessing][16]. + +To start, we want pyAudioProcessing to classify audio into three categories: speech, music, or birds. + +![Segmenting audio into speech, music, and birds][17] + +Using a small dataset (50 samples for training per class) and without any fine-tuning, we can gauge the potential of this classification model to identify audio categories. + +![MFCC of speech, music, and bird signals][18] + +Next, let's try pyAudioProcessing on a music genre classification problem using the [GZTAN][19] audio dataset and audio features: MFCC and spectral features. + +![Music genre classification][20] + +Some genres do well while others have room for improvement. Some things that can be explored from this data include: + + * Data quality check: Is more data needed? + * Features around the beat and other aspects of music audio + * Features other than audio, like transcription and text + * Would a different classifier be better? There has been research on using neural networks to classify music genres. + + + +Regardless of the results of this quick test, it is evident that these features get useful information out of the signal, a machine can work with them, and they form a good baseline to work with. + +### Learn more + +Here are some useful resources that can help in your journey with Python audio processing and machine learning: + + * [pyAudioAnalysis][21] + * [pyAudioProcessing][16] + * [Power-normalized cepstral coefficients (PNCC) for robust speech recognition][22] + * [LPCC features][23] + * [Speech recognition using MFCC][24] + * [Speech/music classification using block-based MFCC features][25] + * [Musical genre classification of audio signals][26] + * Libraries for reading audio in Python: [SciPy][27], [pydub][28], [libROSA][29], pyAudioAnalysis + * Libraries for getting features: libROSA, pyAudioAnalysis (for MFCC); pyAudioProcessing (for MFCC and GFCC) + * Basic machine learning models to use on audio: sklearn, hmmlearn, pyAudioAnalysis, pyAudioProcessing + + + +* * * + +_This article is based on Jyotika Singh's presentation "[Audio processing and ML using Python][30]" from PyBay 2019._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/audio-processing-machine-learning-python + +作者:[Jyotika Singh][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/jyotika-singhhttps://opensource.com/users/jroakeshttps://opensource.com/users/don-watkinshttps://opensource.com/users/clhermansenhttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/FeedbackLoop.png?itok=l7Sa9fHt (abstract illustration with black background) +[2]: https://en.wikipedia.org/wiki/Feature_(machine_learning) +[3]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_1.png (Machine learning at a high level) +[4]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_1a.png (Data types and feature formation in images) +[5]: https://en.wikipedia.org/wiki/Word2vec +[6]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_2b.png (Word2vec for analyzing a corpus of text) +[7]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_4.png (Examples of audio terms to learn) +[8]: https://en.wikipedia.org/wiki/Mel-frequency_cepstrum +[9]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_5.png (Spectrum and cepstrum) +[10]: https://en.wikipedia.org/wiki/Fourier_transform +[11]: https://en.wikipedia.org/wiki/Cepstrum +[12]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_6.png (How the ear works) +[13]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_7.png (MFCC) +[14]: https://en.wikipedia.org/wiki/Discrete_cosine_transform +[15]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_8.png (GFCC) +[16]: https://github.com/jsingh811/pyAudioProcessing +[17]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_10.png (Segmenting audio into speech, music, and birds) +[18]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_11.png (MFCC of speech, music, and bird signals) +[19]: http://marsyas.info/downloads/datasets.html +[20]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_12.png (Music genre classification) +[21]: https://github.com/tyiannak/pyAudioAnalysis +[22]: http://www.cs.cmu.edu/~robust/Papers/OnlinePNCC_V25.pdf +[23]: https://link.springer.com/content/pdf/bbm%3A978-3-319-17163-0%2F1.pdf +[24]: https://pdfs.semanticscholar.org/3439/454a00ef811b3a244f2b0ce770e80f7bc3b6.pdf +[25]: https://pdfs.semanticscholar.org/031b/84fb7ae3fae3fe51a0a40aed4a0dcb55a8e3.pdf +[26]: https://pdfs.semanticscholar.org/4ccb/0d37c69200dc63d1f757eafb36ef4853c178.pdf +[27]: https://www.scipy.org/ +[28]: https://github.com/jiaaro/pydub +[29]: https://librosa.github.io/librosa/ +[30]: https://pybay.com/speaker/jyotika-singh/ diff --git a/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md b/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md new file mode 100644 index 0000000000..2a8d17b1b1 --- /dev/null +++ b/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why it's time to embrace top-down cybersecurity practices) +[#]: via: (https://opensource.com/article/19/9/cybersecurity-practices) +[#]: author: (Matt ShealyAnderson Silva https://opensource.com/users/mshealyhttps://opensource.com/users/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/bexelbiehttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/alanfdoss) + +Why it's time to embrace top-down cybersecurity practices +====== +An open culture doesn't mean being light on security practices. Having +executives on board with cybersecurity, including funding it adequately, +is critical for protecting and securing company data. +![Two different business organization charts][1] + +Cybersecurity is no longer just the domain of the IT staff putting in firewalls and backing up servers. It takes a commitment from the top and a budget to match. The stakes are high when it comes to keeping your customers' information safe. + +The average cost of a data breach in 2018 was $148 for each compromised record. That equals an average cost of [$3.86 million per breach][2]. Because it takes organizations more than six months—196 days on average—to detect breaches, a lot of remediation must happen after discovery. + +With compliance regulations in most industries tightening and stricter security rules, such as the [General Data Protection Regulation][3] (GDPR) becoming law, breaches can lead to large fines as well as loss of reputation. + +To build a cybersecurity solution from the top down, you need to build a solid foundation. This foundation should be viewed not as a technology problem but as a governance issue. Tech solutions will play a role, but it takes more than that—it starts with building a culture of safety. + +### Build a cybersecurity culture + +"A chain is no stronger than its weakest link," Thomas Reid wrote back in 1786. The message still applies when it comes to cybersecurity today. Your systems are only as secure as your least safety-conscious team member. One lapse, by one person, can compromise your data. + +It's important to build a culture where all team members understand the importance of cybersecurity. Security is not just the IT department's job. It is everyone's responsibility. + +Training is a continuous responsibility. When new team members are on-boarded, they need to be trained in security best practices. When team members leave, their access must be restricted immediately. As team members get comfortable in their positions, there should be [strong policies, procedures, and training][4] to keep them safety conscious. + +### Maintain secure systems + +Corporate policies and procedures will establish a secure baseline for your systems. It's important to maintain strict adherence as systems expand or evolve. Secure network design must match these policies. + +A secure system will be able to filter all incoming traffic at the network perimeter. Only traffic required to support your organization should be allowed to get through this perimeter. Unfortunately, threats sometimes still get in. + +Zero-day attacks are increasing in number, and more threat actors are exploiting known defects in software. In 2018, more than [three-quarters of successful endpoint attacks exploited zero-day flaws][5]. While it's difficult to guard against unknown threats, you can minimize your exposure by strictly applying updates and patches immediately when they're released. + +### Manage user privileges + +By limiting each individual user's access and privileges, companies can utilize micro-segmenting to minimize potential damage done by a possible attack. If an attack does get through your secure perimeter, this will limit the number of areas the attacker has access to. + +User access should be limited to only the privileges they need to do their jobs, especially when it comes to sensitive data. Most breaches start with email phishing. Unsuspecting employees click on a malicious link or are tricked into giving up their login credentials. The less access employees have, the less damage a hacker can do. + +Identity and access management (IAM) systems can deploy single sign-on (SSO) to reduce the number of passwords users need to access systems by using an authentication token accepted by different apps. Multi-factor authentication practices combined with reducing privileges can lower risk to the entire system. + +### Implement continuous monitoring + +Your security needs [continuous monitoring across your enterprise][6] to detect and prevent intrusion. This includes servers, networks, Software-as-a-Service (SaaS), cloud services, mobile users, third-party applications, and much more. In reality, it is imperative that every entry point and connection are continuously monitored. + +Your employees are working around the clock, especially if you are a global enterprise. They are working from home and working on the road. This means multiple devices, internet accesses, and servers, all of which need to be monitored. + +Likewise, hackers are working continuously to find any flaw in your system that could lead to a possible cyberattack. Don't wait for your next IT audit to worry about finding the flaws; this should be a continual process and high priority. + +### Conduct regular risk assessments + +Even with continuous monitoring, chief information security officers (CISOs) and IT managers should regularly conduct risk assessments. New devices, hardware, third-party apps, and cloud services are being added all the time. It's easy to forget how all these individual pieces, added one at a time, all fit into the big picture. + +The regularly scheduled, formal risk assessment should take an exhaustive look at infrastructure and access points. It should include penetration testing to identify potential threats. + +Your risk assessment should also analyze backups and data-recovery planning in case a breach occurs. Don't just set up your security and hope it works. Have a plan for what you will do if access is breached, know who will be responsible for what, and establish an expected timeline to implement your plan. + +### Pay attention to remote teams and BYOD users + +More team members than ever work remotely. Whether they are working on the road, at a remote location, or from home, they pose a cybersecurity risk. They are connecting remotely, which can [leave channels open for intrusion or data interception][7]. + +Team members often mix company devices and personal devices almost seamlessly. The advent of BYOD (bring your own device) means company assets may also be vulnerable to apps and software installed on personal devices. While you can manage what's on company devices, when employees check their company email from their personal phone or connect to a company server from their personal laptop, you've increased your overall risk. + +Personal devices and remote connections should always utilize a virtual private network (VPN). A VPN uses encrypted connections to the internet that create a private tunnel that masks the user's IP address. As Douglas Crawford, resident security expert at ProPrivacy.com, [explains][8], "Until the Edward Snowden revelations, people assumed that 128-bit encryption was in practice uncrackable through brute force. They believed it would be so for around another 100 years (taking Moore's Law into account). In theory, this still holds true. However, the scale of resources that the NSA seems willing to throw at cracking encryption has shaken many experts' faith in these predictions. Consequently, system administrators the world over are scrambling to upgrade cipher key lengths." + +### A top-down cybersecurity strategy is essential + +When it comes to cybersecurity, a top-down strategy is essential to providing adequate protection. Building a culture of cybersecurity throughout the organization, maintaining secure systems, and continuous monitoring are essential to safeguarding your systems and your data. + +A top-down approach means your IT department is not solely focused on your company's tech stack while management is solely focused on the company mission and objectives. These are no longer siloed departments; they are interwoven and dependent on each other to ensure success. + +Ultimately, success is defined as keeping your customer information safe and secure. Continuous monitoring and protection of sensitive information are critical to the success of the entire company. With top management on board with funding cybersecurity adequately, IT can ensure optimum security practices. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/cybersecurity-practices + +作者:[Matt ShealyAnderson Silva][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/mshealyhttps://opensource.com/users/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/bexelbiehttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_orgchart2.png?itok=R_cnshU2 (Two different business organization charts) +[2]: https://securityintelligence.com/ponemon-cost-of-a-data-breach-2018/ +[3]: https://ec.europa.eu/info/law/law-topic/data-protection_en +[4]: https://us.norton.com/internetsecurity-how-to-cyber-security-best-practices-for-employees.html +[5]: https://www.ponemon.org/news-2/82 +[6]: https://digitalguardian.com/blog/what-continuous-security-monitoring +[7]: https://www.chamberofcommerce.com/business-advice/ransomeware-the-terrifying-threat-to-small-business +[8]: https://proprivacy.com/guides/the-ultimate-privacy-guide diff --git a/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md b/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md new file mode 100644 index 0000000000..f75089648b --- /dev/null +++ b/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Deep Learning Based Chatbots are Smarter) +[#]: via: (https://opensourceforu.com/2019/09/deep-learning-based-chatbots-are-smarter/) +[#]: author: (Dharmendra Patel https://opensourceforu.com/author/dharmendra-patel/) + +Deep Learning Based Chatbots are Smarter +====== + +[![][1]][2] + +_Contemporary chatbots extensively use machine learning, natural language processing, artificial intelligence and deep learning. They are typically used in the customer service space for almost all domains. Chatbots based on deep learning are far better than traditional variants. Here’s why._ + +Chatbots are currently being used extensively to change customer behaviour. Usually, traditional artificial intelligence (AI) concepts are used in designing chatbots. However, modern applications generate such vast volumes of data that it becomes arduous to process this with traditional AI algorithms. +Deep learning is a subset of AI and is the most suitable technique to process large quantities of data. Deep learning based systems learn from copious data points. Systems like chatbots are the right contenders for deep learning as they require abundant data points to train the system to reach precise levels of performance. The main purpose of chatbots is to offer the most appropriate reply to any question or message that it receives. The ideal response from a chatbot has multiple aspects to it, such as: + + * It should be able to chat in a pragmatic manner + * Respond to the caller’s query + * Provide the corresponding, relevant information + * Raise follow up questions like in a real conversation + + + +Deep learning simulates the human mind for processing information. It works like the human brain by categorising a variety of information, and automatically discovers the features to be used to classify this information in a way that is perfect for chatbot systems. + +![Figure 1: Steps for designing chatbots using deep learning][3] + +**Steps for designing chatbots using deep learning** +The goal while designing chatbots using deep learning is to entirely automate the system to lessen the need for human management as much as possible. To achieve this, we need to completely replace all human experts with a chatbot, eradicating the need for client service representatives entirely. Figure 1 depicts the steps for designing chatbots using deep learning. + +The first step when designing a chatbot is to collect the existing interactions between clients and service representatives, in order to teach the machine the phrases that are important while interacting with customers. This is called ontology creation. + +The data preparation or data preprocessing is the next step in designing the chatbot. This consists of several steps such as tokenisation, stemming and lemmatising. This phase integrates grammar into machine understanding. + +The third step involves deciding on the appropriate model of the chatbot. There are two prominent models — retrieval based and generative. Retrieval models apply the repository of predefined responses while generative models are advanced versions of the retrieval model that use deep learning concepts. + +The next step is to decide on the appropriate technique to handle client interactions efficiently. +Now you are ready to design and implement the chatbot. Use the appropriate programming language for the implementation. Once it is implemented successfully, test it to uncover any bugs or errors. + +**Deep learning based models for chatbots** +Generative models are based on deep learning. They are the smartest models for chatbots but are very complicated to build and operate. They give the best response for any query as they use semantic similarity, which identifies the terms that have common characteristics. + +The Recurrent Neural Network (RNN) encoder-decoder is the ultimate generative model for chatbots, and consists of two RNNs. As an input, the encoder takes a sentence and processes one word at a time. It translates the series of the words into a predetermined size feature vector. It takes only significant words and removes the unnecessary ones. The encoder consists of a number of hidden layers in which one layer influences the other. The final hidden layer acts as a summary layer for the entire sentence. +The decoder, on the other hand, generates another series, one word at a time. The decoder is influenced by the context and by previously generated words. + +Generally, this model is best suited to fixed length sequences; however, before applying the training to the model, padding concepts are used to convert variable length series into fixed length series. For example: + +``` +Query : [P P P P P P “What” “About” “Placement” “ ?” ] +// Assume that the fixed length is 10.P is Padding +Response : [ SD “ It” “is” “Almost” “100%” END P P P P ] +// SD means start decoding. END means response is over. P is Padding +``` + +Word embedding is another important aspect of deep learning based chatbots. It captures the context of the word in the sentence, the semantic and syntactic similarities, as well as the relationship with other words. Word2Vec is a famous method to construct word embedding. There are two main techniques in Word2Vec and both are based on neural networks — continuous bag-of-words (CBOW) and continuous skip-gram. + +The continuous bag-of-words method is generally used as a tool of feature generation. A sentence is first converted into a bag of words. After that, various measures are calculated to characterise the sentence. + +The frequency is the main measure of the CBOW. It provides better accuracy for frequent words. The skip-gram method achieves the reverse of the CBOW method. It tries to predict the source context words from the target. It works well for fewer training data sets. + +The logic for the chatbots that use deep learning is as follows: +_Step 1:_ Build the corpus vocabulary. +_Step 2:_ Map a unique numeric identifier with each word. +_Step 3:_ Padding is done to the context words to keep their size fixed. +_Step 4:_ Make a pair of target words and surround the context words. +_Step 5:_ Build the deep learning architecture for the CBOW model. This involves the following sequence: + + * Input as context words + * Initialised with random weights + * Arrange the word embeddings + * Create a dense softmax layer + * Predict target word + * Match with actual target word + * Compute the loss + * Perform back propagation to update embedding layer +_Step 6:_ Train the model. +_Step 7:_ Test the model. + + + +![Figure 2: Encoder layers][4] + +![Figure 3: Decoder functioning][5] + +**Deep learning tools for chatbots** +TensorFlow is a great tool that uses deep learning. It uses linear regression to achieve effective conversation. We first need to develop a TensorFlow model by using JSON to recognise patterns. The next step is loading this framework and contextualising the data. TensorFlow makes chatbots realistic and very effective. + +Microsoft conversational AI tools are another important resource to design effective chatbots. These tools can be used to design, link, install and accomplish intelligent bots. The Microsoft Bot Builder software development kit (SDK) is ideal for the quick, free and easy development of chatbots with intelligence. + +Pytorch is an excellent open source library based on Python for applications like chatbots. The Optim module implements various algorithms based on neural networks, which are essential for the designing of efficient chatbots. It also provides the power of Tensors and so has the same functionalities as TensorFlow. +Chatbots are essential if organisations aim to deal with customers without any human intervention. As discussed, deep learning based chatbots are the better option compared to the traditional variants, as the former handle abundant data efficiently. And generative models for building chatbots are more appropriate in the modern context. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/deep-learning-based-chatbots-are-smarter/ + +作者:[Dharmendra Patel][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://opensourceforu.com/author/dharmendra-patel/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-20-16-23-04.png?resize=696%2C472&ssl=1 (Screenshot from 2019-09-20 16-23-04) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-20-16-23-04.png?fit=706%2C479&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1DL.png?resize=350%2C248&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2DL.png?resize=350%2C72&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3DL.png?resize=350%2C67&ssl=1 diff --git a/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md b/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md new file mode 100644 index 0000000000..2340130aaa --- /dev/null +++ b/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Euler's Identity Really is a Miracle, Too) +[#]: via: (https://theartofmachinery.com/2019/09/20/euler_formula_miracle.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Euler's Identity Really is a Miracle, Too +====== + +[A post about the exponential function being a miracle][1] did the rounds recently, and [the Hacker News comment thread][2] brought up some debate about the miracle of Euler’s famous identity: + +[e^{\pi i} + 1 = 0] + +A while back I used to make a living teaching this stuff to high school students and university undergrads. Let me give my personal take on what’s so special about Euler’s identity. + +### Complex numbers are already a miracle + +Let’s start with complex numbers. + +The first introduction to complex numbers is usually something like, “We don’t know what (\sqrt{- 1}) is, so let’s try calling it (i).” As it turns out, it works. [It works unreasonably well.][3] To see what I mean, imagine we tried to do the same thing with (\frac{1}{0}). We’ll let’s just make up a value for it called, say, (v). Now consider this old teaser: + +[\begin{matrix} {x = 2} & {,y = 2} \ {\therefore x} & {= y} \ {\text{(multiply\ by\ y)}\therefore{xy}} & {= y^{2}} \ {\text{(subtract\ x\ squared)}\therefore{xy} - x^{2}} & {= y^{2} - x^{2}} \ {\text{(factorise)}\therefore x(y - x)} & {= (y + x)(y - x)} \ {\text{(divide\ common\ factor)}\therefore x} & {= y + x} \ {\text{(subtract\ x)}\therefore 0} & {= y} \ {\therefore 0} & {= 2} \ \end{matrix}] + +(If you’re not sure about the factorisation, try expanding it.) Obviously (0 \neq 2), so where does this “proof” go wrong? At the point it assumes dividing by the (y - x) factor obeys the normal rules of algebra — it doesn’t because (y - x = 0). We can’t just quietly add (v) to our number system and expect any of our existing maths to work with it. On the other hand, it turns out we _can_ (for example) write quadratic equations using (i) and treat them just like quadratic equations using real numbers (even solving them with the same old quadratic formula). + +It gets better. As anyone who’s studied complex numbers knows, after we take the plunge and say (\sqrt{- 1} = i), we don’t need to invent new numbers for, e.g., (\sqrt{i}) (it’s (\frac{\pm (1 + i)}{2})). In fact, instead of going “[turtles all the way down][4]” naming new numbers, we discover that complex numbers actually fill more gaps in the real number system. In many ways, complex numbers work better than real numbers. + +### (e^{\pi i}) isn’t just a made up thing + +I’ve met a few engineers who think that (e^{\pi i} = - 1) and its generalisation (e^{\theta i} = \cos\theta + i\sin\theta) are just notation made up by mathematicians for conveniently modelling things like rotations. I think that’s a shame because Euler’s formula is a lot more surprising than just notation. + +Let’s look at some ways to calculate (e^{x}) for real numbers. With a bit of calculus, you can figure out this Taylor series expansion around zero (also known as a Maclaurin series): + +[\begin{matrix} e^{x} & {= 1 + x + \frac{x^{2}}{2} + \frac{x^{3}}{2 \times 3} + \frac{x^{4}}{2 \times 3 \times 4} + \ldots} \ & {= \sum\limits_{n = 0}^{\infty}\frac{x^{n}}{n!}} \ \end{matrix}] + +A neat thing about this series is that it’s easy to compare with [the series for sin and cos][5]. If you assume they work just as well for complex numbers as real numbers, it only takes simple algebra to show (e^{\theta i} = \cos\theta + i\sin\theta), so it’s the classic textbook proof. + +Unfortunately, if you try evaluating the series on a computer, you hit numerical stability problems. Here’s another way to calculate (e^{x}): + +[e^{x} = \lim\limits_{n\rightarrow\infty}\left( 1 + \frac{x}{n} \right)^{n}] + +Or, translated naïvely into a stupid approximation algorithm in computer code [1][6]: + +``` +import std.algorithm; +import std.range; + +double approxExp(double x, int n) pure +{ + return (1 + x / n).repeat(n).reduce!"a * b"; +} +``` + +Try plugging some numbers into this function, and you’ll see it calculates approximate values for (e^{x}) (though you might need `n` in the thousands to get good results). + +Now for a little leap of faith: That function only uses addition, division and multiplication, which can all be defined and implemented for complex numbers without assuming Euler’s formula. So what if you replace `double` with [a complex number type][7], assume everything’s okay mathematically, and try plugging in some numbers like (3.141593i)? Try it for yourself. Somehow everything starts cancelling out as (n) gets bigger and (x) gets closer to (\pi i), and you get something closer and closer to (- 1 + 0i). + +### (e) and (\pi) are miracles, too + +Because mathematicians prefer to write these constants symbolically, it’s easy to forget what they really are. Imagine the real number line stretching from minus infinity to infinity. There’s one notch slightly below 3, and another notch just above 3, and for deeper reasons, these two notches are special and keep turning up in seemingly unrelated places in maths. + +For example, take the series sum (\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \ldots). It doesn’t converge, but the sum to (n) terms (called the Harmonic function, or (H(n))) approximates (\log_{e}n). If you square the terms, the series converges, but this time (\pi) appears instead of (e): (\frac{1}{1^{2}} + \frac{1}{2^{2}} + \frac{1}{3^{2}} + \ldots = \frac{\pi^{2}}{6}). + +Here’s some more context for why the ubiquity of (e) and (\pi) is special. “The ratio of a circle’s circumference to its diameter” and “the square root of 2” are both numbers that can’t be written down as exact decimals, but at least we can describe them well enough to _define_ them exactly. Imagine some immortal creature tried listing all the numbers that can be mathematically defined. The list could start with all numbers that can be defined in under 10 characters, then all the numbers that can be defined in 10-20 characters, and so on. Obviously, that list never ends, but every definable number will appear on it somewhere, at some finite position. That’s what Georg Cantor called countably infinite, and he went on to prove ([using a simple diagonalisation argument][8]) that the set of real numbers is somehow infinitely bigger than that. That means most real numbers aren’t even definable. + +In other words, you could say maths with numbers is based on a sea of literally indescribable chaos. Thinking of it that way, it’s amazing that the five constants in Euler’s formula get us as far as they do. + +### Yes, the exponential function is a miracle + +I hinted that we can’t just assume that the Taylor series expansion for (e^{x}) works for complex numbers. Here are some examples that show what I mean. First, take the series expansion of (e^{- x^{2}}), the shape of the bell curve famous in statistics: + +[e^{- x^{2}} = 1 - x^{2} + \frac{x^{4}}{2} - \frac{x^{6}}{3!} + \frac{x^{8}}{4!} - \ldots] + +Of course, we can’t calculate the whole infinite sum, but we can approximate it by taking the first (n) terms. Here’s a plot of approximations taking successively more terms. We can see the bell shape after a few dozen terms, and the more terms we add, the better it gets: + +![][9] + +Okay, that’s a Taylor series doing what it’s supposed to. How about we try the same thing with another hump-shaped curve, (\frac{1}{1 + x^{2}})? + +![][10] + +This time it’s like there’s an invisible brick wall at (x = \pm 1). By adding more terms, we can get as close to perfect an approximation as we like, until (x) hits (\pm 1), then the approximation stops converging. The series just won’t work beyond that. But if Taylor expansion doesn’t always work for the whole real number line, can we take it for granted that the series for (e^{x}), (\sin x) and (\cos x) work for complex numbers? + +To get some more insight, we can colour in the places in the complex plane where the Taylor series for (\frac{1}{1 + x^{2}}) converges. It turns out we get a perfect circle of radius 1 centred at 0: + +![][11] + +There are two special points on the plane: (i) and (- i). At these points, (\frac{1}{1 + x^{2}}) turns into a (\frac{1}{0}) singularity, and the series expansion simply can’t work. It’s as if the convergence region expands out from 0 until it hits these singularity points and gets stuck. The funny thing is, these singularities in the complex plane limit how far the Taylor series can work, even when if we derive it using nothing but real analysis. + +It turns out that (e^{x}), (\sin x) and (\cos x) don’t have any problematic points in the complex plane, and that’s why we can easily use Taylor series to explore them beyond real numbers. + +This is yet another example of things making more sense when analysed with complex numbers, which only makes “real” numbers look like the odd ones out. Which raises another question: if [complex numbers are apparently fundamental to explaining the universe][12][2][13], why do we only experience real values? Obviously, the world would be a very different place if we could eat (i) slices of pizza, or if the flow of time had real and imaginary parts. But why the heck _not_? + +### Provably true things can still be surprising + +Of course, philosophy about the physical world aside, none of this is just luck. Maths is maths and there’s no alternative universe where things work differently. That’s because there are logical reasons why all this is true. + +But I don’t think that makes it less special. Arthur C. Clarke famously said that any sufficiently advanced technology is indistinguishable from magic, and I don’t think it should lose all magic as soon as someone, somewhere is smart enough to figure out how to make it work. Likewise, I don’t think mathematical theory becomes less special just because someone figures out a proof. On the contrary, it’s thanks to people wondering about these miraculous patterns that we have the calculus and complex analysis needed to understand how it all works. + + 1. A less-stupid version uses squaring instead of naïve exponentiation: `return (1 + z / (1< “A bridge is a network connection that combines multiple network adapters.” + +One excellent example for a bridge is combining the physical NIC with a virtual interface, like the one created and used for KVM virtualization. [Leif Madsen’s blog][13] has an excellent article on how to achieve this in the CLI. This can also be accomplished in Cockpit with just a few clicks. The example below will accomplish the first part of Leif’s blog using the web UI. We’ll bridge the enp9s0 interface with the virbr0 virtual interface. + +Click the **Add Bridge** button to launch the settings box. Provide a name and select the interfaces you would like to bridge. To enable **Spanning Tree Protocol (STP)**, click the box to the right of the label. Click the **Apply** button to finalize the configuration. + +As is consistent with teaming and bonding, selecting the bridge from the main screen will display the details of the interface. As seen in the example below, the physical device takes control and the virtual interface will adopt that device’s IP address. + +Select the individual interface in the bridge’s detail screen for more options. And once again, click the **Delete** button to remove the bridge. + +![][14] + +#### Adding VLANs + +Cockpit allows admins to create VLANs, or virtual networks, using any of the interfaces on the system. Click the **Add VLAN** button and select an interface. Furthermore, in the **Parent** drop-down list, assign the VLAN ID, and if you like, give it a new name. By default the name will be the same as the parent followed by a dot and the ID. For example, interface _enp11s0_ with VLAN ID _9_ will result in _enp11s0.9_). Click **Apply** to save the settings and to return to the networking main screen. Click the VLAN interface for further configuration. As always, click the **Delete** button to remove the VLAN. + +![][15] + +As we can see, Cockpit can help admins with common network configurations when managing the system’s connectivity. In the next article, we’ll explore how Cockpit handles user management and peek into the add-on 389 Directory Servers. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-network-interfaces-and-firewalld-in-cockpit/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-networking-816x345.jpg +[2]: https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-network-main-screen-1024x687.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-add-zone.gif +[5]: https://github.com/cockpit-project/cockpit/wiki/Feature:-Firewall +[6]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-add_remove-services.gif +[7]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interfaces-overview-1.gif +[8]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-bonding.gif +[9]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-comparison_of_network_teaming_to_bonding +[10]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/ch-configure_network_teaming +[11]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-teaming.gif +[12]: https://fedoramagazine.org/build-network-bridge-fedora +[13]: http://blog.leifmadsen.com/blog/2016/12/01/create-network-bridge-with-nmcli-for-libvirt/ +[14]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-bridging.gif +[15]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-vlans.gif diff --git a/sources/tech/20190921 Top Open Source Video Players for Linux.md b/sources/tech/20190921 Top Open Source Video Players for Linux.md new file mode 100644 index 0000000000..df23a92668 --- /dev/null +++ b/sources/tech/20190921 Top Open Source Video Players for Linux.md @@ -0,0 +1,295 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top Open Source Video Players for Linux) +[#]: via: (https://itsfoss.com/video-players-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top Open Source Video Players for Linux +====== + +_**Wondering which video player should you use on Linux? Here’s a list of top open source video players available for Linux distributions.**_ + +You can watch Hulu, Prime Video and/or [Netflix on Linux][1]. You can also [download videos from YouTube][2] and watch them later or if you are in a country where you cannot get Netflix and other streaming services, you may have to rely on torrent services like [Popcorn Time in Linux][3]. + +Watching movies/TV series or other video contents on computers is not an ‘ancient tradition’ yet. Usually, you go with the default video player that comes baked in with your Linux distribution (that could be anything). + +You won’t have an issue utilizing the default player – however, if you specifically want more open-source video player choices (or alternatives to the default one), you should keep reading. + +### Best Linux video players + +![][4] + +I have included the installation steps for Ubuntu but that shouldn’t make it the list of Ubuntu video players. These open source software should be available in any Linux distribution you are using. + +Installing the software + +Another note for Ubuntu users. You should have [universe repository enabled][5] in order to find and install these video players from the software center or by using command line. I have mentioned the commands but if you like, you can also install them from the Software Center. + +_Please keep in mind that the list is in no particular order of ranking._ + +#### 1\. VLC Media Player + +![][6] + +Key Highlights: + + * Built-in codecs + * Customization options + * Cross-platform + * Every video file format supported + * Extensions available for added functionalities + + + +[VLC Media Player][7] is unquestionably the most popular open source video player. Not just limited to Linux – but it’s a must-have video player for every platform (including Windows). + +It is a quite powerful video player capable of handling a variety of file formats and codecs. You can customize the look of it by using skins and enhance the functionalities with the help of certain extensions. Other features like [subtitle synchronization][8], audio/video filters, etc, exist as well. + +[VLC Media Player][7] + +#### How to install VLC? + +You can easily [install VLC in Ubuntu][9] from the Software Center or download it from the [official website][7]. + +If you’re utilizing the terminal, you will have to separately install the components as per your requirements by following the [official resource][10]. To install the player, just type in: + +``` +sudo apt install vlc +``` + +#### 2\. MPlayer + +![][11] + +Key Highlights: + + * Wide range of output drivers supported + * Major file formats supported + * Cross-platform + * Command-line based + + + +Yet another impressive open-source video player (technically, a video player engine). [MPlayer][12] may not offer you an intuitive user experience but it supports a wide range of output drivers and subtitle files. + +Unlike others, MPlayer does not offer a working GUI (it has one, but it doesn’t work as expected). So, you will have to utilize the terminal in order to play a video. Even though this isn’t a popular choice – it works and a couple of video players that I’ll be listing below are inspired (or based) from MPlayer but with a GUI. + +[MPlayer][12] + +#### How to install MPlayer? + +We already have an article on [installing MPlayer on Ubuntu and other Linux distros][13]. If you’re interested to install this, you should check it out. + +``` +sudo apt install mplayer mplayer-gui +``` + +#### 3\. SMPlayer + +![][14] + +Key Highlights: + + * Supports all major video formats + * Built-in codecs + * Cross-platform (Windows & Linux) + * Play ad-free YouTube video + * Opensubtitles integration + * UI Customization available + * Based on MPlayer + + + +As mentioned, SMPlayer uses MPlayer as the playback engine. So, it supports a wide range of file formats. In addition to all the basic features, it also lets you play YouTube videos from within the video player (by getting rid of the annoying ads). + +If you want to know about SMPlayer a bit more – we have a separate article here: [SMPlayer in Linux][15]. + +Similar to VLC, it also comes baked in with codecs, so you don’t have to worry about finding codecs and installing them to make it work unless there’s something specific you need. + +[SMPlayer][16] + +#### How to install SMPlayer? + +SMPlayer should be available in your Software Center. However, if you want to utilize the terminal, type in this: + +``` +sudo apt install smplayer +``` + +#### 4\. MPV Player + +![][17] + +Key Highlights: + + * Minimalist GUI + * Video codecs built in + * High-quality video output by video scaling + * Cross-platform + * YouTube Videos supported via CLI + + + +If you are looking for a video player with a streamlined/minimal UI, this is for you. Similar to the above-mentioned video players, we also have a separate article on [MPV Player][18] with installation instructions (if you’re interested to know more about it). + +Keeping that aside, it offers what you would expect from a standard video player. You can even try it on your Windows/Mac systems. + +[MPV Player][19] + +#### How to install MPV Player? + +You will find it listed in the Software Center or Package Manager. In either case, you can download the required package for your distro from the [official download page][20]. + +If you’re on Ubuntu, you can type in this in the terminal: + +``` +sudo apt install mpv +``` + +#### 5\. Dragon Player + +![][21] + +Key Highlights: + + * Simple UI + * Tailored for KDE + * Supports playing CDs and DVDs + + + +This has been specifically tailored for KDE desktop users. It is a dead-simple video player with all the basic features needed. You shouldn’t expect anything fancy out of it – but it does support the major file formats. + +[Dragon Player][22] + +#### How to install Dragon Player? + +You will find it listed in the official repo. In either case, you can type in the following command to install it via terminal: + +``` +sudo apt install dragonplayer +``` + +#### 6\. GNOME Videos + +![Totem Video Player][23] + +Key Highlights: + + * A simple video player for GNOME Desktop + * Plugins supported + * Ability to sort/access separate video channels + + + +The default video player for distros with GNOME desktop environment (previously known as Totem). It supports all the major file formats and also lets you take a snap while playing a video. Similar to some of the others, it is a very simple and useful video player. You can try it out if you want. + +[Gnome Videos][24] + +#### How to install Totem (GNOME Videos)? + +You can just type in “totem” to find the video player for GNOME listed in the software center. If not, you can also try utilizing the terminal with the following command: + +``` +sudo apt install totem +``` + +#### 7\. Deepin Movie + +![][25] + +If you are using [Deepin OS][26], you will find this as your default video player for Deepin Desktop Environment. It features all the basic functionalities that you would normally look in a video player. You can try compiling the source to install it if you aren’t using Deepin. + +[Deepin Movie][27] + +#### How to Install Deepin? + +You can find it in the Software Center. If you’d want to compile, the source code is available at [GitHub][28]. In either case, type in the following command in the terminal: + +``` +sudo apt install deepin-movie +``` + +#### 8\. Xine Multimedia Engine + +![][29] + +Key Higlights: + + * Customization available + * Subtitles supported + * Major file formats supported + * Streaming playback support + + + +Xine is an interesting portable media player. You can either choose to utilize the GUI or call the xine library from other applications to make use of the features available. + +It supports a wide range of file formats. You can customize the skin of the GUI. It supports all kinds of subtitles (even from the DVDs). In addition to this, you can take a snapshot while playing the video, which comes handy. + +[Xine Multimedia][30] + +#### How to install Xine Multimedia? + +You probably won’t find this in your Software Center. So, you can try typing this in your terminal to get it installed: + +``` +sudo apt install xine-ui +``` + +In addition to that, you can also check for available binary packages on their [official website][31]. + +**Wrapping Up** + +We would recommend you to try out these open source video players over anything else. In addition to all these, you can also try [Miro Player][32] which is no more being actively maintained but works – so you can give it a try, if nothing else works for you. + +However, if you think we missed one of your favorite Linux video player that deserves a mentioned, let us know about it in the comments down below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/video-players-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[2]: https://itsfoss.com/download-youtube-linux/ +[3]: https://itsfoss.com/popcorn-time-ubuntu-linux/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/Video-Players-for-Linux.png?ssl=1 +[5]: https://itsfoss.com/ubuntu-repositories/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/vlc-media-player.jpg?ssl=1 +[7]: https://www.videolan.org/vlc/ +[8]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ +[9]: https://itsfoss.com/install-latest-vlc/ +[10]: https://wiki.videolan.org/Debian/#Debian +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2015/10/mplayer-video.jpg?ssl=1 +[12]: http://www.mplayerhq.hu/design7/news.html +[13]: https://itsfoss.com/mplayer/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-coco.jpg?ssl=1 +[15]: https://itsfoss.com/smplayer/ +[16]: https://www.smplayer.info/en/info +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/08/mpv-player-interface.png?ssl=1 +[18]: https://itsfoss.com/mpv-video-player/ +[19]: https://mpv.io/ +[20]: https://mpv.io/installation/ +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/dragon-player.jpg?ssl=1 +[22]: https://kde.org/applications/multimedia/org.kde.dragonplayer +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/totem-video-player.png?ssl=1 +[24]: https://wiki.gnome.org/Apps/Videos +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/deepin-movie.jpg?ssl=1 +[26]: https://www.deepin.org/en/ +[27]: https://www.deepin.org/en/original/deepin-movie/ +[28]: https://github.com/linuxdeepin/deepin-movie-reborn +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/xine-multilmedia.jpg?ssl=1 +[30]: https://www.xine-project.org/home +[31]: https://www.xine-project.org/releases +[32]: http://www.getmiro.com/ diff --git a/sources/tech/20190924 A human approach to reskilling in the age of AI.md b/sources/tech/20190924 A human approach to reskilling in the age of AI.md new file mode 100644 index 0000000000..8eaeb099f1 --- /dev/null +++ b/sources/tech/20190924 A human approach to reskilling in the age of AI.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A human approach to reskilling in the age of AI) +[#]: via: (https://opensource.com/open-organization/19/9/claiming-human-age-of-AI) +[#]: author: (Jen Kelchner https://opensource.com/users/jenkelchnerhttps://opensource.com/users/jenkelchner) + +A human approach to reskilling in the age of AI +====== +Investing in learning agility and core capabilities is as important for +the individual worker as it is for the decision-making executive. +Thinking openly can get us there. +![Person on top of a mountain, arm raise][1] + +[The age of AI is upon us][2]. Emerging technologies give humans some relief from routine tasks and allow us to get back to the creative, adaptable creatures many of us prefer being. + +So a shift to developing _human_ skills in the workplace should be a critical focus for organizations. In this part of my series on learning agility, we'll take a look at some reasons for a sense of urgency over reskilling our workforce and reconnecting to our humanness. + +### The clock is ticking + +If you don't believe AI conversations affect you, then I suggest reviewing this 2018 McKinsey Report on [reskilling in the age of automation][3], which provides some interesting statistics. Here are a few applicable nuggets: + + * 62% of executives believe they need to **retrain or replace more than a quarter** of their workforce **by 2023** due to advancing digitization + * The **US and Europe face a larger threat** on reskilling than the rest of the world + * 70% of execs in companies with more than $500 million in annual revenue state this **will affect more than 25%** of their employees + + + +No matter where you fall on an organizational chart, automation (and digitalization more generally) is an important topic for you—because the need for reskilling that it introduces will most likely affect you. + +But what does this reskilling conversation have to do with core capability development? + +To answer _that_ question, let's take a look at a few statistics curated in a [2019 LinkedIn Global Talent Report][4]. + +When surveyed on the topic of ~~soft skills~~ core human capabilities, global companies had this to say: + + * **92%** agree that they matter as much or more than "hard skills" + * **80%** said these skills are increasingly important to company success + * Only **41%** have a formal process to identify these skills + + + +Before panicking at the thought of what these stats could mean to you or your company, let's actually dig into these core capabilities that you already have but may need to brush up on and strengthen. + +### Core human capabilities + +_What the heck does all this have to do with learning agility_, you may be asking, _and why should I care_? + +What many call "soft skills" are really human skills—core capabilities anyone can cultivate. + +I recommend catching up with this introduction to [learning agility][5]. There, I define learning agility as "the capacity for adapting to situations and applying knowledge from prior experience—even when you don't know what to do [...], a willingness to learn from all your experiences and then apply that knowledge to tackle new challenges in new situations." In that piece, we also discussed reasons why characteristics associated with learning agility are among the most sought after skills on the planet today. + +Too often, [these skills go by the name "soft skills."][6] Explanations usually go something like this: "hard skills" are more like engineering- or science-based skills and, well, "non-peopley" related things. But what many call "soft skills" are really _human skills_—core capabilities anyone can cultivate. As leaders, we need to continue to change the narrative concerning these core capabilities (for many reasons, not least of which is the fact that the distinction frequently re-entrenches a [gender bias][7], as if skills somehow fit on a spectrum from "soft to hard.") + +For two decades, I've heard decision makers choose not to invest in people or leadership development because "there isn't money in soft skills" and "there's no way to track the ROI" on developing them. Fortunately, we're moving out of this tragic mindset, as leaders recognize how digital transformation has reshaped how we connect, build community, and organize for work. Perhaps this has something to do with increasingly pervasive reports (and blowups) we see across ecosystems regarding [toxic work culture][8] or broken leadership styles. Top consulting firms doing [global talent surveys][9] continue to identify crucial breakdowns in talent development pointing right back to our topic at hand. + +For two decades, I've heard decision makers choose not to invest in people or leadership development because "there isn't money in soft skills" and "there's no way to track the ROI" on developing them. Fortunately, we're moving out of this tragic mindset. + +We all have access to these capabilities, but often we've lacked examples to learn by or have had little training on how to put them to work. Let's look at the list of the most-needed human skills right now, shall we? + +Topping the leaderboard moving into 2020: + + * Communication + * Relationship building + * Emotional intelligence (EQ) + * Critical thinking and problem-solving (CQ) + * [Learning agility][5] and adaptability quotient (AQ) + * Creativity + + + +If we were to take the items on this list and generalize them into three categories of importance for the future of work, it would look like: + + 1. Emotional Quotient + 2. Adaptability Quotient + 3. Creativity Quotient + + + +Some of us have been conditioned to think we're "not creative" because the term "creativity" refers only to things like art, design, or music. However, in this case, "creativity" means the ability to combine ideas, things, techniques, or approaches in new ways—and it's [crucial to innovation][10]. Solving problems in new ways is the [most important skill][11] companies look for when trying to solve their skill-gap problems. (_Spoiler alert: This is learning agility!_) Obviously, our generalized list ignores many nuances (not to mention additional skills we might develop in our people and organizations as contexts shift); however, this is a really great place to start. + +### Where do we go from here? + +In order to accommodate the demands of tomorrow's organizations, we must: + + * look at retraining and reskilling from early education models to organizational talent development programs, and + * adjust our organizational culture and internal frameworks to support being human and innovative. + + + +This means exploring [open principles][12], agile methodologies, collaborative work models, and continuous states of learning across all aspects of your organization. Digital transformation and reskilling on core capabilities leaves no one—and _no department_—behind. + +In our next installment, we'll begin digging into these core capabilities and examine the five dimensions of learning agility with simple ways to apply them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/9/claiming-human-age-of-AI + +作者:[Jen Kelchner][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/jenkelchnerhttps://opensource.com/users/jenkelchner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/developer_mountain_cloud_top_strong_win.jpg?itok=axK3EX-q (Person on top of a mountain, arm raise) +[2]: https://appinventiv.com/blog/ai-technology-trends/ +[3]: https://www.mckinsey.com/featured-insights/future-of-work/retraining-and-reskilling-workers-in-the-age-of-automation +[4]: https://app.box.com/s/c5scskbsz9q6lb0hqb7euqeb4fr8m0bl/file/388525098383 +[5]: https://opensource.com/open-organization/19/8/introduction-learning-agility +[6]: https://enterprisersproject.com/article/2019/9/6-soft-skills-for-ai-age +[7]: https://enterprisersproject.com/article/2019/8/why-soft-skills-core-to-IT +[8]: https://ldr21.com/how-ubers-workplace-crisis-can-save-your-organization-money/ +[9]: https://www.inc.com/scott-mautz/new-deloitte-study-of-10455-millennials-says-employers-are-failing-to-help-young-people-develop-4-crucial-skills.html +[10]: https://velites.nl/en/2018/11/12/creative-quotient/ +[11]: https://learning.linkedin.com/blog/top-skills/why-creativity-is-the-most-important-skill-in-the-world +[12]: https://opensource.com/open-organization/resources/open-org-definition diff --git a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md new file mode 100644 index 0000000000..16b4780710 --- /dev/null +++ b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An advanced look at Python interfaces using zope.interface) +[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package) +[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg) + +An advanced look at Python interfaces using zope.interface +====== +Zope.interface helps declare what interfaces exist, which objects +provide them, and how to query for that information. +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +The **zope.interface** library is a way to overcome ambiguity in Python interface design. Let's take a look at it. + +### Implicit interfaces are not zen + +The [Zen of Python][2] is loose enough and contradicts itself enough that you can prove anything from it. Let's meditate upon one of its most famous principles: "Explicit is better than implicit." + +One thing that traditionally has been implicit in Python is the expected interface. Functions have been documented to expect a "file-like object" or a "sequence." But what is a file-like object? Does it support **.writelines**? What about **.seek**? What is a "sequence"? Does it support step-slicing, such as **a[1:10:2]**? + +Originally, Python's answer was the so-called "duck-typing," taken from the phrase "if it walks like a duck and quacks like a duck, it's probably a duck." In other words, "try it and see," which is possibly the most implicit you could possibly get. + +In order to make those things explicit, you need a way to express expected interfaces. One of the first big systems written in Python was the [Zope][3] web framework, and it needed those things desperately to make it obvious what rendering code, for example, expected from a "user-like object." + +Enter **zope.interface**, which is developed by Zope but published as a separate Python package. **Zope.interface** helps declare what interfaces exist, which objects provide them, and how to query for that information. + +Imagine writing a simple 2D game that needs various things to support a "sprite" interface; e.g., indicate a bounding box, but also indicate when the object intersects with a box. Unlike some other languages, in Python, attribute access as part of the public interface is a common practice, instead of implementing getters and setters. The bounding box should be an attribute, not a method. + +A method that renders the list of sprites might look like: + + +``` +def render_sprites(render_surface, sprites): +    """ +    sprites should be a list of objects complying with the Sprite interface: +    * An attribute "bounding_box", containing the bounding box. +    * A method called "intersects", that accepts a box and returns +      True or False +    """ +    pass # some code that would actually render +``` + +The game will have many functions that deal with sprites. In each of them, you would have to specify the expected contract in a docstring. + +Additionally, some functions might expect a more sophisticated sprite object, maybe one that has a Z-order. We would have to keep track of which methods expect a Sprite object, and which expect a SpriteWithZ object. + +Wouldn't it be nice to be able to make what a sprite is explicit and obvious so that methods could declare "I need a sprite" and have that interface strictly defined? Enter **zope.interface**. + + +``` +from zope import interface + +class ISprite(interface.Interface): + +    bounding_box = interface.Attribute( +        "The bounding box" +    ) + +    def intersects(box): +        "Does this intersect with a box" +``` + +This code looks a bit strange at first glance. The methods do not include a **self**, which is a common practice, and it has an **Attribute** thing. This is the way to declare interfaces in **zope.interface**. It looks strange because most people are not used to strictly declaring interfaces. + +The reason for this practice is that the interface shows how the method will be called, not how it is defined. Because interfaces are not superclasses, they can be used to declare data attributes. + +One possible implementation of the interface can be with a circular sprite: + + +``` +@implementer(ISprite) +@attr.s(auto_attribs=True) +class CircleSprite: +    x: float +    y: float +    radius: float + +    @property +    def bounding_box(self): +        return ( +            self.x - self.radius, +            self.y - self.radius, +            self.x + self.radius, +            self.y + self.radius, +        ) + +    def intersects(self, box): +        # A box intersects a circle if and only if +        # at least one corner is inside the circle. +        top_left, bottom_right = box[:2], box[2:] +        for choose_x_from (top_left, bottom_right): +            for choose_y_from (top_left, bottom_right): +                x = choose_x_from[0] +                y = choose_y_from[1] +                if (((x - self.x) ** 2 + (y - self.y) ** 2) <= +                    self.radius ** 2): +                     return True +        return False +``` + +This _explicitly_ declares that the **CircleSprite** class implements the interface. It even enables us to verify that the class implements it properly: + + +``` +from zope.interface import verify + +def test_implementation(): +    sprite = CircleSprite(x=0, y=0, radius=1) +    verify.verifyObject(ISprite, sprite) +``` + +This is something that can be run by **pytest**, **nose**, or another test runner, and it will verify that the sprite created complies with the interface. The test is often partial: it will not test anything only mentioned in the documentation, and it will not even test that the methods can be called without exceptions! However, it does check that the right methods and attributes exist. This is a nice addition to the unit test suite and—at a minimum—prevents simple misspellings from passing the tests. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/zopeinterface-python-package + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg +[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://en.wikipedia.org/wiki/Zen_of_Python +[3]: http://zope.org diff --git a/sources/tech/20190924 CodeReady Containers- complex solutions on OpenShift - Fedora.md b/sources/tech/20190924 CodeReady Containers- complex solutions on OpenShift - Fedora.md new file mode 100644 index 0000000000..f3522e9717 --- /dev/null +++ b/sources/tech/20190924 CodeReady Containers- complex solutions on OpenShift - Fedora.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (CodeReady Containers: complex solutions on OpenShift + Fedora) +[#]: via: (https://fedoramagazine.org/codeready-containers-complex-solutions-on-openshift-fedora/) +[#]: author: (Marc Chisinevski https://fedoramagazine.org/author/mchisine/) + +CodeReady Containers: complex solutions on OpenShift + Fedora +====== + +![][1] + +Want to experiment with (complex) solutions on [OpenShift][2] 4.1+? CodeReady Containers (CRC) on a physical Fedora server is a great choice. It lets you: + + * Configure the RAM available to CRC / OpenShift (this is key as we’ll deploy Machine Learning, Change Data Capture, Process Automation and other solutions with significant memory requirements) + * Avoid installing anything on your laptop + * Standardize (on Fedora 30) so that you get the same results every time + + + +Start by installing CRC and Ansible Agnostic Deployer (AgnosticD) on a Fedora 30 physical server. Then, you’ll use AgnosticD to deploy Open Data Hub on the OpenShift 4.1 environment created by CRC. Let’s get started! + +### Set up CodeReady Containers + +``` +$ dnf config-manager --set-enabled fedora +$ su -c 'dnf -y install git wget tar qemu-kvm libvirt NetworkManager jq libselinux-python' +$ sudo systemctl enable --now libvirtd +``` + +Let’s also add a user. + +``` +$ sudo adduser demouser +$ sudo passwd demouser +$ sudo usermod -aG wheel demouser +``` + +Download and extract CodeReady Containers: + +``` +$ su demouser +$ cd /home/demouser +$ wget https://mirror.openshift.com/pub/openshift-v4/clients/crc/1.0.0-beta.3/crc-linux-amd64.tar.xz +$ tar -xvf crc-linux-amd64.tar.xz +$ cd crc-linux-1.0.0-beta.3-amd64/ +$ sudo cp ./crc /usr/bin +``` + +Set the memory available to CRC according to what you have on your physical server. For example, on a physical server with around 100GB you can allocate 80G to CRC as follows: + +``` +$ crc config set memory 81920 +$ crc setup +``` + +You’ll need your pull secret from . + +``` +$ crc start +``` + +That’s it — you can now login to your OpenShift environment: + +``` +eval $(crc oc-env) && oc login -u kubeadmin -p https://api.crc.testing:6443 +``` + +### Set up Ansible Agnostic Deployer + +[github.com/redhat-cop/agnosticd][3] is a fully automated two-phase deployer. Let’s deploy it! + +``` +$ su demouser +$ cd /home/demouser +$ git clone https://github.com/redhat-cop/agnosticd.git +$ cd agnosticd/ansible +$ python -m pip install --upgrade --trusted-host files.pythonhosted.org -r requirements.txt +$ python3 -m pip install --upgrade --trusted-host files.pythonhosted.org -r requirements.txt +$ pip3 install kubernetes +$ pip3 install openshift +$ pip install kubernetes +$ pip install openshift +``` + +### Set up Open Data Hub on Code Ready Containers + +[Open Data Hub][4] is a machine-learning-as-a-service platform built on OpenShift and Kafka/Strimzi. It integrates a collection of open source projects. + +First, create an Ansible inventory file with the following content. + +``` +$ cat inventory +$ 127.0.0.1 ansible_connection=local +``` + +Set up the WORKLOAD environment variable so that Ansible Agnostic Deployer knows that we want to deploy Open Data Hub. + +``` +$ export WORKLOAD="ocp4-workload-open-data-hub" +$ sudo cp /usr/local/bin/ansible-playbook /usr/bin/ansible-playbook +``` + +We are only deploying one Open Data Hub project, so set _user_count_ to 1. You can set up workshops for many students by setting _user_count_. + +An OpenShift project (with Open Data Hub in our case) will be created for each student. + +``` +$ eval $(crc oc-env) && oc login -u kubeadmin -p https://api.crc.testing:6443 +$ ansible-playbook -i inventory ./configs/ocp-workloads/ocp-workload.yml -e"ocp_workload=${WORKLOAD}" -e"ACTION=create" -e"user_count=1" -e"ocp_username=kubeadmin" -e"ansible_become_pass=" -e"silent=False" +$ oc project open-data-hub-user1 +$ oc get route +NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD +jupyterhub jupyterhub-open-data-hub-user1.apps-crc.testing jupyterhub 8080-tcp edge/Redirect None +``` + +On your laptop, add _jupyterhub-open-data-hub-user1.apps-crc.testing_ to your _/etc/hosts_ file. For example: + +``` +127.0.0.1 localhost fedora30 console-openshift-console.apps-crc.testing oauth-openshift.apps-crc.testing mapit-app-management.apps-crc.testing mapit-spring-pipeline-demo.apps-crc.testing jupyterhub-open-data-hub-user1.apps-crc.testing jupyterhub-open-data-hub-user1.apps-crc.testing +``` + +On your laptop: + +``` +$ sudo ssh marc@fedora30 -L 443:jupyterhub-open-data-hub-user1.apps-crc.testing:443 +``` + +You can now browse to [https://jupyterhub-open-data-hub-user1.apps-crc.testing][5]. + +Now that we have Open Data Hub ready, you could deploy something interesting on it. For example, you could deploy IBM’s Qiskit open source framework for quantum computing. For more information, refer to Video no. 9 at [this YouTube playlist][6], and the [Github repo here][7]. + +You could also deploy plenty of other useful tools for Process Automation, Change Data Capture, Camel Integration, and 3scale API Management. You don’t have to wait for articles on these, though. Step-by-step short videos are already [available on YouTube][6]. + +The corresponding step-by-step instructions are [also on YouTube][6]. You can also follow along with this article using the [GitHub repo][8]. + +* * * + +_Photo by _[_Marta Markes_][9]_ on _[_Unsplash_][10]_._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/codeready-containers-complex-solutions-on-openshift-fedora/ + +作者:[Marc Chisinevski][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/mchisine/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/codeready-containers-816x345.jpg +[2]: https://fedoramagazine.org/run-openshift-locally-minishift/ +[3]: https://github.com/redhat-cop/agnosticd +[4]: https://opendatahub.io/ +[5]: https://jupyterhub-open-data-hub-user1.apps-crc.testing/ +[6]: https://www.youtube.com/playlist?list=PLg1pvyPzFye2UtQjZTSjoXhFdqkGK6exw +[7]: https://github.com/marcredhat/crcdemos/blob/master/IBMQuantum-qiskit +[8]: https://github.com/marcredhat/crcdemos/tree/master/fedora +[9]: https://unsplash.com/@vnevremeni?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[10]: https://unsplash.com/s/photos/container?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20190924 Integrate online documents editors, into a Python web app using ONLYOFFICE.md b/sources/tech/20190924 Integrate online documents editors, into a Python web app using ONLYOFFICE.md new file mode 100644 index 0000000000..35c101ed2c --- /dev/null +++ b/sources/tech/20190924 Integrate online documents editors, into a Python web app using ONLYOFFICE.md @@ -0,0 +1,381 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Integrate online documents editors, into a Python web app using ONLYOFFICE) +[#]: via: (https://opensourceforu.com/2019/09/integrate-online-documents-editors-into-a-python-web-app-using-onlyoffice/) +[#]: author: (Aashima Sharma https://opensourceforu.com/author/aashima-sharma/) + +Integrate online documents editors, into a Python web app using ONLYOFFICE +====== + +[![][1]][2] + +_[ONLYOFFICE][3] is an open-source collaborative office suite distributed under the terms of GNU AGPL v.3 license. It contains three editors for text documents, spreadsheets, and presentations and features the following:_ + + * Viewing, editing and co-editing docx, .xlsx, pptx files. OOXML as a core format ensures high compatibility with Microsoft Word, Excel and PowerPoint files. + * Editing other popular formats (.odt, .rtf, .txt, .html, .ods., .csv, .odp) with inner conversion to OOXML. + * Familiar tabbed interface. + * Collaboration tools: two co-editing modes (fast and strict), track changes, comments and integrated chat. + * Flexible access rights management: full access, read only, review, form filling and comment. + * Building your own add-ons using the API. + * 250 languages available and hieroglyphic alphabets. + + + +API allowing the developers integrate ONLYOFFICE editors into their own web sites and apps written in any programming language and setup and manage the editors. + +To integrate ONLYOFFICE editors, we will need an integration app connecting the editors (ONLYOFFICE Document Server) and your service. To use editors within your interface, it should grant to ONLYOFFICE the following permissions : + + * Adding and executing custom code. + * Anonymous access for downloading and saving files. It means that the editors only communicate with your service on the server side without involving any user authorization data from the client side (browser cookies). + * Adding new buttons to UI (for example, “Open in ONLYOFFICE”, “Edit in ONLYOFFICE”). + * Оpening a new page where ONLYOFFICE can execute the script to add an editor. + * Ability to specify Document Server connection settings. + + + +There are several cases of successful integration with popular collaboration solutions such as Nextcloud, ownCloud, Alfresco, Confluence and SharePoint, via official ready-to-use connectors offered by ONLYOFFICE. + +One of the most actual integration cases is the integration of ONLYOFFICE editors with its open-source collaboration platform written in C#. This platform features document and project management, CRM, email aggregator, calendar, user database, blogs, forums, polls, wiki, and instant messenger. + +Integrating online editors with CRM and Projects modules, you can: + + * Attach documents to CRM opportunities and cases, or to project tasks and discussions, or even create a separate folder with documents, spreadsheets, and presentations related to the project. + * Create new docs, sheets, and presentations right in CRM or in the Project module. + * Open and edit attached documents, or download and delete them. + * Import contacts to your CRM in bulk from a CSV file as well as export the customer database as a CSV file. + + + +In the Mail module, you can attach files stored in the Documents module or insert a link to the needed document into the message body. When ONLYOFFICE users receive a message with an attached document, they are able to: download the attachment, view the file in the browser, open the file for editing or save it to the Documents module. As mentioned above, if the format differs from OOXML, the file will be automatically converted to .docx/.xlsx/.pptx and its copy will be saved in the original format as well. + +In this article, you will see the integration process of ONLYOFFICE into the Document Management System written in Python, one of the most popular programming languages. The following steps will show you how to create all the necessary elements to make possible work and collaboration on documents within DMS interface: viewing, editing, co-editing, saving files and users access management and may serve as an example of integration into your Python app. + +**1\. What you will need** + +Let’s start off by creating key components of the integration process: [_ONLYOFFICE Document Server_][4] and DMS written in Python. + +1.1 To install ONLYOFFICE Document Server you can choose from multiple installation options: compile the source code available on GitHub, use .deb or .rpm packages or the Docker image. +We recommend installing Document Server and all the necessary dependencies with only one command using the Docker image. Please note, that choosing this method, you need the latest Docker version installed. + +``` +docker run -itd -p 80:80 onlyoffice/documentserver-de +``` + +1.2 We need to develop DMS in Python. If you have one already, please, check if it meets the following conditions: + + * Has a list of files you need to open for viewing/editing + * Allows downloading files + + + +For the app, we will use a Bottle framework. We will install it in the working directory using the following command: + +``` +pip install bottle +``` + +Then we create the app’s code * main.py*  and the template _index.tpl_ . +We add the following code into this * main.py*  file: + +``` +from bottle import route, run, template, get, static_file # connecting the framework and the necessary components +@route('/') # setting up routing for requests for / +def index(): +return template('index.tpl') # showing template in response to request +run(host="localhost", port=8080) # running the application on port 8080 +``` + +Once we run the app, an empty page will be rendered on . + +In order, the Document Server to be able to create new docs, add default files and form a list of their names in the template, we should create a folder  _files_ , and put 3 files (.docx, .xlsx and .pptx) in there. + +To read these files’ names, we use the _listdir_ component. + +``` +from os import listdir +``` + +Now let’s create a variable for all the file names from the files folder: + +``` +sample_files = [f for f in listdir('files')] +``` + +To use this variable in the template, we need to pass it through the _template_ method: + +``` +def index(): +return template('index.tpl', sample_files=sample_files) + +Here’s this variable in the template: +%for file in sample_files: +
      +{{file}} +
      +% end +``` + +We restart the application to see the list of filenames on the page. +Here’s the method to make these files available for all the app users: + +``` +@get("/files/") +def show_sample_files(filepath): +return static_file(filepath, root="files") +``` + +**2\. How to view docs in ONLYOFFICE within the Python App** +Once all the components are ready, let’s add functions to make editors operational within the app interface. + +The first option enables users to open and view docs. Connect document editors API in the template: + +``` + +``` + +_editor_url_  is a link to document editors. + +A button to open each file for viewing: + +``` + +``` + +Now we need to add a div with  _id_ , in which the document editor will be opened: + +``` +
      +``` + +To open the editor, we have to call a function: + +``` + +``` + +There are two arguments for the DocEditor function: id of the element where the editors will be opened and a JSON with the editors’ settings. +In this example, the following mandatory parameters are used: + + * _documentType_ is identified by its format (.docx, .xlsx, .pptx for texts, spreadsheets and presentations accordingly) + * _document.url_ is the link to the file you are going to open. + * _editorConfig.mode_. + + + +We can also add _title_ that will be displayed in the editors. + +So, now we have everything to view docs in our Python app. + +**3\. How to edit docs in ONLYOFFICE within the Python App** +First of all, add the “Edit” button: + +``` + +``` + +Then create a new function that will open files for editing. It is similar to the View function. +Now we have 3 functions: + +``` + +``` + +_destroyEditor_  is called to close an open editor. +As you might notice, the _editorConfig_ parameter is absent from the _edit()_ function, because it has by default the value * {“mode”: “edit”}.* + +Now we have everything to open docs for co-editing in your Python app. + +**4\. How to co-edit docs in ONLYOFFICE within the Python App** +Co-editing is implemented by using the same document.key for the same document in the editors’ settings. Without this key, the editors will create the editing session each time you open the file. + +Set unique keys for each doc to make users connect to the same editing session for co-editing. The format of the key should be the following:  _filename + “_key”_. The next step is to add it to all of the configs where document is present. + +``` +document: { +url: "host_url" + '/' + filepath, +title: filename, +key: filename + '_key' +}, +``` + +**5\. How to save docs in ONLYOFFICE within the Python App** +Every time we change and save the file, ONLYOFFICE stores all its versions. Let’s see closely how it works. After we close the editor, Document Server builds the file version to be saved and sends the request to callbackUrl address. This request contains document.key and the link to the just built file. +document.key is used to find the old version of the file and replace it with the new one. As we do not have any database here, we just send the filename using callbackUrl. +Specify _callbackUrl_ parameter in the setting in _editorConfig.callbackUrl_ and add it to the _edit()method_: + +``` +function edit(filename) { +const filepath = 'files/' + filename; +if (editor) { +editor.destroyEditor() +} +editor = new DocsAPI.DocEditor("editor", +{ +documentType: get_file_type(filepath), +document: { +url: "host_url" + '/' + filepath, +title: filename, +key: filename + '_key' +} +, +editorConfig: { +mode: 'edit', +callbackUrl: "host_url" + '/callback' + '&filename=' + filename // add file name as a request parameter +} +}); +} +``` + +Write a method that will save file after getting the POST request to* /callback* address: + +``` +@post("/callback") # processing post requests for /callback +def callback(): +if request.json['status'] == 2: +file = requests.get(request.json['url']).content +with open('files/' + request.query['filename'], 'wb') as f: +f.write(file) +return "{\"error\":0}" +``` + +* # status 2*  is the built file. + +When we close the editor, the new version of the file will be saved to storage. + +**6\. How to manage users in ONLYOFFICE within the Python App** +If there are users in your app, and you need to see who exactly is editing a doc, write their identifiers (id and name) in the editors’ configuration. +Add the ability to select a user in the interface: + +``` + +``` + +If you add the call of the function *pick_user()*at the beginning of the tag _<script>_, it will initialize, in the function itself, the variables responsible for the id and the user name. + +``` +function pick_user() { +const user_selector = document.getElementById("user_selector"); +this.current_user_name = user_selector.options[user_selector.selectedIndex].text; +this.current_user_id = user_selector.options[user_selector.selectedIndex].value; +} +``` + +Make use of _editorConfig.user.id_ and  _editorConfig.user.name_ to configure user’s settings. Add these parameters to the editors’ configuration in the file editing function. + +``` +function edit(filename) { +const filepath = 'files/' + filename; +if (editor) { +editor.destroyEditor() +} +editor = new DocsAPI.DocEditor("editor", +{ +documentType: get_file_type(filepath), +document: { +url: "host_url" + '/' + filepath, +title: filename +}, +editorConfig: { +mode: 'edit', +callbackUrl: "host_url" + '/callback' + '?filename=' + filename, +user: { +id: this.current_user_id, +name: this.current_user_name +} +} +}); +} +``` + +Using this approach, you can integrate ONLYOFFICE editors into your app written in Python and get all the necessary tools for working and collaborating on docs. For more integration examples (Java, Node.js, PHP, Ruby), please, refer to the official [_API documentation_][5]. + +**By: Maria Pashkina** + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/integrate-online-documents-editors-into-a-python-web-app-using-onlyoffice/ + +作者:[Aashima Sharma][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://opensourceforu.com/author/aashima-sharma/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/09/Typist-composing-text-in-laptop.jpg?resize=696%2C420&ssl=1 (Typist composing text in laptop) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/09/Typist-composing-text-in-laptop.jpg?fit=900%2C543&ssl=1 +[3]: https://www.onlyoffice.com/en/ +[4]: https://www.onlyoffice.com/en/developer-edition.aspx +[5]: https://api.onlyoffice.com/editors/basic 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 new file mode 100644 index 0000000000..f1a7fe8060 --- /dev/null +++ b/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debugging in Emacs: The Grand Unified Debugger) +[#]: via: (https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/) +[#]: author: (Vineeth Kartha https://opensourceforu.com/author/vineeth-kartha/) + +Debugging in Emacs: The Grand Unified Debugger +====== + +[![][1]][2] + +_This article briefly explores the features of the Grand Unified Debugger, a debugging tool for Emacs._ + +If you are a C/C++ developer, it is highly likely that you have crossed paths with GDB (the GNU debugger) which is, without doubt, one of the most powerful and unrivalled debuggers out there. Its only drawback is that it is command line based, and though that offers a lot of power, it is sometimes a bit restrictive as well. This is why smart people started coming up with IDEs to integrate editors and debuggers, and give them a GUI. There are still developers who believe that using the mouse reduces productivity and that mouse-click based GUIs are temptations by the devil. +Since Emacs is one of the coolest text editors out there, I am going to show you how to write, compile and debug code without having to touch the mouse or move out of Emacs. + +![Figure 1: Compile command in Emacs’ mini buffer][3] + +![Figure 2: Compilation status][4] + +The Grand Unified Debugger, or GUD as it is commonly known, is an Emacs mode in which GDB can be run from within Emacs. This provides all the features of Emacs in GDB. The user does not have to move out of the editor to debug the code written. + +**Setting the stage for the Grand Unified Debugger** +If you are using a Linux machine, then it is likely you will have GDB and gcc already installed. The next step is to ensure that Emacs is also installed. I am assuming that the readers are familiar with GDB and have used it at least for basic debugging. If not, please do check out some quick introductions to GDB that are widely available on the Internet. + +For people who are new to Emacs, let me introduce you to some basic terminology. Throughout this article, you will see shortcut commands such as C-c, M-x, etc. C means the Ctrl key and M means the Alt key. C-c means the Ctrl + c keys are pressed. If you see C-c c, it means Ctrl + c is pressed followed by c. Also, in Emacs, the main area where you edit the text is called the main buffer, and the area at the bottom of the Emacs window, where commands are entered, is called the mini buffer. +Start Emacs and to create a new file, press _C-x C-f_. This will prompt you to enter a file name. Let us call our file ‘buggyFactorial.cpp’. Once the file is open, type in the code shown below: + +``` +#include +#include +int factorial(int num) { +int product = 1; +while(num--) { +product *= num; +} +return product; +} +int main() { +int result = factorial(5); +assert(result == 120); +} +``` + +Save the file with _C-x C-s_. Once the file is saved, it’s time to compile the code. Press _M-x_ and in the prompt that comes up, type in compile and hit Enter. Then, in the prompt, replace whatever is there with _g++ -g buggyFactorial.cpp_ and again hit _Enter_. + +This will open up another buffer in Emacs that will show the status of the compile and, hopefully, if the code typed in is correct, you will get a buffer like the one shown in Figure 2. + +To hide this compilation status buffer, make sure your cursor is in the compilation buffer (you can do this without the mouse using _C-x o_-this is used to move the cursor from one open buffer to the other), and then press _C-x 0_. The next step is to run the code and see if it works fine. Press M-! and in the mini buffer prompt, type _./a.out._ + +See the mini buffer that says the assertion is failed. Clearly, something is wrong with the code, because the factorial (5) is 120. So let’s debug the code now. + +![Figure 3: Output of the code in the mini buffer][5] + +![Figure 4: The GDB buffer in Emacs][6] + +**Debugging the code using GUD** +Now, since we have the code compiled, it’s time to see what is wrong with it. Press M-x and in the prompt, enter _gdb._ In the next prompt that appears, write _gdb -i=mi a.out_, which will start GDB in the Emacs buffer and if everything goes well, you should get the window that’s shown in Figure 4. +At the gdb prompt, type break main and then r to run the program. This should start running the program and should break at the _main()_. + +As soon as GDB hits the break point at main, a new buffer will open up showing the code that you are debugging. Notice the red dot on the left side, which is where your breakpoint was set. There will be a small indicator that shows which line of the code you are on. Currently, this will be the same as the break point itself (Figure 5). + +![Figure 5: GDB and the code in split windows][7] + +![Figure 6: Show the local variables in a separate frame in Emacs][8] + +To debug the factorial function, we need to step into it. For this, you can either use the _gdb_ prompt and the gdb command step, or you can use the Emacs shortcut _C-c C-s_. There are other similar shortcuts, but I prefer using the GDB commands. So I will use them in the rest of this article. +Let us keep an eye on the local variables while stepping through the factorial number. Check out Figure 6 for how to get an Emacs frame to show the local variables. + +Step through the code in the GDB prompt and watch the value of the local variable change. In the first iteration of the loop itself, we see a problem. The value of the product should have been 5 and not 4. + +This is where I leave you and now it’s up to the readers to explore and discover the magic land called GUD mode. Every gdb command works in the GUD mode as well. I leave the fix to this code as an exercise to readers. Explore and see how you can customise things to make your workflow simpler and become more productive while debugging. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/ + +作者:[Vineeth Kartha][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://opensourceforu.com/author/vineeth-kartha/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?resize=696%2C440&ssl=1 (Screenshot from 2019-09-25 15-39-46) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?fit=800%2C506&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_1.png?resize=350%2C228&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_2.png?resize=350%2C228&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_3.png?resize=350%2C228&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_4.png?resize=350%2C227&ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_5.png?resize=350%2C200&ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_6.png?resize=350%2C286&ssl=1 diff --git a/sources/tech/20190925 Mutation testing by example- Execute the test.md b/sources/tech/20190925 Mutation testing by example- Execute the test.md new file mode 100644 index 0000000000..2706e6dae1 --- /dev/null +++ b/sources/tech/20190925 Mutation testing by example- Execute the test.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mutation testing by example: Execute the test) +[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-execute-test) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Mutation testing by example: Execute the test +====== +Use the logic created so far in this series to implement functioning +code, then use failure and unit testing to make it better. +![A cat.][1] + +The [second article][2] in this series demonstrated how to implement the logic for determining whether it's daylight or nighttime in a home automation system (HAS) application that controls locking and unlocking a cat door. This third article explains how to write code to use that logic in an application that locks a door at night and unlocks it during daylight hours. + +As a reminder, set yourself up to follow along using the .NET xUnit.net testing framework by following the [instructions here][3]. + +### Disable the cat trap door during nighttime + +Assume the cat door is a sophisticated Internet of Things (IoT) product that has an IP address and can be accessed by sending a request to its API. For the sake of brevity, this series doesn't go into how to program an IoT device; rather, it simulates the service to keep the focus on test-driven development (TDD) and mutation testing. + +Start by writing a failing unit test: + + +``` +[Fact] +public void GivenNighttimeDisableTrapDoor() { +   var expected = "Cat trap door disabled"; +   var timeOfDay = dayOrNightUtility.GetDayOrNight(nightHour); +   var actual = catTrapDoor.Control(timeOfDay); +   Assert.Equal(expected, actual); +} +``` + +This describes a brand new component or service (**catTrapDoor**). That component (or service) has the capability to control the trap door given the current time. Now it's time to implement **catTrapDoor**. + +To simulate this service, you must first describe its capabilities by using the interface. Create a new file in the app folder and name it **ICatTrapDoor.cs** (by convention, an interface name starts with an uppercase letter **I**). Add the following code to that file: + + +``` +namespace app{ +   public interface ICatTrapDoor { +       string Control(string dayOrNight); +   } +} +``` + +This interface is not capable of functioning. It merely describes your intention when building the **CatTrapDoor** service. Interfaces are a nice way to create abstractions of the services you are working with. In a way, you could regard this interface as an API of the **CatTrapDoor** service. + +To implement the API, create a new file in the app folder and name it **FakeCatTrapDoor.cs**. Enter the following code into the class file: + + +``` +namespace app{ +   public class FakeCatTrapDoor : ICatTrapDoor { +       public string Control(string dayOrNight) { +           string trapDoorStatus = "Undetermined"; +           if(dayOrNight == "Nighttime") { +               trapDoorStatus = "Cat trap door disabled"; +           } + +           return trapDoorStatus; +       } +   } +} +``` + +This new **FakeCatTrapDoor** class implements the interface **ICatTrapDoor**. Its method **Control** accepts string value **dayOrNight** and checks whether the value passed in is "Nighttime." If it is, it modifies **trapDoorStatus** from "Undetermined" to "Cat trap door disabled" and returns that value to the calling client. + +Why is it called **FakeCatTrapDoor**? Because it's not a representation of the real cat trap door. The fake just helps you work out the processing logic. Once your logic is airtight, the fake service is replaced with the real service (this topic is reserved for the discipline of integration testing). + +With everything implemented, all the unit tests pass when they run: + + +``` +Starting test execution, please wait... + +Total tests; 3. Passed: 3. failed: 0. Skipped: 0. +Test Run Successful. +Test execution time: 1.3913 Seconds +``` + +### Enable the cat trap door during daytime + +It's time to look at the next scenario in our user story: + +> _Scenario #2: Enable cat trap door during daylight_ +> +> * Given that the clock detects the daylight +> * When the clock notifies the HAS +> * Then the HAS enables the cat trap door +> + + +This should be easy, just the flip side of the first scenario. First, write the failing test. Add the following unit test to your **UnitTest1.cs** file in the **unittest** folder: + + +``` +[Fact] +public void GivenDaylightEnableTrapDoor() { +   var expected = "Cat trap door enabled"; +   var timeOfDay = dayOrNightUtility.GetDayOrNight(dayHour); +   var actual = catTrapDoor.Control(timeOfDay); +   Assert.Equal(expected, actual); +} +``` + +You can expect to receive a "Cat trap door enabled" notification when sending the "Daylight" status to **catTrapDoor** service. When you run unit tests, you see the result you expect, which fails as expected: + + +``` +Starting test execution, please wait... +[Xunit unittest.UnitTest1.UnitTest1.GivenDaylightEnableTrapDoor [FAIL] +Failed unittest.UnitTest1.UnitTest1.GivenDaylightEnableTrapDoor +[...] +``` + +The unit test expected to receive a "Cat trap door enabled" notification but instead was notified that the cat trap door status is "Undetermined." Cool; now's the time to fix this minor failure. + +Adding three lines of code to the **FakeCatTrapDoor** does the trick: + + +``` +if(dayOrNight == "Daylight") { +   trapDoorStatus = "Cat trap door enabled"; +} +``` + +Run the unit tests again, and all tests pass: + + +``` +Starting test execution, please wait... + +Total tests: 4. Passed: 4. Failed: 0. Skipped: 0. +Test Run Successful. +Test execution time: 2.4888 Seconds +``` + +Awesome! Everything looks good, all the unit tests are in green, you have a rock-solid solution. Thank you, TDD! + +### Not so fast! + +Experienced engineers would not be convinced that the solution is rock-solid. Why? Because the solution hasn't been mutated yet. To dive deeply into what mutation is and why it's important, be sure to read the final article in this series. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mutation-testing-example-execute-test + +作者:[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/cat_pet_animal.jpg?itok=HOrVTfBZ (A cat.) +[2]: https://opensource.com/article/19/9/mutation-testing-example-part-2-failure-experimentation +[3]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd diff --git a/sources/tech/20190926 3 open source social platforms to consider.md b/sources/tech/20190926 3 open source social platforms to consider.md new file mode 100644 index 0000000000..dddde6dc77 --- /dev/null +++ b/sources/tech/20190926 3 open source social platforms to consider.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source social platforms to consider) +[#]: via: (https://opensource.com/article/19/9/open-source-social-networks) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouharihttps://opensource.com/users/danarelhttps://opensource.com/users/osmomjianhttps://opensource.com/users/dff) + +3 open source social platforms to consider +====== +A photo-sharing platform, a privacy-friendly social network, and a web +application for building and sharing portfolios. +![Hands holding a mobile phone with open on the screen][1] + +It is no mystery why modern social media platforms were designed to be addictive: the more we consult them, the more data they have to fuel them—which enables them to grow smarter and bigger and more powerful. + +The massive, global interest in these platforms has created the attention economy, and people's focused mental engagement is the new gold in the age of information abundance. As economist, political scientist, and cognitive psychologist Herbert A. Simon said in [_Designing organizations for an information-rich world_][2], "the wealth of information means a dearth of something else: a scarcity of whatever it is that information consumes." And information consumes our attention, a resource we only have so much of it. + +According to [GlobalWebIndex][3], we are now spending an average of 142 minutes on social media and messaging platforms daily, 63% more than the 90 minutes we spent on these platforms just seven years ago. This can be explained by the fact that these platforms have grown more intelligent over time by studying the minds and behaviors of users and applying those findings to boost their appeal. + +Of relevance here is the psychological concept [variable-ratio schedule][4], which gives rewards after an average number of responses but on an unpredictable schedule. One example is slot machines, which may provide a reward an average of every five games, but the players don't know the specific number of games (one, two, seven, or even 15) they must play before obtaining a reward. This schedule leads to a high response rate and strong engagement. + +Knowing all of this, what can we do to make things better and loosen the grip social networks have on us and our data? I suggest the answer is migrating to open source social platforms, which I believe consider the humane aspect of technology more than private companies do. Here are three open source social platforms to consider. + +### Pixelfed + +[Pixelfed][5] is a photo-sharing platform that is ad-free and privacy-focused, which means no third party is making a profit from your data. Posts are in chronological order, which means there is no algorithm making distinctions between content. + +To join the network, you can pick one of the servers on the [list of instances][6], or you can [install and run][7] your own Pixelfed instance. + +Once you are set up, you can connect with other Pixelfed instances. This is known as federation, which means many instances of a software (in this case, Pixelfed) share data (in this case, pictures). When you federate with another instance of Pixelfed, you can see and interact with pictures posted to other accounts. + +The project is ongoing and needs the community's support to grow. Check [Pixelfed's GitHub][8] page for more information about contributing. + +### Okuna + +[Okuna][9] is an open source, privacy-friendly social network. It is committed to being a positive influence on society and the environment, plus it donates 30% of its profits to worthy causes. + +### Mahara + +[Mahara][10] is an open source web application for building and sharing electronic portfolios. (The word _mahara_ is Māori for _memory_ or _thoughtful consideration_.) With Mahara, you can create a meaningful and verifiable professional profile, but all your data belongs to you rather than a corporate sponsor. It is customizable and can be integrated into other web services. + +You can try Mahara on its [demo site][11]. + +### Engage for change + +If you want to know more about the impact of the attention economy on our lives and engage for positive change, take a look at the [Center for Humane Technology][12], an organization trying to temper the attention economy and make technology more humane. Its aim is to spur change that will protect human vulnerabilities from being exploited and therefore build a better society. + +As Sonya Parker said, "whatever you focus your attention on will become important to you even if it's unimportant." So let's focus our attention on building a better world for all. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/open-source-social-networks + +作者:[Jaouhari Youssef][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/jaouharihttps://opensource.com/users/danarelhttps://opensource.com/users/osmomjianhttps://opensource.com/users/dff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolserieshe_rh_041x_0.png?itok=tfg6_I78 (Hands holding a mobile phone with open on the screen) +[2]: https://digitalcollections.library.cmu.edu/awweb/awarchive?type=file&item=33748 +[3]: https://www.digitalinformationworld.com/2019/01/how-much-time-do-people-spend-social-media-infographic.html +[4]: https://dictionary.apa.org/variable-ratio-schedule +[5]: https://pixelfed.org/ +[6]: https://pixelfed.org/join +[7]: https://docs.pixelfed.org/installing-pixelfed/ +[8]: https://github.com/pixelfed/pixelfed +[9]: https://www.okuna.io/en/home +[10]: https://mahara.org/ +[11]: https://demo.mahara.org/ +[12]: https://humanetech.com/problem/ diff --git a/sources/tech/20190926 Mutation testing by example- Evolving from fragile TDD.md b/sources/tech/20190926 Mutation testing by example- Evolving from fragile TDD.md new file mode 100644 index 0000000000..4ce6e23232 --- /dev/null +++ b/sources/tech/20190926 Mutation testing by example- Evolving from fragile TDD.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mutation testing by example: Evolving from fragile TDD) +[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-definition) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzichttps://opensource.com/users/alex-bunardzichttps://opensource.com/users/marcobravo) + +Mutation testing by example: Evolving from fragile TDD +====== +Test-driven development is not enough for delivering lean code that +works exactly to expectations. Mutation testing is a powerful step +forward. Here's what that looks like. +![Binary code on a computer screen][1] + +The [third article][2] in this series demonstrated how to use failure and unit testing to develop better code. + +While it seemed that the journey was over with a successful sample Internet of Things (IoT) application to control a cat door, experienced programmers know that solutions need _mutation_. + +### What's mutation testing? + +Mutation testing is the process of iterating through each line of implemented code, mutating that line, then running unit tests and checking if the mutation broke the expectations. If it hasn't, you have created a surviving mutant. + +Surviving mutants are always an alarming issue that points to potentially risky areas in a codebase. As soon as you catch a surviving mutant, you must kill it. And the only way to kill a surviving mutant is to create additional descriptions—new unit tests that describe your expectations regarding the output of your function or module. In the end, you deliver a lean, mean solution that is airtight and guarantees no pesky bugs or defects are lurking in your codebase. + +If you leave surviving mutants to kick around and proliferate, live long, and prosper, then you are creating the much dreaded technical debt. On the other hand, if any unit test complains that the temporarily mutated line of code produces output that's different from the expected output, the mutant has been killed. + +### Installing Stryker + +The quickest way to try mutation testing is to leverage a dedicated framework. This example uses [Stryker][3]. + +To install Stryker, go to the command line and run: + + +``` +`$ dotnet tool install -g dotnet-stryker` +``` + +To run Stryker, navigate to the **unittest** folder and type: + + +``` +`$ dotnet-stryker` +``` + +Here is Stryker's report on the quality of our solution: + + +``` +14 mutants have been created. Each mutant will now be tested, this could take a while. + +Tests progress | 14/14 | 100% | ~0m 00s | +Killed : 13 +Survived : 1 +Timeout : 0 + +All mutants have been tested, and your mutation score has been calculated +\- \app [13/14 (92.86%)] +[...] +``` + +The report says: + + * Stryker created 14 mutants + * Stryker saw 13 mutants were killed by the unit tests + * Stryker saw one mutant survive the onslaught of the unit tests + * Stryker calculated that the existing codebase contains 92.86% of code that serves the expectations + * Stryker calculated that 7.14% of the codebase contains code that does not serve the expectations + + + +Overall, Stryker claims that the application assembled in the first three articles in this series failed to produce a reliable solution. + +### How to kill a mutant + +When software developers encounter surviving mutants, they typically reach for the implemented code and look for ways to modify it. For example, in the case of the sample application for cat door automation, change the line: + + +``` +`string trapDoorStatus = "Undetermined";` +``` + +to: + + +``` +`string trapDoorStatus = "";` +``` + +and run Stryker again. A mutant has survived: + + +``` +All mutants have been tested, and your mutation score has been calculated +\- \app [13/14 (92.86%)] +[...] +[Survived] String mutation on line 4: '""' ==> '"Stryker was here!"' +[...] +``` + +This time, you can see that Stryker mutated the line: + + +``` +`string trapDoorStatus = "";` +``` + +into: + + +``` +`string trapDoorStatus = ""Stryker was here!";` +``` + +This is a great example of how Stryker works: it mutates every line of our code, in a smart way, in order to see if there are further test cases we have yet to think about. It's forcing us to consider our expectations in greater depth. + +Defeated by Stryker, you can attempt to improve the implemented code by adding more logic to it: + + +``` +public string Control(string dayOrNight) { +   string trapDoorStatus = "Undetermined"; +   if(dayOrNight == "Nighttime") { +       trapDoorStatus = "Cat trap door disabled"; +   } else if(dayOrNight == "Daylight") { +       trapDoorStatus = "Cat trap door enabled"; +   } else { +       trapDoorStatus = "Undetermined"; +   } +   return trapDoorStatus; +} +``` + +But after running Stryker again, you see this attempt created a new mutant: + + +``` +ll mutants have been tested, and your mutation score has been calculated +\- \app [13/15 (86.67%)] +[...] +[Survived] String mutation on line 4: '"Undetermined"' ==> '""' +[...] +[Survived] String mutation on line 10: '"Undetermined"' ==> '""' +[...] +``` + +![Stryker report][4] + +You cannot wiggle out of this tight spot by modifying the implemented code. It turns out the only way to kill surviving mutants is to _describe additional expectations_. And how do you describe expectations? By writing unit tests. + +### Unit testing for success + +It's time to add a new unit test. Since the surviving mutant is located on line 4, you realize you have not specified expectations for the output with value "Undetermined." + +Let's add a new unit test: + + +``` +[Fact] +public void GivenIncorrectTimeOfDayReturnUndetermined() { +   var expected = "Undetermined"; +   var actual = catTrapDoor.Control("Incorrect input"); +   Assert.Equal(expected, actual); +} +``` + +The fix worked! Now all mutants are killed: + + +``` +All mutants have been tested, and your mutation score has been calculated +\- \app [14/14 (100%)] +[Killed] [...] +``` + +You finally have a complete solution, including a description of what is expected as output if the system receives incorrect input values. + +### Mutation testing to the rescue + +Suppose you decide to over-engineer a solution and add this method to the **FakeCatTrapDoor**: + + +``` +private string getTrapDoorStatus(string dayOrNight) { +   string status = "Everything okay"; +   if(dayOrNight != "Nighttime" || dayOrNight != "Daylight") { +       status = "Undetermined"; +   } +   return status; +} +``` + +Then replace the line 4 statement: + + +``` +`string trapDoorStatus = "Undetermined";` +``` + +with: + + +``` +`string trapDoorStatus = getTrapDoorStatus(dayOrNight);` +``` + +When you run unit tests, everything passes: + + +``` +Starting test execution, please wait... + +Total tests: 5. Passed: 5. Failed: 0. Skipped: 0. +Test Run Successful. +Test execution time: 2.7191 Seconds +``` + +The test has passed without an issue. TDD has worked. But bring  Stryker to the scene, and suddenly the picture looks a bit grim: + + +``` +All mutants have been tested, and your mutation score has been calculated +\- \app [14/20 (70%)] +[...] +``` + +Stryker created 20 mutants; 14 mutants were killed, while six mutants survived. This lowers the success score to 70%. This means only 70% of our code is there to fulfill the described expectations. The other 30% of the code is there for no clear reason, which puts us at risk of misuse of that code. + +In this case, Stryker helps fight the bloat. It discourages the use of unnecessary and convoluted logic because it is within the crevices of such unnecessary complex logic where bugs and defects breed. + +### Conclusion + +As you've seen, mutation testing ensures that no uncertain fact goes unchecked. + +You could compare Stryker to a chess master who is thinking of all possible moves to win a match. When Stryker is uncertain, it's telling you that winning is not yet a guarantee. The more unit tests we record as facts, the further we are in our match, and the more likely Stryker can predict a win. In any case, Stryker helps detect losing scenarios even when everything looks good on the surface. + +It is always a good idea to engineer code properly. You've seen how TDD helps in that regard. TDD is especially useful when it comes to keeping your code extremely modular. However, TDD on its own is not enough for delivering lean code that works exactly to expectations. Developers can add code to an already implemented codebase without first describing the expectations. That puts the entire code base at risk. Mutation testing is especially useful in catching breaches in the regular test-driven development (TDD) cadence. You need to mutate every line of implemented code to be certain no line of code is there without a specific reason. + +Now that you understand how mutation testing works, you should look into how to leverage it. Next time, I'll show you how to put mutation testing to good use when tackling more complex scenarios. I will also introduce more agile concepts to see how DevOps culture can benefit from maturing technology. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mutation-testing-example-definition + +作者:[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-bunardzichttps://opensource.com/users/alex-bunardzichttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/binary_code_computer_screen.png?itok=7IzHK1nn (Binary code on a computer screen) +[2]: https://opensource.com/article/19/9/mutation-testing-example-part-3-execute-test +[3]: https://stryker-mutator.io/ +[4]: https://opensource.com/sites/default/files/uploads/strykerreport.png (Stryker report) diff --git a/sources/tech/20190927 5 tips for GNU Debugger.md b/sources/tech/20190927 5 tips for GNU Debugger.md new file mode 100644 index 0000000000..faedf4240d --- /dev/null +++ b/sources/tech/20190927 5 tips for GNU Debugger.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 tips for GNU Debugger) +[#]: via: (https://opensource.com/article/19/9/tips-gnu-debugger) +[#]: author: (Tim Waugh https://opensource.com/users/twaugh) + +5 tips for GNU Debugger +====== +Learn how to use some of the lesser-known features of gdb to inspect and +fix your code. +![Bug tracking magnifying glass on computer screen][1] + +The [GNU Debugger][2] (gdb) is an invaluable tool for inspecting running processes and fixing problems while you're developing programs. + +You can set breakpoints at specific locations (by function name, line number, and so on), enable and disable those breakpoints, display and alter variable values, and do all the standard things you would expect any debugger to do. But it has many other features you might not have experimented with. Here are five for you to try. + +### Conditional breakpoints + +Setting a breakpoint is one of the first things you'll learn to do with the GNU Debugger. The program stops when it reaches a breakpoint, and you can run gdb commands to inspect it or change variables before allowing the program to continue. + +For example, you might know that an often-called function crashes sometimes, but only when it gets a certain parameter value. You could set a breakpoint at the start of that function and run the program. The function parameters are shown each time it hits the breakpoint, and if the parameter value that triggers the crash is not supplied, you can continue until the function is called again. When the troublesome parameter triggers a crash, you can step through the code to see what's wrong. + + +``` +(gdb) break sometimes_crashes +Breakpoint 1 at 0x40110e: file prog.c, line 5. +(gdb) run +[...] +Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 +5      fprintf(stderr, +(gdb) continue +Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 +5      fprintf(stderr, +(gdb) continue +``` + +To make this more repeatable, you could count how many times the function is called before the specific call you are interested in, and set a counter on that breakpoint (for example, "continue 30" to make it ignore the next 29 times it reaches the breakpoint). + +But where breakpoints get really powerful is in their ability to evaluate expressions at runtime, which allows you to automate this kind of testing. Enter: conditional breakpoints. + + +``` +break [LOCATION] if CONDITION + +(gdb) break sometimes_crashes if !f +Breakpoint 1 at 0x401132: file prog.c, line 5. +(gdb) run +[...] +Breakpoint 1, sometimes_crashes (f=0x0) at prog.c:5 +5      fprintf(stderr, +(gdb) +``` + +Instead of having gdb ask what to do every time the function is called, a conditional breakpoint allows you to make gdb stop at that location only when a particular expression evaluates as true. If the execution reaches the conditional breakpoint location, but the expression evaluates as false, the + +debugger automatically lets the program continue without asking the user what to do. + +### Breakpoint commands + +An even more sophisticated feature of breakpoints in the GNU Debugger is the ability to script a response to reaching a breakpoint. Breakpoint commands allow you to write a list of GNU Debugger commands to run whenever it reaches a breakpoint. + +We can use this to work around the bug we already know about in the **sometimes_crashes** function and make it return from that function harmlessly when it provides a null pointer. + +We can use **silent** as the first line to get more control over the output. Without this, the stack frame will be displayed each time the breakpoint is hit, even before our breakpoint commands run. + + +``` +(gdb) break sometimes_crashes +Breakpoint 1 at 0x401132: file prog.c, line 5. +(gdb) commands 1 +Type commands for breakpoint(s) 1, one per line. +End with a line saying just "end". +>silent +>if !f + >frame + >printf "Skipping call\n" + >return 0 + >continue + >end +>printf "Continuing\n" +>continue +>end +(gdb) run +Starting program: /home/twaugh/Documents/GDB/prog +warning: Loadable section ".note.gnu.property" outside of ELF segments +Continuing +Continuing +Continuing +#0  sometimes_crashes (f=0x0) at prog.c:5 +5      fprintf(stderr, +Skipping call +[Inferior 1 (process 9373) exited normally] +(gdb) +``` + +### Dump binary memory + +GNU Debugger has built-in support for examining memory using the **x** command in various formats, including octal, hexadecimal, and so on. But I like to see two formats side by side: hexadecimal bytes on the left, and ASCII characters represented by those same bytes on the right. + +When I want to view the contents of a file byte-by-byte, I often use **hexdump -C** (hexdump comes from the [util-linux][3] package). Here is gdb's **x** command displaying hexadecimal bytes: + + +``` +(gdb) x/33xb mydata +0x404040 <mydata>:    0x02    0x01    0x00    0x02    0x00    0x00    0x00    0x01 +0x404048 <mydata+8>:    0x01    0x47    0x00    0x12    0x61    0x74    0x74    0x72 +0x404050 <mydata+16>:    0x69    0x62    0x75    0x74    0x65    0x73    0x2d    0x63 +0x404058 <mydata+24>:    0x68    0x61    0x72    0x73    0x65    0x75    0x00    0x05 +0x404060 <mydata+32>:    0x00 +``` + +What if you could teach gdb to display memory just like hexdump does? You can, and in fact, you can use this method for any format you prefer. + +By combining the **dump** command to store the bytes in a file, the **shell** command to run hexdump on the file, and the **define** command, we can make our own new **hexdump** command to use hexdump to display the contents of memory. + + +``` +(gdb) define hexdump +Type commands for definition of "hexdump". +End with a line saying just "end". +>dump binary memory /tmp/dump.bin $arg0 $arg0+$arg1 +>shell hexdump -C /tmp/dump.bin +>end +``` + +Those commands can even go in the **~/.gdbinit** file to define the hexdump command permanently. Here it is in action: + + +``` +(gdb) hexdump mydata sizeof(mydata) +00000000  02 01 00 02 00 00 00 01  01 47 00 12 61 74 74 72  |.........G..attr| +00000010  69 62 75 74 65 73 2d 63  68 61 72 73 65 75 00 05  |ibutes-charseu..| +00000020  00                                                |.| +00000021 +``` + +### Inline disassembly + +Sometimes you want to understand more about what happened leading up to a crash, and the source code is not enough. You want to see what's going on at the CPU instruction level. + +The **disassemble** command lets you see the CPU instructions that implement a function. But sometimes the output can be hard to follow. Usually, I want to see what instructions correspond to a certain section of source code in the function. To achieve this, use the **/s** modifier to include source code lines with the disassembly. + + +``` +(gdb) disassemble/s main +Dump of assembler code for function main: +prog.c: +11    { +   0x0000000000401158 <+0>:    push   %rbp +   0x0000000000401159 <+1>:    mov      %rsp,%rbp +   0x000000000040115c <+4>:    sub      $0x10,%rsp + +12      int n = 0; +   0x0000000000401160 <+8>:    movl   $0x0,-0x4(%rbp) + +13      sometimes_crashes(&n); +   0x0000000000401167 <+15>:    lea     -0x4(%rbp),%rax +   0x000000000040116b <+19>:    mov     %rax,%rdi +   0x000000000040116e <+22>:    callq  0x401126 <sometimes_crashes> +[...snipped...] +``` + +This, along with **info registers** to see the current values of all the CPU registers and commands like **stepi** to step one instruction at a time, allow you to have a much more detailed understanding of the program. + +### Reverse debug + +Sometimes you wish you could turn back time. Imagine you've hit a watchpoint on a variable. A watchpoint is like a breakpoint, but instead of being set at a location in the program, it is set on an expression (using the **watch** command). Whenever the value of the expression changes, execution stops, and the debugger takes control. + +So imagine you've hit this watchpoint, and the memory used by a variable has changed value. This can turn out to be caused by something that occurred much earlier; for example, the memory was freed and is now being re-used. But when and why was it freed? + +The GNU Debugger can solve even this problem because you can run your program in reverse! + +It achieves this by carefully recording the state of the program at each step so that it can restore previously recorded states, giving the illusion of time flowing backward. + +To enable this state recording, use the **target record-full** command. Then you can use impossible-sounding commands, such as: + + * **reverse-step**, which rewinds to the previous source line + * **reverse-next**, which rewinds to the previous source line, stepping backward over function calls + * **reverse-finish**, which rewinds to the point when the current function was about to be called + * **reverse-continue**, which rewinds to the previous state in the program that would (now) trigger a breakpoint (or anything else that causes it to stop) + + + +Here is an example of reverse debugging in action: + + +``` +(gdb) b main +Breakpoint 1 at 0x401160: file prog.c, line 12. +(gdb) r +Starting program: /home/twaugh/Documents/GDB/prog +[...] + +Breakpoint 1, main () at prog.c:12 +12      int n = 0; +(gdb) target record-full +(gdb) c +Continuing. + +Program received signal SIGSEGV, Segmentation fault. +0x0000000000401154 in sometimes_crashes (f=0x0) at prog.c:7 +7      return *f; +(gdb) reverse-finish +Run back to call of #0  0x0000000000401154 in sometimes_crashes (f=0x0) +        at prog.c:7 +0x0000000000401190 in main () at prog.c:16 +16      sometimes_crashes(0); +``` + +These are just a handful of useful things the GNU Debugger can do. There are many more to discover. Which hidden, little-known, or just plain amazing feature of gdb is your favorite? Please share it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/tips-gnu-debugger + +作者:[Tim Waugh][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/twaugh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen) +[2]: https://www.gnu.org/software/gdb/ +[3]: https://en.wikipedia.org/wiki/Util-linux diff --git a/sources/tech/20190928 Microsoft open sourcing its C-- library, Cloudera-s open source data platform, new tools to remove leaked passwords on GitHub and combat ransomware, and more open source news.md b/sources/tech/20190928 Microsoft open sourcing its C-- library, Cloudera-s open source data platform, new tools to remove leaked passwords on GitHub and combat ransomware, and more open source news.md new file mode 100644 index 0000000000..cb803113ab --- /dev/null +++ b/sources/tech/20190928 Microsoft open sourcing its C-- library, Cloudera-s open source data platform, new tools to remove leaked passwords on GitHub and combat ransomware, and more open source news.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Microsoft open sourcing its C++ library, Cloudera's open source data platform, new tools to remove leaked passwords on GitHub and combat ransomware, and more open source news) +[#]: via: (https://opensource.com/article/19/9/news-september-28) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Microsoft open sourcing its C++ library, Cloudera's open source data platform, new tools to remove leaked passwords on GitHub and combat ransomware, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look Cloudera's open source data platform, Microsoft open sourcing its C++ library, new tools to beef up digital security, and more! + +### Cloudera releases open source cloud data platform + +It was only a few months ago that data processing software vendor Cloudera went [all in on open source][2]. The results of that shift have started to appear, with the company releasing "[an integrated data platform made up entirely of open-source elements.][3]" + +Called Cloudera Data Platform, it combines "a cloud-native data warehouse, machine learning service and data hub, each running as instances within the self-contained operating environments." Cloudera's chief product officer Arun Murthy said that by using "existing components in the cloud, the platform cuts deployment times from weeks to hours." The speed of open source adoption is a great industry proof point. One can image the next step is Cloudera's participation in the underlying open source communities they now depend on.  + +### Microsoft open sources its C++ standard library + +When you think of open source software, programming language libraries probably aren't the first things that come to mind. But they're often an essential part of the software that we use. A team at Microsoft recognized the importance of the company's implementation of the C++ Standard Library (STL) and it's been [released as open source][4]. + +By making the library open source, users get "easy access to all the latest developments in C++" and enables them to participate "in the STL’s development by reporting issues and commenting on pull requests." The library, which is under an Apache License, is [available on GitHub][5]. + +### Two new open source security tools + +Nowadays, more than ever it seems, digital security is important to anyone using a computer — from average users to system administrators to software developers. Open source has been playing its part in helping make systems more secure, and two new open source tools to help secure an organization's code and its computers have been released. + +If you, or someone in your company, has ever accidentally published sensitive information to a public GitHub repository, then [Shhgit is for you][6]. The tool, which you can [find on GitHub][7], is designed to detect passwords, connection strings, and access keys that wind up being exposed. Unlike similar tools, you don't need to point Shhgit at a particular repository. Instead, it "taps into the GitHub firehose to automatically flag up leaked secrets". + +Ransomware attacks are no joke, and defending against them is serious business. Cameyo, a company specializing in virtualization, has released an [open source monitoring tool][8] that "any organization can use to identify attacks taking place over RDP (Remote Desktop Protocol) in their environment." Called [RDPmon][9], the software enables users to "monitor and identify brute force attacks and to help protect against ransomware". It does this by watching the number of attempted RDP connections, along with the number of users and which programs those users are running. + +### New foundation to develop open source data processing engine + +There's a new open source foundation in town. Tech firms Alibaba, Facebook, Twitter, and Uber have [teamed up][10] to further develop Presto, a database search engine and processing tool originally crafted by Facebook. + +The Presto Foundation, which operates under the Linux Foundation's umbrella, aims to make Presto the "fastest and most reliable SQL engine for massively distributed data processing." One of the foundation members, Alibaba, already has plans for the tool. According to an [article in CX Tech][11], Alibaba intends to refine Presto to more efficiently "sift through the mountains of data generated by its e-commerce platforms." + +#### In other news + + * [Scientists Create World’s First Open Source Tool for 3D Analysis of Advanced Biomaterials][12] + * [Percona announces Percona Distribution for PostgreSQL to support open source databases][13] + * [Sage gets cloudy, moves towards open source and microservices][14] + * [Compliance monitoring of EU’s Common Agricultural Policy made more transparent and efficient with Open Source][15] + * [WebLinc is taking its in-house ecommerce platform open source][16] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/news-september-28 + +作者:[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/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://opensource.com/19/7/news-july-20#cloudera +[3]: https://siliconangle.com/2019/09/24/cloudera-debuts-open-source-integrated-cloud-data-platform/ +[4]: https://devclass.com/2019/09/18/microsoft-turns-to-github-to-open-source-c-stl/ +[5]: https://github.com/microsoft/STL +[6]: https://portswigger.net/daily-swig/open-source-tool-for-bug-hunters-searches-for-leaked-secrets-in-github-commits +[7]: https://github.com/eth0izzle/shhgit/ +[8]: https://betanews.com/2019/09/18/tool-prevents-brute-force-ransomware/ +[9]: https://github.com/cameyo/rdpmon +[10]: https://sdtimes.com/data/the-presto-foundation-launches-under-the-linux-foundation/ +[11]: https://www.caixinglobal.com/2019-09-24/alibaba-global-tech-giants-form-foundation-for-open-source-database-tool-101465449.html +[12]: https://sputniknews.com/science/201909111076763585-russian-german-scientists-create-worlds-first-open-source-tool-for-3d-analysis-of-advanced/ +[13]: https://hub.packtpub.com/percona-announces-percona-distribution-for-postgresql-to-support-open-source-databases/ +[14]: https://www.itworldcanada.com/article/sage-gets-cloudy-moves-towards-open-source-and-microservices/421771 +[15]: https://joinup.ec.europa.eu/node/702122 +[16]: https://technical.ly/philly/2019/09/24/weblinc-ecommerce-platform-open-source-workarea/ diff --git a/sources/tech/20190929 Open Source Voice Chat Mumble Makes a Big Release After 10 Years.md b/sources/tech/20190929 Open Source Voice Chat Mumble Makes a Big Release After 10 Years.md new file mode 100644 index 0000000000..3205c22a0a --- /dev/null +++ b/sources/tech/20190929 Open Source Voice Chat Mumble Makes a Big Release After 10 Years.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Voice Chat Mumble Makes a Big Release After 10 Years) +[#]: via: (https://itsfoss.com/mumble-voice-chat/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Open Source Voice Chat Mumble Makes a Big Release After 10 Years +====== + +The greatest power of the Internet is its ability to connect people anywhere in the world. Voice chat applications are just one category of tools uniting us. Recently, one of the biggest open-source voice chat apps made a new release, 10 years after its previous release. + +### Mumble: Open Source, Low Latency, High Quality Voice Chat + +![Mumble][1] + +[Mumble][2] is a “free, open source, low latency, high quality voice chat application”. It was originally created to be used by gamers, but it is also used to record podcasts. Several [Linux podcasts][3] use Mumble to record hosts located at different places in the world, including Late Nite Linux. To give you an idea of how powerful Mumble is, it has been used to connect “Eve Online players with huge communities of over 100 simultaneous voice participants”. + +Here are some of the features that make Mumble interesting: + + * Low-latency (ideal for gamers) + * Connections always encrypted and secured + * Connect with friends across servers + * Extensive user permission system + * Extendable through Ice and GRPC protocols + * Automatable administration through Ice middleware + * Low resource cost for hosting + * Free choice between official and third-party server software + * Provide users with channel viewer data (CVP) without giving control away + + + +It’s a powerful software with a lot of features. If you are new to it and want to start using it, I suggest [going through its documentation][4]. + +### What’s New in Mumble 1.3.0? + +![Mumble 1.30 Interface with Lite Theme][5] + +The team behind Mumble released [version 1.3.0][6] in early August. This is the first major release in ten years and it contains over 3,000 changes. Here are just a few of the new features in Mumble 1.3.0: + + * UI redesign + * New lite and dark themes + * Individual user volume adjustment + * New bindable shortcut for changing transmission modes + * Quickly filter channels + * Multichannel recordings are synchronous even after several hours + * PulseAudio monitor devices can be used as input devices + * An optional clock (current time) in the overlay + * Improved user management, including searchable ban list + * Added support for systemd + * Option to disable public server list + * Lower volume of other users when “Priority Speaker” talks + * New interface allows renaming users as well as (batch) deletions + * Mumble client can be controlled through SocketRPC + * Support for Logitech G-keys has been added + + + +### Installing Mumble on Linux + +![Mumble 1.30 Interface Dark Theme][7] + +The Mumble team has installers available for Linux, Windows (32 and 64 bit), and macOS. You can find and download them from the [project’s website][8]. You can also browse its [source code on GitHub][9]. + +They have a [PPA available for Ubuntu][10]. Which means you can easily install it on Ubuntu and Ubuntu-based distributions like Linux Mint, elementary OS. To install, just enter these commands, one by one, in the terminal: + +``` +sudo add-apt-repository ppa:mumble/release +sudo apt update +sudo apt install mumble +``` + +The Snap community also created a [snap app for Mumble][11]. This makes installing Mumble easier in any Linux distribution that supports Snap. You can install it with the following command: + +``` +sudo snap install mumble +``` + +There are also _third-party clients_ for Android and iOS on the download page. + +[Download Mumble for other platforms][8] + +**Final Thoughts** + +I have never used Mumble or any other voice chat app. I just never had the need. That being said, I’m glad that there is a powerful FOSS option available and so widely used. + +Have you ever used Mumble? What is your favorite voice chat app? 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][12]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mumble-voice-chat/ + +作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/mumble-voice-chat-logo.png?ssl=1 +[2]: https://www.mumble.info/ +[3]: https://itsfoss.com/linux-podcasts/ +[4]: https://wiki.mumble.info/wiki/Main_Page +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mumble-1.30-interface.jpg?ssl=1 +[6]: https://www.mumble.info/blog/mumble-1.3.0-release-announcement/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mumble-1.30-interface-1.png?resize=800%2C529&ssl=1 +[8]: https://www.mumble.info/downloads/ +[9]: https://github.com/mumble-voip/mumble +[10]: https://itsfoss.com/ppa-guide/ +[11]: https://snapcraft.io/mumble +[12]: https://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20190930 Cacoo- A Lightweight Online Tool for Modelling AWS Architecture.md b/sources/tech/20190930 Cacoo- A Lightweight Online Tool for Modelling AWS Architecture.md new file mode 100644 index 0000000000..428c68007a --- /dev/null +++ b/sources/tech/20190930 Cacoo- A Lightweight Online Tool for Modelling AWS Architecture.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cacoo: A Lightweight Online Tool for Modelling AWS Architecture) +[#]: via: (https://opensourceforu.com/2019/09/cacoo-a-lightweight-online-tool-for-modelling-aws-architecture/) +[#]: author: (Magesh Kasthuri https://opensourceforu.com/author/magesh-kasthuri/) + +Cacoo: A Lightweight Online Tool for Modelling AWS Architecture +====== + +[![AWS][1]][2] + +_Cacoo is a simple and efficient online tool that can be used to model diagrams for AWS architecture. It is not specific to AWS architecture and can be used for UML modelling, cloud architecture for GCP, Azure, network architecture, etc. However, this open source tool is one of the most efficient in architecture modelling for AWS solutions._ + +For a cloud architect, representing the solution’s design as an architecture diagram is much more helpful in explaining the details visually to target audiences like the IT manager, the development team, business stakeholders and the application owner. Though there are many tools like Sparkx Enterprise Architect, Rational Software Modeler and Visual Paradigm, to name a few, these are not so sophisticated and flexible enough for cloud architecture modelling. Cacoo is an advanced and lightweight tool that has many features to support AWS cloud modelling, as can be seen in Figures 1 and 2. + +![Figure 1: Template options for AWS architecture diagram][3] + +![Figure 2: Sample AWS architecture diagram in Cacoo][4] + +![Figure 3: AWS diagram options in Cacoo][5] + +Though AWS provides developer tools, there is no built-in tool provided for solution modelling and hence we have to choose an external tool like Cacoo for the design preparation. + +We can start with solution modelling in Cacoo either by using the AWS diagram templates, which list pre-built templates for standard architecture diagrams like the network diagram, DevOps solutions, etc. If you want to develop a custom solution from the list of shapes available in the Cacoo online editor, you can choose AWS components like compute, storage, network, analytics, AI tools, etc, and prepare custom architecture to suit your solution, as shown in Figure 2. + +There are connectors available to relate the components (for example, how network communication happens, and how ELB or elastic load balancing branches to EC2 storage). Figure 3 lists sample diagram shapes available for AWS architecture diagrams in Cacoo. + +![Figure 4: Create an IAM role to connect to Cacoo][6] + +![Figure 5: Add the policy to the IAM role to enable Cacoo to import from the AWS account][7] + +**Integrating Cacoo with an AWS account to import architecture** +One of the biggest advantages of Cacoo compared to other cloud modelling tools is that it can import architecture from an AWS account. We can connect to an AWS account, and Cacoo selects the services created in the account with the role attached and prepares an architecture diagram, on the fly. + +For this, we need to first create an IAM (Identity and Access Management) role in the AWS account with the account ID and external ID as given in the Cacoo Import AWS Architecture account (Figure 4). + +Then we need to add a policy to the IAM role in order to access the components attached to this role from Cacoo. For policy creation, we have sample policies available in Cacoo’s Import AWS Architecture wizard. We just need to copy and paste the policy as shown in Figure 5. + +Once this is done, the IAM role is created in the AWS account. Now we need to copy the role ARN (Amazon Resource Name) from the new role created and paste it in Cacoo’s Import AWS Architecture wizard as shown in Figure 6. This imports the architecture of the services created in the account, which is attached to the IAM role we have created and displays it as an architecture diagram. + +![Figure 6: Cacoo’s AWS Architecture Import wizard][8] + +![Figure 7: Cacoo’ worksheet with AWS imported architecture][9] + +Once this is done, we can see the architecture in Cacoo’s worksheet (Figure 7). We can print or export the architecture diagram into PPT, PNG, SVG, PDF, etc, for an architecture document, or for poster printing and other technical discussion purposes, as needed. +Cacoo is one of the most powerful cloud architecture modelling tools and can be used for visual designs for AWS architecture, on the fly, using online tools without installing any software. The online account is accessible from anywhere and can be used for quick architecture presentation. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/cacoo-a-lightweight-online-tool-for-modelling-aws-architecture/ + +作者:[Magesh Kasthuri][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://opensourceforu.com/author/magesh-kasthuri/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/07/AWS.jpg?resize=696%2C427&ssl=1 (AWS) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/07/AWS.jpg?fit=750%2C460&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-Template-options-for-AWS-architecture-diagram.jpg?resize=350%2C262&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Sample-AWS-architecture-diagram-in-Cacoo.jpg?resize=350%2C186&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-3-AWS-diagram-options-in-Cacoo.jpg?resize=350%2C337&ssl=1 +[6]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-4-Create-an-IAM-role-to-connect-to-Cacoo.jpg?resize=350%2C228&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-5-Add-the-policy-to-the-IAM-role-to-enable-Cacoo-to-import-from-the-AWS-account.jpg?resize=350%2C221&ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-6-Cacoo%E2%80%99s-AWS-Architecture-Import-wizard.jpg?resize=350%2C353&ssl=1 +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-7-Cacoo%E2%80%99s-worksheet-with-AWS-imported-architecture.jpg?resize=350%2C349&ssl=1 diff --git a/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md b/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md new file mode 100644 index 0000000000..5de0f02b79 --- /dev/null +++ b/sources/tech/20190930 How the Linux screen tool can save your tasks - and your sanity - if SSH is interrupted.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted) +[#]: via: (https://www.networkworld.com/article/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How the Linux screen tool can save your tasks – and your sanity – if SSH is interrupted +====== +The Linux screen command can be a life-saver when you need to ensure long-running tasks don't get killed when an SSH session is interrupted. Here's how to use it. +Sandra Henry-Stocker + +If you’ve ever had to restart a time-consuming process because your SSH session was disconnected, you might be very happy to learn about an interesting tool that you can use to avoid this problem – the **screen** tool. + +Screen, which is a terminal multiplexor, allows you to run many terminal sessions within a single ssh session, detaching from them and reattaching them as needed. The process for doing this is surprising simple and involves only a handful of commands. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][1] ]** + +To start a screen session, you simply type **screen** within your ssh session. You then start your long-running process, type **Ctrl+A Ctrl+D** to detach from the session and **screen -r** to reattach when the time is right. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +If you’re going to run more than one screen session, a better option is to give each session a meaningful name that will help you remember what task is being handled in it. Using this approach, you would name each session when you start it by using a command like this: + +``` +$ screen -S slow-build +``` + +Once you have multiple sessions running, reattaching to one then requires that you pick it from the list. In the commands below, we list the currently running sessions before reattaching one of them. Notice that initially both sessions are marked as being detached. + +Advertisement + +``` +$ screen -ls +There are screens on: + 6617.check-backups (09/26/2019 04:35:30 PM) (Detached) + 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) +2 Sockets in /run/screen/S-shs +``` + +Reattaching to the session then requires that you supply the assigned name. For example: + +``` +$ screen -r slow-build +``` + +The process you left running should have continued processing while it was detached and you were doing some other work. If you ask about your screen sessions while using one of them, you should see that the session you’re currently reattached to is once again “attached.” + +``` +$ screen -ls +There are screens on: + 6617.check-backups (09/26/2019 04:35:30 PM) (Attached) + 1946.slow-build (09/26/2019 02:51:50 PM) (Detached) +2 Sockets in /run/screen/S-shs. +``` + +You can ask what version of screen you’re running with the **-version** option. + +``` +$ screen -version +Screen version 4.06.02 (GNU) 23-Oct-17 +``` + +### Installing screen + +If “which screen” doesn’t provide information on screen, it probably isn't installed on your system. + +``` +$ which screen +/usr/bin/screen +``` + +If you need to install it, one of the following commands is probably right for your system: + +``` +sudo apt install screen +sudo yum install screen +``` + +The screen tool comes in handy whenever you need to run time-consuming processes that could be interrupted if your SSH session for any reason disconnects. And, as you've just seen, it’s very easy to use and manage. + +Here's a recap of the commands used above: + +``` +screen -S start a session +Ctrl+A Ctrl+D detach from a session +screen -ls list sessions +screen -r reattach a session +``` + +While there is more to know about **screen**, including additional ways that you can maneuver between screen sessions, this should get you started using this handy tool. + +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/3441777/how-the-linux-screen-tool-can-save-your-tasks-and-your-sanity-if-ssh-is-interrupted.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.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&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/sources/tech/20191001 How to create the data structure for a Corteza Low Code application.md b/sources/tech/20191001 How to create the data structure for a Corteza Low Code application.md new file mode 100644 index 0000000000..6e065ac302 --- /dev/null +++ b/sources/tech/20191001 How to create the data structure for a Corteza Low Code application.md @@ -0,0 +1,225 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create the data structure for a Corteza Low Code application) +[#]: via: (https://opensource.com/article/19/10/corteza-low-code-data-structure) +[#]: author: (Lenny Horstink https://opensource.com/users/lenny-horstink) + +How to create the data structure for a Corteza Low Code application +====== +Corteza is an open source alternative to Salesforce. Learn how to use it +in this series. +![Green graph of measurements][1] + +In the [first article][2] in this series, I showed how to create a custom application to track donations using Corteza Low-Code, a graphical user interface- (GUI) and web-based development environment that serves as an alternative to Salesforce. So far, the Donations application merely exists, but this article explains how to make it do something by populating it with a data structure using modules and fields. + +Modules and fields exist inside your application. (In programming terminology, they are "locally defined.") Modules and fields define places where data is stored in your application. Without modules and fields, your application has no memory nor anything to work with, so defining them is the next step when creating a new app. + +The [Donations application][3] is available on the Corteza community server. You need to be logged in or create a free Corteza community server account to check it out. + +### Enter the application's admin area + +To enter the admin area of an application, you first need to open the application inside Corteza Low-Code. To enter the Donations application created in the first part of this series: + + 1. Enter Corteza. (Read [_Intro to Corteza, an open source alternative to Salesforce_][4] if you need some background on this.) + 2. Click on the **+** button to create a new tab. + 3. Select Corteza Low-Code. + 4. Click on the Donations namespace to enter the Donations application. + + + +Since the Donations application doesn't have any modules or pages yet, the only thing you see is an **Admin panel** link on the right. If the applications had pages, it would show the main menu and the **Admin panel** link on the far right. + +![Open Corteza Low Code admin panel][5] + +Click on it to enter the application's admin area. There are four menu items: + +![Corteza Low Code admin panel menu][6] + + * **Modules:** Create or edit modules and fields + * **Pages:** Define the visual part of your application + * **Charts:** Create charts to add to pages + * **Automation:** Add automation rules to automate business processes and workflows + + + +The **Public pages** link takes you back to your application. + +### Create modules and fields + +Modules and fields define what data you need to store in your application and how that data links to other data. If you've ever built a database with [LibreOffice Base][7], Filemaker Pro, or a similar application, this might feel familiar—but you don't need any database experience to work with Corteza. + +#### Modules + +A module is like a table in a database. A simple application typically has a few modules, while bigger applications have many more. Corteza CRM, for example, has over 35. The number of modules an application can have is unlimited. + +A new application does not have any modules. You can create one by using the form on top or by importing an existing module from a different application using an export file. You can import and export individual modules or all modules at the same time. + +When you create a module, best practice is to give it a descriptive name without spaces and using capital letters on different words, e.g., _Lead_, _Account_, or _CaseUpdate_. + +The Donations application includes the following modules: + + * **Contact:** To store the donor's contact data + * **ContactDonation:** To track a contact's donation(s) + * **Project:** To store a project you can assign donations to + * **Note:** To store notes related to a project + + + +![Donations application modules][8] + +#### Fields + +Each module consists of a set of fields that define what data you want to store and in what format. + +You can add new fields to a module by using the **Add new field** button. This adds a new row with the following fields: + + * **Name:** It must be unique and cannot have spaces, e.g., "firstname." This is not shown to the end user. + * **Title:** This is the field's label—the field name the end users see when they view or edit a record. It can contain any character, including spaces. Although it's best practice to keep this title unique, it's not mandatory. An example is "First name." + * **Type:** This is where you set the field type. The wrench icon on the right allows you to set more detailed data for the field type. + * **Multiple values:** This checkbox is available when you want a field type to allow multiple value entries. + * **Required:** This makes the field mandatory for the end user when creating or editing a record. + * **Sensitive:** This allows you to mark data that is sensitive, such as name, email, or telephone number, so your application is compliant with privacy regulations such as the [GDPR][9]. + + + +At the end of the row, you can find a **Delete** button (to remove a field) and a **Permission** button (to set read permissions and update field permissions per role). + +### Field types + +You can select from the following field types. The wrench icon beside the field type provides further options for each case. + + * **Checkbox (Y/N):** This field shows a checkbox to the end user when editing a record. When you click on the wrench icon, you can select what checked and unchecked represent. For example: Yes/No, Active/Inactive, etc. + * **DateTime:** This makes a date field. You can select: + * Date only + * Time only + * Past values only + * Future value only + * Output relative value (e.g., three days ago) + * Custom output format (see [Moment.js][10] for formatting options) + * **Email:** This field auto-validates whether the input is an email and turns it into a clickable email link in record-viewing mode. You can select the **Don't turn email into a link** option to remove the auto-link feature. + * **Select:** When you click on the wrench icon, you can use the **Add** button to add as many Select options as you need. You can also set whether the end user can select multiple values at once. + * **Number:** This field gives you the option to add a prefix (for example a $ for values in dollars), a suffix (for example % for a number that represents a percentage), and the decimal precision (e.g., zero for whole numbers or two for values like 1.13, 2.44, 3.98), and you can use the **Format Input** field to create more complex formats. + * **Record:** This field allows you to link the current module to another module. It will show as a Select to the end user. You can select the module in the **Module name** field and choose the field to use to load the Select options. In **Query fields on search**, you can define what fields you want the user to be able to search on. As with the **Select** field type, you can set whether the user can select multiple values at once. + * **String:** By default, a String field is a single-line text-input field, but you can choose to make it multi-line or even a rich text editor. + * **URL:** The URL field automatically validates whether the field is a link to a site. You can select the following options for this field: + * Trim # from the URL + * Trim ? from the URL + * Only allow SSL (HTTPS) URLs + * Don't turn URL into a link + * **User:** This creates a Select field that loads with all users in Corteza. You can preset the value to the current user. + * **File:** This creates a **File Upload** button for the end user. + + + +#### Field types in the Donations application + +The Donations application includes the following fields in its four modules. + +##### 1\. Contact + +![Contact module][11] + + * Name (String) + * Email (Email) + * Phone (String) + * Address (String; _Multi-line_) + + + +##### 2\. ContactDonation + +![Corteza Donations app modules][12] + + * Contact (Record; link to **Contact**) + * Donation (Number; _Prefix $_ and _Precision 2_) + * Project (Record; link to **Project**) + + + +##### 3\. Project + +![Project module][13] + + * Name (String) + * Description (String; _Multi-line_ and _Use rich text editor_) + * Status (Select; with options _Planning_, _Active_, and _Finished_) + * Start date (DateTime; _Date only_) + * Website link (URL) + * Donations total (Number; _Prefix $_ and _Precision 2_) + * Project owner (User; _Multiple select_ and _Preset with current user_) + + + +##### 4\. Notes + +![Notes module][14] + + * Project (Record; link to **Project**) + * Subject (String) + * Note (String; _Multi-line_ and _Use rich text editor_) + * File (File; _Single image_) + + + +### Create relationships between modules + +Practically every Corteza Low Code application consists of multiple modules that are linked together. For example, projects can have notes or donations can be assigned to different projects. The **Record** field type creates relationships between modules. + +The **Record** field type's basic function is to link from module B back to module A. Records in module B are children of records in module A (you could say it's a 1-N relationship). + +For example, in the Donations application, the module **Note** has a **Record** field that links to the module **Project**. The end user will see a **Select** field in a **Note** record with the value of the **Project** that the note pertains to. + +To create this relationship in the Donations application, select the wrench icon in the **projectId** row: + +![Wrench icon][15] + +In the popup that opens, select the module the field will link to, the label end users will see, and which fields the end user can search on.  + +![Setting query fields for search][16] + +This creates a simple relationship that allows the **Project** to have **Notes**. A many-to-many relationship between modules is more complex. For example, the Donations application needs to support contacts who make multiple donations and donations that are assigned to different projects. The **ContactDonation** module sits in the middle to manage this. + +This module has two fields of the **Record** type. For each, we need to select the correct module and set the label and query fields the user can search on. The Donations application needs the following to be set for the **Contact** and **Project** modules: + +![Contact module field settings][17] + +![Project module field settings][18] + +This creates a many-to-many relationship between modules. + +You've now set up a structure for the data in your application. The next step is to create the visual side of your app using Corteza's **Pages** feature. It's easier than you might expect, as you'll see in the third article in this series. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/corteza-low-code-data-structure + +作者:[Lenny Horstink][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/lenny-horstink +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: https://opensource.com/article/19/9/how-build-application-corteza-low-code-open-source-alternative-salesforce +[3]: https://latest.cortezaproject.org/compose/ns/donations/ +[4]: https://opensource.com/article/19/8/corteza-open-source-alternative-salesforce +[5]: https://opensource.com/sites/default/files/uploads/corteza_donationsadminpanel.png (Open Corteza Low Code admin panel) +[6]: https://opensource.com/sites/default/files/uploads/corteza_donationsmenuadminpanel.png (Corteza Low Code admin panel menu) +[7]: https://www.libreoffice.org/discover/base/ +[8]: https://opensource.com/sites/default/files/uploads/corteza_donationstmodules.png (Donations application modules) +[9]: https://eugdpr.org/ +[10]: https://momentjs.com/docs/#/displaying/format/ +[11]: https://opensource.com/sites/default/files/uploads/corteza_contactmodulefields.png (Contact module) +[12]: https://opensource.com/sites/default/files/uploads/corteza_contactdonationmodule.png (Corteza Donations app modules) +[13]: https://opensource.com/sites/default/files/uploads/corteza_projectmodule.png (Project module) +[14]: https://opensource.com/sites/default/files/uploads/corteza_notesmodule.png (Notes module) +[15]: https://opensource.com/sites/default/files/uploads/corteza_createrelationshipicon.png (Wrench icon) +[16]: https://opensource.com/sites/default/files/uploads/corteza_queryfieldsonsearch.png (Setting query fields for search) +[17]: https://opensource.com/sites/default/files/uploads/corteza_modulefieldsettings-contact.png (Contact module field settings) +[18]: https://opensource.com/sites/default/files/uploads/corteza_modulefieldsettings-project.png (Project module field settings) diff --git a/sources/tech/20191001 The Best Android Apps for Protecting Privacy and Keeping Information Secure.md b/sources/tech/20191001 The Best Android Apps for Protecting Privacy and Keeping Information Secure.md new file mode 100644 index 0000000000..6e47df1e3a --- /dev/null +++ b/sources/tech/20191001 The Best Android Apps for Protecting Privacy and Keeping Information Secure.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Best Android Apps for Protecting Privacy and Keeping Information Secure) +[#]: via: (https://opensourceforu.com/2019/10/the-best-android-apps-for-protecting-privacy-and-keeping-information-secure/) +[#]: author: (Magimai Prakash https://opensourceforu.com/author/magimai-prakash/) + +The Best Android Apps for Protecting Privacy and Keeping Information Secure +====== + +[![][1]][2] + +_Privacy violations and data theft occur every day, making it necessary for all of us to safeguard our data. We trust our smartphones way too much and tend to store personal data on them, ignoring the fact that these devices could easily be compromised. However, there are a few open source apps that can ensure the data on your phone is not compromised. This article lists the best ones._ + +Everyone is becoming aware about information security. There are plenty of privacy and security apps available in the Google Play store too, but it is not easy to select the right one. Most users prefer free apps, but some of these offer only limited functionality and force users to upgrade to a premium membership, which many cannot afford. + +This article sheds light on some FOSS Android apps that will really help in safeguarding your privacy. + +![Figure 1: Safe Notes][3] + +![Figure 2: Exodus Privacy][4] + +**Safe Notes** +Safe Notes is a companion app for the Protected Text website (__). It is an online encrypted notepad which offers space on a separate site for users to store their notes. To use this service, you do not need to sign up with the website. Instead, you need to choose a site name and a password to protect it. + +You have two options to use Safe Notes — you can either use this app to save your notes locally, or you can import your existing Protected Text site in the app. In the latter case, you can synchronise your notes between the app as well as in the Protected Text website. + +By default, all the notes will be in an unlocked state. After you have saved your notes, if you want to encrypt them, click on the key icon beside your note and you will be prompted to give a password. After entering the password of your choice, your note will be encrypted and instead of the key icon, you will see an unlocked icon in its place, which means that your note is not locked. To lock your note, click the ‘Unlocked’ icon beside your note — your note will get locked and the password will be removed from your device. + +Passwords that you are using are not transmitted anywhere. Even if you are using an existing Protected Text site, your passwords are not transmitted. Only your encrypted notes get sent to the Protected Text servers, so you are in total control. But this also means that you cannot recover your password if you lose it. + +Your notes are encrypted by the AES algorithm and SHA 12 for hashing, while SSL is used for data transmission. + +![Figure 3: Net Guard][5] + +**Exodus Privacy** +Have you ever wondered how many permissions you are granting to an Android app? While you can see these in the Google Play store, you may not know that some of those permissions are impacting your privacy more severely than you realise. + +While permissions are taking control of your device with or without your knowledge, third party trackers also compromise your privacy by stealthily collecting data without your consent. And the worst part is that you have no clue as to how many trackers you have in your Android app. + +To view the permissions for an Android app and the trackers in it, use Exodus Privacy. + +Exodus Privacy is an Android app that has been created and maintained by a French non-profit organisation. While the app is not capable of any analysis, it will fetch reports from the Exodus Platform for the apps that are installed in your device. + +These reports are auto-generated by using the static analysis method and, currently, the Exodus platform contains 58,392 reports. Each report gives you information about the number of trackers and permissions. + +Permissions are evaluated using the three levels of Google Permission Classification. These are ‘Normal’, ‘Signature’ and ‘Dangerous’. We should be concerned about the ‘Dangerous’ level because such permissions can access the user’s private and other stored sensitive data. + +Trackers are also listed in this app. When you click on a tracker, you will be taken to a page which shows you the other Android apps that have that particular tracker. This can be really useful to know if the same tracker has been used in the other apps that you have installed. + +In addition, the reports will contain information such as ‘Fingerprint’ and other geographical details about the app publisher such as ‘Country’, ‘State’ and ‘Locality’. + +![Figure 4: xBrowserSync][6] + +![Figure 5: Scrambled Exif][7] + +**Net Guard** +Most Android apps need network access to function properly, but offline apps don’t need this to operate. Yet some of these offline apps continue to run in the background and use network access for some reason or the other. As a result, your battery gets drained very quickly and the data plan on your phone gets exhausted faster than you think. + +Net Guard solves this problem by blocking the network access to selected apps. Net Guard will only block the outgoing traffic from apps, not what’s incoming. + +The Net Guard main window displays all the installed apps. For every app you will see the ‘mobile network’ icon and the ‘Wi-Fi’ icon. When they are both green, it means that Net Guard will allow the app to have network access via the mobile network and Wi-Fi. Alternatively, you can enable any one of them; for example, you can allow the app to use the Internet only via the mobile network by clicking on the ‘Mobile network’ icon to turn it green while the ‘Wi-Fi’ icon is red. + +When both the ‘Mobile network’ and ‘Wi-Fi’ icons are red, the app’s outgoing traffic is blocked. +Also, when ‘Lockdown’ mode is enabled, it will block the network access for all apps except those that are configured to have network access in the ‘Lockdown’ mode too. This is useful when you have very little battery and your data plan is about to expire. + +Net Guard can also block network access to the system apps, but please be cautious about this because sometimes, when the user blocks Internet access to some critical system apps, it could result in a malfunction of other apps. + +**xBrowserSync** +xBrowserSync is a free and open source service that helps to sync bookmarks across your devices. Most of the sync services require you to sign up and keep your data with them. + +xBrowserSync is an anonymous and secure service, for which you need not sign up. To use this service you need to know your sync ID and have a strong password for it. + +Currently, xBrowserSync supports the Mozilla and Chrome browsers; so if you’re using either one of them, you can proceed further. Also, if you have to transfer a huge number of bookmarks from your existing service to xBrowserSync, it is advised that you have a backup of all your bookmarks before you create your first sync. + +You can create your first sync by entering a strong password for it. After your sync is created, a unique sync ID will be shown to you, which can be used to sync your bookmarks across your devices. + +xBrowserSync encrypts all your data locally before it is synced. It also uses PBKDF2 with 250,000 iterations of SHA-256 for the key derivation to combat brute force attacks. Apart from that, It uses PBKDF2 with 250,000 iterations of SHA-256 for the key derivation to combat brute force attacks. And it uses AES-GCM with a random 16 byte IV (Initialization Vector- a random number that is used with secret key to encrypt the data) with 32-bit char sync ID of the user as a salt value. All of these are in place to ensure that your data cannot be decrypted without your password. + +The app provides you with a sleek interface that makes it easy for you to add bookmarks, and share and edit them by adding descriptions and tags to them. + +xBrowserSync is currently hosted by four providers, including the official one. So to accommodate all the users, the synced data that isn’t accessed for a long time is removed. If you don’t want to be dependent on other providers, you can host xBrowserSync for yourself. + +![Figure 6: Riseup VPN][8] + +**Scrambled Exif** +When we share our photos on social media, sometimes we share the metadata on those photos accidentally. Metadata can be useful for some situations but it can also pose a serious threat to your privacy. A typical photo may consist of the following pieces of data such as ‘date and time’, ‘make and model of the camera’, ‘phone name’ and ‘location’. When all these pieces of data are put together by a system or by a group of people, they are able to determine your location at that particular time. + +So if you want to share your photos with your friends as well as on social media without divulging metadata, you can use Scrambled Exif. + +Scrambled Exif is a free and open source tool which removes the Exif data from your photos, after installing the app. So when you want to share a photo, you have to click on the ‘Share’ button from the photo, and it will show you the available options for sharing — choose ‘Scrambled Exif’. Once you have done that, all your metadata is removed from that photo, and you will again be shown the share list. From there on, you can share your photos normally. + +**Riseup VPN** +Riseup VPN (Virtual Private Network) is a tool that enables you to protect your identity, as well as bypass the censorship that is imposed on your network and the encryption of your Internet traffic. Some VPN service providers log your IP address and quietly betray your trust. + +Riseup VPN is a personal VPN service offered by the Riseup Organization, which is a non-profit that fights for a free Internet by providing tools and other resources for anyone who wants to enjoy the Internet without being restrained. + +To use the Riseup VPN, you do not need to register, nor do you need to configure the settings — it is all prepped for you. All you need is to click on the ‘Turn on’ button and within a few moments, you can see that your traffic is routed through the Riseup networks. By default, Riseup does not log your IP address. + +At present, Riseup VPN supports the Riseup networks in Hong Kong and Amsterdam. + +![Figure 7: Secure Photo Viewer][9] + +**Secure Photo Viewer** +When you want to show a cool picture of yours to your friends by giving your phone to them, some of them may get curious and go to your gallery to view all your photos. Once you unlock the gallery, you cannot control what should be shown and what ought to be hidden, as long as your phone is with them. + +Secure Photo Viewer fixes this problem. After installing it, choose the photos or videos you want to show to a friend and click ‘share’. This will show ‘Secure Photo Viewer’ in the available options. Once you click on it, a new window will open and it will instruct you to lock your device. Within a few seconds the photo you have chosen will show up on the screen. Now you can show your friends just that photo, and they can’t get into your gallery and view the rest of your private photos. + +Most of the apps listed here are available on F-Droid as well as on Google Play. I recommend using F-Droid because every app has been compiled via its source code by F-Droid itself, so it is unlikely to have malicious code injected in it. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-best-android-apps-for-protecting-privacy-and-keeping-information-secure/ + +作者:[Magimai 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://opensourceforu.com/author/magimai-prakash/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Android-Apps-security.jpg?resize=696%2C658&ssl=1 (Android Apps security) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Android-Apps-security.jpg?fit=890%2C841&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-Safe-Notes.jpg?resize=211%2C364&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Exodus-Privacy.jpg?resize=225%2C386&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-3-Net-Guard.jpg?resize=226%2C495&ssl=1 +[6]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-4-xBrowserSync.jpg?resize=251%2C555&ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-5-Scrambled-Exif-350x535.jpg?resize=235%2C360&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-6-Riseup-VPN.jpg?resize=242%2C536&ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-7-Secure-Photo-Viewer.jpg?resize=228%2C504&ssl=1 diff --git a/sources/tech/20191002 How to create the user interface for your Corteza Low Code application.md b/sources/tech/20191002 How to create the user interface for your Corteza Low Code application.md new file mode 100644 index 0000000000..52056a29ac --- /dev/null +++ b/sources/tech/20191002 How to create the user interface for your Corteza Low Code application.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create the user interface for your Corteza Low Code application) +[#]: via: (https://opensource.com/article/19/10/corteza-low-code-user-interface) +[#]: author: (Lenny Horstink https://opensource.com/users/lenny-horstink) + +How to create the user interface for your Corteza Low Code application +====== +Add a user-friendly interface to your application built in Corteza Low +Code, an open source alternative to Salesforce. +![metrics and data shown on a computer screen][1] + +In the first two articles in this series, I explained how to use Corteza Low Code to [create an application][2] to track donations and [set up its data structure][3] with modules and fields. In the third article, I will explain how to create the graphical part of the Donations application. + +**Pages** is the HTTP web layer of Corteza Low Code. For comfort of design and to ensure your application is responsive and mobile-ready by default, Pages are built-in blocks. Each block can be resized and dragged wherever you desire. In all blocks, you can define the title, the description, and the layout. + +There are two types of pages: **Record** pages (which show data for or related to a single record) and **List** pages (which show a searchable list of multiple records). Each type is described below. + +### Record pages + +A module without a Record page cannot do anything. To store data inside a module, you need to create a Record page and add it to a module by selecting the appropriate **Page builder** button on the **Modules** page. This opens the drag-and-drop page editor. + +The Donations application has four modules, and each one has the **Page builder** link: + +![Page Builder Link][4] + +First, create the record page for the **Contact** module. When you click on the **Page builder** link, an empty record page opens. Add blocks with the **\+ Add block** button. + +![Add block button][5] + +There are multiple block types available. + +![Block types][6] + +The "Contact" record page in the "Donations" application uses two block types: **Record** and **Record list**. + +#### Record blocks + +The **Record** block is the most important block for a Record page. You can select the block's layout and the fields you want to show. The **Contact** record page needs to show: _Name_, _Email_, _Phone,_ and _Address_. Select those fields and hit **Save and close**, and the block will be added. + +![Form to change Record block][7] + +When you view a record, the values of these fields are shown as strings, and when you add or edit a record, these fields turn into form-input fields. + +Tip: You can drag-and-drop the fields and place them in any order you prefer. + +#### Record list blocks + +The **Contact** page will show the list of donation each contact has given. Create a list of records by selecting the **Record list** block. + +Make **Donations** the title, and select the **ContactDonation** module in the **Module** field. After selecting a module, the columns that are available are populated automatically, and you can select the columns you want to show in the **Record list**: _Donation_, _Project_, and the system field _Created at_. + +If you saved the **Record list** block right now, you would see all donations from all contacts. Because you want to show the donations related to a single contact record, you need to add a **prefilter**. + +The **Prefilter records** field allows simplified SQL "Where" conditions, and variables like **${recordID}**, **${ownerID}**, and **${userID}** are evaluated (when available). For the **Record list**, you want to filter **ContactDonation** records by contact, so you need to fill in: **${recordID} = contactId**. Note: **contactId** is a **Record** field in the module **ContactDonation**. Take a look back at the [second article][3] in this series for more info about linking modules. + +You also want to be able to sort a contact's donations by date. This can be done in the **Presort records** field by inserting **createdAt DESC**. This field supports simplified SQL _Order by_ condition syntax. + +You can also select to hide or show the **New record** button and Search box, and you can define the number of records shown. A best practice is to adjust this number to the size of the block. + +![Form to change Record list block][8] + +To save the block and add it to the page, hit **Save and close**. Now the second block has been added to the page. + +#### Other block types + +Other block types are: + + * **Content:** This block allows you to add fixed text, which you can create with a rich text editor. This is ideal for "help" texts or links to resources, such as the sales handbook on an intranet. + * **Chart:** Inserts charts that have been created with the chart builder. This is very useful when you are creating dashboards. + * **Social media feed:** You can show live content from Twitter here—either a fixed Twitter feed (which is shown in all records) or from a Module field that represents a Twitter link (which enables each record to have his own feed). + * **Automation:** In this block, you can add automation rules that have a manual trigger and that are available for the module, as well as automation rules with no primary module. They are shown to end users as buttons. You can format the automation rule buttons by inserting custom text and selecting a style, and you can change the order of them (when you have multiple buttons) with a drag-and-drop. + * **Calendar:** This block inserts a calendar, which can be shown in the following formats: + * Month + * Month agenda + * Week agenda + * Day agenda + * Month list + * Week list + * Day list The source of the calendar is a list of records from one or multiple modules. For each source, you can select which field represents the title, start date, and end date of the event. + * **File:** You can upload a file and show it on the page. Just like the **Content** block, the content of this block will be the same for all records. To have files that are related to a record, you need to use the **File** field type when creating fields in a module. + + + +Next, add the Record pages for the other modules in the Donations application. Once that is done, you will see the following list under **Pages**: + +![List of pages][9] + +### Change the page layout + +After adding blocks to pages, such as the **Contact Details** and **Donations** blocks in the **Contact** module's Record page, you can resize and position them to create the layout you want. + +![Moving blocks around][10] + +The end result is: + +![Corteza layout][11] + +Corteza Low-Code is responsive by default, so the blocks will resize and reposition automatically on devices with small screens. + +### List pages + +List pages are not related to any single record; rather, they show lists of records. This page type is used to create a home page, list of contacts, list of projects, dashboards, etc. List pages are important because you can't enter new records without viewing a list because the **Add new record** button is shown on lists. + +For the Donations application, create the following list pages: _Home_, _Contacts_, and _Projects_. + +To create a List page, you need to go to the **Pages** administrative page and enter a title in the **Create a new page** box at the top. When you submit this form, it opens the **Edit page** form, which allows you to add a page description (for internal use; the end user will not see it), and you can set the page to **Enabled** so it can be accessed. + +Your list of pages will now look like: + +![List of pages][12] + +You can drag-and-drop to rearrange this to: + +![List of pages][13] + +Rearranging pages makes it easier to maintain the application. It also allows you to generate the application menu structure because List pages (but not Record pages) are shown as menu items. + +Adding content to each List page is exactly the same as adding blocks to Record pages. The only difference is that you cannot select the **Record** block type (because it is related to a single record). + +### Create a menu + +The menu in a Corteza Low-Code application is automatically generated by the tree of pages on the admin page **Pages**. It only shows List pages and ignores Record pages. + +To reorder the menu, simply drag-and-drop the pages in the desired order within the tree of pages. + +### Add charts + +Everybody loves charts and graphs. If pictures are worth 1,000 words, then you can create a priceless application in Corteza. + +Corteza Low-Code comes with a chart builder that allows you to build line, bar, pie, and donut charts: + +![Chart types available in Corteza Low Code][14] + +As an example, add a chart that shows how many donations have been made to each Project. To begin, enter the **Charts** page in the admin menu. + +![Corteza charts admin page][15] + +To create a new chart, use the **Create a new chart** field. + +Inside the chart builder, you will find the following fields: + + * **Name:** Enter a name for the chart; e.g., _Donations_. + * **Module:** This is the module that provides the data to the chart. + * **Filters:** You can select one of the predefined filters, such as **Records created this year**, or add any custom filter (such as **status = "Active"**). + * **Dimensions:** These can be **Datetime** and **Select** fields. Datetime fields allow grouping (e.g., by day, by week, by month). The **Skip missing values** option is handy to remove values that would return null (e.g., records with incomplete data), and **Calculate how many labels can be shown** can avoid overlapping labels (which is useful for charts with many dates on the X-axis). + * **Metrics:** Metrics are numeric fields and have a predefined _count_ option. You can add multiple metric blocks and give each a different label, field (source), function (COUNTD, SUM, MAX, MIN, AVG, or STD, if possible), output (line or bar), and color. + + + +This sample chart uses the **ContactDonation** module and shows total donations per day. + +![Chart of donations per day][16] + +The final step is to add a chart to a page. To add this chart to the home page: + + * Enter **Pages** in the admin menu. + * Click on the **Page builder** link of the **Home** page. + * Add a page block of the type **Chart**, add a block title, and select the chart. + * Resize and reposition the block (or blocks) to make the layout look nice. + + + +![Chart added][17] + +When you save the page and enter your Donation application (via the **Public pages** link on the top right), you will see the home page with the chart. + +![Chart displayed on Corteza UI][18] + +### Add automation + +Automation can make your Corteza Low Code application more efficient. With the Automation tool, you can create business logic that evaluates records automatically when they are created, updated, or deleted, or you can execute a rule manually. + +Triggers are written in JavaScript, one of the most used programming languages in the world, enabling you to write simple code that can evaluate, calculate, and transform data (such as numbers, strings, or dates). Corteza Low Code comes with extra functions that allow you to access, create, save, or delete records; find users; send notifications via email; use Corteza Messaging; and more. + +[Corteza CRM][19] has an extensive set of automation rules that can be used as examples. Some of them are: + + * Account: Create new case + * Account: Create new opportunity + * Case: Insert case number + * Contract: Send contract to custom email + * Lead: Convert a lead into an account and opportunity + * Opportunity: Apply price book + * Opportunity: Generate new quote + * Quote: Submit quote for approval + + + +A complete manual on how to use the automation module, together with code examples, is in development. + +### Deploy an application + +Deploying a Corteza Low Code application is very simple. As soon as it's Enabled, it's deployed and available in the Corteza Low Code Namespaces menu. Once deployed, you can start using your application! + +### For more information + +As I mentioned in parts 1 and 2 of this series, the complete Donations application created in this series is available on the [Corteza community server][20]. You need to be logged in or create a free Corteza community server account to check it out. + +Also, check out the documentation on the [Corteza website][21] for other, up-to-date user and admin tutorials. + +If you have any questions—or would like to contribute—please join the [Corteza Community][22]. After you log in, please introduce yourself in the #Welcome channel. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/corteza-low-code-user-interface + +作者:[Lenny Horstink][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/lenny-horstink +[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/19/9/how-build-application-corteza-low-code-open-source-alternative-salesforce +[3]: https://opensource.com/article/19/9/creating-data-structure-corteza-low-code +[4]: https://opensource.com/sites/default/files/uploads/corteza_donationspagebuilderlink.png (Page Builder Link) +[5]: https://opensource.com/sites/default/files/uploads/corteza_addblock.png (Add block button) +[6]: https://opensource.com/sites/default/files/uploads/corteza_blocktypes.png (Block types) +[7]: https://opensource.com/sites/default/files/uploads/corteza_changerecordblock.png (Form to change Record block) +[8]: https://opensource.com/sites/default/files/uploads/corteza_changerecordlistblock.png (Form to change Record list block) +[9]: https://opensource.com/sites/default/files/uploads/corteza_pageslist.png (List of pages) +[10]: https://opensource.com/sites/default/files/uploads/corteza_movingblocks.png (Moving blocks around) +[11]: https://opensource.com/sites/default/files/uploads/corteza_layoutresult.png (Corteza layout) +[12]: https://opensource.com/sites/default/files/uploads/corteza_pageslist2.png (List of pages) +[13]: https://opensource.com/sites/default/files/uploads/corteza_pageslist3.png (List of pages) +[14]: https://opensource.com/sites/default/files/uploads/corteza_charttypes.png (Chart types available in Corteza Low Code) +[15]: https://opensource.com/sites/default/files/uploads/corteza_createachart.png (Corteza charts admin page) +[16]: https://opensource.com/sites/default/files/uploads/corteza_chartdonationsperday.png (Chart of donations per day) +[17]: https://opensource.com/sites/default/files/uploads/corteza_addchartpreview.png (Chart added) +[18]: https://opensource.com/sites/default/files/uploads/corteza_pageshowingchart.png (Chart displayed on Corteza UI) +[19]: https://cortezaproject.org/technology/core/corteza-crm/ +[20]: https://latest.cortezaproject.org/compose/ns/donations/ +[21]: https://www.cortezaproject.org/ +[22]: https://latest.cortezaproject.org/ diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md new file mode 100644 index 0000000000..f2c6638bc4 --- /dev/null +++ b/sources/tech/20191003 4 open source eBook readers for Android.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source eBook readers for Android) +[#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +4 open source eBook readers for Android +====== +Looking for a new eBook app? Check out these four solid, open source +eBook readers for Android. +![Computer browser with books on the screen][1] + +Who doesn't like a good read? Instead of frittering away your time on social media or a [messaging app][2], you can enjoy a book, magazine, or another document on your Android-powered phone or tablet. + +To do that, all you need is the right eBook reader app. So let's take a look at four solid, open source eBook readers for Android. + +### Book Reader + +Let's start off with my favorite open source Android eBook reader: [Book Reader][3]. It's based on the older, open source version of the now-proprietary FBReader app. Like earlier versions of its progenitor, Book Reader is simple and minimal, but it does a great job. + +**Pros of Book Reader:** + + * It's easy to use. + * The app's interface follows Android's [Material Design guidelines][4], so it's very clean. + * You can add bookmarks to an eBook and share text with other apps on your device. + * There's growing support for languages other than English. + + + +**Cons of Book Reader:** + + * Book Reader has a limited number of configuration options. + * There's no built-in dictionary or support for an external dictionary. + + + +**Supported eBook formats:** + +Book Reader supports EPUB, .mobi, PDF, [DjVu][5], HTML, plain text, Word documents, RTF, and [FictionBook][6]. + +![Book Reader Android app][7] + +Book Reader's source code is licensed under the GNU General Public License version 3.0, and you can find it on [GitLab][8]. + +### Cool Reader + +[Cool Reader][9] is a zippy and easy-to-use eBook app. While I think the app's icons are reminiscent of those found in Windows Vista, Cool Reader does have several useful features. + +**Pros of Cool Reader:** + + * It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors. + * You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters. + * It automatically scans your device for new books when you start it up. You can also access books on [Project Gutenberg][10] and the [Internet Archive][11]. + + + +**Cons of Cool Reader:** + + * Cool Reader doesn't have the cleanest or most modern interface. + * While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use. + * The app's default dictionary is proprietary, although you can swap it out for [an open one][12]. + + + +**Supported eBook formats:** + +You can use Cool Reader to browse EPUB, FictionBook, plain text, RTF, HTML, [Compiled HTML Help][13] (.chm), and TCR (the eBook format for the Psion series of handheld computers) files. + +![Cool Reader Android app][14] + +Cool Reader's source code is licensed under the GNU General Public License version 2, and you can find it on [Sourceforge][15]. + +### KOReader + +[KOReader][16] was originally created for [E Ink][17] eBook readers but found its way to Android. While testing it, I found KOReader to be both useful and frustrating in equal measures. It's definitely not a bad app, but it's not my first choice. + +**Pros of KOReader:** + + * It's highly configurable. + * It supports multiple languages. + * It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet). + + + +**Cons of KOReader:** + + * You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book. + * The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel. + + + +**Supported eBook formats:** + +You can view PDF, DjVu, CBT, and [CBZ][5] eBooks. It also supports EPUB, FictionBook, .mobi, Word documents, text files, and [Compiled HTML Help][13] (.chm) files. + +![KOReader Android app][19] + +KOReader's source code is licensed under the GNU Affero General Public License version 3.0, and you can find it on [GitHub][20]. + +### Booky McBookface + +Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well. + +**Pros of Booky McBookface:** + + * There are no frills. It's just you and your eBook. + * The interface is simple and clean. + * Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device. + + + +**Cons of Booky McBookface:** + + * The app has few configuration options—you can change the size of the font and the brightness, and that's about it. + * You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work. + * You can't add bookmarks to an eBook. + + + +**Supported eBook formats:** + +You can read eBooks in EPUB, HTML, or plain text formats with Booky McBookface. + +![Booky McBookface Android app][22] + +Booky McBookface's source code is available under the GNU General Public License version 3.0, and you can find it [on GitHub][23]. + +Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment. + +Have you ever downloaded an Android app only to find that it wants access to all your phone's... + +There is a rich and growing ecosystem of open source applications for mobile devices, just like the... + +With these seven open source apps, you can play chess against your phone or an online opponent,... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-ereaders-android + +作者:[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://opensource.com/article/19/3/open-messenger-client +[3]: https://f-droid.org/en/packages/com.github.axet.bookreader/ +[4]: https://material.io/design/ +[5]: https://opensource.com/article/19/3/comic-book-archive-djvu +[6]: https://en.wikipedia.org/wiki/FictionBook +[7]: https://opensource.com/sites/default/files/uploads/book_reader-book-list.png (Book Reader Android app) +[8]: https://gitlab.com/axet/android-book-reader/tree/HEAD +[9]: https://f-droid.org/en/packages/org.coolreader/ +[10]: https://www.gutenberg.org/ +[11]: https://archive.org +[12]: http://aarddict.org/ +[13]: https://fileinfo.com/extension/chm +[14]: https://opensource.com/sites/default/files/uploads/cool_reader-icons.png (Cool Reader Android app) +[15]: https://sourceforge.net/projects/crengine/ +[16]: https://f-droid.org/en/packages/org.koreader.launcher/ +[17]: https://en.wikipedia.org/wiki/E_Ink +[18]: https://github.com/koreader/koreader/wiki/Dictionary-support +[19]: https://opensource.com/sites/default/files/uploads/koreader-lookup.png (KOReader Android app) +[20]: https://github.com/koreader/koreader +[21]: https://f-droid.org/en/packages/com.quaap.bookymcbookface/ +[22]: https://opensource.com/sites/default/files/uploads/booky_mcbookface-menu.png (Booky McBookface Android app) +[23]: https://github.com/quaap/BookyMcBookface diff --git a/sources/tech/20191003 Creating a perfect landing page for free.md b/sources/tech/20191003 Creating a perfect landing page for free.md new file mode 100644 index 0000000000..877e133f50 --- /dev/null +++ b/sources/tech/20191003 Creating a perfect landing page for free.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Creating a perfect landing page for free) +[#]: via: (https://opensourceforu.com/2019/10/creating-a-perfect-landing-page-for-free/) +[#]: author: (Jagoda Glowacka https://opensourceforu.com/author/jagoda-glowacka/) + +Creating a perfect landing page for free +====== + +[![][1]][2] + +_Nowadays running an online business has become more popular than doing it in a traditional way. Entrepreneurs are lured by the lack of barriers of entry, simplicity of reaching wide ranges of customers and endless possibilities of growing. With Internet and new technologies it is far easier today to become an online businessman than a traditional one. However, one thing is to become an entrepreneur and another is to keep oneself on the market._ + +Since the digital business world is in constant expansion the competition is getting fiercer and the quality of products and services offered increases. It makes it more troublesome to be noticed in the crowd of alike ambitious online businessmen offering similar products. In order to survive you need to use all the cards you have and even if you have already done that you should always think about improvement and innovation. + +One of this card should definitely be a decent nice-looking and attention-grabbing landing page that boosts your conversions and build trust among your potential customers. Since today you can easily [_create landing page_][3] for free you should never deprive your business of one. As it is a highly powerful tool than can move your business off the ground and gain a lot of new leads. However, in order to do all of this it has to be a high quality landing page that will be impeccable for your targeted audience. + +**A landing page is a must for every online business** + +The concept of landing pages arrived a few years back but these few years were enough to settle down and become the necessity of every online business. At the beginning loads of businessmen decided to ignore their existence and preferred to persuade themselves that a homepage is already enough. Well, sorry to break it for them – but it’s not. + +**Homepage should never equal landing page** + +Obviously, a homepage is also a must for every online business and without it the business can only exist in entrepreneur’s imagination ;-) However, an essence of a homepage is not the same what an essence of a landing page is. And even the most state-of-the-art business website does not replace a good piece of landing page. + +Homepages do serve multiple purposes but none of them is focused on attracting new clients as they don’t clearly encourage visitors to take an action such as subscribing or filling out a contact form. Homepages’ primary focus is the company itself – its full offer, history or founder and it makes them full of distracting information and links. And last but not least, the information on them is not put in order that would make the visitors desire the product instantly. + +**Landing pages impose action** + +Landing page is a standalone website and serves as a first-impression maker among the visitors. It is the place where your new potential customers land and in order to keep them you need to show them instantly that your solution is something they need. It should quickly grab attention of the visitors, engage them in an action and make them interested in your product or service. And it should do all of that as quickly as possible. + +Therefore, landing pages are a great tool which helps you increase your conversion rate, getting information about your visitors, engage new potential leads into action (such as subscribing for a free trial or a newsletter what provide you with personal information about them) and make them believe your product or service is worthwhile. However, in order to fulfill all these functions it needs to have all the necessary landing page elements and it has to be a landing page of high quality. + +**Every landing page needs some core features** +In order to create a perfectly converting landing page you need to plan its structure and put all the essential elements on it that will help you achieve your goals. The core elements that should be placed on every landing page are: + + * headlines which should be catchy, keywords focused and eye-catching. It is the first, and sometimes only, element that visitors read so it has to be well-thought and a little intriguing, + * subheadlines which should be completion of headlines, a little bit more descriptive but still keywords focused and catchy, + * benefits of your solution clearly outlined and demonstrating high value and absolute necessity of purchasing it for your potential leads, + * call-to-action in a visible place and allowing the visitors to subscribe for a free trial, coupons, a newsletter or purchase right away. + + + +All of these features put together in a right order enable you to boost your conversions and make your product or service absolutely desirable for your customers. They are all the core elements of every landing page and without any of them there is a higher risk of landing page failure. + +However, putting all the elements is one thing but designing a landing page is another. When planning its structure you should always have in mind who your target is and adjust your landing page look accordingly. You should always keep up with landing page trends which make your landing page up-to-date and appealing for the customers. + +If it all sounds quite confusing and you are a landing page newbie or still don’t really feel confident in landing page creation you may facilitate this task and use a highly powerful tool the landing page savvies have prepared for you. And that is a [_free landing page creator_][4] which help you create a high quality and eye-catching landing page in less than an hour. + +**Creating a free landing page is a piece of cake** +Today the digital marketing world is full of bad quality landing pages that don’t truly work miracles for businesses. In order to give you all the bonanza the quality of landing page is crucial and choosing a landing page builder designed by landing page experts is one of the most secure options to create a landing page of excellence. + +They are online tools which slightly guide you through the whole creation process making it effortless and quick. They are full of pre-installed features such as landing page layouts and templates, drag and drop function, simple copying and moving or tailoring your landing page to every type of device. You can use these builders up to 14 days for free thanks to a free trial period. Quite nice, huh? ;-) + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/creating-a-perfect-landing-page-for-free/ + +作者:[Jagoda Glowacka][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://opensourceforu.com/author/jagoda-glowacka/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/09/Long-wait-open-for-webpage-in-broser-using-laptop.jpg?resize=696%2C405&ssl=1 (Long wait open for webpage in broser using laptop) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/09/Long-wait-open-for-webpage-in-broser-using-laptop.jpg?fit=1996%2C1162&ssl=1 +[3]: https://landingi.com/blog/how-to-create-landing-page +[4]: https://landingi.com/free-landing-page diff --git a/sources/tech/20191003 SQL queries don-t start with SELECT.md b/sources/tech/20191003 SQL queries don-t start with SELECT.md new file mode 100644 index 0000000000..18fb43d437 --- /dev/null +++ b/sources/tech/20191003 SQL queries don-t start with SELECT.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SQL queries don't start with SELECT) +[#]: via: (https://jvns.ca/blog/2019/10/03/sql-queries-don-t-start-with-select/) +[#]: author: (Julia Evans https://jvns.ca/) + +SQL queries don't start with SELECT +====== + +Okay, obviously many SQL queries do start with `SELECT` (and actually this post is only about `SELECT` queries, not `INSERT`s or anything). + +But! Yesterday I was working on an [explanation of window functions][1], and I found myself googling “can you filter based on the result of a window function”. As in – can you filter the result of a window function in a WHERE or HAVING or something? + +Eventually I concluded “window functions must run after WHERE and GROUP BY happen, so you can’t do it”. But this led me to a bigger question – **what order do SQL queries actually run in?**. + +This was something that I felt like I knew intuitively (“I’ve written at least 10,000 SQL queries, some of them were really complicated! I must know this!“) but I struggled to actually articulate what the order was. + +### SQL queries happen in this order + +I looked up the order, and here it is! (SELECT isn’t the first thing, it’s like the 5th thing!) ([here it is in a tweet][2]). + +(I really want to find a more accurate way of phrasing this than “sql queries happen/run in this order” but I haven’t figured it out yet) + + + +In a non-image format, the order is: + + * `FROM/JOIN` and all the `ON` conditions + * `WHERE` + * `GROUP BY` + * `HAVING` + * `SELECT` (including window functions) + * `ORDER BY` + * `LIMIT` + + + +### questions this diagram helps you answer + +This diagram is about the _semantics_ of SQL queries – it lets you reason through what a given query will return and answers questions like: + + * Can I do `WHERE` on something that came from a `GROUP BY`? (no! WHERE happens before GROUP BY!) + * Can I filter based on the results of a window function? (no! window functions happen in `SELECT`, which happens after both `WHERE` and `GROUP BY`) + * Can I `ORDER BY` based on something I did in GROUP BY? (yes! `ORDER BY` is basically the last thing, you can `ORDER BY` based on anything!) + * When does `LIMIT` happen? (at the very end!) + + + +**Database engines don’t actually literally run queries in this order** because they implement a bunch of optimizations to make queries run faster – we’ll get to that a little later in the post. + +So: + + * you can use this diagram when you just want to understand which queries are valid and how to reason about what results of a given query will be + * you _shouldn’t_ use this diagram to reason about query performance or anything involving indexes, that’s a much more complicated thing with a lot more variables + + + +### confounding factor: column aliases + +Someone on Twitter pointed out that many SQL implementations let you use the syntax: + +``` +SELECT CONCAT(first_name, ' ', last_name) AS full_name, count(*) +FROM table +GROUP BY full_name +``` + +This query makes it _look_ like GROUP BY happens after SELECT even though GROUP BY is first, because the GROUP BY references an alias from the SELECT. But it’s not actually necessary for the GROUP BY to run after the SELECT for this to work – the database engine can just rewrite the query as + +``` +SELECT CONCAT(first_name, ' ', last_name) AS full_name, count(*) +FROM table +GROUP BY CONCAT(first_name, ' ', last_name) +``` + +and run the GROUP BY first. + +Your database engine also definitely does a bunch of checks to make sure that what you put in SELECT and GROUP BY makes sense together before it even starts to run the query, so it has to look at the query as a whole anyway before it starts to come up with an execution plan. + +### queries aren’t actually run in this order (optimizations!) + +Database engines in practice don’t actually run queries by joining, and then filtering, and then grouping, because they implement a bunch of optimizations reorder things to make the query run faster as long as reordering things won’t change the results of the query. + +One simple example of a reason why need to run queries in a different order to make them fast is that in this query: + +``` +SELECT * FROM +owners LEFT JOIN cats ON owners.id = cats.owner +WHERE cats.name = 'mr darcy' +``` + +it would be silly to do the whole left join and match up all the rows in the 2 tables if you just need to look up the 3 cats named ‘mr darcy’ – it’s way faster to do some filtering first for cats named ‘mr darcy’. And in this case filtering first doesn’t change the results of the query! + +There are lots of other optimizations that database engines implement in practice that might make them run queries in a different order but there’s no room for that and honestly it’s not something I’m an expert on. + +### LINQ starts queries with `FROM` + +LINQ (a querying syntax in C# and VB.NET) uses the order `FROM ... WHERE ... SELECT`. Here’s an example of a LINQ query: + +``` +var teenAgerStudent = from s in studentList + where s.Age > 12 && s.Age < 20 + select s; +``` + +pandas (my [favourite data wrangling tool][3]) also basically works like this, though you don’t need to use this exact order – I’ll often write pandas code like this: + +``` +df = thing1.join(thing2) # like a JOIN +df = df[df.created_at > 1000] # like a WHERE +df = df.groupby('something', num_yes = ('yes', 'sum')) # like a GROUP BY +df = df[df.num_yes > 2] # like a HAVING, filtering on the result of a GROUP BY +df = df[['num_yes', 'something1', 'something']] # pick the columns I want to display, like a SELECT +df.sort_values('sometthing', ascending=True)[:30] # ORDER BY and LIMIT +df[:30] +``` + +This isn’t because pandas is imposing any specific rule on how you have to write your code, though. It’s just that it often makes sense to write code in the order JOIN / WHERE / GROUP BY / HAVING. (I’ll often put a `WHERE` first to improve performance though, and I think most database engines will also do a WHERE first in practice) + +`dplyr` in R also lets you use a different syntax for querying SQL databases like Postgres, MySQL and SQLite, which is also in a more logical order. + +### I was really surprised that I didn’t know this + +I’m writing a blog post about this because when I found out the order I was SO SURPRISED that I’d never seen it written down that way before – it explains basically everything that I knew intuitively about why some queries are allowed and others aren’t. So I wanted to write it down in the hopes that it will help other people also understand how to write SQL queries. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/10/03/sql-queries-don-t-start-with-select/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/1179419244808851462?s=20 +[2]: https://twitter.com/b0rk/status/1179449535938076673 +[3]: https://github.com/jvns/pandas-cookbook diff --git a/sources/tech/20191006 Use internal packages to reduce your public API surface.md b/sources/tech/20191006 Use internal packages to reduce your public API surface.md new file mode 100644 index 0000000000..eef43ae560 --- /dev/null +++ b/sources/tech/20191006 Use internal packages to reduce your public API surface.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use internal packages to reduce your public API surface) +[#]: via: (https://dave.cheney.net/2019/10/06/use-internal-packages-to-reduce-your-public-api-surface) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Use internal packages to reduce your public API surface +====== + +In the beginning, before the `go` tool, before Go 1.0, the Go distribution stored the standard library in a subdirectory called `pkg/` and the commands which built upon it in `cmd/`. This wasn’t so much a deliberate taxonomy but a by product of the original `make` based build system. In [September 2014][1], the Go distribution dropped the `pkg/` subdirectory, but then this tribal knowledge had set root in large Go projects and continues to this day. + +I tend to view empty directories inside a Go project with suspicion. Often they are a hint that the module’s author may be trying to create a taxonomy of packages rather than ensuring each package’s name, and thus its enclosing directory, [uniquely describes its purpose][2]. While the symmetry with `cmd/` for `package main` commands is appealing, a directory that exists only to hold other packages is a potential design smell. + +More importantly, the boilerplate of an empty `pkg/` directory distracts from the more useful idiom of an `internal/` directory. `internal/` is a special directory name recognised by the `go` tool which will prevent one package from being imported by another unless both share a common ancestor. Packages within an `internal/` directory are therefore said to be _internal packages_. + +To create an internal package, place it within a directory named `internal/`. When the `go` command sees an import of a package with `internal/` in the import path, it verifies that the importing package is within the tree rooted at the _parent_ of the `internal/` directory. + +For example, a package `/a/b/c/internal/d/e/f` can only be imported by code in the directory tree rooted at `/a/b/c`. It cannot be imported by code in `/a/b/g` or in any other repository. + +If your project contains multiple packages you may find you have some exported symbols which are intended to be used by other packages in your project, but are not intended to be part of your project’s public API. Although Go has limited visibility modifiers–public, exported, symbols and private, non exported, symbols–internal packages provide a useful mechanism for controlling visibility to parts of your project which would otherwise be considered part of its public versioned API. + +You can, of course, promote internal packages later if you want to commit to supporting that API; just move them up a directory level or two. The key is this process is _opt-in_. As the author, internal packages give you control over which symbols in your project’s public API without being forced to glob concepts together into unwieldy mega packages to avoid exporting them. + +### Related posts: + + 1. [Stress test your Go packages][3] + 2. [Practical public speaking for Nerds][4] + 3. [Five suggestions for setting up a Go project][5] + 4. [Automatically fetch your project’s dependencies with gb][6] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/10/06/use-internal-packages-to-reduce-your-public-api-surface + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://groups.google.com/forum/m/#!msg/golang-dev/c5AknZg3Kww/OFLmvGyfNR0J +[2]: https://dave.cheney.net/2019/01/08/avoid-package-names-like-base-util-or-common +[3]: https://dave.cheney.net/2013/06/19/stress-test-your-go-packages (Stress test your Go packages) +[4]: https://dave.cheney.net/2015/02/17/practical-public-speaking-for-nerds (Practical public speaking for Nerds) +[5]: https://dave.cheney.net/2014/12/01/five-suggestions-for-setting-up-a-go-project (Five suggestions for setting up a Go project) +[6]: https://dave.cheney.net/2016/06/26/automatically-fetch-your-projects-dependencies-with-gb (Automatically fetch your project’s dependencies with gb) diff --git a/sources/tech/20191007 7 Java tips for new developers.md b/sources/tech/20191007 7 Java tips for new developers.md new file mode 100644 index 0000000000..6a560ceb2d --- /dev/null +++ b/sources/tech/20191007 7 Java tips for new developers.md @@ -0,0 +1,222 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Java tips for new developers) +[#]: via: (https://opensource.com/article/19/10/java-basics) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +7 Java tips for new developers +====== +If you're just getting started with Java programming, here are seven +basics you need to know. +![Coffee and laptop][1] + +Java is a versatile programming language used, in some way, in nearly every industry that touches a computer. Java's greatest power is that it runs in a Java Virtual Machine (JVM), a layer that translates Java code into bytecode compatible with your operating system. As long as a JVM exists for your operating system, whether that OS is on a server (or [serverless][2], for that matter), desktop, laptop, mobile device, or embedded device, then a Java application can run on it. + +This makes Java a popular language for both programmers and users. Programmers know that they only have to write one version of their software to end up with an application that runs on any platform, and users know that an application will run on their computer regardless of what operating system they use. + +Many languages and frameworks are cross-platform, but none deliver the same level of abstraction. With Java, you target the JVM, not the OS. For programmers, that's the path of least resistance when faced with several programming challenges, but it's only useful if you know how to program Java. If you're just getting started with Java programming, here are seven basic tips you need to know. + +But first, if you're not sure whether you have Java installed, you can find out in a terminal (such as [Bash][3] or [PowerShell][4]) by running: + + +``` +$ java --version +openjdk 12.0.2 2019-07-16 +OpenJDK Runtime Environment 19.3 (build 12.0.2+9) +OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) +``` + +If you get an error or nothing in return, then you should install the [Java Development Kit][5] (JDK) to get started with Java development. Or install a Java Runtime Environment ****(JRE) if you just need to run Java applications. + +### 1\. Java packages + +In Java, related classes are grouped into a _package_. The basic Java libraries you get when you download the JDK are grouped into packages starting with **java** or **javax**. Packages serve a similar function as folders on your computer: they provide structure and definition for related elements (in programming terminology, a _namespace_). Additional packages can be obtained from independent coders, open source projects, and commercial vendors, just as libraries can be obtained for any programming language. + +When you write a Java program, you should declare a package name at the top of your code. If you're just writing a simple application to get started with Java, your package name can be as simple as the name of your project. If you're using a Java integrated development environment (IDE), like [Eclipse][6], it generates a sane package name for you when you start a new project. + + +``` +package helloworld; + +/** + * @author seth + * An application written in Java. + */ +``` + +Otherwise, you can determine the name of your package by looking at its path in relation to the broad definition of your project. For instance, if you're writing a set of classes to assist in game development and the collection is called **jgamer**, then you might have several unique classes within it. + + +``` +package jgamer.avatar; + +/** + * @author seth + * An imaginary game library. + */ +``` + +The top level of your package is **jgamer**, and each package inside it is a descendant, such as **jgamer.avatar** and **jgamer.score** and so on. In your filesystem, the structure reflects this, with **jgamer** being the top directory containing the files **avatar.java** and **score.java**. + +### 2\. Java imports + +The most fun you'll ever have as a polyglot programmer is trying to keep track of whether you **include**, **import**, **use**, **require**, or **some other term** a library in whatever programming language you're writing in. Java, for the record, uses the **import** keyword when importing libraries needed for your code. + + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ +``` + +Imports work based on an environment's Java path. If Java doesn't know where Java libraries are stored on a system, then an import cannot be successful. As long as a library is stored in a system's Java path, then an import can succeed, and a library can be used to build and run a Java application. + +If a library is not expected to be in the Java path (because, for instance, you are writing the library yourself), then the library can be bundled with your application (license permitting) so that the import works as expected. + +### 3\. Java classes + +A Java class is declared with the keywords **public class** along with a unique class name mirroring its file name. For example, in a file **Hello.java** in project **helloworld**: + + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ + +public class Hello { +        // this is an empty class +} +``` + +You can declare variables and functions inside a class. In Java, variables within a class are called _fields_. + +### 4\. Java methods + +Java methods are, essentially, functions within an object. They are defined as being **public** (meaning they can be accessed by any other class) or **private** (limiting their use) based on the expected type of returned data, such as **void**, **int**, **float**, and so on. + + +``` +    public void helloPrompt([ActionEvent][7] event) { +        [String][8] salutation = "Hello %s"; +  +        string helloMessage = "World"; +        message = [String][8].format(salutation, helloMessage); +        [JOptionPane][9].showMessageDialog(this, message); +    } +  +    private int someNumber (x) { +        return x*2; +    } +``` + +When calling a method directly, it is referenced by its class and method name. For instance, **Hello.someNumber** refers to the **someNumber** method in the **Hello** class. + +### 5\. Static + +The **static** keyword in Java makes a member in your code accessible independently of the object that contains it. + +In object-oriented programming, you write code that serves as a template for "objects" that get spawned as the application runs. You don't code a specific window, for instance, but an _instance_ of a window based upon a window class in Java (and modified by your code). Since nothing you are coding "exists" until the application generates an instance of it, most methods and variables (and even nested classes) cannot be used until the object they depend upon has been created. + +However, sometimes you need to access or use data in an object before it is created by the application (for example, an application can't generate a red ball without first knowing that the ball is meant to be red). For those cases, there's the **static** keyword. + +### 6\. Try and catch + +Java is excellent at catching errors, but it can only recover gracefully if you tell it what to do. The cascading hierarchy of attempting to perform an action in Java starts with **try**, falls back to **catch**, and ends with **finally**. Should the **try** clause fail, then **catch** is invoked, and in the end, there's always **finally** to perform some sensible action regardless of the results. Here's an example: + + +``` +try { +        cmd = parser.parse(opt, args);  +        +        if(cmd.hasOption("help")) { +                HelpFormatter helper = new HelpFormatter(); +                helper.printHelp("Hello <options>", opt); +                [System][10].exit(0); +                } +        else { +                if(cmd.hasOption("shell") || cmd.hasOption("s")) { +                [String][8] target = cmd.getOptionValue("tgt"); +                } // else +        } // fi +} catch ([ParseException][11] err) { +        [System][10].out.println(err); +        [System][10].exit(1); +        } //catch +        finally { +                new Hello().helloWorld(opt); +        } //finally +} //try +``` + +It's a robust system that attempts to avoid irrecoverable errors or, at least, to provide you with the option to give useful feedback to the user. Use it often, and your users will thank you! + +### 7\. Running a Java application + +Java files, usually ending in **.java**, theoretically can be run with the **java** command. If an application is complex, however, whether running a single file results in anything meaningful is another question. + +To run a **.java** file directly: + + +``` +`$ java ./Hello.java` +``` + +Usually, Java applications are distributed as Java Archives (JAR) files, ending in **.jar**. A JAR file contains a manifest file specifying the main class, some metadata about the project structure, and all the parts of your code required to run the application. + +To run a JAR file, you may be able to double-click its icon (depending on how you have your OS set up), or you can launch it from a terminal: + + +``` +`$ java -jar ./Hello.jar` +``` + +### Java for everyone + +Java is a powerful language, and thanks to the [OpenJDK][12] project and other initiatives, it's an open specification that allows projects like [IcedTea][13], [Dalvik][14], and [Kotlin][15] to thrive. Learning Java is a great way to prepare to work in a wide variety of industries, and what's more, there are plenty of [great reasons to use it][16]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/java-basics + +作者:[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/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://www.redhat.com/en/resources/building-microservices-eap-7-reference-architecture +[3]: https://www.gnu.org/software/bash/ +[4]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 +[5]: http://openjdk.java.net/ +[6]: http://www.eclipse.org/ +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+joptionpane +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+parseexception +[12]: https://openjdk.java.net/ +[13]: https://icedtea.classpath.org/wiki/Main_Page +[14]: https://source.android.com/devices/tech/dalvik/ +[15]: https://kotlinlang.org/ +[16]: https://opensource.com/article/19/9/why-i-use-java diff --git a/sources/tech/20191007 Introduction to open source observability on Kubernetes.md b/sources/tech/20191007 Introduction to open source observability on Kubernetes.md new file mode 100644 index 0000000000..acd1bc1331 --- /dev/null +++ b/sources/tech/20191007 Introduction to open source observability on Kubernetes.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to open source observability on Kubernetes) +[#]: via: (https://opensource.com/article/19/10/open-source-observability-kubernetes) +[#]: author: (Yuri Grinshteyn https://opensource.com/users/yuri-grinshteyn) + +Introduction to open source observability on Kubernetes +====== +In the first article in this series, learn the signals, mechanisms, +tools, and platforms you can use to observe services running on +Kubernetes. +![Looking back with binoculars][1] + +With the advent of DevOps, engineering teams are taking on more and more ownership of the reliability of their services. While some chafe at the increased operational burden, others welcome the opportunity to treat service reliability as a key feature, invest in the necessary capabilities to measure and improve reliability, and deliver the best possible customer experiences. + +This change is measured explicitly in the [2019 Accelerate State of DevOps Report][2]. One of its most interesting conclusions (as written in the summary) is: + +> "Delivering software quickly, **reliably** _[emphasis mine]_, and safely is at the heart of technology transformation and organizational performance. We see continued evidence that software speed, stability, and **availability** _[emphasis mine]_ contribute to organizational performance (including profitability, productivity, and customer satisfaction). Our highest performers are twice as likely to meet or exceed their organizational performance goals." + +The full [report][3] says: + +> "**Low performers use more proprietary software than high and elite performers**: The cost to maintain and support proprietary software can be prohibitive, prompting high and elite performers to use open source solutions. This is in line with results from previous reports. In fact, the 2018 Accelerate State of DevOps Report found that elite performers were 1.75 times more likely to make extensive use of open source components, libraries, and platforms." + +This is a strong testament to the value of open source as a general accelerator of performance. Combining these two conclusions leads to the rather obvious thesis for this series: + +> Reliability is a critical feature, observability is a necessary component of reliability, and open source tooling is at least _A_ right approach, if not _THE_ right approach. + +This article, the first in a series, will introduce the types of signals engineers typically rely on and the mechanisms, tools, and platforms that you can use to instrument services running on Kubernetes to emit these signals, ingest and store them, and use and interpret them. + +From there, the series will continue with hands-on tutorials, where I will walk through getting started with each of the tools and technologies. By the end, you should be well-equipped to start improving the observability of your own systems! + +### What is observability? + +While observability as a general [concept in control theory][4] has been around since at least 1960, its applicability to digital systems and services is rather new and in some ways an evolution of how these systems have been monitored for the last two decades. You are likely familiar with the necessity of monitoring services to ensure you know about issues before your users are impacted. You are also likely familiar with the idea of using metric data to better understand the health and state of a system, especially in the context of troubleshooting during an incident or debugging. + +The key differentiation between monitoring and observability is that observability is an inherent property of a system or service, rather than something someone does to the system, which is what monitoring fundamentally is. [Cindy Sridharan][5], author of a free [e-book][6] on observability in distributed systems, does a great job of explaining the difference in an excellent [Medium article][7]. + +It is important to distinguish between these two terms because observability, as a property of the service you build, is your responsibility. As a service developer and owner, you have full control over the signals your system emits, how and where those signals are ingested and stored, and how they're utilized. This is in contrast to "monitoring," which may be done by others (and by you) to measure the availability and performance of your service and generate alerts to let you know that service reliability has degraded. + +### Signals + +Now that you understand the idea of observability as a property of a system that you control and that is explicitly manifested as the signals you instruct your system to emit, it's important to understand and describe the kinds of signals generally considered in this context. + +#### What are metrics? + +A metric is a fundamental type of signal that can be emitted by a service or the infrastructure it's running on. At its most basic, it is the combination of: + + 1. Some identifier, hopefully descriptive, that indicates what the metric represents + 2. A series of data points, each of which contains two elements: +a. The timestamp at which the data point was generated (or ingested) +b. A numeric value representing the state of the thing you're measuring at that time + + + +Time-series metrics have been and remain the key data structure used in monitoring and observability practice and are the primary way that the state and health of a system are represented over time. They are also the primary mechanism for alerting, but that practice and others (like incident management, on-call, and postmortems) are outside the scope here. For now, the focus is on how to instrument systems to emit metrics, how to store them, and how to use them for charts and dashboards to help you visualize the current and historical state of your system. + +Metrics are used for two primary purposes: health and insight. + +Understanding the health and state of your infrastructure, platform, and service is essential to keeping them available to users. Generally, these are emitted by the various components chosen to build services, and it's just a matter of setting up the right collection and storage infrastructure to be able to use them. Metrics from the simple (node CPU utilization) to the esoteric (garbage collection statistics) fall into this category. + +Metrics are also essential to understanding what is happening in the system to avoid interruptions to your services. From this perspective, a service can emit custom telemetry that precisely describes specific aspects of how the service is functioning and performing. This will require you to instrument the code itself, usually by including specific libraries, and specify an export destination. + +#### What are logs? + +Unlike metrics that represent numeric values that change over time, logs represent discrete events. Log entries contain both the log payload—the message emitted by a component of the service or the code—and often metadata, such as the timestamp, label, tag, or other identifiers. Therefore, this is by far the largest volume of data you need to store, and you should carefully consider your log ingestion and storage strategies as you look to take on increasing user traffic. + +#### What are traces? + +Distributed tracing is a relatively new addition to the observability toolkit and is specifically relevant to microservice architectures to allow you to understand latency and how various backend service calls contribute to it. Ted Young published an [excellent article on the concept][8] that includes its origins with Google's [Dapper paper][9] and subsequent evolution. This series will be specifically concerned with the various implementations available. + +### Instrumentation + +Once you identify the signals you want to emit, store, and analyze, you need to instruct your system to create the signals and build a mechanism to store and analyze them. Instrumentation refers to those parts of your code that are used to generate metrics, logs, and traces. In this series, we'll discuss open source instrumentation options and introduce the basics of their use through hands-on tutorials. + +### Observability on Kubernetes + +Kubernetes is the dominant platform today for deploying and maintaining containers. As it rose to the top of the industry's consciousness, so did new technologies to provide effective observability tooling around it. Here is a short list of these essential technologies; they will be covered in greater detail in future articles in this series. + +#### Metrics + +Once you select your preferred approach for instrumenting your service with metrics, the next decision is where to store those metrics and what set of services will support your effort to monitor your environment. + +##### Prometheus + +[Prometheus][10] is the best place to start when looking to monitor both your Kubernetes infrastructure and the services running in the cluster. It provides everything you'll need, including client instrumentation libraries, the [storage backend][11], a visualization UI, and an alerting framework. Running Prometheus also provides a wealth of infrastructure metrics right out of the box. It further provides [integrations][12] with third-party providers for storage, although the data exchange is not bi-directional in every case, so be sure to read the documentation if you want to store metric data in multiple locations. + +Later in this series, I will walk through setting up Prometheus in a cluster for basic infrastructure monitoring and adding custom telemetry to an application using the Prometheus client libraries. + +##### Graphite + +[Graphite][13] grew out of an in-house development effort at Orbitz and is now positioned as an enterprise-ready monitoring tool. It provides metrics storage and retrieval mechanisms, but no instrumentation capabilities. Therefore, you will still need to implement Prometheus or OpenCensus instrumentation to collect metrics. Later in this series, I will walk through setting up Graphite and sending metrics to it. + +##### InfluxDB + +[InfluxDB][14] is another open source database purpose-built for storing and retrieving time-series metrics. Unlike Graphite, InfluxDB is supported by a company called InfluxData, which provides both the InfluxDB software and a cloud-hosted version called InfluxDB Cloud. Later in this series, I will walk through setting up InfluxDB in a cluster and sending metrics to it. + +##### OpenTSDB + +[OpenTSDB][15] is also an open source purpose-built time-series database. One of its advantages is the ability to use [HBase][16] as the storage layer, which allows integration with a cloud managed service like Google's Cloud Bigtable. Google has published a [reference guide][17] on setting up OpenTSDB to monitor your Kubernetes cluster (assuming it's running in Google Kubernetes Engine, or GKE). Since it's a great introduction, I recommend following Google's tutorial if you're interested in learning more about OpenTSDB. + +##### OpenCensus + +[OpenCensus][18] is the open source version of the [Census library][19] developed at Google. It provides both metric and tracing instrumentation capabilities and supports a number of backends to [export][20] the metrics to—including Prometheus! Note that OpenCensus does not monitor your infrastructure, and you will still need to determine the best approach if you choose to use OpenCensus for custom metric telemetry. + +We'll revisit this library later in this series, and I will walk through creating metrics in a service and exporting them to a backend. + +#### Logging for observability + +If metrics provide "what" is happening, logging tells part of the story of "why." Here are some common options for consistently gathering and analyzing logs. + +##### Collecting with fluentd + +In the Kubernetes ecosystem, [fluentd][21] is the de-facto open source standard for collecting logs emitted in the cluster and forwarding them to a specified backend. You can use config maps to modify fluentd's behavior, and later in the series, I'll walk through deploying it in a cluster and modifying the associated config map to parse unstructured logs and convert them to structured for better and easier analysis. In the meantime, you can read my post "[Customizing Kubernetes logging (Part 1)][22]" on how to do that on GKE. + +##### Storing and analyzing with ELK + +The most common storage mechanism for logs is provided by [Elastic][23] in the form of the "ELK" stack. As Elastic says: + +> "'ELK' is the acronym for three open source projects: Elasticsearch, Logstash, and Kibana. Elasticsearch is a search and analytics engine. Logstash is a server‑side data processing pipeline that ingests data from multiple sources simultaneously, transforms it, and then sends it to a 'stash' like Elasticsearch. Kibana lets users visualize data with charts and graphs in Elasticsearch." + +Later in the series, I'll walk through setting up Elasticsearch, Kibana, and Logstash in +a cluster to store and analyze logs being collected by fluentd. + +#### Distributed traces and observability + +When asking "why" in analyzing service issues, logs can only provide the information that applications are designed to share with it. The way to go even deeper is to gather traces. As the [OpenTracing initiative][24] says: + +> "Distributed tracing, also called distributed request tracing, is a method used to profile and monitor applications, especially those built using a microservices architecture. Distributed tracing helps pinpoint where failures occur and what causes poor performance." + +##### Istio + +The [Istio][25] open source service mesh provides multiple benefits for microservice architectures, including traffic control, security, and observability capabilities. It does not combine multiple spans into a single trace to assemble a full picture of what happens when a user call traverses a distributed system, but it can nevertheless be useful as an easy first step toward distributed tracing. It also provides other observability benefits—it's the easiest way to get ["golden signal"][26] metrics for each service, and it also adds logging for each request, which can be very useful for calculating error rates. You can read my post on [using it with Google's Stackdriver][27]. I'll revisit it in this series and show how to install it in a cluster and configure it to export observability data to a backend. + +##### OpenCensus + +I described [OpenCensus][28] in the Metrics section above, and that's one of the main reasons for choosing it for distributed tracing: Using a single library for both metrics and traces is a great option to reduce your instrumentation work—with the caveat that you must be working in a language that supports both the traces and stats exporters. I'll come back to OpenCensus and show how to get started instrumenting code for distributed tracing. Note that OpenCensus provides only the instrumentation library, and you'll still need to use a storage and visualization layer like Zipkin, Jaeger, Stackdriver (on GCP), or X-Ray (on AWS). + +##### Zipkin + +[Zipkin][29] is a full, distributed tracing solution that includes instrumentation, storage, and visualization. It's a tried and true set of tools that's been around for years and has a strong user and developer community. It can also be used as a backend for other instrumentation options like OpenCensus. In a future tutorial, I'll show how to set up the Zipkin server and instrument your code. + +##### Jaeger + +[Jaeger][30] is another open source tracing solution that includes all the components you'll need. It's a newer project that's being incubated at the Cloud Native Computing Foundation (CNCF). Whether you choose to use Zipkin or Jaeger may ultimately depend on your experience with them and their support for the language you're writing your service in. In this series, I'll walk through setting up Jaeger and instrumenting code for tracing. + +### Visualizing observability data + +The final piece of the toolkit for using metrics is the visualization layer. There are basically two options here: the "native" visualization that your persistence layers enable (e.g., the Prometheus UI or Flux with InfluxDB) or a purpose-built visualization tool. + +[Grafana][31] is currently the de facto standard for open source visualization. I'll walk through setting it up and using it to visualize data from various backends later in this series. + +### Looking ahead + +Observability on Kubernetes has many parts and many options for each type of need. Metric, logging, and tracing instrumentation provide the bedrock of information needed to make decisions about services. Instrumenting, storing, and visualizing data are also essential. Future articles in this series will dive into all of these options with hands-on tutorials for each. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-observability-kubernetes + +作者:[Yuri Grinshteyn][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/yuri-grinshteyn +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars) +[2]: https://cloud.google.com/blog/products/devops-sre/the-2019-accelerate-state-of-devops-elite-performance-productivity-and-scaling +[3]: https://services.google.com/fh/files/misc/state-of-devops-2019.pdf +[4]: https://en.wikipedia.org/wiki/Observability +[5]: https://twitter.com/copyconstruct +[6]: https://t.co/0gOgZp88Jn?amp=1 +[7]: https://medium.com/@copyconstruct/monitoring-and-observability-8417d1952e1c +[8]: https://opensource.com/article/18/5/distributed-tracing +[9]: https://research.google.com/pubs/pub36356.html +[10]: https://prometheus.io/ +[11]: https://prometheus.io/docs/prometheus/latest/storage/ +[12]: https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage +[13]: https://graphiteapp.org/ +[14]: https://www.influxdata.com/get-influxdb/ +[15]: http://opentsdb.net/ +[16]: https://hbase.apache.org/ +[17]: https://cloud.google.com/solutions/opentsdb-cloud-platform +[18]: https://opencensus.io/ +[19]: https://opensource.googleblog.com/2018/03/how-google-uses-opencensus-internally.html +[20]: https://opencensus.io/exporters/#exporters +[21]: https://www.fluentd.org/ +[22]: https://medium.com/google-cloud/customizing-kubernetes-logging-part-1-a1e5791dcda8 +[23]: https://www.elastic.co/ +[24]: https://opentracing.io/docs/overview/what-is-tracing +[25]: http://istio.io/ +[26]: https://landing.google.com/sre/sre-book/chapters/monitoring-distributed-systems/ +[27]: https://medium.com/google-cloud/istio-and-stackdriver-59d157282258 +[28]: http://opencensus.io/ +[29]: https://zipkin.io/ +[30]: https://www.jaegertracing.io/ +[31]: https://grafana.com/ diff --git a/sources/tech/20191007 Understanding Joins in Hadoop.md b/sources/tech/20191007 Understanding Joins in Hadoop.md new file mode 100644 index 0000000000..ea0025a9d2 --- /dev/null +++ b/sources/tech/20191007 Understanding Joins in Hadoop.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding Joins in Hadoop) +[#]: via: (https://opensourceforu.com/2019/10/understanding-joins-in-hadoop/) +[#]: author: (Bhaskar Narayan Das https://opensourceforu.com/author/bhaskar-narayan/) + +Understanding Joins in Hadoop +====== + +[![Hadoop big data career opportunities][1]][2] + +_Those who have just begun the study of Hadoop might have come across different types of joins. This article briefly discusses normal joins, map side joins and reduce side joins. The differences between map side joins and reduce side joins, as well as their pros and cons, are also discussed._ + +Normally, the term join is used to refer to the combination of the record-sets of two tables. Thus when we run a query, tables are joined and we get the data from two tables in the joined format, as is the case in SQL joins. Joins find maximum usage in Hadoop processing. They should be used when large data sets are encountered and there is no urgency to generate the outcome. In case of Hadoop common joins, Hadoop distributes all the rows on all the nodes based on the join key. Once this is achieved, all the keys that have the same values end up on the same node and then, finally, the join at the reducer happens. This scenario is perfect when both the tables are huge, but when one table is small and the other is quite big, common joins become inefficient and take more time to distribute the row. + +While processing data using Hadoop, we generally do it over the map phase and the reduce phase. Thus there are mappers and reducers that do the job for the map phase and the reduce phase. We use map reduce joins when we encounter a large data set that is too big to use data-sharing techniques. + +**Map side joins** +Map side join is the term used when the record sets of two tables are joined within the mapper. In this case, the reduce phase is not involved. In the map side join, the record sets of the tables are loaded into memory, ensuring a faster join operation. Map side join is convenient for small tables and not recommended for large tables. In situations where you have queries running too frequently with small table joins you could experience a very significant reduction in query computation time. + +**Reduce side joins** +Reduce side joins happen at the reduce side of Hadoop processing. They are also known as repartitioned sort merge joins, or simply, repartitioned joins or distributed joins or common joins. They are the most widely used joins. Reduce side joins happen when both the tables are so big that they cannot fit into the memory. The process flow of reduce side joins is as follows: + + 1. The input data is read by the mapper, which needs to be combined on the basis of the join key or common column. + 2. Once the input data is processed by the mapper, it adds a tag to the processed input data in order to distinguish the input origin sources. + 3. The mapper returns the intermediate key-value pair, where the key is also the join key. + 4. For the reducer, a key and a list of values is generated once the sorting and shuffling phase is complete. + 5. The reducer joins the values that are present in the generated list along with the key to produce the final outcome. + + + +The join at the reduce side combines the output of two mappers based on a common key. This scenario is quite synonymous with SQL joins, where the data sets of two tables are joined based on a primary key. In this case we have to decide which field is the primary key. +There are a few terms associated with reduce side joins: +1\. _Data source:_ This is nothing but the input files. +2\. _Tag:_ This is basically used to distinguish each input data on the basis of its origin. +3\. _Group key:_ This refers to the common column that is used as a join key to combine the output of two mappers. + +**Difference between map side joins and reduce side joins** + + 1. A map side join, as explained earlier, happens on the map side whereas a reduce side join happens on the reduce side. + 2. A map side join happens in the memory whereas a reduce side join happens off the memory. + 3. Map side joins are effective when one data set is big while the other is small, whereas reduce side joins work effectively for big size data sets. + 4. Map side joins are expensive, whereas reduce side joins are cheap. + + + +Opt for map side joins when the table size is small and fits in memory, and you require the job to be completed in a short span of time. Use the reduce side join when dealing with large data sets, which cannot fit into the memory. Reduce side joins are easy to implement and have the advantage of their inbuilt sorting and shuffling algorithms. Besides this, there is no requirement to strictly follow any formatting rule for input in case of reduce side joins, and these could also be performed on unstructured data sets. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/understanding-joins-in-hadoop/ + +作者:[Bhaskar Narayan Das][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://opensourceforu.com/author/bhaskar-narayan/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2017/06/Hadoop-big-data.jpg?resize=696%2C441&ssl=1 (Hadoop big data career opportunities) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2017/06/Hadoop-big-data.jpg?fit=750%2C475&ssl=1 diff --git a/sources/tech/20191007 Using the Java Persistence API.md b/sources/tech/20191007 Using the Java Persistence API.md new file mode 100644 index 0000000000..e911428044 --- /dev/null +++ b/sources/tech/20191007 Using the Java Persistence API.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the Java Persistence API) +[#]: via: (https://opensource.com/article/19/10/using-java-persistence-api) +[#]: author: (Stephon Brown https://opensource.com/users/stephb) + +Using the Java Persistence API +====== +Learn how to use the JPA by building an example app for a bike store. +![Coffee beans][1] + +The Java Persistence API (JPA) is an important Java functionality for application developers to understand. It translates exactly how Java developers turn method calls on objects into accessing, persisting, and managing data stored in NoSQL and relational databases. + +This article examines the JPA in detail through a tutorial example of building a bicycle loaning service. This example will create a create, read, update, and delete (CRUD) layer for a larger application using the Spring Boot framework, the MongoDB database (which is [no longer open source][2]), and the Maven package manager. I also use NetBeans 11 as my IDE of choice. + +This tutorial focuses on the open source angle of the Java Persistence API, rather than the tools, to show how it works. This is all about learning the pattern of programming applications, but it's still smart to understand the software. You can access the full code in my [GitHub repository][3]. + +### Java: More than 'beans' + +Java is an object-oriented language that has gone through many changes since the Java Development Kit (JDK) was released in 1996. Understanding the language's various pathways and its virtual machine is a history lesson in itself; in brief, the language has forked in many directions, similar to the Linux kernel, since its release. There are standard editions that are free to the community, enterprise editions for business, and an open source alternatives contributed to by multiple vendors. Major versions are released at six-month intervals; since there are often major differences in features, you may want to do some research before choosing a version. + +All and all, Java is steeped in history. This tutorial focuses on [JDK 11][4], which is the open source implementation of Java 11, because it is one of the long-term-support versions that is still active. + + * **Spring Boot: **Spring Boot is a module from the larger Spring framework developed by Pivotal. Spring is a very popular framework for working with Java. It allows for a variety of architectures and configurations. Spring also offers support for web applications and security. Spring Boot offers basic configurations for bootstrapping various types of Java projects quickly. This tutorial uses Spring Boot to quickly write a console application and test functionality against the database. + * **Maven:** Maven is a project/package manager developed by Apache. Maven allows for the management of packages and various dependencies within its POM.xml file. If you have used NPM, you may be familiar with how package managers function. Maven also manages build and reporting functionality. + * **Lombok:** Lombok is a library that allows the creation of object getters/setters through annotation within the object file. This is already present in languages like C#, and Lombok introduces this functionality into Java. + * **NetBeans: **NetBeans is a popular open source IDE that focuses specifically on Java development. Many of its tools provide an implementation for the latest Java SE and EE updates. + + + +This group of tools will be used to create a simple application for a fictional bike store. It will implement functionality for inserting collections for "Customer" and "Bike" objects. + +### Brewed to perfection + +Navigate to the [Spring Initializr][5]. This website enables you to generate basic project needs for Spring Boot and the dependencies you will need for the project. Select the following options: + + 1. **Project:** Maven Project + 2. **Language:** Java + 3. **Spring Boot:** 2.1.8 (or the most stable release) + 4. **Project Metadata:** Whatever your naming conventions are (e.g., **com.stephb**) + * You can keep Artifact as "Demo" + 5. **Dependencies:** Add: + * Spring Data MongoDB + * Lombok + + + +Click **Download** and open the new project in your chosen IDE (e.g., NetBeans). + +#### Model outline + +The models represent information collected about specific objects in the program that will be persisted in your database. Focus on two objects: **Customer** and **Bike**. First, create a **dto** folder within the **src** folder. Then, create the two Java class objects named **Customer.java** and **Bike.java**. They will be structured in the program as follows: + +**Customer. Java** + + +``` + 1 package com.stephb.JavaMongo.dto; + 2  + 3 import lombok.Getter; + 4 import lombok.Setter; + 5 import org.springframework.data.annotation.Id; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 @Getter @Setter +12 public class Customer { +13  +14         private @Id [String][6] id; +15         private [String][6] emailAddress; +16         private [String][6] firstName; +17         private [String][6] lastName; +18         private [String][6] address; +19          +20 } +``` + +**Bike.java** + + +``` + 1 package com.stephb.JavaMongo.dto; + 2  + 3 import lombok.Getter; + 4 import lombok.Setter; + 5 import org.springframework.data.annotation.Id; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 @Getter @Setter +12 public class Bike { +13         private @Id [String][6] id; +14         private [String][6] modelNumber; +15         private [String][6] color; +16         private [String][6] description; +17  +18         @Override +19         public [String][6] toString() { +20                 return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description; +21         } +22 } +``` + +As you can see, Lombok annotation is used within the object to generate the getters/setters for the properties/attributes. Properties can specifically receive the annotations if you do not want all of the attributes to have getters/setters within that class. These two classes will form the container carrying your data to wherever you want to display information. + +#### Set up a database + +I used a [Mongo Docker][7] container for testing. If you have MongoDB installed on your system, you do not have to run an instance in Docker. You can install MongoDB from its website by selecting your system information and following the installation instructions. + +After installing, you can interact with your new MongoDB server through the command line, a GUI such as MongoDB Compass, or IDE drivers for connecting to data sources. Now you can define your data layer to pull, transform, and persist your data. To set your database access properties, navigate to the **applications.properties** file in your application and provide the following: + + +``` + 1 spring.data.mongodb.host=localhost + 2 spring.data.mongodb.port=27017 + 3 spring.data.mongodb.database=BikeStore +``` + +#### Define the data access object/data access layer + +The data access objects (DAO) in the data access layer (DAL) will define how you will interact with data in the database. The awesome thing about using a **spring-boot-starter** is that most of the work for querying the database is already done. + +Start with the **Customer** DAO. Create an interface in a new **dao** folder within the **src** folder, then create another Java class name called **CustomerRepository.java**. The class should look like: + + +``` + 1 package com.stephb.JavaMongo.dao; + 2  + 3 import com.stephb.JavaMongo.dto.Customer; + 4 import java.util.List; + 5 import org.springframework.data.mongodb.repository.MongoRepository; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 public interface CustomerRepository extends MongoRepository<Customer, String>{ +12         @Override +13         public List<Customer> findAll(); +14         public List<Customer> findByFirstName([String][6] firstName); +15         public List<Customer> findByLastName([String][6] lastName); +16 } +``` + +This class is an interface that extends or inherits from the **MongoRepository** class with your DTO (**Customer.java**) and a string because they will be used for querying with your custom functions. Because you have inherited from this class, you have access to many functions that allow persistence and querying of your object without having to implement or reference your own functions. For example, after you instantiate the **CustomerRepository** object, you can use the **Save** function immediately. You can also override these functions if you need more extended functionality. I created a few custom queries to search my collection, given specific elements of my object. + +The **Bike** object also has a repository for interacting with the database. Implement it very similarly to the **CustomerRepository**. It should look like: + + +``` + 1 package com.stephb.JavaMongo.dao; + 2  + 3 import com.stephb.JavaMongo.dto.Bike; + 4 import java.util.List; + 5 import org.springframework.data.mongodb.repository.MongoRepository; + 6  + 7 /** + 8  * + 9  * @author stephon +10  */ +11 public interface BikeRepository extends MongoRepository<Bike,String>{ +12         public Bike findByModelNumber([String][6] modelNumber); +13         @Override +14         public List<Bike> findAll(); +15         public List<Bike> findByColor([String][6] color); +16 } +``` + +#### Run your program + +Now that you have a way to structure your data and a way to pull, transform, and persist it, run your program! + +Navigate to your **Application.java** file (it may have a different name, depending on what you named your application, but it should include "application"). Where the class is defined, include an **implements CommandLineRunner** afterward. This will allow you to implement a **run** method to create a command-line application. Override the **run** method provided by the **CommandLineRunner** interface and include the following to test the **BikeRepository**: + + +``` + 1 package com.stephb.JavaMongo; + 2  + 3 import com.stephb.JavaMongo.dao.BikeRepository; + 4 import com.stephb.JavaMongo.dao.CustomerRepository; + 5 import com.stephb.JavaMongo.dto.Bike; + 6 import java.util.Scanner; + 7 import org.springframework.beans.factory.annotation.Autowired; + 8 import org.springframework.boot.CommandLineRunner; + 9 import org.springframework.boot.SpringApplication; +10 import org.springframework.boot.autoconfigure.SpringBootApplication; +11  +12  +13 @SpringBootApplication +14 public class JavaMongoApplication implements CommandLineRunner { +15                 @Autowired +16                 private BikeRepository bikeRepo; +17                 private CustomerRepository custRepo; +18                  +19     public static void main([String][6][] args) { +20                         SpringApplication.run(JavaMongoApplication.class, args); +21     } +22         @Override +23         public void run([String][6]... args) throws [Exception][8] { +24                 Scanner scan = new Scanner([System][9].in); +25                 [String][6] response = ""; +26                 boolean running = true; +27                 while(running){ +28                         [System][9].out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close"); +29                         response = scan.nextLine(); +30                         if ("B".equals(response.toUpperCase())) { +31                                 [String][6][] bikeInformation = new [String][6][3]; +32                                 [System][9].out.println("Enter the information for the Bike"); +33                                 [System][9].out.println("Model Number"); +34                                 bikeInformation[0] = scan.nextLine(); +35                                 [System][9].out.println("Color"); +36                                 bikeInformation[1] = scan.nextLine(); +37                                 [System][9].out.println("Description"); +38                                 bikeInformation[2] = scan.nextLine(); +39  +40                                 Bike bike = new Bike(); +41                                 bike.setModelNumber(bikeInformation[0]); +42                                 bike.setColor(bikeInformation[1]); +43                                 bike.setDescription(bikeInformation[2]); +44  +45                                 bike = bikeRepo.save(bike); +46                                 [System][9].out.println(bike.toString()); +47  +48  +49                         } else if ("X".equals(response.toUpperCase())) { +50                                 [System][9].out.println("Bye"); +51                                 running = false; +52                         } else { +53                                 [System][9].out.println("Sorry nothing else works right now!"); +54                         } +55                 } +56                  +57         } +58 } +``` + +The **@Autowired** annotation allows automatic dependency injection of the **BikeRepository** and **CustomerRepository** beans. You will use these classes to persist and gather data from the database. + +There you have it! You have created a command-line application that connects to a database and is able to perform CRUD operations with minimal code on your part. + +### Conclusion + +Translating from programming language concepts like objects and classes into calls to store, retrieve, or change data in a database is essential to building an application. The Java Persistence API (JPA) is an important tool in the Java developer's toolkit to solve that challenge. What databases are you exploring in Java? Please share in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/using-java-persistence-api + +作者:[Stephon Brown][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stephb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://www.techrepublic.com/article/mongodb-ceo-tells-hard-truths-about-commercial-open-source/ +[3]: https://github.com/StephonBrown/SpringMongoJava +[4]: https://openjdk.java.net/projects/jdk/11/ +[5]: https://start.spring.io/ +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[7]: https://hub.docker.com/_/mongo +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system diff --git a/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md b/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md new file mode 100644 index 0000000000..e350fbe81c --- /dev/null +++ b/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Best Password Managers For Linux Desktop) +[#]: via: (https://itsfoss.com/password-managers-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +5 Best Password Managers For Linux Desktop +====== + +_**A password manager is a useful tool for creating unique passwords and storing them securely so that you don’t have to remember them. Check out the best password managers available for Linux desktop.**_ + +Passwords are everywhere. Websites, forums, web apps and what not, you need to create accounts and password for them. The trouble comes with the password. Keeping the same password for various accounts poses a security risk because [if one of the websites is compromised, hackers try the same email-password combination on other websites][1] as well. + +But keeping unique passwords for all the new accounts means that you have to remember all of them and it’s not possible for normal humans. This is where password managers come to your help. + +Password managing apps suggest/create strong passwords for you and store them in an encrypted database. You just need to remember the master password for the password manager. + +Mainstream modern web browsers like Mozilla Firefox and Google Chrome have built in password manager. This helps but you are restricted to use it on their web browser only. + +There are third party, dedicated password managers and some of them also provide native desktop applications for Linux. In this article, we filter out the best password managers available for Linux. + +Before you see that, I would also advise going through the list of [free password generators for Linux][2] to generate strong, unique passwords for you. + +### Password Managers for Linux + +Possible non-FOSS alert! + +We’ve given priority to the ones which are open source (with some proprietary options, don’t hate me!) and also offer a standalone desktop app (GUI) for Linux. The proprietary options have been highlighted. + +#### 1\. Bitwarden + +![][3] + +Key Highlights: + + * Open Source + * Free for personal use (paid options available for upgrade) + * End-to-end encryption for Cloud servers + * Cross-platform + * Browser Extensions available + * Command-line tools + + + +Bitwarden is one of the most impressive password managers for Linux. I’ll be honest that I didn’t know about this until now – and I’m already making the switch from [LastPass][4]. I was able to easily import the data from LastPass without any issues and had no trouble whatsoever. + +The premium version costs just $10/year – which seems to be worth it (I’ve upgraded for my personal usage). + +It is an open source solution – so there’s nothing shady about it. You can even host it on your own server and create a password solution for your organization. + +In addition to that, you get all the necessary features like 2FA for login, import/export options for your credentials, fingerprint phrase (a unique key), password generator, and more. + +You can upgrade your account as an organization account for free to be able to share your information with 2 users in total. However, if you want additional encrypted vault storage and the ability to share passwords with 5 users, premium upgrades are available starting from as low as $1 per month. I think it’s definitely worth a shot! + +[Bitwarden][5] + +#### 2\. Buttercup + +![][6] + +Key Highlights: + + * Open Source + * Free, with no premium options. + * Cross-platform + * Browser Extensions available + + + +Yet another open-source password manager for Linux. Buttercup may not be a very popular solution – but if you are looking for a simpler alternative to store your credentials, this would be a good start. + +Unlike some others, you do not have to be skeptical about its cloud servers because it sticks to offline usage only and supports connecting cloud sources like [Dropbox][7], [OwnCloud][8], [Nextcloud][9], and [WebDAV][10]. + +So, you can opt for the cloud source if you need to sync the data. You’ve got the choice for it. + +[Buttercup][11] + +#### 4\. KeePassXC + +![][12] + +Key Highlights: + + * Open Source + * Simple password manager + * Cross-platform + * No mobile support + + + +KeePassXC is a community fork of [KeePassX][13] – which was originally a Linux port for [KeePass][14] on Windows. + +Unless you’re not aware, KeePassX hasn’t been maintained for years – so KeePassXC is a good alternative if you are looking for a dead-simple password manager. KeePassXC may not be the most prettiest or fanciest password manager, but it does the job. + +It is secure and open source as well. I think that makes it worth a shot, what say? + +[KeePassXC][15] + +#### 4\. Enpass (not open source) + +![][16] + +Key Highlights: + + * Proprietary + * A lot of features – including ‘Wearable’ device support. + * Completely free for Linux (with premium features) + + + +Enpass is a quite popular password manager across multiple platforms. Even though it’s not an open source solution, a lot of people rely on it – so you can be sure that it works, at least. + +It offers a great deal of features and if you have a wearable device, it will support that too – which is rare. + +It’s great to see that Enpass manages the package for Linux distros actively. Also, note that it works for 64-bit systems only. You can find the [official instructions for installation][17] on their website. It will require utilizing the terminal, but I followed the steps to test it out and it worked like a charm. + +[Enpass][18] + +#### 5\. myki (not open source) + +![][19] + +Key Highlights: + + * Proprietary + * Avoids cloud servers for storing passwords + * Focuses on local peer-to-peer syncing + * Ability to replace passwords with Fingerprint IDs on mobile + + + +This may not be a popular recommendation – but I found it very interesting. It is a proprietary password manager which lets you avoid cloud servers and relies on peer-to-peer sync. + +So, if you do not want to utilize any cloud servers to store your information, this is for you. It is also interesting to note that the app available for Android and iOS helps you replace passwords with your fingerprint ID. If you want convenience on your mobile phone along with the basic functionality on a desktop password manager – this looks like a good option. + +However, if you are opting for a premium upgrade, the pricing plans are for you to judge, definitely not cheap. + +Do try it out and let us know how it goes! + +[myki][20] + +### Some Other Password Managers Worth Pointing Out + +Even without offering a standalone app for Linux, there are some password managers that may deserve a mention. + +If you need to utilize browser-based (extensions) password managers, we would recommend trying out [LastPass][21], [Dashlane][22], and [1Password][23]. LastPass even offers a [Linux client (and a command-line tool)][24]. + +If you are looking for CLI password managers, you should check out [Pass][25]. + +[Password Safe][26] is also an option – but the Linux client is in beta. I wouldn’t recommend relying on “beta” applications for storing passwords. [Universal Password Manager][27] exists but it’s no longer maintained. You may have also heard about [Password Gorilla][28] but it isn’t actively maintained. + +**Wrapping Up** + +Bitwarden seems to be my personal favorite for now. However, there are several options to choose from on Linux. You can either opt for something that offers a native app or just a browser extension – the choice is yours. + +If we missed listing out a password manager worth trying out, let us know about it in the comments below. As always, we’ll extend our list with your suggestion. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/password-managers-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://medium.com/@computerphonedude/one-of-my-old-passwords-was-hacked-on-6-different-sites-and-i-had-no-clue-heres-how-to-quickly-ced23edf3b62 +[2]: https://itsfoss.com/password-generators-linux/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/bitward.png?ssl=1 +[4]: https://www.lastpass.com/ +[5]: https://bitwarden.com/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/buttercup.png?ssl=1 +[7]: https://www.dropbox.com/ +[8]: https://owncloud.com/ +[9]: https://nextcloud.com/ +[10]: https://en.wikipedia.org/wiki/WebDAV +[11]: https://buttercup.pw/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/KeePassXC.png?ssl=1 +[13]: https://www.keepassx.org/ +[14]: https://keepass.info/ +[15]: https://keepassxc.org +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/enpass.png?ssl=1 +[17]: https://www.enpass.io/support/kb/general/how-to-install-enpass-on-linux/ +[18]: https://www.enpass.io/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/myki.png?ssl=1 +[20]: https://myki.com/ +[21]: https://lastpass.com/ +[22]: https://www.dashlane.com/ +[23]: https://1password.com/ +[24]: https://lastpass.com/misc_download2.php +[25]: https://www.passwordstore.org/ +[26]: https://pwsafe.org/ +[27]: http://upm.sourceforge.net/ +[28]: https://github.com/zdia/gorilla/wiki diff --git a/sources/tech/20191008 Bringing Some Order into a Collection of Photographs.md b/sources/tech/20191008 Bringing Some Order into a Collection of Photographs.md new file mode 100644 index 0000000000..b3c2dee08e --- /dev/null +++ b/sources/tech/20191008 Bringing Some Order into a Collection of Photographs.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bringing Some Order into a Collection of Photographs) +[#]: via: (https://opensourceforu.com/2019/10/bringing-some-order-into-a-collection-of-photographs/) +[#]: author: (Dr Anil Seth https://opensourceforu.com/author/anil-seth/) + +Bringing Some Order into a Collection of Photographs +====== + +[![][1]][2] + +_In this article, the author shares tips on managing photographs using different Internet resources and Python programming._ + +These days, it is very easy to let Google Photos or similar cloud based services manage your photos. You can keep clicking on the smartphone and the photos get saved. The tools for helping you find photos, especially based on the content, keep getting better. There is no cost to keeping all your photos as long as you are an amateur and not taking very high resolution images. And it is far easier to let the dozens of photos clicked by accident remain on the cloud, than to remove them! + +Even if you are willing to delegate the task of managing photos to AI tools, there is still the challenge of what to do with the photos taken before the smartphone era. Broadly, the photos can be divided into two groups — those taken with digital cameras and the physical photo prints. +Each of the two categories will need to be handled and managed differently. First, consider the older physical photos. + +**Managing physical photos in the digital era** + +Photos can deteriorate over time. So, the sooner you digitise them, the better you will preserve your memories. Besides, it is far easier to share a memory digitally when the family members are scattered across the globe. + +The first hard decision is related to the physical albums. Should you take photos out of albums for scanning and risk damaging the albums, or scan the album pages and then crop individual photos from the album pages? Scanning or imaging tools can help with the cropping of photos. +In this article, we assume that you are ready to deal with a collection of individual photos. + +One of the great features of photo management software, both on the cloud and the desktop, is that they organise the photos by date. However, the only date associated with scanned photos is the date of scanning! It will be a while before the AI software will place the photos on a timeline by examining the age of the people in the photos. Currently, you will need to handle this aspect manually. + +One would like to be able to store a date in the metadata of the image so every tool can use it. +Python has a number of packages to help you do this. A pretty easy one to use is pyexiv2. Here is a snippet of sample code to modify the date of an image: + +``` +import datetime +import pyexiv2 +EXIF_DATE = ‘Exif.Image.DateTime’ +EXIF_ORIG_DATE = ‘Exif.Photo.DateTimeOriginal’ +def update_exif(filename,date): +try: +metadata=pyexiv2.ImageMetadata(filename) +metadata.read() +metadata[EXIF_DATE]=date +metadata[EXIF_ORIG_DATE]=date +metadata.write() +except: +print(“Error “ + f) +``` + +Most photo management software seem to use either of the two dates, whichever is available. While you are setting the date, you might as well set both! There can be various ways in which the date for the photo may be specified. You may find the following scheme convenient. +Sort the photos manually into directories, each with the name _yy-mm-dd_. If the date is not known, you might as well select an approximate date. If the month also is not known, set it to 01. Now, you can use the _os.walk_ function to iterate over the directories and files, and set the date for each file as just suggested above. + +You may further divide the files into event based sub-directories, event_label, and use that to label photos, as follows: + +``` +LABEL = ‘Xmp.xmp.Label’ +metadata[LABEL] = pyexiv2.XmpTag(LABEL,event_label) +``` + +This is only for illustration purposes. You can decide on how you would like to organise the photos and use what seems most convenient for you. + +**Digital photos** +Digital photos have different challenges. It is so easy to keep taking photos that you are likely to have a lot of them. Unless you have been careful, you are likely to find that you have used different tools for downloading photos from digital cameras and smartphones, so the file names and directory names are not consistent. A convenient option is to use the date and time of an image from the metadata and rename files accordingly. An example code follows: + +``` +import os +import datetime +import pyexiv2 +EXIF_DATE = ‘Exif.Image.DateTime’ +EXIF_ORIG_DATE = ‘Exif.Photo.DateTimeOriginal’ +def rename_file(p,f,fpref,ctr): +fold,fext = f.rsplit(‘.’,1) # separate the ext, e.g. jpg +fname = fpref + “-%04i”%ctr # add a serial number to ensure uniqueness +fnew = ‘.’.join((fname,fext)) +os.rename(‘/’.join((p,f)),’/’.join((p,fnew))) + +def process_files(path, files): +ctr = 0 +for f in files: +try: +metadata=pyexiv2.ImageMetadata(‘/’.join((path,f))) +metadata.read() +if EXIF_ORIG_DATE in metadata.exif_keys: +datestamp = metadata[EXIF_ORIG_DATE].human_value +else: +datestamp = metadata[EXIF_DATE].human_value +datepref = ‘_’.join([ x.replace(‘:’,’-’) for x in datestamp.split(‘ ‘)]) +rename_file(path,f,datepref,ctr) +ctr += 1 +except: +print(‘Error in %s/%s’%(path,f)) +for path, dirs, files in os.walk(‘.’): # work with current directory for convenience +if len(files) > 0: +process_files(path, files) +``` + +All the file names now have a consistent file name. Since the photo managing software provides a way to view the photos by time, it seems that organising the files into directories that have meaningful names may be preferable. You can move photos into directories/albums that are meaningful. The photo management software will let you view photos either by albums or by dates. + +**Reducing clutter and duplicates** +Over time, my collection included multiple copies of the same photos. In the old days, to share photos easily, I used to even keep low resolution copies. Digikam has an excellent option of identifying similar photos. However, each photo needs to be handled individually. A very convenient tool for finding the duplicate files and managing them programmatically is *. The output of this program contains each set of duplicate files on a separate line. + +You can use the Python Pillow and Matplotlib packages to display the images. Use the image’s size to select the image with the highest resolution among the duplicates, retain that and delete the rest. +One thing is certain, though. After all the work is done, it is a pleasure to look at the photographs and relive all those old memories. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/bringing-some-order-into-a-collection-of-photographs/ + +作者:[Dr Anil Seth][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://opensourceforu.com/author/anil-seth/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Gimp-6-Souping-up-photos.jpg?resize=696%2C492&ssl=1 (Gimp-6 Souping up photos) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Gimp-6-Souping-up-photos.jpg?fit=900%2C636&ssl=1 diff --git a/sources/tech/20191009 Start developing in the cloud with Eclipse Che IDE.md b/sources/tech/20191009 Start developing in the cloud with Eclipse Che IDE.md new file mode 100644 index 0000000000..e3ddcf5e07 --- /dev/null +++ b/sources/tech/20191009 Start developing in the cloud with Eclipse Che IDE.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start developing in the cloud with Eclipse Che IDE) +[#]: via: (https://opensource.com/article/19/10/cloud-ide-che) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +Start developing in the cloud with Eclipse Che IDE +====== +Eclipse Che offers Java developers an Eclipse IDE in a container-based +cloud environment. +![Tools in a cloud][1] + +In the many, many technical interviews I've gone through in my professional career, I've noticed that I'm rarely asked questions that have definitive answers. Most of the time, I'm asked open-ended questions that do not have an absolutely correct answer but evaluate my prior experiences and how well I can explain things. + +One interesting open-ended question that I've been asked several times is: + +> "As you start your first day on a project, what five tools do you install first and why?" + +There is no single definitely correct answer to this question. But as a programmer who codes, I know the must-have tools that I cannot live without. And as a Java developer, I always include an interactive development environment (IDE)—and my two favorites are Eclipse IDE and IntelliJ IDEA. + +### My Java story + +When I was a student at the University of Texas at Austin, most of my computer science courses were taught in Java. And as an enterprise developer working for different companies, I have mostly worked with Java to build various enterprise-level applications. So, I know Java, and most of the time I've developed with Eclipse. I have also used the Spring Tools Suite (STS), which is a variation of the Eclipse IDE that is installed with Spring Framework plugins, and IntelliJ, which is not exactly open source, since I prefer its paid edition, but some Java developers favor it due to its faster performance and other fancy features. + +Regardless of which IDE you use, installing your own developer IDE presents one common, big problem: _"It works on my computer, and I don't know why it doesn't work on your computer."_ + +[![xkcd comic][2]][3] + +Because a developer tool like Eclipse can be highly dependent on the runtime environment, library configuration, and operating system, the task of creating a unified sharing environment for everyone can be quite a challenge. + +But there is a perfect solution to this. We are living in the age of cloud computing, and Eclipse Che provides an open source solution to running an Eclipse-based IDE in a container-based cloud environment. + +### From local development to a cloud environment + +I want the benefits of a cloud-based development environment with the familiarity of my local system. That's a difficult balance to find. + +When I first heard about Eclipse Che, it looked like the cloud-based development environment I'd been looking for, but I got busy with technology I needed to learn and didn't follow up with it. Then a new project came up that required a remote environment, and I had the perfect excuse to use Che. Although I couldn't fully switch to the cloud-based IDE for my daily work, I saw it as a chance to get more familiar with it. + +![Eclipse Che interface][4] + +Eclipse Che IDE has a lot of excellent [features][5], but what I like most is that it is an open source framework that offers exactly what I want to achieve: + + 1. Scalable workspaces leveraging the power of cloud + 2. Extensible and customizable plugins for different runtimes + 3. A seamless onboarding experience to enable smooth collaboration between members + + + +### Getting started with Eclipse Che + +Eclipse Che can be installed on any container-based environment. I run both [Code Ready Workspace 1.2][6] and [Eclipse Che 7][7] on [OpenShift][8], but I've also tried it on top of [Minikube][9] and [Minishift][10]. + +![Eclipse Che on OpenShift][11] + +Read the requirement guides to ensure your runtime is compatible with Che: + + * [Che on Kubernetes][12] + * [Che on OpenShift-compatible OSS environments like OKD][13] + + + +For instance, you can quickly install Eclipse Che if you launch OKD locally through Minishift, but make sure to have at least 5GB RAM to have a smooth experience. + +There are various ways to install Eclipse Che; I recommend leveraging the Che command-line interface, [chectl][14]. Although it is still in an incubator stage, it is my preferred way because it gives multiple configuration and management options. You can also run the installation as [an Operator][15], which you can [read more about][16]. I decided to go with chectl since I did not want to take on both concepts at the same time. Che's quick-start provides [installation steps for many scenarios][17]. + +### Why cloud works best for me + +Although the local installation of Eclipse Che works, I found the most painless way is to install it on one of the common public cloud vendors. + +I like to collaborate with others in my IDE; working collaboratively is essential if you want your application to be something more than a hobby project. And when you are working at a company, there will be enterprise considerations around the application lifecycle of develop, test, and deploy for your application. + +Eclipse Che's multi-user capability means each person owns an isolated workspace that does not interfere with others' workspaces, yet team members can still collaborate on application development by working in the same cluster. And if you are considering moving to Eclipse Che for something more than a hobby or testing, the cloud environment's multi-user features will enable a faster development cycle. This includes [resource management][18] to ensure resources are allocated to each environment, as well as security considerations like [authentication and authorization][19] (or specific needs like [OpenID][20]) that are important to maintaining the environment. + +Therefore, moving Eclipse Che to the cloud early will be a good choice if your development experience is like mine. By moving to the cloud, you can take advantage of cloud-based scalability and resource flexibility while on the road. + +### Use Che and give back + +I really enjoy this new development configuration that enables me to regularly code in the cloud. Open source enables me to do so in an easy way, so it's important for me to consider how to give back. All of Che's components are open source under the Eclipse Public License 2.0 and available on GitHub at the following links: + + * [Eclipse Che GitHub][21] + * [Eclipse Che Operator][15] + * [chectl (Eclipse Che CLI)][14] + + + +Consider using Che and giving back—either as a user by filing bug reports or as a developer to help enhance the project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/cloud-ide-che + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT (Tools in a cloud) +[2]: https://opensource.com/sites/default/files/uploads/1_xkcd.jpg (xkcd comic) +[3]: https://xkcd.com/1316 +[4]: https://opensource.com/sites/default/files/uploads/0_banner.jpg (Eclipse Che interface) +[5]: https://www.eclipse.org/che/features +[6]: https://developers.redhat.com/products/codeready-workspaces/overview +[7]: https://che.eclipse.org/eclipse-che-7-is-now-available-40ae07120b38 +[8]: https://www.openshift.com/ +[9]: https://kubernetes.io/docs/tutorials/hello-minikube/ +[10]: https://www.okd.io/minishift/ +[11]: https://opensource.com/sites/default/files/uploads/2_openshiftresources.jpg (Eclipse Che on OpenShift) +[12]: https://www.eclipse.org/che/docs/che-6/kubernetes-single-user.html +[13]: https://www.eclipse.org/che/docs/che-6/openshift-single-user.html +[14]: https://github.com/che-incubator/chectl +[15]: https://github.com/eclipse/che-operator +[16]: https://opensource.com/article/19/6/kubernetes-potential-run-anything +[17]: https://www.eclipse.org/che/docs/che-7/che-quick-starts.html#running-che-locally_che-quick-starts +[18]: https://www.eclipse.org/che/docs/che-6/resource-management.html +[19]: https://www.eclipse.org/che/docs/che-6/user-management.html +[20]: https://www.eclipse.org/che/docs/che-6/authentication.html +[21]: https://github.com/eclipse/che diff --git a/sources/tech/20191009 The Emacs Series ht.el- The Hash Table Library for Emacs.md b/sources/tech/20191009 The Emacs Series ht.el- The Hash Table Library for Emacs.md new file mode 100644 index 0000000000..84e5a46acb --- /dev/null +++ b/sources/tech/20191009 The Emacs Series ht.el- The Hash Table Library for Emacs.md @@ -0,0 +1,414 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Emacs Series ht.el: The Hash Table Library for Emacs) +[#]: via: (https://opensourceforu.com/2019/10/the-emacs-series-ht-el-the-hash-table-library-for-emacs/) +[#]: author: (Shakthi Kannan https://opensourceforu.com/author/shakthi-kannan/) + +The Emacs Series ht.el: The Hash Table Library for Emacs +====== + +[![][1]][2] + +_In this article, we explore the various hash table functions and macros provided by the ht.el library._ + +The ht.el hash table library for Emacs has been written by Wilfred Hughes. The latest tagged release is version 2.2 and the software is released under the GNU General Public License v3. The source code is available at __. It provides a comprehensive list of hash table operations and a very consistent API. For example, any mutation function will always return nil. + +**Installation** +The Milkypostman’s Emacs Lisp Package Archive (MELPA) and Marmalade repositories have ht.el available for installation. You can add the following command to your Emacs init.el configuration file: + +``` +(require ‘package) +(add-to-list ‘package-archives ‘(“melpa” . “https://melpa.org/packages/”) t) +``` + +You can then run _M-x package <RET> ht <RET>_ to install the _ht.el_ library. If you are using Cask, then you simply add the following code to your Cask file: + +``` +(depends-on “ht”) +``` + +You will need the ht library in your Emacs environment before using the API functions. + +``` +(require ‘ht) +``` + +**Usage** +Let us now explore the various API functions provided by the _ht.el_ library. The _ht-create_ function will return a hash table that can be assigned to a hash table variable. You can also verify that the variable is a hash table using the type-of function as shown below: + +``` +(let ((greetings (ht-create))) +(type-of greetings)) + +hash-table +``` + +You can add an item to the hash table using the ht-set! function, which takes the hash table, key and value as arguments. The entries in the hash table can be listed using the _ht-items_ function as illustrated below: + +``` +(ht-set! hash-table key value) ;; Syntax +(ht-items hash-table) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-items greetings)) + +((“Adam” “Hello Adam!”)) +``` + +The keys present in a hash table can be retrieved using the _ht-keys_ function, while the values in a hash table can be obtained using the _ht-values_ function, as shown in the following examples: + +``` +(ht-keys hash-table) ;; Syntax +(ht-values hash-table) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-keys greetings)) + +(“Adam”) + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-values greetings)) + +(“Hello Adam!”) +``` + +The “ht-clear!” function can be used to clear all the items in a hash-table. For example: + +``` +(ht-clear! hash-table) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-clear! greetings) +(ht-items greetings)) + +nil +``` + +An entire hash table can be copied to another hash table using the _ht-copy_ API as shown below: + +``` +(ht-copy hash-table) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-items (ht-copy greetings))) + +((“Adam” “Hello Adam!”)) +``` + +The _ht-merge_ function can combine two different hash tables into one. In the following example, the items in the _english_ and _numbers_ hash tables are merged together. + +``` +(ht-merge hash-table1 hash-table2) ;; Syntax + +(let ((english (ht-create)) +(numbers (ht-create))) +(ht-set! english “a” “A”) +(ht-set! numbers “1” “One”) +(ht-items (ht-merge english numbers))) + +((“1” “One”) (“a” “A”)) +``` + +You can make modifications to an existing hash table. For example, you can remove an item in the hash table using the _ht-remove!_ function, which takes as input a hash table and a key as shown below: + +``` +(ht-remove hash-table key) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-set! greetings “Eve” “Hello Eve!”) +(ht-remove! greetings “Eve”) +(ht-items greetings)) + +((“Adam” “Hello Adam!”)) +``` + +You can do an in-place modification to an item in the hash table using the _ht-update!_ function. An example is given below: + +``` +(ht-update! hash-table key value) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-update! greetings (ht (“Adam” “Howdy Adam!”))) +(ht-items greetings)) + +((“Adam” “Howdy Adam!”)) +``` + +A number of predicate functions are available in _ht.el_ that can be used to check for conditions in a hash table. The _ht_? function checks to see if the input argument is a hash table. It returns t if the argument is a hash table and _nil_ otherwise. + +``` +(ht? hash-table) ;; Syntax + +(ht? nil) + +nil + +(let ((greetings (ht-create))) +(ht? greetings)) + +t +``` + +You can verify if a key is present in a hash table using the _ht-contains_? API, which takes a hash table and key as arguments. It returns t if the item exists in the hash table. Otherwise, it simply returns _nil_. + +``` +(ht-contains? hash-table key) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-contains? greetings “Adam”)) + +t + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-contains? greetings “Eve”)) + +nil +``` + +The _ht-empty?_ function can be used to check if the input hash-table is empty or not. A couple of examples are shown below: + +``` +(ht-empty? hash-table) ;; Syntax + +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-empty? greetings)) + +nil + +(let ((greetings (ht-create))) +(ht-empty? greetings)) + +t +``` + +The equality check can be used on a couple of hash tables to verify if they are the same, using the _ht-equal_? function as illustrated below: + +``` +(ht-equal? hash-table1 hash-table2) ;; Syntax + +(let ((english (ht-create)) +(numbers (ht-create))) +(ht-set! english “a” “A”) +(ht-set! numbers “1” “One”) +(ht-equal? english numbers)) + +nil +``` + +A few of the ht.el library functions accept a function as an argument and apply it to the items of the list. For example, the ht-map function takes a function with a key and value as arguments, and applies the function to each item in the hash table. For example: + +``` +(ht-map function hash-table) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-map (lambda (x y) (* x 2)) numbers)) + +(2) +``` + +You can also use the _ht-each_ API to iterate through each item in the hash-table. In the following example, the sum of all the values is calculated and finally printed in the output. + +``` +(ht-each function hash-table) ;; Syntax + +(let ((numbers (ht-create)) +(sum 0)) +(ht-set! numbers “A” 1) +(ht-set! numbers “B” 2) +(ht-set! numbers “C” 3) +(ht-each (lambda (key value) (setq sum (+ sum value))) numbers) +(print sum)) + +6 +``` + +The _ht-select_ function can be used to match and pick a specific set of items in the list. For example: + +``` +(ht-select function hash-table) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-set! numbers 2 “Two”) +(ht-items (ht-select (lambda (x y) (= x 2)) numbers))) + +((“2” “Two”)) +``` + +You can also reject a set of values by passing a filter function to the _ht-reject API_, and retrieve those items from the hash table that do not match the predicate function. In the following example, key 2 is rejected and the item with key 1 is returned. + +``` +(ht-reject function hash-table) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-set! numbers 2 “Two”) +(ht-items (ht-reject (lambda (x y) (= x 2)) numbers))) + +((“1” “One”)) +``` + +If you want to mutate the existing hash table and remove the items that match a filter function, you can use the _ht-reject_! function as shown below: + +``` +(ht-reject! function hash-table) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-set! numbers 2 “Two”) +(ht-reject! (lambda (x y) (= x 2)) numbers) +(ht-items numbers)) + +((“1” “One”)) +``` + +The _ht-find_ function accepts a function and a hash table, and returns the items that satisfy the input function. For example: + +``` +(ht-find function hash-table) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-set! numbers 2 “Two”) +(ht-find (lambda (x y) (= x 2)) numbers)) + +(2 “Two”) +``` + +You can retrieve the items in the hash table using a specific set of keys with the _ht-select-keys_ API, as illustrated below: + +``` +(ht-select-keys hash-table keys) ;; Syntax + +(let ((numbers (ht-create))) +(ht-set! numbers 1 “One”) +(ht-set! numbers 2 “Two”) +(ht-items (ht-select-keys numbers ‘(1)))) + +((1 “One”)) +``` + +The following two examples are more comprehensive in using the hash table library functions. The _say-hello_ function returns a greeting based on the name as shown below: + +``` +(defun say-hello (name) +(let ((greetings (ht-create))) +(ht-set! greetings “Adam” “Hello Adam!”) +(ht-set! greetings “Eve” “Hello Eve!”) +(ht-get greetings name “Hello stranger!”))) + +(say-hello “Adam”) +“Hello Adam!” + +(say-hello “Eve”) +“Hello Eve!” + +(say-hello “Bob”) +“Hello stranger!” +``` + +The _ht_ macro returns a hash table and we create nested hash tables in the following example: + +``` +(let ((alphabets (ht (“Greek” (ht (1 (ht (‘letter “α”) +(‘name “alpha”))) +(2 (ht (‘letter “β”) +(‘name “beta”))))) +(“English” (ht (1 (ht (‘letter “a”) +(‘name “A”))) +(2 (ht (‘letter “b”) +(‘name “B”)))))))) +(ht-get* alphabets “Greek” 1 ‘letter)) + +“α” +``` + +**Testing** +The _ht.el_ library has built-in tests that you can execute to validate the API functions. You first need to clone the repository using the following commands: + +``` +$ git clone git@github.com:Wilfred/ht.el.git + +Cloning into ‘ht.el’... +remote: Enumerating objects: 1, done. +remote: Counting objects: 100% (1/1), done. +Receiving objects: 100% (471/471), 74.58 KiB | 658.00 KiB/s, done. +remote: Total 471 (delta 0), reused 1 (delta 0), pack-reused 470 +Resolving deltas: 100% (247/247), done. +``` + +If you do not have Cask, install the same using the instructions provided in the _README_ file at __. +You can then change the directory into the cloned ‘_ht.el_’ folder and run _cask install_. This will locally install the required dependencies for running the tests. + +``` +$ cd ht.el/ +$ cask install +Loading package information... Select coding system (default utf-8): +done +Package operations: 4 installs, 0 removals +- Installing [ 1/4] dash (2.12.0)... done +- Installing [ 2/4] ert-runner (latest)... done +- Installing [ 3/4] cl-lib (latest)... already present +- Installing [ 4/4] f (latest)... already present +``` + +A _Makefile_ exists in the top-level directory and you can simply run ‘make’ to run the tests, as shown below: + +``` +$ make +rm -f ht.elc +make unit +make[1]: Entering directory ‘/home/guest/ht.el’ +cask exec ert-runner +......................................... + +Ran 41 tests in 0.016 seconds +make[1]: Leaving directory ‘/home/guest/ht.el’ +make compile +make[1]: Entering directory ‘/home/guest/ht.el’ +cask exec emacs -Q -batch -f batch-byte-compile ht.el +make[1]: Leaving directory ‘/home/guest/ht.el’ +make unit +make[1]: Entering directory ‘/home/guest/ht.el’ +cask exec ert-runner +......................................... + +Ran 41 tests in 0.015 seconds +make[1]: Leaving directory ‘/home/guest/ht.el’ +make clean-elc +make[1]: Entering directory ‘/home/guest/ht.el’ +rm -f ht.elc +make[1]: Leaving directory ‘/home/guest/ht.el’ +``` + +You are encouraged to read the ht.el _README_ file from the GitHub repository at __ for more information. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-emacs-series-ht-el-the-hash-table-library-for-emacs/ + +作者:[Shakthi Kannan][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://opensourceforu.com/author/shakthi-kannan/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/GPL-3.jpg?resize=696%2C351&ssl=1 (GPL 3) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/GPL-3.jpg?fit=998%2C503&ssl=1 diff --git a/sources/tech/20191010 Achieve high-scale application monitoring with Prometheus.md b/sources/tech/20191010 Achieve high-scale application monitoring with Prometheus.md new file mode 100644 index 0000000000..dc5ecedfff --- /dev/null +++ b/sources/tech/20191010 Achieve high-scale application monitoring with Prometheus.md @@ -0,0 +1,301 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Achieve high-scale application monitoring with Prometheus) +[#]: via: (https://opensource.com/article/19/10/application-monitoring-prometheus) +[#]: author: (Paul Brebner https://opensource.com/users/paul-brebner) + +Achieve high-scale application monitoring with Prometheus +====== +Prometheus' prowess as a monitoring system and its ability to achieve +high-scalability make it a strong choice for monitoring applications and +servers. +![Tall building with windows][1] + +[Prometheus][2] is an increasingly popular—for good reason—open source tool that provides monitoring and alerting for applications and servers. Prometheus' great strength is in monitoring server-side metrics, which it stores as [time-series data][3]. While Prometheus doesn't lend itself to application performance management, active control, or user experience monitoring (although a GitHub extension does make user browser metrics available to Prometheus), its prowess as a monitoring system and ability to achieve high-scalability through a [federation of servers][4] make Prometheus a strong choice for a wide variety of use cases. + +In this article, we'll take a closer look at Prometheus' architecture and functionality and then examine a detailed instance of the tool in action. + +### Prometheus architecture and components + +Prometheus consists of the Prometheus server (handling service discovery, metrics retrieval and storage, and time-series data analysis through the PromQL query language), a data model for metrics, a graphing GUI, and native support for [Grafana][5]. There is also an optional alert manager that allows users to define alerts via the query language and an optional push gateway for short-term application monitoring. These components are situated as shown in the following diagram. + +![Promethius architecture][6] + +Prometheus can automatically capture standard metrics by using agents to execute general-purpose code in the application environment. It can also capture custom metrics through instrumentation, placing custom code within the source code of the monitored application. Prometheus officially supports [client libraries][7] for Go, Python, Ruby, and Java/Scala and also enables users to write their own libraries. Additionally, many unofficial libraries for other languages are available. + +Developers can also utilize third-party [exporters][8] to automatically activate instrumentation for many popular software solutions they might be using. For example, users of JVM-based applications like open source [Apache Kafka][9] and [Apache Cassandra][10] can easily collect metrics by leveraging the existing [JMX exporter][11]. In other cases, an exporter won't be needed because the application will [expose metrics][12] that are already in the Prometheus format. Those on Cassandra might also find Instaclustr's freely available [Cassandra Exporter for Prometheus][13] to be helpful, as it integrates Cassandra metrics from a self-managed cluster into Prometheus application monitoring. + +Also important: Developers can leverage an available [node exporter][14] to monitor kernel metrics and host hardware. Prometheus offers a [Java client][15] as well, with a number of features that can be registered either piecemeal or at once through a single **DefaultExports.initialize();** command—including memory pools, garbage collection, JMX, classloading, and thread counts. + +### Prometheus data modeling and metrics + +Prometheus provides four metric types: + + * **Counter:** Counts incrementing values; a restart can return these values to zero + * **Gauge:** Tracks metrics that can go up and down + * **Histogram:** Observes data according to specified response sizes or durations and counts the sums of observed values along with counts in configurable buckets + * **Summary:** Counts observed data similar to a histogram and offers configurable quantiles that are calculated over a sliding time window + + + +Prometheus time-series data metrics each include a string name, which follows a naming convention to include the name of the monitored data subject, the logical type, and the units of measure used. Each metric includes streams of 64-bit float value that are timestamped down to the millisecond, and a set of key:value pairs labeling the dimensions it measures. Prometheus automatically adds **Job** and **Instance** labels to each metric to keep track of the configured job name of the data target and the **<host>:<port>** piece of the scraped target URL, respectively. + +### Prometheus example: the Anomalia Machina anomaly detection experiment + +Before moving into the example, download and begin using open source Prometheus by following this [getting started][16] guide. + +To demonstrate how to put Prometheus into action and perform application monitoring at a high scale, let's take a look at a recent [experimental Anomalia Machina project][17] we completed at Instaclustr. This project—just a test case, not a commercially available solution—leverages Kafka and Cassandra in an application deployed by Kubernetes, which performs anomaly detection on streaming data. (Such detection is critical to use cases including IoT applications and digital ad fraud, among other areas.) The experimental application relies heavily on Prometheus to collect application metrics across distributed instances and make them readily available to view. + +This diagram displays the experiment's architecture: + +![Anomalia Machina Architecture][18] + +Our goals in utilizing Prometheus included monitoring the application's more generic metrics, such as throughput, as well as the response times delivered by the Kafka load generator (the Kafka producer), the Kafka consumer, and the Cassandra client tasked with detecting any anomalies in the data. Prometheus monitors the system's hardware metrics as well, such as the CPU for each AWS EC2 instance running the application. The project also counts on Prometheus to monitor application-specific metrics such as the total number of rows each Cassandra read returns and, crucially, the number of anomalies it detects. All of this monitoring is centralized for simplicity. + +In practice, this means forming a test pipeline with producer, consumer, and detector methods, as well as the following three metrics: + + * A counter metric, called **prometheusTest_requests_total**, increments each time that each pipeline stage executes without incident, while a **stage** label allows for tracking the successful execution of each stage, and a **total** label tracks the total pipeline count. + * Another counter metric, called **prometheusTest_anomalies_total**, counts any detected anomalies. + * Finally, a gauge metric called **prometheusTest_duration_seconds** tracks the seconds of duration for each stage (again using a **stage** label and a **total** label). + + + +The code behind these measurements increments counter metrics using the **inc()** method and sets the time value of the gauge metric with the **setToTime()** method. This is demonstrated in the following annotated example code: + + +``` +import java.io.IOException; +import io.prometheus.client.Counter; +import io.prometheus.client.Gauge; +import io.prometheus.client.exporter.HTTPServer; +import io.prometheus.client.hotspot.DefaultExports; +  +// +// Demo of how we plan to use Prometheus Java client to instrument Anomalia Machina. +// Note that the Anomalia Machina application will have Kafka Producer and Kafka consumer and rest of pipeline running in multiple separate processes/instances. +// So metrics from each will have different host/port combinations. +public class PrometheusBlog {   +static String appName = "prometheusTest"; +// counters can only increase in value (until process restart) +// Execution count. Use a single Counter for all stages of the pipeline, stages are distinguished by labels +static final Counter pipelineCounter = Counter.build() +    .name(appName + "_requests_total").help("Count of executions of pipeline stages") +    .labelNames("stage") +    .register(); +// in theory could also use pipelineCounter to count anomalies found using another label +// but less potential for confusion having another counter. Doesn't need a label +static final Counter anomalyCounter = Counter.build() +    .name(appName + "_anomalies_total").help("Count of anomalies detected") +    .register(); +// A Gauge can go up and down, and is used to measure current value of some variable. +// pipelineGauge will measure duration in seconds of each stage using labels. +static final Gauge pipelineGauge = Gauge.build() +    .name(appName + "_duration_seconds").help("Gauge of stage durations in seconds") +    .labelNames("stage") +    .register(); +  +public static void main(String[] args) { +// Allow default JVM metrics to be exported +   DefaultExports.initialize(); +  +   // Metrics are pulled by Prometheus, create an HTTP server as the endpoint +   // Note if there are multiple processes running on the same server need to change port number. +   // And add all IPs and port numbers to the Prometheus configuration file. +HTTPServer server = null; +try { +server = new HTTPServer(1234); +} catch (IOException e) { +e.printStackTrace(); +} +// now run 1000 executions of the complete pipeline with random time delays and increasing rate +int max = 1000; +for (int i=0; i < max; i++) +{ +// total time for complete pipeline, and increment anomalyCounter +pipelineGauge.labels("total").setToTime(() -> { +producer(); +consumer(); +if (detector()) +anomalyCounter.inc(); +}); +// total pipeline count +pipelineCounter.labels("total").inc(); +System.out.println("i=" + i); +  +// increase the rate of execution +try { +Thread.sleep(max-i); +} catch (InterruptedException e) { +e.printStackTrace(); +} +} +server.stop(); +} +// the 3 stages of the pipeline, for each we increase the stage counter and set the Gauge duration time +public  static void producer() { +class Local {}; +String name = Local.class.getEnclosingMethod().getName(); +pipelineGauge.labels(name).setToTime(() -> { +try { +Thread.sleep(1 + (long)(Math.random()*20)); +} catch (InterruptedException e) { +e.printStackTrace(); +} +}); +pipelineCounter.labels(name).inc(); +   } +public  static void consumer() { +class Local {}; +String name = Local.class.getEnclosingMethod().getName(); +pipelineGauge.labels(name).setToTime(() -> { +try { +Thread.sleep(1 + (long)(Math.random()*10)); +} catch (InterruptedException e) { +e.printStackTrace(); +} +}); +pipelineCounter.labels(name).inc(); +   } +// detector returns true if anomaly detected else false +public  static boolean detector() { +class Local {}; +String name = Local.class.getEnclosingMethod().getName(); +pipelineGauge.labels(name).setToTime(() -> { +try { +Thread.sleep(1 + (long)(Math.random()*200)); +} catch (InterruptedException e) { +e.printStackTrace(); +} +}); +pipelineCounter.labels(name).inc(); +return (Math.random() > 0.95); +   } +} +``` + +Prometheus collects metrics by polling ("scraping") instrumented code (unlike some other monitoring solutions that receive metrics via push methods). The code example above creates a required HTTP server on port 1234 so that Prometheus can scrape metrics as needed. + +The following sample code addresses Maven dependencies: + + +``` +<!-- The client --> +<dependency> +<groupId>io.prometheus</groupId> +<artifactId>simpleclient</artifactId> +<version>LATEST</version> +</dependency> +<!-- Hotspot JVM metrics--> +<dependency> +<groupId>io.prometheus</groupId> +<artifactId>simpleclient_hotspot</artifactId> +<version>LATEST</version> +</dependency> +<!-- Exposition HTTPServer--> +<dependency> +<groupId>io.prometheus</groupId> +<artifactId>simpleclient_httpserver</artifactId> +<version>LATEST</version> +</dependency> +<!-- Pushgateway exposition--> +<dependency> +<groupId>io.prometheus</groupId> +<artifactId>simpleclient_pushgateway</artifactId> +<version>LATEST</version> +</dependency> +``` + +The code example below tells Prometheus where it should look to scrape metrics. This code can simply be added to the configuration file (default: Prometheus.yml) for basic deployments and tests. + + +``` +global: + scrape_interval:    15s # By default, scrape targets every 15 seconds. +  +# scrape_configs has jobs and targets to scrape for each. +scrape_configs: +# job 1 is for testing prometheus instrumentation from multiple application processes. + # The job name is added as a label job=<job_name> to any timeseries scraped from this config. + - job_name: 'testprometheus' +  +   # Override the global default and scrape targets from this job every 5 seconds. +   scrape_interval: 5s +    +   # this is where to put multiple targets, e.g. for Kafka load generators and detectors +   static_configs: +     - targets: ['localhost:1234', 'localhost:1235'] +      + # job 2 provides operating system metrics (e.g. CPU, memory etc). + - job_name: 'node' +  +  # Override the global default and scrape targets from this job every 5 seconds. +   scrape_interval: 5s +    +   static_configs: +     - targets: ['localhost:9100'] +``` + +Note the job named "node" that uses port 9100 in this configuration file; this job offers node metrics and requires running the [Prometheus node exporter][14] on the same server where the application is running. Polling for metrics should be done with care: doing it too often can overload applications, too infrequently can result in lag. Where application metrics can't be polled, Prometheus also offers a [push gateway][19]. + +### Viewing Prometheus metrics and results + +Our experiment initially used [expressions][20], and later [Grafana][5], to visualize data and overcome Prometheus' lack of default dashboards. Using the Prometheus interface (or [http://localhost:][21]9[090/metrics][21]), select metrics by name and then enter them in the expression box for execution. (Note that it's common to experience error messages at this stage, so don't be discouraged if you encounter a few issues.) With correctly functioning expressions, results will be available for display in tables or graphs as appropriate. + +Using the **[irate][22]** or **[rate][23]** function on a counter metric will produce a useful rate graph: + +![Rate graph][24] + +Here is a similar graph of a gauge metric: + +![Gauge graph][25] + +Grafana provides much more robust graphing capabilities and built-in Prometheus support with graphs able to display multiple metrics: + +![Grafana graph][26] + +To enable Grafana, install it, navigate to , create a Prometheus data source, and add a Prometheus graph using an expression. A note here: An empty graph often points to a time range issue, which can usually be solved by using the "Last 5 minutes" setting. + +Creating this experimental application offered an excellent opportunity to build our knowledge of what Prometheus is capable of and resulted in a high-scale experimental production application that can monitor 19 billion real-time data events for anomalies each day. By following this guide and our example, hopefully, more developers can successfully put Prometheus into practice. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/application-monitoring-prometheus + +作者:[Paul Brebner][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/paul-brebner +[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://prometheus.io/ +[3]: https://prometheus.io/docs/concepts/data_model +[4]: https://prometheus.io/docs/prometheus/latest/federation +[5]: https://grafana.com/ +[6]: https://opensource.com/sites/default/files/uploads/prometheus_architecture.png (Promethius architecture) +[7]: https://prometheus.io/docs/instrumenting/clientlibs/ +[8]: https://prometheus.io/docs/instrumenting/exporters/ +[9]: https://kafka.apache.org/ +[10]: http://cassandra.apache.org/ +[11]: https://github.com/prometheus/jmx_exporter +[12]: https://prometheus.io/docs/instrumenting/exporters/#software-exposing-prometheus-metrics +[13]: https://github.com/instaclustr/cassandra-exporter +[14]: https://prometheus.io/docs/guides/node-exporter/ +[15]: https://github.com/prometheus/client_java +[16]: https://prometheus.io/docs/prometheus/latest/getting_started/ +[17]: https://github.com/instaclustr/AnomaliaMachina +[18]: https://opensource.com/sites/default/files/uploads/anomalia_machina_architecture.png (Anomalia Machina Architecture) +[19]: https://prometheus.io/docs/instrumenting/pushing/ +[20]: https://prometheus.io/docs/prometheus/latest/querying/basics/ +[21]: http://localhost:9090/metrics +[22]: https://prometheus.io/docs/prometheus/latest/querying/functions/#irate +[23]: https://prometheus.io/docs/prometheus/latest/querying/functions/#rate +[24]: https://opensource.com/sites/default/files/uploads/rate_graph.png (Rate graph) +[25]: https://opensource.com/sites/default/files/uploads/gauge_graph.png (Gauge graph) +[26]: https://opensource.com/sites/default/files/uploads/grafana_graph.png (Grafana graph) diff --git a/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md new file mode 100644 index 0000000000..718f41ebc9 --- /dev/null +++ b/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server) +[#]: via: (https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server +====== + +**EPEL** Stands for Extra Packages for Enterprise Linux, it is a free and opensource additional packages repository available for **CentOS** and **RHEL** servers. As the name suggests, EPEL repository provides extra and additional packages which are not available in the default package repositories of [CentOS 8][1] and [RHEL 8][2]. + +In this article we will demonstrate how to enable and use epel repository on CentOS 8 and RHEL 8 Server. + +[![EPEL-Repo-CentOS8-RHEL8][3]][4] + +### Prerequisites of EPEL Repository + + * Minimal CentOS 8 and RHEL 8 Server + * Root or sudo admin privileges + * Internet Connection + + + +### Install and Enable EPEL Repository on RHEL 8.x Server + +Login or ssh to your RHEL 8.x server and execute the following dnf command to install EPEL rpm package, + +``` +[root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y +``` + +Output of above command would be something like below, + +![dnf-install-epel-repo-rehl8][3] + +Once epel rpm package is installed successfully then it will automatically enable and configure its yum / dnf repository.  Run following dnf or yum command to verify whether EPEL repository is enabled or not, + +``` +[root@linuxtechi ~]# dnf repolist epel +Or +[root@linuxtechi ~]# dnf repolist epel -v +``` + +![epel-repolist-rhel8][3] + +### Install and Enable EPEL Repository on CentOS 8.x Server + +Login or ssh to your CentOS 8 server and execute following dnf or yum command to install ‘**epel-release**‘ rpm package. In CentOS 8 server, epel rpm package is available in its default package repository. + +``` +[root@linuxtechi ~]# dnf install epel-release -y +Or +[root@linuxtechi ~]# yum install epel-release -y +``` + +Execute the following commands to verify the status of epel repository on CentOS 8 server, + +``` + [root@linuxtechi ~]# dnf repolist epel +Last metadata expiration check: 0:00:03 ago on Sun 13 Oct 2019 04:18:05 AM BST. +repo id repo name status +*epel Extra Packages for Enterprise Linux 8 - x86_64 1,977 +[root@linuxtechi ~]# +[root@linuxtechi ~]# dnf repolist epel -v +…………………… +Repo-id : epel +Repo-name : Extra Packages for Enterprise Linux 8 - x86_64 +Repo-status : enabled +Repo-revision: 1570844166 +Repo-updated : Sat 12 Oct 2019 02:36:32 AM BST +Repo-pkgs : 1,977 +Repo-size : 2.1 G +Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos + Updated : Sun 13 Oct 2019 04:28:24 AM BST +Repo-baseurl : rsync://repos.del.extreme-ix.org/epel/8/Everything/x86_64/ (34 more) +Repo-expire : 172,800 second(s) (last: Sun 13 Oct 2019 04:28:24 AM BST) +Repo-filename: /etc/yum.repos.d/epel.repo +Total packages: 1,977 +[root@linuxtechi ~]# +``` + +Above command’s output confirms that we have successfully enabled epel repo. Let’s perform some basic operations on EPEL repo. + +### List all available packages from epel repository + +If you want to list all the packages from epel repository then run the following dnf command, + +``` +[root@linuxtechi ~]# dnf repository-packages epel list +…………… +Last metadata expiration check: 0:38:18 ago on Sun 13 Oct 2019 04:28:24 AM BST. +Installed Packages +epel-release.noarch 8-6.el8 @epel +Available Packages +BackupPC.x86_64 4.3.1-2.el8 epel +BackupPC-XS.x86_64 0.59-3.el8 epel +CGSI-gSOAP.x86_64 1.3.11-7.el8 epel +CGSI-gSOAP-devel.x86_64 1.3.11-7.el8 epel +Field3D.x86_64 1.7.2-16.el8 epel +Field3D-devel.x86_64 1.7.2-16.el8 epel +GraphicsMagick.x86_64 1.3.33-1.el8 epel +GraphicsMagick-c++.x86_64 1.3.33-1.el8 epel +………………………… +zabbix40-web-mysql.noarch 4.0.12-1.el8 epel +zabbix40-web-pgsql.noarch 4.0.12-1.el8 epel +zerofree.x86_64 1.1.1-3.el8 epel +zimg.x86_64 2.8-4.el8 epel +zimg-devel.x86_64 2.8-4.el8 epel +zstd.x86_64 1.4.2-1.el8 epel +zvbi.x86_64 0.2.35-9.el8 epel +zvbi-devel.x86_64 0.2.35-9.el8 epel +zvbi-fonts.noarch 0.2.35-9.el8 epel +[root@linuxtechi ~]# +``` + +### Search a package from epel repository + +Let’s assume if we want to search Zabbix package in epel repository, execute the following dnf command, + +``` +[root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix +``` + +Output of above command would be something like below, + +![epel-repo-search-package-centos8][3] + +### Install a package from epel repository + +Let’s assume we want to install htop package from epel repo, then issue the following dnf command, + +Syntax: + +# dnf –enablerepo=”epel” install <pkg_name> + +``` +[root@linuxtechi ~]# dnf --enablerepo="epel" install htop -y +``` + +**Note:** If we don’t specify the “**–enablerepo=epel**” in above command then it will look for htop package in all available package repositories. + +That’s all from this article, I hope above steps helps you to enable and configure EPEL repository on CentOS 8 and RHEL 8 Server, please don’t hesitate to share your comments and feedback in below comments section. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/centos-8-installation-guide-screenshots/ +[2]: https://www.linuxtechi.com/install-configure-kvm-on-rhel-8/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/EPEL-Repo-CentOS8-RHEL8.jpg diff --git a/sources/tech/20191013 Sugarizer- The Taste of Sugar on Any Device.md b/sources/tech/20191013 Sugarizer- The Taste of Sugar on Any Device.md new file mode 100644 index 0000000000..749ff78037 --- /dev/null +++ b/sources/tech/20191013 Sugarizer- The Taste of Sugar on Any Device.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sugarizer: The Taste of Sugar on Any Device) +[#]: via: (https://opensourceforu.com/2019/10/sugarizer-the-taste-of-sugar-on-any-device/) +[#]: author: (Dr Anil Seth https://opensourceforu.com/author/anil-seth/) + +Sugarizer: The Taste of Sugar on Any Device +====== + +[![][1]][2] + +_Sugar is a learning platform that was initially developed for the OLPC project. The Sugar Learning Environment can be downloaded and installed on any Linux-compatible hardware. Sugarizer mimics the UI of Sugar using HTML5 and CSS3._ + +The One Laptop Per Child (OLPC) project was launched less than 12 years ago. The goal of bringing down the cost of a laptop to US$ 100 was never really achieved. The project also did not turn out to be as much of a success as anticipated. However, the goal was not really about the laptop, but to educate as many children as possible. +The interactive learning environment of the OLPC project was equally critical. This became a separate project under Sugar Labs, [_https://wiki.sugarlabs.org/_][3], and continues to be active. The Sugar Learning Environment is available as a Fedora spin, and can be downloaded and installed on any Linux-compatible hardware. It would be a good option to install it on an old system, which could then be donated. The US$ 90 Pinebook, [_https://www.pine64.org/,_][4] with Sugar installed on it would also make a memorable and useful gift. +The Sugar Environment can happily coexist with other desktop environments on Linux. So, the computer does not have to be dedicated to Sugar. On Fedora, you may add it to your existing desktop as follows: + +``` +$ sudo dnf group install ‘Sugar Desktop Environment’ +``` + +I have not tried it on Ubuntu. However, the following command should work: + +``` +$ sudo apt install sucrose +``` + +However, Sugar remains, by and large, an unknown entity. This is especially disappointing considering that the need to _learn to learn_ has never been greater. +Hence, the release of Sugarizer is a pleasant surprise. It allows you to use the Sugar environment on any device, with the help of Web technologies. Sugarizer mimics the UI of Sugar using HTML5 and CSS3. It runs activities that have been written in HTML5/JavaScript. The current release includes a number of Sugar activities written initially in Python, which have been ported to HTML5/JavaScript. +You may try the new release at _sugarizer.org_. Better still, install it from Google Play on your Android tablet or from App Store on an Apple device. It works well even on a two-year-old, low-end tablet. Hence, you may easily put your old tablet to good use by gifting it to a child after installing Sugarizer on it. In this way, you could even rationalise your desire to buy the replacement tablet you have been eyeing. + +**Does it work?** +My children are too old and grandchildren too young. Reason tells me that it should work. Experience also tells me that it will most likely NOT improve school grades. I did not like school. I was bored most of the time. If I was studying in today’s schools, I would have had ulcers or a nervous breakdown! +When I think of schools, I recall the frustration of a child long ago (just 20 years) who got an answer wrong. The book and the teacher said that a mouse has two buttons. The mouse he used at home had three! +So, can you risk leaving the education of children you care about to the schools? Think about the skills you may be using today. Could these have been taught at schools a mere five years ago? +I never took JavaScript seriously and never made an effort to learn it. Today, I see Sugarizer and Snap! (a clone of Scratch in JavaScript) and am acutely aware of my foolishness. However, having learnt programming outside the classroom, I am confident that I can learn to program in JavaScript, should the need arise. +The intention at the start was to write about the activities in Sugarizer and, maybe, explore the source code. My favourite activities include TamTam, Turtle Blocks, Maze, etc. From the food chain activity, I discovered that some animals that I had believed to be carnivores, were not. I have also seen children get excited by the Speak activity. +However, once I started writing after the heading ‘Does it work?’, my mind took a radical turn. Now, I am convinced that Sugarizer will work only if you try it out. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/sugarizer-the-taste-of-sugar-on-any-device/ + +作者:[Dr Anil Seth][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://opensourceforu.com/author/anil-seth/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2017/05/Technology-Development-in-Computers-Innovation-eLearning-1.jpg?resize=696%2C696&ssl=1 (Technology Development in Computers (Innovation), eLearning) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2017/05/Technology-Development-in-Computers-Innovation-eLearning-1.jpg?fit=900%2C900&ssl=1 +[3]: https://wiki.sugarlabs.org/ +[4]: https://www.pine64.org/, diff --git a/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md b/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md new file mode 100644 index 0000000000..0f15fae6e6 --- /dev/null +++ b/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to make a Halloween lantern with Inkscape) +[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +How to make a Halloween lantern with Inkscape +====== +Use open source tools to make a spooky and fun decoration for your +favorite Halloween haunt. +![Halloween - backlit bat flying][1] + +The spooky season is almost here! This year, decorate your haunt with a unique Halloween lantern made with open source! + +Typically, a portion of a lantern's structure is opaque to block the light from within. What makes a lantern a lantern are the parts that are missing: windows cut from the structure so that light can escape. While it's impractical for lighting, a lantern with windows in spooky shapes and lurking silhouettes can be atmospheric and a lot of fun to create. + +This article demonstrates how to create your own lantern using [Inkscape][2]. If you don't have Inkscape, you can install it from your software repository on Linux or download it from the [Inkscape website][3] on MacOS and Windows. + +### Supplies + + * Template ([A4][4] or [Letter][5] size) + * Cardstock (black is traditional) + * Tracing paper (optional) + * Craft knife, ruler, and cutting mat (a craft cutting machine/laser cutter can be used instead) + * Craft glue + * LED tea-light "candle" +_Safety note:_ Only use battery-operated candles for this project. + + + +### Understanding the template + +To begin, download the correct template for your region (A4 or Letter) from the links above and open it in Inkscape. + +* * * + +* * * + +* * * + +**![Lantern template screen][6]** + +The gray-and-white checkerboard background is see-through (in technical terms, it's an _alpha channel_.) + +The black base forms the lantern. Right now, there are no windows for light to shine through; the lantern is a solid black base. You will use the **Union** and **Difference** options in Inkscape to design the windows digitally. + +The dotted blue lines represent fold scorelines. The solid orange lines represent guides. Windows for light should not be placed outside the orange boxes. + +To the left of the template are a few pre-made objects you can use in your design. + +### To create a window or shape + + 1. Create an object that looks like the window style you want. Objects can be created using any of the shape tools in Inkscape's left toolbar. Alternately, you can download Creative Commons- or Public Domain-licensed clipart and import the PNG file into your project. + 2. When you are happy with the shape of the object, turn it into a **Path** (rather than a **Shape**, which Inkscape sees as two different kinds of objects) by selecting **Object > Object to Path** in the top menu. + + + +![Object to path menu][7] + + 3. Place the object on top of the base shape. + 4. Select both the object and the black base by clicking one, pressing and holding the Shift key, then selecting the other. + 5. Select **Object > Difference** from the top menu to remove the shape of the object from the base. This creates what will become a window in your lantern. + + + +![Object > Difference menu][8] + +### To add an object to a window + +After making a window, you can add objects to it to create a scene. + +**Tips:** + + * All objects, including text, must be connected to the base of the lantern. If not, they will fall out after cutting and leave a blank space. + * Avoid small, intricate details. These are difficult to cut, even when using a machine like a laser cutter or a craft plotter. + + + 1. Create or import an object. + 2. Place the object inside the window so that it is touching at least two sides of the base. + 3. With the object selected, choose **Object > Object to Path** from the top menu. + + + +![Object to path menu][9] + + 4. Select the object and the black base by clicking on each one while holding the Shift key). + 5. Select **Object > Union** to join the object and the base. + + + +### Add text + +Text can either be cut out from the base to create a window (as I did with the stars) or added to a window (which blocks the light from within the lantern). If you're creating a window, only follow steps 1 and 2 below, then use **Difference** to remove the text from the base layer. + + 1. Select the Text tool from the left sidebar to create text. Thick, bold fonts work best. + +![Text tool][10] + + 2. Select your text, then choose **Path > Object to Path** from the top menu. This converts the text object to a path. Note that this step means you can no longer edit the text, so perform this step _only after_ you're sure you have the word or words you want. + + 3. After you have converted the text, you can press **F2** on your keyboard to activate the **Node Editor** tool to clearly show the nodes of the text when it is selected with this tool. + + + + +![Text selected with Node editor][11] + + 4. Ungroup the text. + 5. Adjust each letter so that it slightly overlaps its neighboring letter or the base. + + + +![Overlapping the text][12] + + 6. To connect all of the letters to one another and to the base, re-select all the text and the base, then select **Path > Union**. + +![Connecting letters and base with Path > Union][13] + + + + +### Prepare for printing + +The following instructions are for hand-cutting your lantern. If you're using a laser cutter or craft plotter, follow the techniques required by your hardware to prepare your files. + + 1. In the **Layer** panel, click the **Eye** icon beside the **Safety** layer to hide the safety lines. If you don't see the Layer panel, reveal it by selecting **Layer > Layers** from the top menu. + 2. Select the black base. In the **Fill and Stroke** panel, set the fill to **X** (meaning _no fill_) and the **Stroke** to solid black (that's #000000ff to fans of hexes). + + + +![Setting fill and stroke][14] + + 3. Print your pattern with **File > Print**. + + 4. Using a craft knife and ruler, carefully cut around each black line. Lightly score the dotted blue lines, then fold. + +![Cutting out the lantern][15] + + 5. To finish off the windows, cut tracing paper to the size of each window and glue it to the inside of the lantern. + +![Adding tracing paper][16] + + 6. Glue the lantern together at the tabs. + + 7. Turn on a battery-powered LED candle and place it inside your lantern. + + + + +![Completed lantern][17] + +Now your lantern is complete and ready to light up your haunt. Happy Halloween! + +How to make Halloween bottle labels with Inkscape, GIMP, and items around the house. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape + +作者:[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/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: http://inkscape.org +[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0 +[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0 +[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen) +[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu) +[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu) +[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu) +[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool) +[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor) +[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text) +[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union) +[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke) +[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern) +[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper) +[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern) diff --git a/sources/tech/20191014 My Linux story- I grew up on PC Magazine not candy.md b/sources/tech/20191014 My Linux story- I grew up on PC Magazine not candy.md new file mode 100644 index 0000000000..d3f967357f --- /dev/null +++ b/sources/tech/20191014 My Linux story- I grew up on PC Magazine not candy.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux story: I grew up on PC Magazine not candy) +[#]: via: (https://opensource.com/article/19/10/linux-journey-newb-ninja) +[#]: author: (Michael Zamot https://opensource.com/users/mzamot) + +My Linux story: I grew up on PC Magazine not candy +====== +This Linux story begins with a kid reading about Linux in issues of PC +Magazine from his childhood home in Costa Rica. Today, he's a passionate +member of the global Linux community. +![The back of a kid head][1] + +In 1998, the movie _Titanic_ was released, mobile phones were just a luxury, and pagers were still in use. This was also the year I got my first computer. I can remember the details as if it were yesterday: Pentium 133MHz and just 16MB of memory. Back in that time (while running nothing less than Windows 95), this was a good machine. I can still hear in my mind the old spinning hard drive noise when I powered that computer on, and see the Windows 95 flag. It never crossed my mind, though (especially as an 8-year-old kid), that I would dedicate every minute of my life to Linux and open source. + +Being just a kid, I always asked my mom to buy me every issue of PC Magazine instead of candies. I never skipped a single issue, and all of those dusty old magazines are still there in Costa Rica. It was in these magazines that I discovered the essential technology that changed my life. An issue in the year 2000 talked extensively about Linux and the advantages of free and open-source software. That issue also included a review of one of the most popular Linux distributions back then: Corel Linux. Unfortunately, the disc was not included. Without internet at home, I was out of luck, but that issue still lit a spark within me. + +In 2003, I asked my mom to take me to a Richard Stallman talk. I couldn’t believe he was in the country. I was the only kid in that room, and I was laser-focused on everything he was saying, though I didn’t understand anything about patents, licenses, or the jokes about him with an old hard drive over his head. + +Despite my attempts, I couldn’t make Linux work on my computer. One rainy afternoon in the year 2003, with the heavy smell of recently brewed coffee, my best friend and I were able to get a local magazine with a two-disk bundle: Mandrake Linux 7.1 (if my memory doesn’t fail) on one and StarOffice on the other. My friend poured more coffee into our mugs while I inserted the Mandrake disk into the computer with my shaking, excited hands. Linux was finally running—the same Linux I had been obsessed with since I read about it 3 years earlier. + +We were lucky enough to get broadband internet in 2006 (at the lightning speed of 128/64Kbps), so I was able to use an old Pentium II computer under my bed and run it 24x7 with Debian, Apache, and my own mail server (my personal server, I told myself). This old machine was my playground to experiment on and put into practice all of the knowledge and reading I had been doing (and also to make the electricity bill more expensive). + +As soon as I discovered there were open source communities in the country, I started attending their meetings. Eventually, I was helping in their events, and not long after I was organizing and giving talks. We used to host two annual events for many years: Festival Latinoamericano de Software Libre (Latin American Free Software Installation Fest) and Software Freedom Day. + +Thanks to what I learned from my reading, but more importantly from the people in these local communities that guided and mentored me, I was able to land my first Linux job in 2011, even without college. I kept growing from there, working for many companies and learning more about open source and Linux at each one. Eventually, I felt that I had an obligation (or a social debt) to give back to the community so that other people like the younger me could also learn. Not long after, I started teaching classes and meeting wonderful and passionate people, many of whom are now as devoted to Linux and open source as I am. I can definitely say: Mission accomplished! + +Eventually, what I learned about open source, Linux, OpenStack, Docker, and every other technology I played with sent me overseas, allowing me to work (doesn’t feel like it) for the most amazing company I’ve ever worked for, doing what I love. Because of open source and Linux, I became a part of something bigger than me. I was a member of a community, and I experienced what I consider the most significant impact on my life: Meeting and learning from so many masterminds and amazing people that today I can call friends. Without them and these communities, I wouldn’t be the person I am today. + +How could I know when I was 10 years old and reading a magazine that Linux and open source would connect me to the greatest people, and change my life forever? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/linux-journey-newb-ninja + +作者:[Michael Zamot][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/mzamot +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa (The back of a kid head) diff --git a/sources/tech/20191015 Formatting NFL data for doing data science with Python.md b/sources/tech/20191015 Formatting NFL data for doing data science with Python.md new file mode 100644 index 0000000000..67f15777ad --- /dev/null +++ b/sources/tech/20191015 Formatting NFL data for doing data science with Python.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Formatting NFL data for doing data science with Python) +[#]: via: (https://opensource.com/article/19/10/formatting-nfl-data-python) +[#]: author: (Christa Hayes https://opensource.com/users/cdhayes2) + +Formatting NFL data for doing data science with Python +====== +In part 1 of this series on machine learning with Python, learn how to +prepare a National Football League dataset for training. +![A football field.][1] + +No matter what medium of content you consume these days (podcasts, articles, tweets, etc.), you'll probably come across some reference to data. Whether it's to back up a talking point or put a meta-view on how data is everywhere, data and its analysis are in high demand. + +As a programmer, I've found data science to be more comparable to wizardry than an exact science. I've coveted the ability to get ahold of raw data and glean something useful and concrete from it. What a useful talent! + +This got me thinking about the difference between data scientists and programmers. Aren't data scientists just statisticians who can code? Look around and you'll see any number of tools aimed at helping developers become data scientists. AWS has a full-on [machine learning course][2] geared specifically towards turning developers into experts. [Visual Studio][3] has built-in Python projects that—with the click of a button—will create an entire template for classification problems. And scores of programmers are writing tools designed to make data science easier for anyone to pick up. + +I thought I'd lean into the clear message of recruiting programmers to the data (or dark) side and give it a shot with a fun project: training a machine learning model to predict plays using a National Football League (NFL) dataset. + +### Set up the environment + +Before I can dig into the data, I need to set up my [virtual environment][4]. This is important because, without an environment, I'll have nowhere to work. Fortunately, Opensource.com has [some great resources][5] for installing and configuring the setup. + +Any of the code you see here, I was able to look up through existing documentation. If there is one thing programmers are familiar with, it's navigating foreign (and sometimes very sparse) documentation. + +### Get the data + +As with any modern problem, the first step is to make sure you have quality data. Luckily, I came across a set of [NFL tracking data][6] from 2017 that was used for the NFL Big Data Bowl. Even the NFL is trying its best to attract the brightest stars in the data realm. + +Everything I need to know about the schema is in the README. This exercise will train a machine learning model to predict run (in which the ball carrier keeps the football and runs downfield) and pass (in which the ball is passed to a receiving player) plays using the plays.csv [data file][7]. I won't use player tracking data in this exercise, but it could be fun to explore later. + +First things first, I need to get access to my data by importing it into a dataframe. The [Pandas][8] library is an open source Python library that provides algorithms for easy analysis of data structures. The structure in the sample NFL data happens to be a two-dimensional array (or in simpler terms, a table), which data scientists often refer to as a dataframe. The Pandas function dealing with dataframes is [pandas.DataFrame][9]. I'll also import several other libraries that I will use later. + + +``` +import pandas as pd +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +import xgboost as xgb + +from sklearn import metrics + +df = pd.read_csv('data/plays.csv') + +print(len(df)) +print(df.head()) +``` + +### Format the data + +The NFL data dump does not explicitly indicate which plays are runs (also called rushes) and which are passes. Therefore, I have to classify the offensive play types through some football savvy and reasoning. + +Right away, I can get rid of special teams plays in the **isSTPLAY** column. Special teams are neither offense nor defense, so they are irrelevant to my objective. + + +``` +#drop st plays +df = df[~df['isSTPlay']] +print(len(df)) +``` + +Skimming the **playDescription** column, I see some plays where the quarterback kneels, which effectively ends a play. This is usually called a "victory formation" because the intent is to run out the clock. These are significantly different than normal running plays, so I can drop them as well. + + +``` +#drop kneels +df = df[~df['playDescription'].str.contains("kneels")] +print (len(df)) +``` + +The data reports time in terms of the quarters in which a game is normally played (as well as the time on the game clock in each quarter). Is this the most intuitive in terms of trying to predict a sequence? One way to answer this is to consider how gameplay differs between time splits. + +When a team has the ball with a minute left in the first quarter, will it act the same as if it has the ball with a minute left in the second quarter? Probably not. Will it act the same with a minute to go at the end of both halves? All else remaining equal, the answer is likely yes in most scenarios. + +I'll convert the **quarter** and **GameClock** columns from quarters to halves, denoted in seconds rather than minutes. I'll also create a **half** column from the **quarter** values. There are some fifth quarter values, which I take to be overtime. Since overtime rules are different than normal gameplay, I can drop them. + + +``` +#drop overtime +df = df[~(df['quarter'] == 5)] +print(len(df)) + +#convert time/quarters +def translate_game_clock(row): +    raw_game_clock = row['GameClock'] +    quarter = row['quarter'] +    minutes, seconds_raw = raw_game_clock.partition(':')[::2] + +    seconds = seconds_raw.partition(':')[0] + +    total_seconds_left_in_quarter = int(seconds) + (int(minutes) * 60) + +    if quarter == 3 or quarter == 1: +        return total_seconds_left_in_quarter + 900 +    elif quarter == 4 or quarter == 2: +        return total_seconds_left_in_quarter + +if 'GameClock' in list (df.columns): +    df['secondsLeftInHalf'] = df.apply(translate_game_clock, axis=1) + +if 'quarter' in list(df.columns): +    df['half'] = df['quarter'].map(lambda q: 2 if q > 2 else 1) +``` + +The **yardlineNumber** column also needs to be transformed. The data currently lists the yard line as a value from one to 50. Again, this is unhelpful because a team would not act the same on its own 20-yard line vs. its opponent's 20-yard line. I will convert it to represent a value from one to 99, where the one-yard line is nearest the possession team's endzone, and the 99-yard line is nearest the opponent's end zone. + + +``` +def yards_to_endzone(row): +    if row['possessionTeam'] == row['yardlineSide']: +        return 100 - row['yardlineNumber'] +    else : +        return row['yardlineNumber'] + +df['yardsToEndzone'] = df.apply(yards_to_endzone, axis = 1) +``` + +The personnel data would be extremely useful if I could get it into a format for the machine learning algorithm to take in. Personnel identifies the different types of skill positions on the field at a given time. The string value currently shown in **personnel.offense** is not conducive to input, so I'll convert each personnel position to its own column to indicate the number present on the field during the play. Defense personnel might be interesting to include later to see if it has any outcome on prediction. For now, I'll just stick with offense. + + +``` +def transform_off_personnel(row): + +   rb_count = 0 +   te_count = 0 +   wr_count = 0 +   ol_count = 0 +   dl_count = 0 +   db_count = 0 + +   if not pd.isna(row['personnel.offense']): +       personnel = row['personnel.offense'].split(', ') +       for p in personnel: +           if p[2:4] == 'RB': +               rb_count = int(p[0]) +           elif p[2:4] == 'TE': +                te_count = int(p[0]) +           elif p[2:4] == 'WR': +                wr_count = int(p[0]) +           elif p[2:4] == 'OL': +                ol_count = int(p[0]) +           elif p[2:4] == 'DL': +                dl_count = int(p[0]) +           elif p[2:4] == 'DB': +               db_count = int(p[0]) + +   return pd.Series([rb_count,te_count,wr_count,ol_count,dl_count, db_count]) + +df[['rb_count','te_count','wr_count','ol_count','dl_count', 'db_count']] = df.apply(transform_off_personnel, axis=1) +``` + +Now the offense personnel values are represented by individual columns. + +![Result of reformatting offense personnel][10] + +Formations describe how players are positioned on the field, and this is also something that would seemingly have value in predicting play outcomes. Once again, I'll convert the string values into integers. + + +``` +df['offenseFormation'] = df['offenseFormation'].map(lambda f : 'EMPTY' if pd.isna(f) else f) + +def formation(row): +    form = row['offenseFormation'].strip() +    if form == 'SHOTGUN': +        return 0 +    elif form == 'SINGLEBACK': +        return 1 +    elif form == 'EMPTY': +        return 2 +    elif form == 'I_FORM': +        return 3 +    elif form == 'PISTOL': +        return 4 +    elif form == 'JUMBO': +        return 5 +    elif form == 'WILDCAT': +        return 6 +    elif form=='ACE': +        return 7 +    else: +        return -1 + +df['numericFormation'] = df.apply(formation, axis=1) + +print(df.yardlineNumber.unique()) +``` + +Finally, it's time to classify the play types. The **PassResult** column has four distinct values: I, C, S, and null, which represent Incomplete passing plays, Complete passing plays, Sacks (classified as passing plays), and a null value. Since I've already eliminated all special teams plays, I can assume the null values are running plays. So I'll convert the play outcome into a single column called **play_type** represented by either a 0 for running or a 1 for passing. This will be the column (or _label_, as the data scientists say) I want my algorithm to predict. + + +``` +def play_type(row): +    if row['PassResult'] == 'I' or row['PassResult'] == 'C' or row['PassResult'] == 'S': +        return 'Passing' +    else: +        return 'Rushing' + +df['play_type'] = df.apply(play_type, axis = 1) +df['numericPlayType'] = df['play_type'].map(lambda p: 1 if p == 'Passing' else 0) +``` + +### Take a break + +Is it time to start predicting things yet? Most of my work so far has been trying to understand the data and what format it needs to be in—before I even get started on predicting anything. Anyone else need a minute? + +In part two, I'll do some analysis and visualization of the data before feeding it into a machine learning algorithm, and then I'll score the model's results to see how accurate they are. Stay tuned! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/formatting-nfl-data-python + +作者:[Christa Hayes][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/cdhayes2 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_LIFE_football__520x292.png?itok=5hPbxQF8 (A football field.) +[2]: https://aws.amazon.com/training/learning-paths/machine-learning/developer/ +[3]: https://docs.microsoft.com/en-us/visualstudio/python/overview-of-python-tools-for-visual-studio?view=vs-2019 +[4]: https://opensource.com/article/19/9/get-started-data-science-python +[5]: https://opensource.com/article/17/10/python-101 +[6]: https://github.com/nfl-football-ops/Big-Data-Bowl +[7]: https://github.com/nfl-football-ops/Big-Data-Bowl/tree/master/Data +[8]: https://pandas.pydata.org/ +[9]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html +[10]: https://opensource.com/sites/default/files/uploads/nfl-python-7_personneloffense.png (Result of reformatting offense personnel) diff --git a/sources/tech/20191016 Open source interior design with Sweet Home 3D.md b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md new file mode 100644 index 0000000000..bc5a17c51c --- /dev/null +++ b/sources/tech/20191016 Open source interior design with Sweet Home 3D.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source interior design with Sweet Home 3D) +[#]: via: (https://opensource.com/article/19/10/interior-design-sweet-home-3d) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Open source interior design with Sweet Home 3D +====== +Try out furniture layouts, color schemes, and more in virtual reality +before you go shopping in the real world. +![Several houses][1] + +There are three schools of thought on how to go about decorating a room: + + 1. Buy a bunch of furniture and cram it into the room + 2. Take careful measurements of each item of furniture, calculate the theoretical capacity of the room, then cram it all in, ignoring the fact that you've placed a bookshelf on top of your bed + 3. Use a computer for pre-visualization + + + +Historically, I practiced the little-known fourth principle: don't have furniture. However, since I became a remote worker, I've found that a home office needs conveniences like a desk and a chair, a bookshelf for reference books and tech manuals, and so on. Therefore, I have been formulating a plan to populate my living and working space with actual furniture, made of actual wood rather than milk crates (or glue and sawdust, for that matter), with an emphasis on _plan_. The last thing I want is to bring home a great find from a garage sale to discover that it doesn't fit through the door or that it's oversized compared to another item of furniture. + +It was time to do what the professionals do. It was time to pre-viz. + +### Open source interior design + +[Sweet Home 3D][2] is an open source (GPLv2) interior design application that helps you draw your home's floor plan and then define, resize, and arrange furniture. You can do all of this with precise measurements, down to fractions of a centimeter, without having to do any math and with the ease of basic drag-and-drop operations. And when you're done, you can view the results in 3D. If you can create a basic table (not the furniture kind) in a word processor, you can plan the interior design of your home in Sweet Home 3D. + +### Installing + +Sweet Home 3D is a [Java][3] application, so it's universal. It runs on any operating system that can run Java, which includes Linux, Windows, MacOS, and BSD. Regardless of your OS, you can [download][4] the application from the website. + + * On Linux, [untar][5] the archive. Right-click on the SweetHome3D file and select **Properties**. In the **Permission** tab, grant the file executable permission. + * On MacOS and Windows, expand the archive and launch the application. You must grant it permission to run on your system when prompted. + + + +![Sweet Home 3D permissions][6] + +On Linux, you can also install Sweet Home 3D as a Snap package, provided you have **snapd** installed and enabled. + +### Measures of success + +First thing first: Break out your measuring tape. To get the most out of Sweet Home 3D, you must know the actual dimensions of the living space you're planning for. You may or may not need to measure down to the millimeter or 16th of an inch; you know your own tolerance for variance. But you must get the basic dimensions, including measuring walls and windows and doors. + +Use your best judgment for common sense. For instance, When measuring doors, include the door frame; while it's not technically part of the _door_ itself, it is part of the wall space that you probably don't want to cover with furniture. + +![Measure twice, execute once][7] + +CC-SA-BY opensource.com + +### Creating a room + +When you first launch Sweet Home 3D, it opens a blank canvas in its default viewing mode, a blueprint view in the top panel, and a 3D rendering in the bottom panel. On my [Slackware][8] desktop computer, this works famously, but my desktop is also my video editing and gaming computer, so it's got a great graphics card for 3D rendering. On my laptop, this view was a lot slower. For best performance (especially on a computer not dedicated to 3D rendering), go to the **3D View** menu at the top of the window and select **Virtual Visit**. This view mode renders your work from a ground-level point of view based on the position of a virtual visitor. That means you get to control what is rendered and when. + +It makes sense to switch to this view regardless of your computer's power because an aerial 3D rendering doesn't provide you with much more detail than what you have in your blueprint plan. Once you have changed the view mode, you can start designing. + +The first step is to define the walls of your home. This is done with the **Create Walls** tool, found to the right of the **Hand** icon in the top toolbar. Drawing walls is simple: Click where you want a wall to begin, click to anchor it, and continue until your room is complete. + +![Drawing walls in Sweet Home 3D][9] + +Once you close the walls, press **Esc** to exit the tool. + +#### Defining a room + +Sweet Home 3D is flexible on how you create walls. You can draw the outer boundary of your house first, and then subdivide the interior, or you can draw each room as conjoined "containers" that ultimately form the footprint of your house. This flexibility is possible because, in real life and in Sweet Home 3D, walls don't always define a room. To define a room, use the **Create Rooms** button to the right of the **Create Walls** button in the top toolbar. + +If the room's floor space is defined by four walls, then all you need to do to define that enclosure as a room is double-click within the four walls. Sweet Home 3D defines the space as a room and provides you with its area in feet or meters, depending on your preference. + +For irregular rooms, you must manually define each corner of the room with a click. Depending on the complexity of the room shape, you may have to experiment to find whether you need to work clockwise or counterclockwise from your origin point to avoid quirky Möbius-strip flooring. Generally, however, defining the floor space of a room is straightforward. + +![Defining rooms in Sweet Home 3D][10] + +After you give the room a floor, you can change to the **Arrow** tool and double-click on the room to give it a name. You can also set the color and texture of the flooring, walls, ceiling, and baseboards. + +![Modifying room floors, ceilings, etc. in Sweet Home 3D][11] + +None of this is rendered in your blueprint view by default. To enable room rendering in your blueprint panel, go to the **File** menu and select **Preferences**. In the **Preferences** panel, set **Room rendering in plan** to **Floor color or texture**. + +### Doors and windows + +Once you've finished the basic floor plan, you can switch permanently to the **Arrow** tool. + +You can find doors and windows in the left column of Sweet Home 3D, in the **Doors and Windows** category. You have many choices, so choose whatever is closest to what you have in your home. + +![Moving a door in Sweet Home 3D][12] + +To place a door or window into your plan, drag-and-drop it on the appropriate wall in your blueprint panel. To adjust its position and size, double-click the door or window. + +### Adding furniture + +With the base plan complete, the part of the job that feels like _work_ is over! From this point onward, you can play with furniture arrangements and other décor. + +You can find furniture in the left column, organized by the room for which each is intended. You can drag-and-drop any item into your blueprint plan and control orientation and size with the tools visible when you hover your mouse over the item's corners. Double-click on any item to adjust its color and finish. + +### Visiting and exporting + +To see what your future home will look like, drag the "person" icon in your blueprint view into a room. + +![Sweet Home 3D rendering][13] + +You can strike your own balance between realism and just getting a feel for space, but your imagination is your only limit. You can get additional assets to add to your home from the Sweet Home 3D [download page][4]. You can even create your own furniture and textures with the **Library Editor** applications, which are optional downloads from the project site. + +Sweet Home 3D can export your blueprint plan to SVG format for use in [Inkscape][14], and it can export your 3D model to OBJ format for use in [Blender][15]. To export your blueprint, go to the **Plan** menu and select **Export to SVG format**. To export a 3D model, go to the **3D View** menu and select **Export to OBJ format**. + +You can also take "snapshots" of your home so that you can refer to your ideas without opening Sweet Home 3D. To create a snapshot, go to the **3D View** menu and select **Create Photo**. The snapshot is rendered from the perspective of the person icon in the blueprint view, so adjust as required, then click the **Create** button in the **Create Photo** window. If you're happy with the photo, click **Save**. + +### Home sweet home + +There are many more features in Sweet Home 3D. You can add a sky and a lawn, position lights for your photos, set ceiling height, add another level to your house, and much more. Whether you're planning for a flat you're renting or a house you're buying—or a house that doesn't even exist (yet), Sweet Home 3D is an engaging and easy application that can entertain and help you make better purchasing choices when scurrying around for furniture, so you can finally stop eating breakfast at the kitchen counter and working while crouched on the floor. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/interior-design-sweet-home-3d + +作者:[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/LIFE_housing.png?itok=s7i6pQL1 (Several houses) +[2]: http://www.sweethome3d.com/ +[3]: https://opensource.com/resources/java +[4]: http://www.sweethome3d.com/download.jsp +[5]: https://opensource.com/article/17/7/how-unzip-targz-file +[6]: https://opensource.com/sites/default/files/uploads/sweethome3d-permissions.png (Sweet Home 3D permissions) +[7]: https://opensource.com/sites/default/files/images/life/sweethome3d-measure.jpg (Measure twice, execute once) +[8]: http://www.slackware.com/ +[9]: https://opensource.com/sites/default/files/uploads/sweethome3d-walls.jpg (Drawing walls in Sweet Home 3D) +[10]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms.jpg (Defining rooms in Sweet Home 3D) +[11]: https://opensource.com/sites/default/files/uploads/sweethome3d-rooms-modify.jpg (Modifying room floors, ceilings, etc. in Sweet Home 3D) +[12]: https://opensource.com/sites/default/files/uploads/sweethome3d-move.jpg (Moving a door in Sweet Home 3D) +[13]: https://opensource.com/sites/default/files/uploads/sweethome3d-view.jpg (Sweet Home 3D rendering) +[14]: http://inkscape.org +[15]: http://blender.org diff --git a/sources/tech/20191017 How to type emoji on Linux.md b/sources/tech/20191017 How to type emoji on Linux.md new file mode 100644 index 0000000000..ff85c55938 --- /dev/null +++ b/sources/tech/20191017 How to type emoji on Linux.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to type emoji on Linux) +[#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to type emoji on Linux +====== +The GNOME desktop makes it easy to use emoji in your communications. +![A cat under a keyboard.][1] + +Emoji are those fanciful pictograms that snuck into the Unicode character space. They're all the rage online, and people use them for all kinds of surprising things, from signifying reactions on social media to serving as visual labels for important file names. There are many ways to enter Unicode characters on Linux, but the GNOME desktop makes it easy to find and type an emoji. + +![Emoji in Emacs][2] + +### Requirements + +For this easy method, you must be running Linux with the [GNOME][3] desktop. + +You must also have an emoji font installed. There are many to choose from, so do a search for _emoji_ using your favorite software installer application or package manager. + +For example, on Fedora: + + +``` +$ sudo dnf search emoji +emoji-picker.noarch : An emoji selection tool +unicode-emoji.noarch : Unicode Emoji Data Files +eosrei-emojione-fonts.noarch : A color emoji font +twitter-twemoji-fonts.noarch : Twitter Emoji for everyone +google-android-emoji-fonts.noarch : Android Emoji font released by Google +google-noto-emoji-fonts.noarch : Google “Noto Emoji” Black-and-White emoji font +google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emoji font +[...] +``` + +On Ubuntu or Debian, use **apt search** instead. + +I'm using [Google Noto Color Emoji][4] in this article. + +### Get set up + +To get set up, launch GNOME's Settings application. + + 1. In Settings, click the **Region & Language** category in the left column. + 2. Click the plus symbol (**+**) under the **Input Sources** heading to bring up the **Add an Input Source** panel. + + + +![Add a new input source][5] + + 3. In the **Add an Input Source** panel, click the hamburger menu at the bottom of the input list. + + + +![Add an Input Source panel][6] + + 4. Scroll to the bottom of the list and select **Other**. + 5. In the **Other** list, find **Other (Typing Booster)**. (You can type **boost** in the search field at the bottom to filter the list.) + + + +![Find Other \(Typing Booster\) in inputs][7] + + 6. Click the **Add** button in the top-right corner of the panel to add the input source to GNOME. + + + +Once you've done that, you can close the Settings window. + +#### Switch to Typing Booster + +You now have a new icon in the top-right of your GNOME desktop. By default, it's set to the two-letter abbreviation of your language (**en** for English, **eo** for Esperanto, **es** for Español, and so on). If you press the **Super** key (the key with a Linux penguin, Windows logo, or Mac Command symbol) and the **Spacebar** together on your keyboard, you will switch input sources from your default source to the next on your input list. In this example, you only have two input sources: your default language and Typing Booster. + +Try pressing **Super**+**Spacebar** together and watch the input name and icon change. + +#### Configure Typing Booster + +With the Typing Booster input method active, click the input sources icon in the top-right of your screen, select **Unicode symbols and emoji predictions**, and set it to **On**. + +![Set Unicode symbols and emoji predictions to On][8] + +This makes Typing Booster dedicated to typing emoji, which isn't all Typing Booster is good for, but in the context of this article it's exactly what is needed. + +### Type emoji + +With Typing Booster still active, open a text editor like Gedit, a web browser, or anything that you know understands Unicode characters, and type "_thumbs up_." As you type, Typing Booster searches for matching emoji names. + +![Typing Booster searching for emojis][9] + +To leave emoji mode, press **Super**+**Spacebar** again, and your input source goes back to your default language. + +### Switch the switcher + +If the **Super**+**Spacebar** keyboard shortcut is not natural for you, then you can change it to a different combination. In GNOME Settings, navigate to **Devices** and select **Keyboard**. + +In the top bar of the **Keyboard** window, search for **Input** to filter the list. Set **Switch to next input source** to a key combination of your choice. + +![Changing keystroke combination in GNOME settings][10] + +### Unicode input + +The fact is, keyboards were designed for a 26-letter (or thereabouts) alphabet along with as many numerals and symbols. ASCII has more characters than what you find on a typical keyboard, to say nothing of the millions of characters within Unicode. If you want to type Unicode characters into a modern Linux application but don't want to switch to Typing Booster, then you can use the Unicode input shortcut. + + 1. With your default language active, open a text editor like Gedit, a web browser, or any application you know accepts Unicode. + 2. Press **Ctrl**+**Shift**+**U** on your keyboard to enter Unicode entry mode. Release the keys. + 3. You are currently in Unicode entry mode, so type a number of a Unicode symbol. For instance, try **1F44D** for a 👍 symbol, or **2620** for a ☠ symbol. To get the number code of a Unicode symbol, you can search the internet or refer to the [Unicode specification][11]. + + + +### Pragmatic emoji-ism + +Emoji are fun and expressive. They can make your text unique to you. They can also be utilitarian. Because emoji are Unicode characters, they can be used anywhere a font can be used, and they can be used the same way any alphabetic character can be used. For instance, if you want to mark a series of files with a special symbol, you can add an emoji to the name, and you can filter by that emoji in Search. + +![Labeling a file with emoji][12] + +Use emoji all you want because Linux is a Unicode-friendly environment, and it's getting friendlier with every release. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-type-emoji-linux + +作者:[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/osdc-lead_cat-keyboard.png?itok=fuNmiGV- (A cat under a keyboard.) +[2]: https://opensource.com/sites/default/files/uploads/emacs-emoji.jpg (Emoji in Emacs) +[3]: https://www.gnome.org/ +[4]: https://www.google.com/get/noto/help/emoji/ +[5]: https://opensource.com/sites/default/files/uploads/gnome-setting-region-add.png (Add a new input source) +[6]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-list.png (Add an Input Source panel) +[7]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-other-typing-booster.png (Find Other (Typing Booster) in inputs) +[8]: https://opensource.com/sites/default/files/uploads/emoji-input-on.jpg (Set Unicode symbols and emoji predictions to On) +[9]: https://opensource.com/sites/default/files/uploads/emoji-input.jpg (Typing Booster searching for emojis) +[10]: https://opensource.com/sites/default/files/uploads/gnome-setting-keyboard-switch-input.jpg (Changing keystroke combination in GNOME settings) +[11]: http://unicode.org/emoji/charts/full-emoji-list.html +[12]: https://opensource.com/sites/default/files/uploads/file-label.png (Labeling a file with emoji) diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/sources/tech/20191017 Intro to the Linux useradd command.md new file mode 100644 index 0000000000..b2befd4650 --- /dev/null +++ b/sources/tech/20191017 Intro to the Linux useradd command.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intro to the Linux useradd command) +[#]: via: (https://opensource.com/article/19/10/linux-useradd-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Intro to the Linux useradd command +====== +Add users (and customize their accounts as needed) with the useradd +command. +![people in different locations who are part of the same team][1] + +Adding a user is one of the most fundamental exercises on any computer system; this article focuses on how to do it on a Linux system. + +Before getting started, I want to mention three fundamentals to keep in mind. First, like with most operating systems, Linux users need an account to be able to log in. This article specifically covers local accounts, not network accounts such as LDAP. Second, accounts have both a name (called a username) and a number (called a user ID). Third, users are typically placed into a group. Groups also have a name and group ID. + +As you'd expect, Linux includes a command-line utility for adding users; it's called **useradd**. You may also find the command **adduser**. Many distributions have added this symbolic link to the **useradd** command as a matter of convenience. + + +``` +$ file `which adduser` +/usr/sbin/adduser: symbolic link to useradd +``` + +Let's take a look at **useradd**. + +> Note: The defaults described in this article reflect those in Red Hat Enterprise Linux 8.0. You may find subtle differences in these files and certain defaults on other Linux distributions or other Unix operating systems such as FreeBSD or Solaris. + +### Default behavior + +The basic usage of **useradd** is quite simple: A user can be added just by providing their username. + + +``` +`$ sudo useradd sonny` +``` + +In this example, the **useradd** command creates an account called _sonny_. A group with the same name is also created, and _sonny_ is placed in it to be used as the primary group. There are other parameters, such as language and shell, that are applied according to defaults and values set in the configuration files **/etc/default/useradd** and **/etc/login.defs**. This is generally sufficient for a single, personal system or a small, one-server business environment. + +While the two files above govern the behavior of **useradd**, user information is stored in other files found in the **/etc** directory, which I will refer to throughout this article. + +File | Description | Fields (bold—set by useradd) +---|---|--- +passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** +shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused +group | Stores group details | **groupname**:unused:**gid**:**members** + +### Customizable behavior + +The command line allows customization for times when an administrator needs finer control, such as to specify a user's ID number. + +#### User and group ID numbers + +By default, **useradd** tries to use the same number for the user ID (UID) and primary group ID (GID), but there are no guarantees. Although it's not necessary for the UID and GID to match, it's easier for administrators to manage them when they do. + +I have just the scenario to explain. Suppose I add another account, this time for Timmy. Comparing the two users, _sonny_ and _timmy_, shows that both users and their respective primary groups were created by using the **getent** command. + + +``` +$ getent passwd sonny timmy +sonny❌1001:1002:Sonny:/home/sonny:/bin/bash +timmy❌1002:1003::/home/timmy:/bin/bash + +$ getent group sonny timmy +sonny❌1002: +timmy❌1003: +``` + +Unfortunately, neither users' UID nor primary GID match. This is because the default behavior is to assign the next available UID to the user and then attempt to assign the same number to the primary group. However, if that number is already used, the next available GID is assigned to the group. To explain what happened, I hypothesize that a group with GID 1001 already exists and enter a command to confirm. + + +``` +$ getent group 1001 +book❌1001:alan +``` + +The group _book_ with the ID _1001_ has caused the GIDs to be off by one. This is an example where a system administrator would need to take more control of the user-creation process. To resolve this issue, I must first determine the next available user and group ID that will match. The commands **getent group** and **getent passwd** will be helpful in determining the next available number. This number can be passed with the **-u** argument. + + +``` +$ sudo useradd -u 1004 bobby + +$ getent passwd bobby; getent group bobby +bobby❌1004:1004::/home/bobby:/bin/bash +bobby❌1004: +``` + +Another good reason to specify the ID is for users that will be accessing files on a remote system using the Network File System (NFS). NFS is easier to administer when all client and server systems have the same ID configured for a given user. I cover this in a bit more detail in my article on [using autofs to mount NFS shares][2]. + +### More customization + +Very often though, other account parameters need to be specified for a user. Here are brief examples of the most common customizations you may need to use. + +#### Comment + +The comment option is a plain-text field for providing a short description or other information using the **-c** argument. + + +``` +$ sudo useradd -c "Bailey is cool" bailey +$ getent passwd bailey +bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash +``` + +#### Groups + +A user can be assigned one primary group and multiple secondary groups. The **-g** argument specifies the name or GID of the primary group. If it's not specified, **useradd** creates a primary group with the user's same name (as demonstrated above). The **-G** (uppercase) argument is used to pass a comma-separated list of groups that the user will be placed into; these are known as secondary groups. + + +``` +$ sudo useradd -G tgroup,fgroup,libvirt milly +$ id milly +uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),3000(tgroup) +``` + +#### Home directory + +The default behavior of **useradd** is to create the user's home directory in **/home**. However, different aspects of the home directory can be overridden with the following arguments. The **-b** sets another directory where user homes can be placed. For example, **/home2** instead of the default **/home**. + + +``` +$ sudo useradd -b /home2 vicky +$ getent passwd vicky +vicky❌1013:1013::/home2/vicky:/bin/bash +``` + +The **-d** lets you specify a home directory with a different name from the user. + + +``` +$ sudo useradd -d /home/ben jerry +$ getent passwd jerry +jerry❌1014:1014::/home/ben:/bin/bash +``` + +#### The skeleton directory + +The **-k** instructs the new user's new home directory to be populated with any files in the **/etc/skel** directory. These are usually shell configuration files, but they can be anything that a system administrator would like to make available to all new users. + +#### Shell + +The **-s** argument can be used to specify the shell. The default is used if nothing else is specified. For example, in the following, shell **bash** is defined in the default configuration file, but Wally has requested **zsh**. + + +``` +$ grep SHELL /etc/default/useradd +SHELL=/bin/bash + +$ sudo useradd -s /usr/bin/zsh wally +$ getent passwd wally +wally❌1004:1004::/home/wally:/usr/bin/zsh +``` + +#### Security + +Security is an essential part of user management, so there are several options available with the **useradd** command. A user account can be given an expiration date, in the form YYYY-MM-DD, using the **-e** argument. + + +``` +$ sudo useradd -e 20191231 sammy +$ sudo getent shadow sammy +sammy:!!:18171:0:99999:7::20191231: +``` + +An account can also be disabled automatically if the password expires. The **-f** argument will set the number of days after the password expires before the account is disabled. Zero is immediate. + + +``` +$ sudo useradd -f 30 willy +$ sudo getent shadow willy +willy:!!:18171:0:99999:7:30:: +``` + +### A real-world example + +In practice, several of these arguments may be used when creating a new user account. For example, if I need to create an account for Perry, I might use the following command: + + +``` +$ sudo useradd -u 1020 -c "Perry Example" \ +-G tgroup -b /home2 \ +-s /usr/bin/zsh \ +-e 20201201 -f 5 perry +``` + +Refer to the sections above to understand each option. Verify the results with: + + +``` +$ getent passwd perry; getent group perry; getent shadow perry; id perry +perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh +perry❌1020: +perry:!!:18171:0:99999:7:5:20201201: +uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) +``` + +### Some final advice + +The **useradd** command is a "must-know" for any Unix (not just Linux) administrator. It is important to understand all of its options since user creation is something that you want to get right the first time. This means having a well-thought-out naming convention that includes a dedicated UID/GID range reserved for your users across your enterprise, not just on a single system—particularly when you're working in a growing organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/linux-useradd-command + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connection_people_team_collaboration.png?itok=0_vQT8xV (people in different locations who are part of the same team) +[2]: https://opensource.com/article/18/6/using-autofs-mount-nfs-shares diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md new file mode 100644 index 0000000000..3b6fc7ca78 --- /dev/null +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using multitail on Linux) +[#]: via: (https://www.networkworld.com/article/3445228/using-multitail-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Using multitail on Linux +====== + +[Glen Bowman][1] [(CC BY-SA 2.0)][2] + +The **multitail** command can be very helpful whenever you want to watch activity on a number of files at the same time – especially log files. It works like a multi-windowed **tail -f** command. That is, it displays the bottoms of files and new lines as they are being added. While easy to use in general, **multitail** does provide some command-line and interactive options that you should be aware of before you start to use it routinely. + +### Basic multitail-ing + +The simplest use of **multitail** is to list the names of the files that you wish to watch on the command line. This command splits the screen horizontally (i.e., top and bottom), displaying the bottom of each of the files along with updates. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +``` +$ multitail /var/log/syslog /var/log/dmesg +``` + +The display will be split like this: + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` ++-----------------------+ +| | +| | ++-----------------------| +| | +| | ++-----------------------+ +``` + +The lines displayed from each of the files would be followed by a single line per file that includes the assigned file number (starting with 00), the file name, the file size, and the date and time the most recent content was added. Each of the files will be allotted half the space available regardless of its size or activity. For example: + +``` +content lines from my1.log +more content +more lines + +00] my1.log 59KB - 2019/10/14 12:12:09 +content lines from my2.log +more content +more lines + +01] my2.log 120KB - 2019/10/14 14:22:29 +``` + +Note that **multitail** will not complain if you ask it to display non-text files or files that you have no permission to view; you just won't see the contents. + +You can also use wild cards to specify the files that you want to watch: + +``` +$ multitail my*.log +``` + +One thing to keep in mind is that **multitail** is going to split the screen evenly. If you specify too many files, you will see only a few lines from each and you will only see the first seven or so of the requested files if you list too many unless you take extra steps to view the later files (see the scrolling option described below). The exact result depends on the how many lines are available in your terminal window. + +Press **q** to quit **multitail** and return to your normal screen view. + +### Dividing the screen + +**Multitail** will split your terminal window vertically (i.e., left and right) if you prefer. For this, use the **-s** option. If you specify three files, the right side of your screen will be divided horizontally as well. With four, you'll have four equal-sized windows. + +``` ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | +| | | | +-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ + 2 files 3 files 4 files +``` + +Use **multitail -s 3 file1 file2 file3** if you want to split the screen into three columns. + +``` ++-------+-------+-------+ +| | | | +| | | | +| | | | +| | | | +| | | | ++-------+-------+-------+ + 3 files with -s 3 +``` + +### Scrolling + +You can scroll up and down through displayed files, but you need to press **b** to bring up a selection menu and then use the up and arrow buttons to select the file you wish to scroll through. Then press the **enter** key. You can then scroll through the lines in an enlarged area, again using the up and down arrows. Press **q** when you're done to go back to the normal view. + +### Getting Help + +Pressing **h** in **multitail** will open a help menu describing some of the basic operations, though the man page provides quite a bit more information and is worth perusing if you want to learn even more about using this tool. + +**Multitail** will not likely be installed on your system by default, but using **apt-get** or **yum** should get you to an easy install. The tool provides a lot of functionality, but with its character-based display, window borders will just be strings of **q**'s and **x**'s. It's a very handy when you need to keep an eye on file updates. + +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/3445228/using-multitail-on-linux.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/glenbowman/7992498919/in/photolist-dbgDtv-gHfRRz-5uRM4v-gHgFnz-6sPqTZ-5uaP7H-USFPqD-pbtRUe-fiKiYn-nmgWL2-pQNepR-q68p8d-dDsUxw-dbgFKG-nmgE6m-DHyqM-nCKA4L-2d7uFqH-Kbqzk-8EwKg-8Vy72g-2X3NSN-78Bv84-buKWXF-aeM4ok-yhweWf-4vwpyX-9hu8nq-9zCoti-v5nzP5-23fL48r-24y6pGS-JhWDof-6zF75k-24y6nHS-9hr19c-Gueh6G-Guei7u-GuegFy-24y6oX5-26qu5iX-wKrnMW-Gueikf-24y6oYh-27y4wwA-x4z19F-x57yP4-24BY6gc-24y6nPo-QGwbkf +[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=HPE20773&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 diff --git a/sources/tech/20191018 How to use Protobuf for data interchange.md b/sources/tech/20191018 How to use Protobuf for data interchange.md new file mode 100644 index 0000000000..4de9e2120a --- /dev/null +++ b/sources/tech/20191018 How to use Protobuf for data interchange.md @@ -0,0 +1,516 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Protobuf for data interchange) +[#]: via: (https://opensource.com/article/19/10/protobuf-data-interchange) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +How to use Protobuf for data interchange +====== +Protobuf encoding increases efficiency when exchanging data between +applications written in different languages and running on different +platforms. +![metrics and data shown on a computer screen][1] + +Protocol buffers ([Protobufs][2]), like XML and JSON, allow applications, which may be written in different languages and running on different platforms, to exchange data. For example, a sending application written in Go could encode a Go-specific sales order in Protobuf, which a receiver written in Java then could decode to get a Java-specific representation of the received order. Here is a sketch of the architecture over a network connection: + + +``` +`Go sales order--->Pbuf-encode--->network--->Pbuf-decode--->Java sales order` +``` + +Protobuf encoding, in contrast to its XML and JSON counterparts, is binary rather than text, which can complicate debugging. However, as the code examples in this article confirm, the Protobuf encoding is significantly more efficient in size than either XML or JSON encoding. + +Protobuf is efficient in another way. At the implementation level, Protobuf and other encoding systems serialize and deserialize structured data. Serialization transforms a language-specific data structure into a bytestream, and deserialization is the inverse operation that transforms a bytestream back into a language-specific data structure. Serialization and deserialization may become the bottleneck in data interchange because these operations are CPU-intensive. Efficient serialization and deserialization is another Protobuf design goal. + +Recent encoding technologies, such as Protobuf and FlatBuffers, derive from the [DCE/RPC][3] (Distributed Computing Environment/Remote Procedure Call) initiative of the early 1990s. Like DCE/RPC, Protobuf contributes to both the [IDL][4] (interface definition language) and the encoding layer in data interchange. + +This article will look at these two layers then provide code examples in Go and Java to flesh out Protobuf details and show that Protobuf is easy to use. + +### Protobuf as an IDL and encoding layer + +DCE/RPC, like Protobuf, is designed to be language- and platform-neutral. The appropriate libraries and utilities allow any language and platform to play in the DCE/RPC arena. Furthermore, the DCE/RPC architecture is elegant. An IDL document is the contract between the remote procedure on the one side and callers on the other side. Protobuf, too, centers on an IDL document. + +An IDL document is text and, in DCE/RPC, uses basic C syntax along with syntactic extensions for metadata (square brackets) and a few new keywords such as **interface**. Here is an example: + + +``` +[uuid (2d6ead46-05e3-11ca-7dd1-426909beabcd), version(1.0)] +interface echo { +   const long int ECHO_SIZE = 512; +   void echo( +      [in]          handle_t h, +      [in, string]  idl_char from_client[ ], +      [out, string] idl_char from_service[ECHO_SIZE] +   ); +} +``` + +This IDL document declares a procedure named **echo**, which takes three arguments: the **[in]** arguments of type **handle_t** (implementation pointer) and **idl_char** (array of ASCII characters) are passed to the remote procedure, whereas the **[out]** argument (also a string) is passed back from the procedure. In this example, the **echo** procedure does not explicitly return a value (the **void** to the left of **echo**) but could do so. A return value, together with one or more **[out]** arguments, allows the remote procedure to return arbitrarily many values. The next section introduces a Protobuf IDL, which differs in syntax but likewise serves as a contract in data interchange. + +The IDL document, in both DCE/RPC and Protobuf, is the input to utilities that create the infrastructure code for exchanging data: + + +``` +`IDL document--->DCE/PRC or Protobuf utilities--->support code for data interchange` +``` + +As relatively straightforward text, the IDL is likewise human-readable documentation about the specifics of the data interchange—in particular, the number of data items exchanged and the data type of each item. + +Protobuf can used in a modern RPC system such as [gRPC][5]; but Protobuf on its own provides only the IDL layer and the encoding layer for messages passed from a sender to a receiver. Protobuf encoding, like the DCE/RPC original, is binary but more efficient. + +At present, XML and JSON encodings still dominate in data interchange through technologies such as web services, which make use of in-place infrastructure such as web servers, transport protocols (e.g., TCP, HTTP), and standard libraries and utilities for processing XML and JSON documents. Moreover, database systems of various flavors can store XML and JSON documents, and even legacy relational systems readily generate XML encodings of query results. Every general-purpose programming language now has libraries that support XML and JSON. What, then, recommends a return to a _binary_ encoding system such as Protobuf? + +Consider the negative decimal value **-128**. In the 2's complement binary representation, which dominates across systems and languages, this value can be stored in a single 8-bit byte: 10000000. The text encoding of this integer value in XML or JSON requires multiple bytes. For example, UTF-8 encoding requires four bytes for the string, literally **-128**, which is one byte per character (in hex, the values are 0x2d, 0x31, 0x32, and 0x38). XML and JSON also add markup characters, such as angle brackets and braces, to the mix. Details about Protobuf encoding are forthcoming, but the point of interest now is a general one: Text encodings tend to be significantly less compact than binary ones. + +### A code example in Go using Protobuf + +My code examples focus on Protobuf rather than RPC. Here is an overview of the first example: + + * The IDL file named _dataitem.proto_ defines a Protobuf **message** with six fields of different types: integer values with different ranges, floating-point values of a fixed size, and strings of two different lengths. + * The Protobuf compiler uses the IDL file to generate a Go-specific version (and, later, a Java-specific version) of the Protobuf **message** together with supporting functions. + * A Go app populates the native Go data structure with randomly generated values and then serializes the result to a local file. For comparison, XML and JSON encodings also are serialized to local files. + * As a test, the Go application reconstructs an instance of its native data structure by deserializing the contents of the Protobuf file. + * As a language-neutrality test, the Java application also deserializes the contents of the Protobuf file to get an instance of a native data structure. + + + +This IDL file and two Go and one Java source files are available as a ZIP file on [my website][6]. + +The all-important Protobuf IDL document is shown below. The document is stored in the file _dataitem.proto_, with the customary _.proto_ extension. + +#### Example 1. Protobuf IDL document + + +``` +syntax = "proto3"; + +package main; + +message DataItem { +  int64  oddA  = 1; +  int64  evenA = 2; +  int32  oddB  = 3; +  int32  evenB = 4; +  float  small = 5; +  float  big   = 6; +  string short = 7; +  string long  = 8; +} +``` + +The IDL uses the current proto3 rather than the earlier proto2 syntax. The package name (in this case, **main**) is optional but customary; it is used to avoid name conflicts. The structured **message** contains eight fields, each of which has a Protobuf data type (e.g., **int64**, **string**), a name (e.g., **oddA**, **short**), and a numeric tag (aka key) after the equals sign **=**. The tags, which are 1 through 8 in this example, are unique integer identifiers that determine the order in which the fields are serialized. + +Protobuf messages can be nested to arbitrary levels, and one message can be the field type in the other. Here's an example that uses the **DataItem** message as a field type: + + +``` +message DataItems { +  repeated DataItem item = 1; +} +``` + +A single **DataItems** message consists of repeated (none or more) **DataItem** messages. + +Protobuf also supports enumerated types for clarity: + + +``` +enum PartnershipStatus { +  reserved "FREE", "CONSTRAINED", "OTHER"; +} +``` + +The **reserved** qualifier ensures that the numeric values used to implement the three symbolic names cannot be reused. + +To generate a language-specific version of one or more declared Protobuf **message** structures, the IDL file containing these is passed to the _protoc_ compiler (available in the [Protobuf GitHub repository][7]). For the Go code, the supporting Protobuf library can be installed in the usual way (with **%** as the command-line prompt): + + +``` +`% go get github.com/golang/protobuf/proto` +``` + +The command to compile the Protobuf IDL file _dataitem.proto_ into Go source code is: + + +``` +`% protoc --go_out=. dataitem.proto` +``` + +The flag **\--go_out** directs the compiler to generate Go source code; there are similar flags for other languages. The result, in this case, is a file named _dataitem.pb.go_, which is small enough that the essentials can be copied into a Go application. Here are the essentials from the generated code: + + +``` +var _ = proto.Marshal + +type DataItem struct { +   OddA  int64   `protobuf:"varint,1,opt,name=oddA" json:"oddA,omitempty"` +   EvenA int64   `protobuf:"varint,2,opt,name=evenA" json:"evenA,omitempty"` +   OddB  int32   `protobuf:"varint,3,opt,name=oddB" json:"oddB,omitempty"` +   EvenB int32   `protobuf:"varint,4,opt,name=evenB" json:"evenB,omitempty"` +   Small float32 `protobuf:"fixed32,5,opt,name=small" json:"small,omitempty"` +   Big   float32 `protobuf:"fixed32,6,opt,name=big" json:"big,omitempty"` +   Short string  `protobuf:"bytes,7,opt,name=short" json:"short,omitempty"` +   Long  string  `protobuf:"bytes,8,opt,name=long" json:"long,omitempty"` +} + +func (m *DataItem) Reset()         { *m = DataItem{} } +func (m *DataItem) String() string { return proto.CompactTextString(m) } +func (*DataItem) ProtoMessage()    {} +func init() {} +``` + +The compiler-generated code has a Go structure **DataItem**, which exports the Go fields—the names are now capitalized—that match the names declared in the Protobuf IDL. The structure fields have standard Go data types: **int32**, **int64**, **float32**, and **string**. At the end of each field line, as a string, is metadata that describes the Protobuf types, gives the numeric tags from the Protobuf IDL document, and provides information about JSON, which is discussed later. + +There are also functions; the most important is **proto.Marshal** for serializing an instance of the **DataItem** structure into Protobuf format. The helper functions include **Reset**, which clears a **DataItem** structure, and **String**, which produces a one-line string representation of a **DataItem**. + +The metadata that describes Protobuf encoding deserves a closer look before analyzing the Go program in more detail. + +### Protobuf encoding + +A Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value. The field names, such as **oddA** and **small**, are for human readability, but the _protoc_ compiler does use the field names in generating language-specific counterparts. For example, the **oddA** and **small** names in the Protobuf IDL become the fields **OddA** and **Small**, respectively, in the Go structure. + +The keys and their values both get encoded, but with an important difference: some numeric values have a fixed-size encoding of 32 or 64 bits, whereas others (including the **message** tags) are _varint_ encoded—the number of bits depends on the integer's absolute value. For example, the integer values 1 through 15 require 8 bits to encode in _varint_, whereas the values 16 through 2047 require 16 bits. The _varint_ encoding, similar in spirit (but not in detail) to UTF-8 encoding, favors small integer values over large ones. (For a detailed analysis, see the Protobuf [encoding guide][8].) The upshot is that a Protobuf **message** should have small integer values in fields, if possible, and as few keys as possible, but one key per field is unavoidable. + +Table 1 below gives the gist of Protobuf encoding: + +**Table 1. Protobuf data types** + +Encoding | Sample types | Length +---|---|--- +varint | int32, uint32, int64 | Variable length +fixed | fixed32, float, double | Fixed 32-bit or 64-bit length +byte sequence | string, bytes | Sequence length + +Integer types that are not explicitly **fixed** are _varint_ encoded; hence, in a _varint_ type such as **uint32** (**u** for unsigned), the number 32 describes the integer's range (in this case, 0 to 232 \- 1) rather than its bit size, which differs depending on the value. For fixed types such as **fixed32** or **double**, by contrast, the Protobuf encoding requires 32 and 64 bits, respectively. Strings in Protobuf are byte sequences; hence, the size of the field encoding is the length of the byte sequence. + +Another efficiency deserves mention. Recall the earlier example in which a **DataItems** message consists of repeated **DataItem** instances: + + +``` +message DataItems { +  repeated DataItem item = 1; +} +``` + +The **repeated** means that the **DataItem** instances are _packed_: the collection has a single tag, in this case, 1. A **DataItems** message with repeated **DataItem** instances is thus more efficient than a message with multiple but separate **DataItem** fields, each of which would require a tag of its own. + +With this background in mind, let's return to the Go program. + +### The dataItem program in detail + +The _dataItem_ program creates a **DataItem** instance and populates the fields with randomly generated values of the appropriate types. Go has a **rand** package with functions for generating pseudo-random integer and floating-point values, and my **randString** function generates pseudo-random strings of specified lengths from a character set. The design goal is to have a **DataItem** instance with field values of different types and bit sizes. For example, the **OddA** and **EvenA** values are 64-bit non-negative integer values of odd and even parity, respectively; but the **OddB** and **EvenB** variants are 32 bits in size and hold small integer values between 0 and 2047. The random floating-point values are 32 bits in size, and the strings are 16 (**Short**) and 32 (**Long**) characters in length. Here is the code segment that populates the **DataItem** structure with random values: + + +``` +// variable-length integers +n1 := rand.Int63()        // bigger integer +if (n1 & 1) == 0 { n1++ } // ensure it's odd +... +n3 := rand.Int31() % UpperBound // smaller integer +if (n3 & 1) == 0 { n3++ }       // ensure it's odd + +// fixed-length floats +... +t1 := rand.Float32() +t2 := rand.Float32() +... +// strings +str1 := randString(StrShort) +str2 := randString(StrLong) + +// the message +dataItem := &DataItem { +   OddA:  n1, +   EvenA: n2, +   OddB:  n3, +   EvenB: n4, +   Big:   f1, +   Small: f2, +   Short: str1, +   Long:  str2, +} +``` + +Once created and populated with values, the **DataItem** instance is encoded in XML, JSON, and Protobuf, with each encoding written to a local file: + + +``` +func encodeAndserialize(dataItem *DataItem) { +   bytes, _ := xml.MarshalIndent(dataItem, "", " ")  // Xml to dataitem.xml +   ioutil.WriteFile(XmlFile, bytes, 0644)            // 0644 is file access permissions + +   bytes, _ = json.MarshalIndent(dataItem, "", " ")  // Json to dataitem.json +   ioutil.WriteFile(JsonFile, bytes, 0644) + +   bytes, _ = proto.Marshal(dataItem)                // Protobuf to dataitem.pbuf +   ioutil.WriteFile(PbufFile, bytes, 0644) +} +``` + +The three serializing functions use the term _marshal_, which is roughly synonymous with _serialize_. As the code indicates, each of the three **Marshal** functions returns an array of bytes, which then are written to a file. (Possible errors are ignored for simplicity.) On a sample run, the file sizes were: + + +``` +dataitem.xml:  262 bytes +dataitem.json: 212 bytes +dataitem.pbuf:  88 bytes +``` + +The Protobuf encoding is significantly smaller than the other two. The XML and JSON serializations could be reduced slightly in size by eliminating indentation characters, in this case, blanks and newlines. + +Below is the _dataitem.json_ file resulting eventually from the **json.MarshalIndent** call, with added comments starting with **##**: + + +``` +{ + "oddA":  4744002665212642479,                ## 64-bit >= 0 + "evenA": 2395006495604861128,                ## ditto + "oddB":  57,                                 ## 32-bit >= 0 but < 2048 + "evenB": 468,                                ## ditto + "small": 0.7562016,                          ## 32-bit floating-point + "big":   0.85202795,                         ## ditto + "short": "ClH1oDaTtoX$HBN5",                 ## 16 random chars + "long":  "xId0rD3Cri%3Wt%^QjcFLJgyXBu9^DZI"  ## 32 random chars +} +``` + +Although the serialized data goes into local files, the same approach would be used to write the data to the output stream of a network connection. + +### Testing serialization/deserialization + +The Go program next runs an elementary test by deserializing the bytes, which were written earlier to the _dataitem.pbuf_ file, into a **DataItem** instance. Here is the code segment, with the error-checking parts removed: + + +``` +filebytes, err := ioutil.ReadFile(PbufFile) // get the bytes from the file +... +testItem.Reset()                            // clear the DataItem structure +err = proto.Unmarshal(filebytes, testItem)  // deserialize into a DataItem instance +``` + +The **proto.Unmarshal** function for deserializing Protbuf is the inverse of the **proto.Marshal** function. The original **DataItem** and the deserialized clone are printed to confirm an exact match: + + +``` +Original: +2041519981506242154 3041486079683013705 1192 1879 +0.572123 0.326855 +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& + +Deserialized: +2041519981506242154 3041486079683013705 1192 1879 +0.572123 0.326855 +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& +``` + +### A Protobuf client in Java + +The example in Java is to confirm Protobuf's language neutrality. The original IDL file could be used to generate the Java support code, which involves nested classes. To suppress warnings, however, a slight addition can be made. Here is the revision, which specifies a **DataMsg** as the name for the outer class, with the inner class automatically named **DataItem** after the Protobuf message: + + +``` +syntax = "proto3"; + +package main; + +option java_outer_classname = "DataMsg"; + +message DataItem { +... +``` + +With this change in place, the _protoc_ compilation is the same as before, except the desired output is now Java rather than Go: + + +``` +`% protoc --java_out=. dataitem.proto` +``` + +The resulting source file (in a subdirectory named _main_) is _DataMsg.java_ and about 1,120 lines in length: Java is not terse. Compiling and then running the Java code requires a JAR file with the library support for Protobuf. This file is available in the [Maven repository][9]. + +With the pieces in place, my test code is relatively short (and available in the ZIP file as _Main.java_): + + +``` +package main; +import java.io.FileInputStream; + +public class Main { +   public static void main(String[] args) { +      String path = "dataitem.pbuf";  // from the Go program's serialization +      try { +         DataMsg.DataItem deserial = +           DataMsg.DataItem.newBuilder().mergeFrom(new FileInputStream(path)).build(); + +         System.out.println(deserial.getOddA()); // 64-bit odd +         System.out.println(deserial.getLong()); // 32-character string +      } +      catch(Exception e) { System.err.println(e); } +    } +} +``` + +Production-grade testing would be far more thorough, of course, but even this preliminary test confirms the language-neutrality of Protobuf: the _dataitem.pbuf_ file results from the Go program's serialization of a Go **DataItem**, and the bytes in this file are deserialized to produce a **DataItem** instance in Java. The output from the Java test is the same as that from the Go test. + +### Wrapping up with the numPairs program + +Let's end with an example that highlights Protobuf efficiency but also underscores the cost involved in any encoding technology. Consider this Protobuf IDL file: + + +``` +syntax = "proto3"; +package main; + +message NumPairs { +  repeated NumPair pair = 1; +} + +message NumPair { +  int32 odd = 1; +  int32 even = 2; +} +``` + +A **NumPair** message consists of two **int32** values together with an integer tag for each field. A **NumPairs** message is a sequence of embedded **NumPair** messages. + +The _numPairs_ program in Go (below) creates 2 million **NumPair** instances, with each appended to the **NumPairs** message. This message can be serialized and deserialized in the usual way. + +#### Example 2. The numPairs program + + +``` +package main + +import ( +   "math/rand" +   "time" +   "encoding/xml" +   "encoding/json" +   "io/ioutil" +   "github.com/golang/protobuf/proto" +) + +// protoc-generated code: start +var _ = proto.Marshal +type NumPairs struct { +   Pair []*NumPair `protobuf:"bytes,1,rep,name=pair" json:"pair,omitempty"` +} + +func (m *NumPairs) Reset()         { *m = NumPairs{} } +func (m *NumPairs) String() string { return proto.CompactTextString(m) } +func (*NumPairs) ProtoMessage()    {} +func (m *NumPairs) GetPair() []*NumPair { +   if m != nil { return m.Pair } +   return nil +} + +type NumPair struct { +   Odd  int32 `protobuf:"varint,1,opt,name=odd" json:"odd,omitempty"` +   Even int32 `protobuf:"varint,2,opt,name=even" json:"even,omitempty"` +} + +func (m *NumPair) Reset()         { *m = NumPair{} } +func (m *NumPair) String() string { return proto.CompactTextString(m) } +func (*NumPair) ProtoMessage()    {} +func init() {} +// protoc-generated code: finish + +var numPairsStruct NumPairs +var numPairs = &numPairsStruct + +func encodeAndserialize() { +   // XML encoding +   filename := "./pairs.xml" +   bytes, _ := xml.MarshalIndent(numPairs, "", " ") +   ioutil.WriteFile(filename, bytes, 0644) + +   // JSON encoding +   filename = "./pairs.json" +   bytes, _ = json.MarshalIndent(numPairs, "", " ") +   ioutil.WriteFile(filename, bytes, 0644) + +   // ProtoBuf encoding +   filename = "./pairs.pbuf" +   bytes, _ = proto.Marshal(numPairs) +   ioutil.WriteFile(filename, bytes, 0644) +} + +const HowMany = 200 * 100  * 100 // two million + +func main() { +   rand.Seed(time.Now().UnixNano()) + +   // uncomment the modulus operations to get the more efficient version +   for i := 0; i < HowMany; i++ { +      n1 := rand.Int31() // % 2047 +      if (n1 & 1) == 0 { n1++ } // ensure it's odd +      n2 := rand.Int31() // % 2047 +      if (n2 & 1) == 1 { n2++ } // ensure it's even + +      next := &NumPair { +                 Odd:  n1, +                 Even: n2, +              } +      numPairs.Pair = append(numPairs.Pair, next) +   } +   encodeAndserialize() +} +``` + +The randomly generated odd and even values in each **NumPair** range from zero to 2 billion and change. In terms of raw rather than encoded data, the integers generated in the Go program add up to 16MB: two integers per **NumPair** for a total of 4 million integers in all, and each value is four bytes in size. + +For comparison, the table below has entries for the XML, JSON, and Protobuf encodings of the 2 million **NumPair** instances in the sample **NumsPairs** message. The raw data is included, as well. Because the _numPairs_ program generates random values, output differs across sample runs but is close to the sizes shown in the table. + +**Table 2. Encoding overhead for 16MB of integers** + +Encoding | File | Byte size | Pbuf/other ratio +---|---|---|--- +None | pairs.raw | 16MB | 169% +Protobuf | pairs.pbuf | 27MB | — +JSON | pairs.json | 100MB | 27% +XML | pairs.xml | 126MB | 21% + +As expected, Protobuf shines next to XML and JSON. The Protobuf encoding is about a quarter of the JSON one and about a fifth of the XML one. But the raw data make clear that Protobuf incurs the overhead of encoding: the serialized Protobuf message is 11MB larger than the raw data. Any encoding, including Protobuf, involves structuring the data, which unavoidably adds bytes. + +Each of the serialized 2 million **NumPair** instances involves _four_ integer values: one apiece for the **Even** and **Odd** fields in the Go structure, and one tag per each field in the Protobuf encoding. As raw rather than encoded data, this would come to 16 bytes per instance, and there are 2 million instances in the sample **NumPairs** message. But the Protobuf tags, like the **int32** values in the **NumPair** fields, use _varint_ encoding and, therefore, vary in byte length; in particular, small integer values (which include the tags, in this case) require fewer than four bytes to encode. + +If the _numPairs_ program is revised so that the two **NumPair** fields hold values less than 2048, which have encodings of either one or two bytes, then the Protobuf encoding drops from 27MB to 16MB—the very size of the raw data. The table below summarizes the new encoding sizes from a sample run. + +**Table 3. Encoding with 16MB of integers < 2048** + +Encoding | File | Byte size | Pbuf/other ratio +---|---|---|--- +None | pairs.raw | 16MB | 100% +Protobuf | pairs.pbuf | 16MB | — +JSON | pairs.json | 77MB | 21% +XML | pairs.xml | 103MB | 15% + +In summary, the modified _numPairs_ program, with field values less than 2048, reduces the four-byte size for each integer value in the raw data. But the Protobuf encoding still requires tags, which add bytes to the Protobuf message. Protobuf encoding does have a cost in message size, but this cost can be reduced by the _varint_ factor if relatively small integer values, whether in fields or keys, are being encoded. + +For moderately sized messages consisting of structured data with mixed types—and relatively small integer values—Protobuf has a clear advantage over options such as XML and JSON. In other cases, the data may not be suited for Protobuf encoding. For example, if two applications need to share a huge set of text records or large integer values, then compression rather than encoding technology may be the way to go. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/protobuf-data-interchange + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://developers.google.com/protocol-buffers/ +[3]: https://en.wikipedia.org/wiki/DCE/RPC +[4]: https://en.wikipedia.org/wiki/Interface_description_language +[5]: https://grpc.io/ +[6]: http://condor.depaul.edu/mkalin +[7]: https://github.com/protocolbuffers/protobuf +[8]: https://developers.google.com/protocol-buffers/docs/encoding +[9]: https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java diff --git a/sources/tech/20191018 Perceiving Python programming paradigms.md b/sources/tech/20191018 Perceiving Python programming paradigms.md new file mode 100644 index 0000000000..9a0027d61d --- /dev/null +++ b/sources/tech/20191018 Perceiving Python programming paradigms.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Perceiving Python programming paradigms) +[#]: via: (https://opensource.com/article/19/10/python-programming-paradigms) +[#]: author: (Jigyasa Grover https://opensource.com/users/jigyasa-grover) + +Perceiving Python programming paradigms +====== +Python supports imperative, functional, procedural, and object-oriented +programming; here are tips on choosing the right one for a specific use +case. +![A python with a package.][1] + +Early each year, TIOBE announces its Programming Language of The Year. When its latest annual [TIOBE index][2] report came out, I was not at all surprised to see [Python again winning the title][3], which was based on capturing the most search engine ranking points (especially on Google, Bing, Yahoo, Wikipedia, Amazon, YouTube, and Baidu) in 2018. + +![Python data from TIOBE Index][4] + +Adding weight to TIOBE's findings, earlier this year, nearly 90,000 developers took Stack Overflow's annual [Developer Survey][5], which is the largest and most comprehensive survey of people who code around the world. The main takeaway from this year's results was: + +> "Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust)." + +Ever since I started programming and exploring different languages, I have seen admiration for Python soaring high. Since 2003, it has consistently been among the top 10 most popular programming languages. As TIOBE's report stated: + +> "It is the most frequently taught first language at universities nowadays, it is number one in the statistical domain, number one in AI programming, number one in scripting and number one in writing system tests. Besides this, Python is also leading in web programming and scientific computing (just to name some other domains). In summary, Python is everywhere." + +There are several reasons for Python's rapid rise, bloom, and dominance in multiple domains, including web development, scientific computing, testing, data science, machine learning, and more. The reasons include its readable and maintainable code; extensive support for third-party integrations and libraries; modular, dynamic, and portable structure; flexible programming; learning ease and support; user-friendly data structures; productivity and speed; and, most important, community support. The diverse application of Python is a result of its combined features, which give it an edge over other languages. + +But in my opinion, the comparative simplicity of its syntax and the staggering flexibility it provides developers coming from many other languages win the cake. Very few languages can match Python's ability to conform to a developer's coding style rather than forcing him or her to code in a particular way. Python lets more advanced developers use the style they feel is best suited to solve a particular problem. + +While working with Python, you are like a snake charmer. This allows you to take advantage of Python's promise to offer a non-conforming environment for developers to code in the style best suited for a particular situation and to make the code more readable, testable, and coherent. + +## Python programming paradigms + +Python supports four main [programming paradigms][6]: imperative, functional, procedural, and object-oriented. Whether you agree that they are valid or even useful, Python strives to make all four available and working. Before we dive in to see which programming paradigm is most suitable for specific use cases, it is a good time to do a quick review of them. + +### Imperative programming paradigm + +The [imperative programming paradigm][7] uses the imperative mood of natural language to express directions. It executes commands in a step-by-step manner, just like a series of verbal commands. Following the "how-to-solve" approach, it makes direct changes to the state of the program; hence it is also called the stateful programming model. Using the imperative programming paradigm, you can quickly write very simple yet elegant code, and it is super-handy for tasks that involve data manipulation. Owing to its comparatively slower and sequential execution strategy, it cannot be used for complex or parallel computations. + +[![Linus Torvalds quote][8]][9] + +Consider this example task, where the goal is to take a list of characters and concatenate it to form a string. A way to do it in an imperative programming style would be something like: + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> sample_string = '' +>>> sample_string +'' +>>> sample_string = sample_string + sample_characters[0] +>>> sample_string +'p' +>>> sample_string = sample_string + sample_characters[1] +>>> sample_string +'py' +>>> sample_string = sample_string + sample_characters[2] +>>> sample_string +'pyt' +>>> sample_string = sample_string + sample_characters[3] +>>> sample_string +'pyth' +>>> sample_string = sample_string + sample_characters[4] +>>> sample_string +'pytho' +>>> sample_string = sample_string + sample_characters[5] +>>> sample_string +'python' +>>> +``` + +Here, the variable **sample_string** is also like a state of the program that is getting changed after executing the series of commands, and it can be easily extracted to track the progress of the program. The same can be done using a **for** loop (also considered imperative programming) in a shorter version of the above code: + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> sample_string = '' +>>> sample_string +>>> for c in sample_characters: +...    sample_string = sample_string + c +...    print(sample_string) +... +p +py +pyt +pyth +pytho +python +>>> +``` + +### Functional programming paradigm + +The [functional programming paradigm][10] treats program computation as the evaluation of mathematical functions based on [lambda calculus][11]. Lambda calculus is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It follows the "what-to-solve" approach—that is, it expresses logic without describing its control flow—hence it is also classified as the declarative programming model. + +The functional programming paradigm promotes stateless functions, but it's important to note that Python's implementation of functional programming deviates from standard implementation. Python is said to be an _impure_ functional language because it is possible to maintain state and create side effects if you are not careful. That said, functional programming is handy for parallel processing and is super-efficient for tasks requiring recursion and concurrent execution. + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> import functools +>>> sample_string = functools.reduce(lambda s,c: s + c, sample_characters) +>>> sample_string +'python' +>>> +``` + +Using the same example, the functional way of concatenating a list of characters to form a string would be the same as above. Since the computation happens in a single line, there is no explicit way to obtain the state of the program with **sample_string** and track the progress. The functional programming implementation of this example is fascinating, as it reduces the lines of code and simply does its job in a single line, with the exception of using the **functools** module and the **reduce** method. The three keywords—**functools**, **reduce**, and **lambda**—are defined as follows: + + * **functools** is a module for higher-order functions and provides for functions that act on or return other functions. It encourages writing reusable code, as it is easier to replicate existing functions with some arguments already passed and create a new version of a function in a well-documented manner. + * **reduce** is a method that applies a function of two arguments cumulatively to the items in sequence, from left to right, to reduce the sequence to a single value. For example: [code] >>> sample_list = [1,2,3,4,5] +>>> import functools +>>> sum = functools.reduce(lambda x,y: x + y, sample_list) +>>> sum +15 +>>> ((((1+2)+3)+4)+5) +15 +>>> +``` + * **lambda functions** are small, anonymized (i.e., nameless) functions that can take any number of arguments but spit out only one value. They are useful when they are used as an argu \ No newline at end of file diff --git a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md new file mode 100644 index 0000000000..e34b1d825c --- /dev/null +++ b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) +[#]: via: (https://www.linuxtechi.com/scp-command-examples-in-linux/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +14 SCP Command Examples to Securely Transfer Files in Linux +====== + +**SCP** (Secure Copy) is command line tool in Linux and Unix like systems which is used to transfer files and directories across the systems securely over the network. When we use scp command to copy files and directories from our local system to remote system then in the backend it makes **ssh connection** to remote system. In other words, we can say scp uses the same **SSH security mechanism** in the backend, it needs either password or keys for authentication. + +[![scp-command-examples-linux][1]][2] + +In this tutorial we will discuss 14 useful Linux scp command examples. + +**Syntax of scp command:** + +### scp <options> <files_or_directories> [root@linuxtechi][3]_host:/<folder> + +### scp <options> [root@linuxtechi][3]_host:/files   <folder_local_system> + +First syntax of scp command demonstrate how to copy files or directories from local system to target host under the specific folder. + +Second syntax of scp command demonstrate how files from target host is copied into local system. + +Some of the most widely used options in scp command are listed below, + + *  -C         Enable Compression + *  -i           identity File or private key + *  -l           limit the bandwidth while copying + *  -P          ssh port number of target host + *  -p          Preserves permissions, modes and access time of files while copying + *  -q          Suppress warning message of SSH + *   -r          Copy files and directories recursively + *   -v          verbose output + + + +Let’s jump into the examples now!!!! + +###### Example:1) Copy a file from local system to remote system using scp + +Let’s assume we want to copy jdk rpm package from our local Linux system to remote system (172.20.10.8) using scp command, use the following command, + +``` +[root@linuxtechi ~]$ scp jdk-linux-x64_bin.rpm root@linuxtechi:/opt +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 27.1MB/s 00:00 +[root@linuxtechi ~]$ +``` + +Above command will copy jdk rpm package file to remote system under /opt folder. + +###### Example:2) Copy a file from remote System to local system using scp + +Let’s suppose we want to copy a file from remote system to our local system under the /tmp folder, execute the following scp command, + +``` +[root@linuxtechi ~]$ scp root@linuxtechi:/root/Technical-Doc-RHS.odt /tmp +root@linuxtechi's password: +Technical-Doc-RHS.odt 100% 1109KB 31.8MB/s 00:00 +[root@linuxtechi ~]$ ls -l /tmp/Technical-Doc-RHS.odt +-rwx------. 1 pkumar pkumar 1135521 Oct 19 11:12 /tmp/Technical-Doc-RHS.odt +[root@linuxtechi ~]$ +``` + +######  Example:3) Verbose Output while transferring files using scp (-v) + +In scp command, we can enable the verbose output using -v option, using verbose output we can easily find what exactly is happening in the background. This becomes very useful in **debugging connection**, **authentication** and **configuration problems**. + +``` +root@linuxtechi ~]$ scp -v jdk-linux-x64_bin.rpm root@linuxtechi:/opt +Executing: program /usr/bin/ssh host 172.20.10.8, user root, command scp -v -t /opt +OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS 11 Sep 2018 +debug1: Reading configuration data /etc/ssh/ssh_config +debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf +debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config +debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for * +debug1: Connecting to 172.20.10.8 [172.20.10.8] port 22. +debug1: Connection established. +………… +debug1: Next authentication method: password +root@linuxtechi's password: +``` + +###### Example:4) Transfer multiple files to remote system + +Multiple files can be copied / transferred to remote system using scp command in one go, in scp command specify the multiple files separated by space, example is shown below + +``` +[root@linuxtechi ~]$ scp install.txt index.html jdk-linux-x64_bin.rpm root@linuxtechi:/mnt +root@linuxtechi's password: +install.txt 100% 0 0.0KB/s 00:00 +index.html 100% 85KB 7.2MB/s 00:00 +jdk-linux-x64_bin.rpm 100% 10MB 25.3MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:5) Transfer files across two remote hosts + +Using scp command we can copy files and directories between two remote hosts, let’s suppose we have a local Linux system which can connect to two remote Linux systems, so from my local linux system I can use scp command to copy files across these two systems, + +Syntax: + +### scp [root@linuxtechi][3]_hosts1:/<files_to_transfer>  [root@linuxtechi][3]_host2:/<folder> + +Example is shown below, + +``` +# scp root@linuxtechi:~/backup-Oct.zip root@linuxtechi:/tmp +# ssh root@linuxtechi "ls -l /tmp/backup-Oct.zip" +-rwx------. 1 root root 747438080 Oct 19 12:02 /tmp/backup-Oct.zip +``` + +###### Example:6) Copy files and directories recursively (-r) + +Use -r option in scp command to recursively copy the entire directory from one system to another, example is shown below, + +``` +[root@linuxtechi ~]$ scp -r Downloads root@linuxtechi:/opt +``` + +Use below command to verify whether Download folder is copied to remote system or not, + +``` +[root@linuxtechi ~]$ ssh root@linuxtechi "ls -ld /opt/Downloads" +drwxr-xr-x. 2 root root 75 Oct 19 12:10 /opt/Downloads +[root@linuxtechi ~]$ +``` + +###### Example:7) Increase transfer speed by enabling compression (-C) + +In scp command, we can increase the transfer speed by enabling the compression using -C option, it will automatically enable compression at source and decompression at destination host. + +``` +root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt +``` + +In the above example we are transferring the Download directory with compression enabled. + +###### Example:8) Limit bandwidth while copying ( -l ) + +Use ‘-l’ option in scp command to put limit on bandwidth usage while copying. Bandwidth is specified in Kbit/s, example is shown below, + +``` +[root@linuxtechi ~]$ scp -l 500 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +###### Example:9) Specify different ssh port while scp ( -P) + +There can be some scenario where ssh port is changed on destination host, so while using scp command we can specify the ssh port number using ‘-P’ option. + +``` +[root@linuxtechi ~]$ scp -P 2022 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +In above example, ssh port for remote host is “2022” + +###### Example:10) Preserves permissions, modes and access time of files while copying (-p) + +Use “-p” option in scp command to preserve permissions, access time and modes while copying from source to destination + +``` +[root@linuxtechi ~]$ scp -p jdk-linux-x64_bin.rpm root@linuxtechi:/var/tmp +jdk-linux-x64_bin.rpm 100% 10MB 13.5MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:11) Transferring files in quiet mode ( -q) in scp + +Use ‘-q’ option in scp command to suppress transfer progress, warning and diagnostic messages of ssh. Example is shown below, + +``` +[root@linuxtechi ~]$ scp -q -r Downloads root@linuxtechi:/var/tmp +[root@linuxtechi ~]$ +``` + +###### Example:12) Use Identify file in scp while transferring ( -i ) + +In most of the Linux environments, keys-based authentication is preferred. In scp command we specify the identify file or private key file using ‘-i’ option, example is shown below, + +``` +[root@linuxtechi ~]$ scp -i my_key.pem -r Downloads root@linuxtechi:/root +``` + +In above example, “my_key.pem” is the identity file or private key file. + +###### Example:13) Use different ‘ssh_config’ file in scp ( -F) + +There are some scenarios where you use different networks to connect to Linux systems, may be some network is behind proxy servers, so in that case we must have different **ssh_config** file. + +Different ssh_config file in scp command is specified via ‘-F’ option, example is shown below + +``` +[root@linuxtechi ~]$ scp -F /home/pkumar/new_ssh_config -r Downloads root@linuxtechi:/root +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 16.6MB/s 00:00 +backup-Oct.zip 100% 713MB 41.9MB/s 00:17 +index.html 100% 85KB 6.6MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:14) Use Different Cipher in scp command (-c) + +By default, scp uses ‘AES-128’ cipher to encrypt the files. If you want to use another cipher in scp command then use ‘-c’ option followed by cipher name, + +Let’s suppose we want to use ‘3des-cbc’ cipher in scp command while transferring the files, run the following scp command + +``` +[root@linuxtechi ~]# scp -c 3des-cbc -r Downloads root@linuxtechi:/root +``` + +Use the below command to list ssh and scp ciphers, + +``` +[root@linuxtechi ~]# ssh -Q cipher localhost | paste -d , -s - +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,root@linuxtechi,aes128-ctr,aes192-ctr,aes256-ctr,root@linuxtechi,root@linuxtechi,root@linuxtechi +[root@linuxtechi ~]# +``` + +That’s all from this tutorial, to get more details about scp command, kindly refer its man page. Please do share your feedback and comments in comments section below. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/scp-command-examples-in-linux/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/scp-command-examples-linux.jpg +[3]: https://www.linuxtechi.com/cdn-cgi/l/email-protection diff --git a/sources/tech/20191021 How to build a Flatpak.md b/sources/tech/20191021 How to build a Flatpak.md new file mode 100644 index 0000000000..94bbb65036 --- /dev/null +++ b/sources/tech/20191021 How to build a Flatpak.md @@ -0,0 +1,320 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to build a Flatpak) +[#]: via: (https://opensource.com/article/19/10/how-build-flatpak-packaging) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to build a Flatpak +====== +A universal packaging format with a decentralized means of distribution. +Plus, portability and sandboxing. +![][1] + +A long time ago, a Linux distribution shipped an operating system along with _all_ the software available for it. There was no concept of “third party” software because everything was a part of the distribution. Applications weren’t so much installed as they were enabled from a great big software repository that you got on one of the many floppy disks or, later, CDs you purchased or downloaded. + +This evolved into something even more convenient as the internet became ubiquitous, and the concept of what is now the “app store” was born. Of course, Linux distributions tend to call this a _software repository_ or just _repo_ for short, with some variations for “branding”, such as _Ubuntu Software Center_ or, with typical GNOME minimalism, simply _Software_. + +This model worked well back when open source software was still a novelty and the number of open source applications was a number rather than a _theoretical_ number. In today’s world of GitLab and GitHub and Bitbucket (and [many][2] [many][3] more), it’s hardly possible to count the number of open source projects, much less package them up in a repository. No Linux distribution today, even [Debian][4] and its formidable group of package maintainers, can claim or hope to have a package for every installable open source project. + +Of course, a Linux package doesn’t have to be in a repository to be installable. Any programmer can package up their software and distribute it from their own website. However, because repositories are seen as an integral part of a distribution, there isn’t a universal packaging format, meaning that a programmer must decide whether to release a `.deb` or `.rpm`, or an AUR build script, or a Nix or Guix package, or a Homebrew script, or just a mostly-generic `.tgz` archive for `/opt`. It’s overwhelming for a developer who lives and breathes Linux every day, much less for a developer just trying to make a best-effort attempt at supporting a free and open source target. + +### Why Flatpak? + +The Flatpak project provides a universal packaging format along with a decentralized means of distribution, plus portability, and sandboxing. + + * **Universal** Install the Flatpak system, and you can run Flatpaks, regardless of your distribution. No daemon or systemd required. The same Flatpak runs on Fedora, Ubuntu, Mageia, Pop OS, Arch, Slackware, and more. + * **Decentralized** Developers can create and sign their own Flatpak packages and repositories. There’s no repository to petition in order to get a package included. + * **Portability** If you have a Flatpak on your system and want to hand it to a friend so they can run the same application, you can export the Flatpak to a USB thumbdrive. + * **Sandboxed** Flatpaks use a container-based model, allowing multiple versions of libraries and applications to exist on one system. Yes, you can easily install the latest version of an app to test out while maintaining the old version you rely on. + + + +### Building a Flatpak + +To build a Flatpak, you must first install Flatpak (the subsystem that enables you to use Flatpak packages) and the Flatpak-builder application. + +On Fedora, CentOS, RHEL, and similar: + + +``` +`$ sudo dnf install flatpak flatpak-builder` +``` + +On Debian, Ubuntu, and similar: + + +``` +`$ sudo apt install flatpak flatpak-builder` +``` + +You must also install the development tools required to build the application you are packaging. By nature of developing the application you’re now packaging, you may already have a development environment installed, so you might not notice that these components are required, but should you start building Flatpaks with Jenkins or from inside containers, then you must ensure that your build tools are a part of your toolchain. + +For the first example build, this article assumes that your application uses [GNU Autotools][5], but Flatpak itself supports other build systems, such as `cmake`, `cmake-ninja`, `meson`, `ant`, as well as custom commands (a `simple` build system, in Flatpak terminology, but by no means does this imply that the build itself is actually simple). + +#### Project directory + +Unlike the strict RPM build infrastructure, Flatpak doesn’t impose a project directory structure. I prefer to create project directories based on the **dist** packages of software, but there’s no technical reason you can’t instead integrate your Flatpak build process with your source directory. It is technically easier to build a Flatpak from your **dist** package, though, and it’s an easier demo too, so that’s the model this article uses. Set up a project directory for GNU Hello, serving as your first Flatpak: + + +``` +$ mkdir hello_flatpak +$ mkdir src +``` + +Download your distributable source. For this example, the source code is located at `https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz`. + + +``` +$ cd hello_flatpak +$ wget +``` + +#### Manifest + +A Flatpak is defined by a manifest, which describes how to build and install the application it is delivering. A manifest is atomic and reproducible. A Flatpak exists in a “sandbox” container, though, so the manifest is based on a mostly empty environment with a root directory call `/app`. + +The first two attributes are the ID of the application you are packaging and the command provided by it. The application ID must be unique to the application you are packaging. The canonical way of formulating a unique ID is to use a triplet value consisting of the entity responsible for the code followed by the name of the application, such as `org.gnu.Hello`. The command provided by the application is whatever you type into a terminal to run the application. This does not imply that the application is intended to be run from a terminal instead of a `.desktop` file in the Activities or Applications menu. + +In a file called `org.gnu.Hello.yaml`, enter this text: + + +``` +id: org.gnu.Hello +command: hello +``` + +A manifest can be written in [YAML][6] or in JSON. This article uses YAML. + +Next, you must define each “module” delivered by this Flatpak package. You can think of a module as a dependency or a component. For GNU Hello, there is only one module: GNU Hello. More complex applications may require a specific library or another application entirely. + + +``` +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        path: src/hello-2.10.tar.gz +``` + +The `buildsystem` value identifies how Flatpak must build the module. Each module can use its own build system, so one Flatpak can have several build systems defined. + +The `no-autogen` value tells Flatpak not to run the setup commands for `autotools`, which aren’t necessary because the GNU Hello source code is the product of `make dist`. If the code you’re building isn’t in a easily buildable form, then you may need to install `autogen` and `autoconf` to prepare the source for `autotools`. This option doesn’t apply at all to projects that don’t use `autotools`. + +The `type` value tells Flatpak that the source code is in an archive, which triggers the requisite unarchival tasks before building. The `path` points to the source code. In this example, the source exists in the `src` directory on your local build machine, but you could instead define the source as a remote location: + + +``` +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        url: +``` + +Finally, you must define the platform required for the application to run and build. The Flatpak maintainers supply runtimes and SDKs that include common libraries, including `freedesktop`, `gnome`, and `kde`. The basic requirement is the `freedesk` runtime and SDK, although this may be superseded by GNOME or KDE, depending on what your code needs to run. For this GNU Hello example, only the basics are required. + + +``` +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +``` + +The entire GNU Hello flatpak manifest: + + +``` +id: org.gnu.Hello +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +command: hello +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        path: src/hello-2.10.tar.gz +``` + +#### Building a Flatpak + +Now that the package is defined, you can build it. The build process prompts Flatpak-builder to parse the manifest and to resolve each requirement: it ensures that the necessary Platform and SDK are available (if they aren’t, then you’ll have to install them with the `flatpak` command), it unarchives the source code, and executes the `buildsystem` specified. + +The command to start: + + +``` +`$ flatpak-builder build-dir org.gnu.Hello.yaml` +``` + +The directory `build-dir` is created if it does not already exist. The name `build-dir` is arbitrary; you could call it `build` or `bld` or `penguin`, and you can have more than one build destination in the same project directory. However, the term `build-dir` is a frequent value used in documentation, so using it as the literal value can be helpful. + +#### Testing your application + +You can test your application before or after it has been built by running the build command along with the `--run` option, and endingi the command with the command provided by the Flatpak: + + +``` +$ flatpak-builder --run build-dir \ +org.gnu.Hello.yaml hello +Hello, world! +``` + +### Packaging GUI apps with Flatpak + +Packaging up a simple self-contained _hello world_ application is trivial, and fortunately packaging up a GUI application isn’t much harder. The most difficult applications to package are those that don’t rely on common libraries and frameworks (in the context of packaging, “common” means anything _not_ already packaged by someone else). The Flatpak community provides SDKs and SDK Extensions for many components you might otherwise have had to package yourself. For instance, when packaging the pure Java implementation of `pdftk`, I use the OpenJDK SDK extension I found in the Flatpak Github repository: + + +``` +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.openjdk11 +``` + +The Flatpak community does a lot of work on the foundations required for applications to run upon in order to make the packaging process easy for developers. For instance, the Kblocks game from the KDE community requires the KDE platform to run, and that’s already available from Flatpak. The additional `libkdegames` library is not included, but it’s as easy to add it to your list of `modules` as `kblocks` itself. + +Here’s a manifest for the Kblocks game: + + +``` +id: org.kde.kblocks +command: kblocks +modules: +\- buildsystem: cmake-ninja +  name: libkdegames +  sources: +    type: archive +    path: src/libkdegames-19.08.2.tar.xz +\- buildsystem: cmake-ninja +  name: kblocks +  sources: +    type: archive +    path: src/kblocks-19.08.2.tar.xz +runtime: org.kde.Platform +runtime-version: '5.13' +sdk: org.kde.Sdk +``` + +As you can see, the manifest is still straight-forward and relatively intuitive. The build system is different, and the runtime and SDK point to KDE instead of the Freedesktop, but the structure and requirements are basically the same. + +Because it’s a GUI application, however, there are some new options required. First, it needs an icon so that when it’s listed in the Activities or Application menu, it looks nice and recognizable. Kblocks includes an icon in its sources, but the names of files exported by a Flatpak must be prefixed using the application ID (such as `org.kde.Kblocks.desktop`). The easiest way to do this is to rename the file directly in the application source, which Flatpak can do for you as long as you include this directive in your manifest: + + +``` +`rename-icon: kblocks` +``` + +Another unique trait of GUI applications is that they often require integration with common desktop services, like the graphics server (X11 or Wayland) itself, a sound server such as [Pulse Audio][7], and the Inter-Process Communication (IPC) subsystem. + +In the case of Kblocks, the requirements are: + + +``` +finish-args: +\- --share=ipc +\- --socket=x11 +\- --socket=wayland +\- --socket=pulseaudio +\- --device=dri +\- --filesystem=xdg-config/kdeglobals:ro +``` + +Here’s the final, complete manifest, using URLs for the sources so you can try this on your own system easily: + + +``` +command: kblocks +finish-args: +\- --share=ipc +\- --socket=x11 +\- --socket=wayland +\- --socket=pulseaudio +\- --device=dri +\- --filesystem=xdg-config/kdeglobals:ro +id: org.kde.kblocks +modules: +\- buildsystem: cmake-ninja +  name: libkdegames +  sources: +  - sha256: 83456cec44502a1f79c0be00c983090e32fd8aea5fec1461fbfbd37b5f8866ac +    type: archive +    url: +\- buildsystem: cmake-ninja +  name: kblocks +  sources: +  - sha256: 8b52c949e2d446a4ccf81b09818fc90234f2f55d8722c385491ee67e1f2abf93 +    type: archive +    url: +rename-icon: kblocks +runtime: org.kde.Platform +runtime-version: '5.13' +sdk: org.kde.Sdk +``` + +To build the application, you must have the KDE Platform and SDK Flatpaks (version 5.13 as of this writing) installed. Once the application has been built, you can run it using the `--run` method, but to see the application icon, you must install it. + +#### Distributing and installing a Flatpak you have built + +Distributing flatpaks happen through repositories. + +You can list your apps on [Flathub.org][8], a community website meant as a _technically_ decentralised (but central in spirit) location for Flatpaks. To submit your Flatpak, [place your manifest into a Git repository][9] and [submit a pull request on Github][10]. + +Alternately, you can create your own repository using the `flatpak build-export` command. + +You can also just install locally: + + +``` +`$ flatpak-builder --force-clean --install build-dir org.kde.Kblocks.yaml` +``` + +Once installed, open your Activities or Applications menu and search for Kblocks. + +![The Activities menu in GNOME][11] + +### Learning more + +The [Flatpak documentation site][12] has a good walkthrough on building your first Flatpak. It’s worth reading even if you’ve followed along with this article. Besides that, the docs provide details on what Platforms and SDKs are available. + +For those who enjoy learning from examples, there are manifests for _every application_ available on [Flathub][13]. + +The resources to build and use Flatpaks are plentiful, and Flatpak, along with containers and sandboxed apps, are arguably [the future][14], so get familiar with them, start integrating them with your Jenkins pipelines, and enjoy easy and universal Linux app packaging. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-build-flatpak-packaging + +作者:[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/flatpak-lead-image.png?itok=J93RG_fi +[2]: http://notabug.org +[3]: http://savannah.nongnu.org/ +[4]: http://debian.org +[5]: https://opensource.com/article/19/7/introduction-gnu-autotools +[6]: https://www.redhat.com/sysadmin/yaml-tips +[7]: https://opensource.com/article/17/1/linux-plays-sound +[8]: http://flathub.org +[9]: https://opensource.com/resources/what-is-git +[10]: https://opensource.com/life/16/3/submit-github-pull-request +[11]: https://opensource.com/sites/default/files/gnome-activities-kblocks.jpg (The Activities menu in GNOME) +[12]: http://docs.flatpak.org/en/latest/introduction.html +[13]: https://github.com/flathub +[14]: https://silverblue.fedoraproject.org/ diff --git a/sources/tech/20191021 How to program with Bash- Syntax and tools.md b/sources/tech/20191021 How to program with Bash- Syntax and tools.md new file mode 100644 index 0000000000..ae17b836d5 --- /dev/null +++ b/sources/tech/20191021 How to program with Bash- Syntax and tools.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Syntax and tools) +[#]: via: (https://opensource.com/article/19/10/programming-bash-part-1) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Syntax and tools +====== +Learn basic Bash programming syntax and tools, as well as how to use +variables and control operators, in the first article in this three-part +series. +![bash logo on green background][1] + +A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it sends them to STDOUT which, by default, [displays them in the terminal][2]. All of the shells I am familiar with are also programming languages. + +Features like tab completion, command-line recall and editing, and shortcuts like aliases all contribute to its value as a powerful shell. Its default command-line editing mode uses Emacs, but one of my favorite Bash features is that I can change it to Vi mode to use editing commands that are already part of my muscle memory. + +However, if you think of Bash solely as a shell, you miss much of its true power. While researching my three-volume [Linux self-study course][3] (on which this series of articles is based), I learned things about Bash that I'd never known in over 20 years of working with Linux. Some of these new bits of knowledge relate to its use as a programming language. Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. + +This three-part series explores using Bash as a command-line interface (CLI) programming language. This first article looks at some simple command-line programming with Bash, variables, and control operators. The other articles explore types of Bash files; string, numeric, and miscellaneous logical operators that provide execution-flow control logic; different types of shell expansions; and the **for**, **while**, and **until** loops that enable repetitive operations. They will also look at some commands that simplify and support the use of these tools. + +### The shell + +A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it displays them in the terminal. All of the shells I am familiar with are also programming languages. + +Bash stands for Bourne Again Shell because the Bash shell is [based upon][4] the older Bourne shell that was written by Steven Bourne in 1977. Many [other shells][5] are available, but these are the four I encounter most frequently: + + * **csh:** The C shell for programmers who like the syntax of the C language + * **ksh:** The Korn shell, written by David Korn and popular with Unix users + * **tcsh:** A version of csh with more ease-of-use features + * **zsh:** The Z shell, which combines many features of other popular shells + + + +All shells have built-in commands that supplement or replace the ones provided by the core utilities. Open the shell's man page and find the "BUILT-INS" section to see the commands it provides. + +Each shell has its own personality and syntax. Some will work better for you than others. I have used the C shell, the Korn shell, and the Z shell. I still like the Bash shell more than any of them. Use the one that works best for you, although that might require you to try some of the others. Fortunately, it's quite easy to change shells. + +All of these shells are programming languages, as well as command interpreters. Here's a quick tour of some programming constructs and tools that are integral parts of Bash. + +### Bash as a programming language + +Most sysadmins have used Bash to issue commands that are usually fairly simple and straightforward. But Bash can go beyond entering single commands, and many sysadmins create simple command-line programs to perform a series of tasks. These programs are common tools that can save time and effort. + +My objective when writing CLI programs is to save time and effort (i.e., to be the lazy sysadmin). CLI programs support this by listing several commands in a specific sequence that execute one after another, so you do not need to watch the progress of one command and type in the next command when the first finishes. You can go do other things and not have to continually monitor the progress of each command. + +### What is "a program"? + +The Free On-line Dictionary of Computing ([FOLDOC][6]) defines a program as: "The instructions executed by a computer, as opposed to the physical device on which they run." Princeton University's [WordNet][7] defines a program as: "…a sequence of instructions that a computer can interpret and execute…" [Wikipedia][8] also has a good entry about computer programs. + +Therefore, a program can consist of one or more instructions that perform a specific, related task. A computer program instruction is also called a program statement. For sysadmins, a program is usually a sequence of shell commands. All the shells available for Linux, at least the ones I am familiar with, have at least a basic form of programming capability, and Bash, the default shell for most Linux distributions, is no exception. + +While this series uses Bash (because it is so ubiquitous), if you use a different shell, the general programming concepts will be the same, although the constructs and syntax may differ somewhat. Some shells may support some features that others do not, but they all provide some programming capability. Shell programs can be stored in a file for repeated use, or they may be created on the command line as needed. + +### Simple CLI programs + +The simplest command-line programs are one or two consecutive program statements, which may be related or not, that are entered on the command line before the **Enter** key is pressed. The second statement in a program, if there is one, might be dependent upon the actions of the first, but it does not need to be. + +There is also one bit of syntactical punctuation that needs to be clearly stated. When entering a single command on the command line, pressing the **Enter** key terminates the command with an implicit semicolon (**;**). When used in a CLI shell program entered as a single line on the command line, the semicolon must be used to terminate each statement and separate it from the next one. The last statement in a CLI shell program can use an explicit or implicit semicolon. + +### Some basic syntax + +The following examples will clarify this syntax. This program consists of a single command with an explicit terminator: + + +``` +[student@studentvm1 ~]$ echo "Hello world." ; +Hello world. +``` + +That may not seem like much of a program, but it is the first program I encounter with every new programming language I learn. The syntax may be a bit different for each language, but the result is the same. + +Let's expand a little on this trivial but ubiquitous program. Your results will be different from mine because I have done other experiments, while you may have only the default directories and files that are created in the account home directory the first time you log into an account via the GUI desktop. + + +``` +[student@studentvm1 ~]$ echo "My home directory." ; ls ; +My home directory. +chapter25   TestFile1.Linux  dmesg2.txt  Downloads  newfile.txt  softlink1  testdir6 +chapter26   TestFile1.mac    dmesg3.txt  file005    Pictures     Templates  testdir +TestFile1      Desktop       dmesg.txt   link3      Public       testdir    Videos +TestFile1.dos  dmesg1.txt    Documents   Music      random.txt   testdir1 +``` + +That makes a bit more sense. The results are related, but the individual program statements are independent of each other. Notice that I like to put spaces before and after the semicolon because it makes the code a bit easier to read. Try that little CLI program again without an explicit semicolon at the end: + + +``` +`[student@studentvm1 ~]$ echo "My home directory." ; ls` +``` + +There is no difference in the output. + +### Something about variables + +Like all programming languages, the Bash shell can deal with variables. A variable is a symbolic name that refers to a specific location in memory that contains a value of some sort. The value of a variable is changeable, i.e., it is variable. + +Bash does not type variables like C and related languages, defining them as integers, floating points, or string types. In Bash, all variables are strings. A string that is an integer can be used in integer arithmetic, which is the only type of math that Bash is capable of doing. If more complex math is required, the [**bc** command][9] can be used in CLI programs and scripts. + +Variables are assigned values and can be used to refer to those values in CLI programs and scripts. The value of a variable is set using its name but not preceded by a **$** sign. The assignment **VAR=10** sets the value of the variable VAR to 10. To print the value of the variable, you can use the statement **echo $VAR**. Start with text (i.e., non-numeric) variables. + +Bash variables become part of the shell environment until they are unset. + +Check the initial value of a variable that has not been assigned; it should be null. Then assign a value to the variable and print it to verify its value. You can do all of this in a single CLI program: + + +``` +[student@studentvm1 ~]$ echo $MyVar ; MyVar="Hello World" ; echo $MyVar ; + +Hello World +[student@studentvm1 ~]$ +``` + +_Note: The syntax of variable assignment is very strict. There must be no spaces on either side of the equal (**=**) sign in the assignment statement._ + +The empty line indicates that the initial value of **MyVar** is null. Changing and setting the value of a variable are done the same way. This example shows both the original and the new value. + +As mentioned, Bash can perform integer arithmetic calculations, which is useful for calculating a reference to the location of an element in an array or doing simple math problems. It is not suitable for scientific computing or anything that requires decimals, such as financial calculations. There are much better tools for those types of calculations. + +Here's a simple calculation: + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1*Var2))" +Result = 63 +``` + +What happens when you perform a math operation that results in a floating-point number? + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1/Var2))" +Result = 0 +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var2/Var1))" +Result = 1 +[student@studentvm1 ~]$ +``` + +The result is the nearest integer. Notice that the calculation was performed as part of the **echo** statement. The math is performed before the enclosing echo command due to the Bash order of precedence. For details see the Bash man page and search "precedence." + +### Control operators + +Shell control operators are one of the syntactical operators for easily creating some interesting command-line programs. The simplest form of CLI program is just stringing several commands together in a sequence on the command line: + + +``` +`command1 ; command2 ; command3 ; command4 ; . . . ; etc. ;` +``` + +Those commands all run without a problem so long as no errors occur. But what happens when an error occurs? You can anticipate and allow for errors using the built-in **&&** and **||** Bash control operators. These two control operators provide some flow control and enable you to alter the sequence of code execution. The semicolon is also considered to be a Bash control operator, as is the newline character. + +The **&&** operator simply says, "if command1 is successful, then run command2. If command1 fails for any reason, then command2 is skipped." That syntax looks like this: + + +``` +`command1 && command2` +``` + +Now, look at some commands that will create a new directory and—if it's successful—make it the present working directory (PWD). Ensure that your home directory (**~**) is the PWD. Try this first in **/root**, a directory that you do not have access to: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ && cd $Dir +mkdir: cannot create directory '/root/testdir/': Permission denied +[student@studentvm1 ~]$ +``` + +The error was emitted by the **mkdir** command. You did not receive an error indicating that the file could not be created because the creation of the directory failed. The **&&** control operator sensed the non-zero return code, so the **touch** command was skipped. Using the **&&** control operator prevents the **touch** command from running because there was an error in creating the directory. This type of command-line program flow control can prevent errors from compounding and making a real mess of things. But it's time to get a little more complicated. + +The **||** control operator allows you to add another program statement that executes when the initial program statement returns a code greater than zero. The basic syntax looks like this: + + +``` +`command1 || command2` +``` + +This syntax reads, "If command1 fails, execute command2." That implies that if command1 succeeds, command2 is skipped. Try this by attempting to create a new directory: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +This is exactly what you would expect. Because the new directory could not be created, the first command failed, which resulted in the execution of the second command. + +Combining these two operators provides the best of both. The control operator syntax using some flow control takes this general form when the **&&** and **||** control operators are used: + + +``` +`preceding commands ; command1 && command2 || command3 ; following commands` +``` + +This syntax can be stated like so: "If command1 exits with a return code of 0, then execute command2, otherwise execute command3." Try it: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +Now try the last command again using your home directory instead of the **/root** directory. You will have permission to create this directory: + + +``` +[student@studentvm1 ~]$ Dir=~/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +[student@studentvm1 testdir]$ +``` + +The control operator syntax, like **command1 && command2**, works because every command sends a return code (RC) to the shell that indicates if it completed successfully or whether there was some type of failure during execution. By convention, an RC of zero (0) indicates success, and any positive number indicates some type of failure. Some of the tools sysadmins use just return a one (1) to indicate a failure, but many use other codes to indicate the type of failure that occurred. + +The Bash shell variable **$?** contains the RC from the last command. This RC can be checked very easily by a script, the next command in a list of commands, or even the sysadmin directly. Start by running a simple command and immediately checking the RC. The RC will always be for the last command that ran before you looked at it. + + +``` +[student@studentvm1 testdir]$ ll ; echo "RC = $?" +total 1264 +drwxrwxr-x  2 student student   4096 Mar  2 08:21 chapter25 +drwxrwxr-x  2 student student   4096 Mar 21 15:27 chapter26 +-rwxr-xr-x  1 student student     92 Mar 20 15:53 TestFile1 +<snip> +drwxrwxr-x. 2 student student 663552 Feb 21 14:12 testdir +drwxr-xr-x. 2 student student   4096 Dec 22 13:15 Videos +RC = 0 +[student@studentvm1 testdir]$ +``` + +The RC, in this case, is zero, which means the command completed successfully. Now try the same command on root's home directory, a directory you do not have permissions for: + + +``` +[student@studentvm1 testdir]$ ll /root ; echo "RC = $?" +ls: cannot open directory '/root': Permission denied +RC = 2 +[student@studentvm1 testdir]$ +``` + +In this case, the RC is two; this means permission was denied for a non-root user to access a directory to which the user is not permitted access. The control operators use these RCs to enable you to alter the sequence of program execution. + +### Summary + +This article looked at Bash as a programming language and explored its basic syntax as well as some basic tools. It showed how to print data to STDOUT and how to use variables and control operators. The next article in this series looks at some of the many Bash logical operators that control the flow of instruction execution. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-part-1 + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/18/10/linux-data-streams +[3]: http://www.both.org/?page_id=1183 +[4]: https://opensource.com/19/9/command-line-heroes-bash +[5]: https://en.wikipedia.org/wiki/Comparison_of_command_shells +[6]: http://foldoc.org/program +[7]: https://wordnet.princeton.edu/ +[8]: https://en.wikipedia.org/wiki/Computer_program +[9]: https://www.gnu.org/software/bc/manual/html_mono/bc.html diff --git a/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md b/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md new file mode 100644 index 0000000000..381ee4c9dd --- /dev/null +++ b/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md @@ -0,0 +1,261 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Beginner’s Guide to Handle Various Update Related Errors in Ubuntu) +[#]: via: (https://itsfoss.com/ubuntu-update-error/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Beginner’s Guide to Handle Various Update Related Errors in Ubuntu +====== + +_**Who hasn’t come across an error while doing an update in Ubuntu? Update errors are common and plenty in Ubuntu and other Linux distributions based on Ubuntu. Here are some common Ubuntu update errors and their fixes.**_ + +This article is part of Ubuntu beginner series that explains the know-how of Ubuntu so that a new user could understand the things better. + +In an earlier article, I discussed [how to update Ubuntu][1]. In this tutorial, I’ll discuss some common errors you may encounter while updating [Ubuntu][2]. It usually happens because you tried to add software or repositories on your own and that probably caused an issue. + +There is no need to panic if you see the errors while updating your system.The errors are common and the fix is easy. You’ll learn how to fix those common update errors. + +_**Before you begin, I highly advise reading these two articles to have a better understanding of the repository concept in Ubuntu.**_ + +![Understand Ubuntu repositories][3] + +![Understand Ubuntu repositories][3] + +###### **Understand Ubuntu repositories** + +Learn what are various repositories in Ubuntu and how they enable you to install software in your system. + +[Read More][4] + +![Understanding PPA in Ubuntu][5] + +![Understanding PPA in Ubuntu][5] + +###### **Understanding PPA in Ubuntu** + +Further improve your concept of repositories and package handling in Ubuntu with this detailed guide on PPA. + +[Read More][6] + +### Error 0: Failed to download repository information + +Many Ubuntu desktop users update their system through the graphical software updater tool. You are notified that updates are available for your system and you can click one button to start downloading and installing the updates. + +Well, that’s what usually happens. But sometimes you’ll see an error like this: + +![][7] + +_**Failed to download repository information. Check your internet connection.**_ + +That’s a weird error because your internet connection is most likely working just fine and it still says to check the internet connection. + +Did you note that I called it ‘error 0’? It’s because it’s not an error in itself. I mean, most probably, it has nothing to do with the internet connection. But there is no useful information other than this misleading error message. + +If you see this error message and your internet connection is working fine, it’s time to put on your detective hat and [use your grey cells][8] (as [Hercule Poirot][9] would say). + +You’ll have to use the command line here. You can [use Ctrl+Alt+T keyboard shortcut to open the terminal in Ubuntu][10]. In the terminal, use this command: + +``` +sudo apt update +``` + +Let the command finish. Observe the last three-four lines of its output. That will give you the real reason why sudo apt-get update fails. Here’s an example: + +![][11] + +Rest of the tutorial here shows how to handle the errors that you just saw in the last few lines of the update command output. + +### Error 1: Problem With MergeList + +When you run update in terminal, you may see an error “[problem with MergeList][12]” like below: + +``` +E:Encountered a section with no Package: header, +E:Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages, +E:The package lists or status file could not be parsed or opened.’ +``` + +For some reasons, the file in /var/lib/apt/lists directory got corrupted. You can delete all the files in this directory and run the update again to regenerate everything afresh. Use the following commands one by one: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt-get clean && sudo apt-get update +``` + +Your problem should be fixed. + +### Error 2: Hash Sum mismatch + +If you find an error that talks about [Hash Sum mismatch][13], the fix is the same as the one in the previous error. + +``` +W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch, +W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages Hash Sum mismatch, +E:Some index files failed to download. They have been ignored, or old ones used instead +``` + +The error occurs possibly because of a mismatched metadata cache between the server and your system. You can use the following commands to fix it: + +``` +sudo rm -rf /var/lib/apt/lists/* +sudo apt update +``` + +### Error 3: Failed to fetch with error 404 not found + +If you try adding a PPA repository that is not available for your current [Ubuntu version][14], you’ll see that it throws a 404 not found error. + +``` +W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found +E: Some index files failed to download. They have been ignored, or old ones used instead. +``` + +You added a PPA hoping to install an application but it is not available for your Ubuntu version and you are now stuck with the update error. This is why you should check beforehand if a PPA is available for your Ubuntu version or not. I have discussed how to check the PPA availability in the detailed [PPA guide][6]. + +Anyway, the fix here is that you remove the troublesome PPA from your list of repositories. Note the PPA name from the error message. Go to _Software & Updates_ tool: + +![Open Software & Updates][15] + +In here, move to _Other Software_ tab and look for that PPA. Uncheck the box to [remove the PPA][16] from your system. + +![Remove PPA Using Software & Updates In Ubuntu][17] + +Your software list will be updated when you do that. Now if you run the update again, you shouldn’t see the error. + +### Error 4: Failed to download package files error + +A similar error is **[failed to download package files error][18] **like this: + +![][19] + +In this case, a newer version of the software is available but it’s not propagated to all the mirrors. If you are not using a mirror, easily fixed by changing the software sources to Main server. Please read this article for more details on [failed to download package error][18]. + +Go to _Software & Updates_ and in there changed the download server to Main server: + +![][20] + +### Error 5: GPG error: The following signatures couldn’t be verified + +Adding a PPA may also result in the following [GPG error: The following signatures couldn’t be verified][21] when you try to run an update in terminal: + +``` +W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 68980A0EA10B4DE8 +``` + +All you need to do is to fetch this public key in the system. Get the key number from the message. In the above message, the key is 68980A0EA10B4DE8. + +This key can be used in the following manner: + +``` +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8 +``` + +Once the key has been added, run the update again and it should be fine. + +### Error 6: BADSIG error + +Another signature related Ubuntu update error is [BADSIG error][22] which looks something like this: + +``` +W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key +W: GPG error: http://ppa.launchpad.net precise Release: +The following signatures were invalid: BADSIG 4C1CBC1B69B0E2F4 Launchpad PPA for Jonathan French W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release +``` + +All the repositories are signed with the GPG and for some reason, your system finds them invalid. You’ll need to update the signature keys. The easiest way to do that is by regenerating the apt packages list (with their signature keys) and it should have the correct key. + +Use the following commands one by one in the terminal: + +``` +cd /var/lib/apt +sudo mv lists oldlist +sudo mkdir -p lists/partial +sudo apt-get clean +sudo apt-get update +``` + +### Error 7: Partial upgrade error + +Running updates in terminal may throw this partial upgrade error: + +![][23] + +``` +Not all updates can be installed +Run a partial upgrade, to install as many updates as possible +``` + +Run the following command in terminal to fix this error: + +``` +sudo apt-get install -f +``` + +### Error 8: Could not get lock /var/cache/apt/archives/lock + +This error happens when another program is using APT. Suppose you are installing some thing in Ubuntu Software Center and at the same time, trying to run apt in terminal. + +``` +E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable) +E: Unable to lock directory /var/cache/apt/archives/ +``` + +Check if some other program might be using apt. It could be a command running terminal, Software Center, Software Updater, Software & Updates or any other software that deals with installing and removing applications. + +If you can close other such programs, close them. If there is a process in progress, wait for it to finish. + +If you cannot find any such programs, use the following [command to kill all such running processes][24]: + +``` +sudo killall apt apt-get +``` + +This is a tricky problem and if the problem still persists, please read this detailed tutorial on [fixing the unable to lock the administration directory error in Ubuntu][25]. + +_**Any other update error you encountered?**_ + +That compiles the list of frequent Ubuntu update errors you may encounter. I hope this helps you to get rid of these errors. + +Have you encountered any other update error in Ubuntu recently that hasn’t been covered here? Do mention it in comments and I’ll try to do a quick tutorial on it. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-update-error/ + +作者:[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/update-ubuntu/ +[2]: https://ubuntu.com/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-repositories.png?ssl=1 +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?ssl=1 +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 +[8]: https://idioms.thefreedictionary.com/little+grey+cells +[9]: https://en.wikipedia.org/wiki/Hercule_Poirot +[10]: https://itsfoss.com/ubuntu-shortcuts/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/11/Ubuntu-Update-error.jpeg?ssl=1 +[12]: https://itsfoss.com/how-to-fix-problem-with-mergelist/ +[13]: https://itsfoss.com/solve-ubuntu-error-failed-to-download-repository-information-check-your-internet-connection/ +[14]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/05/software-updates-ubuntu-gnome.jpeg?ssl=1 +[16]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/remove_ppa_using_software_updates_in_ubuntu.jpg?ssl=1 +[18]: https://itsfoss.com/fix-failed-download-package-files-error-ubuntu/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/09/Ubuntu_Update_error.jpeg?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/09/Change_server_Ubuntu.jpeg?ssl=1 +[21]: https://itsfoss.com/solve-gpg-error-signatures-verified-ubuntu/ +[22]: https://itsfoss.com/solve-badsig-error-quick-tip/ +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/09/Partial_Upgrade_error_Elementary_OS_Luna.png?ssl=1 +[24]: https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/ +[25]: https://itsfoss.com/could-not-get-lock-error/ diff --git a/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md b/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md new file mode 100644 index 0000000000..6d236a3ab7 --- /dev/null +++ b/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How collaboration fueled a development breakthrough at Greenpeace) +[#]: via: (https://opensource.com/open-organization/19/10/collaboration-breakthrough-greenpeace) +[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger) + +How collaboration fueled a development breakthrough at Greenpeace +====== +We're building an innovative platform to connect environmental +advocates—but system complexity threatened to slow us down. Opening up +was the answer. +![The Open Organization at Greenpeace][1] + +Activists really don't like feeling stuck. + +We thrive on forward momentum and the energy it creates. When that movement grinds to a halt, even for a moment, our ability to catalyze passion in others stalls too. + +And my colleagues and I at Greenpeace International were feeling stuck. + +We'd managed to launch a prototype of Planet 4, [Greenpeace's new, open engagement platform][2] for activists and communities. It's live in more than 38 countries (with many more sites). More than 1.75 million people are using it. We've topped more than 3.1 million pageviews. + +To get here, we [spent more than 650 hours in meetings, drank 1,478 litres of coffee, and fixed more than 300 bugs][3]. But it fell short of our vision; it _still_ wasn't [the minimum lovable product][4] we wanted and we didn't know how to move it forward. + +We were stuck. + +Planet 4's complexity was daunting. We didn't always have the right people to address the numerous challenges the project raised. We didn't know if we'd ever realize our vision. Yet a commitment to openness had gotten us here, and I knew a commitment to openness would get us through this, too. + +As [the story of Planet 4][5] continues, I'll explain how it did. + +### An opportunity + +By 2016, my work helping Greenpeace International become a more open organization—[which I described in the first part of this series][6]—was beginning to bear fruit. We were holding regular [community calls][7]. We were releasing project updates frequently and publicly. We were networking with global stakeholders across the organization to define what Planet 4 needed to be. We were [architecting the project with participation in mind][8]. + +Becoming open is an organic process. There's no standard "game plan" for implementing process and practices in an organization. Success depends on the people, the tools, the project, the very fabric of the culture you're working inside. + +Inside Greenpeace, we were beginning to see that success. + +A commitment to openness had gotten us here, and I knew a commitment to openness would get us through this, too. + +For some, this open way of working was inspiring and engaging. For others it was terrifying. Some thought asking for everyone's input was ridiculous. Some thought only "experts" should be part of the conversations, a viewpoint that doesn't mesh well with [the principle of inclusivity][9]. I appreciate expertise—don't get me wrong—but the problem with only asking for "expert" opinions is that you exclude people who might have more interest, passion, and knowledge than someone with a formal title. + +Planet 4 was a vision—not just of a new and open engagement platform, but of an organization that could make _use_ of this platform. And it raised problems on both those fronts: + + * **Data and systems integration:** As a network of 28 independent offices all over the world, Greenpeace has a complex technical landscape. While Greenpeace International provides system _recommendations_ and _support_, individual National and Regional Offices are free to make their own systems choices, even if they aren't the supported ones. This is a good thing; different tools better address different needs for different offices. But it's challenging, too, because the absence of standardization means a lack of expertise in all those systems. + * **Organizational culture and work styles:** Planet 4 devoured many of Greenpeace's internal strategies and visions, then spit them out into a way that promised to move toward the type of organization we wanted to be. It was challenging the organizational status quo. + + + +Our team was too small, our work too big, and the landscape of working in a global non-profit too complex. The team was struggling, and we needed help. + +Then, in 2018, I saw an opportunity. + +As an [Open Organization Ambassador][10], I'd been to Red Hat Summit to speak on a panel about open organizational principles. There I noticed a session exploring what [Red Hat had done to help UNICEF][11], another global non-profit, with its digital transformation efforts. Surely, I thought, Red Hat and Greenpeace could work together, too. + +So I did something that shouldn't seem so revolutionary or audacious: I found the Red Hatter responsible for the company's collaboration with UNICEF, Alexandra Machado, and I _said hello_. I wasn't just introducing myself; I was approaching Alexandra on behalf of a global community of open-minded advocates. + +And it worked. + +### Accelerating + +Together, Alexandra and I spent more than a year coordinating a collaboration that could help Greenpeace move forward. Earlier this year, we started to succeed. + +Planet 4 was a vision—not just of a new and open engagement platform, but of an organization that could make use of this platform. And it raised problems on both those fronts. + +In late May, members of the Planet 4 project and a team from Red Hat's App Dev Center of Excellence met in Amsterdam. The goal: Accelerate us. + +We'd spend an entire week together in a design sprint aimed at helping us chart a speedy path toward making our vision for the Planet 4 engagement platform a reality, beginning with navigating its technical complexity. And in the process, we'd lean heavily on the open way of working we'd learned to embrace. + +At the sprint, our teams got to know each other. We dumped everything on the table. In a radically open and honest way, the Greenpeace team helped the Red Hat team from Waterford understand the technical and cultural hurdles we faced. We explained our organization and our tech stack, our vision and our dreams. Red Hatters noticed our passion and worked alongside us to explore possible technologies that could make our vision a reality. + +Through a series of exercises—including a particularly helpful session of [event storming][12]—we confirmed that our dream was not only the right one to have but also fully realizable. We talked through the dynamics of the systems we are addressing, and, in the end, the Red Hat team helped us envision a prototype for integrated systems that the Greenpeace team could take forward. We've already begun user testing. + +_Listen to Patrick Carney of Red Hat Open Innovation Labs explain event storming._ + +On top of that, our new allies wrote a technical report that laid out the complexities we could _see_ but not _address_—and in a way that spurred internal conversations forward. We found ourselves, a few weeks after the event, moving forward at speed. + +Finally, we were unstuck. + +In the final chapter of Planet 4's story, I'll explain what the experience taught us about the power of openness. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/collaboration-breakthrough-greenpeace + +作者:[Laura Hilliger][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/laurahilliger +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/images/open-org/open-org-greenpeace-article-2-blog-thumbnail-520x292.png?itok=YNEKRAxS (The Open Organization at Greenpeace) +[2]: http://greenpeace.org/international +[3]: https://medium.com/planet4/p4-in-2018-3bec1cc12be8 +[4]: https://medium.com/planet4/past-the-prototype-d3e0a4d3a171 +[5]: https://opensource.com/tags/open-organization-greenpeace +[6]: https://opensource.com/open-organization/19/10/open-platform-greenpeace-1 +[7]: https://opensource.com/open-organization/16/1/community-calls-will-increase-participation-your-open-organization +[8]: https://opensource.com/open-organization/16/8/best-results-design-participation +[9]: https://opensource.com/open-organization/resources/open-org-definition +[10]: https://opensource.com/open-organization/resources/meet-ambassadors +[11]: https://www.redhat.com/en/proof-of-concept-series +[12]: https://openpracticelibrary.com/practice/event-storming/ diff --git a/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md new file mode 100644 index 0000000000..9e99bcdb7c --- /dev/null +++ b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Go About Linux Boot Time Optimisation) +[#]: via: (https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/) +[#]: author: (B Thangaraju https://opensourceforu.com/author/b-thangaraju/) + +How to Go About Linux Boot Time Optimisation +====== + +[![][1]][2] + +_Booting an embedded device or a piece of telecommunication equipment quickly is crucial for time-critical applications and also plays a very major role in improving the user experience. This article gives some important tips on how to enhance the boot-up time of any device._ + +Fast booting or fast rebooting plays a crucial role in various situations. It is critical for an embedded system to boot up fast in order to maintain the high availability and better performance of all the services. Imagine a telecommunications device running a Linux operating system that does not have fast booting enabled. All the systems, services and the users dependent on that particular embedded device might be affected. It is really important that devices maintain high availability in their services, for which fast booting and rebooting play a crucial role. + +A small failure or shutdown of a telecom device, even for a few seconds, can play havoc with countless users working on the Internet. Thus, it is really important for a lot of time-dependent devices and telecommunication devices to incorporate fast booting in their devices to help them get back to work quicker. Let us understand the Linux boot-up procedure from Figure 1. + +![Figure 1: Boot-up procedure][3] + +![Figure 2: Boot chart][4] + +**Monitoring tools and the boot-up procedure** +A user should take note of a number of factors before making changes to a machine. These include the current booting speed of the machine and also the services, processes or applications that are taking up resources and increasing the boot-up time. + +**Boot chart:** To monitor the boot-up speed and the various services that start while booting up, the user can install the boot chart using the following command: + +``` +sudo apt-get install pybootchartgui. +``` + +Each time you boot up, the boot chart saves a _.png_ (portable network graphics) file in the log, which enables the user to view the _png_ files to get an understanding about the system’s boot-up process and services. Use the following command for this purpose: + +``` +cd /var/log/bootchart +``` + +The user might need an application to view the _.png_ files. Feh is an X11 image viewer that targets console users. It doesn’t have a fancy GUI, unlike most other image viewers, but it simply displays pictures. Feh can be used to view the _.png_ files. You can install it using the following command: + +``` +sudo apt-get install feh +``` + +You can view the _png_ files using _feh xxxx.png_. +Figure 2 shows the boot chart when a boot chart _png_ file is viewed. +However, a boot chart is not necessary for Ubuntu versions later than 15.10. To get very brief information regarding boot up speed, use the following command: + +``` +systemd-analyze +``` + +![Figure 3: Output of systemd-analyze][5] + +Figure 3 shows the output of the command _systemd-analyze_. +The command _systemd-analyze_ blame is used to print a list of all running units based on the time they took to initialise. This information is very helpful and can be used to optimise boot-up times. systemd-analyze blame doesn’t display results for services with _Type=simple_, because systemd considers such services to be started immediately; hence, no measurement of the initialisation delays can be done. + +![Figure 4: Output of systemd-analyze blame][6] + +Figure 4 shows the output of _systemd-analyze_ blame. +The following command prints a tree of the time-critical chain of units: + +``` +command systemd-analyze critical-chain +``` + +Figure 5 shows the output of the command _systemd-analyze critical-chain_. + +![Figure 5: Output of systemd-analyze critical-chain][7] + +**Steps to reduce the boot-up time** +Shown below are the various steps that can be taken to reduce boot-up time. + +**BUM (Boot-Up-Manager):** BUM is a run level configuration editor that allows the configuration of _init_ services when the system boots up or reboots. It displays a list of every service that can be started at boot. The user can toggle individual services on and off. BUM has a very clean GUI and is very easy to use. + +BUM can be installed in Ubuntu 14.04 using the following command: + +``` +sudo apt-get install bum +``` + +To install it in versions later than 15.10, download the packages from the link _ 13_. + +Start with basic things and disable services related to the scanner and printer. You can also disable Bluetooth and all other unwanted devices and services if you are not using any of them. I strongly recommend that you study the basics about the services before disabling them, as it might affect the machine or operating system. Figure 6 shows the GUI of BUM. + +![Figure 6: BUM][8] + +**Editing the rc file:** To edit the rc file, you need to go to the rc directory. This can be done using the following command: + +``` +cd /etc/init.d. +``` + +However, root privileges are needed to access _init.d_, which basically contains start/stop scripts that are used to control (start, stop, reload, restart) the daemon while the system is running or during boot. + +The _rc_ file in _init.d_ is called a run control script. During booting, init executes the _rc_ script and plays its role. To improve the booting speed, we make changes to the _rc_ file. Open the _rc_ file (once you are in the _init.d_ directory) using any file editor. + +For example, by entering _vim rc_, you can change the value of _CONCURRENCY=none_ to _CONCURRENCY=shell_. The latter allows certain startup scripts to be executed simultaneously, rather than serially. + +In the latest versions of the kernel, the value should be changed to _CONCURRENCY=makefile_. +Figures 7 and 8 show the comparison of boot-up times before and after editing the rc file. The improvement in the boot-up speed can be noticed. The time to boot before editing the rc file was 50.98 seconds, whereas the time to boot after making the changes to the rc file is 23.85 seconds. +However, the above-mentioned changes don’t work on operating systems later than the Ubuntu version 15.10, since the operating systems with the latest kernel use the systemd file and not the _init.d_ file any more. + +![Figure 7: Boot speed before making changes to the rc file][9] + +![Figure 8: Boot speed after making changes to the rc file][10] + +**E4rat:** E4rat stands for e4 ‘reduced access time’ (ext4 file system only). It is a project developed by Andreas Rid and Gundolf Kiefer. E4rat is an application that helps in achieving a fast boot with the help of defragmentation. It also accelerates application startups. E4rat eliminates both seek times and rotational delays using physical file reallocation. This leads to a high disk transfer rate. +E4rat is available as a .deb package and you can download it from its official website __. + +Ubuntu’s default ureadahead package conflicts with e4rat. So a few packages have to be installed using the following command: + +``` +sudo dpkg purge ureadahead ubuntu-minimal +``` + +Now install the dependencies for e4rat using the following command: + +``` +sudo apt-get install libblkid1 e2fslibs +``` + +Open the downloaded _.deb_ file and install it. Boot data is now needed to be gathered properly to work with e4rat. + +Follow the steps given below to get e4rat running properly and to increase the boot-up speed. + + * Access the Grub menu while booting. This can be done by holding the shift button when the system is booting. + * Choose the option (kernel version) that is normally used to boot and press ‘e’. + * Look for the line starting with _linux /boot/vmlinuz_ and add the following code at the end of the line (hit space after the last letter of the sentence): + + + +``` +- init=/sbin/e4rat-collect or try - quiet splash vt.handsoff =7 init=/sbin/e4rat-collect +``` + + * Now press _Ctrl+x_ to continue booting. This lets e4rat collect data after booting. Work on the machine, open and close applications for the next two minutes. + * Access the log file by going to the e4rat folder and using the following command: + + + +``` +cd /var/log/e4rat +``` + + * If you do not find any log file, repeat the above mentioned process. Once the log file is there, access the Grub menu again and press ‘e’ as your option. + * Enter ‘single’ at the end of the same line that you have edited before. This will help you access the command line. If a different menu appears asking for anything, choose Resume normal boot. If you don’t get to the command prompt for some reason, hit Ctrl+Alt+F1. + * Enter your details once you see the login prompt. + * Now enter the following command: + + + +``` +sudo e4rat-realloc /var/lib/e4rat/startup.log +``` + +This process takes a while, depending on the machine’s disk speed. + + * Now restart your machine using the following command: + + + +``` +sudo shutdown -r now +``` + + * Now, we need to configure Grub to run e4rat at every boot. + * Access the grub file using any editor. For example, _gksu gedit /etc/default/grub._ + * Look for a line starting with _GRUB CMDLINE LINUX DEFAULT=_, and add the following line in between the quotes and before whatever options there are: + + + +``` +init=/sbin/e4rat-preload 18 +``` + + * It should look like this: + + + +``` +GRUB CMDLINE LINUX DEFAULT = init=/sbin/e4rat- preload quiet splash +``` + + * Save and close the Grub menu and update Grub using _sudo update-grub_. + * Reboot the system and you will find noticeable changes in boot speed. + + + +Figures 9 and 10 show the differences between the boot-up time before and after installing e4rat. The improvement in the boot-up speed can be noticed. The time taken to boot before using e4rat was 22.32 seconds, whereas the time taken to boot after using e4rat is 9.065 seconds + +![Figure 9: Boot speed before using e4rat][11] + +![Figure 10: Boot speed after using e4rat][12] + +**A few simple tweaks** +A good boot-up speed can also be achieved using very small tweaks, two of which are listed below. +**SSD:** Using solid-state devices rather than normal hard disks or other storage devices will surely improve your booting speed. SSDs also help in achieving great speeds in transferring files and running applications. + +**Disabling GUI:** The graphical user interface, desktop graphics and window animations take up a lot of resources. Disabling the GUI is another good way to achieve great boot-up speed. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/ + +作者:[B Thangaraju][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://opensourceforu.com/author/b-thangaraju/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?resize=696%2C496&ssl=1 (Screenshot from 2019-10-07 13-16-32) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?fit=700%2C499&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-1.png?resize=350%2C302&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-2.png?resize=350%2C412&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-3.png?resize=350%2C69&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-4.png?resize=350%2C535&ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-5.png?resize=350%2C206&ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-6.png?resize=350%2C449&ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-7.png?resize=350%2C85&ssl=1 +[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-8.png?resize=350%2C72&ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-9.png?resize=350%2C61&ssl=1 +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-10.png?resize=350%2C61&ssl=1 diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md new file mode 100644 index 0000000000..024af38122 --- /dev/null +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -0,0 +1,498 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Logical operators and shell expansions) +[#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Logical operators and shell expansions +====== +Learn about logical operators and shell expansions, in the second +article in this three-part series on programming with Bash. +![Women in computing and open source v5][1] + +Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. This three-part series (which is based on my [three-volume Linux self-study course][2]) explores using Bash as a programming language on the command-line interface (CLI). + +The [first article][3] explored some simple command-line programming with Bash, including using variables and control operators. This second article looks into the types of file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and different types of shell expansions in Bash. The third and final article in the series will explore the **for**, **while**, and **until** loops that enable repetitive operations. + +Logical operators are the basis for making decisions in a program and executing different sets of instructions based on those decisions. This is sometimes called flow control. + +### Logical operators + +Bash has a large set of logical operators that can be used in conditional expressions. The most basic form of the **if** control structure tests for a condition and then executes a list of program statements if the condition is true. There are three types of operators: file, numeric, and non-numeric operators. Each operator returns true (0) if the condition is met and false (1) if the condition is not met. + +The functional syntax of these comparison operators is one or two arguments with an operator that are placed within square braces, followed by a list of program statements that are executed if the condition is true, and an optional list of program statements if the condition is false: + + +``` +if [ arg1 operator arg2 ] ; then list +or +if [ arg1 operator arg2 ] ; then list ; else list ; fi +``` + +The spaces in the comparison are required as shown. The single square braces, **[** and **]**, are the traditional Bash symbols that are equivalent to the **test** command: + + +``` +`if test arg1 operator arg2 ; then list` +``` + +There is also a more recent syntax that offers a few advantages and that some sysadmins prefer. This format is a bit less compatible with different versions of Bash and other shells, such as ksh (the Korn shell). It looks like: + + +``` +`if [[ arg1 operator arg2 ]] ; then list` +``` + +#### File operators + +File operators are a powerful set of logical operators within Bash. Figure 1 lists more than 20 different operators that Bash can perform on files. I use them quite frequently in my scripts. + +Operator | Description +---|--- +-a filename | True if the file exists; it can be empty or have some content but, so long as it exists, this will be true +-b filename | True if the file exists and is a block special file such as a hard drive like **/dev/sda** or **/dev/sda1** +-c filename | True if the file exists and is a character special file such as a TTY device like **/dev/TTY1** +-d filename | True if the file exists and is a directory +-e filename | True if the file exists; this is the same as **-a** above +-f filename | True if the file exists and is a regular file, as opposed to a directory, a device special file, or a link, among others +-g filename | True if the file exists and is **set-group-id**, **SETGID** +-h filename | True if the file exists and is a symbolic link +-k filename | True if the file exists and its "sticky'" bit is set +-p filename | True if the file exists and is a named pipe (FIFO) +-r filename | True if the file exists and is readable, i.e., has its read bit set +-s filename | True if the file exists and has a size greater than zero; a file that exists but that has a size of zero will return false +-t fd | True if the file descriptor **fd** is open and refers to a terminal +-u filename | True if the file exists and its **set-user-id** bit is set +-w filename | True if the file exists and is writable +-x filename | True if the file exists and is executable +-G filename | True if the file exists and is owned by the effective group ID +-L filename | True if the file exists and is a symbolic link +-N filename | True if the file exists and has been modified since it was last read +-O filename | True if the file exists and is owned by the effective user ID +-S filename | True if the file exists and is a socket +file1 -ef file2 | True if file1 and file2 refer to the same device and iNode numbers +file1 -nt file2 | True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not +file1 -ot file2 | True if file1 is older than file2, or if file2 exists and file1 does not + +_**Fig. 1: The Bash file operators**_ + +As an example, start by testing for the existence of a file: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi +The file TestFile1 does not exist. +[student@studentvm1 testdir]$ +``` + +Next, create a file for testing named **TestFile1**. For now, it does not need to contain any data: + + +``` +`[student@studentvm1 testdir]$ touch TestFile1` +``` + +It is easy to change the value of the **$File** variable rather than a text string for the file name in multiple locations in this short CLI program: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi +The file TestFile1 exists. +[student@studentvm1 testdir]$ +``` + +Now, run a test to determine whether a file exists and has a non-zero length, which means it contains data. You want to test for three conditions: 1. the file does not exist; 2. the file exists and is empty; and 3. the file exists and contains data. Therefore, you need a more complex set of tests—use the **elif** stanza in the **if-elif-else** construct to test for all of the conditions: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi +[student@studentvm1 testdir]$ +``` + +In this case, the file exists but does not contain any data. Add some data and try again: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi +TestFile1 exists and contains data. +[student@studentvm1 testdir]$ +``` + +That works, but it is only truly accurate for one specific condition out of the three possible ones. Add an **else** stanza so you can be somewhat more accurate, and delete the file so you can fully test this new code: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; rm $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 does not exist or is empty. +``` + +Now create an empty file to test: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 does not exist or is empty. +``` + +Add some content to the file and test again: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 exists and contains data. +``` + +Now, add the **elif** stanza to discriminate between a file that does not exist and one that is empty: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi +TestFile1 exists and is empty. +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi +TestFile1 exists and contains data. +[student@studentvm1 testdir]$ +``` + +Now you have a Bash CLI program that can test for these three different conditions… but the possibilities are endless. + +It is easier to see the logic structure of the more complex compound commands if you arrange the program statements more like you would in a script that you can save in a file. Figure 2 shows how this would look. The indents of the program statements in each stanza of the **if-elif-else** structure help to clarify the logic. + + +``` +File="TestFile1" +echo "This is $File" > $File +if [ -s $File ] +   then +   echo "$File exists and contains data." +elif [ -e $File ] +   then +   echo "$File exists and is empty." +else +   echo "$File does not exist." +fi +``` + +_**Fig. 2: The command line program rewritten as it would appear in a script**_ + +Logic this complex is too lengthy for most CLI programs. Although any Linux or Bash built-in commands may be used in CLI programs, as the CLI programs get longer and more complex, it makes more sense to create a script that is stored in a file and can be executed at any time, now or in the future. + +#### String comparison operators + +String comparison operators enable the comparison of alphanumeric strings of characters. There are only a few of these operators, which are listed in Figure 3. + +Operator | Description +---|--- +-z string | True if the length of string is zero +-n string | True if the length of string is non-zero +string1 == string2 +or +string1 = string2 | True if the strings are equal; a single **=** should be used with the test command for POSIX conformance. When used with the **[[** command, this performs pattern matching as described above (compound commands). +string1 != string2 | True if the strings are not equal +string1 < string2 | True if string1 sorts before string2 lexicographically (refers to locale-specific sorting sequences for all alphanumeric and special characters) +string1 > string2 | True if string1 sorts after string2 lexicographically + +_**Fig. 3: Bash string logical operators**_ + +First, look at string length. The quotes around **$MyVar** in the comparison must be there for the comparison to work. (You should still be working in **~/testdir**.) + + +``` +[student@studentvm1 testdir]$ MyVar="" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +MyVar is zero length. +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +MyVar is zero length. +``` + +You could also do it this way: + + +``` +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -n "$MyVar" ] ; then echo "MyVar contains data." ; else echo "MyVar is zero length" ; fi +MyVar contains data. +[student@studentvm1 testdir]$ MyVar="" ; if [ -n "$MyVar" ] ; then echo "MyVar contains data." ; else echo "MyVar is zero length" ; fi +MyVar is zero length +``` + +Sometimes you may need to know a string's exact length. This is not a comparison, but it is related. Unfortunately, there is no simple way to determine the length of a string. There are a couple of ways to do it, but I think using the **expr** (evaluate expression) command is easiest. Read the man page for **expr** for more about what it can do. Note that quotes are required around the string or variable you're testing. + + +``` +[student@studentvm1 testdir]$ MyVar="" ; expr length "$MyVar" +0 +[student@studentvm1 testdir]$ MyVar="How long is this?" ; expr length "$MyVar" +17 +[student@studentvm1 testdir]$ expr length "We can also find the length of a literal string as well as a variable." +70 +``` + +Regarding comparison operators, I use a lot of testing in my scripts to determine whether two strings are equal (i.e., identical). I use the non-POSIX version of this comparison operator: + + +``` +[student@studentvm1 testdir]$ Var1="Hello World" ; Var2="Hello World" ; if [ "$Var1" == "$Var2" ] ; then echo "Var1 matches Var2" ; else echo "Var1 and Var2 do not match." ; fi +Var1 matches Var2 +[student@studentvm1 testdir]$ Var1="Hello World" ; Var2="Hello world" ; if [ "$Var1" == "$Var2" ] ; then echo "Var1 matches Var2" ; else echo "Var1 and Var2 do not match." ; fi +Var1 and Var2 do not match. +``` + +Experiment some more on your own to try out these operators. + +#### Numeric comparison operators + +Numeric operators make comparisons between two numeric arguments. Like the other operator classes, most are easy to understand. + +Operator | Description +---|--- +arg1 -eq arg2 | True if arg1 equals arg2 +arg1 -ne arg2 | True if arg1 is not equal to arg2 +arg1 -lt arg2 | True if arg1 is less than arg2 +arg1 -le arg2 | True if arg1 is less than or equal to arg2 +arg1 -gt arg2 | True if arg1 is greater than arg2 +arg1 -ge arg2 | True if arg1 is greater than or equal to arg2 + +_**Fig. 4: Bash numeric comparison logical operators**_ + +Here are some simple examples. The first instance sets the variable **$X** to 1, then tests to see if **$X** is equal to 1. In the second instance, **X** is set to 0, so the comparison is not true. + + +``` +[student@studentvm1 testdir]$ X=1 ; if [ $X -eq 1 ] ; then echo "X equals 1" ; else echo "X does not equal 1" ; fi +X equals 1 +[student@studentvm1 testdir]$ X=0 ; if [ $X -eq 1 ] ; then echo "X equals 1" ; else echo "X does not equal 1" ; fi +X does not equal 1 +[student@studentvm1 testdir]$ +``` + +Try some more experiments on your own. + +#### Miscellaneous operators + +These miscellaneous operators show whether a shell option is set or a shell variable has a value, but it does not discover the value of the variable, just whether it has one. + +Operator | Description +---|--- +-o optname | True if the shell option optname is enabled (see the list of options under the description of the **-o** option to the Bash set builtin in the Bash man page) +-v varname | True if the shell variable varname is set (has been assigned a value) +-R varname | True if the shell variable varname is set and is a name reference + +_**Fig. 5: Miscellaneous Bash logical operators**_ + +Experiment on your own to try out these operators. + +### Expansions + +Bash supports a number of types of expansions and substitutions that can be quite useful. According to the Bash man page, Bash has seven forms of expansions. This article looks at five of them: tilde expansion, arithmetic expansion, pathname expansion, brace expansion, and command substitution. + +#### Brace expansion + +Brace expansion is a method for generating arbitrary strings. (This tool is used below to create a large number of files for experiments with special pattern characters.) Brace expansion can be used to generate lists of arbitrary strings and insert them into a specific location within an enclosing static string or at either end of a static string. This may be hard to visualize, so it's best to just do it. + +First, here's what a brace expansion does: + + +``` +[student@studentvm1 testdir]$ echo {string1,string2,string3} +string1 string2 string3 +``` + +Well, that is not very helpful, is it? But look what happens when you use it just a bit differently: + + +``` +[student@studentvm1 testdir]$ echo "Hello "{David,Jen,Rikki,Jason}. +Hello David. Hello Jen. Hello Rikki. Hello Jason. +``` + +That looks like something useful—it could save a good deal of typing. Now try this: + + +``` +[student@studentvm1 testdir]$ echo b{ed,olt,ar}s +beds bolts bars +``` + +I could go on, but you get the idea. + +#### Tilde expansion + +Arguably, the most common expansion is the tilde (**~**) expansion. When you use this in a command like **cd ~/Documents**, the Bash shell expands it as a shortcut to the user's full home directory. + +Use these Bash programs to observe the effects of the tilde expansion: + + +``` +[student@studentvm1 testdir]$ echo ~ +/home/student +[student@studentvm1 testdir]$ echo ~/Documents +/home/student/Documents +[student@studentvm1 testdir]$ Var1=~/Documents ; echo $Var1 ; cd $Var1 +/home/student/Documents +[student@studentvm1 Documents]$ +``` + +#### Pathname expansion + +Pathname expansion is a fancy term expanding file-globbing patterns, using the characters **?** and *****, into the full names of directories that match the pattern. File globbing refers to special pattern characters that enable significant flexibility in matching file names, directories, and other strings when performing various actions. These special pattern characters allow matching single, multiple, or specific characters in a string. + + * **?** — Matches only one of any character in the specified location within the string + * ***** — Matches zero or more of any character in the specified location within the string + + + +This expansion is applied to matching directory names. To see how this works, ensure that **testdir** is the present working directory (PWD) and start with a plain listing (the contents of my home directory will be different from yours): + + +``` +[student@studentvm1 testdir]$ ls +chapter6  cpuHog.dos    dmesg1.txt  Documents  Music       softlink1  testdir6    Videos +chapter7  cpuHog.Linux  dmesg2.txt  Downloads  Pictures    Templates  testdir +testdir  cpuHog.mac    dmesg3.txt  file005    Public      testdir    tmp +cpuHog     Desktop       dmesg.txt   link3      random.txt  testdir1   umask.test +[student@studentvm1 testdir]$ +``` + +Now list the directories that start with **Do**, **testdir/Documents**, and **testdir/Downloads**: + + +``` +Documents: +Directory01  file07  file15        test02  test10  test20      testfile13  TextFiles +Directory02  file08  file16        test03  test11  testfile01  testfile14 +file01       file09  file17        test04  test12  testfile04  testfile15 +file02       file10  file18        test05  test13  testfile05  testfile16 +file03       file11  file19        test06  test14  testfile09  testfile17 +file04       file12  file20        test07  test15  testfile10  testfile18 +file05       file13  Student1.txt  test08  test16  testfile11  testfile19 +file06       file14  test01        test09  test18  testfile12  testfile20 + +Downloads: +[student@studentvm1 testdir]$ +``` + +Well, that did not do what you wanted. It listed the contents of the directories that begin with **Do**. To list only the directories and not their contents, use the **-d** option. + + +``` +[student@studentvm1 testdir]$ ls -d Do* +Documents  Downloads +[student@studentvm1 testdir]$ +``` + +In both cases, the Bash shell expands the **Do*** pattern into the names of the two directories that match the pattern. But what if there are also files that match the pattern? + + +``` +[student@studentvm1 testdir]$ touch Downtown ; ls -d Do* +Documents  Downloads  Downtown +[student@studentvm1 testdir]$ +``` + +This shows the file, too. So any files that match the pattern are also expanded to their full names. + +#### Command substitution + +Command substitution is a form of expansion that allows the STDOUT data stream of one command to be used as the argument of another command; for example, as a list of items to be processed in a loop. The Bash man page says: "Command substitution allows the output of a command to replace the command name." I find that to be accurate if a bit obtuse. + +There are two forms of this substitution, **`command`** and **$(command)**. In the older form using back tics (**`**), using a backslash (**\**) in the command retains its literal meaning. However, when it's used in the newer parenthetical form, the backslash takes on its meaning as a special character. Note also that the parenthetical form uses only single parentheses to open and close the command statement. + +I frequently use this capability in command-line programs and scripts where the results of one command can be used as an argument for another command. + +Start with a very simple example that uses both forms of this expansion (again, ensure that **testdir** is the PWD): + + +``` +[student@studentvm1 testdir]$ echo "Todays date is `date`" +Todays date is Sun Apr  7 14:42:46 EDT 2019 +[student@studentvm1 testdir]$ echo "Todays date is $(date)" +Todays date is Sun Apr  7 14:42:59 EDT 2019 +[student@studentvm1 testdir]$ +``` + +The **-w** option to the **seq** utility adds leading zeros to the numbers generated so that they are all the same width, i.e., the same number of digits regardless of the value. This makes it easier to sort them in numeric sequence. + +The **seq** utility is used to generate a sequence of numbers: + + +``` +[student@studentvm1 testdir]$ seq 5 +1 +2 +3 +4 +5 +[student@studentvm1 testdir]$ echo `seq 5` +1 2 3 4 5 +[student@studentvm1 testdir]$ +``` + +Now you can do something a bit more useful, like creating a large number of empty files for testing: + + +``` +`[student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done` +``` + +In this usage, the statement **seq -w 5000** generates a list of numbers from one to 5,000. By using command substitution as part of the **for** statement, the list of numbers is used by the **for** statement to generate the numerical part of the file names. + +#### Arithmetic expansion + +Bash can perform integer math, but it is rather cumbersome (as you will soon see). The syntax for arithmetic expansion is **$((arithmetic-expression))**, using double parentheses to open and close the expression. + +Arithmetic expansion works like command substitution in a shell program or script; the value calculated from the expression replaces the expression for further evaluation by the shell. + +Once again, start with something simple: + + +``` +[student@studentvm1 testdir]$ echo $((1+1)) +2 +[student@studentvm1 testdir]$ Var1=5 ; Var2=7 ; Var3=$((Var1*Var2)) ; echo "Var 3 = $Var3" +Var 3 = 35 +``` + +The following division results in zero because the result would be a decimal value of less than one: + + +``` +[student@studentvm1 testdir]$ Var1=5 ; Var2=7 ; Var3=$((Var1/Var2)) ; echo "Var 3 = $Var3" +Var 3 = 0 +``` + +Here is a simple calculation I often do in a script or CLI program that tells me how much total virtual memory I have in a Linux host. The **free** command does not provide that data: + + +``` +[student@studentvm1 testdir]$ RAM=`free | grep ^Mem | awk '{print $2}'` ; Swap=`free | grep ^Swap | awk '{print $2}'` ; echo "RAM = $RAM and Swap = $Swap" ; echo "Total Virtual memory is $((RAM+Swap))" ; +RAM = 4037080 and Swap = 6291452 +Total Virtual memory is 10328532 +``` + +I used the **`** character to delimit the sections of code used for command substitution. + +I use Bash arithmetic expansion mostly for checking system resource amounts in a script and then choose a program execution path based on the result. + +### Summary + +This article, the second in this series on Bash as a programming language, explored the Bash file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and the different types of shell expansions. + +The third article in this series will explore the use of loops for performing various types of iterative operations. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) +[2]: http://www.both.org/?page_id=1183 +[3]: https://opensource.com/article/19/10/programming-bash-part-1 diff --git a/sources/tech/20191022 Initializing arrays in Java.md b/sources/tech/20191022 Initializing arrays in Java.md new file mode 100644 index 0000000000..7971ec104b --- /dev/null +++ b/sources/tech/20191022 Initializing arrays in Java.md @@ -0,0 +1,389 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Initializing arrays in Java) +[#]: via: (https://opensource.com/article/19/10/initializing-arrays-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Initializing arrays in Java +====== +Arrays are a helpful data type for managing collections elements best +modeled in contiguous memory locations. Here's how to use them +effectively. +![Coffee beans and a cup of coffee][1] + +People who have experience programming in languages like C or FORTRAN are familiar with the concept of arrays. They’re basically a contiguous block of memory where each location is a certain type: integers, floating-point numbers, or what-have-you. + +The situation in Java is similar, but with a few extra wrinkles. + +### An example array + +Let’s make an array of 10 integers in Java: + + +``` +int[] ia = new int[10]; +``` + +What’s going on in the above piece of code? From left to right: + + 1. The **int[]** to the extreme left declares the _type_ of the variable as an array (denoted by the **[]**) of **int**. + + 2. To the right is the _name_ of the variable, which in this case is **ia**. + + 3. Next, the **=** tells us that the variable defined on the left side is set to what’s to the right side. + + 4. To the right of the **=** we see the word **new**, which in Java indicates that an object is being _initialized_, meaning that storage is allocated and its constructor is called ([see here for more information][2]). + + 5. Next, we see **int[10]**, which tells us that the specific object being initialized is an array of 10 integers. + + + + +Since Java is strongly-typed, the type of the variable **ia** must be compatible with the type of the expression on the right-hand side of the **=**. + +### Initializing the example array + +Let’s put this simple array in a piece of code and try it out. Save the following in a file called **Test1.java**, use **javac** to compile it, and use **java** to run it (in the terminal of course): + + +``` +import java.lang.*; + +public class Test1 { + +    public static void main([String][3][] args) { +        int[] ia = new int[10];                              // See note 1 below +        [System][4].out.println("ia is " + ia.getClass());        // See note 2 below +        for (int i = 0; i < ia.length; i++)                  // See note 3 below +            [System][4].out.println("ia[" + i + "] = " + ia[i]);  // See note 4 below +    } + +} +``` + +Let’s work through the most important bits. + + 1. Our declaration and initialization of the array of 10 integers, **ia**, is easy to spot. + 2. In the line just following, we see the expression **ia.getClass()**. That’s right, **ia** is an _object_ belonging to a _class_, and this code will let us know which class that is. + 3. In the next line following that, we see the start of the loop **for (int i = 0; i < ia.length; i++)**, which defines a loop index variable **i** that runs through a sequence from zero to one less than **ia.length**, which is an expression that tells us how many elements are defined in the array **ia**. + 4. Next, the body of the loop prints out the values of each element of **ia**. + + + +When this program is compiled and run, it produces the following results: + + +``` +me@mydesktop:~/Java$ javac Test1.java +me@mydesktop:~/Java$ java Test1 +ia is class [I +ia[0] = 0 +ia[1] = 0 +ia[2] = 0 +ia[3] = 0 +ia[4] = 0 +ia[5] = 0 +ia[6] = 0 +ia[7] = 0 +ia[8] = 0 +ia[9] = 0 +me@mydesktop:~/Java$ +``` + +The string representation of the output of **ia.getClass()** is **[I**, which is shorthand for "array of integer." Similar to the C programming language, Java arrays begin with element zero and extend up to element **<array size> – 1**. We can see above that each of the elements of **ia** are set to zero (by the array constructor, it seems). + +So, is that it? We declare the type, use the appropriate initializer, and we’re done? + +Well, no. There are many other ways to initialize an array in Java.  + +### Why do I want to initialize an array, anyway? + +The answer to this question, like that of all good questions, is "it depends." In this case, the answer depends on what we expect to do with the array once it is initialized. + +In some cases, arrays emerge naturally as a type of accumulator. For example, suppose we are writing code for counting the number of calls received and made by a set of telephone extensions in a small office. There are eight extensions, numbered one through eight, plus the operator’s extension, numbered zero. So we might declare two arrays: + + +``` +int[] callsMade; +int[] callsReceived; +``` + +Then, whenever we start a new period of accumulating call statistics, we initialize each array as: + + +``` +callsMade = new int[9]; +callsReceived = new int[9]; +``` + +At the end of each period of accumulating call statistics, we can print out the stats. In very rough terms, we might see: + + +``` +import java.lang.*; +import java.io.*; + +public class Test2 { + +    public static void main([String][3][] args) { + +        int[] callsMade; +        int[] callsReceived; + +        // initialize call counters + +        callsMade = new int[9]; +        callsReceived = new int[9]; + +        // process calls... +        //   an extension makes a call: callsMade[ext]++ +        //   an extension receives a call: callsReceived[ext]++ + +        // summarize call statistics + +        [System][4].out.printf("%3s%25s%25s\n","ext"," calls made", +            "calls received"); +        for (int ext = 0; ext < callsMade.length; ext++) +            [System][4].out.printf("%3d%25d%25d\n",ext, +                callsMade[ext],callsReceived[ext]); + +    } + +} +``` + +Which would produce output something like this: + + +``` +me@mydesktop:~/Java$ javac Test2.java +me@mydesktop:~/Java$ java Test2 +ext               calls made           calls received +  0                        0                        0 +  1                        0                        0 +  2                        0                        0 +  3                        0                        0 +  4                        0                        0 +  5                        0                        0 +  6                        0                        0 +  7                        0                        0 +  8                        0                        0 +me@mydesktop:~/Java$ +``` + +Not a very busy day in the call center. + +In the above example of an accumulator, we see that the starting value of zero as set by the array initializer is satisfactory for our needs. But in other cases, this starting value may not be the right choice. + +For example, in some kinds of geometric computations, we might need to initialize a two-dimensional array to the identity matrix (all zeros except for the ones along the main diagonal). We might choose to do this as: + + +``` + double[][] m = new double[3][3]; +        for (int d = 0; d < 3; d++) +            m[d][d] = 1.0; +``` + +In this case, we rely on the array initializer **new double[3][3]** to set the array to zeros, and then use a loop to set the diagonal elements to ones. In this simple case, we might use a shortcut that Java provides: + + +``` + double[][] m = { +         {1.0, 0.0, 0.0}, +         {0.0, 1.0, 0.0}, +         {0.0, 0.0, 1.0}}; +``` + +This type of visual structure is particularly appropriate in this sort of application, where it can be a useful double-check to see the actual layout of the array. But in the case where the number of rows and columns is only determined at run time, we might instead see something like this: + + +``` + int nrc; + // some code determines the number of rows & columns = nrc + double[][] m = new double[nrc][nrc]; + for (int d = 0; d < nrc; d++) +     m[d][d] = 1.0; +``` + +It’s worth mentioning that a two-dimensional array in Java is actually an array of arrays, and there’s nothing stopping the intrepid programmer from having each one of those second-level arrays be a different length. That is, something like this is completely legitimate: + + +``` +int [][] differentLengthRows = { +     { 1, 2, 3, 4, 5}, +     { 6, 7, 8, 9}, +     {10,11,12}, +     {13,14}, +     {15}}; +``` + +There are various linear algebra applications that involve irregularly-shaped matrices, where this type of structure could be applied (for more information see [this Wikipedia article][5] as a starting point). Beyond that, now that we understand that a two-dimensional array is actually an array of arrays, it shouldn’t be too much of a surprise that: + + +``` +differentLengthRows.length +``` + +tells us the number of rows in the two-dimensional array **differentLengthRows**, and: + + +``` +differentLengthRows[i].length +``` + +tells us the number of columns in row **i** of **differentLengthRows**. + +### Taking the array further + +Considering this idea of array size that is determined at run time, we see that arrays still require us to know that size before instantiating them. But what if we don’t know the size until we’ve processed all of the data? Does that mean we have to process it once to figure out the size of the array, and then process it again? That could be hard to do, especially if we only get one chance to consume the data. + +The [Java Collections Framework][6] solves this problem in a nice way. One of the things provided there is the class **ArrayList**, which is like an array but dynamically extensible. To demonstrate the workings of **ArrayList**, let’s create one and initialize it to the first 20 [Fibonacci numbers][7]: + + +``` +import java.lang.*; +import java.util.*; + +public class Test3 { +        +        public static void main([String][3][] args) { + +                ArrayList<Integer> fibos = new ArrayList<Integer>(); + +                fibos.add(0); +                fibos.add(1); +                for (int i = 2; i < 20; i++) +                        fibos.add(fibos.get(i-1) + fibos.get(i-2)); + +                for (int i = 0; i < fibos.size(); i++) +                        [System][4].out.println("fibonacci " + i + +                       " = " + fibos.get(i)); + +        } +} +``` + +Above, we see: + + * The declaration and instantiation of an **ArrayList** that is used to store **Integer**s. + * The use of **add()** to append to the **ArrayList** instance. + * The use of **get()** to retrieve an element by index number. + * The use of **size()** to determine how many elements are already in the **ArrayList** instance. + + + +Not shown is the **put()** method, which places a value at a given index number. + +The output of this program is: + + +``` +fibonacci 0 = 0 +fibonacci 1 = 1 +fibonacci 2 = 1 +fibonacci 3 = 2 +fibonacci 4 = 3 +fibonacci 5 = 5 +fibonacci 6 = 8 +fibonacci 7 = 13 +fibonacci 8 = 21 +fibonacci 9 = 34 +fibonacci 10 = 55 +fibonacci 11 = 89 +fibonacci 12 = 144 +fibonacci 13 = 233 +fibonacci 14 = 377 +fibonacci 15 = 610 +fibonacci 16 = 987 +fibonacci 17 = 1597 +fibonacci 18 = 2584 +fibonacci 19 = 4181 +``` + +**ArrayList** instances can also be initialized by other techniques. For example, an array can be supplied to the **ArrayList** constructor, or the **List.of()** and **Arrays.asList()** methods can be used when the initial elements are known at compile time. I don’t find myself using these options all that often since my primary use case for an **ArrayList** is when I only want to read the data once. + +Moreover, an **ArrayList** instance can be converted to an array using its **toArray()** method, for those who prefer to work with an array once the data is loaded; or, returning to the current topic, once the **ArrayList** instance is initialized. + +The Java Collections Framework provides another kind of array-like data structure called a **Map**. What I mean by "array-like" is that a **Map** defines a collection of objects whose values can be set or retrieved by a key, but unlike an array (or an **ArrayList**), this key need not be an integer; it could be a **String** or any other complex object. + +For example, we can create a **Map** whose keys are **String**s and whose values are **Integer**s as follows: + + +``` +Map<[String][3],Integer> stoi = new Map<[String][3],Integer>(); +``` + +Then we can initialize this **Map** as follows: + + +``` +stoi.set("one",1); +stoi.set("two",2); +stoi.set("three",3); +``` + +And so on. Later, when we want to know the numeric value of **"three"**, we can retrieve it as: + + +``` +stoi.get("three"); +``` + +In my world, a **Map** is useful for converting strings occurring in third-party datasets into coherent code values in my datasets. As a part of a [data transformation pipeline][8], I will often build a small standalone program to clean the data before processing it; for this, I will almost always use one or more **Map**s. + +Worth mentioning is that it’s quite possible, and sometimes reasonable, to have **ArrayLists** of **ArrayLists** and **Map**s of **Map**s. For example, let’s assume we’re looking at trees, and we’re interested in accumulating the count of the number of trees by tree species and age range. Assuming that the age range definition is a set of string values ("young," "mid," "mature," and "old") and that the species are string values like "Douglas fir," "western red cedar," and so forth, then we might define a **Map** of **Map**s as: + + +``` +Map<[String][3],Map<[String][3],Integer>> counter = +        new Map<[String][3],Map<[String][3],Integer>>(); +``` + +One thing to watch out for here is that the above only creates storage for the _rows_ of **Map**s. So, our accumulation code might look like: + + +``` +// assume at this point we have figured out the species +// and age range +if (!counter.containsKey(species)) +        counter.put(species,new Map<[String][3],Integer>()); +if (!counter.get(species).containsKey(ageRange)) +        counter.get(species).put(ageRange,0); +``` + +At which point, we can start accumulating as: + + +``` +counter.get(species).put(ageRange, +        counter.get(species).get(ageRange) + 1); +``` + +Finally, it’s worth mentioning that the (new in Java 8) Streams facility can also be used to initialize arrays, **ArrayList** instances, and **Map** instances. A nice discussion of this feature can be found [here][9] and [here][10]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/initializing-arrays-java + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者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/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://opensource.com/article/19/8/what-object-java +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: https://en.wikipedia.org/wiki/Irregular_matrix +[6]: https://en.wikipedia.org/wiki/Java_collections_framework +[7]: https://en.wikipedia.org/wiki/Fibonacci_number +[8]: https://towardsdatascience.com/data-science-for-startups-data-pipelines-786f6746a59a +[9]: https://stackoverflow.com/questions/36885371/lambda-expression-to-initialize-array +[10]: https://stackoverflow.com/questions/32868665/how-to-initialize-a-map-using-a-lambda diff --git a/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md b/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md new file mode 100644 index 0000000000..5922064511 --- /dev/null +++ b/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NGT: A library for high-speed approximate nearest neighbor search) +[#]: via: (https://opensource.com/article/19/10/ngt-open-source-library) +[#]: author: (Masajiro Iwasaki https://opensource.com/users/masajiro-iwasaki) + +NGT: A library for high-speed approximate nearest neighbor search +====== +NGT is a high-performing, open source deep learning library for +large-scale and high-dimensional vectors. +![Houses in a row][1] + +Approximate nearest neighbor ([ANN][2]) search is used in deep learning to make a best guess at the point in a given set that is most similar to another point. This article explains the differences between ANN search and traditional search methods and introduces [NGT][3], a top-performing open source ANN library developed by [Yahoo! Japan Research][4]. + +### Nearest neighbor search for high-dimensional data + +Different search methods are used for different data types. For example, full-text search is for text data, content-based image retrieval is for images, and relational databases are for data relationships. Deep learning models can easily generate vectors from various kinds of data so that the vector space has embedded relationships among source data. This means that if two source data are similar, the two vectors from the data will be located near each other in the vector space. Therefore, all you have to do is search the vectors instead of the source data. + +Moreover, the vectors not only represent the text and image characteristics of the source data, but they also represent products, human beings, organizations, and so forth. Therefore, you can search for similar documents and images as well as products with similar attributes, human beings with similar skills, clothing with similar features, and so on. For example, [Yahoo! Japan][5] provides a similarity-based fashion-item search using NGT. + +![Nearest neighbour search][6] + +Since the number of dimensions in deep learning models tends to increase, ANN search methods are indispensable when searching for more than several million high-dimensional vectors. ANN search methods allow you to search for neighbors to the specified query vector in high-dimensional space. + +There are many nearest-neighbor search methods to choose from. [ANN Benchmarks][7] evaluates the best-known ANN search methods, including Faiss (Facebook), Flann, and Hnswlib. According to this benchmark, NGT achieves top-level performance. + +### NGT algorithms + +The NGT index combines a graph and a tree. This result is a very good search performance, with the graph's vertices representing searchable objects. Neighboring vertices are connected by edges. + +This animation shows how a graph is constructed. + +![NGT graph construction][8] + +In the search procedure, neighboring vertices to the specified query can be found descending the graph. Densely connected vertices enable users to explore the graph effectively. + +![NGT graph][9] + +NGT provides a command-line tool, along with C, C++, and Python APIs. This article focuses on the command-line tool and the Python API. + +### Using NGT with the command-line tool + +#### Linux installation + +Download the [latest version of NGT][10] as a ZIP file and install it on Linux with: + + +``` +unzip NGT-x.x.x.zip +cd NGT-x.x.x +mkdir build +cd build +cmake .. +make +make install +``` + +Since NGT libraries are installed in **/usr/local/lib(64)** by default, add the directory to the search path: + + +``` +export PATH="$PATH:/opt/local/bin" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" +``` + +#### Sample dataset generation + +Before you can search for a large-scale dataset, you must generate an NGT dataset. As an example, [download the][11] [fastText][11] [dataset][11] from the [fastText website][12], then convert it to the NGT registration format with: + + +``` +curl -O +unzip wiki-news-300d-1M-subword.vec.zip +tail -n +2 wiki-news-300d-1M-subword.vec | cut -d " " -f 2- > objects.ssv +``` + +**Objects.ssv** is a registration file that has 1 million objects. One object in the file is extracted as a query: + + +``` +`head -10000 objects.ssv | tail -1 > query.ssv` +``` + +#### Index construction + +An **ngt_index** can be constructed using the following command: + + +``` +`ngt create -d 300 -D c index objects.ssv` +``` + +_-d_ specifies the number of dimensions of the vector. _-D c_ means using cosine similarity. + +#### Approximate nearest neighbor search + +The **ngt_index** can be searched for with the queries using: + + +``` +`ngt search -n 10 index query.ssv` +``` + +**-n** specifies the number of resulting objects. + +The search results are: + + +``` +Query No.1 +Rank    ID      Distance +1       10000   0 +2       21516   0.184495 +3       201860  0.240375 +4       71865   0.241284 +5       339589  0.267265 +6       485158  0.280977 +7       7961    0.283865 +8       924513  0.286571 +9       28870   0.286654 +10      395274  0.290466 +Query Time= 0.000972628 (sec), 0.972628 (msec) +Average Query Time= 0.000972628 (sec), 0.972628 (msec), (0.000972628/1) +``` + +Please see the [NGT command-line README][13] for more information. + +### Using NGT from Python + +Although NGT has C and C++ APIs, the [ngtpy][14] Python binding for NGT is the simplest option for programming. + +#### Installing ngtpy + +Install the Python binding (ngtpy) through PyPI with: + + +``` +`pip3 install ngt` +``` + +#### Sample dataset generation + +Generate data files for Python sample programs from the sample data set you downloaded by using this code: + + +``` +dataset_path = 'wiki-news-300d-1M-subword.vec' +with open(dataset_path, 'r') as fi, open('objects.tsv', 'w') as fov, +open('words.tsv', 'w') as fow: +    n, dim = map(int, fi.readline().split()) +    fov.write('{0}¥t{1}¥n'.format(n, dim)) +    for line in fi: +        tokens = line.rstrip().split(' ') +        fow.write(tokens[0] + '¥n') +        fov.write('{0}¥n'.format('¥t'.join(tokens[1:]))) +``` + +#### Index construction + +Construct the NGT index with: + + +``` +import ngtpy + +index_path = 'index' +with open('objects.tsv', 'r') as fin: +    n, dim = map(int, fin.readline().split()) +    ngtpy.create(index_path, dim, distance_type='Cosine') # create an index +    index = ngtpy.Index(index_path) # open the index +    print('inserting objects...') +    for line in fin: +        object = list(map(float, line.rstrip().split('¥t'))) +        index.insert(object) # insert objects +print('building objects...') +index.build_index() +print('saving the index...') +index.save() +``` + +#### Approximate nearest neighbor search + +Here is an example ANN search program: + + +``` +import ngtpy + +print('loading words...') +with open('words.tsv', 'r') as fin: +    words = list(map(lambda x: x.rstrip('¥n'), fin.readlines())) + +index = ngtpy.Index('index', zero_based_numbering = False) # open index +query_id = 10000 +query_object = index.get_object(query_id) # get the object for a query + +result = index.search(query_object) # aproximate nearest neighbor search +print('Query={}'.format(words[query_id - 1])) +print('Rank¥tID¥tDistance¥tWord') +for rank, object in enumerate(result): +    print('{}¥t{}¥t{:.6f}¥t{}'.format(rank + 1, object[0], object[1], words[object[0] - 1])) +``` + +And here are the search results, which are the same as the NGT command-line option's results: + + +``` +loading words... +Query=Horse +Rank    ID      Distance        Word +1       10000   0.000000        Horse +2       21516   0.184495        Horses +3       201860  0.240375        Horseback +4       71865   0.241284        Horseman +5       339589  0.267265        Prancing +6       485158  0.280977        Horsefly +7       7961    0.283865        Dog +8       924513  0.286571        Horsing +9       28870   0.286654        Pony +10      395274  0.290466        Blood-Horse +``` + +For more information, please see [ngtpy README][14]. + +Approximate nearest neighbor (ANN) principles are important features for analyzing data. Learning how to use it in your own projects, or to make sense of data that you're analyzing, is a powerful way to make correlations and interpret information. With NGT, you can use ANN in whatever way you require, or build upon it to add custom features. + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/ngt-open-source-library + +作者:[Masajiro Iwasaki][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/masajiro-iwasaki +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximate_nearest_neighbor +[3]: https://github.com/yahoojapan/NGT +[4]: https://research-lab.yahoo.co.jp/en/ +[5]: https://www.yahoo.co.jp/ +[6]: https://opensource.com/sites/default/files/browser-visual-search_new.jpg (Nearest neighbour search) +[7]: https://github.com/erikbern/ann-benchmarks +[8]: https://opensource.com/sites/default/files/uploads/ngt_movie2.gif (NGT graph construction) +[9]: https://opensource.com/sites/default/files/uploads/ngt_movie1.gif (NGT graph) +[10]: https://github.com/yahoojapan/NGT/releases/latest +[11]: https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M-subword.vec.zip +[12]: https://fasttext.cc/ +[13]: https://github.com/yahoojapan/NGT/blob/master/bin/ngt/README.md +[14]: https://github.com/yahoojapan/NGT/blob/master/python/README-ngtpy.md diff --git a/sources/tech/20191023 Best practices in test-driven development.md b/sources/tech/20191023 Best practices in test-driven development.md new file mode 100644 index 0000000000..47f025a111 --- /dev/null +++ b/sources/tech/20191023 Best practices in test-driven development.md @@ -0,0 +1,206 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best practices in test-driven development) +[#]: via: (https://opensource.com/article/19/10/test-driven-development-best-practices) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Best practices in test-driven development +====== +Ensure you're producing very high-quality code by following these TDD +best practices. +![magnifying glass on computer screen][1] + +In my previous series on [test-driven development (TDD) and mutation testing][2], I demonstrated the benefits of relying on examples when building a solution. That begs the question: What does "relying on examples" mean? + +In that series, I described one of my expectations when building a solution to determine whether it's daytime or nighttime. I provided an example of a specific hour of the day that I consider to fall in the daytime category. I created a **DateTime** variable named **dayHour** and gave it the specific value of **August 8, 2019, 7 hours, 0 minutes, 0 seconds**. + +My logic (or way of reasoning) was: "When the system is notified that the time is exactly 7am on August 8, 2019, I expect that the system will perform the necessary calculations and return the value **Daylight**." + +Armed with such a specific example, it was very easy to create a unit test (**Given7amReturnDaylight**). I then ran the tests and watched my unit test fail, which gave me the opportunity to work on fixing this early failure. + +### Iteration is the solution + +One very important aspect of TDD (and, by proxy, of agile) is the fact that it is impossible to arrive at an acceptable solution unless you are iterating. TDD is a professional discipline based on the process of relentless iterating. It is very important to note that it mandates that each iteration must begin with a micro-failure. That micro-failure has only one purpose: to solicit immediate feedback. And that immediate feedback ensures we can rapidly close the gap between _wanting_ a solution and _getting_ a solution. + +Iteration provides an opportunity to solicit immediate feedback by failing as early as possible. Because that failure is fast (i.e., it is a micro-failure), it is not alarming; even when we fail, we can remain calm, knowing that it will be easy to fix the failure. And the feedback from that failure will guide us toward fixing the failure. + +Rinse, repeat, until we completely close the gap and deliver the solution that fully meets the expectation (but keep in mind that the expectation must also be a micro-expectation). + +### Why micro? + +This approach often feels very unambitious. In TDD (and in agile), it's best to pick a tiny, almost trivial challenge, and then do the TDD song-and-dance by failing first, then iterating until we solve that trivial challenge. People who are used to more substantial, beefy engineering and problem solving tend to feel that such an exercise is beneath their level of competence. + +One of the cornerstones of agile philosophy relies on reducing the problem space to multiple, smallest-possible surface areas. As Robert C. Martin puts it: + +> _"Agile is a small idea about the small problems of small programming teams doing small things"_ + +But how can making an unimpressive series of such pedestrian, minuscule, and almost insignificant micro-victories ever enable us to reach the big-scale solution? + +Here is where sophisticated and elaborate systems thinking comes into play. When building a system, there's always the risk of ending up with a dreaded "monolith." A monolith is a system built on the principle of tight coupling. Any part of the monolith is highly dependent on many other parts of the same monolith. That arrangement makes the monolith very brittle, unreliable, and difficult to operate, maintain, troubleshoot, and fix. + +The only way to avoid this trap is to minimize or, better yet, completely remove coupling. Instead of investing heroic efforts into building elaborate parts that will be assembled into a system, it is much better to take humble, baby steps toward building tiny, micro parts. These micro parts have very little capability on their own, and will, by virtue of such arrangement, not be dependent on other components. This will minimize and even remove any coupling. + +The desired end game in building a useful, elaborate system is to compose it from a collection of generic, completely independent components. The more generic each component is, the more robust, resilient, and flexible the resulting system will be. Also, having a collection of generic components enables them to be repurposed to build brand new systems by reconfiguring those components. + +Consider a toy castle made out of Lego blocks. If we pick almost any block from that castle and examine it in isolation, we won't be able to find anything on that block that specifies it is a Lego block meant for building a castle. The block itself is sufficiently generic, which makes it suitable for building other contraptions, such as toy cars, toy airplanes, toy boats, etc. That's the power of having generic components. + +TDD is a proven discipline for delivering generic, independent, and autonomous components that can be safely used to assemble large, sophisticated systems expediently. As in agile, TDD is focused on micro-activities. And because agile is based on the fundamental principle known as "the Whole Team," the humble approach illustrated here is also important when specifying business examples. If the example used for building a component is not modest, it will be difficult to meet the expectations. Therefore, the expectations must be humble, which makes the resulting examples equally humble. + +For instance, if a member of the Whole Team (a requester) provides the developer with an expectation and an example that reads: + +> _"When processing an order, make sure to apply appropriate discount for orders made by loyal customers, or for orders over certain monetary value, or both."_ + +The developer should recognize that this example is too ambitious. That's not a humble expectation. It is not sufficiently micro, if you will. The developer should always strive to guide a requester in being more specific and micro-level when crafting examples. Paradoxically, the more specific the example, the more generic the resulting solution will be. + +A much better, more effective expectation and example would be: + +> _"Discount made for an order greater than $100.00 is $18.00."_ + +Or: + +> _"Discount made for an order greater than $100.00 that was made by a customer who already placed three orders is $25.00."_ + +Such micro-examples make it easy to turn them into automated micro-expectations (read: unit tests). Such expectations will make us fail, and then we will pick ourselves up and iterate until we deliver the solution—a robust, generic component that knows how to calculate discounts based on the micro-examples supplied by the Whole Team. + +### Writing quality unit tests + +Merely writing unit tests without any concern about their quality is a fool's errand. Shoddily written unit tests will result in bloated, tightly coupled code. Such code is brittle, difficult to reason about, and often nearly impossible to fix. + +We need to lay down some ground rules for writing quality unit tests. These ground rules will help us make swift progress in building robust, reliable solutions. The easiest way to do that is to introduce a mnemonic in the form of an acronym: **FIRST**, which says unit tests must be: + + * **F** = Fast + * **I** = Independent + * **R** = Repeatable + * **S** = Self-validating + * **T** = Thorough + + + +#### Fast + +Since a unit test describes a micro-example, it should expect very simple processing from the implemented code. This means that each unit test should be very fast to run. + +#### Independent + +Since a unit test describes a micro-example, it should describe a very simple process that does not depend on any other unit test. + +#### Repeatable + +Since a unit test does not depend on any other unit test, it must be fully repeatable. What that means is that each time a certain unit test runs, it produces the same results as the previous time it ran. Neither the number of times the unit tests run nor the order in which they run should ever affect the expected output. + +#### Self-validating + +When unit tests run, the outcome of the testing should be instantly visible. Developers should not be expected to reach for some other source(s) of information to find out whether their unit tests failed or passed. + +#### Thorough + +Unit tests should describe all the expectations as defined in the micro-examples. + +### Well-structured unit tests + +Unit tests are code. And the same as any other code, unit tests need to be well-structured. It is unacceptable to deliver sloppy, messy unit tests. All the principles that apply to the rules governing clean implementation code apply with equal force to unit tests. + +A time-tested and proven methodology for writing reliable quality code is based on the clean code principle known as **SOLID**. This acronym that helps us remember five very important principles: + + * **S** = Single responsibility principle + * **O** = Open–closed principle + * **L** = Liskov substitution principle + * **I** = Interface segregation principle + * **D** = Dependency inversion principle + + + +#### Single responsibility principle + +Each component must be responsible for performing only one operation. This principle is illustrated in this meme + +![Sign illustrating single-responsibility principle][3] + +Pumping septic tanks is an operation that must be kept separate from filling swimming pools. + +Applied to unit tests, this principle ensures that each unit test verifies one—and only one—expectation. From a technical standpoint, this means each unit test must have one and only one **Assert** statement. + +#### Open–closed principle + +This principle states that a component should be open for extensions, but closed for any modifications. + +![Open-closed principle][4] + +Applied to unit tests, this principle ensures that we will not implement a change to an existing unit test in that unit test. Instead, we must write a brand new unit test that will implement the changes. + +#### Liskov substitution principle + +This principle provides a guide for deciding which level of abstraction may be appropriate for the solution. + +![Liskov substitution principle][5] + +Applied to unit tests, this principle guides us to avoid tight coupling with dependencies that depend on the underlying computing environment (such as databases, disks, network, etc.). + +#### Interface segregation principle + +This principle reminds us not to bloat APIs. When subsystems need to collaborate to complete a task, they should communicate via interfaces. But those interfaces must not be bloated. If a new capability becomes necessary, don't add it to the already defined interface; instead, craft a brand new interface. + +![Interface segregation principle][6] + +Applied to unit tests, removing the bloat from interfaces helps us craft more specific unit tests, which, in turn, results in more generic components. + +#### Dependency inversion principle + +This principle states that we should control our dependencies, instead of dependencies controlling us. If there is a need to use another component's services, instead of being responsible for instantiating that component within the component we are building, it must instead be injected into our component. + +![Dependency inversion principle][7] + +Applied to the unit tests, this principle helps separate the intention from the implementation. We must strive to inject only those dependencies that have been sufficiently abstracted. That approach is important for ensuring unit tests are not mixed with integration tests. + +### Testing the tests + +Finally, even if we manage to produce well-structured unit tests that fulfill the FIRST principles, it does not guarantee that we have delivered a solid solution. TDD best practices rely on the proper sequence of events when building components/services; we are always and invariably expected to provide a description of our expectations (supplied in the micro-examples). Only after those expectations are described in the unit test can we move on to writing the implementation code. However, two unwanted side effects can, and often do, happen while writing implementation code: + + 1. Implemented code enables the unit tests to pass, but they are written in a convoluted way, using unnecessarily complex logic + 2. Implemented code gets tagged on AFTER the unit tests have been written + + + +In the first case, even if all unit tests pass, mutation testing uncovers that some mutants have survived. As I explained in _[Mutation testing by example: Evolving from fragile TDD][8]_, that is an extremely undesirable situation because it means that the solution is unnecessarily complex and, therefore, unmaintainable. + +In the second case, all unit tests are guaranteed to pass, but a potentially large portion of the codebase consists of implemented code that hasn't been described anywhere. This means we are dealing with mysterious code. In the best-case scenario, we could treat that mysterious code as deadwood and safely remove it. But more likely than not, removing this not-described, implemented code will cause some serious breakages. And such breakages indicate that our solution is not well engineered. + +### Conclusion + +TDD best practices stem from the time-tested methodology called [extreme programming][9] (XP for short). One of the cornerstones of XP is based on the **three C's**: + + 1. **Card:** A small card briefly specifies the intent (e.g., "Review customer request"). + 2. **Conversation:** The card becomes a ticket to conversation. The whole team gets together and talks about "Review customer request." What does that mean? Do we have enough information/knowledge to ship the "review customer request" functionality in this increment? If not, how do we further slice this card? + 3. **Concrete confirmation examples:** This includes all the specific values plugged in (e.g., concrete names, numeric values, specific dates, whatever else is pertinent to the use case) plus all values expected as an output of the processing. + + + +Starting from such micro-examples, we write unit tests. We watch unit tests fail, then make them pass. And while doing that, we observe and respect the best software engineering practices: the **FIRST** principles, the **SOLID** principles, and the mutation testing discipline (i.e., kill all surviving mutants). + +This ensures that our components and services are delivered with solid quality built in. And what is the measure of that quality? Simple—**the cost of change**. If the delivered code is costly to change, it is of shoddy quality. Very high-quality code is structured so well that it is simple and inexpensive to change and, at the same time, does not incur any change-management risks. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/test-driven-development-best-practices + +作者:[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/search_find_code_issue_bug_programming.png?itok=XPrh7fa0 (magnifying glass on computer screen) +[2]: https://opensource.com/users/alex-bunardzic +[3]: https://opensource.com/sites/default/files/uploads/single-responsibility.png (Sign illustrating single-responsibility principle) +[4]: https://opensource.com/sites/default/files/uploads/openclosed_cc.jpg (Open-closed principle) +[5]: https://opensource.com/sites/default/files/uploads/liskov_substitution_cc.jpg (Liskov substitution principle) +[6]: https://opensource.com/sites/default/files/uploads/interface_segregation_cc.jpg (Interface segregation principle) +[7]: https://opensource.com/sites/default/files/uploads/dependency_inversion_cc.jpg (Dependency inversion principle) +[8]: https://opensource.com/article/19/9/mutation-testing-example-definition +[9]: https://en.wikipedia.org/wiki/Extreme_programming diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md new file mode 100644 index 0000000000..d445417c83 --- /dev/null +++ b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -0,0 +1,263 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to dual boot Windows 10 and Debian 10) +[#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to dual boot Windows 10 and Debian 10 +====== + +So, you finally made the bold decision to try out **Linux** after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to **dual boot  Windows 10 alongside Debian 10**. + +[![How-to-dual-boot-Windows-and-Debian10][1]][2] + +### Prerequisites + +Before you get started, ensure you have the following: + + * A bootable USB  or DVD of Debian 10 + * A fast and stable internet connection ( For installation updates & third party applications) + + + +Additionally, it worth paying attention to how your system boots (UEFI or Legacy) and ensure both the operating systems boot using the same boot mode. + +### Step 1: Create a free partition on your hard drive + +To start off, you need to create a free partition on your hard drive. This is the partition where Debian will be installed during the installation process. To achieve this, you will invoke the disk management utility as shown: + +Press **Windows Key + R** to launch the Run dialogue. Next, type **diskmgmt.msc** and hit **ENTER** + +[![Launch-Run-dialogue][1]][3] + +This launches the **disk management** window displaying all the drives existing on your Windows system. + +[![Disk-management][1]][4] + +Next, you need to create a free space for Debian installation. To do this, you need to shrink a partition from one of the volumes and create a new unallocated partition. In this case, I will create a **30 GB** partition from Volume D. + +To shrink a volume, right-click on it and select the ‘**shrink**’ option + +[![Shrink-volume][1]][5] + +In the pop-up dialogue, define the size that you want to shrink your space. Remember, this will be the disk space on which Debian 10 will be installed. In my case, I selected **30000MB  ( Approximately 30 GB)**. Once done, click on ‘**Shrink**’. + +[![Shrink-space][1]][6] + +After the shrinking operation completes, you should have an unallocated partition as shown: + +[![Unallocated-partition][1]][7] + +Perfect! We are now good to go and ready to begin the installation process. + +### Step 2: Begin the installation of Debian 10 + +With the free partition already created, plug in your bootable USB drive or insert the DVD installation medium in your PC and reboot your system. Be sure to make changes to the **boot order** in the **BIOS** set up by pressing the function keys (usually, **F9, F10 or F12** depending on the vendor). This is crucial so that the PC boots into your installation medium. Saves the BIOS settings and reboot. + +A new grub menu will be displayed as shown below: Click on ‘**Graphical install**’ + +[![Graphical-Install-Debian10][1]][8] + +In the next step, select your **preferred language** and click ‘**Continue**’ + +[![Select-Language-Debian10][1]][9] + +Next, select your **location** and click ‘**Continue**’. Based on this location the time will automatically be selected for you. If you cannot find you located, scroll down and click on ‘**other**’ then select your location. + +[![Select-location-Debain10][1]][10] + +Next, select your **keyboard** layout. + +[![Configure-Keyboard-layout-Debain10][1]][11] + +In the next step, specify your system’s **hostname** and click ‘**Continue**’ + +[![Set-hostname-Debian10][1]][12] + +Next, specify the **domain name**. If you are not in a domain environment, simply click on the ‘**continue**’ button. + +[![Set-domain-name-Debian10][1]][13] + +In the next step, specify the **root password** as shown and click ‘**continue**’. + +[![Set-root-Password-Debian10][1]][14] + +In the next step, specify the full name of the user for the account and click ‘**continue**’ + +[![Specify-fullname-user-debain10][1]][15] + +Then set the account name by specifying the **username** associated with the account + +[![Specify-username-Debian10][1]][16] + +Next, specify the username’s password as shown and click ‘**continue**’ + +[![Specify-user-password-Debian10][1]][17] + +Next, specify your **timezone** + +[![Configure-timezone-Debian10][1]][18] + +At this point, you need to create partitions for your Debian 10 installation. If you are an inexperienced user, Click on the ‘**Use the largest continuous free space**’ and click ‘**continue**’. + +[![Use-largest-continuous-free-space-debian10][1]][19] + +However, if you are more knowledgeable about creating partitions, select the ‘**Manual**’ option and click ‘**continue**’ + +[![Select-Manual-Debain10][1]][20] + +Thereafter, select the partition labeled ‘**FREE SPACE**’  and click ‘**continue**’ . Next click on ‘**Create a new partition**’. + +[![Create-new-partition-Debain10][1]][21] + +In the next window, first, define the size of swap space, In my case, I specified **2GB**. Click **Continue**. + +[![Define-swap-space-debian10][1]][22] + +Next, click on ‘’**Primary**’ on the next screen and click ‘**continue**’ + +[![Partition-Disks-Primary-Debain10][1]][23] + +Select the partition to **start at the beginning** and click continue. + +[![Start-at-the-beginning-Debain10][1]][24] + +Next, click on **Ext 4 journaling file system** and click ‘**continue**’ + +[![Select-Ext4-Journaling-system-debain10][1]][25] + +On the next window, select **swap  **and click continue + +[![Select-swap-debain10][1]][26] + +Next, click on **done setting the partition** and click continue. + +[![Done-setting-partition-debian10][1]][27] + +Back to the **Partition disks** page, click on **FREE SPACE** and click continue + +[![Click-Free-space-Debain10][1]][28] + +To make your life easy select **Automatically partition the free space** and click **continue**. + +[![Automatically-partition-free-space-Debain10][1]][29] + +Next click on **All files in one partition (recommended for new users)** + +[![All-files-in-one-partition-debian10][1]][30] + +Finally, click on **Finish partitioning and write changes to disk** and click **continue**. + +[![Finish-partitioning-write-changes-to-disk][1]][31] + +Confirm that you want to write changes to disk and click ‘**Yes**’ + +[![Write-changes-to-disk-Yes-Debian10][1]][32] + +Thereafter, the installer will begin installing all the requisite software packages. + +When asked if you want to scan another CD, select **No** and click continue + +[![Scan-another-CD-No-Debain10][1]][33] + +Next, select the mirror of the Debian archive closest to you and click ‘Continue’ + +[![Debian-archive-mirror-country][1]][34] + +Next, select the **Debian mirror** that is most preferable to you and click ‘**Continue**’ + +[![Select-Debian-archive-mirror][1]][35] + +If you plan on using a proxy server, enter its details as shown below, otherwise leave it blank and click ‘continue’ + +[![Enter-proxy-details-debian10][1]][36] + +As the installation proceeds, you will be asked if you would like to participate in a **package usage survey**. You can select either option and click ‘continue’ . In my case, I selected ‘**No**’ + +[![Participate-in-survey-debain10][1]][37] + +Next, select the packages you need in the **software selection** window and click **continue**. + +[![Software-selection-debian10][1]][38] + +The installation will continue installing the selected packages. At this point, you can take a coffee break as the installation goes on. + +You will be prompted whether to install the grub **bootloader** on **Master Boot Record (MBR)**. Click **Yes** and click **Continue**. + +[![Install-grub-bootloader-debian10][1]][39] + +Next, select the hard drive on which you want to install **grub** and click **Continue**. + +[![Select-hard-drive-install-grub-Debian10][1]][40] + +Finally, the installation will complete, Go ahead and click on the ‘**Continue**’ button + +[![Installation-complete-reboot-debian10][1]][41] + +You should now have a grub menu with both **Windows** and **Debian** listed. To boot to Debian, scroll and click on Debian. Thereafter, you will be prompted with a login screen. Enter your details and hit ENTER. + +[![Debian10-log-in][1]][42] + +And voila! There goes your fresh copy of Debian 10 in a dual boot setup with Windows 10. + +[![Debian10-Buster-Details][1]][43] + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/dual-boot-windows-10-debian-10/ + +作者:[James Kiarie][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.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/How-to-dual-boot-Windows-and-Debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Launch-Run-dialogue.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Disk-management.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Shrink-volume.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Shrink-space.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Unallocated-partition.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Graphical-Install-Debian10.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Language-Debian10.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-location-Debain10.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-Keyboard-layout-Debain10.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-hostname-Debian10.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-domain-name-Debian10.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-root-Password-Debian10.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-fullname-user-debain10.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-username-Debian10.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-user-password-Debian10.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-timezone-Debian10.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Use-largest-continuous-free-space-debian10.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Manual-Debain10.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Create-new-partition-Debain10.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Define-swap-space-debian10.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Partition-Disks-Primary-Debain10.jpg +[24]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-at-the-beginning-Debain10.jpg +[25]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Ext4-Journaling-system-debain10.jpg +[26]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-swap-debain10.jpg +[27]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Done-setting-partition-debian10.jpg +[28]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Click-Free-space-Debain10.jpg +[29]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Automatically-partition-free-space-Debain10.jpg +[30]: https://www.linuxtechi.com/wp-content/uploads/2019/10/All-files-in-one-partition-debian10.jpg +[31]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Finish-partitioning-write-changes-to-disk.jpg +[32]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Write-changes-to-disk-Yes-Debian10.jpg +[33]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Scan-another-CD-No-Debain10.jpg +[34]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian-archive-mirror-country.jpg +[35]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Debian-archive-mirror.jpg +[36]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Enter-proxy-details-debian10.jpg +[37]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Participate-in-survey-debain10.jpg +[38]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Software-selection-debian10.jpg +[39]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-grub-bootloader-debian10.jpg +[40]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-hard-drive-install-grub-Debian10.jpg +[41]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Installation-complete-reboot-debian10.jpg +[42]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian10-log-in.jpg +[43]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian10-Buster-Details.jpg diff --git a/sources/tech/20191023 How to program with Bash- Loops.md b/sources/tech/20191023 How to program with Bash- Loops.md new file mode 100644 index 0000000000..e582bda447 --- /dev/null +++ b/sources/tech/20191023 How to program with Bash- Loops.md @@ -0,0 +1,352 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Loops) +[#]: via: (https://opensource.com/article/19/10/programming-bash-loops) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Loops +====== +Learn how to use loops for performing iterative operations, in the final +article in this three-part series on programming with Bash. +![arrows cycle symbol for failing faster][1] + +Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. This three-part series, based on my [three-volume Linux self-study course][2], explores using Bash as a programming language on the command-line interface (CLI). + +The [first article][3] in this series explored some simple command-line programming with Bash, including using variables and control operators. The [second article][4] looked into the types of file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and different types of shell expansions in Bash. This third (and final) article examines the use of loops for performing various types of iterative operations and ways to control those loops. + +### Loops + +Every programming language I have ever used has at least a couple types of loop structures that provide various capabilities to perform repetitive operations. I use the for loop quite often but I also find the while and until loops useful. + +#### for loops + +Bash's implementation of the **for** command is, in my opinion, a bit more flexible than most because it can handle non-numeric values; in contrast, for example, the standard C language **for** loop can deal only with numeric values. + +The basic structure of the Bash version of the **for** command is simple: + + +``` +`for Var in list1 ; do list2 ; done` +``` + +This translates to: "For each value in list1, set the **$Var** to that value and then perform the program statements in list2 using that value; when all of the values in list1 have been used, it is finished, so exit the loop." The values in list1 can be a simple, explicit string of values, or they can be the result of a command substitution (described in the second article in the series). I use this construct frequently. + +To try it, ensure that **~/testdir** is still the present working directory (PWD). Clean up the directory, then look at a trivial example of the **for** loop starting with an explicit list of values. This list is a mix of alphanumeric values—but do not forget that all variables are strings and can be treated as such. + + +``` +[student@studentvm1 testdir]$ rm * +[student@studentvm1 testdir]$ for I in a b c d 1 2 3 4 ; do echo $I ; done +a +b +c +d +1 +2 +3 +4 +``` + +Here is a bit more useful version with a more meaningful variable name: + + +``` +[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Department $Dept" ; done +Department Human Resources +Department Sales +Department Finance +Department Information Technology +Department Engineering +Department Administration +Department Research +``` + +Make some directories (and show some progress information while doing so): + + +``` +[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done +Working on Department Human Resources +Working on Department Sales +Working on Department Finance +Working on Department Information Technology +Working on Department Engineering +Working on Department Administration +Working on Department Research +[student@studentvm1 testdir]$ ll +total 28 +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Administration +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Engineering +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Finance +drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Human Resources' +drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Information Technology' +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Research +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Sales +``` + +The **$Dept** variable must be enclosed in quotes in the **mkdir** statement; otherwise, two-part department names (such as "Information Technology") will be treated as two separate departments. That highlights a best practice I like to follow: all file and directory names should be a single word. Although most modern operating systems can deal with spaces in names, it takes extra work for sysadmins to ensure that those special cases are considered in scripts and CLI programs. (They almost certainly should be considered, even if they're annoying because you never know what files you will have.) + +So, delete everything in **~/testdir**—again—and do this one more time: + + +``` +[student@studentvm1 testdir]$ rm -rf * ; ll +total 0 +[student@studentvm1 testdir]$ for Dept in Human-Resources Sales Finance Information-Technology Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done +Working on Department Human-Resources +Working on Department Sales +Working on Department Finance +Working on Department Information-Technology +Working on Department Engineering +Working on Department Administration +Working on Department Research +[student@studentvm1 testdir]$ ll +total 28 +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Administration +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Engineering +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Finance +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Human-Resources +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Information-Technology +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Research +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Sales +``` + +Suppose someone asks for a list of all RPMs on a particular Linux computer and a short description of each. This happened to me when I worked for the State of North Carolina. Since open source was not "approved" for use by state agencies at that time, and I only used Linux on my desktop computer, the pointy-haired bosses (PHBs) needed a list of each piece of software that was installed on my computer so that they could "approve" an exception. + +How would you approach that? Here is one way, starting with the knowledge that the **rpm –qa** command provides a complete description of an RPM, including the two items the PHBs want: the software name and a brief summary. + +Build up to the final result one step at a time. First, list all RPMs: + + +``` +[student@studentvm1 testdir]$ rpm -qa +perl-HTTP-Message-6.18-3.fc29.noarch +perl-IO-1.39-427.fc29.x86_64 +perl-Math-Complex-1.59-429.fc29.noarch +lua-5.3.5-2.fc29.x86_64 +java-11-openjdk-headless-11.0.ea.28-2.fc29.x86_64 +util-linux-2.32.1-1.fc29.x86_64 +libreport-fedora-2.9.7-1.fc29.x86_64 +rpcbind-1.2.5-0.fc29.x86_64 +libsss_sudo-2.0.0-5.fc29.x86_64 +libfontenc-1.1.3-9.fc29.x86_64 +<snip> +``` + +Add the **sort** and **uniq** commands to sort the list and print the unique ones (since it's possible that some RPMs with identical names are installed): + + +``` +[student@studentvm1 testdir]$ rpm -qa | sort | uniq +a2ps-4.14-39.fc29.x86_64 +aajohan-comfortaa-fonts-3.001-3.fc29.noarch +abattis-cantarell-fonts-0.111-1.fc29.noarch +abiword-3.0.2-13.fc29.x86_64 +abrt-2.11.0-1.fc29.x86_64 +abrt-addon-ccpp-2.11.0-1.fc29.x86_64 +abrt-addon-coredump-helper-2.11.0-1.fc29.x86_64 +abrt-addon-kerneloops-2.11.0-1.fc29.x86_64 +abrt-addon-pstoreoops-2.11.0-1.fc29.x86_64 +abrt-addon-vmcore-2.11.0-1.fc29.x86_64 +<snip> +``` + +Since this gives the correct list of RPMs you want to look at, you can use this as the input list to a loop that will print all the details of each RPM: + + +``` +`[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done` +``` + +This code produces way more data than you want. Note that the loop is complete. The next step is to extract only the information the PHBs requested. So, add an **egrep** command, which is used to select **^Name** or **^Summary**. The carat (**^**) specifies the beginning of the line; thus, any line with Name or Summary at the beginning of the line is displayed. + + +``` +[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" +Name        : a2ps +Summary     : Converts text and other types of files to PostScript +Name        : aajohan-comfortaa-fonts +Summary     : Modern style true type font +Name        : abattis-cantarell-fonts +Summary     : Humanist sans serif font +Name        : abiword +Summary     : Word processing program +Name        : abrt +Summary     : Automatic bug detection and reporting tool +<snip> +``` + +You can try **grep** instead of **egrep** in the command above, but it will not work. You could also pipe the output of this command through the **less** filter to explore the results. The final command sequence looks like this: + + +``` +`[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" > RPM-summary.txt` +``` + +This command-line program uses pipelines, redirection, and a **for** loop—all on a single line. It redirects the output of your little CLI program to a file that can be used in an email or as input for other purposes. + +This process of building up the program one step at a time allows you to see the results of each step and ensure that it is working as you expect and provides the desired results. + +From this exercise, the PHBs received a list of over 1,900 separate RPM packages. I seriously doubt that anyone read that list. But I gave them exactly what they asked for, and I never heard another word from them about it. + +### Other loops + +There are two more types of loop structures available in Bash: the **while** and **until** structures, which are very similar to each other in both syntax and function. The basic syntax of these loop structures is simple: + + +``` +`while [ expression ] ; do list ; done` +``` + +and + + +``` +`until [ expression ] ; do list ; done` +``` + +The logic of the first reads: "While the expression evaluates as true, execute the list of program statements. When the expression evaluates as false, exit from the loop." And the second: "Until the expression evaluates as true, execute the list of program statements. When the expression evaluates as true, exit from the loop." + +#### While loop + +The **while** loop is used to execute a series of program statements while (so long as) the logical expression evaluates as true. Your PWD should still be **~/testdir**. + +The simplest form of the **while** loop is one that runs forever. The following form uses the true statement to always generate a "true" return code. You could also use a simple "1"—and that would work just the same—but this illustrates the use of the true statement: + + +``` +[student@studentvm1 testdir]$ X=0 ; while [ true ] ; do echo $X ; X=$((X+1)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +[student@studentvm1 testdir]$ +``` + +This CLI program should make more sense now that you have studied its parts. First, it sets **$X** to zero in case it has a value left over from a previous program or CLI command. Then, since the logical expression **[ true ]** always evaluates to 1, which is true, the list of program instructions between **do** and **done** is executed forever—or until you press **Ctrl+C** or otherwise send a signal 2 to the program. Those instructions are an arithmetic expansion that prints the current value of **$X** and then increments it by one. + +One of the tenets of [_The Linux Philosophy for Sysadmins_][5] is to strive for elegance, and one way to achieve elegance is simplicity. You can simplify this program by using the variable increment operator, **++**. In the first instance, the current value of the variable is printed, and then the variable is incremented. This is indicated by placing the **++** operator after the variable: + + +``` +[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((X++)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +``` + +Now delete **| head** from the end of the program and run it again. + +In this version, the variable is incremented before its value is printed. This is specified by placing the **++** operator before the variable. Can you see the difference? + + +``` +[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((++X)) ; done | head +1 +2 +3 +4 +5 +6 +7 +8 +9 +``` + +You have reduced two statements into a single one that prints the value of the variable and increments that value. There is also a decrement operator, **\--**. + +You need a method for stopping the loop at a specific number. To accomplish that, change the true expression to an actual numeric evaluation expression. Have the program loop to 5 and stop. In the example code below, you can see that **-le** is the logical numeric operator for "less than or equal to." This means: "So long as **$X** is less than or equal to 5, the loop will continue. When **$X** increments to 6, the loop terminates." + + +``` +[student@studentvm1 ~]$ X=0 ; while [ $X -le 5 ] ; do echo $((X++)) ; done +0 +1 +2 +3 +4 +5 +[student@studentvm1 ~]$ +``` + +#### Until loop + +The **until** command is very much like the **while** command. The difference is that it will continue to loop until the logical expression evaluates to "true." Look at the simplest form of this construct: + + +``` +[student@studentvm1 ~]$ X=0 ; until false  ; do echo $((X++)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +[student@studentvm1 ~]$ +``` + +It uses a logical comparison to count to a specific value: + + +``` +[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((X++)) ; done +0 +1 +2 +3 +4 +[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((++X)) ; done +1 +2 +3 +4 +5 +[student@studentvm1 ~]$ +``` + +### Summary + +This series has explored many powerful tools for building Bash command-line programs and shell scripts. But it has barely scratched the surface on the many interesting things you can do with Bash; the rest is up to you. + +I have discovered that the best way to learn Bash programming is to do it. Find a simple project that requires multiple Bash commands and make a CLI program out of them. Sysadmins do many tasks that lend themselves to CLI programming, so I am sure that you will easily find tasks to automate. + +Many years ago, despite being familiar with other shell languages and Perl, I made the decision to use Bash for all of my sysadmin automation tasks. I have discovered that—sometimes with a bit of searching—I have been able to use Bash to accomplish everything I need. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-loops + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: http://www.both.org/?page_id=1183 +[3]: https://opensource.com/article/19/10/programming-bash-part-1 +[4]: https://opensource.com/article/19/10/programming-bash-part-2 +[5]: https://www.apress.com/us/book/9781484237298 diff --git a/sources/tech/20191024 Get sorted with sort at the command line.md b/sources/tech/20191024 Get sorted with sort at the command line.md new file mode 100644 index 0000000000..ff291f39bc --- /dev/null +++ b/sources/tech/20191024 Get sorted with sort at the command line.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get sorted with sort at the command line) +[#]: via: (https://opensource.com/article/19/10/get-sorted-sort) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get sorted with sort at the command line +====== +Reorganize your data in a format that makes sense to you—right from the +Linux, BSD, or Mac terminal—with the sort command. +![Coding on a computer][1] + +If you've ever used a spreadsheet application, then you know that rows can be sorted by the contents of a column. For instance, if you have a list of expenses, you might want to sort them by date or by ascending price or by category, and so on. If you're comfortable using a terminal, you may not want to have to use a big office application just to sort text data. And that's exactly what the [**sort**][2] command is for. + +### Installing + +You don't need to install **sort** because it's invariably included on any [POSIX][3] system. On most Linux systems, the **sort** command is bundled in a collection of utilities from the GNU organization. On other POSIX systems, such as BSD and Mac, the default **sort** command is not from GNU, so some options may differ. I'll attempt to account for both GNU and BSD implementations in this article. + +### Sort lines alphabetically + +The **sort** command, by default, looks at the first character of each line of a file and outputs each line in ascending alphabetic order. In the event that two characters on multiple lines are the same, it considers the next character. For example: + + +``` +$ cat distro.list +Slackware +Fedora +Red Hat Enterprise Linux +Ubuntu +Arch +1337 +Mint +Mageia +Debian +$ sort distro.list +1337 +Arch +Debian +Fedora +Mageia +Mint +Red Hat Enterprise Linux +Slackware +Ubuntu +``` + +Using **sort** doesn't change the original file. Sort is a filter, so if you want to preserve your data in its sorted form, you must redirect the output using either **>** or **tee**: + + +``` +$ sort distro.list | tee distro.sorted +1337 +Arch +Debian +[...] +$ cat distro.sorted +1337 +Arch +Debian +[...] +``` + +### Sort by column + +Complex data sets sometimes need to be sorted by something other than the first letter of each line. Imagine, for instance, a list of animals and each one's species and genus, and each "field" (a "cell" in a spreadsheet) is defined by a predictable delimiter character. This is such a common data format for spreadsheet exports that the CSV (comma-separated values) file extension exists to identify such files (although a CSV file doesn't have to be comma-separated, nor does a delimited file have to use the CSV extension to be valid and usable). Consider this example data set: + + +``` +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Pygoscelis;papua;Wagler;1832;Gentoo +Eudyptula;minor;Bonaparte;1867;Little Blue +Spheniscus;demersus;Brisson;1760;African +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Southern Rockhopper +Torvaldis;linux;Ewing,L;1996;Tux +``` + +Given this sample data set, you can use the **\--field-separator** (use **-t** on BSD and Mac—or on GNU to reduce typing) option to set the delimiting character to a semicolon (because this example uses semicolons instead of commas, but it could use any character), and use the **\--key** (**-k** on BSD and Mac or on GNU to reduce typing) option to define which field to sort by. For example, to sort by the second field (starting at 1, not 0) of each line: + + +``` +sort --field-separator=";" --key=2 +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Spheniscus;demersus;Brisson;1760;African +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Torvaldis;linux;Ewing,L;1996;Tux +Eudyptula;minor;Bonaparte;1867;Little Blue +Pygoscelis;papua;Wagler;1832;Gentoo +``` + +That's somewhat difficult to read, but Unix is famous for its _pipe_ method of constructing commands, so you can use the **column** command to "prettify" the output. Using GNU **column**: + + +``` +$ sort --field-separator=";" \ +\--key=2 penguins.list | \ +column --table --separator ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +Slightly more cryptic to the new user (but shorter to type), the command options on BSD and Mac: + + +``` +$ sort -t ";" \ +-k2 penguins.list | column -t -s ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +The **key** definition doesn't have to be set to **2**, of course. Any existing field may be used as the sorting key. + +### Reverse sort + +You can reverse the order of a sorted list with the **\--reverse** (**-r** on BSD or Mac or GNU for brevity): + + +``` +$ sort --reverse alphabet.list +z +y +x +w +[...] +``` + +You can achieve the same result by piping the output of a normal sort through [tac][4]. + +### Sorting by month (GNU only) + +In a perfect world, everyone would write dates according to the ISO 8601 standard: year, month, day. It's a logical method of specifying a unique date, and it's easy for computers to understand. And yet quite often, humans use other means of identifying dates, including months with pretty arbitrary names. + +Fortunately, the GNU **sort** command accounts for this and is able to sort correctly by month name. Use the **\--month-sort** (**-M**) option: + + +``` +$ cat month.list +November +October +September +April +[...] +$ sort --month-sort month.list +January +February +March +April +May +[...] +November +December +``` + +Months may be identified by their full name or some portion of their names. + +### Human-readable numeric sort (GNU only) + +Another common point of confusion between humans and computers is groups of numbers. For instance, humans often write "1024 kilobytes" as "1KB" because it's easier and quicker for the human brain to parse "1KB" than "1024" (and it gets easier the larger the number becomes). To a computer, though, a string such as 9KB is larger than, for instance, 1MB (even though 9KB is only a fraction of a megabyte). The GNU **sort** command provides the **\--human-numeric-sort** (**-h**) option to help parse these values correctly. + + +``` +$ cat sizes.list +2M +12MB +1k +9k +900 +7000 +$ sort --human-numeric-sort +900 +7000 +1k +9k +2M +12MB +``` + +There are some inconsistencies. For example, 16,000 bytes is greater than 1KB, but **sort** fails to recognize that: + + +``` +$ cat sizes0.list +2M +12MB +16000 +1k +$ sort -h sizes0.list +16000 +1k +2M +12MB +``` + +Logically, 16,000 should be written 16KB in this context, so GNU **sort** is not entirely to blame. As long as you are sure that your numbers are consistent, the **\--human-numeric-sort** can help parse human-readable numbers in a computer-friendly way. + +### Randomized sort (GNU only) + +Sometimes utilities provide the option to do the opposite of what they're meant to do. In a way, it makes no sense for a **sort** command to have the ability to "sort" a file randomly. Then again, the workflow of the command makes it a convenient feature to have. You _could_ use a different command, like [**shuf**][5], or you could just add an option to the command you're using. Whether it's bloat or ingenious UX design, the GNU **sort** command provides the means to sort a file arbitrarily. + +The purest form of arbitrary sorting is the **\--random-sort** or **-R** option (not to be confused with the **-r** option, which is short for **\--reverse**). + + +``` +$ sort --random-sort alphabet.list +d +m +p +a +[...] +``` + +You can run a random sort multiple times on a file for different results each time. + +### Sorted + +There are many more features available with the **sort** GNU and BSD commands, so spend some time getting to know the options. You'll be surprised at how flexible **sort** can be, especially when it's combined with other Unix utilities. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/get-sorted-sort + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://en.wikipedia.org/wiki/Sort_(Unix) +[3]: https://en.wikipedia.org/wiki/POSIX +[4]: https://opensource.com/article/19/9/tac-command +[5]: https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html diff --git a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md new file mode 100644 index 0000000000..60f5d8f421 --- /dev/null +++ b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source CMS Ghost 3.0 Released with New features for Publishers) +[#]: via: (https://itsfoss.com/ghost-3-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Open Source CMS Ghost 3.0 Released with New features for Publishers +====== + +[Ghost][1] is a free and open source content management system (CMS). If you are not aware of the term, a CMS is a software that allows you to build a website that is primarily focused on creating content without knowledge of HTML and other web-related technologies. + +Ghost is in fact one of the [best open source CMS][2] out there. It’s main focus is on creating lightweight, fast loading and good looking blogs. + +It has a modern intuitive editor with built-in SEO features. You also have native desktop (Linux including) and mobile apps. If you like terminal, you can also use the CLI tools it provides. + +Let’s see what new feature Ghost 3.0 brings. + +### New Features in Ghost 3.0 + +![][3] + +I’m usually intrigued by open source CMS solutions – so after reading the official announcement post, I went ahead and gave it a try by installing a new Ghost instance via [Digital Ocean cloud server][4]. + +I was really impressed with the improvements they’ve made with the features and the UI compared to the previous version. + +Here, I shall list out the key changes/additions worth mentioning. + +#### Bookmark Cards + +![][5] + +In addition to all the subtle change to the editor, it now lets you add a beautiful bookmark card by just entering the URL. + +If you have used WordPress – you may have noticed that you need to have a plugin in order to add a card like that – so it is definitely a useful addition in Ghost 3.0. + +#### Improved WordPress Migration Plugin + +I haven’t tested this in particular but they have updated their WordPress migration plugin to let you easily clone the posts (with images) to Ghost CMS. + +Basically, with the plugin, you will be able to create an archive (with images) and import it to Ghost CMS. + +#### Responsive Image Galleries & Images + +To make the user experience better, they have also updated the image galleries (which is now responsive) to present your picture collection comfortably across all devices. + +In addition, the images in post/pages are now responsive as well. + +#### Members & Subscriptions option + +![Ghost Subscription Model][6] + +Even though the feature is still in the beta phase, it lets you add members and a subscription model for your blog if you choose to make it a premium publication to sustain your business. + +With this feature, you can make sure that your blog can only be accessed by the subscribed members or choose to make it available to the public in addition to the subscription. + +#### Stripe: Payment Integration + +It supports Stripe payment gateway by default to help you easily enable the subscription (or any type of payments) with no additional fee charged by Ghost. + +#### New App Integrations + +![][7] + +You can now integrate a variety of popular applications/services with your blog on Ghost 3.0. It could come in handy to automate a lot of things. + +#### Default Theme Improvement + +The default theme (design) that comes baked in has improved and now offers a dark mode as well. + +You can always choose to create a custom theme as well (if not pre-built themes available). + +#### Other Minor Improvements + +In addition to all the key highlights, the visual editor to create posts/pages has improved as well (with some drag and drop capabilities). + +I’m sure there’s a lot of technical changes as well – which you can check it out in their [changelog][8] if you’re interested. + +### Ghost is gradually getting good traction + +It’s not easy to make your mark in a world dominated by WordPress. But Ghost has gradually formed a dedicated community of publishers around it. + +Not only that, their managed hosting service [Ghost Pro][9] now has customers like NASA, Mozilla and DuckDuckGo. + +In last six years, Ghost has made $5 million in revenue from their Ghost Pro customers . Considering that they are a non-profit organization working on open source solution, this is indeed an achievement. + +This helps them remain independent by avoiding external funding from venture capitalists. The more customers for managed Ghost CMS hosting, the more funds goes into the development of the free and open source CMS. + +Overall, Ghost 3.0 is by far the best upgrade they’ve offered. I’m personally impressed with the features. + +If you have websites of your own, what CMS do you use? Have you ever used Ghost? How’s your experience with it? Do share your thoughts in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ghost-3-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://itsfoss.com/recommends/ghost/ +[2]: https://itsfoss.com/open-source-cms/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-3.jpg?ssl=1 +[4]: https://itsfoss.com/recommends/digital-ocean/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-editor-screenshot.png?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-subscription-model.jpg?resize=800%2C503&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-app-integration.jpg?ssl=1 +[8]: https://ghost.org/faq/upgrades/ +[9]: https://itsfoss.com/recommends/ghost-pro/ diff --git a/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md b/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md new file mode 100644 index 0000000000..89d6ef1acf --- /dev/null +++ b/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Five Most Popular Operating Systems for the Internet of Things) +[#]: via: (https://opensourceforu.com/2019/10/the-five-most-popular-operating-systems-for-the-internet-of-things/) +[#]: author: (K S Kuppusamy https://opensourceforu.com/author/ks-kuppusamy/) + +The Five Most Popular Operating Systems for the Internet of Things +====== + +[![][1]][2] + +_Connecting every ‘thing’ that we see around us to the Internet is the fundamental idea of the Internet of Things (IoT). There are many operating systems to get the best out of the things that are connected to the Internet. This article explores four popular operating systems for IoT — Ubuntu Core, RIOT, Contiki and TinyOS._ + +To say that life is running on the Internet these days is not an exaggeration due to the number and variety of services that we consume on the Net. These services span multiple domains such as information, financial services, social networking and entertainment. As this list grows longer, it becomes imperative that we do not restrict the types of devices that can connect to the Internet. The Internet of Things (IoT) facilitates connecting various types of ‘things’ to the Internet infrastructure. By connecting a device or thing to the Internet, these things get the ability to not only interact with the user but also between themselves. This feature of a variety of things interacting among themselves to assist users in a pervasive manner constitutes an interesting phenomenon called ambient intelligence. + +![Figure 1: IoT application domains][3] + +IoT is becoming increasingly popular as the types of devices that can be connected to it are becoming more diverse. The nature of applications is also evolving. Some of the popular domains in which IoT is getting used increasingly are listed below (Figure 1): + + * Smart homes + * Smart cities + * Smart agriculture + * Connected automobiles + * Smart shopping + * Connected health + + + +![Figure 2: IoT operating system features][4] + +As the application domains become diverse, the need to manage the IoT infrastructure efficiently is also becoming more important. The operating systems in normal computers perform the primary functions such as resource management, user interaction, etc. The requirements of IoT operating systems are specialised due to the nature and size of the devices involved in the process. Some of the important characteristics/requirements of IoT operating systems are listed below (Figure 2): + + * A tiny memory footprint + * Energy efficiency + * Connectivity features + * Hardware-agnostic operations + * Real-time processing requirements + * Security requirements + * Application development ecosystem + + + +As of 2019, there is a spectrum of choices for selecting the operating system (OS) for the Internet of Things. Some of these OSs are shown in Figure 3. + +![Figure 3: IoT operating systems][5] + +**Ubuntu Core** +As Ubuntu is a popular Linux distribution, the Ubuntu Core IoT offering has also become popular. Ubuntu Core is a secure and lightweight OS for IoT, and is designed with a ‘security first’ philosophy. According to the official documentation, the entire system has been redesigned to focus on security from the first boot. There is a detailed white paper available on Ubuntu Core’s security features. It can be accessed at _ -ubuntu-core-security-whitepaper.pdf?_ga=2.74563154.1977628533. 1565098475-2022264852.1565098475_. + +Ubuntu Core has been made tamper-resistant. As the applications may be from diverse sources, they are given privileges for only their own data. This has been done so that one poorly designed app does not make the entire system vulnerable. Ubuntu Core is ‘built for business’, which means that the developers can focus directly on the application at hand, while the other requirements are supported by the default operating system. + +Another important feature of Ubuntu Core is the availability of a secure app store, which you can learn more about at __. There is a ready-to-go software ecosystem that makes using Ubuntu Core simple. + +The official documentation lists various successful case studies about how Ubuntu Core has been successfully used. + +**RIOT** +RIOT is a user-friendly OS for the Internet of Things. This FOSS OS has been developed by a number of people from around the world. +RIOT supports many low-power IoT devices. It has support for various microcontroller architectures. The official documentation lists the following reasons for using the RIOT OS. + + * _**It is developer friendly:**_ It supports the standard environments and tools so that developers need not go through a steep learning curve. Standard programming languages such as C or C++ are supported. The hardware dependent code is very minimal. Developers can code once and then run their code on 8-bit, 16-bit and 32-bit platforms. + * _**RIOT is resource friendly:**_ One of the important features of RIOT is its ability to support lightweight devices. It enables maximum energy efficiency. It supports multi-threading with very little overhead for threading. + * _**RIOT is IoT friendly:**_ The common system support provided by RIOT makes it a very important choice for IoT. It has support for CoAP, CBOR, high resolution and long-term timers. + + + +**Contiki** +Contiki is an important OS for IoT. It facilitates connecting tiny, low-cost and low-energy devices to the Internet. +The prominent reasons for choosing the Contiki OS are as follows. + + * _**Internet standards:**_ The Contiki OS supports the IPv6 and IPv4 standards, in addition to the low-power 6lowpan, RPL and CoAP standards. + * _**Support for a variety of hardware:**_ Contiki can be run on a variety of low-power devices, which are easily available online. + * _**Large community support:**_ One of the important advantages of using Contiki is the availability of an active community of developers. So when you have some technical issues to be solved, these community members make the problem solving process simple and effective. + + + +The major features of Contiki are listed below. + + * _**Memory allocation:**_ Even the tiny systems with only a few kilobytes of memory can also use Contiki. Its memory efficiency is an important feature. + * _**Full IP networking:**_ The Contiki OS offers a full IP network stack. This includes major standard protocols such as UDP, TCP, HTTP, 6lowpan, RPL, CoAP, etc. + * _**Power awareness:**_ The ability to assess the power requirements and to use them in an optimal minimal manner is an important feature of Contiki. + * The Cooja network simulator makes the process of developing and debugging software easier. + * The availability of the Coffee Flash file system and the Contiki shell makes the file handling and command execution simpler and more effective. + + + +**TinyOS** +TinyOS is an open source operating system designed for low-power wireless devices. It has a vibrant community of users spread across the world from both academia and industry. The popularity of TinyOS can be understood from the fact that it gets downloaded more than 35,000 times in a year. +TinyOS is very effectively used in various scenarios such as sensor networks, smart buildings, smart meters, etc. The main repository of TinyOS is available at . +TinyOS is written in nesC which is a dialect of C. A sample code snippet is shown below: + +``` +configuration Led { +provides { +interface LedControl; +} +uses { +interface Gpio; +} +} +implementation { + +command void LedControl.turnOn() { +call Gpio.set(); +} + +command void LedControl.turnOff() { +call Gpio.clear(); +} + +} +``` + +**Zephyr** +Zephyr is a real-time OS that supports multiple architectures and is optimised for resource-constrained environments. Security is also given importance in the Zephyr design. + +The prominent features of Zephyr are listed below: + + * Support for 150+ boards. + * Complete flexibility and freedom of choice. + * Can handle small footprint IoT devices. + * Can develop products with built-in security features. + + + +This article has introduced readers to a list of four OSs for the IoT, from which they can select the ideal one, based on individual requirements. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-five-most-popular-operating-systems-for-the-internet-of-things/ + +作者:[K S Kuppusamy][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://opensourceforu.com/author/ks-kuppusamy/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/OS-for-IoT.jpg?resize=696%2C647&ssl=1 (OS for IoT) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/OS-for-IoT.jpg?fit=800%2C744&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-IoT-application-domains.jpg?resize=350%2C107&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-IoT-operating-system-features.jpg?resize=350%2C93&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-IoT-operating-systems.jpg?resize=350%2C155&ssl=1 diff --git a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md new file mode 100644 index 0000000000..196d4f40ea --- /dev/null +++ b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for October 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +4 cool new projects to try in COPR for October 2019 +====== + +![][1] + +[COPR][2] is a collection of personal repositories for software that isn’t carried in Fedora. Some software doesn’t conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isn’t supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software. + +This article presents a few new and interesting projects in COPR. If you’re new to using COPR, see the [COPR User Documentation][3] for how to get started. + +### Nu + +[Nu][4], or Nushell, is a shell inspired by PowerShell and modern CLI tools. Using a structured data based approach, Nu makes it easy to work with commands that output data, piping through other commands. The results are then displayed in tables that can be sorted or filtered easily and may serve as inputs for further commands. Finally, Nu provides several builtin commands, multiple shells and support for plugins. + +#### Installation instructions + +The [repo][5] currently provides Nu for Fedora 30, 31 and Rawhide. To install Nu, use these commands: + +``` +sudo dnf copr enable atim/nushell +sudo dnf install nushell +``` + +### NoteKit + +[NoteKit][6] is a program for note-taking. It supports Markdown for formatting notes, and the ability to create hand-drawn notes using mouse. In NoteKit, notes are sorted and organized in a tree structure. + +#### Installation instructions + +The [repo][7] currently provides NoteKit for Fedora 29, 30, 31 and Rawhide. To install NoteKit, use these commands: + +``` +sudo dnf copr enable lyessaadi/notekit +sudo dnf install notekit +``` + +### Crow Translate + +[Crow Translate][8] is a program for translating. It can translate text as well as speak both the input and result, and offers a command line interface as well. For translation, Crow Translate uses Google, Yandex or Bing translate API. + +#### Installation instructions + +The [repo][9] currently provides Crow Translate for Fedora 30, 31 and Rawhide, and for Epel 8. To install Crow Translate, use these commands: + +``` +sudo dnf copr enable faezebax/crow-translate +sudo dnf install crow-translate +``` + +### dnsmeter + +[dnsmeter][10] is a command-line tool for testing performance of a nameserver and its infrastructure. For this, it sends DNS queries and counts the replies, measuring various statistics. Among other features, dnsmeter can use different load steps, use payload from PCAP files and spoof sender addresses. + +#### Installation instructions + +The repo currently provides dnsmeter for Fedora 29, 30, 31 and Rawhide, and EPEL 7. To install dnsmeter, use these commands: + +``` +sudo dnf copr enable @dnsoarc/dnsmeter +sudo dnf install dnsmeter +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/ + +作者:[Dominik Turecek][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html# +[4]: https://github.com/nushell/nushell +[5]: https://copr.fedorainfracloud.org/coprs/atim/nushell/ +[6]: https://github.com/blackhole89/notekit +[7]: https://copr.fedorainfracloud.org/coprs/lyessaadi/notekit/ +[8]: https://github.com/crow-translate/crow-translate +[9]: https://copr.fedorainfracloud.org/coprs/faezebax/crow-translate/ +[10]: https://github.com/DNS-OARC/dnsmeter diff --git a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md new file mode 100644 index 0000000000..08dd80f053 --- /dev/null +++ b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I used the wget Linux command to recover lost images) +[#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How I used the wget Linux command to recover lost images +====== +The story of the rise and fall of the Open Clip Art Library and the +birth of FreeSVG.org, a new library of communal artwork. +![White shoes on top of an orange tribal pattern][1] + +In 2004, the Open Clip Art Library (OCAL) was launched as a source of free illustrations for anyone to use, for any purpose, without requiring attribution or anything in return. This site was the open source world’s answer to the big stacks of clip art CDs on the shelf of every home office in the 1990s, and to the art dumps provided by the closed-source office and artistic software titles. + +In the beginning, the clip art library consisted mostly of work by a few contributors, but in 2010 it went live with a brand new interactive website, allowing anyone to create and contribute clip art with a vector illustration application. The site immediately garnered contributions from around the globe, and from all manner of free software and free culture projects. A special importer for this library was even included in [Inkscape][2]. + +However, in early 2019, the website hosting the Open Clip Art Library went offline with no warning or explanation. Its community, which had grown to number in the thousands, assumed at first that this was a temporary glitch. The site remained offline, however, for over six months without any clear explanation of what had happened. + +Rumors started to swell. The site was being updated ("There is years of technical debt to pay off," said site developer Jon Philips in an email). The site had fallen to rampant DDOS attacks, claimed a Twitter account. The maintainer had fallen prey to identity theft, another Twitter account claimed. Today, as of this writing, the site’s one and only remaining page declares that it is in "maintenance and protected mode," the meaning of which is unclear, except that users cannot access its content. + +### Recovering the commons + +Sites appear and disappear over the course of time, but the loss of the Open Clip Art Library was particularly surprising to its community because it was seen as a community project. Few community members understood that the site hosting the library had fallen into the hands of a single maintainer, so while the artwork in the library was owned by everyone due to its [Creative Commons 0 License][3], access to it was functionally owned by a single maintainer. And, because the site’s community kept in touch with one another through the site, that same maintainer effectively owned the community. + +When the site failed, the community lost access to its artwork as well as each other. And without the site, there was no community. + +Initially, everything on the site was blocked when it went down. After several months, though, users started recognizing that the site’s database was still online, which meant that a user could access an individual art file by entering its exact URL. In other words, you couldn’t navigate to the art file through clicking around a website, but if you already knew the address, then you could bring it up in your browser. Similarly, technical (or lazy) users realized it was also possible to "scrape" the site with an automated web browser like **wget**. + +The **wget** Linux command is _technically_ a web browser, although it doesn’t let you browse interactively the way you do with Firefox. Instead, **wget** goes out onto the internet and retrieves a file or a collection of files and downloads them to your hard drive. You can then open those files in Firefox or a text editor, or whatever application is most appropriate, and view the content. + +Usually, **wget** needs to know a specific file to fetch. If you’re on Linux or macOS with **wget** installed, you can try this process by downloading the index page for [example.com][4]: + + +``` +$ wget example.org/index.html +[...] +$ tail index.html + +<body><div> +    <h1>Example Domain</h1> +    <p>This domain is for illustrative examples in documents. +    You may use this domain in examples without permission.</p> +        <p><a href="[http://www.iana.org/domains/example"\>More][5] info</a></p> +</div></body></html> +``` + +To scrape the Open Clip Art Library, I used the **\--mirror** option, so that I could point **wget** to just the directory containing the artwork so it could download everything within that directory. This action resulted in four straight days (96 hours) of constant downloading, ending with an excess of 100,000 SVG files that had been contributed by over 5,000 community members. Unfortunately, the author of any file that did not have proper metadata was irrecoverable because this information was locked in inaccessible files in the database, but the CC0 license meant that this issue _technically_ didn’t matter (because no attribution is required with CC0 files). + +A casual analysis of the downloaded files also revealed that nearly 45,000 of them were copies of the same single file (the site’s logo). This was caused by redirects pointing to the site's logo (for reasons unknown), and careful parsing could extract the original destination. Another 96 hours, and all clip art posted on OCAL up to its last day was recovered: **a total of about 156,000 images.** + +SVG files tend to be small, but this is still an enormous amount of work that poses a few very real problems. First of all, several gigabytes of online storage would be needed so the artwork could be made available to its former community. Secondly, a means of searching the artwork would be necessary, because it’s just not realistic to browse through 55,000 files manually. + +It became apparent that what the community really needed was a platform. + +### Building a new platform + +For some time, the site [Public Domain Vectors][6] had been publishing vector art that was in the public domain. While it remains a popular site, open source users often used it only as a secondary source of art because most of the files there were in the EPS and AI formats, both of which are associated with Adobe. Both file formats can generally be converted to SVG but at a loss of features. + +When the Public Domain Vectors site’s maintainers (Vedran and Boris) heard about the loss of the Open Clip Art Library, they decided to create a site oriented toward the open source community. True to form, they chose the open source [Laravel][7] framework as the backend, which provided the site with an admin dashboard and user access. The framework, being robust and well-developed, also allowed them to respond quickly to bug reports and feature requests, and to upgrade the site as needed. The site they are building is called [FreeSVG.org][8], and is already a robust and thriving library of communal artwork. + +Since then they have been uploading all of the clip art from the Open Clip Art Library, and they're even diligently tagging and categorizing the art as they go. As creators of Public Domain Vectors, they are also contributing their own images in SVG format. Their aim is to become the primary resource for SVG images with a CC0 license on the internet. + +### Contributing + +The maintainers of [FreeSVG.org][8] are aware that they have inherited significant stewardship. They are working to title and describe all images on the site so that users can easily find artwork, and will provide this file to the community once it is ready, believing strongly that the metadata about the art belongs to the people that create and use the art as much as the art itself does. They're also aware that unforeseen circumstances can arise, so they create regular backups of their site and content, and intend to make the most recent backup available to the public, should their site fail. + +If you want to add to the Creative Commons content of [FreeSVG.org][9], then download [Inkscape][10] and start drawing. There’s plenty of public domain artwork out there in the world, like [historical advertisements][11], [tarot cards][12], and [storybooks][13] just waiting to be converted to SVG, so you can contribute even if you aren’t confident in your drawing skills. Visit the [FreeSVG forum][14] to connect with and support other contributors. + +The concept of the _commons_ is important. [Creative Commons benefits everyone][15], whether you’re a student, teacher, librarian, small business owner, or CEO. If you don’t contribute directly, then you can always help promote it. + +That’s a strength of free culture: It doesn’t just scale, it gets better when more people participate. + +### Hard lessons learned + +From the demise of the Open Clip Art Library to the rise of FreeSVG.org, the open culture community has learned several hard lessons. For posterity, here are the ones that I believe are most important. + +#### Maintain your metadata + +If you’re a content creator, help the archivists of the future and add metadata to your files. Most image, music, font, and video file formats can have EXIF data embedded into them, and others have metadata entry interfaces in the applications that create them. Be diligent in tagging your work with your name, website or public email, and license. + +#### Make copies + +Don’t assume that somebody else is doing backups. If you care about communal digital content, then back it up yourself, or else don’t count on having it available forever. The trope that _whatever’s uploaded to the internet is forever_ may be true, but that doesn’t mean it’s _available to you_ forever. If the Open Clip Art Library files hadn’t become secretly available again, it’s unlikely that anyone would have ever successfully uncovered all 55,000 images from random places on the web, or from personal stashes on people’s hard drives around the globe. + +#### Create external channels + +If a community is defined by a single website or physical location, then that community is as good as dissolved should it lose access to that space. If you’re a member of a community that’s driven by a single organization or site, you owe it to yourselves to share contact information with those you care about and to establish a channel for communication even when that site is not available. + +For example, [Opensource.com][16] itself maintains mailing lists and other off-site channels for its authors and correspondents to communicate with one another, with or without the intervention or even existence of the website. + +#### Free culture is worth working for + +The internet is sometimes seen as a lazy person’s social club. You can log on when you want and turn it off when you’re tired, and you can wander into whatever social circle you want. + +But in reality, free culture can be hard work. It’s not hard in the sense that it’s difficult to be a part of, but it’s something you have to work to maintain. If you ignore the community you’re in, then the community may wither and fade before you realize it. + +Take a moment to look around you and identify what communities you’re a part of, and if nothing else, tell someone that you appreciate what they bring to your life. And just as importantly, keep in mind that you’re contributing to the lives of your communities, too. + +Creative Commons held its Gl obal Summit a few weeks ago in Warsaw, with amazing international... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons + +作者:[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/tribal_pattern_shoes.png?itok=e5dSf2hS (White shoes on top of an orange tribal pattern) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[4]: http://example.com +[5]: http://www.iana.org/domains/example"\>More +[6]: http://publicdomainvectors.org +[7]: https://github.com/viralsolani/laravel-adminpanel +[8]: https://freesvg.org +[9]: http://freesvg.org +[10]: http://inkscape.org +[11]: https://freesvg.org/drinking-coffee-vector-drawing +[12]: https://freesvg.org/king-of-swords-tarot-card +[13]: https://freesvg.org/space-pioneers-135-scene-vector-image +[14]: http://forum.freesvg.org/ +[15]: https://opensource.com/article/18/1/creative-commons-real-world +[16]: http://Opensource.com diff --git a/sources/tech/20191025 Understanding system calls on Linux with strace.md b/sources/tech/20191025 Understanding system calls on Linux with strace.md new file mode 100644 index 0000000000..7628cfa545 --- /dev/null +++ b/sources/tech/20191025 Understanding system calls on Linux with strace.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding system calls on Linux with strace) +[#]: via: (https://opensource.com/article/19/10/strace) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Understanding system calls on Linux with strace +====== +Trace the thin layer between user processes and the Linux kernel with +strace. +![Hand putting a Linux file folder into a drawer][1] + +A system call is a programmatic way a program requests a service from the kernel, and **strace** is a powerful tool that allows you to trace the thin layer between user processes and the Linux kernel. + +To understand how an operating system works, you first need to understand how system calls work. One of the main functions of an operating system is to provide abstractions to user programs. + +An operating system can roughly be divided into two modes: + + * **Kernel mode:** A privileged and powerful mode used by the operating system kernel + * **User mode:** Where most user applications run + + + +Users mostly work with command-line utilities and graphical user interfaces (GUI) to do day-to-day tasks. System calls work silently in the background, interfacing with the kernel to get work done. + +System calls are very similar to function calls, which means they accept and work on arguments and return values. The only difference is that system calls enter a kernel, while function calls do not. Switching from user space to kernel space is done using a special [trap][2] mechanism. + +Most of this is hidden away from the user by using system libraries (aka **glibc** on Linux systems). Even though system calls are generic in nature, the mechanics of issuing a system call are very much machine-dependent. + +This article explores some practical examples by using some general commands and analyzing the system calls made by each command using **strace**. These examples use Red Hat Enterprise Linux, but the commands should work the same on other Linux distros: + + +``` +[root@sandbox ~]# cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.7 (Maipo) +[root@sandbox ~]# +[root@sandbox ~]# uname -r +3.10.0-1062.el7.x86_64 +[root@sandbox ~]# +``` + +First, ensure that the required tools are installed on your system. You can verify whether **strace** is installed using the RPM command below; if it is, you can check the **strace** utility version number using the **-V** option: + + +``` +[root@sandbox ~]# rpm -qa | grep -i strace +strace-4.12-9.el7.x86_64 +[root@sandbox ~]# +[root@sandbox ~]# strace -V +strace -- version 4.12 +[root@sandbox ~]# +``` + +If that doesn't work, install **strace** by running: + + +``` +`yum install strace` +``` + +For the purpose of this example, create a test directory within **/tmp** and create two files using the **touch** command using: + + +``` +[root@sandbox ~]# cd /tmp/ +[root@sandbox tmp]# +[root@sandbox tmp]# mkdir testdir +[root@sandbox tmp]# +[root@sandbox tmp]# touch testdir/file1 +[root@sandbox tmp]# touch testdir/file2 +[root@sandbox tmp]# +``` + +(I used the **/tmp** directory because everybody has access to it, but you can choose another directory if you prefer.) + +Verify that the files were created using the **ls** command on the **testdir** directory: + + +``` +[root@sandbox tmp]# ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +You probably use the **ls** command every day without realizing system calls are at work underneath it. There is abstraction at play here; here's how this command works: + + +``` +`Command-line utility -> Invokes functions from system libraries (glibc) -> Invokes system calls` +``` + +The **ls** command internally calls functions from system libraries (aka **glibc**) on Linux. These libraries invoke the system calls that do most of the work. + +If you want to know which functions were called from the **glibc** library, use the **ltrace** command followed by the regular **ls testdir/** command: + + +``` +`ltrace ls testdir/` +``` + +If **ltrace** is not installed, install it by entering: + + +``` +`yum install ltrace` +``` + +A bunch of output will be dumped to the screen; don't worry about it—just follow along. Some of the important library functions from the output of the **ltrace** command that are relevant to this example include: + + +``` +opendir("testdir/")                                  = { 3 } +readdir({ 3 })                                       = { 101879119, "." } +readdir({ 3 })                                       = { 134, ".." } +readdir({ 3 })                                       = { 101879120, "file1" } +strlen("file1")                                      = 5 +memcpy(0x1665be0, "file1\0", 6)                      = 0x1665be0 +readdir({ 3 })                                       = { 101879122, "file2" } +strlen("file2")                                      = 5 +memcpy(0x166dcb0, "file2\0", 6)                      = 0x166dcb0 +readdir({ 3 })                                       = nil +closedir({ 3 })                       +``` + +By looking at the output above, you probably can understand what is happening. A directory called **testdir** is being opened by the **opendir** library function, followed by calls to the **readdir** function, which is reading the contents of the directory. At the end, there is a call to the **closedir** function, which closes the directory that was opened earlier. Ignore the other **strlen** and **memcpy** functions for now. + +You can see which library functions are being called, but this article will focus on system calls that are invoked by the system library functions. + +Similar to the above, to understand what system calls are invoked, just put **strace** before the **ls testdir** command, as shown below. Once again, a bunch of gibberish will be dumped to your screen, which you can follow along with here: + + +``` +[root@sandbox tmp]# strace ls testdir/ +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +brk(NULL)                               = 0x1f12000 +<<< truncated strace output >>> +write(1, "file1  file2\n", 13file1  file2 +)          = 13 +close(1)                                = 0 +munmap(0x7fd002c8d000, 4096)            = 0 +close(2)                                = 0 +exit_group(0)                           = ? ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +The output on the screen after running the **strace** command was simply system calls made to run the **ls** command. Each system call serves a specific purpose for the operating system, and they can be broadly categorized into the following sections: + + * Process management system calls + * File management system calls + * Directory and filesystem management system calls + * Other system calls + + + +An easier way to analyze the information dumped onto your screen is to log the output to a file using **strace**'s handy **-o** flag. Add a suitable file name after the **-o** flag and run the command again: + + +``` +[root@sandbox tmp]# strace -o trace.log ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +This time, no output dumped to the screen—the **ls** command worked as expected by showing the file names and logging all the output to the file **trace.log**. The file has almost 100 lines of content just for a simple **ls** command: + + +``` +[root@sandbox tmp]# ls -l trace.log +-rw-r--r--. 1 root root 7809 Oct 12 13:52 trace.log +[root@sandbox tmp]# +[root@sandbox tmp]# wc -l trace.log +114 trace.log +[root@sandbox tmp]# +``` + +Take a look at the first line in the example's trace.log: + + +``` +`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` +``` + + * The first word of the line, **execve**, is the name of a system call being executed. + * The text within the parentheses is the arguments provided to the system call. + * The number after the **=** sign (which is **0** in this case) is a value returned by the **execve** system call. + + + +The output doesn't seem too intimidating now, does it? And you can apply the same logic to understand other lines. + +Now, narrow your focus to the single command that you invoked, i.e., **ls testdir**. You know the directory name used by the command **ls**, so why not **grep** for **testdir** within your **trace.log** file and see what you get? Look at each line of the results in detail: + + +``` +[root@sandbox tmp]# grep testdir trace.log +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0 +openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 +[root@sandbox tmp]# +``` + +Thinking back to the analysis of **execve** above, can you tell what this system call does? + + +``` +`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` +``` + +You don't need to memorize all the system calls or what they do, because you can refer to documentation when you need to. Man pages to the rescue! Ensure the following package is installed before running the **man** command: + + +``` +[root@sandbox tmp]# rpm -qa | grep -i man-pages +man-pages-3.53-5.el7.noarch +[root@sandbox tmp]# +``` + +Remember that you need to add a **2** between the **man** command and the system call name. If you read **man**'s man page using **man man**, you can see that section 2 is reserved for system calls. Similarly, if you need information on library functions, you need to add a **3** between **man** and the library function name. + +The following are the manual's section numbers and the types of pages they contain: + + +``` +1\. Executable programs or shell commands +2\. System calls (functions provided by the kernel) +3\. Library calls (functions within program libraries) +4\. Special files (usually found in /dev) +``` + +Run the following **man** command with the system call name to see the documentation for that system call: + + +``` +`man 2 execve` +``` + +As per the **execve** man page, this executes a program that is passed in the arguments (in this case, that is **ls**). There are additional arguments that can be provided to **ls**, such as **testdir** in this example. Therefore, this system call just runs **ls** with **testdir** as the argument: + + +``` +'execve - execute program' + +'DESCRIPTION +       execve()  executes  the  program  pointed to by filename' +``` + +The next system call, named **stat**, uses the **testdir** argument: + + +``` +`stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0` +``` + +Use **man 2 stat** to access the documentation. **stat** is the system call that gets a file's status—remember that everything in Linux is a file, including a directory. + +Next, the **openat** system call opens **testdir.** Keep an eye on the **3** that is returned. This is a file description, which will be used by later system calls: + + +``` +`openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3` +``` + +So far, so good. Now, open the **trace.log** file and go to the line following the **openat** system call. You will see the **getdents** system call being invoked, which does most of what is required to execute the **ls testdir** command. Now, **grep getdents** from the **trace.log** file: + + +``` +[root@sandbox tmp]# grep getdents trace.log +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +[root@sandbox tmp]# +``` + +The **getdents** man page describes it as **get directory entries**, which is what you want to do. Notice that the argument for **getdents** is **3**, which is the file descriptor from the **openat** system call above. + +Now that you have the directory listing, you need a way to display it in your terminal. So, **grep** for another system call, **write**, which is used to write to the terminal, in the logs: + + +``` +[root@sandbox tmp]# grep write trace.log +write(1, "file1  file2\n", 13)          = 13 +[root@sandbox tmp]# +``` + +In these arguments, you can see the file names that will be displayed: **file1** and **file2**. Regarding the first argument (**1**), remember in Linux that, when any process is run, three file descriptors are opened for it by default. Following are the default file descriptors: + + * 0 - Standard input + * 1 - Standard out + * 2 - Standard error + + + +So, the **write** system call is displaying **file1** and **file2** on the standard display, which is the terminal, identified by **1**. + +Now you know which system calls did most of the work for the **ls testdir/** command. But what about the other 100+ system calls in the **trace.log** file? The operating system has to do a lot of housekeeping to run a process, so a lot of what you see in the log file is process initialization and cleanup. Read the entire **trace.log** file and try to understand what is happening to make the **ls** command work. + +Now that you know how to analyze system calls for a given command, you can use this knowledge for other commands to understand what system calls are being executed. **strace** provides a lot of useful command-line flags to make it easier for you, and some of them are described below. + +By default, **strace** does not include all system call information. However, it has a handy **-v verbose** option that can provide additional information on each system call: + + +``` +`strace -v ls testdir` +``` + +It is good practice to always use the **-f** option when running the **strace** command. It allows **strace** to trace any child processes created by the process currently being traced: + + +``` +`strace -f ls testdir` +``` + +Say you just want the names of system calls, the number of times they ran, and the percentage of time spent in each system call. You can use the **-c** flag to get those statistics: + + +``` +`strace -c ls testdir/` +``` + +Suppose you want to concentrate on a specific system call, such as focusing on **open** system calls and ignoring the rest. You can use the **-e** flag followed by the system call name: + + +``` +[root@sandbox tmp]# strace -e open ls testdir +open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 +open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 +file1  file2 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +What if you want to concentrate on more than one system call? No worries, you can use the same **-e** command-line flag with a comma between the two system calls. For example, to see the **write** and **getdents** systems calls: + + +``` +[root@sandbox tmp]# strace -e write,getdents ls testdir +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +write(1, "file1  file2\n", 13file1  file2 +)          = 13 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +The examples so far have traced explicitly run commands. But what about commands that have already been run and are in execution? What, for example, if you want to trace daemons that are just long-running processes? For this, **strace** provides a special **-p** flag to which you can provide a process ID. + +Instead of running a **strace** on a daemon, take the example of a **cat** command, which usually displays the contents of a file if you give a file name as an argument. If no argument is given, the **cat** command simply waits at a terminal for the user to enter text. Once text is entered, it repeats the given text until a user presses Ctrl+C to exit. + +Run the **cat** command from one terminal; it will show you a prompt and simply wait there (remember **cat** is still running and has not exited): + + +``` +`[root@sandbox tmp]# cat` +``` + +From another terminal, find the process identifier (PID) using the **ps** command: + + +``` +[root@sandbox ~]# ps -ef | grep cat +root      22443  20164  0 14:19 pts/0    00:00:00 cat +root      22482  20300  0 14:20 pts/1    00:00:00 grep --color=auto cat +[root@sandbox ~]# +``` + +Now, run **strace** on the running process with the **-p** flag and the PID (which you found above using **ps**). After running **strace**, the output states what the process was attached to along with the PID number. Now, **strace** is tracing the system calls made by the **cat** command. The first system call you see is **read**, which is waiting for input from 0, or standard input, which is the terminal where the **cat** command ran: + + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, +``` + +Now, move back to the terminal where you left the **cat** command running and enter some text. I entered **x0x0** for demo purposes. Notice how **cat** simply repeated what I entered; hence, **x0x0** appears twice. I input the first one, and the second one was the output repeated by the **cat** command: + + +``` +[root@sandbox tmp]# cat +x0x0 +x0x0 +``` + +Move back to the terminal where **strace** was attached to the **cat** process. You now see two additional system calls: the earlier **read** system call, which now reads **x0x0** in the terminal, and another for **write**, which wrote **x0x0** back to the terminal, and again a new **read**, which is waiting to read from the terminal. Note that Standard input (**0**) and Standard out (**1**) are both in the same terminal: + + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, "x0x0\n", 65536)                = 5 +write(1, "x0x0\n", 5)                   = 5 +read(0, +``` + +Imagine how helpful this is when running **strace** against daemons to see everything it does in the background. Kill the **cat** command by pressing Ctrl+C; this also kills your **strace** session since the process is no longer running. + +If you want to see a timestamp against all your system calls, simply use the **-t** option with **strace**: + + +``` +[root@sandbox ~]#strace -t ls testdir/ + +14:24:47 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +14:24:47 brk(NULL)                      = 0x1f07000 +14:24:47 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2530bc8000 +14:24:47 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +14:24:47 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +What if you want to know the time spent between system calls? **strace** has a handy **-r** command that shows the time spent executing each system call. Pretty useful, isn't it? + + +``` +[root@sandbox ~]#strace -r ls testdir/ + +0.000000 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +0.000368 brk(NULL)                 = 0x1966000 +0.000073 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb6b1155000 +0.000047 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +0.000119 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +### Conclusion + +The **strace** utility is very handy for understanding system calls on Linux. To learn about its other command-line flags, please refer to the man pages and online documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/strace + +作者:[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/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://en.wikipedia.org/wiki/Trap_(computing) diff --git a/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md b/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md new file mode 100644 index 0000000000..c2d3b4397f --- /dev/null +++ b/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md @@ -0,0 +1,550 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Backup Configuration Files on a Remote System Using the Bash Script) +[#]: via: (https://www.2daygeek.com/linux-bash-script-backup-configuration-files-remote-linux-system-server/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Backup Configuration Files on a Remote System Using the Bash Script +====== + +It is a good practice to backup configuration files before performing any activity on a Linux system. + +You can use this script if you are restarting the server after several days. + +If you are really concerned about the backup of your configuration files, it is advisable to use this script at least once a month. + +If something goes wrong, you can restore the system to normal by comparing configuration files based on the error message. + +Three **[bash scripts][1]** are included in this article, and each **[shell script][2]** is used for specific purposes. + +You can choose one based on your requirements. + +Everything in Linux is a file. If you make some wrong changes in the configuration file, it will cause the associated service to crash. + +So it is a good idea to take a backup of configuration files, and you do not have to worry about disk usage as this not consume much space. + +### What does this script do? + +This script backs up specific configuration files, moves them to another server, and finally deletes the backup on the remote machine. + +This script has six parts, and the details are below. + + * **Part-1:** Backup a General Configuration Files + * **Part-2:** Backup a wwn/wwpn number if the server is physical. + * **Part-3:** Backup an oracle related files if the system has an oracle user account. + * **Part-4:** Create a tar archive of backup configuration files. + * **Part-5:** Copy the tar archive to other server. + * **Part-6:** Remove Backup of configuration files on the remote system. + + + +**System details are as follows:** + + * **Server-A:** Local System/ JUMP System (local.2daygeek.com) + * **Server-B:** Remote System-1 (CentOS6.2daygeek.com) + * **Server-C:** Remote System-2 (CentOS7.2daygeek.com) + + + +### 1) Bash Script to Backup Configuration files on Remote Server + +Two scripts are included in this example, which allow you to back up important configurations files from one server to another (that is, from a remote server to a local server). + +For example, if you want to back up important configuration files from **“Server-B”** to **“Server-A”**. Use the following script. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archive +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Copy a tar archive to other server +sshpass -p 'password' scp /tmp/$(hostname)-date +%Y%m%d.tar Server-A:/home/daygeek/backup/ + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm $(hostname)-date +%Y%m%d.tar +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target server. + +``` +# vi /home/daygeek/shell-script/conf-remote.sh + +#!/bin/bash +echo -e "Enter the Remote Server Name: \c" +read server +scp /home/daygeek/shell-script/config-file.sh $server:/tmp/ +ssh [email protected]${server} sh /home/daygeek/shell-script/config-file.sh +sleep 10s +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote.sh + +Enter the Remote Server Name: CentOS6.2daygeek.com +config-file.sh 100% 1446 647.8KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191024/ +/tmp/conf-bk-20191024/pvs.out +/tmp/conf-bk-20191024/vgs.out +/tmp/conf-bk-20191024/ip.out +/tmp/conf-bk-20191024/netstat-in.out +/tmp/conf-bk-20191024/fstab.out +/tmp/conf-bk-20191024/ifconfig-a.out +/tmp/conf-bk-20191024/hostname.out +/tmp/conf-bk-20191024/crontab.out +/tmp/conf-bk-20191024/netstat-rn.out +/tmp/conf-bk-20191024/uptime.out +/tmp/conf-bk-20191024/uname.out +/tmp/conf-bk-20191024/mapper.out +/tmp/conf-bk-20191024/lvs.out +/tmp/conf-bk-20191024/exports.out +/tmp/conf-bk-20191024/df-h.out +/tmp/conf-bk-20191024/sysctl.out +/tmp/conf-bk-20191024/hosts.out +/tmp/conf-bk-20191024/passwd.out +/tmp/conf-bk-20191024/fdisk.out +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 11:01 /home/daygeek/backup/CentOS6.2daygeek.com-20191024.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS6.2daygeek.com-20191024.tar + +drwxr-xr-x root/root 0 2019-10-25 11:00 tmp/conf-bk-20191024/ +-rw-r--r-- root/root 96 2019-10-25 11:00 tmp/conf-bk-20191024/pvs.out +-rw-r--r-- root/root 92 2019-10-25 11:00 tmp/conf-bk-20191024/vgs.out +-rw-r--r-- root/root 413 2019-10-25 11:00 tmp/conf-bk-20191024/ip.out +-rw-r--r-- root/root 361 2019-10-25 11:00 tmp/conf-bk-20191024/netstat-in.out +-rw-r--r-- root/root 785 2019-10-25 11:00 tmp/conf-bk-20191024/fstab.out +-rw-r--r-- root/root 1375 2019-10-25 11:00 tmp/conf-bk-20191024/ifconfig-a.out +-rw-r--r-- root/root 21 2019-10-25 11:00 tmp/conf-bk-20191024/hostname.out +-rw-r--r-- root/root 457 2019-10-25 11:00 tmp/conf-bk-20191024/crontab.out +-rw-r--r-- root/root 337 2019-10-25 11:00 tmp/conf-bk-20191024/netstat-rn.out +-rw-r--r-- root/root 62 2019-10-25 11:00 tmp/conf-bk-20191024/uptime.out +-rw-r--r-- root/root 116 2019-10-25 11:00 tmp/conf-bk-20191024/uname.out +-rw-r--r-- root/root 210 2019-10-25 11:00 tmp/conf-bk-20191024/mapper.out +-rw-r--r-- root/root 276 2019-10-25 11:00 tmp/conf-bk-20191024/lvs.out +-rw-r--r-- root/root 0 2019-10-25 11:00 tmp/conf-bk-20191024/exports.out +-rw-r--r-- root/root 236 2019-10-25 11:00 tmp/conf-bk-20191024/df-h.out +-rw-r--r-- root/root 1057 2019-10-25 11:00 tmp/conf-bk-20191024/sysctl.out +-rw-r--r-- root/root 115 2019-10-25 11:00 tmp/conf-bk-20191024/hosts.out +-rw-r--r-- root/root 2194 2019-10-25 11:00 tmp/conf-bk-20191024/passwd.out +-rw-r--r-- root/root 1089 2019-10-25 11:00 tmp/conf-bk-20191024/fdisk.out +``` + +### 2) Bash Script to Backup Configuration files on Remote Server + +There are two scripts added in this example, which do the same as the above script, but this can be very useful if you have a JUMP server in your environment. + +This script allows you to copy important configuration files from your client system into the JUMP box + +For example, since we have already set up a password-less login, you have ten clients that can be accessed from the JUMP server. If so, use this script. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file-1.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archieve +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target server. + +``` +# vi /home/daygeek/shell-script/conf-remote-1.sh + +#!/bin/bash +echo -e "Enter the Remote Server Name: \c" +read server +scp /home/daygeek/shell-script/config-file-1.sh $server:/tmp/ +ssh [email protected]${server} sh /home/daygeek/shell-script/config-file-1.sh +sleep 10s +echo -e "Re-Enter the Remote Server Name: \c" +read server +scp $server:/tmp/$server-date +%Y%m%d.tar /home/daygeek/backup/ +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote-1.sh + +Enter the Remote Server Name: CentOS6.2daygeek.com +config-file.sh 100% 1446 647.8KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/sysctl.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/fdisk.out +Enter the Server Name Once Again: CentOS6.2daygeek.com +CentOS6.2daygeek.com-20191025.tar +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 11:44 /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar + +drwxr-xr-x root/root 0 2019-10-25 11:43 tmp/conf-bk-20191025/ +-rw-r--r-- root/root 96 2019-10-25 11:43 tmp/conf-bk-20191025/pvs.out +-rw-r--r-- root/root 92 2019-10-25 11:43 tmp/conf-bk-20191025/vgs.out +-rw-r--r-- root/root 413 2019-10-25 11:43 tmp/conf-bk-20191025/ip.out +-rw-r--r-- root/root 361 2019-10-25 11:43 tmp/conf-bk-20191025/netstat-in.out +-rw-r--r-- root/root 785 2019-10-25 11:43 tmp/conf-bk-20191025/fstab.out +-rw-r--r-- root/root 1375 2019-10-25 11:43 tmp/conf-bk-20191025/ifconfig-a.out +-rw-r--r-- root/root 21 2019-10-25 11:43 tmp/conf-bk-20191025/hostname.out +-rw-r--r-- root/root 457 2019-10-25 11:43 tmp/conf-bk-20191025/crontab.out +-rw-r--r-- root/root 337 2019-10-25 11:43 tmp/conf-bk-20191025/netstat-rn.out +-rw-r--r-- root/root 61 2019-10-25 11:43 tmp/conf-bk-20191025/uptime.out +-rw-r--r-- root/root 116 2019-10-25 11:43 tmp/conf-bk-20191025/uname.out +-rw-r--r-- root/root 210 2019-10-25 11:43 tmp/conf-bk-20191025/mapper.out +-rw-r--r-- root/root 276 2019-10-25 11:43 tmp/conf-bk-20191025/lvs.out +-rw-r--r-- root/root 0 2019-10-25 11:43 tmp/conf-bk-20191025/exports.out +-rw-r--r-- root/root 236 2019-10-25 11:43 tmp/conf-bk-20191025/df-h.out +-rw-r--r-- root/root 1057 2019-10-25 11:43 tmp/conf-bk-20191025/sysctl.out +-rw-r--r-- root/root 115 2019-10-25 11:43 tmp/conf-bk-20191025/hosts.out +-rw-r--r-- root/root 2194 2019-10-25 11:43 tmp/conf-bk-20191025/passwd.out +-rw-r--r-- root/root 1089 2019-10-25 11:43 tmp/conf-bk-20191025/fdisk.out +``` + +### 3) Bash Script to Backup Configuration files on Multiple Linux Remote Systems + +This script allows you to copy important configuration files from multiple remote Linux systems into the JUMP box at the same time. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file-2.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archieve +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target servers. + +``` +# vi /home/daygeek/shell-script/conf-remote-2.sh + +#!/bin/bash +for server in CentOS6.2daygeek.com CentOS7.2daygeek.com +do +scp /home/daygeek/shell-script/config-file-2.sh $server:/tmp/ +ssh [email protected]${server} sh /tmp/config-file-2.sh +sleep 10s +scp $server:/tmp/$server-date +%Y%m%d.tar /home/daygeek/backup/ +done +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote-2.sh + +config-file-1.sh 100% 1444 416.5KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/sysctl.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/fdisk.out +CentOS6.2daygeek.com-20191025.tar +config-file-1.sh 100% 1444 386.2KB/s 00:00 +CentOS7.2daygeek.com is a VM +oracle user does not exist on server +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/fdisk.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/sysctl.out +tar: Removing leading `/' from member names +CentOS7.2daygeek.com-20191025.tar +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 12:37 /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 12:38 /home/daygeek/backup/CentOS7.2daygeek.com-20191025.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS7.2daygeek.com-20191025.tar + +drwxr-xr-x root/root 0 2019-10-25 12:23 tmp/conf-bk-20191025/ +-rw-r--r-- root/root 21 2019-10-25 12:23 tmp/conf-bk-20191025/hostname.out +-rw-r--r-- root/root 115 2019-10-25 12:23 tmp/conf-bk-20191025/uname.out +-rw-r--r-- root/root 62 2019-10-25 12:23 tmp/conf-bk-20191025/uptime.out +-rw-r--r-- root/root 228 2019-10-25 12:23 tmp/conf-bk-20191025/hosts.out +-rw-r--r-- root/root 501 2019-10-25 12:23 tmp/conf-bk-20191025/df-h.out +-rw-r--r-- root/root 88 2019-10-25 12:23 tmp/conf-bk-20191025/pvs.out +-rw-r--r-- root/root 84 2019-10-25 12:23 tmp/conf-bk-20191025/vgs.out +-rw-r--r-- root/root 252 2019-10-25 12:23 tmp/conf-bk-20191025/lvs.out +-rw-r--r-- root/root 197 2019-10-25 12:23 tmp/conf-bk-20191025/mapper.out +-rw-r--r-- root/root 1088 2019-10-25 12:23 tmp/conf-bk-20191025/fdisk.out +-rw-r--r-- root/root 465 2019-10-25 12:23 tmp/conf-bk-20191025/fstab.out +-rw-r--r-- root/root 0 2019-10-25 12:23 tmp/conf-bk-20191025/exports.out +-rw-r--r-- root/root 451 2019-10-25 12:23 tmp/conf-bk-20191025/crontab.out +-rw-r--r-- root/root 2748 2019-10-25 12:23 tmp/conf-bk-20191025/passwd.out +-rw-r--r-- root/root 861 2019-10-25 12:23 tmp/conf-bk-20191025/ip.out +-rw-r--r-- root/root 455 2019-10-25 12:23 tmp/conf-bk-20191025/netstat-in.out +-rw-r--r-- root/root 505 2019-10-25 12:23 tmp/conf-bk-20191025/netstat-rn.out +-rw-r--r-- root/root 2072 2019-10-25 12:23 tmp/conf-bk-20191025/ifconfig-a.out +-rw-r--r-- root/root 449 2019-10-25 12:23 tmp/conf-bk-20191025/sysctl.out +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-backup-configuration-files-remote-linux-system-server/ + +作者:[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/category/bash-script/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..bcbf0c27ec --- /dev/null +++ b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -0,0 +1,271 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Install and Configure Nagios Core on CentOS 8 / RHEL 8 +====== + +**Nagios** is a free and opensource network and alerting engine used to monitor various devices, such as network devices, and servers in a network. It supports both **Linux** and **Windows OS** and provides an intuitive web interface that allows you to easily monitor network resources. When professionally configured, it can alert you in the event a server or a network device goes down or malfunctions via email alerts. In this topic, we shed light on how you can install and configure Nagios core on **RHEL 8** / **CentOS 8**. + +[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] + +### Prerequisites of Nagios Core + +Before we begin, perform a flight check and ensure you have the following: + + * An instance of RHEL 8 / CentOS 8 + * SSH access to the instance + * A fast and stable internet connection + + + +With the above requirements in check, let’s roll our sleeves! + +### Step 1: Install LAMP Stack + +For Nagios to work as expected, you need to install LAMP stack or any other web hosting stack since it’s going to run on a browser. To achieve this, execute the command: + +``` +# dnf install httpd mariadb-server php-mysqlnd php-fpm +``` + +![Install-LAMP-stack-CentOS8][1] + +You need to ensure that Apache web server is up and running. To do so, start and enable Apache server using the commands: + +``` +# systemctl start httpd +# systemctl enable httpd +``` + +![Start-enable-httpd-centos8][1] + +To check the status of Apache server run + +``` +# systemctl status httpd +``` + +![Check-status-httpd-centos8][1] + +Next, we need to start and enable MariaDB server, run the following commands + +``` +# systemctl start mariadb +# systemctl enable mariadb +``` + +![Start-enable-MariaDB-CentOS8][1] + +To check MariaDB status run: + +``` +# systemctl status mariadb +``` + +![Check-MariaDB-status-CentOS8][1] + +Also, you might consider hardening or securing your server and making it less susceptible to unauthorized access. To secure your server, run the command: + +``` +# mysql_secure_installation +``` + +Be sure to set a strong password for your MySQL instance. For the subsequent prompts, Type **Yes** and hit **ENTER** + +![Secure-MySQL-server-CentOS8][1] + +### Step 2: Install Required packages + +Apart from installing the LAMP server, some additional packages are needed for the installation and proper configuration of Nagios. Therefore, install the packages as shown below: + +``` +# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix +``` + +![Install-requisite-packages-CentOS8][1] + +### Step 3: Create a Nagios user account + +Next, we need to create a user account for the Nagios user. To achieve this , run the command: + +``` +# adduser nagios +# passwd nagios +``` + +![Create-new-user-for-Nagios][1] + +Now, we need to create a group for Nagios and add the Nagios user to this group. + +``` +# groupadd nagiosxi +``` + +Now add the Nagios user to the group + +``` +# usermod -aG nagiosxi nagios +``` + +Also, add Apache user to the Nagios group + +``` +# usermod -aG nagiosxi apache +``` + +![Add-Nagios-group-user][1] + +### Step 4: Download and install Nagios core + +We can now proceed and install Nagios Core. The latest stable version in Nagios 4.4.5 which was released on August 19, 2019.  But first, download the Nagios tarball file from its official site. + +To download Nagios core, first head to the tmp directory + +``` +# cd /tmp +``` + +Next download the tarball file + +``` +# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz +``` + +![Download-Nagios-CentOS8][1] + +After downloading the tarball file, extract it using the command: + +``` +# tar -xvf nagios-4.4.5.tar.gz +``` + +Next, navigate to the uncompressed folder + +``` +# cd nagios-4.4.5 +``` + +Run the commands below in this order + +``` +# ./configure --with-command-group=nagcmd +# make all +# make install +# make install-init +# make install-daemoninit +# make install-config +# make install-commandmode +# make install-exfoliation +``` + +To setup Apache configuration issue the command: + +``` +# make install-webconf +``` + +### Step 5: Configure Apache Web Server Authentication + +Next, we are going to setup authentication for the user **nagiosadmin**. Please be mindful not to change the username or else, you may be required to perform further configuration which may be quite tedious. + +To set up authentication run the command: + +``` +# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin +``` + +![Configure-Apache-webserver-authentication-CentOS8][1] + +You will be prompted for the password of the nagiosadmin user. Enter and confirm the password as requested. This is the user that you will use to login to Nagios towards the end of this tutorial. + +For the changes to come into effect, restart your web server. + +``` +# systemctl restart httpd +``` + +### Step 6: Download & install Nagios Plugins + +Plugins will extend the functionality of the Nagios Server. They will help you monitor various services, network devices, and applications. To download the plugin tarball file run the command: + +``` +# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz +``` + +Next, extract the tarball file and navigate to the uncompressed plugin folder + +``` +# tar -xvf nagios-plugins-2.2.1.tar.gz +# cd nagios-plugins-2.2.1 +``` + +To install the plugins compile the source code as shown + +``` +# ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi +# make +# make install +``` + +### Step 7: Verify and Start Nagios + +After the successful installation of Nagios plugins, verify the Nagios configuration to ensure that all is well and there is no error in the configuration: + +``` +# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg +``` + +![Verify-Nagios-settings-CentOS8][1] + +Next, start Nagios and verify its status + +``` +# systemctl start nagios +# systemctl status nagios +``` + +![Start-check-status-Nagios-CentOS8][1] + +In case Firewall is running on system then allow “80” using the following command + +``` +# firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload +``` + +### Step 8: Access Nagios dashboard via the web browser + +To access Nagios, browse your server’s IP address as shown + + + +A pop-up will appear prompting for the username and the password of the user we created earlier in Step 5. Enter the credentials and hit ‘**Sign In**’ + +![Access-Nagios-via-web-browser-CentOS8][1] + +This ushers you to the Nagios dashboard as shown below + +![Nagios-dashboard-CentOS8][1] + +We have finally successfully installed and configured Nagios Core on CentOS 8 / RHEL 8. Your feedback is most welcome. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ + +作者:[James Kiarie][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.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg diff --git a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md new file mode 100644 index 0000000000..e915fe74d9 --- /dev/null +++ b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enterprise JavaBeans, infrastructure predictions, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/enterprise-javabeans-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Enterprise JavaBeans, infrastructure predictions, 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. + +## [Gartner: 10 infrastructure trends you need to know][2] + +> Corporate network infrastructure is only going to get more involved  over the next two to three years as automation, network challenges, and hybrid cloud become more integral to the enterprise. + +**The impact:** The theme running through all these predictions is the impact of increased complexity. As consumers of technology, we expect things to get easier and easier. As producers of technology, we know what's going on behind the curtains to make that simplicity possible is its opposite. + +## [Jakarta EE: What's in store for Enterprise JavaBeans?][3] + +> [Enterprise JavaBeans (EJB)][4] has been very important to the Java EE ecosystem and promoted many robust solutions to enterprise problems. Besides that, in the past when integration techniques were not so advanced, EJB did great work with remote EJB, integrating many Java EE applications. However, remote EJB is not necessary anymore, and we have many techniques and tools that are better for doing that. So, does EJB still have a place in this new cloud-native world? + +**The impact:** This offers some insights into how programming languages and frameworks evolve and change over time. Respond to changes in developer affinity by identifying the good stuff in a language and getting it landed somewhere else. Ideally that "somewhere else" should be an open standard so that no single vendor gets to control your technology destiny. + +## [From virtualization to containerization][5] + +> Before the telecom industry has got to grips with "step one" virtualization, many industry leaders are already moving on to the next level—containerization. This is a key part of making network software cloud-native i.e. designed, developed, and optimized to exploit cloud technology such as distributed processing and data stores. + +**The impact:** There are certain industries that make big technology decisions on long time horizons; I can only imagine the FOMO that the fast-moving world of infrastructure technology could cause when you've picked something and it starts to look a bit crufty next to the new hotness. + +## [How do you rollback deployments in Kubernetes?][6] + +> There are several strategies when it comes to deploying apps into production. In Kubernetes, rolling updates are the default strategy to update the running version of your app. The rolling update cycles previous Pod out and bring newer Pod in incrementally. + +**The impact:** What is the cloud-native distributed equivalent to **ctrl+z**? And aren't you glad there is one? + +## [What's a Trusted Compute Base?][7] + +> A few months ago, in an article called [Turtles—and chains of trust][8], I briefly mentioned Trusted Compute Bases, or TCBs, but then didn’t go any deeper.  I had a bit of a search across the articles on this blog, and realised that I’ve never gone into this topic in much detail, which feels like a mistake, so I’m going to do it now. + +**The impact:** The issue of to what extent you can trust the computer systems that power your whole life is only going to become more prevalent and more vexing. That turns out to be a great argument for open source from the bottom turtle (hardware) all the way up. + +_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/19/10/enterprise-javabeans-and-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.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html +[3]: https://developers.redhat.com/blog/2019/10/22/jakarta-ee-whats-in-store-for-enterprise-javabeans/ +[4]: https://docs.oracle.com/cd/E13222_01/wls/docs100/ejb/deploy.html +[5]: https://www.lightreading.com/nfv/from-virtualization-to-containerization/a/d-id/755016 +[6]: https://learnk8s.io/kubernetes-rollbacks/ +[7]: https://aliceevebob.com/2019/10/22/whats-a-trusted-compute-base/ +[8]: https://aliceevebob.com/2019/07/02/turtles-and-chains-of-trust/ diff --git a/sources/tech/20191028 How to remove duplicate lines from files with awk.md b/sources/tech/20191028 How to remove duplicate lines from files with awk.md new file mode 100644 index 0000000000..0282a26768 --- /dev/null +++ b/sources/tech/20191028 How to remove duplicate lines from files with awk.md @@ -0,0 +1,243 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to remove duplicate lines from files with awk) +[#]: via: (https://opensource.com/article/19/10/remove-duplicate-lines-files-awk) +[#]: author: (Lazarus Lazaridis https://opensource.com/users/iridakos) + +How to remove duplicate lines from files with awk +====== +Learn how to use awk '!visited[$0]++' without sorting or changing their +order. +![Coding on a computer][1] + +Suppose you have a text file and you need to remove all of its duplicate lines. + +### TL;DR + +To remove the duplicate lines while _preserving their order in the file_, use: + + +``` +`awk '!visited[$0]++' your_file > deduplicated_file` +``` + +### How it works + +The script keeps an associative array with _indices_ equal to the unique lines of the file and _values_ equal to their occurrences. For each line of the file, if the line occurrences are zero, then it increases them by one and _prints the line_, otherwise, it just increases the occurrences _without printing the line_. + +I was not familiar with **awk**, and I wanted to understand how this can be accomplished with such a short script (**awk**ward). I did my research, and here is what is going on: + + * The awk "script" **!visited[$0]++** is executed for _each line_ of the input file. + * **visited[]** is a variable of type [associative array][2] (a.k.a. [Map][3]). We don't have to initialize it because **awk** will do it the first time we access it. + * The **$0** variable holds the contents of the line currently being processed. + * **visited[$0]** accesses the value stored in the map with a key equal to **$0** (the line being processed), a.k.a. the occurrences (which we set below). + * The **!** negates the occurrences' value: + * In awk, [any nonzero numeric value or any nonempty string value is true][4]. + * By default, [variables are initialized to the empty string][5], which is zero if converted to a number. + * That being said: + * If **visited[$0]** returns a number greater than zero, this negation is resolved to **false**. + * If **visited[$0]** returns a number equal to zero or an empty string, this negation is resolved to **true**. + * The **++** operation increases the variable's value (**visited[$0]**) by one. + * If the value is empty, **awk** converts it to **0** (number) automatically and then it gets increased. + * **Note:** The operation is executed after we access the variable's value. + + + +Summing up, the whole expression evaluates to: + + * **true** if the occurrences are zero/empty string + * **false** if the occurrences are greater than zero + + + +**awk** statements consist of a [_pattern-expression_ and an _associated action_][6]. + + +``` +` { }` +``` + +If the pattern succeeds, then the associated action is executed. If we don't provide an action, **awk**, by default, **print**s the input. + +> An omitted action is equivalent to **{ print $0 }**. + +Our script consists of one **awk** statement with an expression, omitting the action. So this: + + +``` +`awk '!visited[$0]++' your_file > deduplicated_file` +``` + +is equivalent to this: + + +``` +`awk '!visited[$0]++ { print $0 }' your_file > deduplicated_file` +``` + +For every line of the file, if the expression succeeds, the line is printed to the output. Otherwise, the action is not executed, and nothing is printed. + +### Why not use the **uniq** command? + +The **uniq** command removes only the _adjacent duplicate lines_. Here's a demonstration: + + +``` +$ cat test.txt +A +A +A +B +B +B +A +A +C +C +C +B +B +A +$ uniq < test.txt +A +B +A +C +B +A +``` + +### Other approaches + +#### Using the sort command + +We can also use the following [**sort**][7] command to remove the duplicate lines, but _the line order is not preserved_. + + +``` +`sort -u your_file > sorted_deduplicated_file` +``` + +#### Using cat, sort, and cut + +The previous approach would produce a de-duplicated file whose lines would be sorted based on the contents. [Piping a bunch of commands][8] can overcome this issue: + + +``` +`cat -n your_file | sort -uk2 | sort -nk1 | cut -f2-` +``` + +##### How it works + +Suppose we have the following file: + + +``` +abc +ghi +abc +def +xyz +def +ghi +klm +``` + +**cat -n test.txt** prepends the order number in each line. + + +``` +1       abc +2       ghi +3       abc +4       def +5       xyz +6       def +7       ghi +8       klm +``` + +**sort -uk2** sorts the lines based on the second column (**k2** option) and keeps only the first occurrence of the lines with the same second column value (**u** option). + + +``` +1       abc +4       def +2       ghi +8       klm +5       xyz +``` + +**sort -nk1** sorts the lines based on their first column (**k1** option) treating the column as a number (**-n** option). + + +``` +1       abc +2       ghi +4       def +5       xyz +8       klm +``` + +Finally, **cut -f2-** prints each line starting from the second column until its end (**-f2-** option: _Note the **-** suffix, which instructs it to include the rest of the line_). + + +``` +abc +ghi +def +xyz +klm +``` + +### References + + * [The GNU awk user's guide][9] + * [Arrays in awk][2] + * [Awk—Truth values][4] + * [Awk expressions][5] + * [How can I delete duplicate lines in a file in Unix?][10] + * [Remove duplicate lines without sorting [duplicate]][11] + * [How does awk '!a[$0]++' work?][12] + + + +That's all. Cat photo. + +![Duplicate cat][13] + +* * * + +_This article originally appeared on the iridakos blog by [Lazarus Lazaridis][14] under a [CC BY-NC 4.0 License][15] and is republished with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/remove-duplicate-lines-files-awk + +作者:[Lazarus Lazaridis][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/iridakos +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://kirste.userpage.fu-berlin.de/chemnet/use/info/gawk/gawk_12.html +[3]: https://en.wikipedia.org/wiki/Associative_array +[4]: https://www.gnu.org/software/gawk/manual/html_node/Truth-Values.html +[5]: https://ftp.gnu.org/old-gnu/Manuals/gawk-3.0.3/html_chapter/gawk_8.html +[6]: http://kirste.userpage.fu-berlin.de/chemnet/use/info/gawk/gawk_9.html +[7]: http://man7.org/linux/man-pages/man1/sort.1.html +[8]: https://stackoverflow.com/a/20639730/2292448 +[9]: https://www.gnu.org/software/gawk/manual/html_node/ +[10]: https://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix +[11]: https://stackoverflow.com/questions/11532157/remove-duplicate-lines-without-sorting +[12]: https://unix.stackexchange.com/questions/159695/how-does-awk-a0-work/159734#159734 +[13]: https://opensource.com/sites/default/files/uploads/duplicate-cat.jpg (Duplicate cat) +[14]: https://iridakos.com/about/ +[15]: http://creativecommons.org/licenses/by-nc/4.0/ diff --git a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md new file mode 100644 index 0000000000..456372ab38 --- /dev/null +++ b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Collapse OS – An OS Created to Run After the World Ends) +[#]: via: (https://itsfoss.com/collapse-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Collapse OS – An OS Created to Run After the World Ends +====== + +When most people think about preparing for a post-apocalyptic world, the first time that comes to mind is food and other living essentials. Recently, a programmer has decided that it would be just as important to create a versatile and survivable operating system after the collapse of society. We will be taking a look at it today, as best we can. + +### Collapse OS – For when the fecal matter hits the rotating device + +![][1] + +The operating system in question is called [Collapse OS][2]. According to the website, Collapse OS is a “z80 kernel and a collection of programs, tools and documentation”. It would allow you to: + + * Run on minimal and improvised machines. + * Interface through improvised means (serial, keyboard, display). + * Edit text files. + * Compile assembler source files for a wide range of MCUs and CPUs. + * Read and write from a wide range of storage devices. + * Replicate itself. + + + +The creator, [Virgil Dupras][3], started the project because [he sees][4] “our global supply chain to collapse before we reach 2030”. He bases this conclusion on the works of Pablo Servigne. He seems to understand that not everyone shares [his views][4]. “That being said, I don’t consider it unreasonable to not believe that collapse is likely to happen by 2030, so please, don’t feel attacked by my beliefs.” + +The overall goal of the project is to jumpstart a post-collapse civilization’s return to the computer age. The production of electronics depends on a very complex supply chain. Once that supply chain crumbles, man will go back to a less technical age. It would take decades to regain our previous technical position. Dupras hopes to jump several steps by creating an ecosystem that will work with simpler chips that can be scavenged from a wide variety of sources. + +### What is the z80? + +The initial CollapseOS kernel is written for the [z80 chip][5]. As a retro computing history buff, I am familiar with [Zilog][6] and it’s z80 chip. In the late 1970s, Zilog introduced the z80 to compete with [Intel’s 8080][7] CPU. The z80 was used in a whole bunch of early personal computers, such as the [Sinclair ZX Spectrum][8] and the [Tandy TRS-80][9]. The majority of these systems used the [CP/M operating system][10], which was the top operating system of the time. (Interestingly, Dupras was originally looking to use an [open-source implementation o][11][f][11] [CP/M][11], but ultimately decided to [start from scratch][12].) + +Both the z80 and CP/M started to decline in popularity after the [IBM PC][13] was released in 1981. Zilog did release several other microprocessors (Z8000 and Z80000), but these did not take off. The company switched its focus to microcontrollers. Today, an updated descendant of the z80 can be found in graphic calculators, embedded devices and consumer electronics. + +Dupras said on [Reddit][14] that he wrote Collapse OS for the z80 because “it’s been in production for so long and because it’s been used in so many machines, scavenger have good chances of getting their hands on it.” + +### Current status and future of the project + +Collapse OS has a pretty decent start. It can self replicate with enough RAM and storage. It is capable of running on an [RC2014 homebrew computer][15] or a Sega Master System/MegaDrive (Genesis). It can read SD cards. It has a simple text editor. The kernel is made up of modules that are connected with glue code. This is designed to make the system flexible and adaptable. + +There is also a detailed [roadmap][16] laying out the direction of the project. Listed goals include: + + * Support for other CPUs, such as 8080 and [6502][17] + * Support for improvised peripherals, such as LCD screens, E-ink displays, and [ACIA devices][18]. + * Support for more storage options, such as floppys, CDs, SPI RAM/ROMs, and AVR MCUs + * Get it to work on other z80 machines, such as [TI-83+][19] and [TI-84+][20] graphing calculators and TRS-80s + + + +If you are interested in helping out or just taking a peek at the project, be sure to visit their [GitHub page][21]. + +### Final Thoughts + +To put it bluntly, I see Collapse OS as more of a fun hobby project (for those who like building operating systems), than something useful. When a collapse does come, how will Collapse OS get distributed, since I imagine that GitHub will be down? I can’t imagine more than a handful of skill people being able to create a system from scavenged parts. There is a whole new generation of makers out there, but most of them are used to picking up an Arduino or a Raspberry Pi and building their project than starting from scratch. + +Contrary to Dupras, my biggest concern is the use of [EMPs][22]. These things fry all electrical systems, meaning there would be nothing left to scavenge to build system. If that doesn’t happen, I imagine that we would be able to find enough x86 components made over the past 30 years to keep things going. + +That being said, Collapse OS sounds like a fun and challenging project to people who like to program in low-level code for strange applications. If you are such a person, check out [Collapse OS][2]. + +Hypothetical question: what is your post-apocalyptic operating system of choice? 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][23]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/collapse-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://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/Collapse_OS.jpg?ssl=1 +[2]: https://collapseos.org/ +[3]: https://github.com/hsoft +[4]: https://collapseos.org/why.html +[5]: https://en.m.wikipedia.org/wiki/Z80 +[6]: https://en.wikipedia.org/wiki/Zilog +[7]: https://en.wikipedia.org/wiki/Intel_8080 +[8]: https://en.wikipedia.org/wiki/ZX_Spectrum +[9]: https://en.wikipedia.org/wiki/TRS-80 +[10]: https://en.wikipedia.org/wiki/CP/M +[11]: https://github.com/davidgiven/cpmish +[12]: https://github.com/hsoft/collapseos/issues/52 +[13]: https://en.wikipedia.org/wiki/IBM_Personal_Computer +[14]: https://old.reddit.com/r/collapse/comments/dejmvz/collapse_os_bootstrap_postcollapse_technology/f2w3sid/?st=k1gujoau&sh=1b344da9 +[15]: https://rc2014.co.uk/ +[16]: https://collapseos.org/roadmap.html +[17]: https://en.wikipedia.org/wiki/MOS_Technology_6502 +[18]: https://en.wikipedia.org/wiki/MOS_Technology_6551 +[19]: https://en.wikipedia.org/wiki/TI-83_series#TI-83_Plus +[20]: https://en.wikipedia.org/wiki/TI-84_Plus_series +[21]: https://github.com/hsoft/collapseos +[22]: https://en.wikipedia.org/wiki/Electromagnetic_pulse +[23]: https://reddit.com/r/linuxusersgroup diff --git a/translated/talk/20180116 Command Line Heroes- Season 1- OS Wars_2.md b/translated/talk/20180116 Command Line Heroes- Season 1- OS Wars_2.md deleted file mode 100644 index 040a2d2836..0000000000 --- a/translated/talk/20180116 Command Line Heroes- Season 1- OS Wars_2.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Command Line Heroes: Season 1: OS Wars) -[#]: via: (https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux) -[#]: author: (redhat https://www.redhat.com) - -代码英雄:第一季:操作系统大战(第二部分 Linux 崛起) -====== -Saron Yitbarek: 这玩意开着的吗?让我们进一段史诗般的星球大战的开幕吧,开始了。 - -配音:[00:00:30] 第二集 :Linux® 的崛起。微软帝国控制着 90% 的桌面用户。操作系统的全面标准化似乎是板上钉钉的事了。然而,互联网的出现将战争的焦点从桌面转向了企业,在该领域,所有商业组织都争相构建自己的服务器。与此同时,一个不太可能的英雄出现在开源反叛组织中。固执,戴着眼镜的 Linus Torvalds 免费发布了他的 Linux 系统。微软打了个趔趄-并且开始重组。 - -Saron Yitbarek: [00:01:00] 哦,我们书呆子就是喜欢那样。上一次我们讲到哪了?苹果和微软互相攻伐,试图在一场争夺桌面用户的战争中占据主导地位。在第一集的结尾,我们看到微软获得了大部分的市场份额。很快,由于互联网的兴起以及随之而来的开发者大军,整个市场都经历了一场地震。互联网将战场从在家庭和办公室中的个人电脑用户转移到拥有数百台服务器的大型商业客户中。 - -[00:01:30] 这意味着巨量资源的迁移。突然间,所有相关企业不仅被迫为服务器空间和网站建设付费,而且还必须集成软件来进行资源跟踪和数据库监控等工作。你需要很多开发人员来帮助你。至少那时候大家都是这么做的。 - -在操作系统之战的第二部分,我们将看到优先级的巨大转变,以及像 Linus Torvalds 和 Richard Stallman 这样的开源叛逆者是如何成功地在微软和整个软件行业的核心地带引起恐惧的。 - -[00:02:00] 我是 Saron Yitbarek,您现在收听的是代码英雄,一款红帽公司原创的播客节目。每一集,我们都会给您带来“从码开始”改变技术的人的故事。 - -[00:02:30] 好。假设你是 1991 年的微软。你自我感觉良好,对吧?满怀信心。确定全球主导的地位感觉不错。你已经掌握了与其他企业合作的艺术,但是仍然将大部分开发人员、程序员和系统管理员排除在联盟之外,而他们才是真正的步兵。这是出现了个叫 Linus Torvalds 的芬兰极客。他和他的开源程序员团队正在开始发布 Linux,其操作系统内核是由他们一起编写出来的。 - -[00:03:00] 坦白地说,如果你是微软公司,你并不会太在意 Linux,甚至是一般意义上的开源运动,但是最终,Linux 的规模变得如此之大,以至于微软不可能不注意到。Linux 第一个版本出现在 1991 年,当时大概有 10000 行代码。十年后,变成了 300 万行代码。如果你想知道,今天则是 2000 万行代码。 - -[00:03:30] 让我们停留在 90 年代初一会儿。那是 Linux 还没有成为我们现在所知道的庞然大物。只是这个奇怪的病毒式的操作系统正在这个星球上蔓延,全世界的极客和黑客都爱上了它。那时候我还太年轻,但依然希望加入他们。在那个时候,发现 Linux 就如同进入了一个秘密社会一样。程序员与朋友分享 Linux CD 集,就像其他人分享地下音乐混音带一样。 - -Developer Tristram Oaten [00:03:40] 讲讲了你 16 岁时第一次接触 Linux 的故事吧。 - -Tristram Oaten: [00:04:00] 我和我的家人去了 Red Sea 上的 Hurghada 潜水度假。那是一个美丽的地方,强烈推荐。第一天,我喝了自来水。也许,我妈妈跟我说过不要这么做。我整个星期都病得很厉害,没有离开旅馆房间。当时我只带了一台新安装了 Slackware Linux 的笔记本电脑,我听说过这玩意并且正在尝试使用它。这台笔记本上没有额外的应用程序,只有 8 张 cd。出于必要,整个星期我所做的就是去了解这个外星一般的系统。我阅读手册,摆弄着终端。我记得当时我甚至我不知道一个点(表示当前目录)和两个点(表示前一个目录)之间的区别。 - -[00:04:30] 我一点头绪都没有。犯过很多错误,但慢慢地,在这种强迫的孤独中,我突破了障碍,开始理解并明白命令行到底是怎么回事。假期结束时,我没有看过金字塔、尼罗河等任何埃及遗址,但我解锁了现代世界的一个奇迹。我解锁了 Linux,接下来的事大家都知道了。 - -Saron Yitbarek: 你可以从很多人那里听到关于这个故事的不同说法。访问 Linux 命令行是一种革命性的体验。 - -David Cantrell: 它给了我源代码。我当时的感觉是,"太神奇了。" - -Saron Yitbarek: 我们正在参加一个名为 Flock to Fedora 的 2017 年 Linux 开发者大会。 - -David Cantrell: .。. 非常有吸引力。我觉得我对这个系统有了更多的控制力,它越来越吸引我。我想,从那时起,1995 年我第一次编译 Linux 内核时,我就迷上了它。 - -Saron Yitbarek: 开发者 David Cantrell 与 Joe Brockmire。 - -Joe Brockmeier: 我寻遍了便宜软件最终找到一套四张 CD 的 Slackware Linux。它看起来来非常令人兴奋而且很有趣,所以我把它带回家,安装在第二台电脑上,开始摆弄它,并为两件事情感到兴奋。一个是,我运行的不是 Windows,另一个我 Linux 的开源特性。 - -Saron Yitbarek: [00:06:00] 某种程度上来说,对命令行的访问总是存在的。在开源真正开始流行还要早几十年前,人们(至少在开发人员中是这样)总是希望能够做到完全控制。让我们回到操作系统大战之前的那个时代,在苹果和微软他们的 GUI 而战之前。那时也有代码英雄。保罗·琼斯 (Paul Jones) 教授(在线图书馆 ibiblio.org 负责人)在那个古老的时代,就是一名开发人员。 - -Paul Jones: [00:07:00] 从本质上讲,互联网在那个时候比较少是客户端-服务器架构的,而是更多是点对点架构的。讲真,当我们说,某种 VAX 到 VAX,某科学工作站,科学工作站。这并不意味着没有客户端与服务端的关系以及没有应用程序,但这的确意味着,最初的设计是思考如何实现点对点,它与 IBM 一直在做的东西相对立。IBM 给你的只有哑终端,这种终端只能让你管理用户界面,却无法让你像真正的终端一样为所欲为。 - -Saron Yitbarek: 图形用户界面在普通用户中普及的同时,在工程师和开发人员中总是存在和一股相反的力量。早在 20 世纪 70 年代和 80 年代的 Linux 出现之前,这股力量就存在于 EMAX 和 GNU 中。有了斯托尔曼的自由软件基金会后,总有某些人想要使用命令行,但上世纪 90 年代的 Linux 的交付方式是独一无二的。 - -[00:07:30] Linux 和其他开源软件的早期爱好者是都是先驱。我正站在他们的肩膀上。我们都是。 - -您现在收听的是代码英雄,一款由红帽公司原创的播客。这是操作系统大战的第二部分:Linux 崛起。 - -Steven Vaughan-Nichols: 1998 年的时候,情况发生了变化。 - -Saron Yitbarek: Steven Vaughan-Nichols 是 zdnet.com 的特约编辑,他已经写了几十年关于技术商业方面的文章了。他将向我们讲述 Linux 是如何慢慢变得越来越流行,直到自愿贡献者的数量远远超过了在 Windows 上工作的微软开发人员的数量的。不过,Linux 从来没有真正关注过微软的台式机客户,这也许就是微软最开始时忽略了 Linux 及其开发者的原因。Linux 真正大放光彩的地方是在服务器机房。当企业开始线上业务时,每个企业都需要一个独特的编程解决方案来满足其需求。 - -[00:08:30] WindowsNT 于 1993 年问世,当时它已经在与其他的服务器操作系统展开竞争了,但是许多开发人员都在想,“既然我可以通过 Apache 构建出基于 Linux 的廉价系统,那我为什么要购买 AIX 设备或大型 Windows 设备呢?”关键点在于,Linux 代码已经开始渗透到几乎所有在线的东西中。 - -Steven Vaughan-Nichols: [00:09:00] 令微软感到惊讶的是,它开始意识到,Linux 实际上已经开始有一些商业应用,不是在桌面环境,而是在商业服务器上。因此,他们发起了一场运动,我们称之为 FUD- 恐惧、不确定和怀疑 (fear,uncertainty 和 double)。他们说,“哦,Linux 这玩意,真的没有那么好。它不太可靠。你一点都不能相信它”。 - -Saron Yitbarek: [00:09:30] 这种软宣传式的攻击持续了一段时间。微软也不是唯一一个对 Linux 感到紧张的公司。这其实是整个行业在对抗这个奇怪新人的挑战。例如,任何与 UNIX 有利害关系的人都可能将 Linux 视为篡夺者。有一个案例很著名,那就是 SCO 组织(它发行过一种版本的 UNIX) 在过去 10 多年里发起一系列的诉讼,试图阻止 Linux 的传播。SCO 最终失败而且破产了。与此同时,微软一直在寻找机会。他们势在必行。只不过目前还不清楚具体要怎么做。 - -Steven Vaughan-Nichols: [00:10:30] 让微软真正担心的是,第二年,在 2000 年的时候,IBM 宣布,他们将于 2001 年投资 10 亿美元在 Linux 上。现在,IBM 已经不再涉足个人电脑业务。他们还没有走出去,但他们正朝着这个方向前进,他们将 Linux 视为服务器和大型计算机的未来,在这一点上,剧透警告,IBM 是正确的。Linux 将主宰服务器世界。 - -Saron Yitbarek: 这已经不再仅仅是一群黑客喜欢命令行的 Jedi 式的控制了。金钱的投入对 Linux 助力极大。Linux 国际的执行董事 John "Mad Dog" Hall 有一个故事可以解释为什么会这样。我们通过电话与他取得了联系。 - -John Hall: [00:11:30] 我的一个朋友名叫 Dirk Holden[00:10:56],他是德国德意志银行的一名系统管理员,他也参与了个人电脑上早期 X Windows 系统的图形项目中的工作。有一天我去银行拜访他,我说 :“Dirk,你银行里有 3000 台服务器,用的都是 Linux。为什么不用 Microsoft NT 呢?”他看着我说:“是的,我有 3000 台服务器,如果使用微软的 Windows NT 系统,我需要 2999 名系统管理员。”他继续说道:“而使用 Linux,我只需要四个。”这真是完美的答案。 - -Saron Yitbarek: [00:12:00] 程序员们着迷的这些东西恰好对大公司也极具吸引力。但由于 FUD 的作用,一些企业对此持谨慎态度。他们听到开源,就想:"开源。这看起来不太可靠,很混乱,充满了 BUG"。但正如那位银行经理所指出的,金钱听过一种有趣的方式,说服人们克服困境。甚至那些需要网站的小公司也加入了 Linux 阵营。与一些昂贵的专有选择相比,使用一个廉价的 Linux 系统在成本上是无法比拟的。如果您是一家雇佣专业人员来构建网站的商店,那么您很定想让他们使用 Linux。 - -[00:12:30] 让我们快进几年。Linux 运行每个人的网站上。Linux 已经征服了服务器世界,然后智能手机也随之诞生。当然,苹果和他们的 iPhone 占据了相当大的市场份额,而且微软也希望能进入这个市场,但令人惊讶的是,Linux 也在那,已经做好准备了,迫不及待要大展拳脚。 - -作家兼记者 James Allworth。 - -James Allworth: [00:13:00] 当然还有容纳第二个竞争者的空间,那本可以是微软,但是实际上却是 Android,而 Andrid 基本上是基于 Linux 的。众所周知,Android 被谷歌所收购,现在运行在世界上大部分的智能手机上,谷歌在 Linux 的基础上创建了 Android。Linux 使他们能够以零成本从一个非常复杂的操作系统开始。他们成功地实现了这一目标,最终将微软挡在了下一代设备之外,至少从操作系统的角度来看是这样。 - -Saron Yitbarek: [00:13:30] 天崩地裂了,很大程度上,微软有被埋没的风险。John Gossman 是微软 Azure 团队的首席架构师。他还记得当时困扰公司的困惑。 - -John Gossman: [00:14:00] 像许多公司一样,微软也非常担心知识产权污染。他们认为,如果允许开发人员使用开源代码,那么很可能只是复制并粘贴一些代码到某些产品中,就会让某种病毒式的许可证生效从而引发未知的风险…,我认为,这跟公司文化有关,很多公司,包括微软,都对开源开发的意义和商业模式之间的分歧感到困惑。有一种观点认为,开源意味着你所有的软件都是免费的,人们永远不会付钱。 - -Saron Yitbarek: [00:14:30] 任何投资于旧的、专有软件模型的人都会觉得这里发生的一切对他们构成了威胁。当你威胁到像微软这样的大公司时,是的,他们一定会做出反应。他们推动所有这些 FUD(fear,uncertainty,doubt)- 恐惧,不确定性和怀疑是有道理的。当时,商业运作的方式基本上就是相互竞争。不过,如果他们是其他公司的话 (If they'd been any other company,看不懂什么意思),他们可能还会怀恨在心,抱着旧有的想法,但到了 2013 年,一切都变了。 - -[00:15:00] 微软的云计算服务 Azure 上线了,令人震惊的是,它从第一天开始就提供了 Linux 虚拟机。Steve Ballmer,这位把 Linux 称为癌症的首席执行官,已经离开了,代替他的是一位新的有远见的首席执行官 Satya Nadella。 - -John Gossman: Satya 有不同的看法。他属于另一个世代。比 Paul,Bill 和 Steve 更年轻的世代,他对开源有不同的看法。 - -Saron Yitbarek: John Gossman,再说一次,来自于 微软的 Azure 团队。 - -John Gossman: [00:16:00] 大约四年前,处于实际需要,我们在 Azure 中添加了 Linux 支持。如果访问任何一家企业客户,你都会发现他们并没有试图决定是使用 Windows 还是使用 Linux、 使用 .net 还是使用 Java TM。他们在很久以前就做出了决定——大约 15 年前才有这样的一些争论。现在,我见过的每一家公司都混合了 Linux 和 Java、Windows 和 .net、SQL Server、Oracle 和 MySQL—— 基于专有源代码的产品和开放源代码的产品。 - -如果你正在运维着一个云,允许这些公司在云上运行他们的业务,那么你就不能简单地告诉他们,“你可以使用这个软件,但你不能使用那个软件。” - -Saron Yitbarek: [00:16:30] 这正是 Satya Nadella 采纳的哲学思想。2014 年秋季,他站在舞台上,希望传递一个重要信息。微软爱 Linux。他接着说,Azure 20% 的业务量已经是 Linux 了,微软将始终对 Linux 发行版提供一流的支持。没有哪怕一丝对开源的宿怨。 - -为了说明这一点,在他们的背后有一个巨大的标志,上面写着 :“Microsoft hearts Linux”。哇哇哇。对我们中的一些人来说,这种转变有点令人震惊,但实际上,无需如此震惊。下面是 Steven Levy,一名科技记者兼作家。 - -Steven Levy: [00:17:30] 当你在踢足球的时候,如果草坪变滑了,那么你也许会换一种不同的鞋子。他们当初就是这么做的。他们不能否认现实而且他们之间也有有聪明人,所以他们必须意识到,这就是世界的运行方式,不管他们早些时候说了什么,即使他们对之前的言论感到尴尬,但是让他们之前关于开源多么可怕的言论影响到现在明智的决策那才真的是疯了。 - -Saron Yitbarek: [00:18:00] 微软低下了它高傲的头。你可能还记得苹果公司,经过多年的孤立无援,最终转向与微软构建合作伙伴关系。现在轮到微软进行 180 度转变了。经过多年的与开源方法的战斗后,他们正在重塑自己。要么改变,要么死亡。Steven Vaughan-Nichols。 - -Steven Vaughan-Nichols: [00:18:30] 即使是像微软这样规模的公司也无法与成千上万的开源开发者竞争,这些开发者开发这包括 Linux 在内的其他大项目。很长时间以来他们都不愿意这么做。前微软首席执行官史蒂夫·鲍尔默 (SteveBallmer) 对 Linux 深恶痛绝。由于它的 GPL 许可证,让 Linux 称为一种癌症,但一旦鲍尔默被扫地出门,新的微软领导层说,“这就好像试图命令潮流不要过来,但潮水依然会不断涌进来。我们应该与 Linux 合作,而不是与之对抗。” - -Saron Tiebreak: [00:19:00] 真的,在线技术历史上最大的胜利之一就是微软能够做出这样的转变,当他们最终决定这么做的时候。当然,当微软出现在开源的桌子上时,老的、铁杆 Linux 支持者是相当怀疑的。他们不确定自己是否能接受这些家伙,但正如沃恩-尼科尔斯所指出的,今天的微软根本不是你父母的微软。事实上,互联网技术历史上最大的胜利之一就是让微软最终做出如此转变。当然,当微软出现在开源桌上时,老一代的、铁杆 Linux 支持者是相当怀疑的。他们不确定自己是否能接受这些家伙,但正如 Vaughan-Nichols 所指出的,今天的微软已经不是你父母那一代时的微软了。 - -Steven Vaughan-Nichols : [00:19:30] 2017 年的微软既不是史蒂夫•鲍尔默 (Steve Ballmer) 的微软,也不是比尔•盖茨 (Bill Gates) 的微软。这是一家完全不同的公司,有着完全不同的方法,而且,开源软件一旦被放出,就无法被收回。开源已经吞噬了整个技术世界。从未听说过 Linux 的人可能对它并不了解,但是每次他们访问 Facebook,他们都在运行 Linux。每次执行谷歌搜索时,你都在运行 Linux。 - -[00:20:00] 每次你用 Android 手机,你都在运行 Linux。它确实无处不在,微软无法阻止它,我认为以为微软可以以某种方式接管它的想法,太天真了。 - -Saron Yitbarek: [00:20:30] 开源支持者可能一直担心微软会像混入羊群中的狼一样,但事实是,开源软件的本质保护了它无法被完全控制。没有一家公司能够拥有 Linux 并以某种特定的方式控制它。Greg Kroah-Hartman 是 Linux 基金会的一名成员。 - -Greg Kroah-Hartman: 每个公司和个人都以自私的方式为 Linux 做出贡献。他们之所以这样做是因为他们想要解决他们所面临的问题,可能是硬件无法工作,或者是他们想要添加一个新功能来做其他事情,又或者想在他们的产品中使用它。这很棒,因为他们会把代码贡献回去,此后每个人都会从中受益,这样每个人都可以用到这份代码。正是因为这种自私,所有的公司,所有的人,所有的人都能从中受益。 - -Saron Yitbarek: [00:21:30] 微软已经意识到,在即将到来的云战争中,与 Linux 作战就像与空气作战一样。Linux 和开源不是敌人,它们是一种氛围。今天,微软以白金会员的身份加入了 Linux 基金会。他们成为 GitHub 开源项目的头号贡献者。2017 年 9 月,他们甚至加入了 Open Source Initiative 组织。现在,微软在开放许可下发布了很多代码。微软的 John Gossman 描述了他们开源 .net 时所发生的事情。起初,他们并不认为自己能得到什么回报。 - -John Gossman: [00:22:00] 我们本没有指望来自社区的贡献,然而,三年后,超过 50% 的对 .net 框架库的贡献来自于微软之外。这包括大量的代码。三星为 .net 提供了 ARM 支持。Intel 和 ARM 以及其他一些芯片厂商已经为 .net 框架贡献了特定于他们处理器的代码生成,以及数量惊人的修复、性能改进等等——既有单个贡献者也有社区。 - -Saron Yitbarek: 直到几年前,我们今天拥有的这个微软,这个开放的微软,还是不可想象的。 - -[00:23:00] 我是 Saron Yitbarek,这里是代码英雄。好吧,我们已经看到了为了赢得数百万桌面用户的爱而战的激烈场面。我们已经看到开源软件在私有巨头的背后悄然崛起,并攫取了巨大的市场份额。我们已经看到了一批批的代码英雄将编程领域变成了我你现在看到的这个样子。今天,大企业正在吸收开源软件,通过这一切,每个人都从他人那里受益。 - -[00:23:30] 在狂野的西方科技界,一贯如此。苹果受到施乐的启发,微软受到苹果的启发,Linux 受到 UNIX 的启发。进化,借鉴,不断成长。如果比喻成大卫和歌利亚(西方经典的以弱胜强战争中的两个主角)的话,开源软件不再是大卫,但是,你知道吗?它也不是歌利亚。开源已经超越了传统。它已经成为其他人战斗的战场。随着开源变得不可避免,新的战争,那些在云计算中进行的战争,那些在开源战场上进行的战争,都在增加。 - -这是 Steven Levy,他是一名作者。 - -Steven Levy: [00:24:00] 基本上,到目前为止,包括微软在内,我们有四到五家公司,正以各种方式努力把自己打造成为我们的工作平台,比如人工智能领域。你能看到智能助手之间的战争,你猜怎么着?苹果有一个智能助手,叫 Siri。微软有一个,叫 Cortana。谷歌有谷歌助手。三星也有一个智能助手。亚马逊也有一个,叫 Alexa。我们看到这些战斗遍布各地。也许,你可以说,最热门的人工智能平台将控制我们生活中所有的东西,而这五家公司就是在为此而争斗。 - -Saron Yitbarek: 现在很难再找到另一个反叛者,它就像 Linux 奇袭微软那样,偷偷潜入 Facebook、 谷歌或亚马逊,攻其不备。因为正如作家 James Allworth 所指出的,成为一个真正的反叛者者只会变得越来越难。 - -James Allworth: [00:25:30] 规模一直以来都是一种优势,但规模优势本质上……怎么说呢,我认为以前它们在本质上是线性的,现在它们在本质上是指数型的了,所以,一旦你开始以某种方法走在前面,另一个新玩家要想赶上来就变得越来越难了。我认为在互联网时代这大体来说来说是正确的,无论是因为规模,还是数据赋予组织的重要性和优势,就其竞争能力而言。一旦你走在前面,你就会吸引更多的客户,这就给了你更多的数据,让你能做得更好,这之后,客户还有什么理由选择排名第二的公司呢,难道是因为因为他们落后了这么远么?我认为在云的时代这个逻辑也不会有什么不同。 - -Saron Yitbarek: [00:26:00] 这个故事始于史蒂夫•乔布斯 (Steve Jobs) 和比尔•盖茨 (Bill Gates) 这样的非凡的英雄,但科技的进步已经呈现出一种众包、有机的感觉。我认为据说我们的开源英雄 Linus Torvalds 在第一次发明 Linux 内核时甚至没有一个真正的计划。他无疑是一位才华横溢的年轻开发者,但他也像潮汐前的一滴水一样。变革是不可避免的。据估计,对于一家私有专利公司来说,用他们老式的、专有的方式创建一个 Linux 发行版将花费他们超过 100 亿美元。这说明了开源的力量。 - -[00:26:30] 最后,这并不是一个专利模型所能与之竞争的东西。成功的公司必须保持开放。这是最大、最终极的教训。还有一点要记住:当我们连接在一起的时候,我们在已有基础上成长和建设的能力是无限的。不管这些公司有多大,我们都不必坐等他们给我们更好的东西。想想那些为了纯粹的创造乐趣而学习编码的新开发者,那些自己动手丰衣足食的人。 - -未来的优秀程序员无管来自何方,只要能够访问代码,他们就能构建下一个大项目。 - -[00:27:30] 以上就是我们关于操作系统战争的两个故事。这场战争塑造了我们的数字生活。争夺主导地位的斗争从桌面转移到了服务器室,最终进入了云计算领域。过去的敌人难以置信地变成了盟友,众包的未来让一切都变得开放。听着,我知道,在这段历史之旅中,还有很多英雄我们没有提到,所以给我们写信吧。分享你的故事。Redhat.com/commandlineheroes。我恭候佳音。 - -在本季剩下的时间里,我们将学习今天的英雄们在创造什么,以及他们要经历什么样的战斗才能将他们的创造变为现实。让我们从艰苦卓绝的编程一线回来看看更多的传奇故事吧。我们每两周放一集新的博客。几周后,我们将为您带来第三集:敏捷革命。 - -[00:28:00] 命令行英雄是一款红帽公司原创的播客。要想免费自动获得新一集的代码英雄,请订阅我们的节目。只要在苹果播客 、Spotify、 谷歌 Play,或其他应用中搜索“代码英雄”。然后点击“订阅”。这样你就会第一个知道什么时候有新剧集了。 - -我是 Saron Yitbarek。感谢收听。继续编码。 - --------------------------------------------------------------------------------- - -via: https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux - -作者:[redhat][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.redhat.com -[b]: https://github.com/lujun9972 diff --git a/translated/talk/20180720 A brief history of text-based games and open source.md b/translated/talk/20180720 A brief history of text-based games and open source.md deleted file mode 100644 index 3cba19ebcb..0000000000 --- a/translated/talk/20180720 A brief history of text-based games and open source.md +++ /dev/null @@ -1,151 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (cycoe) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A brief history of text-based games and open source) -[#]: via: (https://opensource.com/article/18/7/interactive-fiction-tools) -[#]: author: (Jason Mclntosh https://opensource.com/users/jmac) - -关于文字游戏与开源的简史 -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/compass_map_explore_adventure.jpg?itok=ecCoVTrZ) - -[互动小说技术基金会(IFTF: Interactive Fiction Technology Foundation)][1] 是一个非营利组织,致力于保护那些用来生成我们称之为互动小说的数字艺术形式的技术。当 Opensource.com 的一位社区版主提出一篇关于 IFTF、它支持的技术与服务,以及它如何与开源相交织的文章时,我发现这对于我经常讲的几十的故事来说,是个新颖的视角。互动小说的历史比自由及开源软件(FOSS: Free and Open Source Software)运动的历史要长,但同时也与之密切相关。希望你们能喜欢我在这里的分享。 - -### 定义和历史 - -对于我来说,交互式小说这个术语包括了读者主要通过文本与之交互的任何视频游戏或数字化艺术作品。这个术语起源于 20 世纪 80 年代,当时由语法解析器驱动的文本冒险游戏在美国主要体现在,[魔域][2]、[银河系漫游指南][3],以及 [Infocom][4] 正规定义的家用电脑娱乐。在 20 世纪 90 年代,它的主流商业价值被挖掘出来,但在线爱好者社区还是依照传统,发布游戏和游戏创建工具。 - -在四分之一个世纪之后的今天,互动小说包括了品种繁多并且妙趣橫生的作品,如从充满谜题的文字冒险游戏到衍生改良的超文本类型。定期的在线竞赛和节日为品鉴试玩新作品提供了个好地方---英语互动小说世界每年都会举办一次活动,包括 [Spring Thing][5] 和 [IFComp][6]。后者是自 1995 年以来现代互动小说的核心活动,这也使它成为在同类型中持续举办时间最长的游戏展示活动。[IFComp 从 2017 年开始的评选和排名记录][7] 展示了如今基于文本的游戏在形式、风格和主题方面的惊人多样性。 - -(作者注:以上我特指英语,因为可能出于写作方面的技术原因,互动小说社区倾向于按语言进行区分。当然也有 [法语][8] 或 [意大利语][9] 的互动小说年度活动,比如我就听说过至少一届中文互动小说节。幸运的是,这些边界易于打破。在我管理 IFComp 的四年中,我们很欢迎来自国际社区的英语翻译作品。) - -![”假冒的猴子“游戏截图][11] - -在解释器 Lectrote 上启动 Emily Short 的”假冒的猴子“新游戏(二者皆为开源软件)。 - -此外由于互动小说专注于文本,它为玩家和作者都提供了最方便的平台。几乎所有能阅读数字化文本的人(包括能通过文字转语音软件等辅助技术阅读的用户)都能玩大部分的互动小说作品。互动小说创作对所有愿意学习和使用其工具和技术的作家开放。 - -这使我们了解了互动小说与开源的长期关系,以及从它的全盛时期以来,对于艺术形式可用性的积极影响。接下来我将提供现代开源互动小说创建工具的概览,并讨论关于共享源代码这个古老且有点稀奇的互动小说作品传统。 - -### 开源互动小说工具的世界 - -一些开发平台(其中大部分是开源的)可用于创建传统的语法解析器驱动互动小说,其中用户可通过输入命令(如 `向北走`、`拾取提灯`、`收养小猫` 或 `向 Zoe 询问量子机械学`)来与游戏世界交互。20 世纪 90 年代初期出现了几个黑客(此处指拥有友好的语法解析器)游戏开发工具箱,其中目前还在使用的有 [TADS][12]、[Alan][13] 和 [Quest][14],它们都是开源的,并且后两者兼容 FOSS 许可证。 - -其中最出名的是 [Inform][15],1993 年 Graham Nelson 发布了第一个版本,目前由 Nelson 领导的一个团队进行维护。Inform 的源代码是半开源的:Inform 6 是前一个主要版本,[它通过 Artistic 许可证开放源码][16]。这其中蕴涵比我们所看到的更直接的相关性,因为其它专有的 Inform 7 将 Inform 6 作为其核心,在让它将作品编译为机器码之前,将其 [杰出的自然语言语法][17] 翻译为其前身那种更类似 C 的代码。 - -![inform 7 集成式开发环境截图][19] - -包含文档以及一个示例项目的 Inform 7 集成式开发环境 - -Inform 游戏运行在虚拟机上,这是 Inform 时代的遗留产物。当时的发行者为了让同一个游戏运行在 Apple II、Commodore 4、Atari 800 以及其它种类的“[家用计算机][20]”上,将虚拟机作为解决方案。这些原本流行的操作系统中只有少数至今仍存在,但 Inform 的虚拟机使得 Inform 创建的作品能够通过 Inform 解释器运行在任何的计算机上。这些虚拟机包括相对现代的 [Glulx][21],或者通过对 Inform 过去的虚拟机进行逆向工程克隆得到的可爱的古董 [Z-machine][22]。现在,流行的跨平台解释器包括如 [lectrote][23] 和 [Gargoyle][24] 等桌面程序,以及如 [Quixe][25] 和 [Parchment][26] 等基于浏览器的程序。以上所有均为开源软件。 - -如其它的流行开源项目一样,如果 Inform 的发展进程随着它的成熟而逐渐变缓,它为我们留下的最重要的财富就是其活跃透明的生态环境。对于 Inform 来说,(这些财富)包括前面提到的解释器、[语言扩展集合][27](通常混合使用 Inform 6 和 Inform 7 写成),当然也包括所有用它们写成并分享于世界的作品,有的时候也包括那些源代码。(在这篇文章的后半部分我会回到这个话题) - -互动小说创建工具在 21 世纪被发明,力求在传统的语法解析器之外探索一种新的玩家交互方式,即创建任何现代 Web 浏览器都能加载的超文本驱动作品。其中的领头羊是 [Twine][28],原本由 Klimas 在 2009 年开发,目前作为 [GNU 许可证开源项目][29] 由许多贡献者进行活跃开发。(事实上,[Twine][30] 的开源软件血统可追溯到 [TiddlyWiki][31],一个由 Klimas 最初继承的项目) - -对于互动小说开发来说,Twine 代表一系列最开放及最可用的方法。由于它的 FOSS 天性,它通过完备的网页来展示渲染输出,不依赖于需要进一步特殊编译的机器码,而是使用开放并且成熟的 HTML、CSS 和 JavaScript 标准。作为一个创建工具,Twine 能够根据创建者的技能等级,暴露与之相匹配的复杂度。拥有很少或没有编程知识的用户能够创建简单但是可玩的互动小说作品,但那些拥有更多编码和设计技能(包括通过开发 Twine 游戏获得的技能提升)的用户能够创建更复杂的项目。近几年 Twine 在教育领域的可见度和流行度有不小的提升,对此你不要感到太惊讶哦。 - -另一些值得注意的开源互动小说开发项目包括由 Ian Millington 开发的以 MIT 许可证发布的 [Undum][32],以及由 Dan Fabulich 和 [Choice of Games][34] 团队开发的 [ChoiceScript][33],两者也专注于将 Web 浏览器作为游戏平台。除了以上严格的开发系统以外,基于 Web 的互动小说也呈现给我们以开源作品的丰富、变幻的生态。比如 Furkle 的 [Twine 扩展工具集][35],以及 Liza Daly 为自己的互动小说游戏创建的名为 [Windrift][36] 的 JavaScript 框架。 - -### 程序、游戏,以及游戏程序 - -Twine 受益于 [一个致力于提供支持的长期 IFTF 计划][37],它允许公众为其维护和发展提供资助。IFTF 还直接支持两个长期公共服务,IFComp 和互动小说归档,这两个服务都依赖并回馈开放软件和技术。 - -![Harmonia 开场截图][39] - -由 Liza Daly 开发的“Harmonia”的开场画面,该游戏使用 Windrift 开源互动小说创建框架创建。 - -自 2014 年以来,用于运行 IFComp 网站的基于 Perl 和 JavaScript 的应用程序一直是 [一个共享源代码项目][40],它反映了 [互动小说特有子组件使用的 FOSS 许可证是个大杂烩][41],其中包括那些允许解析器驱动的竞争条目在 Web 浏览器中运行的各式各样的代码库。在 1992 年上线并 [在 2017 年成为一个 IFTF 项目][43] 的 [互动小说归档][42],是一套完全基于古老且稳定的互联网标准的镜像仓库,只使用了 [一点开源 Pyhon 脚本][44] 用来处理索引。 - -### 最后,也是最有趣的部分,让我们聊聊开源文字游戏 - -归档的主体 [由游戏组成][45],当然,是那些历经岁月的游戏。它们反映了数十年来不断发展的游戏设计趋势和互动小说工具发展。 - -许多互动小说作品都共享其源代码,社区对于找到它们的快速入门解决方案很简单---[在 IFDB 中搜索标签“source available”][46]。IFDB 是另一个长期运行的互动小说社区服务,由 TADS 的创立者 Mike Roberts 私人运营。对更加简单的界面感到舒适的用户,也可能希望浏览互动小说归档的 [`games/source` 目录][47],该目录按开发平台和编写语言对内容运行分组(也有很多作品,由于太繁杂或太古老而无法分类,只能浮于列表的开头)。 - -对这些代码共享游戏随机抽取的几个样本,揭示了一个有趣的窘境:与更广阔的开源软件世界不同,互动小说社区缺少一种普遍认同的方式来授权它生成的所有代码。与软件工具(包括我们用来创建互动小说的所有工具)不同的是,从字面意思上讲,交互式小说游戏是一件艺术作品。这意味着,将面向软件的开源许可证用于交互式小说游戏,并没有比用于其它像散文或诗歌作品更适合。但同样,互动小说游戏也是一个软件,它展示了创建者希望合法地与世界分享的源代码模式和技术。一个拥有开源意识的互动小说创建者会怎么做呢? - -有些游戏通过将其代码传递到公共领域来解决这一问题,或者通过明确的许可证,亦或者如 [42 年前由 Crowther 和 Woods 开发的”冒险之旅“][48] 一样通过社区发布。一些人试图将其中的不同部分分开,应用他们自己的许可证,允许免费复用游戏公开的业务逻辑,但禁止针对其散文内容的再创作。这是我在开源自己的游戏 [莺巢][49] 时采取的策略。天知道这是否能在法律上站得住脚,但我当时没有更好的主意。 - -当然,你会发现一些作品对所有部分使用单一的许可证,而不介意反对者。一个突出的例子就是 [Emily Short 的史诗作品”假冒的猴子“][50],其全部采用 Creative Commons 4.0 许可证发布。[CC 对其应用于代码感到不满][51],但你可以认为 [Inform 7 源码这种不寻常的散文风格特性][52] 至少比传统的软件项目更适合 CC 许可证。 - -### 接下来要做什么呢,冒险者? - -如果你希望开始探索互动小说的世界,这里有几个链接可供你参考: - - -+ 如上所述,IFDB 和互动小说归档都提供了可浏览的界面,用于浏览超过 40 年价值的互动小说作品。其中大部分可以在 Web 浏览器中播放,但有些需要额外的解释器程序。IFDB 能帮助你找到并安装它们。 - - IFComp 的年度结果页面展现了另一个视图,帮助你了解最佳的免费和归档可用作品。 - -+ 互动小说技术基金会是一个非营利的慈善组织,主要帮助并支持 Twine、IFComp 和互动小说归档的发展,以及提升互动小说的无障碍功能、探索互动小说在教育领域中的应用等等。加入其邮件列表,可以接收 IFTF 的每月资讯,浏览其博客,亦或浏览一些主题商品。 - -+ 在今年的早些时候,John Paul Wohlscheid 写了这篇关于开源互动小说工具的文章。它涵盖了一些这里没有提及的平台,所以如果你还想了解更多,请看一看这篇文章。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/interactive-fiction-tools - -作者:[Jason Mclntosh][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[cycoe](https://github.com/cycoe) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/jmac -[1]:http://iftechfoundation.org/ -[2]:https://en.wikipedia.org/wiki/Zork -[3]:https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy_(video_game) -[4]:https://en.wikipedia.org/wiki/Infocom -[5]:http://www.springthing.net/ -[6]:http://ifcomp.org/ -[7]:https://ifcomp.org/comp/2017 -[8]:http://www.fiction-interactive.fr/ -[9]:http://www.oldgamesitalia.net/content/marmellata-davventura-2018 -[10]:/file/403396 -[11]:https://opensource.com/sites/default/files/uploads/monkey.png (counterfeit monkey game screenshot) -[12]:http://tads.org/ -[13]:https://www.alanif.se/ -[14]:http://textadventures.co.uk/quest/ -[15]:http://inform7.com/ -[16]:https://github.com/DavidKinder/Inform6 -[17]:http://inform7.com/learn/man/RB_4_1.html#e307 -[18]:/file/403386 -[19]:https://opensource.com/sites/default/files/uploads/inform.png (inform 7 IDE screenshot) -[20]:https://www.youtube.com/watch?v=bu55q_3YtOY -[21]:http://ifwiki.org/index.php/Glulx -[22]:http://ifwiki.org/index.php/Z-machine -[23]:https://github.com/erkyrath/lectrote -[24]:https://github.com/garglk/garglk/ -[25]:http://eblong.com/zarf/glulx/quixe/ -[26]:https://github.com/curiousdannii/parchment -[27]:https://github.com/i7/extensions -[28]:http://twinery.org/ -[29]:https://github.com/klembot/twinejs -[30]:/article/18/7/twine-vs-renpy-interactive-fiction -[31]:https://tiddlywiki.com/ -[32]:https://github.com/idmillington/undum -[33]:https://github.com/dfabulich/choicescript -[34]:https://www.choiceofgames.com/ -[35]:https://github.com/furkle -[36]:https://github.com/lizadaly/windrift -[37]:http://iftechfoundation.org/committees/twine/ -[38]:/file/403391 -[39]:https://opensource.com/sites/default/files/uploads/harmonia.png (Harmonia opening screen shot) -[40]:https://github.com/iftechfoundation/ifcomp -[41]:https://github.com/iftechfoundation/ifcomp/blob/master/LICENSE.md -[42]:https://www.ifarchive.org/ -[43]:http://blog.iftechfoundation.org/2017-06-30-iftf-is-adopting-the-if-archive.html -[44]:https://github.com/iftechfoundation/ifarchive-ifmap-py -[45]:https://www.ifarchive.org/indexes/if-archiveXgames -[46]:http://ifdb.tads.org/search?sortby=ratu&searchfor=%22source+available%22 -[47]:https://www.ifarchive.org/indexes/if-archiveXgamesXsource.html -[48]:http://ifdb.tads.org/viewgame?id=fft6pu91j85y4acv -[49]:https://github.com/jmacdotorg/warblers-nest/ -[50]:https://github.com/i7/counterfeit-monkey -[51]:https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software -[52]:https://github.com/i7/counterfeit-monkey/blob/master/Counterfeit%20Monkey.materials/Extensions/Counterfeit%20Monkey/Liquids.i7x diff --git a/translated/talk/20190725 How to transition into a career as a DevOps engineer.md b/translated/talk/20190725 How to transition into a career as a DevOps engineer.md deleted file mode 100644 index 9735ee727c..0000000000 --- a/translated/talk/20190725 How to transition into a career as a DevOps engineer.md +++ /dev/null @@ -1,101 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (beamrolling) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to transition into a career as a DevOps engineer) -[#]: via: (https://opensource.com/article/19/7/how-transition-career-devops-engineer) -[#]: author: (Conor Delanbanque https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque) - -如何转职为 DevOps 工程师 -====== -无论你是刚毕业的大学生,还是想在职业中寻求进步的经验丰富的 IT 专家,这些提示都可以帮你成为 DevOps 工程师。 - -![technical resume for hiring new talent][1] - -DevOps 工程是一个备受称赞的热门职业。不管你是刚毕业正在找第一份工作,还是在利用之前的行业经验的同时寻求学习新技能的机会,本指南都能帮你通过正确的步骤成为[ DevOps 工程师][2]. - -### 让自己沉浸其中 - -首先学习 [DevOps][3] 的基本原理,实践以及方法。在使用工具之前,先了解 DevOps 背后的“为什么”。DevOps 工程师的主要目标是在整个软件开发生命周期(SDLC)中提高速度并保持或提高质量,以提供最大的业务价值。阅读文章,观看 YouTube 视频,参加当地小组聚会或者会议 — 成为热情的 DevOps 社区中的一员,在那里你将从先行者的错误和成功中学习。 - -### 考虑你的背景 - -如果你有从事技术工作的经历,例如软件开发人员,系统工程师,系统管理员,网络运营工程师或者数据库管理员,那么你已经拥有了广泛的见解和有用的经验,它们可以帮助你在未来成为 DevOps 工程师。如果你在完成计算机科学或任何其他 STEM(译者注,STEM 是科学 Science,技术 Technology,工程 Engineering 和数学 Math四个学科的首字母缩略字)领域的学业后刚开始职业生涯,那么你将拥有在这个过渡期间需要的一些基本踏脚石。 - -DevOps 工程师的角色涵盖了广泛的职责。以下是企业最有可能使用他们的三种方向: - -* **偏向于开发(Dev)的 DevOps 工程师**在构建应用中扮演软件开发的角色。他们日常工作的一部分是利用持续集成 / 持续交付(CI/CD),共享仓库,云和容器,但他们不一定负责构建或实施工具。他们了解基础架构,并且在成熟的环境中,能将自己的代码推向生产环境。 -* **偏向于运维技术(Ops)的 DevOps 工程师**可以与系统工程师或系统管理员进行比较。他们了解软件的开发,但并不会把一天的重心放在构建应用上。相反,他们更有可能支持软件开发团队将手动流程自动化的过程,并提高人员和技术系统的效率。这可能意味着分解遗留代码并用较少繁琐的自动化脚本来运行相同的命令,或者可能意味着安装,配置或维护基础结构和工具。他们确保为任何有需要的团队安装可使用的工具。他们也会通过教授如何利用 CI / CD 和其他 DevOps 实践来帮助团队。 -* **网站可靠性工程师(SRE)** 就像解决运维和基础设施的软件工程师。SRE 专注于创建可扩展,高度可用且可靠的软件系统。 - - - -在理想的世界中,DevOps 工程师将了解以上所有领域;这在成熟的科技公司中很常见。然而,顶级银行和许多财富 500 强企业的 DevOps 职位通常会偏向开发(Dev)或运营(Ops)。 - -### 要学习的技术 - -DevOps 工程师需要了解各种技术才能有效完成工作。无论你的背景如何,请从作为 DevOps 工程师使用和理解的基础技术入手。 - -#### 操作系统 - -操作系统是所有东西运行的地方,拥有相关的基础知识十分重要。 [Linux ][4]是你最有可能每天使用的操作系统,尽管有的组织会使用 Windows 操作系统。要开始使用,你可以在家中安装 Linux,在那里你可以随心所欲地打破并学习。 - -#### 脚本 - -接下来,选择一门语言来学习脚本。有很多语言可供选择,包括 Python,Go,Java,Bash,PowerShell,Ruby,和 C / C++。我建议[从 Python 开始][5],因为它相对容易学习和解释,是最受欢迎的语言之一。Python 通常是为了遵循面向对象编程(OOP)的基础而写的,可用于 Web 开发,软件开发以及创建桌面 GUI 和业务应用程序。 - -#### 云 - -学习了 [Linux][4] 和 [Python][5] 之后,我认为下一个该学习的是云计算。基础设施不再只是“运维小哥”的事情了,因此你需要接触云平台,例如 AWS 云服务,Azure 或者谷歌云平台。我会从 AWS 开始,因为它有大量免费学习工具,可以帮助你降低作为开发人员,运维,甚至面向业务的组件的任何障碍。事实上,你可能会被它提供的东西所淹没。考虑从 EC2, S3 和 VPC 开始,然后看看你从其中想学到什么。 - -#### 编程语言 - -如果你带着对软件开发的热情来到 DevOps,请继续提高你的编程技能。DevOps 中的一些优秀和常用语言与脚本相同:Python,Go,Java,Bash,PowerShell,Ruby 和 C / C++。你还应该熟悉 Jenkins 和 Git / Github,你将会在 CI / CD 过程中经常使用到它们。 - -#### 容器 - -最后,使用 Docker 和编排平台(如 Kubernetes)等工具开始学习[容器化][6]。网上有大量的免费学习资源,大多数城市都有本地的线下小组,你可以在友好的环境中向有经验的人学习(还有披萨和啤酒哦!)。 - -#### 其他的呢? - -如果你缺乏开发经验,你依然可以通过对自动化的热情,效率的提高,与他人协作以及改进自己的工作[参与到 DevOps 中][3]来。我仍然建议学习上述工具,但重点不要放在编程 / 脚本语言上。了解基础架构即服务,平台即服务,云平台和 Linux 会非常有用。你可能正在设置工具并学习如何构建有弹性和容错性的系统,并在写代码时利用它们。 - -### 找一份 DevOps 的工作 - -求职过程会有所不同,具体取决于你是否一直从事技术工作,并且正在进入 DevOps 领域,或者你是刚开始职业生涯的毕业生。 - -#### 如果你已经从事技术工作 - -如果你正在从一个技术领域转入 DevOps 角色,首先尝试在你当前的公司寻找机会。你可以和其他的团队一起工作吗?尝试影响其他团队成员,寻求建议,并在不离开当前工作的情况下获得新技能。如果做不到这一点,你可能需要换另一家公司。如果你能从上面列出的一些实践,工具和技术中学习,你将能在面试时展示相关知识中占据有利位置。关键是要诚实,不要让自己陷入失败中。大多数招聘主管都了解你不知道所有的答案;如果你能展示你所学到的东西,并解释你愿意学习更多,你应该有机会获得 DevOps 的工作。 - -#### 如果你刚开始职业生涯 - -申请雇用初级 DevOps 工程师的公司的开放机会。不幸的是,许多公司表示他们希望寻找更富有经验的人,并建议你在获得经验后再申请该职位。这是“我们需要经验丰富的人”的典型,令人沮丧的场景,并且似乎没人愿意给你第一次机会。 - -然而,并不是所有求职经历都那么令人沮丧;一些公司专注于培训和提升刚从大学毕业的学生。例如,我工作的 [MThree][7] 聘请来应届毕业生并且对其进行了 8 周的培训。当完成培训后,参与者们可以充分了解到整个 SDLC,并很好地了解它在财富 500 强公司相关环境中的应用。毕业生被聘为 MThree 的客户公司的初级 DevOps 工程师 — MThree 在前 18 - 24 个月内支付全职工资和福利,之后他们将作为直接雇员加入客户。这是弥合从大学到技术职业的间隙的好方法。 - -### 总结 - -转换成 DevOps 工程师的方法有很多种。这是一条非常有益的职业路线,可能会让你保持繁忙和挑战 — 并增加你的收入潜力。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/how-transition-career-devops-engineer - -作者:[Conor Delanbanque][a] -选题:[lujun9972][b] -译者:[beamrolling](https://github.com/beamrolling) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hiring_talent_resume_job_career.png?itok=Ci_ulYAH (technical resume for hiring new talent) -[2]: https://opensource.com/article/19/7/devops-vs-sysadmin -[3]: https://opensource.com/resources/devops -[4]: https://opensource.com/resources/linux -[5]: https://opensource.com/resources/python -[6]: https://opensource.com/article/18/8/sysadmins-guide-containers -[7]: https://www.mthreealumni.com/ diff --git a/translated/tech/20181213 Podman and user namespaces- A marriage made in heaven.md b/translated/tech/20181213 Podman and user namespaces- A marriage made in heaven.md deleted file mode 100644 index 166a0f8b0b..0000000000 --- a/translated/tech/20181213 Podman and user namespaces- A marriage made in heaven.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Podman and user namespaces: A marriage made in heaven) -[#]: via: (https://opensource.com/article/18/12/podman-and-user-namespaces) -[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) - -Podman 和用户名字空间:天作之合 -====== - -> 了解如何使用 Podman 在单独的用户空间运行容器。 - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/architecture_structure_planning_design_.png?itok=KL7dIDct) - -[Podman][1] 是 [libpod][2] 库的一部分,使用户能够管理 pod、容器和容器镜像。在我的上一篇文章中,我写过 [Podman 作为一种更安全的运行容器的方式][3]。在这里,我将解释如何使用 Podman 在单独的用户命名空间中运行容器。 - -我一直在思考[用户命名空间][4]user namespace,它主要是由 Red Hat 的 Eric Biederman 开发的,作为分离容器的一个很棒的功能。用户命名空间允许你指定用于运行容器的用户标识符(UID)和组标识符(GID)映射。这意味着你可以在容器内运行 UID 0,在容器外运行 UID 100000。如果容器进程逃逸出了容器,内核会将它们视为 UID 100000。不仅如此,任何未映射到用户命名空间的 UID 所拥有的任何文件对象都将被视为 `nobody` 所拥有(65534,`kernel.overflowuid`),并且不允许容器进程访问,除非该对象可由“其他人”访问(世界可读/可写)。 - -如果你拥有一个权限为 [660][5] 的属主为“真实” `root` 的文件,并且用户命名空间中的容器进程尝试读取它,则会阻止它们访问它,并且会将该文件视为 `nobody` 所拥有。 - -### 示例 - -以下是它是如何工作的。首先,我在 `root` 拥有的系统中创建一个文件。 - -``` -$ sudo bash -c "echo Test > /tmp/test" -$ sudo chmod 600 /tmp/test -$ sudo ls -l /tmp/test --rw-------. 1 root root 5 Dec 17 16:40 /tmp/test -``` - -接下来,我将该文件卷挂载到一个使用用户命名空间映射 `0:100000:5000` 运行的容器中。 - -``` -$ sudo podman run -ti -v /tmp/test:/tmp/test:Z --uidmap 0:100000:5000 fedora sh -# id -uid=0(root) gid=0(root) groups=0(root) -# ls -l /tmp/test --rw-rw----. 1 nobody nobody 8 Nov 30 12:40 /tmp/test -# cat /tmp/test -cat: /tmp/test: Permission denied -``` - -上面的 `--uidmap` 设置告诉 Podman 在容器内映射一系列 5000 个 UID,从容器外的 UID 100000开始(因此范围是 100000-104999)到容器内 UID 0 开始的范围(所以范围是 0-4999)。在容器内部,如果我的进程以 UID 1 运行,则它在主机上为 100001。 - -由于实际的 `UID=0` 未映射到容器中,因此 `root` 拥有的任何文件都将被视为 `nobody` 所拥有。即使容器内的进程具有 `CAP_DAC_OVERRIDE`,也无法覆盖此种保护。`DAC_OVERRIDE` 使根进程能够读/写系统上的任何文件,即使进程不是 `root` 用户拥有,也不是全局可读或可写的。 - -用户命名空间功能与主机上的功能不同。它们是命名空间功能。这意味着我的容器根只在容器内具有功能,实际上只在映射到用户命名空间的 UID 范围内。如果容器进程逃逸了容器,则它将没有任何功能而不是映射到用户命名空间的 UID,包括 UID=0。即使进程可能以某种方式进入另一个容器,如果容器使用不同范围的 UID,它们也不具备这些功能。 - -请注意,SELinux 和其他技术还限制了容器进程破开容器时会发生的情况。 - -### 使用 podman top 来显示用户名字空间 - -我们在 `podman top` 中添加了一些功能,允许你检查容器内运行的进程的用户名,并在主机上标识它们的真实 UID。 - -让我们首先使用我们的 UID 映射运行一个 `sleep` 容器。 - -``` -$ sudo podman run --uidmap 0:100000:5000 -d fedora sleep 1000 -``` - -现在运行 `podman top`: - -``` -$ sudo podman top --latest user huser -USER   HUSER -root   100000 - -$ ps -ef | grep sleep -100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -``` - -注意 `podman top` 报告用户进程在容器内以 `root` 身份运行,但在主机(`HUSER`)上以 UID 100000 运行。此外,`ps` 命令确认 `sleep` 过程以 UID 100000 运行。 - -现在让我们运行第二个容器,但这次我们将选择一个单独的 UID 映射,从 200000 开始。 - -``` -$ sudo podman run --uidmap 0:200000:5000 -d fedora sleep 1000 -$ sudo podman top --latest user huser -USER   HUSER -root   200000 - -$ ps -ef | grep sleep -100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -200000   23644 23632  1 08:08 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -``` - -请注意,`podman top` 报告第二个容器在容器内以 `root` 身份运行,但主机上的 UID=200000。 - -另请参阅 `ps` 命令,它显示两个 `sleep` 进程都在运行:一个为 100000,另一个为 200000。 - -这意味着在单独的用户命名空间内运行容器可以在进程之间进行传统的 UID 分离,这从一开始就是 Linux/Unix 的标准安全工具。 - -### 用户名字空间的问题 - -几年来,我一直主张用户命名空间应该作为每个人应该有的安全工具,但几乎没有人使用过。原因是没有任何文件系统支持或转移文件系统。 - -在容器中,你希望在许多容器之间共享**基本**镜像。上面的示例在每个示例中使用 Fedora 基本镜像。Fedora 镜像中的大多数文件都由实际的 UID=0 拥有。如果我使用用户名称空间 0:100000:5000 在此镜像上运行容器,默认情况下它会将所有这些文件视为 `nobody` 所拥有,因此我们需要移动所有这些 UID 以匹配用户名称空间。多年来,我想要一个挂载选项来告诉内核重新映射这些文件 UID 以匹配用户命名空间。上游内核存储开发人员继续调查并在此功能上取得进展,但这是一个难题。 - -Podman 可以在同一镜像上使用不同的用户名称空间,是由于自动 [chown][6] 内置于由 Nalin Dahyabhai 领导的团队开发的[容器/存储][7]中。Podman使用容器/存储,Podman 第一次在新的用户命名空间中使用容器镜像,容器/存储 “chowns”(如,更改所有权)镜像中的所有文件到用户命名空间中映射的 UID 并创建新镜像。可以把它想象成 `fedora:0:100000:5000` 镜像。 - -当 Podman 在具有相同 UID 映射的镜像上运行另一个容器时,它使用“预先设置所有权”的图像。当我在0:200000:5000 上运行第二个容器时,容器/存储会创建第二个镜像,我们称之为 `fedora:0:200000:5000`。 - -请注意,如果你正在执行 `podman build` 或 `podman commit` 并将新创建的镜像推送到容器注册表,Podman 将使用容器/存储来反转移位并将所有文件推回到实际 UID=0 的镜像。 - -这可能会导致在新的 UID 映射中创建容器时出现真正的减速,因为 `chown` 可能会很慢,具体取决于镜像中的文件数。此外,在普通 [OverlayFS][8] 上,镜像中的每个文件都会被复制。正常的 Fedora 镜像最多可能需要 30 秒才能完成 `chown` 并启动容器。 - -幸运的是,Red Hat 内核存储团队(主要是 Vivek Goyal 和 Miklos Szeredi)在内核 4.19 中为 OverlayFS 添加了一项新功能。该功能称为“仅元数据复制”。如果使用 `metacopy=on` 挂载覆盖文件系统作为挂载选项,则在更改文件属性时,它不会复制较低层的内容;内核创建新的 inode,其中包含引用指向较低级别数据的属性。如果内容发生变化,它仍会复制内容。如果你想试用它,可以在 Red Hat Enterprise Linux 8 Beta 中使用此功能。 - -这意味着容器 `chown` 可能在几秒钟内发生,并且你不会将每个容器的存储空间加倍。 - -这使得像 Podman 这样的工具在不同的用户命名空间中运行容器是可行的,大大提高了系统的安全性。 - -### 前瞻 - -我想向 Podman 添加一个新标志,比如 `--userns=auto`,它会告诉它为你运行的每个容器自动选择一个唯一的用户命名空间。这类似于 SELinux 与单独的多类别安全(MCS)标签一起使用的方式。如果设置环境变量 `PODMAN_USERNS=auto`,则甚至不需要设置标志。 - -Podman 最终允许用户在不同的用户名称空间中运行容器。像 [Buildah][9] 和 [CRI-O][10] 这样的工具也可以利用用户命名空间。但是,对于 CRI-O,Kubernetes 需要了解哪个用户命名空间将运行容器引擎,而上游正在处理它。 - -在我的下一篇文章中,我将解释如何在用户命名空间中将 Podman 作为非 root 用户运行。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/podman-and-user-namespaces - -作者:[Daniel J Walsh][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/rhatdan -[b]: https://github.com/lujun9972 -[1]: https://podman.io/ -[2]: https://github.com/containers/libpod -[3]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers -[4]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html -[5]: https://chmodcommand.com/chmod-660/ -[6]: https://en.wikipedia.org/wiki/Chown -[7]: https://github.com/containers/storage -[8]: https://en.wikipedia.org/wiki/OverlayFS -[9]: https://buildah.io/ -[10]: http://cri-o.io/ diff --git a/translated/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md b/translated/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md deleted file mode 100644 index 792de128c6..0000000000 --- a/translated/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zionfuo) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0 – An Introduction To Hyperledger Project (HLP) [Part 8]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/) -[#]: author: (editor https://www.ostechnix.com/author/editor/) - -区块链2.0:Hyperledger项目简介(八) -====== - -![Introduction To Hyperledger Project][1] - -一旦,一个新技术平台在积极发展和商业利益方面达到了普及的门槛,全球的主要公司和小型的初创企业都急于抓住这块蛋糕。在当时**Linux**就是这样的平台。一旦实现了其应用程序的普及,个人、公司和机构就开始对其表现出兴趣,到2000年,**Linux基金会**成立了。 - -Linux 基金会旨在通过赞助他们的开发团队来制定规范和开发Linux作为平台。Linux基金会是一个由软件和IT巨头(如微软、甲骨文、三星、思科、 IBM 、英特尔等[[1][7]]支持的非营利组织。这不包括为改善平台而提供服务的数百名个人开发者。多年来,Linux基金会已经开展了许多项目。**Hyperledger**项目是迄今为止发展最快的项目。 - -在将技术推进至可用且有用的方面上,这种联合主导的开发具有很多优势。为大型项目提供开发标准、库和所有后端协议既昂贵又资源密集型,而且不会从中产生丝毫收入。因此, 对于公司来说,通过支持这些组织来汇集他们的资源来开发常见的那些 “烦人” 部分是有很意义的,以及随后完成这些标准部分的工作以简单地即插即用和定制他们的产品。除了模型的经济性之外,这种合作努力还产生了标准,使其容易使用和集成到优秀的产品和服务中。 - -上述联盟模式,在曾经或当下使WiFi (The Wi-Fi alliance) 、移动电话等标准在制定方面得到了创新。 - - -### Hyperledger (HLP) 项目简介 - -Hyperledger 项目于 2015年12月由 Linux 基金会启动,目前是其孵化的增长最快的项目之一。它是一个伞式组织(umbrella organization),用于合作开发和推进基于[区块链][2]的分布式账本技术 (DLT) 的工具和标准。支持该项目的主要行业参与者包括**IBM**、**英特尔**和**SAP Ariba**[等][3]。HLP 旨在为个人和公司创建框架,以便根据需要创建共享和封闭的区块链,以满足他们自己的需求。设计原则是开发一个专注于隐私和未来可审计性的全球可部署、可扩展、强大的区块链平台。 - -### 开发目标和构造: 即插即用 - -虽然面向企业的平台有以太坊联盟之类的产品,但根据定义,HLP是面向企业的,并得到行业巨头的支持,他们在HLP旗下的许多模块中做出贡献并进一步发展。还孵化开发的周边项目,并这些创意项目推向公众。Hyperledger 项目的成员贡献了他们自己的力量,例如IBM如何为协作开发贡献他们的Fabric平台。该代码库由IBM在其内部研究和开发,并开源出来供所有成员使用。 - -这些过程使得 HLP 中的模块具有高度灵活的插件框架,这将支持企业设置中的快速开发和推出。此外,默认情况下,其他类似的平台是开放的**无需许可链**(permission-less blockchain)或是**公有链**(public blockchain),HLP模块本身就是支持通过调试可以适应特定的功能。 - -在这篇关于[公有链和私有链][4]的比较入门文章中,更多地涵盖了公有链和私有链的差异和用例。 - -根据项目执行董事**Brian Behlendorf**的说法,Hyperledger项目的使命有四个。 - -分别是: - - 1. 创建企业级DLT框架和标准,任何人都可以移植以满足其特定的工业或个人需求。 - 2. 创建一个强大的开源社区来帮助生态系统。 - 3. 促进所述生态系统的行业成员(如成员公司)的参与。 - 4. 为HLP社区提供中立且无偏见的基础设施,以收集和分享相关的更新和发展。 - -可以在这里访问[原始文档][5]。 - -### HLP的架构 - -HLP由12个项目组成,这些项目被归类为独立的模块,每个项目通常都是独立构建和工作的,以开发他们的模块。在孵化之前,首先对它们的能力和生存能力进行研究。组织的任何成员都可以提出增加的建议。在项目孵化后,就会出现积极开发,然后才会推出。这些模块之间的互操作性被赋予了很高的优先级,因此这些组之间的定期通信由社区维护。目前,这些项目中有4个被归类为活动项目。活动标签意味着这些标签已经准备好使用,但还没有准备好发布重大版本。这4个模块可以说是推动区块链革命的最重要或最基本的模块。稍后,我们将详细介绍各个模块及其功能。然而,Hyperledger Fabric平台的简要描述,可以说是其中最受欢迎的。 - -### Hyperledger Fabric - -**Hyperledger Fabric**[2]是一个完全开源的、基于区块链的许可 (非公开) DLT 平台,设计时考虑了企业的使用。该平台提供了适合企业环境的功能和结构。它是高度模块化的,允许开发人员在不同的一致协议、**链码协议**([智能合约][6]) 或身份管理系统等中进行选择。这是一个基于区块链的许可平台,利用身份管理系统,这意味着参与者将知道彼此在企业环境中需要的身份。Fabric允许以各种主流编程语言 (包括Java、Javascript、Go等) 开发智能合约(“链码”,是Hyperledger团队使用的术语)。这使得机构和企业可以利用他们在该领域的现有人才,而无需雇佣或重新培训开发人员来开发他们自己的智能合约。与标准订单验证系统相比,Fabric还使用执行顺序验证系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。与标准订单验证系统相比,Fabric还使用执行顺序验证系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。可插拔性能、身份管理系统、数据库管理系统、共识平台等是Fabric的其他功能,这些功能使它在竞争中保持领先地位。 - - -### 结论 - -诸如Hyperledger Fabric平台这样的项目能够在主流用例中更快地采用区块链技术。Hyperledger社区结构本身支持开放治理原则,并且由于所有项目都是作为开源平台引导的,因此这提高了团队在履行承诺时表现出来的安全性和责任感。 - -由于此类项目的主要应用涉及与企业合作及进一步开发平台和标准,因此Hyperledger项目目前在其他类似项目前面处于有利地位。 - -**参考资料** - - * **[1][Samsung takes a seat with Intel and IBM at the Linux Foundation | TheINQUIRER][7]** - * **[2] E. Androulaki et al., “Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains,” 2018.** - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ - -作者:[editor][a] -选题:[lujun9972][b] -译者:[zionfuo](https://github.com/zionfuo) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/editor/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Introduction-To-Hyperledger-Project-720x340.png -[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ -[3]: https://www.hyperledger.org/members -[4]: https://www.ostechnix.com/blockchain-2-0-public-vs-private-blockchain-comparison/ -[5]: http://www.hitachi.com/rev/archive/2017/r2017_01/expert/index.html -[6]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ -[7]: https://www.theinquirer.net/inquirer/news/2182438/samsung-takes-seat-intel-ibm-linux-foundation diff --git a/translated/tech/20190705 Learn object-oriented programming with Python.md b/translated/tech/20190705 Learn object-oriented programming with Python.md deleted file mode 100644 index 01f6902ad8..0000000000 --- a/translated/tech/20190705 Learn object-oriented programming with Python.md +++ /dev/null @@ -1,302 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn object-oriented programming with Python) -[#]: via: (https://opensource.com/article/19/7/get-modular-python-classes) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -使用 Python 学习面对对象的编程 -====== -使用 Python 类使你的代码变得更加模块化。 -![Developing code.][1] - -在我上一篇文章中,我解释了如何通过使用函数、创建模块或者两者一起来[使 Python 代码更加模块化][2]。函数对于避免重复多次使用的代码非常有用,而模块可以确保你在不同的项目中复用代码。但是模块化还有另一种方法:类。 - -如果你已经听过 _面对对象编程_ 这个术语,那么你可能会对类的用途有一些概念。程序员倾向于将类视为一个虚拟对象,有时与物理世界中的某些东西直接相关,有时则作为某种编程概念的表现形式。无论哪种表示,当你想要在程序中为你或程序的其他部分创建“对象”时,你都可以创建一个类来交互。 - -### 没有类的模板 - -假设你正在编写一个以幻想世界为背景的游戏,并且你需要这个应用程序能够涌现出各种坏蛋来给玩家的生活带来一些刺激。了解了很多关于函数的知识后,你可能会认为这听起来像是函数的一个教科书案例:需要经常重复的代码,但是在调用时可以考虑变量而只编写一次。 - -下面一个纯粹基于函数的敌人生成器实现的例子: - -``` -#!/usr/bin/env python3 - -import random - -def enemy(ancestry,gear): -    enemy=ancestry -    weapon=gear -    hp=random.randrange(0,20) -    ac=random.randrange(0,20) -    return [enemy,weapon,hp,ac] - -def fight(tgt): -    print("You take a swing at the " + tgt[0] + ".") -    hit=random.randrange(0,20) -    if hit > tgt[3]: -        print("You hit the " + tgt[0] + " for " + str(hit) + " damage!") -        tgt[2] = tgt[2] - hit -    else: -        print("You missed.") - -foe=enemy("troll","great axe") -print("You meet a " + foe[0] + " wielding a " + foe[1]) -print("Type the a key and then RETURN to attack.") - -while True: -    action=input() - -    if action.lower() == "a": -        fight(foe) - -    if foe[2] < 1: -        print("You killed your foe!") -    else: -        print("The " + foe[0] + " has " + str(foe[2]) + " HP remaining") -``` - -**enemy** 函数创造了一个具有多个属性的敌人,例如祖先、武器、生命值和防御等级。它返回每个属性的列表,表示敌人全部特征。 - -从某种意义上说,这段代码创建了一个对象,即使它还没有使用类。程序员将这个 "enemy" 称为 _对象_,因为该函数的结果(本例中是一个包含字符串和整数的列表)表示游戏中一个单独但复杂的 _东西_。也就是说,列表中字符串和整数不是任意的:它们一起描述了一个虚拟对象。 - -在编写描述符集合时,你可以使用变量,以便随时使用它们来生成敌人。这有点像模板。 - -在示例代码中,当需要对象的属性时,会检索相应的列表项。例如,要获取敌人的祖先,代码会查询 **foe[0]**,对于生命值,会查询 **foe[2]**,以此类推。 - -这种方法没有什么不妥,代码按预期运行。你可以添加更多不同类型的敌人,创建一个敌人类型列表,并在敌人创建期间从列表中随机选择,等等,它工作得很好。实际上,[Lua][3] 非常有效地利用这个原理来近似面对对象模型。 - -然而,有时候对象不仅仅是属性列表。 - -### 使用对象 - -在 Python 中,一切都是对象。你在 Python 中创建的任何东西都是某个预定义模板的 _实例_。甚至基本的字符串和整数都是 Python **type** 类的衍生物。你可以在这个交互式 Python shell 中见证: - -``` ->>> foo=3 ->>> type(foo) -<class 'int'> ->>> foo="bar" ->>> type(foo) -<class 'str'> -``` - -当一个对象由一个类定义时,它不仅仅是一个属性的集合,Python 类具有各自的函数。从逻辑上讲,这很方便,因为只涉及某个对象类的操作包含在该对象的类中。 - -在示例代码中,fight 代码是主应用程序的功能。这对于一个简单的游戏来说是可行的,但对于一个复杂的游戏来说,世界中不仅仅有玩家和敌人,还可能有城镇居民、牲畜、建筑物、森林等等,他们都不需要使用战斗功能。将战斗代码放在敌人的类中意味着你的代码更有条理,在一个复杂的应用程序中,这是一个重要的优势。 - -此外,每个类都有特权访问自己的本地变量。例如,敌人的生命值,除了某些功能之外,是不会改变的数据。游戏中的随机蝴蝶不应该意外地将敌人的生命值降低到 0。理想情况下,即使没有类,也不会发生这种情况。但是在具有大量活动部件的复杂应用程序中,确保不需要相互交互的部件永远不会发生这种情况,这是一个非常有用的技巧。 - -Python 类也受垃圾收集的影响。当不再使用类的实例时,它将被移出内存。你可能永远不知道这种情况会什么时候发生,但是你往往知道什么时候它不会发生,因为你的应用程序占用了更多的内存,而且运行速度比较慢。将数据集隔离到类中可以帮助 Python 跟踪哪些数据正在使用,哪些不在需要了。 - -### 优雅的 Python - -下面是一个同样简单的战斗游戏,使用了 Enemy 类: - -``` -#!/usr/bin/env python3 - -import random - -class Enemy(): -    def __init__(self,ancestry,gear): -        self.enemy=ancestry -        self.weapon=gear -        self.hp=random.randrange(10,20) -        self.ac=random.randrange(12,20) -        self.alive=True - -    def fight(self,tgt): -        print("You take a swing at the " + self.enemy + ".") -        hit=random.randrange(0,20) - -        if self.alive and hit > self.ac: -            print("You hit the " + self.enemy + " for " + str(hit) + " damage!") -            self.hp = self.hp - hit -            print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") -        else: -            print("You missed.") - -        if self.hp < 1: -            self.alive=False - -# 游戏开始 -foe=Enemy("troll","great axe") -print("You meet a " + foe.enemy + " wielding a " + foe.weapon) - -# 主函数循环 -while True: -    -    print("Type the a key and then RETURN to attack.") -        -    action=input() - -    if action.lower() == "a": -        foe.fight(foe) -                -    if foe.alive == False: -        print("You have won...this time.") -        exit() -``` - -这个版本的游戏将敌人作为一个包含相同属性(祖先,武器,生命值和防御)的对象来处理,并添加一个新的属性来衡量敌人时候已被击败,以及一个战斗功能。 - -类的第一个函数是一个特殊的函数,在 Python 中称为 \_init\_ 或初始化函数。这类似于其他语言中的[构造器][4],它创建了类的一个实例,你可以通过它的属性和调用类时使用的任何变量来识别它(示例代码中的 **foe**)。 - -### Self 和类实例 - -类的函数接受一种你在类之外看不到的新形式的输入:**self**。如果不包含 **self**,那么当你调用类函数时,Python 无法知道要使用的类的 _哪个_ 实例。这就像在一间充满兽人的房间里说:“我要和兽人战斗”,向一个兽人发起。没有人知道你指的是谁,所以坏事就发生了。 - -![Image of an Orc, CC-BY-SA by Buch on opengameart.org][5] - -CC-BY-SA by Buch on opengameart.org - -类中创建的每个属性都以 **self** 符号作为前缀,该符号将变量标识为类的属性。一旦派生出类的实例,就用表示该实例的变量替换掉 **self** 前缀。使用这个技巧,你可以在一间满是兽人的房间里说:“我要和祖先是 orc 的兽人战斗”,这样来挑战一个兽人。当 orc 听到 "gorblar.orc" 时,它就知道你指的是谁(他自己),所以你得到是一场公平的战斗而不是争吵。在 Python 中: - -``` -gorblar=Enemy("orc","sword") -print("The " + gorblar.enemy + " has " + str(gorblar.hp) + " remaining.") -``` - -通过检索类属性而不是查询 **foe[0]**(在函数示例中)或 **gorblar[0]** 来寻找敌人(**gorblar.enemy** 或 **gorblar.hp** 或你需要的任何对象的任何值)。 - -### 本地变量 - -如果类中的变量没有以 **self** 关键字作为前缀,那么它就是一个局部变量,就像在函数中一样。例如,无论你做什么,你都无法访问 **Enemy.fight** 类之外的 **hit** 变量: - -``` ->>> print(foe.hit) -Traceback (most recent call last): -  File "./enclass.py", line 38, in <module> -    print(foe.hit) -AttributeError: 'Enemy' object has no attribute 'hit' - ->>> print(foe.fight.hit) -Traceback (most recent call last): -  File "./enclass.py", line 38, in <module> -    print(foe.fight.hit) -AttributeError: 'function' object has no attribute 'hit' -``` - -**hi** 变量包含在 Enemy 类中,并且只能“存活”到在战斗种发挥作用。 - -### 更模块化 - -本例使用与主应用程序相同的文本文档中的类。在一个复杂的游戏中,我们更容易将每个类看作是自己独立的应用程序。当多个开发人员处理同一个应用程序时,你会看到这一点:一个开发人员处理一个类,另一个开发主程序,只要他们彼此沟通这个类必须具有什么属性,就可以并行地开发这两个代码块。 - -要使这个示例游戏模块化,可以把它拆分为两个文件:一个用于主应用程序,另一个用于类。如果它是一个更复杂的应用程序,你可能每个类都有一个文件,或每个逻辑类组有一个文件(例如,用于建筑物的文件,用于自然环境的文件,用于敌人或 NPC 的文件等)。 - -将只包含 Enemy 类的一个文件保存为 **enemy.py**,将另一个包含其他内容的文件保存为 **main.py**。 - -以下是 **enemy.py**: - -``` -import random - -class Enemy(): -    def __init__(self,ancestry,gear): -        self.enemy=ancestry -        self.weapon=gear -        self.hp=random.randrange(10,20) -        self.stg=random.randrange(0,20) -        self.ac=random.randrange(0,20) -        self.alive=True - -    def fight(self,tgt): -        print("You take a swing at the " + self.enemy + ".") -        hit=random.randrange(0,20) - -        if self.alive and hit > self.ac: -            print("You hit the " + self.enemy + " for " + str(hit) + " damage!") -            self.hp = self.hp - hit -            print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") -        else: -            print("You missed.") - -        if self.hp < 1: -            self.alive=False -``` - -以下是 **main.py**: - -``` -#!/usr/bin/env python3 - -import enemy as en - -# game start -foe=en.Enemy("troll","great axe") -print("You meet a " + foe.enemy + " wielding a " + foe.weapon) - -# main loop -while True: -    -    print("Type the a key and then RETURN to attack.") - -    action=input() - -    if action.lower() == "a": -        foe.fight(foe) - -    if foe.alive == False: -        print("You have won...this time.") -        exit() -``` - -导入模块 **enemy.py** 使用了一条特别的语句,将类文件名称作为引用而不是 **.py** 扩展名,后跟你选择的命名空间指示符(例如,**import enemy as en**)。这个指示符是在你调用类时在代码中使用的。你需要在导入时添加指定符,例如 **en.Enemy**,而不是只使用 **Enemy()**。 - -所有这些文件名都是任意的,尽管在原则上并不罕见。将应用程序的中心命名为 **main.py** 是一个常见约定,和一个充满类的文件通常以小写形式命名,其中的类都以大写字母开头。是否遵循这些约定不会影响应用程序的运行方式,但它确实使经验丰富的 Python 程序员更容易快速理解应用程序的工作方式。 - -在如何构建代码方面有一些灵活性。例如,使用代码示例,两个文件必须位于同一目录中。如果你只想将类打包为模块,那么必须创建一个名为 **mybad** 的目录,并将你的类移入其中。在 **main.py** 中,你的 import 语句稍有变化: - -``` -from mybad import enemy as en -``` - -两种方法都会产生相同的结果,但如果你创建的类足够通用,你认为其他开发人员可以在他们的项目中使用它们,那么后者是更好的。 - -无论你选择哪种方式,都可以启动游戏的模块化版本: - -``` -$ python3 ./main.py -You meet a troll wielding a great axe -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You missed. -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You hit the troll for 8 damage! -The troll has 4 HP remaining -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You hit the troll for 11 damage! -The troll has -7 HP remaining -You have won...this time. -``` - -游戏启动了,它现在更加模块化了。现在你知道了面对对象的应用程序意味着什么,但最重要的是,当你向兽人发起决斗的时候,你要想清楚。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/get-modular-python-classes - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) -[2]: https://opensource.com/article/19/6/get-modular-python-functions -[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi -[4]: https://opensource.com/article/19/6/what-java-constructor -[5]: https://opensource.com/sites/default/files/images/orc-buch-opengameart_cc-by-sa.jpg (CC-BY-SA by Buch on opengameart.org) diff --git a/translated/tech/20191013 Object-Oriented Programming and Essential State.md b/translated/tech/20191013 Object-Oriented Programming and Essential State.md new file mode 100644 index 0000000000..caacee3372 --- /dev/null +++ b/translated/tech/20191013 Object-Oriented Programming and Essential State.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Object-Oriented Programming and Essential State) +[#]: via: (https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +面向对象编程和根本状态 +====== + +早在 2015 年,Brian Will 撰写了一篇有挑衅性的博客:[面向对象编程:一个灾难故事][1]。他随后发布了一个名为[面向对象编程很糟糕][2]的视频,该视频更加详细。我建议你花些时间观看视频,但这是我的一小段摘要: + +OOP 的柏拉图式理想是一堆相互解耦的对象,它们彼此之间发送无状态消息。没有人真的像这样制作软件,Brian 指出这甚至没有意义:对象需要知道向哪个对象发送消息,这意味着它们需要相互引用。视频大部分讲述的是人们试图将对象耦合以实现控制流,同时假装它们是通过设计解耦的。 + +总的来说,他的想法与我自己的 OOP 经验产生了共鸣:对象没有问题,但是我从来没有对_面向_对象建立程序控制流满意,而试图使代码“正确地”面向对象似乎总是在创建不必要的复杂性。 + +我认为他无法完全解释一件事。他直截了当地说“封装没有作用”,但在脚注后面加上“在细粒度的代码级别”,并继续承认对象有时可以奏效,并且在库和文件级别可以封装。但是他没有确切解释为什么有时会奏效,有时却没有奏效,以及如何/在何处划清界限。有人可能会说这使他的“ OOP不好”的说法有缺陷,但是我认为他的观点是正确的,并且可以在根本状态和偶发状态之间划清界限。 + +如果你以前从未听说过“根本”和“偶发”这两个术语的使用,那么你应该阅读 Fred Brooks 的经典文章[没有银弹][3]。 (顺便说一句,他写了许多有关构建软件系统的很棒的文章。)我以前曾写过[关于根本和偶发的复杂性的文章][4],但是这里有一个简短的摘要:软件很复杂。部分原因是因为我们希望软件能够解决混乱的现实世界问题,因此我们将其称为“根本复杂性”。“偶发复杂性”是所有其他复杂性,因为我们正尝试使用硅和金属来解决与硅和金属无关的问题。例如,对于大多数程序而言,用于内存管理或在内存与磁盘之间传输数据或解析文本格式的代码都是“偶发的复杂性”。 + +假设你正在构建一个支持多个频道的聊天应用。消息可以随时到达任何频道。有些频道特别有趣,当有新消息传入时,用户希望得到通知。其他频道静音:消息被存储,但用户不会受到打扰。你需要跟踪每个频道的用户首选设置。 + +一种实现方法是在频道和频道设置之间使用映射(也称为哈希表,字典或关联数组)。注意,映射是 Brian Will 所说的可以用作对象的抽象数据类型(ADT)。 + +如果我们有一个调试器并查看内存中的 map 对象,我们将看到什么?我们当然会找到频道 ID 和频道设置数据(或至少指向它们的指针)。但是我们还会找到其他数据。如果 map 是使用红黑树实现的,我们将看到带有红/黑标签和指向其他节点的指针的树节点对象。与频道相关的数据是根本状态,而树节点是偶发状态。不过,请注意以下几点:该映射有效地封装了它的偶发状态-你可以用 AVL 树实现的另一个映射替换该映射,并且你的聊天程序仍然可以使用。另一方面,映射没有封装根本状态(仅使用 `get()` 和 `set()`方法访问数据不是封装)。事实上,映射与根本状态是尽可能不可知的,你可以使用基本相同的映射数据结构来存储与频道或通知无关的其他映射。 + + +这就是映射 ADT 如此成功的原因:它封装了偶发状态,并与根本状态解耦。如果你考虑一下,Brian 描述的封装问题就是尝试封装根本状态。其他描述的好处是封装偶发状态的好处。 + +要使整个软件系统都达到这一理想相当困难,但扩展开来,我认为它看起来像这样: + + * 没有全局的可变状态 + * 封装了偶发状态(在对象或模块或以其他任何形式) + * 无状态偶发复杂性封装在单独函数中,与数据解耦 + * 使用诸如依赖注入之类的技巧使输入和输出变得明确 + * 完全拥有组件,并从易于识别的位置进行控制 + + + +其中有些违反了我很久以前的本能。例如,如果你有一个数据库查询函数,如果数据库连接处理隐藏在该函数内部,并且唯一的参数是查询参数,那么接口会看起来会更简单。但是,当你使用这样的函数构建软件系统时,协调数据库的使用实际上变得更加复杂。组件不仅以自己的方式做事,而且还试图将自己所做的事情隐藏为“实现细节”。数据库查询需要数据库连接这一事实从来都不是实现细节。如果无法隐藏某些内容,那么显露它是更合理的。 + +我警惕将面向对象编程和函数式编程放在两极,但我认为从函数式编程进入面向对象编程的另一极端是很有趣的:OOP 试图封装事物,包括无法封装的根本复杂性,而纯函数式编程往往会使事情变得明确,包括一些偶发复杂性。在大多数时候,没什么问题,但有时候(比如[在纯函数式语言中构建自我指称的数据结构][5])设计更多的是为了函数编程,而不是为了简便(这就是为什么 [Haskell 包含了一些“逃生出口”( escape hatches)][6])。我之前写过一篇[中立的所谓的“弱纯性” (weak purity)][7] + +Brian 发现封装对更大规模有效,原因有几个。一个是,由于大小的原因,较大的组件更可能包含偶发状态。另一个是“偶发”与你要解决的问题有关。从聊天程序用户的角度来看,“偶发的复杂性”是与消息,频道和用户等无关的任何事物。但是,当你将问题分解为子问题时,更多的事情就变得重要。例如,在解决“构建聊天应用”问题时,可以说频道名称和频道 ID 之间的映射是偶发的复杂性,而在解决“实现 `getChannelIdByName()` 函数”子问题时,这是根本复杂性。因此,封装对于子组件的作用比对父组件的作用要小。 + +顺便说一句,在影片的结尾,Brian Will 想知道是否有任何语言支持_无法_访问它们所作用的范围的匿名函数。[D][8] 语言可以。 D 中的匿名 Lambda 通常是闭包,但是如果你想要的话,也可以声明匿名无状态函数: + +``` +import std.stdio; + +void main() +{ + int x = 41; + + // Value from immediately executed lambda + auto v1 = () { + return x + 1; + }(); + writeln(v1); + + // Same thing + auto v2 = delegate() { + return x + 1; + }(); + writeln(v2); + + // Plain functions aren't closures + auto v3 = function() { + // Can't access x + // Can't access any mutable global state either if also marked pure + return 42; + }(); + writeln(v3); +} +``` + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://medium.com/@brianwill/object-oriented-programming-a-personal-disaster-1b044c2383ab +[2]: https://www.youtube.com/watch?v=QM1iUe6IofM +[3]: http://www.cs.nott.ac.uk/~pszcah/G51ISS/Documents/NoSilverBullet.html +[4]: https://theartofmachinery.com/2017/06/25/compression_complexity_and_software.html +[5]: https://wiki.haskell.org/Tying_the_Knot +[6]: https://en.wikibooks.org/wiki/Haskell/Mutable_objects#The_ST_monad +[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html +[8]: https://dlang.org diff --git a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md new file mode 100644 index 0000000000..44ccc28328 --- /dev/null +++ b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool) +[#]: via: (https://itsfoss.com/gnome-tweak-tool/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法 +====== + +![GNOME Tweak Tool Icon][1] + +你可以通过多种方法来调整 Ubuntu,以自定义其外观和行为。我发现最简单的方法是使用 [GNOME 优化工具][2]。它也被称为 GNOME Tweak 或简单地称为 Tweak(优化)。 + +在过去的教程中,我已经多次介绍过它。在这里,我列出了你可以使用此工具执行的所有主要优化。 + +我在这里使用的是 Ubuntu,但是这些步骤应该适用于使用 GNOME 桌面环境的任何 Linux 发行版。 + +### 在 Ubuntu 18.04 或其它版本上安装 GNOME 优化工具 + +Gnome 优化工具可从 [Ubuntu 中的 Universe 存储库][3]中安装,因此请确保已在“软件和更新”工具中启用了该工具: + +![在 Ubuntu 中启用 Universe 存储库][4] + +之后,你可以从软件中心安装 GNOME 优化工具。只需打开软件中心并搜索 “GNOME Tweaks”并从那里安装它: + +![从软件中心安装 GNOME 优化工具][5] + +或者,你也可以使用命令行通过 [apt 命令][6]安装此软件: + +``` +sudo apt install gnome-tweaks +``` + +### 用优化工具定制 GNOME 桌面 + +![][7] + +GNOME 优化工具使你可以进行许多设置更改。其中的某些更改(例如墙纸更改、启动应用程序等)也可以在官方的“系统设置”工具中找到。我将重点介绍默认情况下“设置”中不可用的优化。 + +#### 1、改变主题 + +你可以通过各种方式[在 Ubuntu 中安装新主题][8]。但是,如果要更改为新安装的主题,则必须安装GNOME 优化工具。 + +你可以在外观部分找到主题和图标设置。你可以浏览可用的主题和图标并设置所需的主题和图标。更改将立即生效。 + +![通过 GNOME 优化更改主题][9] + +#### 2\、禁用动画以提速你的桌面体验 + +应用程序窗口的打开、关闭、最大化等都有一些细微的动画。你可以禁用这些动画以稍微加快系统的速度,因为它会使用较少的资源。 + +![禁用动画以获得稍快的桌面体验][10] + +#### 3、控制桌面图标 + +至少在 Ubuntu 中,你会在桌面上看到“主目录”和“垃圾箱”图标。如果你不喜欢,可以选择禁用它。你还可以选择要在桌面上显示的图标。 + +![在 Ubuntu 中控制桌面图标][11] + +#### 4、管理 GNOME 扩展 + +我想可能知道 [GNOME 扩展][12]。这些是用于桌面的小型“插件”,可扩展 GNOME 桌面的功能。有[大量的 GNOME 扩展][13],可用于在顶部面板中查看 CPU 消耗、获取剪贴板历史记录等。 + +我已经写了一篇[安装和使用 GNOME 扩展][14]的详细文章。在这里,我假设你已经在使用它们,如果是这种情况,那么可以从 GNOME 优化工具中对其进行管理。 + +![管理 GNOME 扩展][15] + +#### 5、改变字体和缩放比例 + +你可以[在 Ubuntu 中安装新字体][16],并使用优化工具在系统范围应用字体更改。如果你认为桌面上的图标和文本太小,也可以更改缩放比例。 + +![更改字体和缩放比例][17] + +#### 6、控制触摸板行为,例如在键入时禁用触摸板,右键单击触摸板即可正常工作 + +GNOME 优化工具还允许你在键入时禁用触摸板。如果你在笔记本电脑上快速键入,这将很有用。手掌底部可能会触摸触摸板,并导致光标移至屏幕上不需要的位置。 + +在键入时自动禁用触摸板可解决此问题。 + +![键入时禁用触摸板][18] + +你还会注意到[当你按下触摸板的右下角以进行右键单击时,什么也没有发生][19]。你的触摸板并没有问题。这是一项系统设置,可对没有实体右键按钮的任何触摸板(例如旧的 Thinkpad 笔记本电脑)禁用这种右键单击功能。两指点击可为你提供右键单击操作。 + +你也可以通过在“鼠标单击模拟”下的“区域”中而不是“手指”中找到它。 + +![修复右键单击问题][20] + +你可能必须[重新启动 Ubuntu][21] 才能生效。如果你是 Emacs 爱好者,还可以从 Emacs 强制进行键盘绑定。 + +#### 7、改变电源设置 + +电源这里只有一个设置。盖上盖子后,你可以将笔记本电脑置于挂起模式。 + +![GNOME 优化工具中的电源设置][22] + +#### 8、决定什么显示在顶部面板 + +桌面的顶部面板显示了一些重要的信息。在这里有日历、网络图标、系统设置和“活动”选项。 + +你还可以[显示电池百分比][23]、添加日期以及日期和时间,并显示星期数。你还可以启用鼠标热点,以便将鼠标移至屏幕的左上角时可以获得所有正在运行的应用程序的活动视图。 + +![GNOME 优化工具中的顶部面板设置][24] + +如果将鼠标将焦点放在应用程序窗口上,则会注意到其菜单显示在顶部面板中。如果你不喜欢这样,可以将其关闭,然后应用程序菜单将显示应用程序本身。 + +#### 9、配置应用窗口 + +你可以决定是否在应用程序窗口中显示最大化和最小化选项(右上角的按钮)。你也可以在左右两边改变它们的位置。 + +![应用程序窗口配置][25] + +还有其他一些配置选项。我不使用它们,但你可以自行探索。 + +#### 10、配置工作区 + +GNOME 优化工具还允许你围绕工作区配置一些内容。 + +![在 Ubuntu 中配置工作区][26] + +### 总结 + +对于任何 GNOME 用户,GNOME 优化(Tweaks)工具都是必备工具。它可以帮助你配置桌面的外观和功能。 我感到惊讶的是,该工具甚至没有出现在 Ubuntu 的主存储库中。我认为应该默认安装它,要不,你将需得在 Ubuntu 中手动安装 GNOME 优化工具。 + +如果你在 GNOME 优化工具中发现了一些此处没有讨论的隐藏技巧,为什么不与大家分享呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-tweak-tool/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/gnome-tweak-tool-icon.png?ssl=1 +[2]: https://wiki.gnome.org/action/show/Apps/Tweaks?action=show&redirect=Apps%2FGnomeTweakTool +[3]: https://itsfoss.com/ubuntu-repositories/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/enable-repositories-ubuntu.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/install-gnome-tweaks-tool.jpg?ssl=1 +[6]: https://itsfoss.com/apt-command-guide/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/customize-gnome-with-tweak-tool.jpg?ssl=1 +[8]: https://itsfoss.com/install-themes-ubuntu/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-theme-ubuntu-gnome.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-animation-ubuntu-gnome.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/desktop-icons-ubuntu.jpg?ssl=1 +[12]: https://extensions.gnome.org/ +[13]: https://itsfoss.com/best-gnome-extensions/ +[14]: https://itsfoss.com/gnome-shell-extensions/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/manage-gnome-extension-tweaks-tool.jpg?ssl=1 +[16]: https://itsfoss.com/install-fonts-ubuntu/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-fonts-ubuntu-gnome.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-touchpad-while-typing-ubuntu.jpg?ssl=1 +[19]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/enable-right-click-ubuntu.jpg?ssl=1 +[21]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/power-settings-gnome-tweaks-tool.jpg?ssl=1 +[23]: https://itsfoss.com/display-battery-ubuntu/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/top-panel-settings-gnome-tweaks-tool.jpg?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/windows-configuration-ubuntu-gnome-tweaks.jpg?ssl=1 +[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/configure-workspaces-ubuntu.jpg?ssl=1 diff --git a/translated/tech/20191023 Building container images with the ansible-bender tool.md b/translated/tech/20191023 Building container images with the ansible-bender tool.md new file mode 100644 index 0000000000..a085b51c5f --- /dev/null +++ b/translated/tech/20191023 Building container images with the ansible-bender tool.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building container images with the ansible-bender tool) +[#]: via: (https://opensource.com/article/19/10/building-container-images-ansible) +[#]: author: (Tomas Tomecek https://opensource.com/users/tomastomecek) + +使用 ansible-bender 构建容器镜像 +====== +了解如何使用 Ansible 在容器中执行命令。 +![Blocks for building][1] + +容器和 [Ansible][2] 很好地融合在一起-从管理和编排到供应和构建。在本文中,我们将重点介绍构建部分。 + +如果你熟悉 Ansible,就会知道你可以编写一系列任务,**ansible-playbook** 命令将为你执行这些任务。你知道吗,你还可以在容器环境中执行此类命令,并获得与编写 Dockerfile 并运行 **podman build** 相同​​的结果。 + +这是一个例子: + + +``` +\- name: Serve our file using httpd + hosts: all + tasks: + - name: Install httpd + package: + name: httpd + state: installed + - name: Copy our file to httpd’s webroot + copy: + src: our-file.txt + dest: /var/www/html/ +``` + +你可以在 Web 服务器上或容器中本地执行这个 playbook,并且只要你记得先创建 **our-file.txt**,它就可以工作。 + +但是缺少了一些东西。你需要启动(并配置)httpd 以便提供文件。这是容器构建和基础架构供应之间的区别:构建镜像时,你只需准备内容;运行容器是另一项任务。另一方面,你可以将元数据附加到容器镜像,它会默认运行命令。 + +这有个工具可以帮助。试试看 **ansible-bender** 怎么样? + + +``` +`$ ansible-bender build the-playbook.yaml fedora:30 our-httpd` +``` + +该脚本使用 ansible-bender 对 Fedora 30 容器镜像执行 playbook,并将生成的容器镜像命名为 “our-httpd”。 + +但是,当你运行该容器时,它不会启动 httpd,因为它不知道如何操作。你可以通过向 playbook 添加一些元数据来解决此问题: + + +``` +\- name: Serve our file using httpd + hosts: all + vars: + ansible_bender: + base_image: fedora:30 + target_image: + name: our-httpd + cmd: httpd -DFOREGROUND + tasks: + - name: Install httpd + package: + name: httpd + state: installed + - name: Listen on all network interfaces. + lineinfile: + path: /etc/httpd/conf/httpd.conf + regexp: '^Listen ' + line: Listen 0.0.0.0:80 + - name: Copy our file to httpd’s webroot + copy: + src: our-file.txt + dest: /var/www/html +``` + +现在你可以构建镜像(从这里开始,请以 root 用户身份运行所有命令。目前,Buildah 和 Podman 不会为无根容器创建专用网络): + + +``` +# ansible-bender build the-playbook.yaml +PLAY [Serve our file using httpd] **************************************************** + +TASK [Gathering Facts] *************************************************************** +ok: [our-httpd-20191004-131941266141-cont] + +TASK [Install httpd] ***************************************************************** +loaded from cache: 'f053578ed2d47581307e9ba3f64f4b4da945579a082c6f99bd797635e62befd0' +skipping: [our-httpd-20191004-131941266141-cont] + +TASK [Listen on all network interfaces.] ********************************************* +changed: [our-httpd-20191004-131941266141-cont] + +TASK [Copy our file to httpd’s webroot] ********************************************** +changed: [our-httpd-20191004-131941266141-cont] + +PLAY RECAP *************************************************************************** +our-httpd-20191004-131941266141-cont : ok=3 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 + +Getting image source signatures +Copying blob sha256:4650c04b851c62897e9c02c6041a0e3127f8253fafa3a09642552a8e77c044c8 +Copying blob sha256:87b740bba596291af8e9d6d91e30a01d5eba9dd815b55895b8705a2acc3a825e +Copying blob sha256:82c21252bd87532e93e77498e3767ac2617aa9e578e32e4de09e87156b9189a0 +Copying config sha256:44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Writing manifest to image destination +Storing signatures +44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Image 'our-httpd' was built successfully \o/ +``` + +镜像构建完毕,可以运行容器了: + +``` +# podman run our-httpd +AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.2.106. Set the 'ServerName' directive globally to suppress this message +``` + +是否提供文件了?首先,找出你容器的 IP: + + +``` +# podman inspect -f '{{ .NetworkSettings.IPAddress }}' 7418570ba5a0 +10.88.2.106 +``` + +你现在可以检查了: + + +``` +$ curl +Ansible is ❤ +``` + +你文件内容是什么? + +这只是使用 Ansible 构建容器镜像的介绍。如果你想了解有关 ansible-bender 可以做什么的更多信息,请查看它的 [GitHub][3] 页面。构建快乐! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/building-container-images-ansible + +作者:[Tomas Tomecek][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/tomastomecek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) +[2]: https://www.ansible.com/ +[3]: https://github.com/ansible-community/ansible-bender \ No newline at end of file