Chaospace

Reshape the world by engineering chaos


  • 首页

  • 分类

  • 归档

  • 站点地图

  • 公益 404

  • 搜索

Python >>> import this

发表于 2016-05-21 | 分类于 软件

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Java, .NET ,Mono

发表于 2016-05-09 | 分类于 软件

Java 是 Sun 开发的跨平台语言,Java 编译出的程序运行在与平台无关的虚拟机 JVM 上,只要在各个操作系统之上实现了虚拟机,Java 就可以在其上运行。因为这一特性, Java 成为跨平台网络开发的首选语言。

这一点,显然是微软最不愿意看到的。微软希望所有的软件都只能在它的 Windows 操作系统中运行,这样就可以牢牢拴住用户,即使生产 Vista 这样的垃圾系统也能赚钱。所以,微软自己也发布一个所谓的“扩展” Java 虚拟机,但是这个 Java 版本只能用在微软自己的系统之上,不能用在其它平台,只能用于 IE 浏览器,无法用于其它浏览器。微软希望通过特意的设计,逐步消减 Java 的跨平台特征。

Sun 并没有束手就擒,面对这种卑劣的手段,只好于 1997 年提起诉讼,认为微软利用自己的垄断地位,破环 Java 的设计原则:

“Microsoft feared and sought to impede the development of network effects that cross-platform technology like Netscape Navigator and Java might enjoy and use to challenge Microsoft’s monopoly. Another internal Microsoft document indicates that the plan was not simply to blunt Java/browser cross-platform momentum, but to destroy the cross-platform threat entirely, with the ‘Strategic Objective’ described as to ‘Kill cross-platform Java by grow(ing) the polluted Java market.’”

微软败诉,只得放弃自己的 Java。并通过退出 .NET 来抗衡 Java。.NET 和 Java 都是中间层,但是和 Java 不同,.NET 并不提供跨操作系统的虚拟机,而是提供与语言关的环境。在 .NET 之上,可以使用 VB,VC 和 C# 进行开发,结果会编译成中间语言,实现与语言无关的特性。总体来说,.NET 还是十分出色的一个开发环境,具有许多优秀的功能。其最重要的目的,就是与 Java 在争抢网络开发上的地盘。

Mono 是 Linux 下的 .NET 开发工具,目的是使 Windows 下的程序更容易移植到 Linux,开发人员更快开始 Linux 下的开发。MonoDevelop 很好用,而且开发出了一些优秀的程序,例如 Beagle, Tomboy, Banshee 和 F-Spot 等。但是由于 Mono 和 .NET 的关系,很多人都害怕微软又会出什么招数,或者利用专利手段一下釜底抽薪,导致所有基于 Mono 的程序陷入困境。正如 Richard Stallman 所说:基于自由软件开发 C# 实现是值得鼓励的一件事,但是把 Gnome,把许多优秀的桌面程序建立在 C# 之上是一件危险的事情。

但是有一个公司并不用担心这个事情,那就是 Novell。因为 Novell 与微软达成的协议,即使 Mono 侵犯了微软的版权,微软也不会起诉这公司。这也就是 Mono 的开发者 de Icaza 受雇于 Novell,而且 Novell 大力支持 Mono 开发的原因。

也许有一天,微软会认识到开源是大势所趋,自由软件是软件这一生产形势的必然要求。但是在获得微软的完全授权之前,Mono 的命运总是不靠谱的。

2016-5 update

故事和预想的类似,微软最终将 Mono 纳入自己的手中。我们应该高兴,微软在这么多年中,终于有所改变,开始了很多开源的项目。

但是,还是那句话,任何严肃的开源开发者,都不应该将自己的工作建立在一个不稳固的基础之上。

The Matrix

发表于 2016-04-27 | 分类于 影视

系统结构

说说 Matrix 和 Zion 的体系结构吧。虽然这里边有一些问题我还没理清。

Matrix 实际是一个虚拟现实系统,其本身有着严密的逻辑,每一件事都在计算之中。(这也是 Oracle 能够预知未来的原因)这样的硬件体系其实是无法自我更新的,其中无可避免地牵扯到安全性的问题。

整个 Matrix 有一个 Kernel,也就是 Neo 要去升级的代码,为什么非要让一个人携带代码去升级呢?我们可以这样想,操作系统中对内存的管理是有讲究的,系统区、用户区的访问需要不同的特权级,比如你要修改系统区的某些部分,你必须要获得 0 级特权,这时问题就有了,如果你轻易把代码交给一个程序并让他获得 0 级特权,系统会很不安全。我们下面会分析,由于整个 Matrix 的程序设计思想,使得这种方法极其危险,并且事实上,Smith 就是这种设计思想带来的最大祸害。

我们接着说,为什么机器把代码交给人,利用人去升级,因为人具有自由意志,或者按我的说法,是一种“无限状态自动机”(非图灵机结构)。Matrix 连接人类,其实为自己提供了无限的升级可能。于是 Matrix 把代码存储在人那里,让人用自己的方法获得特权去读些所有的内存空间,这样比起用程序来,安全得多。下面我们就看看这是为什么。

Matrix 的设计思想是严格的对象封装,一个人,一个 Agent,一只鸟,乃至房子都是封装好的,并且区分了特权级。系统具有 0 级特权,读写所有内存,Agent 具有 1 级特权,可以读写除系统内存以外的内存。这也是为什么他们可以把自己复制到另一个身上去的原因。人互相之间不能读些,只能通过一些通用接口互相连接。这里“人”也是不同的,有的人是一个现实世界的人通过接口在 Matrix 世界里的实现,另一些人则是 Matrix 虚拟出来的。为了使这些人感觉起来像人类,Matrix 的计算模型是抢占式的多任务,所有的程序并发地争夺计算时间、存储空间及各种系统资源。这样很难保证系统的平衡,可是没关系,因为系统具有 0 特权级,系统时间是由他掌握并且分发的。

Smith 说掌握时间就掌握了一切,就是这个道理,程序之间的胜负,靠的就是计算时间的抢占。当 Smith 获得了 0 级特权,他就开始肆无忌惮地复制自己,分配计算时间,以至于威胁到了真正的 Kernel 的安全。可见,用程序升级程序是极端危险的,而人不会觊觎计算机的时间,他们是最安全的升级者。并且按前面的说法,由于人是无限状态自动机,他使得 Matrix 可以跳出窠臼,不断发展。尤其是当所有的人都视 Oracle 为先知的时候。Oracle 其实在精神上统治了几乎所有人,包括 Neo , Morpheus … Oracle 站在哪一边呢? 厚厚

接下要来的 Zion 由于处在系统外部,比较难以理解。究竟他是系统的一部分,还是一个真正的独立反抗机构。根据 Archetect 的话,Zion 就像一个回收站,所有要删除的人都被暂时安放在里边,定期清空一次。而且是为了升级系统而预留的,好让他们协助 “The One”。也就是说,Zion 中所有的人,包括 Neo 都是在系统计算之内的。这也就是为什么在 Neo 醒来之后,机器人发现并摘除了 Neo 身上的接口,却没有杀死 Neo 的原因。让理解了系统的人醒来,并安全送到 Zion ,是机器人的既定策略 (我曾经怀疑这个问题很长时间)。 Ps: 还有一部分能力很强的人被 法国人 收留,而且法国人显然是在一次次系统升级中保留的,一个看透了一切的旁观者

