mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
c0bf6be17e
@ -2,70 +2,73 @@
|
||||
[#]: via: "https://itsfoss.com/duckduckgo-easter-eggs/"
|
||||
[#]: author: "sreenath https://itsfoss.com/author/sreenath/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: translator: "TravinDreek"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14696-1.html"
|
||||
|
||||
隐藏功能!在 DuckDuckGo 搜索引擎中,你可以做这 25 件有趣的事情
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/11/142806ebr5xtzgcwcr5955.jpg)
|
||||
|
||||
比起无处不在的 Google,[有些搜索引擎替代品更加尊重隐私][1],而 DuckDuckGo 就是其中之一。
|
||||
|
||||
最近,这个搜索引擎有了很大的改进,搜索一般网页十分顺畅。在搜索本地地点方面,则还远不及 Google。
|
||||
|
||||
不过,DuckDuckGo(其爱称为 DDG)有一些很酷的功能,大部分用户还没注意到。如果你是一位 DDG 狂热粉,你可能会喜欢用这些小技巧来提升你的搜索体验。
|
||||
不过,DuckDuckGo(简称为 DDG)有一些很酷的功能,大部分用户还没注意到。如果你是一位 DDG 狂热粉,你可能会喜欢用这些小技巧来提升你的搜索体验。
|
||||
|
||||
### 1. 跳转特定网页
|
||||
### 1、跳转到特定网页
|
||||
|
||||
在你最喜欢的网站名称前输入 ! 即可直接进入这个网站。则类似于 Google 的 “运气不错” 功能,但用 DDG 的话来说,这就叫 “叹号搜索”。
|
||||
在你最喜欢的网站名称前输入 `!` 即可直接进入这个网站。则类似于 Google 的 “运气不错” 功能,但用 DDG 的话来说,这就叫 “叹号搜索”。
|
||||
|
||||
网站有缩写,开始输入时便会提示。
|
||||
有一些网站有缩写形式,开始输入时便会提示。
|
||||
|
||||
![duckduckgo bang feature][2]
|
||||
|
||||
在网站名后面输入搜索词,就可以直接抵达那个网站的搜索结果处。
|
||||
|
||||
### 2. 文本转 ASCII
|
||||
### 2、文本转 ASCII
|
||||
|
||||
Figlet 是一个 [有趣的 Linux 命令][3],可以将任意文本转换为漂亮的 ASCII 画格式。
|
||||
|
||||
在任意搜索词前输入 **figlet**,就会显示 ASCII 输出。无需打开终端。
|
||||
在任意搜索词前输入 `figlet`,就会显示 ASCII 输出。无需打开终端。
|
||||
|
||||
![Figlet in DDG][4]
|
||||
|
||||
### 3. 检查社交媒体的状态
|
||||
### 3、检查社交媒体的状态
|
||||
|
||||
在某个人的 Twitter 名前加上 ‘@’,就会显示 TA 的状态(关注者等)。
|
||||
在某个人的 Twitter 名前加上 `@`,就会显示 TA 的状态(关注者等)。
|
||||
|
||||
![Itsfoss Twitter][5]
|
||||
|
||||
### 4. 生成强密码
|
||||
### 4、生成强密码
|
||||
|
||||
输入 ‘password’ 并加上需要的字符数,就可以生成一个独特的强密码。
|
||||
输入 `password` 并加上需要的字符数,就可以生成一个独特的强密码。
|
||||
|
||||
![Generating password in DuckDuckGo][6]
|
||||
|
||||
### 5. 生成随机密码短语
|
||||
### 5、生成随机密码短语
|
||||
|
||||
输入 ‘random passphrase’ 可生成一段密码短语,通常长度为 4 个词。
|
||||
输入 `random passphrase` 可生成一段密码短语,通常长度为 4 个词。
|
||||
|
||||
![Random Passphrase][7]
|
||||
|
||||
### 6. 获取一份速查表
|
||||
### 6、获取一份速查表
|
||||
|
||||
在需要看速查表的搜索词后面,可输入 cheatsheet。如果要搜索的东西有速查表,就会立即显示在搜索页面。
|
||||
在需要看速查表的搜索词后面,可输入 `cheatsheet`。如果要搜索的东西有速查表,就会立即显示在搜索页面。
|
||||
|
||||
![Vim Cheatsheet][8]
|
||||
|
||||
### 7. 通过色码获取颜色
|
||||
### 7、通过色码获取颜色
|
||||
|
||||
输入 ‘color’ 并加上你想查的颜色的十六进制码,便可显示这个颜色。
|
||||
输入 `color` 并加上你想查的颜色的十六进制码,便可显示这个颜色。
|
||||
|
||||
![Color][9]
|
||||
|
||||
### 8. 生成随机数
|
||||
### 8、生成随机数
|
||||
|
||||
搜索 ‘random number’ 会输出一个 0 到 1 之间的随机数。
|
||||
搜索 `random number` 会输出一个 0 到 1 之间的随机数。
|
||||
|
||||
![Random Number][10]
|
||||
|
||||
@ -73,113 +76,113 @@ Figlet 是一个[有趣的 Linux 命令][3],可以将任意文本转换为漂
|
||||
|
||||
![Random Number between 1 and 1000][11]
|
||||
|
||||
### 9. 转换为二进制等形式
|
||||
### 9、转换为二进制等形式
|
||||
|
||||
输入一个二进制数并加上 ‘binary’,可将其从二进制转换为十进制。
|
||||
输入一个二进制数并加上 `binary`,可将其从二进制转换为十进制。
|
||||
|
||||
![Binary to Decimal][12]
|
||||
|
||||
类似地,它也能用于十六禁止和八进制,但我不清楚它们的处理逻辑。
|
||||
类似地,它也能用于十六进制和八进制,但我不清楚它们的处理逻辑。
|
||||
|
||||
### 10. 寻找韵词
|
||||
### 10、寻找韵词
|
||||
|
||||
输入 ‘what rhymes with ’ 并带上要找同韵词的词语。作诗能力变强了,对吧?
|
||||
输入 `what rhymes with` 并带上要找同韵词的词语。作诗能力变强了,对吧?
|
||||
|
||||
![What rhymes with rain][13]
|
||||
|
||||
### 11. 获取拉马努金数、圆周率等常数
|
||||
### 11、获取拉马努金数、圆周率等常数
|
||||
|
||||
输入想获取数值的常数名,便可在搜索结果中看到它。
|
||||
|
||||
![Ramanujan Number][14]
|
||||
|
||||
### 12. 查询现在谁在太空中
|
||||
### 12、查询现在谁在太空中
|
||||
|
||||
输入 ‘people in space’ 获取当前在太空中的人员名单。同时还会显示他们在太空中居住的时间。
|
||||
输入 `people in space` 获取当前在太空中的人员名单。同时还会显示他们在太空中居住的时间。
|
||||
|
||||
![People in Space][15]
|
||||
|
||||
### 13. 查询网页是否无法访问
|
||||
### 13、查询网页是否无法访问
|
||||
|
||||
如果你想知道某个网站是你无法访问了,还是大家都无法访问了,只需在搜索词中输入 “is xyz.com down”。
|
||||
如果你想知道某个网站是你无法访问了,还是大家都无法访问了,只需在搜索词中输入 `is xyz.com down`。
|
||||
|
||||
![Is down?][16]
|
||||
|
||||
### 14. 获取特定话题的名言
|
||||
### 14、获取特定话题的名言
|
||||
|
||||
输入一个词并带上 quotes,就会显示与这个词相关的名言。
|
||||
输入一个词并带上 `quotes`,就会显示与这个词相关的名言。
|
||||
|
||||
![Get quotes in DDG][17]
|
||||
|
||||
### 15. 获取占位文本
|
||||
### 15、获取占位文本
|
||||
|
||||
搜索 ‘lorem ipsum’ 就可以获取 5 段占位文本。对 Web 开发者应该会有用。
|
||||
搜索 `lorem ipsum` 就可以获取 5 段占位文本。对 Web 开发者应该会有用。
|
||||
|
||||
![Lorem ipsum][18]
|
||||
|
||||
### 16. 获取任意月份的日历
|
||||
### 16、获取任意月份的日历
|
||||
|
||||
在年、月、日后面输入 calendar,就会为你显示该月份的交互式日历。
|
||||
在年、月、日后面输入 `calendar`,就会为你显示该月份的交互式日历。
|
||||
|
||||
![Calendar][19]
|
||||
|
||||
### 17. 生成二维码
|
||||
### 17、生成二维码
|
||||
|
||||
在文字、链接等后面输入 ‘qr’,就会生成对应的二维码。
|
||||
在文字、链接等后面输入 `qr`,就会生成对应的二维码。
|
||||
|
||||
![QRCode][20]
|
||||
|
||||
### 18. 获取一些 CSS 动画
|
||||
### 18、获取一些 CSS 动画
|
||||
|
||||
搜索 ‘css animations’ 以获取一些 CSS 动画例子。
|
||||
搜索 `css animations` 以获取一些 CSS 动画例子。
|
||||
|
||||
![CSS Animations][21]
|
||||
|
||||
### 19. 展开短链接
|
||||
### 19、展开短链接
|
||||
|
||||
如果有一个 Bitly 链接或其他短链接,但不确定它指向哪里,不必再跳转到充满垃圾信息的网页了,只需展开短链接,看看真正的网址。
|
||||
|
||||
在短链接后面输入关键词 expand,就会显示真正的目标 URL。
|
||||
在短链接后面输入关键词 `expand`,就会显示真正的目标 URL。
|
||||
|
||||
![Expand Link][22]
|
||||
|
||||
### 20. 获取特殊字符的 HTML 代码
|
||||
### 20、获取特殊字符的 HTML 代码
|
||||
|
||||
搜索 ‘html chars’,可以获取一份很长的列表,上面有 HTML 实体及其描述,按下后会在结果中显示更多信息。
|
||||
搜索 `html chars`,可以获取一份很长的列表,上面有 HTML 实体及其描述,按下后会在结果中显示更多信息。
|
||||
|
||||
![HTML Chars][23]
|
||||
|
||||
### 21. 我用这东西干啥?
|
||||
### 21、我用这东西干啥?
|
||||
|
||||
这功能没什么用。如果你输入 “why should I use this?” ,它就会在搜索结果顶部显示 “cause it's awesome”。显然,DuckDuckGo 在说他自己。
|
||||
这功能没什么用。如果你输入 `why should I use this?` ,它就会在搜索结果顶部显示 `cause it's awesome`。显然,DuckDuckGo 在说他自己。
|
||||
|
||||
![Why should I use this?][24]
|
||||
|
||||
### 22. 转换大小写
|
||||
### 22、转换大小写
|
||||
|
||||
大小写都可转换。lowercase <大写搜索词> 就会显示小写的结果
|
||||
大小写都可转换。`lowercase <大写搜索词>` 就会显示小写的结果
|
||||
|
||||
![Lowercase][25]
|
||||
|
||||
uppercase <小写搜索词> 就会显示大写的结果。
|
||||
`uppercase <小写搜索词>` 就会显示大写的结果。
|
||||
|
||||
![Uppercase][26]
|
||||
|
||||
### 23. 编码 URL
|
||||
### 23、编码 URL
|
||||
|
||||
搜索 ‘encode’ 并加上 URL,就会给出编码后的结果
|
||||
搜索 `encode` 并加上 URL,就会给出编码后的结果
|
||||
|
||||
![URL Encode][27]
|
||||
|
||||
### 24. Motherboard
|
||||
### 24、Motherboard
|
||||
|
||||
搜索 ‘Motherboard’就会看见左侧的 DuckDuckGo 的 logo 变了。它会显示选好的几个随机 logo。
|
||||
搜索 `Motherboard` 就会看见左侧的 DuckDuckGo 的 logo 变了。它会显示选好的几个随机 logo。
|
||||
|
||||
![Motherboard][28]
|
||||
|
||||
### 25. 获取 HTML 色码
|
||||
### 25、获取 HTML 色码
|
||||
|
||||
搜索 ‘color codes’ 便可获得一份颜色表。一样,这个功能多为 Web 开发者和设计师所用。
|
||||
搜索 `color codes` 便可获得一份颜色表。一样,这个功能多为 Web 开发者和设计师所用。
|
||||
|
||||
![Color Codes][29]
|
||||
|
||||
@ -196,7 +199,7 @@ via: https://itsfoss.com/duckduckgo-easter-eggs/
|
||||
作者:[sreenath][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Peaksol](https://github.com/TravinDreek)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,45 +3,47 @@
|
||||
[#]: author: "James Kiarie https://www.linuxtechi.com/author/james/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14699-1.html"
|
||||
|
||||
如何双启动 Ubuntu 22.04 LTS 和 Windows 11
|
||||
======
|
||||
嗨,伙计们,在这篇指南中,我们将演示如何在 Windows 11 的旁侧配置 Ubuntu 22.04 LTS (Jammy Jellyfish) 的双启动设置
|
||||
|
||||
为使其能工作,你需要在你的计算机上安装 windows 11 。接下来,你将需要在你的硬盘驱动器上创建一个单独的分区,你将在此分区上安装 Ubuntu 22.04 。我们将包含这点知识,因此不要担心。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/12/110546fff10ck07e2p0z2f.jpg)
|
||||
|
||||
##### 必要条件
|
||||
嗨,伙计们,在这篇指南中,我们将演示如何在 Windows 11 的之外配置 Ubuntu 22.04 LTS(Jammy Jellyfish)的双启动设置。
|
||||
|
||||
在设置双启动前,这些是你所需要的。
|
||||
为使其能工作,你需要在你的计算机上已经安装好了 Windows 11 。接下来,你将需要在你的硬盘驱动器上创建一个单独的分区,你将在此分区上安装 Ubuntu 22.04 。我们将包含这点知识,因此不要担心。
|
||||
|
||||
* 一个 Ubuntu 22.04 的可启动 USB 驱动器,你可以转到 [Ubuntu 22.04 下载页面][1] 来下载 Ubuntu 22.04 的 ISO 镜像文件。在 ISO 镜像文件到位后,抓取一个 16GB USB 驱动器,并使用 Rufus 应用程序来使其可启动。
|
||||
**前置条件:**
|
||||
|
||||
* 快速稳定的因特网连接
|
||||
在设置双启动前,这些是你所需要的:
|
||||
|
||||
* 一个 Ubuntu 22.04 的可启动 USB 驱动器,你可以转到 [Ubuntu 22.04 下载页面][1] 来下载 Ubuntu 22.04 的 ISO 镜像文件。在 ISO 镜像文件到位后,拿一个 16GB USB 驱动器,并使用 Rufus 应用程序来使其可启动。
|
||||
* 快速稳定的互联网连接
|
||||
|
||||
### 步骤 1、在你的硬盘驱动器上创建一个可用的分区
|
||||
|
||||
正如介绍中所提到的,我们首先需要在硬盘驱动器上创建一个单独的分区,我们将在其中安装 Ubuntu 22.04 。
|
||||
|
||||
因此,通过按下 **Windows + R** 组合键来打开磁盘管理器实用程序
|
||||
因此,通过按下 `Windows + R` 组合键来打开磁盘管理器实用程序。
|
||||
|
||||
在对话框中,输入 diskmgmt.msc ,并按下 <ruby>回车键<rt>ENTER</rt></ruby> 按键。
|
||||
在对话框中,输入 `diskmgmt.msc` ,并按下回车键。
|
||||
|
||||
![][2]
|
||||
|
||||
<ruby>磁盘管理<rt>disk management</rt></ruby>控制台将显示当前磁盘分区,如你将在下面所看到的一样。我们将通过压缩 ‘卷 E’ 来创建一个用于安装 Ubuntu 的分区。这在你的安装过程中可能有所不同,但是只需要跟着做,你就会理解其中的大体意思。
|
||||
<ruby>磁盘管理<rt>disk management</rt></ruby>控制台将显示当前磁盘分区,如你将在下面所看到的一样。我们将通过压缩 “卷 E” 来创建一个用于安装 Ubuntu 的分区。这在你的安装过程中可能有所不同,但是只需要跟着做,你就会理解其中的大体意思。
|
||||
|
||||
![][3]
|
||||
|
||||
因此,在你想要压缩的磁盘驱动器卷上右键,并在弹出的菜单中选择 <ruby>压缩卷<rt>Shrink</rt></ruby> 选项。
|
||||
因此,在你想要压缩的磁盘驱动器卷上点击鼠标右键,并在弹出的菜单中选择 <ruby>压缩卷<rt>Shrink</rt></ruby> 选项。
|
||||
|
||||
![][4]
|
||||
|
||||
一个弹出对话框将会出现,如下所示。具体指定压缩的控件大小(以 MB 为单位),并单 <ruby>压缩卷<rt>Shrink</rt></ruby> 。
|
||||
将会出现一个弹出对话框,如下所示。具体指定压缩的控件大小(以 MB 为单位),并单击 <ruby>压缩卷<rt>Shrink</rt></ruby> 。
|
||||
|
||||
这是指定给 Ubuntu 22.04 安装所用的空间.
|
||||
这是指定给 Ubuntu 22.04 安装所用的空间。
|
||||
|
||||
![][5]
|
||||
|
||||
@ -49,11 +51,11 @@
|
||||
|
||||
![][6]
|
||||
|
||||
随着可用空间的到来,现在将可启动 USB 媒介盘插入到你的 PC ,并重新启动你的系统。此外,要确保访问 BIOS 设置,并修改启动优先级,来使 USB 驱动器成为第一优先级。保存 BIOS 更改并继续启动。
|
||||
随着有了可用空间,现在将可启动 USB 驱动器插入到你的 PC ,并重新启动你的系统。此外,要确保访问 BIOS 设置,并修改启动优先级,来使 USB 驱动器成为第一优先级。保存 BIOS 更改并继续启动。
|
||||
|
||||
### 步骤 2、开始安装
|
||||
|
||||
在第一屏幕中,你将得到如图所示的 GRUB 菜单。选择第一个选项 <ruby>尝试或安装 Ubuntu<rt>Try or Install Ubuntu</rt></ruby> ,并按下 <ruby>回车键<rt>ENTER</rt></ruby> 按键。
|
||||
在第一个屏幕中,你将得到如图所示的 GRUB 菜单。选择第一个选项 <ruby>尝试或安装 Ubuntu<rt>Try or Install Ubuntu</rt></ruby> ,并按下 <ruby>回车键<rt>ENTER</rt></ruby> 按键。
|
||||
|
||||
![][7]
|
||||
|
||||
@ -69,7 +71,7 @@ Ubuntu 22.04 将开始加载,如下所示。这最多需要一分钟。
|
||||
|
||||
![][10]
|
||||
|
||||
在 <ruby>更新和其它软件<rt>Updates and Other Software</rt></ruby> 步骤中,选择 <ruby>正常安装<rt>Normal Installation</rt></ruby>以便安装 Ubuntu的 GUI 版本,通过勾选其它剩余选项来允许下载更新和安装第三方的针对于图像、WIFI 硬件和其它实用程序的软件包
|
||||
在 <ruby>更新和其它软件<rt>Updates and Other Software</rt></ruby> 步骤中,选择 <ruby>正常安装<rt>Normal Installation</rt></ruby> 以便安装 Ubuntu的 GUI 版本,通过勾选其它剩余选项来允许下载更新和安装第三方的针对于图像、WIFI 硬件和其它实用程序的软件包。
|
||||
|
||||
接下来,单击 <ruby>继续<rt>Continue</rt></ruby> 按钮。
|
||||
|
||||
@ -85,29 +87,29 @@ Ubuntu 22.04 将开始加载,如下所示。这最多需要一分钟。
|
||||
|
||||
针对 Ubuntu 22.04 ,我们将创建下面的分区:
|
||||
|
||||
* /boot – 1 GB
|
||||
* /home – 10 GB
|
||||
* / – 12 GB
|
||||
* Swap – 2 GB
|
||||
* `/boot` – 1 GB
|
||||
* `/home` – 10 GB
|
||||
* `/` – 12 GB
|
||||
* 交换分区 – 2 GB
|
||||
* EFI – 300 MB
|
||||
|
||||
为开始使用这些分区,单击 <ruby>可用空间<rt>Free Space</rt></ruby>分区下面的 [ + ] 符号。
|
||||
为开始使用这些分区,单击 <ruby>可用空间<rt>Free Space</rt></ruby>分区下面的 “+” 符号。
|
||||
|
||||
![][13]
|
||||
|
||||
如图显示填写 /boot 分区的详细信息,然后单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
如图显示填写 `/boot` 分区的详细信息,然后单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
|
||||
![][14]
|
||||
|
||||
接下来,具体指定 /home 分区,并单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
接下来,具体指定 `/home` 分区,并单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
|
||||
![][15]
|
||||
|
||||
接下来,定义 / ( root ) 分区,并单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
接下来,定义 `/`(根)分区,并单击 <ruby>确定<rt>OK</rt></ruby> 按钮。
|
||||
|
||||
![][16]
|
||||
|
||||
为定义 swap 空间,设置大小,并在 <ruby>使用为<rt>Use as</rt></ruby>:选项中选择 <ruby>交换区域<rt>Swap area</rt></ruby>。
|
||||
为定义交换空间,设置大小,并在 <ruby>使用为<rt>Use as</rt></ruby>:选项中选择 <ruby>交换区域<rt>Swap area</rt></ruby>。
|
||||
|
||||
![][17]
|
||||
|
||||
@ -115,7 +117,7 @@ Ubuntu 22.04 将开始加载,如下所示。这最多需要一分钟。
|
||||
|
||||
![][18]
|
||||
|
||||
下图是一份我们的分区表的分区摘要。
|
||||
下图是一份我们的分区表的分区摘要:
|
||||
|
||||
![][19]
|
||||
|
||||
@ -141,17 +143,17 @@ Ubuntu 22.04 将开始加载,如下所示。这最多需要一分钟。
|
||||
|
||||
![][24]
|
||||
|
||||
在这时,移除你的可启动 USB 驱动器,并按下 <ruby>回车键<rt>ENTER</rt></ruby> 按键。
|
||||
在这时,移除你的可启动 USB 驱动器,并按下回车键。
|
||||
|
||||
![][25]
|
||||
|
||||
在系统重新启动时,你将找到 Ubuntu 和 Windows 11 的所有选项。
|
||||
在系统重新启动时,你将找到包括 Ubuntu 和 Windows 11 在内的各种选项。
|
||||
|
||||
选择 ‘Ubuntu’ 来启动到你的新 Ubuntu 22.04 安装。为启动到 Windows 11,选择标有 <ruby>Windows 恢复环境<rt>Windows Recovery Environment</rt></ruby> 的条目。
|
||||
选择 “Ubuntu” 来启动到你的新 Ubuntu 22.04 安装。要启动到 Windows 11,请选择标有 <ruby>Windows 恢复环境<rt>Windows Recovery Environment</rt></ruby> 的条目。
|
||||
|
||||
![][26]
|
||||
|
||||
就这样。我们演示了如何双启动 Windows 11 和 Ubuntu 22.04.
|
||||
就这样。我们演示了如何双启动 Windows 11 和 Ubuntu 22.04。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -160,7 +162,7 @@ via: https://www.linuxtechi.com/dual-boot-ubuntu-22-04-and-windows-11/
|
||||
作者:[James Kiarie][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,19 +3,18 @@
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14690-1.html"
|
||||
|
||||
编译代码时动态链接库
|
||||
编译代码时动态地链接库
|
||||
======
|
||||
编译软件在你如何运行你的系统方面给你很大的灵活性。LD_LIBRARY_PATH 变量,以及 GCC 的 -L 和 -l 选项,是这种灵活性的组成部分。
|
||||
|
||||
![women programming][1]
|
||||
![](https://linux.cn/article-14690-1.html)
|
||||
|
||||
图片提供:WOCinTech Chat。由 Opensource.com 修改。CC BY-SA 4.0
|
||||
> 编译软件在你如何运行你的系统方面给你很大的灵活性。`LD_LIBRARY_PATH` 变量,以及 GCC 的 `-L` 和 `-l` 选项,是这种灵活性的组成部分。
|
||||
|
||||
编译软件是开发者经常做的事情,在开源中,一些用户甚至选择自己动手。Linux 播客 Dann Washko 称源码为“通用包格式”,因为它包含了使一个应用在任何平台上运行所需的所有组件。当然,并不是所有的源码都是为所有的系统编写的,所以它只是在目标系统的子集内是“通用”的,但问题是,源码是非常灵活的。有了开源,你可以决定代码的编译和运行方式。
|
||||
编译软件是开发者经常做的事情,在开源世界中,一些用户甚至选择自己动手。Linux 播客 Dann Washko 称源码为“通用包格式”,因为它包含了使一个应用在任何平台上运行所需的所有组件。当然,并不是所有的源码都是为所有的系统编写的,所以它只是在目标系统的子集内是“通用”的,但问题是,源码是非常灵活的。有了开源,你可以决定代码的编译和运行方式。
|
||||
|
||||
当你在编译代码时,你通常要处理多个源文件。开发人员倾向于将不同的类或模块放在不同的文件中,这样它们可以被单独维护,甚至可能被不同的项目使用。但当你编译这些文件时,许多文件会被编译成一个可执行文件。
|
||||
|
||||
@ -27,8 +26,8 @@
|
||||
|
||||
有两个选项对于在 GCC 中寻找库很重要:
|
||||
|
||||
* -L(大写字母 L)在 GCC 的搜索位置上增加一个额外的库路径。
|
||||
* -l(小写字母 L)设置你要链接的库的名字。
|
||||
* `-L`(大写字母 L)在 GCC 的搜索位置上增加一个额外的库路径。
|
||||
* `-l`(小写字母 L)设置你要链接的库的名字。
|
||||
|
||||
例如,假设你写了一个叫做 `libexample.so` 的库,并且你想在编译你的应用 `demo.c` 时使用它。首先,从 `demo.c` 创建一个对象文件:
|
||||
|
||||
@ -36,7 +35,7 @@
|
||||
$ gcc -I ./include -c src/demo.c
|
||||
```
|
||||
|
||||
`-I` 选项在 GCC 搜索头文件的路径中增加了一个目录。在这个例子中,我假设自定义头文件在一个名为 `include` 的本地目录中。`-c` 选项防止 GCC 运行链接器,因为这个任务只是为了创建一个对象文件。而这正是所发生的:
|
||||
`-I` 选项在 GCC 搜索头文件的路径中增加了一个目录。在这个例子中,我假设自定义头文件在一个名为 `include` 的本地目录中。`-c` 选项防止 GCC 运行链接器,因为这个任务只是为了创建一个对象文件。结果如下:
|
||||
|
||||
```
|
||||
$ ls
|
||||
@ -70,7 +69,7 @@ $ ldd ./myDemo
|
||||
/lib64/ld-linux-x86-64.so.2 (0x00007f514b839000)
|
||||
```
|
||||
|
||||
你已经知道`libexample` 不能被定位,但 `ldd` 输出至少确认了对*工作*库的期望。例如,`libc.so.6 `已经被定位,`ldd` 显示其完整路径。
|
||||
你已经知道定位不到 `libexample`,但 `ldd` 输出至少确认了它对*工作*库的期望位置。例如,`libc.so.6 `已经被定位,`ldd` 显示其完整路径。
|
||||
|
||||
### LD_LIBRARY_PATH
|
||||
|
||||
@ -112,9 +111,8 @@ hello world!
|
||||
|
||||
在大多数情况下,`LD_LIBRARY_PATH` 不是你需要设置的变量。按照设计,库安装到 `/usr/lib64` 中,因此应用自然会在其中搜索所需的库。在两种情况下,你可能需要使用 `LD_LIBRARY_PATH`:
|
||||
|
||||
* 你正在编译的软件需要链接到本身刚刚编译但尚未安装的库。好的构建系统,例如 [Autotools][4] 和 [CMake][5],可以帮助处理这个问题。
|
||||
|
||||
* 你正在使用设计为在单个目录之外运行的软件,没有安装脚本或将库放置在非标准目录中的安装脚本。一些应用具有 Linux 用户可以下载、复制到 `/opt` 并在“不安装”的情况下运行的版本。`LD_PATH_LIBRARY` 变量是通过封装脚本设置的,因此用户通常甚至不知道它已被设置。
|
||||
* 你正在编译的软件需要链接到本身刚刚编译但尚未安装的库。良好设计的构建系统,例如 [Autotools][4] 和 [CMake][5],可以帮助处理这个问题。
|
||||
* 你正在使用设计为在单个目录之外运行的软件,它没有安装脚本,或安装脚本将库放置在非标准目录中。一些应用具有 Linux 用户可以下载、复制到 `/opt` 并在“不安装”的情况下运行的版本。`LD_PATH_LIBRARY` 变量是通过封装脚本设置的,因此用户通常甚至不知道它已被设置。
|
||||
|
||||
编译软件为你在运行系统方面提供了很大的灵活性。`LD_LIBRARY_PATH` 变量以及 `-L` 和 `-l` GCC 选项是这种灵活性的组成部分。
|
||||
|
||||
@ -125,7 +123,7 @@ via: https://opensource.com/article/22/5/compile-code-ldlibrarypath
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][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/) 荣誉推出
|
||||
|
@ -3,13 +3,16 @@
|
||||
[#]: author: "Jishnu Saurav Mittapalli https://www.opensourceforu.com/author/jishnu-saurav-mittapalli/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14689-1.html"
|
||||
|
||||
使用机器学习模型进行预测
|
||||
机器学习:使用 Python 进行预测
|
||||
======
|
||||
机器学习基本上是人工智能的一个子集,它使用以前存在的数据对新数据进行预测。当然,现在我们所有人都知道这个道理了!这篇文章展示了如何将 Python 中开发的机器学习模型作为 Java 代码的一部分来进行预测。
|
||||
|
||||
> 机器学习基本上是人工智能的一个子集,它使用以前存在的数据对新数据进行预测。
|
||||
|
||||
当然,现在我们所有人都知道这个道理了!这篇文章展示了如何将 Python 中开发的机器学习模型作为 Java 代码的一部分来进行预测。
|
||||
|
||||
![Machine-learning][1]
|
||||
|
||||
@ -28,14 +31,15 @@ import matplotlib.pyplot as plt
|
||||
```
|
||||
from google.colab import files
|
||||
uploaded = files.upload()
|
||||
for fn in uploaded.keys(): print(‘User uploaded file “{name}” with length {length} bytes’.format(
|
||||
name=fn, length=len(uploaded[fn])))
|
||||
Choose files No file chosen
|
||||
for fn in uploaded.keys():
|
||||
print('User uploaded file "{name}" with length {length} bytes'.format(name=fn, length=len(uploaded[fn])))
|
||||
```
|
||||
|
||||
只有在当前浏览器会话中执行了该单元格时,上传部件才可用。请重新运行此单元,上传文件 *“Hoppers Crossing-Hourly-River-Level.csv”*,大小 2207036 字节。
|
||||
如果没有选择文件的话,选择上传的文件。
|
||||
|
||||
完成后,我们就可以使用 *sklearn 库*来训练我们的模型。为此,我们首先需要导入该库和算法模型,如图 1 所示。
|
||||
只有在当前浏览器会话中执行了该单元格时,上传部件才可用。请重新运行此单元,上传文件 `Hoppers Crossing-Hourly-River-Level.csv`,大小 2207036 字节。
|
||||
|
||||
完成后,我们就可以使用 `sklearn` 库来训练我们的模型。为此,我们首先需要导入该库和算法模型,如图 1 所示。
|
||||
|
||||
![Figure 1: Training the model][2]
|
||||
|
||||
@ -51,7 +55,7 @@ regressor.fit(X_train, y_train)
|
||||
|
||||
### 在 Java 中使用 ML 模型
|
||||
|
||||
我们现在需要做的是把 ML 模型转换成一个可以被 Java 程序使用的模型。有一个叫做 sklearn2pmml 的库可以帮助我们做到这一点:
|
||||
我们现在需要做的是把 ML 模型转换成一个可以被 Java 程序使用的模型。有一个叫做 `sklearn2pmml` 的库可以帮助我们做到这一点:
|
||||
|
||||
```
|
||||
# Install the library
|
||||
@ -75,7 +79,7 @@ via: https://www.opensourceforu.com/2022/05/using-a-machine-learning-model-to-ma
|
||||
作者:[Jishnu Saurav Mittapalli][a]
|
||||
选题:[lkxed][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/) 荣誉推出
|
||||
|
@ -3,19 +3,22 @@
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14697-1.html"
|
||||
|
||||
如何在 RHEL 9 上创建本地 Yum/DNF 仓库
|
||||
======
|
||||
你好,技术人员,最近红帽发布了最新的操作系统 RHEL 9,RHEL 9 满足了混合云的所有要求。它可以安装在物理服务器、虚拟机和容器镜像中。
|
||||
|
||||
当我们没有订阅的时候,想安装软件包来做 POC,那么设置本地的 yum 或 dnf 仓库将是很方便的。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/11/164149y9zzm7kkxwsxgszw.jpg)
|
||||
|
||||
在本指南中,我们将介绍如何在 RHEL 9 上使用 DVD 或 ISO 文件一步一步地创建本地 yum/dnf 资源库。
|
||||
你好,技术兄弟,最近红帽发布了最新的操作系统 RHEL 9,RHEL 9 满足了混合云的所有要求。它可以安装在物理服务器、虚拟机和容器镜像中。
|
||||
|
||||
创建本地 yum/dnf 资源库的先决条件:
|
||||
当我们没有订阅的时候,想安装软件包来做实验,那么设置本地的 Yum 或 DNF 仓库将是很方便的。
|
||||
|
||||
在本指南中,我们将介绍如何在 RHEL 9 上使用 DVD 或 ISO 文件一步一步地创建本地 Yum/DNF 资源库。
|
||||
|
||||
创建本地 Yum/DNF 资源库的先决条件:
|
||||
|
||||
* 最小化安装 RHEL 9 系统
|
||||
* 具有管理权限的 sudo 用户
|
||||
@ -23,7 +26,7 @@
|
||||
|
||||
### 1)挂载 RHEL 9 ISO 文件或 DVD
|
||||
|
||||
我们假设 RHEL 9 iso 文件已经被复制到系统中。运行下面的挂载命令,将 ISO 文件挂载到 /opt/repo 文件夹。
|
||||
我们假设 RHEL 9 iso 文件已经被复制到系统中。运行下面的挂载命令,将 ISO 文件挂载到 `/opt/repo` 文件夹。
|
||||
|
||||
```
|
||||
$ sudo mkdir /var/repo
|
||||
@ -32,15 +35,15 @@ $ sudo mount -o loop rhel-baseos-9.0-x86_64-dvd.iso /var/repo/
|
||||
|
||||
![Mount-RHEL9-ISO-File-Command][1]
|
||||
|
||||
如果是 dvd,运行:
|
||||
如果是 DVD 光盘,运行:
|
||||
|
||||
```
|
||||
$ sudo mount /dev/sr0 /var/repo/
|
||||
```
|
||||
|
||||
### 2)在 “/etc/yum.repos.d/” 目录中创建仓库文件
|
||||
### 2)在 /etc/yum.repos.d/ 目录中创建仓库文件
|
||||
|
||||
在 /etc/yum.repos.d/ 目录下创建一个名为 “rhel9-local.repo” 的仓库文件,内容如下:
|
||||
在 `/etc/yum.repos.d/` 目录下创建一个名为 “rhel9-local.repo` 的仓库文件,内容如下:
|
||||
|
||||
```
|
||||
$ sudo vi /etc/yum.repos.d/rhel9-local.repo
|
||||
@ -65,9 +68,9 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
|
||||
|
||||
![RHEL8-Local-Repo-File][2]
|
||||
|
||||
### 3)刷新 yum/dnf 和订阅管理器的缓存
|
||||
### 3)刷新 Yum/DNF 和订阅管理器的缓存
|
||||
|
||||
执行以下命令来清理 yum 或 dnf 和订阅管理器的缓存。
|
||||
执行以下命令来清理 Yum 或 DNF 和订阅管理器的缓存。
|
||||
|
||||
```
|
||||
$ sudo dnf clean all
|
||||
@ -76,7 +79,7 @@ $ sudo subscription-manager clean
|
||||
|
||||
![DNF-Subscription-Manager-Clean][3]
|
||||
|
||||
在上面的输出中,我们得到一个警告信息 “This system is not registered with an entitlement”(系统没有注册权限)。所以,为了抑制这个警告信息,编辑文件 “/etc/yum/pluginconf.d/subscription-manager.conf”,将参数 “enabled=1” 改为 “enabled=0”。
|
||||
在上面的输出中,我们得到一个警告信息 `This system is not registered with an entitlement`(系统没有注册权限)。所以,为了抑制这个警告信息,编辑文件 `/etc/yum/pluginconf.d/subscription-manager.conf`,将参数 `enabled=1` 改为 `enabled=0`。
|
||||
|
||||
```
|
||||
$ sudo vi /etc/yum/pluginconf.d/subscription-manager.conf
|
||||
@ -98,7 +101,7 @@ $ sudo dnf repolist
|
||||
|
||||
![DNF-Repolist-RHEL-9][5]
|
||||
|
||||
现在,试试用 dnf 命令通过上面配置的本地仓库安装软件包。
|
||||
现在,试试用 `dnf` 命令通过上面配置的本地仓库安装软件包。
|
||||
|
||||
```
|
||||
$ sudo dnf install nfs-utils
|
||||
@ -110,7 +113,7 @@ $ sudo dnf install nfs-utils
|
||||
|
||||
![Package-Installation-Completion-RHEL9-DNF-Command][7]
|
||||
|
||||
完美,上述输出证实了 nfs-utils 包及其依赖项已经通过本地配置的 yum 或 dnf 仓库成功安装。
|
||||
完美,上述输出证实了 `nfs-utils` 包及其依赖项已经通过本地配置的 Yum 或 DNF 仓库成功安装。
|
||||
|
||||
这就是本指南的全部内容。我希望你觉得它有参考价值。请在下面的评论区发表你的疑问和反馈。
|
||||
|
||||
@ -121,7 +124,7 @@ via: https://www.linuxtechi.com/create-local-yum-dnf-repository-rhel/
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][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/) 荣誉推出
|
||||
|
@ -0,0 +1,82 @@
|
||||
[#]: subject: "6 Linux word processors you need to try"
|
||||
[#]: via: "https://opensource.com/article/22/6/word-processors-linux"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "duoluoxiaosheng"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14693-1.html"
|
||||
|
||||
值得尝试的六款 Linux 文字处理程序
|
||||
======
|
||||
|
||||
> 选择一款最中意的文字处理程序把你的想法打印到纸上。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/10/120032h7jlo1ozm37fdyfv.jpg)
|
||||
|
||||
作家们总是在寻找更好的方法将他们的文字和想法以更好的方式呈现给他们的读者。我对文字处理程序最早的印象是在 Apple II 上使用 AppleWorks 和后来的 FrEDWriter,后者是一个创建于 1985 年的免费文字处理程序。这是我的学生们的标配,他们许多人来自没有钱购买专有软件的家庭。
|
||||
|
||||
### Abiword
|
||||
|
||||
在 20 世纪 90 年代时,我开始使用 Linux,寻找我可以使用的高质量的写作程序,并推荐给跟随我进入开源软件世界的学生们。我首先接触的文字处理程序是 [AbiWord][2]。AbiWord 来自西班牙语 Abierto,意思是“开放”。它最早发布于 1998 年,并且之后一直在升级。它使用 GPLv2 开源协议。它支持列表、缩进,字符格式等基本功能,支持 .doc、.html、.docx、.odt 等多种格式文件的导入和导出。
|
||||
|
||||
![Image of Abiword][3]
|
||||
|
||||
### Etherpad
|
||||
|
||||
[Etherpad][4] 是一个开源协作编辑项目。它可以让你像 Google Drive 那样实时编辑文档,主要的区别是它是完全开源的。据它的网站上介绍,你可以“与你的朋友、同学或同事一起写文章、新闻稿、待办事项,同时在同一个文件上工作”。其源代码可随时查看。Etherpad 采用 Apache 2.0 开源协议。你可以直接在线使用它,或者把它下载并 [安装][5] 到你的 Linux 电脑上。
|
||||
|
||||
### Cryptpad
|
||||
|
||||
[CryptPad][6] 是一个端到端加密的写作套件。使用 GPLv3 开源协议,并且源代码公开在 [GitHub][7] 上。它由 [Xwiki][8] 实验室开发。可替代 Google Drive,并且是自主托管的。根据其网站描述,“CryptPad 旨在实现协作办公。实时同步文档的更改。由于所有数据都已加密,因此该服务及其管理员无法查看正在编辑和存储的内容。” Cryptpad 为用户提供了 [丰富的文档][9]。
|
||||
|
||||
### Focuswriter
|
||||
|
||||
[FocusWriter][10] 是一个简单的免干扰的编辑器。它使用隐藏式界面,鼠标移动到屏幕边界时才显示界面。它使用 GPLv3 开源协议,并为 Linux 提供了 Flatpak 软件包,也为 [Ubuntu][11] 和 [Fedora][12] 提供了 DEB 和 RPM。下图是一个 FocusWriter 桌面的例子。这是一个非常简单直观的界面,菜单自动隐藏,当鼠标指向屏幕顶部或边缘时才会显示。文件默认保存为 .odt 格式,也支持纯文本、.docx 和富文本。
|
||||
|
||||
![Image of FocusWriter][13]
|
||||
|
||||
### LibreOffice Writer
|
||||
|
||||
[LibreOffice Writer][14] 是我最喜欢的,我已经使用了十多年了。它拥有我需要的所有特性,包括富文本格式化。它还拥有我见过的最多的导入、导出方式。类似于 [APA][15] 这样的问卷和出版模板它拥有十多种。我最喜欢的是它可以将文件导出为 PDF 和 epub。 LibreOffice Writer 是一个自由软件,使用 Mozilla 公开许可证(MPL)2.0 开源协议。其 [源代码][16] 由文档基金会提供。LibreOffice 支持大多数 Linux 发行版。同时它也提供 Flatpak、Snap 和 AppImage 软件包。另外,你也可以把它下载并安装到 MacOS 和 Windows 上。
|
||||
|
||||
![Image of LibreOffice work space][17]
|
||||
|
||||
### OpenOffice Writer
|
||||
|
||||
Apache [OpenOffice Writer][18] 是一个全功能的文字处理程序。它可以简单地用于备忘录,也可以复杂到足以编写你的第一本书。依据官网的描述,OpenOffice Writer 将文档自动保存为 .odt。它还支持将文档保存为 .doc、.docx、富文本和其他格式。OpenOffice Writer 使用 Apache 许可证 2.0 开源协议。源代码在 [GitHub][19] 上公开。
|
||||
|
||||
还有许多自由开源软件等着大家去发现。它们非常适合完成你的日常任务,你也可以为它们的发展做出贡献。你最喜欢的 Linux 文字处理器程序是什么呢?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/word-processors-linux
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[duoluoxiaosheng](https://github.com/duoluoxiaosheng)
|
||||
校对:[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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/typewriter-hands.jpg
|
||||
[2]: https://www.abisource.com/
|
||||
[3]: https://opensource.com/sites/default/files/2022-05/abiword.png
|
||||
[4]: https://etherpad.org/#
|
||||
[5]: https://github.com/ether/etherpad-lite#installation
|
||||
[6]: https://cryptpad.fr/what-is-cryptpad.html
|
||||
[7]: https://github.com/xwiki-labs/cryptpad
|
||||
[8]: https://github.com/xwiki-labs
|
||||
[9]: https://docs.cryptpad.fr/en/user_guide/index.html
|
||||
[10]: https://gottcode.org/focuswriter/
|
||||
[11]: https://packages.ubuntu.com/jammy/focuswriter
|
||||
[12]: https://src.fedoraproject.org/rpms/focuswriter
|
||||
[13]: https://opensource.com/sites/default/files/2022-05/focuswriter.png
|
||||
[14]: https://www.libreoffice.org/discover/writer/
|
||||
[15]: https://extensions.libreoffice.org/en/extensions/show/apa-style-paper-template
|
||||
[16]: https://www.libreoffice.org/about-us/source-code/
|
||||
[17]: https://opensource.com/sites/default/files/2022-05/Libreofficewriter.png
|
||||
[18]: https://www.openoffice.org/product/writer.html
|
||||
[19]: https://github.com/apache/openoffice
|
@ -0,0 +1,113 @@
|
||||
[#]: subject: "Amberol is a Stunning Looking Music Player for Linux That Just Plays Music and Nothing Else"
|
||||
[#]: via: "https://itsfoss.com/amberol-music-player/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14700-1.html"
|
||||
|
||||
Amberol 是一款外观漂亮的 Linux 音乐播放器,只播放音乐,不做其他事情
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/12/155846b0sbsvtt1et70ttf.jpg)
|
||||
|
||||
虽然音乐世界被流媒体服务所主导,但这并没有阻止开发者为桌面电脑创建音乐播放器。
|
||||
|
||||
最近,我发现了一个外观漂亮的新的 Linux 桌面音乐播放器。它名为 Amberol,我被它的美丽所震撼。
|
||||
|
||||
![amberol music player interface][1]
|
||||
|
||||
看起来不错,不是吗?让我们仔细看看它。
|
||||
|
||||
### Amberol,Linux 上的可爱的音乐播放器
|
||||
|
||||
看起来不错是它所做的两件(或几件)事情中的一件。另一件事是播放音乐。
|
||||
|
||||
这就是它,[Amberol][2] 没有额外的花哨(和有用)的功能,如生成专辑封面、元数据编辑、歌词显示或播放列表和库管理。
|
||||
|
||||
这些功能也不像是会在未来的版本中加入。Amberol 只想播放音乐。就是这样。
|
||||
|
||||
#### 令人惊叹的用户界面
|
||||
|
||||
Amberol 和大多数新的 GNOME 应用一样,是用 Rust 和 GTK 编写的。
|
||||
|
||||
它有一个自适应的用户界面,可以根据你正在播放的专辑颜色来改变颜色。渐变效果给了它一个现代、时尚的外观,肯定会成为你的 Linux <ruby>美化<rt>Ricing</rt></ruby>截图的一部分。
|
||||
|
||||
![amberol music player][3]
|
||||
|
||||
由于其 UI 没有传统的手柄和菜单,它给应用一个统一的外观。
|
||||
|
||||
#### 播放列表
|
||||
|
||||
它会从你添加的文件夹中的文件自动生成一个播放列表,显示在左手边的侧边栏。
|
||||
|
||||
![amberol playlist][4]
|
||||
|
||||
你可以在左上角看到整个播放列表将播放多长时间的音乐。点击“勾选”符号,你可以选择歌曲,并从播放列表中删除它们。
|
||||
|
||||
如果你愿意,可以隐藏播放列表的侧边栏。
|
||||
|
||||
![amberol without playlist][5]
|
||||
|
||||
#### 音乐播放选项
|
||||
|
||||
你可以在界面上看到歌曲的进度。该播放器与键盘上的媒体控制按钮整合得很好。你可以用专用的媒体键来播放、暂停和改变曲目(如果你的系统上有)。
|
||||
|
||||
Amberol 为你提供了一些播放音乐的选项。你可以打开随机播放功能,按随机顺序播放音乐。你也可以单曲循环,直到你厌倦它。
|
||||
|
||||
![amberol music playing options][6]
|
||||
|
||||
底部的汉堡菜单让你可以选择添加文件或文件夹,并显示可用的键盘快捷方式。
|
||||
|
||||
![amberol keyboard shortcuts][7]
|
||||
|
||||
你也可以从这里禁用 UI 颜色变化以配合专辑封面。
|
||||
|
||||
### 在 Linux 上安装 Amberol
|
||||
|
||||
Amberol 是 [以 Flatpak 形式提供的][8]。请确保 [你的系统已启用 Flatpak 支持][9]。
|
||||
|
||||
要安装 Amberol,请打开终端并使用以下命令:
|
||||
|
||||
```
|
||||
flatpak install flathub io.bassi.Amberol
|
||||
```
|
||||
|
||||
安装完毕后,在菜单中搜索该应用,并点击启动。
|
||||
|
||||
第一次运行时,它会要求你添加音乐文件或文件夹。你也可以拖放文件播放。
|
||||
|
||||
![amberol first run][10]
|
||||
|
||||
### 总结
|
||||
|
||||
就个人而言,我更喜欢流媒体服务,因为我没有本机音乐珍藏。但我知道有的人有大量的 CD 收藏,现在都保存在硬盘上。
|
||||
|
||||
Amberol 是一个外观漂亮的应用,对于播放本机音乐来说,它足够好。最吸引人的是它基于专辑封面的自适应用户界面。
|
||||
|
||||
请你试试它,并在评论区分享你的经验。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/amberol-music-player/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-music-player-interface-800x693.png
|
||||
[2]: https://apps.gnome.org/app/io.bassi.Amberol/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-music-player-800x580.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-playlist-800x548.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-without-playlist-800x693.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-music-playing-options-800x548.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-keyboard-shortcuts-800x528.png
|
||||
[8]: https://flathub.org/apps/details/io.bassi.Amberol
|
||||
[9]: https://itsfoss.com/flatpak-guide/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-first-run-800x693.png
|
@ -0,0 +1,100 @@
|
||||
[#]: subject: "Linux Kernel 5.19 RC1 Released, Concluding ARM Generic Kernel Work"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/linux-kernel-5-19-rc1/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Donkey-Hao"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14692-1.html"
|
||||
|
||||
Linux 内核 5.19 RC1 发布,完成了 ARM 通用内核的工作
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202206/10/100401b0t82bd0ww0o2tgn.jpg)
|
||||
|
||||
> Linus Torvalds 发布了用来测试的 Linux 内核 5.19 RC1,带来了一些重大变化。
|
||||
|
||||
继上个月 [Linux 内核 5.18][1] 发布之后,Linus Torvalds 宣布了 Linux 内核 5.19 系列第一个候选版本。与此同时,Linux 内核 5.19 官方合并窗口关闭,这意味着除非是关键性的,否则不会再接受任何新功能。
|
||||
|
||||
简单看一下 Linux 内核 5.19 的新内容,会发现 CPU、GPU、网络、存储和核心模块都有常规的更新。此外,代码清理、淘汰过时硬件和对以后芯片组的持续支持是此版本的亮点。
|
||||
|
||||
在进一步介绍之前,让我们简单来看一下这些新特性。
|
||||
|
||||
### Linux 内核 5.19(RC1)的新特性
|
||||
|
||||
#### CPU
|
||||
|
||||
首先需要提及的是,Linux 内核 5.19 开始 [初步支持][2] 龙芯架构的 CPU 系列。龙芯由中国龙芯中科公司设计开发。龙芯架构的 CPU 是兼容 MIPS 架构的通用微处理器。不过虽然现在提供了支持,但是你仍不能在龙芯 CPU 上启动 Linux,因为一些代码还在审核中。希望在 5.20 版本中能够使用。
|
||||
|
||||
新的 [英特尔 IFS 驱动][4] 在该版本中落地,这有助于在部署前后发现硬件问题。它能够在早期阶段检测电路层面的 CPU 错误。
|
||||
|
||||
在前几个针对英特尔 CPU 的内核版本中一直在对电源管理和散热方面进行开发,[这个版本][5] 也不例外。首先,为 Raptor 和 Alder Lake 家族添加了英特尔 <ruby>运行时平均功率限制<rt>Run-Time Average Power Limiting</rt></ruby>(RAPL)的支持。其次,改进了 P-state 驱动以处理频率变化,并且基于 CPU 的缩放支持被添加到被动 devfreq 中。
|
||||
|
||||
虽然英特尔 CPU 主要是散热和电源管理方面的工作,但对 AMD CPU 系列来说有更多的性能更新。首先,计划在今年年底完成 ZMD Zen 4 CPU 的 <ruby>基于指令的采样<rt>Instruction-Based Sampling</rt></ruby>(IBS)模块引入了更多更新。此外,此版本引入了 PerfMonV2,提供了更多性能监视能力。
|
||||
|
||||
此外,该版本中移除了 a.out 支持。同样,过时的 Renesas H8/300 CPU 也被移除了。
|
||||
|
||||
#### 主要 ARM 更新
|
||||
|
||||
终于,主线 Linux 内核能够 [支持 ARM 多平台][7] 了。在 Linus 的 RC1 开场白中可以看到,这是该版本中的巨大改变!从 Linux 3.7 开始,跨越了十多年的工作,这是多么漫长的过程。
|
||||
|
||||
![Linux 内核 5.19 Rc1 发布公告提到了 ARM 变化][8]
|
||||
|
||||
#### 图形和存储升级
|
||||
|
||||
存储子系统在各种流行的文件系统中都有性能提升。最主要的变化包括苹果 M1 NVMe 控制器支持和对 XFS 文件系统的更好支持。此外,Btrfs、F2FS 以及 exFAT 文件系统也有增强。
|
||||
|
||||
在代码行数方面,有一个令人兴奋的指标是仅是图形驱动程序 Linux 内核 5.19 就增加了大约[50 万行代码][9]。它包括 AMD 的 RDNA、CDNA,英特尔的 Raptor Lake、DG2/Alchemist 等图形驱动更新。
|
||||
|
||||
#### 重要的网络变化
|
||||
|
||||
鉴于数据传输大幅增长,对 Big TCP 的支持有助于支持数据中心 400 GBit 级别的流量。它还可以在高性能网络环境中降低延迟。
|
||||
|
||||
继续改进了 <ruby>多路径 TCP<rt>Multi-Path TCP</rt></ruby>(MPTCP)。此外,高通 ath11k WiFi 驱动程序在此版本中添加了网络唤醒功能。同样增加了对瑞昱的 8852ce 芯片、联发科的 T700 调制解调器以及瑞萨科技的 RZ/V2M 的支持。
|
||||
|
||||
#### 其他值得注意的功能
|
||||
|
||||
首先,内核中著名的随机函数生成器(RNG)在此版本中 [继续][10] 改进。
|
||||
|
||||
其次,著名的新兴的 Framework 模块化笔记本电脑获得了此版本 Chrome OS EC 驱动支持。Framework 笔记本现在可以作为一个非 Chromebook 设备利用 ChromeOS 的嵌入式控制器。
|
||||
|
||||
此外,Wacom 绘画板以及其他相关设备也有众多更新。[包括][11] 对联想 Thinkpad TrackPoint II、谷歌 Whiskers Touchpad、联想 X12 TrackPoint 等设备支持的提升。
|
||||
|
||||
### Linux 内核 5.19 下载
|
||||
|
||||
如果你想要测试并尝试该候选版本,可以在 [这里][12] 下载。
|
||||
|
||||
预计在 2022 年 7 月左右最终版本发布前,将会有多个版本更迭。
|
||||
|
||||
参考自:[内核邮件列表][17]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/linux-kernel-5-19-rc1/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Donkey-Hao](https://github.com/Donkey-Hao)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/2022/05/linux-kernel-5-18/
|
||||
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6f2f3e2c80e975804360665d973211e4d9390cb
|
||||
[3]: http://www.loongson.cn/
|
||||
[4]: https://lore.kernel.org/lkml/13e61c61-0d4b-5f48-6373-f056bf8b603f@redhat.com/
|
||||
[5]: https://lore.kernel.org/linux-acpi/CAJZ5v0hKBt3js65w18iKxzWoN5QuEc84_2xcM6paSv-ZHwe3Rw@mail.gmail.com/
|
||||
[6]: https://lore.kernel.org/lkml/You6yGPUttvBcg8s@gmail.com/
|
||||
[7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ecf0aa5317b0ad6bb015128a5b763c954fd58708
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/06/Linux-Kernel-5.19-Rc1-release-announcement-mentions-ARM-changes.jpg
|
||||
[9]: https://lore.kernel.org/lkml/CAPM=9tw62EZfAm0PbiOPmMrpfR98QMFTWGEQcA34G4ap4xxNkA@mail.gmail.com/
|
||||
[10]: https://lore.kernel.org/lkml/20220522214457.37108-1-Jason@zx2c4.com/T/#u
|
||||
[11]: https://lore.kernel.org/lkml/nycvar.YFH.7.76.2205241107530.28985@cbobk.fhfr.pm/
|
||||
[12]: https://www.kernel.org/
|
||||
[13]: https://git.kernel.org/torvalds/t/linux-5.19-rc1.tar.gz
|
||||
[14]: https://git.kernel.org/torvalds/p/v5.19-rc1/v5.18
|
||||
[15]: https://git.kernel.org/torvalds/ds/v5.19-rc1/v5.18
|
||||
[16]: https://git.kernel.org/torvalds/h/v5.19-rc1
|
||||
[17]: https://lore.kernel.org/lkml/CAHk-=wgZt-YDSKfdyES2p6A_KJoG8DwQ0mb9CeS8jZYp+0Y2Rw@mail.gmail.com/T/#u
|
@ -0,0 +1,47 @@
|
||||
[#]: subject: "OpenInfra Foundation Launches ‘directed funding’ To Support Open Source Projects"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/openinfra-foundation-launches-directed-funding-to-support-open-source-projects/"
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14707-1.html"
|
||||
|
||||
OpenInfra 基金会启动“定向资助”以支持开源项目
|
||||
======
|
||||
![OpenInfra][1]
|
||||
|
||||
OpenInfra 基金会的前身为 OpenStack 基金会,几年前它将范围扩展到其旗舰项目之外,于是改了名字。2022 年 6 月 7 日,它宣布了一种有趣的新方式,让企业资助基金会内的开源项目。一般来说,开源基金会的企业成员通过支付会员费来支持该组织,然后基金会按照他们认为合适的方式分发这些费用。OpenInfra 基金会现在推出了一种新的“定向资助”模式,允许成员将他们的资金直接用于项目。
|
||||
|
||||
此前,基金会并不允许这样做,因为正如 Bryce 指出的那样,它可能会产生混合激励和付费游戏动态,而该组织一直试图避免这种情况。然而,社区对支持特定项目有很大的兴趣,这是有道理的,因为该基金会现在拥有更多种类的项目,但并不是每个成员都对每个项目进行了大量投入。
|
||||
|
||||
Bryce 表示,基金会的领导层和董事会,花费了大量时间来考虑,如何使基金会的核心原则与这种新模式相协调。因此,该模型试图将过去十年运行良好的 OpenStack/OpenInfra 技术治理模型的优点,与这些新的财务考虑相结合。
|
||||
|
||||
在这种“定向资助”模式下,每个新项目都将拥有自己的法人实体来持有项目资金。为确保新项目的合法性,OpenInfra 白金会员(目前为 9 家,包括蚂蚁集团、华为、Meta、微软和红帽)必须担任项目的发起人,之后其他组织才能加入项目基金。如果赞助公司还不是 OpenInfra 成员,则必须成为成员。然后,所有这些资助成员组成一个项目基金管理委员会,决定创建预算的费用。与此同时,OpenInfra 基金会将为这些项目提供社区建设服务。
|
||||
|
||||
这种新模式暂时只适用于加入基金会的新项目。Bryce 和 Collier 指出,组织可能会在一些现有项目中追溯应用这种新模式,但这个考虑目前不在路线图上。
|
||||
|
||||
自从将范围扩展到 OpenStack 之外后,OpenInfra 基金会增加了一些新项目,例如用于提高容器安全性的 Kata Containers、用于基础设施生命周期管理的 Airship、Startling X 边缘计算堆栈以及 Zuul CI/CD 平台。
|
||||
|
||||
“我们从每个成功的项目中学到的最重要的一点是,协作是关键,支持生态系统的范围越广越好,” OpenInfra 基金会总经理 Thierry Carrez 说,“事实上,我们发现最成功的开源项目是由多家公司资助的,因为他们能够整合资源以实现更高的回报率。”
|
||||
|
||||
这种新模式显然是 OpenInfra 基金会引入新项目和新成员的一种方式。正如领导团队欣然承认的那样,其在多方生态系统中管理开源项目的模型 —— 无论是通过新的定向资金还是更传统的方法 —— 可能并不适合每个项目。即使 OpenInfra 基金会只收到一小部分项目,随着对这些复杂云基础设施项目需求的增长,开源项目的数量也在增加,同时它们也变得更加复杂。
|
||||
|
||||
基金会还宣布了其各个项目的几个里程碑版本的发布,包括 Kata Containers 2.0 版、Zuul 5.0 版和 StarlingX 6.0 。
|
||||
|
||||
Collier 说:“基金会今年庆祝成立 10 周年,在展望下一个十年的开放基础设施之际,我们正在推动我们的模型如此成功的关键,那就是:将希望合作的公司和个人联合起来,为他们提供一个框架和有效协作的工具,并帮助他们投资资金以最好地帮助他们关心的项目。”
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/openinfra-foundation-launches-directed-funding-to-support-open-source-projects/
|
||||
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/laveesh-kocher/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/06/open-infra-berlin-event.png
|
@ -0,0 +1,100 @@
|
||||
[#]: subject: "openSUSE Leap 15.4 Release Adds Leap Micro 5.2, Updated Desktop Environments, and More"
|
||||
[#]: via: "https://news.itsfoss.com/opensuse-leap-15-4-release/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-14695-1.html"
|
||||
|
||||
openSUSE Leap 15.4 发布版本添加了 Leap Micro 5.2、更新桌面环境等等
|
||||
======
|
||||
|
||||
> 为奋起直追 SUSE Linux Enterprise 的 SP 4 ,openSUSE Leap 15.4 到来了,带来了新的升级和极其重要的改善。
|
||||
|
||||
![opensuse 15.4][1]
|
||||
|
||||
即将到来的 openSUSE 小发布版本终于来了。如果你使用 openSUSE 作为你日常使用的桌面或服务器版本,你现在可能已经测试候选版本好几周了。
|
||||
|
||||
openSUSE Leap 15.4 的重点是软件包的更新,用以奋起直追 SUSE Linux Enterprise 的 SP 4 。因此,你将注意到一些弃用的软件包,以及可用于替换它们的新的升级。
|
||||
|
||||
当然,你应该有一些可用的软件包来确保兼容性。但是,大多数较旧的版本已经被移除。
|
||||
|
||||
### openSUSE Leap 15.4: 有什么新的变化?
|
||||
|
||||
为与最新的 SUSE Linux Enterprise(SLE)相适应,像 Python 2 和 KDE 4 一样的软件包已经被移除。你可以在这次的发布版本中找到较新的桌面环境。
|
||||
|
||||
此外,在容器和 AI/ML 用例方面,更新了 Podman、Containerd、Tensorflow 和 Grafana。
|
||||
|
||||
#### Leap Micro 5.2
|
||||
|
||||
Leap Micro 是针对容器和虚拟化工作负载定制的轻量级操作系统的最新版本。它也是 Leap 版的 [MicroOS][2],是 Tumbleweed 的一种变体,提供了自动管理和修补。
|
||||
|
||||
#### 桌面环境
|
||||
|
||||
Xfce 4.16 继续保留,但你可以找到主要功能的一些新补充,包括新图标和调色板。
|
||||
|
||||
Xfce 4.16 中的设置管理器也获得了视觉上的刷新。类似地,文件管理器(Thunar)也有一些改善,新的状态托盘插件的深色模式支持等等。
|
||||
|
||||
KDE 4 软件包已经被弃用,Plasma 5.24 LTS 已经作为长期支持版本中包含于其中。
|
||||
|
||||
要深入了解这些变化,你可以查看我们之前针对 [KDE Plasma 5.24 LTS][3] 的报道。总体来说,新的 KDE Plasma 体验应该会令桌面用户赞叹。
|
||||
|
||||
说到 GNOME,你可以发现包含在 openSUSE Leap 15.4 中的 GNOME 41 带来了一系列的改善和新的特色功能。了解更多关于 [GNOME 41][4] 的信息,你可以期待它的一些新的特色功能。
|
||||
|
||||
对于其它的可用的桌面环境来说,Leap 15.4 包括:
|
||||
|
||||
* MATE 桌面环境 1.26
|
||||
* Enlightenment 桌面环境0.25.3
|
||||
* 深度桌面环境 20.3
|
||||
|
||||
#### 弃用的软件包
|
||||
|
||||
移除了一些基础的软件包,包括 Python 2(生命终结)、Digikam、TensorFlow 1.x 和 Qt 4 等软件包。
|
||||
|
||||
在更新系统后,你可以使用 Qt 5 和 Plasma 5 。
|
||||
|
||||
#### 更新的软件包
|
||||
|
||||
很多重要的软件包在 Leap 15.4 中得到了更新,包含一些流行的软件包:
|
||||
|
||||
* TensorFlow 2.6.2
|
||||
* Podman 3.4.4
|
||||
* GNU Health 4.0
|
||||
* sudo 1.9.9
|
||||
* systemd 249.10
|
||||
* AppArmor 3.04
|
||||
* DNF 4.10.0
|
||||
* LibreOffice 7.2.5
|
||||
|
||||
因此,你应该会注意到一些针对服务器用户和桌面用户的各种应用程序的有用更新。很多多媒体应用程序,像 VLC、GNOME MPV 等,都得到了升级。
|
||||
|
||||
#### 其它改善
|
||||
|
||||
随着基本软件的更新和清理,你也可以找到一个由 SUSE 维护的较新的 Linux 内核 5.14.21。
|
||||
|
||||
更新后的内核对硬件的支持应该会有改善。
|
||||
|
||||
更多信息,你可以参考针对 [openSUSE Leap 15.4][5] 的发布版本说明。
|
||||
|
||||
> **[下载 openSUSE Leap 15.4][6]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/opensuse-leap-15-4-release/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/opensuse-leap-15-4.jpg
|
||||
[2]: https://microos.opensuse.org/
|
||||
[3]: https://news.itsfoss.com/kde-plasma-5-24-lts-release/
|
||||
[4]: https://news.itsfoss.com/gnome-41-release/
|
||||
[5]: https://doc.opensuse.org/release-notes/x86_64/openSUSE/Leap/15.4/#rnotes
|
||||
[6]: https://get.opensuse.org/leap/15.4/
|
@ -1,81 +0,0 @@
|
||||
[#]: subject: "Rocket.Chat is Switching to Matrix to Enable Cross-App Messaging"
|
||||
[#]: via: "https://news.itsfoss.com/rocket-chat-matrix/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Rocket.Chat is Switching to Matrix to Enable Cross-App Messaging
|
||||
======
|
||||
Rocket.Chat is embracing the Matrix protocol to enable decentralized communication for the platform. That’s a huge change, isn’t it?
|
||||
|
||||
![rocket chat matrix][1]
|
||||
|
||||
Rocket.Chat is an excellent open-source messaging (collaboration) platform.
|
||||
|
||||
In fact, it is one of the [best open-source Slack alternatives][2] available. We use it as well for internal communication.
|
||||
|
||||
Rocket.Chat is also making good progress compared to some of its open-source competitors. For instance, they [teamed up with Nextcloud to provide an alternative to Office 365][3].
|
||||
|
||||
And recently announced a switch to Matrix protocol to introduce federation capabilities that allow its users to communicate with users on other platforms. In other words, [Rocket.Chat][4] will be utilizing a decentralized network for communication with the Matrix integration.
|
||||
|
||||
As a Rocket.Chat user; you can talk to users on any other app using the Matrix protocol.
|
||||
|
||||
### Rocket.Chat is Switching to a Decentralized Protocol to Enhance Collaboration
|
||||
|
||||
![][5]
|
||||
|
||||
Matrix protocol is a fantastic choice to enable an interoperable federation. Now, with Rocket.Chat onboard; the decentralized network should be stronger than ever.
|
||||
|
||||
Not to forget, we already have [Element][6], and [Gitter][7], as some of the platforms that already utilize Matrix. So, Rocket.Chat joining the network sounds exciting!
|
||||
|
||||
The [official announcement][8] further explains the collaboration:
|
||||
|
||||
> The Rocket.Chat adoption of Matrix makes it simple for organizations to easily connect with external parties, whether they’re using Rocket.Chat or any other Matrix compatible platform. This initiative is another step forward on Rocket.Chat’s journey to let every conversation flow without compromise and enable full interoperability with its ecosystem.
|
||||
|
||||
The new change with the Matrix network is already available in the latest [alpha release for Rocket.Chat 4.7.0][9]. Unless you want to experiment with it, you should wait for the stable release to introduce the Matrix network support.
|
||||
|
||||
**Aron Ogle** (*Core Developer at Rocket.Chat*) has put together a [guide][10] and a video to help you out if you want to explore the technical details of Rocket.Chat integration with the Matrix. Here’s the video for it:
|
||||
|
||||
![Setting up Rocket Chat to talk with Matrix][11]
|
||||
|
||||
### Is This a Good Move?
|
||||
|
||||
While decentralized tech hasn’t taken the internet by storm, it is promising and makes more sense with its reliability and decentralized capabilities. Matrix protocol has been getting all the praise for a couple of years now, and it seems to be heading in the right direction.
|
||||
|
||||
As of now, most of the big platforms rely on centralized infrastructure to make things work.
|
||||
|
||||
And, with the current implementations, cross-communication is not possible with most of the chat applications.
|
||||
|
||||
So, Rocket.Chat will be making a difference by offering cross-app interactions, like the ability to chat with an Element user on **matrix.org,** as shown in the image above.
|
||||
|
||||
Rocket.Chat entering the scene with Matrix protocol could open up the potential for its competitors or other services to give a second thought to solutions like Matrix protocol.
|
||||
|
||||
*What do you think about Rocket.Chat adopting the Matrix protocol? Share your thoughts in the comments section below.*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/rocket-chat-matrix/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/05/rocketchat-matrix-protocol.jpg
|
||||
[2]: https://itsfoss.com/open-source-slack-alternative/
|
||||
[3]: https://news.itsfoss.com/rocket-chat-nextcloud-collaboration/
|
||||
[4]: https://itsfoss.com/rocket-chat/
|
||||
[5]: https://news.itsfoss.com/wp-content/uploads/2022/05/rocket-chat-matrix.jpg
|
||||
[6]: https://itsfoss.com/element/
|
||||
[7]: https://itsfoss.com/gitter/
|
||||
[8]: https://rocket.chat/press-releases/rocket-chat-leverages-matrix-protocol-for-decentralized-and-interoperable-communications
|
||||
[9]: https://github.com/RocketChat/Rocket.Chat/releases/tag/4.7.0
|
||||
[10]: https://geekgonecrazy.com/2022/05/30/rocketchat-and-the-matrix-protocol/
|
||||
[11]: https://youtu.be/oQhIH8kql9I
|
@ -1,37 +0,0 @@
|
||||
[#]: subject: "Google Makes Data Centre Scale Encryption Open Source"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/google-makes-data-centre-scale-encryption-open-source/"
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Google Makes Data Centre Scale Encryption Open Source
|
||||
======
|
||||
![google-ranking-factors][1]
|
||||
|
||||
Google has made open source an encryption scheme it developed to protect traffic between its data centres. PSP, which stands for PSP Security Protocol, was created to relieve Google’s processors of the growing burden of software-based encryption, according to the company. PSP has been hailed as a success in the company’s own environment, and the company has stated that it is “making PSP open source to encourage broader adoption by the community and hardware implementation by additional NIC [network interface card] vendors.” PSP offloads encryption to NICs, which was previously possible with existing encryption schemes, but not at the scale or with the traffic coverage required by Google.
|
||||
|
||||
“At Google’s scale,” the company wrote when announcing its decision, “the cryptographic offload must support millions of live transmission control protocol (TCP) connections and sustain 100,000 new connections per second at peak.”
|
||||
|
||||
Existing security protocols, according to Google Cloud’s Amin Vahdat and Soheil Hassas Yeganeh, had flaws. “While TLS meets our security requirements, it is not an offload-friendly solution because of the tight coupling between the connection state in the kernel and the offload state in hardware. TLS also does not support non-TCP transport protocols, such as UDP”, they stated.
|
||||
|
||||
However, the IPSec protocol cannot be offloaded to hardware at the required scale. “IPSec … cannot economically support our scale partly because they store the full encryption state in an associative hardware table with modest update rates,” the post explains.
|
||||
|
||||
Google added a custom header and trailer to standard User Datagram Protocol (UDP) encapsulation to create PSP. PSP is currently implemented in three ways: one for Google’s Andromeda Linux virtualisation kernel, one for its Snap networking system, and an application-layer version, SoftPSP, created so Google Cloud customers could use PSP on computers with traditional NICs.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/google-makes-data-centre-scale-encryption-open-source/
|
||||
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/laveesh-kocher/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/06/google-ranking-factors-e1654074528236.jpg
|
@ -1,85 +0,0 @@
|
||||
[#]: subject: "Spotify Introduces an Open-Source Tool to Fix a Big Problem for Modern Musicians"
|
||||
[#]: via: "https://news.itsfoss.com/spotify-basic-pitch/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Spotify Introduces an Open-Source Tool to Fix a Big Problem for Modern Musicians
|
||||
======
|
||||
Spotify’s new open-source tool helps you convert audio to MIDI version. Explore why it is a big deal for modern musicians.
|
||||
|
||||
![spotify][1]
|
||||
|
||||
Spotify is a leading music streaming platform with several open-source projects.
|
||||
|
||||
While most of the projects/tools are built for niche users, they have finally introduced something that seems enticing to all the modern musicians involved with digital music production.
|
||||
|
||||
‘Basic Pitch’ is a new free and open-source tool by Spotify that lets you convert any audio file to its MIDI (Musical Instrument Digital Interface) version.
|
||||
|
||||
In case you did not know, with MIDI notes, you can easily tweak what’s being played and analyze more to help you in digital music production.
|
||||
|
||||
### Basic Pitch: Making Things Easier
|
||||
|
||||
With Basic Pitch, one can easily have MIDI notes of an audio file they have always wanted, and with better accuracy.
|
||||
|
||||
![spotify basic pitch][2]
|
||||
|
||||
Spotify explains that it is better than existing note-detection systems by offering some advantages that include:
|
||||
|
||||
> **Polyphonic + instrument-agnostic:** Unlike most other note-detection algorithms, Basic Pitch can track multiple notes at a time and across various instruments, including piano, guitar, and ocarina. Many systems limit users to only monophonic output (one note at a time, like a single vocal melody), or are built for only one kind of instrument.
|
||||
|
||||
> **Pitch bend detection:** Instruments, like guitar or the human voice, allow for more expressiveness through pitch-bending: vibrato, glissando, bends, slides, etc. However, this valuable information is often lost when turning audio into MIDI. Basic Pitch supports this right out of the box.
|
||||
|
||||
> **Speed:** Basic Pitch is light on resources, and is able to run faster than real time on most modern computers ([Bittner et al. 2022][3]).
|
||||
|
||||
Basic Pitch uses a machine learning model that turns various instrumental performances into MIDI. The audio file may also contain your voice, but it should still be able to convert the instrument to its MIDI version.
|
||||
|
||||
![Basic Pitch demo: Convert audio into MIDI using ML][4]
|
||||
|
||||
I tried converting an MP3 karaoke file with a single instrument to get the MIDI notes, and it seemed to work pretty well.
|
||||
|
||||
The tool also lets you process more than one audio file at a time and offers a few parameter controls that include note segmentation, confidence threshold, minimum/maximum pitch, and note length.
|
||||
|
||||
### Made for Creators and Researchers
|
||||
|
||||
Spotify mentions that it targets the creators primarily, but they are also interested to learn how machine learning researchers build upon it and help develop better solutions using the [open-source project on GitHub][5].
|
||||
|
||||
As a creator/musician, you can access the open-source tool on its [official website][6] for a demo. The parameters can be adjusted using the website, and you can also download the MIDI file from there.
|
||||
|
||||
[Basic Pitch][7]
|
||||
|
||||
![spotify basic pitch][8]
|
||||
|
||||
It is also available via [PyPI][9] to install and use via the command-line interface on Linux, Windows, and macOS.
|
||||
|
||||
You can explore its [GitHub page][10] to know more about its usage/commands.
|
||||
|
||||
If you are curious, the [official announcement post][11] provides more technical comparisons and explanations regarding the development of the tool.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/spotify-basic-pitch/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/spotify-midi.jpg
|
||||
[2]: https://news.itsfoss.com/wp-content/uploads/2022/06/spotify-basic-pitch-1024x531.png
|
||||
[3]: https://ieeexplore.ieee.org/document/9746549
|
||||
[4]: https://youtu.be/DhlvfgS73ZQ?list=PLf1KFlSkDLIAYLdb-SD9s8TdGy0rWIwVr
|
||||
[5]: https://github.com/spotify/basic-pitch
|
||||
[6]: https://basicpitch.spotify.com/
|
||||
[7]: https://basicpitch.spotify.com/
|
||||
[8]: https://news.itsfoss.com/wp-content/uploads/2022/06/basic-pitch-parameters.jpg
|
||||
[9]: https://pypi.org/
|
||||
[10]: https://github.com/spotify/basic-pitch
|
||||
[11]: https://engineering.atspotify.com/2022/06/meet-basic-pitch/
|
@ -1,69 +0,0 @@
|
||||
[#]: subject: "Cloud Storage Service Internxt Has a Photos Feature as a Google Photos Alternative"
|
||||
[#]: via: "https://news.itsfoss.com/internxt-photos/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Cloud Storage Service Internxt Has a Photos Feature as a Google Photos Alternative
|
||||
======
|
||||
Internxt is already an interesting cloud storage service. It also has a Photos feature that can be a replacement to Google Photos for some.
|
||||
|
||||
![internxt photos][1]
|
||||
|
||||
Internxt is an open-source encrypted cloud service with a native Linux client. Our [older article][2] explaining its cloud storage service can be an interesting read if you did not know about it.
|
||||
|
||||
Initially, we focused on their cloud storage offering. And, it seems like we missed out on another product “Photos” that was unveiled by them last month in a tweet.
|
||||
|
||||
[Internxt Photos][3] pitches itself as an open-source Google Photo alternative with privacy and security in mind.
|
||||
|
||||
*The post includes an affiliate link for Internxt. If you get a subscription through our link, we get a commission, and you get to support us at no extra cost to you.*
|
||||
|
||||
### Internxt Photos with Zero-Knowledge Encryption
|
||||
|
||||
![][4]
|
||||
|
||||
Internxt Photos claims that it puts privacy and security at its core compared to some competitors in the industry.
|
||||
|
||||
While respecting user privacy, they also try to offer the basic features that help you easily organize the photos you upload to the service.
|
||||
|
||||
Note that the Photos service is included with the cloud storage subscription. Unlike Google’s offering, there are no separate pricing plans for just storing the Photos.
|
||||
|
||||
Likewise, you need to rely on the same Internxt app to access your Photo gallery.
|
||||
|
||||
You should not have anything to worry about considering the Internxt app is available on the Google Play Store, and the App Store as well.
|
||||
|
||||
The photos you upload to the gallery get synced across multiple devices. So, even if you do not have access to one of your devices, it should not be a problem.
|
||||
|
||||
![][5]
|
||||
|
||||
The look of the photo gallery seems inspired by Apple’s Photos app, but that’s a good approach for simplicity and usability. The Photos also provide you the ability to share photos with your friends and family using a link. You can also customize the link to tweak the open limit to control access to your shared links.
|
||||
|
||||
Considering it as an open-source encrypted alternative with a primary cloud storage offering to mainstream Photo storage services, does this sound like something interesting to you?
|
||||
|
||||
You can get started using our link to the product page to explore more about it and get started. The [GitHub page][6] can also be useful if you’re curious.
|
||||
|
||||
[Internxt Photos][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/internxt-photos/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/internxt-photos.jpg
|
||||
[2]: https://itsfoss.com/internxt-cloud-service/
|
||||
[3]: https://itsfoss.com/go/internxt-photos/
|
||||
[4]: https://news.itsfoss.com/wp-content/uploads/2022/06/internxt-gallery.jpg
|
||||
[5]: https://news.itsfoss.com/wp-content/uploads/2022/06/mobile-photos-share-mockup-506x1024.webp
|
||||
[6]: https://github.com/internxt
|
||||
[7]: https://itsfoss.com/go/internxt-photos/
|
@ -1,101 +0,0 @@
|
||||
[#]: subject: "Linux Kernel 5.19 RC1 Released, Concluding ARM Generic Kernel Work"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/linux-kernel-5-19-rc1/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Linux Kernel 5.19 RC1 Released, Concluding ARM Generic Kernel Work
|
||||
======
|
||||
Linus Torvalds releases Linux Kernel 5.19 RC1 for testing, bringing a vast amount of changes.
|
||||
|
||||
Following the [Linux Kernel 5.18][1] release last month, Linus Torvalds announced the first release candidate availability of Linux Kernel 5.19. With this announcement, the official merge window of Linux Kernel 5.19 closes, meaning no new features are to be accepted unless it’s critical.
|
||||
|
||||
A brief look at the new items in Linux Kernel 5.19 shows regular updates across CPU, GPU, networking, storage and core modules. In addition, the code cleanups, removal of obsolete hardware and continuous support for future chipsets are the highlight of this release.
|
||||
|
||||
Without further introduction, let’s take a look at the new features.
|
||||
|
||||
### Linux Kernel 5.19 – New Features (RC1)
|
||||
|
||||
#### Processor
|
||||
|
||||
First and foremost, Linux Kernel 5.19 begins [initial support][2]for the LoongArch CPU family. It is developed by the Chinese company [Loongson][3]. LoongArch CPUs are the general general-purpose, MIPS architecture-compatible microprocessors. Although the support is now available, you can not boot Linux in these CPUs because some code is still under review. And hopefully, they will be already in the 5.20 version.
|
||||
|
||||
The new [Intel IFS driver lands][4] in this version which helps to detect hardware issues before deployment and after. It will help detect CPU faults at the circuit level at an early stage.
|
||||
|
||||
The power management and thermal work have continued for the last couple of Kernel releases for Intel CPUs. And [this release][5] also is no exception. Firstly, the Intel Run-Time Average Power Limiting (RAPL) support was added for Raptor and Alder Lake family. Second, the P-state driver is improved to handle frequency variance and CPU based scaling support is added to the passive devfreq.
|
||||
|
||||
While the thermal and power dominated Intel CPUs, AMD sees more performance updates in its own CPU families. Firstly, more updates were [introduced][6] in the Instruction-Based Sampling (IBS) module for AMD Zen 4 CPUs are planned for the end of this year. Moreover, PerfMonV2 is introduced in this release giving more performance monitoring capabilities.
|
||||
|
||||
Furthermore, the a.out support is removed in this release. Also, the Renesas H8/300 CPU architecture support is removed as its obsolete by now.
|
||||
|
||||
#### Major ARM update
|
||||
|
||||
Finally, the mainline Linux Kernel can [support multiple ARM platforms][7] with this release. This is a big step in this version, which is heard in Linus’s opening note on this Rc1 release. This is a long process that started with Linux 3.7 and spanned more than a decade of work and patches.
|
||||
|
||||
![Linux Kernel 5.19 Rc1 release announcement mentions ARM changes][8]
|
||||
|
||||
#### Graphics and Storage Updates
|
||||
|
||||
The storage subsystem sees performance improvements across popular file systems. The significant changes include Apple M1 NVMe controller support and better support for the XFS file system. In addition, enhancements arrive for Btrfs, F2FS and exFAT file systems.
|
||||
|
||||
One of the exciting metrics in terms of LOC is Linux Kernel 5.19 adds around [half-million lines of code][9] for the Graphics driver alone. It includes graphics updates across AMD RDNA, CDNA, Intel’s Raptor Lake, Intel’s DG2/Alchemist and more.
|
||||
|
||||
#### Important Networking Changes
|
||||
|
||||
Looking at the massive growth in the data transmission, the support for Big TCP lands which helps the data centre traffic at a range of 400GBit. It also aims to give lower latency in high-performance networking environments.
|
||||
|
||||
The Multi-Path TCP (MPTCP) continues its improvements. In addition to that, Qualcomm ath11k WiFi driver adds wake-on-lan support in this version. Also, support is added for Realtek 8852ce chipset, MediaTek T700 modems and Rensas RZ/V2M
|
||||
|
||||
#### Other Notable Features
|
||||
|
||||
Firstly, the famous random number generator in Kernel [continues][10] its improvements in this release.
|
||||
|
||||
Second, the famous and emerging Framework Modular Laptop gets this release Chrome OS EC Driver support. The Framework laptop now can take advantage of ChromeOS’s embedded controller as a non-Chromebook device.
|
||||
|
||||
Moreover, more updates arrive at Wacom tabs and other related devices. It [includes][11] improved support for Lenovo Thinkpad TrackPoint II, Google Whiskers Touchpad, Lenovo X12 TrackPoint, etc.
|
||||
|
||||
### Linux Kernel 5.19 Download
|
||||
|
||||
If you want to test and try this release candidate, download the release tarball [here][12]. Or refer below for a direct link to tar and diffs.
|
||||
|
||||
| - | - | - | - | - | - | - | - | - |
|
||||
| :- | :- | :- | :- | :- | :- | :- | :- | :- |
|
||||
| mainline: | 5.19-rc1 | 2022-06-06 | [tarball][13] | | [patch][14] | | [view diff][15] | [browse][16] |
|
||||
|
||||
There will be multiple kernel iterations until the final release, expected around July 2022.
|
||||
|
||||
*[Via Kernel mailing list.][17]*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/linux-kernel-5-19-rc1/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/2022/05/linux-kernel-5-18/
|
||||
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6f2f3e2c80e975804360665d973211e4d9390cb
|
||||
[3]: http://www.loongson.cn/
|
||||
[4]: https://lore.kernel.org/lkml/13e61c61-0d4b-5f48-6373-f056bf8b603f@redhat.com/
|
||||
[5]: https://lore.kernel.org/linux-acpi/CAJZ5v0hKBt3js65w18iKxzWoN5QuEc84_2xcM6paSv-ZHwe3Rw@mail.gmail.com/
|
||||
[6]: https://lore.kernel.org/lkml/You6yGPUttvBcg8s@gmail.com/
|
||||
[7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ecf0aa5317b0ad6bb015128a5b763c954fd58708
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/06/Linux-Kernel-5.19-Rc1-release-announcement-mentions-ARM-changes.jpg
|
||||
[9]: https://lore.kernel.org/lkml/CAPM=9tw62EZfAm0PbiOPmMrpfR98QMFTWGEQcA34G4ap4xxNkA@mail.gmail.com/
|
||||
[10]: https://lore.kernel.org/lkml/20220522214457.37108-1-Jason@zx2c4.com/T/#u
|
||||
[11]: https://lore.kernel.org/lkml/nycvar.YFH.7.76.2205241107530.28985@cbobk.fhfr.pm/
|
||||
[12]: https://www.kernel.org/
|
||||
[13]: https://git.kernel.org/torvalds/t/linux-5.19-rc1.tar.gz
|
||||
[14]: https://git.kernel.org/torvalds/p/v5.19-rc1/v5.18
|
||||
[15]: https://git.kernel.org/torvalds/ds/v5.19-rc1/v5.18
|
||||
[16]: https://git.kernel.org/torvalds/h/v5.19-rc1
|
||||
[17]: https://lore.kernel.org/lkml/CAHk-=wgZt-YDSKfdyES2p6A_KJoG8DwQ0mb9CeS8jZYp+0Y2Rw@mail.gmail.com/T/#u
|
@ -1,47 +0,0 @@
|
||||
[#]: subject: "OpenInfra Foundation Launches ‘directed funding’ To Support Open Source Projects"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/openinfra-foundation-launches-directed-funding-to-support-open-source-projects/"
|
||||
[#]: author: "Laveesh Kocher https://www.opensourceforu.com/author/laveesh-kocher/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
OpenInfra Foundation Launches ‘directed funding’ To Support Open Source Projects
|
||||
======
|
||||
![open-infra-berlin-event][1]
|
||||
|
||||
The OpenInfra Foundation, formerly known as the OpenStack Foundation until it expanded its scope beyond its flagship project a few years ago, announced today an intriguing new way for companies to fund open source projects within the foundation. Corporate members of open source foundations have traditionally supported the organisation by paying a membership fee, which the foundations then distribute as they see fit. The OpenInfra foundation is now launching a new ‘Directed Funding’ model that allows members to direct their funds directly to a project.
|
||||
|
||||
The foundation previously did not allow this because, as Bryce pointed out, it can create mixed incentives and a pay-for-play dynamic, which the organisation has always tried to avoid. However, there was a lot of interest in the community to support specific projects, which makes sense given that the foundation is now home to a wider variety of projects, but not every member is heavily invested in every project.
|
||||
|
||||
Bryce stated that the foundation’s leadership and board spent a significant amount of time considering how to reconcile the foundation’s core principles with this new model. As a result, the model tries to combine the best of the OpenStack/OpenInfra technical governance model, which has worked well over the last decade, with these new financial considerations.
|
||||
|
||||
Under this ‘directed funding’ model, each new project will have its own legal entity that will hold the project funding. To ensure that the new projects are legitimate, an OpenInfra Platinum member (currently nine, including Ant Group, Huawei, Meta, Microsoft, and Red Hat) must serve as the project’s sponsor, after which other organisations can join the project fund. If a sponsoring company is not already an OpenInfra member, it must become one. All of these funding members then form a project fund governing board, which decides on the fees for creating a budget. Meanwhile, the OpenInfra Foundation will provide these projects with community-building services.
|
||||
|
||||
This new model will, for the time being, only apply to new projects that join the foundation. Bryce and Collier noted that there may be some existing projects where the organisation could retroactively apply this new model, but that is not currently on the roadmap.
|
||||
|
||||
The OpenInfra foundation has added projects such as Kata Containers for increased container security, Airship for infrastructure lifecycle management, the Startling X edge compute stack, and the Zuul CI/CD platform since it expanded beyond OpenStack.
|
||||
|
||||
“The most important thing we’ve learned from each of these successful projects is that collaboration is key and the more breadth in the ecosystem of support the better,” said Thierry Carrez, general manager of the OpenInfra Foundation. “In fact, we’ve found that the most successful open source projects are funded by multiple companies, because they are able to combine their resources to achieve a much stronger rate of return.”
|
||||
|
||||
This new model is clearly a way for the OpenInfra Foundation to bring new projects — and new members — into the fold. Its models for managing open source projects in a multi-party ecosystem — both through the new directed funds and its more traditional approach — may not be suitable for every project, as the leadership team readily admits. Even if the OpenInfra Foundation only receives a small percentage of projects, the number of open-source projects is increasing as the demand for these sophisticated cloud infrastructure projects grows, all while they become more complex.
|
||||
|
||||
The Foundation also announced a couple of milestone releases for its various projects, including version 2.0 of Kata Containers, version 5.0 of Zuul, and the release of StarlingX 6.0.
|
||||
|
||||
“The Foundation celebrates its 10 anniversary this year, and as we look to our next decade of open infrastructure, we’re building momentum on what makes our model so successful: aligning companies and individuals who wish to work together, providing them with a framework and tools to effectively collaborate, and helping them invest their funds to best help the project they care about,” said Collier.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/openinfra-foundation-launches-directed-funding-to-support-open-source-projects/
|
||||
|
||||
作者:[Laveesh Kocher][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/laveesh-kocher/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/06/open-infra-berlin-event.png
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://opensource.com/article/22/5/linux-advice-beginners"
|
||||
[#]: author: "Opensource.com https://opensource.com/users/admin"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "lightchaserhy"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://www.linux.com/news/why-do-enterprises-use-and-contribute-to-open-source-software/"
|
||||
[#]: author: "Dan Whiting https://www.linuxfoundation.org/blog/why-do-enterprises-use-and-contribute-to-open-source-software/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "aREversez"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
@ -97,7 +97,7 @@ via: https://www.linux.com/news/why-do-enterprises-use-and-contribute-to-open-so
|
||||
|
||||
作者:[Dan Whiting][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[aREversez](https://github.com/aREversez)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
120
sources/talk/20220609 SSL Certificates- Make the Right Choice.md
Normal file
120
sources/talk/20220609 SSL Certificates- Make the Right Choice.md
Normal file
@ -0,0 +1,120 @@
|
||||
[#]: subject: "SSL Certificates: Make the Right Choice"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/ssl-certificates-make-the-right-choice/"
|
||||
[#]: author: "Jitendra Bhojwani https://www.opensourceforu.com/author/jitendra-bhojwani/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
SSL Certificates: Make the Right Choice
|
||||
======
|
||||
Increasingly sophisticated techniques are being used to hack into data today. So it has become extremely important to use even better ways to protect your customers’ data. SSL certification is one such way. This article looks at the different types of SSL certificates and how to choose one that suits your organisation.
|
||||
|
||||
![SSL-certificate][1]
|
||||
|
||||
*Increasingly sophisticated techniques are being used to hack into data today. So it has become extremely important to use even better ways to protect your customers’ data. SSL certification is one such way. This article looks at the different types of SSL certificates and how to choose one that suits your organisation.*
|
||||
|
||||
SSL certificates are an apt solution for securing data in transit. They create an automated mechanism to encrypt the transfer of data between the server and browser (or site and visitor). This encryption can only be decrypted by the intended system. So it discourages hackers from stealing data, and offers complete security against transit attacks on it.
|
||||
|
||||
Along with securing communication, SSL certificates also build trust with customers and help you emerge as a credible business by displaying virtual trust icons like a padlock, HTTPS prefix, and a green address bar. So let’s learn about the major types of SSL certificates and how to choose the one that works best for you.
|
||||
|
||||
### SSL certificate options: Similarities and differences
|
||||
|
||||
Let’s first discuss the basic similarity all SSL certificates share. Regardless of their type, price and scope, every SSL certificate encrypts the to-and-fro communication between the site’s server and the Internet browser of your visitor.
|
||||
|
||||
The difference lies in the terms and conditions of the validation process and the number of domains/subdomains it covers, etc. Proceeding to purchase an SSL certificate without first reviewing your present and future needs may result in costly mistakes, and you may end up paying a hefty amount for advanced features that are irrelevant to your business. Or you may get tempted to buy a cheap certificate that isn’t a perfect fit for your business needs.
|
||||
Due to the crucial role it plays, an SSL certificate is issued by an official certificate authority after a thorough verification procedure to confirm the legitimacy of ownership. So, this certificate not only encrypts the communication between websites and audiences, but also ensures the legal position of a site. It plays a vital role in building trust.
|
||||
|
||||
As you have now understood why we need a SSL certificate, we can discuss the different types of popular SSL certificates, along with their benefits and issuance procedures.
|
||||
|
||||
### Domain validation (DV) SSL certificate
|
||||
|
||||
The most basic of the three types of SSL certificates, the DV or domain validation certificate confirms the ownership of a domain through an automated online process. All you have to do is to complete a few basic steps to prove that you are the legitimate owner of the domain to get this certificate. Though easiest to get, this type of certificate helps in building only a basic level of trust.
|
||||
|
||||
After completing the DV certification procedure, you are allocated trust-building visual elements — a static seal, a padlock icon, and an HTTPS prefix in your URL.
|
||||
|
||||
Cheapest prices and quick, automated processes are the two major benefits of a DV certificate. On the flip side, you get only the basic trust signs that aren’t enough to satisfy the security concerns of more demanding customers or visitors.
|
||||
|
||||
*Important to know:* DV misses the most important trust sign — vetting the real, legal business that owns the domain name. For instance, suppose Mr X buys a domain ‘abc.com’ to lure gullible people into investing money in a business that seems genuine. Being a legitimate domain owner, he can get a DV through an automated process. With HTTPS URLs and other trust signs, it is easy to gain people’s trust too. However, the company (or fraud mechanism) behind this domain isn’t vetted/verified, which makes it easier for Mr X to continue duping investors of their hard-earned money.
|
||||
|
||||
Is DV SSL the right choice for you?: DV is best for a small and general website, which doesn’t demand or require any sensitive information that can be misused like credit card numbers, social security information, or details of a financial portfolio. For websites that post children’s stories, general e-magazines, personal blogs, professional portfolios, and other static websites on general topics, a DV certificate is a perfect and cheap solution. Securing more mission-critical sites that collect sensitive data like credit card numbers and social security details is a different story though.
|
||||
|
||||
### Organisation validation (OV) SSL certificate
|
||||
|
||||
As the name suggests, the OV certificate not only validates the domain ownership but also vets the real identity of the organisation to which the domain officially belongs. It builds an extra layer of trust for visitors who have stronger concerns, by displaying the key information about the business. Interested visitors just need to check the details of the certificate to ascertain the credibility of the company.
|
||||
|
||||
As compared to a DV certificate, an OV certification requires a more detailed process carried out by an authorised certificate authority that demands and vets key documents representing the legal status of the company. Hence, along with domain ownership, this certificate also assures that it is owned by a legitimate organisation.
|
||||
|
||||
Though the issuance process is more expensive and demanding, this type of certificate does empower you to position your company as a legal, real company doing legitimate business. It makes you stand out and even more concerned visitors are able to trust your organisation.
|
||||
|
||||
Is OV the right choice for you?: Sites that ask for sensitive data that can be misused by threat actors should obtain this certificate. E-commerce sites with online payment gateways, digital health practitioners, government websites that demand citizens’ information, defence-related websites, online trading platforms, or professional networking sites are all the right candidates for obtaining an OV certificate.
|
||||
|
||||
### Extended validation (EV) SSL certificate
|
||||
|
||||
In the digital domain, visuals matter a lot. A company seal, security icons, or even assuring colours (like green) can go a long way in leaving a lasting impression, winning you a big deal or helping you forge business relations with dynamic brands.
|
||||
|
||||
The vetting procedure for issuing an EV SSL certificate is quite stringent and involves a manual process as well. It starts by verifying the ownership of the domain. After that, the certification authority asks for your identification number. Next, it gets your legal working contact number from relevant authentic sources. That contact number is manually verified by calling your office and talking with the real person. Only after satisfying all such verification parameters can you get the EV certificate.
|
||||
|
||||
Unlike an OV certificate, you don’t just get a static site seal with a basic look, but get dynamic seals as well. Additionally, the full legal company name is displayed in the address bar along with a green-coloured padlock. Added to this, the entire address bar turns green as soon as your site loads. All these visible signs vouch for the legality of your firm, build a ‘visual comfort zone’ and reaffirm the credibility of your organisation.
|
||||
|
||||
Such certificates satisfy the sophisticated digital security vetting parameters of global brands and corporate conglomerates. If highly expensive items like gold and diamond jewellery are being sold on a website, then such superior trust factors satisfy the higher trust demands of buyers. Though this certificate is the most expensive among all the SSL certificates, it is worth investing in the extra dollars as it has the potential to significantly boost your sales revenue.
|
||||
|
||||
### Scope of different SSL certificates
|
||||
|
||||
Apart from the type of certificate, the other crucial question is: how many digital properties you want your certificate to cover? If you own a single domain property and do not want to expand in the foreseeable future, then a single DV would do for you. But what if you own, say, 20 different domains — most of which deal with e-commerce or collect sensitive client information? It wouldn’t be practical to buy the more expensive EV certificate for each of these domains. Here is some guidance on that.
|
||||
|
||||
### Wildcard SSL certificate
|
||||
|
||||
With a single wildcard SSL certificate you can protect the main domain and practically unlimited sub-domains related to it. For instance, yoursite.com (the main domain) may have three subdomains:
|
||||
|
||||
* mail.yoursite.com
|
||||
* login.yoursite.com
|
||||
* ftp.yoursite.com
|
||||
|
||||
This certificate relieves you from the stress and expenses of purchasing a separate certificate for every domain after going through the complete validation process, followed by an installation process for each. It also saves you a lot of time on repetitive processes and almost eliminates potential errors.
|
||||
|
||||
| - |
|
||||
| :- |
|
||||
| Note: Both DV and OV offer wildcard certificate options. |
|
||||
|
||||
### Multi-domain (or SAN SSL) certificate
|
||||
|
||||
One level above the wildcard SSL certificate is the multi-domain certificate, which helps to secure primary domains and their related subdomains. It does everything that a wildcard certificate can do, and more. If you own multiple domains and want a uniform and standard SSL security for all, then a multi-domain certificate is the right choice for you.
|
||||
|
||||
### Is SSL certification only about visual trust signs?
|
||||
|
||||
Obviously, when you spend significant money on an SSL certificate you would like to get more than security icons or trust signals. Well, your certification authority does offer a specific amount of warranty or a payback if your customers become victims of a fraud. The amount of this warranty depends upon the type of certificate and how much it costs.
|
||||
|
||||
### How to choose the ideal certificate authority (CA) for SSL
|
||||
|
||||
The next question is: who can judge the judge? It is you. Carefully consider some of the prime factors while finding the right SSL certificate provider/CA for your site. Before buying any certificate, thoroughly vet the reputation, credentials and experience of the certificate authority.
|
||||
|
||||
Also, ask questions. Do they have a credible history? What type of customers do they have in their repertoire? Do they have an impressive portfolio of regular customers? Most importantly, is the company passively following old industry standards, or is it actively investing in research and development on how to prevent the latest cyber frauds? All such questions will help you to make informed decisions and get the best value for your money.
|
||||
|
||||
Also make another very important check: Has any major browser banned the CA? The very objective of the SSL certificate is defeated if the CA has been banned by a major browser.
|
||||
|
||||
### How long does it take for an SSL certificate to be issued?
|
||||
|
||||
The time taken to issue a certificate varies and depends upon the validation procedure and its requirements. A DV certificate, for instance, is issued within minutes as it has the least verification requirements. An OV SSL, with more detailed vetting requirements, can take up to three days for issuance. Since it has the most demanding vetting process, the EV certificate can take up to four days for issuance.
|
||||
|
||||
The validation period of the certificate, along with its credibility and scope, plays an important role in influencing its price. It is always best to use your discretion, and find a fine balance between the price and value of the certificate.
|
||||
|
||||
A few reputed SSL certificates go the extra mile and also offer extra security measures to customers. You can never be secure enough on a digital platform. So it is always best to see if such additional security elements will be helpful. However, your prime focus should be the credibility and portfolio of the company. It isn’t wise to compromise with that just to get some extra security elements.
|
||||
|
||||
SSL certificates encrypt the data and information that customers share with organisations. They help to save customers from data theft and misuse by threat actors. But it’s always advisable to check the credibility and reviews of a certificate authority carefully before buying a SSL certificate from it.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/ssl-certificates-make-the-right-choice/
|
||||
|
||||
作者:[Jitendra Bhojwani][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/jitendra-bhojwani/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/SSL-certificate.jpg
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/3/raspberry-pi-countdown-clock)
|
||||
[#]: author: (Chris Collins https://opensource.com/users/clcollins)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: ( Donkey-Hao )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,83 +1,79 @@
|
||||
[#]: subject: (Learn the Lisp programming language in 2021)
|
||||
[#]: via: (https://opensource.com/article/21/5/learn-lisp)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: "Learn the Lisp programming language in 2021"
|
||||
[#]: via: "https://opensource.com/article/21/5/learn-lisp"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn the Lisp programming language in 2021
|
||||
Let's learn the Lisp programming language
|
||||
======
|
||||
A lot of Lisp code lurks inside big codebases, so it's smart to get
|
||||
familiar with the language.
|
||||
![Woman sitting in front of her laptop][1]
|
||||
A lot of Lisp code lurks inside big codebases, so it's smart to get familiar with the language.
|
||||
|
||||
![Women in tech and computing][1]
|
||||
|
||||
Image by: kris krüg
|
||||
|
||||
Lisp was invented in 1958, which makes it the second-oldest computer programming language. It has spawned several modern derivatives, including Common Lisp, Emacs Lisp (Elisp), Clojure, Racket, Scheme, Fennel, and GNU Guile.
|
||||
|
||||
People who love thinking about the design of programming languages often love Lisp because of how its syntax and data share the same structure: Lisp code is essentially a list of lists, and its name is an acronym for _LISt Processing_. People who love thinking about the aesthetics of programming languages often hate Lisp because of its frequent use of parentheses for scoping; in fact, it's a common joke that Lisp stands for _Lots of Irritating Superfluous Parentheses_.
|
||||
People who love thinking about the design of programming languages often love Lisp because of how its syntax and data share the same structure: Lisp code is essentially a list of lists, and its name is an acronym for *LISt Processing*. People who love thinking about the aesthetics of programming languages often hate Lisp because of its frequent use of parentheses for scoping; in fact, it's a common joke that Lisp stands for *Lots of Irritating Superfluous Parentheses*.
|
||||
|
||||
Whether you love or hate its design philosophies, Lisp is an interesting glimpse at the past and, thanks to Clojure and Guile, into the future. You might be surprised how much Lisp code there is lurking within big codebases in any given industry, so it's a good idea to have at least a passing familiarity with the language.
|
||||
|
||||
### Install Lisp
|
||||
|
||||
There are many implementations of Lisp. Popular open source versions include [SBCL][2] and [GNU Common Lisp][3] (GCL). You can install either of these with your distribution's package manager.
|
||||
There are many implementations of Lisp. Popular open source versions include [SBCL][2], [GNU Lisp][3], and [GNU Common Lisp][4] (GCL). You can install any of these with your distribution's package manager, but for this article I use `clisp`.
|
||||
|
||||
On Fedora Linux:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install gcl`
|
||||
$ sudo dnf install clisp
|
||||
```
|
||||
|
||||
On Debian:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install gcl`
|
||||
$ sudo apt install clisp
|
||||
```
|
||||
|
||||
For macOS, you can use [MacPorts][4] or [Homebrew][5]:
|
||||
|
||||
For macOS, you can use [MacPorts][5] or [Homebrew][6]:
|
||||
|
||||
```
|
||||
`$ sudo port install gcl`
|
||||
$ sudo port install clisp
|
||||
```
|
||||
|
||||
For Windows, download a binary from [gnu.org/software/gcl][6].
|
||||
For Windows, you can either use [clisp on Cygwin][7] or download a GCL binary from [gnu.org/software/gcl][8].
|
||||
|
||||
For this article, I'm using GCL and its `clisp` command, but most of the principles apply to any Lisp.
|
||||
Even though I'm using the `clisp` command, most of the principles in this article apply to any Lisp. Should you choose to use a different Lisp implementation, the command to run Lisp code is different from what I use in this article (`gcl` or `sbcl` instead of `clisp`, for example) but everything else is the same.
|
||||
|
||||
### List processing
|
||||
|
||||
The basic unit of Lisp source code is an _expression_, which is written as a list. For instance, this is a list of an operator (`+`) and two integers (`1` and `2`):
|
||||
|
||||
The basic unit of Lisp source code is an *expression*, which is written as a list. For instance, this is a list of an operator (`+` ) and two integers (`1` and `2` ):
|
||||
|
||||
```
|
||||
`(+ 1 2)`
|
||||
(+ 1 2)
|
||||
```
|
||||
|
||||
It's also a Lisp expression, using a symbol (`+` ) that evaluates to a function (addition) and two arguments (`1` and `2` ). You can run this expression and others in an interactive Common Lisp environment called REPL (read-eval-print loop). If you're familiar with Python's IDLE, Lisp's REPL should feel somewhat familiar to you.
|
||||
|
||||
To launch a REPL, launch Common Lisp:
|
||||
|
||||
|
||||
```
|
||||
$ clisp
|
||||
[1]>
|
||||
[1]>
|
||||
```
|
||||
|
||||
At the REPL prompt, type a few expressions:
|
||||
|
||||
|
||||
```
|
||||
[1]> (+ 1 2)
|
||||
[1]> (+ 1 2)
|
||||
3
|
||||
[2]> (- 1 2)
|
||||
[2]> (- 1 2)
|
||||
-1
|
||||
[3]> (- 2 1)
|
||||
[3]> (- 2 1)
|
||||
1
|
||||
[4]> (+ 2 3 4)
|
||||
[4]> (+ 2 3 4)
|
||||
9
|
||||
```
|
||||
|
||||
@ -85,109 +81,100 @@ At the REPL prompt, type a few expressions:
|
||||
|
||||
Now that you know the basic structure of a Lisp expression, you can utilize Lisp functions in useful ways. The `print` function takes any argument you provide and displays it on your terminal, while the `pprint` function "pretty" prints it. There are other variations on the print function, but `pprint` is nice in REPL:
|
||||
|
||||
|
||||
```
|
||||
[1]> (pprint "hello world")
|
||||
[1]> (pprint "hello world")
|
||||
|
||||
"hello world"
|
||||
|
||||
[2]>
|
||||
[2]>
|
||||
```
|
||||
|
||||
You can create your own functions with `defun`. The `defun` function requires a name for your function and any parameters you want your function to accept:
|
||||
|
||||
|
||||
```
|
||||
[1]> (defun myprinter (s) (pprint s))
|
||||
[1]> (defun myprinter (s) (pprint s))
|
||||
MYPRINTER
|
||||
[2]> (myprinter "hello world")
|
||||
[2]> (myprinter "hello world")
|
||||
|
||||
"hello world"
|
||||
|
||||
[3]>
|
||||
[3]>
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
You can create variables in Lisp with `setf` :
|
||||
|
||||
|
||||
```
|
||||
[1]> (setf foo "hello world")
|
||||
[1]> (setf foo "hello world")
|
||||
"hello world"
|
||||
[2]> (pprint foo)
|
||||
[2]> (pprint foo)
|
||||
|
||||
"hello world"
|
||||
|
||||
[3]>
|
||||
[3]>
|
||||
```
|
||||
|
||||
You can nest expressions within expressions in a kind of pipeline. For instance, you can pretty print the contents of your variable after invoking the `string-upcase` function to convert its characters to uppercase:
|
||||
|
||||
|
||||
```
|
||||
[3]> (pprint (string-upcase foo))
|
||||
[3]> (pprint (string-upcase foo))
|
||||
|
||||
"HELLO WORLD"
|
||||
|
||||
[4]>
|
||||
[4]>
|
||||
```
|
||||
|
||||
Lisp is dynamically typed in the sense that you don't have to declare variable types when setting them. Lisp treats integers as integers by default:
|
||||
|
||||
|
||||
```
|
||||
[1]> (setf foo 2)
|
||||
[2]> (setf bar 3)
|
||||
[3]> (+ foo bar)
|
||||
[1]> (setf foo 2)
|
||||
[2]> (setf bar 3)
|
||||
[3]> (+ foo bar)
|
||||
5
|
||||
```
|
||||
|
||||
If you intend for an integer to be interpreted as a string, you can quote it:
|
||||
|
||||
|
||||
```
|
||||
[4]> (setf foo "2")
|
||||
"2"
|
||||
[5]> (setf bar "3")
|
||||
[4]> (setf foo "2")
|
||||
"2"
|
||||
[5]> (setf bar "3")
|
||||
"3"
|
||||
[6]> (+ foo bar)
|
||||
[6]> (+ foo bar)
|
||||
|
||||
*** - +: "2" is not a number
|
||||
The following restarts are available:
|
||||
USE-VALUE :R1 Input a value to be used instead.
|
||||
ABORT :R2 Abort main loop
|
||||
Break 1 [7]>
|
||||
Break 1 [7]>
|
||||
```
|
||||
|
||||
In this sample REPL session, both `foo` and `bar` are set to quoted numbers, so Lisp interprets them as strings. Math operators can't be used on strings, so REPL drops into a debugger mode. To get out of the debugger, press **Ctrl+D** on your keyboard.
|
||||
|
||||
You can do some introspection on objects using the `typep` function, which tests for a specific data type. The tokens `T` and `NIL` represent _True_ and _False_, respectively.
|
||||
|
||||
You can do some introspection on objects using the `typep` function, which tests for a specific data type. The tokens `T` and `NIL` represent *True* and *False*, respectively.
|
||||
|
||||
```
|
||||
[4]> (typep foo 'string)
|
||||
[4]> (typep foo 'string)
|
||||
NIL
|
||||
[5]> (typep foo 'integer)
|
||||
[5]> (typep foo 'integer)
|
||||
T
|
||||
```
|
||||
|
||||
The single quote (`'` ) before `string` and `integer` prevents Lisp from (incorrectly) evaluating those keywords as variables:
|
||||
|
||||
|
||||
```
|
||||
[6]> (typep foo string)
|
||||
[6]> (typep foo string)
|
||||
*** - SYSTEM::READ-EVAL-PRINT: variable STRING has no value
|
||||
[...]
|
||||
```
|
||||
|
||||
It's a shorthand way to protect the terms, normally done with the `quote` function:
|
||||
|
||||
|
||||
```
|
||||
[7]> (typep foo (quote string))
|
||||
[7]> (typep foo (quote string))
|
||||
NIL
|
||||
[5]> (typep foo (quote integer))
|
||||
[5]> (typep foo (quote integer))
|
||||
T
|
||||
```
|
||||
|
||||
@ -195,19 +182,17 @@ T
|
||||
|
||||
Unsurprisingly, you can also create lists in Lisp:
|
||||
|
||||
|
||||
```
|
||||
[1]> (setf foo (list "hello" "world"))
|
||||
[1]> (setf foo (list "hello" "world"))
|
||||
("hello" "world")
|
||||
```
|
||||
|
||||
Lists can be indexed with the `nth` function:
|
||||
|
||||
|
||||
```
|
||||
[2]> (nth 0 foo)
|
||||
[2]> (nth 0 foo)
|
||||
"hello"
|
||||
[3]> (pprint (string-capitalize (nth 1 foo)))
|
||||
[3]> (pprint (string-capitalize (nth 1 foo)))
|
||||
|
||||
"World"
|
||||
```
|
||||
@ -216,19 +201,17 @@ Lists can be indexed with the `nth` function:
|
||||
|
||||
To end a REPL session, press **Ctrl+D** on your keyboard, or use the `quit` keyword in Lisp:
|
||||
|
||||
|
||||
```
|
||||
[99]> (quit)
|
||||
[99]> (quit)
|
||||
$
|
||||
```
|
||||
|
||||
### Scripting
|
||||
|
||||
Lisp can be compiled or used as an interpreted scripting language. The latter is probably the easiest option when you're starting, especially if you're already familiar with Python or [shell scripting][7].
|
||||
Lisp can be compiled or used as an interpreted scripting language. The latter is probably the easiest option when you're starting, especially if you're already familiar with Python or [shell scripting][9].
|
||||
|
||||
Here's a simple dice roller script written in GNU Common Lisp:
|
||||
|
||||
|
||||
```
|
||||
#!/usr/bin/clisp
|
||||
|
||||
@ -241,26 +224,24 @@ Here's a simple dice roller script written in GNU Common Lisp:
|
||||
(roller userput)
|
||||
```
|
||||
|
||||
The first line tells your [POSIX][8] terminal what executable to use to run the script.
|
||||
The first line tells your [POSIX][10] terminal what executable to use to run the script.
|
||||
|
||||
The `roller` function, created with `defun`, uses the `random` function to print a pseudo-random number up to, and not including, the zeroth item of the `num` list. The `num` list hasn't been created yet in the script, but the function doesn't get executed until it's called.
|
||||
|
||||
The next line assigns any argument provided to the script at launch time to a variable called `userput`. The `userput` variable is a list, and it's what becomes `num` once it's passed to the `roller` function.
|
||||
|
||||
The penultimate line of the script starts a _random seed_. This provides Lisp with enough entropy to generate a mostly random number.
|
||||
The penultimate line of the script starts a *random seed*. This provides Lisp with enough entropy to generate a mostly random number.
|
||||
|
||||
The final line invokes the custom `roller` function, providing the `userput` list as its sole argument.
|
||||
|
||||
Save the file as `dice.lisp` and mark it executable:
|
||||
|
||||
|
||||
```
|
||||
`$ chmod +x dice.lisp`
|
||||
$ chmod +x dice.lisp
|
||||
```
|
||||
|
||||
Finally, try running it, providing it with a maximum number from which to choose its random number:
|
||||
|
||||
|
||||
```
|
||||
$ ./dice.lisp 21
|
||||
|
||||
@ -275,9 +256,11 @@ $ ./dice.lisp 21
|
||||
|
||||
Not bad!
|
||||
|
||||
You may notice that your emulated die has a pontential value of 0, and never reaches the maximum number you provide to it as an argument. In other words, this script never rolls 20 on a 20-sided die (unless you count 0 as 20). There's a simple fix to this, and you only need the knowledge gained from this article to do it. Can you fix this bug?
|
||||
|
||||
### Learn Lisp
|
||||
|
||||
Whether you can imagine using Lisp as a utilitarian language for personal scripts, to advance your career, or just as a fun experiment, you can see some particularly inventive uses at the annual [Lisp Game Jam][9] (most submissions are open source, so you can view the code to learn from what you play).
|
||||
Whether you can imagine using Lisp as a utilitarian language for personal scripts, to advance your career, or just as a fun experiment, you can see some particularly inventive uses at the annual [Lisp Game Jam][11] (most submissions are open source, so you can view the code to learn from what you play).
|
||||
|
||||
Lisp is a fun and unique language with an ever-growing developer base and enough historic and emerging dialects to keep programmers from all disciplines happy.
|
||||
|
||||
@ -286,20 +269,22 @@ Lisp is a fun and unique language with an ever-growing developer base and enough
|
||||
via: https://opensource.com/article/21/5/learn-lisp
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
选题:[lkxed][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_women_computing_4.png?itok=VGZO8CxT (Woman sitting in front of her laptop)
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/OSDC_women_computing_4.png
|
||||
[2]: http://sbcl.org
|
||||
[3]: https://www.gnu.org/software/gcl/
|
||||
[4]: https://opensource.com/article/20/11/macports
|
||||
[5]: https://opensource.com/article/20/6/homebrew-linux
|
||||
[6]: http://mirror.lagoon.nc/gnu/gcl/binaries/stable
|
||||
[7]: https://opensource.com/article/20/4/bash-programming-guide
|
||||
[8]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
||||
[9]: https://itch.io/jam/spring-lisp-game-jam-2021
|
||||
[3]: http://clisp.org
|
||||
[4]: https://www.gnu.org/software/gcl/
|
||||
[5]: https://opensource.com/article/20/11/macports
|
||||
[6]: https://opensource.com/article/20/6/homebrew-linux
|
||||
[7]: https://cygwin.fandom.com/wiki/Clisp
|
||||
[8]: http://mirror.lagoon.nc/gnu/gcl/binaries/stable
|
||||
[9]: https://opensource.com/article/20/4/bash-programming-guide
|
||||
[10]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
||||
[11]: https://itch.io/jam/spring-lisp-game-jam-2021
|
||||
|
@ -1,204 +0,0 @@
|
||||
[#]: subject: (Write your first JavaScript code)
|
||||
[#]: via: (https://opensource.com/article/21/7/javascript-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Write your first JavaScript code
|
||||
======
|
||||
JavaScript was created for the web, but it can do so much more. Learn
|
||||
the basics, then download our cheat sheet so you always have the details
|
||||
at hand.
|
||||
![Code with javascript on white background][1]
|
||||
|
||||
JavaScript is a programming language full of pleasant surprises. Many people first encounter JavaScript as a language for the web. There's a JavaScript engine in all the major browsers, there are popular frameworks such as JQuery, Cash, and Bootstrap to help make web design easier, and there are even programming environments written in JavaScript. It seems to be everywhere on the internet, but it turns out that it's also a useful language for projects like [Electron][2], an open source toolkit for building cross-platform desktop apps with JavaScript.
|
||||
|
||||
JavaScript is a surprisingly multipurpose language with a wide assortment of libraries for much more than just making websites. Learning the basics of the language is easy, and it's a gateway to building whatever you imagine.
|
||||
|
||||
### Install JavaScript
|
||||
|
||||
As you progress with JavaScript, you may find yourself wanting advanced JavaScript libraries and runtimes. When you're just starting, though, you don't have to install JavaScript at all. All major web browsers include a JavaScript engine to run the code. You can write JavaScript using your favorite text editor, load it into your web browser, and see what your code does.
|
||||
|
||||
### Get started with JavaScript
|
||||
|
||||
To write your first JavaScript code, open your favorite text editor, such as [Notepad++][3], [Atom][4], or [VSCode][5]. Because it was developed for the web, JavaScript works well with HTML, so first, just try some basic HTML:
|
||||
|
||||
|
||||
```
|
||||
<[html][6]>
|
||||
<[head][7]>
|
||||
<[title][8]>JS</[title][8]>
|
||||
</[head][7]>
|
||||
<[body][9]>
|
||||
<[p][10] id="example">Nothing here.</[p][10]>
|
||||
</[body][9]>
|
||||
</[html][6]>
|
||||
```
|
||||
|
||||
Save the file, and then open it in a web browser.
|
||||
|
||||
![HTML displayed in browser][11]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][12])
|
||||
|
||||
To add JavaScript to this simple HTML page, you can either create a JavaScript file and refer to it in the page's `head` or just embed your JavaScript code in the HTML using the `<script>` tag. In this example, I embed the code:
|
||||
|
||||
|
||||
```
|
||||
<[html][6]>
|
||||
<[head][7]>
|
||||
<[title][8]>JS</[title][8]>
|
||||
</[head][7]>
|
||||
<[body][9]>
|
||||
<[p][10] id="example">Nothing here.</[p][10]>
|
||||
|
||||
<[script][13]>
|
||||
let myvariable = "Hello world!";
|
||||
|
||||
document.getElementById("example").innerHTML = myvariable;
|
||||
</[script][13]>
|
||||
|
||||
</[body][9]>
|
||||
</[html][6]>
|
||||
```
|
||||
|
||||
Reload the page in your browser.
|
||||
|
||||
![HTML with JavaScript displayed in browser][14]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][12])
|
||||
|
||||
As you can see, the `<p>` tag as written still contains the string "Nothing here," but when it's rendered, JavaScript alters it so that it contains "Hello world" instead. Yes, JavaScript has the power to rebuild (or just help build) a webpage.
|
||||
|
||||
The JavaScript in this simple script does two things. First, it creates a variable called `myvariable` and places the string "Hello world!" into it. Finally, it searches the current document (the web page as the browser is rendering it) for any HTML element with the ID `example`. When it locates `example`, it uses the `innerHTML` function to replace the contents of the HTML element with the contents of `myvariable`.
|
||||
|
||||
Of course, using a custom variable isn't necessary. It's just as easy to populate the HTML element with something being dynamically created. For instance, you could populate it with a timestamp:
|
||||
|
||||
|
||||
```
|
||||
<[html][6]>
|
||||
<[head][7]>
|
||||
<[title][8]>JS</[title][8]>
|
||||
</[head][7]>
|
||||
<[body][9]>
|
||||
<[p][10] id="example">Date and time appears here.</[p][10]>
|
||||
|
||||
<[script][13]>
|
||||
document.getElementById("example").innerHTML = Date();
|
||||
</[script][13]>
|
||||
|
||||
</[body][9]>
|
||||
</[html][6]>
|
||||
```
|
||||
|
||||
Reload the page to see a timestamp generated at the moment the page is rendered. Reload a few times to watch the seconds increment.
|
||||
|
||||
### JavaScript syntax
|
||||
|
||||
In programming, **syntax** refers to the rules of how sentences (or "lines") are written. In JavaScript, each line of code must end in a semicolon (`;`) so that the JavaScript engine running your code understands when to stop reading.
|
||||
|
||||
Words (or "strings") must be enclosed in quotation marks (`"`), while numbers (or "integers") go without.
|
||||
|
||||
Almost everything else is a convention of the JavaScript language, such as variables, arrays, conditional statements, objects, functions, and so on.
|
||||
|
||||
### Creating variables in JavaScript
|
||||
|
||||
Variables are containers for data. You can think of a variable as a box where you can put data to share with your program. Creating a variable in JavaScript is done with two keywords you choose based on how you intend to use the variable: `let` and `var`. The `var` keyword denotes a variable intended for your entire program to use, while `let` creates variables for specific purposes, usually inside functions or loops.
|
||||
|
||||
JavaScript's built-in `typeof` function can help you identify what kind of data a variable contains. Using the first example, you can find out what kind of data `myvariable` contains by modifying the displayed text to:
|
||||
|
||||
|
||||
```
|
||||
<string>
|
||||
let myvariable = "Hello world!";
|
||||
document.getElementById("example").innerHTML = typeof(myvariable);
|
||||
</string>
|
||||
```
|
||||
|
||||
This renders "string" in your web browser because the variable contains "Hello world!" Storing different kinds of data (such as an integer) in `myvariable` would cause a different data type to be printed to your sample web page. Try changing the contents of `myvariable` to your favorite number and then reloading the page.
|
||||
|
||||
### Creating functions in JavaScript
|
||||
|
||||
Functions in programming are self-contained data processors. They're what makes programming _modular_. It's because functions exist that programmers can write generic libraries that, for instance, resize images or keep track of the passage of time for other programmers (like you) to use in their own code.
|
||||
|
||||
You create a function by providing a custom name for your function followed by any amount of code enclosed within braces.
|
||||
|
||||
Here's a simple web page featuring a resized image and a button that analyzes the image and returns the true image dimensions. In this example code, the `<button>` HTML element uses the built-in JavaScript function `onclick` to detect user interaction, which triggers a custom function called `get_size`:
|
||||
|
||||
|
||||
```
|
||||
<[html][6]>
|
||||
<[head][7]>
|
||||
<[title][8]>Imager</[title][8]>
|
||||
</[head][7]>
|
||||
<[body][9]>
|
||||
|
||||
<[div][15]>
|
||||
<[button][16] onclick="get_size(document.getElementById('myimg'))">
|
||||
Get image size
|
||||
</[button][16]>
|
||||
</[div][15]>
|
||||
|
||||
<[div][15]>
|
||||
<[img][17] style="width: 15%" id="myimg" src="penguin.png" />
|
||||
</[div][15]>
|
||||
|
||||
<[script][13]>
|
||||
function get_size(i) {
|
||||
let w = i.naturalWidth;
|
||||
let h = i.naturalHeight;
|
||||
alert(w + " by " + h);
|
||||
}
|
||||
</[script][13]>
|
||||
|
||||
</[body][9]>
|
||||
</[html][6]>
|
||||
```
|
||||
|
||||
Save the file and load it into your web browser to try the code.
|
||||
|
||||
![Custom get_size function returns image dimensions][18]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][12])
|
||||
|
||||
### Cross-platform apps with JavaScript
|
||||
|
||||
You can see from the code sample how JavaScript and HTML work closely together to create a cohesive user experience. This is one of the great strengths of JavaScript. When you write code in JavaScript, you inherit one of the most common user interfaces of modern computing regardless of platform: the web browser. Your code is cross-platform by nature, so your application, whether it's just a humble image size analyzer or a complex image editor, video game, or whatever else you dream up, can be used by everyone with a web browser (or a desktop, if you deliver an Electron app).
|
||||
|
||||
Learning JavaScript is easy and fun. There are lots of websites with tutorials available. There are also over a million JavaScript libraries to help you interface with devices, peripherals, the Internet of Things, servers, file systems, and lots more. And as you're learning, keep our [**JavaScript cheat sheet**][19] close by so you remember the fine details of syntax and structure.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/javascript-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lixin555](https://github.com/lixin555)
|
||||
校对:[校对者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/code2.png?itok=JCJTJszs (Code with javascript on white background)
|
||||
[2]: https://www.electronjs.org/
|
||||
[3]: https://opensource.com/article/16/12/notepad-text-editor
|
||||
[4]: https://opensource.com/article/20/12/atom
|
||||
[5]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[6]: http://december.com/html/4/element/html.html
|
||||
[7]: http://december.com/html/4/element/head.html
|
||||
[8]: http://december.com/html/4/element/title.html
|
||||
[9]: http://december.com/html/4/element/body.html
|
||||
[10]: http://december.com/html/4/element/p.html
|
||||
[11]: https://opensource.com/sites/default/files/pictures/plain-html.jpg (HTML displayed in browser)
|
||||
[12]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[13]: http://december.com/html/4/element/script.html
|
||||
[14]: https://opensource.com/sites/default/files/uploads/html-javascript.jpg (HTML with JavaScript displayed in browser)
|
||||
[15]: http://december.com/html/4/element/div.html
|
||||
[16]: http://december.com/html/4/element/button.html
|
||||
[17]: http://december.com/html/4/element/img.html
|
||||
[18]: https://opensource.com/sites/default/files/uploads/get-size.jpg (Custom get_size function returns image dimensions)
|
||||
[19]: https://opensource.com/downloads/javascript-cheat-sheet
|
@ -1,118 +0,0 @@
|
||||
[#]: subject: "How to Recover Arch Linux Install via chroot"
|
||||
[#]: via: "https://www.debugpoint.com/2021/07/recover-arch-linux/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Recover Arch Linux Install via chroot
|
||||
======
|
||||
This quick guide explains some of the steps which may come in handy to recover an Arch Linux Install.
|
||||
|
||||
Being a rolling release, sometimes things breaks in [Arch Linux][1]. Not because of your own actions, but hundreds of other reasons such as new Kernel vs your hardware, or software compatibility. But still, Arch Linux is still better and provides the latest packages and applications.
|
||||
|
||||
But sometimes, it gives you trouble and you end up with a blinking cursor and nothing else.
|
||||
|
||||
So, in those scenarios, instead of re-formatting or reinstalling, you may want to try to recover the installation including the data before giving up your hope. This guide outlines some steps in that direction.
|
||||
|
||||
### Recover Arch Linux Installation
|
||||
|
||||
* First step is to create a bootable LIVE USB with Arch Linux. Download the .ISO from this link and create a bootable .ISO. You can check out this guide on [how to create bootable .ISO using Etcher][2]. Remember this step require another working stable system obviously as your current system is not usable.
|
||||
|
||||
[download arch linux][3]
|
||||
|
||||
* You need to know on which partition your Arch Linux is installed. This is a very important step. If you don’t know, you can use GParted to find out. Or check in your Grub menu, Or you can run the below command to find out. This will list all of your disk partitions with their size, labels.
|
||||
|
||||
```
|
||||
sudo lsblk -o name,mountpoint,label,size,uuid
|
||||
```
|
||||
|
||||
* Once done, plug-in the USB stick and boot from it. And you should see the Arch Linux prompt in the LIVE medium.
|
||||
|
||||
* Now, mount to the Arch Linux partition using below. Change the /dev/sda3 to your respective partition.
|
||||
|
||||
```
|
||||
/dev/sda3
|
||||
```
|
||||
|
||||
```
|
||||
mount /dev/sda3 /mntarch-chroot /mnt
|
||||
```
|
||||
|
||||
* The arch-chroot command will mount your Arch Linux partition in the terminal, so login using your Arch credentials. Now, at this stage, you have the following options, based on what you want.
|
||||
|
||||
* You can take backups of your data by going through /home folders. In case, troubleshooter doesn’t work. You may copy the files to external USB or another partition.
|
||||
|
||||
* Verify the log files, specially the pacman logs. Because, unstable system may be caused by upgrading some packages such graphics driver or any other driver. Based on the log, you may want to downgrade any specific package if you want.
|
||||
* You may use the below command to view last 200 lines of the pacman log file to find out any failing items or dependency removal.
|
||||
|
||||
```
|
||||
tail -n 200 /var/log/pacman.log | less
|
||||
```
|
||||
|
||||
* The above command gives you the 200 lines from the end of the pacman.log file to verify. Now, carefully check which of the packages were updates since your successful boot.
|
||||
|
||||
* And note down the package name and version somewhere. And you may try to downgrade packages one-by-one or if you think a specific package created a problem. Use the -U switch of pacman command to downgrade.
|
||||
|
||||
```
|
||||
pacman -U <package name>
|
||||
```
|
||||
|
||||
* You can run the following to start your Arch system after downgrading, if any.
|
||||
|
||||
```
|
||||
exec /sbin/init
|
||||
```
|
||||
|
||||
* Check the status of your display manager, whether if there are any errors. Sometimes, display manager creates a problem which can’t communicate with X Server. For example, if you are using lightdm, then you can check its status via below.
|
||||
|
||||
```
|
||||
systemctl status lightdm
|
||||
```
|
||||
|
||||
* Or, may want to start it via below command and check what is the error.
|
||||
|
||||
```
|
||||
lightdm --test-mode --debug
|
||||
```
|
||||
|
||||
* Here is an example of lightdm failure which caused an unstable Arch system.
|
||||
|
||||
![lightdm - test mode][4]
|
||||
|
||||
* Or check via kicking off the X server using startx.
|
||||
|
||||
```
|
||||
startx
|
||||
```
|
||||
|
||||
* In my experience, if you see errors in the above command, try to install another display manager such as sddm and enable it. It may eliminate the error.
|
||||
|
||||
* Try the above steps, based on the state of your system, and troubleshoot. For errors specific to display manager lightdm, we have a [guide][5] which you may want to check out.
|
||||
* If you are using sddm, then check out [these troubleshooting steps][6] if something works.
|
||||
|
||||
### Closing Notes
|
||||
|
||||
Every installation is different. And above steps may/may not work for you. But it is worth a try and as per experience, it works. If it works, well, good for you. Either way, do let me know in the comment box below, how it goes.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/recover-arch-linux/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/tag/arch-linux
|
||||
[2]: https://www.debugpoint.com/2021/01/etcher-bootable-usb-linux/
|
||||
[3]: https://archlinux.org/download/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/03/lightdm-test-mode.jpg
|
||||
[5]: https://www.debugpoint.com/2021/03/failed-to-start-lightdm/
|
||||
[6]: https://wiki.archlinux.org/title/SDDM#Troubleshooting
|
@ -1,273 +0,0 @@
|
||||
[#]: subject: "How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 22.04 / 20.04 / 18.04"
|
||||
[#]: via: "https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 22.04 / 20.04 / 18.04
|
||||
======
|
||||
This tutorial explains how to boot into **rescue mode** or **emergency mode**in Ubuntu 22.04, 20.04 and 18.04 LTS editions.
|
||||
|
||||
As you might already know, **Runlevels** are replaced with **Systemd targets** in many Linux distributions such as RHEL 7 / RHEL 8 and Ubuntu 16.04 LTS and newer versions. For more details about runlevels and systemd target, refer to [this guide][1].
|
||||
|
||||
This guide is specifically written for Ubuntu, however the steps given below should work on most Linux distributions that use **Systemd** as the default service manager.
|
||||
|
||||
Before getting into the topic, let us have a brief understanding about what is rescue mode and emergency mode and what is the purpose of these both modes.
|
||||
|
||||
### What Is Rescue Mode?
|
||||
|
||||
The **rescue mode** is equivalent to **single user mode** in Linux distributions that use **SysV** as the default service manager. In rescue mode, all local filesystems will be mounted, only some important services will be started. However, no normal services (E.g network services) won't be started.
|
||||
|
||||
The rescue mode is helpful in situations where the system can't boot normally. Also, we can perform some important rescue operations, such as [reset root password][2], in rescue mode.
|
||||
|
||||
### What Is Emergency Mode?
|
||||
|
||||
In contrast to the rescue mode, nothing is started in the **emergency mode**. No services are started, no mount points are mounted, no sockets are established, nothing. All you will have is just a **raw shell**. Emergency mode is suitable for debugging purposes.
|
||||
|
||||
First, we will see how to boot into rescue mode and emergency mode in Ubuntu 22.04 and 20.04 LTS distributions. The procedure for entering rescue mode in Ubuntu 22.04 and 20.04 LTS is exactly the same!
|
||||
|
||||
### Boot Into Rescue Mode In Ubuntu 22.04 / 20.04 LTS
|
||||
|
||||
We can boot into rescue mode in two ways.
|
||||
|
||||
#### Method 1
|
||||
|
||||
Power on your Ubuntu system. Hit the ESC key right after the BIOS logo disappears to display the Grub menu.
|
||||
|
||||
In the GRUB menu, choose the first entry and press **"e"** to edit it.
|
||||
|
||||
![GRUB Menu In Ubuntu 22.04 / 20.04 LTS][3]
|
||||
|
||||
Hit the DOWN arrow and find the line that starts with the word **"linux"** and add the following line at the end of it. To reach the end, just press **CTRL+e** or use the **END** key or **LEFT/RIGHT** arrows in your keyboard.
|
||||
|
||||
```
|
||||
systemd.unit=rescue.target
|
||||
```
|
||||
|
||||
![Edit Grub Boot Menu Entries To Enter Into Rescue Mode In Ubuntu 22.04 / 20.04 LTS][4]
|
||||
|
||||
After adding the above line, hit **Ctrl+x** or**F10** to boot into rescue mode.
|
||||
|
||||
After a few seconds, you will be landed in the rescue mode (single user mode) as root user. You will be prompted to press ENTER to enter the maintenance mode.
|
||||
|
||||
Here is how rescue mode looks like in Ubuntu 22.04 / 20.04 LTS systems:
|
||||
|
||||
![Boot Into Rescue Mode In Ubuntu 22.04 / 20.04 LTS][5]
|
||||
|
||||
Now do whatever you want to do in the rescue mode. You may need to mount the root (**/**) file system in read/write mode before doing any operations in rescue mode.
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
![Mount Root File System In Read Write Mode In Ubuntu 22.04 / 20.04 LTS][6]
|
||||
|
||||
Once done, press **"Ctrl+d"** to boot into normal mode. Alternatively, you can type any one of the following commands to boot into normal mode.
|
||||
|
||||
```
|
||||
systemctl default
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
If you want to reboot the system instead of booting into normal mode, enter:
|
||||
|
||||
```
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
#### Method 2
|
||||
|
||||
In this method, you don't need to edit the grub boot menu entries.
|
||||
|
||||
Power on the system and choose **"Advanced options for Ubuntu"** from the Grub boot menu.
|
||||
|
||||
![Choose Advanced Options For Ubuntu From Grub Boot Menu][7]
|
||||
|
||||
Next, you will see the list of available Ubuntu versions with Kernel versions. Choose the **"Recovery mode"** in the grub boot menu in Ubuntu.
|
||||
|
||||
![Choose Recovery Mode In Grub Boot Menu In Ubuntu 22.04 / 20.04 LTS][8]
|
||||
|
||||
After a few seconds, you will see the Ubuntu recovery menu. From the recovery menu, choose **"Drop to root shell prompt"** option and hit the ENTER key.
|
||||
|
||||
![Enter Into Root Shell Prompt In Ubuntu 22.04 / 20.04 LTS][9]
|
||||
|
||||
Now you will be landed in the rescue mode.
|
||||
|
||||
![Ubuntu Maintenance Mode][10]
|
||||
|
||||
Mount the root (**/**) file system in read/write mode by entering the following command:
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
![Mount Root File System In Read Write Mode In Ubuntu][11]
|
||||
|
||||
Do whatever you want to do in the rescue mode.
|
||||
|
||||
Once done, type exit to return back to the recovery menu.
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
Finally, choose **"Resume normal boot"** option and hit the ENTER key.
|
||||
|
||||
![Boot Into Normal Mode In Ubuntu][12]
|
||||
|
||||
Press ENTER key again to exit recovery mode and continue booting into normal mode.
|
||||
|
||||
![Exit The Recovery Mode In Ubuntu][13]
|
||||
|
||||
If you don't want to boot into normal mode, type **"reboot"** and press ENTER from the maintenance mode to restart your system.
|
||||
|
||||
### Boot Into Emergency Mode In Ubuntu 22.04 / 20.04 LTS
|
||||
|
||||
When the GRUB boot menu appears, press **"e"** to edit it.
|
||||
|
||||
![GRUB Menu In Ubuntu 22.04 / 20.04 LTS][14]
|
||||
|
||||
Find the line that starts with the word **"linux"** and add the following line at the end of it.
|
||||
|
||||
```
|
||||
systemd.unit=emergency.target
|
||||
```
|
||||
|
||||
![Edit Grub Boot Menu Entries To Enter Into Emergency Mode In Ubuntu 22.04 / 20.04 LTS][15]
|
||||
|
||||
After adding the above line, hit **Ctrl+x** or**F10** to boot into emergency mode.
|
||||
|
||||
After a few seconds, you will be landed in the emergency mode as `root` user. You will be prompted to press ENTER to enter the maintenance mode.
|
||||
|
||||
Here is how emergency mode looks like in Ubuntu 22.04 / 20.04 LTS system:
|
||||
|
||||
![Boot Into Emergency Mode In Ubuntu 22.04 / 20.04 LTS][16]
|
||||
|
||||
Now do whatever you want to do in the emergency mode. You may need to mount the root (**/**) file system in read/write mode before doing any operations in this mode.
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
Once done, press **"Ctrl+d"** to boot into normal mode. Alternatively, you can type any one of the following commands to boot into normal mode.
|
||||
|
||||
```
|
||||
systemctl default
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
If you want to reboot the system instead of booting into normal mode, enter:
|
||||
|
||||
```
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
### Boot Into Rescue Mode In Ubuntu 18.04 LTS
|
||||
|
||||
Boot your Ubuntu system. When the Grub menu appears, choose the first entry and press **e** to edit. (To reach the end, just press **CTRL+e** or use the END key or LEFT/RIGHT arrows in your keyboard):
|
||||
|
||||
![Grub Menu][17]
|
||||
|
||||
If you don't see the Grub menu, just hit ESC key right after the BIOS logo disappears.
|
||||
|
||||
Find the line that starts with word **"linux"**and add the following line at the end of that line (To reach the end, just press **CTRL+e** or use the END key or LEFT/RIGHT arrows in your keyboard):
|
||||
|
||||
```
|
||||
systemd.unit=rescue.target
|
||||
```
|
||||
|
||||
![Edit Grub Menu][18]
|
||||
|
||||
Once you added the above line, just press **CTRL+x** or **F10** to continue to boot into rescue mode. After a few seconds, you will be landed in the rescue mode (single user mode) as root user.
|
||||
|
||||
Here is how rescue mode looks like in Ubuntu 18.04 LTS server:
|
||||
|
||||
![Ubuntu Rescue Mode][19]
|
||||
|
||||
Next, type the following command to mount root (**/**) file system into read/write mode.
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
### Boot Into Emergency Mode
|
||||
|
||||
Booting your Ubuntu into emergency is as same as above method. All you have to do is replace **"systemd.unit=rescue.target"** with **"systemd.unit=emergency.target"** when editing grub menu.
|
||||
|
||||
![Edit Grub Menu][20]
|
||||
|
||||
Once you added "systemd.unit=emergency.target", press **Ctrl+x** or **F10** to continue booting into emergency mode.
|
||||
|
||||
![Ubuntu Emergency Mode][21]
|
||||
|
||||
Finally, you can mount root filesystem into read/write mode with command:
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
### Switch Between Rescue And Emergency Modes
|
||||
|
||||
If you are in rescue mode, you don't have to edit the grub boot entry as I mentioned above. Instead, just type the following command to switch to emergency mode instantly:
|
||||
|
||||
```
|
||||
systemctl emergency
|
||||
```
|
||||
|
||||
Similarly, to switch from emergency to rescue mode, type:
|
||||
|
||||
```
|
||||
systemctl rescue
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
You know now what is rescue and emergency modes and how to boot into those modes in Ubuntu 22.04, 20.04 and 18.04 LTS systems. Like I already mentioned, the steps provided here will work on many recent Linux versions that uses Systemd.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/check-runlevel-linux/
|
||||
[2]: https://ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/05/GRUB-Menu-In-Ubuntu-22.04-LTS.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/05/Edit-Grub-Boot-Menu-Entries-To-Enter-Into-Rescue-Mode-In-Ubuntu-22.04-LTS.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/05/Boot-Into-Rescue-Mode-In-Ubuntu-22.04.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/05/Mount-Root-File-System-In-Read-Write-Mode-In-Ubuntu.png
|
||||
[7]: https://ostechnix.com/wp-content/uploads/2022/05/Choose-Advanced-Options-For-Ubuntu-From-Grub-Boot-Menu.png
|
||||
[8]: https://ostechnix.com/wp-content/uploads/2022/05/Choose-Recovery-Mode-In-Grub-Boot-Menu-In-Ubuntu.png
|
||||
[9]: https://ostechnix.com/wp-content/uploads/2022/05/Enter-Into-Root-Shell-Prompt-In-Ubuntu.png
|
||||
[10]: https://ostechnix.com/wp-content/uploads/2022/05/Ubuntu-Maintenance-Mode.png
|
||||
[11]: https://ostechnix.com/wp-content/uploads/2022/05/Mount-Root-File-System-In-Read-Write-Mode-In-Ubuntu-1.png
|
||||
[12]: https://ostechnix.com/wp-content/uploads/2022/05/Boot-Into-Normal-Mode-In-Ubuntu.png
|
||||
[13]: https://ostechnix.com/wp-content/uploads/2022/05/Exit-The-Recovery-Mode-In-Ubuntu.png
|
||||
[14]: https://ostechnix.com/wp-content/uploads/2022/05/GRUB-Menu-In-Ubuntu-22.04-LTS.png
|
||||
[15]: https://ostechnix.com/wp-content/uploads/2022/05/Edit-Grub-Boot-Menu-Entries-To-Enter-Into-Emergency-Mode-In-Ubuntu.png
|
||||
[16]: https://ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Emergency-Mode-In-Ubuntu-20.04-LTS.png
|
||||
[17]: https://ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png
|
||||
[18]: https://ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png
|
||||
[19]: https://ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png
|
||||
[20]: https://ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png
|
||||
[21]: https://ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png
|
@ -1,163 +0,0 @@
|
||||
[#]: subject: "How to Install FFmpeg in Ubuntu and Other Linux"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/install-ffmpeg-ubuntu/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "aREversez"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install FFmpeg in Ubuntu and Other Linux
|
||||
======
|
||||
This tutorial outlines the steps required to install FFmpeg in Ubuntu and Other Linux systems.
|
||||
|
||||
The ffmpeg is a collection library and software program to manipulate multimedia files. The entire ffmpeg is a robust set of libraries that allows you to convert, stream, and manipulate audio and video files. Many frontend Linux applications use it as backend hence depends on it. For example, a screen recording application may need ffmpeg to convert recorded streams to gif images.
|
||||
|
||||
Popular applications and services that use FFmpeg are VLC Media Player, YouTube, Blender, Kodi, Shotcut, and Handbrake – to name a few.
|
||||
|
||||
Fun fact: NASA’s Mars 2020 mission rover Perseverance used FFmpeg to complete and process images and video before beaming back to Earth!
|
||||
|
||||
### About ffmpeg package
|
||||
|
||||
The [ffmpeg][1] itself is a powerful program as a command-line utility. It is available for Linux, Windows, and macOS and supports many architectures. It is written in C and Assembly, providing extensive performance and a cross-platform utility.
|
||||
|
||||
#### The Core
|
||||
|
||||
The core of ffmpeg is the command-line utility or programs. They can be used on the command line or called from any programming language. For example, you can use these from your shell program, python script, etc.
|
||||
|
||||
* ffmpeg: Used to convert audio and video streams, including sources from LIVE streams such as TV cards
|
||||
* ffplay: Media player bundled in this package to play media
|
||||
* ffprobe: Command line tool to show media information – can output as txtm csv, xml, json formats
|
||||
|
||||
### FFmpeg Installation
|
||||
|
||||
Installing FFmpeg is easy in Ubuntu and other Linux distributions. Open a terminal prompt and run the following commands to install.
|
||||
|
||||
#### Ubuntu and similar distro
|
||||
|
||||
```
|
||||
sudo apt install ffmpeg
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
For Fedora Linux, you need to add the [RPM Fusion repo][2] for FFmpeg. The official Fedora repo doesn’t have the FFmpeg package.
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install ffmpeg
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
```
|
||||
pacman -S ffmpeg
|
||||
```
|
||||
|
||||
After the successful installation, you can verify the installation using the below command.
|
||||
|
||||
```
|
||||
ffmpeg --version
|
||||
```
|
||||
|
||||
![FFmpeg installed in Ubuntu Linux][3]
|
||||
|
||||
### Example: How to do basic tasks using ffmpeg
|
||||
|
||||
First, let me give you a simple example of the basic syntax. Consider the following example. It simply converts an mp4 file to mkv file.
|
||||
|
||||
1. Convert a basic video file
|
||||
|
||||
```
|
||||
ffmpeg -i big_buck_bunny.mp4 big_buck_bunny.mkv
|
||||
```
|
||||
|
||||
Of course, this is the easiest method, but it’s not complete because it doesn’t have the bit rate, resolution and other attributes of the video file required for the conversion.
|
||||
|
||||
1. Convert an audio file
|
||||
|
||||
Secondly, you can convert an audio file using a similar command.
|
||||
|
||||
```
|
||||
ffmpeg -i sunny_day.ogg sunny_day.mp3
|
||||
```
|
||||
|
||||
1. Convert with an audio and video codec
|
||||
|
||||
Finally, the following example can convert a video file using specified codecs. The parameter `-c` with `a` or `v` defines audio and video, respectively. The below command uses `libvpx` video and `libvorbis` audio codec for conversion.
|
||||
|
||||
```
|
||||
ffmpeg -i big_buck_bunny.mp4 -c:v libvpx -c:a libvorbis big_buck_bunny.webm
|
||||
```
|
||||
|
||||
### How to find out about the available codecs, encoders and decoders in your system?
|
||||
|
||||
#### List all codecs
|
||||
|
||||
To list all the codecs available, run the below command.
|
||||
|
||||
```
|
||||
ffmpeg -codecs
|
||||
```
|
||||
|
||||
This command lists all the codecs available with their capability, whether they support decoding or encoding, etc. Moreover, they are identified with the position as per the below table.
|
||||
|
||||
```
|
||||
D..... = Decoding supported.E.... = Encoding supported..V... = Video codec..A... = Audio codec..S... = Subtitle codec...I.. = Intra frame-only codec....L. = Lossy compression.....S = Lossless compression
|
||||
```
|
||||
|
||||
![FFmpeg Codec list][4]
|
||||
|
||||
#### List all encoders
|
||||
|
||||
Listing all the encoders is accessible via the below command.
|
||||
|
||||
```
|
||||
ffmpeg -encoders
|
||||
```
|
||||
|
||||
#### List all decoders
|
||||
|
||||
Similarly, the decoders list you can get via the below command.
|
||||
|
||||
```
|
||||
ffmpeg -decoders
|
||||
```
|
||||
|
||||
#### Details
|
||||
|
||||
You can also get more details about the encoders or decoders using the parameter -h.
|
||||
|
||||
```
|
||||
ffmpeg -h decoder=mp3
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
I hope you learned the basics of FFmpeg and its commands. You can learn more about the program via the official [documentation][5].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/install-ffmpeg-ubuntu/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[aREversez](https://github.com/aREversez)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ffmpeg.org/
|
||||
[2]: https://www.debugpoint.com/2020/07/enable-rpm-fusion-fedora-rhel-centos/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/06/FFmpeg-installed-in-Ubuntu-Linux.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/06/FFmpeg-Codec-list.jpg
|
||||
[5]: https://ffmpeg.org/documentation.html
|
@ -1,85 +0,0 @@
|
||||
[#]: subject: "6 Linux word processors you need to try"
|
||||
[#]: via: "https://opensource.com/article/22/6/word-processors-linux"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
6 Linux word processors you need to try
|
||||
======
|
||||
Check out one of my favorite open source word processors to put your ideas to paper.
|
||||
|
||||
![Typewriter with hands][1]
|
||||
|
||||
Image by: rawpixel.com. CC0.
|
||||
|
||||
Writers are always looking for better ways to put their words and ideas into readable formats to share with their readers. My first experiences with word processing came in my Apple II days when I used AppleWorks and later FrEDWriter, which was a free word processing application created in 1985. It was the standard for my students, many of whom came from households that lacked the money to purchase proprietary software.
|
||||
|
||||
### Abiword
|
||||
|
||||
When I made the switch to Linux in the late 1990's, I was looking for high quality writing software that I could use and recommend to students who chose to follow my lead in the world of open source software. The first word processor I became familiar with was [AbiWord][2]. The name AbiWord is derived from the Spanish word, abierto, which means open. It was Initially released in 1998 and it has been under continuous development. It is licensed as GPLv2. It supports basic word processing such as lists, indents and character formats. It supports a variety of import and export file formats including `.doc`, `.html`, `.docx`, and `.odt`.
|
||||
|
||||
![Image of Abiword][3]
|
||||
|
||||
### Etherpad
|
||||
|
||||
[Etherpad][4] is an open source group editing project. It allows you to edit documents in real time much like Google Drive. The main difference is that it is entirely open source. According to their website you can, "write articles, press releases, to-do lists, together with your friends, fellow students or colleagues, all working on the same document at the same time." The source code is readily available to look at. Etherpad is licensed as Apache 2.0. You can use Etherpad in the cloud or download and [install][5] it on your own Linux computer.
|
||||
|
||||
### Cryptpad
|
||||
|
||||
[CryptPad][6] is a collaboration suite that is end-to-end encrypted. It is licensed with GPLv3 and its source code is available on [GitHub][7]. It was developed by [Xwiki][8] Labs. It is an alternative to Google Drive and is self hosted. According to their website, "CryptPad is built to enable collaboration. It synchronizes changes to documents in real time. Because all data is encrypted, the service and its administrators have no way of seeing the content being edited and stored.” Cryptpad offers extensive [documentation][9] for users.
|
||||
|
||||
### Focuswriter
|
||||
|
||||
[FocusWriter][10] is a simple distraction free editor. It uses a hideaway interface that you access by moving your mouse to the edges of the screen. It is licensed with GPLv3 and it's available on Linux with Flatpak,via DEB on [Ubuntu][11], and RPM on [Fedora][12]. This is an example of the FocusWriter desktop. A very simple and intuitive interface where the menu automatically hides until you move your mouse pointer to the top or sides of the screen. Files are saved by default as an `.odt`, but it also supports plain text, `.docx`, and Rich text.
|
||||
|
||||
![Image of FocusWriter][13]
|
||||
|
||||
### LibreOffice Writer
|
||||
|
||||
[LibreOffice Writer][14] is my favorite. I have been using it for over a dozen years. It has all the features I need including formatting for rich text. It also has the largest array of import and export options I have seen in any word processor. There are dozens of templates available for specialty formats like [APA][15] for research and publication. I love that I can export directly to PDF and ‘epub' from any word processor. LibreOffice Writer is free software with the Mozilla Public License 2.0. The s[ource code][16] for LibreOffice is from the Document Foundation. LibreOffice comes standard with most Linux distribution. It is also available as Flatpak, Snap, and AppImage. In addition, you can download and install it on MacOS and Windows.
|
||||
|
||||
![Image of LibreOffice work space][17]
|
||||
|
||||
### OpenOffice Writer
|
||||
|
||||
Apache [OpenOffice Writer][18] is a complete word processor. It's simple enough for memos yet complex enough to write your first book. According to their website, OpenOffice Writer automatically saves documents in ‘open document format'. Documents can also be saved in `.doc`, `.docx`, Rich Text, and other formats. OpenOffice Writer is licensed with an Apache License 2.0. Source code and is available on [GitHub][19].
|
||||
|
||||
There is a wealth of free open source software waiting for you to discover. They are great for getting your everyday tasks done and you can also contribute to their development. What is your favorite Linux word processor application?
|
||||
|
||||
Image by: (Don Watkins, CC BY-SA 4.0)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/word-processors-linux
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/typewriter-hands.jpg
|
||||
[2]: https://www.abisource.com/
|
||||
[3]: https://opensource.com/sites/default/files/2022-05/abiword.png
|
||||
[4]: https://etherpad.org/#
|
||||
[5]: https://github.com/ether/etherpad-lite#installation
|
||||
[6]: https://cryptpad.fr/what-is-cryptpad.html
|
||||
[7]: https://github.com/xwiki-labs/cryptpad
|
||||
[8]: https://github.com/xwiki-labs
|
||||
[9]: https://docs.cryptpad.fr/en/user_guide/index.html
|
||||
[10]: https://gottcode.org/focuswriter/
|
||||
[11]: https://packages.ubuntu.com/jammy/focuswriter
|
||||
[12]: https://src.fedoraproject.org/rpms/focuswriter
|
||||
[13]: https://opensource.com/sites/default/files/2022-05/focuswriter.png
|
||||
[14]: https://www.libreoffice.org/discover/writer/
|
||||
[15]: https://extensions.libreoffice.org/en/extensions/show/apa-style-paper-template
|
||||
[16]: https://www.libreoffice.org/about-us/source-code/
|
||||
[17]: https://opensource.com/sites/default/files/2022-05/Libreofficewriter.png
|
||||
[18]: https://www.openoffice.org/product/writer.html
|
||||
[19]: https://github.com/apache/openoffice
|
@ -1,110 +0,0 @@
|
||||
[#]: subject: "Amberol is a Stunning Looking Music Player for Linux That Just Plays Music and Nothing Else"
|
||||
[#]: via: "https://itsfoss.com/amberol-music-player/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Amberol is a Stunning Looking Music Player for Linux That Just Plays Music and Nothing Else
|
||||
======
|
||||
Though the world of music is dominated by streaming services, it has not discouraged developers from creating music players for desktop computers.
|
||||
|
||||
Recently, I came across a beautiful looking new music player for the Linux desktop. It’s called Amberol and I was awestruck by its beauty.
|
||||
|
||||
![amberol music player interface][1]
|
||||
|
||||
Looks good, no? Let’s take a closer look at it.
|
||||
|
||||
### Amberol, the cute looking music player for Linux
|
||||
|
||||
Looking good is one of the two (or few) things it does. The other thing is playing music.
|
||||
|
||||
And that’s about it. [Amberol][2] doesn’t have additional fancy (and useful) features like album art generation, metadata editing, lyrics display or playlists and library management.
|
||||
|
||||
It’s not like these features will be added in future releases. Amberol just wants to play music. That’s it.
|
||||
|
||||
#### The stunning UI
|
||||
|
||||
Amberol is written in Rust and GTK like most new GNOME applications.
|
||||
|
||||
It has an adaptive UI that changes color based on the album color you are playing. The gradient effect gives it a modern, sleek look that would surely be part of your Linux ricing screenshots.
|
||||
|
||||
![amberol music player][3]
|
||||
|
||||
Since the UI does not have the traditional handlebar and menu, it gives the application a unified look.
|
||||
|
||||
#### Playlists
|
||||
|
||||
It generates a playlist automatically from the files present in the folder you add. It is displayed in the lefthand sidebar.
|
||||
|
||||
![amberol playlist][4]
|
||||
|
||||
You can see how long the entire playlist will play the music in the top left corner. Clicking on the ‘correct sign’ allows you to select songs and remove them from the playlist.
|
||||
|
||||
If you want, you can hide the playlist sidebar.
|
||||
|
||||
![amberol without playlist][5]
|
||||
|
||||
#### Music playing options
|
||||
|
||||
You can see the progress of the songs on the interface. The player integrates well with the media control buttons on the keyboard. You can play/pause and change tracks with the dedicated media keys (if you have it on your system).
|
||||
|
||||
Amberol does give you a few more options for playing the music. You can turn on the shuffle to play music in random order. You may also put a song on repeat and keep on playing it till you get bored of it.
|
||||
|
||||
![amberol music playing options][6]
|
||||
|
||||
The handlebar menu at the bottom gives you the option to add a file or folder and show available keyboard shortcuts.
|
||||
|
||||
![amberol keyboard shortcuts][7]
|
||||
|
||||
You may also disable the UI color changing to match the album art from here.
|
||||
|
||||
### Installing Amberol on Linux
|
||||
|
||||
Amberol is [available as Flatpak][8]. Please ensure that [your system has Flatpak support enabled][9].
|
||||
|
||||
To install Amberol, open a terminal and use the following command:
|
||||
|
||||
```
|
||||
flatpak install flathub io.bassi.Amberol
|
||||
```
|
||||
|
||||
Once installed search for the application in the menu and start from here.
|
||||
|
||||
On the first run, it asks you to add music files or folders. You can also drag and drop files.
|
||||
|
||||
![amberol first run][10]
|
||||
|
||||
### Conclusion
|
||||
|
||||
Personally, I prefer streaming services because I don’t have a good collection of local music. But I know there are people who have/had a huge collection of CDs that are now saved on the hard disk.
|
||||
|
||||
Amberol is a beautiful-looking application and it is good enough for playing local music. The main attraction is the adaptive UI based on the album art.
|
||||
|
||||
I let you play with it and share your experience in the comment section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/amberol-music-player/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-music-player-interface-800x693.png
|
||||
[2]: https://apps.gnome.org/app/io.bassi.Amberol/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-music-player-800x580.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-playlist-800x548.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-without-playlist-800x693.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-music-playing-options-800x548.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/06/Amberol-keyboard-shortcuts-800x528.png
|
||||
[8]: https://flathub.org/apps/details/io.bassi.Amberol
|
||||
[9]: https://itsfoss.com/flatpak-guide/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/06/amberol-first-run-800x693.png
|
@ -1,155 +0,0 @@
|
||||
[#]: subject: "How Garbage Collection works inside a Java Virtual Machine"
|
||||
[#]: via: "https://opensource.com/article/22/6/garbage-collection-java-virtual-machine"
|
||||
[#]: author: "Jayashree Huttanagoudar https://opensource.com/users/jayashree-huttanagoudar"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How Garbage Collection works inside a Java Virtual Machine
|
||||
======
|
||||
Understanding how Java handles memory isn't always necessary, but it can help you envision how the JVM deals with your variables and class instances.
|
||||
|
||||
![Coffee beans][1]
|
||||
|
||||
Image by: Pixabay. CC0.
|
||||
|
||||
Automatic Garbage Collection (GC) is one of the most important features that makes Java so popular. This article explains why GC is essential. It includes automatic and generational GC, how the Java Virtual Machine (JVM) divides heap memory, and finally, how GC works inside the JVM.
|
||||
|
||||
### Java memory allocation
|
||||
|
||||
Java memory is divided into four sections:
|
||||
|
||||
1. Heap: The memory for object instances is allocated in the heap. When the object declaration is made, there won't be any memory allocated in the heap. Instead, a reference is created for that object in the stack.
|
||||
2. Stack: This section allocates the memory for methods, local variables, and class instance variables.
|
||||
3. Code: Bytecode resides in this section.
|
||||
4. Static: Static data and methods are placed in this section.
|
||||
|
||||
### What is automatic Garbage Collection (GC)?
|
||||
|
||||
Automatic GC is a process in which the referenced and unreferenced objects in heap memory are identified, and then unreferenced objects are considered for deletion. The term *referenced objects* means some part of your program is using those objects. *Unreferenced objects* are not currently being used by the program.
|
||||
|
||||
Programming languages like C and C++ require manual allocation and deallocation of memory. This is automatically handled by GC in Java, although you can trigger GC manually with the `system.gc();` call in your code.
|
||||
|
||||
The fundamental steps of GC are:
|
||||
|
||||
#### 1. Mark used and unused objects
|
||||
|
||||
In this step, the used and unused objects are marked separately. This is a time-consuming process, as all objects in memory must be scanned to determine whether they're in use or not.
|
||||
|
||||
![Marking used and unused objects][2]
|
||||
|
||||
#### 2. Sweep/Delete objects
|
||||
|
||||
There are two variations of sweep and delete.
|
||||
|
||||
**Simple deletion**: Only unreferenced objects are removed. However, the memory allocation for new objects becomes difficult as the free space is scattered across available memory.
|
||||
|
||||
![Normal deleting process][3]
|
||||
|
||||
**Deletion with compaction**: Apart from deleting unreferenced objects, referenced objects are compacted. Memory allocation for new objects is relatively easy, and memory allocation performance is improved.
|
||||
|
||||
![Deletion with compacting][4]
|
||||
|
||||
### What is generational Garbage Collection (GC), and why is it needed?
|
||||
|
||||
As seen in the sweep and delete model, scanning all objects for memory reclamation from unused objects becomes difficult once the objects keep growing. An experimental study shows that most objects created during the program execution are short-lived.
|
||||
|
||||
The existence of short-lived objects can be used to improve the performance of GC. For that, the JVM divides the memory into different generations. Next, it categorizes the objects based on these memory generations and performs the GC accordingly. This approach is known as *generational GC*.
|
||||
|
||||
### Heap memory generations and the generational Garbage Collection (GC) process
|
||||
|
||||
To improve the performance of the GC mark and sweep steps, the JVM divides the heap memory into three generations:
|
||||
|
||||
* Young Generation
|
||||
* Old Generation
|
||||
* Permanent Generation
|
||||
|
||||
![Hotspot heap structure][5]
|
||||
|
||||
Here is a description of each generation and its key features.
|
||||
|
||||
#### Young Generation
|
||||
|
||||
All created objects are present here. The young generation is further divided into:
|
||||
|
||||
1. Eden: All newly created objects are allocated with the memory here.
|
||||
2. Survivor space (S0 and S1): After surviving one GC, the live objects are moved to one of these survivor spaces.
|
||||
|
||||
![Object allocation][6]
|
||||
|
||||
The generational GC that happens in the Young Generation is known as *Minor GC*. All Minor GC cycles are "Stop the World" events that cause the other applications to pause until it completes the GC cycle. This is why Minor GC cycles are faster.
|
||||
|
||||
To summarize: Eden space has all newly created objects. Once Eden is full, the first Minor GC cycle is triggered.
|
||||
|
||||
![Filling Eden space][7]
|
||||
|
||||
Minor GC: The live and dead objects are marked during this cycle. The live objects are moved to survivor space S0. Once all live objects are moved to S0, the unreferenced objects are deleted.
|
||||
|
||||
![Copying referenced objects][8]
|
||||
|
||||
The age of objects in S0 is 1 because they have survived one Minor GC. Now Eden and S1 are empty.
|
||||
|
||||
Once cleared, the Eden space is again filled with new live objects. As time elapses, some objects in Eden and S0 become dead (unreferenced), and Eden's space is full again, triggering the Minor GC.
|
||||
|
||||
![Object aging][9]
|
||||
|
||||
This time the dead and live objects in Eden and S0 are marked. The live objects from Eden are moved to S1 with an age increment of 1. The live objects from S0 are also moved to S1 with an age increment of 2 (because they've now survived two Minor GCs). At this point, S0 and Eden are empty. After every Minor GC, Eden and one of the survivor spaces are empty.
|
||||
|
||||
The same cycle of creating new objects in Eden continues. When the next Minor GC occurs, Eden and S1 are cleared by moving the aged objects to S0. The survivor spaces switch after every Minor GC.
|
||||
|
||||
![Additional aging][10]
|
||||
|
||||
This process continues until the age of one of the surviving objects reaches a certain threshold, at which point it is moved to the so-called the Old Generation with a process called *promotion*.
|
||||
|
||||
Further, the `-Xmn` flag sets the Young Generation size.
|
||||
|
||||
### Old Generation (Tenured Generation)
|
||||
|
||||
This generation contains the objects that have survived several Minor GCs and aged to reach an expected threshold.
|
||||
|
||||
![Promotion][11]
|
||||
|
||||
In the example diagram above, the threshold is 8. The GC in the Old Generation is known as a *Major GC*. Use the flags `-Xms` and `-Xmx` to set the initial and maximum size of the heap memory.
|
||||
|
||||
### Permanent Generation
|
||||
|
||||
The Permanent Generation space stores metadata related to library classes and methods of an application, J2SE, and what's in use by the JVM itself. The JVM populates this data at runtime based on which classes and methods are in use. Once the JVM finds the unused classes, they are unloaded or collected, making space for used classes.
|
||||
|
||||
Use the flags `-XX:PermGen` and `-XX:MaxPermGen` to set the initial and maximum size of the Permanent Generation.
|
||||
|
||||
#### Metaspace
|
||||
|
||||
Metaspace was introduced in Java 8u and replaced PermGen. The advantage of this is automatic resizing, which avoids OutOfMemory errors.
|
||||
|
||||
### Wrap up
|
||||
|
||||
This article discusses the various memory generations of JVM and how they are helpful for automatic generational Garbage Collection (GC). Understanding how Java handles memory isn't always necessary, but it can help you envision how the JVM deals with your variables and class instances. This understanding allows you to plan and troubleshoot your code and comprehend potential limitations inherent in a specific platform.
|
||||
|
||||
Image by: (Jayashree Huttanagoudar, CC BY-SA 4.0)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/garbage-collection-java-virtual-machine
|
||||
|
||||
作者:[Jayashree Huttanagoudar][a]
|
||||
选题:[lkxed][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/jayashree-huttanagoudar
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/java-coffee-beans.jpg
|
||||
[2]: https://opensource.com/sites/default/files/2022-06/1Marking.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-06/2NormalDeletion.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-06/3DeletionwithCompacting.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-06/4Hotspot.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-06/5ObjAllocation.png
|
||||
[7]: https://opensource.com/sites/default/files/2022-06/6FillingEden.png
|
||||
[8]: https://opensource.com/sites/default/files/2022-06/7CopyingRefdObjs.png
|
||||
[9]: https://opensource.com/sites/default/files/2022-06/8ObjAging.png
|
||||
[10]: https://opensource.com/sites/default/files/2022-06/9AddlAging.png
|
||||
[11]: https://opensource.com/sites/default/files/2022-06/10Promotion.png
|
@ -1,85 +0,0 @@
|
||||
[#]: subject: "How to Boot Ubuntu 22.04 into Rescue / Emergency Mode"
|
||||
[#]: via: "https://www.linuxtechi.com/boot-ubuntu-22-04-rescue-emergency-mode/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Boot Ubuntu 22.04 into Rescue / Emergency Mode
|
||||
======
|
||||
Hello geeks, booting Ubuntu 22.04 (Jammy Jellyfish) into rescue and emergency mode helps to reset the forgotten user password, fix the file system errors and disabling or enabling systemd service during boot.
|
||||
|
||||
In this post, we will learn how to boot Ubuntu 22.04 LTS system into rescue and emergency mode. Rescue mode is similar to single user mode where are all troubleshooting steps are executed. Rescue mode loads the minimal environment and mount root file system.
|
||||
|
||||
Whereas in emergency mode, we get the single user shell without starting any system services. So emergency mode is required when we can’t boot the system into rescue mode.
|
||||
|
||||
### Boot Ubuntu 22.04 into Rescue or Single User Mode
|
||||
|
||||
Head to target system which you want to boot into rescue or single user mode. At the boot press ‘SHIFT & ESC’ key to enter into grub bootloader screen.
|
||||
|
||||
![Default-Grub-Screen-Ubuntu-22-04][1]
|
||||
|
||||
Choose the first option Ubuntu and press ‘e’ to enter edit mode.
|
||||
|
||||
Go the end of line which starts with linux and delete the string ‘$vt_handoff’ and add the string ‘systemd.unit=rescue.target’
|
||||
|
||||
![rescue-target-ubuntu-22-04][2]
|
||||
|
||||
After making the changes, either press Ctrl+x or F10 to boot in rescue mode,
|
||||
|
||||
![Troubleshooting-Commands-in-Rescue-Mode][3]
|
||||
|
||||
Once you enter into rescue mode, run all troubleshooting commands and to reboot the system run ‘systemctl reboot’ command
|
||||
|
||||
### Alternate Way to Boot System into Rescue Mode
|
||||
|
||||
Reboot the system and press ‘ESC & Shift’ Key to go to grub boot screen.
|
||||
|
||||
Choose the 2nd option ‘Advanced Options for Ubuntu’ –> Choose recovery mode option and hit enter –> Choose Root (Drop to root shell prompt).
|
||||
|
||||
Example is show below
|
||||
|
||||
![Boot-Ubuntu-22-04-Rescue-Mode][4]
|
||||
|
||||
Once you have root shell, run commands to recover and fix the system issues and finally use ‘systemctl reboot’ to reboot the system.
|
||||
|
||||
### Boot Ubuntu 22.04 into Emergency Mode
|
||||
|
||||
To boot the system into emergency mode, first go to grub screen.
|
||||
|
||||
![Default-Grub-Screen-Ubuntu-22-04][5]
|
||||
|
||||
Select the first option as ‘Ubuntu’ and press ‘e’ to edit. Look for the line which starts with linux word, go to the end of that line, remove the string $vt_handoff and add the string ‘systemd.unit=emergency.target’
|
||||
|
||||
![Emergency-Mode-Ubuntu-22-04][6]
|
||||
|
||||
Press Ctrl+x or F10 to boot the system into emergency mode,
|
||||
|
||||
![Command-in-Emergency-Mode-Ubuntu-22-04][7]
|
||||
|
||||
Similarly in rescue mode, you can perform all the troubleshooting in this mode and once done reboot the system with command ‘systemctl reboot’.
|
||||
|
||||
That’s all from this post. I found it informative and don’t hesitate to share this among your technical friends. Kindly post your queries and feedback in below comments section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/boot-ubuntu-22-04-rescue-emergency-mode/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Default-Grub-Screen-Ubuntu-22-04.png
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2022/06/rescue-target-ubuntu-22-04.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Troubleshooting-Commands-in-Rescue-Mode.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Boot-Ubuntu-22-04-Rescue-Mode.gif
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Default-Grub-Screen-Ubuntu-22-04.png
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Emergency-Mode-Ubuntu-22-04.png
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Command-in-Emergency-Mode-Ubuntu-22-04.png
|
@ -0,0 +1,96 @@
|
||||
[#]: subject: "How I gave my old laptop new life with the Linux Xfce desktop"
|
||||
[#]: via: "https://opensource.com/article/22/6/linux-xfce-old-laptop"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How I gave my old laptop new life with the Linux Xfce desktop
|
||||
======
|
||||
While I installed Linux to use my laptop for a few demos at a conference, I found Linux and the Xfce desktop made this old laptop feel quite snappy.
|
||||
|
||||
![Person drinking a hat drink at the computer][1]
|
||||
|
||||
Image by: [Jonas Leupe][2] on [Unsplash][3]
|
||||
|
||||
A few weeks ago, I needed to give a conference presentation that included a brief demonstration of a small app I'd written for Linux. I needed a Linux laptop to bring to the conference, so I dug out an old laptop and installed Linux on it. I used the [Fedora 36 Xfce spin][4], which worked great.
|
||||
|
||||
The laptop I used was purchased in 2012. The 1.70 GHz CPU, 4 GB memory, and 128 GB drive may seem small compared to my current desktop machine, but Linux and the Xfce desktop gave this old machine new life.
|
||||
|
||||
### Xfce desktop for Linux
|
||||
|
||||
The [Xfce desktop][5] is a lightweight desktop that provides a sleek, modern look. The interface is familiar, with a taskbar or “panel” across the top to launch applications, change between virtual desktops, or access notifications in the system tray. The quick access dock at the bottom of the screen lets you launch frequently used applications like the terminal, file manager, and web browser.
|
||||
|
||||
![Image of Xfce desktop][6]
|
||||
|
||||
To start a new application, click the Applications button in the upper-left corner. This opens a menu of application launchers, with the most frequently used applications like the terminal and file manager at the top. Other applications are organized into groups, so you can navigate to the one you want.
|
||||
|
||||
![Image of desktop applications][7]
|
||||
|
||||
### Managing files
|
||||
|
||||
Xfce's file manager is called Thunar, and it does a great job of organizing my files. I like that Thunar can also make connections to remote systems. At home, I use a Raspberry Pi using SSH as a [personal file server][8]. Thunar lets me open an SSH file transfer window so I can copy files between my laptop and the Raspberry Pi.
|
||||
|
||||
![Image of Thunar remote][9]
|
||||
|
||||
Another way to access files and folders is via the quick access dock at the bottom of the screen. Click the folder icon to bring up a menu of common actions such as opening a folder in a terminal window, creating a new folder, or navigating into a specific folder.
|
||||
|
||||
![Image of desktop with open folders][10]
|
||||
|
||||
### Other applications
|
||||
|
||||
I loved exploring the other applications provided in Xfce. The Mousepad text editor looks like a simple text editor, but it contains useful features for editing more than just plain text. Mousepad recognizes many file types that programmers and other power users may appreciate. Check out this partial list of programming languages available in the Document menu.
|
||||
|
||||
![Image of Mousepad file types][11]
|
||||
|
||||
If you prefer a different look and feel, you can adjust the interface options such as font, color scheme, and line numbers using the View menu.
|
||||
|
||||
![Image of Mousepad in color scheme solarized][12]
|
||||
|
||||
The disk utility lets you manage storage devices. While I didn't need to modify my system disk, the disk tool is a great way to initialize or reformat a USB flash drive. I found the interface very easy to use.
|
||||
|
||||
![Image of disk utility][13]
|
||||
|
||||
I was also impressed with the Geany integrated development environment. I was a bit surprised that a full IDE ran so well on an older system. Geany advertises itself as a “powerful, stable and lightweight programmer's text editor that provides tons of useful features without bogging down your workflow.” And that's exactly what Geany provided.
|
||||
|
||||
I started a simple “hello world” program to test out Geany, and was pleased to see that the IDE popped up syntax help as I typed each function name. The pop-up message is unobtrusive and provides just enough syntax information where I need it. While the `printf` function is easy for me to remember, I always forget the order of options to other functions like `fputs` and `realloc`. This is where I need the pop-up syntax help.
|
||||
|
||||
![Image of Geany workspace][14]
|
||||
|
||||
Explore the menus in Xfce to find other applications to make your work easier. You'll find apps to play music, access the terminal, or browse the web.
|
||||
|
||||
While I installed Linux to use my laptop for a few demos at a conference, I found Linux and the Xfce desktop made this old laptop feel quite snappy. The system performed so well that when the conference was over, I decided to keep the laptop around as a second machine.
|
||||
|
||||
I just love working in Xfce and using the apps. Despite the low overhead and minimal approach, I don't feel underpowered. I can do everything I need to do using Xfce and the included apps. If you have an older machine that needs new life, try installing Linux to bring new life to old hardware.
|
||||
|
||||
Image by: (Jim Hall, CC BY-SA 40)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/linux-xfce-old-laptop
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/coffee_tea_laptop_computer_work_desk.png
|
||||
[2]: https://unsplash.com/@jonasleupe?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/tea-cup-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://spins.fedoraproject.org/xfce/download/index.html
|
||||
[5]: https://opensource.com/article/19/12/xfce-linux-desktop
|
||||
[6]: https://opensource.com/sites/default/files/2022-06/Linuxlaptop1.png
|
||||
[7]: https://opensource.com/sites/default/files/2022-06/linuxlaptopDesktopApps.png
|
||||
[8]: https://opensource.com/article/20/3/personal-file-server-ssh
|
||||
[9]: https://opensource.com/sites/default/files/2022-06/LinuxlaptopThunarremote.png
|
||||
[10]: https://opensource.com/sites/default/files/2022-06/LinuxlaptopDesk.png
|
||||
[11]: https://opensource.com/sites/default/files/2022-06/LinuxlaptopMousepadfiletype.png
|
||||
[12]: https://opensource.com/sites/default/files/2022-06/Linuxlaptopmousepadsolarized.png
|
||||
[13]: https://opensource.com/sites/default/files/2022-06/linuxlaptopdisks.png
|
||||
[14]: https://opensource.com/sites/default/files/2022-06/Linuxlaptopgeany.png
|
@ -0,0 +1,137 @@
|
||||
[#]: subject: "Rufus for Linux? Here Are the Best Live USB Creating Tools"
|
||||
[#]: via: "https://itsfoss.com/live-usb-creator-linux/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Rufus for Linux? Here Are the Best Live USB Creating Tools
|
||||
======
|
||||
Rufus is an open-source utility to create bootable USB drives. It is straightforward to use, with available options to tweak as per your requirements. Not just the ease of use, it is also incredibly fast to make bootable USB drives.
|
||||
|
||||
Unfortunately, Rufus is not available for Linux, it is only exclusive to Windows. So, most of us who have used it on Windows, look for Rufus alternatives on Linux.
|
||||
|
||||
If you are in the same boat, fret not, we have some excellent alternatives for various use-cases.
|
||||
|
||||
Let us explore some Rufus alternatives for Linux:
|
||||
|
||||
### 6 Best Live USB Creation Tools for Linux
|
||||
|
||||
All the options listed are entirely open-source and work perfectly fine with Linux distributions.
|
||||
|
||||
**Note:** *The list is in no particular order of ranking.*
|
||||
|
||||
#### 1. BalenaEtcher
|
||||
|
||||
![balena etcher 2022][1]
|
||||
|
||||
BalenaEtcher or Etcher is a good option for multiple platforms (Windows, macOS), including Linux users.
|
||||
|
||||
You do not get any advanced options here. Hence, it is pleasantly easy to use. Simply select the ISO (image file) and proceed to flash it on the target USB drive.
|
||||
|
||||
It is completely open-source and validates your drive after the process. Furthermore, it auto-selects connected USB drives to avoid choosing any hard disk if you accidentally wipe it.
|
||||
|
||||
You can refer to our [handy guide][2] to install it on Linux.
|
||||
|
||||
[BalenaEtcher][3]
|
||||
|
||||
#### 2. Fedora Media Writer
|
||||
|
||||
![fedora media writer][4]
|
||||
|
||||
Fedora Media Writer is particularly known to help you create live USB for Fedora Linux distribution. It can download the ISO file for you if you do not have it already.
|
||||
|
||||
It is also an excellent utility to fix your USB drive if you cannot format it for an issue caused by other bootable USB creation tools.
|
||||
|
||||
Fret not, you can also select a custom image (apart from Fedora Linux) to create a bootable USB.
|
||||
|
||||
You can find the [Flatpak][5] package on Flathub for the latest version on any Linux distribution. Refer to our [Flatpak guide][6] if you’re new to this.
|
||||
|
||||
[Fedora Media Writer][7]
|
||||
|
||||
#### 3. Startup Disk Creator
|
||||
|
||||
![startup disk creator][8]
|
||||
|
||||
If you are using Ubuntu on your system, you already have a bootable USB creator pre-installed, i.e., Startup Disk Creator.
|
||||
|
||||
You can use it to select the desired ISO file (preferably any Ubuntu version) and choose the target USB device to proceed.
|
||||
|
||||
Once you confirm the action, it will proceed with writing the data to complete the bootable drive.
|
||||
|
||||
#### 4. SUSE Studio Imagewriter
|
||||
|
||||
![imagewriter suse][9]
|
||||
|
||||
SUSE Studio Imagewriter is a simple live USB creator.
|
||||
|
||||
I did not find it in the software center for Ubuntu, but it was available in the community repositories (Manjaro) and AUR. So, you can take a look at it if it is available for your Linux distribution.
|
||||
|
||||
[SUSE Studio Imagewriter][10]
|
||||
|
||||
#### 5. UNetbootin
|
||||
|
||||
![unetbootin][11]
|
||||
|
||||
UNetbootin is a live USB creator that supports Linux, Windows, and macOS. You get a few options to tweak, in case you want to explore all the available drives, and can also select a distribution to download the ISO file automatically.
|
||||
|
||||
It is not specific for any Linux distribution, unlike some options above. So, it supports a wide variety of distributions and system utilities.
|
||||
|
||||
[UNetbootin][12]
|
||||
|
||||
#### 6. Ventoy
|
||||
|
||||
![ventoy screenshot 2022][13]
|
||||
|
||||
Ventoy is an interesting bootable USB solution that lets you simply copy-paste the image to create a live USB drive.
|
||||
|
||||
You only have to install Ventoy to the USB drive, which makes two separate partitions. One of the partitions is used to store ISO images that you can simply paste into the USB drive to make it bootable.
|
||||
|
||||
Interestingly, you can also use it to [create multiboot USB][14].
|
||||
|
||||
It is available for Windows and Linux.
|
||||
|
||||
[Ventoy][15]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Ventoy seems like an exciting choice among the options above if you need multiple Linux distributions on your USB drive without needing to repeatedly flash it.
|
||||
|
||||
For simplicity, distro-specific tools can be a good pick, like Startup Disk Creator for Ubuntu, and Fedora Image Writer for Fedora Linux.
|
||||
|
||||
SUSE Image Studio is an interesting option, but may not be the most convenient one.
|
||||
|
||||
If you do not have any specific preferences, BalenaEtcher should be a straightforward option, with UNetbootin as a suitable alternative to it.
|
||||
|
||||
What do you prefer to create a bootable USB drive? Let me know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/live-usb-creator-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/06/balena-etcher-2022-800x537.png
|
||||
[2]: https://itsfoss.com/install-etcher-linux/
|
||||
[3]: https://www.balena.io/etcher/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/06/fedora-media-writer.png
|
||||
[5]: https://itsfoss.com/what-is-flatpak/
|
||||
[6]: https://itsfoss.com/flatpak-guide/
|
||||
[7]: https://flathub.org/apps/details/org.fedoraproject.MediaWriter
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/06/startup-disk-creator.png
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/06/imagewriter-suse.png
|
||||
[10]: https://software.opensuse.org/package/imagewriter
|
||||
[11]: https://itsfoss.com/wp-content/uploads/2022/06/unetbootin.png
|
||||
[12]: https://unetbootin.github.io/
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/06/ventoy-screenshot-2022.png
|
||||
[14]: https://itsfoss.com/multiple-linux-one-usb/
|
||||
[15]: https://www.ventoy.net/
|
@ -0,0 +1,154 @@
|
||||
[#]: subject: "Using Ansible to automate software installation on my Mac"
|
||||
[#]: via: "https://opensource.com/article/22/6/install-software-macos-ansible-homebrew"
|
||||
[#]: author: "Servesha Dudhgaonkar https://opensource.com/users/serveshadudhgaonkar"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Using Ansible to automate software installation on my Mac
|
||||
======
|
||||
In this demo, I install one of my must-have writing tools, Asciidoctor, on macOS using Ansible.
|
||||
|
||||
![Getting started with Perlbrew][1]
|
||||
|
||||
Image by: freephotocc via Pixabay CC0
|
||||
|
||||
On most systems, there are several ways to install software. Which one you use depends on the source of the application you're installing. Some software comes as a downloadable wizard to walk you through an install process, while others are files you just download and run immediately.
|
||||
|
||||
On macOS, a whole library of open source applications is available from Unix commands like [Homebrew][2] and [MacPorts][3]. The advantage of using commands for software installation is that you can automate them, and my favorite tool for automation is Ansible. Combining Ansible with Homebrew is an efficient and reproducible way to install your favorite open source applications.
|
||||
|
||||
This article demonstrates how to install one of my must-have writing tools, Asciidoctor, on macOS using Ansible. Asciidoctor is an open source text processor, meaning that it takes text written in a specific format (in this case, Asciidoc) and transforms it into other popular formats (such as HTML, PDF, and so on) for publishing. Ansible is an open source, agentless, and easy-to-understand automation tool. By using Ansible, you can simplify and automate your day-to-day tasks.
|
||||
|
||||
Note: While this example uses macOS, the information applies to all kinds of open source software on all platforms compatible with Ansible (including Linux, Windows, Mac, and BSD).
|
||||
|
||||
### Installing Ansible
|
||||
|
||||
You can install Ansible using `pip`, the Python package manager. First, install `pip` :
|
||||
|
||||
```
|
||||
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
$ python ./get-pip.py
|
||||
```
|
||||
|
||||
Next, install Ansible using `pip` :
|
||||
|
||||
```
|
||||
$ sudo python -m pip install --user ansible
|
||||
```
|
||||
|
||||
#### Installing Ansible using Homebrew
|
||||
|
||||
Alternately, you can install Ansible using the [Homebrew package manager][4]. If you've already installed Ansible with `pip`, skip this step because you've already achieved the same result!
|
||||
|
||||
```
|
||||
$ brew install ansible
|
||||
```
|
||||
|
||||
### Configuring Ansible
|
||||
|
||||
To set up Ansible, you first must create an inventory file specifying which computer or computers you want your Ansible script (called a playbook) to operate on.
|
||||
|
||||
Create an inventory file in a terminal or using your favorite text editor. In a terminal, type the following, replacing `your-host-name` with the name of your computer:
|
||||
|
||||
```
|
||||
$ cat << EOF >> inventory
|
||||
[localhost\]
|
||||
your-host-name
|
||||
EOF
|
||||
```
|
||||
|
||||
If you don't know your computer's hostname, you can get it using the `hostname` command. Alternately, go to the Apple menu, open System Preferences, then click Sharing. Your computer's hostname is beneath the computer name at the top of Sharing preference pane.
|
||||
|
||||
### Installing Asciidoctor using Ansible
|
||||
|
||||
In this example, I'm only installing applications on the computer I'm working on, which is also known by the term localhost. To start, create a `playbook.yml` file and copy the following content:
|
||||
|
||||
```
|
||||
- name: Install software
|
||||
hosts: localhost
|
||||
become: false
|
||||
vars:
|
||||
Brew_packages:
|
||||
- asciidoctor
|
||||
install_homebrew_if_missing: false
|
||||
```
|
||||
|
||||
In the first [YAML sequence][5], you name the playbook (`Install software` ), provide the target (`localhost` ), and confirm that administrative privileges are not required. You also create two variables that you can use later in the playbook: `Brew_packages` and`install_homebrew_if_missing`.
|
||||
|
||||
Next, create a YAML mapping called `pre_tasks`, containing the logic to ensure that Homebrew itself is installed on the computer where you're running the playbook. Normally, Ansible can verify whether an application is installed or not, but when that application is the package manager that helps Ansible make that determination in the first place, you have to do it manually:
|
||||
|
||||
```
|
||||
pre_tasks:
|
||||
- name: Ensuring Homebrew Is Installed
|
||||
stat:
|
||||
path: /usr/local/bin/brew
|
||||
register: homebrew_check
|
||||
|
||||
- name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
|
||||
fail:
|
||||
msg: Homebrew is missing, install from http://brew.sh
|
||||
when:
|
||||
- not homebrew_check.stat.exists
|
||||
- not install_homebrew_if_missing
|
||||
|
||||
- name: Installing Homebrew
|
||||
shell: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
when:
|
||||
- not homebrew_check.stat.exists
|
||||
- install_homebrew_if_missing
|
||||
```
|
||||
|
||||
Finally, create a YAML mapping called `tasks` containing a call to the Homebrew module (it's a built-in module from Ansible) to install Asciidoctor in the event that it's not already present:
|
||||
|
||||
```
|
||||
tasks:
|
||||
- name: Install Asciidoctor
|
||||
homebrew:
|
||||
name: asciidoctor
|
||||
state: present
|
||||
```
|
||||
|
||||
### Running an Ansible playbook
|
||||
|
||||
You run an Ansible playbook using the `ansible-playbook` command:
|
||||
|
||||
```
|
||||
$ ansible-playbook -i inventory playbook.yml
|
||||
```
|
||||
|
||||
The `-i` option specifies the `inventory` file you created when setting up Ansible. You can optionally add `-vvvv` to direct Ansible to be extra verbose when running the playbook, which can be useful when troubleshooting.
|
||||
|
||||
After the playbook has run, verify that Ansible has successfully installed Asciidoctor on your host:
|
||||
|
||||
```
|
||||
$ asciidoctor -v
|
||||
Asciidoctor X.Y.Z https://asciidoctor.org
|
||||
Runtime Environment (ruby 2.6.8p205 (2021-07-07 revision 67951)...
|
||||
```
|
||||
|
||||
### Adapt for automation
|
||||
|
||||
You can add more software to the `Brew_packages` variable in this article's example playbook. As long as there's a Homebrew package available, Ansible installs it. Ansible only takes action when required, so you can leave all the packages you install in the playbook, effectively building a manifest of all the packages you have come to expect on your computer.
|
||||
|
||||
Should you find yourself on a different computer, perhaps because you're at work or you've purchased a new one, you can quickly install all the same applications in one go. Better still, should you switch to Linux, the Ansible playbook is still valid either by using Homebrew for Linux or by making a few simple updates to switch to a different package manager.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/install-software-macos-ansible-homebrew
|
||||
|
||||
作者:[Servesha Dudhgaonkar][a]
|
||||
选题:[lkxed][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/serveshadudhgaonkar
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/coffee_cafe_brew_laptop_desktop.jpg
|
||||
[2]: https://opensource.com/article/20/6/homebrew-mac
|
||||
[3]: https://opensource.com/article/20/11/macports
|
||||
[4]: https://opensource.com/article/20/6/homebrew-mac
|
||||
[5]: https://www.redhat.com/sysadmin/yaml-beginners
|
@ -0,0 +1,95 @@
|
||||
[#]: subject: "WiFi 6 Promises Much More than Faster Speeds"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/"
|
||||
[#]: author: "Sharon Katta https://www.opensourceforu.com/author/sharon-katta/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
WiFi 6 Promises Much More than Faster Speeds
|
||||
======
|
||||
WiFi 6 increases the network connectivity, and has been developed to ensure the trillions of devices connected in the near future continue to work seamlessly and efficiently. Though it was certified in 2019, it faced a few challenges in testing due to the pandemic. This article gives an overview of this technology.
|
||||
|
||||
![WiFi-6][1]
|
||||
|
||||
The next-generation standard in WiFi technology, termed ‘WiFi 6’, is also known as ‘AX WiFi’ or ‘802.11ax’. Developed to meet the exponential increase in demand for devices in the world, it can be used for virtual reality (VR) and smart home devices as well. It is an improvement on the current 802.11ac WiFi standard and meets current challenges in terms of capacity, efficiency, coverage and performance.
|
||||
|
||||
![Figure 1: WiFi 6][2]
|
||||
|
||||
Researched in 2014, this standard was invented in 2018 and launched by the IEEE High Efficiency WLAN Study Group (HEW SG). It began certifications in late 2019, with Samsung’s Galaxy Note 10 and Ruckus R750 employing this technology. Specified to operate between the 1GHz and 6GHz bands, WiFi 6 focuses mainly between the 2.4GHz and 5GHz frequencies.
|
||||
|
||||
In an average household today, nine devices are connected to WiFi. WiFi 6 aims at improving the network rather than boosting the speed for individual devices.
|
||||
|
||||
### Features of WiFi 6
|
||||
|
||||
**Multi-user, multi-input, multi-output (MU-MIMO):** This communication between routers and multiple devices concurrently. It supports four simultaneous data streams, added to which one user can have a considerable bandwidth of incoming data from a smart router, both on the 2.4GHz and 5GHz frequencies.
|
||||
**1024-QAM:** This helps WiFi 6 encode more bits per packet. There is a 25 per cent increase in throughput. Not only does it improve efficiency in high-traffic situations, it also maximises data rates. This is a huge advantage for modern enterprise applications.
|
||||
**Orthogonal frequency-division multiplexing (OFDM):** This allows four times as many subcarriers and increases speed by 11 per cent. The expanded signal allows for greater simultaneous packet delivery across users. Hence, the wait time between packets and latency is reduced.
|
||||
*Increased channel width:* The 160MHz channel communication is added to the 80MHz band, thus doubling the channel width. This allows routers to handle more users and provide larger streams per user.
|
||||
*Target wake time (TWT):* This feature is unique to WiFi 6. It allows each device to independently negotiate wake time for transmission and reception. This helps to increase total sleep time and maximise battery life. TWT enables many additional networking options, especially for IoT devices.
|
||||
*Improved security:* All WiFi 6 devices will need to include Wi-Fi Protected Access 3 (WPA3). This will lead to encryption of unauthenticated traffic, robust password protection against brute-force dictionary attacks, and superior data reliability for sensitive information with 192-bit encryption.
|
||||
*Beamforming:* With eight support antennas, beamforming helps to improve data rates, and the range is extended by directing signals towards specific clients at once. It offers a backup for rapidly moving devices that may face issues with MU-MIMO. Beamforming also helps to control transmissions from antennas that cause signals to interfere on purpose. The signal can then be redirected to a new direction.
|
||||
|
||||
### Devices that support WiFi 6
|
||||
|
||||
Until recently, WiFi 5 was the standard used for routers, repeaters, mesh networks and many WiFi clients. WiFi 6 was launched in 2019. There will be some compatibility issues for the earlier devices that supported WiFi 5 — they will be able to utilise the WiFi 6 network but not be able to receive support for the same.
|
||||
|
||||
WiFi 6 routers are backward-compatible, and it is better to make sure that the network is ready for that.
|
||||
|
||||
WiFi 6 enables lower battery consumption, making it a great choice for any environment, including the Internet of Things (IoT). It reduces unnecessary data activity, and tells devices when to put their data to sleep and when to be active. As a result, unnecessary data activity is reduced, and performance and battery life are maximised.
|
||||
|
||||
The Samsung Galaxy Note 10 and Ruckus R750 were the world’s first smartphone and access point certified to support Wi-Fi 6, with the latest generation of the Apple iPhone following suit. The Wi-Fi Alliance has set up its certification programme, and new wireless products hitting the market are expected to start applying for compliance certification. The devices listed below are already WiFi 6 enabled:
|
||||
|
||||
* iPhone 11 and after
|
||||
* Samsung Galaxy S10, S20, Note 10, and Note 20
|
||||
* Apple computers with M1 processors
|
||||
* Smart TVs
|
||||
|
||||
> To take advantage of the improvements in the 802.11ax standard fully, both hardware and software functionalities have to be built on this WiFi technology.
|
||||
|
||||
### Hardware testing
|
||||
|
||||
To unlock the full potential of the latest devices, a WiFi 6 router is needed to run the network. This was an expensive affair a few years ago, but now we have a number of options even for mesh systems, gaming routers, range extenders, and more. The best purchase can be made only when hands-on testing is done. Beating all its competitors, the current king in terms of speed for WiFi 6 routers is TP-Link Archer AX6000. This router was able to transmit data wirelessly at a rate of 1523 Mbps up to a distance of 1.5 metres (5 feet).
|
||||
|
||||
One important thing to remember here is that these routers do not magically increase speeds. The theoretical maximum of achieving 9.6 Gbps is unlikely. This high theoretical speed can be split up across a whole network of devices.
|
||||
|
||||
WiFi 6 emphasises quality connectivity in areas where connected devices are densely populated. It does not increase the speed of each device exponentially but ensures these operate at an optimum level.
|
||||
|
||||
Only the combination of a faster plan from the Internet service providers (ISPs) along with the WiFi 6 router, can fulfil its true potential. The real challenge is for the ISPs, as they need new fibre rollouts to capitalise on this next-gen technology. An important question is: when faster ISP speeds come, will the existing hardware become redundant?
|
||||
|
||||
### Applications of WiFi 6
|
||||
|
||||
**Large public venues (LPVs):** Stadiums and convention centres are a few of the common areas where thousands of devices connect to WiFi at the same time. WiFi 6 can help to improve attendee experiences, increase customer interactions, and create value-added services like viewing instant replays or ordering food from one’s seat at an event. WiFi 6 allows LPV owners to create new business opportunities.
|
||||
**Transport hubs:** Public transport stations are also an area where people attempt to connect to the network simultaneously. OFDMA and BSS colouring in WiFi 6 provide the necessary tools needed to overcome this challenge.
|
||||
**IoT and smart city deployments:** Power efficiencies in WiFi 6 enable IoT devices to go into sleep mode and turn on their transmitters at predefined intervals to prolong field time without much maintenance.
|
||||
**Education:** Libraries, auditoriums, and lecture halls at college and university campuses have the highest density of WiFi users during the day, and almost no one at night. WiFi 6 is a perfect choice in this situation.
|
||||
|
||||
### The challenges
|
||||
|
||||
WiFi 6 does not promise an increase in speed, but is an upgrade designed to make sure the speeds of our devices within a given range/area doesn’t slow down a few years down the road. There are three major challenges it faces though, which are often overlooked.
|
||||
Improving the functionality of unsupported devices: Even though WiFi 6 is backward- compatible, justice to it can only be done when this technology is used to the maximum. This means devices need to be upgraded each time.
|
||||
|
||||
Speed and performance outside the internal network: WiFi 6 can provide excellent connectivity for services like cloud file shares. However, the assets and resources of ISPs can affect speed and performance.
|
||||
|
||||
*Coverage issues:* Transmission and bandwidths are capped according to the regulations prevalent in each country. Hence, the coverage of WiFi 6 may be restricted to ensure this cap is met.
|
||||
|
||||
In spite of these challenges, companies like Aruba, Asus, AT&T, Boingo, Broadcom, Cisco, Comcast, CommScope, Cypress, Extreme Networks, Intel, Netgear, Orange, Qualcomm, TP-Link and Xiaomi are all focusing on the potential WiFi 6 has.
|
||||
|
||||
(LCTT 译注:选题删除了原文中的相关产品推荐部分。)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/
|
||||
|
||||
作者:[Sharon Katta][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/sharon-katta/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6-1.jpg
|
@ -0,0 +1,137 @@
|
||||
[#]: subject: "A guide to container orchestration with Kubernetes"
|
||||
[#]: via: "https://opensource.com/article/22/6/container-orchestration-kubernetes"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
A guide to container orchestration with Kubernetes
|
||||
======
|
||||
To learn all about container orchestration with Kubernetes, download our new eBook.
|
||||
|
||||
![CC-BY-SA William Kenlon http://www.williamkenlon.com][1]
|
||||
|
||||
Image by: William Kenlon. CC BY-SA 4.0
|
||||
|
||||
The term orchestration is relatively new to the IT industry, and it still has nuance that eludes or confuses people who don't spend all day orchestrating. When I describe orchestration to someone, it usually sounds like I'm just describing automation. That's not quite right. In fact, I wrote a whole article differentiating [automation and orchestration][2].
|
||||
|
||||
An easy way to think about it is that orchestration is just a form of automation. To understand how you can benefit from orchestration, it helps to understand what specifically it automates.
|
||||
|
||||
### Understanding containers
|
||||
|
||||
A container is an image of a file system containing only what's required to run a specific task. Most people don't build containers from scratch, although reading about [how it's done][3] can be elucidating. Instead, it's more common to pull an existing image from a public container hub.
|
||||
|
||||
A container engine is an application that runs a container. When a container is run, it's launched with a kernel mechanism called a `cgroup`, which keeps processes within the container separate from processes running outside the container.
|
||||
|
||||
### Run a container
|
||||
|
||||
You can run a container on your own Linux computer easily with [Podman][4], [Docker][5], or [LXC][6]. They all use similar commands. I recommend Podman, as it's daemonless, meaning a process doesn't have to be running all the time for a container to launch. With Podman, your container engine runs only when necessary. Assuming you have a container engine installed, you can run a container just by referring to a container image you know to exist on a public container hub.
|
||||
|
||||
For instance, to run an Nginx web server:
|
||||
|
||||
```
|
||||
$ podman run -p 8080:80 nginx
|
||||
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
|
||||
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
|
||||
[...]
|
||||
```
|
||||
|
||||
Open a separate terminal to test it using [curl][7]:
|
||||
|
||||
```
|
||||
$ curl --no-progress-meter localhost:8080 | html2text
|
||||
# Welcome to nginx!
|
||||
|
||||
If you see this page, the nginx web server is successfully installed and
|
||||
working. Further configuration is required.
|
||||
|
||||
For online documentation and support please refer to
|
||||
[nginx.org](http://nginx.org/).
|
||||
Commercial support is available at [nginx.com](http://nginx.com/).
|
||||
|
||||
_Thank you for using nginx._
|
||||
```
|
||||
|
||||
As web server installs go, that's pretty easy.
|
||||
|
||||
Now imagine that the website you've just deployed gets an unexpected spike in traffic. You hadn't planned for that, and even though Nginx is a very resilient web server, everything has its limits. With enough simultaneous traffic, even Nginx can crash. Now what?
|
||||
|
||||
### Sustaining containers
|
||||
|
||||
Containers are cheap. In other words, as you've just experienced, they're trivial to launch.
|
||||
|
||||
You can use systemd to make a container resilient, too, so that a container automatically relaunches even in the event of a crash. This is where using Podman comes in handy. Podman has a command to generate a systemd service file based on an existing container:
|
||||
|
||||
```
|
||||
$ podman create --name mynginx -p 8080:80 nginx
|
||||
$ podman generate systemd mynginx \
|
||||
--restart-policy=always -t 5 -f -n
|
||||
```
|
||||
|
||||
You can launch your container service as a regular user:
|
||||
|
||||
```
|
||||
$ mkdir -p ~/.config/systemd/user
|
||||
$ mv ./container-mynginx.service ~/.config/systemd/user/
|
||||
$ systemctl enable --now --user container-mynginx.service
|
||||
$ curl --head localhost:8080 | head -n1
|
||||
HTTP/1.1 200 OK
|
||||
```
|
||||
|
||||
### Run pods of containers
|
||||
|
||||
Because containers are cheap, you can readily launch more than one container to meet the demand for your service. With two (or more) containers offering the same service, you increase the likelihood that better distribution of labor will successfully manage incoming requests.
|
||||
|
||||
You can group containers together in pods, which Podman (as its name suggests) can create:
|
||||
|
||||
```
|
||||
$ systemctl stop --user container-myngnix
|
||||
$ podman run -dt --pod new:mypod -p 8080:80 nginx
|
||||
$ podman pod ps
|
||||
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
|
||||
26424cc... mypod Running 22m ago e25b3... 2
|
||||
```
|
||||
|
||||
This can also be automated using systemd:
|
||||
|
||||
```
|
||||
$ podman generate systemd mypod \
|
||||
--restart-policy=always -t 5 -f -n
|
||||
```
|
||||
|
||||
### Clusters of pods and containers
|
||||
|
||||
It's probably clear that containers offer diverse options for how you deploy networked applications and services, especially when you use the right tools to manage them. Both Podman and systemd integrate with containers very effectively, and they can help ensure that your containers are available when they're needed.
|
||||
|
||||
But you don't really want to sit in front of your servers all day and all night just so you can manually add containers to pods any time the whole internet decides to pay you a visit. Even if you could do that, containers are only as robust as the computer they run on. Eventually, containers running on a single server do exhaust that server's bandwidth and memory.
|
||||
|
||||
The solution is a Kubernetes cluster: lots of servers, with one acting as a "control plane" where all configuration is entered and many, many others acting as compute nodes to ensure your containers have all the resources they need. Kubernetes is a big project, and there are many other projects, like [Terraform][8], [Helm][9], and [Ansible][10], that interface with Kubernetes to make common tasks scriptable and easy. It's an important topic for all levels of systems administrators, architects, and developers.
|
||||
|
||||
To learn all about container orchestration with Kubernetes, download our free eBook: **[A guide to orchestration with Kubernetes][11]**. The guide teaches you how to set up a local virtual cluster, deploy an application, set up a graphical interface, understand the YAML files used to configure Kubernetes, and more.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/container-orchestration-kubernetes
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/kenlon-music-conducting-orchestra.png
|
||||
[2]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[3]: https://opensource.com/article/22/2/build-your-own-container-linux-buildah
|
||||
[4]: https://opensource.com/article/18/12/podman-and-user-namespaces
|
||||
[5]: https://opensource.com/business/14/8/docker-beginner-guide
|
||||
[6]: https://opensource.com/article/18/11/behind-scenes-linux-containers
|
||||
[7]: https://opensource.com/article/20/5/curl-cheat-sheet
|
||||
[8]: https://opensource.com/article/20/7/terraform-kubernetes
|
||||
[9]: https://opensource.com/article/20/3/helm-kubernetes-charts
|
||||
[10]: https://opensource.com/article/22/1/learn-ansible
|
||||
[11]: https://opensource.com/downloads/guide-orchestration-kubernetes
|
374
sources/tech/20220610 Handling maps in Groovy vs Java.md
Normal file
374
sources/tech/20220610 Handling maps in Groovy vs Java.md
Normal file
@ -0,0 +1,374 @@
|
||||
[#]: subject: "Handling maps in Groovy vs Java"
|
||||
[#]: via: "https://opensource.com/article/22/6/maps-groovy-vs-java"
|
||||
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Handling maps in Groovy vs Java
|
||||
======
|
||||
Discover the differences in map handling between Groovy and Java with this hands-on demo.
|
||||
|
||||
![women programming][1]
|
||||
|
||||
Image by: WOCinTech Chat. Modified by Opensource.com. CC BY-SA 4.0
|
||||
|
||||
Java is a great programming language, but sometimes I want a Java-like language that's just a bit more flexible and compact. That's when I opt for [Groovy][2].
|
||||
|
||||
In a recent article, I reviewed some of the differences between [creating and initializing maps in Groovy][3] and doing the same thing in Java. In brief, Groovy has a concise syntax for setting up maps and accessing map entries compared to the effort necessary in Java.
|
||||
|
||||
This article will delve into more differences in map handling between Groovy and Java. For that purpose, I will use the [sample table of employees][4] used for demoing the JavaScript DataTables library. To follow along, start by making sure you have recent versions of Groovy and Java installed on your computer.
|
||||
|
||||
### Install Java and Groovy
|
||||
|
||||
Groovy is based on Java and requires a Java installation as well. A recent and/or decent version of Java and Groovy might already be in your Linux distribution's repositories, or you can download and install Groovy from the [Apache Groovy website][5]. A good option for Linux users is [SDKMan][6], which can be used to get multiple versions of Java, Groovy, and many other related tools. For this article, I'm using SDK's releases of:
|
||||
|
||||
* Java: version 11.0.12-open of OpenJDK 11
|
||||
* Groovy: version 3.0.8.
|
||||
|
||||
### Back to the problem: maps
|
||||
|
||||
First, in my experience, maps and lists (or at least arrays) often end up in the same program. For example, processing an input file is very similar to passing over a list; often, I do that when I want to categorize data encountered in the input file (or list), storing some kind of value in lookup tables, which are just maps.
|
||||
|
||||
Second, Java 8 introduced the whole Streams functionality and lambdas (or anonymous functions). In my experience, converting input data (or lists) into maps often involves using Java Streams. Moreover, Java Streams are at their most flexible when dealing with streams of typed objects, providing grouping and accumulation facilities out of the box.
|
||||
|
||||
### Employee list processing in Java
|
||||
|
||||
Here's a concrete example based on those fictitious employee records. Below is a Java program that defines an Employee class to hold the employee information, builds a list of Employee instances, and processes that list in a few different ways:
|
||||
|
||||
```
|
||||
1 import java.lang.*;
|
||||
2 import java.util.Arrays;
|
||||
|
||||
3 import java.util.Locale;
|
||||
4 import java.time.format.DateTimeFormatter;
|
||||
5 import java.time.LocalDate;
|
||||
6 import java.time.format.DateTimeParseException;
|
||||
7 import java.text.NumberFormat;
|
||||
8 import java.text.ParseException;
|
||||
|
||||
9 import java.util.stream.Collectors;
|
||||
|
||||
10 public class Test31 {
|
||||
|
||||
11 static public void main(String args[]) {
|
||||
|
||||
12 var employeeList = Arrays.asList(
|
||||
13 new Employee("Tiger Nixon", "System Architect",
|
||||
14 "Edinburgh", "5421", "2011/04/25", "$320,800"),
|
||||
15 new Employee("Garrett Winters", "Accountant",
|
||||
6 "Tokyo", "8422", "2011/07/25", "$170,750"),
|
||||
...
|
||||
|
||||
81 new Employee("Martena Mccray", "Post-Sales support",
|
||||
82 "Edinburgh", "8240", "2011/03/09", "$324,050"),
|
||||
83 new Employee("Unity Butler", "Marketing Designer",
|
||||
84 "San Francisco", "5384", "2009/12/09", "$85,675")
|
||||
85 );
|
||||
|
||||
86 // calculate the average salary across the entire company
|
||||
|
||||
87 var companyAvgSal = employeeList.
|
||||
88 stream().
|
||||
89 collect(Collectors.averagingDouble(Employee::getSalary));
|
||||
90 System.out.println("company avg salary = " + companyAvgSal);
|
||||
|
||||
91 // calculate the average salary for each location,
|
||||
92 // compare to the company average
|
||||
|
||||
93 var locationAvgSal = employeeList.
|
||||
94 stream().
|
||||
95 collect(Collectors.groupingBy((Employee e) ->
|
||||
96 e.getLocation(),
|
||||
97 Collectors.averagingDouble(Employee::getSalary)));
|
||||
98 locationAvgSal.forEach((k,v) ->
|
||||
99 System.out.println(k + " avg salary = " + v +
|
||||
100 "; diff from avg company salary = " +
|
||||
101 (v - companyAvgSal)));
|
||||
|
||||
102 // show the employees in Edinburgh approach #1
|
||||
|
||||
103 System.out.print("employee(s) in Edinburgh (approach #1):");
|
||||
104 var employeesInEdinburgh = employeeList.
|
||||
105 stream().
|
||||
106 filter(e -> e.getLocation().equals("Edinburgh")).
|
||||
107 collect(Collectors.toList());
|
||||
108 employeesInEdinburgh.
|
||||
109 forEach(e ->
|
||||
110 System.out.print(" " + e.getSurname() + "," +
|
||||
111 e.getGivenName()));
|
||||
112 System.out.println();
|
||||
|
||||
|
||||
113 // group employees by location
|
||||
|
||||
114 var employeesByLocation = employeeList.
|
||||
115 stream().
|
||||
116 collect(Collectors.groupingBy(Employee::getLocation));
|
||||
|
||||
117 // show the employees in Edinburgh approach #2
|
||||
|
||||
118 System.out.print("employee(s) in Edinburgh (approach #2):");
|
||||
119 employeesByLocation.get("Edinburgh").
|
||||
120 forEach(e ->
|
||||
121 System.out.print(" " + e.getSurname() + "," +
|
||||
122 e.getGivenName()));
|
||||
123 System.out.println();
|
||||
|
||||
124 }
|
||||
125 }
|
||||
|
||||
126 class Employee {
|
||||
127 private String surname;
|
||||
128 private String givenName;
|
||||
129 private String role;
|
||||
130 private String location;
|
||||
131 private int extension;
|
||||
132 private LocalDate hired;
|
||||
133 private double salary;
|
||||
|
||||
134 public Employee(String fullName, String role, String location,
|
||||
135 String extension, String hired, String salary) {
|
||||
136 var nn = fullName.split(" ");
|
||||
137 if (nn.length > 1) {
|
||||
138 this.surname = nn[1];
|
||||
139 this.givenName = nn[0];
|
||||
140 } else {
|
||||
141 this.surname = nn[0];
|
||||
142 this.givenName = "";
|
||||
143 }
|
||||
144 this.role = role;
|
||||
145 this.location = location;
|
||||
146 try {
|
||||
147 this.extension = Integer.parseInt(extension);
|
||||
148 } catch (NumberFormatException nfe) {
|
||||
149 this.extension = 0;
|
||||
150 }
|
||||
151 try {
|
||||
152 this.hired = LocalDate.parse(hired,
|
||||
153 DateTimeFormatter.ofPattern("yyyy/MM/dd"));
|
||||
154 } catch (DateTimeParseException dtpe) {
|
||||
155 this.hired = LocalDate.EPOCH;
|
||||
156 }
|
||||
157 try {
|
||||
158 this.salary = NumberFormat.getCurrencyInstance(Locale.US).
|
||||
159 parse(salary).doubleValue();
|
||||
160 } catch (ParseException pe) {
|
||||
161 this.salary = 0d;
|
||||
162 }
|
||||
163 }
|
||||
|
||||
164 public String getSurname() { return this.surname; }
|
||||
165 public String getGivenName() { return this.givenName; }
|
||||
166 public String getLocation() { return this.location; }
|
||||
167 public int getExtension() { return this.extension; }
|
||||
168 public LocalDate getHired() { return this.hired; }
|
||||
169 public double getSalary() { return this.salary; }
|
||||
170 }
|
||||
```
|
||||
|
||||
Wow, that's a lot of code for a simple demo program! I'll go through it in chunks first.
|
||||
|
||||
Starting at the end, lines 126 through 170 define the `Employee` class used to store employee data. The most important thing to mention here is that the fields of the employee record are of different types, and in Java that generally leads to defining this type of class. You could make this code a bit more compact by using [Project Lombok's @Data][7] annotation to automatically generate the getters (and setters) for the `Employee` class. In more recent versions of Java, I can declare these sorts of things as a record rather than a class, since the whole point is to store data. Storing the data as a list of `Employee` instances facilitates the use of Java streams.
|
||||
|
||||
Lines 12 through 85 create the list of `Employee` instances, so now you've already dealt with 119 of 170 lines.
|
||||
|
||||
There are nine lines of import statements up front. Interestingly, there are no map-related imports! This is partly because I'm using stream methods that yield maps as their results, and partly because I'm using the `var` keyword to declare variables, so the type is inferred by the compiler.
|
||||
|
||||
The interesting parts of the above code happen in lines 86 through 123.
|
||||
|
||||
In lines 87-90, I convert `employeeList` into a stream (line 88) and then use `collect()` to apply the `Collectors.averagingDouble()` method to the `Employee::getSalary` (line 89) method to calculate the average salary across the whole company. This is pure functional list processing; no maps are involved.
|
||||
|
||||
In lines 93-101, I convert `employeeList` into a stream again. I then use the `Collectors.groupingBy()` method to create a map whose keys are employee locations, returned by `e.getLocation()`, and whose values are the average salary for each location, returned by `Collectors.averagingDouble()` again applied to the `Employee::getSalary` method applied to each employee in the location subset, rather than the entire company. That is, the `groupingBy()` method creates subsets by location, which are then averaged. Lines 98-101 use `forEach()` to step through the map entries printing location, average salary, and the difference between the location averages and company average.
|
||||
|
||||
Now, suppose you wanted to look at just those employees located in Edinburgh. One way to accomplish this is shown in lines 103-112, where I use the stream `filter()` method to create a list of only those employees based in Edinburgh and the `forEach()` method to print their names. No maps here, either.
|
||||
|
||||
Another way to solve this problem is shown in lines 113-123. In this method, I create a map where each entry holds a list of employees by location. First, in lines 113-116, I use the `groupingBy()` method to produce the map I want with keys of employee locations whose values are sublists of employees at that location. Then, in lines 117-123, I use the `forEach()` method to print out the sublist of names of employees at the Edinburgh location.
|
||||
|
||||
When we compile and run the above, the output is:
|
||||
|
||||
```
|
||||
company avg salary = 292082.5
|
||||
San Francisco avg salary = 284703.125; diff from avg company salary = -7379.375
|
||||
New York avg salary = 410158.3333333333; diff from avg company salary = 118075.83333333331
|
||||
Singapore avg salary = 357650.0; diff from avg company salary = 65567.5
|
||||
Tokyo avg salary = 206087.5; diff from avg company salary = -85995.0
|
||||
London avg salary = 322476.25; diff from avg company salary = 30393.75
|
||||
Edinburgh avg salary = 261940.7142857143; diff from avg company salary = -30141.78571428571
|
||||
Sydney avg salary = 90500.0; diff from avg company salary = -201582.5
|
||||
employee(s) in Edinburgh (approach #1): Nixon,Tiger Kelly,Cedric Frost,Sonya Flynn,Quinn Rios,Dai Joyce,Gavin Mccray,Martena
|
||||
employee(s) in Edinburgh (approach #2): Nixon,Tiger Kelly,Cedric Frost,Sonya Flynn,Quinn Rios,Dai Joyce,Gavin Mccray,Martena
|
||||
```
|
||||
|
||||
### Employee list processing in Groovy
|
||||
|
||||
Groovy has always provided enhanced facilities for processing lists and maps, partly by extending the Java Collections library and partly by providing closures, which are somewhat like lambdas.
|
||||
|
||||
One outcome of this is that maps in Groovy can easily be used with different types of values. As a result, you can't be pushed into making the auxiliary Employee class; instead, you can just use a map. Let's examine a Groovy version of the same functionality:
|
||||
|
||||
```
|
||||
1 import java.util.Locale
|
||||
2 import java.time.format.DateTimeFormatter
|
||||
3 import java.time.LocalDate
|
||||
4 import java.time.format.DateTimeParseException
|
||||
5 import java.text.NumberFormat
|
||||
6 import java.text.ParseException
|
||||
|
||||
7 def employeeList = [
|
||||
8 ["Tiger Nixon", "System Architect", "Edinburgh",
|
||||
9 "5421", "2011/04/25", "\$320,800"],
|
||||
10 ["Garrett Winters", "Accountant", "Tokyo",
|
||||
11 "8422", "2011/07/25", "\$170,750"],
|
||||
|
||||
...
|
||||
|
||||
76 ["Martena Mccray", "Post-Sales support", "Edinburgh",
|
||||
77 "8240", "2011/03/09", "\$324,050"],
|
||||
78 ["Unity Butler", "Marketing Designer", "San Francisco",
|
||||
79 "5384", "2009/12/09", "\$85,675"]
|
||||
80 ].collect { ef ->
|
||||
81 def surname, givenName, role, location, extension, hired, salary
|
||||
82 def nn = ef[0].split(" ")
|
||||
83 if (nn.length > 1) {
|
||||
84 surname = nn[1]
|
||||
85 givenName = nn[0]
|
||||
86 } else {
|
||||
87 surname = nn[0]
|
||||
88 givenName = ""
|
||||
89 }
|
||||
90 role = ef[1]
|
||||
91 location = ef[2]
|
||||
92 try {
|
||||
93 extension = Integer.parseInt(ef[3]);
|
||||
94 } catch (NumberFormatException nfe) {
|
||||
95 extension = 0;
|
||||
96 }
|
||||
97 try {
|
||||
98 hired = LocalDate.parse(ef[4],
|
||||
99 DateTimeFormatter.ofPattern("yyyy/MM/dd"));
|
||||
100 } catch (DateTimeParseException dtpe) {
|
||||
101 hired = LocalDate.EPOCH;
|
||||
102 }
|
||||
103 try {
|
||||
104 salary = NumberFormat.getCurrencyInstance(Locale.US).
|
||||
105 parse(ef[5]).doubleValue();
|
||||
106 } catch (ParseException pe) {
|
||||
107 salary = 0d;
|
||||
108 }
|
||||
109 [surname: surname, givenName: givenName, role: role,
|
||||
110 location: location, extension: extension, hired: hired, salary: salary]
|
||||
111 }
|
||||
|
||||
112 // calculate the average salary across the entire company
|
||||
|
||||
113 def companyAvgSal = employeeList.average { e -> e.salary }
|
||||
114 println "company avg salary = " + companyAvgSal
|
||||
|
||||
115 // calculate the average salary for each location,
|
||||
116 // compare to the company average
|
||||
|
||||
117 def locationAvgSal = employeeList.groupBy { e ->
|
||||
118 e.location
|
||||
119 }.collectEntries { l, el ->
|
||||
120 [l, el.average { e -> e.salary }]
|
||||
121 }
|
||||
122 locationAvgSal.each { l, a ->
|
||||
123 println l + " avg salary = " + a +
|
||||
124 "; diff from avg company salary = " + (a - companyAvgSal)
|
||||
125 }
|
||||
|
||||
126 // show the employees in Edinburgh approach #1
|
||||
|
||||
127 print "employee(s) in Edinburgh (approach #1):"
|
||||
128 def employeesInEdinburgh = employeeList.findAll { e ->
|
||||
129 e.location == "Edinburgh"
|
||||
130 }
|
||||
131 employeesInEdinburgh.each { e ->
|
||||
132 print " " + e.surname + "," + e.givenName
|
||||
133 }
|
||||
134 println()
|
||||
|
||||
135 // group employees by location
|
||||
|
||||
136 def employeesByLocation = employeeList.groupBy { e ->
|
||||
137 e.location
|
||||
138 }
|
||||
|
||||
139 // show the employees in Edinburgh approach #2
|
||||
|
||||
140 print "employee(s) in Edinburgh (approach #1):"
|
||||
141 employeesByLocation["Edinburgh"].each { e ->
|
||||
142 print " " + e.surname + "," + e.givenName
|
||||
143 }
|
||||
144 println()
|
||||
```
|
||||
|
||||
Because I am just writing a script here, I don't need to put the program body inside a method inside a class; Groovy handles that for us.
|
||||
|
||||
In lines 1-6, I still need to import the classes needed for the data parsing. Groovy imports quite a bit of useful stuff by default, including `java.lang.*` and `java.util.*`.
|
||||
|
||||
In lines 7-90, I use Groovy's syntactic support for lists as comma-separated values bracketed by `[` and `]`. In this case, there is a list of lists; each sublist is the employee data. Notice that you need the `\` in front of the `$` in the salary field. This is because a `$` occurring inside a string surrounded by double quotes indicates the presence of a field whose value is to be interpolated into the string. An alternative would be to use single quotes.
|
||||
|
||||
But I don't want to work with a list of lists; I would rather have a list of maps analogous to the list of Employee class instances in the Java version. I use the Groovy Collection`.collect()` method in lines 90-111 to take apart each sublist of employee data and convert it into a map. The collect method takes a Groovy Closure argument, and the syntax for creating a closure surrounds the code with `{` and `}` and lists the parameters as `a, b, c ->` in a manner similar to Java's lambdas. Most of the code looks quite similar to the constructor method in the Java Employee class, except that there are items in the sublist rather than arguments to the constructor. However, the last two lines—
|
||||
|
||||
```
|
||||
[surname: surname, givenName: givenName, role: role,
|
||||
|
||||
location: location, extension: extension, hired: hired, salary: salary]
|
||||
```
|
||||
|
||||
—create a map with keys `surname`, `givenName`, `role`, `location`, `extension`, `hired`, and `salary`. And, since this is the last line of the closure, the value returned to the caller is this map. No need for a return statement. No need to quote these key values; Groovy assumes they are strings. In fact, if they were variables, you would need to put them in parentheses to indicate the need to evaluate them. The value assigned to each key appears on its right side. Note that this is a map whose values are of different types: The first four are `String`, then `int`, `LocalDate`, and `double`. It would have been possible to define the sublists with elements of those different types, but I chose to take this approach because the data would often be read in as string values from a text file.
|
||||
|
||||
The interesting bits appear in lines 112-144. I've kept the same kind of processing steps as in the Java version.
|
||||
|
||||
In lines 112-114, I use the Groovy Collection `average()` method, which like `collect()` takes a Closure argument, here iterating over the list of employee maps and picking out the `salary` value. Note that using these methods on the Collection class means you don't have to learn how to transform lists, maps, or some other element to streams and then learn the stream methods to handle your calculations, as in Java. For those who like Java Streams, they are available in newer Groovy versions.
|
||||
|
||||
In lines 115-125, I calculate the average salary by location. First, in lines 117-119, I transform `employeeList`, which is a list of maps, into a map, using the Collection`groupBy()` method, whose keys are the location values and whose values are linked sublists of the employee maps pertaining to that location. Then I process those map entries with the `collectEntries()` method, using the `average()` method to compute the average salary for each location.
|
||||
|
||||
Note that `collectEntries()` passes each key (location) and value (employee sublist at that location) into the closure (the `l, el ->` string) and expects a two-element list of key (location) and value (average salary at that location) to be returned, converting those into map entries. Once I have the map of average salaries by location, `locationAvgSal`, I can print it out using the Collection `each()` method, which also takes a closure. When `each()` is applied to a map, it passes in the key (location) and value (average salary) in the same way as `collectEntries()`.
|
||||
|
||||
In lines 126-134, I filter the `employeeList` to get a sublist of `employeesInEdinburgh`, using the `findAll()` method, which is analogous to the Java Streams `filter()` method. And again, I use the `each()` method to print out the sublist of employees in Edinburgh.
|
||||
|
||||
In lines 135-144, I take the alternative approach of grouping the `employeeList` into a map of employee sublists at each location, `employeesByLocation`. Then in lines 139-144, I select the employee sublist at Edinburgh, using the expression `employeesByLocation[“Edinburgh”]` and the `each()` method to print out the sublist of employee names at that location.
|
||||
|
||||
### Why I often prefer Groovy
|
||||
|
||||
Maybe it's just my familiarity with Groovy, built up over the last 12 years or so, but I feel more comfortable with the Groovy approach to enhancing Collection with all these methods that take a closure as an argument, rather than the Java approach of converting the list, map, or whatever is at hand to a stream and then using streams, lambdas, and data classes to handle the processing steps. I seem to spend a lot more time with the Java equivalents before I get something working.
|
||||
|
||||
I'm also a huge fan of strong static typing and parameterized types, such as `Map,employee>` `,employee>` as found in Java. However, on a day-to-day basis, I find that the more relaxed approach of lists and maps accommodating different types does a better job of supporting me in the real world of data without requiring a lot of extra code. Dynamic typing can definitely come back to bite the programmer. Still, even knowing that I can turn static type checking on in Groovy, I bet I haven't done so more than a handful of times. Maybe my appreciation for Groovy comes from my work, which usually involves bashing a bunch of data into shape and then analyzing it; I'm certainly not your average developer. So is Groovy really a more Pythonic Java? Food for thought.
|
||||
|
||||
I would love to see in both Java and Groovy a few more facilities like `average()` and `averagingDouble()`. Two-argument versions to produce weighted averages and statistical methods beyond averaging—like median, standard deviation, and so forth—would also be helpful. [Tabnine][8] offers interesting suggestions on implementing some of these.
|
||||
|
||||
### Groovy resources
|
||||
|
||||
The [Apache Groovy site][9] has a lot of great documentation. Other good sources include the reference page for [Groovy enhancements to the Java Collection class][10], the more tutorial-like introduction to [working with collections][11], and [Mr. Haki][12]. The [Baeldung site][13] provides a lot of helpful how-tos in Java and Groovy. And a really great reason to learn Groovy is to learn [Grails][14], a wonderfully productive full-stack web framework built on top of excellent components like Hibernate, Spring Boot, and Micronaut.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/maps-groovy-vs-java
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/collab-team-pair-programming-code-keyboard2.png
|
||||
[2]: https://groovy-lang.org/
|
||||
[3]: https://opensource.com/article/22/3/maps-groovy-vs-java
|
||||
[4]: https://datatables.net/
|
||||
[5]: https://groovy.apache.org/download.html
|
||||
[6]: https://opensource.com/article/22/3/manage-java-versions-sdkman
|
||||
[7]: https://projectlombok.org/features/Data
|
||||
[8]: https://www.tabnine.com/code/java/methods/java.util.stream.Collectors/averagingDouble
|
||||
[9]: https://groovy-lang.org/
|
||||
[10]: https://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Collection.html
|
||||
[11]: https://groovy-lang.org/groovy-dev-kit.html#_working_with_collections
|
||||
[12]: https://blog.mrhaki.com/
|
||||
[13]: https://www.baeldung.com/
|
||||
[14]: https://grails.org/
|
@ -0,0 +1,113 @@
|
||||
[#]: subject: "Manage Flatpak Permission Using Flatseal"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/manage-flatpak-permission-flatseal/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Manage Flatpak Permission Using Flatseal
|
||||
======
|
||||
Learn how to manage Flatpak permission using the Flatseal app, which gives you a friendly GUI and additional features.
|
||||
|
||||
Installing applications can be challenging in Linux from a new user standpoint. The primary reason is there are so many [Linux distributions][1]. And you need different installation methods or instructions for various Linux distributions. It can be overwhelming for some users. In addition, it’s also difficult for developers to create separate packages and builds for different distributions.
|
||||
|
||||
### Flatpak solved this problem. How?
|
||||
|
||||
It uses container tech so that the same application executable runs similarly on all Linux platforms. For example, one single executable can run in Ubuntu, Fedora, OpenSUSE, Arch Linux and many others.
|
||||
|
||||
Moreover, the developers also spend fewer efforts on packaging the same app for different platforms. And they can concentrate on the app features rather than the distributions or deployments.
|
||||
|
||||
In addition, Flatpak apps also get updates instantly, and you get the newest version as soon as it’s available.
|
||||
|
||||
All these benefits also open up an important question. What is the permission a Flatpak app needs? How do you manage them easily? For example, one app may require only network access, not disk space. Or another may have access to take screenshots, but it might not be required at all.
|
||||
|
||||
So, it is essential to review the permission of a Flatpak app. This is similar to your Android or iOS app permission.
|
||||
|
||||
Finally, even if you are a new user, it’s not that difficult to manage and review the permissions, thanks to the graphical app – Flatseal.
|
||||
|
||||
### What is Flatseal?
|
||||
|
||||
Flatseal is a Flatpak application which gives you a friendly user interface to view and change permissions of all the Flatpak apps in your system.
|
||||
|
||||
It is an excellent little app with an easy-to-use toggle button for each of the permission sections per application. Here’s how it looks (Figure 1).
|
||||
|
||||
![Figure 1 – Flatseal App][2]
|
||||
|
||||
### How do you use Flatseal to manage Flatpak Permission?
|
||||
|
||||
When opening the Flatseal app, it should list all the Flatpak apps at the left navigation bar. And once you select one application, it shows the available permission settings in the main window at the right.
|
||||
|
||||
Now, for each Flatpak permission control, the current value is shown in the toggle switch. If the permission is in use, it should be set. Otherwise, it should be greyed out.
|
||||
|
||||
First, to set permission, you must navigate to your system’s application. Then, you can enable or disable any respective control from the permission list.
|
||||
|
||||
Second, if you want to set a global control that applies to all the Flatpak in your system, you can choose “All Applications” at the left-top and apply the global setting (Figure 2).
|
||||
|
||||
![Figure 2: Manage Flatpak Permission using Flatseal][3]
|
||||
|
||||
It’s super easy. Isn’t it?
|
||||
|
||||
### Example of Managing Flatpak Permission using Flatseal
|
||||
|
||||
Let’s take an example.
|
||||
|
||||
In my system, I have the above Flatpak installed (Figure 2). Let’s pick the Telegram Desktop app. Currently, the Telegram desktop does not have permission to access any home directory or user files (Figure 3).
|
||||
|
||||
![Figure 3: Telegram Desktop Flatpak App does not have permission to the home folders][4]
|
||||
|
||||
Now, if I want to permit all user files and any specific folder (e.g. /home/Downloads), you can give it by turning the enable switch on. See the Figure 4 below.
|
||||
|
||||
![Figure 4: Permission changed of Telegram Desktop to give access to folders][5]
|
||||
|
||||
Similarly, you can enable or disable the permission you want. Under the hood, Flatseal performs the internal Flatpak commands to achieve this.
|
||||
|
||||
For example, the above scenario may translate to the following command.
|
||||
|
||||
```
|
||||
flatpak override org.telegram.desktop --filesystem=/home/Downloads
|
||||
```
|
||||
|
||||
And to remove:
|
||||
|
||||
```
|
||||
flatpak override org.telegram.desktop --nofilesystem=/home/Downloads
|
||||
```
|
||||
|
||||
There is also another cool feature of Flatseal which shows a small alert icon beside the user-specific permission changes (See Figure 4).
|
||||
|
||||
### Can I install Flatseal in all Linux distributions?
|
||||
|
||||
Yes, you can install [Flatseal][6] in all Linux Distributions as Flatpak. You can set up your system using [this guide][7] and run the following command to install. Or, [click here][8] to launch the system-specific installer directly.
|
||||
|
||||
```
|
||||
flatpak install flathub com.github.tchx84.Flatseal
|
||||
```
|
||||
|
||||
### Closing Notes
|
||||
|
||||
I hope the above guide to managing Flatpak permission is easy enough for you to understand and start with Flatpak. It’s super easy to control and far easier to use. Also, you may want to visit our more Flatpak [guide here][9].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/manage-flatpak-permission-flatseal/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/category/distributions
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2022/06/Flatseal-App.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/06/Manage-Flatpak-Permission-using-Flatseal.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/06/Telegram-Desktop-Flatpak-App-does-not-have-permission-to-the-home-folders.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/06/Permission-changed-of-Telegram-Desktop-to-give-access-to-folders.jpg
|
||||
[6]: https://flathub.org/apps/details/com.github.tchx84.Flatseal
|
||||
[7]: https://flatpak.org/setup/
|
||||
[8]: https://dl.flathub.org/repo/appstream/com.github.tchx84.Flatseal.flatpakref
|
||||
[9]: https://www.debugpoint.com/tag/flatpak/
|
@ -0,0 +1,181 @@
|
||||
[#]: subject: "Run Windows Apps And Games Using WineZGUI On Linux"
|
||||
[#]: via: "https://ostechnix.com/winezgui-run-windows-apps-and-games-on-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Run Windows Apps And Games Using WineZGUI On Linux
|
||||
======
|
||||
WineZGUI - A Wine GUI Frontend Using Zenity
|
||||
|
||||
A while ago we wrote about **[Bottles][1]**, an opensource graphical application easily to run Windows software and Games on Linux operating systems. Today, we will discuss about a similar interesting project. Say hello to **WineZGUI**, a Wine GUI frontend to **[run windows apps and games with wine on Linux][2]**.
|
||||
|
||||
#### Contents
|
||||
|
||||
1. What Is WineZGUI?
|
||||
2. Bottles Vs WineZGUI
|
||||
3. How To Install WineZGUI In Linux
|
||||
4. Run Windows Apps And Games With WineZGUI In Linux
|
||||
5. Conclusion
|
||||
|
||||
### What Is WineZGUI?
|
||||
|
||||
WineZGUI is a collection of Bash scripts that allows you to easily manage wine prefixes and provides easier wine gaming experience on Linux using **Zenity**.
|
||||
|
||||
Using WineZGUI, we can directly launch the Windows exe files or games from File manager without installing them.
|
||||
|
||||
WineZGUI creates shortcut for each application or game for easier access and also creates separate prefixes for each exe binary file.
|
||||
|
||||
When you launch a Windows exe file with WineZGUI, it will prompt you whether to use the default wine prefix or create a new one. The default prefix is `~/.local/share/winezgui/default`.
|
||||
|
||||
If you choose to create a new prefix for the windows binary or exe, WineZGUI will try to extract the product name and icon from the exe file and it creates a desktop shortcut.
|
||||
|
||||
When you launch the same exe or binary file later, it will recommend you to run it with the associated prefix earlier.
|
||||
|
||||
To put this layman terms, WineZGUI is simply a Wine and winetricks simple GUI for official vanilla wine. Wine prefix setup is automatic when we launch an exe to play a game.
|
||||
|
||||
You simply open an exe and it creates a prefix and a desktop shortcut with name and icon extracted from that exe.
|
||||
|
||||
It uses **exiftool** and **icotool** utilities to extract the name and icon respectively. Either you can open an exe to launch that game from existing prefix, or use desktop shortcut.
|
||||
|
||||
WineZGUI is a shell script that is freely hosted in GitHub. You can grab the source code, improve it, fix bugs and add features.
|
||||
|
||||
### Bottles Vs WineZGUI
|
||||
|
||||
You might wonder how does WineZGUI compare with Bottles. There is a subtle difference between these applications though.
|
||||
|
||||
**Bottles is prefix oriented** and **runner oriented**. Meaning - Bottles first creates a prefix then use different exe files with it. Bottles does not remember exe's prefix. Bottles uses different runners.
|
||||
|
||||
**WineZGUI is exe oriented**. It uses exe to create one prefix for that exe only. Next time we open an exe, it will ask whether to launch with existing exe prefix.
|
||||
|
||||
WineZGUI does not offer advanced features like **bottles** or **[lutris][3]** do, like runners, online installers, etc.
|
||||
|
||||
### How To Install WineZGUI In Linux
|
||||
|
||||
Make sure you have installed the necessary prerequisites for WineZGUI.
|
||||
|
||||
**Debian/Ubuntu:**
|
||||
|
||||
```
|
||||
$ sudo dpkg --add-architecture i386
|
||||
$ sudo apt install zenity wine winetricks libimage-exiftool-perl icoutils gnome-terminal
|
||||
```
|
||||
|
||||
**Fedora:**
|
||||
|
||||
```
|
||||
$ sudo dnf install zenity wine winetricks perl-Image-ExifTool icoutils gnome-terminal
|
||||
```
|
||||
|
||||
The officially recommended way to install WineZGUI is by using **[Flatpak][4]**.
|
||||
|
||||
After installing Flatpak, run the following commands one by one to install WineZGUI in Linux.
|
||||
|
||||
```
|
||||
$ flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
```
|
||||
|
||||
```
|
||||
$ flatpak --user -y install flathub org.winehq.Wine/x86_64/stable-21.08
|
||||
```
|
||||
|
||||
```
|
||||
$ wget https://github.com/fastrizwaan/WineZGUI-Releases/releases/download/WineZGUI-0.4_20220608/io.github.WineZGUI_0_4_20220608.flatpak
|
||||
```
|
||||
|
||||
```
|
||||
$ flatpak --user -y install io.github.WineZGUI_0_4_20220608.flatpak
|
||||
```
|
||||
|
||||
### Run Windows Apps And Games With WineZGUI In Linux
|
||||
|
||||
Launch WineZGUI from Dash or Menu.
|
||||
|
||||
![Launch WineZGUI][5]
|
||||
|
||||
This is how the default interface of WineZGUI looks like.
|
||||
|
||||
![WineZGUI Interface][6]
|
||||
|
||||
As you can see in the above screenshot, WineZGUI interface is very simple and easy to understand. From the main window, you can,
|
||||
|
||||
* Open an EXE file,
|
||||
* Open Winetricks GUI and CLI,
|
||||
* Launch Wine configuration,
|
||||
* Launch explorer,
|
||||
* Open BASH shell,
|
||||
* Kill all apps/games including WineZGUI interface,
|
||||
* Delete wine prefix,
|
||||
* View installed WineZGUI version.
|
||||
|
||||
For the purpose of the demonstration, I am going to open an .exe file.
|
||||
|
||||
In the next window, choose the EXE file to run. In my case, it is WinRAR.
|
||||
|
||||
![Choose The EXE File To Run][7]
|
||||
|
||||
Next, whether you want to run the EXE file with default prefix or create a new prefix. I choose default prefix.
|
||||
|
||||
![Run WinRAR With Default Prefix][8]
|
||||
|
||||
A few seconds later, the WinRAR setup wizard will appear. Click Install to continue.
|
||||
|
||||
![Install WinRAR In Linux][9]
|
||||
|
||||
Click OK to complete the WinRAR installation.
|
||||
|
||||
![Complete WinRAR Installation][10]
|
||||
|
||||
Click "Run WinRAR" to launch it.
|
||||
|
||||
![Run WinRAR][11]
|
||||
|
||||
Here is WinRAR running in my Fedora 36 desktop!
|
||||
|
||||
![WinRAR Is Running In Fedora Using Wine][12]
|
||||
|
||||
### Conclusion
|
||||
|
||||
WineZGUI is a newcomer to the club. If you're looking for an easier way to run Windows apps and games using Wine on a Linux desktop, WineZGUI might be a good choice.
|
||||
|
||||
With the help of WineZGUI, the users have an option to create a wine prefix right at same folder as the `.exe` and creating a relatively-linked `.desktop` entry to automatically do so.
|
||||
|
||||
The reason being that it's easier to back up and delete a game along with the wine prefix, and having it generate a `.desktop` would make it resilient to being moved and transferred.
|
||||
|
||||
A cool use-case would be to setup using the app, then share the wine prefix to your friend and others who just want a working wine prefix with all the dependencies, saves, etc.
|
||||
|
||||
Give it a try and let us know what do you think about this project in the comment section below.
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [WineZGUI GitHub Repository][13]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/winezgui-run-windows-apps-and-games-on-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/run-windows-software-on-linux-with-bottles/
|
||||
[2]: https://ostechnix.com/run-windows-games-softwares-ubuntu-16-04/
|
||||
[3]: https://ostechnix.com/manage-games-using-lutris-linux/
|
||||
[4]: https://ostechnix.com/how-to-install-and-use-flatpak-in-linux/
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/06/Launch-WineZGUI.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/06/WineZGUI-Interface.png
|
||||
[7]: https://ostechnix.com/wp-content/uploads/2022/06/Choose-The-EXE-File-To-Run.png
|
||||
[8]: https://ostechnix.com/wp-content/uploads/2022/06/Run-WinRAR-With-Default-Prefix.png
|
||||
[9]: https://ostechnix.com/wp-content/uploads/2022/06/Install-WinRAR-In-Linux.png
|
||||
[10]: https://ostechnix.com/wp-content/uploads/2022/06/Complete-WinRAR-Installation.png
|
||||
[11]: https://ostechnix.com/wp-content/uploads/2022/06/Run-WinRAR.png
|
||||
[12]: https://ostechnix.com/wp-content/uploads/2022/06/WinRAR-Is-Running-In-Fedora-Using-Wine.png
|
||||
[13]: https://github.com/fastrizwaan/WineZGUI
|
@ -0,0 +1,144 @@
|
||||
[#]: subject: "Don’t Be Afraid of Linux Terminal. Embrace it."
|
||||
[#]: via: "https://itsfoss.com/love-thy-terminal/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "duoluoxiaosheng"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Don’t Be Afraid of Linux Terminal. Embrace it.
|
||||
======
|
||||
Most of our focus goes into avoiding the Linux terminal, at least, for new users comfortable with Graphical User Interfaces (GUIs).
|
||||
|
||||
While it is good to make things easy and convenient, there are a few reasons why you should not be afraid of dipping your toes into the Linux terminal.
|
||||
|
||||
Here, I shall highlight some of them to encourage you to try a few things in the terminal that should help you eventually.
|
||||
|
||||
### 1. Quick Access to Information on Commands
|
||||
|
||||
![quick info terminal][1]
|
||||
|
||||
At times, you may need to use a command in the terminal to perform something. Sure, you can just copy-paste without knowing what it actually does.
|
||||
|
||||
But, what if you are interested to know a bit more about the command?
|
||||
|
||||
Well, you just need to type in:
|
||||
|
||||
```
|
||||
man <command you intend to learn>
|
||||
```
|
||||
|
||||
For instance: man apt
|
||||
|
||||
It will give you all the essential details right on the same screen, without needing an internet connection or scouring the web to find out what it does. You save time, you get to know stuff.
|
||||
|
||||
And, that makes things convenient, giving you more confidence in using the terminal.
|
||||
|
||||
These are often referred to as “man pages”. You can read one of our resources to[learn about man pages on Linux][2].
|
||||
|
||||
Thanks to the terminal.
|
||||
|
||||
### 2. Troubleshooting Problems
|
||||
|
||||
![troubleshoting illustration][3]
|
||||
|
||||
When you search for a fix on the internet, most of the solutions provide you with commands to get it fixed.
|
||||
|
||||
Hence, one of the best use-cases of the terminal is to resolve several system issues quite easily. You will have to be careful here, because
|
||||
|
||||
While there are things that you can tweak around with GUI programs, the majority of the easy fixes go through the terminal.
|
||||
|
||||
Considering we have several [troubleshooting guides][4] on our portal, some examples include:
|
||||
|
||||
* [Checking network adapter manufacturer][5]
|
||||
* [Fixing long shutdown time][6]
|
||||
* [Fix no Wi-Fi with broadcom adapters][7]
|
||||
|
||||
### 3. Easily Work With a Remote Server
|
||||
|
||||
![remote server illustration][8]
|
||||
|
||||
You will end up accessing the command line (or the terminal) to access a remote server and perform various operations, including file transfers.
|
||||
|
||||
Compared to a GUI method for a remote server, you minimize bandwidth issues and ensure that you get to perform anything you need faster using the Linux terminal.
|
||||
|
||||
There are also options to open a GUI program on the remote server via the terminal. Even if it is slow, the terminal gives you plenty of abilities to interact comfortably with a remote server.
|
||||
|
||||
### 4. Resource Efficient
|
||||
|
||||
It does not matter whether you use one of the [best Linux distributions][9], a Linux terminal is always resource-efficient and consumes the least amount of memory.
|
||||
|
||||
If you are low on resources or may have a graphics driver conflict with a GUI program, you can always rely on the Linux terminal.
|
||||
|
||||
This should help you through critical tasks without taking much system resources.
|
||||
|
||||
### 5. Fast
|
||||
|
||||
![fast illustration][10]
|
||||
|
||||
Not just limited to the memory usage, but you can get things done faster with a terminal over a GUI, you know?
|
||||
|
||||
Some tasks you can try include installing an application, launching a program, performing complex file operations, and more.
|
||||
|
||||
### 6. Stable and Reliable Command-line Programs
|
||||
|
||||
Compared to GUI programs, terminal programs are stable and more reliable. Why?
|
||||
|
||||
Fewer factors influence the program with crashes/bugs when it comes to a terminal.
|
||||
|
||||
While the terminal tools could be unintuitive, they are often built for servers in mind. So, the tools do not receive frequent experience breaking updates and do not quickly fail to work.
|
||||
|
||||
### 7. More Tools for CLI
|
||||
|
||||
We do not have a GUI program for everything on Linux. However, there are several [CLI tools][11] to perform a wide range of operations, some fun and critical tasks as well.
|
||||
|
||||
You need to get something done; chances are, you will find a command-line tool for it.
|
||||
|
||||
### 8. Various Terminal Emulators to Try
|
||||
|
||||
![variety illustration][12]
|
||||
|
||||
While you should not have any trouble with the default terminal emulator installed on your Linux distribution, you have plenty of other options.
|
||||
|
||||
If you prefer a different look, more advanced features, or tailored for a specific use, you can look at some of the [best terminal emulators][13] available.
|
||||
|
||||
If you thought using the terminal was boring, you must try some of them.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Personally, I feared the terminal when I was a new Linux user. But, as I got comfortable with it for small tasks, I got to realize the perks mentioned above.
|
||||
|
||||
You do not need to use the terminal over GUI for everything. Nevertheless, it is good to prefer the terminal for a few things because you might save your time, and get things done faster, and in a hassle-free manner.
|
||||
|
||||
Abhishek has written an [excellent guide on various small things that make you get more comfortable with the Linux terminal][14].
|
||||
|
||||
*What do you think are the benefits of a terminal over a GUI? What are your reasons to prefer the terminal? Let me know your thoughts in the comments section below.*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/love-thy-terminal/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2022/06/quick-info-terminal.png
|
||||
[2]: https://itsfoss.com/linux-man-page-guide/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/06/troubleshoting-illustration.jpg
|
||||
[4]: https://itsfoss.com/tag/troubleshoot/
|
||||
[5]: https://itsfoss.com/find-network-adapter-ubuntu-linux/
|
||||
[6]: https://itsfoss.com/long-shutdown-linux/
|
||||
[7]: https://itsfoss.com/fix-no-wireless-network-ubuntu/
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/06/remote-server-illustration.jpg
|
||||
[9]: https://itsfoss.com/best-linux-distributions/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/06/fast-illustration.jpg
|
||||
[11]: https://itsfoss.com/tag/cli-tools/
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/06/variety-illustration.jpg
|
||||
[13]: https://itsfoss.com/linux-terminal-emulators/
|
||||
[14]: https://itsfoss.com/basic-terminal-tips-ubuntu/
|
@ -0,0 +1,151 @@
|
||||
[#]: subject: "LibreOffice 7.4: Top New Features and Release Details"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/libreoffice-7-4/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
LibreOffice 7.4: Top New Features and Release Details
|
||||
======
|
||||
This post contains the top new features of LibreOffice 7.4 (upcoming) across Writer, Calc, Impress and other core modules.
|
||||
|
||||
**This post contains the top new features of LibreOffice 7.4 (upcoming) across Writer, Calc, Impress and other core modules.**
|
||||
|
||||
The LibreOffice team improves the famous free and open-source office product with each iteration. Perhaps the only stable and well-managed open-source project as a replacement to Microsoft Office.
|
||||
|
||||
The LibreOffice 7.4 version (planned in August), bringing regular updates to core modules including Calc, Writer and Impress with features and enhancements. Furthermore, in this release, the compatibility with Microsoft Office improved with changes to the core filters and platform updates.
|
||||
|
||||
Before we round up the new features, here’s a tentative schedule for LibreOffice 7.4:
|
||||
|
||||
### Schedule
|
||||
|
||||
| Milestone | Release Date |
|
||||
| :- | :- |
|
||||
| Alpha 1 | May 9, 2022 – May 15, 2022 |
|
||||
| Feature Freeze | Jun 6, 2022 – Jun 12, 2022 |
|
||||
| Beta 1 | Jun 6, 2022 – Jun 12, 2022 |
|
||||
| RC1 | Jul 4, 2022 – Jul 10, 2022 |
|
||||
| RC2 | Jul 25, 2022 – Jul 31, 2022 |
|
||||
| RC3 | Aug 8, 2022 – Aug 14, 2022 |
|
||||
| Release 7.4 | Aug 15, 2022 – Aug 21, 2022 |
|
||||
|
||||
### LibreOffice 7.4 Features
|
||||
|
||||
#### Calc
|
||||
|
||||
First and foremost, the most crucial change coming in 7.4 is the support of 16k columns in LibreOffice Calc. It was available in earlier LibreOffice 7.3 but hidden as an experimental option. Finally, it is open to support 16384 columns, i.e. up to XFD. Additional columns are going to help several high-volume data work.
|
||||
|
||||
![LibreOffice 7.4 Calc now supports 16k columns.][1]
|
||||
|
||||
Second, the Autosum button gets the following [additional functions][2] to improve productivity and save time.
|
||||
|
||||
* COUNTA
|
||||
* PRODUCT
|
||||
* STDEV
|
||||
* STDEVP
|
||||
* VAR
|
||||
* VARP
|
||||
|
||||
![Additional options in Autosum button][3]
|
||||
|
||||
Moreover, the height of the formula bar is now part of the *.ods files. Hence, you can see the height retained after saving the file and opening it. Earlier, it was being reset to the default height. It is one of the small changes but has a more significant impact on heavy Calc users.
|
||||
|
||||
![Height of Calc Formula bar][4]
|
||||
|
||||
In addition, a new menu option `Sheet > Navigate > Go to Sheet` shows an entire new dialog which is similar to the Writer’s Go to Page.
|
||||
|
||||
#### Writer
|
||||
|
||||
Firstly, the hyphenation settings get three new options. You can now specify the size of the hyphenation zone, minimum word length and ability to stop hyphenating the last word.
|
||||
|
||||
![New Hyphenation settings][5]
|
||||
|
||||
*Image credit: LibreOffice Team*
|
||||
|
||||
Secondly, the menu item Tools > Update > Update now updates the preview of all OLE objects. Also, if you are importing a DOCX file in LibreOffice 7.4, the paragraph borders bring more clarity. In addition, the import also improves the Rich text and checkbox contents inside the text box for DOCX imports. Moreover, Write 7.4 now supports clearing breaks from Word files improving layout consistency.
|
||||
|
||||
Secondly, the menu item `Tools > Update > Update all` now updates the preview of all OLE objects.
|
||||
|
||||
Also, if you are importing a DOCX file in LibreOffice 7.4, the paragraph borders bring more clarity. In addition, the import also improves the Rich text and checkbox contents inside the text box for DOCX imports.
|
||||
|
||||
Moreover, Writer 7.4 now supports clearing breaks from Word files improving layout consistency.
|
||||
|
||||
#### Impress
|
||||
|
||||
The significant change in Impress is a new Theme tab in the Slide properties for the master slide. It contains several accent colour options which control all the sildes in your presentation. It will be a really neat feature in this version.
|
||||
|
||||
![New Theme option in Slide Master Properties][6]
|
||||
|
||||
### Common Updates (across all modules)
|
||||
|
||||
Firstly, the most important change as a standard feature is LibreOffice now supports WEBP images officially. You can directly export and import WebP images across Writer, Calc, Draw etc. Now you do not need additional software to convert WEBP images, especially in Linux systems.
|
||||
|
||||
Moreover, the support for Windows compressed enhanced meta file (EMZ/WMZ) also lands in this release.
|
||||
|
||||
![New WEBP Image Support][7]
|
||||
|
||||
Secondly, the Fille > Recent Documents can remember the state of the last opened document, whether it was read-only or editable.
|
||||
|
||||
The 3D shapes lighting gets some bug fixes and corrections corresponding to the ODF specifications.
|
||||
|
||||
### Performance Updates
|
||||
|
||||
A bunch of performance boosts also makes this an important release of LibreOffice. Here’s a quick recap of the performance boosts.
|
||||
|
||||
* [The Text Layout performance gets around a 60% boost][8]
|
||||
* [Calc formula re-calculation][9]
|
||||
* Improved performance of [VLOOKUP][10], COUNTIF and SUMIF
|
||||
* [And CSV file import][11]
|
||||
|
||||
That’s not all. LibreOffice 7.4 also brings a huge set of filters (export and import) for Microsoft Office 365 file types, extended PDF export options (such as a sign) via command line, updated language support and API changes.
|
||||
|
||||
### Download LibreOffice 7.4 for Testing
|
||||
|
||||
You can download the development version of LibreOffice 7.4 using the respective links and help to test.
|
||||
|
||||
* [RPM Package for Fedora and related distributions][12]
|
||||
* [DEB packages for Ubuntu, Linux Mint and others][13]
|
||||
* [Windows 10, 11 – 64-bit][14]
|
||||
* [macOS 64 bit][15]
|
||||
* [Mac OS X – ARM and Apple SIlicon, M1][16]
|
||||
|
||||
If you need assistance, you can refer to our [guide here][17] to install the development version in Linux. Make sure to report any issues or bugs in the [official bug tracker.][18]
|
||||
|
||||
LibreOffice 7.4 is planned for release between Aug 15, 2022, and Aug 21, 2022.
|
||||
|
||||
*[Via Release Notes][19]*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/libreoffice-7-4/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2022/06/LibreOffice-7.4-Calc-now-supports-16k-columns.jpg
|
||||
[2]: https://bugs.documentfoundation.org/show_bug.cgi?id=139602
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/06/Additional-formula-in-Autosum-tool.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/06/Height-of-Calc-Formula-bar.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/06/New-Hyphenation-settings.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/06/New-Theme-option-in-Slide-Master-Properties.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/06/New-WEBP-Image-Support.jpg
|
||||
[8]: http://llunak.blogspot.com/2022/04/improving-text-layout-performance.html
|
||||
[9]: https://bugs.documentfoundation.org/show_bug.cgi?id=119083
|
||||
[10]: https://bugs.documentfoundation.org/show_bug.cgi?id=146546
|
||||
[11]: https://bugs.documentfoundation.org/show_bug.cgi?id=94677
|
||||
[12]: https://www.libreoffice.org/download/download/?type=rpm-x86_64&version=7.4.0&lang=en-US
|
||||
[13]: https://www.libreoffice.org/download/download/?type=deb-x86_64&version=7.4.0&lang=en-US
|
||||
[14]: https://www.libreoffice.org/download/download/?type=win-x86_64&version=7.4.0&lang=en-US
|
||||
[15]: https://www.libreoffice.org/download/download/?type=mac-x86_64&version=7.4.0&lang=en-US
|
||||
[16]: https://www.libreoffice.org/download/download/?type=mac-aarch64&version=7.4.0&lang=en-US
|
||||
[17]: https://www.debugpoint.com/2022/06/install-latest-libreoffice-ubuntu-linux/
|
||||
[18]: https://bugs.documentfoundation.org/
|
||||
[19]: https://wiki.documentfoundation.org/ReleaseNotes/7.4
|
@ -0,0 +1,159 @@
|
||||
[#]: subject: "A Quick Look at Cloud Cost Management Tools"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/a-quick-look-at-cloud-cost-management-tools/"
|
||||
[#]: author: "Dr Anand Nayyar https://www.opensourceforu.com/author/anand-nayyar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
A Quick Look at Cloud Cost Management Tools
|
||||
======
|
||||
Whether you are using a single cloud computing service provider or operating in a multi-cloud or hybrid cloud computing environment, you may be paying for resources that your organisation does not use at all. That is why cloud cost management is so important.
|
||||
|
||||
![Cloud cost management tools][1]
|
||||
|
||||
If you are a developer or software engineer, you will be using a range of cloud resources. Managing cloud costs, and knowing exactly where and why the expenditure on the cloud is happening is a huge challenge. If cloud-native technologies like microservices, containers and Kubernetes are being used, cloud utilisation may not be fully visible and the organisation may end up paying for far more services than have been used.
|
||||
|
||||
![Figure 1: Cost per customer report][2]
|
||||
|
||||
### What is cloud cost management?
|
||||
|
||||
Cloud cost management is defined as the efficient monitoring, measuring and control of cloud costs. Traditionally, cloud cost management focused on cutting down cloud cost wastages in terms of under-utilised and forgotten resources but, nowadays, it focuses on architectural optimisation.
|
||||
|
||||
The advantages of cloud cost management are:
|
||||
|
||||
* High accuracy in the planning, budgeting and forecasting of cloud services
|
||||
* Re-architecting resources for more profit
|
||||
* Reducing operational costs and decommissioning wasteful services
|
||||
* Effective load balancing management and better usage of computing resources
|
||||
|
||||
Cloud native cost management services
|
||||
|
||||
AWS Cloud Economics Center
|
||||
Though the key driver for any enterprise to migrate to a cloud platform is better total cost of ownership (TCO), the benefits don’t stop there today. Cloud economics or FinOps is the term used for creating a framework that can help to derive the expenditure in cloud adoption.
|
||||
|
||||
![Figure 2: Amazon cost management solutions][3]
|
||||
|
||||
When a business is growing, good planning, budget control and predicting the pattern of cloud asset usage are important. Cloud economics addresses this space. There are many third party tools like CloudHealth, Densify or Apptio Cloudability available as cost management tools, which come with financial management, advisory and advanced analytics. Most of these tools work on any cloud platform — Azure, AWS or GCP.
|
||||
|
||||
At the same time, there are native tools available as well for cost management like the AWS Economics Center or Cost Management console.
|
||||
|
||||
AWS Economics is based on a cloud value framework and has the following benefits.
|
||||
|
||||
* Cost savings: Offers usage details on the cloud assets and TCO calculation to compare with existing and forecasted spends.
|
||||
* Staff productivity: Improved automation tasks like DevOps pipeline, automated code review, and automated cost optimisation alerts reduce manual efforts.
|
||||
* Operational resilience: A well-architected framework is used to ensure high availability, security and compliance, leading to highly resilient cloud platform usage.
|
||||
* Business agility: Reduces errors in cloud deployment by using best practices and AWS partner solutions.
|
||||
|
||||
![Figure 3: AWS cost management dashboard][4]
|
||||
|
||||
### Azure cloud cost management
|
||||
|
||||
A well-architected framework has five pillars of cloud architecture development — cost optimisation, performance efficiency, operational excellence, reliability and security. Of these, cost optimisation will give immediate to long-term benefits, and requires a cost adoption framework and operating model to build an efficient cost pillar.
|
||||
|
||||
Cloud cost management includes cost transparency and cost governance as per the FinOps framework guidance. This can be implemented by using the Crawl-Walk-Run principle, where we start with cost transparency and the operating model (crawl), move towards cost optimisation and automation (walk) and, finally, implement cost management solutions and governance policies for efficient cost optimisation (run).
|
||||
|
||||
The Azure platform calls this the Build-Measure-Learn principle (similar to the Crawl-Walk-Run principle). It suggests reviewing the cost principles, including right-sizing of resources and resource tagging, and then developing a cost model to decide the billing models for resources. These will capture cost requirements, policies for infrastructure provisioning and associated budget allocation. Cost alerts and budget thresholds should also be set.
|
||||
|
||||
Resources should be tagged so that priorities can be set in cost allocation for production and non-production environments, to create a workflow process in budget management.
|
||||
|
||||
![Figure 4: AWS Trusted Advisor][5]
|
||||
|
||||
### Google cost visibility services
|
||||
|
||||
The Google Cloud Platform or GCP cost management suite is built on three tools.
|
||||
|
||||
* Cost visibility: Provides the cost per resource.
|
||||
|
||||
* Resource usage optimisation: The cost advisory facility helps you to tune the cost per resource by giving the history of and the prediction for cloud service usage.
|
||||
|
||||
* Pricing efficiency: Advisory guidelines are given to optimise the cloud services, like use of cost-efficient compute or storage resources based on usage patterns.
|
||||
|
||||
![Figure 5: Azure guidance principles for cost optimisation (Image source: Azure documentation)][6]
|
||||
|
||||
Cost management tools provide dashboard visualisation of resource usage. Alerts are given with respect to over usage or under usage of services, and a usage summary can be scheduled (weekly, monthly or quarterly). Billing exports to CSV or JSON files can be used for historical analysis.
|
||||
|
||||
Google Cloud Platform (GCP) also has many native cloud services for cloud billing; it has reporting, forecasting and optimisation features for compute and storage services, some of which are listed below.
|
||||
|
||||
* Cost management provides visualisation reports on service utilisation, filtered by labels. Data Studio can be used to build custom dashboards.
|
||||
* Billing APIs and data collection APIs (StackDriver, Resource Manager API) offer integration with native and third party cost management tools.
|
||||
* Google Recommender can be used for optimising cost and usage, based on patterns of resource usage. Resource hierarchy can be used for fine grained resource management for cost allocation.
|
||||
* Quota limits can be used to proactively control the spend rate on resources including apps and infrastructure.
|
||||
* Budgets and alerts can throttle cap costs to control spends. These can be used to closely monitor costs, and send alerts through an SMS or e-mail using programmatic budget notifications.
|
||||
* GCP can be integrated with ‘Cloud Build’, ‘Cloud Pub/Sub’ (event/alerts) and cloud functions for cost reporting, billing and notifications.
|
||||
|
||||
![Figure 6: GCP cost summary dashboard (Image source: Google documentation)][7]
|
||||
|
||||
### Some best practices to handle cloud costs efficiently
|
||||
|
||||
Cost management and cost transparency are the two common principles of cloud governance. The FinOps framework addresses both these principles.
|
||||
|
||||
The top seven ways to optimise cloud cost usage are listed below.
|
||||
|
||||
* Shutdown unused resources/instances: A common issue in resource optimisation is handling unused resources or instances, particularly in non-production environments. Monitoring and controlling these will enable better cost optimisation.
|
||||
* Right-size underused resources: During cloud migration, infrastructure sizing is done based on the existing on-premises infrastructure. We may not know the performance requirements (completely) at the initial stage, and hence right-sizing resources like VM instances, storage services and database size can help reduce costs.
|
||||
* Reserve instances or spot instances for consistent long-term workloads: When moving to the cloud, we generally have a clear idea of what we need for long-term usage like data lakes or FTP landing zone. For these services, using reserved or spot instances for three to five years can give as much as 50 per cent cost benefit.
|
||||
* Choose the hybrid cloud approach for reducing migration costs: Instead of moving all applications at once to the cloud, we can migrate in stages, keeping some key applications on-premises.
|
||||
* Use auto-scaling features for the required resources: Many cloud services have the auto-scale feature, which helps to scale-up computing and storage when there is higher usage and scale these down in case of lower usage. This feature too helps to reduce costs.
|
||||
Budget your resources: We can set a quota for resources using a budget and cost allocation, so that if there is dynamic burst in resource requirement it can be controlled well within the allocated budget by enabling alerts and notifications.
|
||||
* Choose the right compute services for better performance and costs: Though cloud service providers like Azure, AWS and GCP have multiple compute models and instance types, we may not know if we are using the right compute size and model. If we can optimise the compute model considering performance and technical requirements, we can manage costs better.
|
||||
|
||||
### Open source cloud cost management tools
|
||||
|
||||
#### Kube-Downscaler
|
||||
|
||||
Kube-Downscaler is an open source framework written in Python, which can be used to handle automatic shutdowns or set the uptime for Kubernetes worker pods based on usage patterns (for example, shutdown during the weekend and set uptime during office hours).
|
||||
|
||||
This framework runs on a single pod in the Kubernetes cluster and can work with Azure (AKS), AWS (EKS) and GCP (GKE). It has a configuration setup that can be given for the shutdown time period or uptime running period. It can be scheduled to run once or regularly for a given period (monthly, yearly).
|
||||
|
||||
![Figure 7: Integrated FinOps toolchain ecosystem][8]
|
||||
|
||||
Alternatively, we can use Kubernetes-Ops, which is another open source framework for handling end-to-end Kubernetes clusters. It can create pods/clusters, and manage, deploy, scale and monitor them in a single pane of glass.
|
||||
|
||||
#### Kubecost
|
||||
|
||||
Though cloud cost governance aims at managing compute and storage services to a large extent, managing container costs is also a challenging exercise.
|
||||
|
||||
Kubecost helps to get monthly spends, costs for name space level, and deployment resource costs; it identifies cost efficiency in a Kubernetes clustered environment. It comes in both a free-to-use open source model (where there are limitations to using it such as a single cluster, metric retention period) and a commercial model.
|
||||
|
||||
We can get details of underutilised or over-provisioned resources (nodes and pods, and abandoned resources) based on usage footprints. The major features of Kubecost are cost allocation across nodes and pods, unified cost monitoring with integrated dashboard, cost optimisation insights to identify under-provisioned or over-provisioned cluster resources, and cost alerts as well as notifications for anomalous behaviour in resource usage.
|
||||
|
||||
Kubecost can be used with Azure Kubernetes Service (AKS), Amazon’s Elastic Kubernetes Service (EKS) and Fargate, Google Kubernetes Engine (GKE) and other Kubernetes platforms in private cloud environments.
|
||||
|
||||
### Integrated FinOps toolchain solution
|
||||
|
||||
FinOps is more of a culture adoption and is driven by the three-dimensional approach for cloud cost management — people (cost administration, team structure, training), processes (cost levers, maturity models, metrics definitions) and tools (cost management services, third party tools, cost advisory services).
|
||||
|
||||
FinOps is a collaborative activity between the finance/procurement team, technical IT operations team, and business management (COO, CIO). It can be developed as an agnostic framework for implementation in a multi-cloud environment (public/private/hybrid). It can also be easily integrated with third party tools for flexible implementation. For example, developing reports and dashboards could be made flexible with this integration of third-party tools.
|
||||
|
||||
![Figure 8: Kubecost dashboard (Image source: Azure documentation)][9]
|
||||
|
||||
### Future trends in FinOps adoption
|
||||
|
||||
The adoption of FinOps is maturing in most organisations that have substantial cloud consumption as they need processes and procedures to manage, monitor, allocate and forecast cloud spending. With the introduction of FinOps, organisations will have deeper insights into the resources available or reserved, which will promote appropriate procurement of cloud resources and avoid unnecessary spend in the first place.
|
||||
|
||||
Choosing between the right FinOps platform from cloud services providers (Azure Cost Management, AWS Cost Explorer and GCP Cost Tools), third party options or in-house development is not an easy task. Factors like variability in size and usage of cloud resources, fast-changing technology, and the advent of new cloud use cases complicate the process of automating cost optimisation. Building a governance culture and mindset is vital, but not always easy.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/a-quick-look-at-cloud-cost-management-tools/
|
||||
|
||||
作者:[Dr Anand Nayyar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/anand-nayyar/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Cloud-cost-management-tools.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Fig1-CloudZero.jpg
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-2.jpg
|
||||
[4]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figuer-3.jpg
|
||||
[5]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-4.jpg
|
||||
[6]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-5.jpg
|
||||
[7]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-6.jpg
|
||||
[8]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-7.jpg
|
||||
[9]: https://www.opensourceforu.com/wp-content/uploads/2022/04/Figure-8.jpg
|
@ -0,0 +1,127 @@
|
||||
[#]: subject: "Thonny is an Ideal IDE for Teaching Python Programming in Schools"
|
||||
[#]: via: "https://itsfoss.com/thonny-python-ide/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Thonny is an Ideal IDE for Teaching Python Programming in Schools
|
||||
======
|
||||
Running a Python program in Linux is as simple as executing the Python file in the terminal.
|
||||
|
||||
But that’s not very convenient for everyone and it doesn’t help you debug your programs. Too raw.
|
||||
|
||||
There are several IDEs and text editors that can be used for Python development. The [PyCharm community edition is available for Linux users][1].
|
||||
|
||||
I recently came across another IDE specifically crafted for Python beginners. I liked the idea of this application and hence I am sharing it with you here.
|
||||
|
||||
### Thonny is a cross-platform, open source Python IDE for beginners
|
||||
|
||||
[Thonny][2] feels like the Python version of Eclipse in terms of UI and UX. And that’s not entirely a bad thing considering most C++ and Java beginners start with Eclipse and many stay with it afterward.
|
||||
|
||||
It’s not a new tool. It has been on the horizon for some years now. I don’t code in Python so I never discovered it until recently.
|
||||
|
||||
Dedicated to Python, Thonny has features that help Python beginners understand how their program behaves. Let’s take a look at those features.
|
||||
|
||||
#### Plug and play
|
||||
|
||||
Thonny comes with Python so you don’t need to do additional effort for installing Python. That’s not a big deal for Linux users as most distributions have Python installed by default.
|
||||
|
||||
The interface is simple. It gives you an editor where you can write your Python program and hit the Run button or use F5 key to play the program. The output is displayed at the bottom.
|
||||
|
||||
![thonny hello world][3]
|
||||
|
||||
#### See variables
|
||||
|
||||
From the View->Variables, you can see the values of all the variables. No need to print them all.
|
||||
|
||||
![thonny variable pane][4]
|
||||
|
||||
#### Built-in debugger
|
||||
|
||||
Run your program step by step by using the debugger. You can access it from the top menu or use the Ctrl+F5 keys. You don’t even need the breakpoints here. You can go into big steps with F6 or in small steps with F7.
|
||||
|
||||
![thonny step by step f6][5]
|
||||
|
||||
In small steps, you can see how Python sees your expressions. This is very helpful for new programmers to understand why their program is behaving in a certain manner.
|
||||
|
||||
![thonny step by step f7][6]
|
||||
|
||||
That’s not it. For function calls, it opens a new window with separate local variables table and code pointer. Super cool!
|
||||
|
||||
#### Syntax error highlighter
|
||||
|
||||
Beginners often make simple syntax errors like missing paranthesis, quotes etc. Thonny is points it out immediately in the editor itself.
|
||||
|
||||
Local variables are also visually distinguished from globals.
|
||||
|
||||
#### Auto completion
|
||||
|
||||
You don’t have to type everything. Thonny supports auto code completion which helps in coding faster.
|
||||
|
||||
![thonny auto complete][7]
|
||||
|
||||
#### Access to system shell
|
||||
|
||||
From the Tools, you can access the system shell. From here you can install new Python package or learn to handle Python from the command line.
|
||||
|
||||
![thonny shell terminal][8]
|
||||
|
||||
Please note that if you use Flatpak or Snap, Thonny may not be able to access the system shell.
|
||||
|
||||
#### Manage Pip from GUI
|
||||
|
||||
Go to Tools and Manage packages. It opens a window and you can install Pip packages from this GUI.
|
||||
|
||||
![thonny manage packages][9]
|
||||
|
||||
Good enough features for learning Python, right? Let’s see how to install it.
|
||||
|
||||
### Installing Thonny on Linux
|
||||
|
||||
Thonny is a cross-platform application. It is available for Windows, macOS and Linux.
|
||||
|
||||
It’s a popular application and you can find it in the repositories of most Linux distributions. Just look for it in your system’s software center.
|
||||
|
||||
Alternatively, you can always use the package manager of your Linux distribution.
|
||||
|
||||
On Debian and Ubuntu-based distributions, you can use the apt command to install it.
|
||||
|
||||
```
|
||||
sudo apt install thonny
|
||||
```
|
||||
|
||||
It downloads a bunch of dependencies and around 300 MB of packages.
|
||||
|
||||
Once installed, you can search for it in the menu and install it from there.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Thonny is a decent tool for beginner Python programmers. Not that experts cannot use it but it’s more suited to be used in the schools and colleges. Students will find it helpful in learning Python and understanding how their code behaves in certain manner. In fact, it was originally developed in University of Tartu, Estonia.
|
||||
|
||||
Overall, a good software for Python learners.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/thonny-python-ide/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://itsfoss.com/install-pycharm-ubuntu/
|
||||
[2]: https://thonny.org/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-hello-world.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-variable-pane.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-step-by-step-f6.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-step-by-step-f7.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-auto-complete.png
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-shell-terminal.png
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/06/thonny-manage-packages.png
|
221
sources/tech/20220613 Use Terraform to manage TrueNAS.md
Normal file
221
sources/tech/20220613 Use Terraform to manage TrueNAS.md
Normal file
@ -0,0 +1,221 @@
|
||||
[#]: subject: "Use Terraform to manage TrueNAS"
|
||||
[#]: via: "https://opensource.com/article/22/6/terraform-truenas"
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use Terraform to manage TrueNAS
|
||||
======
|
||||
Get more out of TrueNAS when you integrate Terraform for configuration management.
|
||||
|
||||
![Puzzle pieces coming together to form a computer screen][1]
|
||||
|
||||
Image by: Opensource.com
|
||||
|
||||
Sometimes combining different open source projects can have benefits. The synergy of using Terraform with TrueNAS is a perfect example.
|
||||
|
||||
TrueNAS is an OpenBSD-based operating system that provides network-attached storage (NAS) and network services. One of its main strengths is leveraging the ZFS file system, which is known for enterprise-level reliability and fault tolerance. Terraform is a provisioning and deployment tool embodying the concept of infrastructure as code.
|
||||
|
||||
### TrueNAS
|
||||
|
||||
TrueNAS has a very nice web user interface (UI) for its management and an application programming interface (API). Terraform can be integrated with the API to provide configuration management of your NAS, as I'll demonstrate below.
|
||||
|
||||
To begin, I used Virtual Machine Manager to configure a virtual machine and then installed the latest version, TrueNAS 13.0. The only necessary input was to enter the root password. Once it reboots, the main menu appears. You will also see the HTTP management address. You can access this address from your local web browser.
|
||||
|
||||
![Virtual machine console setup][2]
|
||||
|
||||
### Terraform
|
||||
|
||||
Terraform needs to be installed where it can access the TrueNAS management URL. I am taking advantage of tfenv, a tool for managing Terraform versions.
|
||||
|
||||
```
|
||||
$ tfenv list-remote
|
||||
$ tfenv install 1.2.0
|
||||
$ tfenv use 1.2.0
|
||||
$ terraform -version
|
||||
Terraform v1.2.0
|
||||
on linux_amd64
|
||||
```
|
||||
|
||||
Next, create a working directory, such as `~/code/terraform/truenas`, to contain the configuration files associated with your TrueNAS instance.
|
||||
|
||||
```
|
||||
$ mkdir ~/code/terraform/truenas
|
||||
$ cd ~/code/terraform/truenas
|
||||
```
|
||||
|
||||
Create the initial terraform configuration file and add the necessary directives to define the TrueNAS provider.
|
||||
|
||||
```
|
||||
$ vi main.tf
|
||||
```
|
||||
|
||||
The provider will look like this, where the address and API key for your TrueNAS instance will need to be correctly specified.
|
||||
|
||||
```
|
||||
$ cat main.tf
|
||||
|
||||
|
||||
terraform {
|
||||
required_providers {
|
||||
truenas = {
|
||||
source = "dariusbakunas/truenas"
|
||||
version = "0.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "truenas" {
|
||||
api_key = "1-61pQpp3WyfYwg4dHToTHcOt7QQzVrMtZnkJAe9mmA0Z2w5MJsDB7Bng5ofZ3bbyn"
|
||||
base_url = "http://192.168.122.139/api/v2.0"
|
||||
}
|
||||
```
|
||||
|
||||
The TrueNAS API key is created in the Web UI. Log in and click the small gear in the upper right-hand corner.
|
||||
|
||||
![A pulldown menu from settings shows options including the desired choice, API Keys][3]
|
||||
|
||||
This UI section enables you to create the API key. Once generated, copy it to the `main.tf` file.
|
||||
|
||||
### Initialize
|
||||
|
||||
In your TrueNAS Terraform directory, you have the `main.tf` file. The first step is to initialize using the command `terraform init`, which should generate the following result:
|
||||
|
||||
```
|
||||
Initializing the backend...
|
||||
|
||||
Initializing provider plugins...
|
||||
- Finding dariusbakunas/truenas versions matching "0.9.0"...
|
||||
- Installing dariusbakunas/truenas v0.9.0...
|
||||
- Installed dariusbakunas/truenas v0.9.0 (self-signed, key ID E44AF1CA58555E96)
|
||||
|
||||
Partner and community providers are signed by their developers.
|
||||
If you'd like to know more about provider signing, you can read about it here:
|
||||
https://www.terraform.io/docs/cli/plugins/signing.html
|
||||
|
||||
Terraform has created a lock file .terraform.lock.hcl to record the provider
|
||||
selections it made above. Include this file in your version control repository
|
||||
so that Terraform can guarantee to make the same selections by default when
|
||||
you run "terraform init" in the future.
|
||||
|
||||
Terraform has been successfully initialized!
|
||||
|
||||
You may now begin working with Terraform. Try running "terraform plan" to see
|
||||
any changes that are required for your infrastructure. All Terraform commands
|
||||
should now work.
|
||||
|
||||
If you ever set or change modules or backend configuration for Terraform,
|
||||
rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary.
|
||||
```
|
||||
|
||||
A successful initialization means you're ready to start adding resources. Any TrueNAS item, such as a storage pool, network file system (NFS) share, or cron job, is a resource.
|
||||
|
||||
### Add a ZFS dataset
|
||||
|
||||
The following example resource directive defines a ZFS dataset. For my example, I will add it to the `main.tf` file.
|
||||
|
||||
```
|
||||
resource "truenas_dataset" "pictures" {
|
||||
pool = "storage-pool"
|
||||
name = "pictures"
|
||||
comments = "Terraform created dataset for Pictures"
|
||||
}
|
||||
```
|
||||
|
||||
Run the command `terraform validate` to check the configuration.
|
||||
|
||||
```
|
||||
Success! The configuration is valid.
|
||||
```
|
||||
|
||||
Running `terraform plan` will describe the actions that Terraform will perform. Now, add the new dataset with `terraform apply`.
|
||||
|
||||
```
|
||||
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
|
||||
+ create
|
||||
|
||||
Terraform will perform the following actions:
|
||||
|
||||
# truenas_dataset.pictures will be created
|
||||
+ resource "truenas_dataset" "pictures" {
|
||||
+ acl_mode = (known after apply)
|
||||
+ acl_type = (known after apply)
|
||||
+ atime = (known after apply)
|
||||
+ case_sensitivity = (known after apply)
|
||||
+ comments = "Terraform created dataset for Pictures"
|
||||
+ compression = (known after apply)
|
||||
+ copies = (known after apply)
|
||||
+ dataset_id = (known after apply)
|
||||
+ deduplication = (known after apply)
|
||||
+ encrypted = (known after apply)
|
||||
+ encryption_algorithm = (known after apply)
|
||||
+ encryption_key = (sensitive value)
|
||||
+ exec = (known after apply)
|
||||
+ generate_key = (known after apply)
|
||||
+ id = (known after apply)
|
||||
+ managed_by = (known after apply)
|
||||
+ mount_point = (known after apply)
|
||||
+ name = "pictures"
|
||||
+ pbkdf2iters = (known after apply)
|
||||
+ pool = "storage-pool"
|
||||
+ quota_bytes = (known after apply)
|
||||
+ quota_critical = (known after apply)
|
||||
+ quota_warning = (known after apply)
|
||||
+ readonly = (known after apply)
|
||||
+ record_size = (known after apply)
|
||||
+ ref_quota_bytes = (known after apply)
|
||||
+ ref_quota_critical = (known after apply)
|
||||
+ ref_quota_warning = (known after apply)
|
||||
+ share_type = (known after apply)
|
||||
+ snap_dir = (known after apply)
|
||||
+ sync = (known after apply)
|
||||
}
|
||||
|
||||
Plan: 1 to add, 0 to change, 0 to destroy.
|
||||
|
||||
Do you want to perform these actions?
|
||||
Terraform will perform the actions described above.
|
||||
Only 'yes' will be accepted to approve.
|
||||
|
||||
Enter a value:
|
||||
```
|
||||
|
||||
Type `yes` to confirm and hit Enter.
|
||||
|
||||
```
|
||||
truenas_dataset.pictures: Creating...
|
||||
truenas_dataset.pictures: Creation complete after 0s [id=storage-pool/pictures]
|
||||
|
||||
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
|
||||
```
|
||||
|
||||
That's it. You can check for this new dataset in the TrueNAS Web UI.
|
||||
|
||||
![The pictures dataset is shown in the storage pool list, with the comment "Terraform create dataset for pictures"][4]
|
||||
|
||||
### Do more with TrueNAS and Terraform
|
||||
|
||||
The TrueNAS provider for Terraform allows you to manage many more aspects of your TrueNAS device. For instance, you could share this new dataset as an NFS or server message block (SMB) share. You can also create additional datasets, cron jobs, and zvols.
|
||||
|
||||
Image by: (Alan Formy-Duval, CC BY-SA 4.0)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/terraform-truenas
|
||||
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lkxed][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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/puzzle_computer_solve_fix_tool.png
|
||||
[2]: https://opensource.com/sites/default/files/2022-06/TrueNAS_console.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-06/TrueNAS_APIkey.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-06/TrueNAS_Dataset.png
|
@ -0,0 +1,86 @@
|
||||
[#]: subject: "Cloudflare Has Something New to Replace Annoying CAPTCHAs on the Internet"
|
||||
[#]: via: "https://news.itsfoss.com/cloudflare-pat/"
|
||||
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Cloudflare 有了一个新东西,它可以替代互联网上烦人的验证码
|
||||
======
|
||||
不想通过正确输入 <ruby>验证码<rt>CAPTCHA</rt></ruby> 来证明自己是个人类吗?Cloudflare 可能有了一个解决方案。
|
||||
|
||||
![Cloudflare][1]
|
||||
|
||||
互联网服务巨头 Cloudflare(在 6 月 9 日)[刚刚宣布了][2] <ruby>私有访问令牌<rt>Private Access Tokens</rt></ruby> 功能。这项功能旨在减少你在网络上看到的验证码数量,同时改善你的隐私。
|
||||
|
||||
你可能已经发现,验证码在移动设备上是一种可怕的体验。通常,它们会最终会占据整个屏幕,有时甚至也无法完成。
|
||||
|
||||
作为替代方案,网站可以选择收集唯一识别数据,以证明你是人类。当然,从隐私的角度来看,这种做法是很糟糕的。如果这么做,许多重视隐私的公司都几乎无法避免 <ruby>僵尸攻击<rt>bot attacks</rt></ruby>。
|
||||
|
||||
幸运的是,私有访问令牌(PATs)的发布将改变这一点。
|
||||
|
||||
### 私有访问令牌会产生什么影响?
|
||||
|
||||
简而言之,私有访问令牌能够做到下面这些事:
|
||||
|
||||
* 在支持设备上减少验证码数量
|
||||
* 增强用户隐私
|
||||
* 允许网站所有者确保访问者来自真实设备
|
||||
|
||||
然而,深入观察,我们可以看到私有访问令牌的影响力远不止于此。若使用传统的验证码,就有多个实体可以访问你的数据。
|
||||
|
||||
首先,你正在访问的网站知道你的 IP 地址和你正在访问的 URL。当然,这些数据是建立连接所需的最低要求。此外,对于更高级的功能,网站还会发送一些用户代理数据,还好这些数据并不是唯一可识别的。
|
||||
|
||||
然而,另一方,也就是验证码提供者,却可以收集更多的数据。与你要访问的网站一样,它也知道你的 IP 地址、用户代理数据和你访问的 URL。不幸的是,除此之外,他们还会收集其他数据,例如你的设备信息和交互数据。如果把这些信息,与你之前完成验证码的时间联系起来,你就会惊讶的发现,他们可以建立一个非常详细的属于你的个人资料。
|
||||
|
||||
幸运的是,有了 Cloudflare 的私有访问令牌,你就可以完全绕过验证码,从而阻止验证码提供者收集此类数据。
|
||||
|
||||
### 私有访问令牌是如何工作的?
|
||||
|
||||
![][3]
|
||||
|
||||
验证码的理念是集中尽可能多的数据,私人访问令牌则恰恰相反,它将数据去中心化,因此任何一方都无法唯一识别你。在你提到数据共享之前,Cloudflare 就已经特别指出了,数据不会在各方之间共享。
|
||||
|
||||
当你访问使用 Cloudflare 和私人访问令牌的网站的时候,共有三方将处理你的数据的不同部分。
|
||||
|
||||
1. 网站。它只会知道你的 IP、URL 和用户代理,这也是建立连接所必需的。
|
||||
2. 你的设备制造商。他们只会知道那些用于验证设备是否真实所需的设备数据,而不会知道你正在访问哪个网站,或你的 IP 地址是什么。验证了你的设备后,他们将生成一个令牌,该令牌将发送到 Cloudflare。
|
||||
3. Cloudflare。他们将收到这个令牌,令牌中不包含你的任何设备数据,只有制造商对它是正品的“保证”。他们知道的唯一其他数据,就是你正在访问的网站,同样,这是为你提供内容所必需的。
|
||||
|
||||
通过这种方式,Cloudflare 无需接触你的数据,就可以对“你是一个人”充满信心。
|
||||
|
||||
### 支持的操作系统:没有 Linux?
|
||||
|
||||
你可能已经意识到,私人访问令牌需要特定的操作系统功能才能工作。目前,它们仅存在于苹果最新的操作系统上,即 iOS 和 iPadOS 16,以及 macOS Ventura。这是因为苹果的操作系统只在有限的硬件上运行,设备验证会更加容易。
|
||||
|
||||
另一方面,Linux 是一种通用操作系统,旨在在各种硬件上运行。因此,我认为,在可预见的未来,它都不会支持私人访问令牌。
|
||||
|
||||
回到苹果,我想到私人访问令牌也可能导致消费者维修设备的权利出现一些问题。例如,如果我用第三方的非正品电池更换了老旧的 iPhone 原装电池,私人访问令牌系统会特殊对待这种情况吗?
|
||||
|
||||
如果是 Linux 手机呢?这些制造商,如 Pine64 和 Purism,可能没有支持这样一个系统的基础设施。是否可以在这些上使用私人访问令牌呢?
|
||||
|
||||
Cloudflare 在 [公告帖][4] 中提到:
|
||||
|
||||
> 我们正在积极努力让其他客户和设备制造商也使用私人访问令牌框架。每当新客户开始使用它时,从该客户进入你网站的流量将自动开始要求令牌,你的访问者将自动看到更少的验证码。
|
||||
|
||||
因此,我们希望看到它被更多的设备和操作系统采用。你如何看待 Cloudflare 的私人访问令牌呢?在下面的评论中发表你的看法吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/cloudflare-pat/
|
||||
|
||||
作者:[Jacob Crume][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/wp-content/uploads/2022/06/cloudflare-private-access-tokens.jpg
|
||||
[2]: https://blog.cloudflare.com/eliminating-captchas-on-iphones-and-macs-using-new-standard/
|
||||
[3]: https://news.itsfoss.com/wp-content/uploads/2022/06/PAT-Data-transfer-chart-1024x650.png
|
||||
[4]: https://blog.cloudflare.com/eliminating-captchas-on-iphones-and-macs-using-new-standard/
|
187
translated/tech/20210722 Write your first JavaScript code.md
Normal file
187
translated/tech/20210722 Write your first JavaScript code.md
Normal file
@ -0,0 +1,187 @@
|
||||
[#]: subject: "Write your first JavaScript code"
|
||||
[#]: via: "https://opensource.com/article/21/7/javascript-cheat-sheet"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
编写你的第一段 JavaScript 代码
|
||||
======
|
||||
JavaScript 是为 Web 而生的,但它可以做的事远不止于此。本文将带领你了解它的基础知识,然后你可以下载我们的备忘清单,以便随时掌握详细信息。
|
||||
|
||||
![开源编程][1]
|
||||
|
||||
图源:Opensource.com
|
||||
|
||||
JavaScript 是一种充满惊喜的编程语言。许多人第一次遇到 JavaScript 时,它通常是作为一种 Web 语言出现的。所有主流浏览器都有一个 JavaScript 引擎;并且,还有一些流行的框架,如 JQuery、Cash 和 Bootstrap 等,它们可以帮助简化网页设计;甚至还有用 JavaScript 编写的编程环境。它似乎在互联网上无处不在,但事实证明,它对于 [Electron][2] 等项目来说也是一种有用的语言。Electron 是一个构建跨平台桌面应用程序的开源工具包,它使用的语言就是 JavaScript。
|
||||
|
||||
JavaScript 语言的用途多到令人惊讶,它拥有各种各样的库,而不仅仅是用于制作网站。它的基础知识十分容易掌握,因此,它可以作为一个起点,助你跨出构建你想象中的东西的第一步。
|
||||
|
||||
### 安装 JavaScript
|
||||
|
||||
随着你的 JavaScript 水平不断提高,你可能会发现自己需要高级的 JavaScript 库和运行时。不过,刚开始学习的时候,你是根本不需要安装 JavaScript 的。因为所有主流的 Web 浏览器都包含一个 JavaScript 引擎来运行代码。你可以使用自己喜欢的文本编辑器编写 JavaScript,将其加载到 Web 浏览器中,接着你就能看到代码的作用。
|
||||
|
||||
### 上手 JavaScript
|
||||
|
||||
要编写你的第一个 JavaScript 代码,请打开你喜欢的文本编辑器,例如 [Notepad++][3]、[Atom][4] 或 [VSCode][5] 等。因为它是为 Web 开发的,所以 JavaScript 可以很好地与 HTML 配合使用。因此,我们先来尝试一些基本的 HTML:
|
||||
|
||||
```
|
||||
<html>
|
||||
<head>
|
||||
<title>JS</title>
|
||||
</head>
|
||||
<body>
|
||||
<p id="example">Nothing here.</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
保存这个文件,然后在 Web 浏览器中打开它。
|
||||
|
||||
![浏览器中显示的 HTML][6]
|
||||
|
||||
要将 JavaScript 添加到这个简单的 HTML 页面,你可以创建一个 JavaScript 文件并在页面的 `<head>` 中引用它,或者只需使用 `<script>` 标记将 JavaScript 代码嵌入 HTML 中。在这个例子中,我嵌入了下面的代码:
|
||||
|
||||
```
|
||||
<html>
|
||||
<head>
|
||||
<title>JS</title>
|
||||
</head>
|
||||
<body>
|
||||
<p id="example">Nothing here.</p>
|
||||
|
||||
<script>
|
||||
let myvariable = "Hello world!";
|
||||
|
||||
document.getElementById("example").innerHTML = myvariable;
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
在浏览器中重新加载页面。
|
||||
|
||||
![在浏览器中显示带有 JavaScript 的 HTML][7]
|
||||
|
||||
如你所见,`<p>` 标签仍然包含字符串 “Nothing here”,但是当它被渲染时,JavaScript 会改变它,使其包含 “Hello world”。是的,JavaScript 具有重建(或只是帮助构建)网页的能力。
|
||||
|
||||
这个简单脚本中的 JavaScript 做了两件事。首先,它创建一个名为 `myvariable` 的变量,并将字符串 “Hello world!” 放置其中。然后,它会在当前文档(浏览器呈现的网页)中搜索 ID 为 “example” 的所有 HTML 元素。当它找到 `example` 时,它使用了 `innerHTML` 函数将 HTML 元素的内容替换为 `myvariable` 的内容。
|
||||
|
||||
当然,我们也可以不用自定义变量。因为,使用动态创建的内容来填充 HTML 元素也是容易的。例如,你可以使用当前时间戳来填充它:
|
||||
|
||||
```
|
||||
<html>
|
||||
<head>
|
||||
<title>JS</title>
|
||||
</head>
|
||||
<body>
|
||||
<p id="example">Date and time appears here.</p>
|
||||
|
||||
<script>
|
||||
document.getElementById("example").innerHTML = Date();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
重新加载页面,你就可以看到在呈现页面时生成的时间戳。再重新加载几次,你可以观察到秒数会不断增加。
|
||||
|
||||
### JavaScript 语法
|
||||
|
||||
在编程中,<ruby>语法<rt>syntax</rt></ruby> 指的是如何编写句子(或“行”)的规则。在 JavaScript 中,每行代码必须以分号(`;`)结尾,以便运行代码的 JavaScript 引擎知道何时停止阅读。(LCTT 译注:从实用角度看,此处的“必须”其实是不正确的,大多数 JS 引擎都支持不加分号。Vue.js 的作者尤雨溪认为“没有应该不应该,只有你自己喜欢不喜欢”,他同时表示,“Vue.js 的代码全部不带分号”。详情可以查看他在知乎上对于此问题的 [回答][10]。)
|
||||
|
||||
单词(或 <ruby>“字符串”<rt>strings</rt></ruby>)必须用引号(`"`)括起来,而数字(或 <ruby>“整数”<rt>integers</rt></ruby>)则不用。
|
||||
|
||||
几乎所有其他东西都是 JavaScript 语言的约定,例如变量、数组、条件语句、对象、函数等等。
|
||||
|
||||
### 在 JavaScript 中创建变量
|
||||
|
||||
变量是数据的容器。你可以将变量视为一个盒子,你在其中放置数据,以便与程序的其他部分共享它。要在 JavaScript 中创建变量,你可以选用关键字 `let` 和 `var` 中的一个,请根据你打算如何使用变量来选择:`var` 关键字用于创建一个供整个程序使用的变量,而 `let` 只为特定目的创建变量,通常在函数或循环的内部使用。(LCTT 译注:还有 `const` 关键字,它用于创建一个常量。)
|
||||
|
||||
JavaScript 内置的 `typeof` 函数可以帮助你识别变量包含的数据的类型。使用第一个示例,你可以修改显示文本,来显示 `myvariable` 包含的数据的类型:
|
||||
|
||||
```
|
||||
<string>
|
||||
let myvariable = "Hello world!";
|
||||
document.getElementById("example").innerHTML = typeof(myvariable);
|
||||
</string>
|
||||
```
|
||||
|
||||
接着,你就会发现 Web 浏览器中显示出 “string” 字样,因为该变量包含的数据是 “Hello world!”。在 `myvariable` 中存储不同类型的数据(例如整数),浏览器就会把不同的数据类型打印到示例网页上。尝试将 `myvariable` 的内容更改为你喜欢的数字,然后重新加载页面。
|
||||
|
||||
### 在 JavaScript 中创建函数
|
||||
|
||||
编程中的函数是独立的数据处理器。正是它们使编程得以 *模块化*。因为函数的存在,程序员可以编写通用库,例如,调整图像大小或统计时间花费的库,以供其他和你一样的程序员在他们的代码中使用。
|
||||
|
||||
要创建一个函数,你可以为函数提供一个自定义名称,后面跟着用大括号括起来的、任意数量的代码。
|
||||
|
||||
下面是一个简单的网页,其中包含了一个剪裁过的图像,还有一个分析图像并返回真实图像尺寸的按钮。在这个示例代码中,`<button>` 这个 HTML 元素使用了 JavaScript 的内置函数 `onclick` 来检测用户交互,它会触发一个名为 `get_size` 的自定义函数。具体代码如下:
|
||||
|
||||
```
|
||||
<html>
|
||||
<head>
|
||||
<title>Imager</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<button onclick="get_size(document.getElementById('myimg'))">
|
||||
Get image size
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<img style="width: 15%" id="myimg" src="penguin.png" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function get_size(i) {
|
||||
let w = i.naturalWidth;
|
||||
let h = i.naturalHeight;
|
||||
alert(w + " by " + h);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
保存这个文件,并将其加载到 Web 浏览器中以尝试这段代码。
|
||||
|
||||
![自定义的 get_size 函数返回了图像尺寸][8]
|
||||
|
||||
### 使用 JavaScript 的跨平台应用程序
|
||||
|
||||
你可以从代码示例中看到,JavaScript 和 HTML 紧密协作,从而创建了有凝聚力的用户体验。这是 JavaScript 的一大优势。当你使用 JavaScript 编写代码时,你继承了现代计算中最常见的用户界面之一,而它与平台无关,那就是 Web 浏览器。你的代码本质上是跨平台的,因此你的应用程序,无论是简单的图像大小分析器还是复杂的图像编辑器、视频游戏,或者你梦想的任何其他东西,都可以被所有人使用,无论是通过 Web 浏览器,还是桌面(如果你同时提供了一个 Electron 应用)。
|
||||
|
||||
学习 JavaScript 既简单又有趣。网络上有很多网站提供了相关教程,还有超过一百万个 JavaScript 库可帮助你与设备、外围设备、物联网、服务器、文件系统等进行交互。在你学习的过程中,请将我们的 [JavaScript 备忘单][9] 放在身边,以便记住语法和结构的细节。
|
||||
|
||||
正文中的配图来自:Seth Kenlon,CC BY-SA 4.0
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/javascript-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[校对者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/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/code2.png
|
||||
[2]: https://www.electronjs.org/
|
||||
[3]: https://opensource.com/article/16/12/notepad-text-editor
|
||||
[4]: https://opensource.com/article/20/12/atom
|
||||
[5]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[6]: https://opensource.com/sites/default/files/pictures/plain-html.jpg
|
||||
[7]: https://opensource.com/sites/default/files/uploads/html-javascript.jpg
|
||||
[8]: https://opensource.com/sites/default/files/uploads/get-size.jpg
|
||||
[9]: https://opensource.com/downloads/javascript-cheat-sheet
|
||||
[10]: https://www.zhihu.com/question/20298345/answer/49551142
|
@ -0,0 +1,120 @@
|
||||
[#]: subject: "How to Recover Arch Linux Install via chroot"
|
||||
[#]: via: "https://www.debugpoint.com/2021/07/recover-arch-linux/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何通过 chroot 恢复 Arch Linux 的安装
|
||||
======
|
||||
这个快速指南解释了恢复 Arch Linux 安装的一些步骤。
|
||||
|
||||
作为一个滚动发布的版本,[Arch Linux][1] 中有时会出现一些问题。不是因为你自己的行为,而是数以百计的其他原因,如新内核与你的硬件,或软件的兼容性。但是,Arch Linux 仍然是更好的,它提供了最新的软件包和应用。
|
||||
|
||||
但有时,它也会给你带来麻烦,你最终只能看到一个闪烁的光标,其他什么都没有。
|
||||
|
||||
所以,在这种情况下,与其重新格式化或重新安装,不如在放弃希望之前尝试恢复安装和数据。本指南概述了这个方向的一些步骤。
|
||||
|
||||
### 恢复 Arch Linux 安装
|
||||
|
||||
* 第一步是用 Arch Linux 创建一个可启动的 Live USB。从这个链接下载 .ISO 并创建一个可启动的 .ISO。你可以查看这个指南[如何使用 Etcher 创建可启动的 .ISO][2]。记住这一步需要另一个稳定的工作系统,因为你目前的系统不能使用。
|
||||
|
||||
[下载 arch linux][3]
|
||||
|
||||
* 你需要知道你的 Arch Linux 安装在哪个分区上。这是一个非常重要的步骤。如果你不知道,你可以用 GParted 来查找。或者在你的 Grub 菜单中查看,或者你可以运行下面的命令来了解。这将列出你所有的磁盘分区及其大小、标签。
|
||||
|
||||
```
|
||||
sudo lsblk -o name,mountpoint,label,size,uuid
|
||||
```
|
||||
|
||||
* 完成后,插入 U 盘并从它启动。你应该在 Live 介质中看到 Arch Linux 的提示。
|
||||
|
||||
* 现在,用下面的方法挂载到 Arch Linux 分区。把 /dev/sda3 改成你各自的分区。
|
||||
|
||||
```
|
||||
/dev/sda3
|
||||
```
|
||||
|
||||
```
|
||||
mount /dev/sda3 /mntarch-chroot /mnt
|
||||
```
|
||||
|
||||
* arch-chroot 命令将在终端挂载你的 Arch Linux 分区,所以用你的 Arch 凭证登录。现在,在这个阶段,根据你的需要,你有以下选择。
|
||||
|
||||
* 你可以通过 /home 文件夹来备份你的数据。如果,故障排除器无效的话。你可以把文件复制到外部 USB 或其他分区。
|
||||
|
||||
* 核查日志文件,特别是 pacman 日志。因为,不稳定的系统可能是由升级某些软件包引起的,如图形驱动或任何其他驱动。根据日志,如果你想降级任何特定的软件包,你可能要降级。
|
||||
|
||||
* 你可以使用下面的命令来查看 pacman 日志文件的最后 200 行,以找出任何失败的项目或依赖性删除。
|
||||
|
||||
```
|
||||
tail -n 200 /var/log/pacman.log | less
|
||||
```
|
||||
|
||||
* 上面的命令给了你从 pacman.log 文件末尾的 200 行来验证。现在,仔细检查哪些软件包在你成功启动后被更新了。
|
||||
|
||||
* 并记下软件包的名称和版本。你可以尝试逐一降级软件包,或者如果你认为某个特定的软件包产生了问题。使用 pacman 命令的 -U 开关来降级。
|
||||
|
||||
```
|
||||
pacman -U <package name>
|
||||
```
|
||||
|
||||
* 如果有的话,你可以在降级后运行以下命令来启动你的 Arch 系统。
|
||||
|
||||
```
|
||||
exec /sbin/init
|
||||
```
|
||||
|
||||
* 检查你的显示管理器的状态,是否有任何错误。有时,显示管理器会产生一个问题,无法与 X 服务器通信。例如,如果你正在使用 lightdm,那么你可以通过以下方式检查它的状态。
|
||||
|
||||
```
|
||||
systemctl status lightdm
|
||||
```
|
||||
|
||||
* 或者,可以通过下面的命令启动它,并检查什么是错误。
|
||||
|
||||
```
|
||||
lightdm --test-mode --debug
|
||||
```
|
||||
|
||||
、* 下面是一个 lightdm 失败的例子,它导致了一个不稳定的 Arch 系统。
|
||||
|
||||
![lightdm - test mode][4]
|
||||
|
||||
* 或者通过使用 startx 启动 X 服务器来检查。
|
||||
|
||||
```
|
||||
startx
|
||||
```
|
||||
|
||||
* 根据我的经验,如果你在上述命令中看到错误,尝试安装另一个显示管理器,如 sddm 并启用它。它可能会消除这个错误。
|
||||
|
||||
* 根据你的系统状态,尝试上述步骤,并进行故障排除。对于特定于显示管理器 lightdm 的错误,我们有一个[指南][5],你可能想查看一下。
|
||||
|
||||
* 如果你使用的是 sddm,那么请查看[这些故障排除步骤][6]是否可以。
|
||||
|
||||
### 结束语
|
||||
|
||||
每个安装都是不同的。上述步骤可能对你不起作用。但它值得一试,根据经验,它是有效的。如果它起作用,那么,对你来说是好事。无论哪种方式,请在下面的评论区中告诉我,它结果如何。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/recover-arch-linux/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/tag/arch-linux
|
||||
[2]: https://www.debugpoint.com/2021/01/etcher-bootable-usb-linux/
|
||||
[3]: https://archlinux.org/download/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/03/lightdm-test-mode.jpg
|
||||
[5]: https://www.debugpoint.com/2021/03/failed-to-start-lightdm/
|
||||
[6]: https://wiki.archlinux.org/title/SDDM#Troubleshooting
|
@ -0,0 +1,273 @@
|
||||
[#]: subject: "How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 22.04 / 20.04 / 18.04"
|
||||
[#]: via: "https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Ubuntu 22.04 / 20.04 / 18.04 中启动到 <ruby>救援<rt>Rescue</rt></ruby> 模式 或 <ruby>紧急<rt>Emergency</rt></ruby> 模式
|
||||
======
|
||||
这篇教程将介绍如何在 Ubuntu 22.04、20.04 和 18.04 LTS 版本中启动到 <ruby>救援<rt>Rescue</rt></ruby> 模式 或 <ruby>紧急<rt>Emergency</rt></ruby> 模式。
|
||||
|
||||
你可能已经知道,在 Linux 发行版中 **<ruby>运行等级<rt>Runlevels</rt></ruby>** 已经被 **<ruby>系统目标<rt>Systemd targets</rt></ruby>** 所替代,例如, RHEL 7 、RHEL 8 、Ubuntu 16.04 LTS 及其更新的版本。更多关于 <ruby>运行等级<rt>Runlevels</rt></ruby> 和 <ruby>系统目标<rt>Systemd targets</rt></ruby> 的信息,参考 [这篇指南][1] 。
|
||||
|
||||
这篇指南是针对 Ubuntu 编写的,但是,下面所给的步骤应该也适用于大多数使用 **Systemd** 作为默认服务管理器的 Linux 发行版。
|
||||
|
||||
在进入主题前,让我们简单的理解:什么是 <ruby>救援<rt>rescue</rt></ruby> 模式 和 <ruby>紧急<rt>Emergency</rt></ruby> 模式,以及这两种模式的目的是什么。
|
||||
|
||||
### 什么是 <ruby>救援<rt>rescue</rt></ruby> 模式?
|
||||
|
||||
在 Linux 发行版中,<ruby>救援<rt>rescue</rt></ruby> 模式 等效于 <ruby>单用户<rt>single user</rt></ruby> 模式,它使用 **SysV** 作为默认的服务器管理器。在 <ruby>救援<rt>rescue</rt></ruby> 模式 中,将挂载所有的本地文件系统,将仅启动一些重要的服务。但是,不会启动一般的服务 (例如,网络服务)。
|
||||
|
||||
<ruby>救援<rt>rescue</rt></ruby> 模式 在不能正常启动系统的情况下是很有用的。此外,我们可以在 <ruby>救援<rt>rescue</rt></ruby> 模式 下执行一些重要的 <ruby>救援<rt>rescue</rt></ruby> 操作,例如,[重新设置 root 密码][2] 。
|
||||
|
||||
### 什么是 <ruby>紧急<rt>Emergency</rt></ruby> 模式?
|
||||
|
||||
与 <ruby>救援<rt>rescue</rt></ruby> 模式相比, 在 <ruby>紧急<rt>Emergency</rt></ruby> 模式中,不会启动任何的东西。不会启动服务,不会挂载挂载点,不会建立套接字,什么都不会启动。你将所拥有的只是一个 **原始的 shell** 。<ruby>紧急<rt>Emergency</rt></ruby> 模式适用于调试目的。
|
||||
|
||||
首先,我们将看到如何在 Ubuntu 22.04 和 20.04 LTS 发行版中启动到 <ruby>救援<rt>Rescue</rt></ruby> 模式 或 <ruby>紧急<rt>Emergency</rt></ruby> 模式。在 Ubuntu 22.04 和 20.04 LTS 中进入 <ruby>救援<rt>rescue</rt></ruby> 模式 的过程是完全相同的!
|
||||
|
||||
### 在 Ubuntu 22.04 / 20.04 LTS 中启动到 <ruby>救援<rt>rescue</rt></ruby> 模式
|
||||
|
||||
我们可以使用两种方法来启动到 <ruby>救援<rt>rescue</rt></ruby> 模式。
|
||||
|
||||
#### 方法 1
|
||||
|
||||
打开你的 Ubuntu 系统。在 BIOS 徽标出现后,按下 ESC 按键来显示 GRUB 菜单。
|
||||
|
||||
在 GRUB 菜单中,选择第一项,并按下 **"e"** 按键来编辑它。
|
||||
|
||||
![GRUB Menu In Ubuntu 22.04 / 20.04 LTS][3]
|
||||
|
||||
按下 **下箭头** 按键,并找到以单词 **"linux"** 开头的一行代码,并在其结尾处添加下面的一行代码。为到达其结尾处,只需要按下 **CTRL+e** 组合键,或使用你键盘上的 **END** 按键或 **左箭头/右箭头** 按键。
|
||||
|
||||
```
|
||||
systemd.unit=rescue.target
|
||||
```
|
||||
|
||||
![Edit Grub Boot Menu Entries To Enter Into Rescue Mode In Ubuntu 22.04 / 20.04 LTS][4]
|
||||
|
||||
在添加上面的代码行后,按下 **Ctrl+x** 组合键 或按下 **F10** 按键来启动到 <ruby>救援<rt>rescue</rt></ruby> 模式.
|
||||
|
||||
数秒后,你将作为 root 用户来登陆到 <ruby>救援<rt>rescue</rt></ruby> 模式 (<ruby>单用户<rt>single user</rt></ruby> 模式) 。将会提示你按下 <ruby>回车<rt>ENTER</rt></ruby> 按键来进入维护模式。
|
||||
|
||||
下图是 Ubuntu 22.04 / 20.04 LTS 系统的 <ruby>救援<rt>rescue</rt></ruby> 模式 的样子:
|
||||
|
||||
![Boot Into Rescue Mode In Ubuntu 22.04 / 20.04 LTS][5]
|
||||
|
||||
现在,在 <ruby>救援<rt>rescue</rt></ruby> 模式 中做你想做的任何事。在 <ruby>救援<rt>rescue</rt></ruby> 模式 中,在你执行任何操作前,你可能需要以 读/写 模式 的方式来挂载 root (**/**) 文件系统。
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
![Mount Root File System In Read Write Mode In Ubuntu 22.04 / 20.04 LTS][6]
|
||||
|
||||
在完成后,按下 **"Ctrl+d"** 组合键来启动到正常模式。或者,你可以输入下面的任意一个命令来启动到正常模式。
|
||||
|
||||
```
|
||||
systemctl default
|
||||
```
|
||||
|
||||
或者,
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
如果你想重新启动系统,而不是启动到正常的模式,输入:
|
||||
|
||||
```
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
#### 方法 2
|
||||
|
||||
在这种方法中,你不需要编辑 GRUB 启动菜单项目。
|
||||
|
||||
打开系统电源,并从 GRUB 启动菜单中选择 <ruby>Ubuntu 高级选项<rt>Advanced options for Ubuntu</rt></ruby>。
|
||||
|
||||
![Choose Advanced Options For Ubuntu From Grub Boot Menu][7]
|
||||
|
||||
接下来,你将看到一个带有内核版本的可用的 Ubuntu 版本的列表。在 Ubuntu 中的 GRUB 启动菜单中选择 <ruby>恢复<rt>Recovery</rt></ruby> 模式。
|
||||
|
||||
![Choose Recovery Mode In Grub Boot Menu In Ubuntu 22.04 / 20.04 LTS][8]
|
||||
|
||||
数秒后,你将看到 Ubuntu 的 <ruby>恢复<rt>Recovery</rt></ruby> 菜单。从 <ruby>恢复<rt>Recovery</rt></ruby> 菜单中,选择 **<ruby>进入 root 的 shell 提示符<rt>Drop to root shell prompt</rt></ruby>** 选项 ,并按下 <ruby>回车<rt>ENTER</rt></ruby> 按键。
|
||||
|
||||
![Enter Into Root Shell Prompt In Ubuntu 22.04 / 20.04 LTS][9]
|
||||
|
||||
现在,你将登陆到 <ruby>救援<rt>rescue</rt></ruby> 模式。
|
||||
|
||||
![Ubuntu Maintenance Mode][10]
|
||||
|
||||
通过输入下面的命令来 以 读/写 模式的方式 来挂载 root (**/**) 文件系统:
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
![Mount Root File System In Read Write Mode In Ubuntu][11]
|
||||
|
||||
在 <ruby>救援<rt>rescue</rt></ruby> 模式 中做你想做的任何事。
|
||||
|
||||
在完成后,输入 **exit** 来返回到 <ruby>恢复<rt>Recovery</rt></ruby> 菜单。
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
最后,选择 **<ruby>救援正常启动<rt>Resume normal boot</rt></ruby>** 选项,并按下 <ruby>回车<rt>ENTER</rt></ruby> 按键。
|
||||
|
||||
![Boot Into Normal Mode In Ubuntu][12]
|
||||
|
||||
再次按下 <ruby>回车<rt>ENTER</rt></ruby> 按键来退出 <ruby>恢复<rt>Recovery</rt></ruby> 模式,并继续启动到正常模式。
|
||||
|
||||
![Exit The Recovery Mode In Ubuntu][13]
|
||||
|
||||
如果你不想启动到正常模式,输入 **reboot** 并从维护模式中按下 <ruby>回车<rt>ENTER</rt></ruby> 按键来重新启动你的系统。
|
||||
|
||||
### 在 Ubuntu 22.04 / 20.04 LTS 中启动到 <ruby>紧急<rt>Emergency</rt></ruby> 模式
|
||||
|
||||
当 GRUB 菜单出现时,按下 **"e"** 按键来编辑它。
|
||||
|
||||
![GRUB Menu In Ubuntu 22.04 / 20.04 LTS][14]
|
||||
|
||||
找到以单词 **"linux"** 开头的一行代码,并在其结尾处添加下面的一行代码。
|
||||
|
||||
```
|
||||
systemd.unit=emergency.target
|
||||
```
|
||||
|
||||
![Edit Grub Boot Menu Entries To Enter Into Emergency Mode In Ubuntu 22.04 / 20.04 LTS][15]
|
||||
|
||||
在添加上面的代码行后,按下 **Ctrl+x** 组合键,或按下 **F10** 按键来启动到 <ruby>紧急<rt>Emergency</rt></ruby> 模式。
|
||||
|
||||
数秒后,你将作为 `root` 用户来登陆到 <ruby>紧急<rt>Emergency</rt></ruby> 模式。将会提示你按下 <ruby>回车<rt>ENTER</rt></ruby> 按键来进入维护模式。
|
||||
|
||||
下图是 Ubuntu 22.04 / 20.04 LTS 系统的 <ruby>紧急<rt>Emergency</rt></ruby> 模式 的样子:
|
||||
|
||||
![Boot Into Emergency Mode In Ubuntu 22.04 / 20.04 LTS][16]
|
||||
|
||||
现在,在 <ruby>紧急<rt>Emergency</rt></ruby> 模式 中做你想做的任何事。在 <ruby>紧急<rt>Emergency</rt></ruby> 模式 中,在你执行任何操作前,你可能需要以 读/写 模式 的方式来挂载 root (**/**) 文件系统。
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
在完成后,按下 **"Ctrl+d"** 组合键来启动到正常模式。或者,你可以输入下面的任意一个命令来启动到正常模式。
|
||||
|
||||
```
|
||||
systemctl default
|
||||
```
|
||||
|
||||
或者,
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
如果你想重新启动系统,而不是启动到正常的模式,输入:
|
||||
|
||||
```
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
### 在 Ubuntu 18.04 LTS 中启动到 <ruby>救援<rt>rescue</rt></ruby> 模式
|
||||
|
||||
启动你的 Ubuntu 系统。当 GRUB 菜单出现时,选择第一项并按下按键 **"e"** 来编辑。(为到达其结尾处,只需要按下 **CTRL+e** 组合键,或使用你键盘上的 **END** 按键或 **左箭头/右箭头** 按键):
|
||||
|
||||
![Grub Menu][17]
|
||||
|
||||
如果你没有看到 GRUB 菜单,只需要在 BIOS 徽标出现后,按下 ESC 按键来显示 GRUB 菜单。
|
||||
|
||||
找到以单词 **"linux"** 开头的一行代码,并在其结尾处添加下面的一行代码 (为到达其结尾处,只需要按下 **CTRL+e** 组合键,或使用你键盘上的 **END** 按键或 **左箭头/右箭头** 按键):
|
||||
|
||||
```
|
||||
systemd.unit=rescue.target
|
||||
```
|
||||
|
||||
![Edit Grub Menu][18]
|
||||
|
||||
在添加上面的代码行后,只需要按下 **Ctrl+x** 组合键,或按下 **F10** 按键来启动到 <ruby>救援<rt>rescue</rt></ruby> 模式。数秒后,你将作为 `root` 用户来登陆到 <ruby>救援<rt>rescue</rt></ruby> 模式 (<ruby>单用户<rt>single user</rt></ruby> 模式) 。
|
||||
|
||||
下图是 Ubuntu 18.04 LTS 服务器 系统的 <ruby>救援<rt>rescue</rt></ruby> 模式 的样子:
|
||||
|
||||
![Ubuntu Rescue Mode][19]
|
||||
|
||||
接下来,输入下面的命令来挂载 root (**/**) 文件系统为 读/写 模式。
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
### 启动到 <ruby>紧急<rt>Emergency</rt></ruby> 模式
|
||||
|
||||
启动你的 Ubuntu 到 <ruby>紧急<rt>Emergency</rt></ruby> 模式 基本与上述方法相同。你所需要做的全部工作是,在编辑 GRUB 菜单时,将 **"systemd.unit=rescue.target"** 替换为 **"systemd.unit=emergency.target"** 。
|
||||
|
||||
![Edit Grub Menu][20]
|
||||
|
||||
在你添加 "systemd.unit=emergency.target" 后,按下 **Ctrl+x** 组合键,或按下 **F10** 按键来启动到 <ruby>紧急<rt>Emergency</rt></ruby> 模式。
|
||||
|
||||
![Ubuntu Emergency Mode][21]
|
||||
|
||||
最后,你可以使用下面的命令来以 读/写 模式的方式 来挂载 root (**/**) 文件系统:
|
||||
|
||||
```
|
||||
mount -n -o remount,rw /
|
||||
```
|
||||
|
||||
### 在 <ruby>救援<rt>rescue</rt></ruby> 模式 和 <ruby>紧急<rt>Emergency</rt></ruby> 模式 之间切换
|
||||
|
||||
如果你正在 <ruby>救援<rt>rescue</rt></ruby> 模式 中,你不必像我上述提到的那样来编辑 GRUB 的菜单启动项。相反,你只想要输入下面的命令来立刻切换到 <ruby>紧急<rt>Emergency</rt></ruby> 模式:
|
||||
|
||||
```
|
||||
systemctl emergency
|
||||
```
|
||||
|
||||
同样,为从 <ruby>紧急<rt>Emergency</rt></ruby> 模式 切换到 <ruby>救援<rt>rescue</rt></ruby> 模式,输入:
|
||||
|
||||
```
|
||||
systemctl rescue
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
现在,你知道了什么是 <ruby>救援<rt>Rescue</rt></ruby> 模式 和 <ruby>紧急<rt>Emergency</rt></ruby> 模式,以及如何在 Ubuntu 22.04 、20.04 和 18.04 LTS 系统中启动到这些模式。 正如我已经提到的,在这里提供的这些步骤应该也适用于大多数当前使用 **Systemd** 作为默认服务管理器的 Linux 发行版。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://ostechnix.com/check-runlevel-linux/
|
||||
[2]: https://ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/
|
||||
[3]: https://ostechnix.com/wp-content/uploads/2022/05/GRUB-Menu-In-Ubuntu-22.04-LTS.png
|
||||
[4]: https://ostechnix.com/wp-content/uploads/2022/05/Edit-Grub-Boot-Menu-Entries-To-Enter-Into-Rescue-Mode-In-Ubuntu-22.04-LTS.png
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/05/Boot-Into-Rescue-Mode-In-Ubuntu-22.04.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/05/Mount-Root-File-System-In-Read-Write-Mode-In-Ubuntu.png
|
||||
[7]: https://ostechnix.com/wp-content/uploads/2022/05/Choose-Advanced-Options-For-Ubuntu-From-Grub-Boot-Menu.png
|
||||
[8]: https://ostechnix.com/wp-content/uploads/2022/05/Choose-Recovery-Mode-In-Grub-Boot-Menu-In-Ubuntu.png
|
||||
[9]: https://ostechnix.com/wp-content/uploads/2022/05/Enter-Into-Root-Shell-Prompt-In-Ubuntu.png
|
||||
[10]: https://ostechnix.com/wp-content/uploads/2022/05/Ubuntu-Maintenance-Mode.png
|
||||
[11]: https://ostechnix.com/wp-content/uploads/2022/05/Mount-Root-File-System-In-Read-Write-Mode-In-Ubuntu-1.png
|
||||
[12]: https://ostechnix.com/wp-content/uploads/2022/05/Boot-Into-Normal-Mode-In-Ubuntu.png
|
||||
[13]: https://ostechnix.com/wp-content/uploads/2022/05/Exit-The-Recovery-Mode-In-Ubuntu.png
|
||||
[14]: https://ostechnix.com/wp-content/uploads/2022/05/GRUB-Menu-In-Ubuntu-22.04-LTS.png
|
||||
[15]: https://ostechnix.com/wp-content/uploads/2022/05/Edit-Grub-Boot-Menu-Entries-To-Enter-Into-Emergency-Mode-In-Ubuntu.png
|
||||
[16]: https://ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Emergency-Mode-In-Ubuntu-20.04-LTS.png
|
||||
[17]: https://ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png
|
||||
[18]: https://ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png
|
||||
[19]: https://ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png
|
||||
[20]: https://ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png
|
||||
[21]: https://ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png
|
@ -0,0 +1,163 @@
|
||||
[#]: subject: "How to Install FFmpeg in Ubuntu and Other Linux"
|
||||
[#]: via: "https://www.debugpoint.com/2022/06/install-FFmpeg-ubuntu/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
在 Ubuntu 等 Linux 发行版上安装 FFmpeg
|
||||
======
|
||||
本教程介绍了 FFmpeg 在 Ubuntu 及其他 Linux 发行版上的安装步骤。
|
||||
|
||||
FFmpeg 是一套处理多媒体文件的软件库。凭借这些强大的库,FFmpeg 能够转换格式、推流以及处理音频和视频文件。许多 Linux 的前端应用都使用 FFmpeg 作为后端支持,所以这些应用对 FFmpeg 的依赖度非常高。举个例子,录屏软件可能会用到 FFmpeg 将录屏转换为 gif 动图。
|
||||
|
||||
VLC 多媒体播放器、YouTube、Blender、Kodi、Shotcut 和 Handbrake 等流行的应用与服务都在使用 FFmpeg。
|
||||
|
||||
趣事:NASA 火星 2020 计划的探测器“毅力”号在将图像和视频发送到地球之前,会先使用 FFmpeg 对其进行处理。
|
||||
|
||||
### 关于 FFmpeg
|
||||
|
||||
[FFmpeg][1] 本身是一款非常强大的命令行实用程序,在 Linux 发行版、Windows 以及 macOS 等系统上均可运行,支持多种架构。FFmpeg 是用 C 语言和汇编语言编写的,性能强大,提供跨平台支持。
|
||||
|
||||
#### 核心
|
||||
|
||||
FFmpeg 的核心是命令行实用程序,既可在命令行上使用,也可以经由任何程序语言调用。比如,你可以在 Shell 程序或 python 脚本中使用 FFmpeg。
|
||||
|
||||
* FFmpeg: 用于转换音视频格式,包括视频直播资源。
|
||||
* ffplay: FFmpeg 配套使用的媒体播放器
|
||||
* ffprobe: 显示媒体文件信息的命令行工具,可将信息输出为 csv、xml、json 等格式。
|
||||
|
||||
### FFmpeg 安装
|
||||
|
||||
在 Ubuntu 等 Linux 发行版上, FFmpeg 的安装比较简单。打开终端,运行以下命令安装即可。
|
||||
|
||||
#### Ubuntu 及与其相似的发行版
|
||||
|
||||
```
|
||||
sudo apt install FFmpeg
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
在 Fedora Linux 上安装 FFmpeg,你需要添加 [RPM Fusion 仓库][2],因为 Fedora 官方仓库没有 FFmpeg 软件包。
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-
|
||||
```
|
||||
|
||||
```
|
||||
sudo dnf install FFmpeg
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
```
|
||||
pacman -S FFmpeg
|
||||
```
|
||||
|
||||
安装完成后,可输入以下命令查看安装是否成功。
|
||||
|
||||
```
|
||||
FFmpeg --version
|
||||
```
|
||||
|
||||
![FFmpeg installed in Ubuntu Linux][3]
|
||||
|
||||
### 案例:FFmpeg 的基本操作
|
||||
|
||||
首先,我们先来看看 FFmpeg 语法的一个简单例子。如下,该语法可以将 mp4 文件转换为 mkv 文件。
|
||||
|
||||
1. 视频文件格式转换
|
||||
|
||||
```
|
||||
FFmpeg -i big_buck_bunny.mp4 big_buck_bunny.mkv
|
||||
```
|
||||
|
||||
当然,这种写法最为简单易懂,但它并不完整,因为没有输入 <ruby>比特率<rt>bit rate</rt></ruby>、<ruby>分辨率<rt>resolution</rt></ruby> 以及其他的视频文件属性。
|
||||
|
||||
2. 音频文件格式转换
|
||||
|
||||
第二,输入与上面相似的命令可以转换音频文件的格式。
|
||||
|
||||
```
|
||||
FFmpeg -i sunny_day.ogg sunny_day.mp3
|
||||
```
|
||||
|
||||
3. 使用音视频 codec 执行格式转换
|
||||
|
||||
最后,在下面的例子中,我们可以使用特定的 <ruby>编解码器<rt>codec</rt></ruby> 来转换视频格式。参数 `-c` 搭配 `a` 或者 `v`,可以分别定义音频和视频文件。以下转换命令使用 `libvpx` 视频编解码器和 `libvorbis` 音频编解码器。
|
||||
|
||||
```
|
||||
FFmpeg -i big_buck_bunny.mp4 -c:v libvpx -c:a libvorbis big_buck_bunny.webm
|
||||
```
|
||||
|
||||
### 如何确定自己系统中有哪些编码器和解码器?
|
||||
|
||||
#### 显示所有编解码器
|
||||
|
||||
输入以下命令,打印所有编解码器。
|
||||
|
||||
```
|
||||
FFmpeg -codecs
|
||||
```
|
||||
|
||||
该命令可以打印出所有可用的编解码器,并显示每个编解码器对应的功能信息,比如是否支持解码或编码。此外,如以下输出结果所示,打印出来的信息还会按照首字母顺序标注出每个编码器和解码器的位置。
|
||||
|
||||
```
|
||||
D..... = Decoding supported.E.... = Encoding supported..V... = Video codec..A... = Audio codec..S... = Subtitle codec...I.. = Intra frame-only codec....L. = Lossy compression.....S = Lossless compression
|
||||
```
|
||||
|
||||
![FFmpeg Codec list][4]
|
||||
|
||||
#### 显示所有编码器
|
||||
|
||||
输入下列命令,打印出所有编码器
|
||||
|
||||
```
|
||||
FFmpeg -encoders
|
||||
```
|
||||
|
||||
#### 显示所有解码器
|
||||
|
||||
同样,输入下列命令,打印出所有解码器。
|
||||
|
||||
```
|
||||
FFmpeg -decoders
|
||||
```
|
||||
|
||||
#### 更多信息
|
||||
|
||||
输入参数 `-h`,获取更多关于编码器或解码器的信息。
|
||||
|
||||
```
|
||||
FFmpeg -h decoder=mp3
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
我希望这篇文章可以帮助你了解 FFmpeg 的基本知识及基本命令。若要了解更多信息,可前往 FFmpeg 官方网站,浏览 [<ruby>帮助文章<rt>Documentation</rt></ruby>][5]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/06/install-FFmpeg-ubuntu/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://FFmpeg.org/
|
||||
[2]: https://www.debugpoint.com/2020/07/enable-rpm-fusion-fedora-rhel-centos/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/06/FFmpeg-installed-in-Ubuntu-Linux.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/06/FFmpeg-Codec-list.jpg
|
||||
[5]: https://FFmpeg.org/documentation.html
|
@ -0,0 +1,157 @@
|
||||
[#]: subject: "How Garbage Collection works inside a Java Virtual Machine"
|
||||
[#]: via: "https://opensource.com/article/22/6/garbage-collection-java-virtual-machine"
|
||||
[#]: author: "Jayashree Huttanagoudar https://opensource.com/users/jayashree-huttanagoudar"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lkxed"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
JVM 垃圾回收的工作原理
|
||||
======
|
||||
对于程序员来说,掌握 Java 的内存管理机制并不是必须的,但它能够帮助你更好地理解 JVM 是如何处理程序中的变量和类实例的。
|
||||
|
||||
![咖啡豆][1]
|
||||
|
||||
图源:Pixabay. CC0.
|
||||
|
||||
Java 之所以能够如此流行,自动 <ruby>垃圾回收<rt>Garbage Collection</rt></ruby>(GC)功不可没,它也是 Java 最重要的几个特性之一。在这篇文章中,我将说明为什么垃圾回收如此重要。本文的主要内容为:自动的分代垃圾回收、JVM 划分内存的依据,以及 JVM 垃圾回收的工作原理。
|
||||
|
||||
### Java 内存分配
|
||||
|
||||
Java 程序的内存空间被划分为以下四个区域:
|
||||
|
||||
1. 堆区(Heap):对象实例就是在这个区域分配的。不过,当我们声明一个对象时,堆中不会有任何内存分配发生,只是在栈中创建了一个对象的引用而已。
|
||||
2. 栈区(Stack):方法、局部变量和类的实例变量就是在这个区域分配的。
|
||||
3. 代码区(Code):这个区域存放了程序的字节码。
|
||||
4. 静态区(Static):这个区域存放了程序的静态数据和静态方法。
|
||||
|
||||
### 什么是自动垃圾回收?
|
||||
|
||||
自动垃圾回收是这样一个过程:首先,堆中的所有对象会被分类为“被引用的”和“未被引用的”;接着,“未被引用的对象”就会被做上标记,以待之后删除。其中,“被引用的对象”是指程序中的某一部分仍在使用的对象,“未被引用的对象”是指目前没有正在被使用的对象。
|
||||
|
||||
许多编程语言,例如 C 和 C++,都需要程序员手动管理内存的分配和释放。在 Java 中,这一过程是通过垃圾回收机制来自动完成的(尽管你也可以在代码中调用 `system.gc();` 来手动触发垃圾回收)。
|
||||
|
||||
垃圾回收的基本步骤如下:
|
||||
|
||||
#### 1. 标记已使用和未使用的对象
|
||||
|
||||
在这一步骤中,已使用和未使用的对象会被分别做上标记。这是一个及其耗时的过程,因为需要扫描内存中的所有对象,才能够确定它们是否正在被使用。
|
||||
|
||||
![标记已使用和未使用的对象][2]
|
||||
|
||||
#### 2. 扫描/删除对象
|
||||
|
||||
有两种不同的扫描和删除算法:
|
||||
|
||||
**简单删除(标记清除)**:它的过程很简单,我们只需要删除未被引用的对象即可。但是,后续给新对象分配内存就会变得很困难了,因为可用空间被分割成了一块块碎片。
|
||||
|
||||
![标记清除的过程][3]
|
||||
|
||||
**删除压缩(标记整理)**:除了会删除未被引用的对象,我们还会压缩被引用的对象(未被删除的对象)。这样以来,新对象的内存分配就相对容易了,并且内存分配的效率也有了提升。
|
||||
|
||||
![标记整理的过程][4]
|
||||
|
||||
### 什么是分代垃圾回收,为什么需要它?
|
||||
|
||||
正如我们在“扫描删除”模型中所看到的,一旦对象不断增长,我们就很难扫描所有未使用的对象以回收内存。不过,有一项实验性研究指出,在程序执行期间创建的大多数对象,它们的存活时间都很短。
|
||||
|
||||
既然大多数对象的存活时间都很短,那么我们就可以利用这个事实,从而提升垃圾回收的效率。该怎么做呢?首先,JVM 将内存划分为不同的“代”。接着,它将所有的对象都分类到这些内存“代”中,然后对这些“代”分别执行垃圾回收。这就是“分代垃圾回收”。
|
||||
|
||||
### 堆内存的“代”和分代垃圾回收过程
|
||||
|
||||
为了提升垃圾回收中的“标记清除”的效率,JVM 将对内存划分成以下三个“代”:
|
||||
|
||||
* 年轻代
|
||||
* 老年代
|
||||
* 永久代
|
||||
|
||||
![Hotspot 堆内存结构][5]
|
||||
|
||||
下面我将介绍每个“代”及其主要特征。
|
||||
|
||||
#### 年轻代
|
||||
|
||||
所有创建不久的对象都存放在这里。年轻代被进一步分为以下两个区域:
|
||||
|
||||
1. 伊甸区(Eden):所有新创建的对象都在此处分配内存。
|
||||
2. 幸存者区(Survivor,分为 S0 和 S1):经历过一次垃圾回收后,仍然存活的对象会被移动到两个幸存者区中的一个。
|
||||
|
||||
![对象分配][6]
|
||||
|
||||
在年轻代发生的分代垃圾回收被称为 “Minor GC”。Minor GC 过程中的每个阶段都是“<ruby>停止世界<rt>Stop The World</rt></ruby>”(STW)的,这会导致其他应用程序暂停运行,直到垃圾回收结束。这也是 Minor GC 更快的原因。
|
||||
|
||||
一句话总结:伊甸区存放了所有新创建的对象,当它的可用空间被耗尽,第一次垃圾回收就会被触发。
|
||||
|
||||
![填充伊甸区][7]
|
||||
|
||||
Minor GC:在该垃圾回收过程中,所有存活和死亡的对象都会被做上标记。其中,存活对象会被移动到 S0 幸存者区。当所有存活对象都被移动到了 S0,未被引用的对象就会被删除。
|
||||
|
||||
![拷贝被引用的对象][8]
|
||||
|
||||
S0 中的对象年龄为 1,因为它们挺过了一次 Minor GC。此时,伊甸区和 S1 都是空的。
|
||||
|
||||
每当完成清理后,伊甸区就会再次接受新的存活对象。随着时间的推移,伊甸区和 S0 中的某些对象被宣判死亡(不再被引用),并且伊甸区的可用空间也再次耗尽(填满了),那么 Minor GC 又将再次被触发。
|
||||
|
||||
![对象年龄增长][9]
|
||||
|
||||
这一次,伊甸区和 S0 中的死亡和存活的对象会被做上标记。其中,伊甸区的存活对象会被移动到 S1,并且年龄增加至 1。S0 中的存活对象也会被移动到 S1,并且年龄增加至 2(因为它们挺过了两次 Minor GC)。此时,伊甸区和 S0 又是空的了。每次 Minor GC 之后,伊甸区和两个幸存者区中的一个都会是空的。
|
||||
|
||||
新对象总是在伊甸区被创建,周而复始。当下一次垃圾回收发生时,伊甸区和 S1 都会被清理,它们中的存活对象会被移动到 S0 区。每次 Minor GC 之后,这两个幸存者区(S0 和 S1)就会交换一次。
|
||||
|
||||
![额外年龄增长][10]
|
||||
|
||||
这个过程会一直进行下去,直到某个存活对象的年龄达到了某个阈值,然后它就会被移动到一个叫做“老年代”的地方,这是通过一个叫做“晋升”的过程来完成的。
|
||||
|
||||
使用 `-Xmn` 选项可以设置年轻代的大小。
|
||||
|
||||
### 老年代
|
||||
|
||||
这个区域存放着那些挺过了许多次 Minor GC,并且达到了某个年龄阈值的对象。
|
||||
|
||||
![晋升][11]
|
||||
|
||||
在上面这个示例图表中,晋升的年龄阈值为 8。在老年代发生的垃圾回收被称为 “Major GC”。
|
||||
|
||||
使用 `-Xms` 和 `-Xmx` 选项可以分别设置堆内存大小的初始值和最大值。(LCTT 译注:结合上面的 `-Xmn` 选项,就可以间接设置老年代的大小了。)
|
||||
|
||||
### 永久代
|
||||
|
||||
永久代存放着一些元数据,它们与应用程序、Java 标准环境以及 JVM 自用的库类及其方法相关。JVM 会在运行时,用到了什么类和方法,就会填充相应的数据。当 JVM 发现有未使用的类,就会卸载或是回收它们,从而为正在使用的类腾出空间。
|
||||
|
||||
使用 `-XX:PermGen` 和 `-XX:MaxPerGen` 选项可以分别设置永久代大小的初始值和最大值。
|
||||
|
||||
#### 元空间
|
||||
|
||||
Java 8 引入了元空间,并用它替换了永久代。这么做的好处是自动调整大小,避免了 <ruby>内存不足<rt>OutOfMemory</rt></ruby>(OOM)错误。
|
||||
|
||||
### 总结
|
||||
|
||||
本文讨论了各种不同的 JVM 内存“代”,以及它们是如何在分代垃圾回收算法中起作用的。对于程序员来说,掌握 Java 的内存管理机制并不是必须的,但它能够帮助你更好地理解 JVM 处理程序中的变量和类实例的方式。这种理解使你能够规划和排除代码故障,并理解特定平台固有的潜在限制。
|
||||
|
||||
正文配图来自:Jayashree Huttanagoudar,CC BY-SA 4.0
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/garbage-collection-java-virtual-machine
|
||||
|
||||
作者:[Jayashree Huttanagoudar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lkxed](https://github.com/lkxed)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jayashree-huttanagoudar
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/java-coffee-beans.jpg
|
||||
[2]: https://opensource.com/sites/default/files/2022-06/1Marking.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-06/2NormalDeletion.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-06/3DeletionwithCompacting.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-06/4Hotspot.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-06/5ObjAllocation.png
|
||||
[7]: https://opensource.com/sites/default/files/2022-06/6FillingEden.png
|
||||
[8]: https://opensource.com/sites/default/files/2022-06/7CopyingRefdObjs.png
|
||||
[9]: https://opensource.com/sites/default/files/2022-06/8ObjAging.png
|
||||
[10]: https://opensource.com/sites/default/files/2022-06/9AddlAging.png
|
||||
[11]: https://opensource.com/sites/default/files/2022-06/10Promotion.png
|
@ -0,0 +1,85 @@
|
||||
[#]: subject: "How to Boot Ubuntu 22.04 into Rescue / Emergency Mode"
|
||||
[#]: via: "https://www.linuxtechi.com/boot-ubuntu-22-04-rescue-emergency-mode/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何启动 Ubuntu 22.04 进入救援/紧急模式
|
||||
======
|
||||
极客们好,将 Ubuntu 22.04(Jammy Jellyfish)启动到救援和紧急模式有助于重置忘记的用户密码,修复文件系统错误以及在启动过程中禁用或启用 systemd 服务。
|
||||
|
||||
在这篇文章中,我们将学习如何启动 Ubuntu 22.04 LTS 系统进入救援和应急模式。救援模式类似于单用户模式,所有的故障排除步骤都在这里进行。救援模式加载最小的环境并挂载根文件系统。
|
||||
|
||||
而在紧急模式下,我们得到的是单用户 shell,而不启动任何系统服务。因此,当我们无法启动系统进入救援模式时,就需要紧急模式。
|
||||
|
||||
### 启动 Ubuntu 22.04 进入救援或单用户模式
|
||||
|
||||
前往你想启动到救援或单用户模式的目标系统。在启动时按下 “SHIFT+ESC” 键,进入 grub bootloader 页面。
|
||||
|
||||
![Default-Grub-Screen-Ubuntu-22-04][1]
|
||||
|
||||
选择第一个选项 Ubuntu,并按 “e” 键进入编辑模式。
|
||||
|
||||
在以 linux 开头的一行末尾,删除字符串 “$vt_handoff” 并添加字符串 “systemd.unit=rescue.target”。
|
||||
|
||||
![rescue-target-ubuntu-22-04][2]
|
||||
|
||||
做完修改后,按 Ctrl+x 或 F10 在救援模式下启动。
|
||||
|
||||
![Troubleshooting-Commands-in-Rescue-Mode][3]
|
||||
|
||||
进入救援模式后,运行所有的故障排除命令,并运行 “systemctl reboot” 命令来重启系统。
|
||||
|
||||
### 另一种启动系统进入救援模式的方法
|
||||
|
||||
重新启动系统并按下 “ESC+Shift” 键,进入 grub 启动界面。
|
||||
|
||||
选择第二个选项 “Advanced Options for Ubuntu”->选择恢复模式选项并点击回车->选择 Root(进入 root shell 提示)。
|
||||
|
||||
下面是一个例子
|
||||
|
||||
![Boot-Ubuntu-22-04-Rescue-Mode][4]
|
||||
|
||||
当你有了 root shell,运行命令来恢复和修复系统问题,最后使用 “systemctl reboot” 来重启系统。
|
||||
|
||||
### 引导 Ubuntu 22.04 进入紧急模式
|
||||
|
||||
要启动系统进入紧急模式,首先进入 grub 页面。
|
||||
|
||||
![Default-Grub-Screen-Ubuntu-22-04][5]
|
||||
|
||||
选择第一个选项 “Ubuntu” 并按 “e” 键进行编辑。寻找以 linux 开头的一行,移到该行的末尾,删除字符串 $vt_handoff 并添加字符串 “systemd.unit=emergency.target”。
|
||||
|
||||
![Emergency-Mode-Ubuntu-22-04][6]
|
||||
|
||||
按 Ctrl+x 或 F10 将系统启动到紧急模式。
|
||||
|
||||
![Command-in-Emergency-Mode-Ubuntu-22-04][7]
|
||||
|
||||
同样,在救援模式下,你可以在这个模式下执行所有的故障排除,完成后,就用 “systemctl reboot” 命令重启系统。
|
||||
|
||||
这篇文章的内容就这些。我发现它内容丰富,不要犹豫,在你的技术朋友中分享这个。请在下面的评论区发表你的疑问和反馈。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/boot-ubuntu-22-04-rescue-emergency-mode/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者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/lkxed
|
||||
[1]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Default-Grub-Screen-Ubuntu-22-04.png
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2022/06/rescue-target-ubuntu-22-04.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Troubleshooting-Commands-in-Rescue-Mode.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Boot-Ubuntu-22-04-Rescue-Mode.gif
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Default-Grub-Screen-Ubuntu-22-04.png
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Emergency-Mode-Ubuntu-22-04.png
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2022/06/Command-in-Emergency-Mode-Ubuntu-22-04.png
|
@ -0,0 +1,90 @@
|
||||
[#]: subject: "Edit PDFs on Linux with these open source tools"
|
||||
[#]: via: "https://opensource.com/article/22/6/open-source-pdf-editors-linux"
|
||||
[#]: author: "Michael Korotaev https://opensource.com/users/michaelk"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
用这些开源工具在 Linux 上编辑 PDF 文件
|
||||
======
|
||||
Adobe Acrobat 的开源替代品具有创建、编辑和注释 PDF 的所有必要功能。
|
||||
|
||||
![a checklist for a team][1]
|
||||
|
||||
图片由:Opensource.com
|
||||
|
||||
开源的 PDF 阅读和编辑工具通常比 “PDF 编辑器”搜索结果第一页中的应用更安全和可靠。在那里,你很可能看到带有隐藏限制和关税的专有应用,缺乏关于数据保护政策和托管的足够信息。你可以有更好的。
|
||||
|
||||
这里有五个应用,可以安装在你的 Linux 系统上(和其他系统)或托管在服务器上。每一个都是免费和开源的,具有创建、编辑和注释 PDF 文件的所有必要功能。
|
||||
|
||||
### LibreOffice
|
||||
|
||||
使用 [LibreOffice][2] 套件,你对应用的选择取决于最初的任务。虽然文字处理器 LibreOffice Writer,可以让你创建 PDF 文件,并从 ODF 和其他文本格式导出,但 Draw 更适合于处理现有的 PDF 文件。
|
||||
|
||||
Draw 是用来创建和编辑图形文件的,如小册子、杂志和海报。因此,该工具集主要集中在视觉对象和布局上。然而,对于 PDF 编辑,当文件具有编辑属性时,LibreOffice Draw 提供了用于修改和添加 PDF 内容的工具。如果没有的话,你仍然可以在现有的内容层上添加新的文本字段,并对文件进行注释或完成。
|
||||
|
||||
Draw 和 Writer 都被捆绑在 LibreOffice 桌面套件中,可在 Linux 系统、macOS 和 Windows 上安装。
|
||||
|
||||
### ONLYOFFICE Docs
|
||||
|
||||
ONLYOFFICE 一直在改进 PDF 的处理,并在 [ONLYOFFICE Docs][3] 的 7.1 版本中引入了一个全新的 PDF 和电子书的阅读器。
|
||||
|
||||
该文档编辑器允许从头开始创建 PDF 文件,使用 DOCX 作为文件的基础,然后可以转换为 PDF 或 PDF/A。通过内置的表单创建功能,ONLYOFFICE Docs 还可以建立可填充的文档模板,并将其导出为可编辑的 PDF,并为不同类型的内容设置可填充的字段:文本、图像、日期等。
|
||||
|
||||
除了可以识别 PDF 内的文本进行复制和提取外,ONLYOFFICE Docs 还可以将 PDF 转换为 DOCX,这样你就可以继续使用完全可编辑的文本格式的文件。ONLYOFFICE 还可以让你用密码保护文件,添加水印,并使用桌面版中的数字签名。
|
||||
|
||||
ONLYOFFICE Docs 可以作为一个网络套件(内部或云端)集成到文档管理系统(DMS)或作为一个独立的桌面应用程序使用。你可以将后者作为 DEB 或 RPM 文件、AppImage、Flatpack 和其他几种格式在 Linux 中安装。
|
||||
|
||||
### PDF Arranger
|
||||
|
||||
[PDF Arranger][4] 是 PikePDF 库的一个前端应用。它不像 LibreOffice 和 ONLYOFFICE 那样对 PDF 的内容进行编辑,但它对于重新排序页面、将 PDF 分割成更小的文件、将几个 PDF 合并成一个、旋转或裁剪页面等都很好。它的界面是直观的,易于使用。
|
||||
|
||||
PDF Arranger 可用于 Linux 和 Windows。
|
||||
|
||||
### Okular
|
||||
|
||||
[Okular][5] 是一个由 KDE 社区开发的免费开源文档查看器。该应用的功能非常成熟,可以查看 PDF、电子书、图片和漫画。
|
||||
|
||||
Okular 完全或部分支持大多数流行的 PDF 功能和使用场景,如添加注释和内联笔记或插入文本框、形状和印章。你还可以为文档添加数字加密签名,这样你的读者就可以确定文档的来源。
|
||||
|
||||
除了在 PDF 中添加文本和图像外,还可以从文档中检索到它们,以复制和粘贴到其他地方。Okular 中的区域选择工具可以识别所选区域内的组件,所以你可以从 PDF 中独立提取它们。
|
||||
|
||||
你可以使用你的发行版包管理器或以 Flatpak 的形式安装 Okular。
|
||||
|
||||
### Xournal++
|
||||
|
||||
[Xournal++][6] 是一款带有 PDF 文件注释工具的手写日记软件。
|
||||
|
||||
它是一款具有强化手写功能的记事软件,对于处理基于文本的内容和专业布局来说,它可能不是最佳选择。然而,它渲染图形的能力以及对书写和绘图的手写笔输入的支持使它作为一个小众生产力工具脱颖而出。
|
||||
|
||||
图层管理工具、可定制的笔尖设置以及对手写笔映射的支持,使 PDF 注释和草图绘制变得更加舒适。Xournal++ 还有一个文本工具,用于添加文本框,并能插入图像。
|
||||
|
||||
Xournal++ 可在 Linux 系统(Ubuntu、Debian、Arch、SUSE)、MacOS 和 Windows(10及以上)中安装。
|
||||
|
||||
### 总结
|
||||
|
||||
如果你正在寻找一个免费和安全的专有 PDF 浏览和编辑软件的替代品,不难找到一个开源的选择,无论是桌面还是在线使用。只要记住,目前可用的解决方案在不同的使用情况下有各自的优势,没有一个工具在所有可能的任务中都同样出色。
|
||||
|
||||
这五个方案因其功能或对小众 PDF 任务的有用性而脱颖而出。对于企业使用和协作,我建议 ONLYOFFICE 或 LibreOffice Draw。PDF Arranger 是一个简单的、轻量级的工具,当你不需要改变文本时,可以用它来处理页面。Okular 为多种文件类型提供了很好的查看功能,如果你想在 PDF 中画草图和做笔记,Xournal++ 是最佳选择。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/open-source-pdf-editors-linux
|
||||
|
||||
作者:[Michael Korotaev][a]
|
||||
选题:[lkxed][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/michaelk
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/checklist_hands_team_collaboration.png
|
||||
[2]: https://opensource.com/article/21/9/libreoffice-tips
|
||||
[3]: https://opensource.com/article/20/12/onlyoffice-docs
|
||||
[4]: https://flathub.org/apps/details/com.github.jeromerobert.pdfarranger
|
||||
[5]: https://opensource.com/article/22/4/linux-kde-eco-certification-okular
|
||||
[6]: http://xournal.sourceforge.net/
|
Loading…
Reference in New Issue
Block a user