mirror of
https://github.com/LCTT/TranslateProject.git
synced 2026-08-23 04:03:29 +08:00
Merge branch 'master', remote-tracking branch 'lctt/master'
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
Linux基金会捐赠部分会员费给Code.org
|
||||
================================================================================
|
||||

|
||||
|
||||
Linux基金会[宣布][1]鉴于年中个别成员的努力和推广。对于每一位在2014年6月1日到6月30日晚上11:59之间加入的新会员,Code.org将会得到25美元。
|
||||
|
||||
Code.org是通过让更多的学校提供机会,以提高女性和有色人种学生的参与,致力于扩展计算机科学教育的非营利性组织。其目标是提供给每所学校的学生学习计算机科学的机会。Code.org与Linux基金会的使命是增加人们学习编程的机会。
|
||||
|
||||
Linux基金会的CMO Amanda McPherson解释道,当今的许多Linux人才都是从学生时代开始摆弄电脑,并在大学期间编写了简单地程序。通过将提供这个月的个人会员捐款给Code.org,我们希望社会各界能够支持Linux和Linux创始人Linus Torvalds的工作,同时帮助增加获取计算机科学教育的下一代Linux开发人员和系统管理员。
|
||||
|
||||
学习和教育也是Linux基金会最优先考虑的。基金会最近宣布的第一个“Linux入门”大规模开放式网络课程(MOOC),它是免费提供给所有人的。已经有超过14万人登记预计8月开始的第一节课。它也提供并组织各种培训课程。
|
||||
|
||||
Linux基金会会员们支持着Linux和开源社区的发展。作为额外津贴,成员也会得到包括20%折扣的LinuxCon和CloudOpen大会门票的独家优惠;高达10%折扣的Linux基金会培训;一个Linux.com的电子邮件地址(例如john@linux.com);购买戴尔,惠普和联想电脑的员工优惠价;高达35%折扣的O'Reilly书籍和电子书;以及其他各种折扣。
|
||||
|
||||
每年的会员费为99美元。对于学生是25美元,但包含相同的个人会员优惠。要注册,请访问:
|
||||
[https://www.linuxfoundation.org/about/join/individual][2]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.muktware.com/2014/06/linux-foundation-donate-portion-membership-fees-code-org/27942
|
||||
|
||||
译者:[乌龙茶](https://github.com/yechunxiao19) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.linuxfoundation.org/news-media/announcements/2014/06/linux-foundations-biannual-membership-drive-kicks-portion-dues
|
||||
[2]:https://www.linuxfoundation.org/about/join/individual
|
||||
@@ -1,4 +1,4 @@
|
||||
Collectl: 一个高级全能的 Linux 性能监控工具
|
||||
Collectl: Linux 性能监控的全能冠军
|
||||
================================================================================
|
||||
|
||||
对于一个 Linux 系统管理员来说确保自己管理的系统处于一个良好的状态是其首要责任。Linux 系统管理员可以找到有很多工具来帮助自己监控和显示系统中的进程,例如 top 和 htop ,但是这些工具都不能与 **collectl** 相媲美。
|
||||
@@ -8,8 +8,7 @@ Collectl: 一个高级全能的 Linux 性能监控工具
|
||||
|
||||
**collectl**是一款非常优秀并且有着丰富的命令行功能的实用程序,你可以用它来采集描述当前系统状态的性能数据。不同于大多数其它的系统监控工具,collectl 并非仅局限于有限的系统度量,相反,它可以收集许多不同类型系统资源的相关信息,如 cpu 、disk、memory 、network 、sockets 、 tcp 、inodes 、infiniband 、 lustre 、memory、nfs、processes、quadrics、slabs和buddyinfo等。
|
||||
|
||||
使用 **collectl** 的另一个好处就是它可以替代那些有特殊用途的工具如 top、ps、iotop 等还有其它许多这样的工具。那么 **collectl** 有什么特性而使其成为一个有用的工具呢?
|
||||
|
||||
使用 **collectl** 的另一个好处就是它可以替代那些特定用途的工具如: top、ps、iotop 等等其它工具。那么 **collectl** 有什么特性而使其成为一个有用的工具呢?
|
||||
|
||||
经过许多研究后,我总结了 collectl 的命令行功能的一些非常重要的特性。
|
||||
|
||||
@@ -33,7 +32,6 @@ Collectl: 一个高级全能的 Linux 性能监控工具
|
||||
|
||||
### 如何在Linux上安装collectl###
|
||||
|
||||
|
||||
**collectl**可以在所有的 Linux 发行版上运行,唯一需要的就是 perl 语言,所以在安装 **collectl** 之前,一定要确保你的电脑上已经安装了**Perl**。
|
||||
|
||||
#### 对于Debian/Ubuntu/Linux Mint ####
|
||||
@@ -50,8 +48,7 @@ Collectl: 一个高级全能的 Linux 性能监控工具
|
||||
|
||||
### 一些关于collectl的实例 ###
|
||||
|
||||
|
||||
collectl 工具安装完成之后,你可以轻松得在终端运行它,你甚至不需要任何选项。下面的命令将会以简短的人性化的格式显示cpu、硬盘和网络信息。
|
||||
collectl 工具安装完成之后,你可以轻松地在终端运行它,你甚至不需要指定任何选项。下面的命令将会以简短易读的格式显示cpu、硬盘和网络信息。
|
||||
|
||||
# collectl
|
||||
|
||||
@@ -70,16 +67,15 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
22 4 993 1615 0 0 56 3 1 2 0 3
|
||||
|
||||
|
||||
正如上面终端上所显示的,我们很容易观察该命令输出的系统度量值,因为它只显示一整行。
|
||||
|
||||
正如上面终端上所显示的,我们很容易观察该命令输出的系统度量值,因为它每次以一行显示。
|
||||
|
||||
不加任何参数执行 collectl 会显示下面子系统的信息
|
||||
|
||||
- cpu
|
||||
- disks
|
||||
- network
|
||||
- 磁盘
|
||||
- 网络
|
||||
|
||||
**提示**:在这里,一个子系统是每一种可以测量的系统资源。
|
||||
**提示**:在这里,一个子系统就是每一种可以测量的系统资源。
|
||||
|
||||
你也可以显示除slabs以外各个子系统的统计数据,这要结合下面的 **-all** 选项来实现。
|
||||
|
||||
@@ -99,9 +95,7 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
15 1 753 1276 361 391 1G 175M 1G 683M 193M 1G ssslkjjebbk 0 0 40 3 1 2 0 3 0 0 0 0 623 0 0 0 8160 240829 0 0 0 0
|
||||
|
||||
|
||||
|
||||
但是,你如何用它来监控 cpu 的使用情况呢? ‘s’ 选项可以用来控制需要收集和回放的数据。
|
||||
|
||||
但是,你如何用它来监控 cpu 的使用情况呢? ‘-s’ 选项可以用来控制哪个子系统的数据需要收集和回放。
|
||||
|
||||
例如下面的命令可以用来对cpu使用情况进行一个总结。
|
||||
|
||||
@@ -140,7 +134,7 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
11 2 795 1285 0 0 0 0 2 14 1 14
|
||||
|
||||
|
||||
你可以很容易地理解默认选项是“**cdn**”,它代表cpu、硬盘和网络数据。运行添加这个选项的 collectl 命令的输出和“**collectl -scn**”的输出一样。
|
||||
你可以很容易就明白默认选项是“**cdn**”,它代表cpu、硬盘和网络数据。运行带这个选项的 collectl 命令的输出和“**collectl -scn**”的输出一样。
|
||||
|
||||
如果你想采集内存的数据,用下面的命令。
|
||||
|
||||
@@ -201,7 +195,7 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
|
||||
对于我们普通大众来说记住这些选项很困难,所以在这里,我整理出了一个列表来总结这个工具支持的选项。
|
||||
|
||||
- **b** – buddy info (memory fragmentation)
|
||||
- **b** – buddy info (内存碎片)
|
||||
- **c** – CPU
|
||||
- **d** – Disk
|
||||
- **f** – NFS V3 Data
|
||||
@@ -213,7 +207,7 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
- **s** – Sockets
|
||||
- **t** – TCP
|
||||
- **x** – Interconnect
|
||||
- **y** – Slabs (system object caches)
|
||||
- **y** – Slabs (系统对象缓存)
|
||||
|
||||
对于一个系统管理员或者一个 Linux 用户来说很重要的一种数据就是硬盘的使用情况。下面的命令可以帮你监控硬盘使用情况。
|
||||
|
||||
@@ -233,7 +227,7 @@ collectl 工具安装完成之后,你可以轻松得在终端运行它,你
|
||||
0 0 0 0
|
||||
|
||||
|
||||
你也可以使用“**-sD**”选项来采集单个硬盘的数据,但是你必须知道全部硬盘的信息不会被报告。
|
||||
你也可以使用“**-sD**”选项来采集单个硬盘的数据,不过你必须知道这就不会显示全部硬盘的信息。
|
||||
|
||||
# collectl -sD
|
||||
|
||||
@@ -333,7 +327,7 @@ collectl 工具中有许多选项,但是仅用一篇文章来介绍肯定是
|
||||
22 root 0 2 0 S 0 0 0 0.00 0.00 0 00:00.00 0 0 0 0 kintegrityd
|
||||
|
||||
|
||||
我确信许多系统管理员将会喜欢这个工具并且在充分利用它后会感受到它的强大。如果你想增进你对 collectl 的了解,从而达到新的层面,你可以去参阅 collectl 的 man 手册并勤加练习。
|
||||
我确信许多系统管理员将会喜欢这个工具并且在充分使用它后会感受到它的强大。如果你想增进你对 collectl 的了解,从而达到新的层面,你可以去参阅 collectl 的 man 手册并勤加练习。
|
||||
|
||||
在你的终端键入下面的命令开始阅读吧。
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
Ubuntu 14.04上怎样安装‘California’ 日历应用
|
||||
================================================================================
|
||||

|
||||
|
||||
**当非盈利软件服务商Yorba宣称它上个月开始开发名为‘California’的桌面日历应用程序时,我们很兴奋——我们在自己的头条里面说“正当其时!”**
|
||||
|
||||
Yorba在背后支撑着注重用户体验的电子邮件客户端软件‘Geary’以及华丽的照片管理软件‘Shotwell’,因此,我们自然有理由非常期望他们能够进军linux系统上的生产力软件主流软件。
|
||||
|
||||
尽管 **California 尚未稳定** 到可以发布到正式的发行版本,但现在可以通过该公司的日常开发的PPA安装到ubuntu系统中。
|
||||
|
||||
### 迄今取得的进展 ###
|
||||
|
||||
“*Neeeeeyaaaaaaaawwnnn!*” — 那是飞机即将降落在旧金山国际机场的一段警告声音.
|
||||
|
||||
是的,California 正在积极的开发中,该软件尚未完成,也没有稳定到满足每个人每天使用,但是
|
||||
如果你愿意搞定一些bug的话,你可以在ubuntu 14.04上安装这款应用程序。
|
||||
|
||||
是否这样做取决于你的想法。
|
||||
|
||||
当前的构建(如,在写本文时的)提供了本地管理以及Google 日历和web日历(.ICS)的基本支持。事件可以甚至在GNOME桌面的日期/时间小程序中显示.
|
||||
|
||||
#### 自然语言输入 ####
|
||||
|
||||
当你第一次打开California 软件时,呈现在你面前的是当月概要,目前还没有按星期,年,议程去查看的方法,起码我没找到。你可以使用导航按钮而切换月份.
|
||||
|
||||
可以通过点击工具栏中的日历图标创建新的日历(*如 ‘工作‘, ‘宠物照料‘*)及打开/关闭它。当所有的日历都展现在主窗口时,每个日历通过不同颜色来视觉区分。
|
||||
|
||||
要创建新的事件,点击‘+’图标, 然后在弹出的输入框中使用**自然语言输入**,输入你想要提交事件的描述(译注:显然你得用英语)。例如, 输入内容“*Bake Sansa Stark A Lemon Cake on Wednesday 2.45 PM*”将在周三的这个时间(14:45)加入该事件。
|
||||
|
||||

|
||||
|
||||
我希望这个功能变得更加完善些。现在,尽管它能够精准定位日期,但不支持重复性事件的创建
|
||||
(e.g., via “*Skype chat with Sam every Tuesday at 7 AM*“)也不能识别地点或人物(e.g., “*Coffee with Penelope on Monday 12 PM at Boston Tea Party*“)。
|
||||
|
||||
要修改正确些,你可以在网格视图上双击它们来完善和编辑创建好条目。这将打开一个包含附加字段、时间选择、日期格式等的窗口。
|
||||
|
||||
#### 不够完善 ####
|
||||
|
||||
如果说有一些缺陷,那就是在外观上(这个阶段的bugs和欠缺的功能可以被忽略)。虽然在 Adwaita 主题下看来已经很棒了,不过在 Ubuntu 默认主题下它看起来糟透了。
|
||||
|
||||
这不是Yorba(或GNOME)的错误,而是Ubuntu开发团队仍然没有在Compiz里面增加对GNOME新的GTK标题栏的支持,现在还在使用 Unity 来渲染窗口。
|
||||
|
||||
California 在ubuntu系统上完全可用,这个问题只是在发行版升级之后。 这个问题没有影响到Ubuntu GNOME或Linux Mint。
|
||||
|
||||
### 在ubuntu14.04中安装California ###
|
||||
|
||||
如果你没注意先前的提醒,我们再次重申:California 尚未稳定,正处于积极的开发中。
|
||||
|
||||
这个[Yorba Daily PPA][2] 也包含了最新(未稳定)的Shotwell和Geary版本。将这个PPA安装到你的系统中将能够使这些软件也更新了。
|
||||
|
||||
sudo add-apt-repository ppa:yorba/daily-builds
|
||||
sudo apt-get update && sudo apt-get install california
|
||||
|
||||
另一个安全试用这个软件的方法是,[直接下载来自PPA的.deb安装包][3]:
|
||||
|
||||
- [Download California for Ubuntu 14.04 (64bit)][4]
|
||||
- [Download California for Ubuntu 14.04 (32bit)][5]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2014/05/california-calendar-app-hits-yorba-daily-ppa
|
||||
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.omgubuntu.co.uk/2014/04/yorba-california-calendar-app-linux
|
||||
[2]:https://launchpad.net/~yorba/+archive/daily-builds/
|
||||
[3]:https://launchpad.net/~yorba/+archive/daily-builds/+packages
|
||||
[4]:https://launchpad.net/~yorba/+archive/daily-builds/+files/california_0.1.0-0%7E188%7Eubuntu14.04.1_amd64.deb
|
||||
[5]:https://launchpad.net/~yorba/+archive/daily-builds/+files/california_0.1.0-0%7E188%7Eubuntu14.04.1_i386.deb
|
||||
@@ -0,0 +1,121 @@
|
||||
如何在Linux上使用命令行管理密码
|
||||
================================================================================
|
||||
|
||||
在基于密码的认证在网络盛行的今天,你可能需要或者已经使用了某种密码管理工具来跟踪管理你正在使用的所有密码。有各种各样的在线或离线服务或者软件工具用于完成此类事情,而这些工具因复杂程度、用户界面或者目标环境(如企业或终端用户)的不同而各不相同。例如,有一些是为终端用户开发基于图形化的密码管理器,如[KeePass(X)][1]。
|
||||
|
||||
对于那些不想要依赖图形化进行密码管理的用户,笔者将会讲述如何在命令行下使用 [pass][2]来管理密码,**这是一个简单的用于命令行管理密码的工具**。
|
||||
|
||||
该密码工具实际上是一个shell脚本编写的前端,其中调用了几个其它工具(如gpg,pwgen,git,xsel)来使用OpenGPG管理用户的密码信息。各个密码使用gpg工具进行加密,并存储到本地密码仓库中。密码信息可以通过终端或者自清除的剪贴板工具使用。
|
||||
|
||||
该密码工具相当灵活,并且使用起来及其简单。你可以将每个密码信息存储到一个OpenGPG保护的普通文本文件,并且将不同的密码文件分组多个类目中。它支持bash自动补全特性,因此可以很方便地使用TAB键来补全命令或者很长的密码名称。
|
||||
|
||||
|
||||
### 在Linux上安装pass ###
|
||||
|
||||
在Debian,Ubuntu或者Linux Mint上安装pass:
|
||||
|
||||
$ sudo apt-get install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
|
||||
在Fedora上安装pass:
|
||||
|
||||
$ sudo yum install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
在CentOS上安装pass,首先[启用EPEL仓库][3],然后执行以下命令:
|
||||
|
||||
$ sudo yum install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
在Archlinux上安装pass:
|
||||
|
||||
$ sudo pac -S pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
### 初始化本地密码仓库 ###
|
||||
|
||||
在使用密码工具之前,你需要执行一次初始化步骤,该步骤包括创建一个GPG密钥对(如果你还没有)以及一个本地密码仓库。
|
||||
|
||||
首先,通过以下步骤创建一个GPG密钥对(即:公钥/私钥)。如果已经创建了自己的GPG密钥对,可以跳过此步骤。
|
||||
|
||||
$ gpg --gen-key
|
||||
|
||||
执行该步骤,会询问你如下问题。如果你不确定,可以选择接受默认回答。作为密钥生成部分,你将要为你的密钥创建一个加密口令,这个口令实际上是你访问存储在本地密码仓库中的任何密码信息时的主密码。成功创建密钥对后,创建的密钥对会存储在~/.gnupg目录中。
|
||||
|
||||

|
||||
|
||||
接下来,运行以下命令来初始化本地密码仓库。下面的<gpg-id>,输入之前创建密钥对时的关联电子邮件地址。
|
||||
|
||||
$ pass init <gpg-id>
|
||||
|
||||
该命令会在~/.password-store目录中创建一个密码仓库。
|
||||
|
||||
### 在终端使用pass管理密码 ###
|
||||
#### 插入新密码信息 ####
|
||||
|
||||
要将新的密码信息插入到本地密码仓库中,请遵循以下命令格式:
|
||||
|
||||
$ pass insert <password-name>
|
||||
|
||||
<password-name>是你定义的专有名称,并且可以分级(如 "finance/tdbank", "online/gmail.com")。在这种情况下,密码信息可以存储到~/.password-store目录下对应的子目录中。
|
||||
|
||||
如果你想要分多行插入密码信息,请像以下命令一样使用"-m"选项。以你自己喜欢的任何格式来输入密码信息,然后按Ctrl+D来结束。
|
||||
|
||||
$ pass insert <password-name> -m
|
||||
|
||||

|
||||
|
||||
#### 查看所有密码名称列表 ####
|
||||
|
||||
要查看所有存储的密码名称列表,只需输入"pass"命令:
|
||||
|
||||
$ pass
|
||||
|
||||

|
||||
|
||||
#### 从密码仓库中取回密码信息 ####
|
||||
|
||||
要访问特定密码列表中的内容,只需使用以下命令:
|
||||
|
||||
$ pass <password-name>
|
||||
|
||||
例如:
|
||||
|
||||
$ pass email/gmail.com
|
||||
|
||||
会要求你输入密码口令来解锁密钥。
|
||||
|
||||
如果你想要将密码复制到剪贴板,而不是显示到终端屏幕上,使用以下命令:
|
||||
|
||||
$ pass -c email/gmail.com
|
||||
|
||||
当密码被复制到剪贴板,剪贴板在45秒后会被自动清空。
|
||||
|
||||
#### 在密码仓库中生成并存储新密码 ####
|
||||
|
||||
使用`pass`命令,你也可以生成一个新的随机密码,该密码可用于任何目的。pass工具将会使用pwgen工具来生成一个好的随机密码。你可以指定密码的长度,或者生成带或不带符号的密码。
|
||||
|
||||
例如,要生成一个具有10个字符不带符号的密码,并将它存储到 "email/new_service.com"列表中:
|
||||
|
||||
$ pass generate email/new_service.com 10 -n
|
||||
|
||||
#### 移除密码信息 ####
|
||||
|
||||
要移除现存的密码信息是很容易的:
|
||||
|
||||
$ pass rm email/gmail.com
|
||||
|
||||
小结一下,pass是及其灵活,便于携带,并且更为重要的是,易于使用。对于正在寻找能简单而行之有效地、安全地、并且不依赖图形化管理任何私人信息的工具的人,笔者强烈推荐pass。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/05/manage-passwords-command-line-linux.html
|
||||
|
||||
译者:[GOLinux](https://github.com/译者ID) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://xmodulo.com/2013/08/how-to-manage-multiple-passwords-on-linux.html
|
||||
[2]:http://www.zx2c4.com/projects/password-store/
|
||||
[3]:http://xmodulo.com/2013/03/how-to-set-up-epel-repository-on-centos.html
|
||||
@@ -9,7 +9,7 @@ Dos攻击或者DDos攻击目的是使服务器或者网络资源耗尽,使其
|
||||
|
||||
netstat命令的用户手册描述其作用是用来显示网络连接、路由表、接口统计、伪连接和组播成员的。
|
||||
|
||||
## 一些例子和解释 ##
|
||||
### 一些例子和解释 ###
|
||||
|
||||
netstat -na
|
||||
|
||||
@@ -47,18 +47,19 @@ netstat命令的用户手册描述其作用是用来显示网络连接、路由
|
||||
|
||||
列出所有连接到本机80端口的IP地址和其连接数。80端口一般是用来处理HTTP网页请求。
|
||||
|
||||
## 如何减少DOS攻击 ##
|
||||
### 如何减少DOS攻击 ###
|
||||
|
||||
一旦你获得攻击服务器的IP地址你就可以使用以下命令拒绝此IP的所有连接。
|
||||
|
||||
iptables -A INPUT 1 -s $IPADRESS -j DROP/REJECT
|
||||
|
||||
注意,你需要将 $IPADRESS 替换成需要拒绝连接的IP地址。
|
||||
|
||||
执行完以上命令后,使用以下命令结束所有的httpd连接以清理系统。
|
||||
|
||||
killall -KILL httpd
|
||||
|
||||
然后执行以下命令重启httpd服务。
|
||||
然后执行以下命令重启httpd服务。
|
||||
|
||||
service httpd start #RedHat 系统
|
||||
|
||||
@@ -70,7 +71,7 @@ netstat命令的用户手册描述其作用是用来显示网络连接、路由
|
||||
|
||||
via: http://linuxaria.com/howto/how-to-verify-ddos-attack-with-netstat-command-on-linux-terminal
|
||||
|
||||
译者:[shipsw](https://github.com/shipsw) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[shipsw](https://github.com/shipsw) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
心脏流血教给我们的:成为开源的贡献者而不仅是个用户
|
||||
================================================================================
|
||||

|
||||
|
||||
> 如果你的公司依赖像OpenSSL这样的开源软件,是时候主动点了。
|
||||
|
||||
心脏流血漏洞让开源社区如芒在背。
|
||||
|
||||
ComputerWorld的Richi Jennings [抨击说][1]“又一个非常可怕的开源失败。”(他是要做标题党么?)ZDNet的Steven J. Vaughan-Nichols不像是作秀反开源,却仍旧将心脏流血漏洞[渲染为][2]“开源软件的最遭时刻”。而最后,ZDNet的Chris Duckett则务实地[倡议][3]:“商业公司(应该)筹集资金来避免心脏流血再次发生。”
|
||||
|
||||
而实际上,企业资金并不是解决心脏流血事件的最终答案 。你才是!
|
||||
|
||||
想要避免开源失败的公司应该不仅仅是开源软件的用户,还要是贡献者。
|
||||
|
||||
### 贡献者乘坐头等舱 ###
|
||||
|
||||
贡献者能够引导特定的项目。他们占据主动,而不是被动接受。大多数企业缺乏资源参与他们所使用的所有开源项目,但每家公司都可以资助给那些真正关系到他们的项目。并且资助得越多,得到的好处越大。
|
||||
|
||||
开源就是一个不断给予的礼物,尤其是给予那些对开源反哺的人们。
|
||||
|
||||
我在MongoDB的同事[Adam Comerford让这点更有说服力][4]:如果你看看第一批得知Heartbleed漏洞的[时间线] [5],那些第一批得知的(如谷歌)有一个相当大的优势。如Comford所说的,这些公司有一个显著的优势就是他们可以在bug还未大规模传开的时候率先采取措施保护他们的系统。
|
||||
|
||||
|
||||
鉴于早期了解像Heartbleed之类问题的优势,Comerford问:“我如何确保我在这类问题的早期通知列表里面?”
|
||||
|
||||
|
||||
如果你依赖于专有软件,你有一个答案:向卖方支付大量的金钱,并希望他适时地响应。但是,如果你正在使用开源软件,有一个更多选择: “要么有大量的员工给[开源项目]做贡献 ,或者...有认识主要贡献者的员工(我们可以找找,他们大多也会贡献其他开源软件项目,像其他的极客和呆瓜一样。“
|
||||
|
||||
Comerford断言说,好处不止这样:
|
||||
|
||||
> 这有很多好处 - 除了让问题及早通知,让手头上的专家来应付这些棘手的更新,以评估你的风险,甚至可能在公众知道之前内部解决问题。在确定项目的方向上你还可以得到重视的回馈,可以影响到关键特性的优先级。最终,你会得到社区的善意,使产品变得更好,并有可能成为其它的聪明贡献者的工作目标。
|
||||
|
||||
换句话说,参与进来。成员有特权,主要的特权可能就是信息。
|
||||
|
||||
### 选择在哪贡献 ###
|
||||
|
||||
同样,没有一家公司有足够的资源来有效地促进所有它所使用的项目,这就是为什么Comerford建议对关键项目上这么做的原因:
|
||||
|
||||
> 如果你要人们列出在企业中所有开源关键技术,你可能会得到一张很长的名单。然后,告诉他们,他们将必须清点人工和预算来支持清单上的每一种技术的话(并验证它) - 它可能会迅速缩水。
|
||||
|
||||
如果你是一个AMD那样的芯片公司,给Linux内核贡献基本驱动程序和其他代码很可能是强制性的。给LibreOffice贡献可能不是。或者,如果你判断你的未来在Hadoop上进行深层数据分析,你应该贡献Hadoop,即使你依旧免费使用OpenSSL社区的成果。比如Dish Networks公司,它的[ CIO告诉上周在开放商业会上的人们][6],他们正在将重要的数据从关系型数据库转到Apache的Kafka,那他最好研究Kafka的代码,即使他不贡献给Apache HTTP服务器项目。
|
||||
|
||||
每家公司都有其优先级,以及这些优先级应该以严肃的承诺而确立。
|
||||
|
||||
这是确保这些项目安全的一部分办法。而另一部分,它是一种形成影响力指引的方式。但同时,红帽公司CEO[Jim Whitehurst][7]早在2008年声明,它是显著减少IT花费的办法:
|
||||
|
||||
> 今天编写的绝大多数软件是企业编写的,不得转售。并且绝大多数是从来没有真正使用过。IT软件开发中的浪费是巨大的....最终,开源给全世界的客户提供价值,我们不仅需要让我们的客户作为开源产品的用户,而且真正加入开源和参与在开发社区。
|
||||
|
||||
|
||||
Comerford坚持认为:“如果我在业务中使用开源软件,我应该雇开发人员来积极给软件做贡献,如果他们自己不是核心开发者,那就雇佣核心开发者。 ”这是充分利用开源软件的关键:给它做贡献,不只是使用它。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://readwrite.com/2014/05/14/heartbleed-open-source-contribution-users
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://blogs.computerworld.com/encryption/23767/heartbleed-openssl-open-source-fail
|
||||
[2]:http://www.zdnet.com/heartbleed-open-sources-worst-hour-7000028420/
|
||||
[3]:http://www.zdnet.com/openssl-needs-corporate-funding-to-avoid-heartbleed-repeat-7000028385/
|
||||
[4]:http://comerford.cc/wordpress/2014/04/15/my-conclusion-heartbleed-timeline/
|
||||
[5]:http://www.smh.com.au/it-pro/security-it/heartbleed-disclosure-timeline-who-knew-what-and-when-20140415-zqurk.html
|
||||
[6]:http://blogs.wsj.com/cio/2014/05/06/dish-looks-to-open-source-software-after-database-failure/
|
||||
[7]:http://www.cnet.com/news/red-hat-solve-enterprise-waste-through-open-source/
|
||||
@@ -1,28 +0,0 @@
|
||||
乌龙茶 占坑
|
||||
Linux Foundation to donate portion of membership fees to Code.org
|
||||
================================================================================
|
||||

|
||||
|
||||
The Linux Foundation [announced][1] its mid-year individual membership drive and promotion. For each new membership between 01 June to 11:59 p.m. PT on June 30, 2014, Code.org will receive $25.
|
||||
|
||||
Code.org is a non-profit organization dedicated to the expansion of computer science by making it available in more schools and increasing participation by women and underrepresented students of color. Its vision is to provide the opportunity of learning computer science to every school student. Code.org identifies with the Linux Foundation’s mission to increase opportunities for people to learn programming of all types.
|
||||
|
||||
Amanda McPherson, CMO at The Linux Foundation explains – “Many of today’s Linux professionals got started as students, tinkering with computers and writing simple programs during college. By helping extend individual membership contributions this month to Code.org, we hope the community can support Linux and the work of Linux creator Linus Torvalds while helping to increase access to computer science education for the next generation of Linux developers and SysAdmins”.
|
||||
|
||||
Learning and education are top priorities at The Linux Foundation too. It recently announced the first ‘Introduction to Linux’ Massive Open Online Course (MOOC), which is free for all. More than 140,000 people already enrolled for the first class that begins this August. It also offers and organizes various training programs.
|
||||
|
||||
The Linux Foundation memberships support the advancement of Linux and open source community. As additional perks, members also receive exclusive benefits that include 20 percent off LinuxCon and CloudOpen registration; up to 10 percent off Linux Foundation training; a Linux.com email address (e.g. john@linux.com); employee purchase pricing from Dell, HP and Lenovo; up to 35 percent off O’Reilly books and e-books; and a variety of other discounts.
|
||||
|
||||
The membership fee per year is $99. For students it is $25 and includes the same benefits as individual members. To sign up, visit:
|
||||
[https://www.linuxfoundation.org/about/join/individual][2]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.muktware.com/2014/06/linux-foundation-donate-portion-membership-fees-code-org/27942
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.linuxfoundation.org/news-media/announcements/2014/06/linux-foundations-biannual-membership-drive-kicks-portion-dues
|
||||
[2]:https://www.linuxfoundation.org/about/join/individual
|
||||
@@ -0,0 +1,42 @@
|
||||
Red Hat Enterprise Linux launched for SAP HANA
|
||||
================================================================================
|
||||
Red Hat has expanded the company’s strategic alliance with SAP AG to make it easier for customers to adopt and run the SAP Data Management portfolio, including the SAP HANA platform, SAP Adaptive Server Enterprise (SAP ASE), SAP IQ software, and the SAP SQL Anywhere suite on Red Hat’s open source solutions.
|
||||
|
||||
The expanded collaboration is expected to enable real-time, in-memory innovation by providing an open, scalable, integrated and highly-available platform for solutions from SAP along with those that are custom-built in an effort to expand customer choice when it comes to fueling business performance and helping enterprises realize increased value from cloud computing and big data.
|
||||
|
||||
Steve Lucas, president, Platform Solutions, SAP AG added: “By joining forces with Red Hat to enable SAP HANA on Red Hat Enterprise Linux, we plan to give our customers an additional choice upon which to base deployments of SAP solutions; an open, flexible and scalable platform that is intended to support customers’ data management needs across on-premise and cloud environments.”
|
||||
|
||||
As the foundation of the enhanced partnership, Red Hat Enterprise Linux is now available and qualified for production use of SAP HANA and supported by partners’ SAP-certified hardware solutions. SAP HANA enables customers to capture business transactions to help make smarter, faster decisions through real-time analysis and reporting combined with dramatically accelerated business processes. Customers can now also enjoy expanded choice when it comes to their deployments of SAP HANA to experience the reliability, quality and stability offered by Red Hat Enterprise Linux. They can also standardize deployments of SAP solutions on Red Hat’s high-performing, secure and open platform, helping to ensure consistency of operations across the business.
|
||||
|
||||
> We are looking for aspiring bloggers and journalists for The Mukt. If you are interested, [apply now!][1]
|
||||
|
||||
Red Hat Enterprise Linux for SAP HANA is designed for easy deployment and simplified integration, and will be available via SAP-certified hardware appliances from partners. Delivered through the power of the partner ecosystems of Red Hat and SAP, it is planned for customers to now have access to a portfolio of cross-industry experience and expertise that harnesses the flexible, scalable and open nature of SAP software and Red Hat solutions that are designed to meet a variety of enterprise information requirements.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.muktware.com/2014/06/red-hat-enterprise-linux-launched-sap-hana/27946
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.themukt.com/write-mukt/
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
||||
@@ -0,0 +1,23 @@
|
||||
alim0x translating
|
||||
|
||||
Steam Hits The Big 500 For Linux Games
|
||||
================================================================================
|
||||

|
||||
|
||||
That is one heck of a milestone isn't it? 500 Linux compatible games are now on Steam which is a pretty great number to point anyone at. No longer will people keep stating "but Linux has no games", but sadly they will say Linux has very little AAA games which is true, but this will be a gradual build up of course.
|
||||
|
||||
I keep saying this, but I still never thought we would make it to a day like this. We have XCOM, Civilization and many more still to come with some surprise announcements later this year I've no doubt.
|
||||
|
||||
Once the Steam Machines/SteamOS are released, and if they are successful we should see the number rise even quicker.
|
||||
|
||||
So, how long before we hit 1000? End of the year maybe, who knows!
|
||||
|
||||
I will go get my party hat now...are you celebrating this milestone?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.gamingonlinux.com/articles/steam-hits-the-big-500-for-linux-games.3849
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
@@ -0,0 +1,38 @@
|
||||
Ubuntu 14.04: Hardware Compatibility Updates
|
||||
================================================================================
|
||||
As Ubuntu moves more and more spiritually away from being another “Linux” Distribution (check their site, the word Linux is not to be found, they have changed the language to refer to themselves as “the world’s most popular open source desktop operating system” instead), they continue to make efforts in certifying hardware from various vendors as “Ubuntu compatible”. Let’s take a quick look at some of the work that has gone into the Ubuntu 14.04 LTS hardware compatibility.
|
||||
|
||||
### What Does Certified Mean? ###
|
||||
|
||||
In the case of Ubuntu Certified Compatibility, it means that either the component or the entire desktop/laptop and all its various components are certified to have full driver support within the kernel for the version of Ubuntu it is certified for. Now, there appear to be two levels of this certification:
|
||||
|
||||
- Components Within Device Certification: This is where major components of a device are certified for a particular LTS version of Ubuntu (like the CPU, Video, Network and Storage Controllers) but not necessarily other components as they may vary (sound, wireless, specialized chipsets).
|
||||
- Full System Certification: This is where an entire device (laptop, desktop or more commonly, a server) and all its myriad of device options are all certified as driver available for a version of Ubuntu LTS
|
||||
|
||||
In the example below, the Dell Inspiron 1545 has had its major components and various other device options certified to run with Ubuntu 12.04 LTS:
|
||||
|
||||

|
||||
|
||||
### So Do My Components Work or Not? ###
|
||||
|
||||
Well, as in most things related to Linux, the answer is “it depends”. The older your system or component, strangely enough, the more likely that it will be supported in the LTS version you are using. A LOT of work has gone into certifying hardware in LTS in general and strides have been made between versions 12.04 and 14.04 LTS (some estimates have the system certifications increasing almost 30% whereas component additions are almost 40% up since the last major version).
|
||||
|
||||
The newest components are going to be hit and miss (particularly if you are looking for official binary drivers from your friendly neighborhood video chip makers – both NVidia and ATI have fallen behind lately when it comes to getting support for their latest chips in the repository channels for the latest kernel versions).
|
||||
|
||||
If you have any doubt whether your system or server is fully compatible, check [Ubuntu’s handy “Certified Hardware”][1] site and see if your component or system is listed.
|
||||
|
||||
### Final Thoughts ###
|
||||
|
||||
Ubuntu has come a long way (literally and figuratively) in terms of hardware support in regards to Linux. Whereas everyone really used to be pretty hit and miss and getting any component to work properly in Linux could mean hours of searching for drivers, patches, configuration strings and/or special settings for a particular chip and revision. Now, for most major system components made within 90 days of the LTS release, you will find you have a pretty decent shot at getting your system up and running in Ubuntu 14.04 LTS.
|
||||
|
||||
Have a different experience or a long standing component with a lack of compatibility? Drop me a note and let me know, I would love to hear about your experiences!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://linuxacademy.com/blog/linux/ubuntu-14-04-hardware-compatibility-updates/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.ubuntu.com/certification/
|
||||
43
sources/news/20140607 Ubuntu One Formally Shuts Down.md
Normal file
43
sources/news/20140607 Ubuntu One Formally Shuts Down.md
Normal file
@@ -0,0 +1,43 @@
|
||||
Ubuntu One Formally Shuts Down
|
||||
================================================================================
|
||||
**Ubuntu One is now formally in shut-down. You have until July 31 to grab your files or they will be lost forever. **
|
||||
|
||||
Canonical announced that it [was axing the service earlier this year][1], citing a lack of paid users and increased competition from Google, Dropbox and other cloud storage services as chief factors in making the decision.
|
||||
|
||||
Attempting to access the web dashboard of Ubuntu One throws up the following notice informing users that the service has been discontinued:
|
||||
|
||||

|
||||
|
||||
Earlier this month an update was pushed to Ubuntu 12.04 LTS to inform users that Ubuntu One would shortly be removed from the desktop, while Ubuntu 14.04 LTS, released in April, ships without Ubuntu One preinstalled.
|
||||
|
||||
### Get Your Data ###
|
||||
|
||||
To grab all your data as a **.zip** file you simply need to log in and hit the orange button positioned under the main notice.
|
||||
|
||||
Canonical has also partnered with cloud storage migration service [mover.io][2] to allow direct importing of files from Ubuntu One to other services, such as Dropbox, Google Drive and Copy.
|
||||
|
||||
Mover, who describe Ubuntu One as “…a world class file sync and share product”, is offering its data transfer service to Ubuntu One users for free, although it does require an account to be created. The company normally only allows ‘free’ plan users to transfer 2GB data.
|
||||
|
||||
For more details on migrating your data to Google Drive through mover.io you can refer to the following knowledge base article.
|
||||
|
||||
- [Transfer from Ubuntu One to Google Drive][3]
|
||||
|
||||
### Refunds ###
|
||||
|
||||
For those of you who had ponied up cash for extra storage on this or the Ubuntu One Music service, Canonical told us you can expect to receive a refund within the next 7–10 days.
|
||||
|
||||
注:下面的那个链接地址在另外一篇文章中,如果也翻译发布了,可以链接到发布的文章里
|
||||
If you’re looking for an Ubuntu One alternative check [out our round up of the most popular][4] cloud services used by our readers.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2014/06/ubuntu-one-discontinued-grab-files-now
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.omgubuntu.co.uk/2014/04/canonical-axe-ubuntu-one-file-music-services-grab-data-now
|
||||
[2]:http://mover.io/
|
||||
[3]:http://support.mover.io/knowledgebase/articles/346927-how-to-transfer-from-ubuntu-one-to-google-drive
|
||||
[4]:http://www.omgubuntu.co.uk/2014/04/three-alternatives-ubuntu-one
|
||||
@@ -1,59 +0,0 @@
|
||||
translating --------------------------- by jutzyn
|
||||
How has the Press Reacted to Ubuntu 14.04? We Round Up the Reviews
|
||||
================================================================================
|
||||

|
||||
|
||||
**The release of Ubuntu 14.04 just before the Easter holiday arrived gave tech journalists and bloggers an extended period in which to play with the newest long-term support release.**
|
||||
|
||||
But what did they make of it?
|
||||
|
||||
### Press Reaction ###
|
||||
|
||||
The last few years have seen each successive release of Ubuntu greeted by fewer and fewer pixels (as opposed to column inches).
|
||||
|
||||
As an LTS, the recommended choice for home users and enterprise deployments alike, does 14.04 buck the trend?
|
||||
|
||||
> ‘Reviews from mainstream tech publications and news site are once again thin on the ground.’
|
||||
|
||||
In short: not really. Reviews from mainstream tech publications and news site are once again thin on the ground. Whether it’s that this release has little newsworthy to offer (outside of extended support and a few extras that only enthusiasts are likely to care about) or whether there’s an increasing weariness about covering an established product that has, by and large, remained a niche interest is not for me to postulate.
|
||||
|
||||
But while there’s no mention of the Trusty Tahr on the BBC News website or in the technology section of The Guardian, it didn’t arrive totally unnoticed. What press reaction there has been, has been positive.
|
||||
|
||||
#### Quote, Unquote ####
|
||||
|
||||
ZDNet offers up a [detailed overview][1], describing the release as “solid and stable”. While noting that it features ‘no big changes’ the reviewer, Terry Ralph-Knight, goes on to declare Ubuntu as being “**pretty hard to beat**”.
|
||||
|
||||
> ‘Terry Ralph-Knight of Zdnet declares Ubuntu 14.04 LTS
|
||||
|
||||
Over at TechRepublic Jack Wallen, in his concise overview, [says Trusty][2] ‘wows through subtlety‘.
|
||||
|
||||
Jon Gold of **Network World** conveys the salient [changes with a slideshow][3]. On the subject of improved HiDPI support Gold notes that this “could prove important as 4K screens begin to gain traction in the market.”
|
||||
|
||||
Tech site The Inquirer [covers the release][4] from the ‘Windows XP Alternative’ angle, but noted it is a ‘natty bit of kit in its own right’.
|
||||
|
||||
> ‘Other coverage tended to regurgitate the official Canonical press release’
|
||||
|
||||
Other coverage tended to regurgitate the Canonical press release that trumpets the lure for Windows XP users and businesses; touts the ‘optimised for multi-touch trackpads and touchscreen’ angle; and touches on the co-release of new 14.04-based tablet and phone builds.
|
||||
|
||||
Of these, **Engadget** and **PCAdvisor** cover the [above points concisely][5], while Jon Brodkin of Ars Technica [distills the essentials points in depth][6] with added insight from an email conversation he had with Rick Spencer, VP of Engineering at Canonical.
|
||||
|
||||
The decision to refer to Ubuntu Touch as merely ‘Ubuntu’ (something that while technically true forgoes a distinction still warranted) confused a few reporters, with many inferring that the screenshots of the desktop version accompanying their articles is what will be shipping on tablets later this year.
|
||||
|
||||
As we have previously reported, the ‘Unity 8′-based version of Ubuntu will be sold preinstalled on tablets from unknown OEMs later this year.
|
||||
|
||||
In all the reception has been positive, if a little lacking. But what critics think matters not a jot — it’s you, the user whose opinion is the true decider. Have you upgraded yet?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2014/04/press-reaction-ubuntu-14-04
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.zdnet.com/ubuntu-14-04-lts-trusty-tahr-review-solid-and-stable-but-no-big-changes-7000028437/
|
||||
[2]:http://www.techrepublic.com/article/ubuntu-14-04-wows-through-subtlety/
|
||||
[3]:http://www.networkworld.com/slideshow/149046/first-look-ubuntu-1404-lts.html
|
||||
[4]:http://www.theinquirer.net/inquirer/news/2340343/ubuntu-1404-lts-desktop-arrives-this-week-as-windows-xp-alternative#%C2%A0
|
||||
[5]:http://www.pcadvisor.co.uk/news/software/3512604/ubuntu-1404-lts-plays-better-with-high-res-displays-forms-ubuntus-tablet-backbone/
|
||||
[6]:http://arstechnica.com/information-technology/2014/04/ubuntu-14-04-will-power-first-commercially-available-ubuntu-tablets/
|
||||
@@ -1,4 +1,3 @@
|
||||
这年头 就是要多占坑 No grown-ups will ever understand that this is a matter of so much importance!
|
||||
10 Linux Platforms Meant For Embedded Systems
|
||||
==========================================
|
||||
Linux has a wide variety of uses. The platform is used by many for simple home use, while it is also the chosen platform for programmers and hackers. In addition, Linux is widely used in embedded systems and there are distributions that are tailored specifically to such systems. Here are 10 Linux platforms that can work great on embedded systems!
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
Vic020
|
||||
Why We Shouldn't Accept Bad Linux Ports
|
||||
================================================================================
|
||||
Thanks to the recent fiasco of The Witcher 2 I wanted to write down some thoughts on why we shouldn't accept bad quality ports from developers.
|
||||
|
||||
Only in recent years have we had so many damned games in our Linux libraries that you now see comments from Linux gamers like "I've got too many games already!" which I imagine now sounds familiar to a lot of you. We have never before seen so much attention from developers thanks to Valve & Steam.
|
||||
|
||||
Also thanks to the push from developers we are seeing ports come along that are quite frankly lazy or just downright buggy to the point of being unplayable for a majority of people.
|
||||
|
||||
The problem is if we keep accepting ports at a sub-par quality then Linux will gain a reputation for having low quality games. Think about that big picture for a moment, seriously.
|
||||
|
||||
Imagine if you will that AAA developers started pushing out more games for Linux using technology like this "eON" that was used to port The Witcher 2. Let's say we have a lot of them and it suddenly looks like Linux has a lot of big-name games. You then have plenty of people trying out Linux, and seeing that their games run with terrible performance on the exact same hardware giving them the impression that Linux itself is bad for gaming. That's not good for anyone.
|
||||
|
||||
I've seen many people say "the toolkit used to port doesn't matter?". That in my eyes is a very naive statement to make. Of course it matters, it can mean the difference of light and day in the quality of a game on Linux. Which directly goes back to my point above about the perception of Linux gaming.
|
||||
You can still say the toolkit doesn't matter and use whatever comparison/analogy you fancy, but if the toolkit is the root cause of the issue, like it will be 99% of the time when we are talking about computer software then yes, it does of course matter.
|
||||
|
||||
I've seen comments now from other major websites stating we should just accept them and be thankful we have them at all. That is an idiotic statement from people who don't look at the bigger picture.
|
||||
|
||||

|
||||
|
||||
Think about the developers and publishers who will see it as acceptable to push terrible Linux ports out the door and call it a day with only profits in mind. The consumer perception of Linux gaming would worsen yet again with even more bad quality ports.
|
||||
|
||||
I am all for ports from developers, of course I am I run this site after-all. I as a customer however do not want to pay for games that would work on Windows, but run like a snail on Linux, why should I? Why should you?
|
||||
|
||||
Final added point: You should never attack a developer when they reach out to the community having issues, that's not acceptable. Feedback is fine, but name calling is childish and makes Linux again look bad.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.gamingonlinux.com/articles/why-we-shouldnt-accept-bad-linux-ports.3765
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
@@ -0,0 +1,126 @@
|
||||
Four Awesome Free Alternatives to Ubuntu One Cloud Storage
|
||||
================================================================================
|
||||

|
||||
|
||||
Be honest: news that [Canonical is shuttering its Ubuntu One cloud storage service][1] came as a shock, right?
|
||||
|
||||
After four years of serving each and every Ubuntu user with a few gigabytes of free space in which to store their documents, music and photos, Canonical have decided to close it down. The service will cease operating as normal from June, and all files will be deleted permanently this July.
|
||||
|
||||
While the reasons behind its closure make sense for the company in lieu of it broader ambitions elsewhere, there’s no getting away from the fact that if you used it daily, you’re going to be left a little peeved.
|
||||
|
||||
> ‘…there is an army of alternatives able to pick up where Ubuntu One has left off’
|
||||
|
||||
Thankfully there is an army of alternatives able to pick up where Ubuntu One has left off. Most, if not all, offer more space, better features and are generally more reliable than Canonical’s aged offering. In fact, it seems like everyone and their pet cat now offers free cloud storage.
|
||||
|
||||
It’s partly because of the fierce competition between these services, what CEO Jane Silber refers to as the “free storage wars”, that the Ubuntu One offering wasn’t able to find its footing.
|
||||
|
||||
But the promise of some free space and a means of syncing to it through the desktop does not mean they’re all equal, or worthy of entrusting with your data. Which alternatives are worth pursuing? Let’s take a look.
|
||||
|
||||

|
||||
Dropbox Indicator on Ubuntu – Comes In Handy
|
||||
|
||||
### Dropbox ###
|
||||
|
||||
#### Best all rounder ####
|
||||
|
||||
Who hasn’t heard of Dropbox? As the granddaddy of cloud storage, it was the first service to both popularise and implement desktop-to-server syncing in a way that felt productive and not cumbersome.
|
||||
|
||||
Its success was buoyed by a generous referral scheme offering you extra space for signing others up, and extensive cross-platform support. Dropbox makes it easy to hop between devices and OSes and retain access to your files. Other features include public folders that let you share items with other people, regardless of whether they use the service, and near-instantaneous syncing of files as and when they’re changed.
|
||||
|
||||
256-bit AES encryption and two-step verification mean your files are pretty safe and secure.
|
||||
|
||||
For Ubuntu users Dropbox provides a native application that integrates tightly with the default file manager Nautilus. It offers an indicator applet for monitoring, sharing and managing sync; file and folder emblems; and some handy right-click menu options for quick sharing.
|
||||
|
||||
- **2GB** Free Space
|
||||
- Referral Scheme
|
||||
- Paid plans start from $9.99/m for 100GB
|
||||
- **Multi-platform support** (Windows, Mac, iOS, Android, Blackberry & Linux)
|
||||
|
||||
> - [Learn More on the Dropbox Website][2]
|
||||
|
||||

|
||||
Insync Integrates Google Drive on Linux
|
||||
|
||||
### Google Drive ###
|
||||
|
||||
#### Best for space and features ####
|
||||
|
||||
If you use Gmail or Google Docs then you’ll have, at some point or another, interacted with Google Drive. The search giant’s cloud service offers 15GB of free space in which to store your files, folders, photos and the like. These can be accessed from virtually any device with internet access and a fairly recent web browser or through dedicated mobile and desktop apps.
|
||||
|
||||
One of the neat things about Drive is that certain files do not count towards your free space quota; e.g., Google Docs files. Neither do files others have shared with you. Better still, any photos you upload to Google+ that have a resolution less than 2048 x 2048 are also hosted and synced gratis.
|
||||
|
||||
But Drive offers more than just space for your stuff. You also gain tight integration with Google’s own services, like Gmail, Google Docs and Google+.
|
||||
|
||||
While it’s not the easiest alternative to use on Ubuntu owing to a lack of official native support, there are a number of third party tools that allow you to sync your files locally and have all changes made uploaded back. The most popular third part app is InSync. It’s not free (costing a one-off fee of $15 for the basic account) but it is by far the best way to use it.
|
||||
|
||||
- 15GB Free Space
|
||||
- Paid plans start from $2.99/m for 100GB
|
||||
- Official apps for Windows, Mac, iOS and Android
|
||||
- Integrated into Chrome OS
|
||||
- Unofficial applications for Linux
|
||||
|
||||
> - [Learn More on the Google Drive Website][3]
|
||||
|
||||

|
||||
Copy running on Ubuntu
|
||||
|
||||
### Copy ###
|
||||
|
||||
#### Best for Security Conscious ####
|
||||
|
||||
If popularity was based solely on the number of referral links that are posted in our comments section, then Copy would win the title hands down.
|
||||
|
||||
It may be less well known than other entrants on this list, but Copy, which is run by cloud enterprise giant Barracuda Networks, touts its robust security benefits the loudest.
|
||||
|
||||
Like Dropbox, Copy uses AES 256-bit encryption on all files but, unlike Dropbox, doesn’t not rely on third-party servers as all files are stored on the company’s own servers.
|
||||
|
||||
“With advanced features like secure sharing, source validation, and identity verification, you can breathe easy knowing your content can only be seen by the people you want,” they promise on their website.
|
||||
|
||||
Another of its unique advantages is that shared files and folders can be assigned to a single user so that they don’t count against the data storage limit for other users. Or, if preferred, the load can be shared between parties so that, for example, a 10GB file shared between 4 people would count as 2.5GB/each, rather than, as on Dropbox, 10GB each.
|
||||
|
||||
Google Drive offers something similar in that only the ‘sharer’ of a file has it count against their storage.
|
||||
|
||||
For desktop integration Copy spoil Linux users. The service supports native integration with **Nautilus, Thunar** and **Caja**, including sync folders and right-click options. An indicator applet/system tray item provides further control options, including a handy list of recently changed files.
|
||||
|
||||
- 15GB Free Space
|
||||
- Referral scheme
|
||||
- Paid plans start from $9.99/m for 250GB
|
||||
- Multi-platform support (Windows, Mac, iOS, Android & Linux)
|
||||
|
||||
> - [Learn More on the Copy Website][4]
|
||||
|
||||

|
||||
Manage File Sync Yourself
|
||||
|
||||
### ownCloud ###
|
||||
|
||||
#### Best for privacy ####
|
||||
|
||||
If you’d rather not trust your data in other people’s hands but still want the convenience of a “personal cloud”, ownCloud is a free and open source cloud storage platform you can host yourself.
|
||||
|
||||
Like with other cloud storage services, ownCloud lets you sync and share your files across Windows, OS X, Linux, Android, and iOS. It also comes with calendar integration, photo gallery sharing, built-in support for (mounting) additional storage devices/services – e.g., FTP servers, Dropbox and Amazon S3 – and a slew of “apps” that can be added for additional features in the web interface, including a PDF viewer, text editor, and version control.
|
||||
|
||||
Packages are available for a number of distributions, including Ubuntu from 12.04 to 13.10.
|
||||
|
||||
> - [Learn More on the ownCloud Website][5]
|
||||
|
||||
Chances are some of you reading this will have you own favourite, so don’t take the four picks above as set in stone. Other options worth exploring before committing include [SpiderOak][6], Microsoft [OneDrive][7] and [Box][8].
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2014/04/three-alternatives-ubuntu-one
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.omgubuntu.co.uk/2014/04/canonical-axe-ubuntu-one-file-music-services-grab-data-now
|
||||
[2]:http://dropbox.com/
|
||||
[3]:http://drive.google.com/
|
||||
[4]:https://www.copy.com/home/
|
||||
[5]:http://owncloud.org/
|
||||
[6]:https://spideroak.com/
|
||||
[7]:https://onedrive.live.com/
|
||||
[8]:https://www.box.com/
|
||||
112
sources/talk/20140607 Got Linux--Add Proprietary Code.md
Normal file
112
sources/talk/20140607 Got Linux--Add Proprietary Code.md
Normal file
@@ -0,0 +1,112 @@
|
||||
Got Linux? Add Proprietary Code
|
||||
================================================================================
|
||||

|
||||
|
||||
> For some industries, running proprietary software on an open source Linux distro is not the exception -- it's the rule of thumb. Take, for example, the Wall Street crowd. "Ninety-nine percent of the applications on Wall Street depend on proprietary products. We are much like Oracle in that our product runs on Linux but has a proprietary license," said FSMLabs' President Victor Yodaiken.
|
||||
|
||||
Migrating to the Linux platform is not an either/or proposition. Linux as a computing platform is so flexible that it offers users a have-it-your-way menu of software options.
|
||||
|
||||
One option is the Linux desktop. Individual users in home computing, SOHO and SMB operations can choose from a variety of enterprise-class Linux distributions. The Linux desktop OS offers a no-cost or low-cost alternative to the frustrations of Microsoft Windows or the limitations of Apple's Unix-based OS X platform for its relatively costly Mac hardware.
|
||||
|
||||
Another migration path is to forgo acclimating office staff to the Linux desktop. Instead, enterprises can opt to run their back-office and server operations on a Linux server. Linux servers have a rigorous giant footprint in the networking and cloud computing worlds. Linux servers are commonplace in many other enterprise settings.
|
||||
|
||||
A third migration choice is to run a full Linux shop. Standard office computing software is readily available in open source packages for office suites, Web browsing and graphic production tasks. Open source database applications connect famously with back-end software and servers. Plus, Linux does not need hardware-specific buy-in requirements.
|
||||
|
||||
Staff training to use the Linux desktop applications often is needed only in small amounts. Thanks to workers' familiarity with cross-platform software such as LibreOffice and OpenOffice productivity suites, as well as Google Chrome and Firefox Web browsers, front-office communications rarely miss a beat.
|
||||
|
||||
Linux is flexible. A new trend is to create third-party proprietary software to suit your own enterprise needs. Commercial software firms can recompile must-have Windows or any other platform's software. They also can create task-specific Linux applications that combine off-the-shelf open source components with their own proprietary code.
|
||||
|
||||
"I believe this is becoming a new trend. Enterprises are using third-party proprietary software developed to work on the Linux OS. One of the factors pushing enterprises into migrating to Linux with custom-made software is the financial burden of continuing to pay Microsoft licensing fees," Dayan Jeremiah, CEO of [Icewarp Pacific][1], told LinuxInsider.
|
||||
|
||||
### Linux Does Proprietary ###
|
||||
|
||||
One of the biggest hurdles a company faces in migrating to any operating system is overseeing application compatibility. In the case of moving into Linux, an enterprise has to make sure that whatever software it uses is compatible with the Linux OS, noted Jeremiah.
|
||||
|
||||
The Linux OS has an arsenal of software that runs across the numerous distributions and Linux desktop environments. Depending on the industry involved, the vast open source community may not have a specific replacement for every specialized computing task. In that case, it is often cost-effective to roll your own with the help of a third-party software developer.
|
||||
|
||||
"Using a third-party software vendor helps to ensure this compatibility. For example, we are able to mix and match the software components together so that the application works on Linux," said Jeremiah.
|
||||
|
||||
### An Old Model Made New ###
|
||||
|
||||
A growing number of proprietary software firms, such as Icewarp, build specialized software to meet an enterprise's specific computing needs. They use many open source components in the mix.
|
||||
|
||||
The savings, compared to staying with the Microsoft infrastructure, involve not only licensing costs, but also reduced coding costs.
|
||||
|
||||
"We can build an entire software solution using readily available components for Linux. This entire solution is generally much more cost-effective, efficient and stable across the board," Jeremiah noted.
|
||||
|
||||
Icewarp does not develop the specialized software as free open source projects. It does not provide free versions and charge a fee for support. You order it and pay for it.
|
||||
|
||||
### Porting Code Can Be Chaotic ###
|
||||
|
||||
One hurdle in making software ported from another computing platform compatible with the Linux OS is the vast majority of Linux flavors, according to Jacob Loveless, CEO of [Lucera][2]. The Linux OS has a common kernel, but it has a lot of flavors.
|
||||
|
||||
"The problem develops when software companies have to cross-compile for multiple Linux systems," Loveless told LinuxInsider. "With the exception of Microsoft Exchange Server, most databases run exceptionally well on Linux. MySQL and PostSQL are probably to two most prominent open source versions."
|
||||
|
||||
The majority of the hurdles in porting software to Linux require recompiling the code. Usually there are platform-specific things you have to do to make it work, he said.
|
||||
|
||||
For example, if you have proprietary code bases written in .Net or other languages for Windows, the open source compiler that runs on Linux is not always compatible. So you have a lot of application work you have to redo, Loveless explained.
|
||||
|
||||
Another example involves using databases. You often have to port to a different database and a different Web server.
|
||||
|
||||
"There is definitely work there," said Loveless.
|
||||
|
||||
### A Lot Is Not Enough ###
|
||||
|
||||
Another compatibility issue in migrating to Linux is the type of open source software a company needs.
|
||||
|
||||
"There are not enough open source solutions for all of the specialized enterprise needs," maintained IceWarp's Jeremiah, "but whatever is available for Linux in general, we feel is sufficient. What is not provided by the communities for specialized business applications can be built by third-party software firms."
|
||||
|
||||
For example, IceWarp recently built a specialized Linux-compatible application that required no additional hardware purchase and no additional licensing fees.
|
||||
|
||||
The specialized software included a clustered set of load balancers, a cluster of database servers and a cluster set of IP servers. All of it runs on a standard Red Hat Enterprise Linux or CentOS Linux distro.
|
||||
|
||||
### Follow the Money ###
|
||||
|
||||
In some cases, you can follow the money trail to the Linux OS. Sometimes it is the Linux server that has heavily populated an industry. Other times it is a particular Linux desktop application -- or it could be both.
|
||||
|
||||
Take, for example, the Wall Street crowd. In financial markets, time synchronization becomes critical. The financial networks rely on distributive networks where users have to work with time locks to complete transactions. Other applications require very precise timing before a transaction can be executed. These are functions that require precise time synchronization controls, explained Victor Yodaiken, president of [FSMLabs][3].
|
||||
|
||||
When FSMLabs started developing its TimeKeeper time synchronization software, Yodaiken expected there soon would be a need to develop a Windows version.
|
||||
|
||||
However, "it turned out that everybody who is doing automated trading or low-latency trading or even collecting data at high precision is running Linux in this market," he told LinuxInsider.
|
||||
|
||||
### Time Is Costly ###
|
||||
|
||||
FSMLabs uses proprietary code that runs on Linux. The Network Time Protocol built into Linux does not adequately synchronize time into nanoseconds for software that tracks stock and trade transactions. Windows falls short for another reason.
|
||||
|
||||
"I think Linux's popularity over Windows is that Windows does not have a standard API which lets you get time below a millisecond. So Windows does not really do you any good. You have to have specialized APIs. With Linux, you do not have to screw around with your application program," Yodaiken said.
|
||||
|
||||
The financial markets were one of the first to embrace Linux. Many of the early systems managers came up from [Bell Labs][4] in the 1980s, so it is a very established market, he added.
|
||||
|
||||
### Filling a Need ###
|
||||
|
||||
For some industries, running proprietary software on an open source Linux distro is not the exception -- it's the rule of thumb.
|
||||
|
||||
"Ninety-nine percent of the applications on Wall Street depend on proprietary products. We are much like Oracle in that our product runs on Linux but has a proprietary license," said FSMLabs' Yodaiken.
|
||||
|
||||
Some markets that run Linux need more specialized software than what's available as open source products. Existing open source software just does not meet their requirements. That is why software developers provide commercial offerings for enterprise Linux operations, he added.
|
||||
|
||||
"That is pretty common. Open source is really best suited for big markets. That is why it has wide, general requirements. Not too many people would have to have a one microsecond correct time all the time -- and alarms if they can't get it," he pointed out.
|
||||
|
||||
### Linux Purism Is Pointless ###
|
||||
|
||||
The concept of maintaining a totally free open source software infrastructure on the Linux OS may fall short when it comes to running specialized software. That reality holds true for any specialized business.
|
||||
|
||||
When a specialized computing need does not impact a wide user market, a third-party software developer can provide a proprietary, commercial or closed source software solution. Call it what you will. Open source purity might become a thing of the past as businesses continue to adopt the Linux OS.
|
||||
|
||||
"Having commercial software prominent on the Linux OS is fairly common," said Yodaiken. "People in business are not purists. They just want to solve problems."
|
||||
|
||||
Jack M. Germain has been writing about computer technology since the early days of the Apple II and the PC. He still has his original IBM PC-Jr and a few other legacy DOS and Windows boxes. He left shareware programs behind for the open source world of the Linux desktop. He runs several versions of Windows and Linux OSes and often cannot decide whether to grab his tablet, netbook or Android smartphone instead of using his desktop or laptop gear. You can connect with him on Google+.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxinsider.com/story/80555.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.icewarp.com/
|
||||
[2]:https://lucerahq.com
|
||||
[3]:http://www.fsmlabs.com/
|
||||
[4]:http://www.bell-labs.com/
|
||||
@@ -0,0 +1,88 @@
|
||||
CNprober 翻译中...
|
||||
How to turn Vim into a full-fledged IDE
|
||||
================================================================================
|
||||
If you code a little, you know how handy an Integrated Development Environment (IE) can be. Java, C, Python, they all become a lot more accessible when the IDE software is checking the syntax for you, compiling in the background, or importing the libraries you need. On the other hand, if you are on Linux, you might also know how handy Vim can be when it comes to text editing. So naturally, you would like to get all the features of an IDE from Vim.
|
||||
|
||||
In fact, there are quite a few ways to do so. One could think of [c.vim][1] which attempts to transform Vim into a C oriented IDE, or [Eclim][2] which merges Vim into Eclipse. However, I would like to propose you a more generalist approach using only plugins. You do not want to bloat your editor with too many panels or features. Instead, the plugin approach lets you choose what you put into your Vim. As a bonus, the result will not be language-specific, allowing you to code in anything. So here is my **top 10 list of plugins which brings IDE features to Vim**.
|
||||
|
||||
### Bonus: Pathogen ###
|
||||
|
||||
First of all, we might not all be familiar with plugins for Vim, and how to install them. This is why the first plugin that I recommend is Pathogen, as it will allow you to install other plugins more easily. That way, if you want to install another plugin for Vim not listed here, you will be able to do so easily. The [official page][3] is really well documented, so go visit it to download and install. From there installing the rest of the plugins will be easy.
|
||||
|
||||
### 1. SuperTab ###
|
||||
|
||||
[][4]
|
||||
|
||||
The first thing we get used to in an IDE is auto-completion feature. For that, I like the plugin [SuperTab][5] which comes in quite handy, giving "super powers" to the tabulation key.
|
||||
|
||||
### 2. Syntastic ###
|
||||
|
||||

|
||||
|
||||
If you tend to code in more than one language, it is really easy to confuse the syntax at some point. Hopefully, [syntastic][6] will check it for you, and tell you if should put brackets or parentheses for that conditional, or remind you that you forgot a semi-colon somewhere.
|
||||
|
||||
### 3. Auto Pairs ###
|
||||
|
||||
Another thing that drives most of the coders insane: did I write this last parenthesis or not?! Everyone hates counting with your finger all the parentheses you put so far. To deal with that, I use [Auto Pairs][7], which automatically inserts and formats parentheses and brackets.
|
||||
|
||||
### 4. NERD Commenter ###
|
||||
|
||||
Then if you are looking for a quick shortcut to comment code, regardless of the programming language, you can turn to [NERD Commenter][8]. Even if you are not a programmer, I really really recommend this plugin as it just so efficient while commenting bash scripts or anything in your system.
|
||||
|
||||
### 5. Snipmate ###
|
||||
|
||||
Any programmer knows that a good coders codes, but an excellent one reuses. For that, [snipmate][9] will easily insert code snippets into your file and greatly reduce your typing. It comes by default with a lot of snippets for various languages, but you can also easily add yours to the list.
|
||||
|
||||
### 6. NERDTree ###
|
||||
|
||||

|
||||
|
||||
To manage a big project, it is always a good idea to split the code into different files. Just basic good coding practices. And to keep all this files in mind, [NERDTree][10] is a nice file browser to use straight from Vim.
|
||||
|
||||
### 7. MiniBufferExplorer ###
|
||||
|
||||

|
||||
|
||||
To complement a file explorer, there is nothing better than a good buffer manager to have more than one file open at any time. [MiniBufferExplorer][11] does the job well and efficiently. It even sets different colors for your buffers as well as easy shortcuts to switch the focus.
|
||||
|
||||
### 8. Tag List ###
|
||||
|
||||

|
||||
|
||||
When you have more than one file open at any given time, it is easy to forget what you put in them. To prevent that, [Tag List][12] is a code visualizer that will display the different variables and functions written in a nice compact format.
|
||||
|
||||
### 9. undotree ###
|
||||
|
||||

|
||||
|
||||
For all of us who like to undo, redo, and undo again some modifications to see how the compilation evolves, [undotree][13] is a nice plugin to see your undo and redo edits in a tree. This kind of functionality is clearly not limited to code, so this is a plugin that I like a lot.
|
||||
|
||||
### 10. gdbmgr ###
|
||||
|
||||
Finally, last but not least, anyone needs a good debugger at some point. If you like gdb, then [gdbmgr][14] is for you as it integrates the famous debugger to Vim.
|
||||
|
||||
To conclude, whether you are an insane coder or not, it is always handy to have a few extra functions of Vim at hand at any time. Like I said in the introduction, you do not have to install all these plugins if you do not need them, or you might want to install different ones. But this is definitely a solid basis.
|
||||
|
||||
What plugins do you use for Vim? Or how would you complement this top 10? Please let us know in the comments.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/06/turn-vim-full-fledged-ide.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.vim.org/scripts/script.php?script_id=213
|
||||
[2]:http://eclim.org/
|
||||
[3]:https://github.com/tpope/vim-pathogen
|
||||
[4]:https://www.flickr.com/photos/xmodulo/14332189422/
|
||||
[5]:https://github.com/ervandew/supertab
|
||||
[6]:https://github.com/scrooloose/syntastic
|
||||
[7]:https://github.com/jiangmiao/auto-pairs
|
||||
[8]:https://github.com/scrooloose/nerdcommenter
|
||||
[9]:https://github.com/garbas/vim-snipmate
|
||||
[10]:https://github.com/scrooloose/nerdtree
|
||||
[11]:http://www.vim.org/scripts/script.php?script_id=159
|
||||
[12]:http://www.vim.org/scripts/script.php?script_id=273
|
||||
[13]:https://github.com/mbbill/undotree
|
||||
[14]:http://vim.sourceforge.net/scripts/script.php?script_id=4104
|
||||
@@ -0,0 +1,58 @@
|
||||
New OpenSSL breach is no Heartbleed, but needs to be taken seriously
|
||||
================================================================================
|
||||
> Summary: While the newest OpenSSL security problems are troubling, and you should address it, it's nothing as bad as Heartbleed.
|
||||
|
||||
It's been a bad week for open-source Secure Socket Layer (SSL) programs.
|
||||
|
||||
First, the obscure, [GnuTLS was revealed to have a trivial][1] but damning flaw. Then, the massively popular OpenSSL was found to have [a man-in-the-middle vulnerability][2]. After the [Heartbleed fiasco][3], OpenSSL needed this like a hole in the head.
|
||||
|
||||

|
||||
|
||||
This vulnerability, according to Adam Langley, a senior staff software engineer at Google, has been [around for at least 15 years][4]. It's a pity the Core Infrastructure Initiative (CII) [riding to OpenSSL's rescue with more developer funding][5] didn't happen any sooner than it did.
|
||||
|
||||
That said, this bug is still is nowhere near as bad as Heartbleed. For starters, an attacker needs to be running a system between the web browser or other SSL-enabled client program to make use of the security hole.
|
||||
|
||||
Be that as it may, you still need to address it by upgrading as soon as possible. As Chris Camejo, Director of Assessment Services for [NTT Com Security][6] said in an e-mail interview, "It's bad because it has been around for a long time and looks to be fairly widespread."
|
||||
|
||||
He added: "If exploited it would allow the attacker to decrypt traffic. This is serious given that the whole point of SSL is to encrypt traffic and it is widely used to protect passwords, credit card numbers, and all other manner of sensitive transactions that happen on web sites as well as certain email connections."
|
||||
|
||||
In a separate interview, Mark Cox, Red Hat's senior director of product security, [went into deeper detail][7]. Cox said, OpenSSL has fixed a number of security flaws, but given the Heartbleed episode we needed to find a way to tell people not to panic.
|
||||
|
||||
Cox explained that Heartbleed had been patched before it was revealed but news of the exploit spread before news of the patches, hence so much of the upset around it. In this latest case, there have been seven security issues patched but only two of them need concern administrators and users.
|
||||
|
||||
The first, Cox continued, is the Datagram Transport Layer Security (DTLS) bug. There is no known exploit of it at this time, but there is the potential for a successful attack against it.
|
||||
|
||||
Therefore, while DTLS is not widely used, if you do use it, it should be patched as soon as possible.
|
||||
|
||||
Cox then said the "real meat of the issue is the man-in-the-middle attack." Even here, for this work, someone really must be "in the middle" between a vulnerable server and client to make use of the hole.
|
||||
|
||||
But if someone can do this, they could "bypass SSL and get to the raw data... This is quite a serious issue."
|
||||
|
||||
Still, with Heartbleed anyone could theoretically exploit vulnerable SSL servers. To attack using this hole would require network access to the traffic between the client and server. For example, a successful attack might be made with a fake coffee house Wi-Fi access point being used to connect the Android version of the Chrome Web browser and an unpatched Web server. Fortunately, Google has [already released an updated version of this browser][8], 35.0.1916.141, to eliminate this problem.
|
||||
|
||||
The most vulnerable systems, according to Cox, are unpatched Android devices using a bogus Wi-Fi hot spot. Morrell added that since Android users are at the mercy of their phone vendors and telcos for security updates they may be stuck with vulnerabilities for quite a long time.
|
||||
|
||||
Fortunately, if the servers they connect with have been updated, they still can't be attacked.
|
||||
|
||||
The OpenSSL security community has known about this problem since early May. The group, working with Red Hat, other major Linux and open-source groups, and hardware vendors, went to a great deal of trouble to not simply patch the bug but to take the next steps of testing the repair, so that they could be as certain (as anyone can ever be in security) that it would fix the hole, but also not introduce any new security problems, and work with most combinations of OpenSSL servers and clients.
|
||||
|
||||
Now that the patch is out there, OpenSSL is trying to get the solid facts, as well as the patch, out to people so there won't be any undue panic over these problems. Cox added that the major Linux vendors, such as Red Hat and Ubuntu, already have the patches available.
|
||||
|
||||
All server administrators need do is to download and install them and instead of a security crisis this will prove to be business as usual.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.zdnet.com/new-openssl-breech-is-no-heartbleed-but-needs-to-be-taken-seriously-7000030273/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.zdnet.com/another-serious-gnutls-bug-exposes-linux-clients-to-server-attacks-7000030205
|
||||
[2]:http://www.zdnet.com/openssl-fixes-another-severe-vulnerability-7000030253/
|
||||
[3]:http://www.zdnet.com/heartbleed-serious-openssl-zero-day-vulnerability-revealed-7000028166
|
||||
[4]:https://www.imperialviolet.org/2014/06/05/earlyccs.html
|
||||
[5]:http://www.zdnet.com/corporations-put-their-cash-where-their-open-source-security-is-7000030023/
|
||||
[6]:http://www.nttcomsecurity.com/us/
|
||||
[7]:http://ec.libsyn.com/p/6/a/5/6a58036510bae37c/CloudEvangelistPodcast_Ep92_MarkCox.mp3?d13a76d516d9dec20c3d276ce028ed5089ab1ce3dae902ea1d06c88537d1ce596fdc&c_id=7251647)
|
||||
[8]:http://googlechromereleases.blogspot.com/2014/06/chrome-for-android-update.html
|
||||
178
sources/talk/20140607 Raspberry Pi In Schools.md
Normal file
178
sources/talk/20140607 Raspberry Pi In Schools.md
Normal file
@@ -0,0 +1,178 @@
|
||||
Raspberry Pi In Schools
|
||||
================================================================================
|
||||
> Teaching the world to code is a noble goal, but how is it going to work in practice?
|
||||
|
||||
Two years ago, when the Raspberry Pi launched, it was with the intention of improving IT education in the UK. Since then more powerful, better connected or cheaper boards have come onto the market, but the Pi retains its position as the white knight of ICT teaching.
|
||||
|
||||
Why? Because of the community of users that has grown up around it. To find out more we travelled west to Manchester, venue for the second annual Jamboree – a festival of educators, makers and messer-abouters focussed on highlighting how engaging the Pi can be. There, we met 75% of the Raspberry Pi Foundation’s education team – Ben Nuttall, Clive Beale and Carrie Anne Philbin – to discuss IT teaching in the UK.
|
||||
|
||||

|
||||
|
||||
**LV**: So, Raspberry Pi education team, we were saying earlier that the obvious place to start is with the UK government’s Year of Code initiative, but that seems far too negative to being with!
|
||||
|
||||
**Carrie Anne**: Yeah, but there’s so much to say about it!
|
||||
|
||||
**Clive**: I think it’s a fantastic initiative, which just represents everything we stand for, blah, blah, blah, blah, blah!
|
||||
|
||||
**LV**: Should we just leave that then?
|
||||
|
||||
**Clive**: I mean the main issue is how the media portray computing, which is a brilliant, creative, rigorous, hard, challenging, fun thing, to just reduced to ‘this code’. ‘We must learn to code.’ ‘You better learn code or you’re a rubbish teacher.’ Which of course is not the case at all, it’s so much more than that. And so the teachers are running around now thinking the sky’s falling because they think that by September 2014, if they can’t code, then they’ve failed and they’ll think their kids have failed, and it’s a really bad message. There hasn’t been a simple message to say this is not the case, get out into the playground with some chalk and make a maze and do some computing, to teach them how to use a computer. No politician has stepped in to say this is not the case and they haven’t asked teachers who would tell them this isn’t the case. And that’s the problem. Where are the teachers? Where are the people that are actually teaching?
|
||||
|
||||
**LV**: As you’ve just left teaching to join the Raspberry Pi Foundation, what are your thought Carrie Anne?
|
||||
|
||||
**Carrie Anne**: It feels like a lot longer than two months, it feels like an eternity!
|
||||
|
||||
**Clive**: Is that bad?
|
||||
|
||||
**Carrie Anne**: No no, not at all! Because teachings so fast paced in that you’re seeing the results of what you’re doing in class straight away, whereas being out of the classroom for the past two months and working the Foundation, I can’t actually see the impact I’m having, but obviously people are talking to me and saying I am having an impact. It’s just very different to what I was seeing before. Clive always said there’s a massive difference between teaching and being a teacher. There are a lot of people we talk to who run Raspberry Jams, workshops, CoderDoJos and that kind of thing, and they always say ‘Oh, it’s really easy, you just do this, this and this.’ And it’s like, great, but you’ve got kids coming to you that *want* to learn this stuff. Imagine a class where you’ve got a bunch of kids who aren’t interested or engaged by this subject and actually teaching is much harder…
|
||||
|
||||
**Clive**: Maybe 15 year olds on a Friday afternoon…
|
||||
|
||||
**Carrie Anne**: Yes, a six-period day, end of the week…
|
||||
|
||||
**Clive**: Ofsted saying, ‘Why haven’t your kids developed after 20 minutes in your lesson? Why haven’t they progressed?’. It’s very different.
|
||||
|
||||
**Carrie Anne**: It’s very different, yep.
|
||||
|
||||
**LV**: So you have some idea of how things should be done because of your recent experience?
|
||||
|
||||
**Carrie Anne**: Yes.
|
||||
|
||||
> The Raspberry Jams have done an excellent job of bringing people together from all walks of life
|
||||
|
||||
**LV**: Are we, in general as a society, doing the right things?
|
||||
|
||||
**Carrie Anne**: I think so. I think what’s been really nice about the Raspberry Pi community is that is gives back to the community. So there are experts, there are people who love what they do, who are reaching out to teachers and reaching out to children by running workshops and clubs and things. And it’s actually that collaboration that produces the best materials and produces the best way to move forward with the new curriculum. I mean, the work I did as a teacher producing the Sonic Pi was a team of work. That was because I worked with, yes an academic, but he was an expert. He wanted to develop a teaching environment that I could use with my students to teach tech-based programing in a fun and engaging way, that engaged both genders and engaged both low ability students and high ability students. It’s a tech-based programming language, which is important at Key Stage 3 where you need to not just be able to teach Scratch, you need to teach a tech-based language that’s nice bridge between Starch and something like Python, which we can teach later on. So, yeah, I think we are moving in the right direction. It would be nicer if the powers that be…
|
||||
|
||||
**Clive**: It would be nice to see that as a microcosm of how these things actually happen. So as an academic has a brilliant idea and they’re very good at what they do, and then they come to a teacher and say ‘How can we make this useful in the classroom?’, ‘How can we get assessment in there?’, which schools needs frankly, ‘How do we make it robust?’, ‘How can we test it?’. And isn’t that a weird idea, to actually ask the people that teach how we should do that? It hasn’t happened really. But, yes, as Carrie says, we’re going in the right direction, certainly. The community and third parties are doing more to push it along.
|
||||
|
||||
**LV**: From someone outside a little bit, it kind of looks like this community has sort of spontaneously developed around the Raspberry Pi. Has this always been there or has it just become more obvious now?
|
||||
|
||||
**Carrie Anne**: I think it’s always been there. I was a teacher so when Raspberry Pi first came out I got one. It got it and then I was like, this is brilliant! Someone’s developed something for education. A Linux box that we can use in the classroom. It’s cheap, it’s brilliant!
|
||||
|
||||
**Clive**: And mess about with.
|
||||
|
||||
**Carrie Anne**: Yeah, it’s going to be great! And then I was like, right, so where are the resources to go with it? Ah, there aren’t any. Then I was like, so where can I go and find some? The first obvious place was Raspberry Jam. There are people running events where they’re doing stuff. So I thought I’ll go along and speak to some people, and see what’s available. And it was through that that I met people to work with, and they’d formed that themselves, the enthusiasts from throughout the community around the Raspberry Pi.
|
||||
|
||||
**Clive**: It’s been a focus, hasn’t it? There’s been a lot of people sort of hanging around, saying ‘Look, I like tinkering, I like messing, I like coding, I like making’, and this thing appeared which was cheap and cheerful and fantastic to play around with, and I think it was a focus. It was waiting to happen really.
|
||||
|
||||

|
||||
Carrie Ann Philbin, The Raspberry Pi Foundation’s Education Pioneer
|
||||
|
||||
**LV**: Was there anything equivalent to Raspberry Jams before the Raspberry Pi came along for people and teachers to come together?
|
||||
|
||||
**Carrie Anne**: Well teachers tend to generally get together through things like TeachMeets and through Twitter, and those kinds of chat tools. There are ways that you can get together, but that’s more talking about teaching practice. Like the different ways you can use a sentence. It’s very teachery, it wasn’t specific to teaching computing.
|
||||
|
||||
**Clive**: I think hardware-wise, Raspberry Pi was in the right place and the right time.
|
||||
|
||||
**Ben**: The Jams done a really good job of bringing people together. The people, like myself, who were attending user groups that are interested in tech and really passionate about it, have got a chance to share that interest with the wider community. There were families coming in, teachers coming in, and they were just sharing what they were doing. And the skills they already had, and I was already programming in Python and things like that just on the desktop, and the Pi came along and it opened up this way of plugging into the real world and all the other things the Pi brings with it. Just being about to use those skills and pass them on, I got myself involved in Education through that.
|
||||
|
||||
**LV**: So you weren’t a teacher before then?
|
||||
|
||||
**Ben**: No, I was a software developer.
|
||||
|
||||
**Carrie Anne**: This is what’s great about the education team at Raspberry Pi. It’s 50% ex-teachers and 50% software developers. We need people like Ben and Dave (Honess).
|
||||
|
||||
**Ben**: Yes, some people have ideas for things and think this could be an engaging exercise, but they may not know exactly how to deliver it, or how it’s going to work. They might not know how exactly a teacher is supposed to produce something to use that, but they have an end goal and working with someone else can help achieve that.
|
||||
|
||||
**Clive**: Yeah, you’re right, the real key is the mix. So you’re getting teachers and engineers and developers and families. Before, they might have been on a Linux user group, they might have been a teacher group, and you’re just bringing a bunch of different people together and that just (to use a horrible word!) synergizes stuff.
|
||||
(Everyone LOL)
|
||||
|
||||
**Clive**: Yes, I did it! I said synergizes! I’m buying a copy of the magazine now.
|
||||
|
||||
**Carrie Anne**: There’s something that comes about from getting all those different types of people together is that it breeds this wonderful learning environment that you cannot reproduce. Like, you were running a Picamera workshop this morning. So that was run by people who run Jams who are from industry. And what was really nice is that there were teachers and there were people who had come for the Jamboree from industry that were helping the teachers do stuff. And there was this environment that was like, it’s ok to not know something, it’s ok to ask a question, it’s ok to get it wrong and make mistakes. And that’s really powerful because sometimes teachers are afraid perhaps of saying they don’t know.
|
||||
|
||||
**Ben**: So at this workshop, we gave people an intro to building a real application around the camera. So it’s not just ‘Oh, there’s a camera and you can take pictures’. It was ‘Ok, let’s plug in a button, and attach that to the Pi and let’s make that be the button for the camera’. And just a simple intro like that opens up a world of possibilities. Sometimes a lot of these things like the Jam, just gives you a lot of inspiration. Or if you see something in a magazine or online, or on Twitter, and you think somebody’s done that with the Pi, I’d really like to do that project in my garden or I’d like to do that myself and twist it and use some of the libraries they’ve used or used some of the codebase they’ve used and take it in their own direction.
|
||||
|
||||
**Clive**: Like it’s not a button, it’s a sensor for when your parents walk into your bedroom, it then tweets it as they walk in.
|
||||
|
||||
**Ben**: And everyone’s got a different way of thinking. If you’re in classroom of 30 kids and you show them how to make a button do this, each of them is thinking ‘Oh I can make a such and such’. They’ll all have a different idea. And some of them will just go straight home and make one. And some of them would need a lot more guidance.
|
||||
|
||||
> Every teacher needs more time off their timetable to develop their skills
|
||||
|
||||
**LV**: Are there some kids that just don’t get it at all?
|
||||
|
||||
**Ben**: I think there’s something for everyone, but they might not find it straight away. If you delivered a term’s worth of content for a class, with a good scope of different projects, I’d be surprised if there was one kid that wasn’t interested in any of it or didn’t find any of it engaging.
|
||||
|
||||
**Clive**: It’s almost an antidote for kids not getting it. With teaching music, you’ll have people that are level 5 or 6 while others can’t read music. Because computing is creative and engaging, we don’t all have to become master coders. With Scratch, it’s a visual language and you’ll find that quite often you’ll get what are classed as low ability kids that just rip into that and do fantastic things because it’s the first time they’ve been allowed to get ideas out of their heads and make something with it. And before, if they’ve had problems with writing and numeracy, they haven’t been able to do that. There are case studies with young boys that aren’t very good at reading and writing but they start telling stories when you give them an environment where they can actually do these things. So it’s brilliant tool to actually fight the opposite. It’s not that they don’t get it. There’s something for everybody.
|
||||
|
||||

|
||||
Linux Voice’s Andrew Gregory asks Clive Beale a tough question
|
||||
|
||||
**LV**: Pre-Raspberry Pi, in the dark ages of about 5 years ago, before the ICT revolution, what would those children be doing? Would they have responded to ICT at all?
|
||||
|
||||
**Carrie Anne**: In a classroom, you have a network of computers that are all on lockdown. You’ve got your network administrator and team of technicians, and they do a wonderful job and I certainly wouldn’t slate them – I was a technician once. But we were living in a time where you had to lock down the internet, which I disagree with, I think it should be open. And all the computers, you can’t execute any files on them, so you can’t actually teach any programming on them. So that was a problem for me.
|
||||
|
||||
**LV**: Is that changing?
|
||||
|
||||
**Carrie Anne**: I think it is changing, and will change with the new curriculum. For me as a teacher, what was great when the Raspberry Pi came along is that I don’t actually need those computers around the outside any more.
|
||||
|
||||
**LV**: So you don’t need permission.
|
||||
|
||||
**Carrie Anne**: Here’s my box full of Pis, let’s just get them out.
|
||||
|
||||
**Clive**: I’ll install what you want, do what I want.
|
||||
|
||||
**Carrie Anne**: Yeah, you can break it. And that’s ok, you just flash it and start again.
|
||||
|
||||
**Clive**: In 1997, they put the C back in ICT and suddenly it became this thing that you had to teach. The curriculum wasn’t really that bad. A lot of people moan about it, but if you actually sat down and read it, it was quite flexible and did let you do take control and make programming and coding interesting. But because resources are so important to schools, you just ended up doing the easy things.
|
||||
|
||||
**LV**: But when you said about kids using Scratch and becoming motivated to do other things, that would never have happened before the Raspberry Pi came along.
|
||||
|
||||
**Clive**: Yes, it was more just following what the teacher said, ‘And now we’re going to write a letter to the cinema’ or something. That’s like giving someone a Ferrari and saying you’ve just got to drive in this room for half an hour. So you’ve given them this fantastic tool for exploration and creativity, and you’re saying we’ve got to do this. Whereas with the computing thing, especially things like Scratch, just lets them think, ‘Ok, I can do a movie, I can do a little flip frame animation, or you know what, I can actually make a game’. And then suddenly they’re doing stuff that they haven’t had the opportunity to do.
|
||||
|
||||
**Carrie Anne**: Yeah, and I think that ICT curriculum was about 12 years out of date. It was created and it wasn’t updated.
|
||||
|
||||
> you can break it. And that’s ok, you just flash it and start again
|
||||
|
||||
**LV**: Obviously quite a lot has changed in computing education according to the media over the last couple of years in the UK. Broadly speaking, it is getting better?
|
||||
|
||||
**Carrie Anne**: Yes.
|
||||
|
||||
**LV**: What are the parts that pushed it to be better.
|
||||
|
||||
**Carrie Anne**: I think the teachers. They’re the ones in the classroom that have to teach the curriculum. When I became a teacher, I was already working in a school and I kept putting it off becoming a teacher because the curriculum bored me. But then I realised that, when I actually got into the classroom, I was able to put my own spin on it. I think it started with the teachers. Those people saying we want a new curriculum, we want to teach this and it’s engaging the kids and they’re learning something. I think it started there and then I think industry picked up on the fact that that was happening and they wanted more industry experts. And then the government got involved and it snowballed really.
|
||||
|
||||
**Clive**: Scratch was a big word-of-mouth thing wasn’t it. It was about mid-2000 when it came out, and suddenly you just found that any teacher worth their salt was using it for their ICT curriculum because it taught about control.
|
||||
|
||||
**Carrie Anne**: HTML as well. HTML has been on the curriculum for years. We’ve been teaching HTML in Notepad for years.
|
||||
|
||||
**LV**: What are going to be the big things pushing it forward over the next few years?
|
||||
|
||||
**Carrie Anne**: I think more of the same really. It’ll be teachers, it’s always the teachers. They’re the ones that come to the Jamboree and this kind of thing, and learn from people like Ben and that sort of collaboration. That’s where it starts. The teachers see what can be done, and they start doing it, and they’ll be more of that. And there are initiatives like code clubs and the Master Teachers are great.
|
||||
|
||||
**Clive**: Teachers are meeting up more when before may not have been getting together.
|
||||
|
||||
**Ben**: And as well as there being a more content, I think they’ll be convergence of a lot of this stuff. So, because the Raspberry Pi doesn’t have any official resources right now, some people are going off and writing their own. I think they’ll be a convergence of people pulling their ideas together and there’ll be a more centralised system for that. And we’ll be helping the community out with that.
|
||||
|
||||
**Clive**: ‘We’ll be at the forefront of that’, is that quote!
|
||||
|
||||
**LV**: You haven’t mentioned government policy, or anything like that at all. Is that a negative thing or just by-the-by?
|
||||
|
||||
**Clive**: I was at the Westminster forum yesterday and they had a chap from the DFE there, and I couldn’t resist it, so I got the mic and said you haven’t really taken it seriously have you? He turned round and said, we have *really* take it seriously. This idea that we can just bring in a new program of study and saying ‘Oh, aren’t we wonderful’, because Eric Schmidt’s speech and going over that, and suddenly we’re made it all better for you. But you haven’t, you just seemed to have done something that a lot of teachers are now scared of. So there’s a lot of work to do, and we’re really positive. But no, the government have not, in my personal opinion, given the money or the support or the thought behind this. If you go to Jersey, it’s such a great contrast. 6 million pounds, 100 thousand people on the island – the size of Cambridge. Compared to the 53 million in England and parts of the UK. This is in England initially, it’s not in Scotland and Wales. They’re got the infrasture, fibre to the door in every school, linking into businesses, £2 million CPD for teachers, well that’s practically what the government pay for the whole of England. So, have you taken it seriously, no. I think they’ve completing underestimated what’s involved. They thought the teachers would just pick it up and have the time and resources, which we don’t have the time for.
|
||||
|
||||
**Carrie Anne**: Maggie Philbin has been leading a UK digital skills taskforce, of which I’m part the team. We’re looking at where the skill shortages are and what are digital skills. Because there’s going to a whole group of kids who are now 14 to 16 who are going to leave the education system who haven’t had new programs like these. They were on the old program, so we’re looking at who will be deskilled and what we can do about that. So hopefully that report will inform government policy.
|
||||
|
||||
**Ben**: There must be a generation of people that don’t have their own website.
|
||||
|
||||
**LV**: If there’s one thing you could change about government policy, what would it be?
|
||||
|
||||
**Clive**: It really is to do with support for teachers. This idea that teachers would be able to, especially primary school teachers where you have to teach a range of subjects, suddenly go off, and even the guy yesterday said, well there’s loads of third party resources, but you’ve still got to go out and get them and try them out and learn and bring them all together.
|
||||
|
||||
**Carrie Anne**: Time. One of the biggest recommendations that I would say is time. Every teacher needs more time off their timetable to develop their skills, especially in an area like this that they perhaps think they’re weak. Because it takes a while to set things up and start your learning. As a teacher, you get like a 30 period timetable, you’re teaching for about 22 lessons of that with about 7 free periods, but some of those you’ll be covering for another lesson and some of those I need to plan my lesson and mark. They need time.
|
||||
|
||||
**Clive**: If you look at science, so if you’re a chemistry or biology teacher at secondary, there’s a scheme where you can re-skill to physics and they will give you free periods, huge bursary, and they’ll also take you off timetable one day a week to go off and go to other schools and retrain, and maybe pay for the cover. And this is the government doing this, and if you do this, this and this, you come out as an accredited physics teacher. So they took that seriously, but yet here’s a brand new subject and they’re expecting people just to pick up and run with it, and it’s completely inadequate.
|
||||
|
||||
**Carrie Anne**: But it’s not just time to learn something, it’s also time to go and meet industry people. Like go to a company and be in there and work and learn from them, and see what the world is like. Because some people, they went through education, went to university and became a teacher, so they’ve never left this school environment and they’ve got no idea of what the world of work is like.
|
||||
|
||||
**Ben**: I think there are some people in the current government that seem to think there should just be this package, and this is what you should deliver as your syllabus this year. Everyone is treated the same. Each teacher has their own class, and they’re all different, with different ways of engaging their interest. It needs to be tailored, so the teacher needs to take that material, and perhaps look on our site in the next year and say, well this one looks quite suitable for my class, or this one might be a good one to do.
|
||||
|
||||
**Clive**: It’s so long term. The government also do not understand that this is long term. So if you’re going to start teaching at 5 about algorithms and a bit of code and Scratch, what happens further down the line. The secondary school teacher will be saying, I can’t teach them Scratch anymore, which is what we do in Year 7 at the moment. So it’s actually quite a long term thing and things will continue to change over the next several years until that pipeline becomes full. And they’ve unbelievably said here’s £2 million, do some training for September 2014. What’s 2014 got to do with it? This is five, six, seven years down the line.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxvoice.com/education-education-education/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
@@ -1,4 +1,3 @@
|
||||
Linux-pdz重又复出,先占一坑哦!
|
||||
Making Linux Feel at Home
|
||||
================================================================================
|
||||
**Hiring Tux is a smart move for both small and large businesses. Linux once was considered a hobbyist's operating system, but it has come a long way and now is considered enterprise class. It is considered very stable and secure. Linux can easily be customized, and there is a huge community eager to help out. Those are just some of the reasons to migrate to the Linux desktop.**
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
GOLinux Translating ... !
|
||||
|
||||
乌龙茶 占坑
|
||||
10 Database Tools For Linux Users To Use!
|
||||
================================================================================
|
||||
From content management systems to simple tables, databases are a part of every development project nowadays. That is why developers lay so much emphasis on using the right kind of database tools. Here are some that may be of help to you!
|
||||
|
||||
@@ -1,376 +0,0 @@
|
||||
GOLinux在此蹲着,不怕臭的来抢。。。
|
||||
Write your first Linux Kernel module
|
||||
================================================================================
|
||||
> Ever wanted to start hacking the kernel? Don’t have a clue how to begin? Let us show you how it’s done…
|
||||
|
||||
Kernel programming is often seen as a black magic. In Arthur C Clarke’s sense, it probably is. The Linux kernel is quite different from its user space: many abstractions are waived, and you have to take extra care, as a bug in you code affects the whole system. There is no easy way to do floating-point maths, the stack is fixed and small, and the code you write is always asynchronous so you need to think about the concurrency. Despite all of this though, the Linux kernel is just a very large and complex C program that is open for everyone to read, learn and improve, and you too can be a part of it.
|
||||
|
||||
> “The easiest way to start kernel programming
|
||||
> is to write a module – a piece of code that
|
||||
> can be dynamically loaded into the kernel.“
|
||||
|
||||
Probably the easiest way to start kernel programming is to write a module – a piece of code that can be dynamically loaded into the kernel and removed from it. There are limits to what modules can do – for example, they can’t add or remove fields to common data structures like process descriptors. But in all other ways they are full-fledged kernel-level code, and they can always be compiled into the kernel (thus removing all the restrictions) if needed. It is fully possible to develop and compile a module outside the Linux source tree (this is unsurprisingly called an out-of-tree build), which is very convenient if you just want to play a bit and do not wish to submit your changes for inclusion into the mainline kernel.
|
||||
|
||||
In this tutorial, we’ll develop a simple kernel module that creates a **/dev/reverse** device. A string written to this device is read back with the word order reversed (“Hello World” becomes “World Hello”). It is a popular programmer interview puzzle, and you are likely to get some bonus points when you show the ability to implement it at the kernel level as well. A word of warning before we start: a bug in your module may lead to a system crash and (unlikely, but possible) data loss. Be sure you’ve backed up all your important data before you start, or, even better, experiment in a virtual machine.
|
||||
|
||||
### Avoid root if possible ###
|
||||
|
||||
> By default, **/dev/reverse** is available to root only, so you’ll have to run your test programs with **sudo**. To fix this, create a **/lib/udev/rules.d/99-reverse.rules** file that contains:
|
||||
>
|
||||
> SUBSYSTEM=="misc", KERNEL=="reverse", MODE="0666"
|
||||
>
|
||||
> Don’t forget to reinsert the module. Making device nodes accessible to non-root users is generally not a good idea, but it is quite useful during development. This is not to mention that running test binaries as root is not a good idea either.
|
||||
|
||||
#### A module’s anatomy ####
|
||||
|
||||
As most of the Linux kernel modules are written in C (apart from low-level architecture-specific parts), it is recommended that you keep your module in a single file (say, reverse.c). We’ve put the full source code on GitHub – and here we’ll look at some snippets of it. To begin, let’s include some common headers and describe the module using predefined macros:
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Valentine Sinitsyn <valentine.sinitsyn@gmail.com>");
|
||||
MODULE_DESCRIPTION("In-kernel phrase reverser");
|
||||
|
||||
Everything is straightforward here, except for **MODULE_LICENSE()**: it is not a mere marker. The kernel strongly favours GPL-compatible code, so if you set the licence to something non GPL-compatible (say, “Proprietary”), certain kernel functions will not be available to your module.
|
||||
|
||||
### When not to write a kernel module ###
|
||||
|
||||
> Kernel programming is fun, but writing (and especially debugging) kernel code in a real-world project requires certain skills. In general, you should descend to the kernel level only if there is no other way to solve your problem. Chances are you can stay in the userspace if:
|
||||
>
|
||||
> - You develop a USB driver – have a look at [libusb][1].
|
||||
> - You develop a filesystem – try [FUSE][2].
|
||||
> - You are extending Netfilter – [libnetfilter_queue][3] may help you then.
|
||||
>
|
||||
> Generally, native kernel code will perform better, but for many projects this performance loss isn’t crucial.
|
||||
|
||||
Since kernel programming is always asynchronous, there is no **main()** function that Linux executes sequentially to run your module. Instead, you provide callbacks for various events, like this:
|
||||
|
||||
static int __init reverse_init(void)
|
||||
{
|
||||
printk(KERN_INFO "reverse device has been registered\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit reverse_exit(void)
|
||||
{
|
||||
printk(KERN_INFO "reverse device has been unregistered\n");
|
||||
}
|
||||
|
||||
module_init(reverse_init);
|
||||
module_exit(reverse_exit);
|
||||
|
||||
Here, we define functions to be called on the module’s insertion and removal. Only the first one is required. For now, they simply print a message to the kernel ring buffer (accessible from the userspace via the **dmesg** command); **KERN_INFO** is a log level (note there is no comma). **__init** and **__exit** are attributes – the pieces of metadata attached to functions (or variables). Attributes are rarely seen in userspace C code but are pretty common in the kernel. Everything marked with **__init** is recycled after the initialisation (remember the old “Freeing unused kernel memory…” message?). **__exit** denotes functions that are safe to optimise out when the code is built statically into the kernel. Finally, the **module_init()** and **module_exit()** macros set **reverse_init()** and **reverse_exit()** functions as lifecycle callbacks for our module. The actual function names aren’t important; you can call them **init()** and **exit()** or **start()** and **stop()**, if you wish. They are declared static and hence invisible outside your module. In fact, any function in the kernel is invisible unless explicitly exported. However, prefixing your functions with a module name is a common convention among kernel programmers.
|
||||
|
||||
These are bare bones – let’s make things more interesting. Modules can accept parameters, like this:
|
||||
|
||||
# modprobe foo bar=1
|
||||
|
||||
The **modinfo** command displays all parameters accepted by the module, and these are also available under **/sys/module//parameters** as files. Our module will need a buffer to store phrases – let’s make its size user-configurable. Add the following three lines just below **MODULE_DESCRIPTION()**:
|
||||
|
||||
static unsigned long buffer_size = 8192;
|
||||
module_param(buffer_size, ulong, (S_IRUSR | S_IRGRP | S_IROTH));
|
||||
MODULE_PARM_DESC(buffer_size, "Internal buffer size");
|
||||
|
||||
Here, we define a variable to store the value, wrap it into a parameter, and make it readable by everyone via sysfs. The parameter’s description (the last line) appears in the modinfo’s output.
|
||||
|
||||
As the user can set **buffer_size** directly, we need to sanitise it in **reverse_init()**. You should always check the data that comes outside the kernel – if you don’t, you are opening yourself to kernel panics or even security holes.
|
||||
|
||||
static int __init reverse_init()
|
||||
{
|
||||
if (!buffer_size)
|
||||
return -1;
|
||||
printk(KERN_INFO
|
||||
"reverse device has been registered, buffer size is %lu bytes\n",
|
||||
buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Non-zero return value from a module init function indicates a failure.
|
||||
|
||||
### Navigation ###
|
||||
|
||||
> The Linux kernel is the ultimate source for everything you may need when developing modules. However, it’s quite big, and you may have trouble trying to find what you are after. Luckily, there are tools that make it easier to navigate large codebases. First of all, there is Cscope – a venerable tool that runs in a terminal. Simply run **make cscope && cscope** in the kernel sources top-level directory. Cscope integrates well with Vim and Emacs, so you can use it without leaving the comfort of your favorite editor.
|
||||
>
|
||||
> If terminal-based tools aren’t your cup of tea, visit [http://lxr.free-electrons.com][4]. It is a web-based kernel navigation tool with not quite as many features as Cscope (for example, you can’t easily find usages for the function), but it still provides enough for the quick lookups.
|
||||
|
||||
Now it’s time to compile the module. You will need the headers for the kernel version you are running (**linux-headers** or equivalent package) and **build-essential** (or analogous). Next, it’s time to create a boilerplate Makefile:
|
||||
|
||||
obj-m += reverse.o
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||
|
||||
Now, call **make** to build your first module. If you typed everything correctly, you will find **reverse.ko** in the current directory. Insert it with **sudo insmod reverse.ko**, and run:
|
||||
|
||||
$ dmesg | tail -1
|
||||
[ 5905.042081] reverse device has been registered, buffer size is 8192 bytes
|
||||
|
||||
Congratulations! However, for now this line is telling lies – there is no device node yet. Let’s fix it.
|
||||
|
||||
#### Miscellaneous devices ####
|
||||
|
||||
In Linux, there is a special character device type called “miscellaneous” (or simply “misc”). It is designed for small device drivers with a single entry point, and is exactly what we need. All misc devices share the same major number (10), so the one driver (**drivers/char/misc.c**) can look after all of them, and they are distinguished by their minor numbers. In all other senses, they are just normal character devices.
|
||||
|
||||
To register a minor number (and an entry point) for the device, you declare **struct misc_device**, fill its fields (note the syntax), and call **misc_register()** with a pointer to this structure. For this to work, you will also need to include the **linux/miscdevice.h** header file:
|
||||
|
||||
static struct miscdevice reverse_misc_device = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "reverse",
|
||||
.fops = &reverse_fops
|
||||
};
|
||||
static int __init reverse_init()
|
||||
{
|
||||
...
|
||||
misc_register(&reverse_misc_device);
|
||||
printk(KERN_INFO ...
|
||||
}
|
||||
|
||||
Here, we request a first available (dynamic) minor number for the device named “reverse”; th ellipsis indicates omitted code that we’ve already seen. Don’t forget to unregister the device on the module’s teardown:
|
||||
|
||||
static void __exit reverse_exit(void)
|
||||
{
|
||||
misc_deregister(&reverse_misc_device);
|
||||
...
|
||||
}
|
||||
|
||||
The ‘fops’ field stores a pointer to a struct **file_operations** (declared in linux/fs.h), and this is the entry point for our module. **reverse_fops** is defined as:
|
||||
|
||||
static struct file_operations reverse_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = reverse_open,
|
||||
...
|
||||
.llseek = noop_llseek
|
||||
};
|
||||
|
||||
Again, **reverse_fops** contains a set of callbacks (also known as methods) to be executed when userspace code opens a device, reads from it, writes to it or closes the file descriptor. If you omit any of these, a sensible fallback will be used instead. That’s why we explicitly set the **llseek** method to **noop_llseek()**, which (as the name implies) does nothing. The default implementation changes a file pointer, and we don’t want our device to be seekable now (this will be your home assignment for today).
|
||||
|
||||
#### I open at the close ####
|
||||
|
||||
Let’s implement the methods. We’ll allocate a new buffer for each file descriptor opened, and free it on close. This is not really safe: if a userspace application leaks descriptors (perhaps intentionally), it may hog the RAM, and render the system unusable. You should always think about these possibilities in the real world, but for the tutorial, it’s acceptable.
|
||||
|
||||
We’ll need a structure to describe the buffer. The kernel provides many generic data structures: linked lists (which are double-linked), hash tables, trees and so on. However, buffers are usually implemented from scratch. We will call ours “struct buffer”:
|
||||
|
||||
struct buffer {
|
||||
char *data, *end, *read_ptr;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
**data** is a pointer to the string this buffer stores, and end is the first byte after the string end. **read_ptr** is where **read()** should start reading the data from. The buffer size is stored for the completeness – for now, we don’t use this field. You shouldn’t assume the users of your structure will correctly initialise all of these, so it is better to encapsulate buffer allocation and deallocation in functions. They are usually named **buffer_alloc()** and **buffer_free()**.
|
||||
|
||||
static struct buffer *buffer_alloc(unsigned long size)
|
||||
{
|
||||
struct buffer *buf;
|
||||
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
|
||||
if (unlikely(!buf))
|
||||
goto out;
|
||||
...
|
||||
out:
|
||||
return buf;
|
||||
}
|
||||
|
||||
Kernel memory is allocated with **kmalloc()** and freed with **kfree()**; the **kzalloc()** flavour sets the memory to all-zeroes. Unlike standard **malloc()**, its kernel counterpart receives flags specifying the type of memory requested in the second argument. Here, **GFP_KERNEL** means we need a normal kernel memory (not in DMA or high-memory zones) and the function can sleep (reschedule the process) if needed. **sizeof(*buf)** is a common way to get the size of a structure accessible via pointer.
|
||||
|
||||
You should always check **kmalloc()**’s return value: dereferencing NULL pointer will result in kernel panic. Also note the use of **unlikely()** macro. It (and the opposite **likely()** macro) is widely used in the kernel to signify that the condition is almost always true (or false). It doesn’t affect control flow, but helps modern processors to boost performance with branch prediction.
|
||||
|
||||
Finally, note the **gotos**. They are often considered evil, however, the Linux kernel (and some other system software) employs them to implement centralised function exiting. This results in less deeply nested and more readable code, and is much like the **try-ctach** blocks used in higher-level languages.
|
||||
|
||||
With **buffer_alloc()** and **buffer_free()** in place, the implementation of the **open** and **close** methods becomes pretty straightforward.
|
||||
|
||||
static int reverse_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int err = 0;
|
||||
file->private_data = buffer_alloc(buffer_size);
|
||||
...
|
||||
return err;
|
||||
}
|
||||
|
||||
**struct file** is a standard kernel data structure that stores information about an opened file, like current file position (**file->f_pos**), flags (**file->f_flags**), or open mode (**file->f_mode**). Another field, **file->private_data** is used to associate the file with some arbitrary data. Its type is void *, and it is opaque to the kernel outside the file’s owner. We store a buffer there.
|
||||
|
||||
If the buffer allocation fails, we indicate this to the calling user space code by returning negative value (**-ENOMEM**). A C library doing **open(2)** system call (probably, **glibc**) will detect this and set **errno** appropriately.
|
||||
|
||||
#### Learn to read and write ####
|
||||
|
||||
“Read” and “write” methods are where the real job is done. When data is written to a buffer, we drop its previous contents and reverse the phrase in-place, without any temporary storage. The **read** method simply copies the data from the kernel buffer into the userspace. But what should the **reverse_read()** method do if there is no data in the buffer yet? In userspace, the **read()** call would block until the data is available. In the kernel, you must wait. Luckily, there is a mechanism for this, and it is called ‘wait queues’.
|
||||
|
||||
The idea is simple. If a current process needs to wait for some event, its descriptor (a **struct task_struct** stored as ‘current’) is put into non-runnable (sleeping) state and added to a queue. Then **schedule()** is called to select another process to run. A code that generates the event uses the queue to wake up the waiters by putting them back to the **TASK_RUNNING** state. The scheduler will select one of them somewhere in the future. Linux has several non-runnable process states, most notably **TASK_INTERRUPTIBLE** (a sleep that can be interrupted with a signal) and **TASK_KILLABLE** (a sleeping process that can be killed). All of this should be handled correctly, and wait queues do this for you.
|
||||
|
||||
A natural place to store our read wait queue head is struct buffer, so start with adding **wait_queue_head_t read_queue** field to it. You should also include **linux/sched.h**. A wait queue can be declared statically with DECLARE_WAITQUEUE() macro. In our case, dynamic initialisation is needed, so add this line to **buffer_alloc()**:
|
||||
|
||||
init_waitqueue_head(&buf->read_queue);
|
||||
|
||||
We wait for the data to be available; or for **read_ptr != end** condition to become true. We also want the wait to be interruptible (say, by Ctrl+C). So the “read” method should start like this:
|
||||
|
||||
static ssize_t reverse_read(struct file *file, char __user * out,
|
||||
size_t size, loff_t * off)
|
||||
{
|
||||
struct buffer *buf = file->private_data;
|
||||
ssize_t result;
|
||||
while (buf->read_ptr == buf->end) {
|
||||
if (file->f_flags & O_NONBLOCK) {
|
||||
result = -EAGAIN;
|
||||
goto out;
|
||||
}
|
||||
if (wait_event_interruptible
|
||||
(buf->read_queue, buf->read_ptr != buf->end)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
...
|
||||
|
||||
We loop until the data is available and use **wait_event_interruptible()** (it’s a macro, not a function, that’s why the queue is passed by value) to wait if it isn’t. If **wait_event_interruptible()** is, well, interrupted, it returns a non-zero value, which we translate to **-ERESTARTSYS**. This code means the system call should be restarted. **file->f_flags** check accounts for files opened in non-blocking mode: if there is no data, we return **-EAGAIN**.
|
||||
|
||||
We can’t use **if()** instead of **while()**, since there can be many processes waiting for the data. When the **write** method awakes them, the scheduler chooses the one to run in an unpredictable way, so by the time this code is given a chance to execute, the buffer can be empty again. Now we need to copy the data from **buf->data** to the userspace. The **copy_to_user()** kernel function does just that:
|
||||
|
||||
size = min(size, (size_t) (buf->end - buf->read_ptr));
|
||||
if (copy_to_user(out, buf->read_ptr, size)) {
|
||||
result = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
The call can fail if the user space pointer is wrong; if this happen, we return **-EFAULT**. Remember not to trust anything coming outside the kernel!
|
||||
|
||||
buf->read_ptr += size;
|
||||
result = size;
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
|
||||
Simple arithmetic is needed so the data can be read in arbitrary chunks. The method returns the number of bytes read or an error code.
|
||||
|
||||
The write method is simpler and shorter. First, we check that the buffer have enough space, then we use the **copy_from_userspace()** function to get the data. Then **read_ptr** and end pointers are reset and the buffer contents are reversed:
|
||||
|
||||
buf->end = buf->data + size;
|
||||
buf->read_ptr = buf->data;
|
||||
if (buf->end > buf->data)
|
||||
reverse_phrase(buf->data, buf->end - 1);
|
||||
|
||||
Here, **reverse_phrase()** does all heavy lifting. It relies on the **reverse_word()** function, which is quite short and marked inline. This is another common optimisation; however, you shouldn’t overuse it, since aggressive inlining makes the kernel image unnecessarily large.
|
||||
|
||||
Finally, we need to wake up processes waiting for the data at **read_queue**, as described earlier. **wake_up_interruptible()** does just that:
|
||||
|
||||
wake_up_interruptible(&buf->read_queue);
|
||||
|
||||
Phew! You now have a kernel module that at least compiles successfully. Now it’s time to test it.
|
||||
|
||||
### Debugging kernel code ###
|
||||
|
||||
> Perhaps the most common debugging method in the kernel is printing. You can use plain **printk()** (presumably with **KERN_DEBUG** log level) if you wish. However, there are better ways. Use **pr_debug()** or **dev_dbg()**, if you are writing a device driver that has its own “struct device”: they support the dynamic debug (**dyndbg**) feature and can be enabled or disabled on request (see **Documentation/dynamic-debug-howto.txt**). For pure development messages, use **pr_devel()**, which becomes a no-op unless DEBUG is defined. To enable DEBUG for our module, include:
|
||||
>
|
||||
> CFLAGS_reverse.o := -DDEBUG
|
||||
>
|
||||
> in the Makefile. After that, use **dmesg** to view debug messages generated by **pr_debug()** or **pr_devel()**.
|
||||
>
|
||||
> Alternatively, you can send debug messages directly to the console. To do this, either set the **console_loglevel** kernel variable to 8 or greater (**echo 8 /proc/sys/kernel/printk**) or temporarily print the debug message in question at the high log level like **KERN_ERR**. Naturally, you should remove debug statements of this kind before publishing your code.
|
||||
>
|
||||
> Note that kernel messages appear on the console, not in a terminal emulator window such as Xterm; that’s why you’ll find recommendations not to do kernel development in the X environment.
|
||||
|
||||
### Surprise, surprise! ###
|
||||
|
||||
Compile the module and load it into the kernel:
|
||||
|
||||
$ make
|
||||
$ sudo insmod reverse.ko buffer_size=2048
|
||||
$ lsmod
|
||||
reverse 2419 0
|
||||
$ ls -l /dev/reverse
|
||||
crw-rw-rw- 1 root root 10, 58 Feb 22 15:53 /dev/reverse
|
||||
|
||||
Everything seems to be in place. Now, to test how the module works, we’ll write a small program that reverses its first command line argument. The **main()** function (sans error checking) may look like this:
|
||||
|
||||
int fd = open("/dev/reverse", O_RDWR);
|
||||
write(fd, argv[1], strlen(argv[1]));
|
||||
read(fd, argv[1], strlen(argv[1]));
|
||||
printf("Read: %s\n", argv[1]);
|
||||
|
||||
Run it as:
|
||||
|
||||
$ ./test 'A quick brown fox jumped over the lazy dog'
|
||||
Read: dog lazy the over jumped fox brown quick A
|
||||
|
||||
It works! Play with it a little: try passing single-word or single-letter phrases, empty or non-English strings (if you have a keyboard layout set) and anything else.
|
||||
|
||||
Now let’s make things a little trickier. We’ll create two processes that share the file descriptor (and hence the kernel buffer). One will continuously write strings to the device, and another will read them. The **fork(2)** system call is used in the example below, but pthreads will work as well. I also omitted the code that opens and closes the device and does the error checking (again):
|
||||
|
||||
char *phrase = "A quick brown fox jumped over the lazy dog";
|
||||
if (fork())
|
||||
/* Parent is the writer */
|
||||
while (1)
|
||||
write(fd, phrase, len);
|
||||
else
|
||||
/* child is the reader */
|
||||
while (1) {
|
||||
read(fd, buf, len);
|
||||
printf("Read: %s\n", buf);
|
||||
}
|
||||
|
||||
What do you expect this program to output? Below is what I’ve got on my laptop:
|
||||
|
||||
Read: dog lazy the over jumped fox brown quick A
|
||||
Read: A kcicq brown fox jumped over the lazy dog
|
||||
Read: A kciuq nworb xor jumped fox brown quick A
|
||||
Read: A kciuq nworb xor jumped fox brown quick A
|
||||
...
|
||||
|
||||
What’s going on here? It’s a race. We thought **read** and **write** were atomic, or executed one instruction at a time from the beginning till the end. However the kernel is a concurrent beast, and it can easily reschedule the process running the kernel-mode part of the **write** operation somewhere inside the **reverse_phrase()** function. If the process that does **read()** is scheduled before the writer is given a chance to finish, it will see the data in an inconsistent state. Such bugs are really hard to debug. But how to fix it?
|
||||
|
||||
Basically, we need to ensure that no **read** method can be executed until the write method returns. If you ever programmed a multi-threaded application, you’ve probably seen synchronisation primitives (locks) like mutexes or semaphores. Linux has them as well, but there are nuances. Kernel code can run in the process context (working “on behalf” of the userspace code, as our methods do) and in the interrupt context (for example, in an IRQ handler). If you are in the process context and a lock you need has already been taken, you simply sleep and retry until you succeed. You can’t sleep in the interrupt context, so the code spins in a loop until the lock become available. The corresponding primitive is called a spinlock, but in our case, a simple mutex – an object that only one process can “hold” at the given time – is sufficient. A real-world code may also use a read-write semaphore, for performance reasons.
|
||||
|
||||
Locks always protect some data (in our case, a “struct buffer” instance), and it is very common to embed them in a structure they are protecting. So we add a mutex (‘struct mutex lock’) into the “struct buffer”. We must also initialise the mutex with **mutex_init()**; **buffer_alloc()** is a good place for this. The code that uses mutexes must also include **linux/mutex.h**.
|
||||
|
||||
A mutex is much like a traffic light – it’s useless unless drivers look at it and follow the signals. So we need to update **reverse_read()** and **reverse_write()** to acquire the mutex before doing anything to the buffer and release it when they are done. Let’s have a look at the **read** method – **write** works just the same way:
|
||||
|
||||
static ssize_t reverse_read(struct file *file, char __user * out,
|
||||
size_t size, loff_t * off)
|
||||
{
|
||||
struct buffer *buf = file->private_data;
|
||||
ssize_t result;
|
||||
if (mutex_lock_interruptible(&buf->lock)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
We acquire the lock at the very beginning of the function. **mutex_lock_interruptible()** either grabs the mutex and returns or puts the process to sleep until the mutex is available. As before, the **_interruptible** suffix means the sleep can be interrupted with a signal.
|
||||
|
||||
while (buf->read_ptr == buf->end) {
|
||||
mutex_unlock(&buf->lock);
|
||||
/* ... wait_event_interruptible() here ... */
|
||||
if (mutex_lock_interruptible(&buf->lock)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
Below is our “wait for the data” loop. You should never sleep when holding a mutex, or a situation called a “deadlock” may occur. So, if there is no data, we release the mutex and call **wait_event_interruptible()**. When it returns, we reacquire the mutex and continue as usual:
|
||||
|
||||
if (copy_to_user(out, buf->read_ptr, size)) {
|
||||
result = -EFAULT;
|
||||
goto out_unlock;
|
||||
}
|
||||
...
|
||||
out_unlock:
|
||||
mutex_unlock(&buf->lock);
|
||||
out:
|
||||
return result;
|
||||
|
||||
Finally, the mutex is unlocked when the function ends or if an error occurs while the mutex is being held. Recompile the module (don’t forget to reload it) and run the second test again. You should see no corrupted data now.
|
||||
|
||||
### What’s next? ###
|
||||
|
||||
Now you have a taste of kernel hacking. We’ve just scratched the surface of the topic, and there is much more to see. Our first module was intentionally simple, however the concepts you learned will stay the same in more complex scenarios as well. Concurrency, method tables, registering callbacks, putting processes to sleep and waking them up are things that every kernel hacker should be comfortable with, and now you’ve seen all of them in action. Maybe your kernel code will end up in the mainline Linux source tree some day – drop us a line if this happens!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxvoice.com/be-a-kernel-hacker/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.libusb.org/
|
||||
[2]:http://fuse.sf.net/
|
||||
[3]:http://www.linuxvoice.com/be-a-kernel-hacker/www.netfilter.org/projects/libnetfilter_queue
|
||||
[4]:http://lxr.free-electrons.com/
|
||||
@@ -1,40 +0,0 @@
|
||||
Translating by john...
|
||||
Command line secrets
|
||||
================================================================================
|
||||
There are loads of really good reasons to use the command line. It’s the most powerful and concise method of interacting with your computer, as we show in [issue 3 of Linux Voice][1]. However, we decided to take a moment to look at some of its more obscure (and some would say pointless) uses.
|
||||
|
||||
### Browsing the web ###
|
||||
|
||||
Firefox and Chromium are both great browsers, but have you ever thought they’re a little too graphical? No? Well take a look at the video below where we take the elinks web browser out for a spin around hacker news. It might not be as colourful as its more famous rivals, but it manages to render most web pages.
|
||||
|
||||
<iframe width="570" scrolling="no" height="418" src="http://shelr.tv/records/5368d80796608063a3000072/embed" style="border: 0; id="shelr_record_5368d80796608063a3000072"></iframe>
|
||||
|
||||
As well has having geek-chic, it can come in handy when you just need to quickly check if a web page is accessible from a computer you only have SSH access to.
|
||||
|
||||
### Looking up definitions on Wikipedia ###
|
||||
|
||||
Yes, we’ve already covered using the web, but the web isn’t the only way of accessing information on Wikipedia. David Leadbeater has set up a DNS server that holds extracts from Wikipedia in DNS entries. This lets you grab information using command line tools such as dig.
|
||||
|
||||
<iframe width="570" scrolling="no" height="418" src="http://shelr.tv/records/5368bfa896608063a300006d/embed" style="border: 0;" id="shelr_record_5368bfa896608063a300006d"></iframe>
|
||||
|
||||
### Watch movies ###
|
||||
|
||||
Who needs Netflix or YouTube when you can watch Star Wars Episode IV: A New Hope directly in your terminal by telneting into towel.blinkenlights.nl
|
||||
|
||||
<iframe width="570" scrolling="no" height="418" style="border: 0" src="http://shelr.tv/records/5368be5296608063a300006c/embed" id="shelr_record_5368be5296608063a300006c" border="0"></iframe>
|
||||
|
||||
### Play games ###
|
||||
|
||||
There were plenty of games for Linux before Steam came along, and many of them didn’t need any fancy graphics. NetHack, Robots and Greed are just a few examples. Here’s a peek at Moon Buggy.
|
||||
|
||||
<iframe width="570" scrolling="no" height="418" style="border: 0" src="http://shelr.tv/records/5368ca4596608063a300006f/embed" id="shelr_record_5368ca4596608063a300006f" border="0"></iframe>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxvoice.com/commandline-secrets/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.linuxvoice.com/issue-3-is-out/
|
||||
@@ -0,0 +1,125 @@
|
||||
Cup 2014 Brazil: Watch FIFA World Cup 2014 Competition in Your Linux Desktop
|
||||
================================================================================
|
||||
Football is the most played and most watched sports on Earth. The present form of football originated in Britain. Football players run an average of more than six miles during a single match. Over one billion fans watched last world cup football matches on Television. This figure is estimated to rise on an above note, this year.
|
||||
|
||||
Yeah! 2014 FIFA World Cup is going to start from 12th of June and will last on 13th of July. This will be the 20th FIFA World Cup, which is scheduled to be played in Brazil. A total of 32 countries are participating in this event.
|
||||
|
||||
For the fan-boys of football, here we are going to throw light on an application software called “icup 2014 Brazil”, which will update you with latest scores, keep tracks of the match score of your favourite team. Here in this article we will be discussing its features, usages, installation, etc.
|
||||
|
||||

|
||||
iCup 2014 Brazil
|
||||
|
||||
### What is icup 2014 Brazil? ###
|
||||
|
||||
icup 2014 Brazil is an application which is capable of keeping a track of match results of the FIFA world cup 2014 into your Linux desktop, starting shortly.
|
||||
|
||||
### Features of icup 2014 Brazil ###
|
||||
|
||||
- Adaptive User Interface, i.e., auto-resize of user interface.
|
||||
- Fast Access to Statistics.
|
||||
- Social Network Sharing Enabled, which extends to Facebook, Twitter and Google+.
|
||||
- Latest one is – Retina display Support.
|
||||
- Detailed data with time events and Statistics related to match and Team.
|
||||
- Audio Kit which comprise of the ‘National-Anthem’ of all the participating countries (32) in high quality effect along with the stadium background sound which makes the whole thing real.
|
||||
- An inbuilt calendar with the support of time zone for better understanding of events in local time zone, grouping of data and statistics for real time comparison groupable by day or stage, Graphical 2nd stage table, Result and Scores of Teams in real time.
|
||||
- Proxy support.
|
||||
|
||||
### Platforms and Architecture Supported ###
|
||||
|
||||
The application is designed to run on all major platforms including **Mac**, **Windows** and **Linux**. For the point of Linux, it is important to mention that the application is designed for **x86** processor only. However installing an **x86** application on **x86_64** architecture is possible. We have to tweak a little to make it work **x86_64** systems.
|
||||
|
||||
#### An insight of the Technical Specification on different Platforms ####
|
||||
|
||||
- Live Result, Calendar, Grouping of Data, 2nd stage Table, Social Network Linking and Multi-language support – Available for all supported platform.
|
||||
- Retina Display – No support in Windows and Linux, however supported in Mac OS.
|
||||
- Detailed Statistics – Supported in Linux. Donation-ware for Windows and Mac.
|
||||
- Audio Kit – Supported in Mac and Linux. Unknown for Windows.
|
||||
|
||||
**Important**: As visible in the above specification, some of the features like detailed specification are not available on platform other than Linux, for free. It is just to support Server and Bandwidth cost. For a Linux user, nothing needs to be cared about as far as detailed statistics are concerned, a proud moment.
|
||||
|
||||
### Installing iCup 2014 Brazil in Linux ###
|
||||
|
||||
First go to official [iCup 2014 Brazil download][1] page and download application according to your platform and architecture.
|
||||
|
||||
#### On 32-Bit System ####
|
||||
|
||||
# cd Downloads/
|
||||
# tar xvf iCup_2014_FREE-Brazil_1.1_linux.tar.bz2
|
||||
# cd iCup\ 2014\ FREE\ -\ Brazil\ 1.1/
|
||||
# chmod 755 iCup\ 2014\ FREE\ -\ Brazil
|
||||
|
||||
As I said above, this application is designed for x86 systems only. In order to Install a 32 bit application on 64 bit architecture, we need to prepare our system by installing some packages – **GTK+2** and **libstdc++.so.6**.
|
||||
|
||||
Well not for this Application only, but there are a whole lot of application in Linux which is not supported in 64-bit e.g., **Skype**. We need to build our System to install those applications.
|
||||
|
||||
#### On 64-Bit Systems ####
|
||||
|
||||
Install **GTK+2** and **libstdc++so.6**, using apt or yum command as shown below.
|
||||
|
||||
$ sudo apt-get install libgtk2.0-0 libstdc++6 [on Debian based systems]
|
||||
|
||||
If you get any dependency error, run the following command to resolve those dependencies
|
||||
|
||||
$ sudo apt-get -f install
|
||||
|
||||
----------
|
||||
|
||||
# yum install gtk2 libstdc++ [on RedHat based systems]
|
||||
|
||||
Once all the required packages are installed. Now the System is capable of running 32 bit applications on 64-bit systems, now go the directory where you’ve downloaded ‘**iCup 2014 Brazil**‘ package and run the following commands to install it.
|
||||
|
||||
# cd Downloads/
|
||||
# tar xvf iCup_2014_FREE-Brazil_1.1_linux.tar.bz2
|
||||
# cd iCup\ 2014\ FREE\ -\ Brazil\ 1.1/
|
||||
# chmod 755 iCup\ 2014\ FREE\ -\ Brazil
|
||||
|
||||
Next, move to the directory and double click the executable to start the application. In the below screen-shot you may not get the full information since the FIFA 2014 has not started till now. Although the glimpse of what we can get once the event starts.
|
||||
|
||||

|
||||
iCup Brazil 2014
|
||||
|
||||
No detailed Information : World cup hasn’t started Yet.
|
||||
|
||||

|
||||
Match Detailed Information
|
||||
|
||||
Groups and Teams
|
||||
|
||||

|
||||
Groups and Teams
|
||||
|
||||
2nd stage Detailed Information
|
||||
|
||||

|
||||
2nd stage Detailed Information
|
||||
|
||||
Match Details. Seems incomplete now.
|
||||
|
||||

|
||||
Match Summary
|
||||
|
||||
Language Change window and Social share button Integrated.
|
||||
|
||||

|
||||
Language Change
|
||||
|
||||
Donation is optional for Linux. You can always contribute.
|
||||
|
||||

|
||||
Donation
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
The above Application seems promising and may prove to be a boon for those Football fan-wall who can now remain connected.
|
||||
|
||||
That’s all for now. I’ll be here again with another interesting article soon. In that mean keep connected to Tecmint.com. Don’t forget to provide us with your valuable feedback in the comment section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/view-fifa-world-cup-matche-results/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.e-link.it/icup/brazil2014/icup-brazil-2014-desktop-app.php
|
||||
@@ -0,0 +1,72 @@
|
||||
How To Extract Images From Videos Using ffmpeg
|
||||
================================================================================
|
||||
Hi unixmen readers,
|
||||
|
||||
Have you ever wanted to extract images from a video file? It is possible to do such thing in Linux and for this tutorial I will use ffmpeg to get images from a video.
|
||||
|
||||
### What is ffmpeg? ###
|
||||
|
||||
ffmpeg is a very useful command line program which can be used to transcode media files. It is part of the FFmpeg leading multimedia framework that has many functionalities such as the ability to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.
|
||||
|
||||
There are many various tools included in the framework each of which has a specific role. For example the ffserver is used to stream multimedia for live broadcasts, ffprobe is used to analyze multimedia stream, ffplay can be used as a simple media player and **ffmpeg** has the ability to convert multimedia files between formats.
|
||||
|
||||
If you are interested the followings are the developer libraries included in the FFmpeg framework:
|
||||
|
||||
- libavutil is a library containing functions for simplifying programming, including random number generators, data structures, mathematics routines, core multimedia utilities, and much more.
|
||||
- libavcodec is a library containing decoders and encoders for audio/video codecs.
|
||||
- libavformat is a library containing demuxers and muxers for multimedia container formats.
|
||||
- libavdevice is a library containing input and output devices for grabbing from and rendering to many common multimedia input/output software frameworks, including Video4Linux, Video4Linux2, VfW, and ALSA.
|
||||
- libavfilter is a library containing media filters.
|
||||
- libswscale is a library performing highly optimized image scaling and color space/pixel format conversion operations.
|
||||
- libswresample is a library performing highly optimized audio resampling, rematrixing and sample format conversion operations.
|
||||
|
||||
**Note**: ffmpeg and FFmpeg are not the same. FFmpeg is the framework and the ffmpeg one of the utilities included on it.
|
||||
|
||||
### Let the action begin ###
|
||||
|
||||
In order to follow this tutorial you need to install the ffmpeg command line utility in your linux machine. Ubuntu users can easily install the ffmpeg utility by typing and running the following command in their terminal.
|
||||
|
||||
sudo apt-get install ffmpeg
|
||||
|
||||
Fedora users can install ffmpeg directly from the repos.
|
||||
|
||||
yum install ffmpeg
|
||||
|
||||
Or you can compile it from source. Before compiling and installing it from source you need to download it from the official website with the help of the following command.
|
||||
|
||||
wget http://www.ffmpeg.org/releases/ffmpeg-2.2.3.tar.bz2
|
||||
|
||||
Extract the archive with the following command.
|
||||
|
||||
tar -xvjf ffmpeg-2.2.3.tar.bz2
|
||||
|
||||
Once the archive is extracted run the following command.
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
Once the compile is finished run the following command to install ffmpeg.
|
||||
|
||||
su -c 'make install'
|
||||
|
||||
Not that everything is set up, all you have to is type a few commands in your terminal and you will be able to extract images from any type of video file.
|
||||
|
||||
Before going any further make sure you are in the same directory with the video file from which you want to extract images from. Use the cd command to navigate to the right directory. Since the video I am using for the purpose of this tutorial is in my Desktop i use the following command to navigate to my desktop.
|
||||
|
||||
cd /home/oltjano/Desktop
|
||||
|
||||
Then I use the following command to extract images from my video file.
|
||||
|
||||
ffmpeg -i "Тимати - Рентген ( Альбом '13')-C9Plztvv8ac.mp4" -r 1 -q:v 2 -f image2 image-3%d.jpeg
|
||||
|
||||
The **-i** option serves to get the input which in my case is the video file named **Тимати – Рентген ( Альбом ’13′)-C9Plztvv8ac.mp4**, the -r option sets the number of frames to be extracted as images every second. I like to extract one frame every second.
|
||||
|
||||
Then a very important option that should be mentioned and I like to use is the -q:v which is used to set the image quality of the images being extracted. I always get high quality images when extracting them from a video by using the value of 2.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/extract-images-videos-using-ffmpeg/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
33
sources/tech/20140607 How To Install iCup 2014 In Linux.md
Normal file
33
sources/tech/20140607 How To Install iCup 2014 In Linux.md
Normal file
@@ -0,0 +1,33 @@
|
||||
How To Install iCup 2014 In Linux
|
||||
================================================================================
|
||||

|
||||
|
||||
Hi linux geeks,
|
||||
|
||||
In this short tutorial, I will teach you how to install a very nice app for the 2014 FIFA World Cup in your Linux distribution. The application is called iCup and is available for Windows, Mac and Linux.
|
||||
|
||||
It has been a very long time since I have watched a football match so I thought to install this app on my machine to stay updated with the latest statistics on World Cup 2014. I don’t want to look like an ignorant regarding football in front of my friends. The iCup application can provide information on matches schedule, scorers, team coaches and formations of every match. There are also real time updates that give you the latest data during the matches.
|
||||
|
||||
### It supports the following features: ###
|
||||
|
||||
- Fully localizable on the fly in about 30 languages (use the language menu into the option panel)
|
||||
- Exclusive flexible user interface that adapt the data size to the window dimensions
|
||||
- Searchable matches calendar also groupable by day or stage
|
||||
- Graphical visualization of groups and 2° stage
|
||||
- Support for the conversion of the matches dates and time based on your local timezone and your system format.
|
||||
- Direct linking for commenting the results into your preferred social network (Facebook, Google+ and Twitter)
|
||||
- Proxy support (basic and digest authentication method supported)
|
||||
|
||||
I have tested it on my Ubuntu 12.04 LTS system and it works great. I have not experienced any errors or crashes so far. You can easily install this great app on your system by grabbing a copy of it on the [official website][1] and then extract the archive on your favourite destination. Once the archive is extracted, double click on iCup 2014 FREE – Brazil and the app will open.
|
||||
|
||||
iCup is very useful to me, I hope you find it useful too.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/install-icup-2014-linux/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.e-link.it/icup/brazil2014/icup-brazil-2014-desktop-app.php
|
||||
@@ -0,0 +1,112 @@
|
||||
>> chenguang is translating
|
||||
|
||||
Linux: Bash Delete All Files In Directory Except Few
|
||||
================================================================================
|
||||

|
||||
|
||||
I'm a new Linux system user. I need to cleanup in a download directory i.e. delete all files from ~/Downloads/ folders except the following types:
|
||||
|
||||
*.iso - All iso images files.
|
||||
*.zip - All zip files.
|
||||
|
||||
How do I delete all file except some in bash shell on a Linux, OS X or Unix-like systems?
|
||||
|
||||
Bash shell supports rich file pattern matching such as follows:
|
||||
|
||||
- * - Match any files.
|
||||
- ? - Matches any single character in filenames.
|
||||
- [...] - Matches any one of the enclosed characters.
|
||||
|
||||
### Method #1: Say hello to extended pattern matching operators ###
|
||||
|
||||
You need to use the extglob shell option using the shopt builtin command to use extended pattern matching operators such as:
|
||||
|
||||
1. ?(pattern-list) - Matches zero or one occurrence of the given patterns.
|
||||
1. *(pattern-list) - Matches zero or more occurrences of the given patterns.
|
||||
1. +(pattern-list) - Matches one or more occurrences of the given patterns.
|
||||
1. @(pattern-list) - Matches one of the given patterns.
|
||||
1. !(pattern-list) - Matches anything except one of the given patterns.
|
||||
|
||||
A pattern-list is nothing but a list of one or more patterns (filename) separated by a |. First, turn on extglob option:
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
#### Bash remove all files except *.zip and *.iso files ####
|
||||
|
||||
The rm command syntax is:
|
||||
|
||||
## Delete all file except file1 ##
|
||||
rm !(file1)
|
||||
|
||||
## Delete all file except file1 and file2 ##
|
||||
rm !(file1|file2)
|
||||
|
||||
## Delete all file except all zip files ##
|
||||
rm !(*.zip)
|
||||
|
||||
## Delete all file except all zip and iso files ##
|
||||
rm !(*.zip|*.iso)
|
||||
|
||||
## You set full path too ##
|
||||
rm /Users/vivek/!(*.zip|*.iso|*.mp3)
|
||||
|
||||
## Pass options ##
|
||||
rm [options] !(*.zip|*.iso)
|
||||
rm -v !(*.zip|*.iso)
|
||||
rm -f !(*.zip|*.iso)
|
||||
rm -v -i !(*.php)
|
||||
|
||||
Finally, turn off extglob option:
|
||||
|
||||
shopt -u extglob
|
||||
|
||||
### Method #2: Using bash GLOBIGNORE variable to remove all files except specific ones ###
|
||||
|
||||
From the [bash(1)][1] page:
|
||||
|
||||
> A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. If a filename matched by a pathname expansion pattern also matches one of the patterns in GLOBIGNORE, it is removed from the list of matches.
|
||||
|
||||
To delete all files except zip and iso files, set GLOBIGNORE as follows:
|
||||
|
||||
## only works with BASH ##
|
||||
cd ~/Downloads/
|
||||
GLOBIGNORE=*.zip:*.iso
|
||||
rm -v *
|
||||
unset GLOBIGNORE
|
||||
|
||||
### Method #3: Find command to rm all files except zip and iso files ###
|
||||
|
||||
If you are using tcsh/csh/sh/ksh or any other shell, try the following find command syntax on a Unix-like system to delete files:
|
||||
|
||||
find /dir/ -type f -not -name 'PATTERN' -delete
|
||||
|
||||
OR
|
||||
|
||||
## deals with weird file names using xargs ##
|
||||
find /dir/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm {}
|
||||
find /dir/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm [options] {}
|
||||
|
||||
To delete all files except php files in ~/sources/ directory, type:
|
||||
|
||||
find ~/sources/ -type f -not -name '*.php' -delete
|
||||
|
||||
OR
|
||||
|
||||
find ~/sources/ -type f -not -name '*.php' -print0 | xargs -0 -I {} rm -v {}
|
||||
|
||||
The syntax to delete all files except *.zip and *.iso is as follows:
|
||||
|
||||
find . -type f -not \( -name '*zip' -or -name '*iso' \) -delete
|
||||
|
||||
For more information see [bash command man page][1] and [find command man page][2].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.cyberciti.biz/faq/linux-bash-delete-all-files-in-directory-except-few/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.manpager.com/linux/man1/bash.1.html
|
||||
[2]:http://www.manpager.com/linux/man1/find.1.html
|
||||
@@ -0,0 +1,108 @@
|
||||
Nuvola Player 2.4.0 Released – A Online Cloud Music Player for Linux
|
||||
================================================================================
|
||||
**Nuvola Player** is an open source player that runs cloud music services such as Amazon Cloud Player, Bandcamp, Deezer, 8tracks, Google Play Music, Grooveshark, Hyper Machine and Pandora in its own web interface and provides integration with a Linux desktop.
|
||||
|
||||
This application comes with lots of features in the form of plugins such as desktop notifications, system tray, multimedia keys, media player applets, dock menu, lyrics, last.fm and much more.
|
||||
|
||||
On **May 31st 2014**, A new version of **Nuvola Player 2.4.0** was released – which brings a few new features, including two new services such as Logitech Media Server and This is My Jam with numerous bug fixes.
|
||||
|
||||
### What’s new in this release ###
|
||||
|
||||
- Deleted broken Hide Google+ buttons option, because Google changes the code too regularly.
|
||||
- Service settings are now applied quickly without reload.
|
||||
- The pause and toggle play/pause behaviour have been fixed.
|
||||
- Added a caution about compatibility problems with desktop notifications for Chrome.
|
||||
- The in-page navigation buttons have been implemented (now users will find buttons in the top bar next to the Google Play logo).
|
||||
- A new Logitech Media Server and This is My Jam services has been added.
|
||||
- Included support for back/ forward mouse buttons.
|
||||
- Fixed support for actionable notification in the GNOME lock screen.
|
||||
|
||||
For a complete list of features, visit at official release [announcement page][1].
|
||||
|
||||
### Installing Nuvola Player in Debian, Ubuntu and Linux Mint ###
|
||||
|
||||
The official Nuvola Player repository contains binary packages for **Ubuntu 14.04, 13.10, 12.10, 12.04** and **Linux Mint 17, 16, 15, 14.** You can install binary package ‘nuvolaplayer‘ by adding Nuvola Player repository under your system.
|
||||
|
||||
#### On Ubuntu and Linux Mint ####
|
||||
|
||||
Open a terminal and run the following series of commands in the terminal.
|
||||
|
||||
$ sudo add-apt-repository ppa:nuvola-player-builders/stable
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get upgrade
|
||||
$ sudo apt-get install nuvolaplayer
|
||||
|
||||
**Note**: Please don’t skip system updates command ‘sudo apt-get upgrade‘. Otherwise, your apt-get may fail to install Flash plugin.
|
||||
|
||||
If you wish to install Nuvola Player without Flash plugin support, you can skip that system upgrade command and use the following command to install nuvolaplayer without Flash support.
|
||||
|
||||
$ sudo apt-get --no-install-recommends install nuvolaplayer
|
||||
|
||||
#### On Debian ####
|
||||
|
||||
For **Debian Wheezy** and **Debian Sid** the stable Nuvola Player binary packages available from official repository. Using this repository, you can install latest stable version using the following bunch of commands.
|
||||
|
||||
Firstly, Open a terminal and import a public key, and then add the repository to ‘**sources.list**‘ file and then do a system update to install nuvolaplyer as shown below.
|
||||
|
||||
#### Debian Wheezy ####
|
||||
|
||||
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 706C220A
|
||||
$ sudo sh -c 'echo "deb http://ppa.fenryxo.cz/nuvola-player/ wheezy main" >> /etc/apt/sources.list'
|
||||
$ sudo sh -c 'echo "deb-src http://ppa.fenryxo.cz/nuvola-player/ wheezy main" >> /etc/apt/sources.list'
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install nuvolaplayer
|
||||
|
||||
#### Debian Sid ####
|
||||
|
||||
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 706C220A
|
||||
$ sudo sh -c 'echo "deb http://ppa.fenryxo.cz/nuvola-player/ sid main" >> /etc/apt/sources.list'
|
||||
$ sudo sh -c 'echo "deb-src http://ppa.fenryxo.cz/nuvola-player/ sid main" >> /etc/apt/sources.list'
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install nuvolaplayer
|
||||
|
||||
**Note**: Nuvola Player depend on wrapped Flash plugin, which is not installed by default due to conflicting libraries (**GTK+ 2** and **GTK+ 3**).
|
||||
|
||||
To workaround this problem, we enable component flash **PPA** to install package ‘**nuvolaplayer-flashplugin**‘ using the following commands.
|
||||
|
||||
$ sudo sh -c 'echo "deb http://ppa.fenryxo.cz/nuvola-player/ sid main beta flash" >> /etc/apt/sources.list'
|
||||
$ sudo sh -c 'echo "deb-src http://ppa.fenryxo.cz/nuvola-player/ sid main beta flash" >> /etc/apt/sources.list'
|
||||
$ apt-get update
|
||||
$ apt-get install nuvolaplayer-flashplugin
|
||||
|
||||
Once you done with the installation, you will find the application in **Menu** to launch it. Keep in mind, you must have internet connection in order to listen music online.
|
||||
|
||||
### Nuvola Player Screen Shots ###
|
||||
|
||||

|
||||
Select Music Services
|
||||
|
||||

|
||||
Grooveshark Music Service
|
||||
|
||||

|
||||
Grooveshark Playing Music
|
||||
|
||||

|
||||
Nuvola Player Preferences
|
||||
|
||||

|
||||
Google Play Music
|
||||
|
||||

|
||||
Rdio Music Service
|
||||
|
||||

|
||||
About Nuvola Player
|
||||
|
||||
For other Linux distributions, you can download source tarball packages at Nuvola Player [launchpad downloads][2] page.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/install-nuvola-player-in-linux/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://nuvolaplayer.fenryxo.cz/releases/2.4.html
|
||||
[2]:https://launchpad.net/nuvola-player/+download
|
||||
@@ -0,0 +1,175 @@
|
||||
Practical Interview Questions and Answers on Linux Shell Scripting
|
||||
================================================================================
|
||||
With the overwhelming response we are getting on the Interview Series articles, the first of its kind on any Linux How-to website in the form of Likes, Feedbacks in comment as well as on personal Email Address make us going from one article to the next article.
|
||||
|
||||
Here is the link to the [Interview Series][1] articles already published on Tecmint.com, where we have covered lots of topics viz., FTP, MySQL, Apache, Scripting, Linux Commands, etc.
|
||||
|
||||

|
||||
Practical Interview Question on Shell Scripting
|
||||
|
||||
Continuing to the above series here we are coming with another 5 wonderful Linux Interview Questions and their answer. Your (The Tecmint.com Readers and frequent Visitors) support is always needed to make it successful.
|
||||
|
||||
### 1. Write a shell script to get current date, time, user name and current working directory. ###
|
||||
|
||||
> **Answer** : The commands logname, date, who I am and pwd will output username, current date and time, and current working directory. Just implementing these commands in the script and making it a bit interactive.
|
||||
|
||||
Now create a file called ‘**userstats.sh**‘ and add the following code to it.
|
||||
|
||||
#!/bin/bash
|
||||
echo "Hello, $LOGNAME"
|
||||
echo "Current date is `date`"
|
||||
echo "User is `who i am`"
|
||||
echo "Current directory `pwd`"
|
||||
|
||||
Place execute permission and run the script as shown below.
|
||||
|
||||
# chmod 755 userstats.sh
|
||||
# ./userstats.sh
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
Hello, avi
|
||||
Current date is Sat Jun 7 13:05:29 IST 2014
|
||||
User is avi pts/0 2014-06-07 11:59 (:0)
|
||||
Current directory /home/avi/Desktop
|
||||
|
||||
### 2. Write a Shell Script that adds two numbers if provided as the command Line Argument and if the two numbers are not entered it outputs an Error Message along with a one-Line of how-to use description. ###
|
||||
|
||||
> **Answer** : Here is the simple Shell Script along with description which adds two number if provided as Command-Line argument, if not it throws error with single line on how to use the script.
|
||||
|
||||
Again create a file called ‘**two-numbers.sh**‘ and add the following content to it.
|
||||
|
||||
#!/bin/bash
|
||||
# The Shebang
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
# If two Inputs are not received from Standard Input
|
||||
|
||||
then
|
||||
# then execute the below statements
|
||||
|
||||
echo "Usage - $0 x y"
|
||||
# print on standard output, how-to use the script (Usage - ./1.sh x y )
|
||||
|
||||
echo " Where x and y are two nos for which I will print sum"
|
||||
# print on standard output, “Where x and y are two nos for which I will print sum ”
|
||||
|
||||
exit 1
|
||||
# Leave shell in Error Stage and before the task was successfully carried out.
|
||||
|
||||
fi
|
||||
# End of the if Statement.
|
||||
|
||||
echo "Sum of $1 and $2 is `expr $1 + $2`"
|
||||
# If the above condition was false and user Entered two numbers as a command Line Argument,
|
||||
it will show the sum of the entered numbers.
|
||||
|
||||
Set executer permission on the file and run the script as shown below.
|
||||
|
||||
# chmod 755 two-numbers.sh
|
||||
|
||||
**Condition 1**: Running the script without entering two numbers as command line argument, you will get the following output.
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
# ./two-numbers.sh
|
||||
|
||||
Usage - ./two-numbers.sh x y
|
||||
Where x and y are two nos for which I will print sum
|
||||
|
||||
**Condition 2**: When Numbers are entered as command line argument you will get the result as shown.
|
||||
|
||||
$ ./two-numbers.sh 4 5
|
||||
|
||||
Sum of 4 and 5 is 9
|
||||
|
||||
Hence the above shell script fulfills the condition as suggested in the question.
|
||||
|
||||
### 3. You needs to print a given Number say 10572, in reverse order using a Shell script such that the input is provided using command Line Argument only. If the input data is not provided as Command Line Argument, it should throw and error and should suggest, how to use the script. Write the script but before that tell me the algorithm that needs to be implemented here. ###
|
||||
|
||||
#### Algorithm ####
|
||||
|
||||
1. Let the Input Number = n
|
||||
1. Set rev=0, sd=0 (Reverse and single digitis set to 0)
|
||||
1. n % 10, will find and give single left most digit
|
||||
1. reverse number is generated as rev * 10 + sd
|
||||
1. Decrease Input Number (n) by 1.
|
||||
1. if n > 0, then goto step 3 else goto setp 7
|
||||
1. Print rev
|
||||
|
||||
Now again, create a file called ‘**numbers.sh**‘ and add the following given code it.
|
||||
|
||||
#!/bin/bash
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
echo "Usage: $0 number"
|
||||
echo " I will find reverse of given number"
|
||||
echo " For eg. $0 0123, I will print 3210"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
n=$1
|
||||
rev=0
|
||||
sd=0
|
||||
|
||||
while [ $n -gt 0 ]
|
||||
do
|
||||
sd=`expr $n % 10`
|
||||
rev=`expr $rev \* 10 + $sd`
|
||||
n=`expr $n / 10`
|
||||
done
|
||||
echo "Reverse number is $rev"
|
||||
|
||||
Grant a execute permission on the file and run the script as shown below.
|
||||
|
||||
# chmod 755 numbers.h
|
||||
|
||||
**Condition 1**: When Input is not provided as command line argument, you will get the following output.
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
./numbers.sh
|
||||
|
||||
Usage: ./numbers.sh number
|
||||
I will find reverse of given number
|
||||
For eg. ./2.sh 123, I will print 321
|
||||
|
||||
**Condition 2**: When Input was provided as command line Argument.
|
||||
|
||||
$ ./numbers.sh 10572
|
||||
|
||||
Reverse number is 27501
|
||||
|
||||
The above script worked perfectly and the output was just what we needed.
|
||||
|
||||
### 4. You are supposed to calculate a real number calculation directly from terminal and not any shell script. What will you do (say the real numbers are 7.56 and 2.453)? ###
|
||||
|
||||
> **Answer** : We need to use bc command in a special way as described below. The output of echo 7.56 + 2.453 should be pipelined to bc.
|
||||
|
||||
For example, run the following command to calculate numbers in real time using bc command as shown.
|
||||
|
||||
$ echo 7.56 + 2.453 | bc
|
||||
|
||||
10.013
|
||||
|
||||
### 5. You are supposed to find the value of pi upto 100 places of decimal, what is the easiest way to get the result done. ###
|
||||
|
||||
> **Answer** : The easiest way to find the value of pi, correct upto 100 places of decimal we just need to issue the below command.
|
||||
|
||||
# pi 100
|
||||
|
||||
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067
|
||||
|
||||
Obviously! We must have package ‘**pi**‘ installed. Just do a **apt** or **yum** to get a required package to install ‘**pi**‘ onto the distribution you are using.
|
||||
|
||||
That’s all for now. I’ll be here again with another interesting article very soon. Till then stay tuned and connected to Tecmint.com. Don’t forget to provide us with you valuable feedback in the comment section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/practical-interview-questions-on-linux-shell-scripting/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.tecmint.com/category/interview-questions/
|
||||
@@ -1,4 +1,4 @@
|
||||
(翻译中 by runningwater)
|
||||
(翻译中 by runningwater)
|
||||
Encrypting Your Cat Photos
|
||||
================================================================================
|
||||
The truth is, I really don't have anything on my hard drive that I would be upset over someone seeing. I have some cat photos. I have a few text files with ideas for future books and/or short stories, and a couple half-written starts to NaNoWriMo novels. It would be easy to say that there's no point encrypting my hard drive, because I have nothing to hide. The problem is, we wrongly correlate a "desire for privacy" with "having something to hide". I think where I live, in America, we've taken our rights to privacy for granted. Rather than the traditional "he must be hiding porn or bombs", think about something a little more mundane.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
GOLinux Translating!
|
||||
|
||||
Guide To Install Ubuntu 14.04 In Dual Boot Mode With Windows 8 Or 8.1 UEFI
|
||||
================================================================================
|
||||

|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
Translating by GOLinux ...
|
||||
|
||||
How to launch applications differently with Gnome-Pie on Linux desktop
|
||||
================================================================================
|
||||
The biggest complaint you can hear those days about Ubuntu is the new Unity interface. I remember leaving for Archlinux precisely when Unity started to rise, and when it was made clear that it was here to stay. However, Unity indirectly has led to good consequences: it allowed other distributions and other desktop environments to become more prominent as people were unhappy with it. If your system can support it, no one is against a bit of eye candy.
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
为什么我们不接收不良Linux 接口
|
||||
================================================================================
|
||||
由于最近The Witcher 2的惨败,我想写下些想法,为什么我们不应该接受来自开发人员的不良接口。
|
||||
|
||||
最近几年在我们linux的游戏库有太多该死的游戏,导致你现在可以看到来自linux玩家的评论“我已经有很多游戏了!”现在我可以想象到很多熟悉的声音。感谢Valve&Steam,之前我们从来没有看见过这么多自来开发者的注意力。
|
||||
|
||||
同样由于开发者的提交,我们看见了伴随而来的接口,它们,坦率地说,质量十分的糟糕或者说对于多数人们彻彻底底的不会用。
|
||||
|
||||
这个问题就是如果我们继续接受低水平质量的接口,Linux就会赢得一个游戏质量水平低的声誉。严肃地想想一个贴图的大怪兽。
|
||||
|
||||
再想象一下,一个3A开发者给linux推送大量游戏,使用用了The Witcher2接口“eON”的技术。那就是说我们有了大量开发者,就像突然看起来Linux有很多大牌游戏了。然后你可以看见大量的人尝试Linux,却看见它们的游戏运行者糟糕的画面,在同等硬件水品下,就会给它们一个印象,linux对游戏不友好。所以,这对所有人都不好。
|
||||
|
||||
|
||||
我已经看见许多人说“工具包用于接口真的没关系?”。这在我的眼里看来是一个非常天真的声明。当然,这有关系, 它意味Linux的游戏质量光和天的不同。它直接导致我回到关于Linux游戏的认知之上的观点。
|
||||
你可以坚持说工具包没有关系和使用任何比较/类比你幻想,但如果工具包是导致问题的根源,如同当我们讨论计算机软件它会占用99%的时间,是的,它当然有关系!
|
||||
|
||||
如今,我已经看见许多评论,来自其他主流网页声明,我们应该接受它们并且作感谢状,我们毕竟拥有他们。那真是个白痴的声明,那些不看大局的人。
|
||||
|
||||

|
||||
|
||||
想想,那些开发者和发行商认为可以接受推送的糟糕linux接口送出了门,总有一天得召回。它们的脑里只有利润。消费者对Linux游戏的感知就会进一步恶化,就是因为这些不良的接口。
|
||||
|
||||
我完全赞同来子开发者的接口,当然毕竟我运行着这个网站。但是,我作为一个消费者不愿意在windows可运行的游戏付钱,可是在linux运行得却像蜗牛,为什么我应该?为什么你应该?
|
||||
|
||||
最后增加一个观点:当开发者研究出有问题,发布在社区,你们应该从不攻击它们,这是不可接受的。反馈是很好,骂人是很孩子气,这使得Linux再一次看起来糟糕。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.gamingonlinux.com/articles/why-we-shouldnt-accept-bad-linux-ports.3765
|
||||
|
||||
译者:[Vic020](http://www.vicyu.net) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
@@ -2,15 +2,14 @@
|
||||
================================================================================
|
||||

|
||||
|
||||
> 技术视点是技术视角(TechScape)的一个新的组成部分,其特色是与科技界的上层人士进行独家采访和长时间谈话,探讨科技动态。
|
||||
|
||||
> 我们的第一个谈话对象是[李纳斯·托沃兹][1],Linux的传奇缔造者以及开源改革先驱。托沃兹生于芬兰的赫尔辛基,是诗人奥尔·托沃兹的孙子。尽管他更喜欢告诉人们,他的名字来自于《花生漫画》中的角色,但事实是他是以李纳斯·鲍林——两次诺贝尔奖获得者的名字来命名的。他的计算机经历是从康懋达公司的一台Amiga 500计算机上开始的,搬到辛克莱尔后又换到了IBM的386上。刚开始,他使用的是Minix操作系统,后来在该系统上衍生出了他自己的Linux操作系统。托沃兹和他的妻子托芙——六次芬兰全国空手道冠军结婚了,婚后他们定居在加利佛尼亚的圣何塞,育有三个女儿。
|
||||
> 我们的第一个谈话对象是[李纳斯·托沃兹][1],Linux的传奇缔造者以及开源改革先驱。托沃兹生于芬兰的赫尔辛基,是诗人奥尔·托沃兹的孙子。尽管他更喜欢告诉人们,他的名字来自于《花生漫画》中的角色,但事实是他是以李纳斯·鲍林——一位两次诺贝尔奖获得者的名字来命名的。他的计算机经历是从一台Commodore计算机上开始的,后来换成了Sinclair和IBM的386上。刚开始,他使用的是Minix操作系统,后来换成了他自己的Linux操作系统。托沃兹和他的妻子托芙——一位六次芬兰全国空手道冠军结婚了,婚后他们定居在加利佛尼亚的圣何塞,育有三个女儿。
|
||||
|
||||
**技术视点(TV)**:在当今的技术中,有什么令你感兴趣?
|
||||
|
||||
**托沃兹**:我差不多是个“鼠目寸光”的家伙,所以相对于那些更空洞的“大潮流”,我对技术中实在的新东西更感兴趣。
|
||||
|
||||
我喜欢关注硬件公司生产的新产品,关注他们最新的芯片,而其中可能最能激励我的(因为毕竟我是个做软件的)是那些提出新的算法并开发出新的软件来利用这些新功能的人。
|
||||
我喜欢关注硬件公司生产的新产品,关注他们最新的芯片,而其中可能最能吸引我的(因为毕竟我是个做软件的)是那些提出新的算法并开发出新的软件来利用这些新功能的人。
|
||||
|
||||
**TV**:那在当今科技中,什么真正让你感到恼火?它是怎么以及为什么让你生气?
|
||||
|
||||
@@ -18,11 +17,12 @@
|
||||
|
||||
这里,当然也包括我。我认为,整个的“个人崇拜”相当令人不安。而且,我很痛恨把我以及我所说的话看得太重。对于乔布斯,埃里森,盖茨等所谓的领袖,都是如此。我希望更多的人能自己思考,并且意识到技术实际上来自遍布全球的那些默默无闻的伟大工程师中的任意一员。
|
||||
|
||||
我理解人们想要并且需要一个焦点,而这种事也不仅仅发生在技术世界中(嘿,毫无疑问,我希望这事在技术世界中要发生得比娱乐行业来得少;),但是,这事仍然有点令人沮丧。
|
||||
我理解人们想要并且需要一个焦点,而这种事也不仅仅发生在技术世界中(嘿,毫无疑问,我希望这事在技术世界中要发生得比娱乐行业来得少 ;) ),但是,这事仍然有点令人沮丧。
|
||||
|
||||
**TV**:你是怎么错过“申请终身许可证”的机会,而其它像Red Hat,SuSE等等却抓住了它?这是因为如果Linux不开源,它起初就不会成为Linux了吗?你能谈谈更多情况吗?你是否曾在此事上感到过后悔?
|
||||
**TV**:你是怎么错过“毕生机遇”,而其它像Red Hat,SuSE等等却抓住了它?这是因为如果Linux不开源,它起初就不会成为Linux了吗?你能谈谈更多情况吗?你是否曾在此事上感到过后悔?
|
||||
|
||||
**托沃兹**:我当然不会因为任何事情后悔。我现在身在一个令人羡慕的位置上,我能干我喜欢的事情。而且,人们因此而尊重我。况且,我自由的能做我想做(也做了)的事情。
|
||||
|
||||
**托沃兹**:我当然不会因为任何事情后悔。我现在身在一个令人羡慕的位置上,我能干我喜欢的事情。而且,人们因此而尊重我。况且,我想要做的(而我已经做了)无偿工作也获得了酬劳。
|
||||
我想,很少有人会喜欢自己变得与众不同,那么让我来告诉你吧,这种感觉真不错。对于商业方面,我从来都不感兴趣。而且,对我来说,那些可以采用Linux并把它商用的人和公司只是做了我从没有动力做的事情。而这项工作需要人做,也很有益。因此,事实上我很感谢那些商业实体:它们让我能集中精力干我想干的那部分事情。
|
||||
|
||||
**TV**:在当今的科技界,哪位是你尊敬的人?为什么?
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
在个人层面上,我更喜欢那些不把他们自己太当一回事,同时又在他们的本职工作上干得很好的人。如果一定要我说一些知名人士,我想我更愿意成为斯蒂芬·沃兹尼克那样的人,我想这也是我尊敬他的原因。
|
||||
|
||||
**TV**:照你估计,当谷歌和微软都实现了各自的诺言,他们之间会发生什么?胜者又为什么会胜出?
|
||||
**TV**:在谷歌和微软的言行上,你更敬佩哪个?成功者为什么成功?
|
||||
|
||||
**托沃兹**:我不认为获胜的结果会和获胜的过程一样有趣。
|
||||
**托沃兹**:我不认为成功的结果会和成功的过程一样有趣。
|
||||
|
||||
在整个谷歌和微软的竞争中,我真的不认为公司本身相比技术环境中那些吸引人们视线的变革更为有趣。这份竞争,已经从对单个计算机的控制,升级为对成千上万独立计算机的整合。
|
||||
在整个谷歌和微软的竞争中,我真的不认为公司本身相比技术环境中那些吸引人们视线的变革更为有趣。这个竞争,已经从对单个计算机的控制,升级为对成千上万独立计算机的整合。
|
||||
|
||||
**TV**:你认为像科技灾难、互联网泡沫崩溃以及电信业崩盘这样的事为什么会发生?我们在今后怎样来防止它们再发生?
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
心脏流血教给我们的:成为开源的贡献者而不仅是个用户
|
||||
================================================================================
|
||||

|
||||
|
||||
> 如果你的公司依赖像OpenSSL这样的开源软件,是时候主动点了。
|
||||
|
||||
开源社区已经官方披上了它心脏流血衬衫。
|
||||
|
||||
ComputerWorld的Richi Jennings [抨击说][1]“又一个非常可怕的开源失败。”(骗取更多的页面浏览量?)ZDNet的Steven J. Vaughan-Nichols没有公开反对开源软件,仍旧[设法称][2]心脏流血是开源软件的最遭时刻。" 最终ZDNet的Chris Duckett务实地[恳求][3]:"公司筹集资金来避免心脏流血再次发生。"
|
||||
|
||||
而一个好的开始,企业资金并不是心脏流血的最终答案 。你才是。
|
||||
|
||||
想要避免开源失败的公司应该不仅仅是开源软件的用户,还要是贡献者。
|
||||
|
||||
### 贡献者乘坐头等舱 ###
|
||||
|
||||
贡献者帮助引导特定的项目。他们开始行动,而不只是执行。大多数企业缺乏资源参与他们所使用的所有开源项目,但每家公司都可以投资给那些真正关系到他们的项目。并且投资得越多,得到的好处越大。
|
||||
|
||||
开源就是坚持给那些会给予反馈项目补助的礼物。
|
||||
|
||||
我MongoDB的同事[Adam Comerford让这点更有说服力][4]:如果你看看第一批得知Heartbleed的[时间线] [5],那些第一批得知的(如谷歌)有一个相当大的优势。如Comford所说的,这些公司有一个显著的优势就是他们可以在bug还大规模未知的时候率先采取措施保护他们的系统。
|
||||
|
||||
|
||||
既然知道早期了解像Heartbleed问题的优势,Comerford问:“我如何确保我在这类问题的早期通知列表里面?”
|
||||
|
||||
|
||||
如果你依赖于专有软件,你有一个答案:向卖方支付大量的金钱,并希望他适时地响应。但是,如果你正在使用开源软件,有一个扩展选项: “要么有大量的员工给[开源项目]做贡献 ,或者...有知道主要贡献者的员工(让我们面对他,他们大多会贡献其他开源软件项目,极客和书呆子八卦像其他人一样。“
|
||||
|
||||
Comerford断言说:”好处不止这样“
|
||||
|
||||
> 这有很多好处 - 除了让问题及早通知,你让手头上的专家来应付这些棘手的更新,以评估你的风险,甚至可能在公众知道之前内部解决问题。在设置项目的方向上你还可以得到尊重的声音,可以有权划分关键特性的优先级。最终,你会了解社区好的意愿,有助于使大家的产品变得更好,并成为让聪明的贡献者一起工作的目标。
|
||||
|
||||
换句话说,参与进来。成员有特权,主要的特权可能就是信息。
|
||||
|
||||
### 选择在哪贡献 ###
|
||||
|
||||
同样,没有一家公司有足够的资源来有效地促进所有它所使用的项目,这就是为什么Comerford建议对关键项目上这么做的原因:
|
||||
|
||||
> 如果你要人们列出在商业中所有开源关键技术,你可能会得到一张很长的名单。现在,告诉他们,他们将不得不清点数量和预算来支持清单上的每一种技术的(并证明它) - 它可能会迅速缩水。
|
||||
|
||||
如果你是一个AMD那样的芯片公司,给Linux内核贡献基本驱动程序和其他代码很可能是强制性的。给LibreOffice贡献可能不是。或者,如果你赌你的未来在Hadoop上进行深层数据分析,你应该贡献Hadoop,即使你选择在OpenSSL社区免费乘车。如果你是Dish Networks,它的[ CIO告诉上周在开放商业会以上的人们][6],他们正在将重要的的工作载荷,关系型数据库转到Apache的Kafka,那他最好研究Kafaka的代码,即使他不贡献给Apache HTTP服务器项目。
|
||||
|
||||
每家公司都有其优先级,以及这些优先级必须以严肃地给开源项目提交来证明。
|
||||
|
||||
这是确保这些项目安全的一部分办法。而另一部分,它是一种影响方向的方式。但同时,红帽公司CEO[Jim Whitehurst][7]早在2008年声明,它是显著减少IT花费的办法:
|
||||
|
||||
> 今天编写的绝大多数软件是企业编写的,不得转售。并且绝大多数是从来没有真正使用过。IT软件开发中的浪费是巨大的....最终,开源给全世界的客户提供价值,我们不仅需要让我们的客户作为开源产品的用户,而且真正加入开源和参与在开发社区。
|
||||
|
||||
|
||||
Comerford坚持认为:“如果我在业务中使用开源软件,如果他们自己不是核心开发者,我应该雇核心开发人员来积极给软件做贡献。 ”这是充分利用开源软件的关键:给它做贡献,不只是使用它。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://readwrite.com/2014/05/14/heartbleed-open-source-contribution-users
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://blogs.computerworld.com/encryption/23767/heartbleed-openssl-open-source-fail
|
||||
[2]:http://www.zdnet.com/heartbleed-open-sources-worst-hour-7000028420/
|
||||
[3]:http://www.zdnet.com/openssl-needs-corporate-funding-to-avoid-heartbleed-repeat-7000028385/
|
||||
[4]:http://comerford.cc/wordpress/2014/04/15/my-conclusion-heartbleed-timeline/
|
||||
[5]:http://www.smh.com.au/it-pro/security-it/heartbleed-disclosure-timeline-who-knew-what-and-when-20140415-zqurk.html
|
||||
[6]:http://blogs.wsj.com/cio/2014/05/06/dish-looks-to-open-source-software-after-database-failure/
|
||||
[7]:http://www.cnet.com/news/red-hat-solve-enterprise-waste-through-open-source/
|
||||
369
translated/tech/20140603 Write your first Linux Kernel module.md
Normal file
369
translated/tech/20140603 Write your first Linux Kernel module.md
Normal file
@@ -0,0 +1,369 @@
|
||||
编写属于你的第一个Linux内核模块
|
||||
================================================================================
|
||||
> 曾经多少次想要在内核游荡?曾经多少次茫然不知方向?你不要再对着它迷惘,让我们指引你走向前方……
|
||||
内核编程常常看起来像是黑魔法,而在亚瑟 C 克拉克的眼中,它八成就是了。Linux内核和它的用户空间是大不相同的:抛开漫不经心,你必须小心翼翼,因为你编程中的一个bug就会影响到整个系统。浮点数学做起来可不容易,堆栈固定而渺小,而你写的代码总是异步的,因此你需要想想怎样让它并发。而除了所有这一切之外,Linux内核只是一个很大的、很复杂的C程序,它对每个人开放,任何人都去读它、学习它并改进它,而你也可以是其中之一。
|
||||
|
||||
> “开始内核编程的最简单的方式
|
||||
> 是写模块——一段代码
|
||||
> 可以用来动态加载进内核。”
|
||||
|
||||
可能,开始内核编程的最简单的方式,就是写模块——一段可以动态加载进内核并从内核移除的代码。模块所能做的事是有限的——例如,他们不能添加或移除像进程描述符这样的常规数据结构域。但是,在其它方面,他们是成熟的内核级的代码,可以在需要时随时编译进内核(这样就可以摒弃所有的限制了)。完全可以在Linux源代码树以外来开发并编译一个模块(这并不奇怪,它称为树外开发),如果你只是想稍微玩玩,而并不想提交修改以包含到主线内核中去,这样的方式是很方便的。
|
||||
|
||||
在本教程中,我们将开发一个简单的内核模块用以创建一个**/dev/reverse**设备。写入该设备的字符串将以逆序的方式读回(“Hello World”读成“World Hello”)。这是一个流行的节目采访智力游戏,而当你展示能力来实施时,你也可能获得一些奖励分。在开始前,有一句忠告:你的模块中的一个bug会导致系统崩溃(虽然可能性不大,但还是有可能的)和数据丢失。在开始前,请确保你已经将重要数据备份,或者,采用一种更好的方式,在虚拟机中进行试验。
|
||||
### 尽可能避免root身份 ###
|
||||
|
||||
> 默认情况下,**/dev/reverse**只有root可以使用,因此你不得不使用**sudo**来测试该程序。要解决该问题,可以创建一个包含以下内容的**/lib/udev/rules.d/99-reverse.rules**文件:
|
||||
>
|
||||
> SUBSYSTEM=="misc", KERNEL=="reverse", MODE="0666"
|
||||
>
|
||||
> 别忘了重新插入模块。让设备节点让非root用户访问这往往不是一个好主意,但是在开发其间却是十分有用的,这不是说以root身份运行二进制测试文件也不是个好主意。
|
||||
|
||||
#### 模块的构造 ####
|
||||
|
||||
由于大多数的Linux内核模块是用C写的(除了低级别特定架构部分),所以推荐你将模块以单一文件形式保存(例如,reverse.c)。我们已经把完整的源代码放在GitHub上——这里我们将看其中的一些片段。开始时,我们先要包含一些常见的文件头,并用预定义的宏来描述模块:
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Valentine Sinitsyn <valentine.sinitsyn@gmail.com>");
|
||||
MODULE_DESCRIPTION("In-kernel phrase reverser");
|
||||
|
||||
这里一切都直接明了,除了**MODULE_LICENSE()**:它不仅仅是一个标记。内核坚定地支持GPL兼容代码,因此如果你把许可证设置为其它非GPL兼容的(如,“专利”),特定的内核功能将在你的模块中不可用。
|
||||
|
||||
### 什么时候不该写内核模块 ###
|
||||
|
||||
> 内核编程很有趣,但是在现实项目中写(尤其是调试)内核代码要求特定的技巧。通常来讲,在没有其它方式解决你的问题时,你才应该沉入内核级别。可能你可以待在用户空间中,如果:
|
||||
|
||||
> - 你开发一个USB驱动 —— 请查看[libusb][1]。
|
||||
> - 你开发一个文件系统 —— 试试[FUSE][2]。
|
||||
> - 你在扩展Netfilter —— 那么[libnetfilter_queue][3]对你有所帮助。
|
||||
>
|
||||
> 通常,本地内核代码会干得更好,但是对于许多项目而言,这点性能丢失并不严重。
|
||||
由于内核编程总是异步的,没有Linux顺序执行得**main()**函数来运行你的模块。取而代之的是,你为各种事件提供了回调函数,像这个:
|
||||
|
||||
static int __init reverse_init(void)
|
||||
{
|
||||
printk(KERN_INFO "reverse device has been registered\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit reverse_exit(void)
|
||||
{
|
||||
printk(KERN_INFO "reverse device has been unregistered\n");
|
||||
}
|
||||
|
||||
module_init(reverse_init);
|
||||
module_exit(reverse_exit);
|
||||
|
||||
这儿,我们定义了函数,用来访问模块的插入和移除功能,只有第一个是必要的。目前,它们只是打印消息到内核环缓冲区(可以通过**dmesg**命令从用户空间访问);**KERN_INFO**是日志等级(注意,没有逗号)。**_init**和**_exit**是属性 —— 联结到函数的元数据片(或者变量)。属性在用户空间的C代码中是很罕见的,但是内核中却很普遍。所有标记为**_init**的,会在初始化后再生(还记得那条老旧的“释放未使用的内核内存……”信息?)。**__exit**表明,当代码被静态构建进内核时,该函数可以安全地优化。最后,**module_init()**和**module_exit()**这两个宏将**reverse_init()**和**reverse_exit()**函数设置成为我们模块的生命周期回调函数。实际的函数名称并不重要,你可以称它们为**init()**和**exit()**,或者**start()**和**stop()**,你想叫什么就叫什么吧。在你的模块外,它们被申明成为静态的和不可见的。事实上,内核中的任何函数都是不可见的,除非明确地被导出。然而,在内核程序员中,给你的函数加上模块名前缀是约定俗成的。
|
||||
|
||||
这些是基本要素 —— 让我们把事情变得更有趣些。模块可以接收参数,就像这样:
|
||||
|
||||
# modprobe foo bar=1
|
||||
|
||||
**modinfo**命令显示了所有模块接受的参数,而这些也可以在**/sys/module//parameters**下作为文件使用。我们的模块需要一个缓冲区来存储短语 —— 让我们把这大小设置为用户可配置。添加**MODULE_DESCRIPTION()**以下的三行:
|
||||
|
||||
static unsigned long buffer_size = 8192;
|
||||
module_param(buffer_size, ulong, (S_IRUSR | S_IRGRP | S_IROTH));
|
||||
MODULE_PARM_DESC(buffer_size, "Internal buffer size");
|
||||
|
||||
这儿,我们定义了一个变量来存储该值,将其包裹到一个参数中,并通过sysfs来让所有人可读。参数的描述(最后一行)会出现在modinfo的输出中。
|
||||
|
||||
由于用户可以直接设置**buffer_size**,我们需要在**reverseinit()**来清除它。你总该检查来自内核外的数据 —— 如果你不这么做,你就是会将你自身置于内核异常之中,设置造成安全漏洞。
|
||||
|
||||
static int __init reverse_init()
|
||||
{
|
||||
if (!buffer_size)
|
||||
return -1;
|
||||
printk(KERN_INFO
|
||||
"reverse device has been registered, buffer size is %lu bytes\n",
|
||||
buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
来自模块初始化函数的非0返回值意味着模块执行失败。
|
||||
|
||||
### 导航 ###
|
||||
|
||||
> 但你开发模块时,Linux内核就是你所需一切的源头。然而,它相当大,你可能在查找你所要的内容时会有困难。幸运的是,在浏览庞大的代码库时,有工具可以帮助你干得轻松一点。首先,是Cscope —— 在终端中运行的一个令人肃然起敬的工具。你所要做的,就是在内核源代码的顶级目录中运行**make cscope && cscope**。Cscope和Vim以及Emacs整合得很好,因此你可以在使用你最喜爱的编辑器舒适地工作时来使用它。
|
||||
|
||||
> 如果基于终端的工具不是你的最爱,那么就访问[http://lxr.free-electrons.com][4]吧。它是一个基于web的内核导航工具,即使它的功能没有Cscope来得多(例如,你不能方便地找到函数的用法),但它仍然提供了足够多的快速查询功能。
|
||||
现在是时候来编译模块了。你将需要用于正在运行的内核版本的头文件(**linux-headers**,或者同等软件包)和**build-essential**(或者类似的包)。接下来,该创建一个标准的Makefile模板:
|
||||
|
||||
obj-m += reverse.o
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||
|
||||
现在,调用**make**来构建你的第一个模块。如果你输入的都正确,在当前目录内会发现reverse.ko文件。使用**sudo insmod reverse.ko**插入,然后运行:
|
||||
|
||||
$ dmesg | tail -1
|
||||
[ 5905.042081] reverse device has been registered, buffer size is 8192 bytes
|
||||
|
||||
恭喜了!然而,目前这一行还只是在逗你玩而已 —— 还没有设备节点呢。让我们来修复它。
|
||||
|
||||
#### 混杂设备 ####
|
||||
|
||||
在Linux中,有一种特殊的字符设备类型,叫做“混杂设备”(或者简称为“misc”)。它设计用于只有一个单一接入点的小型设备驱动,而这正是我们所需要的。所有混杂设备共享同一个主设备号(10),因此一个驱动(**drivers/char/misc.c**)就可以查看它们所有设备了,而这些设备用次设备号来区分。在所有其它意义上,它们只是普通字符设备。
|
||||
|
||||
要为该设备注册一个次设备号(以及一个接入点),你需要声明**struct misc_device**,填上所有字段(注意语法),然后使用指针指向该结构函数来调用**misc_register()**。为了这个能工作,你也需要包含**linux/miscdevice.h**头文件:
|
||||
|
||||
static struct miscdevice reverse_misc_device = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "reverse",
|
||||
.fops = &reverse_fops
|
||||
};
|
||||
static int __init reverse_init()
|
||||
{
|
||||
...
|
||||
misc_register(&reverse_misc_device);
|
||||
printk(KERN_INFO ...
|
||||
}
|
||||
|
||||
这儿,我们为名为“reverse”的设备请求一个第一个可用的(动态的)次设备号;省略号表明我们已经见过的省略的代码。别忘了在模块卸下后注销掉该设备。
|
||||
|
||||
static void __exit reverse_exit(void)
|
||||
{
|
||||
misc_deregister(&reverse_misc_device);
|
||||
...
|
||||
}
|
||||
|
||||
‘fops’字段存储了一个指针,指向结构函数**file_operations**(在Linux/fs.h中已声明),而这真是我们模块的接入点。**reverse_fops**定义如下:
|
||||
|
||||
static struct file_operations reverse_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = reverse_open,
|
||||
...
|
||||
.llseek = noop_llseek
|
||||
};
|
||||
|
||||
再者,**reverse_fops**包含了一系列回调函数(也称之为方法),当用户空间代码打开一个设备时,就会执行。从该设备读取,向该设备写入,或者关闭文件描述符。如果你忽略了所有这些,就会使用一个灵敏的回调函数来替代。这就是为什么我们明确给**noop_llseek()**设置了**llseek**方法,而它却什么也不干(就像名称中暗指的)。默认部署改变了文件指针,我们现在也不想我们的设备被找到(这是你们的今天的回家作业)。
|
||||
|
||||
#### 我在关闭时打开 ####
|
||||
|
||||
让我们实施该方法。我们将分配一个新的缓冲区给每个打开的文件描述符,并在它关闭时释放。这事实上并不安全:如果一个用户空间应用程序泄漏了描述符(也许是故意的),它就会霸占RAM,并使系统不可用。在现实世界中,你总得考虑到这些可能性。但在本教程中,这种方法可以接受。
|
||||
|
||||
我们需要一个结构函数来描述缓冲区。内核提供了许多常规的数据结构:链接列表(双联的),哈希表,树等等之类。然而,缓冲区常常从零开始实施。我们将调用我们的“struct buffer”:
|
||||
|
||||
struct buffer {
|
||||
char *data, *end, *read_ptr;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
**data**是该缓冲区存储的一个指向字符串的指针,而最后部分是字符串结尾后的第一个字节。**read_ptr**是**read()**开始读取数据的地方。缓冲区大小为了完整性而存储 —— 目前,我们还没有使用该区域。你不能假设使用你结构体的用户会正确地初始化所有这些东西,所以最好在函数中封装缓冲区分配和解除。它们通常命名为**buffer_alloc()**和**buffer_free()**。
|
||||
|
||||
static struct buffer *buffer_alloc(unsigned long size)
|
||||
{
|
||||
struct buffer *buf;
|
||||
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
|
||||
if (unlikely(!buf))
|
||||
goto out;
|
||||
...
|
||||
out:
|
||||
return buf;
|
||||
}
|
||||
|
||||
内核内存使用**kmalloc()**来分配,并使用**kfree()**来释放;**kzalloc()**的风格是将内存设置为全零。不同于标准的**malloc()**,它的内核对应部分收到的标志指定了第二个参数中请求的内存类型。这里,**GFP_KERNEL**是说我们需要一个普通的内核内存(不是在DMA或高内存中)以及函数可以按需睡眠(重新编排进程)。**sizeof(*buf)**是一种常见的方式,它用来获取可通过指针访问的结构体的大小。
|
||||
|
||||
你应该随时检查**kmalloc()**的返回值:解应用NULL指针将导致内核异常。同时也需要注意**unlikely()**宏的使用。它(及其相对宏**likely()**)被广泛用于内核中,用于表明条件几乎总是真的(或假的)。它不会影响到控制流,但是能帮助现代处理器通过分支预测技术来提升性能。
|
||||
|
||||
最后,注意**gotos**。它们常常为认为是邪恶的,但是,Linux内核(以及一些其它系统软件)采用它们来实施集中式的函数退出。这样的结果是减少嵌套深度,使代码更具可读性,而且非常像更高级语言中的**try-catch**区块。
|
||||
|
||||
有了**buffer_alloc()**和**buffer_free()**,**open**和**close**方法就变得很简单了。
|
||||
|
||||
static int reverse_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int err = 0;
|
||||
file->private_data = buffer_alloc(buffer_size);
|
||||
...
|
||||
return err;
|
||||
}
|
||||
|
||||
**struct file**是一个标准的内核数据结构,用以存储打开的文件的信息,如当前文件位置(**file->fpos**),标志(**file->flags**),或者打开模式(**file->fmode**)。另外一个字段**file->privatedata**用于关联文件到一些专有数据,它的类型是void *,而且它在文件拥有者以外对内核不透明。我们将一个缓冲区存储在那里。
|
||||
|
||||
如果缓冲区分配失败,我们通过返回否定值(**-ENOMEM**)来为调用的用户空间代码标明。
|
||||
|
||||
#### 学会读写 ####
|
||||
|
||||
“read”和“write”方法是真正完成工作的地方。当数据写入到缓冲区时,我们就丢弃它里头先前的内容,并在没有任何临时存储时将短语恢复原状。**read**方法仅仅是从内核缓冲区复制数据到用户空间。但是如果缓冲区还没有数据,**reverseread()**会做什么呢?在用户空间中,**read()**调用会在有可用数据前阻塞它。在内核中,你必须等待。幸运的是,有一项机制用于处理这种情况,就是‘wait queues’。
|
||||
|
||||
想法很简单。如果当前进程需要等待某个事件,它的描述符(**struct task_struct**存储为‘current’)被放进非可运行(睡眠中)状态,并添加到一个队列中。然后**schedule()**就被调用来选择另一个进程运行。生成事件的代码通过使用队列将等待进程放回**TASKRUNNING**状态来唤醒它们。调度程序将在以后在某个地方选择它们之一。Linux有多种非可运行状态,最值得注意的是**TASKINTERRUPTIBLE**(一个可以通过信号中断的睡眠)和**TASKKILLABLE**(一个可被杀死的睡眠中的进程)。所有这些都应该正确处理,并等待队列为你做这些事。
|
||||
|
||||
一个用以存储读取等待队列头的天然场所就是结构缓冲区,所以从为它添加**wait_queue_head_t read_queue**字段开始。你也应该包含**linux/sched.h**。可以使用DECLARE_WAITQUEUE()宏来静态声明一个等待队列。在我们这种情况下,需要动态初始化,因此添加下面这行到**buffer_alloc()**:
|
||||
|
||||
init_waitqueue_head(&buf->read_queue);
|
||||
|
||||
我们等待可用数据;或者等待**read_ptr != end**条件成立。我们也想要让等待操作可以被中断(如,通过Ctrl+C)。因此,“read”方法应该像这样开始:
|
||||
|
||||
static ssize_t reverse_read(struct file *file, char __user * out,
|
||||
size_t size, loff_t * off)
|
||||
{
|
||||
struct buffer *buf = file->private_data;
|
||||
ssize_t result;
|
||||
while (buf->read_ptr == buf->end) {
|
||||
if (file->f_flags & O_NONBLOCK) {
|
||||
result = -EAGAIN;
|
||||
goto out;
|
||||
}
|
||||
if (wait_event_interruptible
|
||||
(buf->read_queue, buf->read_ptr != buf->end)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
...
|
||||
|
||||
我们让它循环,直到有可用数据,如果没有则使用**wait_event_interruptible()**(它是一个宏,不是函数,这就是为什么要给队列传递值)来等待。好吧,如果**wait_event_interruptible()**被中断,它返回一个非0值,这个值代表**-ERESTARTSYS**。这段代码意味着系统调用应该重新启动。**file->f_flags**检查以非阻塞模式打开的文件数:如果没有数据,返回**-EAGAIN**。
|
||||
|
||||
我们不能使用**if()**来替代**while()**,因为可能有许多进程正等待数据。当**write**方法唤醒它们时,调度程序选择一个来以不可预知的方式运行,因此,在这段代码有机会执行的时候,缓冲区可能再次空出。现在,我们需要将数据从**buf->data** 复制到用户空间。**copytouser()**内核函数就干了此事:
|
||||
|
||||
size = min(size, (size_t) (buf->end - buf->read_ptr));
|
||||
if (copy_to_user(out, buf->read_ptr, size)) {
|
||||
result = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
如果用户空间指针错误,那么调用可能会失败;如果发生了此事,我们就返回**-EFAULT**。记住,不要相信任何来自内核外的事物!
|
||||
|
||||
buf->read_ptr += size;
|
||||
result = size;
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
|
||||
为了让数据能读入到专有组块中,需要进行简单运算。该方法返回读入的字节数,或者一个错误代码。
|
||||
|
||||
写方法更简短。首先,我们检查缓冲区是否有足够的空间,然后我们使用**copy_from_userspace()**函数来获取数据。再然后**read_ptr**和结束指针会被重置,缓冲区内容会被撤销掉:
|
||||
|
||||
buf->end = buf->data + size;
|
||||
buf->read_ptr = buf->data;
|
||||
if (buf->end > buf->data)
|
||||
reverse_phrase(buf->data, buf->end - 1);
|
||||
|
||||
这里, **reverse_phrase()**干了所有吃力的工作。它依赖于**reverse_word()**函数,该函数相当简短并且标记为内联。这是另外一个常见的优化;但是,你不能过度使用。因为积极的内联会导致内核映像徒然增大。
|
||||
|
||||
最后,我们需要唤醒**read_queue**中等待数据的进程,就跟先前讲过的那样。**wake_up_interruptible()**就是用来干此事的:
|
||||
|
||||
wake_up_interruptible(&buf->read_queue);
|
||||
|
||||
唷!你现在已经有了一个内核模块,它至少已经编译成功了。现在,是时候来测试了。
|
||||
|
||||
### 调试内核代码 ###
|
||||
|
||||
> 或许,内核中最常见的调试方法就是打印。如果你愿意,你可以使用普通的**printk()** (假定使用**KERN_DEBUG**日志等级)。然而,那儿还有更好的办法。如果你正在写一个设备驱动,这个设备驱动有它自己的“struct device”,可以使用**pr_debug()**或者**dev_dbg()**:它们支持动态调试(**dyndbg**)特性,并可以根据需要启用或者禁用(请查阅**Documentation/dynamic-debug-howto.txt**)。对于单纯的开发消息,使用**prdevel()**,该函数没有操作符,除非设置了DEBUG。要为我们的模块启用DEBUG,请添加以下行到Makefile中:
|
||||
|
||||
> CFLAGS_reverse.o := -DDEBUG
|
||||
>
|
||||
> 完了之后,使用**dmesg**来查看**pr_debug()**或**pr_devel()**生成的调试信息。
|
||||
> 或者,你可以直接发送调试信息到控制台。要想这么干,你可以设置**console_loglevel**内核变量为8或者更大的值(**echo 8 /proc/sys/kernel/printk**),或者在高日志等级,如**KERN_ERR**,来临时打印要查询的调试信息。很自然,在发布代码前,你应该移除这样的调试声明。
|
||||
|
||||
> 注意出现在控制台的内核消息,而不要在Xterm这样的终端模拟器窗口中去查看;那也是你在内核开发时,经常会建议你不要再X环境下进行的原因。
|
||||
|
||||
### 惊喜,惊喜! ###
|
||||
|
||||
编译模块,然后加载进内核:
|
||||
|
||||
$ make
|
||||
$ sudo insmod reverse.ko buffer_size=2048
|
||||
$ lsmod
|
||||
reverse 2419 0
|
||||
$ ls -l /dev/reverse
|
||||
crw-rw-rw- 1 root root 10, 58 Feb 22 15:53 /dev/reverse
|
||||
|
||||
一切似乎就位。现在,要测试模块是否正常工作,我们将写一段小程序来翻转它的第一个命令行参数。**main()**(没有错误检查)可能看上去像这样:
|
||||
|
||||
int fd = open("/dev/reverse", O_RDWR);
|
||||
write(fd, argv[1], strlen(argv[1]));
|
||||
read(fd, argv[1], strlen(argv[1]));
|
||||
printf("Read: %s\n", argv[1]);
|
||||
|
||||
像这样运行:
|
||||
|
||||
$ ./test 'A quick brown fox jumped over the lazy dog'
|
||||
Read: dog lazy the over jumped fox brown quick A
|
||||
|
||||
它工作正常!玩得更逗一点:试试传递单个单词或者单个字母的短语,空的字符串或者是非英语字符串(如果你有这样的键盘布局设置),以及其它任何东西。
|
||||
|
||||
现在,让我们让事情变得更好玩一点。我们将创建两个进程,它们共享一个文件描述符(因而还有内核缓冲区)。其中一个会持续写入字符串到设备,而另一个将读取这些字符串。在下例中,我们使用了**fork(2)**系统调用,而pthreads也很好用。我也忽略了打开和关闭设备,以及错误检查部分的代码(又来了):
|
||||
|
||||
char *phrase = "A quick brown fox jumped over the lazy dog";
|
||||
if (fork())
|
||||
/* Parent is the writer */
|
||||
while (1)
|
||||
write(fd, phrase, len);
|
||||
else
|
||||
/* child is the reader */
|
||||
while (1) {
|
||||
read(fd, buf, len);
|
||||
printf("Read: %s\n", buf);
|
||||
}
|
||||
|
||||
你希望这个程序会输出什么呢?下面就是在我的笔记本上得到的东西:
|
||||
|
||||
Read: dog lazy the over jumped fox brown quick A
|
||||
Read: A kcicq brown fox jumped over the lazy dog
|
||||
Read: A kciuq nworb xor jumped fox brown quick A
|
||||
Read: A kciuq nworb xor jumped fox brown quick A
|
||||
...
|
||||
|
||||
这里发生了什么呢?举行了一场比赛。我们认为**read**和**write**是很小的,或者从头到尾一次执行一个指令。然而,内核是并发的野兽,它可以很容易地重排**reverse_phrase()**函数内部某个地方运行着的内核模式部分的写入操作。如果进行**read()**操作的进程在写入操作结束前就被编排进去,就会产生数据不连续状态。这些bug非常难以排除。但是,怎样来处理这个问题呢?
|
||||
|
||||
基本上,我们需要确保在写方法返回前没有**read**方法能被执行。如果你曾经编写过一个多线程的应用程序,你可能见过同步原语(锁),如互斥锁或者信号。Linux也有这些,但有些细微的差别。内核代码可以运行在进程条件中(“代表”用户空间代码工作,就像我们的方法那样)以及运行在中断条件中(例如,在IRQ处理器中)。如果你的程序处于进程条件中,并且你需要的锁已经被拿走,你的程序就会睡眠并重试直至成功。在中断条件中是无法睡眠的,因此代码在循环中流转,直到有可用的锁为止。关联原语被称为自旋锁,但在我们的环境中,一个简单的互斥锁 —— 在特定时间内只有唯一一个进程能“占有”的对象 —— 就足够了。处于性能方面的考虑,现实的代码可能也会使用读-写信号。
|
||||
|
||||
锁总是保护某些数据(在我们的环境中,是一个“struct buffer”实例),而且也常常会把它们嵌入到它们所保护的结构体中。因此,我们添加一个互斥锁(‘struct mutex lock’)到“struct buffer”中。我们也必须用**mutex_init()**来初始化互斥锁;**buffer_alloc**是用来处理这件事的好地方。使用互斥锁的代码也必须包含**linux/mutex.h**。
|
||||
|
||||
互斥锁很像交通信号灯 —— 除非驱动查看并跟踪信号,否则它没什么用。因此,在对缓冲区做操作并在操作完成时释放它之前,我们需要更新**reverse_read()**和**reverse_write()**来获取互斥锁。让我们来看看**read**方法 —— **write**的工作原理相同:
|
||||
|
||||
static ssize_t reverse_read(struct file *file, char __user * out,
|
||||
size_t size, loff_t * off)
|
||||
{
|
||||
struct buffer *buf = file->private_data;
|
||||
ssize_t result;
|
||||
if (mutex_lock_interruptible(&buf->lock)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
我们在函数一开始就获取锁。**mutex_lock_interruptible()**要么抓取互斥锁然后返回,要么让进程睡眠,直到有可用的互斥锁。就像前面一样,**_interruptible**后缀意味着睡眠可以由信号来中断。
|
||||
|
||||
while (buf->read_ptr == buf->end) {
|
||||
mutex_unlock(&buf->lock);
|
||||
/* ... wait_event_interruptible() here ... */
|
||||
if (mutex_lock_interruptible(&buf->lock)) {
|
||||
result = -ERESTARTSYS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
下面是我们的“等待数据”循环。当持有互斥锁,或者发生称之为“死锁”的情境时,不应该让进程睡眠。因此,如果没有数据,我们释放互斥锁并调用**wait_event_interruptible()**。当它返回时,我们重新获取互斥锁并像往常一样继续:
|
||||
|
||||
if (copy_to_user(out, buf->read_ptr, size)) {
|
||||
result = -EFAULT;
|
||||
goto out_unlock;
|
||||
}
|
||||
...
|
||||
out_unlock:
|
||||
mutex_unlock(&buf->lock);
|
||||
out:
|
||||
return result;
|
||||
|
||||
最后,当函数结束,或者在互斥锁被占有过程中发生错误时,互斥锁被解锁。重新编译模块(别忘了重新加载),然后再次进行测试。现在你应该没发现毁坏的数据了。
|
||||
|
||||
### 接下来是什么? ###
|
||||
现在,你体验了一把内核侵入。我们刚刚为你揭开了今天话题的外衣,里面还有更多东西供你探索。我们的第一个模块是有意识地写得简单一点,在从中学到的概念在更复杂的环境中也一样。并发、方法表、注册回调函数、使进程睡眠以及唤醒进程,这些都是内核黑客们耳熟能详的东西,而现在你已经看过了它们的运作。或许某天,你的内核代码也将被加入到主线Linux源代码树中 —— 如果真这样,请联系我们!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxvoice.com/be-a-kernel-hacker/
|
||||
|
||||
译者:[GOLinux](https://github.com/GOLinux) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.libusb.org/
|
||||
[2]:http://fuse.sf.net/
|
||||
[3]:http://www.linuxvoice.com/be-a-kernel-hacker/www.netfilter.org/projects/libnetfilter_queue
|
||||
[4]:http://lxr.free-electrons.com/
|
||||
25
translated/tech/20140604 Command line secrets.md
Normal file
25
translated/tech/20140604 Command line secrets.md
Normal file
@@ -0,0 +1,25 @@
|
||||
命令行的秘密
|
||||
================================================================================
|
||||
有很多使用命令行的理由.它是与你的计算机交互的最强大和简明的方法,正如我们在[issue 3 of Linux Voice][1]中展示的那样.但是,我们决定先来看一下命令行的一些隐晦的使用场景(或许有些人会觉得没有意义).
|
||||
### 浏览网页 ###
|
||||
Firefox和Chromium都是很好的浏览器,但是你有没有发现它们有点太图像化了?没有?看一下下面的视频,我们使用elinks web浏览器显示了与黑客相关的新闻.界面可能没有其他浏览器好看,但是它能够显示更多的web页面.
|
||||
<iframe width="570" scrolling="no" height="418" src="http://shelr.tv/records/5368d80796608063a3000072/embed" style="border: 0; id="shelr_record_5368d80796608063a3000072"></iframe>
|
||||
当你只想在你通过SSH方式登录的计算机上检查一下能否上网的时候,这将是一个很便利的方法.
|
||||
### 在维基百科上查找想要的信息 ###
|
||||
是的,上文我们已经提到了使用Web,但是web不是查看维基百科的唯一方式.David Leadbeater已经构建了一个将维基百科DNS入口提取出来的DNS服务器.这能够让你使用想dig这样的命令行工具来抓取你想要的信息.
|
||||
<iframe width="570" scrolling="no" height="418" src="http://shelr.tv/records/5368bfa896608063a300006d/embed" style="border: 0;" id="shelr_record_5368bfa896608063a300006d"></iframe>
|
||||
### 看电影 ###
|
||||
当你想要看Star Wars Episode IV时,不再需要使用Netflix或者YouTube,只要在你的终端中直接telnet towel.blinkenlights.nl就行了.
|
||||
<iframe width="570" scrolling="no" height="418" style="border: 0" src="http://shelr.tv/records/5368be5296608063a300006c/embed" id="shelr_record_5368be5296608063a300006c" border="0"></iframe>
|
||||
### 玩游戏 ###
|
||||
再Steam来之前Linux下就有许多游戏,并且很多都不需要图形界面比如NetHack,Robots和Greed.
|
||||
<iframe width="570" scrolling="no" height="418" style="border: 0" src="http://shelr.tv/records/5368ca4596608063a300006f/embed" id="shelr_record_5368ca4596608063a300006f" border="0"></iframe>
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxvoice.com/commandline-secrets/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.linuxvoice.com/issue-3-is-out/
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
在这个教程中,让我告诉你如何设置在Ubuntu 14.04 LTS的Apache网页服务器设置虚拟主机。请注意,这个教程只针对Ubuntu14.04的32位版本。
|
||||
我不能提出人和保证它也可以工作在其它更低的Ubuntu版本或者Ubuntu衍生物。
|
||||
我不能提出任何保证它也可以工作在其它更低的Ubuntu版本或者Ubuntu衍生物。
|
||||
|
||||
|
||||
###方案###
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
Ubuntu 14.04上怎样安装‘California’ 日历应用
|
||||
================================================================================
|
||||

|
||||
|
||||
**当非盈利软件安装Yorba时表明它开始用在被称为‘California’的桌面日历应用程序中,在上个月的 那段时间里我们都很兴奋,我们在自己的头条中进行了声明.**
|
||||
|
||||
那是非常好的理由,Yorba在背后支撑着用户体验好的电子邮件客户端软件‘Geary’以及照片管理软件‘Shotwell’.期望他们能够自然的成为linux系统的主流软件.
|
||||
|
||||
尽管 **California 尚未稳定** 到保证一个正式的发行版本,但现在将公司日常开发的PPA(Personal Package Archives)安装到ubuntu系统中是可使用的.
|
||||
|
||||
### 迄今取得的进展 ###
|
||||
|
||||
“*Neeeeeyaaaaaaaawwnnn!*” — 那是飞机即将降落在旧金山国际机场的一段警告声音.
|
||||
|
||||
是的,California 正在积极的开发中,该软件没有完成,也没有稳定到满足任何人每天使用,但是
|
||||
如果你能够很聪明的处理一些bug的话,你能够在ubuntu 14.04上安装这款应用程序
|
||||
|
||||
是否这样做取决于你的需要.
|
||||
|
||||
当前的构建提供了本地管理以及Google 日历和web日历的基本支持. 事件甚至在GNOME桌面
|
||||
的日期/时间小程序中显示.
|
||||
|
||||
#### 自然语言输入 ####
|
||||
|
||||
当你第一次打开California 软件时,当月的概要呈现在你的面前,目前还没有-至少我能够找到一种方法
|
||||
按星期,年,议程去查看. 尽管月份使用导航按钮,然而能够周期性的操作.
|
||||
|
||||
通过点击工具栏中的日历图标创建新的日历(*e.g., ‘work‘, ‘pet schedule‘*)及打开/关闭. 当所有的日历都展现在主窗口时,每个日历分配的不同颜色能够带来视觉的区分.
|
||||
|
||||
为了创建新的事件,点击‘+’图标, 然后在弹出的输入框中使用**自然语言输入**,输入你想要提交事件的描述. 例如, 输入内容“*Bake Sansa Stark A Lemon Cake on Wednesday 2.45 PM*”将嵌入新的条目在周三的这个时间(14:45).
|
||||
|
||||

|
||||
|
||||
我不能等待这个功能变得更加完善。现在,尽管它能够精准定位日期,但不支持经常性事件的创建
|
||||
(e.g., via “*Skype chat with Sam every Tuesday at 7 AM*“)也不能填写地点或人物(e.g., “*Coffee with Penelope on Monday 12 PM at Boston Tea Party*“).
|
||||
|
||||
为了能够更好的控制,你可以在网格视图上双击它们来完善和编辑创建好条目. 将打开一个包含附加字段、时间选择、日期格式等的窗口.
|
||||
|
||||
#### 缺乏光芒 ####
|
||||
|
||||
在外观上如果有一些缺陷被发现(这个阶段bugs和遗漏选项应该被忽略). 然而在 Adwaita看来已经很棒了,ubuntu默认主题下它看起来糟透了.
|
||||
|
||||
这不是Yorba的错误(或GNOME) 只是Ubuntu开发团队不再增加主题来支持GNOME新的GTK标题栏以及‘光主题’的模式对话框
|
||||
|
||||
California 在ubuntu系统上完全可用,恰巧运行在相似软件分发升级失败之后. 这个问题将不影响它们在ubuntu GNOME中的运行或第三方主题的切换
|
||||
|
||||
|
||||
### 在ubuntu14.04中安装California ###
|
||||
|
||||
如果你掩饰先前的警告, 我们再次重声:California 尚未稳定,正处于积极的开发中.
|
||||
|
||||
这个[Yorba Daily PPA][2] 包含最新(未稳定)的Shotwell和Geary版本. 将这个PPA安装到你的系统中将能够看到这些软件的更新.
|
||||
|
||||
sudo add-apt-repository ppa:yorba/daily-builds
|
||||
sudo apt-get update && sudo apt-get install california
|
||||
|
||||
可通过一个安全的方法来使用这个应用程序,便是[直接下载来自PPA的.deb安装包][3]:
|
||||
|
||||
- [Download California for Ubuntu 14.04 (64bit)][4]
|
||||
- [Download California for Ubuntu 14.04 (32bit)][5]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2014/05/california-calendar-app-hits-yorba-daily-ppa
|
||||
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.omgubuntu.co.uk/2014/04/yorba-california-calendar-app-linux
|
||||
[2]:https://launchpad.net/~yorba/+archive/daily-builds/
|
||||
[3]:https://launchpad.net/~yorba/+archive/daily-builds/+packages
|
||||
[4]:https://launchpad.net/~yorba/+archive/daily-builds/+files/california_0.1.0-0%7E188%7Eubuntu14.04.1_amd64.deb
|
||||
[5]:https://launchpad.net/~yorba/+archive/daily-builds/+files/california_0.1.0-0%7E188%7Eubuntu14.04.1_i386.deb
|
||||
@@ -1,141 +0,0 @@
|
||||
GOLinux翻译中
|
||||
|
||||
How to manage passwords from the command line on Linux
|
||||
如何在Linux上使用命令行管理密码
|
||||
================================================================================
|
||||
With password-based authentication so prevalent online these days, you may need or already use some sort of password management tool to keep track of all the passwords you are using. There are various online or offline services or software tools for that matter, and they vary in terms of their sophistication, user interface or target environments (e.g., enterprises or end users). For example, there are a few GUI-based password managers for end users, such as [KeePass(X)][1].
|
||||
在基于密码的认证在网络盛行的今天,你可能需要或者已经使用了某种密码管理工具来跟踪管理你正在使用的所有密码。有各种各样的在线或离线服务或者软件工具用于完成此类事情,而这些工具因复杂程度、用户界面或者目标环境(如企业或终端用户)的不同而各不相同。例如,有一些是为终端用户开发基于图形化的密码管理器,如[KeePass(X)][1]。
|
||||
For those of you who do not want any kind of GUI dependency for password management, I will describe how to manage passwords from the command line by using [pass][2], **a simple command-line utility for password management**.
|
||||
对于那些不想要依赖图形化进行密码管理的用户,笔者将会讲述如何在命令行下使用 [pass][2]来管理密码,**这是一个简单的用于命令行管理密码的工具**。
|
||||
The pass utility is in fact a shell script frontend which uses several other tools (e.g., gpg, pwgen, git, xsel) to manage user's password info using OpenPGP. Each password is encrypted with gpg utility, and stored in a local password store. Password info can be retrieved either via terminal or self-clearing clipboard interface.
|
||||
该密码工具实际上是一个shell脚本编写的前端,其中调用了几个其它工具(如gpg,pwgen,git,xsel)来使用OpenGPG管理用户的密码信息。各个密码使用gpg工具进行加密,并存储到本地密码仓库中。密码信息可以通过终端或者自清除的剪贴板工具取回。
|
||||
The pass utility is quite flexible and extremely simple to use. You can store each password info in an OpenPGP-protected plain text file, and group different password files into multiple categories. It supports bash auto completion feature, so it is very convenient to fill in commands or long password names using TAB key.
|
||||
该密码工具相当灵活,并且使用起来及其简单。你可以将各个密码信息存储到一个OpenGPG保护的普通文本文件,并且将密码文件分组放到多个类目中。它支持bash自动补全特性,因此可以很方便地使用TAB键来补全命令或者很长的秘密名称。
|
||||
### Install pass on Linux ###
|
||||
### 在Linux上安装pass ###
|
||||
To install pass on Debian, Ubuntu or Linux Mint:
|
||||
在Debian,Ubuntu或者Linux Mint上安装pass:
|
||||
|
||||
$ sudo apt-get install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
To install pass on Fedora:
|
||||
在Fedora上安装pass:
|
||||
|
||||
$ sudo yum install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
To install pass on CentOS, first [enable EPEL repository][3] and then run:
|
||||
在CentOS上安装pass,首先[启用EPEL仓库][3],然后执行以下命令:
|
||||
|
||||
$ sudo yum install pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
To install pass on Archlinux:
|
||||
在Archlinux上安装pass:
|
||||
|
||||
$ sudo pac -S pass
|
||||
$ echo "source /etc/bash_completion.d/password-store" >> ~/.bashrc
|
||||
|
||||
### Initialize Local Password Store ###
|
||||
### 初始化本地密码仓库 ###
|
||||
Before using pass utility, you need to do one-time initialization step which involves creating a GPG key pair (if you don't have one) and a local password store.
|
||||
在使用密码工具之前,你需要执行一次初始化步骤,该步骤包括创建一个GPG密钥对(如果你还没有)以及一个本地密码仓库。
|
||||
First, create a GPG key pair (i.e., public/private keys) as follows. If you already have your own GPG key pair, you can skip this step.
|
||||
首先,通过以下步骤创建一个GPG密钥对(即:公钥/私钥)。如果已经创建了自己的GPG密钥对,可以跳过此步骤。
|
||||
|
||||
$ gpg --gen-key
|
||||
|
||||
It will ask you a series of questions as shown below. If you are not sure, you can accept default answers. As part of key generation, you will set a passphrase for your secret key, which is essentially the master password required to access any password info stored in local password store. A successfully generated key pair will be stored in ~/.gnupg
|
||||
执行该步骤,会询问你如下问题。如果你不确定,可以选择接受默认回答。作为密钥生成部分,你将要为你的密钥创建一个加密口令,这个口令本质上是你访问存储在本地密码仓库中的任何密码信息时的主密码。成功创建密钥对后,创建的密钥对会存储在~/.gnupg目录中。
|
||||

|
||||
|
||||
Next, initialize the local password store by running the following command. For <gpg-id>, enter the email address associated your GPG key created above.接下来,运行以下命令来初始化本地密码仓库。对于<gpg-id>,输入上面创建密钥对时的关联电子邮件地址。
|
||||
|
||||
|
||||
$ pass init <gpg-id>
|
||||
|
||||
This command will create a password store under ~/.password-store directory.
|
||||
该命令会在~/.password-store目录中创建一个密码仓库。
|
||||
|
||||
### Manage Passwords from a Terminal with pass ###
|
||||
### 在终端使用pass管理密码 ###
|
||||
#### Insert new password info ####
|
||||
### 插入新密码信息 ###
|
||||
To insert new password info into local password store, use the following format.
|
||||
要将新的密码信息插入到本地密码仓库中,请遵循以下命令格式:
|
||||
|
||||
$ pass insert <password-name>
|
||||
|
||||
<password-name> is an arbitrary name you define, and can be hierarchical (e.g., "finance/tdbank", "online/gmail.com"), in which case the password info will be created in corresponding sub-directories under ~/.password-store
|
||||
<password-name>是你定义的专有名称,并且可以分级(如 "finance/tdbank", "online/gmail.com")。在这种情况下,密码信息可以存储到~/.password-store目录下对应的子目录中。
|
||||
If you want to insert password info as multi-lines, use "-m" option as follows. Type in password info in any format as you like, and press Ctrl+D to finish.
|
||||
如果你想要分多行插入密码信息,请像以下命令一样使用"-m"选项。以你自己喜欢的任何格式来输入密码信息,然后按Ctrl+D来结束。
|
||||
|
||||
$ pass insert <password-name> -m
|
||||
|
||||

|
||||
注:此图片暂时无法访问,不过可以直接访问flickr地址:https://www.flickr.com/photos/xmodulo/14129264286/ 文章发布的时候注意此处
|
||||
|
||||
#### View a list of all password names ####
|
||||
#### 查看所有密码名称列表 ####
|
||||
|
||||
To view the list of all stored password names, simply type "pass":
|
||||
要查看所有存储的密码名称列表,只需输入"pass"命令:
|
||||
|
||||
$ pass
|
||||
|
||||

|
||||
|
||||
#### Retrieve password info from password store ####
|
||||
#### 从密码仓库中取回密码信息 ####
|
||||
To access the content of a particular password listing, simply use the command below:
|
||||
要访问特定密码列表中的内容,只需使用以下命令:
|
||||
|
||||
$ pass <password-name>
|
||||
|
||||
For example:
|
||||
例如:
|
||||
|
||||
$ pass email/gmail.com
|
||||
|
||||
You will be asked to enter the passphrase to unlock the secret key.
|
||||
会要求你输入密码口令来解锁密钥。
|
||||
|
||||
If you want the password to be copied to the clipboard, instead of appearing in the terminal screen, use this command instead:
|
||||
如果你想要将密码复制到剪贴板,而不是显示到终端屏幕上,使用以下命令:
|
||||
|
||||
$ pass -c email/gmail.com
|
||||
|
||||
Once copied to the clipboard, the password will automatically be cleared from the clipboard after 45 seconds.
|
||||
一旦密码被复制到剪贴板,剪贴板在45秒后会被自动清空。
|
||||
|
||||
#### Generate and store a new password in password store ####
|
||||
#### 在密码仓库中生成并存储新密码 ####
|
||||
With `pass`, you can also generate a new random password which you can use for any purpose. pass will use pwgen utility to generate a good random password. You can specify the length of a password, or generate a password with or without symbols.
|
||||
使用`pass`命令,你也可以生成一个新的随机密码,该密码可用于任何目的。pass工具将会使用pwgen工具来生成一个好的随机密码。你可以指定密码的长度,或者生成是否带有符号的密码。
|
||||
For example, to generate a 10-character password with no symbol, and store it under "email/new_service.com" listing:
|
||||
例如,要生成一个具有10个字符不带符号的密码,并将它存储到 "email/new_service.com"列表中:
|
||||
|
||||
$ pass generate email/new_service.com 10 -n
|
||||
|
||||
#### Remove password info ####
|
||||
#### 移除密码信息 ####
|
||||
Removing existing password info is easy:
|
||||
要移除现存的密码信息是很容易的:
|
||||
|
||||
$ pass rm email/gmail.com
|
||||
|
||||
To summarize, pass is extremely flexible, portable, and more importantly, easy to use. I highly recommend pass to anyone looking for a simple means to organize any kind of private info in a secure fashion, without relying on GUI dependency.
|
||||
针对以上小结,pass是及其灵活,便于携带,并且更为重要的是,易于使用的一个工具。对于正在寻找能简单而行之有效地,安全地并且不依赖图形化管理任何私人信息的工具的人,笔者强烈推荐pass。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/05/manage-passwords-command-line-linux.html
|
||||
|
||||
译者:[GOLinux](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://xmodulo.com/2013/08/how-to-manage-multiple-passwords-on-linux.html
|
||||
[2]:http://www.zx2c4.com/projects/password-store/
|
||||
[3]:http://xmodulo.com/2013/03/how-to-set-up-epel-repository-on-centos.html
|
||||
Reference in New Issue
Block a user