最后,我们看看这一次,也就是第六次的升级过程中,Matrix 里发生了什么。开始时,一直到第一集结尾,一切按部就班,Neo 获得了 0 级权限,计算机准备消灭 Zion,并让 Neo 为救 Zion 进入 Kernel 升级系统。如果没有 Smith,事情的发展应该是这样,乌贼冲进 Zion,玉石俱焚;Neo 冲入 Kernel,却发现其使自己别无选择的要成为一个牺牲者。然而系统出现了大错误,给了 Smith 系统最高权限。

致命的错误使得系统不得不让 Neo 离开,注意,第二集里 Neo 选择救 Trinity 是计算机“让”他离开的,因为 Smith 逐渐变得不能控制,需要一个能够控制他的进程去消灭它。可是 Neo 却一直不能回到 Matrix 内部,此时系统的情况已经不可收拾, Smith 占据大片内存空间,Kernel 实际被挤到一个角落。

可能你会问,为什么系统不直接删除 Smith 了事?这时大家可以想想杀毒软件是如何工作的。首先你必须获得病毒的特征码,然后再在系统中查找并且删除之,而这时系统根本没有 Smith 的特征码,想象一下,如果你被病毒搞到无计可施,你会怎么办?format C:,对吧。Smith 要的就是这个效果。恩恩

决战之前,Neo 来到了 Zero-One(详情见 Matrix 之 History of future)。计算机不得不定下城盟,实际也重新设置了一些系统参数,使得进攻 Zion 被放弃。Neo 进入了 Matrix,不断收集 Smith 的特征码。Smith 最终进入了 Neo 的内存空间,不断把自己复制过去,他没有想到的是,Neo 这时候已经成了一个管道,就是 Linux 里头的”|”。他的代码完全被 Kernel 掌握。于是系统启动了瑞星杀毒 33432,扫描内存,杀杀杀! 说到这里,我的观点是,虽然看上去人类在 Neo 领导下得到拯救,但是 Neo 死了。也就是说,这个 Neo 的命运和前几个 Neo 相比,并没有多少不同。 Neo 一直以为他自己能够做选择,能够成为救世主。最终,其宿命没有丝毫的改变。对电脑来说,这其中的波折,仅仅是 “a very dangerous game” 。

下一个 Neo 还会出现,为了对系统进行下一次升级。

人类,依然是被统治的,即使是 Zion 中的“自由人”。

天大的阴谋

Zion,从它一出现,就疑点重重 首先,Matrix 中的人醒来的时候,机器人可以轻而易举的把人杀死,但是机器人仅仅是把人头上的插头拔掉,把人施放,等待其他的人把他接走。Zion 中的飞船可以自由进入 “电池重地”,如入 无机(器人)之境。等人越聚越多的时候,才排出大批杀手机器人,使用重型钻地装备去消灭。机器人很傻么?机器人不怕牺牲么? 其次,Zion 的能源从哪来?这是一个始终没有解决的问题。既然机器人需要人做电池,那 Zion 从哪里获得能源呢? 一个很奇怪的现象,不知大家注意没有,Zion 的政权组织形式。有议会和议员,但显然,这些议员不是民选的,给我的第一感觉,他们经历了很多,知道很多。像圣战的最后生存者,像圣斗士里的童虎。 所有这些疑问,在 Neo 见到 Matrix 之父 Architect 之后,得到了解决。Matrix 中的程序会出现漏洞,如果放任这些漏洞不管,会引起系统崩溃。所以,Zion 作为系统的回收站而存在。而 系统不断的补充 Zion 中的人,为其提供能源,还有一个重要的目的,就是让他们找到 The One 来进行系统升级。而系统到现在,已经是第六代了。所以,议员们其实就是前几次升级后,The One 选出的 23 个人,他们重建了 Zion 他们知道他们的宿命就是找出 The One 去升级系统。 每一次,Neo 都完成了其升级系统的任务,就像是 Neo 自己的选择。而这一次,Neo 本以为他选择了另一条路,本以为他能够把握住他自己的命运。

History of future

资料来源 AnimMatrix ,没有看过这部动画的话,很容易对 The Matrix 三部曲所讲的故事产生误解。 这里仅讲述 其中的“第二次复兴” (The Second Renaissance). 所有事件发生在 The Matrix 所讲的故事之前。 一切从不远的将来开始,具有较高人工智能的机器人在各个领域服务于人类机器人听从人类主人的命令,不知疲倦的劳动

尽管机器人忠诚而纯洁,机器人没有获得人类的尊重。 直到有一天一个机器人 (B1-66ER) 突然“爆走”杀死了它的人类主人, 因为他的主人把它当成个人物品,要把它销毁。而它不想死。

人类认为机器人没有权力追求平等的生存权,并宣判了 B1-66ER 的死刑。

这引发了全世界机器人的游行抗议活动 Million Machine March

抗议活动受到“血腥”镇压

大部分的机器人被清洗,剩余一小部分迁徙到中东的机器人保留地 (Zero-one)

ps: 这就是在 The Matrix Revolutions 的最后,Neo 和 Trinity 冒死前往的地方。

在这里,人工智能迅速发展,很快,

Zero-One 在科技,经济上全面超过人类。

最终,引发了人类和 AI 机器人的全面开战。

在没有科技优势,没有工业优势的情况下,人类的战败是必然的。

战争中幸存的人类被“收集”起来,成了机器的永久能源。(详情见后文)

因为机器人发现人在没有思维活动的话,生存不了多久

所以,人工智能创造了一个与所有人的到脑相连的虚拟现实

以使得作为 battery 的人类以为自己仍然生活在 蓝天白云之下。

维护这个虚拟现实的程序,被称为 Matrix

语录

Morpheus: Do you believe in fate, Neo?

Neo: No.

Morpheus: Why not?

Neo: Because I don’t like the idea that I’m not in control of my life. Neo: And she’s (the Oracle) never wrong.Morpheus: Try not to think of it in terms of right and wrong. She is a guide, Neo. She can help you to find the path. Mouse: …Because you have to wonder now. How did the machines really know what Tasty Wheat tasted like. huh?. Maybe they got it wrong. Maybe what I think Tasty Wheat tasted like actually tasted like oatmeal or tuna fish. That makes you wonder about a lot of things. You take chicken for example, maybe they couldn’t figure out what to make chicken taste like, which is why chicken tastes like everything. Maybe they couldn’t figure out… (子非鱼,安知鱼之乐) Councillor Hamann(CH): … nobody cares how it works as long as it works. I like it down here. I like to be reminded this city survives because of these machines. These machines are keeping us alive, while other machines are coming to kill us. Interesting, isn’t it? Power to give life, and the power to end it.

Neo: We have the same power.

CH: I suppose we do, but down here sometimes I think about all those people still plugged into the Matrix and when I look at these machines, I.. I can’t help thinking that in a way, we are plugged into them.

Neo: But we control these machines, they don’t control us.

CH: Of course not, how could they? The idea’s pure nonsense, but… it does make one wonder just… what is control?

Neo: If we wanted, we could shut these machines down.

CH: Of course… that’s it. You hit it! That’s control, isn’t it? If we wanted, we could smash them to bits. Although if we did, we’d have to consider what would happen to our lights, our heat, our air.

Neo: So we need machines and they need us. Is that your point ?

…

Neo: Why don’t you tell me what’s on your mind, Councillor?

CH: There is so much in this world that I do not understand. See that machine? It has something to do with recycling our water supply. I have absolutely no idea how it works. But I do understand the reason for it to work. I have absolutely no idea how you are able to do some of the things you do, but I believe there’s a reason for that as well. I only hope we understand that reason before it’s too late.

