mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-25 00:50:15 +08:00
commit
8522b64ccd
172
Dict.md
172
Dict.md
@ -1,163 +1,79 @@
|
||||
LCTT 术语词典
|
||||
======
|
||||
|
||||
<img src="https://avatars3.githubusercontent.com/u/5432002?v=3&s=200" align="right" width="100" height="100"></img>
|
||||
<font face='黑体' size=6><b><center>Linux中国术语词典</center></b></font>
|
||||
<br />
|
||||
<font face='微软雅黑' size=3><b><center>[Linux中国](http://www.linux.cn)出品</center></b></font>
|
||||
****************************************************
|
||||
****************************************************
|
||||
<font face='微软雅黑'><b>本词典为规范Linux中国翻译组(LCTT)技术术语翻译而编写,同时也方便广大翻译志愿者查阅。限于编写者的水平,其中可能有不完善或疏漏的地方,希望广大翻译志愿者不吝指正。同时,希望广大翻译志愿者能提供相关术语的翻译供大家参考。另外,若在翻译过程中对某些术语有疑虑,可在我们的QQ专门群中进行讨论。在此,谨代表LCTT感谢各位志愿者的辛勤劳动和无私奉献。</b></font>
|
||||
<font face='微软雅黑' size=3><b><p align='right'>LCTT翻译组</p></b></font>
|
||||
****************************************************
|
||||
本文收录了 LCTT 自创和选用的翻译词汇。
|
||||
|
||||
#### A ####
|
||||
### 1. APM:高级电源管理
|
||||
### 2.
|
||||
#### B ####
|
||||
### 1. Backbone:骨干
|
||||
> 是一个网络的一部分,其作为所有网络运输的一个基本通道,其需要非常高的带宽。一个骨干网络的服务提供者连接许多企业子网和较小服务提供者的网络。一个企业骨干网络连接许多局域网和数据中心。
|
||||
为什么要自创翻译词汇?在翻译过程中,我们发现一些非缩写的英语术语沿袭使用了英语单词/短语,而没有得体的、公认的、正式的对应中文翻译。我们认为,中英文混杂是对原生语言的一种污染(英文缩写除外,这是为了减少冗长的语句),按照本地化的宗旨,应该对这些词汇进行翻译,并在必要时创造新的词汇。故此,我们在几年的翻译中,逐渐推敲和形成了一些新的译法,并在我们翻译的文章中使用和推广。
|
||||
|
||||
### 2. B channel(Bearer channel):承载信道
|
||||
> 承载信道(Bearer Channel),也叫做B channel,是一个全双工DS0时间槽(64-kbps),其携带模拟语音或数字资料通过综合服务数字网(ISDN)。
|
||||
对这些译法,我们尽量遵循“信达雅”的原则。但鉴于水平所及,肯定会有所不足,虽然也有不断的调整和改进,但仍希望得到大家的反馈和指正。
|
||||
|
||||
### 3. Backchannel:反向通道
|
||||
> 是指当其他实时在线会话在进行中时,习惯使用网络化的计算机来维持一个实时的在线会话。
|
||||
我们采用的方法是:
|
||||
|
||||
### 4. Back End:后台
|
||||
> 在一个计算机系统中,是指为一个前台作业提供服务的一个节点或软件程序。前台直接影响用户,后台可能与其他系统相连接,如数据库和其它系统。
|
||||
- 音似:中文读音近似于英文原词
|
||||
- 意近:中文字的意思接近英文原意
|
||||
- 组词:根据上述两条组成新的词汇,以避免和原有词汇混淆
|
||||
|
||||
### 5. Back-haul:回程线路
|
||||
> 是一个通信信道,它使携带信息流到远于最终目的地的地方,然后将它送回。这样做是因为传输到更远的远程区域的代价要远比直接发送的代价低地多。
|
||||
此外,需要说明的是,有些译法可能已经被其他人在别的地方更早提出,但限于我们的学识和搜索能力,并未发现和了解到,并非我们故意剽窃。
|
||||
|
||||
### 6. Backoff:退避
|
||||
> 是指当一个主机已经在有MAC 协议的网络中经历了一个冲突之后试图去重发之前的等待时期。这个退避时间通常是任意的来最小化相同节点再次冲突的可能性。在每次冲突后增加退避时期也能帮助预防重复碰撞,特别当这个网络负担很重时。
|
||||
顺便说一句,2014 年对 “Shebang”(`#!`)一词翻译时,来自于 LCTT 早期重要贡献者 GOLinux 提出的 “[释伴](https://linux.cn/article-3664-1.html)” 译法,是我们第一次创造新的翻译词汇,也是我们形成这样的想法的起点。
|
||||
|
||||
### 7. Backplane:附加卡
|
||||
> 在许多网络中是一个物理接口模块,例如,连接在一个界面处理器或卡和在一个总线机箱内数据总线和功率分配总线之间的一个路由器或转换器。
|
||||
除了自创的翻译词汇外,这里还收录了一些选用的翻译词汇。有一些词汇存在多种译法,我们在翻译和使用过程中,采用了某个译法,在此列出以保持一致。
|
||||
|
||||
### 8. Back Pressure:背压
|
||||
> 在计算机系统中,是指网络拥塞信息逆流通过一个Internet网络。
|
||||
### F
|
||||
|
||||
### 9. Balun(balanced-unbalanced):不平衡变压器
|
||||
> 意味着平衡-非平衡。不平衡变压器是一个设计用来转换平衡和不平衡之间的电信号的设备。
|
||||
#### Fork
|
||||
|
||||
### 10. Baseband:基带
|
||||
> 是一种类型的网络技术,在那里仅仅一种载波频率被使用。在一个基带网中,信息在传送介质中以数字的形式被携带在一个单一的多元信号通道中。
|
||||
Fork 行为/操作广泛用于进程管理、版本管理和软件衍生方面。此词汇也长期缺乏确定的译法。
|
||||
|
||||
### 11. Bastion Host:防御主机
|
||||
> 是在内部网络和外部网络之间的一个网关,它被设计来防御针对内部网络的攻击。这个系统在非武装区(DMZ)的公共一边,不被防火墙或过滤路由器保护,它对攻击是完全暴露的。
|
||||
此前,提议者对 Fork 给出了 “复刻” 的译法。基本意思是,根据上游/父本复制一份,然后在此基础上进行修改,从而形成“衍生品”。
|
||||
|
||||
### 12: Bc(Committed Burst):约定资讯讯务
|
||||
> 是一个用在帧中继系统的术语,是一个帧中继交互网约定接受和传输和通过一个帧中继网络数据链路控制(DLC)和一个特殊的时帧的最大数据量(用比特表示)。
|
||||
有趣的是,我们发现 GitHub 的 [部分中文文档](https://docs.github.com/zh/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks) 中也采用了此译法,不知道是不是受到了我们的影响。
|
||||
|
||||
### 13. BCP(Best Current Practices):最优现行方法
|
||||
> 是副系列的IETF RFCs,其被用于描述在Internet上的最优配置技术。
|
||||
- 提议者:wxy
|
||||
- 首次链接:https://linux.cn/article-7877-1.html
|
||||
|
||||
### 14. BCU(Balanced Configuration Unit):平衡配置单元
|
||||
> 是一个综合的IBM解决方法,它由软件和硬件组成。BCUs是综合的和测试作为数据仓库系统的预配置功能块。
|
||||
### L
|
||||
|
||||
### 15. BECN(Backward Explicit Congestion Notification):显式拥塞通知
|
||||
> 是在帧中继报头的一个1比特域,其发信号到任何接收帧的事物(转换器和数据终端设备),拥塞就发生在帧的反面(后面)。帧中继转换器和数据终端设备可能遵照显式拥塞通知位来减慢那个方向的数据传输率。
|
||||
#### Live
|
||||
|
||||
### 16. BER(Bit Error Rate):误码率
|
||||
> 是接收到的位包含错误的比率。BER通常被表示成十足的负面力量。
|
||||
Live 原意多指“现场”、“实时”,在计算机环境中使用时也多引用此意。但对它的翻译就颇费神,因为无论是在 Live Patch,还是更多见的 Live USB/CD、Live Session,其实都不好翻译为“现场”、“实时”。
|
||||
|
||||
### 17. BIP(Bit Interleaved Parity):位交叉奇偶校验
|
||||
> 一个用在ATM中的术语,是一个通常用来检测链接错误的一种方法。一个检测位或字被嵌入到以前发生阻塞或帧的链接中。位错误在有效载荷中能够作为维护信息被删除和报告。
|
||||
提议者之前曾经尝试创造了新的“[临场](https://linux.cn/article-12854-1.html)”词汇,但是感觉有些不够达意。经过推敲,提议者再次推荐使用“立付”,在照顾发音的同时,取其“立时交付”之意。这样,Live USB/CD 可以译做 “立付 USB/CD”,Live Session 可以译做 “立付会话”。
|
||||
|
||||
#### C ####
|
||||
而对于 Live Stream,提议者建议依旧翻译为“直播”、“实时流”。对于 Live Patch,还是采用 “热补丁” 这样的意译。
|
||||
|
||||
#### D ####
|
||||
### 1. daemon:守护进程
|
||||
### 2.
|
||||
#### F ####
|
||||
- 提议者:wxy
|
||||
- 首次链接(临场):https://linux.cn/article-12854-1.html
|
||||
- 首次链接(立付):https://linux.cn/article-15499-1.html
|
||||
|
||||
#### G ####
|
||||
#### Repo/Repository
|
||||
|
||||
#### H ####
|
||||
### 1. Home Directory:家目录
|
||||
#### I ####
|
||||
### 1. issue:工单
|
||||
> 有翻译做“问题”的,但是应该译作“工单”,尤其是用于 GitHub 中。
|
||||
Repository 主要用于两个场景,一个是用于版本管理的代码仓库,一个是用于分发软件/组件/制品的软件仓库。
|
||||
|
||||
#### J ####
|
||||
鉴于两种场景的差异,建议在使用时,分别注明“代码仓库”或“软件仓库”,也可简称为 “代码仓”或“软件仓”。
|
||||
|
||||
#### K ####
|
||||
### S
|
||||
|
||||
#### L ####
|
||||
### 1. live CD:现场版 CD
|
||||
> 通常不翻译,但是如果翻译,可以译作“现场版”。
|
||||
### 2. live patch: 实时补丁/热补丁
|
||||
> 指 Linux 内核的 live patch 支持。
|
||||
#### Shebang [ʃɪ'bæŋ]:释伴
|
||||
|
||||
### 2. LTS(Long Term Support):长期支持
|
||||
> 该缩写词多见于操作系统发行版或者软件发行版名称中,表明该版本属于长期支持版。
|
||||
Shebang(也称为 Hashbang)是一个由井号和叹号构成的字符序列(`#!`),出现在脚本文件的第一行的前两个字符,后跟解释器路径,如:`#!/bin/sh`,这通常是 Linux 中 shell 脚本的标准起始行。
|
||||
|
||||
#### M ####
|
||||
长期以来,Shebang 都没有正式的中文名称。提议者将其翻译为:“释伴”,即解释伴随行的简称,同时又是 Shebang 的音译。(关于这个词汇的翻译,在下面的首次链接中有其它的建议和讨论。)
|
||||
|
||||
#### N ####
|
||||
- 提议者:GoLinux
|
||||
- 首次链接:https://linux.cn/article-3664-1.html
|
||||
|
||||
#### O ####
|
||||
### 1. Orchestration:编排
|
||||
> 描述复杂计算机系统、中间件(middleware)和业务的自动化的安排、协调和管理(来自维基百科)。
|
||||
#### Shell :交互界面
|
||||
|
||||
#### P ####
|
||||
### 1. P-code(Pseudo-code):伪代码语言
|
||||
> 一种解释型语言,执行方式介于编译型语言和解释型语言之间。和解释型语言一样,伪代码编程语言无需编译,在执行时自动转换成二进制形式。然而,和编译型语言不同的是,这种可执行的二进制文件是以伪代码的形式而不是机器语言的形式存储的。伪代码语言的例子有 Java、Python 和 REXX/Object REXX。
|
||||
Shell 是 Unix/Linux 等系统的 `sh`、`bash` 等命令行的接口程序,包括 DOS/Windows 的 `command.com`/`cmd.exe` 等其实也属于此类,只是通常不这样称呼。
|
||||
|
||||
### 2. PAM(Pluggable Authentication Modules):可插拔认证模块
|
||||
> 用于系统安全性的可替换的用户认证模块,它允许在不知道将使用何种认证方案的情况下进行编程。这允许将来用其它模块来替换某个模块,却无需重写软件。
|
||||
这个词汇也是一个一直没有翻译而径直使用的计算机词汇。我们也没有见到(找到)合适的翻译。但是我们在 LCTT 译者 CanYellow 翻译的一篇文章中见到他将其翻译为 “交互界面”,我们认为这是一种好的翻译。
|
||||
|
||||
### 3. Port/Ported/Porting:移植
|
||||
> 一个过程,即获取为某个操作系统平台编写的程序,并对其进行修改使之能在另一 OS 上运行,并且具有类似的功能。
|
||||
注:有些人对此次条的翻译持反对意见,此词条建议尝试性在部分语境中使用。
|
||||
|
||||
### 4. POSIX(Portable Operating System Interface for uniX):UNIX 可移植操作系统接口
|
||||
> 一组编程接口标准,它们规定如何编写应用程序源代码以便应用程序可在操作系统之间移植。POSIX 基于 UNIX,它是 The Open Group 的 X/Open 规范的基础。
|
||||
- 提议者:CanYellow
|
||||
- 首次链接:https://linux.cn/article-15469-1.html
|
||||
|
||||
#### Q ####
|
||||
### 说明
|
||||
|
||||
#### R ####
|
||||
### 1. RCS(Revision Control System):修订控制系统
|
||||
> 一组程序,它们控制组环境下文件的共享访问并跟踪文本文件的变化。常用于维护源代码模块的编码工作。
|
||||
|
||||
### 2. RFS(Remote File Sharing):远程文件共享
|
||||
> 一个程序,它让用户访问其它计算机上的文件,就好象文件在用户的系统上一样。
|
||||
|
||||
#### S ####
|
||||
### 1. shebang [ʃɪ'bæŋ]:释伴
|
||||
> Shebang(也称为Hashbang)是一个由井号和叹号构成的字符序列(#!),出现在文本文件的第一行的前两个字符,后跟解释器路径,如:#!/bin/sh,这通常是Linux中shell脚本的标准起始行。
|
||||
> 长期以来,shebang都没有正式的中文名称。Linux中国翻译组将其翻译为:释伴,即解释伴随行的简称,同时又是shebang的音译。
|
||||
|
||||
### 2. Spool(Simultaneous Peripheral Operation On-Line):假脱机
|
||||
> 将数据发送给一个程序,该程序将该数据信息放入队列以备将来使用(例如,打印假脱机程序)
|
||||
|
||||
### 2. Steganography:隐写术
|
||||
> 将一段信息隐藏在另一段信息中的做法。一个示例是在数字化照片中放置不可见的数字水印。
|
||||
|
||||
### 3. Swap:交换
|
||||
> 暂时将数据(程序和/或数据文件)从随机存取存储器移到磁盘存储器(换出),或反方向移动(换入),以允许处理比物理内存所能容纳的更多的程序和数据。
|
||||
|
||||
### 4. Scheduling:调度
|
||||
> 将任务分配至资源的过程,在计算机或生产处理中尤为重要(来自维基百科)。
|
||||
|
||||
#### T ####
|
||||
### 1. Time-sharing:分时
|
||||
> 一种允许多个用户分享处理器的方法,它以时间为基础给每个用户分配一部分处理器资源,按照这些时间段轮流运行每个用户的进程。
|
||||
|
||||
### 2. TL;DR:长篇摘要
|
||||
> Too Long;Didn't Read的缩写词,即太长,未阅的意思。该词多见于互联网社区论坛中,用于指出该文太长,没有阅读,或者标示出一篇长文章的摘要。在论坛回复中,该缩写词也多作为灌水用。因此,Linux中国翻译组将其翻译为:长篇摘要。
|
||||
|
||||
#### U ####
|
||||
|
||||
#### V ####
|
||||
### 1. VRML(Virtual Reality Modeling Language):虚拟现实建模语言
|
||||
> 一种主要基于 Web 的语言,用于 3D 效果(如构建遍历)。
|
||||
|
||||
#### W ####
|
||||
### 1. Wrapper:封装器
|
||||
> 用于启动另一个程序的程序。
|
||||
|
||||
#### X ####
|
||||
|
||||
#### Y ####
|
||||
|
||||
#### Z ####
|
||||
此文档会根据建议不断更新,其固定地址为: https://github.com/LCTT/TranslateProject/blob/master/Dict.md ,欢迎大家提交议题或拉取请求来完善它。
|
@ -0,0 +1,245 @@
|
||||
[#]: subject: "How to Analyse Sentiments Using Machine Learning"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/09/how-to-analyse-sentiments-using-machine-learning/"
|
||||
[#]: author: "Jishnu Saurav Mittapalli https://www.opensourceforu.com/author/jishnu-saurav-mittapalli/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15504-1.html"
|
||||
|
||||
如何使用机器学习来分析情感
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
本文将帮助你理解 <ruby>情感分析<rt>sentiment analysis</rt></ruby> 的概念,并且学习如何使用机器学习进行情感分析。我们使用了不同的机器学习算法进行情感分析,然后将各个算法的准确率结果进行比较,以确定哪一种算法最适合这个问题。
|
||||
|
||||
情感分析是自然语言处理(NLP)中的一个重要的内容。情感指的是我们对某一事件、物品、情况或事物产生的感觉。情感分析是一个从文本中自动提取人类情感的研究领域。它在上世纪 90 年代初才慢慢地开始发展起来。
|
||||
|
||||
本文将让你明白如何将机器学习(ML)用于情感分析,并比较不同机器学习算法的结果。本文的目标不在于研究如何提高算法性能。
|
||||
|
||||
如今,我们生活在一个快节奏的社会中,所有的商品都能在网上购买到,每个人都可以在网上发表自己的评论。而一些商品的负面网络评论可能会损害公司的声誉,从而影响公司的销售额。因此对公司来说,通过商品评论来了解客户真正想要什么变得非常重要。但是这些评论数据太多了,无法一个个地手动查看所有的评论。这就是情绪分析诞生的缘由。
|
||||
|
||||
现在,就让我们看看如何用机器学习开发一个模型,来进行基本的情绪分析吧。
|
||||
|
||||
### 现在就开始吧!
|
||||
|
||||
#### 获取数据
|
||||
|
||||
第一步是选择一个数据集。你可以从任何公开的评论中进行选择,例如推文或电影评论。数据集中至少要包含两列:标签和实际的文本段。
|
||||
|
||||
下图显示了我们选取的部分数据集。
|
||||
|
||||
![Figure 1: Data sample][1]
|
||||
|
||||
接下来,我们导入所需的库:
|
||||
|
||||
```
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from nltk.stem.porter import PorterStemmer
|
||||
import re
|
||||
import string
|
||||
```
|
||||
|
||||
正如你在上面代码看到,我们导入了 `NumPy` 和 `Pandas` 库来处理数据。至于其他库,我们会在使用到它们时再说明。
|
||||
|
||||
数据集已准备就绪,并且已导入所需的库。接着,我们需要用 `Pandas` 库将数据集读入到我们的项目中去。我们使用以下的代码将数据集读入 Pandas <ruby>数据帧<rt>DataFrame</rt></ruby> 类型:
|
||||
|
||||
```
|
||||
sentiment_dataframe = pd.read_csv(“/content/drive/MyDrive/Data/sentiments - sentiments.tsv”,sep = ‘\t’)
|
||||
```
|
||||
|
||||
#### 数据处理
|
||||
|
||||
现在我们的项目中已经导入好数据集了。然后,我们要对数据进行处理,以便算法可以更好地理解数据集的特征。我们首先为数据集中的列命名,通过下面的代码来完成:
|
||||
|
||||
```
|
||||
sentiment_dataframe.columns = [“label”,”body_text”]
|
||||
```
|
||||
|
||||
然后,我们对 `label` 列进行数值化:`negative` 的评论替换为 1,`positive` 的评论替换为 0。下图显示了经过基本修改后的 `sentiment_dataframe` 的值。
|
||||
|
||||
![Figure 2: Data frame with basic modifications][2]
|
||||
|
||||
#### 准备好特征值、目标值
|
||||
|
||||
下一步是数据的预处理。这是非常重要的一步,因为机器学习算法只能理解/处理数值形数据,而不能理解文本,所以此时要进行特征抽取,将字符串/文本转换成数值化的数据。此外,还需要删除冗余和无用的数据,因为这些数据可能会污染我们的训练模型。我们在这一步中去除了噪声数据、缺失值数据和不一致的数据。
|
||||
|
||||
对于情感分析,我们在数据帧中添加特征文本的长度和标点符号计数。我们还要进行词干提取,即将所有相似词(如 “give”、“giving” 等)转换为单一形式。完成后,我们将数据集分为两部分:特征值 X 和 目标值 Y。
|
||||
|
||||
上述内容是使用以下代码完成的。下图显示了执行这些步骤后的数据帧。
|
||||
|
||||
![Figure 3: Data frame after the division of the data set][3]
|
||||
|
||||
```
|
||||
def count_punct(text):
|
||||
count = sum([1 for char in text if char in string.punctuation])
|
||||
return round(count/(len(text) - text.count(“ “)),3)*100
|
||||
|
||||
tokenized_tweet = sentiment_dataframe[‘body_text’].apply(lambda x: x.split())
|
||||
stemmer = PorterStemmer()
|
||||
tokenized_tweet = tokenized_tweet.apply(lambda x: [stemmer.stem(i) for i in x])
|
||||
for i in range(len(tokenized_tweet)):
|
||||
tokenized_tweet[i] = ‘ ‘.join(tokenized_tweet[i])
|
||||
sentiment_dataframe[‘body_text’] = tokenized_tweet
|
||||
sentiment_dataframe[‘body_len’] = sentiment_dataframe[‘body_text’].apply(lambda x:len(x) - x.count(“ “))
|
||||
sentiment_dataframe[‘punct%’] = sentiment_dataframe[‘body_text’].apply(lambda x:count_punct(x))
|
||||
X = sentiment_dataframe[‘body_text’]
|
||||
y = sentiment_dataframe[‘label’]
|
||||
```
|
||||
|
||||
#### 特征工程:文本特征处理
|
||||
|
||||
我们接下来进行文本特征抽取,对文本特征进行数值化。为此,我们使用<ruby>计数向量器<rt>CountVectorizer</rt></ruby>,它返回词频矩阵。
|
||||
|
||||
在此之后,计算数据帧 X 中的文本长度和标点符号计数等特征。X 的示例如下图所示。
|
||||
|
||||
![Figure 4: Sample of final features][4]
|
||||
|
||||
#### 使用的机器学习算法
|
||||
|
||||
现在数据已经可以训练了。下一步是确定使用哪些算法来训练模型。如前所述,我们将尝试多种机器学习算法,并确定最适合情感分析的算法。由于我们打算对文本进行二元分类,因此我们使用以下算法:
|
||||
|
||||
* K-近邻算法(KNN)
|
||||
* 逻辑回归算法
|
||||
* 支持向量机(SVMs)
|
||||
* 随机梯度下降(SGD)
|
||||
* 朴素贝叶斯算法
|
||||
* 决策树算法
|
||||
* 随机森林算法
|
||||
|
||||
#### 划分数据集
|
||||
|
||||
首先,将数据集划分为训练集和测试集。使用 `sklearn` 库,详见以下代码:
|
||||
|
||||
```
|
||||
from sklearn.model_selection import train_test_split
|
||||
X_train, X_test, y_train, y_test = train_test_split(X,y, test_size = 0.20, random_state = 99)
|
||||
```
|
||||
|
||||
我们使用 20% 的数据进行测试,80% 的数据用于训练。划分数据的意义在于对一组新数据(即测试集)评估我们训练的模型是否有效。
|
||||
|
||||
##### K-近邻算法
|
||||
|
||||
现在,让我们开始训练第一个模型。首先,我们使用 KNN 算法。先训练模型,然后再评估模型的准确率(具体的代码都可以使用 Python 的 `sklearn` 库来完成)。详见以下代码,KNN 训练模型的准确率大约为 50%。
|
||||
|
||||
```
|
||||
from sklearn.neighbors import KNeighborsClassifier
|
||||
model = KNeighborsClassifier(n_neighbors=3)
|
||||
model.fit(X_train, y_train)
|
||||
model.score (X_test,y_test)
|
||||
|
||||
0.5056689342403629
|
||||
```
|
||||
|
||||
##### 逻辑回归算法
|
||||
|
||||
逻辑回归模型的代码十分类似——首先从库中导入函数,拟合模型,然后对模型进行评估。下面的代码使用逻辑回归算法,准确率大约为 66%。
|
||||
|
||||
```
|
||||
from sklearn.linear_model import LogisticRegression
|
||||
model = LogisticRegression()
|
||||
model.fit (X_train,y_train)
|
||||
model.score (X_test,y_test)
|
||||
|
||||
0.6621315192743764
|
||||
```
|
||||
|
||||
##### 支持向量机算法
|
||||
|
||||
以下代码使用 SVM,准确率大约为 67%。
|
||||
|
||||
```
|
||||
from sklearn import svm
|
||||
model = svm.SVC(kernel=’linear’)
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6780045351473923
|
||||
```
|
||||
|
||||
##### 随机森林算法
|
||||
|
||||
以下的代码使用了随机森林算法,随机森林训练模型的准确率大约为 69%。
|
||||
|
||||
```
|
||||
from sklearn.ensemble import RandomForestClassifier
|
||||
model = RandomForestClassifier()
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6938775510204082
|
||||
```
|
||||
|
||||
##### 决策树算法
|
||||
|
||||
接下来,我们使用决策树算法,其准确率约为 61%。
|
||||
|
||||
```
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
model = DecisionTreeClassifier()
|
||||
model = model.fit(X_train,y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6190476190476191
|
||||
```
|
||||
|
||||
##### 随机梯度下降算法
|
||||
|
||||
以下的代码使用随机梯度下降算法,其准确率大约为 49%。
|
||||
|
||||
```
|
||||
from sklearn.linear_model import SGDClassifier
|
||||
model = SGDClassifier()
|
||||
model = model.fit(X_train,y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.49206349206349204
|
||||
```
|
||||
|
||||
##### 朴素贝叶斯算法
|
||||
|
||||
以下的代码使用朴素贝叶斯算法,朴素贝叶斯训练模型的准确率大约为 60%。
|
||||
|
||||
```
|
||||
from sklearn.naive_bayes import GaussianNB
|
||||
model = GaussianNB()
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6009070294784581
|
||||
```
|
||||
|
||||
#### 情感分析的最佳算法
|
||||
|
||||
接下来,我们绘制所有算法的准确率图。如下图所示。
|
||||
|
||||
![Figure 5: Accuracy performance of the different algorithms][5]
|
||||
|
||||
可以看到,对于情感分析这一问题,随机森林算法有最佳的准确率。由此,我们可以得出结论,随机森林算法是所有机器算法中最适合情感分析的算法。我们可以通过处理得到更好的特征、尝试其他矢量化技术、或者使用更好的数据集或更好的分类算法,来进一步提高准确率。
|
||||
|
||||
既然,随机森林算法是解决情感分析问题的最佳算法,我将向你展示一个预处理数据的样本。在下图中,你可以看到模型会做出正确的预测!试试这个来改进你的项目吧!
|
||||
|
||||
![Figure 6: Sample predictions made][6]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/09/how-to-analyse-sentiments-using-machine-learning/
|
||||
|
||||
作者:[Jishnu Saurav Mittapalli][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/jishnu-saurav-mittapalli/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-1-Data-sample.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-2-Data-frame-with-basic-modifications-3.jpg
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-3-Data-frame-after-the-division-of-the-data-set.jpg
|
||||
[4]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-4-Sample-of-final-features.jpg
|
||||
[5]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-5-Accuracy-performance-of-the-different-algorithms.jpg
|
||||
[6]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-6-Sample-predictions-made.jpg
|
||||
[0]: hhttps://img.linux.net.cn/data/attachment/album/202302/03/112201q909lsqqs9e0jjzc.jpg
|
96
published/20220919 I got my first pull request merged!.md
Normal file
96
published/20220919 I got my first pull request merged!.md
Normal file
@ -0,0 +1,96 @@
|
||||
[#]: subject: "I got my first pull request merged!"
|
||||
[#]: via: "https://opensource.com/article/22/9/first-pull-request-merged"
|
||||
[#]: author: "Oluwaseun https://opensource.com/users/jhhornn"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "onionstalgia"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15502-1.html"
|
||||
|
||||
我的第一个拉取请求被合并了!
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 体验为开源做出贡献的快乐。
|
||||
|
||||
难以用言语形容我在收到合并通知(如下图)时的喜悦,当然这要归功于现在我上的工程学校 [AltSchool Africa][2]。
|
||||
|
||||
![successful merge message][3]
|
||||
|
||||
在此之前,我曾多次接触过开源的概念,了解了它在技术领域的重要性,甚至参加过开源会议(比如 OSCAFest)。我曾多次跃跃欲试,但当打开 GitHub 来想创建些东西时,冒名顶替综合症就会冒出来。
|
||||
|
||||
时间来到 2022 年 8 月 8 日星期一,当观看了 Bolaji 为开源做贡献的视频之后,我重新振奋起来。不过,想要把我学到的东西付诸实践,我注意到需要下面几个步骤:
|
||||
|
||||
步骤:
|
||||
|
||||
1. 我要下定决心,做好为一个开源项目做出贡献的心理建设。
|
||||
2. 我要根据我的技能水平进行筛选,我从一个站点([Good First Issues][4])寻找我开始的第一个项目。我不停地往下翻看,直到找到了一个符合心意的项目。
|
||||
3. 我要确定自己掌握完成项目所需的 [Git 和 GitHub][5] 知识。
|
||||
|
||||
> **LCTT 译注:**
|
||||
>
|
||||
> “[Good First Issues][4]” 这个网站主要是针对那些想为开源软件做贡献,但不知道从哪里开始或如何开始的开发者。通过为开发者提供过滤器,该网站使他们能够根据自己熟悉的编程语言来浏览和选择问题和存储库。此外,他们还可以选择他们想要解决的问题的类型。
|
||||
|
||||
### 项目
|
||||
|
||||
经过长时间查找,我终于找到了一个名为 [确保没有缺失的 alt 属性][6] 的项目。我所要做的,就是为网站上的图片提供描述性的 `alt` 值。图片的 `alt` 值有助于提高网站的辅助功能,这样屏幕阅读器就可以向视障人士提供图像的详细描述了。这很简单,对吧?是的,但假如我没有下定决心想要作出贡献,我就不会找到这项目,在我心中开源仍将是个神话。
|
||||
|
||||
我心潮澎湃,直到发现这个项目是来自 [MDN][7] 的。等等,<ruby>MDN<rt>Mozzila 开发者网络</rt></ruby>?干和 Mozilla 的开发者一样的事儿?他们会合并我这么小儿科的贡献吗?[冒名顶替综合症][8] 又开始了。
|
||||
|
||||
在检查这个议题时,我看到有人已经在提交贡献了,于是我鼓起勇气开始翻阅项目的内容。阅读和理解这个项目颇花费了我一些时间,而另一个要克服的,就是清楚处理这个议题我要怎么做。
|
||||
|
||||
这个项目就像你想的那么简单。
|
||||
|
||||
于是,我挑选了两幅图片着手尝试。我给它们的 `alt` 属性赋值,提交我的更改,然后发出拉取请求。从提交请求到收到批准邮件的这段时间,我充满了自我怀疑。我要不要关闭拉取请求?这可是 MDN 啊。好吧,这甚至都不算编程…… 如果请求没有被合并怎么办?我恐怕再也不会想为开源做出贡献了。不过,所有的疑虑都在我看到审阅者发来的这些邮件时烟消云散:
|
||||
|
||||
![拉取请求确认邮件][9]
|
||||
|
||||
![拉取请求被合并的通知邮件][10]
|
||||
|
||||
![做出贡献和请求被合并的祝贺邮件][11]
|
||||
|
||||
我喜出望外,这激发了我去检查更多图片的热情,也给了我发请求解决其他议题所需的勇气。
|
||||
|
||||
![议题分配邮件][12]
|
||||
|
||||
### 总结
|
||||
|
||||
我希望你能从这篇文章中感受到以下几点:
|
||||
|
||||
* 开源是面向所有人的。你在刚刚访问的那个网站上看到拼写错误了吗?你帮助订正了拼写错误,这就是为开源做出了贡献。
|
||||
* 没有任何技能是微不足道的。如你所见,我所做出的贡献,只需要对 HTML 最基本的了解。
|
||||
* 能阻止你做出贡献的只有你自己。
|
||||
* 要想让雪球滚起来,需要做的就只是提交第一个贡献。
|
||||
|
||||
我衷心希望你能从我的经历中获得什么,并且今天就付诸实践。这也就是我想贡献的另一个领域,那么,我们下一篇文章见,也祝你开源愉快!
|
||||
|
||||
这篇文章最初发布于 [我的第一个拉取请求被合并][13],并经许可转载。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/first-pull-request-merged
|
||||
|
||||
作者:[Oluwaseun][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[onionstalgia](https://github.com/onionstalgia)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jhhornn
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/dandelion_zoom.jpg
|
||||
[2]: https://www.altschoolafrica.com/
|
||||
[3]: https://opensource.com/sites/default/files/2022-09/successfulmerge.png
|
||||
[4]: https://goodfirstissues.com/
|
||||
[5]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/about-collaborative-development-models
|
||||
[6]: https://github.com/mdn/content/issues/19334
|
||||
[7]: https://developer.mozilla.org/en-US/
|
||||
[8]: https://opensource.com/article/20/9/imposter-syndrome
|
||||
[9]: https://opensource.com/sites/default/files/2022-09/approved.png
|
||||
[10]: https://opensource.com/sites/default/files/2022-09/merged_0.png
|
||||
[11]: https://opensource.com/sites/default/files/2022-09/thanks.png
|
||||
[12]: https://opensource.com/sites/default/files/2022-09/next.png
|
||||
[13]: https://dev.to/jhhornn/i-got-my-first-pull-request-merged-3ei9
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202302/02/170752aebzil6qjabuzb3g.jpg
|
@ -0,0 +1,145 @@
|
||||
[#]: subject: "Fedora Media Writer: World-Class LIVE USB Creator [Tutorial]"
|
||||
[#]: via: "https://www.debugpoint.com/fedora-media-writer/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15499-1.html"
|
||||
|
||||
Fedora Media Writer:顶级的立付 USB 创建器
|
||||
======
|
||||
|
||||
> 关于安装和使用 Fedora Media Writer 从 Linux 和 Windows 创建立付 USB 的教程。
|
||||
|
||||
![Fedora Media Writer][1]
|
||||
|
||||
### Fedora Media Writer
|
||||
|
||||
社区和 Fedora Linux 团队开发并维护了 [Fedora Media Writer 应用][2]。这个应用可以将任何 ISO 镜像写入你的闪存盘(U 盘)中。此外,Fedora Media Writer 还有直接从 Fedora 镜像中下载 ISO 文件的功能,前提是你有一个稳定的互联网连接。
|
||||
|
||||
此外,它还为你提供了一个下载选项列表:比如官方版本、新兴版本、定制版和实验室版本的镜像。
|
||||
|
||||
不仅如此,你还可以使用这个灵巧的工具将任何其他 ISO 镜像写入你的闪存。它不总是需要 Fedora ISO。
|
||||
|
||||
虽然有其他流行的工具可以用来创建 <ruby>立付<rt>Live</rt></ruby> USB ,比如 [Etcher][3]、Ventoy 和 Rufus,但考虑到该团队是从主流 Fedora Linux 与贡献者一起开发的,你仍然可以尝试使用此程序。
|
||||
|
||||
> **LCTT 译注**:特此说明一下使用 “立付” 一词作为 “Live” 的中文翻译。
|
||||
>
|
||||
> Live 原意多指“现场”、“实时”,在计算机环境中使用时也多引用此意。但对它的翻译就颇费神,因为无论是在 Live Patch,还是更多见的 Live USB/CD、Live Session,其实都不好翻译为“现场”、“实时”。
|
||||
>
|
||||
> 提议者之前曾经尝试创造了新的“[临场](https://linux.cn/article-12854-1.html)”词汇,但是感觉有些不够达意。经过推敲,提议者再次推荐使用“立付”,在照顾发音的同时,取其“立时交付”之意。这样,Live USB/CD 可以译做 “立付 USB/CD”,Live Session 可以译做 “立付会话”。
|
||||
>
|
||||
> 详见我们发布的[《LCTT 术语词典》](https://linux.cn/article-15496-1.html)。
|
||||
|
||||
因此,综上所述,这里是 Fedora Media Writer 的快速功能亮点。
|
||||
|
||||
#### Fedora Media Writer 的功能摘要
|
||||
|
||||
- 适用于 Linux、Windows 和 macOS
|
||||
- 直接下载 + 写入镜像到 USB 闪存
|
||||
- 官方版本(Workstation、IoT、Server)下载
|
||||
- 新兴版本(Silverblue、Kinoite)下载
|
||||
- 定制版(KDE Plasma、Xfce 等)
|
||||
- 实验室(Fedora Astronomy、Robotic 等)
|
||||
- 可作为 Linux 发行版的 Flatpak 包
|
||||
- 同时,可以将任何其他 ISO 镜像(非 Fedora)写入 U 盘。
|
||||
- 能够格式化 U 盘,恢复 U 盘
|
||||
- 基于 Qt
|
||||
|
||||
### 如何安装
|
||||
|
||||
#### Linux
|
||||
|
||||
Fedora Media Writer 以 Flatpak 的形式提供给 Linux 发行版。要在任何 Linux(如 Fedora、Ubuntu 或 Linux Mint)中安装它,请 [按照这个指南设置 Flatpak][4]。
|
||||
|
||||
然后,点击下面的链接进行安装。这将启动你的 Linux 发行版的官方软件程序(如 <ruby>发现<rt>Discover</rt></ruby>应用、GNOME <ruby>软件<rt>Software</rt></ruby> 应用)。安装后,你可以通过应用程序菜单启动它。
|
||||
|
||||
> **[以 Flatpak 形式安装 Fedora Media Writer][5]**
|
||||
|
||||
#### Windows
|
||||
|
||||
如果你是一个计划迁移到 Linux(如 Fedora)的 Windows 用户,它是一个完美的工具。你需要从 GitHub 上下载 exe 安装程序(链接如下),并按照屏幕上的指示进行安装。
|
||||
|
||||
> **[用于 Windows 的最新安装程序(exe)][6]**
|
||||
|
||||
安装完成后,你可以从开始菜单启动它。
|
||||
|
||||
#### macOS
|
||||
|
||||
对于 macOS,你可以在上述链接中获取 dmg 文件。
|
||||
|
||||
> **[用于 macOS 的最新安装程序(dmg)][6]**
|
||||
|
||||
### 如何使用 Fedora Media Writer 在 Linux 中创建立付 USB
|
||||
|
||||
第一个页面给你两个主要选项。<ruby>自动下载<rt>Download automatically</rt></ruby> 选项用于即时下载 ISO 镜像。第二个选项是直接从你的磁盘上写入已经下载的 ISO 文件。
|
||||
|
||||
如果你已经插上了 USB,你应该看到它是第三个选项。第三个选项是格式化并删除你 U 盘中的所有数据,并将其恢复到出厂设置。
|
||||
|
||||
此外,你也可以用这个工具来格式化你的 USB 闪存。你不需要任何命令或任何花哨的东西。需要注意的一点是,这个选项只有在你的 U 盘有数据时才可见。如果它已经被格式化了,该工具可以检测到它,但不会显示恢复它的选项!! 😲
|
||||
|
||||
#### 自动下载和写入
|
||||
|
||||
![Fedora Media Writer - 第一个页面][7]
|
||||
|
||||
<ruby>自动下载<rt>Download automatically</rt></ruby>选项为你提供了以下页面,可以从镜像中下载任何你想要的 Fedora ISO。这对很多人来说很有用,因为它消除了单独下载 ISO 文件、验证校验和等的麻烦。
|
||||
|
||||
![自动下载选项给了你这些选项][8]
|
||||
|
||||
在选择了发行版之后,最后的页面会给你版本(Fedora 36、35 等)和架构(x86、ARM 等)的选项。另外,你应该看到目标 USB。点击 “<ruby>下载并写入<rt>Download & Write</rt></ruby>”,开始这个过程。
|
||||
|
||||
![Fedora Media Writer 的最终写入页面][9]
|
||||
|
||||
#### 从磁盘上写入一个现有的 ISO 文件
|
||||
|
||||
当你选择 “<ruby>选择 ISO 文件<rt>select .iso file</rt></ruby>” 时,你可以从系统中选择该文件。之后,选择目标 USB 驱动器,然后点击 “<ruby>写入<rt>Write</rt></ruby>”,开始这个过程。
|
||||
|
||||
![通过 Fedora Media Writer 直接写入 ISO][10]
|
||||
|
||||
![写入进行中][11]
|
||||
|
||||
![写入完成][12]
|
||||
|
||||
写入操作完成后,你可以看到如上所示的确认信息。在我的测试中,写一个大约 3GB 的 ISO 需要大约 3 到 4 分钟。
|
||||
|
||||
### 使用 Fedora Media Writer 在 Windows、macOS 中创建 LIVE USB
|
||||
|
||||
在 Windows 和 macOS 中使用这个工具的步骤是一样的,就像上面显示的 Linux 一样。你可以在安装后轻松找到快捷方式,并以同样的方式启动。
|
||||
|
||||
![在 Windows 11 中运行][13]
|
||||
|
||||
### 结束语
|
||||
|
||||
我希望本指南能帮助你在日常的 USB 写入工作中使用 Fedora Media Writer。另外,这个工具的好处是你可以用它来格式化/恢复你的 U 盘。你不再需要 GParted 或 GNOME <ruby>磁盘<rt>Disks</rt></ruby> 应用了。
|
||||
|
||||
对于 Linux、Windows 和 macOS 用户来说,这是一个非常棒的程序。
|
||||
|
||||
加油。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/fedora-media-writer/
|
||||
|
||||
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2022/05/fmwhead2022.jpg
|
||||
[2]: https://github.com/FedoraQt/MediaWriter
|
||||
[3]: https://www.debugpoint.com/2021/01/etcher-bootable-usb-linux/
|
||||
[4]: https://flatpak.org/setup/
|
||||
[5]: https://dl.flathub.org/repo/appstream/org.fedoraproject.MediaWriter.flatpakref
|
||||
[6]: https://github.com/FedoraQt/MediaWriter/releases/latest
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/05/Fedora-Media-Writer-First-Screen.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/05/The-automatic-download-options-gives-you-these-options.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/05/The-final-Write-screen-of-Fedora-Media-Writer.jpg
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/05/Direct-ISO-write-via-Fedora-Media-Writer.jpg
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2022/05/Writing-is-in-progress.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2022/05/Writing-Complete.jpg
|
||||
[13]: https://www.debugpoint.com/wp-content/uploads/2022/05/Running-in-Windows-11.png
|
125
published/202301/20190331 Codecademy vs. The BBC Micro.md
Normal file
125
published/202301/20190331 Codecademy vs. The BBC Micro.md
Normal file
@ -0,0 +1,125 @@
|
||||
[#]: subject: "Codecademy vs. The BBC Micro"
|
||||
[#]: via: "https://twobithistory.org/2019/03/31/bbc-micro.html"
|
||||
[#]: author: "Two-Bit History https://twobithistory.org"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "CanYellow"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15469-1.html"
|
||||
|
||||
上世纪的 BBC Micro 和如今的 Codecademy
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
20 世纪 70 年代末期,计算机突然成为了某种普罗大众能够买回家的商品;而此前的几十年间,它一直只是听命于企业级霸主的神秘而笨重的机器。少数狂热的爱好者注意到了它是多么的吸引人,并争相购买了属于自己的计算机。对更多的人而言,微型计算机的到来引发了对未来的无助焦虑。同时期的杂志上的一则广告承诺,家用计算机将“让您的孩子在学校享有不公平的优势”。广告中展示了一位打着领带,身着时髦的西装外套的男孩子急切地举手回答问题,而在他的身后,他的那些显得不那么聪明的同学们闷闷不乐地望着他。这则广告以及其它类似的广告在暗示:世界正在疾速改变,而如果你不立即学习如何使用这些令人生畏的新设备之一,你和你的家人就会被时代所抛弃。
|
||||
|
||||
在英国,这些焦虑转化为政府高层对国家竞争力的担忧。从各种意义上,20 世纪 70 年代对英国来说都是平平无奇的十年,通胀与失业率高企。与此同时,一系列的罢工让伦敦陷于一次又一次的停电中。一篇 1979 年的政府报告担心:没有跟上计算机技术浪潮将“为我们糟糕的工业表现平添又一个影响因素”[^1]。英国似乎已经在计算机技术的角逐中落后了 —— 所有的大型的计算机公司都是美国的,而集成电路则在日本和中国台湾制造。
|
||||
|
||||
由英国政府建立的公共服务广播公司英国广播公司(BBC)作出了一个大胆的举动,决定通过帮助英国人战胜他们对计算机的反感,来解决英国的国家竞争力问题。BBC 发起了 “<ruby>[计算机认知计划][T3]<rt>Computer Literacy Project</rt></ruby>”,该计划包括多个教育方向的努力:几部电视连续剧、一些相关书籍、一个支持团队网络以及一款名为 [BBC Micro][T2] 的特别定制的微型计算机。该项目是如此成功,以致于 1983 年 《[BYTE][T4]》杂志的一位编辑写道:“与美国相比,英国人对微型计算机感兴趣的比例更高。”[^2] 这位编辑惊讶于在英国举办的 <ruby>第五届个人计算机世界展<rt>Fifth Personal Computer World Show</rt></ruby> 的人数比参加当年的西海岸计算机展的人数更多。超过六分之一的英国人观看了由该计划制作的第一部电视连续剧,并最终售出了 150 万台 BBC Micro 微型计算机。[^3]
|
||||
|
||||
去年,一份包含了由计算机认知计划制作的每一部电视连续剧和所有出版资料的 [档案][4] 被发布在了互联网上。我抱着极大的兴趣观看了这些电视连续剧,并试图想象在 20 世纪 80 年代早期学习计算机使用是什么样子。但事实证明,更有趣的是计算机是如何被教授的。今天,我们仍然担心技术发展使人们落伍。富有的科技企业家与政府花费大量的资金试图教孩子们“编码”。我们拥有诸如 [Codecademy][T1] 这样的网站,通过新技术的运用进行交互式编程教学。我们可能假定这种方式比 80 年代的呆板的电视连续剧更高效,不过真的是这样吗?
|
||||
|
||||
### 计算机认知计划
|
||||
|
||||
1975 年发布的 [Altair 8800][5] 拉开了微型计算机革命的大幕。不到两年,Apple II、TRS-80 以及 Commodore PET 也都相继发布。全新的计算机的销量爆发式增长。1978 年,BBC 在一部名为 《<ruby>[芯片来了][T5]<rt>Now the Chips Are Down</rt></ruby>》(LCTT 译注:对于非英国区域的读者,可以在 [这里][T6] 观看该纪录片)的纪录片中探讨了这些新机器必将会带来的剧烈的社会变革。
|
||||
|
||||
该纪录片充满担忧。在前 5 分钟内,解说员提到这种微电子器件将“彻底改变我们的生活方式”。随着诡异的合成音乐的播放,屏幕上绿色的电脉冲围绕着放大后的芯片起舞,解说员进一步说,这种芯片“正是日本放弃造船业的原因,也将成为我们的孩子们长大后失业的原因”。该纪录片继续探讨了机器人如何用于汽车自动化组装,以及欧洲的手表业如何在与美国的电子表行业竞争中败下阵来。它指责英国政府在应对未来的大规模失业的准备上做得不够。
|
||||
|
||||
该纪录片据信可能在英国议会上展示过。[^4] 包括工业署和人力服务委员会在内的一些政府代表,开始对尝试提高英国公众对计算机的认识感兴趣。人力服务委员会为来自 BBC 的教育部门提供了资助,让他们的一个团队到日本、美国以及其他国家进行了实地考察。该研究团队完成了一份报告,历数了微电子技术在工业制造、劳动关系与办公室工作等领域的哪些方面将发生重大改变。70 年代末,BBC 决定制作一部十集电视连续剧,帮助普通英国人“学习如何使用和控制计算机,避免产生被计算机支配的感受”[^5]。这一努力最终成为了一个与 “<ruby>成人认知计划<rt>Adult Literacy Project</rt></ruby>” 相似的多媒体项目。成人认知计划是 BBC 此前进行的一项工作,包括一部电视连续剧以及补充课程,帮助两百万人提高他们的阅读能力。
|
||||
|
||||
计算机认知计划背后的制作方热衷于以“实操”示例为特色的电视连续剧。这样如果观众拥有一台微型计算机在家里,他们就可以亲自动手尝试。这些例子必须使用 BASIC 语言,因为这是在几乎所有的微型计算机上都使用的编程语言(实际是整个 <ruby>交互界面<rt>shell</rt></ruby>)。但是制作者面临一个棘手的问题:微型计算机制造商均拥有他们自己的 BASIC 方言,因此不论他们选择哪一种方言,他们都不可避免地疏远大部分的观众。唯一切实可行的方案是创造一种全新的 BASIC 方言 —— BBC BASIC,以及与之配合使用的微型计算机。英国公众可以购买这种全新的微型计算机,并依照示例操作,而不需要担心软硬件上的差异带来的问题。
|
||||
|
||||
BBC 的电视制作人与节目主持人并不具备自行制造微型计算机的能力,因此他们汇总了一份他们预期的计算机的规范,并邀请英国的微型计算机公司推出满足该规范要求的新机器。这份规范要求提供一种相对更强劲的计算机,因为 BBC 的制作方认为相应的设备应当能够运行真实有用的应用程序。计算机认知计划的技术顾问还建议:如果必须要教授全体国人一种 BASIC 方言的话,那么最好选择表现良好的方言(他们可能没有确切地这样说,不过我认为这就是他们的真实想法)。BBS BASIC 通过允许递归调用与局部变量弥补了一些 BASIC 语言的常见缺点。[^6]
|
||||
|
||||
BBC 最终决定由一家位于剑桥的名为 Acorn Computers 的公司制造 BBC Micro 计算机。在选择 Acorn 公司的时候,BBC 没有接受来自 [Clive Sinclair][T7] 的申请,他经营着一家 Sinclair Research 公司。1980 年,Sinclair 公司通过 Sinclair ZX80 为英国开拓了微型计算机的大众市场。虽然 Sinclair 公司的新产品 ZX81 更便宜,但是性能不足以满足 BBC 的要求。而 Acorn 的新型计算机(内部被称为 Proton)的原型机更加昂贵,但是性能更好,更具备扩展性。BBC 对此印象深刻。该型号的计算机从未以 “Proton” 的名字上市或销售过,因为它在 1981 年 12 月以 “BBC Micro” 的名字发布了。BBC Micro 又被亲切地称为 “The Beeb”,你可以以 235 英磅的价格购得其 16k 内存的版本,或者以 335 英磅的价格获得其 32k 内存的版本。
|
||||
|
||||
到了 1980 年,Acorn 在英国计算机行业逐渐衰微,但是 BBC Micro 帮助 Acorn 公司创立了其遗留至今的宝贵遗产。时至今日,世界范围内最流行的微处理器指令集是 ARM 架构,“ARM” 如今代表的是 “<ruby>先进 RISC 架构设备<rt>Advanced RISC Machine</rt></ruby>”,然而最初它代表的是 “<ruby>Acorn RISC 架构设备<rt>Acorn RISC Machine</rt></ruby>”。ARM 架构背后的 ARM 控股公司就是 Acorn 公司在 1990 年之后的延续。
|
||||
|
||||
![Picture of the BBC Micro.][9]
|
||||
|
||||
_BBC Micro 的一幅差劲的图片,我摄于美国加州山景城的<ruby>计算机历史博物馆<rt>Computer History Museum</rt></ruby>_
|
||||
|
||||
### 《计算机程序》电视连续剧
|
||||
|
||||
作为计算机认知计划的一部分,他们最终制作了十几部不同的电视连续剧。第一部作品是一部名为 《计算机程序<rt>The Computer Programme</rt></ruby>》 的十集电视连续剧。该连续剧在 1982 年初播出了十周。每周晚上有一百万人收看该节目,还有 25 万人在每周日与周一的下午收看该节目的重播。
|
||||
|
||||
该电视节目由两名主持人主持:Chris Serle 和 Ian McNaught-Davis。Serle 扮演初学者,而 McNaught-Davis 扮演专家,他具有专业的大型计算机编程经验。这是一个启发性的方式,有些 [略显笨拙的过渡][10] —— Serle 经常直接从与 McNaught-Davis 的对话中,过渡到面向镜头的边走边说的讲述,此时你不禁会疑惑 McNaught-Davis 是否还站在画面之外。不过这意味着 Serle 可以表达观众肯定会有的关注 —— 他可能会惊恐地看着满屏的 BASIC 语言,并提出类似“这些美元符号是什么意思”的问题。在节目中的某些时刻,Serle 与 McNaught-Davis 会坐在计算机前进行事实上的结对编程。McNaught-Davis 会在各个地方留下一些线索,而 Serle 则试图将它们弄清楚。如果这一节目仅仅由一个无所不知的讲述者主持,那么它的亲和力就会差很多。
|
||||
|
||||
该节目也在努力展示计算在普通人生活中的实际应用。到 80 年代早期,家用电脑已经开始与年轻男孩和电子游戏联系在一起。计算机认知计划的制作方试图避免采访“令人印象深刻的、有能力的年轻人”,因为这可能会“加剧老年观众的焦虑”,而该节目正打算吸引这一人群对计算感兴趣 [^7]。在该系列的第一集中,该节目的 “现场” 记者 Gill Nevill 采访了一位女性,她购买了一台 Commodore PET 计算机用于辅助管理她的糖果店。这位名叫 Phyllis 的女性受访者看上去大约 60 多岁,但她在使用 PET 完成她的会计工作上没有任何问题,甚至已经开始使用 PET 为其他企业做计算机工作,这听上去像是一个有前途的自由职业的开端。Phyllis 说她并不介意计算机工作逐步取代她的糖果店生意,因为她更喜欢计算机工作。这次采访要是换成对一名青少年的采访,介绍了他是如何修改 《[Breakout][T8]》 电子游戏,以使之运行更快并更具挑战性,不过这就几乎鼓舞不了任何人。另一方面,如果普罗大众中的 Phyllis 都会使用计算机,那么你当然也可以。
|
||||
|
||||
虽然该节目以大量的 BASIC 编程为特色,不过它实际想要教给观众的是,计算机通常是如何工作的。该节目通过类比的方法解释了其中的一般原则。在第二集中,有一个关于 [Jacquard][T9] 织机(LCTT 译注:中文网络译为雅卡尔提布机)的延伸讨论,主要是两个方面:其一,它揭示了计算机并不仅仅基于昨天发明的神秘技术 —— 计算的一些基本原则可以上溯到两百年前,就跟你可以在卡片上打孔来控制纺织机的想法一样简单;其二,经线与纬线的交织用来证明二元选择(即纬线是从上方还是下方穿过经线)在不断重复时足以产生巨大变化。当然,节目接下来继续讨论信息是如何使用二进制存储的。
|
||||
|
||||
在该节目中接下来是一个蒸汽管风琴的章节,该管风琴能够演奏编码在一卷长长的、分段的打孔卡片的音乐。这个类比用以解释 BASIC 中的 <ruby>子程序<rt>subroutine</rt></ruby>。Serle 与 McNaught-Davis 将整卷的打孔卡片摊开在演播室的地板上,然后指出看上去像是重复的副歌的分段。McNaught-Davis 解释说,如果你将这些重复的卡片分段剪下,并以某种方式添加一条指令,回到第一次播放该副歌的最初的分段,这就是子程序。这是一个绝妙的解释,它在人们的脑海中的印象非常深刻。
|
||||
|
||||
我仅仅摘录了一些例子,不过我认为,总的来看该节目尤为擅长通过解释计算机实现功能所依赖的原理,使计算机不再神秘。这一节目本可以专注于 BASIC 教学,不过它并没有这样做。这被证明是一个相当明智的选择。在 1983 年写就的一篇回忆文章中,计算机认知计划的总制作人 John Radcliffe 如是写道:
|
||||
|
||||
> 如果计算机将如我们所相信的那样重要,对这一新主题的真正理解对每个人都很重要,也许与文字读写能力同等重要。不管是在我们这里还是在美国,在计算机认知的主要路线上的早期思路均集中于编程上。然而随着我们思想的发展,尽管我们意识到“动手”体验在个人计算机上的价值,但我们开始降低对编程的重视,而更多的强调广泛的理解,将微型计算机与大型计算机联系起来,鼓励人们获取一系列应用程序与高级语言的经验,并将这些经验同现实世界中的工业与商业活动中的经验联系起来……。我们相信,一旦人们掌握了这些最简单的原则,它们将可以进一步深入该主题。
|
||||
|
||||
后来,Radcliffe 又以类似的口吻写道:
|
||||
|
||||
> 围绕着这一系列节目的主要阐释目标有很多争论。一些人认为,在使用微型计算机上的实际细节上给予建议,对本项目而言尤为重要。但我们的结论是,如果该系列节目要拥有可持续性的教育价值,它就必须通过对计算原理的解释,成为进入真实计算世界的一种方式。这需要通过对微型计算机上的室内演示,通过类比方式解释其中的原则,以及通过电影说明实际应用的真实例子来实现。不仅仅是微型计算机,小型机以及大型机也将被展示。
|
||||
|
||||
我喜爱这一连续剧,尤其是其中关于小型机与大型机的部分。计算机认知计划背后的制作方旨在帮助英国人找准定位:计算身处何处又去向何方?计算机现在能做什么,未来又能做什么?学习一些 BASIC 语言是回答这些问题的一个部分,但是仅仅理解 BASIC 语言似乎不足以使人们认知计算机。
|
||||
|
||||
### 如今的计算机认知
|
||||
|
||||
如果你现在搜索“学习编码”,你看到的排在第一的是指向 Codecademy 网站的链接。如果要说存在一个“计算机认知计划”的现代替代品 —— 具有相同的影响与目标,那就是 Codecademy。
|
||||
|
||||
“<ruby>学习编码<rt>learn to code</rt></ruby>” 是 Codecademy 的口号。我认为我不是第一个指出这一点的人 —— 事实上我可能在某个地方读过这句话,只是现在拿来用而已。但是这里使用的是 “<ruby>编码<rt>code</rt></ruby>” 而非 “<ruby>编程<rt>program</rt></ruby>”,这说明了一些问题。这表明你学习的重要内容是如何读懂代码,如何阅读满屏的 Python 代码的意思,而不是目光呆滞、不知所云。我能够理解为什么对于普通人而言,这似乎是成为专业程序员的主要障碍。专业程序员整日盯着布满编程术语的计算机屏幕,如果我想要成为一个专业程序员,我最好确保我能够理解这些天书一样的字符。但是理解语法并不是成为程序员的最大的挑战。在更大的障碍面前,它很快将变成微不足道。仅仅以掌握一门编程语言的语法为目标,你可能能够 _阅读_ 代码,但是无法做到 _编写_ 代码以解决全新的问题。
|
||||
|
||||
我最近学习了 Codecademy 的 《编程基础》 课程。如果你对编程感兴趣(而不是对网页开发或者数据科学),并且没有任何编程经验,这是 Codecademy 推荐你学习的课程。里面有几节关于计算机科学史的课时,不过都是流于表面而没有深入研究。(感谢上帝,[一位高尚的互联网秩序义务维护者][12] 指出了其中存在的一个特别恶劣的错误)。该课程的主要目的是教授你编程语言的通用结构要素:变量、函数、控制流、循环等。换句话说,该课程聚焦于为了让你理解天书般的代码中的模式,而所需要知道的内容。
|
||||
|
||||
公平地看,Codecademy 也提供了其他内容深入的课程。但是即使是如 《计算机科学之路》 这样的课程也几乎只仅仅专注于编程以及程序中表达的概念。有人可能会反驳说这才是重点 —— Codecademy 的主要特点就是提供给你一些交互式的、带有自动反馈的编程课程。在有限的自动化课程中能够灌输给学员的内容只有这么多,因此学员的脑海里也没有更多的空间容纳更多其他的内容。但是负责启动计算机认知计划的 BBC 的制作人也面临同样的问题。他们意识到受限于他们的传播媒介,“通过电视节目所能获得的学习内容的容量也是受限的”[^8]。虽然在他们所能传达的信息总量上存在相似的限制,但是 BBC 的制作人选择强调在学习 BASIC 语言上的一般原则。难道 Codecademy 就不能将其中一两节交互式可视化的课时替换为编织经线与纬线的 Jacquard 织机的案例吗?
|
||||
|
||||
我一直在大声鼓吹 “一般原则”,因此让我再解释下我认为的一般原则是什么,以及为什么它们如此重要。J. Clark Scott 出了一本有关计算机的书,书名为 《<ruby>但是它怎么知道?<rt>But How Do It Know?</rt></ruby>》。这个书名来自书的序言里的一则笑话:一个店员向人群推销保温瓶,说保温瓶可以让热食始终是热的,冷食始终是冷的。一名听众对这个新发明感到惊讶,问道,但是它怎么知道(根据你给它的食物类型的不同选择做相应的事情呢)?笑点在于保温瓶当然不能感知食物的温度然后据此做出决定 —— 保温瓶仅仅制作成保证冷食必然保持冷的,热食必然保持热的就可以了。人们也以(笑话中的那个听众)一样的方式看待计算机,相信计算机就是数字大脑,能够基于提供给它们的代码 “选择” 做一件事或者另一件事。但是了解一些有关计算机如何工作的知识,哪怕是很初级水平的理解,也能让(人们理解中的)计算机摆脱(做判断的)侏儒。这就是为什么 Jacquard 织机是一个很好的有助理解的例子。一开始它似乎是一种难以置信的设备,它读取打孔卡片,然后以某种方式“知道”编织正确的样式。现实是显而易见的:每一行孔都对应一根线,而一行中有孔的地方对应着提起的线。理解了这些虽然不会有助于你用计算机完成新的事情,但是将使你自信于你不是在跟某些神秘事物打交道。我们应当尽快将这种自信的感受传授给初学者。
|
||||
|
||||
唉,可能真正的问题是没有人想要了解 Jacquard 织机。根据 Codecademy 如何强调他们教授的专业应用来判断,很多人开始使用 Codecademy 可能是因为他们相信这有助于 “提升” 他们的职业水平。他们没有来由地相信,首要的问题是理解编程的专业术语,因此他们才想要 “学习编码”。他们想要在他们所拥用的。每天晚上晚餐与就寝之间的一两个小时里尽快完成这件事。Codecademy 毕竟只是一门投其所好的生意,而非一些有关 18 世纪就发明了的机器的间接说明。
|
||||
|
||||
另一方面,计算机认知计划是供职于 BBC 的一群制作人与公务员所认为的,将计算机的使用教给国民的最好的方式。我承认,因为这一群人教会大众他们无法以己之力所能求得的事物,而赞美这一群人的建议多少有点精英主义。但我情不自禁认为他们做对了。许多人使用 BBC Micro 第一次学会了使用计算机,他们中的很多人进而成为了成功的软件开发者或游戏设计师。[正如我曾经所说的][14],我怀疑在计算机已经变得相对简单的时代里,学习使用计算机是一个巨大的优势。不过或许这群人所拥有的另一个优势在于有像 《计算机程序》 这样的尽己所能不仅仅教授编程,而且教授计算机是为什么又是如何运行程序的节目。在看完 《计算机程序》 之后,你可能并不能理解计算机屏幕上的所有天书般的编程术语,但是实际上你也并不需要,因为你知道无论 “代码” 是什么样子,计算机总是在重复做基础的事情。在完成了 Codecademy 上的一到两个课程之后,你可能能够感受一些天书般的编程术语,但是对你来说,一台计算机仍然只是一台能够以某种方式将天书般的字符转化为运行的软件的魔法机器。但这并不是计算机认知。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2019/03/31/bbc-micro.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[CanYellow](https://github.com/CanYellow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://twobithistory.org
|
||||
[b]: https://github.com/lujun9972
|
||||
[4]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/
|
||||
[5]: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html
|
||||
[9]: https://twobithistory.org/images/beeb.jpg
|
||||
[10]: https://twitter.com/TwoBitHistory/status/1112372000742404098
|
||||
[12]: https://twitter.com/TwoBitHistory/status/1111305774939234304
|
||||
[14]: https://twobithistory.org/2018/09/02/learning-basic.html
|
||||
[15]: https://twitter.com/TwoBitHistory
|
||||
[16]: https://twobithistory.org/feed.xml
|
||||
[17]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw
|
||||
[20]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf
|
||||
|
||||
|
||||
[^1]: Robert Albury and David Allen, Microelectronics, report (1979).
|
||||
[^2]: Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, <https://archive.org/stream/byte-magazine-1983-01/1983_01_BYTE_08-01_Looking_Ahead#page/n41/mode/2up>.
|
||||
[^3]: John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, <https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf>.
|
||||
[^4]: David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, <https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/history>.
|
||||
[^5]: ibid.
|
||||
[^6]: Williams, 51.
|
||||
[^7]: Radcliffe, 11.
|
||||
[^8]: Radcliffe, 5.
|
||||
|
||||
[T1]: https://www.codecademy.com/
|
||||
[T2]: https://bbcmicro.computer/
|
||||
[T3]: https://clp.bbcrewind.co.uk/history
|
||||
[T4]: https://archive.org/details/byte-magazine?tab=about
|
||||
[T5]: https://www.bbc.co.uk/iplayer/episode/p01z4rrj/horizon-19771978-now-the-chips-are-down
|
||||
[T6]: https://archive.org/details/BBCHorizon19771978NowTheChipsAreDown
|
||||
[T7]: https://en.wikipedia.org/wiki/Sinclair_Research
|
||||
[T8]: https://en.wikipedia.org/wiki/Breakout_(video_game)
|
||||
[T9]: https://www.scienceandindustrymuseum.org.uk/objects-and-stories/jacquard-loom
|
||||
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/23/131931eegzjokllq1j440z.jpg
|
@ -0,0 +1,109 @@
|
||||
[#]: subject: "Pandas: The Popular Python Library for Data Analysis and Data Science"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/08/pandas-the-popular-python-library-for-data-analysis-and-data-science/"
|
||||
[#]: author: "Phani Kiran https://www.opensourceforu.com/author/phani-kiran/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15484-1.html"
|
||||
|
||||
Pandas:用于数据分析和数据科学的最热门 Python 库
|
||||
======
|
||||
|
||||
> Pandas 是一个十分流行的 Python 第三方库。本文介绍了 Pandas 库中的一些特性和函数,并且我们鼓励读者亲手使用 Pandas 库,来解决实际的业务问题。
|
||||
|
||||
Pandas 为 Python 中数据分析提供了基础和高级的构建组件。Pandas 库是用于数据分析与数据操作的最强大和最灵活的开源**分析工具**之一,并且它还提供了用于建模和操作表格数据(以行和列组织的数据)的**数据结构**。
|
||||
|
||||
Pandas 库有两个主要的数据结构:第一个是 “<ruby>系列<rt>Series</rt></ruby>”,该数据结构能够很方便地从 Python 数组或字典中**按位置或指定的索引名称**来检索数据;第二个是“<ruby>数据帧<rt>DataFrames</rt></ruby>”,该数据结构将数据存储在行和列中。列可以通过列名访问,行通过索引访问。列可以有不同类型的数据,包括列表、字典、序列、数据帧、NumPy 数组等。
|
||||
|
||||
### Pandas 库可以处理各种文件格式
|
||||
|
||||
有各种各样的文件格式。用于数据分析的工具必须能够提供处理各种文件格式的方法。
|
||||
|
||||
Pandas 可以读取各种文件格式,例如 CSV 文件、JSON 文件、XML 文件、Parquet 文件、SQL 文件,详见下表。
|
||||
|
||||
| | 写入 | 读取 |
|
||||
| :- | :- | :- |
|
||||
| CSV 文件 | `to_csv` 函数 | `read_csv` 函数 |
|
||||
| JSON 文件 | `to_json` 函数 | `read_json` 函数 |
|
||||
| Parquet 文件 | `to_parquet` 函数 | `read_parquet` 函数 |
|
||||
| SQL 文件 | `to_sql` 函数 | `read_sql` 函数,`read_sql_query` 函数,`read_sql_table` 函数 |
|
||||
| XML 文件 | `to_xml` 函数 | `read_xml` 函数 |
|
||||
|
||||
### 使用 Pandas 进行数据清理
|
||||
|
||||
在现实场景中,很多数据集存在数据缺失、数据格式错误、错误数据或重复数据的情况,如果要对使数据分析更加准确,就需要对这些没有用的数据进行处理。此外,数据还会有需要 <ruby>屏蔽<rt>mask</rt></ruby> 的敏感和机密信息。接下来,Pandas 提供了清理、丢弃、替换、屏蔽等方法,来处理这些坏数据。
|
||||
|
||||
#### Pandas 清洗空值:
|
||||
|
||||
a. 空行可以使用 `df.dropna(inplace=True)` 方法来删除。
|
||||
|
||||
b. 空值可以使用 `df.fillna(<value>, inplace=True)` 方法来替换。还可以指定某一个列来替换该列的空数据。
|
||||
|
||||
#### Pandas 屏蔽数据:
|
||||
|
||||
c. 要屏蔽所有不满足条件 `my_list.where(my_list < 5)` 的敏感数据的值,可以使用 `my_list.mask(my_list < 5)`。
|
||||
|
||||
#### Pandas 清洗重复数据:
|
||||
|
||||
d. 要删除重复数据,可以使用 `drop_duplicates()` 方法:
|
||||
|
||||
```
|
||||
df.drop_duplicates(‘<column>’, keep = False)
|
||||
df.drop_duplicates(‘<column>’, keep = ‘first’)
|
||||
df.drop_duplicates(‘<column>’, keep = ‘last’)
|
||||
```
|
||||
|
||||
### 使用 Pandas 进行数据分析
|
||||
|
||||
下面的表格列出了 Pandas 中进行数据分析的各种函数,以及其语法。(请注意:`df` 代表一个 <ruby>数据帧<rt>DataFrame</rt></ruby> 数据结构的实例。)
|
||||
|
||||
| 语法 | 描述 |
|
||||
| :- | :- |
|
||||
| `df.head(x)` | `head()` 函数用于读取前面的 x 行,如果不填参数 x,默认返回 5 行 |
|
||||
| `df.tail(x)` | `tail()` 函数用于读取尾部的 x 行,如果不填参数 x ,默认返回最后 5 行,空行各个字段的值返回 NaN |
|
||||
| `loc(x:y)` | Loc 函数返回指定行的数据,也可以对数据进行切片 |
|
||||
| `groupby('<column>')` | 对指定列的数据进行分组 |
|
||||
| `df['column'].sum()` | 计算指定列数据的总和 |
|
||||
| `df['column']. mean()` | 计算指定列数据的算术平均值 |
|
||||
| `df['column'].min()` | 计算指定列数据的最小值 |
|
||||
| `df['column'].max()` | 计算指定列数据的最大值 |
|
||||
| `df.sort_values(['column'])` | 在指定列上根据数值进行排序,默认升序 |
|
||||
| `df.size` | 返回元素的个数,即为行数 * 列数 |
|
||||
| `df.describe` | 返回对各列的统计汇总 |
|
||||
| `pd.crosstab(df['column1'], df['column2'], margins = True)` | 创建 `column1` 和 `column2` 的交叉表 |
|
||||
| `df.duplicated([column1, 'column2'])` | 根据 `column1` 和 `column2` 中的重复值,返回 `True` 或 `False` |
|
||||
|
||||
### Pandas 的优点
|
||||
|
||||
* 支持多索引(层次索引),方便分析多维数据。
|
||||
* 支持数据透视表的创建,堆栈和取消堆栈操作。
|
||||
* 可以使用 Pandas 处理有限值的分类数据。
|
||||
* 支持分组和聚合运算。
|
||||
* 可以禁用排序。
|
||||
* 支持行级过滤(获取满足过滤条件的行)和列级过滤(只选择需要的列)。
|
||||
* 有助于重塑数据集(数组的维度变换)。还可以转置数组的值,并转换为列表。当你使用 Python 处理数据时,可以将 Pandas 数据帧转换为多维 NumPy 数组。
|
||||
* 支持面向标签的数据切片。
|
||||
|
||||
### Pandas 的不足
|
||||
|
||||
Pandas 的代码和语法与 Python 不同,所以人们需要额外再学习 Pandas。此外,相较于 Pandas,像三维数据这样的高维数据会在 NumPy 等其他库有更好的处理。
|
||||
|
||||
### 总结
|
||||
|
||||
Pandas 能够大幅提升数据分析的效率。它与其他库的兼容性使它在其他 Python 库中都能有效地使用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/08/pandas-the-popular-python-library-for-data-analysis-and-data-science/
|
||||
|
||||
作者:[Phani Kiran][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/phani-kiran/
|
||||
[b]: https://github.com/lkxed
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/27/163400o6afgegh0nf4nfec.jpg
|
@ -0,0 +1,107 @@
|
||||
[#]: subject: "Give your Terminal a Retro Look Using this Neat Application"
|
||||
[#]: via: "https://www.debugpoint.com/cool-retro-terminal/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15493-1.html"
|
||||
|
||||
给你的终端一个复古的外观
|
||||
======
|
||||
|
||||
> 想让你的终端有一个复古的外观?本指南将帮助你在 Linux 发行版中安装 Cool Retro Terminal 应用程序。
|
||||
|
||||
![酷炫复古终端][1]
|
||||
|
||||
你有没有想过如何在你的 Linux 终端中模仿那些老式 CRT 显示器的外观?
|
||||
|
||||
那些 CRT 屏幕有自己的粉丝。如果你把苹果 2 或 IBM 3278 终端之类与今天的 4K 显示器显示相比较,它们的外观真的很酷。我并不是说 4K 显示器不好,但有时传统的显示器会让我们想起那些过去的日子。闲话少说。让我们开始安装这个应用程序。
|
||||
|
||||
### Cool Retro Terminal
|
||||
|
||||
该应用程序是自由开源的。它被称为 [cool-retro-term][2]。它是轻量级的,有许多自定义选项,有预先设置的配置文件,如 Apple 2 等。它还能在你的终端中提供那些静态噪音和扫描线效果。很酷,不是吗?
|
||||
|
||||
它是用 Qt 构建的,需要 Qt 5.2 或更高版本。如果你使用的是最新的 Linux 发行版,在依赖性方面你应该没问题。
|
||||
|
||||
![绿色扫描线主题][3]
|
||||
|
||||
### 如何下载和安装 Cool Retro Terminal
|
||||
|
||||
Ubuntu、Linux Mint 和其他基于 Debian 的发行版:
|
||||
|
||||
使用下面的简单命令在你的 Ubuntu 和其他相关发行版中安装这个应用程序:
|
||||
|
||||
```
|
||||
sudo apt install cool-retro-term
|
||||
```
|
||||
|
||||
Arch Linux:
|
||||
|
||||
这个软件包在 Arch 用户仓库(AUR)中可用。如果你没有启用 AUR,请使用 [本指南][4] 启用它,然后使用以下命令来安装它:
|
||||
|
||||
```
|
||||
pacman -S cool-retro-term
|
||||
```
|
||||
|
||||
Fedora、RHEL 和其他相关发行版:
|
||||
|
||||
对于 Fedora 和其他相关的 Linux,使用下面的命令来安装这个应用程序:
|
||||
|
||||
```
|
||||
sudo dnf install cool-retro-term
|
||||
```
|
||||
|
||||
Appimage:
|
||||
|
||||
也有一个 AppImage 格式的独立的可执行程序,你可以直接下载并运行。不需要安装。按照下面的命令来做:
|
||||
|
||||
```
|
||||
wget https://github.com/Swordfish90/cool-retro-term/releases/download/1.1.1/Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
chmod a+x Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
./Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
```
|
||||
|
||||
注意:在 GitHub 中,没有 1.2.0 以后的版本的 AppImage 构建版。
|
||||
|
||||
### 配置
|
||||
|
||||
安装完成后,你可以在应用程序菜单中找到终端应用程序 “Cool Retro Term”。那么,启动该应用程序并享受其中吧。
|
||||
|
||||
请记住,这覆盖你的 Linux 发行版中的默认控制台/终端应用程序。它是一个独立的控制台应用程序。
|
||||
|
||||
配置选项可以通过右键菜单访问。
|
||||
|
||||
上下文菜单给你提供了以下预设。然后你可以通过设置窗口对它们中的每一个进行颜色和外观设置的配置。例如,如果你想要更多的透明度、对比度或更多的噪音、环境光或闪烁。所有这些都可以从下面的设置窗口通过几个选项进行配置。
|
||||
|
||||
而且,你可以轻松地制作你自己的主题。
|
||||
|
||||
![Cool Retro Term 中的预装主题][5]
|
||||
|
||||
![设置中的各种效果][6]
|
||||
|
||||
### 总结
|
||||
|
||||
Cool Retro Terminal 是一个用于 Linux 桌面的老式显示管终端,它可以让你体验到如同坐在复古终端前的感觉。你可能喜欢,也可能不喜欢,而且人们几乎不把它作为日常使用。但它仍然是一个漂亮的终端,可以时不时地体验一下,以摆脱平凡的终端。
|
||||
|
||||
你喜欢复古的外观吗?你最喜欢的主题是什么?请在下面的评论区告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/cool-retro-terminal/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[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/wp-content/uploads/2021/12/cool-retro-terminal-1024x576.jpg
|
||||
[2]: https://github.com/Swordfish90/cool-retro-term
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/12/Green-Scanlines-Theme-1024x594.jpg
|
||||
[4]: https://www.debugpoint.com/2021/01/install-yay-arch/
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/12/Pre-loaded-Themes-in-Cool-Retro-Term-1024x599.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2021/12/Various-Effects-in-Settings.jpg
|
@ -0,0 +1,142 @@
|
||||
[#]: subject: "10 universal steps for open source code review"
|
||||
[#]: via: "https://opensource.com/article/22/10/code-review"
|
||||
[#]: author: "Martin Kopec https://opensource.com/users/martin-kopec"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "yzuowei"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15489-1.html"
|
||||
|
||||
开源代码评审的十个通用步骤
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 只要你遵循这些通用流程,代码评审并不可怕。
|
||||
|
||||
你是否需要在你还没有完全理解整个项目时就对代码进行评审?抑或你避开了评审,以免让你看起来不知道如何进行。
|
||||
|
||||
本篇文章想要告诉你一个更好的方法。<ruby>代码评审<rt>code review</rt></ruby> 并不需要你知道所有事情。实际上,就我个人经验而言,这种情况非常普遍。
|
||||
|
||||
我还记得作为实习生加入 <ruby>红帽<rt>Red Hat</rt></ruby> 的时候,被要求参与代码评审。我们当时采取的是 +1 或 -1 的投票系统,而我在一开始的时候常常踌躇于该如何评审。我发现我会问自己,如果我对于一处改动给予了 +1,而别人却投了 -1,我是不是看起来很蠢?
|
||||
|
||||
如果你对一处改动投了 +1,而别人投了 -1,这又意味着什么呢?答案是不意味任何事!你可能只是漏掉了一处别人注意到的细节。这不意味着世界末日。这也是为什么我们会用投票系统。正如同所有开源项目一样,代码合并是一项协同工作。
|
||||
|
||||
最近,我接到了太多的代码评审工作,以至于我几乎做不过来。我同时也注意到,参与评审的贡献者数量正在稳步减少。
|
||||
|
||||
出于这个原因,我想要写一篇文章阐述我对代码评审的个人观点。在这篇文章里,我会分享一些诀窍与技巧。我将会向你展示几个用来问自己的问题,以及在评审代码时需要注意的一些地方。
|
||||
|
||||
### 代码评审的目的是什么?
|
||||
|
||||
你是否曾写过一个非常简单的补丁?你认为它是如此微不足道,不需要审查。或许你直接就合并了它。直到晚些时候,你意识到你犯了个错误,一个明显的或是愚蠢的错误,比如错误的缩进,比如几行重复的代码而不是调用函数(是的,这些都是经验之谈!)。
|
||||
|
||||
如果有其他人来审查代码,就会发现这些东西。
|
||||
|
||||
代码评审的一个目的便是为你带来一双新的眼睛,从新的视角看待你要尝试解决的问题。这种新的背景也正是为什么代码评审至关重要。
|
||||
|
||||
你可能认为你必须是一个语言专家,才能审查别人的代码、项目,或两者。让我来告诉你一个所有代码评审者都想跟你说的秘密吧:大错特错!你并不需要完全理解该项目或者编程语言,就可以为一个改动提供全新的视角。下面,我将向你展示代码评审的通用流程。
|
||||
|
||||
### 代码评审的通用流程
|
||||
|
||||
这是我的代码评审流程,拆分成了几个要点。这个流程包含了我会问自己的一些问题,以帮助我专注于代码的变化以及其后果。你不需要严格依照这个顺序来进行评审。如果有任何原因导致你无法执行其中的某一步,跳过那一步就好。
|
||||
|
||||
#### 1、理解改动,它想要解决的问题,以及为什么要这么做
|
||||
|
||||
为什么需要改动的解释以及任何相关背景都应该被放在 <ruby>提交<rt>commit</rt></ruby> 信息里。如果没有,请要求提供,并请投 -1 直到相关信息被提供。
|
||||
|
||||
改动想解决的问题需要被解决吗?它是项目应当关注的问题,还是与项目完全无关?
|
||||
|
||||
#### 2、你会如何实现解决方案?它会不一样吗?
|
||||
|
||||
在这个时候,你应该已经知道代码改动是为了什么。换做是你会怎么做?在进一步对改动进行细节评审前,先思考这个问题。如果你想出了一个不一样的解决方案,并且你认为你的方案更好,在评审中提出来。你不需要投 -1;去问问作者为什么没有往那个方向走,看看这次讨论会把你们带向何方。
|
||||
|
||||
#### 3、运行有改动和没有改动的代码
|
||||
|
||||
我通常会在代码中设置几个断点,运行代码并检查新代码是如何与其余部分互动的。
|
||||
|
||||
如果你无法运行整个代码,试着将带有新代码的函数复制到一个新的本地文件,模拟输入数据,然后运行。这在你不知道怎么运行整个项目,或者无法接触到运行所需的特殊环境时很有帮助。
|
||||
|
||||
#### 4、新代码会破坏任何东西吗?
|
||||
|
||||
我是说,任何东西。想一想可能的后果。
|
||||
|
||||
以一个新的命令行选项为例,它会总是被目标所接受吗?
|
||||
|
||||
是否存在这样一种情况,使得新选项无法被接受或是会与其他东西起冲突?
|
||||
|
||||
或许新代码是导入了新的东西。那么这个新的库,以及可能的新的依赖关系,能够在老版本或者项目的运行系统中被找到吗?
|
||||
|
||||
安全方面呢?新的依赖足够安全吗?你至少可以在网上快速地搜索一下。还有,注意一下控制台日志里的警告。有的时候在同一个库里也可以找到更安全的函数。
|
||||
|
||||
#### 5、新代码是否有效?
|
||||
|
||||
你刚刚确认了被提出的解决方案大概是正确的。现在该检查代码本身了。你需要关注代码的有效性和必要性。
|
||||
|
||||
检查新代码的风格。它与项目的代码风格相匹配吗?任何开源项目都(应该)有一份文档告知(新)贡献者项目所遵循的风格和优秀实践。
|
||||
|
||||
比如说,OpenStack 社区的所有项目都有一份 HACKING.rst 文件。你经常也能找到一份[新贡献者指南][1]包含所有必须知道的信息。
|
||||
|
||||
#### 6、确认所有新增的变量和导入都被使用
|
||||
|
||||
你正在评审的代码常常已经过多次迭代,有的时候代码的最终版本与初始版已迥然不同。所以我们很容易忘记一些在历史版本中加入的变量与引用。自动化检测通常会用到 lint 工具,类似 Python 中的 [flake8][12]。
|
||||
|
||||
(LCTT 译注:[lint][5] 指编程中用来发现代码潜在错误和约束代码风格的工具,起源于 C 语言编程中的静态分析工具 `lint`。“lint” 本意为衣服上积累的绒毛与灰尘,“lint” 的取名寓意则在于捕捉编程时产生的“绒毛与灰尘”)
|
||||
|
||||
(LCTT 校注:我建议,“Lint” 工具可以翻译为 “代码清理” 或 “代码清洁” 工具。)
|
||||
|
||||
你可以在不声明新变量的情况下重写代码吗?通常情况下你可以,但问题是这样是否更好。这会带来什么益处吗?我们的目标不是要创造尽可能多的单行代码,而是写出高效且易读的代码。
|
||||
|
||||
#### 7、新的函数和方法是否必要?
|
||||
|
||||
项目里的别的地方是否存在可以被复用的功能类似的函数?确保避免重新发明轮子以及重新实现已经被定义的逻辑永远都是值得的。
|
||||
|
||||
#### 8、有单元测试吗?
|
||||
|
||||
如果补丁增加了新的函数或者在函数内添加了新的逻辑,它也应该附带对应的单元测试。新函数的作者总是比别人更适合写该函数的单元测试。
|
||||
|
||||
#### 9. 验证重构
|
||||
|
||||
如果这次提交对现有代码进行了重构(它可能重命名了某个变量,或者是改变了的变量的作用域,或者是通过加减参数来改变函数的足迹,又或者是删去了某个东西),问一问你自己:
|
||||
|
||||
- 这个可以被删除吗?它会影响到稳定分支吗?
|
||||
- 所有出现的地方都删掉了吗?
|
||||
|
||||
你可以利用 [grep 命令][3] 来查找。你不会相信有多少次我投 -1 就是因为这个。这是一个任何人都会犯的简单错误,也正因如此任何人都可以发现它。
|
||||
|
||||
提交的所有者很容易忽略这些事情,这完全可以理解。我也犯过很多次这种错误。我最终发现问题的根源在于我太急于提出评审,以至于我忘记了对仓库进行整体检查。
|
||||
|
||||
除了对项目仓库的检查外,检查其他代码用户也十分必要。如果有别的项目导入了这个项目,它们可能也需要进行重构。在 OpenStack 社区中,我们有对应的工具来查询别的社区项目。
|
||||
|
||||
#### 10、项目文档是否需要做出更改?
|
||||
|
||||
你可以再一次使用 [grep 命令][4] 来检查在项目文档中是否提到了相关的代码改动。用常识来判断这次改动是否需要被收入文档以告知最终用户,还是只是一个不会影响用户体验的内部变化。
|
||||
|
||||
#### 额外提示:考虑周到
|
||||
|
||||
当你在评审完新代码后提出建议或评论时,要考虑周到,反馈准确,描述详尽。如果有你不理解的地方就发出提问。如果你认为代码存在错误,解释你的理由。记住,如果作者不知道什么地方出了问题,他们就无法修复它。
|
||||
|
||||
### 最后几句
|
||||
|
||||
唯一的坏评审是没有评审。通过评审和投票,你提供了你的观点并为此投票。没有人指望你来做出最终决定(除非你是核心维护者),但是投票系统允许你提供你的观点和意见。相信我,补丁所有者会很高兴你这么做了的。
|
||||
|
||||
你能想到别的要点来给出好的评审吗?你是否有我不知道的特殊技巧?在评论中分享它们吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/code-review
|
||||
|
||||
作者:[Martin Kopec][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[yzuowei](https://github.com/yzuowei)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/martin-kopec
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://docs.openstack.org/tempest/latest/contributor/contributing.html
|
||||
[2]: https://opensource.com/article/19/5/python-flake8
|
||||
[3]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[4]: https://www.redhat.com/sysadmin/how-to-use-grep
|
||||
[5]: https://codedocs.org/what-is/lint-software
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/29/140840wsbypukbubp69buv.jpg
|
@ -0,0 +1,101 @@
|
||||
[#]: subject: "What you actually need to know about open source to get started"
|
||||
[#]: via: "https://opensource.com/article/22/11/get-started-open-source"
|
||||
[#]: author: "Katie Edwards https://opensource.com/users/kaedward"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "yzuowei"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15492-1.html"
|
||||
|
||||
关于开源,你需要知道些什么
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 一份用简单直白的语句来解释开源的新手指南。
|
||||
|
||||
要是你想要(或需要)知道 [开源][1] 的意思究竟是什么。我会介绍开源的一些基础,无论你是对项目贡献感兴趣,还是在想要融入的新工作圈子里总是听到这个名词,因为这个词总是被人不断的提起。
|
||||
|
||||
我坦白,我这个人没什么技术经验,在极具技术性的开源社区中从事着内容设计的边缘工作。考虑到我原来的背景是营销与传播,我决定换工作时感觉就像离了水的鱼儿。[Git][2]、数据科学、软件的来龙去脉……直到一年后的今天,我依然感到难以消化。
|
||||
|
||||
但这正是为什么我要写这篇文章。我想要让开源变得不那么令人生畏。毕竟,开源的中心是一个支持型的学习社区 —— 这个社区对所有人开放,无论你是否有技术经验。
|
||||
|
||||
我会从基础中的基础开始。
|
||||
|
||||
### 什么是开源?
|
||||
|
||||
在此声明,业界对开源的定义可以在 <ruby>[开放源代码促进会][3]<rt>Open Source Initiative</rt></ruby> 的网站找到。
|
||||
|
||||
然而,大众对“开源”软件的认知通常为它不用花钱,它的源代码是公开的,任何人都可以对其贡献,你可以重新发布它或者用它做任何你想做的事。
|
||||
|
||||
这里面有些是真的,而有些则属于常见的误解,其中之一就是关于花费。
|
||||
|
||||
#### 开源只要 0 元
|
||||
|
||||
这是真的吗?大部分情况下是,但不是所有情况。开源软件的本质在于代码的公开性,所以获取软件本身确实不需要花费。但是,依赖开源项目营利的公司也确实存在。但如果软件不需要花钱,开源公司又是如何生存的?他们该如何盈利?
|
||||
|
||||
拥有“免费产品”这个概念本身是反直觉的。但你要知道:一个公司不一定要靠出售软件来赚钱,它也可以从产品的管理,数据的储存,以及对客户的支持中获利。
|
||||
|
||||
很多公司都采用了订阅模式,他们提供客户支持服务以帮助客户解决软件问题并为客户解答疑惑。数据储存也并非免费,这也是能为公司带来收入的另一领域。从这个角度来说,在销售的“产品”不是软件,而是订阅服务。
|
||||
|
||||
- **开源代码是公开访问的**:这是真的吗?是的,永远都是。“开源”一词的先决条件正是这份公开性。源代码必须允许被查看、使用、修改和重新发布。
|
||||
- **你可以用这份代码做任何你想做的事**:这是真的吗?依情况而定。许可证条款会对你对代码的使用方式作出限制,但你通常都可以用代码做你想做的事。无论是调整该项目以满足特殊需求,还是以此为基础做些别的,开源软件允许你和其他所有人对其修改。
|
||||
- **任何人都可以贡献开源项目**:这是真的吗?是的,但有限制。所有有 [合适技能][4] 的人都可以贡献开源。但是,这不意味着所有的贡献都会被接受和采纳。
|
||||
|
||||
比如说,你对一个目标是对地球上所有的鸟类进行分类的项目感兴趣。你恰好很喜欢恐龙,特别是那些最终进化成如今的鸟类的恐龙。于是,你为所有最像鸟类的恐龙提交了条目。项目所有者在看到这些后可能会想:“不错,这都是些很棒的史前鸟类。”但他们也可能会认为:“嗯……这些恐龙看起来像鸟,但他们还不是鸟,因此他们不属于鸟类百科。”
|
||||
|
||||
幸运的是,项目里的工作通常有法可依。开源项目通常有着贡献指南和行为准则,所以你不用担心你会加入什么使得项目脱轨的东西。
|
||||
|
||||
### 为什么选择开源呢?
|
||||
|
||||
那么,在众多贡献之后(如果这些贡献完成的话),为什么人们愿意免费赠送他们的软件?如果有那么多人为此付出了时间与精力,他们为什么不能联合起来为软件明码标价?
|
||||
|
||||
这个问题有很多回答。我在这里给出了一些:
|
||||
|
||||
- 创业是艰难的,如果你开发的项目展现不出赚钱的潜力则尤其如此。召集一群志同道合的人,没有承诺也没有对薪水的期望,相对而言要简单得多。
|
||||
- 大部分开源社区的成员对软件的改进或者实现感兴趣,但他们没有时间或者不愿意将项目作为他们的全职工作。有时候开源代表的是热情驱动的项目、极客组成的团体,还有凝聚众人智慧对恼人问题的解决方案。
|
||||
- 围绕各种规模的开源项目形成的团体促进了支持型社区的成形,在这里贡献者与旁观者都可以练习他们的技能,改进他们常用的软件,互教互学,并为发声被听到而感到振奋。很多开源社区本质上就是高度集中的线上爱好者俱乐部。
|
||||
|
||||
### 我该如何参与呢?
|
||||
|
||||
现在你可能会问你自己:“我知道了这些信息又可以做些什么呢?我能贡献开源项目吗?如果我不够优秀的话该怎么办?”
|
||||
|
||||
不要害怕 —— 即便是 [新手][5] 也欢迎为开源项目做贡献。在与社区一起朝着更大的目标共同努力的同时,你也得到了一个磨练技能的绝佳机会。况且,正如我之前所说,最坏的情况也不过是你的提交不被“鸟类百科”所接受(而这也是因为项目的所有者看不到你对鸟类百科的愿景,那是一片关于鸟类知识的网络天地,鸟与他们的祖先在那里愉快地共存)。
|
||||
|
||||
你需要会写代码来贡献开源吗?与大众认知相违的是,[你不需要][6]。项目“需要举全村之力”以兴旺,这意味着他们需要来自不同背景的人的贡献。视觉设计师、撰稿人、营销、评审、翻译、主题爱好者,甚至只是最终产品的用户,都是可贵的贡献者。他们不仅是帮忙搭建并改进了产品,他们也识别出了漏洞,提出了修改建议,为项目做出宣传,最终使得社区强大。
|
||||
|
||||
简单来说,不论你的背景是什么,经验有多少,只要你对开源或是某个特别的项目感兴趣,你几乎可以保证会被张开双臂欢迎。
|
||||
|
||||
### 现在就加入开源吧
|
||||
|
||||
还是不确定应该从哪开始?这里有些能帮助你的想法和资源:
|
||||
|
||||
- [Up For Grabs][7] 是一份“专门为新贡献者策划任务的开源项目清单。”这里很适合新贡献者们来寻找简单的初次 PR 机会,这次机会也能让你探寻你更喜欢哪种贡献。
|
||||
- 来看看 GitHub 上的这份 [新手友好项目][8] 列表吧。
|
||||
- 如果你还是缺乏灵感,考虑一下[贡献][9](或一起“飞”) <ruby>红帽<rt>Red Hat</rt></ruby>的开放设计系统 [PatternFly][10]。
|
||||
- LCTT 夹带私货:你还可以通过参与 LCTT 的翻译工作来首次体验如何参与开源,这几乎简单到你只需要懂一点点英文和一些热情,本文就是由开源贡献者翻译贡献而成的。入口在此: https://linux.cn/lctt/
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/get-started-open-source
|
||||
|
||||
作者:[Katie Edwards][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[yzuowei](https://github.com/yzuowei)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/kaedward
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/resources/what-open-source
|
||||
[2]: https://opensource.com/resources/what-is-git
|
||||
[3]: https://opensource.org/osd
|
||||
[4]: https://opensource.com/life/16/1/8-ways-contribute-open-source-without-writing-code
|
||||
[5]: https://opensource.com/article/18/4/get-started-open-source-project
|
||||
[6]: https://opensource.com/article/22/8/non-code-contribution-powers-open-source
|
||||
[7]: https://up-for-grabs.net/?ref=hackernoon.com#/
|
||||
[8]: https://github.com/MunGell/awesome-for-beginners
|
||||
[9]: https://github.com/patternfly
|
||||
[10]: https://www.patternfly.org/v4/get-started/design
|
||||
[11]: https://img.linux.net.cn/data/attachment/album/202301/30/110936lhhk216wajijdh22.jpg
|
@ -0,0 +1,84 @@
|
||||
[#]: subject: "4 key differences between Twitter and Mastodon"
|
||||
[#]: via: "https://opensource.com/article/22/11/twitter-vs-mastodon"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "onionstalgia"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15486-1.html"
|
||||
|
||||
Twitter 和 Mastodon 的四个关键区别
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> Mastodon 并不是一家公司。所有 Mastodon 实例都由各自所属服务器的贡献者负责支持维护的。以下是它的一些其他优势。
|
||||
|
||||
社交媒体并不总是社交性的,有时我们还需要足够的推动力来改变我们工作和阅读的内容。我在 2008 年开始使用 Twitter 作为 RSS 阅读器的替代品,这彻底颠覆了我那时的阅读和学习方式。世界各地的教育家和自由与开放源码(FOSS)倡导者的推文让我了解并参与到一个无与伦比的学习网络中。但这在过去的六年间,事情发生了变化,以及最近它的所有权发生了变化,造成我阅读的内容更多是由算法驱动的,而不是出于我个人的兴趣和选择。在几年前的 Opensource.com 记者编辑碰头会中,[Seth Kenlon][1] 建议我试试 [Mastodon][2]。于是我在 2019 年加入了 [Fosstodon][3]。Fosstodon 是一个专为喜欢自由和开源软件的同好们搭建的实例。
|
||||
|
||||
### Mastodon 与 Twitter 对比
|
||||
|
||||
作为一个墨守成规的人,改变对我来说并不容易,尽管 Twitter 变得越来越让人厌倦,我还一直在使用。可是到了 2022 年的春天,Twitter 的出售危机让我重新考虑使用 Fosstodon 了。
|
||||
|
||||
### 1、收藏而不是点赞
|
||||
|
||||
Mastodon 的界面与 Twitter 很相似。但在 Mastodon上,你不是“点赞”一个帖子,而是通过点击帖子下方的星标来“收藏”一个帖子。
|
||||
|
||||
![Favorite button][4]
|
||||
|
||||
### 2、分享帖子
|
||||
|
||||
在 Twitter 上,重新分享是“<ruby>转推<rt>retweet</rt></ruby>”,但在 Mastodon,它是“<ruby>转嘟<rt>boost</rt></ruby>”。你可以点击帖子下方的双箭头图标来转嘟。
|
||||
|
||||
![Boost button][5]
|
||||
|
||||
### 3、Mastodon 实例
|
||||
|
||||
任何人都可以运行一个 Mastodon 实例,这让不同的实例上发展出了独特的社区(类似在 Twitter 上围绕特定标签形成的社区,不过 Mastodon 也有标签),有些实例有一套独特的规则。举个例子,和我以前的社交网络不同,Fosstodon 上采取了内容审核制度。最初这让我觉得有些严格,我发了一个与自由与开放源码软件无关的帖子,然后帖子就被删除了。我被告知的删除原因是,我没有给帖子打上 “内容警告”。这惹怒了我,于是我尝试寻找别的实例,发现了几个更符合我胃口的。其中一个是 [Mastodon.social][6],另一个是 [Scholar.social][7],前者是一个泛用的实例,没有预设的发帖主题,后者则是一个学术专用的实例。当然,他们也都制定有严格的行为规范。
|
||||
|
||||
每个实例都有规则,虽然在表述上略有不同,但都清楚地说明了可以接受和不可接受的行为。Fosstodon 公布了它的 [行为规范][8],确立了站点的规则和预期。
|
||||
|
||||
### 4、开源社交网络
|
||||
|
||||
如果你也想运行自己的 Mastodon 实例或协助开发一个,好消息是,Mastodon 是开源的。它使用 AGPLv3 许可证,它的源代码可以在 [Git 仓库][9] 获得。Mastodon 使用 [ActivityPub][10] 协议与世界各地的服务器通信。
|
||||
|
||||
Mastodon 不是互联网上的单一的网站,而是一系列横跨全球并相互通信的网站们。这个联邦网络被称为 “<ruby>联邦宇宙<rt>Fediverse</rt></ruby>”。不像其他社交网站有单一的所有者,任何人都可以在服务器上运行 Mastodon 或者其他 ActivityPub 协议网站。
|
||||
|
||||
从用户的角度来看,这一开始时其实并不重要。你可以在任何 Mastodon 实例上注册,然后连接到其余所有的实例。
|
||||
|
||||
不过,这种分布式设计是有其好处的。如果你碰见一个实例上的社区内容你不想看,你可以从屏蔽该实例中的某个用户,或者屏蔽整个实例。
|
||||
|
||||
过去的一个月里,我又回到了 Fosstodon,主要还是因为我热衷开源。我很享受在 Fosstodon 上分享开源内容,而 Fosstodon 上的其他用户也都能乐于看到关于自由和开源软件的帖子。当我有一些内容不适合在 Fosstodon 上分享时,我会分享到 Scholar.social 或者 Mastodon.social 上。
|
||||
|
||||
不是所有的实例都有关注的主题,即便是那些有主题的实例,主题常常也是仅作参考,而不是严格作为删帖的依据。如果你有特定的兴趣,也许就能找到一个围绕这个话题建立的社区,然后马上就能收获及时的关注。当然,你也依然能够与其他实例的用户交流。
|
||||
|
||||
### 试试 Mastodon
|
||||
|
||||
Mastodon 不是一家公司,所有 Mastodon 实例都是由各自所属的服务器的贡献者负责支持维护的。有些能很容易地通过 Patreon 或 PayPal 提供支持。
|
||||
|
||||
我发现,联邦宇宙是个很温馨的地方,把快乐带回给了社交网络。你加入了 Mastodon 了吗?有没有什么收获?请在评论中告诉我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/twitter-vs-mastodon
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[onionstalgia](https://github.com/onionstalgia)
|
||||
校对:[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/users/seth
|
||||
[2]: https://joinmastodon.org/
|
||||
[3]: https://fosstodon.org/about/
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/favorite-button.webp
|
||||
[5]: https://opensource.com/sites/default/files/2022-11/boost-button.webp
|
||||
[6]: https://mastodon.social/about
|
||||
[7]: https://scholar.social/about/more
|
||||
[8]: https://hub.fosstodon.org/coc/
|
||||
[9]: https://github.com/mastodon/mastodon
|
||||
[10]: https://en.wikipedia.org/wiki/ActivityPub
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/28/093152q9c5yeo9dyebp2mj.jpg
|
194
published/202301/20221111.4 ⭐️⭐️ Drop swap for zram on Linux.md
Normal file
194
published/202301/20221111.4 ⭐️⭐️ Drop swap for zram on Linux.md
Normal file
@ -0,0 +1,194 @@
|
||||
[#]: subject: "Drop swap for zram on Linux"
|
||||
[#]: via: "https://opensource.com/article/22/11/zram-swap-linux"
|
||||
[#]: author: "David Both https://opensource.com/users/dboth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15487-1.html"
|
||||
|
||||
在 Linux 上用 zram 替代传统交换空间
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> zram 是一个用于创建内存压缩缓存的工具,特别是可以用作交换空间。
|
||||
|
||||
我在我的电脑上花了很多时间(我是说工作),我发现了很多有趣的东西。其中最近引起我注意的是 `zram0` 设备。我是在几个月前写一篇文章时第一次注意到它,它显示在 `lsblk` 命令的输出中:
|
||||
|
||||
```
|
||||
# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||
sda 8:0 0 931.5G 0 disk
|
||||
├─sda1 8:1 0 600M 0 part
|
||||
[...]
|
||||
zram0 252:0 0 8G 0 disk [SWAP]
|
||||
```
|
||||
|
||||
它被识别为交换空间,这就是首先引起我的好奇心的原因,所以我做了一些研究。zram 最初被称为 “<ruby>压缩缓存<rt>compcache</rt></ruby>”,即 “压缩的高速缓存”。事实证明,zram 是一个用于创建内存内压缩缓存的工具,特别是作为交换空间使用。
|
||||
|
||||
但为什么呢?
|
||||
|
||||
当我开始研究 zram 时,我只发现了几篇关于将 zram 用于交换空间的基础文章。起初,这对我来说似乎有点违反直觉。毕竟,如果你的内存快用完了,你把页面交换到内存中的虚拟驱动器中,有什么好处呢?
|
||||
|
||||
然后我找到了 Fedora 项目的维基页面,它提议使用 <ruby>[zram 交换空间][1]<rt>swap-on-zram</rt></ruby>。该建议说:“交换是有用的,除了它的速度很慢。zram 是一个使用了压缩的内存驱动器。在启动时创建一个 zram 交换空间,并且不再使用默认的交换分区。”
|
||||
|
||||
该页面的其余部分是关于它的细节、好处、副作用和反馈。
|
||||
|
||||
### Linux 上用于交换空间的 zram
|
||||
|
||||
使用 zram 作为交换空间,与常规的基于分区或基于文件的交换空间做的事情相同。当内存压力过大时,一些最近使用最少的数据会被移到交换空间。平均来说,它会被压缩到其原始大小的 50% 左右,并被放置在内存的 zram 空间中。这比将这些内存页存储在硬盘上要快得多,并可以释放出它所使用的内存用于其他用途。
|
||||
|
||||
### 节省交换空间
|
||||
|
||||
我试图找到关于配置多少交换空间或 zram 交换空间的总结建议。这使我重新回顾了交换空间的设置,以及我之前的文章《[现代 Linux 系统的正确交换空间是多少?][2]》。就我所知,从 RHEL 和 Fedora 的最新文档来看,推荐的交换空间数量并没有改变。不过,该文档忽略了 zram 的使用。
|
||||
|
||||
然而,在不使用 zram 的旧版 Linux 或 zram 被禁用的情况下,之前文章中的表格仍然为交换空间的分配提供了一个好的起点。
|
||||
|
||||
我找到的关于 zram 功能的文档在 zram 如何根据内存大小分配空间,以及分配给 zram 交换空间的数量方面是不一致的。
|
||||
|
||||
由于缺乏权威性的文档,我进行了一些实验来凭经验确定用于分配 zram 交换空间的算法。我为此使用了我自己的物理和虚拟系统。结果很有趣,与我迄今为止发现的任何文档都不一致。
|
||||
|
||||
在所有足够大的系统上,zram 的默认大小是 8GB,但在内存较小的主机上通常会大大减少。在我用于测试的一台虚拟机(VM)上,可以访问 4GB 的内存,zram 的虚拟交换空间被分配为 3.8GB。我的一台旧戴尔电脑拥有 8GB 的内存,zram 被设置为 7.6GB。当内存减少到 2GB 时,zram 就减少到 1.9GB。
|
||||
|
||||
我拥有的所有内存超过 8GB 的物理和虚拟主机都显示正好是 8GB 的 zram。这包括我拥有 64GB 内存的主工作站和其他拥有 16GB 或 32GB 内存的主机。
|
||||
|
||||
基于这几个数据点,我可以得出这样的结论:目前的默认设置是最多 8GB 的 zram,而在 8GB 或以下的主机上,zram 占内存的 95%。
|
||||
|
||||
我读过一些文章,其中提到了 zram 交换空间的其他大小,甚至高达 100% 的内存,但这些似乎都是理论上的,而不是现实。
|
||||
|
||||
你的发行版可能不同,但这里是 Fedora 和类似发行版的实际 zram 交换空间的分配情况:
|
||||
|
||||
- 内存 ⇐ 8 GB:0.95 × 内存
|
||||
- 内存 > 8 GB:8 GB
|
||||
|
||||
请注意,zram 交换空间大小的算法并没有基于对任何给定的现实世界的系统或应用程序的 “最佳” 交换大小的建议。这种 zram 交换空间的分配是一种相当概率性的方法,它应该在广泛的 Linux 主机上运行良好。然而,最大的 zram 交换空间大小被配置为 8GB,而且我一直推荐 8GB 作为传统交换空间的最大容量,我想我可以说它反映了 zram 交换空间的最佳大小。
|
||||
|
||||
### 管理 zram 交换空间
|
||||
|
||||
zram 的默认值保存在 `/usr/lib/systemd/zram-generator.conf` 配置文件中。以下是我的一个测试虚拟机,分配了 5097GB 的内存。
|
||||
|
||||
```
|
||||
# cat /usr/lib/systemd/zram-generator.conf
|
||||
# This config file enables a /dev/zram0 device with the default settings:
|
||||
# - size - same as available RAM or 8GB, whichever is less
|
||||
# - compression - most likely lzo-rle
|
||||
#
|
||||
# To disable, uninstall zram-generator-defaults or create empty
|
||||
# /etc/systemd/zram-generator.conf file.
|
||||
[zram0]zram-size= min(ram, 8192)
|
||||
```
|
||||
|
||||
你可以在 `zram-generator.conf` 配置文件的最后一行改变默认的 zram 交换空间大小。但我建议不要这样做,除非你能明确说明这样做的原因,并在你做任何改变后测试你的结果。像 Linux 中的许多其他配置默认值一样,zram 的默认值已经被很好地测试过了,适合大多数使用情况。
|
||||
|
||||
### 监控 zram
|
||||
|
||||
可以使用 `zramctl` 工具来查看 zram 的当前状态。
|
||||
|
||||
```
|
||||
# zramctl
|
||||
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
|
||||
/dev/zram0 lzo-rle 4.8G 4K 80B 12K 4[SWAP]
|
||||
```
|
||||
|
||||
传统的 `swapon` 命令也可以用来查看交换,包括作为交换使用的 zram:
|
||||
|
||||
```
|
||||
# swapon --show
|
||||
NAME TYPE SIZE USED PRIO
|
||||
/dev/zram0 partition 4.8G 0B 100
|
||||
```
|
||||
|
||||
需要注意的是,`zramctl` 在不包含数据时不报告 zram,所以结果会包含空输出。而像 `lsblk`、`swapon`、 `top`、`free`、`htop` 等工具,即使不包含数据,也会显示 zram。
|
||||
|
||||
### 停用 zram
|
||||
|
||||
`swapoff -a` 命令会关闭 zram 交换空间以及用作交换的传统 HDD 或 SSD 存储。`swapon -a` 命令在 zram 为空时不显示它,可以使用 `zramctl /dev/zram0` 代替。
|
||||
|
||||
```
|
||||
# swapon --show# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||
sda 8:00 120G 0 disk
|
||||
├─sda1 8:10 1G 0 part /boot/efi
|
||||
├─sda2 8:20 1G 0 part /boot
|
||||
└─sda3 8:30 118G 0 part
|
||||
├─vg01-root 253:00 10G 0 lvm /
|
||||
├─vg01-swap 253:10 3G 0 lvm [SWAP]
|
||||
├─vg01-usr 253:10 30G 0 lvm /usr
|
||||
├─vg01-home 253:20 10G 0 lvm /home
|
||||
├─vg01-var 253:30 30G 0 lvm /var
|
||||
└─vg01-tmp 253:40 10G 0 lvm /tmp
|
||||
sr0 11:01 1024M 0 rom
|
||||
zram0 252:00 0B 0 disk
|
||||
# zramctl## zramctl /dev/zram0
|
||||
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
|
||||
/dev/zram0 lzo-rle 0B 0B 0B 0B 4
|
||||
```
|
||||
|
||||
注意,`/dev/zram0` 在这些命令中并没有显示为交换空间,直到它被用于该目的。这给我造成了一些困惑,直到我的实验表明这是事实。
|
||||
|
||||
### 创建 zram 交换空间
|
||||
|
||||
zram 本身已经存在了大约 20 年,但只是在过去的一两年里才在一些发行版上作为交换空间使用。你的一些或所有主机上当前的 Linux 环境可能没有用 zram 创建交换空间。如果是这种情况,它可以很容易地被补救。
|
||||
|
||||
对于 Fedora 32,它是默认使用 zram 交换空间之前的最后一个版本,它只需要三个简单的命令。
|
||||
|
||||
首先,验证是否存在 `zram-swap.service` 文件,它作为 `zram` RPM 包的一部分安装:
|
||||
|
||||
```
|
||||
# systemctl status zram-swap
|
||||
● zram-swap.service - Enable compressed swap in memory using zram
|
||||
Loaded: loaded (/usr/lib/systemd/system/zram-swap.service; disabled; vendor preset: disabled)
|
||||
Active: inactive (dead)
|
||||
```
|
||||
|
||||
接下来,安装 `zram-generator-defaults` 和 `zram-generator` 软件包:
|
||||
|
||||
```
|
||||
# dnf install zram-generator-defaults zram-generator
|
||||
```
|
||||
|
||||
启用并启动 `zram-swap` 服务:
|
||||
|
||||
```
|
||||
# systemctl enable zram-swap.service# systemctl start zram-swap.service
|
||||
```
|
||||
|
||||
然后验证 `zram0` 是否存在并被用作交换空间:
|
||||
|
||||
```
|
||||
# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:00 120G 0 disk
|
||||
├─sda1 8:10 2G 0 part /boot
|
||||
└─sda2 8:20 118G 0 part
|
||||
├─vg01-root 253:00 10G 0 lvm /
|
||||
├─vg01-swap 253:10 3G 0 lvm [SWAP]
|
||||
├─vg01-usr 253:20 35G 0 lvm /usr
|
||||
├─vg01-tmp 253:30 15G 0 lvm /tmp
|
||||
├─vg01-var 253:40 35G 0 lvm /var
|
||||
└─vg01-home 253:50 20G 0 lvm /home
|
||||
sr0 11:01 1024M 0 rom
|
||||
zram0 252:00 7.5G 0 disk [SWAP]
|
||||
```
|
||||
|
||||
### 用 zram 改进交换空间
|
||||
|
||||
这就是全部内容了。在 Fedora 上这很容易。不同的发行版可能也一样简单,只是软件包名称和命令的细节可能不同。在你的电脑上试试 zram 交换空间吧。在我的下一篇文章中,我将进一步演示一些 zram 选项。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/zram-swap-linux
|
||||
|
||||
作者:[David Both][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dboth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM
|
||||
[2]: https://opensource.com/article/19/2/swap-space-poll
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/28/113826twvkkbrso9ws2kss.jpg
|
@ -0,0 +1,140 @@
|
||||
[#]: subject: "How to Setup Python Development Environment in Ubuntu and Fedora"
|
||||
[#]: via: "https://www.debugpoint.com/setup-python-environment-ubuntu-fedora/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15475-1.html"
|
||||
|
||||
如何在 Ubuntu 和 Fedora 中设置 Python 开发环境
|
||||
======
|
||||
|
||||
> 本文将帮助你了解在 Ubuntu 和 Fedora 中设置 Python 开发环境的基础知识和步骤。
|
||||
|
||||
[Python][1] 由于其强大的库、简单的语法和可移植性,在过去几年中变得很流行。目前几乎所有的企业系统都在使用它。
|
||||
|
||||
因此,如果你正试图建立你的 Python 环境,并想知道如何开始等等,那么你就找到正确的地方了。在这里,我试图给你一些开始的步骤。
|
||||
|
||||
### 在 Ubuntu 和 Fedora 中设置 Python 开发环境
|
||||
|
||||
#### Python 版本
|
||||
|
||||
如果你刚刚开始 Python 开发,那么建议你使用最新的 Python 3.x 进行开发,因为 Python 2.x 已经不再支持了。几乎所有领先的 Linux 发行版都取消了对 Python 2 的依赖。
|
||||
|
||||
如果你正在运行 Fedora 或 Ubuntu 的最新发行版,那么你应该已经安装了 Python 3.x,并设置为默认解释器。例如,Fedora 37 和 Ubuntu 22.04 LTS 将 [Python 3.11][2] 作为默认的 Python 交互界面。
|
||||
|
||||
找到你的 Python 版本的一个快速方法是在 Ubuntu 和 Fedora 的终端运行以下命令:
|
||||
|
||||
```
|
||||
python2
|
||||
```
|
||||
|
||||
```
|
||||
python3
|
||||
```
|
||||
|
||||
![python3][3]
|
||||
|
||||
如果你运行的是早期版本的 Ubuntu 或 Fedora,那么你可以使用以下命令安装最新的 Python 3.x:
|
||||
|
||||
Ubuntu:
|
||||
|
||||
```
|
||||
sudo apt install python3
|
||||
```
|
||||
|
||||
Fedora:
|
||||
|
||||
```
|
||||
sudo dnf install python3
|
||||
```
|
||||
|
||||
另外,运行下面的命令,找出当前系统中 Python 可执行文件的路径:
|
||||
|
||||
```
|
||||
Which python
|
||||
```
|
||||
|
||||
#### 切换默认解释器的版本
|
||||
|
||||
如果你的系统安装了多个 Python 版本 —— 2.x 和 3.x,并且你想在它们之间切换,也是可以的。
|
||||
|
||||
如果你只安装了一个版本,你可以跳过这一节。
|
||||
|
||||
要进行切换,首先,从终端运行 `python`,找出默认的可执行路径。理想情况下,它应该是 `/usr/bin/python`。现在,运行下面的程序,找出通往可执行文件的符号链接:
|
||||
|
||||
```
|
||||
ln -l /usr/bin/python
|
||||
```
|
||||
|
||||
```
|
||||
lrwxrwxrwx 1 root root .... /usr/bin/pyhton -> python2
|
||||
```
|
||||
|
||||
现在检查一下 `$PATH` 变量,确定系统查找可执行文件的路径连接顺序:
|
||||
|
||||
```
|
||||
echo $PATH
|
||||
```
|
||||
|
||||
![PATH 变量][4]
|
||||
|
||||
你可以看到 `/usr/local/bin` 在 `/usr/bin/` 之前,那么你可以创建一个软符号链接到 `python3`。然后你的解释器在运行 `python` 命令时就会找到最新的 Python 3 而不是 Python 2。
|
||||
|
||||
```
|
||||
ls -s /usr/bin/python3 /usr/local/bin/python
|
||||
```
|
||||
|
||||
现在你应该注销并再次登录以清除任何哈希条目,或者你可以运行 `hash -r` 来清除它们。
|
||||
|
||||
现在你可以从终端运行 `python`,你应该有最新的 Python 3 了。
|
||||
|
||||
#### Python IDE
|
||||
|
||||
集成开发环境(IDE)可以帮助你编写、编译和执行你的代码。有 [几个免费的 Python 集成开发环境][5] —— 如 PyCharm、Eclipse、Eric 等,你可以使用。但那将是另一篇关于其优点和缺点的文章。
|
||||
|
||||
如果你从官方 [python.org][1] 网站下载 Python,Python 还带着一个叫做 IDLE 的默认开发环境。IDLE 适合于起步,之后你可以决定选择任何一个最好的免费 Python IDE。
|
||||
|
||||
在 Ubuntu 和 Fedora 中,IDLE 并没有和 Python 一起被默认包含,你必须手动安装它。从终端运行下面的命令来手动安装 IDLE:
|
||||
|
||||
Ubuntu:
|
||||
|
||||
```
|
||||
sudo apt install idle
|
||||
```
|
||||
|
||||
Fedora:
|
||||
|
||||
```
|
||||
sudo dnf install python-tools
|
||||
```
|
||||
|
||||
安装后,你可以从命令行空闲启动 IDLE 或从应用程序中搜索。
|
||||
|
||||
![IDLE][6]
|
||||
|
||||
现在,你可以使用 IDLE 开始你的开发。大部分的基本选项你可以在 IDLE 的文件菜单中找到。
|
||||
|
||||
我希望这篇指南解释了你在开始 Python 开发之前应该知道的东西。 尽管本指南主要是针对 Ubuntu 和 Fedora 的,但你仍然可以在所有基于 Ubuntu 和 Fedora 的发行版上参考它。如果你在 Python 环境设置方面遇到问题,请在下面的评论区告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/setup-python-environment-ubuntu-fedora/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[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.python.org/
|
||||
[2]: https://www.debugpoint.com/install-python-3-11-ubuntu/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2020/06/python3.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2020/06/PATH-Variable.png
|
||||
[5]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2020/06/IDLE-environment.png
|
||||
[7]: https://www.debugpoint.com/bash-base64-encode-decode/
|
@ -0,0 +1,124 @@
|
||||
[#]: subject: "apt remove vs apt purge: What’s the Difference?"
|
||||
[#]: via: "https://itsfoss.com/apt-remove/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Tingze-G"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15458-1.html"
|
||||
|
||||
apt remove 和 apt purge: 有什么区别?
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
如果你想 [在 Ubuntu 上使用终端卸载软件][1],可以使用:
|
||||
|
||||
```
|
||||
sudo apt remove package_name
|
||||
```
|
||||
|
||||
但是在很多论坛,你可能会看到别人说,如果你想彻底删除软件就用 `apt purge`。
|
||||
|
||||
你可能会觉得很困惑,因为 `apt purge` 和 `apt remove` 看起来是一样的。
|
||||
|
||||
```
|
||||
sudo apt purge package_name
|
||||
```
|
||||
|
||||
为什么会有两个如此像的命令来删除软件包呢?两者之间有什么不同呢?下面将为你揭晓。
|
||||
|
||||
### apt-remove 和 apt-purge 有什么不同?
|
||||
|
||||
`apt-remove` 和 `apt-purge` 的相同之处就是都可以卸载软件包,但是运行 `apt-purge` 除了可以删除安装包之外,还可以清除相关的配置文件。这是两者之间唯一的不同点。要注意的是这两条命令都不能删除用户主目录中相关的应用程序文件。
|
||||
|
||||
你是否遇到过这样的情况,卸载一个软件然后重新安装,却发现之前的设置都还在。这是因为用 `apt remove` 不能删除该软件的相关配置文件。
|
||||
|
||||
#### 哪些东西被删除了?哪些还在?
|
||||
|
||||
我分享一个使用 `apt remove` 和 `apt purge` 两个命令分别卸载 mplayer 这个软件的实际例子。重点是看每次操作后还残余哪些文件。
|
||||
|
||||
这是删除前的文件:
|
||||
|
||||
![mplayer before removal][2]
|
||||
|
||||
现在运行 `apt remove` 这个命令:
|
||||
|
||||
![apt uninstall package ubuntu][3]
|
||||
|
||||
下面的是还残留在系统中的文件:
|
||||
|
||||
![files after mplayer removal][4]
|
||||
|
||||
我们可以看到,有两个地方残留着 mplayer 的文件: `/etc` 和 `/home/abhishek`。
|
||||
|
||||
这次我们重新安装 mplayer,然后用 `apt purge` 来卸载软件。
|
||||
|
||||
![apt purge command][5]
|
||||
|
||||
现在让我们看看与 mplayer 相关的文件:
|
||||
|
||||
![files after mplayer removal][6]
|
||||
|
||||
我们可以看到 `/etc` 目录下的文件已经没有了。
|
||||
|
||||
但是在主目录中的文件呢?`apt purge` 会删除它们吗?
|
||||
|
||||
答案是否定的。`apt` 命令不会删除主目录中的配置文件。所以它们仍然在系统中,除非你手动删除。但是这些文件所占的空间真的很小,几乎不占磁盘空间。
|
||||
|
||||
值得注意的是,不是所有的软件在主目录或者 `/etc` 目录下都有配置文件。
|
||||
|
||||
#### 使用 apt remove 或者 apt purge 的效果
|
||||
|
||||
我能想到的一个实际例子就是 Discord,你用 deb 文件 [在 Ubuntu 上安装了 Discord][7]。然后登录自己的账号,之后又卸载并重新用 deb 文件安装。
|
||||
|
||||
现在如果你打开 Discord,你会发现你的账号自动登录了。是不是觉得很奇怪?
|
||||
|
||||
这是个功能,像一些软件,比如 Discord、VirtualBox,它们会提供更新,就是卸载现在的版本然后下载新的(尽管你不知道它内部怎么进行的),但是它在卸载的时候,这些软件的配置文件没有被删除,所以等你打开这些软件的时候就会自动登录。
|
||||
|
||||
当你想卸载一个软件,但是想保留你过去使用该软件留下的配置文件的时候,你就可以用 `apt remove`。
|
||||
|
||||
但是,有时候用它不能满足你的需求,比如当你没有配置好一个软件的时候,你想要重新开始,这个时候用 `apt purge` 就比较合适。
|
||||
|
||||
#### 运行 apt purge 是否可以用通配符删除?
|
||||
|
||||
当你删除一个包的时候,它会提示 `removing package-name*`。这意味着它会删除以这个包名开头的所有文件。
|
||||
|
||||
![apt purge wild card][8]
|
||||
|
||||
我在手册页之类的文档中没有找到关于这个问题的答案。所以我自己做了一个小测试,我安装了 espeak 和 espeak-ng 这两个软件,espeak* 应该可以通配扩展到 espeak-ng。
|
||||
|
||||
但是当我用 `apt purge` 删除 espeak 包时,espeak-ng 包还在,没有被一并删除。因此,这似乎是有一种防止通配符的扩展的机制。
|
||||
|
||||
### 那么,你应该使用 apt remove 还是 apt purge 呢?
|
||||
|
||||
很少有人会一直使用 `apt purge`。
|
||||
|
||||
在我看来,一般清况下,用 `apt remove` 就可以了,但是当你想删除那些自定义配置文件时,你就得用 `apt purge`。
|
||||
|
||||
不管是用 `apt remove` 还是 `apt purge`,你都需要从用户的主目录中删除残余的配置文件,并运行 `apt autoremove` 来清除任何依赖的包。
|
||||
|
||||
现在到你啦。你现在对 `apt remove` 和 `apt purge` 的区别更加了解吗?你更喜欢使用哪一个呢?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/apt-remove/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Tingze-G](https://github.com/Tingze-G)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/apt-remove/
|
||||
[2]: https://itsfoss.com/content/images/wordpress/2022/11/mplayer-before-removal.png
|
||||
[3]: https://itsfoss.com/content/images/wordpress/2022/11/apt-uninstall-package-ubuntu.png
|
||||
[4]: https://itsfoss.com/content/images/wordpress/2022/11/files-after-mplayer-removal.png
|
||||
[5]: https://itsfoss.com/content/images/wordpress/2022/11/apt-purge-command.png
|
||||
[6]: https://itsfoss.com/content/images/wordpress/2022/11/files-after-apt-purge.png
|
||||
[7]: https://itsfoss.com/install-discord-linux/
|
||||
[8]: https://itsfoss.com/content/images/wordpress/2022/11/apt-purge-wild-card.png
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/19/113744ucqk6f69t4hbi8h8.jpg
|
@ -0,0 +1,262 @@
|
||||
[#]: subject: "Battle of the Texts and the Unicode Savior"
|
||||
[#]: via: "https://itsfoss.com/unicode-linux/"
|
||||
[#]: author: "Sylvain Leroux https://www.yesik.it/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "yzuowei"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15483-1.html"
|
||||
|
||||
文字间的战斗与其救世主 Unicode
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
我们都知道如何从键盘输入文字,不是吗?
|
||||
|
||||
那么,请允许我挑战你在你最爱的文本编辑器中输入这段文字:
|
||||
|
||||
![«Ayumi moved to Tokyo in 1993 to pursue her career» said Dmitrii][1]
|
||||
|
||||
这段文字难以被输入因为它包含着:
|
||||
|
||||
- 键盘上没有的印刷符号,
|
||||
- 平假名日文字符,
|
||||
- 为符合平文式罗马字标准,日本首都的名字中的两个字母 “o” 头顶带有长音符号,
|
||||
- 以及最后,用西里尔字母拼写的名字德米特里。
|
||||
|
||||
毫无疑问,想要在早期的电脑中输入这样的句子是不可能的。这是因为早期电脑所使用的字符集有限,无法兼容多种书写系统。而如今类似的限制已不复存在,马上我们就能在文中看到。
|
||||
|
||||
### 电脑是如何储存文字的?
|
||||
|
||||
计算机将字符作为数字储存。它们再通过表格将这些数字与含有意义的字形一一对应。
|
||||
|
||||
在很长一段时间里,计算机将每个字符作为 0 到 255 之间的数字储存(这正好是一个字节的长度)。但这用来代表人类书写所用到的全部字符是远远不够的。而解决这个问题的诀窍在于,取决于你住在地球上的哪一块区域,系统会分别使用不同的对照表。
|
||||
|
||||
这里有一张在法国常被广泛使用的对照表 [ISO 8859-15][2]:
|
||||
|
||||
![The ISO 8859-15 encoding][3]
|
||||
|
||||
如果你住在俄罗斯,你的电脑大概会使用 [KOI8-R][4] 或是 [Windows-1251][5] 来进行编码。现在让我们假设我们在使用后者:
|
||||
|
||||
![The Windows-1251 encoding is a popular choice to store text written using the Cyrillic alphabets][6]
|
||||
|
||||
对于 128 之前的数字,两张表格是一样的。这个范围与 [US-ASCII][7] 相对应,这是不同字符表格之间的最低兼容性。而对于 128 之后的数字,这两张表格则完全不同了。
|
||||
|
||||
比如,依据 Windows-1251,字符串 “said Дмитрий” 会被储存为:
|
||||
|
||||
```
|
||||
115 97 105 100 32 196 236 232 242 240 232 233
|
||||
```
|
||||
|
||||
按照计算机科学的常规方法,这十二个数字可被写成更加紧凑的十六进制:
|
||||
|
||||
```
|
||||
73 61 69 64 20 c4 ec e8 f2 f0 e8 e9
|
||||
```
|
||||
|
||||
如果德米特里发给我这份文件,我在打开后可能会看到:
|
||||
|
||||
```
|
||||
said Äìèòðèé
|
||||
```
|
||||
|
||||
这份文件 _看起来_ 被损坏了,实则不然。这些储存在文件里的数据,即数字,并没有发生改变。被显示出的字符与 _另一张表格_ 中的数据相对应,而非文字最初被写出来时所用的编码表。
|
||||
|
||||
让我们来举一个例子,就以字符 “Д” 为例。按照 Windows-1251,“Д” 的数字编码为 196(c4)。储存在文件里的只有数字 196。而正是这同样的数字在 ISO8859-15 中与 “Ä” 相对应。这就是为什么我的电脑错误地认为字形 “Ä” 就是应该被显示的字形。
|
||||
|
||||
![When the same text file is written then read again but using a different encoding][8]
|
||||
|
||||
多提一句,你依然可以时不时地看到一些错误配置的网站展示,或由 [用户邮箱代理][9] 发出的对收件人电脑所使用的字符编码做出错误假设的邮件。这样的故障有时被称为乱码(LCTT 译注:原文用词为 [mojibake][10], 源自日语 _文字化け_)。好在这种情况在今天已经越来越少见了。
|
||||
|
||||
![Example of Mojibake on the website of a French movie distributor. The website name has been changed to preserve the innocent.][11]
|
||||
|
||||
### Unicode 拯救了世界
|
||||
|
||||
我解释了不同国家间交换文件时会遇到的编码问题。但事情还能更糟,同一个国家的不同生产商未必会使用相同的编码。如果你在 80 年代用 Mac 和 PC 互传过文件你就懂我是什么意思了。
|
||||
|
||||
也不知道是不是巧合,[Unicode][12] 项目始于 1987 年,主导者来自<ruby>施乐<rt>Xerox</rt></ruby>和……<ruby>苹果<rt>Apple</rt></ruby> 。
|
||||
|
||||
这个项目的目标是定义一套通用字符集来允许同一段文字中 _同时_ 出现人类书写会用到的任何文字。最初的 Unicode 项目被限制在 65536 个不同字符(每个字符用 16 位表示,即每个字符两字节)。这个数字已被证实是远远不够的。
|
||||
|
||||
于是,在 1996 年 Unicode 被扩展以支持高达 100 万不同的 <ruby>[代码点][13]<rt>code point</rt></ruby>。粗略来说,一个“代码点”可被用来识别字符表中的一个条目。Unicode 项目的一个核心工作就是将世界上正在被使用(或曾被使用)的字母、符号、标点符号以及其他文字仓管起来,并给每一项条目分配一个代码点用以准确分辨对应的字符。
|
||||
|
||||
这是一个庞大的项目:为了让你有个大致了解,发布于 2017 年的 Unicode 版本 10 定义了超过 136,000 个字符,覆盖了 139 种现代和历史上的语言文字。
|
||||
|
||||
随着如此庞大数量的可能性,一个基本的编码会需要每个字符 32 位(即 4 字节)。但对于主要使用 US-ASCII 范围内字符的文字,每个字符 4 字节意味着 4 倍多的储存需求以及 4 倍多的带宽用以传输这些文字。
|
||||
|
||||
![Encoding text as UTF-32 requires 4 bytes per character][14]
|
||||
|
||||
所以除了 [UTF-32][15],Unicode 联盟还定义了更加节约空间的 [UTF-16][16] 和 [UTF-8][17] 编码,分别使用了 16 位和 8 位。但只有 8 位该如何储存超过 100,000 个不同的值呢?事实是,你不能。但这其中窍门在于用一个代码值(UTF-8 中的 8 位以及 UTF-16 中的 16 位)来储存最常用的一些字符。再用几个代码值储存最不常用的一些字符。所以说 UTF-8 和 UTF-16 是 _可变长度_ 编码。尽管这样也有缺陷,但 UTF-8 是空间与时间效率之间一个不错的折中。更不用提 UTF-8 可以向后兼容大部分 Unicode 之前的 1 字节编码,因为 UTF-8 经过了特别设计,任何有效的 US-ASCII 文件都是有效的 UTF-8 文件。你也可以说,UTF-8 是 US-ASCII 的超集。而在今天已经找不到不用 UTF-8 编码的理由了。当然除非你书写主要用的语言需要多字节编码,或是你不得不与一些残留的老旧系统打交道。
|
||||
|
||||
在下面两张图中,你可以亲自比较一下同一字符串的 UTF-16 和 UTF-8 编码。特别注意 UTF-8 使用了一字节来储存拉丁字母表中的字符,但它使用了两字节来存储西里尔字母表中的字符。这是 Windows-1251 西里尔编码储存同样字符所需空间的两倍。
|
||||
|
||||
![UTF-16 is a variable length encoding requiring 2 bytes to encode most characters. Some character still requires 4 bytes though (for example][18]
|
||||
|
||||
![UTF-8 is a variable length encoding requiring 1, 2, 3 or 4 bytes per character][19]
|
||||
|
||||
### 而这些对于打字有什么用呢?
|
||||
|
||||
啊……知道一些你的电脑的能力与局限以及其底层机制也不是什么坏事嘛。特别是我们马上就要说到 Unicode 和十六进制。现在……让我们再聊点历史。真的就一点,我保证……
|
||||
|
||||
……就说从 80 年代起,电脑键盘曾经有过 [`Compose` 键][20](有时候也被标为 `Multi` 键)就在 `Shift` 键的下边。当按下这个键时,你会进入 “<ruby>组合<rt>Compose</rt></ruby>” 模式。一旦在这个模式下,你便可以通过输入助记符来输入你键盘上没有的字符。比如说,在组合模式下,输入 RO 便可生成字符 ®(当作是 O 里面有一个 R 就能很容易记住)。
|
||||
|
||||
![Compose key on lk201 keyboard][21]
|
||||
|
||||
现在很难在现代键盘上看到 `Compose` 键了。这大概是因为占据主导地位的 PC 不再用它了。但是在 Linux 上(可能还有其他系统)你可以模拟 `Compose` 键。这项设置可以通过 GUI 开启,在大多数桌面环境下调用“键盘”控制面板:但具体的步骤取决于你的桌面环境以及版本。如果你成功启用了那项设置,不要犹豫,在评论区分享你在你电脑上所采取的具体步骤。
|
||||
|
||||
(LCTT 译注:如果有读者想要尝试,建议将 `Compose` 键设为大写锁定键,或是别的不常用的键,`Ctrl` 和 `Alt` 会被大部分 GUI 程序优先识别为功能键。还有一些我自己试验时遇到过的问题,在开启 `Compose` 键前要确认大写锁定是关闭的,输入法要切换成英文,组合模式下输入大小写敏感。我试验的系统是 Ubuntu 22.04 LTS。)
|
||||
|
||||
至于我自己嘛,我现在先假设你用的就是默认的 `Shift+AltGr` 组合来模拟 `Compose` 键。(LCTT 校注:`AltGr` 在欧洲键盘上是指右侧的 `Alt` 键,在国际键盘上等价于 `Ctrl+Alt` 组合键。)
|
||||
|
||||
那么,作为一个实际例子,尝试输入 “LEFT-POINTING DOUBLE ANGLE QUOTATION MARK(左双角引号)”(LCTT 译注:Guillemet,是法语和一些欧洲语言中的引号,与中文的书名号不同),你可以输入 `Shift+AltGr` `<<`(你在敲助记符时不需要一直按着 `Shift+AltGr`)。如果你成功输入了这个符号,你自己应该也能猜到要怎么输入 “RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK(右双角引号)” 了。
|
||||
|
||||
来看看另一个例子,试试 `Shift+AltGr` `---` 来生成一个 “EM DASH(长破折号)”(LCTT 译注:中文输入法的长破折号由两个 “EM DASH” 组成)。要做到这个,你需要按下主键盘上的的 [连字符减号][22] 键而非数字键盘上的那个。
|
||||
|
||||
值得注意的是 `Compose` 键在非 GUI 环境下也能工作。但是取决于你使用的是 X11 控制台还是只显示文字的控制台,它们所支持的组合按键顺序并不相同。
|
||||
|
||||
在控制台上,你可以通过命令 `dumpkeys` 来查看支持的组合按键列表(LCTT 译注:可能需要 root 权限):
|
||||
|
||||
```
|
||||
dumpkeys --compose-only
|
||||
```
|
||||
|
||||
在 GUI 下,组合键是在 Gtk/X11 层被实现的。想要知道 Gtk 所支持的助记符,可以查看页面:[https://help.ubuntu.com/community/GtkComposeTable][23]
|
||||
|
||||
### 我们可以避免对 Gtk 字符组合的依赖吗?
|
||||
|
||||
或许我是个纯粹主义者,但是我为 Gtk 这种对 Compose 键进行硬编码的方式感到悲哀。毕竟,不是所有 GUI 应用都会使用 Gtk 库。而且我如果想要添加我自己的助记符的话就只能重新编译 Gtk 了。
|
||||
|
||||
幸好在 X11 层也有对字符组合的支持。在以前则是通过令人尊敬的 [X 输入法(XIM)][24]。
|
||||
|
||||
这个方法在比起基于 Gtk 的字符组合能够在更加底层的地方工作,同时具备优秀的灵活性并兼容很多 X11 应用。
|
||||
|
||||
比如说,假设我只是想要添加 `-->` 组合来输入字符 `→` (U+2192,RIGHTWARDS ARROW(朝右箭头)),我只需要新建 `~/.XCompose` 文件并写入以下代码:
|
||||
|
||||
```
|
||||
cat > ~/.XCompose << EOT
|
||||
# Load default compose table for the current local
|
||||
include "%L"
|
||||
|
||||
# Custom definitions
|
||||
<Multi_key> <minus> <minus> <greater> : U2192 # RIGHTWARDS ARROW
|
||||
EOT
|
||||
```
|
||||
|
||||
然后你就可以启动一个新的 X11 应用,强制函数库使用 XIM 作为输入法,并开始测试:
|
||||
|
||||
```
|
||||
GTK_IM_MODULE="xim" QT_IM_MODULE="xim" xterm
|
||||
```
|
||||
|
||||
新的组合排序应该可以在你刚启动的应用里被输入了。我鼓励你通过 `man 5 compose` 来进一步学习组合文件格式。
|
||||
|
||||
在你的 `~/.profile` 中加入以下两行来将 XIM 设为你所有应用的默认输入法。这些改动会在下一次你登录电脑时生效:
|
||||
|
||||
```
|
||||
export GTK_IM_MODULE="xim"
|
||||
export QT_IM_MODULE="xim"
|
||||
```
|
||||
|
||||
这挺酷的,不是吗?这样你就可以随意的加入你想要的组合排序。而且在默认的 XIM 设置中已经有几个有意思的组合了。试一下输入组合键 `LLAP`。
|
||||
|
||||
但我不得不提到两个缺陷。XIM 已经比较老了,而且只适合我们这些不太需要多字节输入法的人。其次,当你用 XIM 作为输入法的时候,你就不能利用 `Ctrl+Shift+u` 加上代码点来输入 Unicode 字符了。什么?等一下?我还没聊过那个?让我们现在来聊一下吧:
|
||||
|
||||
### 如果我需要的字符没有对应的组合键排序该怎么办?
|
||||
|
||||
组合键是一个不错的工具,它可以用来输入一些键盘上没有的字符。但默认的组合集有限,而切换 XIM 并为一个你一生仅用一次的字符来定义一个新的组合排序十分麻烦。
|
||||
|
||||
但这能阻止你在同一段文字里混用日语、拉丁语,还有西里尔字符吗?显然不能,这多亏了 Unicode。比如说,名字 “あゆみ” 由三个字母组成:
|
||||
|
||||
- [“HIRAGANA LETTER A(平假名字母 あ)” (U+3042)][25]
|
||||
- [“HIRAGANA LETTER YU(平假名字母 ゆ)” (U+3086)][26]
|
||||
- 以及 [“HIRAGANA LETTER MI(平假名字母 み)” (U+307F)][27]
|
||||
|
||||
我在上文提及了 Unicode 字符的正式名称,并遵循了全部用大写拼写的规范。在它们的名字后面,你可以找到它们的 Unicode 代码点,位于括号之间并写作 16 位的十六进制数字。这让你想到什么了吗?
|
||||
|
||||
不管怎样,一旦你知道了的一个字符的代码点,你就可以按照以下组合输入:
|
||||
|
||||
- `Ctrl+Shift+u`,然后是 `XXXX`(你想要的字符的 _十六进制_ 代码点)然后回车。
|
||||
|
||||
作为一种简写方式,如果你在输入代码点时不松开 `Ctrl+Shift`,你就不用敲回车。
|
||||
|
||||
不幸的是,这项功能的实现是在软件库层而非 X11 层,所以对其支持在不同应用间并不统一。以 LibreOffice 为例,你必须使用主键盘来输入代码点。而在基于 Gtk 的应用则接受来自数字键盘的输入。
|
||||
|
||||
最后,当我和我的 Debian 系统上的控制台打交道时,我发现了一个类似的功能,但它需要你按下 `Alt+XXXXX` 而 `XXXXX` 是你想要的字符的 _十进制_ 的代码点。我很好奇这究竟是 Debian 独有的功能,还是因为我使用的语言环境(Locale) 是 `en_US.UTF-8`。如果你对此有更多信息,我会很愿意在评论区读到它们的!
|
||||
|
||||
| GUI | 控制台 | 字符 |
|
||||
| :- | :- | :- |
|
||||
| `Ctrl+Shift+u` `3042` `Enter` | `Alt+12354` | あ |
|
||||
| `Ctrl+Shift+u` `3086` `Enter` | `Alt+12422` | ゆ |
|
||||
| `Ctrl+Shift+u` `307F` `Enter` | `Alt+12415` | み |
|
||||
|
||||
### 死键
|
||||
|
||||
最后值得一提的是,想要不(必须)依赖 Compose 键来输入键组合还有一个更简单的方法。
|
||||
|
||||
你的键盘上的某些键是专门用来创造字符组合的。这些键叫做 <ruby>[死键][28]<rt>Dead Key</rt></ruby>。这是因为当你按下它们一次,看起来什么都没有发生,但它们会悄悄地改变你下一次按键所产生的字符。这个行为的灵感来自于机械打字机:在使用机械打字机时,按下一个死键会印下一个字符,但不会移动字盘。于是下一次按键则会在同一个地方印下另一个字符。视觉效果就是两次按键的组合。
|
||||
|
||||
我们在法语里经常用到这个。举例来说,想要输入字母 `ë` 我必须按下死键 `¨` 然后再按下 `e` 键。同样地,西班牙人的键盘上有着死键 `~`。而在北欧语系下的键盘布局,你可以找到 `°` 键。我可以念很久这份清单。
|
||||
|
||||
![hungary dead keys][29]
|
||||
|
||||
显然,不是所有键盘都有所有死键。实际上,你的键盘上是找不到大部分死键的。比如说,我猜在你们当中只有小部分人——如果真的有的话——有死键 `¯` 来输入 `Tōkyō` 所需要的长音符号(“平变音符”)。
|
||||
|
||||
对于那些你键盘上没有的死键,你需要寻找别的解决方案。好消息是,我们已经用过那些技术了。但这一次我们要用它们来模拟死键,而非“普通”键。
|
||||
|
||||
那么,我们的第一个选择是利用 `Compose` `-` 来生成长音符号(你键盘上有的连字符减号)。按下时屏幕上什么都不会出现,但当你接着按下 `o` 键你就能看到 `ō`。
|
||||
|
||||
Gtk 在组合模式下可以生成的一系列死键都能在 [这里][30] 找到。
|
||||
|
||||
另一个解决方法则是利用 Unicode 字符 “COMBINING MACRON(组合长音符号)”(U+0304),然后字母 `o`。我把细节都留给你。但如果你好奇的话,你会发现你打出的结果有着微妙的不同,你并没有真地打出 “LATIN SMALL LETTER O WITH MACRON(小写拉丁字母 O 带长音符号)”。我在上一句话的结尾用了大写拼写,这就是一个提示,引导你寻找通过 Unicode 组合字符按更少的键输入 `ō` 的方法……现在我将这些留给你的聪明才智去解决了。
|
||||
|
||||
### 轮到你来练习了!
|
||||
|
||||
所以,你都学会了吗?这些在你的电脑上工作吗?现在轮到你来尝试了:根据上面提出的线索,加上一点练习,现在你可以完成文章开头给出的挑战了。挑战一下吧,然后把成果复制到评论区作为你成功的证明。
|
||||
|
||||
赢了也没有奖励,或许来自同伴的惊叹能够满足你!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/unicode-linux/
|
||||
|
||||
作者:[Sylvain Leroux][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[yzuowei](https://github.com/yzuowei)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.yesik.it/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/content/images/wordpress/2017/10//text-challenge.png
|
||||
[2]: https://en.wikipedia.org/wiki/ISO/IEC_8859-15
|
||||
[3]: https://itsfoss.com/content/images/wordpress/2017/10//ISO_8859-15.png
|
||||
[4]: https://en.wikipedia.org/wiki/KOI8-R
|
||||
[5]: https://en.wikipedia.org/wiki/Windows-1251
|
||||
[6]: https://itsfoss.com/content/images/wordpress/2017/10//Windows-1251.png
|
||||
[7]: https://en.wikipedia.org/wiki/ASCII
|
||||
[8]: https://itsfoss.com/content/images/wordpress/2017/10//windows-1251-to-iso8859-15-encoding-decoding-error-example.png
|
||||
[9]: https://en.wikipedia.org/wiki/Email_client
|
||||
[10]: https://en.wikipedia.org/wiki/Mojibake
|
||||
[11]: https://itsfoss.com/content/images/wordpress/2017/10/Mojibake-french-example.png
|
||||
[12]: https://en.wikipedia.org/wiki/Unicode
|
||||
[13]: https://en.wikipedia.org/wiki/Code_point
|
||||
[14]: https://itsfoss.com/content/images/wordpress/2017/10//unicode-utf-32-encoding-example.png
|
||||
[15]: https://en.wikipedia.org/wiki/UTF-32
|
||||
[16]: https://en.wikipedia.org/wiki/UTF-16
|
||||
[17]: https://en.wikipedia.org/wiki/UTF-8
|
||||
[18]: https://itsfoss.com/content/images/wordpress/2017/10//unicode-utf-16-encoding-example.png
|
||||
[19]: https://itsfoss.com/content/images/wordpress/2017/10//unicode-utf-8-encoding-example.png
|
||||
[20]: https://en.wikipedia.org/wiki/Compose_key
|
||||
[21]: https://itsfoss.com/content/images/wordpress/2022/12/compose_key_on_lk201_keyboard.jpg
|
||||
[22]: https://en.wikipedia.org/wiki/Hyphen-minus
|
||||
[23]: https://help.ubuntu.com/community/GtkComposeTable
|
||||
[24]: https://en.wikipedia.org/wiki/X_Input_Method
|
||||
[25]: http://www.fileformat.info/info/unicode/char/3042/index.htm
|
||||
[26]: http://www.fileformat.info/info/unicode/char/3086/index.htm
|
||||
[27]: http://www.fileformat.info/info/unicode/char/307F/index.htm
|
||||
[28]: https://en.wikipedia.org/wiki/Dead_key
|
||||
[29]: https://itsfoss.com/content/images/wordpress/2022/12/hungary_dead_keys.png
|
||||
[30]: https://help.ubuntu.com/community/GtkDeadKeyTable
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/27/123501fod5doujjgo5jfjk.jpg
|
@ -0,0 +1,135 @@
|
||||
[#]: subject: "EndeavourOS: Your Search for Perfect Arch Distro Ends Here"
|
||||
[#]: via: "https://www.debugpoint.com/endeavouros-review/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15476-1.html"
|
||||
|
||||
EndeavourOS:你对完美的 Arch 发行版的搜寻到此为止
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 我们整体点评了最近发布的 EndeavourOS “Cassini”。
|
||||
|
||||
每年,个人和小型团队们推出了数以百计的 Linux 发行版。它们大多是 Debian、Ubuntu、Fedora 或 Arch Linux 的直接衍生品,再加上一些定制的东西。这也难怪每年都有因为缺乏贡献、愿景和坚持而死亡的发行版。
|
||||
|
||||
三年前,作为已停止的 Antergos 项目的延续,一个由贡献者们组成的小团队发起了 EndeavourOS 项目。从那时起,由于其安装简单,用户体验和功能,它已经变得很受欢迎。
|
||||
|
||||
![具备 Xfce 桌面的 EndeavourOS][1]
|
||||
|
||||
### 点评 EndeavourOS
|
||||
|
||||
如果你曾经试过它,你就会很明显地发现,他们花了很多心血来开发这个发行版。这个发行版的口号是成为一个面向大众的 “通用” Arch Linux 发行版,摒弃了新用户对 Arch Linux 安装的恐惧,以及使用 Arch 时的优越感。
|
||||
|
||||
如果你曾经尝试过 EndeavourOS,你一定会 “感觉” 到作为一个 Arch 发行版,对最终用户来说,在桌面上执行的事情是多么的 “容易”。
|
||||
|
||||
#### 安装和可供选择的桌面
|
||||
|
||||
通过 “独有的” Calamares 安装程序,它的安装变得超级简单。除此之外,EndeavourOS 团队还特别注意在安装步骤中为你提供了大部分的选项。例如,无需用户干预的临场介质直接启动。它会启动欢迎屏幕。欢迎屏幕要做的事就是提供让你在系统中安装它所有必要选项。
|
||||
|
||||
![EndeavourOS 欢迎屏幕][2]
|
||||
|
||||
默认情况下,ISO 提供了一个轻量级的 Xfce 桌面。然而,EndeavourOS 也为你提供了各种桌面环境和窗口管理器(见下文)。而且它们都经过测试,可以正常工作。如果你在安装过程中连接到了互联网,你可以通过 Calamares 安装程序来安装这些。这意味着你不需要在基本的 Xfce 设置后重新安装它们。
|
||||
|
||||
此外,如果你是一个资深用户,只想安装一个基本的 Arch Linux,不需要任何桌面,那也是可以的。只要在安装时使用 “<ruby>无桌面<rt>No desktop</rt></ruby>” 选项就可以了!
|
||||
|
||||
尽管 Arch Linux 最近创建了一个自动脚本 `archinstall` 来使安装更容易,但通过 EndeavourOS 的 ISO 来获得 Arch 的基本安装仍然更快、更容易。
|
||||
|
||||
![EndeavourOS 安装程序显示无桌面和其他选项][3]
|
||||
|
||||
此外,你可以在三个选项中选择:GRUB、systemd-boot 或 “<ruby>无启动器<rt>no bootloader</rt></ruby>”,这是 EndeavourOS “Cassini” 版本的亮点功能之一。此外,你还可以选择你要安装的软件包(仅在线模式支持)。例如,你可能需要一个基本的系统来开始使用。或者,你可能想安装一些与视频/音频或开发工作有关的应用程序。所有这些你都可以在这个版本中选择。
|
||||
|
||||
安装通过检测我的测试机中安装的其他操作系统而完成,很顺利。在“Cassini” 版本中,该团队还将 mkinitcpio 换成了 [dracut][4],以获得更好的性能,减少启动相关问题的失败。
|
||||
|
||||
#### “Xfce” 旗舰版的桌面体验
|
||||
|
||||
第一次登录后,你会再次看到欢迎程序,其中有一个 “安装后” 可以做的项目列表。开发人员提供了一个非常周到的列表。这包括改变墙纸、更新 Arch 镜像、安装英伟达驱动等初始任务。许多 Linux 发行版都有一个欢迎程序,但我认为这个程序是一个完善的软件包。
|
||||
|
||||
![欢迎应用中的安装后项目][5]
|
||||
|
||||
默认的外观是你能得到的定制的最好的 Xfce 桌面。通过定制,它成为一个外观良好的发行版,远非默认的 Xfce 可比。定制包括 GRUB 菜单、登录屏幕和桌面等等。
|
||||
|
||||
Xfce 主菜单配置了更多的项目,终端略带透明,使用 Qogir 图标主题。所有这些变化都辅以令人惊叹的壁纸和 Arc-Darker 默认 Xfce 主题。
|
||||
|
||||
![EndeavourOS “Cassini” 桌面带有 Xfce 4.18][6]
|
||||
|
||||
#### 性能
|
||||
|
||||
尽管有桌面环境,Arch Linux 的性能总是更好。它总是令人感觉更快,因为它的内部并不臃肿。除此之外,[Xfce 桌面 4.18][7] 在 “Cassini” 版本中还做了额外的性能优化,你可以在浏览桌面的时候感受到。
|
||||
|
||||
在空闲状态下,它使用了大约 700MB 的内存和平均 4% 的 CPU 占用。这是性能基线。资源使用量可能会根据你打开的应用程序的数量而增加。在我之前对 EndeavourOS 的点评中,其性能表现也类似。
|
||||
|
||||
不仅如此,它在默认的 Xfce 安装中只使用了 4GB 的磁盘空间。然而,你可能需要安装额外的重型软件,如 LibreOffice、GIMP 或 KDenlive,这将占用更多磁盘空间。
|
||||
|
||||
![EndeavourOS “Cassini” 的性能][8]
|
||||
|
||||
#### 在 EndeavourOS 中执行日常任务有多容易?
|
||||
|
||||
EndeavourOS 的一大特点是一些基于 Python 的 GUI 工具,可以使你在 Arch Linux 中的生活变得简单。例如,你可以从 Arch 和 EndeavourOS 的软件仓库中获得更新通知、一键从 AUR 安装软件、一键更新镜像和你的系统。你不需要从终端运行任何命令。这对 Arch Linux 的新用户来说是一个很大的帮助。
|
||||
|
||||
![一键安装软件][9]
|
||||
|
||||
![软件包清理器和更新管理器][10]
|
||||
|
||||
#### 处理滚动发布的独特方式,以实现稳定性
|
||||
|
||||
Arch Linux 作为一个滚动发布的发行版,往往会出现故障。例如,在 Arch 主仓库的每个月的内核更新期间,一些系统可能会出现故障。由于它的受欢迎程度和开发者的主动性,如果出现问题,你会得到通知和相关的解决方法。
|
||||
|
||||
最近 Arch Linux 中的 GRUB 问题,给用户带来了大量的启动问题,EndeavourOS 团队通过适当的沟通,给用户提供了解决方法,真的 [处理得很好][11]。
|
||||
|
||||
因此,如果你最终遇到一个不稳定的系统,你也不会真的迷失。
|
||||
|
||||
此外,Pacman 的配置已被定制过,使用 EndeavourOS 选择的镜像,以确保你的体验是完美的。
|
||||
|
||||
#### 对开源硬件和 ARM 的正式支持
|
||||
|
||||
在这个 EndeavourOS “Cassini” 版本中,官方支持了 Pinebook Pro 笔记本电脑。该团队在 Manjaro 软件包的基础上与 Pine64 团队合作,为你提供了独家的 Arch 软件包,使该笔记本开箱即用。此外, EndeavourOS ARM 镜像也可用于树莓派 4。
|
||||
|
||||
#### 社区帮助
|
||||
|
||||
EndeavourOS 最大的好处之一是社区帮助 —— 这是即时的!这主要是指其专门的 [Telegram 频道][12],在那里你可以在几分钟内得到对你的 EndeavourOS 的任何问题的回应。我曾经去过这个频道,管理员/贡献者们都很友好,很有帮助。
|
||||
|
||||
此外,你也可以从官方论坛和其他社交渠道获得帮助。
|
||||
|
||||
### 总结
|
||||
|
||||
在结束对 EndeavourOS 的 [“Cassini” 版本][13] 的点评时,我想说这是一个构建得最好的发行版,而且组织良好。开发者和团队有一个建立通用的 Arch Linux 发行版的清晰路线图。另外,通过对 ARM 和 Pinebook Pro 的支持以及其他举措,其愿景也很明确。
|
||||
|
||||
总而言之,对于每一个希望在 Arch Linux 中拥有一个运行时间更长、更稳定的系统的人来说,这是一个完美的发行版。
|
||||
|
||||
你可以从 [官方网站][14] 下载 EndeavourOS。
|
||||
|
||||
让我们举杯!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/endeavouros-review/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[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/wp-content/uploads/2022/12/Xubuntu-22.04-with-Xfce-4.18-Desktop-2.jpg
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-Welcome-Screen.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-installer-showing-22no-desktop22-and-other-options.jpg
|
||||
[4]: https://wiki.archlinux.org/title/Dracut
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/12/After-install-items-in-Welcome-app.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-22Cassini22-Desktop-with-Xfce-4.18.jpg
|
||||
[7]: https://www.debugpoint.com/xfce-4-18-features/
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-performance-22Cassini22.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/12/One-click-installation-of-software.jpg
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/12/Package-cleaner-and-update-manager.jpg
|
||||
[11]: https://endeavouros.com/news/full-transparency-on-the-grub-issue/
|
||||
[12]: https://endeavouros.com/community/
|
||||
[13]: https://endeavouros.com/news/cassini-packed-with-new-features-is-here/
|
||||
[14]: https://endeavouros.com/download/
|
||||
[15]: https://www.debugpoint.com/mint-upgrade-tool/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/24/205819zhx7kx5899ra9ka9.jpg
|
@ -0,0 +1,258 @@
|
||||
[#]: subject: "11 New Distros to look forward to in 2023"
|
||||
[#]: via: "https://news.itsfoss.com/new-distros-2023/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Cubik65536"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15463-1.html"
|
||||
|
||||
2023 年值得期待的 11 个新发行版
|
||||
======
|
||||
|
||||
> 你对 2023 年有什么期待?试试这些发行版吧!
|
||||
|
||||
![2023 年值得期待的 11 个新发行版][1]
|
||||
|
||||
是时候向 2022 年说再见了!📆
|
||||
|
||||
2022 年有很多发行版发布,其中有一些非常出色。
|
||||
|
||||
随着人们越来越关注用户体验和性能,Linux 发行版在过去的一年中有了显著的发展。
|
||||
|
||||
对于你我这样的最终用户,可以有几个选择。你可以尝试一些 [对初学者友好的选项][2] 或者尝试一些 [面向资深用户的发行版][3]。
|
||||
|
||||
在本文中,我将重点介绍一些你可以尝试一下看看的新发行版。这些发行版可能不一定能取代现有的流行发行版。但是,如果你想尝试一些新的东西,可以试试列表中的这些。
|
||||
|
||||
所以,你在 2023 年可以期待什么?🤔
|
||||
|
||||
好吧,为了回答这个问题,让我们踏上发行版之旅吧!
|
||||
|
||||
> 💡 新的发行版可能不适合生产环境。如果你不介意尝试新的东西,可以尝试这些选项。
|
||||
|
||||
### 1、Vanilla OS
|
||||
|
||||
![Vanilla OS][4]
|
||||
|
||||
Vanilla OS 是一个基于 Ubuntu 的发行版,它是 [Bottles][5] 的创建者 Mirko Brombin 的心血结晶。
|
||||
|
||||
它旨在提供一个具有**干净、原生的 GNOME 体验,以及<ruby>按需不变性<rt>on-demand immutability</rt></ruby>**和优秀的首次安装体验。
|
||||
|
||||
> LCTT 译注:<ruby>按需不变性<rt>on-demand immutability</rt></ruby>,指一个可以按需让文件不可更改的功能,用于确保系统文件不会被随意更新。 可参考 [此链接](https://documentation.vanillaos.org/docs/almost/)。
|
||||
|
||||
如果你想尝试一些新的东西并且想尝试一下按需不变性这个令 Vanilla OS 如此独特的功能,可以尝试一下这个发行版。
|
||||
|
||||
它还没有稳定版本,在一段时间内也不会有,预计将在 2023 年进行许多改进。
|
||||
|
||||
> **[Vanilla OS][6]**
|
||||
|
||||
### 2、XeroLinux
|
||||
|
||||
![XeroLinux][7]
|
||||
|
||||
这个兴趣项目 [XeroLinux][8] 是 Steve(即 TechXero)启动的,这个项目并不打算成为一个主流发行版,也没有各种花里胡哨的东西。
|
||||
|
||||
这个 “养眼” 版的 Arch Linux 衍生版提供了令人愉快的开箱即用体验和一些令人兴奋的功能。
|
||||
|
||||
如果你希望获得更加易用的 Arch Linux 体验,可以尝试这个。
|
||||
|
||||
**从 2023 年 1 月起**,XeroLinux 将切换到每月发布的计划。所以,你可以期待 2023 年有很多更新!
|
||||
|
||||
> **[XeroLinux][9]**
|
||||
|
||||
### 3、Crystal Linux
|
||||
|
||||
![Crystal Linux][10]
|
||||
|
||||
Crystal Linux 是一个即将发布的基于 Arch 的发行版,它希望**提供一个易于使用的桌面体验,以及现代 Linux 技术**。
|
||||
|
||||
在目前的状态下,它可能不适合新手,而具有 Linux 使用经验的人更有可能喜欢它。
|
||||
|
||||
所以,就目前而言,我建议已经熟悉 Linux 的用户可以尝试一下 Crystal Linux。
|
||||
|
||||
我预计 Crystal Linux 将在 2023 年有一个稳定版本,该版本将具有许多功能和改进,而这些功能和改进都是基于目前可用的 [beta 版本][12]。
|
||||
|
||||
> **[Crystal Linux][12]**
|
||||
|
||||
### 4、TUXEDO OS
|
||||
|
||||
![TUXEDO OS][13]
|
||||
|
||||
[TUXEDO OS][14] 是一个由 TUXEDO 计算机公司(一个专注 Linux 的硬件制造商)提供的基于 Ubuntu 的发行版。
|
||||
|
||||
它提供了 KDE Plasma 桌面环境,还有一些额外的功能,例如用于微调硬件的 **TUXEDO 控制中心**,以及一个用于解决驱动程序与缺少软件包的问题的配置服务 **TUXEDO Tomte**。
|
||||
|
||||
如果你想要一个**不同的 KDE 驱动的体验**,我建议你尝试一下。
|
||||
|
||||
最开始,它只作为预装系统在 TUXEDO 的笔记本和台式电脑上提供。
|
||||
|
||||
但是后来,它在 2022 年 9 月获得了一个通用版本,称为 “TUXEDO OS 1”。它将在 2023 年获得大量更新。
|
||||
|
||||
> **[TUXEDO OS][15]**
|
||||
|
||||
### 5、EuroLinux
|
||||
|
||||
![EuroLinux][16]
|
||||
|
||||
[EuroLinux][17] 是一个具有**企业级特性**的、基于 RHEL 的发行版。它以可靠的软件包提供了稳定性和安全性。
|
||||
|
||||
它基于 **RHEL 9**,可以提供与其他 [基于 RHEL 的服务器发行版][18](如 Rocky Linux,CentOS,AlmaLinux 等)的无缝兼容性。
|
||||
|
||||
它旨在以熟悉的用户界面布局吸引 Windows 和 macOS 用户,在屏幕底部提供了一个半透明的菜单栏。
|
||||
|
||||
你应该尝试一下,因为整个软件包相当充分,可以同时满足 Linux 和 Windows/macOS 用户的需要。
|
||||
|
||||
它现在已经发布了稳定版本,也在 2023 年有更新计划。
|
||||
|
||||
> **[EuroLinux][19]**
|
||||
|
||||
### 6、Zinc
|
||||
|
||||
![Zinc][20]
|
||||
|
||||
[Zinc][21] 是一个 **基于 Ubuntu 的发行版**,经过了调整后提供了一个独特的体验。现有的 Ubuntu 用户可能会惊讶于它所提供的内容。
|
||||
|
||||
它基于 **Xubuntu** 的最新 LTS 版本,使用了 XFCE 桌面环境,并对其进行了许多改进,例如集成的 Linux AppImage 支持、deb-get 包安装程序、BTRFS 作为默认文件系统等。
|
||||
|
||||
如果你正确的配置了它,它可以成为你的日用操作系统的替代品。
|
||||
|
||||
它遵循稳定的发布模式,因此你可以期待 2023 年的重大更新!
|
||||
|
||||
> **[Zinc][21]**
|
||||
|
||||
### 7、CachyOS
|
||||
|
||||
![CachyOS][22]
|
||||
|
||||
[CachyOS][23] 尝试使 **Arch Linux 变得对初学者更加友好**,让任何人都可以使用。它很受欢迎,因为它具有高度的可定制性,而且还拥有最新的软件。
|
||||
|
||||
它旨在为你提供一个快速、安全且易于使用的操作系统。
|
||||
|
||||
该操作系统适用于想要试验和尝试新事物的用户。
|
||||
|
||||
CachyOS 是一个滚动发布的发行版,因此你可以期待它在 2023 年获得大量更新。
|
||||
|
||||
> **[CachyOS][23]**
|
||||
|
||||
### 8、risiOS
|
||||
|
||||
![risiOS][24]
|
||||
|
||||
在基于 Arch 和 Ubuntu 的 Linux 发行版的海洋中,[risiOS][25] 是一道难得的风景。
|
||||
|
||||
该项目基于 Fedora Linux,其起源于美国西雅图。
|
||||
|
||||
它使用 **GNOME 桌面环境** 为用户提供了一个高度可定制的体验,同时还提供了 **自定义的 ZSH 版本**。
|
||||
|
||||
如果你希望尝试一个基于 Fedora 的发行版,这可能是你的新选择!
|
||||
|
||||
risiOS 会在稳定版本间隔中推送一些小更新。在 2023 年,它还有更多的东西可以提供给你。
|
||||
|
||||
> **[risiOS][25]**
|
||||
|
||||
### 9、Exodia OS
|
||||
|
||||
![Exodia OS][26]
|
||||
|
||||
#$**!又是一个基于 Arch 的 Linux 发行版?
|
||||
|
||||
是的。🤭 好吧,看起来今年我们已经受够了基于 Arch 的发行版了,这并不一定是坏事!
|
||||
|
||||
认识一下 [Exodia OS][27],一个基于 Arch 的 Linux 发行版,旨在为安全领域的用户提供高度可定制的体验。
|
||||
|
||||
其功能包括**为各种网络安全领域预装的工具、命令行界面应用、ElKowars wacky widgets (EWW)、Zsh 等**。
|
||||
|
||||
如果你是一个网络安全专家或爱好者,你可以试试!
|
||||
|
||||
他们为三个不同的使用场景提供了三个版本。你可以期待他们在 2023 年继续推送必要的更新和功能添加。
|
||||
|
||||
> **[Exodia OS][27]**
|
||||
|
||||
### 10、Kumandar Linux
|
||||
|
||||
![Kumandar Linux][28]
|
||||
|
||||
乍一看,你可能会认为这是 Windows 7,但如果仔细观察,你会发现这是 [Kumandar Linux][29]。
|
||||
|
||||
它基于**Debian 11,并使用自定义的 XFce 版本**。
|
||||
|
||||
该名称在中文中的含义为 “指挥官”,以向开发者的第一台电脑 [Commodore VIC20][30] 致敬。
|
||||
|
||||
如果你喜欢 Windows 7,但想在 Linux 上体验同样的体验,那么你可以试试!
|
||||
|
||||
目前,该系统只发布了早期的候选版本。但是,你可以期待在 2023 年发布稳定版本,希望如此!
|
||||
|
||||
> **[Kumander][29]**
|
||||
|
||||
### 11、Ubuntu Unity
|
||||
|
||||
![Ubuntu Unity][31]
|
||||
|
||||
[今年早些时候][32],Ubuntu Unity 被宣布为 Ubuntu 的官方版本,是 Ubuntu 的一个翻版。
|
||||
|
||||
它使用了 2010 - 2017 年间 Ubuntu 中使用的 Unity 桌面界面,该界面后来被 Canonical 使用 GNOME 取代。
|
||||
|
||||
开发工作如火如荼,年轻的首席开发人员正在推动更新和增加新功能。
|
||||
|
||||
想要尝试不同风格的 Ubuntu 的用户可以试试这个系统。它提供了 LTS 和非 LTS 版本。
|
||||
|
||||
> **[Ubuntu Unity][33]**
|
||||
|
||||
### 总结
|
||||
|
||||
即使有了这份全面的清单,我也可能遗漏了一些。 🤔
|
||||
|
||||
但是。
|
||||
|
||||
或许 2023 年会有惊喜的发布占据头版,或者一些现有的发行版会尝试一些不同的东西。
|
||||
|
||||
但在那之前,
|
||||
|
||||
_💬 请告诉我你在 2023 年期待着哪些发行版?_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/new-distros-2023/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Cubik65536](https://github.com/Cubik65536)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/distros-to-look-forward-in-2023.png
|
||||
[2]: https://itsfoss.com/best-linux-beginners/
|
||||
[3]: https://itsfoss.com/advanced-linux-distros/
|
||||
[4]: https://news.itsfoss.com/content/images/2022/12/Vanilla-OS-1.png
|
||||
[5]: https://usebottles.com
|
||||
[6]: https://vanillaos.org
|
||||
[7]: https://news.itsfoss.com/content/images/2022/12/XeroLinux.jpg
|
||||
[8]: https://itsfoss.com/xerolinux/
|
||||
[9]: https://xerolinux.xyz
|
||||
[10]: https://news.itsfoss.com/content/images/2022/12/Crystal-Linux.jpg
|
||||
[11]: https://git.getcryst.al/crystal
|
||||
[12]: https://getcryst.al
|
||||
[13]: https://news.itsfoss.com/content/images/2022/12/TuxedoOS.jpg
|
||||
[14]: https://news.itsfoss.com/tuxedo-os/
|
||||
[15]: https://www.tuxedocomputers.com/en/TUXEDO-OS_1.tuxedo
|
||||
[16]: https://news.itsfoss.com/content/images/2022/12/EuroLinux.jpg
|
||||
[17]: https://news.itsfoss.com/eurolinux-desktop/
|
||||
[18]: https://itsfoss.com/rhel-based-server-distributions/
|
||||
[19]: https://en.euro-linux.com/eurolinux/desktop/
|
||||
[20]: https://news.itsfoss.com/content/images/2022/12/Zinc.png
|
||||
[21]: https://teejeetech.com/tag/zinc/
|
||||
[22]: https://news.itsfoss.com/content/images/2022/12/CachyOS.jpg
|
||||
[23]: https://cachyos.org
|
||||
[24]: https://news.itsfoss.com/content/images/2022/12/risiOS.png
|
||||
[25]: https://risi.io
|
||||
[26]: https://news.itsfoss.com/content/images/2022/12/Exodia-OS.jpg
|
||||
[27]: https://exodia-os.github.io/exodia-website/
|
||||
[28]: https://news.itsfoss.com/content/images/2022/12/Kumander-Linux.jpg
|
||||
[29]: https://www.kumander.org
|
||||
[30]: https://en.wikipedia.org/wiki/VIC-20
|
||||
[31]: https://news.itsfoss.com/content/images/2022/12/UbuntuUnity.jpg
|
||||
[32]: https://news.itsfoss.com/unity-remix-official-flavor/
|
||||
[33]: https://ubuntuunity.org/
|
@ -0,0 +1,188 @@
|
||||
[#]: subject: "11 tips for writing a good Git commit message"
|
||||
[#]: via: "https://opensource.com/article/22/12/git-commit-message"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ZhangZhanhaoxiang"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15467-1.html"
|
||||
|
||||
编写好 Git 提交信息的 11 个技巧
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 我请社区的开源从业者分享了他们关于编写有用的 Git 提交信息的建议。
|
||||
|
||||
最近,当需要更新时,我一直在密切关注从产品和服务获得的变更日志。以下是一些示例:
|
||||
|
||||
- 修复了一些错误。
|
||||
- 进行了一些可访问性改进。
|
||||
- 我们已经进行了改进,并修复了错误,以实现更顺畅地运行。
|
||||
|
||||
当我想到我还是一名初级开发人员写的一些首次提交信息时,我不得不沮丧地垂下头:
|
||||
|
||||
- 用鼠标点了一下,现在一切似乎都正常了。
|
||||
- 执行了程序员 X 告诉我的操作,现在横幅是蓝色的。
|
||||
|
||||
这可真令人沮丧!我向我们的贡献者们提出了以下问题:
|
||||
|
||||
- 什么是好的 Git 提交信息?
|
||||
- 什么是坏的 Git 提交信息?
|
||||
- 你认为一个项目应该有哪些关于提交信息所写内容的规则?
|
||||
|
||||
以下是他们的答案:
|
||||
|
||||
### 易阅读的文笔是关键
|
||||
|
||||
与你写任何东西一样,你应该考虑谁会阅读它。然后相应地调整信息的数量和深度。
|
||||
|
||||
提高你的自然语言和写作技能对于软件开发的职业生涯顺利发展至关重要。重要的不仅仅是代码。
|
||||
|
||||
—— [Camilla Conte][1]
|
||||
|
||||
### 具有描述性,不要假设
|
||||
|
||||
我在 [OpenStack][2] 社区中花了很多时间合作,与我在像“野外”的其他随意的项目中看到的相比,它的代码审查者有一些相当严格的标准。
|
||||
|
||||
我花在撰写一条可靠的提交信息的时间,往往要比编写实际的代码实现或修复程序的时间长得多。有时,提交信息可能会比它们解释的代码变化长很多倍。
|
||||
|
||||
总结一些贡献者指导:
|
||||
|
||||
- 描述为什么要做出改变,而不仅仅是改变了什么
|
||||
- 第一个提交行是最重要的(就像电子邮件的主题行)
|
||||
- 不要假设审查者了解你正在修复的原始问题
|
||||
- 不要假设审查者可以访问外部 Web 服务或网站(总结缺陷报告和其他相关讨论)
|
||||
- 不要假设代码是不言自明的和自我说明的(尽管没有必要重复你在代码注释中也提出的观点)
|
||||
- 不要只包含与更改的早期修订相关的信息(我们希望贡献者将修订压扁在一起,并相应地编辑其提交信息)。
|
||||
|
||||
《OpenStack 贡献者指南》中有一个关于该主题的 [简短章节][3]。
|
||||
|
||||
—— [Jeremy Stanley][4]
|
||||
|
||||
### 未来的你会感谢自己
|
||||
|
||||
我非常同意 Jeremy 的观点。+1000。
|
||||
|
||||
Jeremy 说:“描述为什么要做出改变,而不仅仅是改变了什么。”
|
||||
|
||||
想象一下,你是旁观者,在遥远的未来试图理解这个提交。
|
||||
|
||||
正如老话所说,设身处地为他人着想。
|
||||
|
||||
—— [Leigh Morresi][5]
|
||||
|
||||
### 使用 bug ID
|
||||
|
||||
我建议在提交信息的开头添加 bug ID,这样在以后使用 [grep 命令][6] 跟踪提交信息时就会更方便。
|
||||
|
||||
例如:
|
||||
|
||||
```
|
||||
$ git commit -m "BZ#19xxxxx
|
||||
```
|
||||
|
||||
要写出深思熟虑的提交,请考虑以下事项:
|
||||
|
||||
- 我为什么要做这些更改?
|
||||
- 我的更改产生了什么影响?
|
||||
- 为什么有更改的必要?
|
||||
- 更改的依据是什么?
|
||||
|
||||
—— [Agil Antony][7]
|
||||
|
||||
### 讲述整个故事
|
||||
|
||||
我喜欢想象每个提交信息都有一个隐藏的前缀,上面写着 “By applying this(通过应用这个)”。
|
||||
|
||||
一个好的提交信息包括将要发生的事情以及原因。仅仅有工单作参考是不够的,因为这分散了信息;Git 是去中心化的。作为一名软件开发人员,我想知道为什么当前要考虑做出更改。正在解决的具体问题是什么?考虑(并放弃)了哪些替代解决方案?在创建变更集的过程中发现了哪些影响当前内容的意外情况?
|
||||
|
||||
缩短提交信息没有什么好处。你未来的自己和未来的同事会感激你深入地解释了问题,以及为什么这个变更集是解决方案。认真学习和利用那些内容丰富的“烹饪”博客。然而,在此,仅仅是把生活经验替换成了项目的问题罢了(LCTT 译注:意思是要认真学习和模仿优秀、详细的提交信息)。
|
||||
|
||||
—— [Lisa Seelye][8]
|
||||
|
||||
### 但不要过于冗长
|
||||
|
||||
一个好的 Git 提交信息包含有关所做操作的信息,而不要包含其他信息。例如,如果你需要更新 `.gitignore`,只需写 “更新了 .gitignore” 即可。人们可以自行深入到提交本身中了解更多细节。它不需要冗长。
|
||||
|
||||
糟糕的提交信息类似于“哦,糟糕”或“试试这个”。当然,我也曾经犯过这样的错误,但这对于任何需要一目了然地查看提交信息的人来说都没有任何帮助。
|
||||
|
||||
提交信息的规则非常主观。他们可能因领导和团队而异。但至少要提供一些有关提交的上下文信息。特别是如果它是一个大的更改。没有人有时间浏览 1000 多个具有大量更改历史的文件。
|
||||
|
||||
—— [Miriam Goldman][9]
|
||||
|
||||
### 使用现在时
|
||||
|
||||
我喜欢项目经理风格的提交信息,用现在时而不是将来时的术语编写(例如,“添加” 而不是“已添加”)。然而,这通常只有在频繁提交时才有可能。当你面临最后期限时,你能记住的只有“我是如何做的”而已。然而,写得好的提交不仅有助于合作者,而且有助于提交者回忆历史。
|
||||
|
||||
—— [Chris Okpada][10]
|
||||
|
||||
### 不要依赖链接
|
||||
|
||||
我想提醒同事们的一件事是,你不仅仅是向给你的提交作批准的人解释。你还要向未来的开发人员和用户解释,他们在使用 bisect 或 blame 定位问题时发现了这个提交,并试图了解其相关性。
|
||||
|
||||
如果提供的唯一的上下文是指向某个外部系统的链接,并且在未来很长一段时间内,它所链接的系统不再使用,或者该用户无法访问,那么你的提交信息将变得无用,可能还不如空白。
|
||||
|
||||
我经常去挖掘一些开源项目的 Git 历史,发现有些提交信息无非就是一个 Bug ID,或者是某个公司内部的和专用的缺陷跟踪器的链接。
|
||||
|
||||
不要依赖链接!
|
||||
|
||||
—— [Jeremy Stanley][4]
|
||||
|
||||
### 清晰简洁的变更日志
|
||||
|
||||
作为一名发布沟通经理,我会经常阅读整个发布版块。我还会与开发人员会面,讨论任何尚未明确的领域。然后我提前测试了版本。之后,我将通过寻找变更日志和相应的修订或新内容来撰写发布文章。
|
||||
|
||||
变更日志是开发人员的个人提醒,但也有相应的提议和工单。你应该适当地将产品名称大写,使用拼写检查器,与标点符号和句子结构保持一致。首席开发人员也应该校对这些。你的客户,即开发人员,正在阅读这些内容。在运行更新之前,他们应该了解哪些信息能更好地为客户服务?
|
||||
|
||||
—— [Courtney Robertson][11]
|
||||
|
||||
### 具体一点
|
||||
|
||||
作为一个经常性的发布经理,我喜欢带有组件名称的提交的信息,以及对更改内容的简要描述。在我们忘记了你聪明的分支名称之后,还可以参考一下这项工作的请求来自何处,这有助于将修复程序联系在一起。
|
||||
|
||||
- “修复致命错误”并不是理想的提交。
|
||||
- “ISS-304: 修复具有合作伙伴角色的用户在登录访问控制功能中的致命错误”更好。
|
||||
- “ISS-304: 登录访问控制:修复 `getPartnerId()` 的致命错误”也更好。
|
||||
|
||||
我可以查看 Git 提交、分支、合并提交之间的整个关系,并检查更改的各个行和文件。但我在发布过程中没有这样的时间。我希望能够在项目管理工具回溯这项工作的源头,了解哪些组件正在被更改,以及以何种方式进行更改。
|
||||
|
||||
—— [Ryan Price][12]
|
||||
|
||||
### 让它成为一种习惯
|
||||
|
||||
我最喜欢犯的错误是“在我切换分支之前提交”,因为我必须处理其他更紧急的事情。有时候,我需要把我目前的工作提交给一个完全不同的项目。我的经理的策略是让我们像平时一样工作。但当我们变基时,他希望我们在有意义的地方压扁提交,并编写更好的信息。我不能说我们总是这样做,但他的方法确实有道理。
|
||||
|
||||
我也有很多“这个坏了,不知道为什么”类型的信息(哈哈),我尝试了一些东西,但想在尝试其他东西之前提交该尝试,以防方法 A 比方法 B 更接近解决问题。我已经写了 10 多年了。
|
||||
|
||||
—— [RachieVee][13]
|
||||
|
||||
你的提交信息建议或提示是什么?让我们在评论中知道。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/git-commit-message
|
||||
|
||||
作者:[AmyJune Hineline][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[ZhangZhanhaoxiang](https://github.com/ZhangZhanhaoxiang)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/amyjune
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/users/spotlesstofu
|
||||
[2]: https://opensource.com/resources/what-is-openstack
|
||||
[3]: https://docs.openstack.org/contributors/common/git.html#commit-messages
|
||||
[4]: https://opensource.com/users/fungi
|
||||
[5]: https://opensource.com/users/dgtlmoon
|
||||
[6]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[7]: https://opensource.com/users/agantony
|
||||
[8]: https://opensource.com/users/lisa
|
||||
[9]: https://opensource.com/users/miriamgoldman
|
||||
[10]: https://opensource.com/users/ojchris
|
||||
[11]: https://opensource.com/users/courtneyrdev
|
||||
[12]: https://opensource.com/users/liberatr
|
||||
[13]: https://opensource.com/users/rachievee
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/22/184300vcsqmm85ub1ssh4b.jpg
|
@ -3,38 +3,46 @@
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15464-1.html"
|
||||
|
||||
Colorblind Filters:帮助色盲用户的 GNOME 扩展
|
||||
======
|
||||
|
||||
**一个不错的 GNOME 扩展:Colorblind Filters,它为色盲用户带来了许多选项。**
|
||||
![][0]
|
||||
|
||||
> 一个不错的 GNOME 扩展:Colorblind Filters,它为色盲用户带来了许多调整选项。
|
||||
|
||||
无障碍是计算和操作系统的一个重要方面。它包括对视力障碍、色盲和许多其他健康症状的管理设置。流行的 Linux 桌面环境,如 GNOME 和 KDE Plasma,具有无障碍设置,以帮助所有这些情况。
|
||||
|
||||
感谢 GNOME 扩展生态系统,有大量的专门扩展可以帮助这些用户。我遇到的其中一个扩展是[“Colorblind Filters”][1]。
|
||||
|
||||
|
||||
### Colorblind Filters – GNOME 扩展
|
||||
|
||||
根据维基百科,_"色盲通常涉及无法区分红色和绿色的深浅。遗传性色盲症没有治疗方法。如果色盲是由其他疾病引起的,治疗潜在的原因会有帮助。"_。
|
||||
|
||||
因此,你有选项来调整你的 Linux 桌面上的设置是很重要的。
|
||||
因此,你有可以调整你的 Linux 桌面设置的选项是很重要的。
|
||||
|
||||
#### 设置扩展程序和 Flatpak
|
||||
|
||||
首先,确保你已经启用了 Flatpak 和 GNOME 扩展。并且安装了扩展管理器。你可以参考这个关于如何[设置 flatpak][2]和启用 [GNOME 扩展][3]的详细指南,或者从终端运行以下命令(对于 Ubuntu、Linux Mint 等)。
|
||||
首先,确保你已经启用了 Flatpak 和 GNOME 扩展。并且安装了扩展管理器。你可以参考这个关于如何 [设置 flatpak][2] 和启用 [GNOME 扩展][3] 的详细指南,或者从终端运行以下命令(对于 Ubuntu、Linux Mint 等)。
|
||||
|
||||
```
|
||||
sudo apt install flatpaksudo apt install gnome-software-plugin-flatpakflatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakreporeboot
|
||||
sudo apt install flatpak
|
||||
sudo apt install gnome-software-plugin-flatpak
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
reboot
|
||||
|
||||
```
|
||||
|
||||
对于 Fedora 用户,使用以下命令。
|
||||
|
||||
```
|
||||
sudo dnf install flatpaksudo dnf install gnome-software-plugin-flatpakflatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakreporeboot
|
||||
sudo dnf install flatpak
|
||||
sudo dnf install gnome-software-plugin-flatpak
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
reboot
|
||||
```
|
||||
|
||||
完成后,安装扩展管理器:
|
||||
@ -53,19 +61,16 @@ flatpak install com.mattjakeman.ExtensionManager
|
||||
|
||||
![Colorblind Filters 扩展托盘图标][5]
|
||||
|
||||
右键点击眼睛图标以获得更多设置。这个扩展带来了色盲收集、模拟和额外选项的所有必要定制。目前有以下选项:
|
||||
|
||||
- 红色盲
|
||||
- 绿色盲
|
||||
- 蓝黄色盲
|
||||
右键点击眼睛图标以获得更多设置。这个扩展带来了色盲集合、模拟和额外选项的所有必要定制。目前有以下选项:
|
||||
|
||||
- 纠正和模拟(具有高对比度)
|
||||
|
||||
- GBR 和 BRG 的通道混合器
|
||||
- 亮度反转
|
||||
- 颜色反转
|
||||
|
||||
- 红色盲
|
||||
- 绿色盲
|
||||
- 蓝黄色盲
|
||||
- 额外的调整
|
||||
- GBR 和 BRG 的通道混合器
|
||||
- 亮度反转
|
||||
- 颜色反转
|
||||
|
||||
![Colorblind Filters - 选项][6]
|
||||
|
||||
@ -73,9 +78,9 @@ flatpak install com.mattjakeman.ExtensionManager
|
||||
|
||||
### 总结
|
||||
|
||||
我认为苹果的 macOS 和 iOS 已经实现了比 Windows 或 Linux 更好的无障碍。然而,Linux 桌面在这些应用和扩展方面也不落后。另外,还有一些专门的 Linux 发行版,如“[Accessible Coconut][7]”,它是为专门的需求而建立的。
|
||||
我认为苹果的 macOS 和 iOS 已经实现了比 Windows 或 Linux 更好的无障碍。然而,Linux 桌面在这些应用和扩展方面也不落后。另外,还有一些专门的 Linux 发行版,如 “[Accessible Coconut][7]”,它是为专门的需求而建立的。
|
||||
|
||||
我希望 Colorblind gnome 扩展对你日常使用 Linux 和 GNOME 桌面有帮助。
|
||||
我希望 Colorblind GNOME 扩展对你日常使用 Linux 和 GNOME 桌面有帮助。
|
||||
|
||||
干杯。
|
||||
|
||||
@ -86,7 +91,7 @@ via: https://www.debugpoint.com/colorblind-filters-gnome-extension/
|
||||
作者:[Arindam][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/) 荣誉推出
|
||||
|
||||
@ -99,3 +104,4 @@ via: https://www.debugpoint.com/colorblind-filters-gnome-extension/
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Colorblind-Filters-extension-tray-icon.gif
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Colorblind-Filters-options.jpg
|
||||
[7]: https://www.debugpoint.com/accessible-coconut-linux-visually-impaired/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/21/122942m49s8o25s9ai6szs.jpg
|
@ -0,0 +1,215 @@
|
||||
[#]: subject: "Learn to code with my retro computer program"
|
||||
[#]: via: "https://opensource.com/article/23/1/learn-machine-language-retro-computer"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15461-1.html"
|
||||
|
||||
用复古电脑程序 Toy CPU 学习低级编程
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 我写了一个名为 “Toy CPU” 的教育性复古计算机程序,以便我的学生能够学习机器语言。
|
||||
|
||||
我兼职教授大学课程,包括一个对所有专业开放的一般计算机主题的课程。这是一门入门课程,向学生讲授技术是如何运作的,以消除围绕计算的神秘感。
|
||||
|
||||
虽然不是计算机科学课程,但这门课的一个部分涉及计算机编程。我通常用非常抽象的术语谈论编程,所以不会让听众听不懂。但是今年,我想让我的学生以 “老派” 的方式做一些需要 “动手” 的编程。同时,我又想保持简单,以便让每个人都能跟上。
|
||||
|
||||
我喜欢将我的课程结构化,以显示你是如何从 “那里” 到 “这里” 的。理想情况下,我会让我的学生学习如何编写一个简单的程序。然后,我将从这里开始,展示现代编程是如何让开发人员创建更复杂的程序的。我决定尝试一种非常规的方法 —— 教学生学习终极的低级别编程语言:机器语言。
|
||||
|
||||
### 机器语言编程
|
||||
|
||||
早期的个人电脑如 Apple II(1977 年)、TRS-80(1977 年)和 IBM PC(1981 年)让用户用键盘输入程序,并在屏幕上显示结果。但计算机并不总是带有屏幕和键盘。
|
||||
|
||||
Altair 8800 和 IMSAI 8080(均为 1975 年制造)要求用户使用面板上的 “开关和灯” 输入程序。你可以用机器语言输入指令,使用一组开关,机器会点亮 LED 灯以代表每个二进制指令的 1 和 0。
|
||||
|
||||
![Altair 8800 计算机的图片][1]
|
||||
|
||||
对这些早期机器进行编程,需要了解被称为 “<ruby>操作码<rt>opcode</rt></ruby>” (操作代码的简称)的机器语言指令,以执行基本操作,如将两个数字相加或将一个值存储到计算机的存储器中。我想向我的学生展示程序员是如何通过开关和灯,手工输入一系列指令和内存地址的。
|
||||
|
||||
然而,在这门课上,使用实际的 Altair 8800 就有点太复杂了。我需要一些简单的、任何初级水平的学生都能掌握的东西。理想情况下,我希望能找到一个简单的 “业余” 复古计算机,其工作原理与 Altair 8800 相似,但我无法找到一个价格低于 100 美元的合适的 “类似 Altair” 的设备。我找到了几个 “Altair” 软件模拟器,但它们忠实地再现了 Altair 8800 的操作码,这对我的需求来说太过沉重。
|
||||
|
||||
我决定编写我自己的 “教育” 复古计算机。我称它为 “Toy CPU”。你可以在我的 [GitHub 代码库][2] 上找到它,包括几个可以运行的版本。第一版是一个实验性的原型,运行在 [FreeDOS][3] 上。第二版是一个更新的原型,在 Linux 上用 [ncurses][4] 运行。版本 3 是一个 FreeDOS 程序,在图形模式下运行。
|
||||
|
||||
### Toy CPU 的编程
|
||||
|
||||
Toy CPU 是一个非常简单的复古计算机。它只有 256 字节的内存和一个最小化的指令集,其目的是在复制 “开关和灯” 编程模式的同时保持简单化。它的界面模仿 Altair 8800,有一系列 8 个 LED 灯,分别代表计数器(程序的 “行号”)、指令、累积器(用于临时数据的内部存储器)和状态。
|
||||
|
||||
当你启动 Toy CPU 时,它通过清除内存来模拟 “启动”。当它启动时,它也会在屏幕右下方的状态灯中显示 “INI”(初始化)。“PWR”(电源)灯亮表示 Toy CPU 已被打开。
|
||||
|
||||
![Toy CPU 的启动屏幕][5]
|
||||
|
||||
当 Toy CPU 准备好让你进入一个程序时,它通过状态灯指示 “INP”(“输入”模式),并让你从程序的计数器 0 开始。Toy CPU 的程序总是从计数器 0 开始。
|
||||
|
||||
在 “输入” 模式下,用上下方向键显示不同的程序计数器,按回车键编辑当前计数器上的指令。当你进入 “编辑” 模式时,Toy CPU 的状态灯上会显示 “EDT”(“编辑” 模式)。
|
||||
|
||||
![Toy CPU 编辑屏幕][6]
|
||||
|
||||
Toy CPU 有一张速查表,被 “贴” 在显示屏的前面。它列出了 Toy CPU 可以处理的不同操作码。
|
||||
|
||||
- `00000000`(`STOP`):停止程序执行。
|
||||
- `00000001`(`RIGHT`):将累加器中的位向右移动一个位置。值 `00000010` 变成 `00000001`,`00000001` 变成 `00000000`。
|
||||
- `00000010`(`LEFT`):将累加器中的位向左移动一个位置。值 `01000000` 变成 `10000000`,`10000000` 变成 `00000000`。
|
||||
- `00001111`(`NOT`):对累加器进行二进制非操作。例如,值 `10001000` 变成 `01110111`。
|
||||
- `00010001`(`AND`):对累加器用存储在某一地址的值进行二进制与操作。该地址被存储在下一个计数器中。
|
||||
- `00010010`(`OR`):对累积器用存储在某一地址的值进行二进制或运算。
|
||||
- `00010011`(`XOR`):对累加器用存储在某一地址的值进行二进制异或运算。
|
||||
- `00010100`(`LOAD`):将一个地址的值加载(复制)到累加器中。
|
||||
- `00010101`(`STORE`): 存储(复制)累加器中的值到一个地址。
|
||||
- `00010110`(`ADD`):将存储在某一地址的数值加入到累加器中。
|
||||
- `00010111`(`SUB`):从累积器中减去储存在某一地址的数值。
|
||||
- `00011000`(`GOTO`):转到(跳到)一个计数器地址。
|
||||
- `00011001`(`IFZERO`):如果累加器为零,转到(跳到)一个计数器地址。
|
||||
- `10000000`(`NOP`):空操作,可以安全地忽略。
|
||||
|
||||
当处于 “编辑” 模式时,使用左右方向键选择操作码中的一个位,然后按空格键在关闭(0)和开启(1)之间翻转数值。当你完成编辑后,按回车键回到 “输入” 模式。
|
||||
|
||||
![Toy CPU 输入模式屏幕][7]
|
||||
|
||||
### 一个示例程序
|
||||
|
||||
我想通过输入一个简短的程序来探索 Toy CPU,将两个数值相加,并将结果存储在 Toy CPU 的内存中。实际上,这执行的是算术运算 `A+B=C`。要创建这个程序,你只需要几个操作码:
|
||||
|
||||
- `00010100`(`LOAD`)
|
||||
- `00010110`(`ADD`)
|
||||
- `00010101`(`STORE`)
|
||||
- `00000000`(`STOP`)
|
||||
|
||||
`LOAD`、`ADD` 和 `STORE` 指令需要一个内存地址,这个地址总是在下一个计数器的位置。例如,程序的前两条指令是:
|
||||
|
||||
```
|
||||
计数器 0:00010100
|
||||
计数器 1:某个内存地址,第一个值 A 存放在那里
|
||||
```
|
||||
|
||||
计数器 0 中的指令是 `LOAD` 操作,计数器 1 中的值是你存储某个值的内存地址。这两条指令一起将内存中的数值复制到 Toy CPU 的累加器中,在那里你可以对该数值进行操作。
|
||||
|
||||
将一个数字 `A` 装入累加器后,你需要将数值 `B` 加到它上面。你可以用这两条指令来做:
|
||||
|
||||
```
|
||||
计数器 2:00010110
|
||||
计数器 3:存储第二个值 B 的内存地址
|
||||
```
|
||||
|
||||
假设你把值 `1`(`A`)装入累加器,然后把值 `3`(`B`)加到它上面。现在累加器的值是 `4`。现在你需要用这两条指令把数值 `4` 复制到另一个内存地址(`C`):
|
||||
|
||||
```
|
||||
计数器 4:00010101
|
||||
计数器 5:一个内存地址(C),我们可以在那里保存新的值
|
||||
```
|
||||
|
||||
把这两个值加在一起后,现在可以用这条指令结束程序:
|
||||
|
||||
```
|
||||
计数器 6: 00000000
|
||||
```
|
||||
|
||||
计数器 6 之后的任何指令都可以供程序作为存储内存使用。这意味着你可以用计数器 7 的内存来储存值 `A`,计数器 8 的内存来储存值 `B` ,计数器 9 的内存来储存值 `C`。你需要将这些分别输入到 Toy CPU 中:
|
||||
|
||||
```
|
||||
计数器 7:00000001(1)
|
||||
计数器 8:00000011(3)
|
||||
计数器 9:00000000(0,以后会被覆盖)
|
||||
```
|
||||
|
||||
在弄清了所有指令和 `A`、`B` 和 `C` 的内存位置后,现在可以将完整的程序输入到 Toy CPU 中。这个程序将数值 1 和 3 相加,得到 4:
|
||||
|
||||
```
|
||||
计数器 0:00010100
|
||||
计数器 1:00000111(7)
|
||||
计数器 2:00010110
|
||||
计数器 3:00001000(8)
|
||||
计数器 4:00010101
|
||||
计数器 5:00001001(9)
|
||||
计数器 6:00000000
|
||||
计数器 7:00000001(1)
|
||||
计数器 8:00000011(3)
|
||||
计数器 9:00000000(0,以后会被覆盖)
|
||||
```
|
||||
|
||||
要运行程序,在 “输入” 模式下按下 `R` 键。Toy CPU 将在状态灯中显示 “RUN”(“运行” 模式),并从计数器 0 开始执行你的程序。
|
||||
|
||||
Toy CPU 有一个明显的延迟,所以你可以看到它执行程序中的每一步。随着程序的进行,你应该看到计数器从 `00000000`(0)移动到 `00000110`(6)。在计数器 1 之后,程序从内存位置 7 加载数值 `1`,累积器更新为 `00000001`(1)。在计数器 3 之后,程序将加数值 `3`,并更新累加器显示 `00000100`(4)。累加器将保持这种状态,直到程序在计数器 5 之后将数值存入内存位置 9,然后在计数器 6 结束。
|
||||
|
||||
![在运行模式下的 Toy CPU][8]
|
||||
|
||||
### 探索机器语言编程
|
||||
|
||||
你可以使用 Toy CPU 来创建其他程序,并进一步探索机器语言编程。通过用机器语言编写这些程序来测试你的创造力。
|
||||
|
||||
### 一个在累积器上闪灯的程序
|
||||
|
||||
你能点亮累加器上的右四位,然后是左四位,然后是所有的位吗?你可以用两种方法之一来写这个程序。
|
||||
|
||||
一种直接的方法是,从不同的内存地址加载三个数值,像这样:
|
||||
|
||||
```
|
||||
计数器 0:LOAD
|
||||
计数器 1:“右边”
|
||||
计数器 2:LOAD
|
||||
计数器 3:“左边”
|
||||
计数器 4:LOAD
|
||||
计数器 5:“所有”
|
||||
计数器 6:STOP
|
||||
计数器 7:00001111(“右边”)
|
||||
计数器 8:11110000(“左边”)
|
||||
计数器 9:11111111(“全部”)
|
||||
```
|
||||
|
||||
写这个程序的另一种方法是尝试使用 `NOT` 和 `OR` 二进制操作。这样可以得到一个更小的程序:
|
||||
|
||||
```
|
||||
计数器 0:LOAD
|
||||
计数器 1:“右边”
|
||||
计数器 2:NOT
|
||||
计数器 3:OR
|
||||
计数器 4:“右边”
|
||||
计数器 5:STOP
|
||||
计数器 6:00001111(“右边”)
|
||||
```
|
||||
|
||||
### 从一个数字开始倒数
|
||||
|
||||
你可以把 Toy CPU 作为一个倒数计时器。这个程序行使 `IFZERO` 测试,只有当累加器为零时,程序才会跳转到一个新的计数器:
|
||||
|
||||
```
|
||||
计数器 0:LOAD
|
||||
计数器 1:“初始值”
|
||||
计数器 2:IFZERO(这也是倒计时的“开始”)
|
||||
计数器 3:“结束”
|
||||
计数器 4:SUB
|
||||
计数器 5:“1”
|
||||
计数器 6:GOTO
|
||||
计数器 7:“开始”
|
||||
计数器 8:STOP
|
||||
计数器 9:00000111(“初始值”)
|
||||
计数器 10:00000001(“1”)
|
||||
```
|
||||
|
||||
Toy CPU 是学习机器语言的一个好方法。我在入门课程中使用了 Toy CPU,学生们说他们发现写第一个程序很困难,但写下一个程序就容易多了。学生们还表示,用这种方式编写程序其实很有趣,他们学到了很多关于计算机实际工作的知识。Toy CPU 既具有教育性,也很有趣味性!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/learn-machine-language-retro-computer
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/2022-12/MITS_Altair_8800_Computer_%281975%29.png
|
||||
[2]: https://github.com/freedosproject/toycpu
|
||||
[3]: https://opensource.com/downloads/guide-using-freedos
|
||||
[4]: https://opensource.com/article/21/8/ncurses-linux
|
||||
[5]: https://opensource.com/sites/default/files/2022-12/toycpu.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/edit0-load.png
|
||||
[7]: https://opensource.com/sites/default/files/2022-12/input0-load.png
|
||||
[8]: https://opensource.com/sites/default/files/2022-12/run-3.png
|
||||
[0]: https://opensource.com/sites/default/files/lead-images/retro_old_unix_computer.png
|
@ -3,34 +3,38 @@
|
||||
[#]: author: "Yauhen Zaremba https://opensource.com/users/yauhen-zaremba"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "lxbwolf"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15460-1.html"
|
||||
|
||||
构建高效的 DevOps 文化的 6 个技巧
|
||||
======
|
||||
|
||||
你为什么要构建 [DevOps][1] 文化?开发和运营团队的精简协作有很多好处。效率是首要目标:提高新软件部署的速度,减少等待的时间。培养同事之间的信任可以提升员工的满意度,激发新的创新,并对盈利能力产生积极的影响。
|
||||
> 无论你是刚刚开始在你的组织中使用 DevOps,还是仅仅想改善你现有的文化,请考虑这些技巧以及它们与你组织的未来的关系。
|
||||
|
||||
[DevOps][2] 是一个很广泛的范畴,大家的理解也见仁见智。每个公司对于如何实行 DevOps 也各不相同。这种意见的多样性实际上是一件好事--这么多的观点对于建立更强大的团队是很有用的。本指南将探讨在 DevOps 文化中鼓励同事之间更好地合作的最高技巧。
|
||||
![][0]
|
||||
|
||||
下面每个部分从不同的视角介绍 DevOps 文化,并争取将它引入你的工作中去。
|
||||
你为什么要构建 [DevOps][1] 文化?开发团队和运维团队的精简协作有很多好处。效率是首要目标:提高新软件部署的速度,减少等待的时间。培养同事之间的信任可以提升员工的满意度,激发新的创新,并对盈利能力产生积极的影响。
|
||||
|
||||
[DevOps][2] 是一个很广泛的思想,大家的理解也见仁见智。每个公司对于如何实行 DevOps 也各不相同。这种意见的多样性实际上是一件好事 —— 这么多的观点对于建立更强大的团队是很有用的。本指南将探讨在 DevOps 文化中鼓励同事之间更好地合作的最高技巧。
|
||||
|
||||
下面每个部分从不同的视角介绍 DevOps 文化,并探讨了将它引入员工队伍的方法。
|
||||
|
||||
![DevOps includes collaboration, workflow, infosec, and iteration.][3]
|
||||
|
||||
### 流程的持续开发
|
||||
### 流程的持续发展
|
||||
|
||||
DevOps 文化的这一核心原则使它与许多其他类型的工作区别开来。DevOps 哲学说,犯错是有积极意义的,因为这表明你在尝试新的想法。
|
||||
DevOps 文化的这一核心原则使它与许多其他类型的工作场所的风气区别开来。DevOps 哲学说,犯错是有积极意义的,因为这表明你在尝试新的想法。
|
||||
|
||||
DevOps 文化的核心是不停地创造。实际上,这意味着当测试结果显示事情由于你的改动而变坏时,不要懊恼。我们要认识到,进化的过程不是线性的,通往成功的道路也从来不是一条直线。
|
||||
|
||||
DevOps 专家[Gene Kim][4] 主张勇于承担风险和进行实验。鼓励你的团队尝试不寻常的任务,以得到新的领悟。
|
||||
DevOps 专家 [Gene Kim][4] 主张勇于承担风险和进行实验。鼓励你的团队尝试不寻常的任务,以得到新的领悟。
|
||||
|
||||
你的组织应该以利润为导向吗?你能允许你的团队尝试一些新东西(非指个人兴趣项目)吗?持续的流程开发意味着对升级目前的方法持开放态度。优秀的销售领导懂得,结果比出勤率更重要,因此,关注团队的工作方式而不是工作量的多少始终是关键。
|
||||
你的组织应该以利润为导向吗?你能允许你的团队尝试一些新东西(非指个人兴趣项目)吗?持续的流程发展意味着对升级目前的方法持开放态度。优秀的销售领导懂得,结果比出勤率更重要,因此,关注团队的工作方式而不是工作量的多少始终是关键。
|
||||
|
||||
### 随时提供反馈并积极寻求反馈
|
||||
|
||||
成员之间增加信任是蓬勃发展的 DevOps 文化的另一个关键特征。无论你的员工是在学习如何建立联盟网络联系,还是试图设计他们的下一个 [UX][5] 调查,每个人都应该对他们工作的反馈持开放态度。但是,除非你的团队成员尊重彼此的意见,并相信反馈是本着善意的精神提出的,否则这永远不会发生。
|
||||
成员之间增加信任是蓬勃发展的 DevOps 文化的另一个关键特征。无论你的员工是在学习如何建立联盟网络联系,还是试图设计他们的下一个 [用户体验][5] 调查,每个人都应该对他们工作的反馈持开放态度。但是,除非你的团队成员尊重彼此的意见,并相信反馈是本着善意的精神提出的,否则这永远不会发生。
|
||||
|
||||
这种文化听起来可能是很难培养的;事实上,一些公司会比其他公司更努力地实现这一点。诚然,给予和接受反馈的成功很大程度上取决于员工的个性。在招聘过程中,也可以对此进行筛选。
|
||||
|
||||
@ -40,19 +44,19 @@ DevOps 专家[Gene Kim][4] 主张勇于承担风险和进行实验。鼓励你
|
||||
|
||||
### 不断改进
|
||||
|
||||
在同事之间增加智力信任的基础上,你的团队应该寻找方法来改善其工作。DevOps 的性质意味着软件开发团队将比传统方法更迅速地进行部署。
|
||||
在同事之间增加对智力信任的基础上,你的团队应该寻找方法来改善其工作。DevOps 的性质意味着软件开发团队将比传统方法更迅速地进行部署。
|
||||
|
||||
这种开放的改进文化可以对开发和运维以外的部门产生积极的影响。你也可以自己去探索,企业还有哪些领域会受到积极的影响。
|
||||
这种开放的改进文化可以对开发和运维以外的部门产生积极的影响。你也可以自己去探索企业还有哪些领域会受到积极的影响。
|
||||
|
||||
留意培训和提高技能的机会。即使一个培训课程没有广告上说的那么突出,但有机会与行业专家建立联系,并与未来建立联系,这可以提高你的组织内的思想多样性。
|
||||
|
||||
### 为以后的开发保存当前的想法
|
||||
|
||||
频繁使用的 [Git][7] 账户应该是你的 DevOps 工具链的一部分。你可以用 Git 作为软件开发和其他相关项目中产生的脚本的共同仓库。Git 作为 "版本控制" 工具而被熟知,Git 允许程序员保存他们工作的迭代、复用或改进其他人的工作。
|
||||
频繁使用的 [Git][7] 账户应该是你的 DevOps 工具链的一部分。你可以用 Git 作为软件开发和其他相关项目中产生的脚本的共同仓库。Git 作为 “版本控制” 工具而被熟知,Git 允许程序员保存他们工作的迭代、复用或改进其他人的工作。
|
||||
|
||||
你的目标是有能力保留好的想法供将来使用。某个方法由于某种原因没有成功。然而,那套想法在当时是错误的,并不意味着它在未来永远无法成为有用的东西。
|
||||
你的目标是能够保留好的想法以供将来使用。某个方法由于某种原因没有成功。然而,那套想法在当时是错误的,并不意味着它在未来永远无法成为有用的东西。
|
||||
|
||||
由于 DevOps 的整个重点在于生产环境中的软件的端到端所有权,因此保存开发的迭代真正支持这一原则。你希望看到对手头的软件测试项目的持续关注和投入。
|
||||
由于 DevOps 的整个重点在于生产环境中的软件的端到端所有权,因此节省开发的迭代真正支持这一原则。你希望看到对手头的软件测试项目的持续关注和投入。
|
||||
|
||||
一个简单的方法是要求开发者在开发者合同和最终项目报告中包含对未来工作的想法。确保技术服务经理知道他们应该要求提供在建设过程中出现的旁门左道的想法的例子。意识到这些小创新的人越多,在需要的时候就越有可能有人记住一个。
|
||||
|
||||
@ -60,24 +64,23 @@ DevOps 专家[Gene Kim][4] 主张勇于承担风险和进行实验。鼓励你
|
||||
|
||||
目标是对彼此的工作角色以及它们之间的相互关系有一个共同的理解。你可以通过几个简单的方法实现这一目标,用一句话概括:坐在一起。邀请其他团队参加你们的会议,完整地分享用户反馈报告。一起吃午饭,一起计划虚拟的快乐时光,一般来说,要确保你的同事都在一起。大约 90% 的拥有成熟的 DevOps 协议的团队报告说,他们清楚地了解自己对其他团队的责任,而在不成熟的 DevOps 团队中,只有大约 46% 的工作者清楚地了解自己的责任。
|
||||
|
||||
虽然与志同道合的人结成小团体,只与被雇来执行与你相同任务的员工一起玩耍是很诱人的,但这对整个企业来说是很糟糕的。无论你喜欢与否,所有的人都是多面手,能够在一系列的情况下贡献自己的独特才能。
|
||||
虽然与志同道合的人结成小团体,只与被雇来执行与你相同任务的员工在一起是很诱人的,但这对整个企业来说是很糟糕的。无论你喜欢与否,所有的人都是多面手,能够在一系列的情况下贡献自己的独特才能。
|
||||
|
||||
密切协作的想法是尊重任何人对其周围正在进行的产品或工作流程提出改进建议的能力。如果你与公司内的其他部门保持一定的距离,你将会错过无数次分享智慧想法的机会。毕竟,你往往在交流中学习得最好。
|
||||
密切协作的理念是尊重任何人对其周围正在进行的产品或工作流程提出改进建议的能力。如果你与公司内的其他部门保持一定的距离,你将会错过无数次分享智慧想法的机会。毕竟,你往往在交流中学习得最好。
|
||||
|
||||
### 致力于自动化
|
||||
|
||||
你应该以提高效率和加速流程的方式,将单调的和重复的任务变为自动化。每个行业都有无聊的--说得直白一点,愚蠢的--每天或每周都要进行的工作。
|
||||
你应该以提高效率和加速流程的名义,寻求将单调的和重复的任务变为自动化。每个行业都有无聊的 —— 说得直白一点,就是愚蠢的 —— 每天或每周都要进行的工作。
|
||||
|
||||
无论是手工将数据从一页复制到另一页,还是手工打出音频记录,每个级别的工作人员都应该坚持让机器在可能的情况下承担这些负担。现实是自动化技术每年都在进步,操作流程也应该如此。[自动化测试][8] 对 DevOps 非常关键,它是 CALMS 框架的第二个原则(其中的 “C”代表“文化”)。
|
||||
|
||||
你怎样才能实现这一点?邀请员工公开表达他们认为工作的哪些方面可以自动化,然后--这里是关键的部分--支持实现自动化所需的设施。这可能意味着每年花 600 美元订阅一个软件程序、一套完整的企业应用现代化解决方案或开发人员的两天时间来建立一个新的工具在内部使用。
|
||||
无论是手工将数据从一页复制到另一页,还是手工打出音频记录,每个级别的工作人员都应该坚持让机器在可能的情况下承担这些负担。现实是自动化技术每年都在进步,操作流程也应该如此。[自动化测试][8] 对 DevOps 非常关键,它是 CALMS 框架的第二个原则(其中的 “C” 代表 “文化”)。
|
||||
|
||||
你怎样才能实现这一点?邀请员工公开表达他们认为工作的哪些方面可以自动化,然后 —— 这里是关键的部分 —— 支持实现自动化所需的设施。这可能意味着每年花 600 美元订阅一个软件程序、一套完整的企业应用现代化解决方案,或开发人员用两天时间来建立一个在内部使用新工具。
|
||||
|
||||
无论哪种方式,你都应该评估自动化的好处,考虑你可以为每个人节省多少时间。DevOps 的统计数据不断表明,现代公司通过整合这些有益的原则,年复一年地得到了很大的改善。
|
||||
|
||||
### 探索成功的新工作方式
|
||||
|
||||
文化转变不会在一夜之间发生。不过,你越早开始,就越早看到结果。根据我的经验,当变化是对以前的真正改进时,人们会接受它。DevOps 为这种改进提供了一个框架。无论你是刚刚在你的组织中开始使用 DevOps,还是仅仅想改善你现有的文化,请考虑以上几点以及它们与你组织的未来的关系。
|
||||
文化转变不会在一夜之间发生。不过,你越早开始,就越早看到结果。根据我的经验,当变化真正对以前进行了改进时,人们会接受它。DevOps 为这种改进提供了一个框架。无论你是刚刚在你的组织中开始使用 DevOps,还是仅仅想改善你现有的文化,请考虑以上几点以及它们与你组织的未来的关系。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -86,7 +89,7 @@ via: https://opensource.com/article/23/1/tips-effective-devops-culture
|
||||
作者:[Yauhen Zaremba][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -100,3 +103,4 @@ via: https://opensource.com/article/23/1/tips-effective-devops-culture
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/devop-venn.png
|
||||
[7]: https://opensource.com/article/22/11/git-concepts
|
||||
[8]: https://opensource.com/article/20/7/open-source-test-automation-frameworks
|
||||
[0]: https://opensource.com/sites/default/files/lead-images/team_dev_email_chat_video_work_wfm_desk_520.png
|
@ -0,0 +1,128 @@
|
||||
[#]: subject: "Use time-series data to power your edge projects with open source tools"
|
||||
[#]: via: "https://opensource.com/article/23/1/time-series-data-edge-open-source-tools"
|
||||
[#]: author: "Zoe Steinkamp https://opensource.com/users/zoesteinkamp"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ZhangZhanhaoxiang"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15481-1.html"
|
||||
|
||||
使用时间序列数据,用开源工具助力你的边缘项目
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> InfluxData 是一个开源的时间序列数据库平台。下面介绍了它是如何被用于边缘应用案例的。
|
||||
|
||||
收集到的随时间变化的数据称为时间序列数据。今天,它已经成为每个行业和生态系统的一部分。它是不断增长的物联网行业的一大组成部分,将成为人们日常生活的重要部分。但时间序列数据及其需求很难处理。这是因为没有专门为处理时间序列数据而构建的工具。在这篇文章中,我将详细介绍这些问题,以及过去 10 年来 InfluxData 如何解决这些问题。
|
||||
|
||||
### InfluxData
|
||||
|
||||
InfluxData 是一个开源的时间序列数据库平台。你可能通过 [InfluxDB][1] 了解该公司,但你可能不知道它专门从事时间序列数据库开发。这很重要,因为在管理时间序列数据时,你要处理两个问题:存储生命周期和查询。
|
||||
|
||||
在存储生命周期中,开发人员通常首先收集和分析非常详细的数据。但开发人员希望存储较小的、降低采样率的数据集,以描述其趋势,而不占用太多的存储空间。
|
||||
|
||||
查询数据库时,你不希望基于 ID 查询数据,而是希望基于时间范围进行查询。使用时间序列数据最常见的一件事是在一段时间内对其进行汇总。在典型的关系型数据库中存储数据时,这种查询是很慢的,这种数据库使用行和列来描述不同数据点的关系。专门为处理时间序列数据而设计的数据库可以更快地处理这类查询。InfluxDB 有自己的内置查询语言:Flux,这是专门为查询时间序列数据集而构建的。
|
||||
|
||||
![Telegraf 如何工作的图像][2]
|
||||
|
||||
### 数据采集
|
||||
|
||||
数据采集和数据处理都有一些很棒的工具。InfluxData 有 12 个以上的客户端库,允许你使用自己选择的编程语言编写和查询数据。这是自定义用法的一个很好的工具。开源摄取代理 Telegraf 包括 300 多个输入和输出插件。如果你是一个开发者,你也可以贡献自己的插件。
|
||||
|
||||
InfluxDB 还可以接受上传小体积历史数据集的 CSV 文件,以及大数据集的批量导入。
|
||||
|
||||
```
|
||||
import math
|
||||
bicycles3 = from(bucket: "smartcity")
|
||||
|> range(start:2021-03-01T00:00:00z, stop: 2021-04-01T00:00:00z)
|
||||
|> filter(fn: (r) => r._measurement == "city_IoT")
|
||||
|> filter(fn: (r) => r._field == "counter")
|
||||
|> filter(fn: (r) => r.source == "bicycle")
|
||||
|> filter(fn: (r) => r.neighborhood_id == "3")
|
||||
|> aggregateWindow(every: 1h, fn: mean, createEmpty:false)
|
||||
bicycles4 = from(bucket: "smartcity")
|
||||
|> range(start:2021-03-01T00:00:00z, stop: 2021-04-01T00:00:00z)
|
||||
|> filter(fn: (r) => r._measurement == "city_IoT")
|
||||
|> filter(fn: (r) => r._field == "counter")
|
||||
|> filter(fn: (r) => r.source == "bicycle")
|
||||
|> filter(fn: (r) => r.neighborhood_id == "4")
|
||||
|> aggregateWindow(every: 1h, fn: mean, createEmpty:false)join(tables: {neighborhood_3: bicycles3, neighborhood_4: bicycles4}, on ["_time"], method: "inner")
|
||||
|> keep(columns: ["_time", "_value_neighborhood_3","_value_neighborhood_4"])
|
||||
|> map(fn: (r) => ({
|
||||
r with
|
||||
difference_value : math.abs(x: (r._value_neighborhood_3 - r._value_neighborhood_4))
|
||||
}))
|
||||
```
|
||||
|
||||
### Flux
|
||||
|
||||
Flux 是我们的内部查询语言,从零开始建立,用于处理时间序列数据。它也是我们一些工具的基础动力,包括 <ruby>任务<rt>task</rt></ruby>、<ruby>警报<rt>alert</rt></ruby> 和 <ruby>通知<rt>notification</rt></ruby>。要剖析上面的 Flux 查询,需要定义一些东西。首先,“<ruby>桶<rt>bucket</rt></ruby>”就是我们所说的数据库。你可以配置存储桶,然后将数据流添加到其中。查询会调用 `smartcity` 存储桶,其范围为特定的一天(准确地说是 24 小时)。你可以从存储桶中获取所有数据,但大多数用户都包含一个数据范围。这是你能做的最基本的 Flux 查询。
|
||||
|
||||
接下来,我添加过滤器,将数据过滤到更精确、更易于管理的地方。例如,我过滤分配给 id 为 3 的社区中的自行车数量。从那里,我使用 `aggregateWindow` 获取每小时的平均值。这意味着我希望收到一个包含 24 列的表,每小时一列。我也对 id 为 4 的社区进行同样的查询。最后,我将这两张表相叠加,得出这两个社区自行车使用量的差异。
|
||||
|
||||
如果你想知道什么时候是交通高峰,这是不错的选择。显然,这只是 Flux 查询功能的一个小例子。但它提供了一个很好的例子,使用了 Flux 附带的一些工具。我还有很多的数据分析和统计功能。但对于这一点,我建议查看 Flux 文档。
|
||||
|
||||
```
|
||||
import "influxdata/influxdb/tasks"
|
||||
option task = {name: PB_downsample, every: 1h, offset: 10s}
|
||||
from(bucket: "plantbuddy")
|
||||
|>range(start: tasks.lastSuccess(orTime: -task.every))
|
||||
|>filter(fn: (r) => r["_measurement"] == "sensor_data")
|
||||
|>aggregateWindow(every: 10m, fn:last, createEmpty:false)
|
||||
|>yield(name: "last")
|
||||
|>to(bucket: "downsampled")
|
||||
```
|
||||
|
||||
### 任务
|
||||
|
||||
InfluxDB <ruby>任务<rt>task</rt></ruby> 是一个定时 Flux 脚本,它接收输入数据流并以某种方式修改或分析它。然后,它将修改后的数据存储在新的存储桶中或执行其他操作。将较小的数据集存储到新的存储桶中,称为“<ruby>降采样<rt>downsampling</rt></ruby>”,这是数据库的核心功能,也是时间序列数据生命周期的核心部分。
|
||||
|
||||
你可以在当前任务示例中看到,我已经对数据进行了降采样。我得到每 10 分钟增量的最后一个值,并将该值存储在降采样桶中。原始数据集在这 10 分钟内可能有数千个数据点,但现在降采样桶只有 60 个新值。需要注意的一点是,我还使用了范围内的 `lastSuccess` 函数。这会告诉 InfluxDB 从上次成功运行的时间开始运行此任务,以防它在过去 2 小时内失败,在这种情况下,它可以追溯 3 个小时内的最后一次成功运行。这对于内置错误处理非常有用。
|
||||
|
||||
![检查和警报通知系统的图像][3]
|
||||
|
||||
### 检查和警报
|
||||
|
||||
InfluxDB 包含一个 <ruby>警报<rt>Alert</rt></ruby> 或 <ruby>检查<rt>Check</rt></ruby> 和 <ruby>通知<rt>notification</rt></ruby> 系统。这个系统非常简单直白。首先进行检查,定期查看数据以查找你定义的异常。通常,这是用阈值定义的。例如,任何低于 32°F 的温度值都被指定为“WARN”值,高于 32°F 都被分配为“OK”值,低于 0°F 都被赋予“CRITICAL”值。从那开始,你的检查可以按你认为必要的频率运行。你的检查以及每个检查的当前状态都有历史记录。在不需要的时候,你不需要设置通知。你可以根据需要参考你的警报历史记录。
|
||||
|
||||
许多人选择设置通知。为此,你需要定义一个 <ruby>通知端点<rt>notification endpoint</rt></ruby>。例如,聊天应用程序可以进行 HTTP 调用以接收通知。然后你定义何时接收通知,例如,你可以每小时运行一次检查。你可以每 24 小时运行一次通知。你可以让通知响应值更改,例如,“WARN”更改为“CRITICAL”,或者当值为“CRITICAL”时,无论如何都从“OK”更改为“WARN”。这是一个高度可定制的系统。从这个系统创建的 Flux 代码也可以编辑。
|
||||
|
||||
![新 Edge 功能的图像][4]
|
||||
|
||||
### 边缘
|
||||
|
||||
最后,我想把所有的核心功能放在一起,包括最近发布的一个非常特别的新功能。“Edge to cloud” 是一个非常强大的工具,允许你运行开源 InfluxDB,并在出现连接问题时在本地存储数据。连接修复后,它会将数据流传输到 InfluxData 云平台。
|
||||
|
||||
这对于边缘设备和重要数据非常重要,因为任何数据丢失都是有害的。你定义一个要复制到云的存储桶,然后该存储桶有一个磁盘支持的队列来本地存储数据。然后定义云存储桶应该复制到的内容。在连接到云端之前,数据都存储在本地。
|
||||
|
||||
### InfluxDB 和物联网边缘
|
||||
|
||||
假设你有一个项目,你想使用连接到植物上的物联网传感器 [监测家里植物的健康状况][5]。该项目是使用你的笔记本电脑作为边缘设备设置的。当你的笔记本电脑合上或关闭时,它会在本地存储数据,然后在重新连接时将数据流传到我的云存储桶。
|
||||
|
||||
![图片展示了 Plant buddy 的工作方式][6]
|
||||
|
||||
需要注意的一点是,在将数据存储到复制桶之前,这会对本地设备上的数据进行降采样。你的植物传感器每秒提供一个数据点。但它将数据压缩为一分钟的平均数,因此存储的数据更少了。在云账户中,你可以添加一些警报和通知,让你知道植物的水分何时低于某个水平,需要浇水。也可以在网站上使用视觉效果来告诉用户植物的健康状况。
|
||||
|
||||
数据库是许多应用程序的主干。在像 InfluxDB 的时间序列数据库平台中使用带有时间戳的数据可以节省开发人员的时间,并使他们能够访问各种工具和服务。InfluxDB 的维护者喜欢看到人们在我们的开源社区中构建什么,所以请与我们联系,并与其他人共享你的项目和代码!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/time-series-data-edge-open-source-tools
|
||||
|
||||
作者:[Zoe Steinkamp][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[ZhangZhanhaoxiang](https://github.com/ZhangZhanhaoxiang)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/zoesteinkamp
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/17/8/influxdb-time-series-database-stack
|
||||
[2]: https://opensource.com/sites/default/files/2022-12/Telegraf.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-12/TimeSeriesChecks%26Alerts.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-12/TimSeriesEdge.png
|
||||
[5]: https://opensource.com/article/22/5/plant-care
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/TimeSeriesplantbuddy.png
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/25/220620ftlnqfm4og7q2j0z.jpg
|
191
published/202301/20230110.3 ⭐️⭐️ How to use methods in Java.md
Normal file
191
published/202301/20230110.3 ⭐️⭐️ How to use methods in Java.md
Normal file
@ -0,0 +1,191 @@
|
||||
[#]: subject: "How to use methods in Java"
|
||||
[#]: via: "https://opensource.com/article/23/1/java-methods"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ZhangZhanhaoxiang"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15473-1.html"
|
||||
|
||||
如何在 Java 中使用方法
|
||||
======
|
||||
|
||||
> 在这个简便的教程中,我们可以了解到 Java 中方法的定义,如何使用方法,以及何时使用方法。
|
||||
|
||||
![][0]
|
||||
|
||||
Java 中的方法(在许多其他编程语言中称为“函数”)是被组合在一起并标记为可重用的一块代码。方法很有用,因为它们允许你在不重写相同代码的情况下,执行相同的操作或一系列操作,这不仅意味着你的工作量减少,还意味着出现问题时需要维护和调试的代码减少。
|
||||
|
||||
方法存在于类中,因此标准 Java 样板代码适用:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
// 在此写代码
|
||||
}
|
||||
```
|
||||
|
||||
在这样一个简单的单文件应用程序中,包定义并不是绝对必要的,但它是一个很好的习惯,而且大多数 IDE 都强制执行它。
|
||||
|
||||
默认情况下,Java 会寻找在类中运行的 `main` 方法。方法可以是公有的或私有的,也可以是静态的或非静态的,但 `main` 方法必须是公有的、静态的,Java 编译器才能识别和使用它。当方法是公有的时,它可以从类外部执行。要在程序启动时调用 `Example` 类,其 `main` 方法必须是可访问的,因此将其设置为 `public`。
|
||||
|
||||
下面是两个方法的简单演示:一个 `main` 方法在调用 `Example` 类时默认执行,另一个 `report` 方法接受 `main` 的输入并执行简单操作。
|
||||
|
||||
为了模拟任意数据输入,我使用了 `if`-`then` 语句,该语句根据你启动应用程序的时间在两个字符串之间进行选择。换句话说,`main` 方法首先设置一些数据(在现实生活中,这些数据可以来自用户输入,也可以来自应用程序其他地方的其他方法),然后 “调用” `report`方法,将处理后的数据作为输入提供:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
// 生成一些数据
|
||||
long myTime = System.currentTimeMillis();
|
||||
String weather;
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
weather = "party";
|
||||
} else {
|
||||
weather = "apocalypse";
|
||||
}
|
||||
|
||||
// 调用其他方法
|
||||
report(weather);
|
||||
}
|
||||
|
||||
private static void report(String day) {
|
||||
System.out.printf("Welcome to the zombie %s\n", day);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
运行代码:
|
||||
|
||||
```
|
||||
$ java ./Example.java
|
||||
Welcome to the zombie apocalypse
|
||||
$ java ./Example.java
|
||||
Welcome to the zombie party
|
||||
```
|
||||
|
||||
请注意,同一 `report` 方法有两个不同的结果。当然,在这个简单的演示中,不需要第二种方法。模拟数据生成的 `if`-`then` 语句可能生成了相同的结果。但是,当一个方法执行一项复杂的任务时,比如将图像调整为缩略图,然后使用调整后的图像在屏幕上生成小部件,那么附加组件的“费用”就很有意义了。
|
||||
|
||||
### 何时使用 Java 方法
|
||||
|
||||
很难知道何时使用方法,何时只将数据发送到 [Java 流][1] 或循环中。如果你面临这个决定,答案通常是使用一种方法。原因如下:
|
||||
|
||||
- 方法开销少。它们不会给代码增加处理开销。
|
||||
- 方法减少代码的行数。
|
||||
- 方法是特定的。查找名为 `resizeImage` 的方法通常比查找隐藏在从驱动器加载图像的函数中某个循环中的代码更容易。
|
||||
- 方法是可重用的。当你第一次编写方法时,你可能会 _认为_ 它只对应用程序中的一个任务有用。然而,随着应用程序的编写,你可能会发现自己正在使用一种你认为“已完成”的方法。
|
||||
|
||||
### 函数式编程与面向对象编程
|
||||
|
||||
函数式编程利用方法作为执行任务的主要构造。创建一个方法,该方法接受一种数据,处理该数据,并输出新数据。将许多方法串在一起,你就拥有了一个动态且功能强大的应用程序。像 C 和 [Lua][2] 这样的编程语言就是这种编码风格的例子。
|
||||
|
||||
用代码完成任务的另一种方式是 Java 使用的面向对象模型。在面向对象编程中,方法是模板的组成部分。你可以创建对象,而不是将数据从一个方法发送到另一个方法,并可以通过使用它们的方法来更改它们。
|
||||
|
||||
从面向对象的角度来看,这是一个简单的 “僵尸末日” 演示程序。在函数方法中,我使用一种方法生成数据,另一种方法使用该数据执行操作。面向对象的等价物是具有表示工作单元的类。这个示例应用程序向用户显示一条当天的消息,宣布这一天会有僵尸派对或是僵尸末日。编写一个“天”对象,然后查询该对象以了解其特性是有意义的。作为演示面向对象构造的不同方面的借口,新的示例应用程序还将统计有多少僵尸出现在派对上(或末日)。
|
||||
|
||||
Java 为每个类使用一个文件,因此要创建的第一个文件是 `Day.Java`,它用作 `Day` 对象:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// 类
|
||||
public class Day {
|
||||
public static String weather;
|
||||
public int count;
|
||||
|
||||
// 构造方法
|
||||
public Day() {
|
||||
long myTime = System.currentTimeMillis();
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
weather = "paradise";
|
||||
} else {
|
||||
weather = "apocalypse";
|
||||
}
|
||||
}
|
||||
|
||||
// 方法
|
||||
public String report() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public int counter() {
|
||||
Random rand = new Random();
|
||||
count = count + rand.nextInt(100);
|
||||
|
||||
return(count);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在“类”部分中,创建了两个域:天象 `weather` 和计数 `count`。`weather` 是静态的。在一天的过程中(在这种假想的情况下),`weather` 不会改变。要么是派对 `paradise`,要么是末日 `apocalypse`,持续了一整天。然而,僵尸的数量在一天中会增加。
|
||||
|
||||
在“构造方法”部分,确定当天的天象。它是作为一个 [构造方法][3] 完成的,因为它只在类最初被调用时发生一次。
|
||||
|
||||
在“方法”部分,`report` 方法只返回由构造方法确定和设置的天象报告。然而,`counter` 方法生成一个随机数,并将其添加到当前僵尸计数中。
|
||||
|
||||
换句话说,这个类做了三件不同的事情:
|
||||
|
||||
- 表示应用程序定义的“天”。
|
||||
- 设置当天不变的天气报告。
|
||||
- 设置一天中不断增加的僵尸数量。
|
||||
|
||||
要使用这所有,请创建第二个文件:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
Day myDay = new Day();
|
||||
String foo = myDay.report();
|
||||
String bar = myDay.report();
|
||||
|
||||
System.out.printf("Welcome to a zombie %s\n", foo);
|
||||
System.out.printf("Welcome to a zombie %s\n", bar);
|
||||
System.out.printf("There are %d zombies out today.\n", myDay.counter());
|
||||
System.out.printf("UPDATE: %d zombies. ", myDay.counter());
|
||||
System.out.printf("UPDATE: %d zombies. ", myDay.counter());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
因为现在有两个文件,所以使用 Java IDE 运行代码是最简单的,但是如果不想使用 IDE,可以创建自己的 [JAR 文件][4]。运行代码以查看结果:
|
||||
|
||||
```
|
||||
Welcome to a zombie apocalypse
|
||||
Welcome to a zombie apocalypse
|
||||
There are 35 zombies out today.
|
||||
UPDATE: 67 zombies. UPDATE: 149 zombies.
|
||||
```
|
||||
|
||||
无论调用 `report` 方法多少次,`weather` 都保持不变,但调用 `counter` 方法的次数越多,僵尸的数量就会增加。
|
||||
|
||||
### Java 方法
|
||||
|
||||
方法(或函数)是编程中的重要组成。在 Java 中,你可以将它们作为函数式编程的单个类的一部分使用,也可以在面向对象编程的类之间使用它们。两种类型的编程对于解决同一个问题有不同的视角,因此没有对与错之分。通过反复尝试,积累一点经验,你会知道哪一个最适合某个特定的问题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/java-methods
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[ZhangZhanhaoxiang](https://github.com/ZhangZhanhaoxiang)
|
||||
校对:[wxy](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/article/20/1/javastream
|
||||
[2]: https://opensource.com/article/22/11/lua-worth-learning
|
||||
[3]: https://opensource.com/article/19/6/what-java-constructor
|
||||
[4]: https://opensource.com/article/21/8/fastjar
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/24/003036jk84quk8ngdqgd8z.jpg
|
@ -3,14 +3,16 @@
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15466-1.html"
|
||||
|
||||
Wordbook:适用于 GNOME 的离线英语词典应用
|
||||
======
|
||||
|
||||
**遇见 Wordbook – 一个 GNOME 桌面的离线词典应用。**
|
||||
![][0]
|
||||
|
||||
> 遇见 Wordbook:一个 GNOME 桌面的离线词典应用。
|
||||
|
||||
我们大多在谷歌、DDG 或其他搜索引擎上搜索单词信息,如含义、同义词、反义词等。
|
||||
|
||||
@ -20,15 +22,15 @@ Wordbook:适用于 GNOME 的离线英语词典应用
|
||||
|
||||
### Wordbook:离线词典应用
|
||||
|
||||
这个应用在本质上是非常基本的。但以它的能力完成了它的工作。Wordbook 目前支持一个英译英字典。在其核心部分,它使用 [Open English WordNet 数据库][2]进行定义。Open English Wordnet 是 [Princeton Wordnet项目][3] 的一个开源分叉。
|
||||
这个应用在本质上是非常基础的,但它的能力足以完成工作。Wordbook 目前支持一个**英英字典**。在其核心部分,它使用 [Open English WordNet 数据库][2] 进行定义。Open English Wordnet 是 [Princeton Wordnet项目][3] 的一个开源复刻。
|
||||
|
||||
Wordbook 应用还可以使用 [eSpeak][4] – 一个免费和开源的语音合成器来发音。
|
||||
Wordbook 应用还可以使用 [eSpeak][4] – 一个自由开源的语音合成器来发音。
|
||||
|
||||
![Wordbook - 英译英词典应用][5]
|
||||
|
||||
然而,在第一次运行时,它需要一次性上网,以下载离线数据。就这些了。其他值得注意的功能包括实时搜索、双击搜索和带有 HTML 标记的自定义定义。
|
||||
然而,在第一次运行时,它需要一次性上网,以下载离线数据。仅此而已。其他值得注意的功能包括实时搜索、双击搜索和带有 HTML 标记的自定义定义。
|
||||
|
||||
Wordbook是一个 [GNOME 应用][6],使用现代 GTK4 和 libadwaita 构建。因此,它与 GNOME 桌面的浅色和深色主题整合得很好。你也可以使用 Wordbook 的随机单词功能来学习新单词以增加你的词汇量。
|
||||
Wordbook 是一个 [GNOME 应用][6],使用现代的 GTK4 和 libadwaita 构建。因此,它与 GNOME 桌面的浅色和深色主题整合得很好。你也可以使用 Wordbook 的随机单词功能来学习新单词以增加你的词汇量。
|
||||
|
||||
### 安装
|
||||
|
||||
@ -44,7 +46,7 @@ flatpak install com.github.fushinari.Wordbook
|
||||
|
||||
我希望你在学校或商业工作中使用这个小小的应用。如果你在写论文和较长的段落,离线特性是很方便的。
|
||||
|
||||
你知道其他Linux的离线字典吗?请在评论栏里告诉我们。
|
||||
你知道其他 Linux 的离线字典吗?请在评论栏里告诉我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -53,7 +55,7 @@ via: https://www.debugpoint.com/wordbook-offline-dictionary/
|
||||
作者:[Arindam][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/) 荣誉推出
|
||||
|
||||
@ -67,3 +69,4 @@ via: https://www.debugpoint.com/wordbook-offline-dictionary/
|
||||
[6]: https://www.debugpoint.com/tag/gnome-app
|
||||
[7]: https://www.debugpoint.com/install-ubuntu-windows-virtualbox/
|
||||
[8]: https://floss.social/@debugpoint
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/22/120052z1e0bg1ynyanors2.jpg
|
@ -0,0 +1,242 @@
|
||||
[#]: subject: "Install Ubuntu on Windows Using VirtualBox [Complete Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-ubuntu-windows-virtualbox/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ZhangZhanhaoxiang"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15472-1.html"
|
||||
|
||||
完整指南:使用 VirtualBox 在 Windows 上安装 Ubuntu
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 本教程将指导你用最简单的步骤在 Windows 上的 Oracle VirtualBox 上安装 Ubuntu 桌面版。
|
||||
|
||||
[VirtualBox][1] 是 Oracle 的一款流行的虚拟化软件,可用于 Linux、mac 和 Windows 系统。它是灵活的,并提供了许多功能来实现虚拟化。这是在 Windows 中体验 Ubuntu 而不安装它的最佳且简单的方法。然而,我强烈建议将 Ubuntu 以双引导的方式安装在物理机上,从而更好地体验 Ubuntu。
|
||||
|
||||
下面列出的步骤假设你是第一次在 Windows 中安装 Ubuntu。因此,这些步骤有点描述性,也有点冗长。此外,以下步骤适用于 Windows 10 和 Windows 11 作为宿主机。
|
||||
|
||||
### 你需要什么
|
||||
|
||||
- 可上网的 PC
|
||||
- 用于安装的 Ubuntu Linux ISO 镜像文件
|
||||
- 安装了 VirtualBox 的 Windows 系统
|
||||
|
||||
### 使用 VirtualBox 在 Windows 上安装 Ubuntu
|
||||
|
||||
#### 下载并安装必要的东西
|
||||
|
||||
从以下链接下载 Ubuntu Linux 桌面版 ISO 镜像文件。
|
||||
|
||||
> **[下载 Ubuntu 桌面版][7]**
|
||||
|
||||
此外,请从下面的官方网站下载 Oracle VirtualBox 安装程序。
|
||||
|
||||
> **[下载 VirtualBox][8]**
|
||||
|
||||
![VirtualBox for Windows 的下载位置][9]
|
||||
|
||||
#### 如何安装和配置 VirtualBox
|
||||
|
||||
Windows 中的 VirtualBox 需要 “Microsoft Visual C++ 2019 Redistrobutiable package”。你必须先安装它。从以下链接下载软件包(X64 架构):
|
||||
|
||||
> **[下载 MSVC][10]**
|
||||
|
||||
![下载 VirtualBox 的依赖项][11]
|
||||
|
||||
![安装 VirtualBox 的依赖项][12]
|
||||
|
||||
完成以上安装后,从以下链接下载最新的 Python 包。Python 绑定也是 Windows 端 VirtualBox 安装所需的依赖项。
|
||||
|
||||
> **[下载 Python for Windows][13]**
|
||||
|
||||
然后,启动 VirtualBox 安装程序并按照屏幕上的说明进行安装。
|
||||
|
||||
安装后,重新启动 Windows 系统。
|
||||
|
||||
#### 为 Ubuntu 设置虚拟机
|
||||
|
||||
从开始菜单启动 VirtualBox。
|
||||
|
||||
![从开始菜单中选择 VirtualBox][14]
|
||||
|
||||
在 VirtualBox 窗口工具栏上,单击 “<ruby>新建<rt>New</rt></ruby>”。
|
||||
|
||||
![单击新建][16]
|
||||
|
||||
- 在创建虚拟机窗口中,输入虚拟机的名称。它可以是标识此版本 Ubuntu 的任何名称。
|
||||
- 保持 “<ruby>文件夹<rt>Folder</rt></ruby>” 不变。这是创建虚拟机文件的路径。
|
||||
- 在 “<ruby>ISO 镜像文件<rt>ISO Image</rt></ruby>” 一栏,浏览你下载的 Ubuntu ISO 文件。
|
||||
- 然后选择 “<ruby>跳过无人值守安装<rt> Skip Unattended installation</rt></ruby>”。如果不选择此选项,将在虚拟机中创建一个 [默认用户 id(vboxuser)和密码][15]。让我们暂时不要管它。
|
||||
|
||||
![选择 ISO 文件][17]
|
||||
|
||||
- 单击 “<ruby>硬件<rt>Hardware</rt></ruby>” 部分,并调整虚拟机所需的内存。一般的经验是,虚拟机的内存大小应该小于主机系统中的物理内存。我建议对于 8 GB 内存系统的虚拟机使用 2 GB 到 4 GB。要选择 4 GB 内存,拖动滑块(或键入)使其为 4096 MB(即 4×1024)。
|
||||
- 选择 2 或 4 核处理器。
|
||||
|
||||
![选择硬件][18]
|
||||
|
||||
- 单击 “<ruby>硬盘<rt>Hard Disk</rt></ruby>” 部分,并保持文件位置不变。
|
||||
- 为 Ubuntu 安装提供至少 20 GB 到 25 GB 的容量。
|
||||
- 硬盘文件类型值保持为 VDI(VirtualBox 磁盘镜像)
|
||||
- 不要选择 “<ruby>预分配完整大小<rt>Pre-allocate Full Size</rt></ruby>”。
|
||||
- 最后,单击 “<ruby>完成<rt>Finish</rt></ruby>”。
|
||||
|
||||
![选择硬盘][19]
|
||||
|
||||
你应该在 VirtualBox 的左侧面板上看到一个新条目,其中包含一个 Ubuntu 22.04 条目(你之前设置的名称)。
|
||||
|
||||
选择条目并单击 “<ruby>开始<rt>Start</rt></ruby>” 以引导到虚拟机:
|
||||
|
||||
![在 VirtualBox 中启动 Ubuntu][20]
|
||||
|
||||
#### 使用 VirtualBox 安装 Ubuntu
|
||||
|
||||
成功引导后,你应该看到以下屏幕,其中显示了安装 Ubuntu 的各种选项。选择 “<ruby>尝试 Ubuntu<rt>Try Ubuntu</rt></ruby>” 或 “<ruby>安装 Ubuntu<rt>Install Ubuntu</rt></ruby>”。
|
||||
|
||||
在欢迎屏幕中,单击 “<ruby>尝试 Ubuntu<rt>Try Ubuntu</rt></ruby>”。过了一会儿,你会看到下面的 Ubuntu <ruby>临场<rt>Live</rt></ruby>桌面。如果要更改分辨率,请右键单击桌面并选择显示设置。并将分辨率更改为 1400×900。
|
||||
|
||||
![选择尝试 Ubuntu][21]
|
||||
|
||||
在桌面上,双击 “<ruby>安装 Ubuntu<rt>Install Ubuntu</rt></ruby>”。
|
||||
|
||||
![Ubuntu LIVE 桌面][22]
|
||||
|
||||
在下一组屏幕中,根据需要选择 “<ruby>语言<rt>Language</rt></ruby>” 和 “<ruby>键盘布局<rt>Keyboard Layout</rt></ruby>”。
|
||||
|
||||
![选择语言][23]
|
||||
|
||||
![选择键盘布局][24]
|
||||
|
||||
安装屏幕为你提供所需的安装类型。选择 “<ruby>正常安装<rt>Normal Installation</rt></ruby>”,然后在 “<ruby>其他选项<rt>Other options</rt></ruby>” 下选择两个选项。
|
||||
|
||||
![选择安装选项][25]
|
||||
|
||||
由于你是在虚拟磁盘空间中安装的,即它只是一个文件,因此你可以安全地选择 “<ruby>擦除磁盘并安装 Ubuntu<rt>Erase disk and install Ubuntu</rt></ruby>” 选项。
|
||||
|
||||
![安装类型][26]
|
||||
|
||||
点击 “<ruby>立即安装<rt>Install Now</rt></ruby>” 并 “<ruby>继续<rt>Continue</rt></ruby>”。
|
||||
|
||||
![将更改写入磁盘][27]
|
||||
|
||||
然后选择 “<ruby>地区<rt>region</rt></ruby>”,添加“<ruby>你的名字<rt>Your name</rt></ruby>”、“<ruby>计算机名称<rt>Your computer's name</rt></ruby>”、“<ruby>用户名<rt>Username</rt></ruby>” 和 “<ruby>密码<rt>Password</rt></ruby>”。这将是安装后登录 Ubuntu 的用户 id 和密码。
|
||||
|
||||
单击 “<ruby>继续<rt>Continue</rt></ruby>” 开始安装。等到它完成。
|
||||
|
||||
![创建用户帐户][28]
|
||||
|
||||
安装完成后,单击 “<ruby>立即重新启动<rt>Restart Now</rt></ruby>”。等待几秒钟,你将看到一个登录屏幕。使用用户 id 和密码登录。你应该看到 Ubuntu 桌面在 Windows 端 VirtualBox 中作为 VM 运行。
|
||||
|
||||
![Ubuntu 安装完成][29]
|
||||
|
||||
![登录 Ubuntu][30]
|
||||
|
||||
![使用 Virtualbox 在 Windows 中运行的 Ubuntu][31]
|
||||
|
||||
### 安装后配置和提示(可选)
|
||||
|
||||
#### 安装客体机增强项
|
||||
|
||||
成功安装后,应为 Windows 宿主机和 Ubuntu 客体机安装 “<ruby>VirtualBox 客体机增强项<rt>VirtualBox guest additions</rt></ruby>”。客体机增强项是一组需要安装在客体虚拟机(即 Ubuntu)内的软件包,以启用 **共享文件夹、双向复制 / 粘贴、自动更改分辨率** 和许多类似功能。
|
||||
|
||||
要安装它,请引导到 Ubuntu。从 VirtualBox 菜单中,选择“<ruby>设备<rt>Devices</rt></ruby> > <ruby>插入客体机增强 CD 镜像<rt>Insert Guest Additions CD Image</rt></ruby>”。必要的软件包将安装在 Ubuntu 中。
|
||||
|
||||
![从菜单中选择客体机增强][32]
|
||||
|
||||
打开文件管理器并打开装入的文件夹,如下所示。然后右键单击 > 选择 “<ruby>在终端中打开<rt>open in terminal</rt></ruby>”。
|
||||
|
||||
![打开已挂载的光盘并选择带有终端的选项][33]
|
||||
|
||||
然后运行以下命令:
|
||||
|
||||
```
|
||||
sudo ./VBoxLinuxAdditions.run
|
||||
```
|
||||
|
||||
![VirtualBox 为 Windows 主机添加客体机增强项][34]
|
||||
|
||||
完成上述命令后,重新启动 Ubuntu VM。
|
||||
|
||||
#### 启用 Windows 和 Ubuntu 之间的复制和粘贴
|
||||
|
||||
要在 Windows 和 Ubuntu 系统之间启用复制和粘贴,请从菜单中选择 “<ruby>设备<rt>Devices</rt></ruby> > <ruby>共享剪贴板<rt>Shared Clipboard</rt></ruby> > <ruby>双向<rt>Bi-directional</rt></ruby>”。
|
||||
|
||||
![启用共享剪贴板][35]
|
||||
|
||||
#### 关闭 Ubuntu VM
|
||||
|
||||
理想情况下,你应该从自己的关机菜单中关闭 VM。但是,你也可以从 VirtualBox 主窗口关闭。右键单击虚拟机名称并选择 “<ruby>关闭<rt>Close</rt></ruby> > <ruby>关机<rt>Poweroff</rt></ruby>”。
|
||||
|
||||
![关闭虚拟机][36]
|
||||
|
||||
#### 如何删除 Ubuntu 并删除所有数据
|
||||
|
||||
如果要完全删除虚拟机(例如 Ubuntu)及其数据,请选择 “<ruby>删除<rt>Remove</rt></ruby>” 和 “<ruby>删除所有文件<rt>Delete All Files</rt></ruby>”。
|
||||
|
||||
![选择删除以移除虚拟机][37]
|
||||
|
||||
![选择删除选项][38]
|
||||
|
||||
### 结语
|
||||
|
||||
在本教程中,你学习了使用 VirtualBox 在 Windows(10 或 11)上安装 Ubuntu 的最简单方法。此外,你还学习了几步安装后配置 Ubuntu VM 的基本步骤。你可以对 VirtualBox 中的其他任何 Linux 发行版使用上述步骤。
|
||||
|
||||
如果你有任何疑问,欢迎在下面发表评论。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-ubuntu-windows-virtualbox/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[ZhangZhanhaoxiang](https://github.com/ZhangZhanhaoxiang)
|
||||
校对:[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/tag/virtualbox
|
||||
[2]: https://www.debugpoint.com#presteps
|
||||
[3]: https://www.debugpoint.com#download-items
|
||||
[4]: https://www.debugpoint.com#install-virtualbox
|
||||
[5]: https://www.debugpoint.com#install-ubuntu
|
||||
[6]: https://www.debugpoint.com#post-install-steps
|
||||
[7]: https://ubuntu.com/download/desktop
|
||||
[8]: https://www.virtualbox.org/wiki/Downloads
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Download-location-for-VirtualBox-for-Windows.jpg
|
||||
[10]: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Download-the-dependency-for-VirtualBox.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-the-dependency-for-VirtualBox.jpg
|
||||
[13]: https://www.python.org/downloads/windows/
|
||||
[14]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-VirtualBox-from-start-menu.jpg
|
||||
[15]: https://www.debugpoint.com/virtualbox-id-password/
|
||||
[16]: https://www.debugpoint.com/wp-content/uploads/2023/01/Click-on-New.jpg
|
||||
[17]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-the-ISO-file.jpg
|
||||
[18]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Hardware.jpg
|
||||
[19]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Hard-Disk.jpg
|
||||
[20]: https://www.debugpoint.com/wp-content/uploads/2023/01/Boot-Ubuntu-in-VirtualBox.jpg
|
||||
[21]: https://www.debugpoint.com/wp-content/uploads/2023/01/1-Select-Try-Ubuntu.jpg
|
||||
[22]: https://www.debugpoint.com/wp-content/uploads/2023/01/2-Ubuntu-LIVE-desktop-1.jpg
|
||||
[23]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Language.jpg
|
||||
[24]: https://www.debugpoint.com/wp-content/uploads/2023/01/4-Select-Keybaord-Layout.jpg
|
||||
[25]: https://www.debugpoint.com/wp-content/uploads/2023/01/5-Select-install-options.jpg
|
||||
[26]: https://www.debugpoint.com/wp-content/uploads/2023/01/6-Installation-Type.jpg
|
||||
[27]: https://www.debugpoint.com/wp-content/uploads/2023/01/7-Write-changes-to-disk.jpg
|
||||
[28]: https://www.debugpoint.com/wp-content/uploads/2023/01/8-User-account-creation.jpg
|
||||
[29]: https://www.debugpoint.com/wp-content/uploads/2023/01/10-Ubuntu-Installation-is-complete.jpg
|
||||
[30]: https://www.debugpoint.com/wp-content/uploads/2023/01/11-Log-on-to-Ubuntu.jpg
|
||||
[31]: https://www.debugpoint.com/wp-content/uploads/2023/01/12-Ubuntu-running-in-Windows-using-Virtualbox-2048x1280.jpg
|
||||
[32]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Guest-addition-from-the-menu.jpg
|
||||
[33]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-the-mounted-disc-and-select-option-with-terminal.jpg
|
||||
[34]: https://www.debugpoint.com/wp-content/uploads/2023/01/VirtualBox-guest-addition-install-for-Windows-host.jpg
|
||||
[35]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-clipboard-sharing.jpg
|
||||
[36]: https://www.debugpoint.com/wp-content/uploads/2023/01/Poweroff-Virtual-machine.jpg
|
||||
[37]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-remove-to-delete-a-VM.jpg
|
||||
[38]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-the-delete-options.jpg
|
||||
[39]: https://www.debugpoint.com/install-python-windows/
|
||||
[40]: https://floss.social/@debugpoint
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/23/230204pr8c36xesq5r8vx9.jpg
|
@ -0,0 +1,144 @@
|
||||
[#]: subject: "How to Install Python on Windows [Beginner’s Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-python-windows/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15480-1.html"
|
||||
|
||||
如何在 Windows 上安装 Python
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 这个简单的指南演示了如何在 Windows 上下载和安装 Python。
|
||||
|
||||
这篇文章是用最新的 Python 3.11 稳定版测试的。
|
||||
|
||||
在学习如何在 Windows 上安装 Python 之前,你可能想看看如何在 Linux 发行版(如 Ubuntu)上[轻松安装][1] Python。如果你打算成为一名开发者,最好在 Linux 中尝试 Python。那么,你可能想看看 [如何在 Windows 之外安装 Linux(如 Ubuntu)][2]。
|
||||
|
||||
Python 是一种流行的通用编程语言,在过去十年中成为开发者的选择。而且它的受欢迎程度与日俱增。它被广泛用于网络开发、复杂系统、数据科学、机器学习和所有科学领域。
|
||||
|
||||
你可能遇到的 Python 有两个版本。Python2 目前已经不支持了。而 Python3 系列是持续支持的版本。
|
||||
|
||||
### 检查 Python 是否已经安装
|
||||
|
||||
在 Windows 上安装它之前,你应该检查它是否已经安装。一般来说,它应该没有安装,不像在 Ubuntu (和其他 Linux 发行版)中,Python 是预先安装的。
|
||||
|
||||
从开始菜单中,打开“命令提示符”。
|
||||
|
||||
并输入以下内容:
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
如果 Python 是可用的,它将显示一个包含版本细节的信息。
|
||||
|
||||
### 下载并安装 Python
|
||||
|
||||
打开下面的 Python 官方下载页面。
|
||||
|
||||
> **[下载 Python][3]**
|
||||
|
||||
![如何找到要安装的 Python][4]
|
||||
|
||||
在顶部,你应该看到当前的稳定版本。点击下载链接。如果你正在寻找任何特定的版本,在这个页面上向下滚动,在 “Python releases by version number:” 的标签下下载特定的版本。
|
||||
|
||||
下载后,进入下载文件夹,运行安装程序。
|
||||
|
||||
按照屏幕上的指示进行安装。
|
||||
|
||||
![安装 Python 第 1 步][5]
|
||||
|
||||
![安装 Python 第 2 步][6]
|
||||
|
||||
安装完成后,验证 Python 的版本。
|
||||
|
||||
### 验证 Python 版本
|
||||
|
||||
从开始菜单,打开“命令提示符”,运行以下命令。
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
![Windows 上的 Python 版本][7]
|
||||
|
||||
你应该看到你的系统当前安装的 Python 包的版本。另外,你也可以运行下面的程序来获得一个 Python 交互式 shell。
|
||||
|
||||
```
|
||||
python
|
||||
```
|
||||
|
||||
你可以用 `CTRL+Z` 和回车键退出这个交互界面。
|
||||
|
||||
### 检查 PATH 变量
|
||||
|
||||
你应该检查系统变量 `PATH`,看看 Python 的可执行位置是否存在。这应该是使用安装程序自动更新的。
|
||||
|
||||
从开始菜单中,搜索“<ruby>系统变量<rt>system variables</rt></ruby>”并打开它。
|
||||
|
||||
![打开环境变量设置][8]
|
||||
|
||||
在“系统属性”对话框中,点击“<ruby>高级<rt>Advanced</rt></ruby> > <ruby>环境变量<rt>Environment Variables</rt></ruby>”。在用户变量部分,对照路径变量,检查 Python 的安装位置是否存在。请参考下面的图片作为指导。
|
||||
|
||||
如果你看到所有的路径都存在,你就可以运行你的 Python 项目了。
|
||||
|
||||
![检查 Windows 中的 Python 环境 PATH 值][9]
|
||||
|
||||
### 创建并运行你的第一个 Python 程序
|
||||
|
||||
一个额外的步骤,这里是你如何编码和运行你的第一个 Python 程序。你可以使用任意 [推荐的 Python 编辑器][10] 来编写你的程序。
|
||||
|
||||
下面是一个简单的程序,它在控制台中输出文本 `debugpoint.com`。
|
||||
|
||||
```
|
||||
# Sample Python program
|
||||
print("debugpoint.com")
|
||||
```
|
||||
|
||||
用任意名字保存文件。这里我把它保存为 `hello.py`,放在 E 盘。`.py` 是 Python 源码的扩展名。
|
||||
|
||||
要运行这个程序,请打开命令提示符,在 E 盘中执行以下内容。
|
||||
|
||||
```
|
||||
python hello.py
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
![在 Windows 中运行一个简单的 Python 程序][11]
|
||||
|
||||
### 结束语
|
||||
|
||||
我希望这个简单的初学者指南能够帮助你在 Windows 中安装 Python,验证安装并运行你的第一个程序。
|
||||
|
||||
如果你遇到问题,请在下面的评论栏中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-python-windows/
|
||||
|
||||
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://linux.cn/article-15475-1.html
|
||||
[2]: https://www.debugpoint.com/complete-guide-how-dual-boot-ubuntu-windows/
|
||||
[3]: https://www.python.org/downloads/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/How-to-locate-Python-set-up.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-1.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-2.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Python-version-on-Windows.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-Environment-variable-Settings.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Check-Python-Environment-PATH-Values-in-Windows.jpg
|
||||
[10]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Running-a-simple-Python-program-in-Windows.jpg
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/25/211813u4mmhhffif58hmpu.jpg
|
@ -0,0 +1,114 @@
|
||||
[#]: subject: "Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)"
|
||||
[#]: via: "https://www.debugpoint.com/share-folder-virt-manager/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15470-1.html"
|
||||
|
||||
在 virt-manager 的主机和客户机之间共享文件夹
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 在本指南中,你将学习如何在 virt-manager 的 KVM、QEMU 和 libvirt 的主机和客户机之间共享文件夹。
|
||||
|
||||
[virt-manager][1] 应用或软件包使用 [libvirt][2] 库来提供虚拟机管理服务。它有一个桌面界面,有助于创建、删除和管理多个虚拟机。
|
||||
|
||||
virt-manager 桌面界面及其组件为各种个人和商业场景提供了灵活的虚拟机管理服务。它是一个自由开源的应用,主要用于 KVM 虚拟机。然而,它也可以支持其他管理程序,如 Xen 和 LXC。
|
||||
|
||||
在之前的文章中,我解释了 [如何使用 virt-manager 创建虚拟机][3]。这篇文章介绍了如何在客户机和主机之间无缝访问文件和文件夹。
|
||||
|
||||
### 关于 virtiofs 的说明
|
||||
|
||||
共享文件和文件夹是由名为 virtiofs 的 libvirt 共享文件系统提供的。它提供了访问主机上的目录树的所有功能和参数。由于大多数 virt-manager 虚拟机的配置都被翻译成 XML,所以共享文件/文件夹也可以通过 XML 文件来指定。
|
||||
|
||||
### 在 virt-manager中共享文件夹
|
||||
|
||||
首先,确保你的客户机关闭了电源。在 virt-manager GUI 中,选择虚拟机,点击“<ruby>打开<rt>Open</rt></ruby>”,弹出控制台设置。
|
||||
|
||||
![打开设置][4]
|
||||
|
||||
点击工具条上显示虚拟硬件细节的图标。然后点击左边面板上的“<ruby>内存<rt>Memory</rt></ruby>”。
|
||||
|
||||
选择选项 “<ruby>启用共享内存<rt>Enable shared memory</rt></ruby>”。点击应用。
|
||||
|
||||
![启用共享内存选项][5]
|
||||
|
||||
然后点击底部的 “<ruby>添加硬件<rt>Add hardware</rt></ruby>”。
|
||||
|
||||
![点击添加硬件][6]
|
||||
|
||||
在添加新硬件的窗口中,从左边的面板上选择 “<ruby>文件系统<rt>File system</rt></ruby>”。
|
||||
|
||||
然后在 “<ruby>细节<rt>Details</rt></ruby>” 标签中选择 “<ruby>驱动程序<rt>Driver</rt></ruby>” 为 “virtiofs”。点击 “<ruby>浏览<rt>Browse</rt></ruby> > <ruby>浏览本地<rt>browse local</rt></ruby>”,**选择你想在客户机内访问的主机路径**。
|
||||
|
||||
在目标路径中,输入你想要的任何名字。这只是一个文件标签,将在挂载时使用。
|
||||
|
||||
所以,如果我想访问 `Pictures/Screenshots` 文件夹(`/home/debugpoint/Pictures/Screenshots`),示例设置可以是这样:
|
||||
|
||||
![添加一个新的文件系统硬件][7]
|
||||
|
||||
下面是上述配置的 XML 设置。你可以在 XML 标签中找到它。
|
||||
|
||||
```
|
||||
<filesystem type="mount" accessmode="passthrough">
|
||||
<driver type="virtiofs"/>
|
||||
<binary path="/usr/libexec/virtiofsd"/>
|
||||
<source dir="/home/debugpoint/Pictures/Screenshots"/>
|
||||
<target dir="mount_tag_pictures"/>
|
||||
<alias name="fs1"/>
|
||||
<address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
|
||||
</filesystem>
|
||||
```
|
||||
|
||||
点击 “<ruby>完成<rt>Finish</rt></ruby>”。在 virt-manager 主窗口中,右键点击虚拟机,点击运行,启动虚拟机。确保点击“<ruby>显示图形控制台<rt>show the graphical console</rt></ruby>”(如果虚拟机没有显示,点击工具条上的监视器图标)。
|
||||
|
||||
在客户机中,创建一个你想挂载主机文件夹的文件夹。在这个例子中,我使用了 `/mnt/pictures`。
|
||||
|
||||
```
|
||||
sudo mkdir /mnt/pictures
|
||||
```
|
||||
|
||||
最后,使用你在上述步骤中创建的标签将主机文件夹挂载到这个新文件夹。使用下面的命令在终端做这件事。确保根据你的系统改变下面命令中的标签和文件夹名称。
|
||||
|
||||
```
|
||||
sudo mount -t virtiofs mount_tag_pictures /mnt/pictures
|
||||
```
|
||||
|
||||
现在你可以在 virt-manager 中的主机和客户机之间的无缝地浏览文件夹和添加/删除项目。
|
||||
|
||||
![从 virt-manager 客户机访问主机文件][8]
|
||||
|
||||
### 总结
|
||||
|
||||
我希望这个方案能帮助你从客户机上访问主机文件和文件夹。记住,你的用户 ID,也就是用来启动 virt-manager 应用的用户,应该有同样的权限来访问主机文件夹。
|
||||
|
||||
如果你遇到任何错误,上述指南帮助了你,请在下面留言。
|
||||
|
||||
- [参考][9]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/share-folder-virt-manager/
|
||||
|
||||
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://virt-manager.org/
|
||||
[2]: https://libvirt.org/manpages/libvirtd.html
|
||||
[3]: https://www.debugpoint.com/virt-manager/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-the-settings.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-the-shared-memory-option.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Click-on-add-hardware.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Add-a-new-file-system-hardware.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Access-host-files-from-virt-manager-guest.jpg
|
||||
[9]: https://libvirt.org/kbase/virtiofs.html
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/23/163636dm5j1wrsga95xgrd.jpg
|
155
published/202301/20230114.0 ⭐️ A 4-minute guide to Java loops.md
Normal file
155
published/202301/20230114.0 ⭐️ A 4-minute guide to Java loops.md
Normal file
@ -0,0 +1,155 @@
|
||||
[#]: subject: "A 4-minute guide to Java loops"
|
||||
[#]: via: "https://opensource.com/article/23/1/java-loops"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15495-1.html"
|
||||
|
||||
Java 循环语句的简要指南
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 无论你使用的是 `while` 循环、`do`/`while` 循环,还是无限循环,了解循环的工作原理对 Java 编程至关重要。
|
||||
|
||||
只要某些预定的条件为真,一个 `while` 循环就会执行一组任务。这被认为是一个控制结构,可以指导程序的流程。它是一种你可以通过定义一个条件来告诉你的代码要做什么的方法,它可以测试它,并根据它发现的情况采取行动。Java 中的两种 `while` 循环是 `while` 和 `do`/`while`。
|
||||
|
||||
### Java while 循环
|
||||
|
||||
`while` 循环的目的是对数据进行迭代,直到某个条件得到满足。要创建一个 `while` 循环,你需要提供一个可以测试的条件,然后是你想要运行的代码。Java 有几个内置的测试函数,其中最简单的是数学运算符(`<`, `>`, `==`, 等等):
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
int count = 0;
|
||||
while (count < 5) {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在这个简单的例子中,条件是变量 `count` 小于 5。因为 `count` 被实例化为 0,然后在 `while` 循环的代码中增加 1,所以程序总共迭代了 5 次:
|
||||
|
||||
```
|
||||
$ java ./while.java
|
||||
0 1 2 3 4
|
||||
```
|
||||
|
||||
在它进行第六次迭代之前,条件不再是真的,所以循环结束。
|
||||
|
||||
`while` 循环的条件语句是至关重要的。弄错了可能意味着你的循环永远不会执行。例如,假设你把 `count == 5` 作为条件:
|
||||
|
||||
```
|
||||
while (count == 5) {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
```
|
||||
|
||||
当你运行这段代码时,它的构建和运行都很成功,但什么也没有发生:
|
||||
|
||||
```
|
||||
$ java ./while.java
|
||||
$
|
||||
```
|
||||
|
||||
循环被跳过了,因为 `count` 被设置为 0,而且在第一次遇到 while 循环的时候,它还是 0。循环从未开始,`count` 也从未被递增。
|
||||
|
||||
与此相反的是,当一个条件开始为真,并且永远不会为假时,这将导致一个无限循环。
|
||||
|
||||
### Java do while 循环
|
||||
|
||||
与 `while` 循环相似,`do`/`while` 循环在每次迭代结束时测试条件,而不是在开始时测试条件。有了这个循环,循环中的代码至少运行一次,因为没有进入的入口,只有退出的出口:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
int count = 9;
|
||||
do {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
} while(count == 5);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在这个示例代码中,`count` 被设置为 9。循环重复的条件是 `count` 等于 5,但是 9 不等于 5。不过,这个检查要到第一次迭代结束时才进行:
|
||||
|
||||
```
|
||||
$ java ./do.java
|
||||
9
|
||||
```
|
||||
|
||||
### Java 无限循环
|
||||
|
||||
无限循环,正如它的名字所示,永远不会结束。有时它们是被错误地创建的,但无限循环确实有一个有效的场景。有时你想让一个进程无限地继续下去(在功能上是无限的,因为你不能保证你需要它什么时候停止),因此你可能会把你的条件设置为不可能满足的东西。
|
||||
|
||||
假设你写了一个应用程序,在僵尸天启期间计算留在你附近的僵尸的数量。为了模拟需要多少个循环才能达到 0 个僵尸的不确定性,我的演示代码从操作系统中检索了一个时间戳,并将计数器(`c`)的值设置为从该时间戳得出的某个数字。因为这是一个简单的例子,你不会真的想陷入一个无限循环,这段代码倒数到 0,并使用 `break` 函数来强制结束循环:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
long myTime = System.currentTimeMillis();
|
||||
|
||||
int c;
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
c = 128;
|
||||
} else {
|
||||
c = 1024;
|
||||
}
|
||||
|
||||
while(true) {
|
||||
System.out.printf("%d Zombies\n", c);
|
||||
|
||||
// break for convenience
|
||||
if ( c <= 0 ) { break; }
|
||||
c--;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
你可能要运行几次才能触发不同的僵尸总数,但有时你的程序会迭代 128 次,有时会迭代 1024 次:
|
||||
|
||||
```
|
||||
$ java ./zcount.java
|
||||
1024 Zombies
|
||||
1023 Zombies
|
||||
[...]
|
||||
0 Zombies
|
||||
```
|
||||
|
||||
你能说出为什么循环的终点是 0 而不是 -1 吗?
|
||||
|
||||
### Java 循环
|
||||
|
||||
循环使你能够控制程序的执行流程。迭代在编程中很常见,无论你使用 `while` 循环、`do`/`while` 循环还是无限循环,了解循环的工作原理都是至关重要的。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/java-loops
|
||||
|
||||
作者:[Seth Kenlon][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://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202301/31/093057lesc38vufbuzustm.jpg
|
@ -0,0 +1,92 @@
|
||||
[#]: subject: "Over 90% Systems Had Flatpak Installed, Says GNOME's Research Report"
|
||||
[#]: via: "https://news.itsfoss.com/gnome-research-report/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15490-1.html"
|
||||
|
||||
GNOME 的研究报告称 90% 以上的系统都安装了 Flatpak
|
||||
======
|
||||
|
||||
> GNOME 的调查数据揭示了一些令人感兴趣的用户偏好。这是否会影响 GNOME 在不久的将来的开发决策?让我们拭目以待。
|
||||
|
||||
![GNOME 的研究报告说,超过 90% 的系统安装了 Flatpak][1]
|
||||
|
||||
在 2022 年 8 月,GNOME 开发了 [一个工具][2],让用户可以匿名提供关于他们的系统配置、扩展和 GNOME 调整的设置。
|
||||
|
||||
这是为了**帮助 GNOME 深入了解**用户的偏好,并在分析数据的基础上做出更好的决定。
|
||||
|
||||
GNOME 设计团队的成员 [Allan Day][3] 在最近的一篇博文中分享了收集的数据。它包含了一些有趣的洞察和发现。
|
||||
|
||||
让我带你了解一下:
|
||||
|
||||
### 研究报告的发现
|
||||
|
||||
本研究报告包括来自 2,517 个用户的数据,这些用户的硬件和软件配置各不相同。
|
||||
|
||||
> 📋 这些数据是使用 [gnome-info-collect 工具][4] 从向 GNOME 提供数据的人那里获得的,并不代表 GNOME 的全部用户。
|
||||
|
||||
最初,他们收到了 2,560 个回复,但由于一些数据没有来自使用 GNOME 的系统或来自虚拟机,他们不得不从数据集中删除一些。
|
||||
|
||||
它包含什么?它含有匿名的非敏感数据指标,显示了用户是如何设置他们的系统的。
|
||||
|
||||
> 💡 这对 GNOME 团队来说可以有很大的用处,他们现在可以使用这些数据来做出设计和开发的决定。
|
||||
|
||||
其中一个引起我们注意的数据指标是在他们的 GNOME 系统上使用 Flatpak 的人的百分比。
|
||||
|
||||
**超过 90% 的系统都安装了 Flatpak。**
|
||||
|
||||
在 2517 个用户中,有高达 2344 个用户在他们的 GNOME 系统上安装了 Flatpak。其中 2,102 人完全启用了它。
|
||||
|
||||
在这样一个小的数据集中,这是一个巨大的数字! 🤯
|
||||
|
||||
关于这一点,Allan 有这样的补充说明:
|
||||
|
||||
> Flatpak 和 Flathub 对 GNOME 的战略方向至关重要,所以了解它们的采用程度是很有用的。这种采用程度也与 GNOME 的软件应用设计有关。
|
||||
|
||||
除此之外,一些关键的收获包括:
|
||||
|
||||
- 最常用的默认网页浏览器是 Mozilla Firefox。
|
||||
- 在使用 GNOME 的人中,最常用的发行版是 Fedora。
|
||||
- 谷歌是配置了在线账户的用户的首选账户。
|
||||
- GIMP 是安装在 GNOME 上最受欢迎的应用程序之一,紧随其后的是 VLC。
|
||||
- 83% 的用户至少启用了一个 GNOME 扩展。
|
||||
|
||||
我建议你通过该 [研究报告][5] 来获得更深入的了解。
|
||||
|
||||
### 这是否有助于改善 GNOME 的体验?
|
||||
|
||||
收集这些数据是为了通过分析和提供给设计和开发团队来改善桌面体验。
|
||||
|
||||
然而,收集到的数据仍然相当有限,可能无法代表大多数的 GNOME 用户。
|
||||
|
||||
为了解决这个问题,博文中提到:
|
||||
|
||||
> 总的来说,这些数据对于 GNOME 项目应该专注于哪些功能给出了一些有力的提示。它也提供了关于哪些功能不应该被优先考虑的证据。需要记住的是,虽然我们在这里有关于一些 GNOME 用户做出的决定的证据,但这些数据并没有让我们深入了解为什么他们会做出这样的决定。
|
||||
|
||||
GNOME 团队希望在根据这些数据做出决定时保持谨慎。而且,像这样的调查应该能让他们更好地了解用户的偏好,并把重点放在基本层面上更重要的东西上。
|
||||
|
||||
当然,不可能照顾到每一种类型的用户。但是,只要基本面得到了照顾,桌面体验最终应该得到改善。
|
||||
|
||||
你对这些发现有什么看法?欢迎在下面的评论中分享你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/gnome-research-report/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/flatpak-gnome-research-report.jpg
|
||||
[2]: https://news.itsfoss.com/gnome-improve-tool/
|
||||
[3]: https://twitter.com/allanday
|
||||
[4]: https://gitlab.gnome.org/vstanek/gnome-info-collect/
|
||||
[5]: https://blogs.gnome.org/aday/2023/01/18/gnome-info-collect-what-we-learned/
|
@ -0,0 +1,106 @@
|
||||
[#]: subject: "Meet ecode: An Upcoming Modern, Lightweight Code Editor With a Brand New GUI Framework"
|
||||
[#]: via: "https://news.itsfoss.com/ecode-editor/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15505-1.html"
|
||||
|
||||
迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
|
||||
======
|
||||
|
||||
> 一个正在开发中令人兴奋的新代码编辑器,基于其自己的 GUI 框架。
|
||||
|
||||
![Meet ecode: An Upcoming Modern, Lightweight Code Editor With a Brand New GUI Framework][1]
|
||||
|
||||
如果你看看周围的开源代码编辑器,有几个有前途的新项目可能会挑战 Visual Studio Code 的地位。
|
||||
|
||||
当然,这可能不会很快发生。**但对支持新项目持乐观态度也无妨。**
|
||||
|
||||
我们最近在这里介绍了其中的一些选择:
|
||||
|
||||
现在,我偶然发现了另一个编辑器,“**ecode**”。这个项目的作者提到,它从 [Lite XL][2] 等编辑器中获得了灵感。
|
||||
|
||||
有什么不同?
|
||||
|
||||
- 它建立在其新的 GUI 框架 [eepp][3] 之上,该框架专注于提供一个丰富的用户界面。
|
||||
- 虽然它的目标是使用最少的资源,但 ecode 的理念针对的是有 SSD、高核心数和良好的 GPU 加速的**现代硬件**系统。
|
||||
- 该代码编辑器可以被编译为在任何现代浏览器中运行。然而,目前的重点并不在网页版的开发上。
|
||||
|
||||
![ecode official screenshot][4]
|
||||
|
||||
这听起来不错。那么,让我们看一看。
|
||||
|
||||
> 🚧 该项目正在大力开发中。你不应该在日常工作中依赖这个工具。
|
||||
|
||||
### ecode 的特点
|
||||
|
||||
![ecode][7]
|
||||
|
||||
[ecode][8] 是一个功能强大的编辑器,从一开始就有所有的基本功能。
|
||||
|
||||
当然,它有计划随着开发的进展增加更多的东西。就目前而言,这里有一些关键的亮点:
|
||||
|
||||
- 可移植
|
||||
- 语法高亮
|
||||
- 终端支持
|
||||
- 自动补全
|
||||
- 可定制的颜色方案
|
||||
- 可定制的键盘绑定
|
||||
- LSP 支持
|
||||
- <ruby>缩略视图<rt>Minimap</rt></ruby>
|
||||
- 插件管理器
|
||||
- 深色和浅色模式
|
||||
- 各种类型的分割视图以适应不同的工作流程
|
||||
|
||||
我在 Linux Mint 上简单地试了一下这个编辑器,它看起来确实是正在开发中。
|
||||
|
||||
但是,即使在其早期阶段,它也支持广泛的语言和相应的语法高亮。
|
||||
|
||||
![ecode options][9]
|
||||
|
||||
你可以从一组预定义的主题中快速定制编辑器的主题。
|
||||
|
||||
对于编写大量代码(冗长的片段)并需要快速浏览的用户来说,缩略视图将非常方便。
|
||||
|
||||
最初,当我在一个空白区域右键点击时,该应用崩溃了。但是,随着下一个版本 **0.4.1**(在发表这篇文章的时候)的更新,它很快就被修复了。所以,我想说**开发进展似乎很有希望**。
|
||||
|
||||
![][10]
|
||||
|
||||
### 下载 ecode
|
||||
|
||||
你可以尝试一下 [在线演示][13] 来快速测试一些选项。
|
||||
|
||||
有一个可用于所有 Linux 发行版的 AppImage 软件包。也有用于 macOS 和 Windows 的软件包。
|
||||
|
||||
你可以从它的 [GitHub 发布页][14] 获得这些包,或者探索它的 [源码][3]。
|
||||
|
||||
> **[下载 ecode][14]**
|
||||
|
||||
💬 有这么多有前途的新代码编辑器在开发中,你认为我们会对微软的 VS Code 有一个好的竞争吗?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ecode-editor/
|
||||
|
||||
作者:[Ankush Das][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://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/ecode-first-look.png
|
||||
[2]: https://itsfoss.com/lite-xl/
|
||||
[3]: https://github.com/SpartanJ/eepp/
|
||||
[4]: https://news.itsfoss.com/content/images/2023/01/ecode-official.jpg
|
||||
[5]: https://www.pjtra.com/apple-touch-icon.png
|
||||
[7]: https://news.itsfoss.com/content/images/2023/01/ecode.png
|
||||
[8]: https://github.com/SpartanJ/ecode
|
||||
[9]: https://news.itsfoss.com/content/images/2023/01/ecode-options.png
|
||||
[10]: https://news.itsfoss.com/content/images/2023/01/ecode-plugins.png
|
||||
[13]: https://cdn.ensoft.dev/eepp-demos/demo-fs.html?run=ecode.js
|
||||
[14]: https://github.com/SpartanJ/ecode/releases/tag/ecode-0.4.1
|
@ -0,0 +1,109 @@
|
||||
[#]: subject: "Kodi 20.0 \"Nexus\" Update Includes Support for AV1 Video and Steam Deck Controller"
|
||||
[#]: via: "https://news.itsfoss.com/kodi-20-nexus-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "natsumm"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15501-1.html"
|
||||
|
||||
Kodi 20.0 发布,支持 AV1 视频和 Steam Deck 控制器
|
||||
======
|
||||
|
||||
> Kodi 20 版本增加了多项重要功能。
|
||||
|
||||
![Kodi 20.0 "Nexus" Update Includes Support for AV1 Video and Steam Deck Controller][1]
|
||||
|
||||
[Kodi][2] 是 Kodi 基金会开发的跨平台开源媒体播放器,提供了大量功能。
|
||||
|
||||
它的上一个主要版本是**两年前**发布的 [Kodi 19 “Matrix”][3]。
|
||||
|
||||
**Kodi “Nexus”** 是改进后的主要版本,它提供了几个新功能和改进。
|
||||
|
||||
让我们来看看这些。
|
||||
|
||||
### 🆕 Kodi 20 “Nexus” 更新了什么?
|
||||
|
||||
这次发布带来了很多新的特性,较为突出的有:
|
||||
|
||||
- AV1 编解码支持
|
||||
- 增强的 PVR 支持
|
||||
- 更新后的数据抓取器
|
||||
- 多个修复和改进
|
||||
|
||||
![kodi 20 nexus][4]
|
||||
|
||||
#### AV1 编解码支持
|
||||
|
||||
Kodi 现在在 Linux 平台上支持开源的免版税的 [AV1 编解码][5]。
|
||||
|
||||
通过 [视频加速 API][6](VA-API)实现了解码 AV1 的硬件加速,并且还为视频输入流增加了 AV1 支持。
|
||||
|
||||
#### 增强的 PVR 支持
|
||||
|
||||
通过 [PVR][7] 观看电视和收听广播也得到了许多改进,其中一些值得注意的改进包括:
|
||||
|
||||
- 重新设计过的频道管理器。
|
||||
- 能够显示特定频道或录音的提供方。
|
||||
- 能够按提供方对频道和录音进行排序。
|
||||
- 支持只读录音。
|
||||
- 改进后的 EPG 搜索。
|
||||
- 自动清理缓存的 PVR 图像。
|
||||
- PVR 客户端插件的多实例支持。
|
||||
- Estuary 主题下的 PVR 体验调整。
|
||||
|
||||
#### 更新后的数据抓取器
|
||||
|
||||
TVDB 电视节目抓取器已更新,以防止其在加载损坏的“视频流”和“信息标记视频”后出现问题。
|
||||
|
||||
> 🗒️ 建议旧版 Kodi 20 的用户更新到最新版本,避免使用此抓取器时出现问题。
|
||||
|
||||
此外,更新后的 Python 电视节目抓取器,解决了一个潜在的问题,即新的抓取器使用的 XML 格式与现有的程序不同的问题。
|
||||
|
||||
因此,当你向库中现有的电视节目添加新集时,即便你正在使用 NFO 文件,你也必须刷新节目以下载新集指南。
|
||||
|
||||
#### 🛠️ 多个修复和改进
|
||||
|
||||
除此之外,Kodi 20 还提供了一些修复和改进,例如:
|
||||
|
||||
- Steam Deck 控制器的内置支持。
|
||||
- 开始支持 NFSv4 的文件系统。
|
||||
- 默认支持光盘。
|
||||
- 使用通用缓冲区管理 API 时,能够设置使用 HDR 输出。
|
||||
- 解决了 DRMPrime 的一个问题。
|
||||
- 多个对于图文电视的支持。
|
||||
- 修复了单机游戏的黑屏问题。
|
||||
|
||||
要了解更多信息,请阅读 [官方公告][8]。
|
||||
|
||||
### 📥 下载 Kodi 20
|
||||
|
||||
Kodi 20 “Nexus” 可从 [官方网站][9] 及其 [GitHub 仓库][10] 获取。
|
||||
|
||||
在应用商店和官方软件库也可以获取到。
|
||||
|
||||
Kodi v21(代号:Omega)正在开发中。如果你想从这次发布中获得更多内容,请关注下一个版本。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/kodi-20-nexus-release/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[natsumm](https://github.com/natsumm)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/kodi-nexus-20-release.png
|
||||
[2]: https://kodi.tv
|
||||
[3]: https://news.itsfoss.com/kodi-19-release/
|
||||
[4]: https://news.itsfoss.com/content/images/2023/01/Kodi_20_Nexus.jpg
|
||||
[5]: https://en.wikipedia.org/wiki/AV1
|
||||
[6]: https://en.wikipedia.org/wiki/Video_Acceleration_API
|
||||
[7]: https://kodi.wiki/view/PVR
|
||||
[8]: https://kodi.tv/article/kodi-20-0-nexus-release
|
||||
[9]: https://kodi.tv/download/
|
||||
[10]: https://github.com/xbmc/xbmc/releases/tag/20.0-Nexus
|
@ -0,0 +1,77 @@
|
||||
[#]: subject: "A ChatGPT GNOME Extension is in Development for Linux Users"
|
||||
[#]: via: "https://news.itsfoss.com/chatgpt-gnome-extension-development/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15498-1.html"
|
||||
|
||||
一个正在开发中的 ChatGPT GNOME 扩展
|
||||
======
|
||||
|
||||
> 你想要一个人工智能的 GNOME 桌面吗?下面这个扩展可以实现这个功能!
|
||||
|
||||
![A ChatGPT GNOME Extension is in Development for Linux Users][1]
|
||||
|
||||
[ChatGPT][2] 是一个在当下十分流行的聊天机器人,它可以与用户进行互动,用户就像在对话一样。
|
||||
|
||||
最近,关于 ChatGPT 的新闻时常出现在人们的视野之中,有时是关于 ChatGPT 的坏消息。
|
||||
|
||||
不难看出,ChatGPT 有其两面性。事实上,对于任何人工智能的实现都同样如此。
|
||||
|
||||
一方面,ChatGPT 这一工具的巨大潜力给许多人留下了深刻的印象。但另一方面,因人们对它的滥用/误用,导致 ChatGPT 在科技界引起了轩然大波。
|
||||
|
||||
人们对 ChatGPT 滥用/误用太多了,以至于其创建者 [OpenAI][3] 开发了一种工具来检测 ChatGPT 的使用情况,这个内容可以进一步访问 [此网页](https://news.itsfoss.com/openai-chatgpt-detection/)。
|
||||
|
||||
现在,我注意到在一个 Reddit 讨论中,一位开发人员提到了一些有趣的事情。
|
||||
|
||||
一个用户名为 [HorrorPills][6] 的开发人员已经开始**为 ChatGPT 开发 GNOME 扩展**。
|
||||
|
||||
这听起来非常有趣,让我们继续来看看吧。
|
||||
|
||||
### 这个扩展仍在开发中:让我们持续保持关注吧!
|
||||
|
||||
![chatgpt gnome extension][7]
|
||||
|
||||
这是一个 GNOME 桌面扩展,将 ChatGPT 添加到了桌面的 <ruby>系统托盘<rt>system tray</rt></ruby> 中。
|
||||
|
||||
现在,这个 GNOME 桌面扩展还处于未完成的状态,它已经具有了基本的功能,但仍存在一些错误。
|
||||
|
||||
正如它的开发者 [所说][8] 的那样:
|
||||
|
||||
你需要有一个 **ChatGPT 帐户**,才能使用这个扩展程序,并且需要用到你的键盘,才能进行定位,因为现在这个扩展的光标功能还有很多问题。
|
||||
|
||||
此外,这个扩展**对 GNOME 43 的支持也很不完整**,他们提供了一个临时的修复程序,并将这个进一步完善的任务添加到此扩展的后续开发中。
|
||||
|
||||
如果你喜欢的话,你可以**试试这个扩展**。你可以通过它的 [GitHub 仓库][9],来获取运行它所需的所有说明和文件。
|
||||
|
||||
它的开发人员还 [表示][10]:当这个扩展变得更加稳定时,他们会将这个扩展发布到 **GNOME 扩展** [网站][11] 上去。
|
||||
|
||||
此外,开发人员还 [透露][12]:他们在未来可能会实现 **KDE Plasma 的 ChatGPT 扩展**。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/chatgpt-gnome-extension-development/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/chatgpt-gnome-extension.png
|
||||
[2]: https://chat.openai.com
|
||||
[3]: https://openai.com
|
||||
[4]: https://news.itsfoss.com/content/images/size/w256h256/2022/08/android-chrome-192x192.png
|
||||
[5]: https://news.itsfoss.com/content/images/2023/01/openai-to-detect-chatgpt-text.png
|
||||
[6]: https://github.com/HorrorPills
|
||||
[7]: https://news.itsfoss.com/content/images/2023/01/ChatGPT_GNOME_Ext.jpg
|
||||
[8]: https://www.reddit.com/r/linux/comments/10ay23v/comment/j46yp15/
|
||||
[9]: https://github.com/HorrorPills/ChatGPT-Gnome-Desktop-Extension
|
||||
[10]: https://www.reddit.com/r/linux/comments/10avlgs/comment/j4al4cg/
|
||||
[11]: https://extensions.gnome.org
|
||||
[12]: https://www.reddit.com/r/linux/comments/10avlgs/comment/j48uofo/
|
@ -0,0 +1,158 @@
|
||||
[#]: subject: "elementary OS 7 is a Modest Upgrade With Useful Changes"
|
||||
[#]: via: "https://news.itsfoss.com/elementary-os-7-release/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15506-1.html"
|
||||
|
||||
elementary OS 7 发布
|
||||
======
|
||||
|
||||
> 在一年后,elementary OS 7 出现了,带来一些激动人心的微妙变化!
|
||||
|
||||
![][0]
|
||||
|
||||
elementary OS 6.1 是一个令人印象深刻的版本。终于,过去了一年,下一个主要的升级,elementary OS 7 “Horus” 来了。
|
||||
|
||||
这些变化可能不算大规模的翻新,正如以前 [报道][2],开发的重点更多的是在细化上。
|
||||
|
||||
### elementary OS 7:有什么新内容?
|
||||
|
||||
主要的改进领域包括:
|
||||
|
||||
- <ruby>应用中心<rt>AppCenter</rt></ruby>
|
||||
- 应用程序和系统更新
|
||||
- 侧载/替代商店
|
||||
- 改进的初次安装体验
|
||||
- 应用程序的改进
|
||||
|
||||
#### 应用中心升级
|
||||
|
||||
![elementary os 7 appcenter][3]
|
||||
|
||||
在每一次重大的升级中,<ruby>应用中心<rt>AppCenter</rt></ruby>都得到了很大的重视。虽然它已经提供了完美的体验,但它变得越来越好了,更快的性能、更好的调整以适应不同屏幕分辨率或窗口大小。
|
||||
|
||||
应用的描述是这次的亮点。你可以一次看到应用程序的更多屏幕截图,让你对应用程序有更好的了解。
|
||||
|
||||
![elementary os 7 appcenter descriptions][4]
|
||||
|
||||
这些图片还包括了图片说明,应该有助于视力有关的残疾用户访问应用程序页面。
|
||||
|
||||
从大的方面来说,屏幕截图融入到以应用程序的默认重点颜色为特色的背景中,看起来很不错。
|
||||
|
||||
此外,应用程序的描述也会给你提供更多关于该应用程序如何积极维护的信息,以及最近的发布说明。
|
||||
|
||||
#### 应用程序更新
|
||||
|
||||
![elementaryos 7 appcenter app updates][5]
|
||||
|
||||
你现在可以选择切换是否要自动更新应用程序。
|
||||
|
||||
Flatpak 的首选项保持不变;你可以选择让它们自动更新,而不是手动检查。
|
||||
|
||||
此外,系统更新一旦下载并准备好,就会离线安装,可以给你一个顺滑的体验。
|
||||
|
||||
#### 第三方应用商店
|
||||
|
||||
elementaryOS 7 应用中心上的应用程序放在其独立的 Flatpak 软件仓库上。
|
||||
|
||||
然而,你仍然可以添加 Flathub 作为软件仓库,以获得更多的 Flatpak 应用程序。
|
||||
|
||||
为了告知你这一区别,应用中心会提到一些警告,如 “<ruby>非策划的<rt>Non-Curated</rt></ruby>”,这样你就知道它是来自另一个应用商店。
|
||||
|
||||
![elementaryos 7 appcenter non-curated app warning][6]
|
||||
|
||||
当你第一次尝试从第三方商店安装一个应用程序时,这样的弹出警告只会出现一次。
|
||||
|
||||
#### 支持网页应用程序
|
||||
|
||||
![Elementary os 7 web apps][7]
|
||||
|
||||
该版本包括 GNOME Web 43,它支持创建网页应用程序,可在应用程序菜单中找到。
|
||||
|
||||
你可以在 GNOME Web 中管理所安装的网页应用程序。
|
||||
|
||||
#### 重新设计的图标
|
||||
|
||||
![elementaryos new icons][8]
|
||||
|
||||
elementaryOS 已经被视作最漂亮的 Linux 发行版之一。
|
||||
|
||||
为了提升体验,几乎每一个应用程序的图标都被重新设计,以提供一个更现代和更有表现力的用户体验。
|
||||
|
||||
#### 安装和初次体验
|
||||
|
||||
![elementary os 7 primary mouse button prompt installation window][9]
|
||||
|
||||
安装体验随着升级而变得更加直接了当。
|
||||
|
||||
换句话说,你在安装程序中的看到屏幕数量将减少,但仍然可以得到所有的基本信息,包括警告和系统要求。
|
||||
|
||||
安装程序现在可以提示你选择左键或右键设置为鼠标的主按钮。
|
||||
|
||||
![elementaryos automatic updates toggle onboarding screen][10]
|
||||
|
||||
从系统主题偏好到自动更新,你可以在安装后直接配置所有必要的东西。
|
||||
|
||||
#### 新的音乐多媒体应用程序
|
||||
|
||||
![elementartyos music 7 app][11]
|
||||
|
||||
为了提供更好的多媒体体验,该音乐应用程序已经从头开始完全重写,在各种使用情况下都能很好地工作。
|
||||
|
||||
你可以设置本地音乐位置、预览音频文件、获得正确的元数据信息,以及更多。
|
||||
|
||||
#### 其他变化
|
||||
|
||||
你会发现其他几个细微的改进。其中一些包括:
|
||||
|
||||
- 邮件应用现在采用了更现代、更扁平的设计,以提高响应速度。
|
||||
- 邮件应用程序现在支持微软 365 账户。
|
||||
- 在任务应用中对新创建的任务列表的离线支持。
|
||||
- 在线账户设置包括对 CalDAV 账户的离线支持。
|
||||
- 切换选择文件夹,只需点击一下。
|
||||
- 重新设计的打印机设置。
|
||||
- 电源配置文件管理设置。
|
||||
|
||||
你可以参考 [官方公告][12] 了解更多细节。
|
||||
|
||||
### 下载 elementary OS 7
|
||||
|
||||
> 📋 当我尝试最新的 RC 构建版时,我的英伟达显卡驱动的系统启动时出现了一个反色的(看起来很奇怪)的彩色屏幕。这对最终版本来说可能不是一个问题。
|
||||
|
||||
你可以从 [官方网站][13] 上获取最新的 ISO。我希望他们能够为英伟达系统增加一个单独的 ISO,但对于其他系统,它应该可以正常工作。
|
||||
|
||||
> **[elementary OS 7][13]**
|
||||
|
||||
另外,你必须得重新安装,而不是从 elementary OS 6 升级。在你继续安装之前,请查看其 [官方 FAQ][14]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/elementary-os-7-release/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[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/content/images/size/w2000/2023/01/elementary-os-7-release-ft.png
|
||||
[2]: https://news.itsfoss.com/elementary-os-7-dev-updates/
|
||||
[3]: https://news.itsfoss.com/content/images/2023/01/appcenter-responsive.jpg
|
||||
[4]: https://news.itsfoss.com/content/images/2023/01/appcenter-appinfo.png
|
||||
[5]: https://news.itsfoss.com/content/images/2023/01/appcenter-updates.png
|
||||
[6]: https://news.itsfoss.com/content/images/2023/01/appcenter-sideload.png
|
||||
[7]: https://news.itsfoss.com/content/images/2023/01/web-apps.png
|
||||
[8]: https://news.itsfoss.com/content/images/2023/01/icons-apps.png
|
||||
[9]: https://news.itsfoss.com/content/images/2023/01/initialsetup-lefthand-elementaryos.png
|
||||
[10]: https://news.itsfoss.com/content/images/2023/01/onboarding-updates.png
|
||||
[11]: https://news.itsfoss.com/content/images/2023/01/elementary-music.jpg
|
||||
[12]: https://blog.elementary.io/os-7-available-now/
|
||||
[13]: https://elementary.io
|
||||
[14]: https://github.com/elementary/os/wiki/OS-7-Horus-FAQ
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202302/03/171644noopjnzno5z4en2p.jpg
|
@ -0,0 +1,159 @@
|
||||
[#]: subject: "System76's Upcoming COSMIC Desktop is Gearing Up With Big Changes"
|
||||
[#]: via: "https://news.itsfoss.com/system76-pop-os-cosmic-de-changes/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15508-1.html"
|
||||
|
||||
System76 即将推出的 COSMIC 桌面正在酝酿大变化
|
||||
======
|
||||
|
||||
> System76 介绍了其即将推出的由 Rust 开发的 COSMIC 桌面环境的开发细节。让我们来看看。
|
||||
|
||||
![System76 即将推出的 COSMIC 桌面正在酝酿大变化][1]
|
||||
|
||||
Pop!_OS 的开发者们 [早在 2021 年][2] 就开始着手开发他们**基于 Rust 的桌面环境** COSMIC。
|
||||
|
||||
其目标是制作一些你已经熟悉的 Pop!_OS 的东西,但为你提供一个更快和更可扩展的桌面环境。
|
||||
|
||||
System76 也决定 [不发布 Pop!_OS 22.10][3],以专注于它的开发。
|
||||
|
||||
另外,我们的一个社区贡献者尝试了它的一个早期版本,它看起来很有希望:
|
||||
|
||||
> **建议阅读** 📖
|
||||
>
|
||||
> 我试用了 System76 新的基于 Rust 的 COSMIC 桌面!如果你还不知道,System76 的开发者一直在开发一个新的桌面环境(被称为 COSMIC),它是用 Rust 编写的:一种内存安全和超快的编程语言。从头开始创建一个桌面环境并不是一件简单的事。这涉及到创建从合成器、...
|
||||
>
|
||||
> ![][5]
|
||||
|
||||
时间过去了一年,我们现在对这个桌面环境有了更多的期待。
|
||||
|
||||
让我们来探索一下 System76 为我们准备了什么。
|
||||
|
||||
### COSMIC 桌面的 3 项关键性的改进
|
||||
|
||||
> 📋 我们讨论的这些变化和草图在最终发布时可能会有变化。
|
||||
|
||||
在 [最近的一篇博文][6] 中,来自 System76 的 Alex 让我们看到了 COSMIC 桌面环境的发展状况。
|
||||
|
||||
让我带你看看其中值得注意的亮点:
|
||||
|
||||
- 新的用户界面功能
|
||||
- 重新打造的设置应用
|
||||
- 新的壁纸功能
|
||||
|
||||
### 1、新的用户界面功能
|
||||
|
||||
![cosmic de ui new ui features][7]
|
||||
|
||||
一个新的 [SegmentedButton][8] 部件被用来处理 COSMIC 桌面环境中各处的标签和分段式按钮。
|
||||
|
||||
它的目的是给人一种简洁、有条理、更集中的菜单体验,而分段式按钮则允许在选择时进行操作。
|
||||
|
||||
他们还举了一个例子来解释这对用户界面有什么帮助:
|
||||
|
||||
> 当你定制你的桌面以使用水平工作区而不是垂直工作区时,例如,你的选择将导致桌面反映这种行为。
|
||||
|
||||
### 2、重新打造的设置应用
|
||||
|
||||
![cosmic de revamped settings menu][9]
|
||||
|
||||
首先,“设置” 应用得到了彻底的整改,现在搜索结果显示为一个连续的、可滚动的、来自不同设置面板的结果列表。
|
||||
|
||||
> 🗒️ 在最新几轮的内部用户(UX)测试后,具体设置进行了调整。
|
||||
|
||||
然后是各种设置面板本身的改造。让我带你了解一下。
|
||||
|
||||
#### 显示调整
|
||||
|
||||
![cosmic de display settings][10]
|
||||
|
||||
开发人员将图形模式和深浅色选项移至显示设置面板。在测试过程中,他们发现大多数用户到显示设置中去是希望找到这些设置。
|
||||
|
||||
![][11]
|
||||
|
||||
此外,当使用多个显示器时,显示设置将根据显示器被组织到专门的选项卡中,并有改变或添加颜色配置文件的选项。
|
||||
|
||||
#### 电源选项
|
||||
|
||||
![][12]
|
||||
|
||||
这个设置面板现在可以显示连接的无线设备的电池电量和所有连接设备的概览。
|
||||
|
||||
你还可以根据你的要求选择电源配置文件,并限制笔记本电脑的电池充电,以保护电池寿命。
|
||||
|
||||
#### 地区和语言选择
|
||||
|
||||
![cosmic de region language settings][13]
|
||||
|
||||
该设置已被划分为不同的类别,以便于访问。它们被分为几个的类别,以选择日历、日期、温度和测量的区域格式。
|
||||
|
||||
#### 声音
|
||||
|
||||
声音设置中增加了一个新的选项,可以让你调整个别警报和应用程序的音量。
|
||||
|
||||
![cosmic de sound settings][14]
|
||||
|
||||
此外,拥有两个或更多扬声器的用户现在可以使用新的扬声器测试工具来优化其设置。
|
||||
|
||||
### 3、新的壁纸功能
|
||||
|
||||
![][15]
|
||||
|
||||
COSMIC 桌面环境可以让你设置一张壁纸,每个显示器一张,或者让你以幻灯片的形式循环播放多张壁纸。这是给**多显示器用户的一个好消息!**
|
||||
|
||||
你还可以对每张壁纸在切换到下一张之前在屏幕上停留的时间进行精细控制。
|
||||
|
||||
### 🛠️ 其他改进措施
|
||||
|
||||
除了上面提到的面向用户的变化之外,还有一些内在的改进,包括:
|
||||
|
||||
- 一个新的动态渲染器,[iced-dyrend][16] 已经由 System76 首席工程师实现,旨在动态调整你的 GPU 应该使用什么渲染程序。如果你有 GPU,它可以在 OpenGL 或 Vulkan 之间切换;如果你没有,则可以在 [Softbuffer][17] 之间切换。
|
||||
- 通过 [cosmic-text][18] 进行的文本渲染已经与 Softbuffer 0.2.0 配对,允许 [libcosmic][19] 部件库的软件渲染后端在任何操作系统上使用。
|
||||
- 开发者还测试了 XWayland 的实现,使 COSMIC 桌面环境能够运行使用 X11 窗口系统的应用程序。
|
||||
- COSMIC 桌面环境已经通过 [cosmic-time][20] 动画库加入了对动画的支持。它包含了默认应用程序所使用的动画,并使用 [Iced][21] 工具箱构建。
|
||||
|
||||
开发者还提到:
|
||||
|
||||
> 虽然 COSMIC 桌面环境是为 Pop!_OS 开发的,但我们的目标是让它的元素也能在其他操作系统上使用。
|
||||
|
||||
这是很好的消息!如果你想知道 COSMIC 桌面环境是否是 Pop!_OS 独有的东西,也许你也可以在发行版上试试它,希望如此! 😊
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/system76-pop-os-cosmic-de-changes/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/02/cosmic-desktop-changes.png
|
||||
[2]: https://news.itsfoss.com/pop-os-cosmic-rust/
|
||||
[3]: https://news.itsfoss.com/no-pop-os-21-10/
|
||||
[4]: https://news.itsfoss.com/content/images/size/w256h256/2022/08/android-chrome-192x192.png
|
||||
[5]: https://news.itsfoss.com/content/images/wordpress/2022/01/system76-rust-based-distro-ft.png
|
||||
[6]: https://blog.system76.com/post/more-on-cosmic-de-to-kick-off-2023
|
||||
[7]: https://news.itsfoss.com/content/images/2023/02/COSMIC_ui.jpg
|
||||
[8]: https://github.com/pop-os/libcosmic/pull/56
|
||||
[9]: https://news.itsfoss.com/content/images/2023/02/COSMIC_revamped_settings.jpg
|
||||
[10]: https://news.itsfoss.com/content/images/2023/02/COSMIC_display.png
|
||||
[11]: https://news.itsfoss.com/content/images/2023/02/multiple-displays.jpg
|
||||
[12]: https://news.itsfoss.com/content/images/2023/02/COSMIC_power-1.png
|
||||
[13]: https://news.itsfoss.com/content/images/2023/02/COSMIC_region_language.png
|
||||
[14]: https://news.itsfoss.com/content/images/2023/02/COSMIC_sound.png
|
||||
[15]: https://news.itsfoss.com/content/images/2023/02/COSMIC_wallpapers-1.png
|
||||
[16]: https://github.com/pop-os/iced/commit/f1310e47617c3046a3cd98e20e373247f19327af
|
||||
[17]: https://github.com/rust-windowing/softbuffer/
|
||||
[18]: https://github.com/pop-os/cosmic-text
|
||||
[19]: https://github.com/pop-os/libcosmic
|
||||
[20]: https://github.com/pop-os/cosmic-time
|
||||
[21]: https://github.com/iced-rs/iced
|
||||
[22]: https://mastodon.social/@itsfoss
|
||||
[23]: https://twitter.com/itsfoss2
|
@ -0,0 +1,179 @@
|
||||
[#]: subject: "KDE Plasma 5.27: Top New Features and Release Details"
|
||||
[#]: via: "https://www.debugpoint.com/kde-plasma-5-27/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
KDE Plasma 5.27: Top New Features and Release Details
|
||||
======
|
||||
|
||||
**The list of impressive features and enhancements of the KDE Plasma 5.27 desktop is arriving in February.**
|
||||
|
||||
In a way, KDE Plasma 5.27 is a milestone release.
|
||||
|
||||
Firstly, it is the final LTS release of the Plasma 5 version and the last instalment of the Plasma 5 series. Initial porting work has already started for Plasma 6 series, which would be based on Qt 6 version.
|
||||
|
||||
Release number-wise, it is the 29th version of the KDE Plasma desktop, followed by the [prior plasma 5.26 release][1].
|
||||
|
||||
Visible feature-wise, it’s of moderate size. However, the bug fixes, code refactoring, cleanup, and optimization are significant. Most are not visible on the deck, but you can feel the changes when using this fluid desktop.
|
||||
|
||||
Before I walk you through the key features, here’s the schedule.
|
||||
|
||||
- **Beta:** Jan 19, 2023
|
||||
- **KDE Plasma 5.27 Final release:** Feb 14, 2023
|
||||
|
||||
![KDE Plasma 5.27 dev edition][2]
|
||||
|
||||
### KDE Plasma 5.27: Best New Features
|
||||
|
||||
#### Plasma Workspace
|
||||
|
||||
A brand new app welcomes you to Plasma desktop from now on. It was a good idea to add this app to Plasma. It will give you some initial information about Plasma, setting up online accounts and so on.
|
||||
|
||||
![Plasma Welcome App][3]
|
||||
|
||||
The media controller applet introduces two new layouts in this release. A vertical layout showing album art, song title and artist name. And an icon-only display showing only album art. [MR 2176][4]
|
||||
|
||||
The icon size settings slide in the Appearance is moved under the preview with more descriptive text. Also, the window size is slightly larger to accommodate the overall items. [MR 2213][5]
|
||||
|
||||
![Changes in icon size slide][6]
|
||||
|
||||
KDE Plasma battery monitor will now show the charging, discharging, and fully charged status for non-power supply batteries such as a wireless mouse, and mobile phones when connected to the Plasma desktop. [MR 2210][7]
|
||||
|
||||
Also, the battery monitor stops showing 100% when the battery is fully charged. You can only see the power icon without any text. [MR 2306][8]
|
||||
|
||||
In another change, the battery monitor shows “Estimating…” text when the remaining time is 0. Also, the remaining time calculation is changed to give you accurate hours and minutes remaining to full charge.
|
||||
|
||||
The middle click features are now exposed in the applet UI when available. The features existed for some apps, but the discovery was difficult unless tried. [MR 2205][9]
|
||||
|
||||
![Exposing the middle click options][10]
|
||||
|
||||
In the upcoming Qt6, the GaussianBlur is not available. Hence it has been removed in this version, and FastBlur is now incorporated. This is part of the initial Qt6 porting of the future Plasma 6 release. [MR 2083][11]
|
||||
|
||||
The “do not disturb” applet now shows a clearer message for the duration. Earlier it used to show “Until today”, and it has been changed to “Automatically ends: Today at ….”. [MR 1412][12]
|
||||
|
||||
In KDE Plasma 5.27, you can directly drag the wallpaper from the image list to any other application which accepts images. For example, you can directly drag and drop an image from the wallpaper window to the Gwenview image viewer. This definitely eases up many workflows and should save hassles from going to the folder and opening them. However, the feature is not working in my test, so I can’t show you a demo. [MR 2284][13]
|
||||
|
||||
We all love Krunner, the most excellent launcher ever! In this release, Krunner now searches for the key in any part of the file name in the recent document list. It sorts the result from the best match, starting with the search key in the file name to the bottom. [MR 2273][14]
|
||||
|
||||
Also, when there is no match in any documents in your system, Krunner now prompts a web search with the search key. [MR 2311][15]
|
||||
|
||||
![Krunner is great][16]
|
||||
|
||||
The developers can now prioritise the applet notification by assigning a notification value of 256. Once it is a high priority, the notification becomes part of the top header instead of the menu. [MR 2245][17]
|
||||
|
||||
The Users settings page, fingerprint register, and authentication selection are much more visually attractive with an actual hand image. [MR 2347][18]
|
||||
|
||||
![New Visual cue for fingerprint][19]
|
||||
|
||||
The accessibility of KDE Plasma is now more robust because the Orca screenreader app can read the notifications. It includes the app name and the notification description. [MR 2295][20]
|
||||
|
||||
#### Wayland, Kwin and Plasma desktop
|
||||
|
||||
KDE Plasma 5.27 now supports **high-resolution scrolling** in Wayland, thanks to libinput 1.9 version changes. With this change, you should experience smooth scrolling performance in Chrome and Firefox browsers. I hope this makes it on par with the Windows experience. To this day, I still feel Windows scrolling in the popular browser is very smooth. [MR 3034][21]
|
||||
|
||||
Another Wayland fix in this release is the inclusion of the Wayland implementation of **idle notification protocol**. In the Wayland session, if you become idle, the data can now be consumed by various apps and modules to save power, change the status in messaging apps, etc. [MR 2959][22]
|
||||
|
||||
Wayland session in Plasma desktop also brings content type. This allows Kwin to tweak the display behaviour (direct scanout, variable refresh rate, etc.) based on the content displayed on the screen. So, you should get an optimized session based on whether you are watching a movie, playing games or casually browsing the web. [MR 2467][23]
|
||||
|
||||
KDE Plasma Wayland session now supports **fractional scaling** natively. The upstream Wayland change for this was [merged][24] a few months back in 2022. You should get native resolution options in Wayland sessions. [MR 2598][25]
|
||||
|
||||
If you are a multi-monitor user, you should be glad to know that the settings to manage multiple displays are now easily accessible via the system tray display configuration.
|
||||
|
||||
![Multiple display configuration is now available from system tray][26]
|
||||
|
||||
#### Discover
|
||||
|
||||
Discover now shows a proper message when you are offline that it cannot fetch software information from servers instead of showing a progress bar. [MR 383][27]
|
||||
|
||||
For the past few releases, Discover has been improved for Flatpak management. This release also gets some goodies for Flatpak apps. Firstly, the Flatpak application view now shows more permissions entries that an app needs. A new settings page lists all the installed Flatpak and its permissions. [MR 372][28]
|
||||
|
||||
![Flatpak Permission in Discover][29]
|
||||
|
||||
Secondly, Discover now waits a few moments before checking updates for Flatpak. While it waits, it shows the locally cached Flatpak data. [MR 421][30]
|
||||
|
||||
Thirdly, the Discover home is revamped. Honestly, it was due for a long time. Now it looks far better with the popular apps, editor’s choice and other categories. [MR 398][31]
|
||||
|
||||
![Discover homepage now revamped][32]
|
||||
|
||||
#### Additional updates
|
||||
|
||||
Other key change includes:
|
||||
|
||||
- Plasma 5.27 is based on KDE Framework 5.102 and Qt 5.15.2.
|
||||
- Transition animation when changing wallpaper.
|
||||
- The weather applet now shows weather info in overlay mode.
|
||||
- The location picker in the weather applet now gives you a possible list of locations.
|
||||
- The network applet now shows 5G connection label and icons when used.
|
||||
- And hopefully, a new wallpaper as always!
|
||||
|
||||
[_Detailed changelog_][33] _(5.26.5-5.26.90)_
|
||||
|
||||
### Download
|
||||
|
||||
The BETA of KDE Plasma 5.27 is now out. You can download the ISO file and torrent via the KDE Neon distribution from the below link. Remember, this is a testing copy, and there may be bugs. So use it with caution.
|
||||
|
||||
[Download KDE Neon (testing edition)][34]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Overall, the change list is enormous and impossible to cover in one article. It’s amazing to see so many changes pulled up in each release by the KDE team. The KDE Framework and app changes are not part of this article which is also significant.
|
||||
|
||||
The final release is planned on Feb 14, 2023.
|
||||
|
||||
Distro-wise, KDE Plasma 5.27 should be available in Fedora 38 and Ubuntu 23.04 Lunar Lobster within the March-April timeframe.
|
||||
|
||||
So, which one of the features do you choose as your favourite? Let me know in the comment box below.
|
||||
|
||||
Cheers.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/kde-plasma-5-27/
|
||||
|
||||
作者:[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/kde-plasma-5-26/
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2023/01/KDE-Plasma-5.27-dev-edition.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2023/01/Plasma-Welcome-App.jpg
|
||||
[4]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2176
|
||||
[5]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2213
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Changes-in-icon-size-slide2.jpg
|
||||
[7]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2210
|
||||
[8]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2306
|
||||
[9]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2205
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2023/01/Exposing-the-middle-click-options.jpg
|
||||
[11]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2083
|
||||
[12]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1412
|
||||
[13]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2284
|
||||
[14]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2273
|
||||
[15]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2311
|
||||
[16]: https://www.debugpoint.com/wp-content/uploads/2023/01/Krunner-is-great.jpg
|
||||
[17]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2245
|
||||
[18]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2347
|
||||
[19]: https://www.debugpoint.com/wp-content/uploads/2023/01/New-Visual-cue-for-fingerprint.jpg
|
||||
[20]: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2295
|
||||
[21]: https://invent.kde.org/plasma/kwin/-/merge_requests/3034
|
||||
[22]: https://invent.kde.org/plasma/kwin/-/merge_requests/2959
|
||||
[23]: https://invent.kde.org/plasma/kwin/-/merge_requests/2467
|
||||
[24]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143
|
||||
[25]: https://invent.kde.org/plasma/kwin/-/merge_requests/2598
|
||||
[26]: https://www.debugpoint.com/wp-content/uploads/2023/01/Multiple-display-configuration-is-now-available-from-system-tray.jpg
|
||||
[27]: https://invent.kde.org/plasma/discover/-/merge_requests/383
|
||||
[28]: https://invent.kde.org/plasma/discover/-/merge_requests/372
|
||||
[29]: https://www.debugpoint.com/wp-content/uploads/2023/01/Flatpak-Permission-in-Discover.jpg
|
||||
[30]: https://invent.kde.org/plasma/discover/-/merge_requests/421
|
||||
[31]: https://invent.kde.org/plasma/discover/-/merge_requests/398
|
||||
[32]: https://www.debugpoint.com/wp-content/uploads/2023/01/Discover-homepage-now-revamped.jpg
|
||||
[33]: https://kde.org/announcements/changelogs/plasma/5/5.26.5-5.26.90/
|
||||
[34]: https://files.kde.org/neon/images/testing/current/
|
@ -0,0 +1,127 @@
|
||||
[#]: subject: "LibreOffice 7.5 Unveils Stunning New App Icons and Cool Features"
|
||||
[#]: via: "https://news.itsfoss.com/libreoffice-7-5-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
LibreOffice 7.5 Unveils Stunning New App Icons and Cool Features
|
||||
======
|
||||
|
||||
LibreOffice 7.5 seems to have a new personality with its brand-new app icons and other improvements.
|
||||
|
||||
![LibreOffice 7.5 Unveils Stunning New App Icons and Cool Features][1]
|
||||
|
||||
LibreOffice 7.5 community edition is here with **many feature upgrades and new app icons**.
|
||||
|
||||
The previous major release [version 7.4][2] bought in better 'interoperability' with Microsoft's proprietary file formats and **further solidified LibreOffice** as one of the [best open-source alternatives to Microsoft Office][3] on Linux.
|
||||
|
||||
And now, a new release is here with a lot in store.
|
||||
|
||||
Let's take a look at what this has to offer.
|
||||
|
||||
### 🆕 LibreOffice 7.5: What's New?
|
||||
|
||||
![LibreOffice 7.5: New Features][4]
|
||||
|
||||
With this release, plenty of improvements have been made to all the programs of LibreOffice; some key highlights include:
|
||||
|
||||
- **New App Icons**
|
||||
- **Writer Improvements**
|
||||
- **Calc Improvements**
|
||||
- **Impress & Draw Improvements**
|
||||
- **Dark mode improvement**
|
||||
|
||||
#### New App Icons
|
||||
|
||||
![libreoffice's updated icons][5]
|
||||
|
||||
LibreOffice now features a new set of app icons that look pretty modern. These will look neat with current-gen desktop environments such as GNOME and Plasma.
|
||||
|
||||
Here's how it looks compared to the old icon; refreshing, right?
|
||||
|
||||
![libreoffice old icon vs new icon][6]
|
||||
|
||||
Similarly, the developers have also updated the icon set used throughout LibreOffice's interface for various media types/files.
|
||||
|
||||
#### Writer Improvements
|
||||
|
||||
![libreoffice writer screenshot][7]
|
||||
|
||||
The Writer app has received a host of improvements, notable ones include:
|
||||
|
||||
- A new plain text type was added.
|
||||
- Content controls for titles and tags.
|
||||
- New combo box type and ability to export content controls to PDF.
|
||||
- Spellcheck has improved for various languages such as Danish, Dutch, Estonian, German, Hungarian, Norwegian, and Swedish.
|
||||
- In case of tables, column detection has improved when it intersects with merged cells.
|
||||
- Bookmark editing and accessibility has been improved.
|
||||
- A decorative tag can be applied to images, embedded objects, and text frames to allow assistive software to ignore them in exported PDFs.
|
||||
|
||||
#### Calc Improvements
|
||||
|
||||
![libreoffice 7.5 calc screenshot][8]
|
||||
|
||||
Cell inputs with the leading ' apostrophe in cells that are not formatted as Text will now permanently remove the first apostrophe to prevent confusion.
|
||||
|
||||
Support for Kamenický and Mazovia encodings was added, alongside improvements to conditional formatting.
|
||||
|
||||
In addition, when searching for a term in the Function Wizard, it will now match the function descriptions as well as their names.
|
||||
|
||||
#### Impress & Draw Improvements
|
||||
|
||||
Impress now has support for adding cropped videos in media shapes and also includes a fix for an EMF graphics issue where it would appear blurry.
|
||||
|
||||
![libreoffice draw's new table style design feature][9]
|
||||
|
||||
In the case of Draw, essential support was added for modifying table styles and creating new ones. Modified styles are saved into the document and can be made into templates and shared.
|
||||
|
||||
> 🗒️ You can access the feature to modify table style by right-clicking on a design in the Table Design sidebar panel.
|
||||
|
||||
#### 🛠️ Other Changes and Improvements
|
||||
|
||||
These were not the only improvements to LibreOffice with the 7.5 release.
|
||||
|
||||
Things like **better support for dark and high contrast themes**, support for data tables in charts, various improvements to the core, and more make this a packed release. Some refinements are targeted for platforms like macOS and Windows, along with Linux.
|
||||
|
||||
You can check all the technical changes from the [official release notes][10] or the [announcement][11].
|
||||
|
||||
### Download LibreOffice 7.5
|
||||
|
||||
LibreOffice 7.5 is available from the [official download page][12].
|
||||
|
||||
You can find deb and rpm files along with packages for Windows and macOS (Intel/ARM).
|
||||
|
||||
[LibreOffice 7.5][12]
|
||||
|
||||
You can also opt for a Torrent file for an even smoother download experience.
|
||||
|
||||
For existing users, depending on your Linux distribution, expect an update in the coming days/weeks. You may opt for the Flatpak package for faster access to the latest version.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/libreoffice-7-5-release/
|
||||
|
||||
作者:[Sourav Rudra][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/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2023/02/libreoffice-7.5-release.png
|
||||
[2]: https://news.itsfoss.com/libreoffice-7-4-release/
|
||||
[3]: https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/
|
||||
[4]: https://youtu.be/ZlAmjIwUvs4
|
||||
[5]: https://news.itsfoss.com/content/images/2023/02/LibreOffice_7.5_Icons.png
|
||||
[6]: https://news.itsfoss.com/content/images/2023/02/libreoffice-icons.jpg
|
||||
[7]: https://news.itsfoss.com/content/images/2023/02/libreoffice-writer.png
|
||||
[8]: https://news.itsfoss.com/content/images/2023/02/libreoffice-7-5.png
|
||||
[9]: https://news.itsfoss.com/content/images/2023/02/LibreOffice_7.5_Table_Design.png
|
||||
[10]: https://wiki.documentfoundation.org/ReleaseNotes/7.5
|
||||
[11]: https://blog.documentfoundation.org/blog/2023/02/02/tdf-announces-libreoffice-75-community/
|
||||
[12]: https://www.libreoffice.org/download/download-libreoffice/
|
@ -1,94 +0,0 @@
|
||||
[#]: subject: "I got my first pull request merged!"
|
||||
[#]: via: "https://opensource.com/article/22/9/first-pull-request-merged"
|
||||
[#]: author: "Oluwaseun https://opensource.com/users/jhhornn"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
I got my first pull request merged!
|
||||
======
|
||||
Experience the joy that contributing to open source brings.
|
||||
|
||||
![Dandelion zoomed in][1]
|
||||
|
||||
Image by: Photo by Rob Tiller, CC BY-SA 4.0
|
||||
|
||||
Words cannot express my joy when I got the notification about the merge below, and I owe it to my current engineering school, [AltSchool Africa][2].
|
||||
|
||||
![successful merge message][3]
|
||||
|
||||
Before this, I had been introduced to open source many times, told about its importance in the tech space, and even attended open source conferences (e.g., OSCAFest). I had all the instant excitement to start, but imposter syndrome set in on opening GitHub to create something.
|
||||
|
||||
Fast forward to Monday, the 8th of August, 2022, when I watched Bolaji's video on contributing to open source. I felt pumped again, but I wanted to apply what I learned, so I noted some steps.
|
||||
|
||||
The steps:
|
||||
|
||||
1. I made up my mind I was going to contribute to a project.
|
||||
2. I was focused on a site ([good first issue][4]) to pick my first project from, which I filtered to suit my skill level. I kept opening the next page till I found one.
|
||||
3. I made sure I was equipped with the required [Git and GitHub][5] knowledge to complete the project.
|
||||
|
||||
### The project
|
||||
|
||||
After long hours searching for projects, I finally found one titled, [Ensure no missing alt attributes][6]. I was to give descriptive alt values to images from the site. Alt values in images help to improve the accessibility of the site such that screen readers can provide a detailed description of the image to, say, a visually impaired person. Easy right? Yes, but if I didn't make up my mind to get the first contribution, I wouldn't find it, and open source would continue to be a myth to me.
|
||||
|
||||
I was still pumped until I discovered it was from [MDN][7]. Wait, MDN? As in Mozilla developer? Will they merge my contribution even with how seemingly easy it looks? [Imposter syndrome][8] set in.
|
||||
|
||||
Upon checking the issue, I saw that people were already contributing. I summoned my courage and started reading about it. Taking my time to read and understand the project and how I needed to approach the issue was another challenge I had to overcome.
|
||||
|
||||
The project is as easy as you try to understand it.
|
||||
|
||||
So, I picked two images to begin with. I gave alt values to them, committed my changes, then made a pull request. The time between when I made the pull request and when I got the approval mail was full of self-doubts. Should I close the pull request? This is MDN. Well, it's not coding... What if I don't get merged? I might never contribute again. All it took to clear all of the doubts were the emails I got from my reviewer below:
|
||||
|
||||
![Email of approved pull request][9]
|
||||
|
||||
![mail showing that pull request has been merged][10]
|
||||
|
||||
![congratulatory mail on contributing and merging of pull request][11]
|
||||
|
||||
I was indeed delighted, and this inspired me to check for more. It gave me the courage I needed to request additional issues to solve.
|
||||
|
||||
![Mail of issue assignment][12]
|
||||
|
||||
### Summary
|
||||
|
||||
A few lessons I'd love you to take home from this article are:
|
||||
|
||||
* Open source is for all. Do you see that typo on that site you just visited? You helping to correct it is a way of contributing.
|
||||
* No skillset is too small. A basic understanding of HTML was what I needed to contribute.
|
||||
* Only you can stop yourself from contributing.
|
||||
* The first contribution is all you need to get the ball rolling.
|
||||
|
||||
I hope you have been able to pick something from my story and apply it today. This is another space I'd like to keep contributing to, so see you in my next article, and happy open sourcing!
|
||||
|
||||
*[This article originally appeared on I got my first Pull Request merged! and is republished with permission.][13]*
|
||||
|
||||
Image by: (Awosise Oluwaseun, CC BY-SA 4.0)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/9/first-pull-request-merged
|
||||
|
||||
作者:[Oluwaseun][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/jhhornn
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/dandelion_zoom.jpg
|
||||
[2]: https://www.altschoolafrica.com/
|
||||
[3]: https://opensource.com/sites/default/files/2022-09/successfulmerge.png
|
||||
[4]: https://goodfirstissues.com/
|
||||
[5]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/about-collaborative-development-models
|
||||
[6]: https://github.com/mdn/content/issues/19334
|
||||
[7]: https://developer.mozilla.org/en-US/
|
||||
[8]: https://opensource.com/article/20/9/imposter-syndrome
|
||||
[9]: https://opensource.com/sites/default/files/2022-09/approved.png
|
||||
[10]: https://opensource.com/sites/default/files/2022-09/merged_0.png
|
||||
[11]: https://opensource.com/sites/default/files/2022-09/thanks.png
|
||||
[12]: https://opensource.com/sites/default/files/2022-09/next.png
|
||||
[13]: https://dev.to/jhhornn/i-got-my-first-pull-request-merged-3ei9
|
@ -1,97 +0,0 @@
|
||||
[#]: subject: "What you actually need to know about open source to get started"
|
||||
[#]: via: "https://opensource.com/article/22/11/get-started-open-source"
|
||||
[#]: author: "Katie Edwards https://opensource.com/users/kaedward"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
What you actually need to know about open source to get started
|
||||
======
|
||||
|
||||
A beginner's guide to open source explained in plain terms.
|
||||
|
||||
So you want (or need) to figure out what ["open source"][1] really means. I'll cover the basics of open source, whether you're interested in contributing to a project or want to be in the loop at a new job where the term keeps getting thrown around.
|
||||
|
||||
Full disclosure: I am a person with little technical experience, working in the content-design fringes of a very technical open source environment. Given my background in marketing and communication, I felt like a fish out of water when I made this career switch. [Git][2], data science, the ins and outs of software… It was, and still is a year later, a lot to comprehend.
|
||||
|
||||
But that's why I'm writing this piece. I want to help make open source a little less intimidating. After all, at the center of open source is a supportive learning community—built for everyone, technically experienced or not.
|
||||
|
||||
I'll start with the absolute basics.
|
||||
|
||||
### What is open source?
|
||||
|
||||
For the record, the industry definition of open source is available at the [Open Source Initiative][3] site.
|
||||
|
||||
However, the popular perception of "open source" software is usually that it doesn't cost anything, the source code is accessible, anyone can contribute to it, and you can redistribute it or do whatever else you want with it.
|
||||
|
||||
Some of that is true, and some of it plays into a few common misconceptions, one of which is cost.
|
||||
|
||||
#### Open source costs $0
|
||||
|
||||
Is it true? Usually, but not always. By nature of its code being publicly available, open source software can be obtained at no cost. However, for-profit companies do exist around open source projects. But if the software is available at no cost, how do open source companies even exist? How do they make money?
|
||||
|
||||
The concept of having a "free product" is counter-intuitive. But that's just the thing: A company doesn't have to sell software to profit from the management of products, storage of data, and customer support.
|
||||
|
||||
Many companies follow a subscription model, offering customer support in case of bugs or general confusion. Data storage isn't free, so that is another area where these companies can bring in income. In this regard, the "product" isn't the software; it's the benefit of a subscription.
|
||||
|
||||
- **The source code is accessible**: Is it true? Yes, always. This accessibility is a prerequisite for adopting the term "open source." The source code must be available to view, use, modify, and redistribute.
|
||||
- **You can do whatever you want with the code**: Is it true? It depends. Subject to licensing terms, there are some limitations on how you can use code, but you can generally use it however you'd like. Whether that means tweaking a project to fit a specific need or using it as the basis for something else, open source software is yours, and everyone else's, to modify.
|
||||
- **Anyone can contribute to open source projects**: Is it true? Yes - within limits. Anyone with the [right skill set][4] can contribute to open source. However, that doesn't mean all contributions are always accepted and implemented.
|
||||
|
||||
For example, say you're interested in a project where the end goal is a catalog of all the types of birds in the world. You're really into dinosaurs, specifically dinosaurs that may have eventually evolved into modern-day birds. So, you contribute entries for all of the most bird-like dinosaurs. The project owners could see this and think, "Sweet, those are some great prehistoric birds." However, they're also allowed to say, "Hmm, those dinosaurs are like birds, but they're technically not birds yet. They probably don't belong on Birdpedia."
|
||||
|
||||
Luckily, projects don't usually work under lawless conditions. Open source projects typically come with contribution guidelines and codes of conduct, so you don't have to worry about your additions flying off the rails.
|
||||
|
||||
### Why open source?
|
||||
|
||||
So, after all the contributions are made (if it's ever actually done), why would people give away their software for no cost? If so many people put their time and effort into creating something, why wouldn't they band together and slap a price tag on it?
|
||||
|
||||
This question comes with a lot of answers. Here are a few:
|
||||
|
||||
- Starting a business is hard, especially if the project you're working on doesn't form the strong foundation for a money machine. It can be easier to rally a bunch of like-minded people without commitments or the expectation of paychecks.
|
||||
- Most open source communities consist of people interested in improving software or bringing it into existence but don't have the time or interest to commit to working full-time on a project. Sometimes open source represents passion projects, geek groups, and crowd-sourced solutions to annoying problems.
|
||||
- The groups that form around open source projects of all sizes foster supportive communities where contributors and onlookers alike can practice their skills, improve software they regularly use, teach and learn from each other, and feel empowered to make their voices heard. Many open source communities are essentially hyper-focused online hobby clubs.
|
||||
|
||||
### Where do I get involved?
|
||||
|
||||
Now you may ask yourself, "But what do I do with this information? Can I contribute to open source projects? What if I'm not good enough yet?"
|
||||
|
||||
Never fear—even [beginners][5] are welcome to contribute to open source projects. It's a great way to hone your skills while working with a community towards a larger goal. And, as I talked about earlier, the worst that can happen is your changes aren't merged into Birdpedia (and that's because those product owners just can't see your vision of a Birdpedia where birds and their ancestors gleefully coexist in an online world of bird-related knowledge).
|
||||
|
||||
Do you have to know how to code to contribute to projects? Contrary to popular belief, [no, you don't][6]. Projects "take a village" to thrive, which means they need input from people of all different backgrounds. Visual designers, writers, marketers, reviewers, translators, subject matter enthusiasts, and even just users of the resulting product are all valuable contributors. Not only do they help build out and improve products, but they identify bugs, suggest improvements, spread the word about the project, and generally strengthen the community.
|
||||
|
||||
In short, no matter what your background or experience, if you're interested in open source or a specific project, you're nearly guaranteed to be welcomed with open arms.
|
||||
|
||||
### Get started with open source now
|
||||
|
||||
Still not sure where to begin? Here are some ideas and resources to get you started:
|
||||
|
||||
- [Up For Grabs][7] is a "list of open source projects which have curated tasks specifically for new contributors." This is a great place to find an easy first PR opportunity, which is a great way to find out what kind of contributions you'll enjoy.
|
||||
- Check out this list of [beginner-friendly projects][8] on GitHub.
|
||||
- If you're still not feeling inspired, consider [contributing][9] to (or flying with) [PatternFly][10], Red Hat's open design system.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/get-started-open-source
|
||||
|
||||
作者:[Katie Edwards][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/kaedward
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/resources/what-open-source
|
||||
[2]: https://opensource.com/resources/what-is-git
|
||||
[3]: https://opensource.org/osd
|
||||
[4]: https://opensource.com/life/16/1/8-ways-contribute-open-source-without-writing-code
|
||||
[5]: https://opensource.com/article/18/4/get-started-open-source-project
|
||||
[6]: https://opensource.com/article/22/8/non-code-contribution-powers-open-source
|
||||
[7]: https://up-for-grabs.net/?ref=hackernoon.com#/
|
||||
[8]: https://github.com/MunGell/awesome-for-beginners
|
||||
[9]: https://github.com/patternfly
|
||||
[10]: https://www.patternfly.org/v4/get-started/design
|
@ -1,81 +0,0 @@
|
||||
[#]: subject: "4 key differences between Twitter and Mastodon"
|
||||
[#]: via: "https://opensource.com/article/22/11/twitter-vs-mastodon"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
4 key differences between Twitter and Mastodon
|
||||
======
|
||||
|
||||
Mastodon is not a corporation. All of its instances are staffed and supported by each server's contributors. Here are a few other advantages.
|
||||
|
||||
Social media is not always sociable, and sometimes we need a sufficient impetus to change what we do and what we read. I began using Twitter as a replacement for my RSS reader in 2008, which revolutionized how I read and learned up to that point. Tweets from educators and free and open source (FOSS) advocates worldwide kept me informed and engaged in a learning network that was without equal. That's changed over the past half dozen years, and recently a change in ownership and the shaping of what I read was driven more by an algorithm than by my personal interests and choices. During a yearly meetup of correspondents and editors of Opensource.com a few years ago, [Seth Kenlon][1] suggested giving [Mastodon][2] a try. I joined [Fosstodon][3] in 2019. Fosstodon is a Mastodon instance for a community of like-minded people who enjoy free and open source software.
|
||||
|
||||
### Mastodon vs Twitter
|
||||
|
||||
Change is not easy. Being a creature of habit, I stayed with my old standby even though it was becoming increasingly tiresome. The threat of its sale in the spring of 2022 invited me to reconsider Fosstodon.
|
||||
|
||||
### 1. Favorite instead of like
|
||||
|
||||
The Mastodon interface is similar to Twitter. Rather than "liking" a post, you "favorite" a post on Mastodon by clicking the star icon under the post content.
|
||||
|
||||
![Favorite button][4]
|
||||
|
||||
### 2. Share a post
|
||||
|
||||
Re-sharing on my old network is a "retweet," but on Mastodon, it's a "boost." You click the double-arrow icon under the post content to boost a post.
|
||||
|
||||
![Boost button][5]
|
||||
|
||||
### 3. Mastodon instances
|
||||
|
||||
Because anyone can run a Mastodon instance, different instances not only have unique communities (like the ones that form around specific hashtags on Twitter, but Mastodon also has hashtags). Some have a unique set of rules. For instance, unlike my former social network, there were content moderation rules on Fosstodon that seemed strict initially. I made a post unrelated to FOSS software, and my post was removed. I was told it had been removed because I'd not issued a "content warning." That irked me, so I looked for another instance and found a couple more to my liking. One was [Mastodon.social][6], and the other [Scholar.social][7]. The former is a general server with no expectation about what you will post. The latter was an instance dedicated to academics. In all cases, there are well-enforced codes of conduct.
|
||||
|
||||
Each instance has rules, and while they differ slightly in the description, they clearly spell out what is and is not acceptable behavior. Fosstodon published its [code of conduct][8], which established the rules and expectations of behavior on the site.
|
||||
|
||||
### 4. Open source social networking
|
||||
|
||||
If you want to run your own Mastodon instance or help develop one, you'll be happy to know that Mastodon is open source. It uses an AGPLv3 license, and its source code is available as a [Git repository][9]. The software provides a social network server that uses the [ActivityPub][10] protocol to communicate with other servers worldwide.
|
||||
|
||||
Mastodon is not a single site on the internet but a series of sites spanning the globe and communicating with each other. This federated network is referred to as the "fediverse." Unlike other social networks, where there's a single owner of the network, Mastodon and other ActivityPub sites are owned by anyone who runs a server.
|
||||
|
||||
From a user's perspective, this doesn't matter at first. You can sign up on any Mastodon instance and then connect to all other instances.
|
||||
|
||||
There is power to this distributed design, though. If you encounter an instance with a community producing content you'd rather not see, you can block either a single user from that instance or the whole instance.
|
||||
|
||||
In the past month, I've returned to Fosstodon primarily because open source is my passion. I enjoy sharing open source content on Fosstodon because the other users of Fosstodon are generally receptive to posts about free and open source software. When I have something to share that's not considered appropriate on Fosstodon, I share it on Scholar.social or Mastodon.social.
|
||||
|
||||
Not all instances have topics they focus on, and even those that do often use their topical interests as a guideline rather than grounds for strict removal of posts. If you have a particular interest, you might be able to find a community built around that topic, and you're likely to see that you have an instant audience. Of course, you'll still always be able to communicate with users of other instances, too.
|
||||
|
||||
### Try Mastodon
|
||||
|
||||
Mastodon is not a corporation. All of its instances are staffed and supported by each server's contributors. Some instances make it easy to support them with Patreon or PayPal.
|
||||
|
||||
I have found the fediverse a welcoming place that brings joy back into social networking. Have you joined Mastodon? What are your takeaways? Let us know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/twitter-vs-mastodon
|
||||
|
||||
作者:[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/users/seth
|
||||
[2]: https://joinmastodon.org/
|
||||
[3]: https://fosstodon.org/about/
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/favorite-button.webp
|
||||
[5]: https://opensource.com/sites/default/files/2022-11/boost-button.webp
|
||||
[6]: https://mastodon.social/about
|
||||
[7]: https://scholar.social/about/more
|
||||
[8]: https://hub.fosstodon.org/coc/
|
||||
[9]: https://github.com/mastodon/mastodon
|
||||
[10]: https://en.wikipedia.org/wiki/ActivityPub
|
@ -0,0 +1,147 @@
|
||||
[#]: subject: "Making Content that Resonates: An Interview with 'The Linux Cast' Creator, Matthew Weber"
|
||||
[#]: via: "https://news.itsfoss.com/interview-matthew-weber/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Making Content that Resonates: An Interview with 'The Linux Cast' Creator, Matthew Weber
|
||||
======
|
||||
|
||||
A conversation with Matthew Weber, the mastermind behind 'The Linux Cast' YouTube channel.
|
||||
|
||||
![Making Content that Resonates: An Interview with 'The Linux Cast' Creator, Matthew Weber][1]
|
||||
|
||||
If you have been following us, you probably know that we promised to interact with interesting personalities in the Linux and open-source world.
|
||||
|
||||
Here, we have Matthew, a **content creator** known for his "[**The Linux Cast**][2]" YouTube channel.
|
||||
|
||||
He creates podcasts and YouTube videos related to Linux, covering news and other exciting stuff.
|
||||
|
||||
As a fellow content creator, **I find his content very insightful** 🤓
|
||||
|
||||
We asked him a couple of questions that **should help Linux users and content creators in the Linux/Open-Source space gain some insights** from someone with an excellent level of experience.
|
||||
|
||||
**Q. The Linux Cast is an informative YouTube channel that we all love. What inspired you to start it?**
|
||||
|
||||
![thelinuxcast youtube channel][3]
|
||||
|
||||
**A:** My friend Ricky and I have been podcasting along with our friend Vince since **2009**. In 2017 we decided that we were going to switch to Linux and start a podcast. Ricky works in IT and has way more Linux know-how than I did at the time, so we thought it’d be **fun to start a podcast and see how it went**. We didn’t stick with it, doing only a few episodes in seasons 2017 and 2018.
|
||||
|
||||
In about July or August 2020, bored because of the pandemic, I visited the anchor page for the podcast and found to my surprise, that people were listening to it, each of our old episodes has hundreds of listens.
|
||||
|
||||
So, I decided to start it back up again. I found a new co-host in Martin and carried on. In **September 2020**, I decided **I’d start making a few YouTube videos to go along with the podcast**. That’s why the YouTube Channel exists.
|
||||
|
||||
It was started to host the podcast, and I threw some really, really bad videos up to see if I could draw in listeners. And then it just kind of took off.
|
||||
|
||||
**Q. Apart from The Linux Cast, what else do you do Linux-wise?**
|
||||
|
||||
**A:** I’m beginning to **learn Python**, which has been fun. I also have started to **care more about privacy lately**, so I’ve been working on interesting FOSS-related ways of tackling that problem as well.
|
||||
|
||||
12 Simple Tools to Protect Your PrivacyQuick ways to enhance online privacy? Use these simple tools to take control of your data easily.![][4]It's FOSSAnkush Das![][5]
|
||||
|
||||
**Q. Do you have any other plans that you want to share with our readers for your channel/blog?**
|
||||
|
||||
![youtube illustration][6]
|
||||
|
||||
My main goal for the channel is just to keep getting better at making videos. It sounds kind of lame, but I do want to improve the production quality while retaining the style that I have. I can’t script a video to save my life, so I know that’s not in the cards, but I’d like to just improve at video making. I’d also like to live stream more. I’ve done that in the past, but as a New Year’s resolution, I’ve decided to start my Sunday night streams up again.
|
||||
|
||||
‘Don’t be Afraid to Contribute’: Mirko Brombin Talks about Vanilla OS and Other Future ProjectsA conversation with Mirko Brombin, founder of Vanilla OS and Bottles creator.![][7]It's FOSS NewsAnkush Das![][8]
|
||||
|
||||
**Q. I noticed that you love i3 window manager. For someone new to the concept, what tip would you give to get them started? And why do you think they should give it a try?**
|
||||
|
||||
**A:** Tiling window managers aren’t for everyone, butI think everyone should try one at least once (after all, how do you know you don’t like it unless you try?). If you, dear reader, **find yourself wanting to use the keyboard to navigate Linux, a tiling window manager is probably a good choice.**
|
||||
|
||||
Now as for why i3 itself is great, I like it because I’ve spent so much time in it and I have spent most of my time configuring it. That means I have all the keybindings and such just the way I like them and everything is properly customized just to my liking.It has taken ages to get here, but it’s a fun process. **i3wm is great because it’s not fussy like DWM or Xmonad (both are coded and configured in actual programming languages, which makes them harder to configure)**, and it’s not as odd as something like bspwm. It’s simple and has just enough features to make it good.
|
||||
|
||||
![][9]
|
||||
|
||||
As for a tip? Would it be rude to say **watch my videos on i3**? Probably. My best tip for anyone wanting to get into i3 (or any tiling window manager, really), is to **try it in a VM first**. Get it installed and start to customize. Don’t give up when you hit the first problem; push through and make it yours.
|
||||
|
||||
The best part about i3 and other window managers is that you can customize them in an infinite number of ways. Linux fans love to claim that Linux is all about customization, but **until you’ve used a window manager, you’ve never really experienced that freedom**.
|
||||
|
||||
**Q. For someone who switched from Arch to Fedora, what would you suggest for someone deciding between the two?**
|
||||
|
||||
![arch fedora illustration][10]
|
||||
|
||||
**A:****Try both. I preach this all the time**, but the distro I use should make no difference on the distro you choose. I have a hardware setup that is different than yours, and yours is different than someone else’s. That means that every distro is going to run differently on your hardware.
|
||||
|
||||
As for Arch VS. Fedora, the big difference comes down to package managers and versioning of software. **Arch will have slightly newer software than Fedora**, and it has the AUR. Fedora is a more traditional release-based distro, but it still has newer software than something like Debian.
|
||||
|
||||
Getting Started With FedoraCollection of useful tutorials for new Fedora users.![][11]It's FOSSAbhishek Prakash![][12]
|
||||
|
||||
So, choosing between them really comes down to answering two questions: **do you need the latest software and do you need the AUR? This is why I say try both** because you need to experience the AUR before you can decide if you like it or not.
|
||||
|
||||
But mostly, **Fedora is easier to use, and I think it’s slightly more stable than Arch**, which is why I've chosen it as my daily driver.
|
||||
|
||||
**Q. What are your thoughts on “the year of Linux desktop” for 2023?**
|
||||
|
||||
![year of linux desktop][13]
|
||||
|
||||
**A:** 2022 was the year of the Linux Desktop. Last year was the year when Linux made it, and it’s all because of the Steam Deck. Linux is never going to compete with Windows in tems of market share. But it arrived last year as a consumer product for the first time (unless you count Android, which I do not).
|
||||
|
||||
I think 2023 will just be a continuation of that. Slow and steady growth. That’s where it’s at. Anyone wanting an explosion of people using Linux on the Desktop is and always has been asking for disappointment.
|
||||
|
||||
**Q. With a blog, YouTube channel, podcast, and writing, how do you manage your time or remain productive?**
|
||||
|
||||
![the linux cast pc setup][14]
|
||||
|
||||
**A: Todo lists and a bullet journal**. I’ve found that if I keep a list of things I have to do, I will get them done. And I ensure that I spend plenty of time doing things for fun and spending time away from my computer. If all I do is work, I get burned out, so really, it’s all about **ensuring that there is a balance there**.
|
||||
|
||||
**Q. What do you do in your spare time?** **A:****Fanfiction and reading books** mostly. I read a ton. I also enjoy watching sports. I’m a **Philadelphia Eagles fan**, a fan of the Golden State Warriors, and I’m an alumnus of Michigan State University, so I cheer for them when it comes to college sports.
|
||||
|
||||
![book sports illustration][15]
|
||||
|
||||
I also spend a terrible amount of time on YouTube. I’m slowly getting this down to a reasonable amount of time, but in the past, I’d definitely spend more time there than I should.
|
||||
|
||||
**Q. How do you see the future as a Linux content creator?**
|
||||
|
||||
**A:** Change is inevitable, but predicting it is hard. I think **we’re going to see more Linux in the world, and that makes me happy as a Linux content creator**. Over the last two years, I’ve seen many people create their own Linux channels and I think that’s great. The more people cover Linux on YouTube and the web in general, the better.
|
||||
|
||||
Obviously, the big thing for all of us in the next year or so is the **continued transition to Wayland**. Most big DEs have gone to it now, which is great. Now it’s going to be the turn of the window manager. We’ll see how all that plays out.
|
||||
|
||||
I also think we’ll see **more and more immutable distros out there, like Silverblue and OpenSuse’s Micro**. That seems to be where Linux is heading, which should make things very interesting for everyone, content creator or not.
|
||||
|
||||
**Q. Is there a message you would like to give our readers who aim to work in the Linux/Open-Source space as a content creators?**
|
||||
|
||||
![message to readers illustration][16]
|
||||
|
||||
**A:** The hardest part is starting. **Don’t let dreams of being DistroTube, Chris Titus, or The Linux Experiment stop you from continuing once you start**. If you start making videos, those first few months or even years can be rough, especially if you look at those big guys and compare your subscriber count to theirs. It isn’t a competition.
|
||||
|
||||
The thing that I’ve learned if I’ve learned anything, is that **consistency in posting is the best thing you can do**. Post on a predictable schedule (I did every day for a long time, but two or three times a week will work too). The more you post, the better you’ll be (though don’t do more than one a day).
|
||||
|
||||
And finally, **don’t do it if you’re not having fun doing it**. Not many YouTubers can make this a full-time job, so if you’re doing it for the money, then you shouldn’t do it. Being able to be that successful is very much like winning the lottery; it probably isn’t going to happen. So do it for fun. Do it on a schedule that you can keep up long term and still keep it fun. **Make content that you enjoy**, because then others will enjoy it too. If you remember to keep it fun, the viewers will come.
|
||||
|
||||
> 💭 Share your thoughts on the interview and if you want us to talk to your favorite open-source/Linux creator, feel free to mention them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/interview-matthew-weber/
|
||||
|
||||
作者:[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/content/images/size/w2000/2023/01/interview-with-the-linux-cast.png
|
||||
[2]: https://www.youtube.com/@TheLinuxCast
|
||||
[3]: https://news.itsfoss.com/content/images/2023/01/thelinuxcast.jpg
|
||||
[4]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
|
||||
[5]: https://itsfoss.com/content/images/wordpress/2022/02/privacy-tools-ft.jpg
|
||||
[6]: https://news.itsfoss.com/content/images/2023/01/youtube-illustration-1.png
|
||||
[7]: https://news.itsfoss.com/content/images/size/w256h256/2022/08/android-chrome-192x192.png
|
||||
[8]: https://news.itsfoss.com/content/images/2022/12/interview-with-mirko-brombin.png
|
||||
[9]: https://news.itsfoss.com/content/images/2023/01/linux-i3wm--1-.png
|
||||
[10]: https://news.itsfoss.com/content/images/2023/01/arch-fedora-illustration-1.png
|
||||
[11]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png
|
||||
[12]: https://itsfoss.com/content/images/2023/01/fedora-tutorials.png
|
||||
[13]: https://news.itsfoss.com/content/images/2023/01/year-of-linux-desktop-2023.png
|
||||
[14]: https://news.itsfoss.com/content/images/2023/01/linux-cast-setup.png
|
||||
[15]: https://news.itsfoss.com/content/images/2023/01/sports-book-hobby.png
|
||||
[16]: https://news.itsfoss.com/content/images/2023/01/message-to-readers.png
|
@ -1,100 +0,0 @@
|
||||
[#]: subject: "Pandas: The Popular Python Library for Data Analysis and Data Science"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/08/pandas-the-popular-python-library-for-data-analysis-and-data-science/"
|
||||
[#]: author: "Phani Kiran https://www.opensourceforu.com/author/phani-kiran/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Pandas: The Popular Python Library for Data Analysis and Data Science
|
||||
======
|
||||
|
||||
*Pandas is a popular Python library. This article describes a few features and functions available in this library, and encourages readers to use it for practical business problems.*
|
||||
|
||||
Pandas provides fundamental and high-level building blocks for practical, real world data analysis in Python. It is one of the most powerful and flexible open source tools for data analysis and manipulation, and provides data structures for modelling and manipulating tabular data (data in rows and columns).
|
||||
|
||||
Pandas has two primary data structures. The first is a ‘series’ data structure that helps to retrieve data from the array or dictionary of Python objects. Data can be retrieved either by position or by specifying the index name. The second is the ‘dataframes’ data structure to store data in rows and columns. Columns have column names and rows are accessed using indexes. Columns can have different types of data including lists, dictionaries, pandas series, another dataframe, NumPy arrays, etc.
|
||||
|
||||
### Processing various file types
|
||||
|
||||
Data is often available in various formats. It is imperative that the tool used for data analysis is able to provide a wide range of methods for handling it.
|
||||
|
||||
With Pandas, one can read various file types like CSV, JSON, XML, Parquet, SQL (see Table 1).
|
||||
|
||||
| | Write | Read |
|
||||
| :- | :- | :- |
|
||||
| CSV | to_csv | read_csv |
|
||||
| JSON | to_json | Read_json |
|
||||
| Parquet | to_parquet | read_parquet |
|
||||
| SQL | to_sql | read_sql, read_sql_query, read_sql_table |
|
||||
| XML | to_xml | read_xml |
|
||||
|
||||
### Data cleansing using Pandas
|
||||
|
||||
In real-world scenarios, data is often incomplete and includes bad data. It is sometimes duplicated. Also, data includes sensitive and confidential information, which needs to be masked. Pandas offers ways to handle bad data by using methods like cleaning, dropping, replacing, masking, etc.
|
||||
|
||||
a. Empty rows can be removed with the *df.dropna(inplace=True)* operation.
|
||||
|
||||
b. Empty values can be replaced with *df.fillna(<value>, inplace=True)*. We can specify the column name to be placed in a particular column.
|
||||
|
||||
c. You can mask the values for sensitive and non-public data for all items NOT satisfying the condition *my_list.where(my_list < 5)*. Masking of values satisfying the condition can be done with*my_list.mask(my_list < 5)*.
|
||||
|
||||
d. Duplicates can be dropped from a dataframe using:
|
||||
|
||||
```
|
||||
df.drop_duplicates(‘<column>’, keep = False)
|
||||
df.drop_duplicates(‘<column>’, keep = ‘first’)
|
||||
df.drop_duplicates(‘<column>’, keep = ‘last’)
|
||||
```
|
||||
|
||||
### Data analysis using Pandas
|
||||
|
||||
Table 2 lists the various functions in Pandas that perform data analysis as well as the syntax for usage. (Note: df stands for dataframe.)
|
||||
|
||||
| Function | Description | Syntax |
|
||||
| :- | :- | :- |
|
||||
| Head | Head() function returns the first five rows | df.head(x) |
|
||||
| tail | tail() function returns the last five rows by default | df.tail(x) |
|
||||
| Loc | Loc function returns a particular row. Slicing of the data is also possible | loc(x:y) |
|
||||
| Groupby | Groups data on a particular column | groupby(‘<column>’) |
|
||||
| Sum | Sum of values in a particular column | df[‘column’].sum() |
|
||||
| Mean | Average of values in a particular column | df[‘column’]. mean() |
|
||||
| Min | Minimum value in a particular column | df[‘column’].min() |
|
||||
| Max | Maximum value in a particular column | df[‘column’].max() |
|
||||
| Sort | Sorts dataframe in a column | df.sort_values([‘column’]) |
|
||||
| Size | Rows * columns | df.size |
|
||||
| Describe | Describes details of the dataframe | df.describe |
|
||||
| Crosstab | Creates a frequency tabulation of rows and columns | pd.crosstab(df[‘column1’], df[‘column2’], margins = True) |
|
||||
| Duplicated | Returns True or False based on duplicate values in Column1 and Column2 | df.duplicated([column1, ‘column2’]) |
|
||||
|
||||
### Advantages of Pandas
|
||||
|
||||
* It supports multi-index (hierarchical index) used for easy analysis of data having a large number of dimensions.
|
||||
* It supports the creation of pivot tables, stack and unstack operations.
|
||||
* Categorical data containing finite values can be processed with Pandas.
|
||||
* It supports grouping and aggregations.
|
||||
* Sorting can be explicitly disabled.
|
||||
* It supports filtering at both row-level (gets the rows satisfying the filter condition) and column-level (selects only the required columns).
|
||||
* Helps in reshaping of data sets. You can also transpose the values of the array and convert to a List. When you are processing data using Python, you can convert the Pandas dataframe to a multi-dimensional NumPy array; the values member variable is used for this.
|
||||
* Supports label-oriented slicing of data.
|
||||
|
||||
### The disadvantages
|
||||
|
||||
The code and syntax of Pandas is different from Python, which leads to a steep learning curve for some users. Also, a few concepts like three dimensional data are better handled in other libraries like NumPy.
|
||||
|
||||
Pandas really elevates the data analysis process in an efficient manner. Its compatibility with other libraries makes it very conducive for use in various scenarios.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/08/pandas-the-popular-python-library-for-data-analysis-and-data-science/
|
||||
|
||||
作者:[Phani Kiran][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/phani-kiran/
|
||||
[b]: https://github.com/lkxed
|
@ -1,213 +0,0 @@
|
||||
[#]: subject: "How to Analyse Sentiments Using Machine Learning"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/09/how-to-analyse-sentiments-using-machine-learning/"
|
||||
[#]: author: "Jishnu Saurav Mittapalli https://www.opensourceforu.com/author/jishnu-saurav-mittapalli/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Analyse Sentiments Using Machine Learning
|
||||
======
|
||||
This article will help you understand the concept of sentiment analysis and learn how it is done. It uses different machine learning algorithms for sentiment analysis, and then compares them to decide which one is the best for the particular problem described here.
|
||||
|
||||
Sentiment analysis is a major area in the field of natural language processing. A sentiment is any opinion or feeling that we have about an event, a product, a situation or anything else. Sentiment analysis is the field of research in which human sentiments are automatically extracted from the text. This field started evolving in the early 90s.
|
||||
|
||||
This article will help you understand how machine learning (ML) can be used for sentiment analysis, and compare the different ML algorithms that can be used. It does not try to improve the performance of any of the algorithms or methods.
|
||||
|
||||
In today’s fast paced world, everything is online and everyone can post their views. A few negative online comments may hurt a company’s reputation and, thereby, its sales. Now that everything’s online, everyone can post their views and opinions. It becomes very important for companies to go through these to understand what their customers really want. But since there is so much data, it cannot be gone through manually. This is where sentiment analysis comes in.
|
||||
|
||||
Let us now start developing a model to do a basic sentiment analysis.
|
||||
|
||||
### Let’s start!
|
||||
|
||||
The first step is to select a data set. You can choose from any publicly available reviews or comments such as tweets or movie reviews. The two columns that should definitely be there in the data set are the label and the actual piece of text.
|
||||
|
||||
Figure 1 shows a small sample of how the data looks.
|
||||
|
||||
![Figure 1: Data sample][1]
|
||||
|
||||
Now we need to import the required libraries:
|
||||
|
||||
```
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from nltk.stem.porter import PorterStemmer
|
||||
import re
|
||||
import string
|
||||
```
|
||||
|
||||
As you can see in the above code, we have imported NumPy and Pandas for processing the data. We will look at the other imported libraries when we use them.
|
||||
|
||||
Now that the data set is ready and the libraries are imported, we need to bring the former into our project. The Pandas library is used for this purpose. We bring the data set into the Pandas data frame using the following line of code:
|
||||
|
||||
```
|
||||
sentiment_dataframe = pd.read_csv(“/content/drive/MyDrive/Data/sentiments - sentiments.tsv”,sep = ‘\t’)
|
||||
```
|
||||
|
||||
Now that we have the data set in our project, let us manipulate it so that our algorithm can understand the features better. We begin by giving names to our columns in the data set. This is done by using the line of code given below:
|
||||
|
||||
```
|
||||
sentiment_dataframe.columns = [“label”,”body_text”]
|
||||
```
|
||||
|
||||
We then assign numerical labels to the classes — negative is replaced with 1 and positive is replaced with 0. Figure 2 shows how the data frame looks at this stage.
|
||||
|
||||
![Figure 2: Data frame with basic modifications][2]
|
||||
|
||||
The next step is the preprocessing of the data. This is a very important step as it helps us to convert string/text data into numerical data (machine learning algorithms can understand/process numerical data and not text). Also, the redundant and useless data needs to be removed as it may taint our training model. We remove the noisy data, missing values and other non-consistent data in this step.
|
||||
|
||||
We will add the features text length and punctuation count in the data frame specifically for this application. We will also do the stemming, i.e., we will convert all similar words (like ‘give’, ‘giving’, etc) into a single form. Once this is done, we divide the data set into two — X and Y — where X is the features and Y is the prediction class.
|
||||
|
||||
This is done using the following piece of code. Figure 3 shows the data frame after these steps are taken.
|
||||
|
||||
![Figure 3: Data frame after the division of the data set][3]
|
||||
|
||||
```
|
||||
def count_punct(text):
|
||||
count = sum([1 for char in text if char in string.punctuation])
|
||||
return round(count/(len(text) - text.count(“ “)),3)*100
|
||||
|
||||
tokenized_tweet = sentiment_dataframe[‘body_text’].apply(lambda x: x.split())
|
||||
stemmer = PorterStemmer()
|
||||
tokenized_tweet = tokenized_tweet.apply(lambda x: [stemmer.stem(i) for i in x])
|
||||
for i in range(len(tokenized_tweet)):
|
||||
tokenized_tweet[i] = ‘ ‘.join(tokenized_tweet[i])
|
||||
sentiment_dataframe[‘body_text’] = tokenized_tweet
|
||||
sentiment_dataframe[‘body_len’] = sentiment_dataframe[‘body_text’].apply(lambda x:len(x) - x.count(“ “))
|
||||
sentiment_dataframe[‘punct%’] = sentiment_dataframe[‘body_text’].apply(lambda x:count_punct(x))
|
||||
X = sentiment_dataframe[‘body_text’]
|
||||
y = sentiment_dataframe[‘label’]
|
||||
```
|
||||
|
||||
We now need to convert the string into numerical data. We use a count vectorizer for this purpose; that is, we get the counts of each word and convert it into a vector.
|
||||
|
||||
After this, features such as length of text and punctuation count in the dataframe, i.e., X, are calculated. A sample of X is shown in Figure 4.
|
||||
|
||||
![Figure 4: Sample of final features][4]
|
||||
|
||||
Now the data is ready for training. The next step is to determine which algorithms we are going to use for training our model. As has been mentioned before, we are going to try several algorithms and determine the best one for sentiment analysis. Since we are basically trying to do binary classification, the following algorithms can be used:
|
||||
|
||||
* K-nearest neighbors (KNN)
|
||||
* Logistic regression
|
||||
* Support vector machines (SVMs)
|
||||
* Stochastic gradient descent
|
||||
* Naive Bayes
|
||||
* Decision tree
|
||||
* Random Forest
|
||||
|
||||
We first need to split our data set into testing and training data. This is done by using the sklearn library using the following code:
|
||||
|
||||
```
|
||||
from sklearn.model_selection import train_test_split
|
||||
X_train, X_test, y_train, y_test = train_test_split(X,y, test_size = 0.20, random_state = 99)
|
||||
```
|
||||
|
||||
We will use 20 per cent of the data for testing and 80 per cent for the training part. We will separate the data because we want to test on a new set of data whether our model is working properly or not.
|
||||
|
||||
Now let us start with the first model. We will try the KNN algorithm first, and use the sklearn library for this. We will first train the model and then assess its performance (all of this can be done using the sklearn library in Python itself). The following piece of code does this, and we get an accuracy of around 50 per cent.
|
||||
|
||||
```
|
||||
from sklearn.neighbors import KNeighborsClassifier
|
||||
model = KNeighborsClassifier (n_neighbors=3)
|
||||
model.fit(X_train, y_train)
|
||||
model.score (X_test,y_test)
|
||||
|
||||
0.5056689342403629
|
||||
```
|
||||
|
||||
The code is similar in the logistic regression model — we first import the function from the library, fit the model, and then test it. The following piece of code uses the logistic regression algorithm. The output shows we got an accuracy of around 66 per cent.
|
||||
|
||||
```
|
||||
from sklearn.linear_model import LogisticRegression
|
||||
model = LogisticRegression()
|
||||
model.fit (X_train,y_train)
|
||||
model.score (X_test,y_test)
|
||||
|
||||
0.6621315192743764
|
||||
```
|
||||
|
||||
The following piece of code uses SVM. The output shows we got an accuracy of around 67 per cent.
|
||||
|
||||
```
|
||||
from sklearn import svm
|
||||
model = svm.SVC(kernel=’linear’)
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6780045351473923
|
||||
```
|
||||
|
||||
The following piece of code uses the Random Forest algorithm, and we get an accuracy of around 69 per cent.
|
||||
|
||||
```
|
||||
from sklearn.ensemble import RandomForestClassifier
|
||||
model = RandomForestClassifier()
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6938775510204082
|
||||
```
|
||||
|
||||
Next we use the Decision tree algorithm, which gives an accuracy of around 61 per cent.
|
||||
|
||||
```
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
model = DecisionTreeClassifier()
|
||||
model = model.fit(X_train,y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6190476190476191
|
||||
```
|
||||
|
||||
The following piece of code uses the stochastic gradient descent algorithm. The output shows that we got an accuracy of around 49 per cent.
|
||||
|
||||
```
|
||||
from sklearn.linear_model import SGDClassifier
|
||||
model = SGDClassifier()
|
||||
model = model.fit(X_train,y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.49206349206349204
|
||||
```
|
||||
|
||||
The following piece of code uses Naive Bayes. We get an accuracy of around 60 per cent.
|
||||
|
||||
```
|
||||
from sklearn.naive_bayes import GaussianNB
|
||||
model = GaussianNB()
|
||||
model.fit(X_train, y_train)
|
||||
model.score(X_test,y_test)
|
||||
|
||||
0.6009070294784581
|
||||
```
|
||||
|
||||
Now that we have checked out all the algorithms, let us graph their accuracy performance. The graph is shown in Figure 5.
|
||||
|
||||
![Figure 5: Accuracy performance of the different algorithms][5]
|
||||
|
||||
As you can see, the random forest algorithm gave the best accuracy for this problem and we can conclude that it is the best fit for sentiment analysis amongst ML algorithms. We can improve the accuracy much more by getting better features, trying out other vectorising techniques, and using a better data set or newer classification algorithms.
|
||||
|
||||
Now that random forest is seen as the best algorithm for this problem, I am going to show you a sample prediction. In Figure 6, you can see that the right predictions are being made! Do try this out to improve upon this project!
|
||||
|
||||
![Figure 6: Sample predictions made][6]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/09/how-to-analyse-sentiments-using-machine-learning/
|
||||
|
||||
作者:[Jishnu Saurav Mittapalli][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/jishnu-saurav-mittapalli/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-1-Data-sample.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-2-Data-frame-with-basic-modifications-3.jpg
|
||||
[3]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-3-Data-frame-after-the-division-of-the-data-set.jpg
|
||||
[4]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-4-Sample-of-final-features.jpg
|
||||
[5]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-5-Accuracy-performance-of-the-different-algorithms.jpg
|
||||
[6]: https://www.opensourceforu.com/wp-content/uploads/2022/07/Figure-6-Sample-predictions-made.jpg
|
@ -1,115 +0,0 @@
|
||||
[#]: subject: "Give your Terminal a Retro Look Using this Neat Application"
|
||||
[#]: via: "https://www.debugpoint.com/cool-retro-terminal/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Give your Terminal a Retro Look Using this Neat Application
|
||||
======
|
||||
|
||||
**Want to give your Terminal a retro look? This guide contains instructions to help you to install Cool Retro Terminal application in all Linux distributions.**
|
||||
|
||||
![Cool Retro Terminal][1]
|
||||
|
||||
Cool Retro Terminal
|
||||
|
||||
Have you ever wondered how you can mimic the look of those old CRT monitors displayed in your Linux terminal?
|
||||
|
||||
Those CRT screens have their own fan base. Like the Apple 2 or the IBM 3278 terminals – they are really cool looking if you compare them to today’s 4K monitor displays. I am not saying 4K is bad, but sometimes legacy displays remind us of those bygone days. Enough of these ramblings. Let’s get started installing the app.
|
||||
|
||||
### Cool Retro Term
|
||||
|
||||
The application is free and open-sourced. And it is called [cool-retro-term][2]. It is lightweight and has many customization options with pre-set profiles, such as Apple 2, etc. It also gives you those static noises and scan-lines effects in your terminal. Cool, isn’t it?
|
||||
|
||||
It is built in Qt and requires Qt 5.2 and higher. If you are using the latest Linux distributions, you should be good in terms of dependencies.
|
||||
|
||||
![Green Scanlines Theme][3]
|
||||
|
||||
Green Scanlines Theme
|
||||
|
||||
### How to Download and Install Cool Retro Terminal
|
||||
|
||||
#### Ubuntu, Linux Mint and other Debian-based distributions
|
||||
|
||||
The following simple command will install this application in your Ubuntu and other related distributions.
|
||||
|
||||
```
|
||||
sudo apt install cool-retro-term
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
This package is available in Arch User Repository AUR. If you do not have AUR enabled, enable it using [this guide][4] and then use the following commands to install it.
|
||||
|
||||
```
|
||||
pacman -S cool-retro-term
|
||||
```
|
||||
|
||||
#### Fedora, RHEL and other related distributions
|
||||
|
||||
For Fedora and other related Linux, use the following command to install this app.
|
||||
|
||||
```
|
||||
sudo dnf install cool-retro-term
|
||||
```
|
||||
|
||||
#### Appimage
|
||||
|
||||
A self-contained executable as AppImage is also available, which you can just download and run. No installation is required. Follow the below commands to do that.
|
||||
|
||||
```
|
||||
wget https://github.com/Swordfish90/cool-retro-term/releases/download/1.1.1/Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
chmod a+x Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
./Cool-Retro-Term-1.1.1-x86_64.AppImage
|
||||
```
|
||||
|
||||
Note: Version 1.2.0 onwards there are no AppImage build in the GitHub.
|
||||
|
||||
### Configurations
|
||||
|
||||
After the installation is finished, you can find the terminal application “Cool Retro Term” in the application menu. So, launch the application and enjoy.
|
||||
|
||||
Remember, this is not overriding your default console/terminal application in your Linux distributions. It is a stand-alone console application.
|
||||
|
||||
The configuration options are available via the Right Click context menu.
|
||||
|
||||
The context menu gives you the following pre-sets. You can then configure each of them for colour, and appearance settings via the settings window. For example, if you want more transparency, contrast or more noise, ambient light or flickering – all of them can be configured from the below settings window via several options.
|
||||
|
||||
And easily you can make your own theme.
|
||||
|
||||
![Pre-loaded Themes in Cool Retro Term][5]
|
||||
|
||||
Pre-loaded Themes in Cool Retro Term
|
||||
|
||||
![Various Effects in Settings][6]
|
||||
|
||||
Various Effects in Settings
|
||||
|
||||
### Summary
|
||||
|
||||
Cool Retro Terminal is an old tube-style terminal for Linux desktops that allows you to experience it as if you are sitting in front of a retro terminal. You may or may not like it, and one hardly uses it for a daily driver. But still, a nice-looking terminal to experience from time to time to get away from the mundane terminal.
|
||||
|
||||
Do you like the retro look? What is your favourite theme? Let me know in the comment section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/cool-retro-terminal/
|
||||
|
||||
作者:[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/2021/12/cool-retro-terminal-1024x576.jpg
|
||||
[2]: https://github.com/Swordfish90/cool-retro-term
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/12/Green-Scanlines-Theme-1024x594.jpg
|
||||
[4]: https://www.debugpoint.com/2021/01/install-yay-arch/
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/12/Pre-loaded-Themes-in-Cool-Retro-Term-1024x599.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2021/12/Various-Effects-in-Settings.jpg
|
@ -1,134 +0,0 @@
|
||||
[#]: subject: "10 universal steps for open source code review"
|
||||
[#]: via: "https://opensource.com/article/22/10/code-review"
|
||||
[#]: author: "Martin Kopec https://opensource.com/users/martin-kopec"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
10 universal steps for open source code review
|
||||
======
|
||||
|
||||
Code review doesn't have to be scary when you follow this universal process.
|
||||
|
||||
Have you ever found yourself in a situation where you needed to do a code review but didn't fully understand the project? Maybe you did not review it to avoid looking like you didn't know what you were doing.
|
||||
|
||||
This article assures you that there's a better way. You don't need to know everything to provide a code review. In fact, based on my experience, that's quite common.
|
||||
|
||||
I remember when I joined Red Hat as an intern and was asked to help with code reviews. We used a system of +1 or -1 votes, and I was initially very hesitant to weigh in. I found myself asking whether when I gave a +1 on a change but then someone else voted -1, would I look foolish?
|
||||
|
||||
What does happen if someone votes -1 on a change you've vote +1? The answer is nothing! You might have missed a detail that the other person noticed. It's not the end of the world. That's why we have this voting system. Like the rest of open source, merging code is a collaborative effort.
|
||||
|
||||
Lately, I've been so inundated with code reviews that I can hardly keep up with them. I also noticed that the number of contributors doing these reviews steadily decreased.
|
||||
|
||||
For this reason, I'm writing about my point of view on writing a code review. In this article, I'll share some helpful tips and tricks. I'll show you a few questions you should ask yourself and a few ideas of what to look for when doing a code review.
|
||||
|
||||
### What is the purpose of a code review?
|
||||
|
||||
Have you ever written a really simple patch? Something you think is so trivial that it doesn't require a review? Maybe you merged it straight away. Later, it turns out there was a mistake, something obvious or silly, like the wrong indentation or a few duplicated lines of code instead of a function call (yes, I'm speaking from experience!).
|
||||
|
||||
A code review by someone else would have caught these things.
|
||||
|
||||
The point of a code review is to bring a fresh pair of eyes with a new perspective on the problem you're trying to solve. That new context is exactly the reason a code review is crucial.
|
||||
|
||||
You may think that you must be an expert in the language to review someone else's code, the project, or both. Here's a secret all code reviewers want you to know: That's wrong! You don't need to fully understand the project or the language to provide a fresh perspective on a change. There's a universal process of code review.
|
||||
|
||||
### The universal process of a code review
|
||||
|
||||
Here's my process for code review, grouped into a couple of points. The process provides questions I ask myself to help me focus on a code change and its consequences. You don't need to go in this specific order. If there's a step, you can't execute for any reason, just move to another step.
|
||||
|
||||
### 1. Understand the change, what it's trying to solve, and why
|
||||
|
||||
The explanation of why the change is needed and any relevant context should be in the commit message. If it isn't, request it and feel free to -1 until it's provided.
|
||||
|
||||
Is it something that needs to be solved? Is it something the project should focus on, or is it completely out of scope?
|
||||
|
||||
### 2. How would you implement the solution? Would it be different?
|
||||
|
||||
At this point, you know what the code change is about. How would you have done it? Think about this before reviewing the change in detail. If the solution you have in mind is different from the one you're reviewing, and you think it's better, bring that up in the review. You don't need to -1 it; just ask why the author didn't go in this direction and see how the discussion evolves.
|
||||
|
||||
### 3. Run the code with and without the change
|
||||
|
||||
I usually put a few breakpoints into the code, run it, and inspect how the new code interacts with the rest.
|
||||
|
||||
If you can't run the whole code, try to copy the function containing the new code to a new local file, simulate the input data, and run that. This is helpful when you either don't know how to run the whole project or when it requires a specific environment to which you don't have access.
|
||||
|
||||
### 4. Can the new code break anything?
|
||||
|
||||
I mean, really anything. Think about the consequences.
|
||||
|
||||
In the case of a new command-line option, will it always be accepted by the target?
|
||||
|
||||
Can a situation occur when the option wouldn't be accepted or when it could conflict with something?
|
||||
|
||||
Maybe it's a new import. Is the new library, and possibly a new dependency, available in the older releases or systems you ship the project for?
|
||||
|
||||
What about security? Is the new dependency safe to use? The least you can do is run a quick Internet search to find out. Also, look for warnings in the console log. Sometimes there are more secure methods within the same library.
|
||||
|
||||
### 5. Is the code effective?
|
||||
|
||||
You've determined that the proposed solution is probably correct. Now it's time to check the code itself, its effectiveness, and its necessity.
|
||||
|
||||
Check the style of the new code. Does it match the style of the project? Any open source project has (or should have) a document informing (new) contributors about the styles and good practices the project follows.
|
||||
|
||||
For instance, every project in the OpenStack community has a HACKING.rst file. There's often also [a guide for new contributors][1] with all the must-know information.
|
||||
|
||||
### 6. Check that all new variables and imports are used
|
||||
|
||||
Often, there have been many iterations of the code you're reviewing, and sometimes the final version is very different from when it started. It's easy to forget an import or a new variable that was needed in a former version of the new code. Automation usually checks these things using linting tools like [flake8][2] in the case of Python code.
|
||||
|
||||
Can you rewrite the code without declaring new variables? Well, usually, yes, but the question is whether it's better that way. Does it bring any benefit? The goal isn't to create as many one-liners as possible. The goal is to write code that is both efficient and easy to read.
|
||||
|
||||
### 7. Are the new functions or methods necessary?
|
||||
|
||||
Is there a similar function that can be reused somewhere in the project? It's always worth helping to avoid reinventing the wheel and re-implementing logic that's already been defined.
|
||||
|
||||
### 8. Are there unit tests?
|
||||
|
||||
If the patch adds a new function or new logic in a function, it should also include new unit tests for that. It's always better when the author of a new function also writes unit tests for it.
|
||||
|
||||
### 9. Verify refactoring
|
||||
|
||||
If the commit refactors existing code (it renames a variable, changes variable scope, changes the footprint of a function by adding or removing arguments, or removes something), ask yourself:
|
||||
|
||||
- Can this be removed? Will it affect the stable branch?
|
||||
- Are all the occurrences deleted?
|
||||
|
||||
You can use the [grep command][3] to find out. You wouldn't believe how many times I've voted -1 just because of this. This is a simple mistake that anyone can make, but that also means anyone can uncover it.
|
||||
|
||||
The owner of the commit can easily overlook these things, which is totally understandable. It's happened to me many times too. I'd finally figured out the root of the problem I'd been fixing, so I was in a rush to propose the review, and then I forgot to check the whole repo.
|
||||
|
||||
Apart from the project's repository, sometimes it's also necessary to check other code consumers. If some other project imports this one, they may need refactoring, too. In the OpenStack community, we have a tool that searches across every community project.
|
||||
|
||||
### 10. Does project documentation need to be modified?
|
||||
|
||||
Again, you can use the [grep command][4] to check whether the project documentation mentions anything related to the code change. Apply common sense to determine whether a change needs to be documented for end users or it's just an internal change that doesn't affect user experience.
|
||||
|
||||
### Bonus tip: Be considerate
|
||||
|
||||
Be considerate, precise, and descriptive if you make a suggestion or comment on something after you've reviewed the new code. Ask questions if you don't understand something. If you think the code is wrong, explain why you think so. Remember, the author can't fix it if they don't know what's broken.
|
||||
|
||||
### Final words
|
||||
|
||||
The only bad review is no review. By reviewing and voting, you provide your point of view and vote only for that. Nobody expects you to give the final yes or no (unless you're a core maintainer!), but the voting system allows you to provide your perspective and opinion. A patch owner will be glad you did it, trust me.
|
||||
|
||||
Can you think of any other steps for a good review? Do you have any special technique different from mine? Let us all know in the comments!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/code-review
|
||||
|
||||
作者:[Martin Kopec][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/martin-kopec
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://docs.openstack.org/tempest/latest/contributor/contributing.html
|
||||
[2]: https://opensource.com/article/19/5/python-flake8
|
||||
[3]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[4]: https://www.redhat.com/sysadmin/how-to-use-grep
|
@ -1,191 +0,0 @@
|
||||
[#]: subject: "Drop swap for zram on Linux"
|
||||
[#]: via: "https://opensource.com/article/22/11/zram-swap-linux"
|
||||
[#]: author: "David Both https://opensource.com/users/dboth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Drop swap for zram on Linux
|
||||
======
|
||||
|
||||
Zram is a tool for creating an in-RAM compressed cache, specifically for use as swap space.
|
||||
|
||||
I spend a lot of time playing (I mean working) on my computers, and I've found a lot of interesting things. One that has most recently come to my attention is the `zram0` device. I first noticed it when working on one of my Opensource.com articles several months ago. It showed up in the output from the `lsblk` command:
|
||||
|
||||
```
|
||||
# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||
sda 8:00 931.5G 0 disk
|
||||
├─sda1 8:10 600M 0 part
|
||||
[...]
|
||||
zram0 252:00 8G 0 disk [SWAP]
|
||||
```
|
||||
|
||||
It's identified as swap space, which is what first piqued my curiosity, so I did some exploration. Zram was originally called "compcache," which stands for "compressed cache." It turns out that zram is a tool for creating an in-RAM compressed cache, specifically for use as swap space.
|
||||
|
||||
But Why?
|
||||
|
||||
When I began researching zram, all I found were a couple of basic articles about using zram for swap space. At first, this seemed a bit counterintuitive to me. After all, if you're running out of RAM and you swap pages into a virtual drive in RAM, what's gained?
|
||||
|
||||
I then found the Fedora Project wiki page that proposed the use of [Swap on zram][1]. The proposal says: "Swap is useful, except when it's slow. zram is a RAM drive that uses compression. Create a swap-on-zram during start-up. And no longer use swap partitions by default."
|
||||
|
||||
The rest of the page is about details, benefits, side effects, and feedback.
|
||||
|
||||
### Zram for swap space on Linux
|
||||
|
||||
Using zram for swap space is intended to do the same thing as regular partition-based or file-based swap space. When memory pressure becomes too great, some of the least recently used data is moved to swap space. On average, it's compressed to about 50% of its original size, and placed in zram space in RAM. This is much faster than storing those memory pages on a hard drive and frees up the RAM it was using for other use.
|
||||
|
||||
### Saving on swap
|
||||
|
||||
I tried to find revised recommendations for how much swap or zram swap to configure. This led me back to a reassessment of swap, and my previous article, [What's the right amount of swap space for a modern Linux system?][2] As far as I can tell from the most current documentation for RHEL and Fedora, the recommended amount of swap space has not changed. That documentation, however, ignores the use of zram.
|
||||
|
||||
However, the tables in that previous article still provide a good starting point for swap space allocation when using older releases of Linux that don't use zram or in cases where zram has been disabled.
|
||||
|
||||
The documents I found for the Zram feature are inconsistent in terms of how zram is allocated with respect to RAM size, and the amount of space allocated to zram swap.
|
||||
|
||||
Due to the lack of authoritative documentation, I performed some experiments to empirically determine the algorithm used to allocate zram swap. I used my own physical and virtual systems for this. The results are interesting and do not match any documentation I've so far found.
|
||||
|
||||
The default size of zram is 8 GB on all systems large enough to support that, but it's typically reduced significantly on hosts with small amounts of RAM. On one virtual machine (VM) I use for testing, with access to 4 GB of RAM, the zram virtual swap space is allocated to 3.8 GB. One old Dell I have contains 8 GB of RAM, and the zram is set to 7.6 GB. When RAM is reduced to 2 GB, Zram is reduced to 1.9 GB.
|
||||
|
||||
All physical and virtual hosts I have with more than 8 GB of RAM show exactly 8 GB of zram. This includes my primary workstation with 64 GB of RAM and other hosts with 16 GB or 32 GB of RAM.
|
||||
|
||||
Based on these few data points, I can draw the conclusion that the current default settings are for 8 GB of zram at most, and for zram to be 95% of RAM on hosts with 8 GB or less.
|
||||
|
||||
I have read a number of articles that mention other sizes for zram swap, even up to 100% of RAM, but those all seem to be theoretical rather than reality.
|
||||
|
||||
Your distribution may be different, but here are the actual zram swap allocations for Fedora and similar distributions:
|
||||
|
||||
- **RAM ⇐ 8 GB:** 0.95 × RAM
|
||||
- **RAM > 8 GB:** 8 GB
|
||||
|
||||
Be aware that the zram swap size algorithm is not based on any recommendations for the "best" swap size for any given real-world system or application. This zram swap allocation is a rather probabilistic approach to what should work well on a wide range of Linux hosts. However, the fact that the maximum zram swap size is configured for 8 GB and the fact that I have always recommended 8 GB as the maximum amount of traditional swap, I think I can say it's reflective of the optimum sizes for zram swap.
|
||||
|
||||
### Managing zram swap
|
||||
|
||||
Zram defaults are stored in the `/usr/lib/systemd/zram-generator.conf` configuration file. The following is from one of my test VMs with 5097 GB of RAM allocated.
|
||||
|
||||
```
|
||||
# cat /usr/lib/systemd/zram-generator.conf
|
||||
# This config file enables a /dev/zram0 device with the default settings:
|
||||
# - size - same as available RAM or 8GB, whichever is less
|
||||
# - compression - most likely lzo-rle
|
||||
#
|
||||
# To disable, uninstall zram-generator-defaults or create empty
|
||||
# /etc/systemd/zram-generator.conf file.
|
||||
[zram0]zram-size= min(ram, 8192)
|
||||
```
|
||||
|
||||
You can change the default Zram swap size in the last line of the `zram-generator.conf` configuration file. I recommend against doing that, unless you can definitively show a reason for doing so, and test your results once you make any changes. Like many other configuration defaults in Linux, the zram ones have been well-tested and are appropriate for most use cases.
|
||||
|
||||
### Monitor zram
|
||||
|
||||
The zramctl utility can be used to view the current state of zram.
|
||||
|
||||
```
|
||||
# zramctl
|
||||
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
|
||||
/dev/zram0 lzo-rle 4.8G 4K 80B 12K 4[SWAP]
|
||||
```
|
||||
|
||||
The traditional `swapon` command can also be used to view swap including zram used as swap:
|
||||
|
||||
```
|
||||
# swapon --show
|
||||
NAME TYPE SIZE USED PRIO
|
||||
/dev/zram0 partition 4.8G 0B 100
|
||||
```
|
||||
|
||||
One thing to be aware of is that `zramctl` does not report on zram when it contains no data, so the results contain null output. Tools like `lsblk`, `swapon`, `top`, `free`, `htop`, and so on, do show zram even when it contains no data.
|
||||
|
||||
### Deactivate zram
|
||||
|
||||
The `swapoff -a` command turns off `zram` swap as well as traditional HDD or SSD storage used as swap. The `swapon -a` command does not show zram when it is empty. Use `zramctl /dev/zram0` instead.
|
||||
|
||||
```
|
||||
# swapon --show# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||
sda 8:00 120G 0 disk
|
||||
├─sda1 8:10 1G 0 part /boot/efi
|
||||
├─sda2 8:20 1G 0 part /boot
|
||||
└─sda3 8:30 118G 0 part
|
||||
├─vg01-root 253:00 10G 0 lvm /
|
||||
├─vg01-swap 253:10 3G 0 lvm [SWAP]
|
||||
├─vg01-usr 253:10 30G 0 lvm /usr
|
||||
├─vg01-home 253:20 10G 0 lvm /home
|
||||
├─vg01-var 253:30 30G 0 lvm /var
|
||||
└─vg01-tmp 253:40 10G 0 lvm /tmp
|
||||
sr0 11:01 1024M 0 rom
|
||||
zram0 252:00 0B 0 disk
|
||||
# zramctl## zramctl /dev/zram0
|
||||
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
|
||||
/dev/zram0 lzo-rle 0B 0B 0B 0B 4
|
||||
```
|
||||
|
||||
Note that `/dev/zram0` doesn't show up in these commands as swap space until it's being used for that purpose. This caused me some confusion until my experiments showed it to be the case.
|
||||
|
||||
### Creating Zram Swap
|
||||
|
||||
Zram itself has been around for about 20 years, but has only been in use as swap space on some distributions for the last year or two. The current Linux installation on some or all of your hosts may not have been created with zram for swap. If that's the case, it can be easily remedied.
|
||||
|
||||
For Fedora 32, the last release prior to the default use of zram for swap, it only takes three easy commands.
|
||||
|
||||
First, verify the presence of the `zram-swap.service` file, installed as part of the `zram` RPM package.
|
||||
|
||||
```
|
||||
# systemctl status zram-swap
|
||||
● zram-swap.service - Enable compressed swap in memory using zram
|
||||
Loaded: loaded (/usr/lib/systemd/system/zram-swap.service; disabled; vendor preset: disabled)
|
||||
Active: inactive (dead)
|
||||
```
|
||||
|
||||
Next, install the `zram-generator-defaults` and `zram-generator` packages.
|
||||
|
||||
```
|
||||
# dnf install zram-generator-defaults zram-generator
|
||||
```
|
||||
|
||||
Enable and start the zram-swap service:
|
||||
|
||||
```
|
||||
# systemctl enable zram-swap.service# systemctl start zram-swap.service
|
||||
```
|
||||
|
||||
And then verify that `zram0` exists, and is being used as swap space:
|
||||
|
||||
```
|
||||
# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:00 120G 0 disk
|
||||
├─sda1 8:10 2G 0 part /boot
|
||||
└─sda2 8:20 118G 0 part
|
||||
├─vg01-root 253:00 10G 0 lvm /
|
||||
├─vg01-swap 253:10 3G 0 lvm [SWAP]
|
||||
├─vg01-usr 253:20 35G 0 lvm /usr
|
||||
├─vg01-tmp 253:30 15G 0 lvm /tmp
|
||||
├─vg01-var 253:40 35G 0 lvm /var
|
||||
└─vg01-home 253:50 20G 0 lvm /home
|
||||
sr0 11:01 1024M 0 rom
|
||||
zram0 252:00 7.5G 0 disk [SWAP]
|
||||
```
|
||||
|
||||
### Improve swap with zram
|
||||
|
||||
That's all there is to it. It was easy with Fedora. Different distributions will likely be just as easy, with some possible different details in the package names and commands. Give zram swap a try on your computer. In my next article, I'll demonstrate some further zram options.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/zram-swap-linux
|
||||
|
||||
作者:[David Both][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/dboth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM
|
||||
[2]: https://opensource.com/article/19/2/swap-space-poll
|
@ -1,142 +0,0 @@
|
||||
[#]: subject: "How to Setup Python Development Environment in Ubuntu and Fedora"
|
||||
[#]: via: "https://www.debugpoint.com/setup-python-environment-ubuntu-fedora/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Setup Python Development Environment in Ubuntu and Fedora
|
||||
======
|
||||
|
||||
**This article helps you with the basics and steps to setup your Python development environment in Ubuntu and Fedora.**
|
||||
|
||||
[Python][1] became popular in the last couple of years due to its powerful libraries, easy syntax, and portability. It is being used currently almost every system across businesses.
|
||||
|
||||
So, if you are trying to set up your Python box and wondering how to begin etc., then you are at the right place. Here, I tried to give you some steps to get started.
|
||||
|
||||
### Setup Python Development Environment in Ubuntu and Fedora
|
||||
|
||||
#### Python Versions
|
||||
|
||||
If you are starting up Python development fresh, then it is recommended that you use the latest Python 3.x for your development, as Python 2.x is already out of support. Almost all the leading Linux distributions removed the dependency on Python 2.
|
||||
|
||||
If you are running the latest distributions as of today for Fedora or Ubuntu, then you should have Python 3.x already installed and set as the default interpreter. For example, Fedora 37 and Ubuntu 22.04 LTS, which are currently available, have [Python 3.11][2] as the default Python shell.
|
||||
|
||||
A quick way to find out what Python version you have is by running the below command from a terminal in both Ubuntu and Fedora.
|
||||
|
||||
```
|
||||
python2
|
||||
```
|
||||
|
||||
```
|
||||
python3
|
||||
```
|
||||
|
||||
![python3][3]
|
||||
|
||||
If you are running earlier versions of Ubuntu or Fedora, then you can install the latest Python 3.x using the below commands:
|
||||
|
||||
**Ubuntu**
|
||||
|
||||
```
|
||||
sudo apt install python3
|
||||
```
|
||||
|
||||
**Fedora**
|
||||
|
||||
```
|
||||
sudo dnf install python3
|
||||
```
|
||||
|
||||
Also, run the below command to find out the path of your Python executable in the current system:
|
||||
|
||||
```
|
||||
which python
|
||||
```
|
||||
|
||||
#### Switching Versions as the default interpreter
|
||||
|
||||
If your system has multiple Python versions installed – 2.x and 3.x and you want to switch between them, it is possible.
|
||||
|
||||
_If you have only one version installed, you can skip this section._
|
||||
|
||||
To switch, first, run python from the terminal to find out the default executable path. Ideally, it should be `/usr/bin/python`. Now, run below to find out the symbolic link to the executable.
|
||||
|
||||
```
|
||||
ln -l /usr/bin/python
|
||||
```
|
||||
|
||||
```
|
||||
lrwxrwxrwx 1 root root .... /usr/bin/pyhton -> python2
|
||||
```
|
||||
|
||||
Now check out the `$PATH` variable to determine the order of path concatenation which the system looks up for executables.
|
||||
|
||||
```
|
||||
echo $PATH
|
||||
```
|
||||
|
||||
![PATH-Variable][4]
|
||||
|
||||
As you can see `/usr/local/bin`is preceding the `/usr/bin/` then you can create a soft symbolic link to `python3`. Then your interpreter should pick up the latest Python 3 instead of Python 2 while running the python command.
|
||||
|
||||
```
|
||||
ls -s /usr/bin/python3 /usr/local/bin/python
|
||||
```
|
||||
|
||||
Now you should logout and log in again to clear any hash entries, or you can run `hash -r` to clear them out.
|
||||
|
||||
Now you can run python from the terminal, and you should have the latest Python 3 picked up.
|
||||
|
||||
#### Python IDE
|
||||
|
||||
An integrated development environment (IDE) helps you write and compile and execute your code. There are [several free Python IDE available][5] – such as PyCharm, Eclipse, Eric, etc., which you can use. That would be another write-up on their pros and cons.
|
||||
|
||||
If you download Python from the official [python.org][1] website, Python accompanies a default development environment called IDLE. IDLE is good for starting up your system, and later you can decide to pick any of the best free Python IDE available.
|
||||
|
||||
IDLE is not included in Ubuntu and Fedora along with python as default, you have to install it manually. Run the below commands from the terminal to manually install IDLE.
|
||||
|
||||
**Ubuntu**
|
||||
|
||||
```
|
||||
sudo apt install idle
|
||||
```
|
||||
|
||||
**Fedora**
|
||||
|
||||
```
|
||||
sudo dnf install python-tools
|
||||
```
|
||||
|
||||
Once installed, you can launch IDLE from the command line idle or search from the application.
|
||||
|
||||
![IDLE-environment`][6]
|
||||
|
||||
Now, you can use IDLE to start your development. Most of the basic options you can find in the File menu of IDLE.
|
||||
|
||||
I hope this guide explains what you should know before starting your Python development. Although this guide is primarily targeted to Ubuntu and Fedora, you can still follow the instructions for all Ubuntu and Fedora-based distributions as well. If you are facing problems with the Python environment setup, let me know in the comment section below.
|
||||
|
||||
[Next:Learn Bash base64 Encode and Decode With Examples][7]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/setup-python-environment-ubuntu-fedora/
|
||||
|
||||
作者:[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.python.org/
|
||||
[2]: https://www.debugpoint.com/install-python-3-11-ubuntu/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2020/06/python3.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2020/06/PATH-Variable.png
|
||||
[5]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2020/06/IDLE-environment.png
|
||||
[7]: https://www.debugpoint.com/bash-base64-encode-decode/
|
@ -1,121 +0,0 @@
|
||||
[#]: subject: "apt remove vs apt purge: What’s the Difference?"
|
||||
[#]: via: "https://itsfoss.com/apt-remove/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Tngze-G"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
apt remove vs apt purge: What’s the Difference?
|
||||
======
|
||||
|
||||
To [uninstall an application in the Ubuntu terminal][1], you can use:
|
||||
|
||||
```
|
||||
sudo apt remove package_name
|
||||
```
|
||||
|
||||
But in various forums, you may come across the suggestion to use the apt purge command for removing applications completely.
|
||||
|
||||
This leaves you confused because using apt purge is quite similar to apt remove:
|
||||
|
||||
```
|
||||
sudo apt purge package_name
|
||||
```
|
||||
|
||||
So, why are there two similar commands for removing packages? What’s the difference between the two? Let me explain it to you with a few examples.
|
||||
|
||||
### What’s the difference between apt-remove and apt-purge?
|
||||
|
||||
Both apt-remove and apt-purge do the same thing and that is to uninstall a package. The apt-purge removes the package and purges any configuration files associated with it. That’s the only difference between the two. Neither command touches the application files under the home directory of the user.
|
||||
|
||||
Have you ever removed an application and installed it again, only to notice that all your settings are in place? It’s because the apt remove command doesn’t remove the configuration files.
|
||||
|
||||
#### See what’s being removed and what remains
|
||||
|
||||
Let me share a practical example of removing the mplayer application using both apt remove and apt purge commands. The focus is on seeing what files remain after each operation.
|
||||
|
||||
Here are the files associated with mplayer before removal.
|
||||
|
||||
![mplayer before removal][2]
|
||||
|
||||
Now, if I run the apt remove command.
|
||||
|
||||
![apt uninstall package ubuntu][3]
|
||||
|
||||
Here are the files that remain in the system:
|
||||
|
||||
![files after mplayer removal][4]
|
||||
|
||||
As you can see, there are mplayer files remaining in two locations: /etc and /home/abhishek.
|
||||
|
||||
Now, if I install mplayer again and use apt purge to remove mplayer application this time.
|
||||
|
||||
![apt purge command][5]
|
||||
|
||||
Let’s look for files associated mplayer now.
|
||||
|
||||
![files after mplayer removal][6]
|
||||
|
||||
As you can see, the files from /etc directory no longer exists.
|
||||
|
||||
But what about the files in the home directory? Should apt purge not remove it?
|
||||
|
||||
The answer is negative. The apt commands do not touch the configuration files located under the home directory. They remain in the system unless you manually remove them. Those files are really small in size and hardly take disk space.
|
||||
|
||||
Do note that not all applications create configuration files under /etc or home directory.
|
||||
|
||||
#### The effect of using apt remove or apt purge
|
||||
|
||||
A practical example I can think of is Discord. You [install Discord on Ubuntu][7] with deb file. Start using it by logging into your account. Remove discord and install it again using deb file.
|
||||
|
||||
Now if you start Discord, you’ll notice that you are already logged into your account. Surprising, no?
|
||||
|
||||
But this is a feature because some applications like Discord, VirtualBox provide you updates similarly. You remove the current version and install the newer one (even if you don’t see this process). Since the application configuration files are not touched, you are logged back in without additional effort.
|
||||
|
||||
The apt remove command gives you the option to reuse an application with similar configuration that you used in the past.
|
||||
|
||||
However, you may not always want it. If you configured an application in a bad way and want to start from scratch, the apt purge command is the way to go forward.
|
||||
|
||||
#### Does apt purge perform a wild-card removal?
|
||||
|
||||
When you purge a package, you’ll notice that it mentions removing package-name*. This indicates that it will remove all the packages with names starting from package-name.
|
||||
|
||||
![apt purge wild card][8]
|
||||
|
||||
I didn’t find a definite answer on this point in the documentation (i.e. man page). So, I did a little test on my own. I installed espeak and espeak-ng packages. The espeak* should expand to espeak-ng as well.
|
||||
|
||||
But when espeak was pruged, the espeak-ng package was untouched. So there seems to be a mechanism that protects against such wild card expansions.
|
||||
|
||||
### So, should you use apt remove or apt purge?
|
||||
|
||||
Few people just get addicted to using apt purge.
|
||||
|
||||
In my opinion, apt remove is what you should use most of the time. Use apt purge when you have to get rid of the custom configuration files.
|
||||
|
||||
In both cases, you’ll have to remove the remaining configuration files from the user’s home directory and run apt autoremove to eliminate any leftover dependencies.
|
||||
|
||||
Over to you now. Do you understand the difference between apt remove and apt purge better now? Which one do you prefer to use?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/apt-remove/
|
||||
|
||||
作者:[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/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/apt-remove/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/11/mplayer-before-removal.png
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/11/apt-uninstall-package-ubuntu.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/11/files-after-mplayer-removal.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/11/apt-purge-command.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/11/files-after-apt-purge.png
|
||||
[7]: https://itsfoss.com/install-discord-linux/
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/11/apt-purge-wild-card.png
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-caja"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -1,257 +0,0 @@
|
||||
[#]: subject: "Battle of the Texts and the Unicode Savior"
|
||||
[#]: via: "https://itsfoss.com/unicode-linux/"
|
||||
[#]: author: "Sylvain Leroux https://www.yesik.it/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Battle of the Texts and the Unicode Savior
|
||||
======
|
||||
|
||||
We all know how to type text on the keyboard. Don’t we?
|
||||
|
||||
So, may I challenge you to type that text in your favorite text editor:
|
||||
|
||||
![«Ayumi moved to Tokyo in 1993 to pursue her career» said Dmitrii][1]
|
||||
|
||||
This text is challenging to type since it contains:
|
||||
|
||||
- typographical signs not directly available on the keyboard,
|
||||
- hiragana Japanese characters,
|
||||
- the name of the Japanese capital written with a macron on top of the two letters “o” to comply with the Hepburn romanization standard,
|
||||
- and finally, the first name Dmitrii written using the Cyrillic alphabet.
|
||||
|
||||
No doubt, writing such a sentence on early computers would have been simply impossible. Because computers used limited character sets, unable to let coexist several writing systems. But today such limitations are lifted as we will see in this article.
|
||||
|
||||
### How do computers store text?
|
||||
|
||||
Computers stores characters as numbers. And they use tables to map those numbers to the glyph used to represent them.
|
||||
|
||||
For a long time, computers stored each character as a number between 0 and 255 (which fits exactly one byte). But that was far from being sufficient to represent the whole set of characters used in human writing. So, the trick was to use a different correspondence table depending on where in the world you lived.
|
||||
|
||||
Here is the [ISO 8859-15][2] correspondence table commonly used in France:
|
||||
|
||||
![The ISO 8859-15 encoding][3]
|
||||
|
||||
But if you lived in Russia, your computer would have probably used the [KOI8-R][4] or [Windows-1251][5] encoding instead. Let’s assume that later was used:
|
||||
|
||||
![The Windows-1251 encoding is a popular choice to store text written using the Cyrillic alphabets][6]
|
||||
|
||||
For numbers lower than 128, the two tables are identical. This range is corresponding to the [US-ASCII][7] standard, some kind of minimum-compatible set between characters tables. But beyond 128, the two tables are completely different.
|
||||
|
||||
For example, according to Windows-1251, the string _“said Дмитрий”_ is stored as:
|
||||
|
||||
```
|
||||
115 97 105 100 32 196 236 232 242 240 232 233
|
||||
```
|
||||
|
||||
To follow a common practice in computer sciences, those twelve numbers can be rewritten using the more compact hexadecimal notation:
|
||||
|
||||
```
|
||||
73 61 69 64 20 c4 ec e8 f2 f0 e8 e9
|
||||
```
|
||||
|
||||
If Dmitrii sends me that file, and I open it I might end up seeing that:
|
||||
|
||||
```
|
||||
said Äìèòðèé
|
||||
```
|
||||
|
||||
The file _appears_ to be corrupted. But it isn’t. The data— that is the _numbers_–stored in that file don’t have changed. As I live in France, my computer has _assumed_ the file to be encoded as ISO8859-15. And it displayed the characters _of that table_ corresponding to the data. And not the character of the encoding table used when the text was originally written.
|
||||
|
||||
To give you an example, take the character Д. It has the numeric code 196 (c4) according to Windows-1251. The only thing stored in the file is the number 196. But that same number corresponds to Ä according to ISO8859-15. So my computer wrongly believed it was the glyph intended to be displayed.
|
||||
|
||||
![When the same text file is written then read again but using a different encoding][8]
|
||||
|
||||
As a side note, you can still occasionally see an illustration of those issues on ill-configured websites or in email send by [mail user agents][9] making false assumptions about the character encoding used on the recipient’s computer. Such glitches are sometimes nicknamed [mojibake][10]. Hopefully, this is less and less frequent today.
|
||||
|
||||
![Example of Mojibake on the website of a French movie distributor. The website name has been changed to preserve the innocent.][11]
|
||||
|
||||
### Unicode comes to save to the day
|
||||
|
||||
I explained encoding issues when exchanging files between different countries. But things were even worst since the encodings used by different manufacturers for the same country were not always the same. You can understand what I mean if you had to exchange files between Mac and PC in the 80s.
|
||||
|
||||
Is it a coincidence or not, the [Unicode][12] project started in 1987, led by people of Xerox and … Apple.
|
||||
|
||||
The goal of the project was to define a universal character set allowing to _simultaneously_ use any character used in human writing within the same text. The original Unicode project was limited to 65536 different characters (each character being represented using 16 bits— that is two bytes per character). A number that has proven to be insufficient.
|
||||
|
||||
So, in 1996 Unicode has been extended to support up to 1 million different [code points][13]. Roughly speaking, a “code point” a number that identifies an entry in the Unicode character table. And one core job of the Unicode project is to make an inventory of all letters, symbols, punctuation marks and other characters that are (or were) used worldwide, and to assign to each of them a code point that will uniquely identify that character.
|
||||
|
||||
This is a huge project: to give you some idea, the version 10 of Unicode, published in 2017, defines over 136,000 characters covering 139 modern and historic scripts.
|
||||
|
||||
With such a large number of possibilities, a basic encoding would require 32 bits (that is 4 bytes) per character. But for text using mainly the characters in the US-ASCII range, 4 bytes per character means 4 times more storage required to save the data and 4 times more bandwidth to transmit them.
|
||||
|
||||
![Encoding text as UTF-32 requires 4 bytes per character][14]
|
||||
|
||||
So besides the [UTF-32][15] encoding, the Unicode consortium defined the more space-efficient [UTF-16][16] and [UTF-8][17] encodings, using respectively 16 and 8 bits. But how to store over 100,000 different values in only 8 bits? Well, you can’t. But the trick is to use one code value (8 bits in UTF-8, 16 in UTF-16) to store the most frequently used characters. And to use several code values for the least commonly used characters. So UTF-8 and UTF-16 are _variable length_ encoding. Even if this has drawbacks, UTF-8 is a good compromise between space and time efficiency. Not mentioning being backward compatible with most 1-byte pre-Unicode encoding, since UTF-8 was specifically designed so any valid US-ASCII file is also a valid UTF-8 file. In a sense, UTF-8 is a superset of US-ASCII. And today, there is no reason for not using the UTF-8 encoding. Unless of course if you write mostly with languages requiring multi-byte encodings or if you have to deal with legacy systems.
|
||||
|
||||
I let you compare the UTF-16 and UTF-8 encoding of the same string on the illustrations below. Pay special attention to the UTF-8 encoding using one byte to store the characters of the Latin alphabet. But using two bytes to store characters of the Cyrillic alphabet. That is twice more space than when storing the same characters using the Windows-1251 Cyrillic encoding.
|
||||
|
||||
![UTF-16 is a variable length encoding requiring 2 bytes to encode most characters. Some character still requires 4 bytes though (for example][18]
|
||||
|
||||
![UTF-8 is a variable length encoding requiring 1, 2, 3 or 4 bytes per character][19]
|
||||
|
||||
### And how does that help for typing text?
|
||||
|
||||
Well… It doesn’t hurt to have some knowledge of the underlying mechanism to understand the capabilities and limitations of your computer. Especially we will talk about Unicode and hexadecimal a little later. But for now… a little bit more history. Just a little bit, I promise…
|
||||
|
||||
… just enough to say starting in the 80s, computer keyboard used to have a [compose key][20] (sometimes labeled the “multi” key) next to the shift key. By pressing that key, you entered in “compose” mode. And once in that mode, you were able to enter characters not directly available on your keyboard by entering mnemonics instead. For example, in compose mode, typing RO produced the ® character (which is easy to remember as an R inside an O).
|
||||
|
||||
![compose key on lk201 keyboard][21]
|
||||
|
||||
It is now a rarity to see the compose key on modern keyboards. Probably because of the domination of PCs that don’t make use of it. But on Linux (and possibly on other systems?) you can emulate the compose key. This is something that can be configured in the GUI on many desktop environments using the “keyboard” control panel: But the exact procedure varies depending on your desktop environment or even depending its version. If you changed that setting, don’t hesitate to use the comment section to share the specific steps you’ve followed on your computer.
|
||||
|
||||
As for myself, for now, I will assume you use the default Shift+AltGr combination to emulate the compose key.
|
||||
|
||||
So, as a practical example, to enter the LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, you can type Shift+AltGr<< (you don’t have to maintain Shift+AltGr pressed when entering the mnemonic). If you managed to do that, I think you should be able to guess by yourself how to enter the _RIGHT-POINTING_ DOUBLE ANGLE QUOTATION MARK.
|
||||
|
||||
As another example, try Shift+AltGr--- to produce an EM DASH. For that to work, you have to press the [hyphen-minus][22] key on the main keyboard, not the one you will find on your numeric keypad.
|
||||
|
||||
Worth mentioning the “compose” key works in a non-GUI environment too. But depending if you use you use X11 or a text-only console, the supported compose key sequence are not the same.
|
||||
|
||||
On the console, you can check the list of supported compose key by using the `dumpkeys` command:
|
||||
|
||||
```
|
||||
dumpkeys --compose-only
|
||||
```
|
||||
|
||||
On the GUI, compose key is implemented at Gtk/X11 level. For a list of all mnemonics supported by the Gtk, take a look at that page: [https://help.ubuntu.com/community/GtkComposeTable][23]
|
||||
|
||||
### Is there a way to avoid relying on Gtk for character composition?
|
||||
|
||||
Maybe I’m a purist, but I found somewhat unfortunate the compose key support being hard-coded in Gtk. After all, not all GUI applications are using that library. And I cannot add my own mnemonics without re-compiling the Gtk.
|
||||
|
||||
Hopefully, there is support for character composition at X11-level too. Formerly, through the venerable [X Input Method (XIM)][24].
|
||||
|
||||
This will work at lower-level than Gtk-based character composition. But will allow a great amount of flexibility. And will work with many X11 applications.
|
||||
|
||||
For example, let’s imagine I just want to add the --> composition to enter the → character (U+2192 RIGHTWARDS ARROW), I would create a `~/.XCompose` file containing those lines:
|
||||
|
||||
```
|
||||
cat > ~/.XCompose << EOT
|
||||
# Load default compose table for the current local
|
||||
include "%L"
|
||||
|
||||
# Custom definitions
|
||||
<Multi_key> <minus> <minus> <greater> : U2192 # RIGHTWARDS ARROW
|
||||
EOT
|
||||
```
|
||||
|
||||
Then you can test by starting a new X11 application, forcing libraries to use XIM as input method:
|
||||
|
||||
```
|
||||
GTK_IM_MODULE="xim" QT_IM_MODULE="xim" xterm
|
||||
```
|
||||
|
||||
The new compose sequence should be available in the application you launched. I encourage you to learn more about the compose file format by typing `man 5 compose`.
|
||||
|
||||
To make XIM the default input method for all your applications, just add to your `~/.profile` file the following two lines. that change will be effective the next time you’ll open a session on your computer:
|
||||
|
||||
```
|
||||
export GTK_IM_MODULE="xim"
|
||||
export QT_IM_MODULE="xim"
|
||||
```
|
||||
|
||||
It’s pretty cool, isn’t it? That way you can add all the compose sequences you might want. And there are already a couple of funny ones in the default XIM settings. Try for example to press composeLLAP.
|
||||
|
||||
Well, I must mention two drawbacks though. XIM is relatively old and is probably only suitable for those of us who don’t regularly need multi-bytes input methods. Second, when using XIM as your input method, you no longer can enter Unicode characters by their code point using the Ctrl+Shift+u sequence. What? Wait a minute? I didn’t talk about that yet? So let’s do it now:
|
||||
|
||||
### What if there is no compose key sequence for the character I need?
|
||||
|
||||
The compose key is a nice tool to type some characters not available on the keyboard. But the default set of combinations is limited, and switching to XIM and defining a new compose sequence for a character you will need only once in a lifetime can be cumbersome.
|
||||
|
||||
Does that prevent you to mix Japanese, Latin and Cyrillic characters in the same text? Certainly not, thanks to Unicode. For example, the name あゆみ is made of:
|
||||
|
||||
- the [HIRAGANA LETTER A (U+3042)][25]
|
||||
- the [HIRAGANA LETTER YU (U+3086)][26]
|
||||
- and the [HIRAGANA LETTER MI (U+307F)][27]
|
||||
|
||||
I mentioned above the official Unicode character names, following the convention to write them in all upper cases. After their name, you will find their Unicode code point, written between parenthesis, as a 16-bit hexadecimal number. Does that remind you something?
|
||||
|
||||
Anyway, once you know the code point of a character, you can enter it using the following combination:
|
||||
|
||||
- Ctrl+Shift+u, then XXXX (the _hexadecimal_ code point of the character you want) and finally Enter.
|
||||
|
||||
As a shorthand, if you don’t release Ctrl+Shift while entering the code point, you won’t have to press Enter.
|
||||
|
||||
Unfortunately, that feature is implemented at software library level rather than at X11 level. So the support may be variable among different applications. In LibreOffice, for example, you have to type the code point using the main keyboard. Whereas Gtk-based application will accept entry from the numeric keypad as well.
|
||||
|
||||
Finally, when working at the console on my Debian system, there is a similar feature, but requiring instead to press Alt+XXXXX where XXXXX is the code point of the character you want, but written in _decimal_ this time. I wonder if this is Debian-specific or related to the fact I’m using the en_US.UTF-8 locale. If you have more information about that, I would be curious to read you in the comment section!
|
||||
|
||||
| GUI | Console | Character |
|
||||
| :- | :- | :- |
|
||||
| Ctrl+Shift+u3042Enter | Alt+12354 | あ |
|
||||
| Ctrl+Shift+u3086Enter | Alt+12422 | ゆ |
|
||||
| Ctrl+Shift+u307FEnter | Alt+12415 | み |
|
||||
|
||||
### Dead keys
|
||||
|
||||
Last but not least, there is a simpler method to enter key combinations that do not rely (necessarily) on the compose key.
|
||||
|
||||
Some keys on your keyboard were specifically designed to create a combination of characters. Those are called [dead keys][28]. Because when you press them once, nothing seems to happen. But they will silently modify the character produced by the next key you will press. This is a behavior inspired from mechanical typewriter: with them, pressing a dead key imprinted a character, but will not move the carriage. So the next keystroke will imprint another character at the same position. Visually resulting in a combination of the two pressed keys.
|
||||
|
||||
We use that a lot in French. For example, to enter the letter “ë” I have to press the ¨ dead key followed by the e key. Similarly, Spanish people have the ~ dead key on their keyboard. And on the keyboard layout for Nordic languages, you can find the ° key. And I could continue that list for a very long time.
|
||||
|
||||
![hungary dead keys][29]
|
||||
|
||||
Obviously, not all dead keys are available on all keyboard. I fact, most dead keys are NOT available on your keyboard. For example, I assume very few of you— if any— have a dead key ¯ to enter the macron (“flat accent”) used to write Tōkyō.
|
||||
|
||||
For those dead keys that are not directly available on your keyboard, you need to resort to other solutions. The good news is we’ve already used those techniques. But this time we will use them to emulate dead keys. Not “ordinary” keys.
|
||||
|
||||
So, a first option could be to generate the macron dead key by using Compose- (the hyphen-minus key available on your keyboard). Nothing appears. But if after that you press the o key it will finally produce “ō”.
|
||||
|
||||
The list of dead keys that Gtk can produce using the compose mode can be found [here][30].
|
||||
|
||||
A different solution would use the Unicode COMBINING MACRON (U+0304) character. Followed by the letter o. I will leave the details up to you. But if you’re curious, you may discover this leads to a very subtlely different result, rather than really producing a LATIN SMALL LETTER O WITH MACRON. And if I wrote the end of the previous sentence in all uppercase, this is a hint guiding you toward a method to enter ō with fewer keystrokes than by using a Unicode combining character… But I let that to your sagacity.
|
||||
|
||||
### Your turn to practice!
|
||||
|
||||
So, did you get it all? Does that work on your computer? It’s your turn to try that: using the clues given above, and a little bit of practice, now you can enter the text of the challenge given in the beginning of this article. Do it, then copy-paste your text in the comment section below as proof of your success.
|
||||
|
||||
There is nothing to win, except maybe the satisfaction of impressing your peers!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/unicode-linux/
|
||||
|
||||
作者:[Sylvain Leroux][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.yesik.it/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2017/10//text-challenge.png
|
||||
[2]: https://en.wikipedia.org/wiki/ISO/IEC_8859-15
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2017/10//ISO_8859-15.png
|
||||
[4]: https://en.wikipedia.org/wiki/KOI8-R
|
||||
[5]: https://en.wikipedia.org/wiki/Windows-1251
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2017/10//Windows-1251.png
|
||||
[7]: https://en.wikipedia.org/wiki/ASCII
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2017/10//windows-1251-to-iso8859-15-encoding-decoding-error-example.png
|
||||
[9]: https://en.wikipedia.org/wiki/Email_client
|
||||
[10]: https://en.wikipedia.org/wiki/Mojibake
|
||||
[11]: https://itsfoss.com/wp-content/uploads/2017/10/Mojibake-french-example.png
|
||||
[12]: https://en.wikipedia.org/wiki/Unicode
|
||||
[13]: https://en.wikipedia.org/wiki/Code_point
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-32-encoding-example.png
|
||||
[15]: https://en.wikipedia.org/wiki/UTF-32
|
||||
[16]: https://en.wikipedia.org/wiki/UTF-16
|
||||
[17]: https://en.wikipedia.org/wiki/UTF-8
|
||||
[18]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-16-encoding-example.png
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-8-encoding-example.png
|
||||
[20]: https://en.wikipedia.org/wiki/Compose_key
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/12/compose_key_on_lk201_keyboard.jpg
|
||||
[22]: https://en.wikipedia.org/wiki/Hyphen-minus
|
||||
[23]: https://help.ubuntu.com/community/GtkComposeTable
|
||||
[24]: https://en.wikipedia.org/wiki/X_Input_Method
|
||||
[25]: http://www.fileformat.info/info/unicode/char/3042/index.htm
|
||||
[26]: http://www.fileformat.info/info/unicode/char/3086/index.htm
|
||||
[27]: http://www.fileformat.info/info/unicode/char/307F/index.htm
|
||||
[28]: https://en.wikipedia.org/wiki/Dead_key
|
||||
[29]: https://itsfoss.com/wp-content/uploads/2022/12/hungary_dead_keys.png
|
||||
[30]: https://help.ubuntu.com/community/GtkDeadKeyTable
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://itsfoss.com/switch-debian-stable-testing/"
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://opensource.com/article/22/12/rexx-scripting"
|
||||
[#]: author: "Howard Fosdick https://opensource.com/users/howtech"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -1,93 +0,0 @@
|
||||
[#]: subject: "Discover the power of the Linux SpaceFM file manager"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-spacefm"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Discover the power of the Linux SpaceFM file manager
|
||||
======
|
||||
|
||||
SpaceFM is a tabbed file manager for Linux using the GTK toolkit, so it fits right in on desktops like [GNOME][1], [Mate][2], [Cinnamon][3], and others. SpaceFM also features a built-in device manager system, so it's particularly good for window managers, like [Fluxbox][4] or [fvwm][5], which typically don't include a graphical device manager. If you're happy with the file managers on Linux, but you want to try one that's a little bit different in design, SpaceFM is worth a look.
|
||||
|
||||
### Install SpaceFM
|
||||
|
||||
On Linux, you're likely to find **SpaceFM** in your distribution's software repository. On Fedora, Mageia, OpenMandriva, and similar:
|
||||
|
||||
```
|
||||
$ sudo dnf install spacefm
|
||||
```
|
||||
|
||||
On Debian and Debian-based systems:
|
||||
|
||||
```
|
||||
$ sudo apt install spacefm
|
||||
```
|
||||
|
||||
### Panels
|
||||
|
||||
I don't know why SpaceFM is called SpaceFM, but it could be because it makes a concerted effort to let you use every bit of space in its window for something useful. By default, SpaceFM is actually pretty simple, standard-issue file manager. It has a single panel listing your files, a toolbar, and a menu bar.
|
||||
|
||||
![SpaceFM is typical in design. At first.][6]
|
||||
|
||||
All the "usual" rules apply.
|
||||
|
||||
- **Double-click** to open a directory or to open a file in its default application.
|
||||
- **Right-click** for a contextual menu providing lots of standard options (copy, paste, rename, view properties, create a new folder, and so on).
|
||||
|
||||
The way SpaceFM sets itself apart, though, is its panel system. SpaceFM displays one panel by default. That's the big file window listing your files. But it can have up to four panel views, plus a few bonus panels for some specific tasks.
|
||||
|
||||
### Opening a new panel
|
||||
|
||||
Instead of seeing one directory in your file manager, you can see two. To bring up another directory in its own pane, press **Ctrl+2** or go to the **View** menu and select **Panel 2**. Alternatively, click the second green dot icon from the left in the menu panel.
|
||||
|
||||
With two panels, you can move files from one directory to another without opening a new file manager window, or you can browse two directories to compare their contents.
|
||||
|
||||
But why settle for two panels? Maybe you'd rather see _three_ directories at once. To bring up a third directory in a dedicated pane, press **Ctrl+3** or go to the **View** menu and select **Panel 3**. Alternatively, click the third green dot icon from the left in the menu panel. This panel appears at the bottom of the SpaceFM window.
|
||||
|
||||
With three panels open, you can move files between several directories, or sort files from a common "dumping ground" (like your Desktop or Downloads folder) into specific directories.
|
||||
|
||||
Of course, once you've tried three panels you'll probably find yourself itching for a fourth. To open a fourth directory in its own pane, press **Ctrl+4** or go to the **View** menu and select **Panel 4**. Alternatively, click the fourth green dot icon from the left in the menu panel. This one opens next to Panel 3, splitting your SpaceFM window into even quarters.
|
||||
|
||||
![SpaceFM can have up to four panels.][7]
|
||||
|
||||
What about a _fifth_ panel? Well, actually SpaceFM stops at four panels. If you really do want a fifth panel, you have to open a new SpaceFM window. However, there are still more panels, used for information other than file listings, to explore.
|
||||
|
||||
### Special panels
|
||||
|
||||
The **View** menu reveals that in addition to file panels, there are additionally task-specific panels you can choose to display. This includes:
|
||||
|
||||
- **Task manager**: Lists ongoing file manager processes. This isn't a general-purpose task manager, so to set nice values or detect a zombie apocalypse of undead PIDs, [htop or top][8] is still your utility of choice.
|
||||
- **Bookmarks**: Links to common folders, such as Desktop, Documents, Downloads, and any location you want to keep handy.
|
||||
- **Devices**: USB thumb drives and remote file systems.
|
||||
- **File tree**: A view of your file system in order of directory inheritance.
|
||||
|
||||
These panels open on the left side of SpaceFM, but they do stack. You can have bookmarks, devices, tasks, and a file tree open at once, although it helps to have a very tall SpaceFM window.
|
||||
|
||||
### Make space for SpaceFM
|
||||
|
||||
SpaceFM is a configurable multi-tasking file manager. It maximizes the information you can build into a single window, and it lets you decide what's important, and when. This article has focused on the panels of SpaceFM because those are, at least in my view, the most unique aspect of the application. However, there's a lot more to SpaceFM, including plugins, preferences, a design mode, keyboard shortcuts, and customization. This isn't a small application, even though it is a lightweight one. Spend some time with SpaceFM, because you never know what you'll discover.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-spacefm
|
||||
|
||||
作者:[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/article/19/12/gnome-linux-desktop
|
||||
[2]: https://opensource.com/article/19/12/mate-linux-desktop
|
||||
[3]: https://opensource.com/article/19/12/cinnamon-linux-desktop
|
||||
[4]: https://opensource.com/article/19/12/fluxbox-linux-desktop
|
||||
[5]: https://opensource.com/article/19/12/fvwm-linux-desktop
|
||||
[6]: https://opensource.com/sites/default/files/2022-10/spacefm.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-10/spacefm-panels.webp
|
||||
[8]: https://opensource.com/life/16/2/open-source-tools-system-monitoring
|
@ -1,136 +0,0 @@
|
||||
[#]: subject: "Fedora Media Writer: World-Class LIVE USB Creator [Tutorial]"
|
||||
[#]: via: "https://www.debugpoint.com/fedora-media-writer/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Fedora Media Writer: World-Class LIVE USB Creator [Tutorial]
|
||||
======
|
||||
|
||||
**A tutorial on installing and using Fedora Media Writer to create LIVE USB from Linux & Windows.**
|
||||
|
||||
![Fedora Media Writer][1]
|
||||
|
||||
### Fedora Media Writer
|
||||
|
||||
The community and Fedora Linux team develop and maintain the [Fedora Media Writer app][2]. This application writes any ISO image to your flash drive (USB stick). In addition, Fedora Media Writer also has features to download the ISO file directly from the Fedora Mirrors, provided you have a stable internet connection.
|
||||
|
||||
Moreover, it gives you a list of options for download – such as Official Editions, Emerging Editions, Spins and Fedora Labs images.
|
||||
|
||||
Not only that, but you can also use this nifty utility to write any other ISO images to your flash drive. It need not be the Fedora ISO always.
|
||||
|
||||
Although there are other popular utilities available for creating LIVE USBs, such as [Etcher][3], Ventoy, and Rufus – you can still give this utility a try, considering the team develops it from mainstream Fedora Linux with contributors.
|
||||
|
||||
So, in summary, here are quick feature highlights of Fedora Media Writer.
|
||||
|
||||
#### Features Summary of Fedora Media Writer
|
||||
|
||||
- Available for Linux, Windows and macOS
|
||||
- Directly download + write the images to a USB flash drive
|
||||
- Official Editions (Workstation, IoT, Server) download
|
||||
- Emerging Editions (Silverblue, Kinoite) download
|
||||
- Spins (KDE Plasma, Xfce, etc)
|
||||
- Labs (Fedora Astronomy, Robotic and other flavours)
|
||||
- Available as Flatpak for Linux Distros
|
||||
- Also, can write any other ISO images (non-Fedora) to a USB stick.
|
||||
- Ability to format USB stick, restore flash drive
|
||||
- Based on Qt
|
||||
|
||||
### How to Install
|
||||
|
||||
#### Linux
|
||||
|
||||
Fedora Media Writer is available as Flatpak for Linux Distributions. To install it in any Linux (such as Fedora, Ubuntu, or Linux Mint) – [set up Flatpak by following this guide][4].
|
||||
|
||||
Then, click on the below link to install. This will launch the official Software application of your Linux Distro (such as Discover, GNOME Software). After installation, you can launch it via Application Menu.
|
||||
|
||||
[Install Fedora Media Writer as Flatpak][5]
|
||||
|
||||
#### Windows
|
||||
|
||||
If you are a Windows user and planning to migrate to Linux (or Fedora), it is a perfect tool. You need to download the exe installer from GitHub (link below) and follow the onscreen instruction for installation.
|
||||
|
||||
[Latest Installer for Windows (exe)][6]
|
||||
|
||||
After installation, you can launch it from Start Menu.
|
||||
|
||||
For macOS, you can get the dmg file in the above link.
|
||||
|
||||
### How to use Fedora Media Writer to Create LIVE USB in Linux
|
||||
|
||||
The first screen gives you two main options. The automatic download option is for downloading the ISO images on the fly. And the second option is to write the already downloaded ISO files from your disk directly.
|
||||
|
||||
If you have already plugged in the USB, you should see it as the third option. The third option is to format and delete all the data from your USB stick and restore it to its factory settings.
|
||||
|
||||
Furthermore, you can use this utility for just formatting your USB flash drive as well. You do not need any command or anything fancy. A point to note is that this option is only visible when your USB stick has data. If it’s already formatted, the tool can detect it and won’t show you the option to restore it!! 😲
|
||||
|
||||
#### Automatic Download and Write
|
||||
|
||||
![Fedora Media Writer - First Screen][7]
|
||||
|
||||
The automatic Download option gives you the following screen to download any Fedora ISO you want from mirrors. This is useful for many because it eliminates the hassles of separately downloading ISO files, verifying checksum, etc.
|
||||
|
||||
![The automatic download options gives you these options][8]
|
||||
|
||||
After choosing the distribution, the final screen gives you the option for version (Fedora 36, 35, etc.) and architecture (x86, ARM, etc.). Also, you should see the USB destination. Click on Download and Write to start the process.
|
||||
|
||||
![The final Write screen of Fedora Media Writer][9]
|
||||
|
||||
#### Write an existing ISO file from the disk.
|
||||
|
||||
When you choose the ‘select iso file’ option, you can select the file from your system. After that, select the destination USB drive and click Write to start the process.
|
||||
|
||||
![Direct ISO write via Fedora Media Writer][10]
|
||||
|
||||
![Writing is in progress][11]
|
||||
|
||||
![Writing Complete][12]
|
||||
|
||||
After the write operation is finished, you can see a confirmation message shown above. It took standard time to write a 3GB~ ISO during my test, around 3 to 4 minutes.
|
||||
|
||||
### Using Fedora Media Writer to Create LIVE USB in Windows, macOS
|
||||
|
||||
The steps are the same to use this utility in Windows and macOS, as shown above for Linux. You can easily find the shortcuts after installation and launch in the same way.
|
||||
|
||||
![Running in Windows 11][13]
|
||||
|
||||
### Closing Notes
|
||||
|
||||
I hope this guide helps you use Fedora Media Writer for your day to day USB writing work. Also, the good thing about this utility is that you can use it for formatting/restoring your USB stick. You do not require GParted or GNOME Disks anymore.
|
||||
|
||||
It’s such a terrific utility for Linux, Windows and macOS users.
|
||||
|
||||
Cheers.
|
||||
|
||||
[Next:How to Get Xfce 4.18 in Xubuntu 22.04 and 22.10][14]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/fedora-media-writer/
|
||||
|
||||
作者:[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/05/fmwhead2022.jpg
|
||||
[2]: https://github.com/FedoraQt/MediaWriter
|
||||
[3]: https://www.debugpoint.com/2021/01/etcher-bootable-usb-linux/
|
||||
[4]: https://flatpak.org/setup/
|
||||
[5]: https://dl.flathub.org/repo/appstream/org.fedoraproject.MediaWriter.flatpakref
|
||||
[6]: https://github.com/FedoraQt/MediaWriter/releases/latest
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/05/Fedora-Media-Writer-First-Screen.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/05/The-automatic-download-options-gives-you-these-options.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/05/The-final-Write-screen-of-Fedora-Media-Writer.jpg
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/05/Direct-ISO-write-via-Fedora-Media-Writer.jpg
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2022/05/Writing-is-in-progress.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2022/05/Writing-Complete.jpg
|
||||
[13]: https://www.debugpoint.com/wp-content/uploads/2022/05/Running-in-Windows-11.png
|
||||
[14]: https://www.debugpoint.com/xfce-4-18-xubuntu-22-04/
|
@ -1,134 +0,0 @@
|
||||
[#]: subject: "EndeavourOS: Your Search for Perfect Arch Distro Ends Here"
|
||||
[#]: via: "https://www.debugpoint.com/endeavouros-review/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
EndeavourOS: Your Search for Perfect Arch Distro Ends Here
|
||||
======
|
||||
|
||||
**We review the recent release of EndeavourOS “Cassini” and the distro overall.**
|
||||
|
||||
Hundreds of Linux distributions pop up every year by individuals and small teams. They are mostly the direct derivatives of Debian, Ubuntu, Fedora or Arch Linux – with a few customizations. And no wonder majority of them die every year due to a lack of contributions, vision and persistence.
|
||||
|
||||
Three years back, a small team of contributors started EndeavourOS to continue the discontinued Antergos project. And since then, it has become popular because of its simplicity of installation, user experience and features.
|
||||
|
||||
![EndeavourOS with Xfce desktop][1]
|
||||
|
||||
### EndeavourOS Review
|
||||
|
||||
A lot went into developing the distribution, which is quite evident if you have ever tried it out. The motto of this distro is to be a “general purpose” Arch Linux distribution for the masses, discarding the Arch Linux installation fear for new users and the superiority of using Arch.
|
||||
|
||||
If you ever tried EndeavourOS, you must have “felt” how “easy” things are to perform on a desktop for the end user, being an Arch distro.
|
||||
|
||||
#### Installation and desktop options to choose from
|
||||
|
||||
The installation is made super easy with the “one and only” Calamares installer. On top of that EndeavourOS team gave extra caution to provide you with most of the options during the installation steps. For example, the LIVE medium boots up directly without user intervention. And it launches the welcome screen. The welcome screen greets you with all the necessary options to install it in your system.
|
||||
|
||||
![EndeavourOS Welcome Screen][2]
|
||||
|
||||
By default, the ISO provides a lightweight Xfce desktop. However, EndeavourOS also provides you with all the desktop environments and window managers (the major ones – see below). And they are all tested to work fine. If you are connected to the internet during installation – you can install these via the Calamares installer. That means you do not need to reinstall them after the base Xfce setup.
|
||||
|
||||
Furthermore, if you are a power user and want just a basic Arch Linux to install without any desktop – then that’s also possible. Just use the “No desktop” option during installation!
|
||||
|
||||
Although Arch Linux recently created an automated script archinstall to make the installation easier, still faster and easier to get a base Arch Install via the EndeavourOS ISO.
|
||||
|
||||
![EndeavourOS installer showing no desktop and other options][3]
|
||||
|
||||
Furthermore, you have the option to choose between three options: GRUB, systemd-boot or “no bootloader” – this is one of the highlight features of the EndeavourOS “Cassini” release. In addition, you can also choose the packages you want to install (online mode only). For example, you might need a basic system to start with. Or, you might want to install some apps related to video/audio or development work. All of these you can select in this version.
|
||||
|
||||
The installation is smooth and finished by detecting the other operating systems in my test machine. In this “Cassini” release, the team also swapped the mkinitcpio with [dracut][4] for better performance and less failure on boot-related issues.
|
||||
|
||||
#### Flagship “Xfce” flavoured desktop experience
|
||||
|
||||
After the first login, you are again greeted with the Welcome app with a list of items which you can do “after install”. A very thoughtful addition from the devs. This includes initial tasks of changing wallpaper, updating Arch mirrors, installing NVIDIA drivers, and more. Many Linux distributions bring a Welcome app, but this app is a complete package, IMO.
|
||||
|
||||
![After install items in Welcome app][5]
|
||||
|
||||
The default look is the best-customized Xfce desktop you can get. It has been customized to be presented as a well-looking distro, far from what default Xfce actually brings in. This includes the GRUB menu, login screen and desktop.
|
||||
|
||||
The main Xfce menu is configured with more items, and the terminal is a little transparent and uses the Qogir icon theme. All of these changes are complemented with stunning wallpapers and Arc-Darker default Xfce theme.
|
||||
|
||||
![EndeavourOS Cassini Desktop with Xfce 4.18][6]
|
||||
|
||||
#### Performance
|
||||
|
||||
The performance of Arch Linux is always better, despite the desktop environment. It always feels faster because it doesn’t bring bloated within. On top of that, the [Xfce desktop 4.18][7] brings in additional performance optimization in the “Cassini” release, which you can feel while browsing through the desktop.
|
||||
|
||||
At idle, it uses around 700MB of memory and CPU at an average of 4%. This is the baseline. The resource usage may increase based on the number of apps you open. In my earlier reviews of EndeavourOS, the performance is always similar.
|
||||
|
||||
Not only that, it uses only 4GB of disk space for the default Xfce installation. However, you may need to install additional heavy software such as LibreOffice, GIMP, or KDenlive, which would take more disk space.
|
||||
|
||||
![EndeavourOS performance Cassini][8]
|
||||
|
||||
#### How easy is it to perform day-to-day tasks in EndeavourOS
|
||||
|
||||
One of the great features of EndeavourOS is some of the python-based GUI tools which make your life easy in Arch Linux. For example, you get notifications for updates from Arch and EndeavourOS repo, one-click software installation from AUR, and update mirrors and your system with one single click. You do not need to run any commands from the terminal. This is a big help for new users of Arch Linux.
|
||||
|
||||
![One click installation of software][9]
|
||||
|
||||
![Package cleaner and update manager][10]
|
||||
|
||||
#### A unique way of handling the rolling release towards stability
|
||||
|
||||
Arch Linux being a rolling release distro, tend to break things. For example, some systems may break during the monthly Kernel refresh of the Arch main repo. Due to its popularity and the developers’ proactiveness, you get notifications and a workaround related to the problem if things break.
|
||||
|
||||
The recent GRUB issue in Arch Linux, which caused massive boot problems for users, is really [handled well][11] by the EndeavourOS team through proper communication to the users with a workaround.
|
||||
|
||||
Hence, you are not really lost if you end up with an unstable system.
|
||||
|
||||
In addition, the pacman configuration is customized with EndeavourOS-selected mirrors to ensure your experience is flawless.
|
||||
|
||||
#### Official support for open-source hardware and ARM
|
||||
|
||||
In this EndeavourOS “Cassini” release, the official support for Pinebook Pro laptops arrives. The team worked on top of Manjaro packages with the Pine64 team to provide exclusive Arch packages for you so that the laptop works out of the box. In addition, EndeavourOS ARM images are also available to download for Raspberry Pi 4.
|
||||
|
||||
#### Community help
|
||||
|
||||
One of the greatest benefits of EndeavourOS is community help – which is instant! This is mostly for its dedicated [Telegram channel][12], where you get responses to your any EndeavourOS problems within minutes. I have been to the channel, and the mods/contributors are friendly and helpful.
|
||||
|
||||
Furthermore, you can also get help from the official forum and other social channels.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
While closing this EndeavourOS review of the [“Cassini” release,][13] I would say it’s one of the best-built distros and well-organized. The developers and the team have a clear roadmap to build a general-purpose Arch Linux distro. Also, the vision is clear with the ARM and Pinebook Pro supports and other initiatives.
|
||||
|
||||
To summarise, a perfect distro for everyone who wants a longer-running, stable system in Arch Linux.
|
||||
|
||||
You can download EndeavourOS from the [official website][14].
|
||||
|
||||
Cheers.
|
||||
|
||||
[Next:Linux Mint Upgrade Tool: Usage Guide][15]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/endeavouros-review/
|
||||
|
||||
作者:[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/12/Xubuntu-22.04-with-Xfce-4.18-Desktop-2.jpg
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-Welcome-Screen.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-installer-showing-22no-desktop22-and-other-options.jpg
|
||||
[4]: https://wiki.archlinux.org/title/Dracut
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/12/After-install-items-in-Welcome-app.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-22Cassini22-Desktop-with-Xfce-4.18.jpg
|
||||
[7]: https://www.debugpoint.com/xfce-4-18-features/
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/12/EndeavourOS-performance-22Cassini22.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/12/One-click-installation-of-software.jpg
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/12/Package-cleaner-and-update-manager.jpg
|
||||
[11]: https://endeavouros.com/news/full-transparency-on-the-grub-issue/
|
||||
[12]: https://endeavouros.com/community/
|
||||
[13]: https://endeavouros.com/news/cassini-packed-with-new-features-is-here/
|
||||
[14]: https://endeavouros.com/download/
|
||||
[15]: https://www.debugpoint.com/mint-upgrade-tool/
|
@ -1,258 +0,0 @@
|
||||
[#]: subject: "11 New Distros to look forward to in 2023"
|
||||
[#]: via: "https://news.itsfoss.com/new-distros-2023/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Cubik65536"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
11 New Distros to look forward to in 2023
|
||||
======
|
||||
|
||||
What are you looking forward to in 2023? Try these distros!
|
||||
|
||||
![11 New Distros to look forward to in 2023][1]
|
||||
|
||||
It's time to say goodbye to 2022! 📆
|
||||
|
||||
There were many distro releases in 2022, some more extraordinary than others.
|
||||
|
||||
With the trend shifting towards focusing more on the user experience and performance side of things, Linux distributions have significantly evolved over the past year.
|
||||
|
||||
As for you, the end-user, you now have several options. You can try some [beginner-friendly options][2] or [distros for advanced users][3].
|
||||
|
||||
Here, I focus on new options that you can give a try. These distros may not necessarily replace the popular distributions available. But if you want to try something new and different, feel free to go through the list.
|
||||
|
||||
So, what can you expect in 2023? 🤔
|
||||
|
||||
Well, to answer that. Allow me to take you on a distro journey!
|
||||
|
||||
> 💡 New distributions may not be suitable for production use cases. Try these options if you have no issues taking a leap of faith to experiment.
|
||||
|
||||
### 1. Vanilla OS
|
||||
|
||||
![vanilla os][4]
|
||||
|
||||
Vanilla OS is an Ubuntu-based distro that is the brainchild of Mirko Brombin, the creator of [Bottles][5].
|
||||
|
||||
It aims to provide a **clean, vanilla GNOME experience with on-demand immutability** and an exceptional first-time setup experience.
|
||||
|
||||
You can check it out if you want something new and want to try out the on-demand immutability features that make Vanilla OS so unique.
|
||||
|
||||
It is yet to receive a stable release (soon) and is set to receive many improvements in 2023.
|
||||
|
||||
[Vanilla OS][6]
|
||||
|
||||
### 2. XeroLinux
|
||||
|
||||
![xeroxlinux][7]
|
||||
|
||||
Steve a.k.a. TechXero, started [XeroLinux][8] as a passion project that was not meant to be a mainstream distro with all the bells and whistles.
|
||||
|
||||
An **'eye-candy' version of Arch Linux** offers a pleasant out-of-the-box experience with a few exciting features.
|
||||
|
||||
You can try this if you want a more accessible Arch Linux experience.
|
||||
|
||||
**From January 2023**, XeroLinux will be switching to a monthly release schedule. So, you can expect plenty of updates in 2023!
|
||||
|
||||
[XeroLinux][9]
|
||||
|
||||
### 3. Crystal Linux
|
||||
|
||||
![crystal linux][10]
|
||||
|
||||
Crystal Linux is an upcoming Arch-based distro that wants to **provide an easy-to-use desktop experience coupled with modern Linux technologies**.
|
||||
|
||||
In its current form, it may not be welcoming to newcomers, and people with experience using Linux are likelier to like it.
|
||||
|
||||
So, for now, I would suggest users who are already familiar with Linux give Crystal Linux a try.
|
||||
|
||||
I expect Crystal Linux to have a stable release sometime in 2023 with many features and improvements over the [beta version][11] that is available right now.
|
||||
|
||||
[Crystal Linux][12]
|
||||
|
||||
#### Recommended Read 📖
|
||||
|
||||
### 4. TUXEDO OS
|
||||
|
||||
![tuxedo os][13]
|
||||
|
||||
[TUXEDO OS][14] is an Ubuntu-based offering from TUXEDO Computers, a Linux-focused hardware manufacturer.
|
||||
|
||||
It features the KDE Plasma desktop environment with extras like **TUXEDO Control Center** to fine-tune your hardware and **TUXEDO Tomte**, a configuration service for resolving driver/missing package issues.
|
||||
|
||||
I suggest you try this if you want a **different KDE-powered experience**.
|
||||
|
||||
Initially, it was only made available as a pre-installed operating system on TUXEDO laptops and computers.
|
||||
|
||||
But later, it received a general use release back in September 2022 dubbed as 'TUXEDO OS 1'. It is set to receive plenty of updates in 2023.
|
||||
|
||||
[TUXEDO OS][15]
|
||||
|
||||
### 5. EuroLinux
|
||||
|
||||
![euro linux][16]
|
||||
|
||||
An RHEL-based distro with **enterprise perks** is what [EuroLinux][17] is. It provides stability and security in a solid package.
|
||||
|
||||
Based on **RHEL 9**, it can provide seamless compatibility with other [RHEL-based server distros][18] such as Rocky Linux, CentOS, AlmaLinux, and more.
|
||||
|
||||
It aims to lure in Windows and macOS users with a familiar user interface layout with its implementation of a translucent dock at the bottom of the screen.
|
||||
|
||||
You should try this because the overall package is quite adequate and can cater to both Linux and Windows/macOS users.
|
||||
|
||||
It is now available as stable release, with updates planned for 2023.
|
||||
|
||||
[EuroLinux Desktop][19]
|
||||
|
||||
### 6. Zinc
|
||||
|
||||
![zinc][20]
|
||||
|
||||
[Zinc][21] is an **Ubuntu-based distro** that has been tweaked to provide a unique experience. Existing Ubuntu users may be surprised to see what it has to offer.
|
||||
|
||||
Based on the latest LTS release of **Xubuntu**, it uses the XFCE desktop environment with numerous improvements, such as integrated Linux AppImage support, deb-get package installer, BTRFS as the default file system, and more.
|
||||
|
||||
This distro can be a viable alternative to replace your daily driver, provided it is set up correctly.
|
||||
|
||||
It follows a stable release model, so you can expect significant updates in 2023!
|
||||
|
||||
[Zinc][21]
|
||||
|
||||
### 7. CachyOS
|
||||
|
||||
![cachyos][22]
|
||||
|
||||
[CachyOS][23] tries to make **Arch Linux a beginner-friendly affair** that anyone can use. It is popular because of its high level of customizability and also because it has the newest software.
|
||||
|
||||
It aims to provide you with a fast and secure operating system that is easy to use.
|
||||
|
||||
This OS is for users who want to experiment and try something new.
|
||||
|
||||
CachyOS is a rolling-release distro, so you can expect it to receive a ton of updates in 2023.
|
||||
|
||||
[CachyOS][23]
|
||||
|
||||
### 8. risiOS
|
||||
|
||||
![risios][24]
|
||||
|
||||
In a sea of Arch and Ubuntu-based Linux distros, [risiOS][25] is a rare sight to see.
|
||||
|
||||
Based on Fedora Linux, the project saw its beginnings in Seattle, USA.
|
||||
|
||||
It uses the **GNOME desktop environment** to provide users with a highly customizable experience with a **customized ZSH version**.
|
||||
|
||||
If you want to try a Fedora-based distro, this can be something new for you!
|
||||
|
||||
risiOS gets a stable release with minor updates pushed in between. It has much more to give in 2023.
|
||||
|
||||
[risiOS][25]
|
||||
|
||||
### 9. Exodia OS
|
||||
|
||||
![exodia os][26]
|
||||
|
||||
Another Arch-based Linux distro!#$**?
|
||||
|
||||
Yes. 🤭 Well, it looks like this year, we have had enough of Arch-based distros, which is not necessarily bad!
|
||||
|
||||
Meet [Exodia OS][27], an Arch-based Linux distro that aims to be highly customizable for users in cybersecurity fields.
|
||||
|
||||
Its feature set includes pre-installed **tools for all cybersecurity fields, TUI Apps, ElKowars wacky widgets (EWW), zsh, and more**.
|
||||
|
||||
If you are a cybersecurity expert or an enthusiast, you can give this a try!
|
||||
|
||||
They offer three releases for different use cases. You can expect them to keep pushing essential updates and feature additions in 2023.
|
||||
|
||||
[Exodia OS][27]
|
||||
|
||||
### 10. Kumandar Linux
|
||||
|
||||
![kumander linux][28]
|
||||
|
||||
At first glance, you would think that it is Windows 7, but if you look closer, you will find that it is [Kumandar Linux][29].
|
||||
|
||||
It is based on **Debian 11 and uses a customized version of XFCE**.
|
||||
|
||||
The name stands for 'Commander' in English and pays homage to the developer's first computer, the [Commodore VIC20][30].
|
||||
|
||||
If you liked the Windows 7 experience but wanted the same thing on Linux. Then you can give this a try!
|
||||
|
||||
Currently, only the early-release candidate has been released. But you can expect a stable release in 2023, hopefully!
|
||||
|
||||
[Kumander][29]
|
||||
|
||||
### 11. Ubuntu Unity
|
||||
|
||||
![ubuntu unity][31]
|
||||
|
||||
Declared as an official flavor of Ubuntu [earlier this year][32], Ubuntu Unity is a remix of Ubuntu.
|
||||
|
||||
It features the **Unity desktop interface** used in Ubuntu from 2010-2017, which was dropped in favor of GNOME.
|
||||
|
||||
The development has been in full swing, with the young lead developer pushing updates and feature additions.
|
||||
|
||||
Users who want to try a different flavor of Ubuntu can give this a shot. It offers both LTS and non-LTS releases.
|
||||
|
||||
[Ubuntu Unity][33]
|
||||
|
||||
**So, wrapping up.**
|
||||
|
||||
Even with this comprehensive list, I may have missed out on some. 🤔
|
||||
|
||||
But.
|
||||
|
||||
Maybe a surprise release will take the headlines in 2023, or some existing distro will try something different.
|
||||
|
||||
Until then.
|
||||
|
||||
_💬 Do tell me what distribution you are excited about in 2023?_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/new-distros-2023/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Cubik65536](https://github.com/Cubik65536)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/distros-to-look-forward-in-2023.png
|
||||
[2]: https://itsfoss.com/best-linux-beginners/
|
||||
[3]: https://itsfoss.com/advanced-linux-distros/
|
||||
[4]: https://news.itsfoss.com/content/images/2022/12/Vanilla-OS-1.png
|
||||
[5]: https://usebottles.com
|
||||
[6]: https://vanillaos.org
|
||||
[7]: https://news.itsfoss.com/content/images/2022/12/XeroLinux.jpg
|
||||
[8]: https://itsfoss.com/xerolinux/
|
||||
[9]: https://xerolinux.xyz
|
||||
[10]: https://news.itsfoss.com/content/images/2022/12/Crystal-Linux.jpg
|
||||
[11]: https://git.getcryst.al/crystal
|
||||
[12]: https://getcryst.al
|
||||
[13]: https://news.itsfoss.com/content/images/2022/12/TuxedoOS.jpg
|
||||
[14]: https://news.itsfoss.com/tuxedo-os/
|
||||
[15]: https://www.tuxedocomputers.com/en/TUXEDO-OS_1.tuxedo
|
||||
[16]: https://news.itsfoss.com/content/images/2022/12/EuroLinux.jpg
|
||||
[17]: https://news.itsfoss.com/eurolinux-desktop/
|
||||
[18]: https://itsfoss.com/rhel-based-server-distributions/
|
||||
[19]: https://en.euro-linux.com/eurolinux/desktop/
|
||||
[20]: https://news.itsfoss.com/content/images/2022/12/Zinc.png
|
||||
[21]: https://teejeetech.com/tag/zinc/
|
||||
[22]: https://news.itsfoss.com/content/images/2022/12/CachyOS.jpg
|
||||
[23]: https://cachyos.org
|
||||
[24]: https://news.itsfoss.com/content/images/2022/12/risiOS.png
|
||||
[25]: https://risi.io
|
||||
[26]: https://news.itsfoss.com/content/images/2022/12/Exodia-OS.jpg
|
||||
[27]: https://exodia-os.github.io/exodia-website/
|
||||
[28]: https://news.itsfoss.com/content/images/2022/12/Kumander-Linux.jpg
|
||||
[29]: https://www.kumander.org
|
||||
[30]: https://en.wikipedia.org/wiki/VIC-20
|
||||
[31]: https://news.itsfoss.com/content/images/2022/12/UbuntuUnity.jpg
|
||||
[32]: https://news.itsfoss.com/unity-remix-official-flavor/
|
||||
[33]: https://ubuntuunity.org/
|
@ -1,185 +0,0 @@
|
||||
[#]: subject: "11 tips for writing a good Git commit message"
|
||||
[#]: via: "https://opensource.com/article/22/12/git-commit-message"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
11 tips for writing a good Git commit message
|
||||
======
|
||||
|
||||
Lately, I have been paying closer attention to the changelogs I get from products and services when updates are needed. Here are some examples:
|
||||
|
||||
- Fixed some bugs.
|
||||
- Made some accessibility improvements.
|
||||
- We've made improvements and fixed bugs for a smoother ride.
|
||||
|
||||
When I think about some of the first commit messages I made as a junior developer I have to hang my head in dismay:
|
||||
|
||||
- Pointed and clicked around a bit and now things seem to work.
|
||||
- Did what programmer X told me to do and now the banner is blue.
|
||||
|
||||
This can be frustrating! I asked our community of contributors the following questions:
|
||||
|
||||
- What makes a good Git commit message?
|
||||
- What makes a bad one?
|
||||
- What rules do you think a project should have around what a commit message contains?
|
||||
|
||||
Here are their answers:
|
||||
|
||||
### Great writing is key
|
||||
|
||||
As with anything you write, you should think about who is going to read it. Then adapt the amount and depth of information accordingly.
|
||||
|
||||
Improving your natural language and writing skills is essential for a healthy career in software development. It's not just code that counts.
|
||||
|
||||
**—[Camilla Conte][1]**
|
||||
|
||||
### Be descriptive and don't assume
|
||||
|
||||
I spend a lot of my time collaborating in the [OpenStack][2] community, and its code reviewers have some fairly exacting standards compared to what I see from other projects "in the wild."
|
||||
|
||||
I'll often spend far longer composing a solid commit message than I do writing the actual code implementation or fix. Sometimes commit messages can end up many times longer than the diffs they're explaining.
|
||||
|
||||
To summarize some of the contributor guidance:
|
||||
|
||||
- Describe why a change is being made, not just what is changing
|
||||
- The first commit line is the most important (like the subject line of an email)
|
||||
- Don't assume reviewers understand the original problem you're fixing
|
||||
- Don't assume the reviewer has access to external web services or the site (summarize defect reports and other relevant discussions)
|
||||
- Don't assume the code is self-evident and self-documenting (though there is no need to repeat points you also make in your code comments)
|
||||
- Don't include information only relevant to earlier revisions of the change (we expect contributors to squash revisions together and edit their commit messages accordingly).
|
||||
|
||||
There's a brief section on the topic in the OpenStack Contributors Guide: [https://docs.openstack.org/contributors/common/git.html#commit-messages][3]
|
||||
|
||||
**—[Jeremy Stanley][4]**
|
||||
|
||||
### Your future self will thank you
|
||||
|
||||
I cannot agree more with Jeremy. +1000
|
||||
|
||||
Jeremy said, "describe why a change is being made, not just what's changing."
|
||||
|
||||
Imagine you're someone else, in a faraway future, trying to work out this commit.
|
||||
|
||||
Put yourself in other people's shoes, as the old saying goes.
|
||||
|
||||
**—[Leigh Morresi][5]**
|
||||
|
||||
### Use the bug ID
|
||||
|
||||
I recommend adding the bug ID at the start of the commit message so that it's easier to track the commits at a later stage using the [`grep` command][6].
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ git commit -m "BZ#19xxxxx
|
||||
```
|
||||
|
||||
To come up with thoughtful commits, consider the following:
|
||||
|
||||
- Why have I made these changes?
|
||||
- What effect have my changes made?
|
||||
- Why was the change needed?
|
||||
- What are the changes in reference to?
|
||||
|
||||
**—[Agil Antony][7]**
|
||||
|
||||
### Tell the whole story
|
||||
|
||||
I like to imagine there is a hidden prefix to every commit message that reads "By applying this."
|
||||
|
||||
A good commit message includes exactly what will happen and why. It is insufficient to merely have the work ticket reference because that decentralizes the information; Git is decentralized. As a software developer, I want to know why the proposed changes are being considered. What specific problem is being addressed? What alternate solutions were considered (and discarded)? What unexpected things were discovered during the creation of the changeset that influenced the current content?
|
||||
|
||||
There's no prize for shortest commit message. Your future self and future colleagues will appreciate you going into depth to explain the problem and why this changeset is the answer. Harness those cooking blogs where there's a five-paragraph life story. Here, however, make the problem the subject of the life story.
|
||||
|
||||
**—[Lisa Seelye][8]**
|
||||
|
||||
### But don't be overly verbose
|
||||
|
||||
A good git commit message contains information about what was done, and nothing else. For instance, if you needed to update the .gitignore, just say "updated .gitignore." Folks can dive into the commit itself for more details. It doesn't need to be verbose.
|
||||
|
||||
A bad commit message is something like, "oh crap" or "try this". Granted, I've been guilty of this, but it doesn't help anyone if they need to look at commits at a glance.
|
||||
|
||||
Rules are very subjective. They can differ from lead to lead and team to team. But at the very least, give some contextual information about the commit. Especially if it's a large one. No one has time to skim through 1000+ files with a heavy change history.
|
||||
|
||||
**—[Miriam Goldman][9]**
|
||||
|
||||
### Use present tense
|
||||
|
||||
I like project manager-styled commit messages written in present and not future terms (for example, "add" instead of "added"). However, it's usually only possible if commits are frequent. There's only so much "how did I do it" you can remember when you're faced with a deadline. Yet, well-written commits not only help collaborators, but are also helpful to the committer in recollecting history.
|
||||
|
||||
**—[Chris Okpada][10]**
|
||||
|
||||
### Don't rely on links
|
||||
|
||||
One thing I like to remind colleagues of is that you're not just explaining to the people who are going to decide whether to approve your commit. You're also explaining to future developers and users who have found this commit in a bisect or blame operation and are trying to understand its relevance.
|
||||
|
||||
If the only context supplied is a link to some external system, and that far in the future the system it links to is no longer in use or has otherwise become inaccessible to that individual, your commit message has been rendered useless and may just as well be blank.
|
||||
|
||||
All too often, I go digging in the Git history of some open source project, and find commit messages which are nothing more than a bug ID or a link to some company's internal and private defect tracker.
|
||||
|
||||
Don't be that project!
|
||||
|
||||
**—[Jeremy Stanley][4]**
|
||||
|
||||
### Clear and concise changelogs
|
||||
|
||||
As a release communications manager, I often read the entire release board. I also met with developers to discuss any areas that weren't clear yet. Then I tested the release early. After that, I would write a release post by sourcing the changelogs and corresponding revised or new content.
|
||||
|
||||
The changelogs are personal reminders for developers, but also have corresponding issues and tickets for them. You should capitalize product names appropriately, use a spell checker, be consistent with punctuation, and sentence structure. The lead developer should proofread these as well. Your customers, that are developers, are reading these. What information should they know before running the update to better serve their customers?
|
||||
|
||||
**—[Courtney Robertson][11]**
|
||||
|
||||
### Be specific
|
||||
|
||||
As a frequent release manager, I like messages that name the component a commit touches, and a brief description of what was changed. Also having a reference back to where the request for this work came from helps to tie fixes together long after we forgot about your clever branch name.
|
||||
|
||||
- "fix fatal error" is not ideal.
|
||||
- "ISS-304: Fix fatal error in Login Access Control function for users
|
||||
with the Partner role" is better.
|
||||
- "ISS-304: Login Access Control: fix fatal error in getPartnerId()" is
|
||||
better still.
|
||||
|
||||
I can look at the entire relationship between a Git commit, branch, merge commit, and inspect the individual lines and files that were changed. But I don't have that kind of time in the middle of a release. I want to be able to relate back to the source of this work in the project management tool, have some idea of which components are being changed, and in what way.
|
||||
|
||||
**—[Ryan Price][12]**
|
||||
|
||||
### Make it a habit
|
||||
|
||||
My favorite commit that I'm guilty of is, "commit before I switch branches" because I have to work on something else more urgent. Sometimes, I need to commit my current work to a totally different project. My manager's strategy is to have us work as we normally do. But then when we rebase, he wants us to squash commits where it makes sense and write better messages. I can't say we always do this, but his method does make sense.
|
||||
|
||||
I have a lot of "this is broken don't know why" type messages too (haha) where I try things but want to commit that attempt before I try something else in case method A was closer to fixing the issue than method B. Writing code is a hot mess. And I've been writing it for over 10 years.
|
||||
|
||||
**—[RachieVee][13]**
|
||||
|
||||
What commit message advice or tips do you live by? Let us know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/git-commit-message
|
||||
|
||||
作者:[AmyJune Hineline][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/amyjune
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/users/spotlesstofu
|
||||
[2]: https://opensource.com/resources/what-is-openstack
|
||||
[3]: https://docs.openstack.org/contributors/common/git.html#commit-messages
|
||||
[4]: https://opensource.com/users/fungi
|
||||
[5]: https://opensource.com/users/dgtlmoon
|
||||
[6]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[7]: https://opensource.com/users/agantony
|
||||
[8]: https://opensource.com/users/lisa
|
||||
[9]: https://opensource.com/users/miriamgoldman
|
||||
[10]: https://opensource.com/users/ojchris
|
||||
[11]: https://opensource.com/users/courtneyrdev
|
||||
[12]: https://opensource.com/users/liberatr
|
||||
[13]: https://opensource.com/users/rachievee
|
@ -1,98 +0,0 @@
|
||||
[#]: subject: "Document with BookStack, an open source Confluence alternative"
|
||||
[#]: via: "https://opensource.com/article/23/1/bookstack-open-source-documentation"
|
||||
[#]: author: "Dan Brown https://opensource.com/users/ssddanbrown"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Document with BookStack, an open source Confluence alternative
|
||||
======
|
||||
|
||||
BookStack is an open source, web-based documentation system, that allows you to create a structured knowledge store for personal, team, or company use. BookStack focuses on ease-of-use and design to provide an experience suitable for an audience with, potentially, mixed skills in technology. It's built upon the PHP framework Laravel, with MySQL or MariaDB used as a datastore.
|
||||
|
||||
I built BookStack after attempting to find a documentation or wiki system for my workplace. [Confluence][1] was the closest option to suit my requirements but the user-based pricing introduced a barrier. The closed nature of Confluence also raised questions to the longevity of the documentation I'd be building. In the end, I decided to build my own platform to suit my needs. I released it under the MIT license to give back to the open source community that I'd come to love and benefit from over the years.
|
||||
|
||||
### Content hierarchy and organization options
|
||||
|
||||
To keep things familiar and intuitive, BookStack makes use of real-world book terms to describe its organization structure. Documentation content is created as a "Page":
|
||||
|
||||
- Pages belong to a specific "Book".
|
||||
- Within a Book, Pages can optionally be grouped up into "Chapters".
|
||||
- As your documentation grows, you can then use "Shelves" to categorize Books, with Books being able to be part of multiple shelves if needed.
|
||||
|
||||
This structure sits at the heart of BookStack, and can often be the love-it-or-hate-it deciding aspect of whether BookStack is suitable for your use case.
|
||||
|
||||
Upon this core hierarchy, BookStack also provides tagging, user favorites, and advanced search capabilities to ensure content remains discoverable.
|
||||
|
||||
### Writing documentation
|
||||
|
||||
The primary method of writing documentation in BookStack is through the use of its what-you-see-is-what-you-get (WYSIWYG) editor, which makes use of the open source [Tiny][2] project. This editor provides a range of content formats including:
|
||||
|
||||
- Various header levels
|
||||
- Code blocks
|
||||
- Collapsible blocks
|
||||
- Tables
|
||||
- Images
|
||||
- Links
|
||||
- iFrame embeds
|
||||
- Alert callouts
|
||||
- Bullet, numbered and tasks lists
|
||||
- Drawings (through intregration with the open source [diagrams.net][3])
|
||||
|
||||
If you prefer [Markdown][4], you can use the built-in Markdown editor, which provides a live preview and supports the same feature set as the WYSIWYG editor. If permission allows, you can even jump between these editor options depending on the page you're editing.
|
||||
|
||||
### How your data is stored
|
||||
|
||||
Documentation is stored within a [MySQL or MariaDB][5] database in a relatively simple HTML format, in addition to the original Markdown content if Markdown was used. A lot of design and development decisions have been made to keep this HTML format simplistic. It uses plain standard HTML elements where possible, to ensure raw documentation content remains open and portable.
|
||||
|
||||
Uploaded images, attachments, and created drawings are saved on the local filesystem but can optionally be stored in an s3-compatible datastore like the open source [MinIO][6].
|
||||
|
||||
To keep your content accessible, there are built-in options to export content as PDF, HTML, plain text, or Markdown. For external consumption, there's a HTTP REST API and a webhook system. In terms of extension, a "logical theme system" allows running of custom PHP code upon a wide range of system events.
|
||||
|
||||
### Ready for business
|
||||
|
||||
BookStack comes with a range of features to support business environments. Support for a range of authentication options are built-in, including SAML2, OpenID Connect, and LDAP allowing easy single-sign-on usage with platforms such as [KeyCloak][7]. MFA options are available and can be mandated based upon role. An audit log provides full visibility of modification activities across an instance.
|
||||
|
||||
A full role-based permission system provides administrators full control over create, view, update, and delete actions of system content. This allows per-role system defaults, with options to set custom permissions on a per-hierarchy item basis.
|
||||
|
||||
### A community of support
|
||||
|
||||
After being active for over 7 years, the community for BookStack has grown with various avenues for discussion and support. We now have:
|
||||
|
||||
- [Our documentation site][8]
|
||||
- [Video guides on YouTube][9]
|
||||
- [A subreddit][10]
|
||||
- [An active GitHub issues list][11]
|
||||
- [Paid-for business support][12]
|
||||
|
||||
If you want to play with BookStack, you can try it out [on our demo site][13]. To learn how to set up your own instance, visit the [installation page of our documentation][14].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/bookstack-open-source-documentation
|
||||
|
||||
作者:[Dan Brown][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/ssddanbrown
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/20/9/open-source-alternatives-confluence
|
||||
[2]: https://github.com/tinymce/
|
||||
[3]: https://www.diagrams.net/
|
||||
[4]: https://opensource.com/article/19/9/introduction-markdown
|
||||
[5]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet
|
||||
[6]: https://github.com/minio/
|
||||
[7]: https://www.keycloak.org/
|
||||
[8]: https://www.bookstackapp.com/docs/
|
||||
[9]: https://www.youtube.com/c/BookStackApp
|
||||
[10]: https://www.reddit.com/r/bookstack
|
||||
[11]: https://github.com/BookStackApp/BookStack/issues
|
||||
[12]: https://www.bookstackapp.com/support
|
||||
[13]: https://demo.bookstackapp.com/books/bookstack-demo-site/page/logging-in-to-the-demo-site
|
||||
[14]: https://www.bookstackapp.com/docs/admin/installation/
|
@ -1,210 +0,0 @@
|
||||
[#]: subject: "Learn to code with my retro computer program"
|
||||
[#]: via: "https://opensource.com/article/23/1/learn-machine-language-retro-computer"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn to code with my retro computer program
|
||||
======
|
||||
|
||||
I teach university courses part-time, including a class about general computing topics, open to all majors. This is an introductory course that teaches students about how technology works, to remove the mystery around computing.
|
||||
|
||||
While not a computer science course, one section of this course covers computer programming. I usually talk about programming in very abstract terms, so I don't lose my audience. But this year, I wanted my students to do some "hands-on" programming in an "old school" way. At the same time, I wanted to keep it simple, so everyone could follow along.
|
||||
|
||||
I like to structure my lessons to show how you got from "there" to "here." Ideally, I would let my students learn how to write a simple program. Then I would pick it up from there to show how modern programming allows developers to create more complex programs. I decided to try an unconventional approach — teach the students about the ultimate in low-level programming: machine language.
|
||||
|
||||
### Machine language programming
|
||||
|
||||
Early personal computers like the Apple II (1977), TRS-80 (1977), and IBM PC (1981) let users enter programs with a keyboard, and displayed results on a screen. But computers didn't always come with a screen and keyboard.
|
||||
|
||||
The Altair 8800 and IMSAI 8080 (both made in 1975) required users to enter a program using "switches and lights" on a panel. You would enter an instruction in machine language, using a bank of switches, and the machine would light up the ones and zeros of each binary instruction using LEDs.
|
||||
|
||||
![Image of an Altair 8800 Computer.][1]
|
||||
|
||||
Programming these early machines required knowing the machine language instructions, called opcodes, short for operation codes, to perform basic operations like adding two numbers or storing a value into the computer's memory. I wanted to show my students how programmers would enter a series of instructions and memory addresses by hand, using the switches and lights.
|
||||
|
||||
However, using an actual Altair 8800 would be too much overhead in this class. I needed something simple that any beginner-level student could grasp. Ideally, I hoped to find a simple "hobby" retro computer that worked similarly to the Altair 8800, but I couldn't find a suitable "Altair-like" device for less than $100. I found several "Altair" software emulators, but they faithfully reproduce the Altair 8800 opcodes, and that was too much for my needs.
|
||||
|
||||
I decided to write my own "educational" retro computer. I call it the Toy CPU. You can find it on my [GitHub repository][2], including several releases to play with. Version 1 was an experimental prototype that ran on [FreeDOS][3]. Version 2 was an updated prototype that ran on Linux with [ncurses][4]. Version 3 is a FreeDOS program that runs in graphics mode.
|
||||
|
||||
### Programming the Toy CPU
|
||||
|
||||
The Toy CPU is a very simple retro computer. Sporting only 256 bytes of memory and a minimal instruction set, the Toy CPU aims for simplicity while replicating the "switches and lights" programming model. The interface mimics the Altair 8800, with a series of eight LEDs for the counter (the "line number" for the program), instruction, accumulator (internal memory used for temporary data), and status.
|
||||
|
||||
When you start the Toy CPU, it simulates "booting" by clearing the memory. While the Toy CPU is starting up, it also displays `INI` ("initialize") in the status lights at the bottom-right of the screen. The `PWR` ("power") light indicates the Toy CPU has been turned on.
|
||||
|
||||
![Image of start screen for the toy cpu.][5]
|
||||
|
||||
When the Toy CPU is ready for you to enter a program, it indicates `INP` ("input" mode) via the status lights, and starts you at counter 0 in the program. Programs for the Toy CPU always start at counter 0.
|
||||
|
||||
In "input" mode, use the up and down arrow keys to show the different program counters, and press Enter to edit the instruction at the current counter. When you enter "edit" mode, the Toy CPU shows `EDT` ("edit" mode) on the status lights.
|
||||
|
||||
![Image of the toy CPU editing screen.][6]
|
||||
|
||||
The Toy CPU has a cheat sheet that's "taped" to the front of the display. This lists the different opcodes the Toy CPU can process:
|
||||
|
||||
- `00000000` (`STOP`): Stop program execution.
|
||||
- `00000001` (`RIGHT`): Shift the bits in the accumulator to the right by one position. The value 00000010 becomes 00000001, and 00000001 becomes 00000000.
|
||||
- `00000010` (`LEFT`): Shift the bits in the accumulator to the left by one position. The value 01000000 becomes 10000000, and 10000000 becomes 00000000.
|
||||
- `00001111` (`NOT`): Binary NOT the accumulator. For example, the value 10001000 becomes 01110111.
|
||||
- `00010001` (`AND`): Binary AND the accumulator with the value stored at an address. The address is stored in the next counter.
|
||||
- `00010010` (`OR`): Binary OR the accumulator with the value stored at an address.
|
||||
- `00010011` (`XOR`): Binary XOR (“exclusive or”) the accumulator with the value stored at an address.
|
||||
- `00010100` (`LOAD`): Load (copy) the value from an address into the accumulator.
|
||||
- `00010101` (`STORE`): Store (copy) the value in the accumulator into an address.
|
||||
- `00010110` (`ADD`): Add the value stored at an address to the accumulator.
|
||||
- `00010111` (`SUB`): Subtract the value stored at an address from the accumulator.
|
||||
- `00011000` (`GOTO`): Go to (jump to) a counter address.
|
||||
- `00011001` (`IFZERO`): If the accumulator is zero, go to (jump to) a counter address.
|
||||
- `10000000` (`NOP`): No operation; safely ignored.
|
||||
|
||||
When in "edit" mode, use the left and right arrow keys to select a bit in the opcode, and press `Space`to flip the value between off (0) and on (1). When you are done editing, press `Enter`to go back to "input" mode.
|
||||
|
||||
![Image of the toy CPU input mode screen.][7]
|
||||
|
||||
### A sample program
|
||||
|
||||
I want to explore the Toy CPU by entering a short program that adds two values, and stores the result in the Toy's memory. Effectively, this performs the arithmetic operation **A+B=C**. To create this program, you only need a few opcodes:
|
||||
|
||||
- `00010100` (`LOAD`): Load (copy) the value from an address into the accumulator.
|
||||
- `00010110` (`ADD`): Add the value stored at an address to the accumulator.
|
||||
- `00010101` (`STORE`): Store (copy) the value in the accumulator into an address.
|
||||
- `00000000` (`STOP`): Stop program execution.
|
||||
|
||||
The `LOAD`, `ADD`, and `STORE` instructions require a memory address, which will always be in the next counter location. For example, the first two instructions of the program are:
|
||||
|
||||
```
|
||||
counter 0: 00010100
|
||||
counter 1: some memory address where the first value A is stored
|
||||
```
|
||||
|
||||
The instruction in counter 0 is the `LOAD`operation, and the value in counter 1 is the memory address where you have stored some value. The two instructions together copy a value from memory into the Toy's accumulator, where you can work on the value.
|
||||
|
||||
Having loaded a number **A** into the accumulator, you need to add the value **B** to it. You can do that with these two instructions:
|
||||
|
||||
```
|
||||
counter 2: 00010110
|
||||
counter 3: a memory address where the second value B is stored
|
||||
```
|
||||
|
||||
Say that you loaded the value 1 (**A**) into the accumulator, then added the value 3 (**B**) to it. The accumulator will now have the value 4. Now you need to copy the value 4 into another memory address (**C**) with these two instructions:
|
||||
|
||||
```
|
||||
counter 4: 00010101
|
||||
counter 5: a memory address (C) where we can save the new value
|
||||
```
|
||||
|
||||
Having added the two values together, you can now end the program with this instruction:
|
||||
|
||||
```
|
||||
counter 6: 00000000
|
||||
```
|
||||
|
||||
Any instructions after counter 6 are available for the program to use as stored memory. That means you can use the memory at counter 7 for the value **A**, the memory in counter 8 for the value **B**, and the memory at counter 9 for the stored value **C**. You need to enter these separately into the Toy:
|
||||
|
||||
```
|
||||
counter 7: 00000001 (1)
|
||||
counter 8: 00000011 (3)
|
||||
counter 9: 00000000 (0, will be overwritten later)
|
||||
```
|
||||
|
||||
Having figured out all the instructions and the memory locations for **A**, **B**, and **C**, you can now enter the full program into the Toy. This program adds the values 1 and 3 to get 4:
|
||||
|
||||
```
|
||||
counter 0: 00010100
|
||||
counter 1: 00000111 (7)
|
||||
counter 2: 00010110
|
||||
counter 3: 00001000 (8)
|
||||
counter 4: 00010101
|
||||
counter 5: 00001001 (9)
|
||||
counter 6: 00000000
|
||||
counter 7: 00000001 (1)
|
||||
counter 8: 00000011 (3)
|
||||
counter 9: 00000000 (0, will be overwritten later)
|
||||
```
|
||||
|
||||
To run the program, press the `R` key when in "input" mode. The Toy CPU will show `RUN` ("run" mode) in the status lights, and execute your program starting at counter 0.
|
||||
|
||||
The Toy has a significant delay built into it, so you can watch the Toy execute each step in the program. You should see the counter move from 00000000 (0) to 00000110 (6) as the program progresses. After counter 1, the program loads the value 1 from memory location 7, and the accumulator updates to 00000001 (1). After counter 3, the program will add the value 3 and update the accumulator to show 00000100 (4). The accumulator will remain that way until the program stores the value into memory location 9 after counter 5 then ends at counter 6.
|
||||
|
||||
![Image of the Toy in RUN mode.][8]
|
||||
|
||||
### Exploring machine language programming
|
||||
|
||||
You can use the Toy to create other programs and further explore machine language programming. Test your creativity by writing these programs in machine language.
|
||||
|
||||
### A program to flash the lights on the accumulator
|
||||
|
||||
Can you light up the right four bits on the accumulator, then the left four bits, then all of the bits? You can write this program in one of two ways:
|
||||
|
||||
A straightforward approach would be to load three values from different memory addresses, like this:
|
||||
|
||||
```
|
||||
counter 0: LOAD
|
||||
counter 1: "right"
|
||||
counter 2: LOAD
|
||||
counter 3: "left"
|
||||
counter 4: LOAD
|
||||
counter 5: "all"
|
||||
counter 6: STOP
|
||||
counter 7: 00001111 ("right")
|
||||
counter 8: 11110000 ("left")
|
||||
counter 9: 11111111 ("all")
|
||||
```
|
||||
|
||||
Another way to write this program is to experiment with the NOT and OR binary operations. This results in a smaller program:
|
||||
|
||||
```
|
||||
counter 0: LOAD
|
||||
counter 1: "right"
|
||||
counter 2: NOT
|
||||
counter 3: OR
|
||||
counter 4: "right"
|
||||
counter 5: STOP
|
||||
counter 6: 00001111 ("right")
|
||||
```
|
||||
|
||||
### Count down from a number
|
||||
|
||||
You can use the Toy as a countdown timer. This program exercises the IFZERO test, which will jump the program to a new counter only if the accumulator is zero:
|
||||
|
||||
```
|
||||
counter 0: LOAD
|
||||
counter 1: "initial value"
|
||||
counter 2: IFZERO (this is also the "start" of the countdown)
|
||||
counter 3: "end"
|
||||
counter 4: SUB
|
||||
counter 5: "one"
|
||||
counter 6: GOTO
|
||||
counter 7: "start"
|
||||
counter 8: STOP
|
||||
counter 9: 00000111 ("initial value")
|
||||
counter 10: 00000001 ("one")
|
||||
```
|
||||
|
||||
The Toy CPU is a great way to learn about machine language. I used the Toy CPU in my introductory course, and the students said they found it difficult to write the first program, but writing the next one was much easier. The students also commented that writing programs in this way was actually fun, and they learned a lot about how computers actually work. The Toy CPU is educational and fun!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/learn-machine-language-retro-computer
|
||||
|
||||
作者:[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/2022-12/MITS_Altair_8800_Computer_%281975%29.png
|
||||
[2]: https://github.com/freedosproject/toycpu
|
||||
[3]: https://opensource.com/downloads/guide-using-freedos
|
||||
[4]: https://opensource.com/article/21/8/ncurses-linux
|
||||
[5]: https://opensource.com/sites/default/files/2022-12/toycpu.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/edit0-load.png
|
||||
[7]: https://opensource.com/sites/default/files/2022-12/input0-load.png
|
||||
[8]: https://opensource.com/sites/default/files/2022-12/run-3.png
|
@ -1,123 +0,0 @@
|
||||
[#]: subject: "Use time-series data to power your edge projects with open source tools"
|
||||
[#]: via: "https://opensource.com/article/23/1/time-series-data-edge-open-source-tools"
|
||||
[#]: author: "Zoe Steinkamp https://opensource.com/users/zoesteinkamp"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use time-series data to power your edge projects with open source tools
|
||||
======
|
||||
|
||||
Gathering data as it changes over the passage of time is known as time-series data. Today, it has become a part of every industry and ecosystem. It is a large part of the growing IoT sector and will become a larger part of everyday people's lives. But time-series data and its requirements are hard to work with. This is because there are no tools that are purpose-built to work with time-series data. In this article, I go into detail about those problems and how InfluxData has been working to solve them for the past 10 years.
|
||||
|
||||
### InfluxData
|
||||
|
||||
InfluxData is an open source time-series database platform. You may know about the company through [InfluxDB][1], but you may not have known that it specialized in time-series databases. This is significant, because when managing time-series data, you deal with two issues — storage lifecycle and queries.
|
||||
|
||||
When it comes to storage lifecycle, it's common for developers to initially collect and analyze highly detailed data. But developers want to store smaller, downsampled datasets that describe trends without taking up as much storage space.
|
||||
|
||||
When querying a database, you don't want to query your data based on IDs. You want to query based on time ranges. One of the most common things to do with time-series data is to summarize it over a large period of time. This kind of query is slow when storing data in a typical relational database that uses rows and columns to describe the relationships of different data points. A database designed to process time-series data can handle queries exponentially faster. InfluxDB has its own built-in querying language: Flux. This is specifically built to query on time-series data sets.
|
||||
|
||||
![Image of how Telegraf works.][2]
|
||||
|
||||
### Data acquisition
|
||||
|
||||
Data acquisition and data manipulation come out of the box with some awesome tools. InfluxData has over 12 client libraries that allow you to write and query data in the coding language of your choice. This is a great tool for custom use cases. The open source ingest agent, Telegraf, includes over 300 input and output plugins. If you're a developer, you can contribute your own plugin, as well.
|
||||
|
||||
InfluxDB can also accept a CSV upload for small historical data sets, as well as batch imports for large data sets.
|
||||
|
||||
```
|
||||
import math
|
||||
bicycles3 = from(bucket: "smartcity")
|
||||
|> range(start:2021-03-01T00:00:00z, stop: 2021-04-01T00:00:00z)
|
||||
|> filter(fn: (r) => r._measurement == "city_IoT")
|
||||
|> filter(fn: (r) => r._field == "counter")
|
||||
|> filter(fn: (r) => r.source == "bicycle")
|
||||
|> filter(fn: (r) => r.neighborhood_id == "3")
|
||||
|> aggregateWindow(every: 1h, fn: mean, createEmpty:false)
|
||||
bicycles4 = from(bucket: "smartcity")
|
||||
|> range(start:2021-03-01T00:00:00z, stop: 2021-04-01T00:00:00z)
|
||||
|> filter(fn: (r) => r._measurement == "city_IoT")
|
||||
|> filter(fn: (r) => r._field == "counter")
|
||||
|> filter(fn: (r) => r.source == "bicycle")
|
||||
|> filter(fn: (r) => r.neighborhood_id == "4")
|
||||
|> aggregateWindow(every: 1h, fn: mean, createEmpty:false)join(tables: {neighborhood_3: bicycles3, neighborhood_4: bicycles4}, on ["_time"], method: "inner")
|
||||
|> keep(columns: ["_time", "_value_neighborhood_3","_value_neighborhood_4"])
|
||||
|> map(fn: (r) => ({
|
||||
r with
|
||||
difference_value : math.abs(x: (r._value_neighborhood_3 - r._value_neighborhood_4))
|
||||
}))
|
||||
```
|
||||
|
||||
### Flux
|
||||
|
||||
Flux is our internal querying language built from the ground up to handle time-series data. It's also the underlying powerhouse for a few of our tools, including tasks, alerts, and notifications. To dissect the flux query from above, you need to define a few things. For starters, a "bucket" is what we call a database. You configure your buckets and then add your data stream into them. The query calls the smartcity bucket, with the range of a specific day (a 24-hour period to be exact.) You can get all the data from the bucket, but most users include a data range. That's the most basic flux query you can do.
|
||||
|
||||
Next, I add filters, which filter the data down to something more exact and manageable. For example, I filter for the count of bicycles in the neighborhood assigned to the id of 3. From there, I use aggregateWindow to get the mean for every hour. That means I expect to receive a table with 24 columns, one for every hour in the range. I do this exact same query for neighborhood 4 as well. Finally, I join the two tables and get the differences between bike usage in these two neighborhoods.
|
||||
|
||||
This is great if you want to know what hours are high-traffic hours. Obviously, this is just a small example of the power of flux queries. But it gives a great example of some of the tools flux comes with. I also have a large amount of data analysis and statistics functions. But for that, I suggest checking out the Flux documentation.
|
||||
|
||||
```
|
||||
import "influxdata/influxdb/tasks"
|
||||
option task = {name: PB_downsample, every: 1h, offset: 10s}
|
||||
from(bucket: "plantbuddy")
|
||||
|>range(start: tasks.lastSuccess(orTime: -task.every))
|
||||
|>filter(fn: (r) => r["_measurement"] == "sensor_data")
|
||||
|>aggregateWindow(every: 10m, fn:last, createEmpty:false)
|
||||
|>yield(name: "last")
|
||||
|>to(bucket: "downsampled")
|
||||
```
|
||||
|
||||
### Tasks
|
||||
|
||||
An InfluxDB task is a scheduled Flux script that takes a stream of input data and modifies or analyzes it in some way. It then stores the modified data in a new bucket or performs other actions. Storing a smaller data set into a new bucket is called "downsampling," and it's a core feature of the database, and a core part of the time-series data lifecycle.
|
||||
|
||||
You can see in the current task example that I've downsampled the data. I'm getting the last value for every 10-minute increment and storing that value in the downsampled bucket. The original data set might have had thousands of data points in those 10 minutes, but now the downsampled bucket only has 60 new values. One thing to note is that I'm also using the last success function in range. This tells InfluxDB to run this task from the last time it ran successfully, just in case it has failed for the past 2 hours, in which case it can go back three hours in time to the last successful run. This is great for built-in error handling.
|
||||
|
||||
![Image of the checks and alerts notification system.][3]
|
||||
|
||||
### Checks and alerts
|
||||
|
||||
InfluxDB includes an alerting or checks and notification system. This system is very straightforward. You start with a check that looks at the data periodically for anomalies that you've defined. Normally, this is defined with thresholds. For example, any temperature value under 32° F gets assigned a value of `WARN`, and anything above 32° F gets assigned a value of `OK`, and anything below 0° F gets a value of `CRITICAL`. From there, your check can run as often as you deem necessary. There is a recorded history of your checks and the current status of each. You are not required to set up a notification when it's not needed. You can just reference your alert history as needed.
|
||||
|
||||
Many people choose to set up their notifications. For that, you need to define a notification endpoint. For example, a chat application could make an HTTP call to receive your notifications. Then you define when you would like to receive notifications, for example you can have checks run every hour. You can run notifications every 24 hours. You can have your notification respond to a change in the value, for example `WARN` to `CRITICAL`, or when a value is `CRITICAL`, regardless of it changing from `OK` to `WARN`. This is a highly customizable system. The Flux code that's created from this system can also be edited.
|
||||
|
||||
![Image of the new Edge feature.][4]
|
||||
|
||||
### Edge
|
||||
|
||||
To wrap up, I'd like to bring all the core features together, including a very special new feature that's recently been released. Edge to cloud is a very powerful tool that allows you to run the open source InfluxDB and locally store your data in case of connectivity issues. When connectivity is repaired, it streams the data to the InfluxData cloud platform.
|
||||
|
||||
This is significant for edge devices and important data where any loss of data is detrimental. You define that you want a bucket to be replicated to the cloud, and then that bucket has a disk-backed queue to store the data locally. Then you define what your cloud bucket should replicate into. The data is stored locally until connected to the cloud.
|
||||
|
||||
### InfluxDB and the IoT Edge
|
||||
|
||||
Suppose you have a project where you want to [monitor the health of household plants][5] using IoT sensors attached to the plant. The project is set up using your laptop as the edge device. When your laptop is closed or otherwise off, it stores the data locally, and then streams it to my cloud bucket when reconnected.
|
||||
|
||||
![Image showing how Plant buddy works.][6]
|
||||
|
||||
One thing to notice is that this downsamples data on the local device before storing it in the replication bucket. Your plant's sensors provide a data point for every second. But it condenses the data to be an average of one minute so you have less data to store. In the cloud account, you might add some alerts and notifications that let you know when the plant's moisture is below a certain level and needs to be watered. There could also be visuals you could use on a website to tell users about their plants' health.
|
||||
|
||||
Databases are the backbone of many applications. Working with time-stamped data in a time series database platform like InfluxDB saves developers time, and gives them access to a wide range of tools and services. The maintainers of InfluxDB love seeing what people are building within our open source community, so connect with us and share your projects and code with others!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/time-series-data-edge-open-source-tools
|
||||
|
||||
作者:[Zoe Steinkamp][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/zoesteinkamp
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/17/8/influxdb-time-series-database-stack
|
||||
[2]: https://opensource.com/sites/default/files/2022-12/Telegraf.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-12/TimeSeriesChecks%26Alerts.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-12/TimSeriesEdge.png
|
||||
[5]: https://opensource.com/article/22/5/plant-care
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/TimeSeriesplantbuddy.png
|
@ -1,187 +0,0 @@
|
||||
[#]: subject: "How to use methods in Java"
|
||||
[#]: via: "https://opensource.com/article/23/1/java-methods"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to use methods in Java
|
||||
======
|
||||
|
||||
A method in Java (called a "function" in many other programming languages) is a portion of code that's been grouped together and labeled for reuse. Methods are useful because they allow you to perform the same action or series of actions without rewriting the same code, which not only means less work for you, it means less code to maintain and debug when something goes wrong.
|
||||
|
||||
A method exists within a class, so the standard Java boilerplate code applies:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
// code here
|
||||
}
|
||||
```
|
||||
|
||||
A package definition isn't strictly necessary in a simple one-file application like this, but it's a good habit to get into, and most IDEs enforce it.
|
||||
|
||||
By default, Java looks for a `main` method to run in a class. Methods can be made public or private, and static or non-static, but the main method must be public and static for the Java compiler to recognize and utilize it. When a method is public, it's able to be executed from outside the class. To call the `Example` class upon start of the program, its `main` method must be accessible, so set it to `public`.
|
||||
|
||||
Here's a simple demonstration of two methods: one `main` method that gets executed by default when the `Example` class is invoked, and one `report` method that accepts input from `main` and performs a simple action.
|
||||
|
||||
To mimic arbitrary data input, I use an if-then statement that chooses between two strings, based on when you happen to start the application. In other words, the `main` method first sets up some data (in real life, this data could be from user input, or from some other method elsewhere in the application), and then "calls" the `report` method, providing the processed data as input:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
// generate some data
|
||||
long myTime = System.currentTimeMillis();
|
||||
String weather;
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
weather = "party";
|
||||
} else {
|
||||
weather = "apocalypse";
|
||||
}
|
||||
|
||||
// call the other method
|
||||
report(weather);
|
||||
}
|
||||
|
||||
private static void report(String day) {
|
||||
System.out.printf("Welcome to the zombie %s\n", day);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Run the code:
|
||||
|
||||
```
|
||||
$ java ./Example.java
|
||||
Welcome to the zombie apocalypse
|
||||
$ java ./Example.java
|
||||
Welcome to the zombie party
|
||||
```
|
||||
|
||||
Notice that there are two different results from the same `report` method. In this simple demonstration, of course, there's no need for a second method. The same result could have been generated from the if-then statement that mimics the data generation. But when a method performs a complex task, like resizing an image into a thumbnail and then generating a widget on screen using that resized image, then the "expense" of an additional component makes a lot of sense.
|
||||
|
||||
### When to use a Java method
|
||||
|
||||
It can be difficult to know when to use a method and when to just send data into a [Java Stream][1] or loop. If you're faced with that decision, the answer is usually to use a method. Here's why:
|
||||
|
||||
- Methods are cheap. They don't add processing overhead to your code.
|
||||
- Methods reduce the line count of your code.
|
||||
- Methods are specific. It's usually easier to find a method called `resizeImage` than it is to find code that's hidden in a loop somewhere in the function that loads images from the drive.
|
||||
- Methods are reusable. When you first write a method, you may _think_ it's only useful for one task within your application. As your application grows, however, you may find yourself using a method you thought you were "done" with.
|
||||
|
||||
### Functional vs. object-oriented programming
|
||||
|
||||
Functional programming utilizes methods as the primary construct for performing tasks. You create a method that accepts one kind of data, processes that data, and outputs new data. String lots of methods together, and you have a dynamic and capable application. Programming languages like C and [Lua][2] are examples of this style of coding.
|
||||
|
||||
The other way to think of accomplishing tasks with code is the object-oriented model, which Java uses. In object-oriented programming, methods are components of a template. Instead of sending data from method to method, you create objects with the option to alter them through the use of their methods.
|
||||
|
||||
Here's the same simple zombie apocalypse demo program from an object-oriented perspective. In the functional approach, I used one method to generate data and another to perform an action with that data. The object-oriented equivalent is to have a class that represents a work unit. This example application presents a message-of-the-day to the user, announcing that the day brings either a zombie party or a zombie apocalypse. It makes sense to program a "day" object, and then to query that day to learn about its characteristics. As an excuse to demonstrate different aspects of object-oriented construction, the new sample application will also count how many zombies have shown up to the party (or apocalypse).
|
||||
|
||||
Java uses one file for each class, so the first file to create is `Day.java`, which serves as the Day object:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// Class
|
||||
public class Day {
|
||||
public static String weather;
|
||||
public int count;
|
||||
|
||||
// Constructor
|
||||
public Day() {
|
||||
long myTime = System.currentTimeMillis();
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
weather = "paradise";
|
||||
} else {
|
||||
weather = "apocalypse";
|
||||
}
|
||||
}
|
||||
|
||||
// Methods
|
||||
public String report() {
|
||||
return weather;
|
||||
}
|
||||
|
||||
public int counter() {
|
||||
Random rand = new Random();
|
||||
count = count + rand.nextInt(100);
|
||||
|
||||
return(count);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the `Class` section, two fields are created: `weather` and `count`. Weather is static. Over the course of a day (in this imaginary situation), weather doesn't change. It's either a party or an apocalypse, and it lasts all day. The number of zombies, however, increases over the course of a day.
|
||||
|
||||
In the `Constructor` section, the day's weather is determined. It's done as a [constructor][3] because it's meant to only happen once, when the class is initially invoked.
|
||||
|
||||
In the `Methods` section, the `report` method only returns the weather report as determined and set by the constructor. The `counter` method, however, generates a random number and adds it to the current zombie count.
|
||||
|
||||
This class, in other words, does three very different things:
|
||||
|
||||
- Represents a "day" as defined by the application.
|
||||
- Sets an unchanging weather report for the day.
|
||||
- Sets an ever-increasing zombie count for the day.
|
||||
|
||||
To put all of this to use, create a second file:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
Day myDay = new Day();
|
||||
String foo = myDay.report();
|
||||
String bar = myDay.report();
|
||||
|
||||
System.out.printf("Welcome to a zombie %s\n", foo);
|
||||
System.out.printf("Welcome to a zombie %s\n", bar);
|
||||
System.out.printf("There are %d zombies out today.\n", myDay.counter());
|
||||
System.out.printf("UPDATE: %d zombies. ", myDay.counter());
|
||||
System.out.printf("UPDATE: %d zombies. ", myDay.counter());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Because there are now two files, it's easiest to use a Java IDE to run the code, but if you don't want to use an IDE, you can create your own [JAR file][4]. Run the code to see the results:
|
||||
|
||||
```
|
||||
Welcome to a zombie apocalypse
|
||||
Welcome to a zombie apocalypse
|
||||
There are 35 zombies out today.
|
||||
UPDATE: 67 zombies. UPDATE: 149 zombies.
|
||||
```
|
||||
|
||||
The "weather" stays the same regardless of how many times the `report` method is called, but the number of zombies on the loose increases the more you call the `counter` method.
|
||||
|
||||
### Java methods
|
||||
|
||||
Methods (or functions) are important constructs in programming. In Java, you can use them either as part of a single class for functional-style coding, or you can use them across classes for object-oriented code. Both styles of coding are different perspectives on solving the same problem, so there's no right or wrong decision. Through trial and error, and after a little experience, you learn which one suits a particular problem best.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/java-methods
|
||||
|
||||
作者:[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/article/20/1/javastream
|
||||
[2]: https://opensource.com/article/22/11/lua-worth-learning
|
||||
[3]: https://opensource.com/article/19/6/what-java-constructor
|
||||
[4]: https://opensource.com/article/21/8/fastjar
|
||||
|
@ -1,241 +0,0 @@
|
||||
[#]: subject: "Install Ubuntu on Windows Using VirtualBox [Complete Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-ubuntu-windows-virtualbox/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Install Ubuntu on Windows Using VirtualBox [Complete Guide]
|
||||
======
|
||||
|
||||
**This tutorial will guide you through the easiest steps to install an Ubuntu desktop on Windows using Oracle VirtualBox.**
|
||||
|
||||
[VirtualBox][1] is a popular virtualization software by Oracle which is available for Linux, mac and Windows systems. It is flexible and brings many features to take advantage of your virtualization. It’s the best and easy way to experience Ubuntu in Windows without installing it. However, I strongly recommend installing Ubuntu physically as a dual-boot to enjoy its advantage.
|
||||
|
||||
The steps outlined below assume that you are installing Ubuntu for the first time in Windows. Hence the steps are a little descriptive and a bit lengthy. Furthermore, the following steps should work for Windows 10 and Windows 11 as host machines.
|
||||
|
||||
### Contents
|
||||
|
||||
- [Pre-requisite][2]
|
||||
- [Download Ubuntu ISO and VirtualBox set-up files][3]
|
||||
- [Install VirtualBox on Windows (Host)][4]
|
||||
- [Install Ubuntu (Guest) on VirtualBox][5]
|
||||
- [Guest addition installation and tips][6]
|
||||
|
||||
### What you’ll need
|
||||
|
||||
- A PC with internet access
|
||||
- Ubuntu Linux ISO image file for installation
|
||||
- Windows system with VirtualBox installed
|
||||
|
||||
### Install Ubuntu on Windows Using VirtualBox
|
||||
|
||||
#### Download and install the necessary items
|
||||
|
||||
- Download the Ubuntu Linux desktop ISO image file from the following link.
|
||||
|
||||
[Download Ubuntu Desktop][7]
|
||||
|
||||
- Also, download the Oracle VirtualBox installer from the official website below.
|
||||
|
||||
[Download VirtualBox][8]
|
||||
|
||||
![Download location for VirtualBox for Windows][9]
|
||||
|
||||
#### How to install and configure VirtualBox
|
||||
|
||||
VirtualBox in Windows requires Microsoft Visual C++ 2019 Redistributable package. And you have to install it first. Download the package (under X64 architecture) from the below link:
|
||||
|
||||
[Download][10]
|
||||
|
||||
![Download the dependency for VirtualBox][11]
|
||||
|
||||
![Install the dependency for VirtualBox][12]
|
||||
|
||||
- After the above installation is complete, download the latest Python package from the below link. Python bindings are also a dependency for VirtualBox installation on Windows.
|
||||
|
||||
[Download Python for Windows][13]
|
||||
|
||||
- Then, launch the VirtualBox installation and follow the onscreen instructions to install it.
|
||||
- After installation, restart your Windows system again.
|
||||
|
||||
#### Set up a virtual machine for Ubuntu
|
||||
|
||||
- Launch VirtualBox from the start menu.
|
||||
|
||||
![Select VirtualBox from start menu][14]
|
||||
|
||||
- On the VirtualBox window toolbar, click **New**.
|
||||
- On the **Create VirtualBox** window, give the name of your virtual machine. It can be any name which identifies this version of Ubuntu.
|
||||
- Keep the **Folder Name** unchanged. This is the path where the virtual machine file will be created.
|
||||
- In the ISO Image field, browse the Ubuntu ISO file you downloaded.
|
||||
- And select the Unattended installation. If you un-select this, a [default user id (vboxuser) and password][15] will be created in your virtual machine. Let’s not follow it for now.
|
||||
|
||||
![Click on New][16]
|
||||
|
||||
![Select the ISO file][17]
|
||||
|
||||
- Click on Hardware and select the RAM you want for your virtual box. A thumb rule is that your VM’s RAM size should be less than your physical RAM in the host system. I would recommend using 2 GB to 4 GB for a virtual machine for an 8 GB RAM system. For 4 GB RAM, use the slider (or type in) to make it 4096 MB (i.e. 4*1024).
|
||||
- Choose processor as 2 or 4.
|
||||
- Click on the Hard Disk section, and keep the file location unchanged.
|
||||
- Give a minimum of 20GB to 25GB for Ubuntu installation.
|
||||
- The hard disk file type value keeps as VDI (VirtualBox Disk Image)
|
||||
- Do not select the pre-allocate full size.
|
||||
- And finally, click on Finish.
|
||||
|
||||
![Select Hardware][18]
|
||||
|
||||
![Select Hard Disk][19]
|
||||
|
||||
- You should see a new entry at the left panel of VirtualBox with an Ubuntu 22.04 entry (the name which you gave above).
|
||||
- Select the entry and click on Start to boot into the virtual machine
|
||||
|
||||
![Boot Ubuntu in VirtualBox][20]
|
||||
|
||||
#### Install Ubuntu using VirtualBox
|
||||
|
||||
- After a successful boot, you should see the following screen, which shows various options for installing Ubuntu. Select **Try or install Ubuntu**.
|
||||
- In the Welcome screen, click on **Try Ubuntu**. And after a few moments, you should see the following Ubuntu LIVE desktop. If you want to change the resolution, right-click on the desktop and select Display settings. And change the resolution to 1400×900.
|
||||
- On the desktop, double-click on “**Install Ubuntu**…”.
|
||||
|
||||
![Select Try Ubuntu][21]
|
||||
|
||||
![Ubuntu LIVE desktop][22]
|
||||
|
||||
- In the next set of screens, select Language and Keyboard Layout as your needs.
|
||||
- The Install screen provides you with the type of installation you need. Select Normal Installation, and select both options under Other options.
|
||||
- Since you are installing in the virtual disk space, i.e. which is just a file, you can safely choose the “Erase disk and install Ubuntu” option.
|
||||
- Hit Install Now and Continue.
|
||||
|
||||
![Select Language][23]
|
||||
|
||||
![Select Keybaord Layout][24]
|
||||
|
||||
![Select install options][25]
|
||||
|
||||
![Installation Type][26]
|
||||
|
||||
![Write changes to disk][27]
|
||||
|
||||
- Then select region, add name, user and password. This will be your user id and password to log on to Ubuntu after installation.
|
||||
- Hit continue to start the installation. Wait until it finishes.
|
||||
|
||||
![User account creation][28]
|
||||
|
||||
![Ubuntu Installation is complete][29]
|
||||
|
||||
Click on Restart Now after the installation is complete. Wait for a few seconds and you should see a login screen. Use the user id and password to log in. And you should see Ubuntu desktop is running inside VirtualBox as VM in Windows.
|
||||
|
||||
![Log on to Ubuntu][30]
|
||||
|
||||
![Ubuntu running in Windows using Virtualbox][31]
|
||||
|
||||
### Post-install configuration and tips (optional)
|
||||
|
||||
#### Install Guest Additions
|
||||
|
||||
After the successful installation, you should install the **VirtualBox guest additions** for Windows Host and Ubuntu Guest. The guest addition is a set of packages you need to install inside the guest VM (i.e. Ubuntu) to enable **shared folders, bi-directional copy/paste, automatic resolution change,** and many such features.
|
||||
|
||||
To install it, boot into Ubuntu. From the VirtualBox menu, select `Devices > Insert Guest Additions CD Image`. The necessary packages will be mounted inside Ubuntu.
|
||||
|
||||
![Select Guest addition from the menu][32]
|
||||
|
||||
Open the file manager and open the mounted folder as shown below. And then right-click > select `open in terminal`.
|
||||
|
||||
Then run the following command:
|
||||
|
||||
```
|
||||
sudo ./VBoxLinuxAdditions.run
|
||||
```
|
||||
|
||||
![Open the mounted disc and select option with terminal][33]
|
||||
|
||||
![VirtualBox guest addition install for Windows host][34]
|
||||
|
||||
After the above command is complete, restart Ubuntu VM.
|
||||
|
||||
#### Enable Copy and paste between Windows and Ubuntu
|
||||
|
||||
- To enable the copy and paste between Windows and Ubuntu systems, select `Devices > Shared Clipboard > Bi-directional` from the menu.
|
||||
|
||||
![Enable clipboard sharing][35]
|
||||
|
||||
#### Shutting down Ubuntu VM
|
||||
|
||||
- Ideally, you should shut down a VM from its own power off menu. However, you can also shut down from the main VirtualBox window. Right-click on the VM name and select `Close > Poweroff`.
|
||||
|
||||
![Poweroff Virtual machine][36]
|
||||
|
||||
#### How to delete Ubuntu and remove all data
|
||||
|
||||
- If you want to delete the Virtual machine entirely (.e.g. Ubuntu) and its data, select `Remove` and `delete all files`.
|
||||
|
||||
![Select remove to delete a VM][37]
|
||||
|
||||
![Select the delete options][38]
|
||||
|
||||
### Close notes
|
||||
|
||||
In this tutorial, you learned the easiest way to install Ubuntu on Windows (10 or 11) using VirtualBox. Also, you learned several post-install basic steps to configure the Ubuntu VM. You can use the above steps for any other Linux distributions in VirtualBox.
|
||||
|
||||
Feel free to comment below if you have any problems or questions.
|
||||
|
||||
[Next:How to Install Python on Windows [Beginner’s Guide]][39]
|
||||
|
||||
[_Using Mastodon? Follow us at floss.social/@debugpoint_][40]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-ubuntu-windows-virtualbox/
|
||||
|
||||
作者:[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/virtualbox
|
||||
[2]: https://www.debugpoint.com#presteps
|
||||
[3]: https://www.debugpoint.com#download-items
|
||||
[4]: https://www.debugpoint.com#install-virtualbox
|
||||
[5]: https://www.debugpoint.com#install-ubuntu
|
||||
[6]: https://www.debugpoint.com#post-install-steps
|
||||
[7]: https://ubuntu.com/download/desktop
|
||||
[8]: https://www.virtualbox.org/wiki/Downloads
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Download-location-for-VirtualBox-for-Windows.jpg
|
||||
[10]: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Download-the-dependency-for-VirtualBox.jpg
|
||||
[12]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-the-dependency-for-VirtualBox.jpg
|
||||
[13]: https://www.python.org/downloads/windows/
|
||||
[14]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-VirtualBox-from-start-menu.jpg
|
||||
[15]: https://www.debugpoint.com/virtualbox-id-password/
|
||||
[16]: https://www.debugpoint.com/wp-content/uploads/2023/01/Click-on-New.jpg
|
||||
[17]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-the-ISO-file.jpg
|
||||
[18]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Hardware.jpg
|
||||
[19]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Hard-Disk.jpg
|
||||
[20]: https://www.debugpoint.com/wp-content/uploads/2023/01/Boot-Ubuntu-in-VirtualBox.jpg
|
||||
[21]: https://www.debugpoint.com/wp-content/uploads/2023/01/1-Select-Try-Ubuntu.jpg
|
||||
[22]: https://www.debugpoint.com/wp-content/uploads/2023/01/2-Ubuntu-LIVE-desktop-1.jpg
|
||||
[23]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Language.jpg
|
||||
[24]: https://www.debugpoint.com/wp-content/uploads/2023/01/4-Select-Keybaord-Layout.jpg
|
||||
[25]: https://www.debugpoint.com/wp-content/uploads/2023/01/5-Select-install-options.jpg
|
||||
[26]: https://www.debugpoint.com/wp-content/uploads/2023/01/6-Installation-Type.jpg
|
||||
[27]: https://www.debugpoint.com/wp-content/uploads/2023/01/7-Write-changes-to-disk.jpg
|
||||
[28]: https://www.debugpoint.com/wp-content/uploads/2023/01/8-User-account-creation.jpg
|
||||
[29]: https://www.debugpoint.com/wp-content/uploads/2023/01/10-Ubuntu-Installation-is-complete.jpg
|
||||
[30]: https://www.debugpoint.com/wp-content/uploads/2023/01/11-Log-on-to-Ubuntu.jpg
|
||||
[31]: https://www.debugpoint.com/wp-content/uploads/2023/01/12-Ubuntu-running-in-Windows-using-Virtualbox-2048x1280.jpg
|
||||
[32]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-Guest-addition-from-the-menu.jpg
|
||||
[33]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-the-mounted-disc-and-select-option-with-terminal.jpg
|
||||
[34]: https://www.debugpoint.com/wp-content/uploads/2023/01/VirtualBox-guest-addition-install-for-Windows-host.jpg
|
||||
[35]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-clipboard-sharing.jpg
|
||||
[36]: https://www.debugpoint.com/wp-content/uploads/2023/01/Poweroff-Virtual-machine.jpg
|
||||
[37]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-remove-to-delete-a-VM.jpg
|
||||
[38]: https://www.debugpoint.com/wp-content/uploads/2023/01/Select-the-delete-options.jpg
|
||||
[39]: https://www.debugpoint.com/install-python-windows/
|
||||
[40]: https://floss.social/@debugpoint
|
@ -1,147 +0,0 @@
|
||||
[#]: subject: "How to Install Python on Windows [Beginner’s Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-python-windows/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install Python on Windows [Beginner’s Guide]
|
||||
======
|
||||
|
||||
**This simple guide demonstrates how to download and install Python on Windows.**
|
||||
|
||||
This article is tested with the latest Python 3.11 stable version.
|
||||
|
||||
Before you learn how to install Python on Windows, you might want to check how you can [install it easily][1] on Linux distributions such as Ubuntu. It’s better to try Python in Linux if you are planning to be a developer. That being said, you might want to check [how to install Linux (such as Ubuntu) alongside Windows][2].
|
||||
|
||||
Python is a popular general-purpose programming language which becomes the developer’s choice in the past decade. And its popularity is increasing every day. it is widely used for web development, complex systems, data science, machine learning and all areas of science.
|
||||
|
||||
There are two versions of Python that you may come across. Python2 is currently out of support. And the Python3 series is the ongoing support release.
|
||||
|
||||
### Check whether Python is installed
|
||||
|
||||
Before you install it on Windows, you should check whether it is already installed. In general, it should not be installed, unlike in Ubuntu (and other Linux distributions), where Python comes pre-installed.
|
||||
|
||||
From the start menu, open “command prompt”.
|
||||
|
||||
And type the following:
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
If Python is available, it will show you a message with the version details.
|
||||
|
||||
### Download and Install Python
|
||||
|
||||
Open the below official Python download page.
|
||||
|
||||
[Download Python][3]
|
||||
|
||||
![How to locate Python set up][4]
|
||||
|
||||
At the top, you should see the current stable version. Click on the download link. If you are looking for any specific version, scroll down on this page and download the specific version under the label “Python releases by version number:”.
|
||||
|
||||
After downloading, go to the Downloads folder and run the setup.
|
||||
|
||||
Follow the on-screen instructions to install it.
|
||||
|
||||
![Install Python step 1][5]
|
||||
|
||||
![Install Python step 2][6]
|
||||
|
||||
After installation is complete, verify the Python version.
|
||||
|
||||
### Verify Python Version
|
||||
|
||||
From the start menu, open “command prompt” and run the following command.
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
![Python version on Windows][7]
|
||||
|
||||
You should see your system’s currently installed version of the Python package. Alternatively, you can also run below to get a Python interactive shell.
|
||||
|
||||
```
|
||||
python
|
||||
```
|
||||
|
||||
You can exit the shell using CTRL+Z and Enter.
|
||||
|
||||
### Check PATH Variables
|
||||
|
||||
You should check the system variable PATH with the Python executable location. This should be updated automatically using the installer.
|
||||
|
||||
From the start menu, search “system variables” and open it.
|
||||
|
||||
![Open Environment variable Settings][8]
|
||||
|
||||
In the System Properties Dialog, click on `Advanced > Environment Variables`. Under the user variables section against the Path variable, check whether the Python installed location is present. Refer to the below image for a guideline.
|
||||
|
||||
If you see all the path is present, you are all set to run your Python project.
|
||||
|
||||
![Check Python Environment PATH Values in Windows][9]
|
||||
|
||||
### Create and run your first Python program
|
||||
|
||||
For an additional step, here’s how you can code & run your first Python program. You should ideally use any [recommended Python editor][10] to write your program.
|
||||
|
||||
Here’s a simple program which outputs the text “debugpoint.com” in the console.
|
||||
|
||||
```
|
||||
# Sample Python program
|
||||
print("debugpoint.com")
|
||||
```
|
||||
|
||||
Save the file with any name. Here I have saved it as “hello.py” in E drive. The .py is the extension of Python source codes.
|
||||
|
||||
To run this program, open a command prompt and execute below inside E drive.
|
||||
|
||||
```
|
||||
python hello.py
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
![Running a simple Python program in Windows][11]
|
||||
|
||||
### Closing Notes
|
||||
|
||||
I hope this simple beginner’s guide helps you to install Python in Windows, verify the installation and run your first program.
|
||||
|
||||
Please let me know if you run into issues in the comment box below.
|
||||
|
||||
[Next:Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)][12]
|
||||
|
||||
[_Using Mastodon? Follow us at floss.social/@debugpoint_][13]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-python-windows/
|
||||
|
||||
作者:[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/install-python-3-11-ubuntu/
|
||||
[2]: https://www.debugpoint.com/complete-guide-how-dual-boot-ubuntu-windows/
|
||||
[3]: https://www.python.org/downloads/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/How-to-locate-Python-set-up.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-1.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-2.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Python-version-on-Windows.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-Environment-variable-Settings.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Check-Python-Environment-PATH-Values-in-Windows.jpg
|
||||
[10]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Running-a-simple-Python-program-in-Windows.jpg
|
||||
[12]: https://www.debugpoint.com/share-folder-virt-manager/
|
||||
[13]: https://floss.social/@debugpoint
|
@ -1,110 +0,0 @@
|
||||
[#]: subject: "Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)"
|
||||
[#]: via: "https://www.debugpoint.com/share-folder-virt-manager/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)
|
||||
======
|
||||
|
||||
**In this guide, you will learn how to share a folder between host and guest in virt-manager using KVM, QEMU and libvirt.**
|
||||
|
||||
The [virt-manager][1] application or package uses the [libvirt][2] library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines.
|
||||
|
||||
The virt-manager desktop interface and its components provide flexible virtual machine management services for various personal and business use cases. it is a free and open-source application primarily used for KVM virtual machines. However, it can also support other hypervisors such as Xen and LXC.
|
||||
|
||||
In the earlier article, I explained [how to create a virtual machine using virt-manager][3]. This article covers how you can seamlessly access files and folders between guest and host virtual machines.
|
||||
|
||||
### A note about virtiofs
|
||||
|
||||
The sharing files and folders are powered by the libvirt shared file system called virtiofs. It provides all the features and parameters to access the directory tree on the host machine. Since most of the virt-manager virtual machine configurations are translated to XML, the share files/folders can also be specified by the XML file.
|
||||
|
||||
### Share folder in virt-manager
|
||||
|
||||
- First, make sure your guest virtual machine is powered off. From the virt-manager GUI, select the virtual machine and click on Open to pull up the console settings.
|
||||
|
||||
![Open the settings][4]
|
||||
|
||||
- Click on the icon which says show virtual hardware details in the toolbar. And then click on **Memory** on the left panel.
|
||||
- Select the option “**Enable shared memory**“. Click Apply.
|
||||
|
||||
![Enable the shared memory option][5]
|
||||
|
||||
- And then click “Add hardware” at the bottom.
|
||||
|
||||
![Click on add hardware][6]
|
||||
|
||||
- Select **File system** from the left panel in the add new hardware window.
|
||||
- Then select **Driver=virtiofs** in the details tab. Click on `browse > browse local` and **select the host path** you want to access inside the guest VM.
|
||||
- In the target path, mention any name you want. It’s just a file tag which will be used during mount.
|
||||
- So, if I want to access the Pictures/Screenshots folder (`/home/debugpoint/Pictures/Screenshots`), sample settings could be the following:
|
||||
|
||||
![Add a new file system hardware][7]
|
||||
|
||||
The XML settings are below for the above configuration. You can find it in the XML tab.
|
||||
|
||||
```
|
||||
<filesystem type="mount" accessmode="passthrough">
|
||||
<driver type="virtiofs"/>
|
||||
<binary path="/usr/libexec/virtiofsd"/>
|
||||
<source dir="/home/debugpoint/Pictures/Screenshots"/>
|
||||
<target dir="mount_tag_pictures"/>
|
||||
<alias name="fs1"/>
|
||||
<address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
|
||||
</filesystem>
|
||||
```
|
||||
|
||||
Click on Finish. In the main virt-manager window, right-click on the VM and click Run to start the virtual machine. Make sure to click on the “show the graphical console” (monitor icon in the toolbar – if the VM is not showing.
|
||||
|
||||
In the guest machine, create a folder where you want to mount the host folder. For this example, I have used /mnt/pictures.
|
||||
|
||||
```
|
||||
sudo mkdir /mnt/pictures
|
||||
```
|
||||
|
||||
And finally, mount the host folder using the tag you created in the above step to this new folder. Use the following command to do that from the terminal. Ensure to change the tag and folder name in the below command as your system.
|
||||
|
||||
```
|
||||
sudo mount -t virtiofs mount_tag_pictures /mnt/pictures
|
||||
```
|
||||
|
||||
Now you can browse the folders and add/delete items seamlessly in virt-manager between host and guest.
|
||||
|
||||
![Access host files from virt-manager guest][8]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
I hope this solution helps you to access host files and folders from the guest machine. Remember, your user Id, which is used to launch the virt-manager app, should have the same access to the host folder.
|
||||
|
||||
If you run into any errors, the above guide helped you drop a note below.
|
||||
|
||||
_[Reference][9]_
|
||||
|
||||
[_Using Mastodon? Follow us at floss.social/@debugpoint_][10]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/share-folder-virt-manager/
|
||||
|
||||
作者:[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://virt-manager.org/
|
||||
[2]: https://libvirt.org/manpages/libvirtd.html
|
||||
[3]: https://www.debugpoint.com/virt-manager/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-the-settings.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Enable-the-shared-memory-option.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Click-on-add-hardware.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Add-a-new-file-system-hardware.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Access-host-files-from-virt-manager-guest.jpg
|
||||
[9]: https://libvirt.org/kbase/virtiofs.html
|
||||
[10]: https://floss.social/@debugpoint
|
@ -1,151 +0,0 @@
|
||||
[#]: subject: "A 4-minute guide to Java loops"
|
||||
[#]: via: "https://opensource.com/article/23/1/java-loops"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
A 4-minute guide to Java loops
|
||||
======
|
||||
|
||||
A while loop performs a set of tasks for as long as some predefined condition is true. This is considered a control structure that directs the flow of a program. It's a way for you to tell your code what to do by defining a condition that it can test, and take action based on what it finds. The two kinds of while loops in Java are while and do while.
|
||||
|
||||
### Java while loop
|
||||
|
||||
A while loop is meant to iterate over data until some condition is satisfied. To create a while loop, you provide a condition that can be tested, followed by the code you want to run. Java has several built-in test functions, the simplest of which are mathematical operators (`<`, `>`, `==`, and so on):
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
int count = 0;
|
||||
while (count < 5) {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this simple example, the condition is that the variable `count` is less than 5. Because `count` is instantiated at 0, and then incremented by 1 in the code within the while loop, the program iterates a total of 5 times:
|
||||
|
||||
```
|
||||
$ java ./while.java
|
||||
0 1 2 3 4
|
||||
```
|
||||
|
||||
Before it can iterate a sixth time, the condition is no longer true, so the loop ends.
|
||||
|
||||
The conditional statement for a while loop is vital. Getting it wrong could mean that your loop never executes. For instance, suppose you had set `count == 5` as the condition:
|
||||
|
||||
```
|
||||
while (count == 5) {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
```
|
||||
|
||||
When you run the code, it builds and runs successfully, but nothing happens:
|
||||
|
||||
```
|
||||
$ java ./while.java
|
||||
$
|
||||
```
|
||||
|
||||
The loop has been skipped because `count` was set to 0, and it's still 0 at the moment the while loop is first encountered. The loop never has a reason to start and `count` is never incremented.
|
||||
|
||||
The reverse of this is when a condition starts as true and can never be false, this results in an infinite loop.
|
||||
|
||||
### Java do while loop
|
||||
|
||||
Similar to the while loop, a do while loop tests for the conditional at the end, not the beginning, of each iteration. With this, the code in your loop runs at least once because there's no gateway to entry, only a gateway to exit:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
int count = 9;
|
||||
do {
|
||||
System.out.printf("%d ", count);
|
||||
count++;
|
||||
} while(count == 5);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this sample code, `count` is set to 9. The condition for the loop to repeat is that `count` is equal to 5. But 9 isn't equal to 5. That check isn't performed until the end of the first iteration, though:
|
||||
|
||||
```
|
||||
$ java ./do.java
|
||||
9
|
||||
```
|
||||
|
||||
### Java infinite loops
|
||||
|
||||
An infinite loop, as its name suggests, never ends. Sometimes they're created by mistake, but an infinite loop does have a valid use case. Sometimes you want a process to continue indefinitely (that's functionally infinite because you can't guarantee when you need it to stop), and so you might set your condition to something impossible to meet.
|
||||
|
||||
Suppose you've written an application that counts the number of zombies remaining in your neighborhood during a zombie apocalypse. To simulate uncertainty over how many loops are required to get to 0 zombies, my demo code retrieves a timestamp from the operating system and sets the value of the counter (`c`) to some number derived from that timestamp. Because this is a simple example and you don't really want to get trapped in an infinite loop, this code counts down to zero and uses the `break` function to force the loop to end:
|
||||
|
||||
```
|
||||
package com.opensource.example;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
|
||||
long myTime = System.currentTimeMillis();
|
||||
|
||||
int c;
|
||||
|
||||
if ( myTime%2 == 0 ) {
|
||||
c = 128;
|
||||
} else {
|
||||
c = 1024;
|
||||
}
|
||||
|
||||
while(true) {
|
||||
System.out.printf("%d Zombies\n", c);
|
||||
|
||||
// break for convenience
|
||||
if ( c <= 0 ) { break; }
|
||||
c--;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You may have to run it a few times to trigger a different total number of zombies, but sometimes your program iterates 128 times and other times 1,024 times:
|
||||
|
||||
```
|
||||
$ java ./zcount.java
|
||||
1024 Zombies
|
||||
1023 Zombies
|
||||
[...]
|
||||
0 Zombies
|
||||
```
|
||||
|
||||
Can you tell why the loops end at 0 and not at -1?
|
||||
|
||||
### Java loops
|
||||
|
||||
Loops give you control over the flow of your program's execution. Iteration is common in programming, and whether you use a while loop, a do while loop, or an infinite loop, understanding how loops work is vital.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/1/java-loops
|
||||
|
||||
作者:[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
|
||||
|
||||
|
@ -0,0 +1,181 @@
|
||||
[#]: subject: "Learn zip Command in Linux Using Examples"
|
||||
[#]: via: "https://www.debugpoint.com/zip-command-linux-examples/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn zip Command in Linux Using Examples
|
||||
======
|
||||
|
||||
**Here’s a beginner’s guide on understanding the zip command in Linux with a few examples.**
|
||||
|
||||
![][1]
|
||||
|
||||
A zip file is a compressed archive containing one or more files. It is widely used as a lossless data compression technique. Thanks to compression, it takes less disk space and requires fewer data to transfer over computer networks.
|
||||
|
||||
These compressed files can be extracted easily in Linux, Windows and macOS. Various software is available that supports zip file compression and also offers to extract them.
|
||||
|
||||
Since it is popular, almost all operating systems have this built-in.
|
||||
|
||||
In this tutorial, we will talk about several terminal-based methods to zip a file in Linux.
|
||||
|
||||
### Zip Command in Linux: Examples
|
||||
|
||||
#### Syntax
|
||||
|
||||
The program name you need to use in Linux to zip a file is `zip`. Here’s the basic syntax.
|
||||
|
||||
```
|
||||
zip [compress file name] file1 file2 file3
|
||||
```
|
||||
|
||||
And here’s the official syntax.
|
||||
|
||||
```
|
||||
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
|
||||
```
|
||||
|
||||
Ideally, it should be installed in all the major Linux distributions. If not, use the following commands to install it.
|
||||
|
||||
#### Install zip on Debian, Ubuntu and related distributions
|
||||
|
||||
```
|
||||
sudo apt install zip
|
||||
```
|
||||
|
||||
#### Install in Fedora, RHEL-based systems
|
||||
|
||||
```
|
||||
sudo dnf install zip
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
```
|
||||
pacman -S zip
|
||||
```
|
||||
|
||||
Let’s take a look at some examples.
|
||||
|
||||
#### How to zip files and folders
|
||||
|
||||
I have the following three files in my test directory. They are file1.txt, file2.txt and file3.txt. If I want to compress three files using zip and create a zip myfiles.zip, the following command is sufficient.
|
||||
|
||||
```
|
||||
zip myfiles.zip file1.txt file2.txt file3.mp3
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```
|
||||
adding: file1.txt (stored 0%)adding: file2.txt (stored 0%)adding: file3.mp3 (deflated 13%)
|
||||
```
|
||||
|
||||
![Output of Basic zip command in Linux][2]
|
||||
|
||||
A few points you should remember here.
|
||||
|
||||
- When creating a zip file, you should have the modify access to the current directory.
|
||||
- The zip file format doesn’t contain the permissions, i.e. read(4), write(2), and execute(1). So, the user who creates it becomes the owner of the file.
|
||||
- If you want to use zip with permission, try the tar command (to be explained in a later tutorial).
|
||||
- In the above output, the zip command shows the file names being added to the archive and the compression method.
|
||||
- Specifying the .zip file name extension in the target file name is not mandatory. If you omit .zip, zip will add the .zip at the end.
|
||||
|
||||
When you have hundreds or thousands of files in operation, it’s a good idea to suppress the output in the terminal. You can use -q command to suppress the output in the zip command.
|
||||
|
||||
```
|
||||
zip -q myfiles.zip file1.txt file2.txt file3.txt
|
||||
```
|
||||
|
||||
#### Recursive compression of subfolders
|
||||
|
||||
The `-r` option of zip command enables you to include subdirectories and their contents. This option recursively traverses until the last child of a directory structure and adds all of them to the zip file.
|
||||
|
||||
The following command creates a compressed file with all the contents and subdirectories inside my_folder.
|
||||
|
||||
```
|
||||
zip -r myfolder.zip my_folder
|
||||
```
|
||||
|
||||
You can also use the wild card characters (*) to include specific types of files in your zip file.
|
||||
|
||||
```
|
||||
zip -0 my_movies.zip *.mp4
|
||||
```
|
||||
|
||||
#### Adding a mix of files and directories
|
||||
|
||||
With all the above options, the zip command allows you to specify files and directories together as arguments.
|
||||
|
||||
```
|
||||
zip -r myfiles.zip file1.txt file2.txt file3.txt my_folder1 my_folder2
|
||||
```
|
||||
|
||||
### Compression algorithms
|
||||
|
||||
The default output of the zip file contains two distinct words, i.e. deflate and store. The default compression method used by zip is deflate. If it successfully compresses the file, then the output shows deflate. And when it can’t compress a file, it simply stores them inside the .zip file as is. Those file outputs show stored.
|
||||
|
||||
There any many compression algorithm present. One of them is the bzip2 compression method which is supported by zip command in Linux. You can specify the compression algo as a command option to use. Use the option -Z followed by the algorithm name, as shown below.
|
||||
|
||||
```
|
||||
zip -r -Z bzip2 myfolder.zip my_folder
|
||||
```
|
||||
|
||||
#### Compress levels
|
||||
|
||||
The zip command also allows you to specify the compression level. The compression level is how much you want the zip optimized to reduce the package size. It’s a numeric value range from 0 to 9. A value of 9 compression level is the highest compression. The default value is 6.
|
||||
|
||||
Remember, if you are using zip to compress thousands of files of varying sizes, it might use higher system resources and take time. So, if you use it in programs, or shell scripts for many files, follow proper programming standards.
|
||||
|
||||
```
|
||||
zip -9 -r myfolder.zip my_folder
|
||||
```
|
||||
|
||||
#### Password protect a zip file
|
||||
|
||||
You can also password protect a zip file using `-e` option like the one below.
|
||||
|
||||
```
|
||||
zip -e -r myfolder.zip my_folder
|
||||
```
|
||||
|
||||
It will ask for the password after you run the command.
|
||||
|
||||
Caution: Don’t use the zip command to password-protect a zip file. The encryption algorithm of the zip is PKZIP using a stream cipher. And it can be cracked easily. If you want to protect your file, use 7-Zip or other advanced tools.
|
||||
|
||||
#### Split size zip files
|
||||
|
||||
Many applications, servers, and file shares may contain restrictions of a fixed-size file upload. For example, you have a 10GB file, but the service allows only 1GB per file. Using the -s option of the zip, you can compress and split them into chunks for upload.
|
||||
|
||||
```
|
||||
zip -s 1g -r myfolder.zip my_folder
|
||||
```
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
You learned some basics of the zip command. It is useful for most local cases where you need to take quick backups by compressing them on the fly. However, for more advanced options, you should use 7-Zip or other commands, which I will share in the next few articles.
|
||||
|
||||
In the meantime, you can learn more in the [zip manual][3].
|
||||
|
||||
_This article is part of the [Linux command][4] learning series._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/zip-command-linux-examples/
|
||||
|
||||
作者:[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/2023/01/zip-file-head.jpg
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2023/01/Output-of-Basic-zip-command-in-Linux.jpg
|
||||
[3]: https://linux.die.net/man/1/zip
|
||||
[4]: https://www.debugpoint.com/category/linux-commands
|
@ -0,0 +1,149 @@
|
||||
[#]: subject: "Top 10 Linux Distributions for Servers in 2023"
|
||||
[#]: via: "https://www.linuxtechi.com/top-10-linux-distributions-for-servers/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " Veryzzj"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Top 10 Linux Distributions for Servers in 2023
|
||||
======
|
||||
|
||||
Linux operating system is a popular choice for servers – and for multiple reasons. First, it’s free (with exception of a few commercial distributions such as RHEL and SUSE Linux Enterprise Server ) and open-source. Its open-source nature implies that developers can view its source code, modify it and redistribute it according to the laid-out license terms. In addition, Linux is generally considered stable, versatile, and more secure than Windows. Furthermore, it can easily be deployed across various platforms such as bare-metal, virtual, and cloud environments.
|
||||
|
||||
In this article, we highlight the top 10 Linux distributions for servers.
|
||||
|
||||
### 1) Red Hat Enterprise Linux (RHEL)
|
||||
|
||||
[Red Hat Enterprise Linux][1], abbreviated as RHEL, is a commercial Linux distribution that was developed specifically for enterprise environments. It is a performance-driven, reliable, and secure operating system that provides enhanced usability and seamless deployment which makes it ideal for server environments.
|
||||
|
||||
RHEL supports a wide range of workloads in bare-metal, virtual, and cloud environments. In fact, it’s the world’s leading open-source solutions provider offering a myriad of products including Red Hat OpenShift, Ansible automation platform, Open hybrid cloud, JBoss Enterprise Application Platform, and SAP to mention a few.
|
||||
|
||||
![Neofetch-Command-Output-RHEL-System][2]
|
||||
|
||||
### 2) Ubuntu Server
|
||||
|
||||
Developed and maintained by Canonical, Ubuntu is one of the most popular and widely used Linux distributions. It is a Debian-based Linux distribution that is absolutely free and open-source and is renowned for Its Desktop edition which is intuitive, user-friendly, and considered ideal for learners and beginners. Ubuntu comes in 3 editions namely; Desktop, Ubuntu Server, and Core.
|
||||
|
||||
While the Desktop Edition enjoys massive global usage, the Server edition also offers a solid platform for server environments. First, it can be deployed in any environment, be it on a physical, virtual, or cloud environment with extensive scale-out functionality. This implies you can add resources on the go to meet evolving demands.
|
||||
|
||||
And since the server version is completely stripped down without any GUI, it’s relatively lightweight leading to low resource overhead. This means low CPU and memory usage. This consequently leads to improved performance and enterprise-grade stability.
|
||||
|
||||
Apart from installing it on physical data centers and virtual servers, Ubuntu server is available in public clouds such as AWS and Azure. According to Canonical, 55% of OpenStack clouds run on Ubuntu. In addition, you can have your own managed Openstack cloud for a fee.
|
||||
|
||||
![][3]
|
||||
|
||||
### 3) Debian
|
||||
|
||||
Debian is one of the earliest Linux distributions that is renowned for its rock-solid stability. It comes in three variants: Stable, Unstable, and Testing.
|
||||
|
||||
The Debian stable branch is the latest officially released distribution of Debian and is the most popular version for servers and desktop PCs. All packages shipped with this branch have undergone rigorous testing and debugging, and are hence considered ready for production workloads.
|
||||
|
||||
Debian server is tailored to be a fast and reliable operating system with an emphasis on security and stability. It’s for this reason that it makes for a perfect choice for server environments. In addition, It provides extensive hardware support with over 59,000 software packages, by far the greatest number of packages provided by any OS.
|
||||
|
||||
Just like Ubuntu Server, Debian is lightweight, versatile, and highly stable for enterprise workloads. In fact, it is considered more stable and easier to manage than Ubuntu.
|
||||
|
||||
![][4]
|
||||
|
||||
##### 4) SUSE Linux Enterprise Server
|
||||
|
||||
Another formidable and worthy contender in providing an excellent platform for servers is SUSE Linux Enterprise Server ( SLES ). The server operating system is created and maintained by SUSE, a German-based organization.
|
||||
|
||||
SLES is a commercial distribution that was built to handle enterprise-grade workloads. It is adaptable to any environment and is optimized for stability, reliability, and security. It is highly scalable and allows IT teams to efficiently deploy their applications and services in response to growing business demands.
|
||||
|
||||
The latest SLES release provides interoperability with ease of administration. It also provides increased support and compatibility with Docker containers, Kubernetes, and geo-clusters. The latter provides flexibility with high availability allowing IT teams to configure replication clusters that span multiple data center regions.
|
||||
|
||||
SUSE Linux Enterprise Server not only supports in-house workloads but is also offered on popular cloud providers including Microsoft Azure, Google Compute Engine, and Amazon Web Services.
|
||||
|
||||
|
||||
##### 5) OpenSUSE Leap
|
||||
|
||||
Developed by the OpenSUSE project, OpenSUSEis a non-commercial RPM-based Linux distribution that is developed and maintained by SUSE. OpenSUSE is free and open-source and provides two editions:
|
||||
|
||||
- OpenSUSE Leap
|
||||
- OpenSUSE Tumbleweed
|
||||
|
||||
OpenSUSE TumbleWeed is the rolling release version of OpenSUSE. It contains the latest stable applications including an updated kernel, git, SAMBA, desktop applications, and many more. It, therefore, makes a perfect distribution of choice for developers or power users who need to leverage the latest software stacks in their workloads. However, due to frequent kernel updates, it’s not the ideal choice for servers since frequent updates can cause inconsistencies with other third-party driver modules.
|
||||
|
||||
OpenSUSE Leap is the preferred OpenSUSE option for servers. It’s an open-source and community-driven distribution that has a slower release cycle and, hence, a better fit than TumbleWeed. It is community-driven and this means that it undergoes rigorous testing before being released.
|
||||
|
||||
Leap is comparatively easy to use and offers high performance and stability ideal for handling enterprise-grade workloads. It is a great alternative to commercial server distributions such as SLES and RHEL and allows companies to deploy their workloads both on bare metal and cloud deployments.
|
||||
|
||||
![][6]
|
||||
|
||||
### 6) Rocky Linux
|
||||
|
||||
Rocky Linux is a Linux distribution that was developed as a replacement for CentOS Linux which reached EOL ( End Of Life ) on 31st, December 2021. It is a free and opensource Linux distribution that is enterprise-ready, providing rock-solid stability, reliability, and regular updates with a 10-year support lifecycle at absolutely no cost
|
||||
|
||||
Rocky Linux is an enterprise operating system designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux and is currently under intensive development by the community.
|
||||
|
||||
The distribution has gained massive popularity since the untimely discontinuation of CentOS Linux. It can be installed on both servers, and desktop computers. It’s also available in custom-built images on Public cloud providers such as Amazon AWS, and Google Compute Engine.
|
||||
|
||||
Rocky Linux developers have availed a migration script that allows users to migrate from other enterprise editions such as CentOS Linux and Oracle Linux to Rocky Linux.
|
||||
|
||||
![][7]
|
||||
|
||||
### 7) AlmaLinux
|
||||
|
||||
Another alternative that was developed to plug in the gap left by CentOS Linux is AlmaLinux. This is yet another enterprise operating system that is completely free and opensource.
|
||||
|
||||
AlmaLinux was originally created by CloudLinux but is currently community driven. It offers a production-grade enterprise operating system that is 1:1 binary compatible with Red Hat Enterprise Linux (RHEL). In a nutshell, it’s a clone of RHEL and provides rock-solid stability and benefits that come with RHEL at no cost.
|
||||
|
||||
Being an Enterprise-grade server OS, AlmaLinux can comfortably run heavy and critical workloads. In addition, it provides regular releases that come with long-term support.
|
||||
|
||||
![][8]
|
||||
|
||||
### 8) Oracle Linux
|
||||
|
||||
Developed by Oracle Corporation, Oracle Linux is a secure and high-performance operating system that is compiled from RHEL source code. It is optimized for hybrid and multi-cloud deployments, and just like Rocky and AlmaLinux, Oracle Linux is 100% binary compatible with Red Hat Linux.
|
||||
|
||||
Oracle Linux is a viable option for data centers and certainly a perfect replacement for CentOS which reached EOL. It is rock-solid stable and posts incredible performance ideal for enterprise applications.
|
||||
|
||||
Unlike Commercial Linux distributions such as RHEL and SUSE, Oracle Linux is completely free to download, use and redistribute. It is available under the GNU General Public License (GPLv2).
|
||||
|
||||
### 9) Fedora Server
|
||||
|
||||
Fedora is a free and open-source Linux distribution that is developed and maintained by Fedora Project which is sponsored by Red Hat.
|
||||
|
||||
Fedora serves as the upstream, community distribution of Red Hat Enterprise Linux. All the applications go through rigorous testing before they are pushed to RHEL. As such, it is referred to as a ‘Bleeding Edge’ operating system. This implies is regularly gets the latest software applications and updates.
|
||||
|
||||
For a long time, Fedora has been popular for its Workstation Edition which was built for laptop and desktop computers. Over time, it has expanded to include other editions such as Fedora Server, Fedora IoT, and Fedora CoreOS.
|
||||
|
||||
Fedora Server is a robust, reliable, and flexible operating system that ships with the best and latest data center technologies. As a leading-edge edition, it offers the very latest technologies in the open-source community. It is easy to install, set up, and administer using various tools such as Cockpit web console.
|
||||
|
||||
Fedora is also fast, remarkably stable, and secure. It works just fine for production and enterprise workloads. New releases of Fedora are pushed out once every 6 months.
|
||||
|
||||
![][10]
|
||||
|
||||
### 10) Fedora CoreOS
|
||||
|
||||
Last on our list is Fedora CoreOS. This is a minimal operating system that is optimized specifically for running containerized applications and workloads. According to its home page, it touts itself as “an automatically-updating, minimal operating system for running containerized workloads securely and at scale.”
|
||||
|
||||
By default, it ships with both podman and docker and comes in three release streams namely: Stable, Testing, and Next. You can get images for bare-metal servers and virtualized environments as well as cloud images that are hosted by major cloud providers such as Amazon Web Service (AWS) and Google Cloud Platform (GCP).
|
||||
|
||||
##### Conclusion
|
||||
|
||||
That was a round-up of the best Linux distributions for servers. We hope you found this guide insightful. Any thoughts on our guide? Your feedback is very much welcome.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/top-10-linux-distributions-for-servers/
|
||||
|
||||
作者:[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.redhat.com/en
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Neofetch-Command-Output-RHEL-System.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2022/05/Login-Screen-After-Ubuntu-Server-22-04-Installation.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2021/08/Login-screen-Debian11.png
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2018/09/openSUSE-Leap15-Installation-Option.jpg
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2022/07/neofetch-rockylinux9-post-installation.png
|
||||
[8]: https://www.linuxtechi.com/wp-content/uploads/2021/04/AlmaLinux8-Dashboard-After-Installation.jpg
|
||||
[10]: https://www.linuxtechi.com/wp-content/uploads/2016/11/Fedora-Linux-Desktop.png
|
@ -0,0 +1,346 @@
|
||||
[#]: subject: "Beyond Bash: 9 Lesser-Known Linux Shells and Their Capabilities"
|
||||
[#]: via: "https://itsfoss.com/shells-linux/"
|
||||
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Beyond Bash: 9 Lesser-Known Linux Shells and Their Capabilities
|
||||
======
|
||||
|
||||
A Shell provides an interface to Linux and Unix-like systems by interpreting commands and acts as an intermediary between the user and the core workings of the operating system.
|
||||
|
||||
Undoubtedly, the **bash shell is the most popular one**, and some users prefer other shells like ZSH, which is the default shell in macOS. But many shells exist other than these popular ones, with different features and use cases.
|
||||
|
||||
In this article, we will take a look at some less popular shells that are actively maintained and provide a different user experience.
|
||||
|
||||
### 1. Fish Shell
|
||||
|
||||
When talking about shells other than bash/zsh, the first name coming to our mind is the fish shell.
|
||||
|
||||
Fish is a **smart, user-friendly command line shell** primarily for UNIX-like operating systems.
|
||||
|
||||
![fish shell][1]
|
||||
|
||||
**Features of Fish Shell**
|
||||
|
||||
- Autosuggestion of commands based on history and completions.
|
||||
- Supports 24-bit color.
|
||||
- It supports syntax highlighting, and all features work out of the box.
|
||||
|
||||
**Install Fish**
|
||||
|
||||
Fish is available in the official repos of almost all Linux distributions. In Ubuntu, you can install it by:
|
||||
|
||||
```
|
||||
sudo apt install fish
|
||||
```
|
||||
|
||||
The version in the Ubuntu repos is a bit old. If you want to install the latest version, you can use the official PPA provided by the team.
|
||||
|
||||
```
|
||||
sudo apt-add-repository ppa:fish-shell/release-3
|
||||
sudo apt update
|
||||
sudo apt install fish
|
||||
```
|
||||
|
||||
[Fish Shell][2]
|
||||
|
||||
### 2. Nushell
|
||||
|
||||
Nushell is a new type of shell that works in **Linux, macOS, Windows, BSD**, etc. **Nu**, as it’s also called, it takes its philosophy and inspiration from projects like [PowerShell][3], functional programming languages, and modern [CLI][4] tools.
|
||||
|
||||
![nushell][5]
|
||||
|
||||
**Features of Nushell**
|
||||
|
||||
- **Everything is data:** Nu pipelines use structured data so you can safely select, filter, and sort the same way every time.
|
||||
- **Powerful plugins:** It's easy to extend Nu using a powerful plugin system.
|
||||
- **Easy to read error messages.** Nu operates on typed data, so it catches bugs that other shells don’t. And when things break, Nu tells you exactly where and why.
|
||||
- Clean IDE support.
|
||||
|
||||
**Install Nushell**
|
||||
|
||||
If you’re on Ubuntu, you won’t find an apt repository to install Nushell. But you can build it by installing the required dependencies, as per its [instructions on GitHub][6].
|
||||
|
||||
Fortunately, there is a way to install it on any distro using **Homebrew**. You can refer to our tutorial on [installing and using Homebrew Package Manager on Linux][7].
|
||||
|
||||
Once you successfully set it up on Linux, you need to type in the following command to install Nushell:
|
||||
|
||||
```
|
||||
brew install nushell
|
||||
```
|
||||
|
||||
Head to its official website to explore more installation options.
|
||||
|
||||
[Nushell][8]
|
||||
|
||||
### 3. Dune
|
||||
|
||||
The project's creator describes **Dune** as a shell by the beach. Dune is a **fast, useful and pretty shell**, offering a few niche metaprogramming features such as quoting.
|
||||
|
||||
![dune shell][9]
|
||||
|
||||
**Features of Dune Shell**
|
||||
|
||||
- Before entering the interactive mode, Dune executes _the prelude,_ a startup file stored in the home directory.
|
||||
- Dune's REPL is entirely customizable
|
||||
- You can define aliases by assigning a variable to a program's name
|
||||
- Use a macro to write functions that modify your shell's environment and act like commands or programs
|
||||
- Dune offers an extensive standard library and also provides a pretty interface to see all the functions available in each module.
|
||||
|
||||
**Install Dune Shell**
|
||||
|
||||
Dune shell is available in the Arch Linux repository as **dunesh**.
|
||||
|
||||
For all other users, the Dune shell can be installed with cargo. So first, you need to [install the latest version of rust][10]. If you already have rust installed, ensure you have the latest version and then proceed to install Dune.
|
||||
|
||||
```
|
||||
cargo install -f dune
|
||||
```
|
||||
|
||||
Once installed, you can access the shell by entering the following:
|
||||
|
||||
```
|
||||
dunesh
|
||||
```
|
||||
|
||||
[Dune Shell][11]
|
||||
|
||||
### 4. Xonsh
|
||||
|
||||
Xonsh is a **Python-powered, cross-platform shell** and command prompt. It combines Python and bash shell so that you can run Python commands directly in the shell. You can even combine Python and shell commands.
|
||||
|
||||
![xonsh shell][12]
|
||||
|
||||
We had a separate article on Xonsh if you are curious to learn more:
|
||||
|
||||
**Features of Xonsh Shell**
|
||||
|
||||
- The Xonsh language has shell primitives that you are used to from Bash
|
||||
- Prepare environment variables and arguments in Python and use them in shell commands
|
||||
- Xontribs is a 3rd-party extension system
|
||||
- Customizable tab completion, key bindings, color styles
|
||||
- Rich interface to discover history
|
||||
|
||||
**Installing Xonsh Shell**
|
||||
|
||||
Xonsh is available in the repos of many Linux distributions like Ubuntu, Fedora, etc. So, to install it on Ubuntu, run:
|
||||
|
||||
```
|
||||
sudo apt install xonsh
|
||||
```
|
||||
|
||||
Xonsh also provides an AppImage package, which can be downloaded from their download page. You may refer to our [AppImage guide][13] if you are new to the file format.
|
||||
|
||||
[Xonsh][14]
|
||||
|
||||
### 5. Hilbish
|
||||
|
||||
Hilbish is an **extensible shell** that is very customizable via the Lua programming language. The shell is aimed at both casual users and power users.
|
||||
|
||||
![hilbish shell][15]
|
||||
|
||||
Features of Hilbish
|
||||
|
||||
- Simple and Easy Scripting
|
||||
- History and Completion Menus: Provides the user with proper menus for completions and history searching
|
||||
- Syntax highlighting and hinting are available via the Lua API
|
||||
- It works on Unix systems and Windows, but on Windows, there may encounter issues.
|
||||
|
||||
**Installing Hilbish**
|
||||
|
||||
Hilbish is not available in the package repositories of Ubuntu. So, you will be building it from the source.
|
||||
|
||||
To install it, you need **Go and task** installed.
|
||||
|
||||
```
|
||||
sudo apt install golang-go
|
||||
sudo snap install task --classic
|
||||
```
|
||||
|
||||
Once the dependencies are installed, run the following commands to install Hilbish shell:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/Rosettea/Hilbish
|
||||
cd Hilbish
|
||||
go get -d ./...
|
||||
```
|
||||
|
||||
If you want a stable branch, run these commands:
|
||||
|
||||
```
|
||||
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
task build
|
||||
sudo task install
|
||||
```
|
||||
|
||||
[Hilbish][16]
|
||||
|
||||
### 6. Elvish
|
||||
|
||||
Elvish is an expressive programming language and a versatile interactive shell. It runs on Linux, Mac, and Windows. Even if **v1.0** has not been released, it is already suitable for most daily interactive use.
|
||||
|
||||
![elvish shell][17]
|
||||
|
||||
**Features of Elvish**
|
||||
|
||||
- **Powerful Pipelines:** Pipelines in Elvish can carry structured data, not just text. You can stream lists, maps, and even functions through the pipeline.
|
||||
- **Intuitive Control Structures**
|
||||
- **Directory History:** Elvish remembers all the directories you have been to. You can access it by pressing `CTRL+L`.
|
||||
- **Command History**
|
||||
- **Built-in File Manager:** Accessible by pressing CTRL + N
|
||||
|
||||
**Install Elvish**
|
||||
|
||||
Elvish shell is available in Ubuntu and Arch Linux package managers. So to install it, open a terminal and run:
|
||||
|
||||
```
|
||||
sudo apt install elvish
|
||||
```
|
||||
|
||||
[Elvish][18]
|
||||
|
||||
### 7. Oh
|
||||
|
||||
According to its developers, Oh is a reimagining of the Unix shell.
|
||||
|
||||
It aims to become a more powerful and robust replacement to modern options while respecting the conventions established by the Unix shell over the last half-century.
|
||||
|
||||
![][19]
|
||||
|
||||
**Features of Oh Shell**
|
||||
|
||||
- First-class channels, pipes, environments, and functions
|
||||
- Rich return values that work with standard shell constructs
|
||||
- Support for modularity.
|
||||
- A simplified set of evaluation and quoting rules.
|
||||
- A syntax that deviates as little as possible from established conventions;
|
||||
|
||||
**Installing Oh**
|
||||
|
||||
Oh provides a pre-compiled binary. You need to download it from their [official GitHub page][20].
|
||||
|
||||
You need to give execution permission to the file using the command:
|
||||
|
||||
```
|
||||
chmod +x filename
|
||||
```
|
||||
|
||||
Now, you can run it by :
|
||||
|
||||
```
|
||||
./<name of binary file>
|
||||
```
|
||||
|
||||
[Oh][21]
|
||||
|
||||
### 8. Solidity
|
||||
|
||||
Solidity is an interactive shell with lightweight session recording and remote compiler support. When you change the solidity pragma/language, it automatically fetches a matching remote compiler.
|
||||
|
||||
![][22]
|
||||
|
||||
**Features of Solidity**
|
||||
|
||||
- `pragma solidity <version>` attempts to dynamically load the selected compiler version
|
||||
- Sessions can be saved and restored using the `.session` command.
|
||||
- Settings are saved on exit (not safe when running concurrent shells).
|
||||
- `$_` is a placeholder for the last known result.
|
||||
- Special commands are dot-prefixed. Everything else is evaluated as Solidity code.
|
||||
|
||||
**Install Solidity**
|
||||
|
||||
You can install solidity shell through npm.
|
||||
|
||||
[Ensure you have the latest version of nodejs][23] and npm installed, then type the following command:
|
||||
|
||||
```
|
||||
npm install -g solidity-shell
|
||||
```
|
||||
|
||||
Once installed, run **solidity-shell** to start the session.
|
||||
|
||||
[Solidity Shell][24]
|
||||
|
||||
### 9. Yash
|
||||
|
||||
Yash, or yet another shell is a POSIX-compliant command line shell written in C99 (ISO/IEC 9899:1999). It has features for daily interactive and scripting use.
|
||||
|
||||
![][25]
|
||||
|
||||
**Features of Yash Shell**
|
||||
|
||||
- Global aliases
|
||||
- Socket redirection, pipeline redirection, and process redirection
|
||||
- Prompt command and command-not-found handler
|
||||
- Command line completion with predefined completion scripts for more than 100 commands
|
||||
- Command line prediction based on command history
|
||||
|
||||
**Installing Yash Shell**
|
||||
|
||||
To install the shell, you need to go to their [GitHub releases][26] page and download the tar file. Now extract the tar file; inside it, you will find an INSTALL file with instructions to install it.
|
||||
|
||||
Typically, you should execute the below command inside the extracted folder.
|
||||
|
||||
```
|
||||
./configure && make && sudo make install
|
||||
```
|
||||
|
||||
[Yash][27]
|
||||
|
||||
### Honorable Mentions
|
||||
|
||||
- **Ion:** [Ion Shell][28] is a modern system shell written in Rust, primarily for **RedoxOS**. It is still a work in progress, and users should expect syntax changes.
|
||||
- **Closh:** [Closh][29] is a bash-like shell that combines the best of traditional UNIX shells with the power of [Clojure][30]. It aims to be a modern alternative to bash. This, too, is in the early stages of development.
|
||||
- **Dash**: [Dash][31] is a POSIX-compliant, fast and lightweight shell from Debian.
|
||||
|
||||
💬 _What do you think about these shells listed? Would you experiment by changing the default shell to some of the options here? What's your favorite one? Share your thoughts in the comments box below._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/shells-linux/
|
||||
|
||||
作者:[Sreenath][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/sreenath/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/content/images/2023/01/fish-shell.png
|
||||
[2]: https://fishshell.com/
|
||||
[3]: https://itsfoss.com/microsoft-open-sources-powershell/
|
||||
[4]: https://itsfoss.com/gui-cli-tui/
|
||||
[5]: https://itsfoss.com/content/images/2023/01/nushell.png
|
||||
[6]: https://github.com/nushell/nushell
|
||||
[7]: https://itsfoss.com/homebrew-linux/
|
||||
[8]: https://www.nushell.sh/
|
||||
[9]: https://itsfoss.com/content/images/2023/01/dunesh.png
|
||||
[10]: https://itsfoss.com/install-rust-cargo-ubuntu-linux/
|
||||
[11]: https://github.com/adam-mcdaniel/dune
|
||||
[12]: https://itsfoss.com/content/images/2023/01/xonsh.png
|
||||
[13]: https://itsfoss.com/use-appimage-linux/
|
||||
[14]: https://xon.sh/
|
||||
[15]: https://itsfoss.com/content/images/2023/01/hilbish.png
|
||||
[16]: https://rosettea.github.io/Hilbish/
|
||||
[17]: https://itsfoss.com/content/images/2023/01/elvish.png
|
||||
[18]: https://elv.sh/
|
||||
[19]: https://itsfoss.com/content/images/2023/01/oh_Shell.png
|
||||
[20]: https://github.com/michaelmacinnis/oh#linux
|
||||
[21]: https://github.com/michaelmacinnis/oh
|
||||
[22]: https://itsfoss.com/content/images/2023/01/solidity-shell.png
|
||||
[23]: https://itsfoss.com/install-nodejs-ubuntu/
|
||||
[24]: https://github.com/tintinweb/solidity-shell
|
||||
[25]: https://itsfoss.com/content/images/2023/01/yash.png
|
||||
[26]: https://github.com/magicant/yash/releases/tag/2.53
|
||||
[27]: https://yash.osdn.jp/index.html.en
|
||||
[28]: https://gitlab.redox-os.org/redox-os/ion
|
||||
[29]: https://github.com/dundalek/closh
|
||||
[30]: https://clojure.org/
|
||||
[31]: https://linuxhandbook.com/dash-shell/
|
||||
|
@ -0,0 +1,423 @@
|
||||
[#]: subject: "A guide to fuzzy queries with Apache ShardingSphere"
|
||||
[#]: via: "https://opensource.com/article/23/2/fuzzy-query-apache-shardingsphere"
|
||||
[#]: author: "Xiong Gaoxiang https://opensource.com/users/xionggaoxiang"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
A guide to fuzzy queries with Apache ShardingSphere
|
||||
======
|
||||
|
||||
[Apache ShardingSphere][1] is an open source distributed database and an ecosystem users and developers need for their databases to provide a customized and cloud-native experience. Its [latest release][2] contains many new features, including data encryption integrated with existing SQL workflows. Most importantly, it allows fuzzy queries of the encrypted data.
|
||||
|
||||
### The problem
|
||||
|
||||
By parsing a user's SQL input and rewriting the SQL according to the user's encryption rules, the original data is encrypted and stored with ciphertext data in the underlying database simultaneously.
|
||||
|
||||
When a user queries the data, it fetches the ciphertext data from the database, decrypts it, and returns the decrypted original data to the user. However, because the encryption algorithm encrypts the whole string, users cannot run fuzzy queries.
|
||||
|
||||
Nevertheless, many businesses need fuzzy queries after the data is encrypted. In version 5.3.0, Apache ShardingSphere provides users with a default fuzzy query algorithm that supports encrypted fields. The algorithm also supports hot plugging, which users can customize. The fuzzy query can be achieved through configuration.
|
||||
|
||||
### How to achieve fuzzy query in encrypted scenarios
|
||||
|
||||
#### Load data to the in-memory database (IMDB)
|
||||
|
||||
First, load all the data into the IMDB to decrypt it. Then, it'll be like querying the original data. This method can achieve fuzzy queries. If the amount of data is small, this method will prove simple and cost-effective. However, if the quantity of data is large, it'll be a disaster.
|
||||
|
||||
#### Implement encryption and decryption functions consistent with database programs
|
||||
|
||||
The second method is to modify fuzzy query conditions and use the database decryption function to decrypt data first and then implement fuzzy query. This method's advantage is the low cost of implementation, development, and use.
|
||||
|
||||
Users only need to modify the previous fuzzy query conditions slightly. However, the ciphertext and encryption functions are stored together in the database, which cannot cope with the problem of account data leaks.
|
||||
|
||||
Native SQL:
|
||||
|
||||
```
|
||||
select * from user where name like "%xxx%"
|
||||
```
|
||||
|
||||
After implementing the decryption function:
|
||||
|
||||
```
|
||||
ѕеlесt * frоm uѕеr whеrе dесоdе(namе) lіkе "%ххх%"
|
||||
```
|
||||
|
||||
#### Store after data masking
|
||||
|
||||
Implement data masking on ciphertext and then store it in a fuzzy query column. This method could lack precision.
|
||||
|
||||
For example, mobile number **13012345678** becomes **130****5678** after the masking algorithm is performed.
|
||||
|
||||
#### Perform encrypted storage after tokenization and combination
|
||||
|
||||
This method performs tokenization and combination on ciphertext data and then encrypts the resultset by grouping characters with fixed length and splitting a field into multiple ones. For example, we take four English characters and two Chinese characters as a query condition: **ningyu1** uses the four-character as a group to encrypt, so the first group is **ning**, the second group **ingy**, the third group **ngyu**, the fourth group **gyu1**, and so on. All the characters are encrypted and stored in the fuzzy query column. If you want to retrieve all data that contains four characters, such as **ingy**, encrypt the characters and use a key `like"%partial%"` to query.
|
||||
|
||||
Shortcomings:
|
||||
|
||||
- Increased storage costs: Free grouping will increase the amount of data, and the data length will increase after being encrypted.
|
||||
- Limited length in fuzzy query: Due to security issues, the length of free grouping cannot be too short or the [rainbow table][3] will easily crack it. Like the example I mentioned above, the length of fuzzy query characters must be greater than or equal to four letters/digits or two Chinese characters.
|
||||
|
||||
#### Single-character digest algorithm (default fuzzy query algorithm provided in ShardingSphere version 5.3.0)
|
||||
|
||||
Although the above methods are all viable, it's only natural to wonder if there's a better alternative. In our community, we find that single-character encryption and storage can balance performance and query but fails to meet security requirements.
|
||||
|
||||
So what's the ideal solution? Inspired by masking algorithms and cryptographic hash functions, we find that data loss and one-way functions can be used.
|
||||
|
||||
The cryptographic hash function should have the following four features:
|
||||
|
||||
- It should be easy to calculate the hash value for any given message.
|
||||
- It should be difficult to infer the original message from a known hash value.
|
||||
- It should not be feasible to modify the message without changing the hash value.
|
||||
- There should only be a very low chance that two different messages produce the same hash value.
|
||||
|
||||
Security: Because of the one-way function, it's impossible to infer the original message. To improve the accuracy of the fuzzy query, we want to encrypt a single character, but the rainbow table will crack it.
|
||||
|
||||
So we take a one-way function (to ensure every character is the same after encryption) and increase the frequency of collisions (to ensure every string is **1: N** backward), which greatly enhances security.
|
||||
|
||||
### Fuzzy query algorithm
|
||||
|
||||
Apache ShardingSphere implements a universal fuzzy query algorithm using the below single-character digest algorithm `org.apache.shardingsphere.encrypt.algorithm.like.CharDigestLikeEncryptAlgorithm`.
|
||||
|
||||
```
|
||||
public final class CharDigestLikeEncryptAlgorithm implements LikeEncryptAlgorithm<Object, String> {
|
||||
|
||||
private static final String DELTA = "delta";
|
||||
|
||||
private static final String MASK = "mask";
|
||||
|
||||
private static final String START = "start";
|
||||
|
||||
private static final String DICT = "dict";
|
||||
|
||||
private static final int DEFAULT_DELTA = 1;
|
||||
|
||||
private static final int DEFAULT_MASK = 0b1111_0111_1101;
|
||||
|
||||
private static final int DEFAULT_START = 0x4e00;
|
||||
|
||||
private static final int MAX_NUMERIC_LETTER_CHAR = 255;
|
||||
|
||||
@Getter
|
||||
private Properties props;
|
||||
|
||||
private int delta;
|
||||
|
||||
private int mask;
|
||||
|
||||
private int start;
|
||||
|
||||
private Map<Character, Integer> charIndexes;
|
||||
|
||||
@Override
|
||||
public void init(final Properties props) {
|
||||
this.props = props;
|
||||
delta = createDelta(props);
|
||||
mask = createMask(props);
|
||||
start = createStart(props);
|
||||
charIndexes = createCharIndexes(props);
|
||||
}
|
||||
|
||||
private int createDelta(final Properties props) {
|
||||
if (props.containsKey(DELTA)) {
|
||||
String delta = props.getProperty(DELTA);
|
||||
try {
|
||||
return Integer.parseInt(delta);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new EncryptAlgorithmInitializationException("CHAR_DIGEST_LIKE", "delta can only be a decimal number");
|
||||
}
|
||||
}
|
||||
return DEFAULT_DELTA;
|
||||
}
|
||||
|
||||
private int createMask(final Properties props) {
|
||||
if (props.containsKey(MASK)) {
|
||||
String mask = props.getProperty(MASK);
|
||||
try {
|
||||
return Integer.parseInt(mask);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new EncryptAlgorithmInitializationException("CHAR_DIGEST_LIKE", "mask can only be a decimal number");
|
||||
}
|
||||
}
|
||||
return DEFAULT_MASK;
|
||||
}
|
||||
|
||||
private int createStart(final Properties props) {
|
||||
if (props.containsKey(START)) {
|
||||
String start = props.getProperty(START);
|
||||
try {
|
||||
return Integer.parseInt(start);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new EncryptAlgorithmInitializationException("CHAR_DIGEST_LIKE", "start can only be a decimal number");
|
||||
}
|
||||
}
|
||||
return DEFAULT_START;
|
||||
}
|
||||
|
||||
private Map<Character, Integer> createCharIndexes(final Properties props) {
|
||||
String dictContent = props.containsKey(DICT) && !Strings.isNullOrEmpty(props.getProperty(DICT)) ? props.getProperty(DICT) : initDefaultDict();
|
||||
Map<Character, Integer> result = new HashMap<>(dictContent.length(), 1);
|
||||
for (int index = 0; index < dictContent.length(); index++) {
|
||||
result.put(dictContent.charAt(index), index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private String initDefaultDict() {
|
||||
InputStream inputStream = CharDigestLikeEncryptAlgorithm.class.getClassLoader().getResourceAsStream("algorithm/like/common_chinese_character.dict");
|
||||
LineProcessor<String> lineProcessor = new LineProcessor<String>() {
|
||||
|
||||
private final StringBuilder builder = new StringBuilder();
|
||||
|
||||
@Override
|
||||
public boolean processLine(final String line) {
|
||||
if (line.startsWith("#") || 0 == line.length()) {
|
||||
return true;
|
||||
} else {
|
||||
builder.append(line);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResult() {
|
||||
return builder.toString();
|
||||
}
|
||||
};
|
||||
return CharStreams.readLines(new InputStreamReader(inputStream, Charsets.UTF_8), lineProcessor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encrypt(final Object plainValue, final EncryptContext encryptContext) {
|
||||
return null == plainValue ? null : digest(String.valueOf(plainValue));
|
||||
}
|
||||
|
||||
private String digest(final String plainValue) {
|
||||
StringBuilder result = new StringBuilder(plainValue.length());
|
||||
for (char each : plainValue.toCharArray()) {
|
||||
char maskedChar = getMaskedChar(each);
|
||||
if ('%' == maskedChar) {
|
||||
result.append(each);
|
||||
} else {
|
||||
result.append(maskedChar);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private char getMaskedChar(final char originalChar) {
|
||||
if ('%' == originalChar) {
|
||||
return originalChar;
|
||||
}
|
||||
if (originalChar <= MAX_NUMERIC_LETTER_CHAR) {
|
||||
return (char) ((originalChar + delta) & mask);
|
||||
}
|
||||
if (charIndexes.containsKey(originalChar)) {
|
||||
return (char) (((charIndexes.get(originalChar) + delta) & mask) + start);
|
||||
}
|
||||
return (char) (((originalChar + delta) & mask) + start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "CHAR_DIGEST_LIKE";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Define the binary `mask` code to lose precision `0b1111_0111_1101` (mask).
|
||||
- Save common Chinese characters with disrupted order like a `map` dictionary.
|
||||
- Obtain a single string of `Unicode` for digits, English, and Latin.
|
||||
- Obtain an `index` for a Chinese character belonging to a dictionary.
|
||||
- Other characters fetch the `Unicode` of a single string.
|
||||
- Add `1 (delta)`to the digits obtained by different types above to prevent any original text from appearing in the database.
|
||||
- Then convert the offset `Unicode` into binary, perform the `AND` operation with `mask`, and carry out a two-bit digit loss.
|
||||
- Directly output digits, English, and Latin after the loss of precision.
|
||||
- The remaining characters are converted to decimal and output with the common character `start` code after the loss of precision.
|
||||
|
||||
### The fuzzy algorithm development progress
|
||||
|
||||
#### The first edition
|
||||
|
||||
Simply use `Unicode` and `mask` code of common characters to perform the `AND` operation.
|
||||
|
||||
```
|
||||
Mask: 0b11111111111001111101
|
||||
The original character: 0b1000101110101111讯
|
||||
After encryption: 0b1000101000101101設
|
||||
```
|
||||
|
||||
Assuming we know the key and encryption algorithm, the original string after a backward pass is:
|
||||
|
||||
```
|
||||
1.0b1000101100101101 謭
|
||||
2.0b1000101100101111 謯
|
||||
3.0b1000101110101101 训
|
||||
4.0b1000101110101111 讯
|
||||
5.0b1000101010101101 読
|
||||
6.0b1000101010101111 誯
|
||||
7.0b1000101000101111 訯
|
||||
8.0b1000101000101101 設
|
||||
```
|
||||
|
||||
Based on the missing bits, we find that each string can be derived `2^n` Chinese characters backward. When the `Unicode` of common Chinese characters is decimal, their intervals are very large. Notice that the Chinese characters inferred backward are not common characters, and it's more likely to infer the original characters.
|
||||
|
||||
![Inference of Chinese characters][4]
|
||||
|
||||
#### The second edition
|
||||
|
||||
The interval of common Chinese characters in `Unicode` is irregular. We planned to leave the last few bits of Chinese characters in `Unicode` and convert them into decimal as an `index` to fetch some common Chinese characters. This way, when the algorithm is known, uncommon characters won't appear after a backward pass, and distractors are no longer easy to eliminate.
|
||||
|
||||
If we leave the last few bits of Chinese characters in `Unicode`, it has something to do with the relationship between the accuracy of fuzzy query and anti-decryption complexity. The higher the accuracy, the lower the decryption difficulty.
|
||||
|
||||
Let's take a look at the collision degree of common Chinese characters under our algorithm:
|
||||
|
||||
1. When `mask`=0b0011_1111_1111:
|
||||
|
||||
![Mask results][5]
|
||||
|
||||
2. When `mask`=0b0001_1111_1111:
|
||||
|
||||
![Mask results][6]
|
||||
|
||||
For the mantissa of Chinese characters, leave 10 and 9 digits. The 10-digit query is more accurate because its collision is much weaker. Nevertheless, if the algorithm and the key are known, the original text of the 1:1 character can be derived backward.
|
||||
|
||||
The nine-digit query is less accurate because nine-digit collisions are relatively stronger, but there are fewer 1:1 characters. Although we change the collisions regardless of whether we leave ten or nine digits, the distribution is unbalanced due to the irregular `Unicode` of Chinese characters. The overall collision probability cannot be controlled.
|
||||
|
||||
#### The third edition
|
||||
|
||||
In response to the unevenly distributed problem found in the second edition, we take common characters with disrupted order as the dictionary table.
|
||||
|
||||
1. The encrypted text first looks up the `index` in the out-of-order dictionary table. We use the `index` and subscript to replace the `Unicode` without rules. Use `Unicode` in case of uncommon characters. (Note: Evenly distribute the code to be calculated as far as possible.)
|
||||
|
||||
2. The next step is to perform the `AND` operation with a `mask` and lose two-bit precision to increase the frequency of collisions.
|
||||
|
||||
Let's take a look at the collision degree of common Chinese characters under our algorithm:
|
||||
|
||||
1. When `mask`=0b1111_1011_1101:
|
||||
|
||||
![Mask results][7]
|
||||
|
||||
2. When `mask`=0b0111_1011_1101:
|
||||
|
||||
![Mask results][8]
|
||||
|
||||
When the `mask` leaves 11 bits, you can see that the collision distribution is concentrated at 1:4. When the `mask` leaves ten bits, the number becomes 1:8. At this time, we only need to adjust the number of precision losses to control whether the collision is 1:2, 1:4 or 1:8.
|
||||
|
||||
If the `mask` is selected as 1, and the algorithm and key are known, there will be a 1:1 Chinese character because we calculate the collision degree of common characters at this time. If we add the missing four bits before the 16-bit binary of Chinese characters, the situation becomes `2^5=32` cases.
|
||||
|
||||
Since we encrypt the whole text, even if the individual character is inferred backward, there will be little impact on overall security and will not cause mass data leaks. At the same time, the premise of backward pass is to know the algorithm, key, `delta`, and dictionary, so it's impossible to achieve from the data in the database.
|
||||
|
||||
### How to use fuzzy query
|
||||
|
||||
Fuzzy query requires the configuration of `encryptors` (encryption algorithm configuration), `likeQueryColumn` (fuzzy query column name), and `likeQueryEncryptorName` (encryption algorithm name of fuzzy query column ) in the encryption configuration.
|
||||
|
||||
Please refer to the following configuration. Add your own sharding algorithm and data source.
|
||||
|
||||
```
|
||||
dataSources:
|
||||
ds_0:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
jdbcUrl: jdbc:mysql://127.0.0.1:3306/test?allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
|
||||
rules:
|
||||
- !ENCRYPT
|
||||
encryptors:
|
||||
like_encryptor:
|
||||
type: CHAR_DIGEST_LIKE
|
||||
aes_encryptor:
|
||||
type: AES
|
||||
props:
|
||||
aes-key-value: 123456abc
|
||||
tables:
|
||||
user:
|
||||
columns:
|
||||
name:
|
||||
cipherColumn: name
|
||||
encryptorName: aes_encryptor
|
||||
assistedQueryColumn: name_ext
|
||||
assistedQueryEncryptorName: aes_encryptor
|
||||
likeQueryColumn: name_like
|
||||
likeQueryEncryptorName: like_encryptor
|
||||
phone:
|
||||
cipherColumn: phone
|
||||
encryptorName: aes_encryptor
|
||||
likeQueryColumn: phone_like
|
||||
likeQueryEncryptorName: like_encryptor
|
||||
queryWithCipherColumn: true
|
||||
|
||||
|
||||
props:
|
||||
sql-show: true
|
||||
```
|
||||
|
||||
Insert
|
||||
|
||||
```
|
||||
Logic SQL: insert into user ( id, name, phone, sex) values ( 1, '熊高祥', '13012345678', '男')
|
||||
Actual SQL: ds_0 ::: insert into user ( id, name, name_ext, name_like, phone, phone_like, sex) values (1, 'gyVPLyhIzDIZaWDwTl3n4g==', 'gyVPLyhIzDIZaWDwTl3n4g==', '佹堝偀', 'qEmE7xRzW0d7EotlOAt6ww==', '04101454589', '男')
|
||||
```
|
||||
|
||||
Update
|
||||
|
||||
```
|
||||
Logic SQL: update user set name = '熊高祥123', sex = '男1' where sex ='男' and phone like '130%'
|
||||
Actual SQL: ds_0 ::: update user set name = 'K22HjufsPPy4rrf4PD046A==', name_ext = 'K22HjufsPPy4rrf4PD046A==', name_like = '佹堝偀014', sex = '男1' where sex ='男' and phone_like like '041%'
|
||||
```
|
||||
|
||||
Select
|
||||
|
||||
```
|
||||
Logic SQL: select * from user where (id = 1 or phone = '13012345678') and name like '熊%'
|
||||
Actual SQL: ds_0 ::: select `user`.`id`, `user`.`name` AS `name`, `user`.`sex`, `user`.`phone` AS `phone`, `user`.`create_time` from user where (id = 1 or phone = 'qEmE7xRzW0d7EotlOAt6ww==') and name_like like '佹%'
|
||||
```
|
||||
|
||||
Select: federated table sub-query
|
||||
|
||||
```
|
||||
Logic SQL: select * from user LEFT JOIN user_ext on user.id=user_ext.id where user.id in (select id from user where sex = '男' and name like '熊%')
|
||||
Actual SQL: ds_0 ::: select `user`.`id`, `user`.`name` AS `name`, `user`.`sex`, `user`.`phone` AS `phone`, `user`.`create_time`, `user_ext`.`id`, `user_ext`.`address` from user LEFT JOIN user_ext on user.id=user_ext.id where user.id in (select id from user where sex = '男' and name_like like '佹%')
|
||||
```
|
||||
|
||||
Delete
|
||||
|
||||
```
|
||||
Logic SQL: delete from user where sex = '男' and name like '熊%'
|
||||
Actual SQL: ds_0 ::: delete from user where sex = '男' and name_like like '佹%'
|
||||
```
|
||||
|
||||
The above example demonstrates how fuzzy query columns rewrite SQL in different SQL syntaxes to support fuzzy queries.
|
||||
|
||||
### Wrap up
|
||||
|
||||
This article introduced you to the working principles of fuzzy query and used specific examples to demonstrate how to use it. I hope that through this article, you will have a basic understanding of fuzzy queries.
|
||||
|
||||
_This article was originally published on [Medium][9] and has been republished with the author's permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/2/fuzzy-query-apache-shardingsphere
|
||||
|
||||
作者:[Xiong Gaoxiang][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/xionggaoxiang
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://shardingsphere.apache.org/
|
||||
[2]: https://opensource.com/article/23/1/apache-shardingsphere-new-features
|
||||
[3]: https://www.techtarget.com/whatis/definition/rainbow-table
|
||||
[4]: https://opensource.com/sites/default/files/2023-01/41chinesecharacters.jpg
|
||||
[5]: https://opensource.com/sites/default/files/2023-01/42-1-characters.jpg
|
||||
[6]: https://opensource.com/sites/default/files/2023-01/42-2-characters.jpg
|
||||
[7]: https://opensource.com/sites/default/files/2023-01/43-1-characters.png
|
||||
[8]: https://opensource.com/sites/default/files/2023-01/43-2-characters.png
|
||||
[9]: https://medium.com/codex/fuzzy-query-for-ciphercolumn-shardingsphere-5-3-0-deep-dive-ad09faea67d3
|
132
sources/tech/20230202.1 ⭐️ Learn Basic by coding a game.md
Normal file
132
sources/tech/20230202.1 ⭐️ Learn Basic by coding a game.md
Normal file
@ -0,0 +1,132 @@
|
||||
[#]: subject: "Learn Basic by coding a game"
|
||||
[#]: via: "https://opensource.com/article/23/2/learn-basic-coding-game"
|
||||
[#]: author: "Moshe Zadka https://opensource.com/users/moshez"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn Basic by coding a game
|
||||
======
|
||||
|
||||
Writing the same application in multiple languages is a great way to learn new ways to program. Most programming languages have certain things in common, such as:
|
||||
|
||||
- Variables
|
||||
- Expressions
|
||||
- Statements
|
||||
|
||||
These concepts are the basis of most programming languages. Once you understand them, you can start figuring the rest out.
|
||||
|
||||
Programming languages usually share some similarities. Once you know one programming language, you can learn the basics of another by recognizing its differences.
|
||||
|
||||
Practicing with a standard program is a good way of learning a new language. It allows you to focus on the language, not the program's logic. I'm doing that in this article series using a "guess the number" program, in which the computer picks a number between one and 100 and asks you to guess it. The program loops until you guess the number correctly.
|
||||
|
||||
This program exercises several concepts in programming languages:
|
||||
|
||||
- Variables
|
||||
- Input
|
||||
- Output
|
||||
- Conditional evaluation
|
||||
- Loops
|
||||
|
||||
It's a great practical experiment to learn a new programming language. This article focuses on Basic.
|
||||
|
||||
### Guess the number in (Bywater) Basic
|
||||
|
||||
There is no real standard for the Basic programming language. Wikipedia says, "BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use." The [BWBasic][1] implementation is available under the GPL.
|
||||
|
||||
You can explore Basic by writing a version of the "guess the number" game.
|
||||
|
||||
### Install Basic on Linux
|
||||
|
||||
In Debian or Ubuntu, you can install Basic with the following:
|
||||
|
||||
```
|
||||
$ apt install -y bwbasic
|
||||
```
|
||||
|
||||
Download the latest release tarball for Fedora, CentOS, Mageia, and any other Linux distribution. Extract it, make it executable, and then run it from a terminal:
|
||||
|
||||
```
|
||||
$ tar --extract --file bwbasic*z
|
||||
|
||||
$ chmod +x bywater
|
||||
|
||||
$ ./bywater
|
||||
```
|
||||
|
||||
On Windows, [download the .exe release][2].
|
||||
|
||||
### Basic code
|
||||
|
||||
Here is my implementation:
|
||||
|
||||
```
|
||||
10 value$ = cint(rnd * 100) + 1
|
||||
20 input "enter guess"; guess$
|
||||
30 guess$ = val(guess$)
|
||||
40 if guess$ < value$ then print "Too low"
|
||||
50 if guess$ > value$ then print "Too high"
|
||||
60 if guess$ = value$ then 80
|
||||
70 goto 20
|
||||
80 print "That's right"
|
||||
```
|
||||
|
||||
Basic programs can be numbered or unnumbered. Usually, it is better to write programs unnumbered, but writing them with numbered lines makes it easier to refer to individual lines.
|
||||
|
||||
By convention, coders write lines as multiples of 10. This approach allows interpolating new lines between existing ones for debugging. Here's an explanation of my method above:
|
||||
|
||||
- Line 10: Computes a random value between 1 and 100 using the built-in **rnd** function, which generates a number between 0 and 1, not including 1.
|
||||
- Line 20: Asks for a guess and puts the value in the **guess$ scalar** variable. Line 30 converts the value to a numeric one.
|
||||
- Lines 40 and 50: Give the guesser feedback, depending on the comparison.
|
||||
- Line 70: Goes to the beginning of the loop.
|
||||
- Line 60: _Breaks_& the loop by transferring control to line 80. Line 80 is the last line, so the program exits after that.
|
||||
|
||||
### Sample output
|
||||
|
||||
The following is an example of the program after putting it in `program.bas`:
|
||||
|
||||
```
|
||||
$ bwbasic program.bas
|
||||
Bywater BASIC Interpreter/Shell, version 2.20 patch level 2
|
||||
Copyright (c) 1993, Ted A. Campbell
|
||||
Copyright (c) 1995-1997, Jon B. Volkoff
|
||||
|
||||
enter guess? 50
|
||||
Too low
|
||||
enter guess? 75
|
||||
Too low
|
||||
enter guess? 88
|
||||
Too high
|
||||
enter guess? 80
|
||||
Too low
|
||||
enter guess? 84
|
||||
Too low
|
||||
enter guess? 86
|
||||
Too high
|
||||
enter guess? 85
|
||||
That's right
|
||||
```
|
||||
|
||||
### Get started
|
||||
|
||||
This "guess the number" game is a great introductory program for learning a new programming language because it exercises several common programming concepts in a pretty straightforward way. By implementing this simple game in different programming languages, you can demonstrate some core concepts of the languages and compare their details.
|
||||
|
||||
Do you have a favorite programming language? How would you write the "guess the number" game in it? Follow this article series to see examples of other programming languages that might interest you!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/2/learn-basic-coding-game
|
||||
|
||||
作者:[Moshe Zadka][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/moshez
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://yeolpishack.net/repos/ChipMaster/bwBASIC
|
||||
[2]: https://github.com/nerun/bwbasic/releases
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user