活着的意义

在 Matrix 中,有一个人值得关注,那就是 Cypher ,即为了重新回到 Matrix 而成了“叛徒”的那个人。

Agent Smith: Do we have a deal, Mr. Reagan?

Cypher: You know, I know this steak doesn’t exist. I know that when I put it in my mouth, the Matrix is telling my brain that it is juicy and delicious. After nine years, you know what I realize? I gnorance is bliss.

Agent Smith: Then we have a deal? Cypher: I don’t want to remember nothing. Nothing. You understand? And I want to be rich. You know, someone important. Like an actor.

Agent Smith: Whatever you want, Mr. Reagan.

Cypher: Okay. I get my body back into a power plant, re-insert me into the Matrix, I’ll get you what you want.

这是在电影中唯一一个醒来以后还想回去的人。其他的人都认为自己被解放了,成了一个自由人。尽管吃的很难吃,尽管穿的很破旧,尽管每天都要面对死亡的压力。许多人还不停的送东西给 Neo,请他帮着把自己的亲人带过来。 这其实是两种对立的世界观,这种对立,在故事的极端情况中凸现了出来。Cypher 追求的是享乐,不管是真实还是幻影,不管自己是不是一个提供能量的电池,不管未来将会怎样,天天能够感到吃到美味的食物,过着奢侈的生活,成为一个名人,像一个演员一样,才是他的理想生活。对他来说,奋斗是没有意义的,Zion 中的艰苦生活是没有意义的。所以,忘记真实的一切,重新回到 Matrix 中,就是实现其目标的唯一途径。

Blue pill or Red pill, Which one would you take ?

隐喻

The Matrix 讲的是计算机和人的故事。

For computer, I know just a little. For human, even less.

对其中的一些东西的理解,大概可以用一些比喻来概括,有的没想好,暂缺。

Matrix <————————-> 操作系统
ZION <————————-> 需要定期清空的回收站
Neo <————————-> 系统更新程序
Smith <————————-> 杀毒软件
Oracle <————————-> 精神控制
Architect <————————-> ????
电话 <————————–> 接口程序
地铁 <————————–> 彩蛋
法国人 <————————–> ???

如何确定内核模块的维护者

发表于 2016-04-16 | 分类于 Linux
  1. 查看 MAINTAINERS 文件

  2. 使用脚本 scripts/get_maintainer.pl

    $ scripts/get_maintainer.pl -f drivers/usb/serial/ftdi_sio.c
      Greg Kroah-Hartman <gregkh@suse.de>
      Alan Cox <alan@linux.intel.com>
      linux-usb@vger.kernel.org
      linux-kernel@vger.kernel.org
    

Bash 脚本里面的旋转

发表于 2016-04-16 | 分类于 代码
while(true); do 
    for a in \\ \| \/ -; do 
        echo -n $a
        sleep 1
        echo -n -e \\r
    done
done

Linux 中的 Flash 文件系统

发表于 2016-04-06 | 分类于 Linux

作者: 华清远见嵌入式培训中心

嵌入式系统与通用 PC 机不同,一般没有硬盘这样的存储设备而是使用 Flash 闪存芯片、小型闪存卡等专为嵌入式系统设计的存储装置,本文分析了嵌入式系统中常用的存储设备及其管理机制,介绍了常用的基于 FLASH 的文件系统类型。

1.嵌入式系统存储设备及其管理机制分析

构建适用于嵌入式系统的 Linux 文件系统,必然会涉及到两个关键点,一是文件系统类型的选择,它关系到文件系统的读写性能、尺寸大小; 另一个就是根文件系统内容的选择,它关系到根文件系统所能提供的功能及尺寸大小。

嵌 入式设备中使用的存储器是像 Flash 闪存芯片、小型闪存卡等专为嵌入式系统设计的存储装置。Flash 是目前嵌入式 系统中广泛采用的主流存储器,它的 主要特点是按整体 / 扇区擦除和按字节编程,具有低功耗、高密度、小体积等优点。目前,Flash 分为 NOR, NAND 两种类型。

NOR 型闪存可以直接读取芯片内储存的数据,因而速度比较快,但是价格较高。NOR 型芯 片,地址线与数据线分开,所以 NOR 型芯片可以像 SRAM 一样连在 数据线上,对 NOR 芯片可以“字”为基本单位操作,因此传输效率很高,应用程序可以直接在 Flash 内运行,不必再把代码读到系统 RAM 中运行。它与 SRAM 的最大不同在于写操作需要经过擦除和写入两个过程。

NAND 型闪存芯片共用地址线与数据线,内部数据 以块为单位进行存储,直接将 NAND 芯片做启动芯片比较难。NAND 闪 存是连续存储介质,适合放大文件。 擦除 NOR 器件时是以 64-128KB 的块进行的,执行一个写入 / 擦除操作的时间为 5s;擦除 NAND 器件是以 8-32KB 的块进行的,执行相同的操作最 多只需要 4ms。NAND Rash 的单元尺寸几乎是 NOR 器件的一半,由于生产过程更为简单,NAND 结构可以在给定的模具尺寸内提供更高的容量,也就相应地降低了价格。NOR flash 占据了容量为 1―16MB 闪存市场的大部分,而 NAND flash 只是用在 8―128MB 的产品当中,这也说明 NOR 主要应用在代码存储介质中,NAND 适合于数据存储。寿命 (耐用性),在 NAND 闪存中每个 块的最大擦写次数是一百万次,而 NOR 的擦写次数是十万次。NAND 存储器除了具有 10 比 1 的块擦除周期优势,典型的 NAND 块尺寸要比 NOR 器件小 8 倍,每个 NAND 存储器块在给定的时间内的删除次数要少一些。

所有嵌入式系统的启动都至少需要使用某种形式的永久性存储设备,它们需要合适的驱动程序,当前在嵌入式 Linux 中有三种常用的块驱动程序可以选择。

  • Blkmem 驱动层

Blkmem 驱动是为 uclinux 专门设计的,也是最早的一种块驱动程序之一,现在仍然有很多嵌入式 Linux 操作系 统选用它作为块驱动程,尤其是在 uClinux 中。它相对来说是最简单的,而且只支持建立在 NOR 型 Flash 和 RAM 中的根文件系统。使用 Blkmem 驱动,建立 Flash 分区配置比 较困难,这种驱动程序为 Flash 提供了一些基本擦除 / 写操作。

  • RAMdisk 驱动层

RAMdisk 驱动层通常应用在标准 Linux 中无盘工作站的启动,对 Flash 存储器并不提供任何的直接支持, RAM disk 就是在开机时,把一部分的内存虚拟成块设备,并且把之前所准备好的档案系统映像解压缩到该 RAM disk 环境中。当在 Flash 中放置一个压缩的文件系统,可以将文件系统解压到 RAM,使用 RAM disk 驱动层支持一个保持在 RAM 中的文件系统。

  • MTD 驱动层

为 了尽可能避免针对不同的技术使用不同的工具,以及为不同的的技术提供共同的能力,Linux 内核纳入了 MTD 子系统 (memory Technology Device)。它提供了一致且统一的接口,让底层的 MTD 芯片驱动程序无缝地与较高层接口组合在一起。JFFS2, Cramfs, YAFFS 等文件系统都可以被安装成 MTD 块设备。MTD 驱动也可以为那些支持 CFI 接口的 NOR 型 Flash 提供支持。虽然 MTD 可以建立在 RAM 上, 但它是专为基于 Flash 的设备而设计的。MTD 包含特定 Flash 芯片的驱动程序,开发者要选择适合自己系统的 Flash 芯片驱动。Flash 芯片驱动 向上层提供读、写、擦除等基本的操作,MTD 对这些操作进行封装后向用户层提供 MTD char 和 MTD block 类型的设备。MTD char 类型的设备包括 /dev/mtd0, /dev/mtdl 等,它们提供对 Flash 原始字符的访问。MTD block 类型的设备包括 /dev/mtdblock0,/dev/mtdblock1 等,MTD block 设备是将 Flash 模拟成块设备,这样可以在这些模拟的块设备上创建像 Cramfs, JFFS2 等格式的文件系统。

MTD 驱动层也支持在一块 Flash 上建立多个 Flash 分区,每一个分区作为了一个 MTD block 设备,可以把系统软件和数据等分配到不同的分区上,同时可以在不同的分区采用不用的文件系统格式。这一点非常重要,正是由于这一点才为嵌入式系 统多文件系统的建立提供了灵活性。

2. 基于 Flash 的文件系统

鉴 于 Flash 存储介质的读写特点,传统的 Linux 文件系统己经不适合应用在嵌入式系统中,像 Ext2fs 文件系统是 为像 IDE 那样的块设备设计的,这 些设备的逻辑块是 512 字节、1024 字节等大小,没有提供很好的扇区擦写支持,不支持损耗平衡,没有掉电保护,也没有特别完美的扇区管理,这不太适合于 扇区大小因设备类型而划分的闪存设备。基于这样的原因,产生了很多专为 Flash 设备而设计的文件系统,常见的专用于闪存设备的文件系统如下:

  • Romfs

传 统型的 Romfs 文件系统是最常使用的一种文件系统,它是一种简单的、紧凑的、只读的文件系统,不支持动态擦写保存; 它按顺序存放所有的文件数据,所以 这种文件系统格式支持应用程序以 XIP 方式运行,在系统运行时,可以获得可观的 RAM 节省空间。uClinux 系统通常采用 Romfs 文件系统。

  • Cramfs

Cramfs 是 Linux 的创始人 Linus Torvalds 开发的一种可压缩只读文件系统在 Cramfs 文件系统中,每一页被单独压缩,可以随机页访问,其压缩比高达 2:1, 为嵌入式系统节省大量 的 Flash 存储空间。Cramfs 文件系统以压缩方式存储,在运行时解压缩,所以不支持应用程序以 XIP 方式运行,所有的应用程序要求被拷到 RAM 里去 运行,但这并不代表比 Ramfs 需求的 RAM 空间要大一点,因为 Cramfs 是采用分页压缩的方式存放档案,在读取档案时,不会一下子就耗用过多的内存空间,只针对目前实际读取的部分分配内存,尚没 有读取的部分不分配内存空间,当我们读取的档案不在内存时, Cramfs 文件系统自动计算压缩后的资料所存的位置,再即时解压缩到 RAM 中。另外,它的速度快,效率高,其只读的特点有利于保护文件系统免受破坏,提 高了系统的可靠性; 但是它的只读属性同时又是它的一大缺陷,使得用户无法对其内容对进扩充。Cramfs 映像通常是放在 Flash 中,但是也能放在别的文 件系统里,使用 loopback 设备可以把它安装别的文件系统里。使用 mkcramfs 工具可以创建 Cramfs 映像。

  • Ramfs/Tmpfs

Ramfs 也是 Linus Torvalds 开发的,Ramfs 文件系统把所有的文件都放在 RAM 里运行,通常是 Flash 系统用来存储一些临时性或经常要修改的数据,相对于 ramdisk 来说,Ramfs 的大小可以随着所含文件内容大小变化,不像 ramdisk 的大小是固定的。Tmpfs 是基于内存的文件系统,因为 tmpfs 驻留在 RAM 中,所以写 / 读操作发生在 RAM 中。tmpfs 文件系统大小可随所含文件内容大小变化,使得能够最理想地使用内存;tmpfs 驻留在 RAM,所以读和写几乎都是瞬时的。tmpfs 的一个 缺点是当系统重新引导时会丢失所有数据。

  • JFFS2

JFFS2 是 RedHat 公司基于 JFFS 开发的闪存文件系统,最初是针对 RedHat 公司的嵌入式产品 eCos 开发的 嵌入式文件系统,所以 JFFS2 也 可以用在 Linux,uCLinux 中。JFFS 文件系统最早是由瑞典 Axis Communications 公司基于 Linux2.0 的内核为嵌入式系统开发的文件系统。JFFS2 是一个可读写的、压缩的、日志型文件系统,并提供了 崩溃 / 掉电安全保护,克服了 JFFS 的一些缺点: 使用了基于哈希表的日志节点结构,大大加快了对节点的操作速度; 支持数据压缩;提供了“写平衡”支持; 支 持多种节点类型;提高了对闪存的利用率,降低了内存的消耗。这些特点使 JFFS2 文件系统成为目前 Flash 设备上最流行的文件系统格式,它的缺点就是当 文件系统已满或接近满时,JFFS2 运行会变慢,这主要是因为碎片收集的问题。

  • YAFFS

YAFFS/YAFFS2 是一种和 JFFSx 类似的闪存文件系统,它是专为嵌入式系统使用 NAND 型闪存而设计的一种日 志型文件系统。和 JFFS2 相比它 减少了一些功能,所以速度更快,而且对内存的占用比较小。此外,YAFFS 自带 NAND 芯片的驱动,并且为嵌入式系统提供了直接访问文件系统的 API,用 户可以不使用 Linux 中的 MTD 与 VFS,直接对文件系统操作。YAFFS2 支持大页面的 NAND 设备,并且对大页面的 NAND 设备做了优化。 JFFS2 在 NAND 闪存上表现并不稳定,更适合于 NOR 闪存,所以相对大容量的 NAND 闪存,YAFFS 是更好的选择。

具体的嵌入式系统设计中可根据不同目录存放的内容不同以及存放的文件属性,确定使用何种文件系统。

  • UBIFS

诺基亚开发的新文件系统,意在取代 JFFS2.

Kill software patents

发表于 2016-04-06 | 分类于 开源

By Pieter Hintjens

Online on: 31/10/2006

I know that many people come to the FFII—as I did—because they feel a deep sense of injustice at how the smaller players in IT are consistently squashed by special interests and monopolists. But I’m going to look at our core concern—software patents—from a different angle, one based more on economics and less on emotions.

The simple question “what’s wrong with software patents?” stirs up controversy and divides the IT industry into two camps like no other. Every group has their own ideology about software patents. Those who don’t like them claim that they are anti-competitive, that they are tools used by industry giants to crush free and open software, that they are bad for innovation, that they are monopolies, etc. Those who like them claim that they are simply units of intellectual property, to be traded like any other commodity.

What is property?
All property is a monopoly. All property can be traded, bought and sold, and can make money for its owners. The state can declare any resource it likes to be “property”. We are, as citizens, property of the state, and in some countries we can still be traded, bought, and sold, and make money for our owners.

But these are useless truisms. I can make tenuous comparisons between patents and slavery, and stir up all kinds of emotions. I’m not going to do that. Instead, I’m going to look at the very meaning of property, and explore the dynamics that drive the basic notions of “private property”.

Property, of any kind, consists of a definition and a system of enforcement. All the rest is subjective. There is no intrinsic reason that land or potatoes should be different from ideas, time, or air. Anyone who argues that it is “right” or “wrong” to define and enforce certain types of property must prove this using more than just rhetoric and dogma.

The case for private property
Let’s look at a well-understood form of property: land rights. Most countries are divided up into plots large and small. The very concept of “country” is property, but a thousand years ago, only a small part of the world’s surface, in and around human habitations, was considered property. The rest was common lands, belonging to all and none. The process of turning common lands into shared property, and then into private domains (the “tragedy of the commons”) was driven by discussions very similar to the ones we hear today. The process was driven by greed to some extent, but also by real needs of evolving economies driven by new technologies in agriculture and industry.

A farmer who owns his land is far more likely to look after it than a farmer working on a collective. Similarly, it is clear that private home ownership is a healthier model in a modern money-based economy than state-ownership of homes. Private ownership of some things works very well.

The case for common property
However, this is not the whole story. Private ownership is not a panacea, and for every example where private ownership is “right”, I can find one where it is “wrong”. The roads and streets that connect those farms and houses are owned and managed collectively. The rain, air, and sun is owned by no-one. The wild animals and insects that form an important part of the ecology are collectively owned.

The five principles of property
There are actually good economic reasons for choosing a private property model for some resources, and not for others. There are five key rules to consider (there may be more, these are the most obvious ones to me):

Is the resource mobile, or fixed? This criteria defines whether it is possible to accurately define the resource, or not. A mobile resource—such as migrating birds or fish—does not fit the private property model. Fixed resources, such as lobsters, do.
Does the resource have clear boundaries, or not? This criteria defines whether it is possible to accurately enforce the monopoly, or not. Land can be well-defined. Art cannot be well-defined.
What generates more wealth—exclusive ownership or sharing? This criteria defines whether it is useful to consider this resource as property at all. Exclusive ownership of a house generates wealth, but exclusive ownership of roads does not (which is why we removed toll bridges on our roads).
Is the property system economical? In other words, is the definition and enforcement of the property cheap? If so, it is accessible to all. If not, it becomes a priviledge of the rich, and the system itself stops being economically neutral.
Is the property system well-bounded? In other words, is the definition of the property clear and unnegotiable? If the definition can be manipulated and changed, then the system that manages it will grow in an unsafe manner.
All forms of property can be tested against these five rules. The rules are, ultimately, self-enforcing because any society that ignores them will find itself paying the cost, and competition between societies punishes those that choose inefficient economic models.

The dangers of bad property systems
A well-defined property system can be incredibly powerful, and badly-defined property systems can be very damaging. I’d argue that what brought down the Soviet Union was not the political system, nor military spending, but simply the fact that private ownership of farms and houses was impossible. There is a direct relationship between house prices (which mainly depend on availability of land) and economic growth, in many countries. Home ownership creates a middle class, which is the main driver of modern economies.

Let’s see what happens when we break the rules. If we try to create monopolies on mobile resources, we over-exploit those resources. If we try to enforce monopolies that don’t have clear boundaries, we spend a lot on lawyers. If we create monopolies on resources that should be shared, we lose competitive advantage. If we create expensive property systems, we unleash special interests. And if we create unbounded property systems, those special interests will grow out of control.

Property systems for the software business
So I’ve defined five economic rules that we can apply to any form of property to measure whether it is a good, or bad, concept. Let’s now apply these to the main forms of property that are used in the IT sector, and see what we get. The four main property forms are: copyright, trademark, patent, and trade secret (which though not defined as IPR, is a real and useful form of property):

Copyright: it applies to a fixed resource: a self-defining written expression. It has clear boundaries (the document or work). Exclusive ownership does produce wealth, but sharing seems to be a stronger driver, and models such as the GPL that encourage both appear to be the most efficient at producing value. The copyright system is cheap and well-bounded, except when it comes to lifespans, and we’ve seen copyright terms extended to life+70, which is extraordinary in today’s digital era.
Trademark: it applies to a fixed resource: a name, logo, or phrase. It has clear boundaries (the mark). Exclusive ownership produces the most value—sharing of marks just weakens them. The trademark system is very well-bounded, though it could be cheaper.
Software patent: it applies to mobile resources: new ways of doing things, or methods. It has unclear boundaries (methods are difficult to define absolutely, and they overlap in horribly complex ways). It uses exclusive ownership for resources (new ideas) that produce much more value when shared. It is poorly bounded (it depends on a set of negotiable definitions such as “technical effect”), and it is very expensive.
Trade secret: it is fixed (in your firm). It has clear boundaries (individuals may not pass secrets outside the defined group). It depends on exclusive ownership. It is a well-defined system that is easy to apply, and cheap (based on simple contract).
The conclusions are clear: copyright, trademark, and trade secret are good forms of property for the software business, though copyright terms are a problem. Patents are a bad form of property for the software business, because they amplify the general weaknesses of the patent system:

Patents claim to own ideas, which are highly mobile resources, and in software, more mobile than most other industries.
Patents have unclear boundaries, and in software these boundaries are even less clear than in other industries.
Patents reduce the sharing of new ideas, and software depends on a higher volume of sharing of ideas than other industries.
Patents are an expensive property system, and most software innovation is driven by unfunded grass-roots work.
Patents are not a well-bounded property system, and in software a boundary between “good” and “bad” patents cannot be drawn.
It is significant, in my opinion, that patent industry has focussed almost exclusively on weakening the definition of software patents, and on strengthening their enforcement. There has been little or no discussion about the basic justification for creating this form of property, apart from the uselessly broad claim that “ownership of [certain classes of] ideas promotes investment in innovation [in certain sectors]”. This claim, which has always underpinned the patent system has been used to justify a gold rush, a land-grab of ideas in sectors where innovation actually depends on sharing, not exclusion.

Software patents are a new toll barrier
Many industries find that poor quality patents are a problem. But no other industry that has relied extensively on copyright has been subjected to patenting. The use of patents in software looks a lot more like the errection of a massive new system of private tolls and taxes, than the enablement of a new properties class.

Software patents were enabled in the USA in 1982 by a Supreme Court decision. After almost twenty-five years, we would expect to see this new form of property either proven, or disproven. The bulk of the software sector should, by now, be using patents as their primary tool for justifying new investments. There should be software patent success stories, to match the many success stories that were and are driven by other forms of intellectual property.

These success stories are just not there. Instead, we see a sorry parade of lawsuits. IBM—who has the largest software portfolio, and who has claimed that it is against business method patents—has just sued Amazon for infringing on several business process patents.

Conclusion
In this article I’ve examined software patents from the fundamentalist view point of how well a property system functions. This is not art, but science. We can document and measure, and we can prove or disprove property systems.

No sane person can claim that all private property is good, or that all private property is bad. Would it make sense to sell off all our streets to private owners? Would it make sense to allow individuals to collect tolls on bridges, borders, crossings, and rivers? All these property systems have been tried. There is no firmer believer in private property and punitive enforcement than a warlord.

No honest person can claim that it’s a choice between “privatising everything” and “an anti-property communist state”. The choices are between models that work, and models that do not. History is filled with examples and experiences, and we must recognise and learn from those models, or we will make stupid and avoidable mistakes. There is, behind our iMatix building in Brussels, a street that was privatised some decades ago. I’ve no idea what the intention was, but today we can see the results via Google Maps. The privatised street has become a wasted area, a car park, filled with weeds.

This is what’s wrong with software patents.

Free as in Freedom

发表于 2016-04-06 | 分类于 开源

Richard

Richard Matthew Stallman, the father of the GNU movement once gave a talk at the Australian National University where he explained his stand on the name GNU/Linux, the Digital Millennium Act, DRM which Stallman chooses to call Digital Restriction Management and software idea patents. He talked for over one hour explaining and throwing light on these and many other topics of interest to GNU and all freedom loving people.

RMS on why people should call it GNU/Linux instead of just Linux

… So the goal we had set out to reach in 1984 had been reached (with the development of the Linux kernel). But at the same time, a confusion developed, we started thinking that the entire operating system was Linux. And this confusion was a serious blow to the free software movement. Because, before that time, the people who saw various pieces of GNU knew that they were doing so and they became GNU fans. And so when they came across the articles written about the philosophy of GNU, they wouldn’t guarantee to agree with us but at least they would pay serious attention and say we are fans of GNU and this is the philosophy of GNU.

After there was a complete GNU system with Linux that you could get to run, people started thinking that it was Linux. But before that point, our software spread the philosophy and our philosophy help spread the software because when the people read this, if they agree, they will be motivated to develop more free software and add to GNU.

However after people started using essentially the GNU system with Linux added, and called it Linux, it no longer led then to the philosophy associated with GNU - the philosophy of free software. Instead of that, the people read the philosophy that was associated with the name Linux. The apolitical philosophy of Linus Torvalds who thinks that all software licences are legitimate and it is wrong ever to violate them. So his views on this are more or less the same as Microsoft’s. Now he of course has the right to promote his views but I object to our work becoming the main basis for promoting his views because it is attributed to him directly by labeling the GNU system as Linux. And that is why I ask people to call the system as GNU/Linux.

Give us equal mention. We need it. We need it not just because it is fair but because it will help people recognize what we have done so they will think about what we are asking them help us do. Our work is not finished. People will sometimes give me advice which in other circumstances might have been wise. They would say, it looks bad to ask for credit. And so they say, when the people call the system Linux, smile to yourself and take pride in a job well done. This would be very wise advice if it were true that the job is done. We made a great beginning. We have developed more than one free operating system in our community and many free application programs. But there are many application programs we still have to develop. We have developed free operating systems used by 10’s of millions of users. But there are 100’s of millions of users of proprietary operating systems and even the people using free operating systems often use proprietary programs on top of that. So we have a tremendous amount of work to do.

RMS on Digital Millennium Copyright Act and DRM

…

Today the main question is whether we would be allowed to develop the software that the users want. In the US, there are already two laws forbidding the development of various kinds of free software. One of these laws is the Digital Millennium Copyright Act - The law that forbids free software to access encrypted or some how blocked off data. This law was used to prohibit the free software from playing a DVD. If you buy a DVD in the US, it is legal for you to watch the movie. But the free software that would enable you to do this on your free GNU/Linux system has been censored completely. There is in fact no lawfully available software in the US that you could use to watch a DVD.

But I am afraid, they have carried this even further. There is a certain computer game that is accompanied by a network server that allows people to play against each other and they communicate with some kind of cryptic protocol. And people figured this out and implemented their own server and they have their own free game which is some what similar. They wrote it themselves and is not a modified work within modified proprietary game that won’t have been illegal anyway. So they wrote their own game and they have their own server. And you could use either game and talk to either server. And they were sued. A court ruled that these free alternatives are illegal ones under the digital millennium copyright act. Now please note that using either one of these free alternatives doesn’t enable one to use the proprietary one without paying. We have here two separate products being tied together through the use of this law.

The Digital Millennium Copyright Act is used to impose DRM (Digital Restriction Management) on the public. So they are not satisfied with prohibiting people from sharing with their neighbours. They want to redesign your computer system to stop you from sharing and this is wrong. DRM is fundamentally wrong in itself because it stops people from cooperating with their neighbours. And a government of the people, by the people and for the people will not enact laws that support DRM in any way. So that is one law which prohibits certain kinds of free software.

RMS on Software Idea Patents

Another law in the US which prohibits free software from any progress of any kind is the patent law. In the US, any kind of software idea for use in any kind of software can be patented by some one. Which means that when you implement that idea, you could get sued. Now large programs combine many ideas. A program can combine easily 100’s or 1000’s of different ideas. And if any one of these ideas is patented, your chances of developing a large program without infringing many patents is absurdly small. So software patents are obstacles to all software development. And they threaten users as well. The users can also get sued for the software they are using, for the way they have configured their machines and so on.

And this is advertised as a scheme to promote progress. But economic research shows just the opposite. Now I used to ask people to imagine how many different patents one program could be implemented by at once. I would say dozens, may be 50. Well now we do not have to imagine. Somebody did a study, must have been a lot of work. He took one particular program named Linux - the kernel of the GNU/Linux system. And he checked for all the US patents that covers something that could be found somewhere in Linux. He found 286 different US patents that covers parts of Linux. And Linux is just one part of the system. I saw an estimate somewhere else that it was 25 % of the system.

So if we note, we can get a rough estimate of around a 100,000 or so different software idea patents in the US that would cover ideas used some where in GNU/Linux system of today. Of course, it is a rough estimate and it wouldn’t surprise me if it were only 30,000 or as much as 300,000. So now you see the danger. And since this danger is not only for free software developers but for all software developers aside perhaps from the mega corporations, there is actually a very broad movement against the software idea patents. This movement which I am led to say I played a major role in starting about 40 years ago has actually persuaded the European Parliament which voted to reject software idea patents. Now European Union is set out to have only a little democracy in it. … The process is not over yet and we are still fighting it but there is a good chance that we can win at the level of the European Union. Of course Microsoft wants software idea patents. Microsoft has stated that it intends to use software idea patents to kill off GNU/Linux.

RMS on developing a free Java platform and on Flash and MS Word file formats

(This is not a problem since Sun opens Java,maybe we make Flash our next target.)

One of the big dangers in our community is that people start putting non-free software into the system and they call it bonus. They say it is a nice addition, it gives more features. Yes it gives you more features at the cost of your freedom. When these things are distributed separately, they call it value added packages. And that term makes it stick about your values. It says it values your convenience only, don’t value your freedom. So I prefer to call them freedom subtracted packages. That makes a statement about my values.

But they also include them, incorporate them in various distributions of GNU/Linux system. For instance, Sun has a version of the GNU/Linux system which they call the Java Desktop. Now they are not giving credit either to Linux or GNU but that is not an important issue when we look at what they are doing which is really bad that is, including several non-free programs including Sun’s Java platform. Sun’s Java platform is not free software. You shouldn’t install. If you do install it, you are putting yourself at risk of creating other problems for other people. There are people who are so attracted to java - they think this idea that will run on all platforms is so exciting - that they stop paying attention to things like what to pay attention to. They will write programs in java, they will write free programs in java and offer to people and it turns out it doesn’t run on all platforms, it doesn’t run on a free platform.

You see, we have free java platforms. But they don’t implement all features yet. Sun keeps on adding features and our efforts are speeding up but they are still behind. So many of the java libraries or the newer language features, we don’t have yet. So if you use them in your free program, it would run on a free platform and you will find that your program is actually an inducement to people to install non-free software. The same thing is happening when websites use java or websites use flash.

The use of flash websites is a major problem for our community. People are working in free software for playing flash. And now it more or less handles just the display of things but it doesn’t handle reading input. If you see a website using flash, complain. Complain to the site developer saying you are excluding people who believe in maintaining their freedom. Please get rid of the flash from your site.

A similar problem occurs when people distribute files in word format. And peoples approach to this used to be find some way to arrange to read it. And I pointed out that this is actually not a right response in the long run. You see, people worked on figuring out the details of the secret of word format. And figured out a lot of them. So there is free software today like openoffice that can read word files. But it is still short term thinking just to address this problem as right because Microsoft can keep changing the word format. And every time they make word files in this new format and they send to other people and other people can’t read them. And so they feel like have to upgrade word as well and the result is a large number of these windows users are using new version of word and they send us these word files in a different format which our software can’t read. And maybe it is patented and we will get sued if we make our free software read.

To solve this office problem, we have to remove Microsoft’s control over the language that people use to communicate with each other and with themselves - like saving your files so you could read your files later. We have to refuse to use word format for this. When people send you a word file, therefore don’t cope with the situation by reading it. Instead it is much better to send back a message saying - please don’t ever send me word files. This is contributing to a serious social problem. But send it in public documented formats which everyone is free to implement so you are not giving a particular company any power it shouldn’t have.

Fundamentally, the use of non-free software program gives somebody power of the kind that nobody should have. And therefore software should be free. Computer users should always have the freedom to control their computers. And they should be free to cooperate with each other in doing so.

RMS on Free software Vs Opensource

… In 1998, some of them started another way of talking about free software where they call it opensource. And with this different name, they have associated a different set of ideas. They don’t say that this is a matter of the freedom that every user should have. In fact, they would often say that they recommend a development methodology which they say will generally produce more powerful and reliable software. And that may be true. I hope it is true. It would be nice if freedom provides as a byproduct, security of software. But it is a terrible mistake, I think, to focus all the attention on these short term practical benefits and ignore freedom itself. The danger is, then people would fail to defend their freedom when it is threatened as they wouldn’t recognize what it is.

So if you imagine two people, one who is convinced by the opensource philosophy and another who is convinced by the free software philosophy. And you show these people a powerful, reliable, convenient, non-free program. What are they going to say ?

The opensource guy would say - “I am surprised you were able to do such a good job without letting the users study the code and find the bugs for you. But I can argue with the facts. It seems a powerful and reliable program”. And he will probably use it. Where as the free software person will say - “I don’t care how powerful and convenient it is if it takes away my freedom. I wouldn’t pay such a high price for that convenience. I am going to get to work on a free replacement for this program right away before anybody else get tempted to use that program”.

One person would give up his freedom when ever you can offer him convenience in its return and the other would fight for his freedom. And if enough of you fight for your freedom, freedom may prevail.

RMS on RMS

GPL

Now people sometimes have accused me of having a holier than thou attitude. I think that is not actually true. I don’t criticise and condemn people just because they don’t stand up for free software strongly as I do. As long as what they are doing is good, I will say what they are doing is good and I might suggest somethings they could do.

However, I do have a holy attitude because I am a saint. It is my job to be holy. I am saint iGNUcius of the church of Emacs. I bless your computer my child. Emacs started out as a text editor which became a way of life for many users because it could do almost everything without exiting Emacs. And ultimately a religion. We even have a great schism between two rival versions of Emacs. And now we have a saint too. Fortunately no gods. In this church, instead of gods, we have an editor.

To be a member of the church of Emacs, you must recite the confession of the faith. You must say, there is no system but GNU and Linux is one of its kernels. The church of Emacs has certain advantages compared with some other churches. To become a saint in the church of Emacs does not require celibacy. However, it does require living a life of moral purity. You must exorcise the evil proprietary operating systems that posses what ever of the computers under your control and install in all of them a holy free operating system instead. And then, only install free software on top of that. If you make this commitment to live by it, then you too would be a saint and you may eventually have a halo if you can find one because they don’t make them any more.

Sometimes, people ask me if it is a sin in the church of Emacs to use the editor Vi. It is true that Vi-Vi-Vi is the editor of the beast. But using a free version of Vi is not a sin but a penance. And sometimes, people ask me if my halo is really an old computer disc. This is not a computer disc. It is my halo. But it was a computer disc in a previous existence.

Firefox 的意义

发表于 2016-04-06 | 分类于 技术

1、Firefox 的出现促进了竞争,使用户得到了好处很多人也许没有体会到,他们虽然是 IE 的用户,但是他们却是 Firefox 出现的最大受益者。从 99 年前后 IE3、IE4 通过捆绑战术打败 Netscape 之后到 2004 年 Firefox 大流行之前,IE 发布了三个版本,但是没有任何的实质性改进。 没有改进是因为 IE 没有缺点么?当然不是,这数年间多少病毒通过 IE 漏洞传播,多少恶意插件通过 IE 横行。以恶意插件为例,其实解决恶意插件技术上难度很 大么?IE 上面提供一个插件管理器功能,就可以完全解决这个问题。然而这个技术问题前不久才在 XpSp2 版本中得到解决,为什么?原因很简单,没有竞争, 你不喜欢 IE 也没有办法,只有用。IE7 目前宣布的特性中,最引人注意的标签浏览,Rss 支持,增强的安全性,都是 Firefox 比 IE 老版本强的地方。这也让我们发现,IE 用户之所以有新版本新特性可用,正是因为 Firefox 的出现给 IE 的垄断地位造成了威胁。所以 IE 用户是 Firefox 流行的最大受益者。

2、Firefox 的出现有利于推广 W3c Web 标准化的网站设计

W3c web 标准化设计思想要求把网页中的内容和样式分开,不使用 Table 进行布局。这样的好处是节约网络带宽,提高网页渲染的速度,降低浏览器的内存占用, 提高网站设计的效率,利于在不同设备里面浏览等等。这些我们这里不展开讲了,不然再写两三篇文章也说不完。大家可以去看《网站重构》 一书。然而这种设计思想和 W3c 标准长期被网站设计师们忽视,甚至故意的违反。这是因为市场上长期 IE 占有绝对多数的市场分额,而 IE 对 W3c 标准的支持 很差。在 IE 和 Netscape 的大战期间,微软为了得到垄断地位,也为了给潜在竞争者设置障碍,给 IE 增加了很多专有 Html 标记。这些标记很多都违反 了内容和样式分开的原则,还有些有专利和其他法律上的壁垒。这样就给其他 的浏览器发展造成了障碍。这形成了 一个恶性循环,使用这些非标准元素的网站越多,那么 IE 的垄断地位就会越稳固,而 IE 的垄断地位越稳固,使用这些非标准元素的网站也就会越多。然而正如前 面说的 IE 的垄断地位一旦固若金汤,微软就会不在乎用户需求,一意孤行。用户的合理要求就会被忽视。很多人埋怨手机上面的 Wap 页面太简单,网站太少。然 而大部分 Web 网站在手机上面也会变得支离破碎,甚至完全无法浏览。但是他们可能不知道的是,如果网站比较严格的遵守了 W3c 标准,那么在大多数手机里面 网站是可以正常浏览的(当然尺寸受到限制,显示的样子会有些差异),现在大部分智能手机是可以直接浏览 XHtml 网站的。然而,那些使用了 IE 非标准扩展 的网站在手机和其他移动设备一般都是无法浏览的,甚至可能会造成浏览器死机。也就是说,如果 Firefox 或者其他的比较符合 W3c 标准的浏览器更早的流 行的话,那么更多的网站就会支持 W3c 标准,我们早就可以在移动设备上面随意冲浪了。

3、Firefox 的出现有利于提高网络安全恶意插件方面有一种对 Firefox 安全性的误解说,”Firefox 的安全性来自用的人比较少,所有没有针对 Firefox 的恶意插件”。我经常听人提到这种误解,不光是不喜欢 Firefox 的人有这种误解,我发现很多非常喜欢 Firefox 的人也有这种误解,甚至因为这个误解他们说不要推广 Firefox 以免 Firefox 被恶人盯住。 这种误解来自于对恶意插件猖獗现状的误解,实际上恶意插件并不是一种技术上很难防止的东西。前面我们也提到了,微软如果做一个插件管理器就可以解决 99% 的恶意插件了。现在恶意插件猖獗是微软因为没有竞争而不愿意投入人力和财力在 IE 安全性提高上面造成的。Xp2 sp2 在 Firefox 的压力下,推出了插件管理器,虽然不能彻底解决问题,但是微软为了避免 IE 失去优势,必然会在 IE7 对这个功能进行增强。现在 Firefox 上面没有一个恶意插件流行的主要原因是, Firefox 在插件安装方面要检查用户确认网站安全,随时可以删除插件,以及比较完善的插件安全模型。Firefox 比较完善的插件安全模型这点也很重 要。实际上 Firefox 的插件运行在 Firefox 的环境之中,他无法对 Firefox 以外的存储空间和用户信息进行破坏。这个 IE 的插件模型迥异,微 软的 IE 插件模型实际上是 ActiveX 是 COM,COM 是运行在整个操作系统范围内的,如果插件愿意甚至可以直接格式化用户硬盘。当然微软也有安全模型 来限制 IE 插件,比如插件不能自动安装等等,不能操作用户硬盘等等。但是 3721 等等非常强硬的恶意插件的泛滥证明微软的安全模型的脆弱(3721 可以不 经用户允许就安装,还好他只是个恶意插件,他是病毒用户又会怎么样?)软件漏洞造成的安全问题方面前 些日子 Firefox 发现第一个漏洞的时候,许多美国媒体如获至宝大肆宣扬。这也反衬出来 IE 的安全性有多差,现在 IE 出现漏洞已经不算新闻了。据说刘蝶 雨在 IE 身上曾经连着 7 天找到 7 个漏洞。我们说软件有 Bug,有漏洞是难免的,这没有办法。微软家大业大,IE 程序非常复杂,有些漏洞不是什么不能原谅的 问题。但是问题在于对漏洞的反应:
根据安全公司 Secunia 的统计,2003 年至 2005 年,Secunia 针对 Firefox1.x 发布了 22 个安全警告,基本都是低危级;而同期针对 IE6.x 的警告有 85 个,高危级不在少数。Nitot 将这种情况比作手指受伤与掉脑袋的区别。
Firefox 对发现的漏洞都是很快的解决和发布,当然这不光光是因为 Firefox 的开发者勤奋,这也跟开源软件的组织方式和管理方式有关。
Mozilla 欧洲总裁 Tristan Nitot 周一表示,一旦 Firefox 出现漏洞,Mozilla 会迅速作出反应,在最短的时间里为用户提供解决方案,而微软在这一点上要差很多。

Nitot 举例说:”9 月 6 日,Mozilla 接到了一个 IDN 缓冲问题报告;8 日,该问题被意外公开;9 日,我们通过改变设置暂时解决了这个问题,用户可以手动作出改变后者打上补丁;十天之内,我们发布了新版本,问题完全解决。”
然而 IE 的漏洞被发现以后,微软公司极少在短期内就作出解决的。

4、Firefox 其实更简单更好用很 多人凭着随便一用就下结论说 Firefox 不好用,或者说 Firefox 不适于普通用户。然而我们遇到了很多的反例,今天霍炬就给我讲了一个反例,他的一个朋友经营灯具的,前两天用 木马检查工具一检查机器发现木马成堆,所以开始用 Firefox。霍炬帮他安装了几个插件,他立刻喜欢上了 Firefox。这个家伙以前一直骂 Firefox 难用的,说这个功能没有,那个功能没有的。这次才知道,原来他自己下载过 Firefox,但是不会安装插件,很多好玩好用的插件都没见过,所以觉得 Firefox 太差劲。开源软件的推广中经常遇到这样的问题,因为开源的哲学是尊重用户的选择, 所以一个具有超级强大扩展功能的软件发行的时候,都不包含扩展包,让用户自己选择扩展。这样高端用户可以完全定制这个软件。Firefox 也是这样的,所 以很多对开源哲学不了解的朋友,常常会被那些功能其实非常强大的软件的平凡外表所欺骗。这里的一个典型例子就是 Linux,如果你直接下载 Linux 核心 的话,你甚至不知道怎么把它安装到电脑上去,所以产生了很多的 Linux 安装版发行商,来帮用户把 Linux 和好的开源软件打包并提供安装和配置工具。目前这种打包服务在 Firefox 社区中还比较少,所以很多初级用户对 Firefox 有这样那样的误 解。这也说明,我们国内的开源爱好者应该考虑多进行这方面的工作(国外的已经比较不错了,Firefox1.5 刚刚发行 BSD port 里面就出现了)。

5、只有想不到的,没有 Firefox 做不到的

Firefox 是一个高度可扩展的浏览器(同时很安全,前面讲过了),Firefox 比 IE 出现要晚得多,但是各种各样的扩展数目比 IE 多得多。据说让 keso 一直忍受 Firefox 不断膨胀内存占用的主因是他放不下那些贴心的 Firefox 扩展。今年 6-7 月的时候,Firefox 中文网做了一个 10 佳 Firefox 扩展的评选,被选中的有屏蔽广告的 Adblock,有拓展标签浏览的 Tab Mix,有提供拖动打开新网页功能的 SuperDragAndGo,方便下载的 FlashGot,有关联各种应用程序的 Launchy,有鼠标花样玩法的 All-in-One Gestures Extension,有可以方便的看天气预报的 ForecastFox,有 Rss 浏览器 Sage,有超级收藏工具 ScrapBook,有帮你输入 BBCODE/XHTML/HTML 的 BBcode。关于这些扩展的详细说明和下载地址,请看我的文章“Firefox 中文网评选的 10 佳 Firefox 扩展”。以上说的拓展并不是全部,优秀拓展还有很多很多,简而言之,只有你想不到的拓展,没有 Firefox 做不到的功能。

如果你还没开始使用 Firefox,为什么不从今天开始试试呢?不需要花一分钱,下载安装即可,也许你也可以发现一个新的世界。

hexo: Hello World

发表于 2016-04-06 | 分类于 软件

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

$ hexo new "My New Post"

More info: Writing

Hexo-hey admin

$ npm install -save hexo-hey

Run server

$ hexo server

More info: Server

Generate static files

$ hexo generate

More info: Generating

Deploy to remote sites

$ hexo deploy

More info: Deployment

Hexo image generate

主页: hexo-migrator-image
安装:

$ npm install hexo-migrator-image --save

使用:

$ hexo migrate image

How Does It Work

This migrator scans all .md files in a hexo blog folder for Markdown’s image tags. Then downloads (remote) or copies (local) files to source/images folder and updates all urls in the posts. The images’ file names are SHA1 digest of its original url. A backup file named .md.#timestamp#.bak file will be created for each .md files every time. However it is better to use version control or make a copy just in case.

Theme

  • hexo next - https://github.com/iissnan/hexo-theme-next

Plunins

  • hexo-all-minifier
1…456…18

Feng Chao

178 日志
14 分类
1 标签
RSS
GitHub E-Mail Twitter
© 2006 — 2018 Feng Chao
由 Hexo 强力驱动
|
主题 — NexT.Mist