2010
07.29

对我来说,一个好的程序员应该是努力去追求尽可能无错的高质量的符合需求的代码实现。 一些人也许认为好的程序员是那些懂得多门编程语言,懂得很牛技术的程序员,是的,这在某些情况下是对的。但归根到底,无论你用什么样的技术,什么样的语言,所有的程序被写出来,其功能都要符合需求以及尽可能地健壮无错和高质量。  我们可以想像一下,如果一个能力普通的程序员有足够多的时间来做测试,那么,其也可以保证他的代码的质量。所以,有一种观点这样认为——要达到质量高的代码只需要有足够多的时间来做测试。这对于以结果为导向的商业软件开发中是可以理解的(我们可以看到那些制汽车的产商在汽车测试上花费的精力和时间就可以明白这一道理)。

但是,很明显,所有的已经开发出来项目都是在不完美的条件下开发出来的,一般来说,几乎所有的项目都是在最大化程序员软件的开发速度。而且,很多情况下,我们似乎对深度测试和压力测试并不是很关心,所以,我们总是在祈祷并期望那些赶工出来的代码可以正常工作,尤其是在上线的时候,这种唯心主义的价值观更为强烈。  其实,开发速度和软件产品质量并不矛盾。好的程序员并一定是技术强的程序员,而是那些可以在不完美的工作环境下保证软件质量和工作效率的程序员。下面是是五个程序员可以在这种不完美的情况下做得更好的观点(它们都和语言和技术没什么关系,只不过是一种你的工作行为,能够和所有的行业相通),这五个观点也许可以让你成为这样的好程序员。

  • 寻找不同观点:程序员好像并不喜欢技术上有异见的人,他们特别喜欢争论各自的技术观点。但是,他们忽略了不同观点的价值。任何事情都有好有坏,我们应该学会在不同观点中学习和平衡。这样才会更多的了解编程和技术。要经常在做事之前问自己和别人,这么做对不对?做完事后问自己,还可不可以改进?努力去寻找别的不同的观点或方法。程序员应该经常上网,经常和同事讨论不同的实现方法,不同的技术观点,这样才能取长补短。然而,在实际工作中,我发现程序员们并不喜欢互相请教,因为请教的人怕别人看不起他,而被请教的人总是先贬低对方的能力,哎……(参看《十个让你变成糟糕的程序员的行为》),如果有这样的文化氛围的话,那也没有关系。上网吧,网上的人谁也不认识谁,可以尽情地问一些愚蠢的问题。呵呵。总之,一定要明白,如果某些事情只有一个观点,那么你一定要怀疑一下了,没有观点和技术方案的比较,没有百花齐放的情况,你就无法知道是否还有更好的东西。真正的和谐不是只有一种声音,真正的和谐而是在不同的观点声音下取长补短,百家争鸣(参看《十条不错的编程观点》)。否则,你永远都不会接受到新的观点,也就无法进步和成长了。

  • 千万别信自己的代码: 在任何时候,一定要高度怀疑自己的代码。很多时候,错误总是自己造成的。所以,当出现问题的时候,要学会review代码中所有的可疑点,千万别觉得某段代码很简单,可以略过。事实证明,很多疏忽大意都是在阴沟里翻的船,都是那些很低级的错误。在查错的过程中,切忌过早下结论,切忌四处乱改(参看《各种流行的编程风格》),停下来,想一想,会是哪儿的代码有重大嫌疑,然后查看一下代码,捋一捋程序的逻辑(参看《橡皮鸭程序调试法》),调试并验证一下程序的逻辑和变量在运行时是否是正确的。很多时候,对于那些难缠的问题,最后解决了总是因为我们开始认真回头审视所有的代码。只有对自己的代码保持着高度的怀疑,这样我们才会想着如何让其运行得更好更稳定,也会让我们在单元测试中下更多的功夫,这样才能更能在那忙碌的环境中节省时间。相信我,在集成测试中fix bug的成本要比在单元测试Fix bug的成本大得多的多。一个简单的例子就是memory leak。程序员对自己的程序需要有忧患意识,这样才会越来越成熟,而自己的能力也会越来越强。

  • 思考和放松: 做事前多想一想,这样做事的时候就不会不顾此失彼,手忙脚乱,一旦事情一乱,你的心情也会更乱,于是,事情也就会更乱。最后,你只得重写,这种事情太多了。而且,在工作中要学会享受,要学会放松心情,我并不是让你工作的时候聊QQ,我只是说,有时候,心态过于紧张,压力过大,你的工作成果反而更不好,从而又反过来造成新一轮的焦虑和紧张。我个人认为,思考和放松是可以完美统一的,思考其实就是一种放松,停下来,休息一下,回头看看走过的路,喝口水,登个高,看看过去走的对不对?总体是个什么样?总结一下,然后看看前路怎么样好走,这会你才会越走越好,越走越快。好的程序员都不是那种埋头苦干的人,好的程序员总是那些善于总结成败得失,善于思考,善于调整,善于放松的人(参看《优秀程序员的十个习惯》)。不然,我能看到的情形是,你很快地把事干完,回到家刚坐下来,老板或是客户就打电话来告诉你你的程序出问题了。总之,深思熟虑,动作会很慢,但是你可以保证你工作成果的质量,反而能让你更多的节约时间。

  • 学习历史,跟上时代: 如果你是从十年前开始编程的,那么,今天的这门语言或是技术会有很多很多的改进和改善。你以前开发一个功能或函数,今天早已被集成时了语言中,而且做得比你的版本要好得多。以前你需要100行代码完成的事情,今天只需要1行代码。这样的事情在未来还会发生,所以,今天的你一定要学会如何跟上时代。但是,你也不要放弃历史,我现在看到很多程序员对一些现代的语言和技术使用的非常好,他们可以很容易地跟上时代。但不要忘了,计算机世界的技术更新和技术淘汰也是非常猛的。所以,你一定要学习历史,这些历史不是产商的历史,而是整个计算机文化的历史(参见《Unix传奇》)。只有通过历史,你才能明白历史上出现的问题,新技术出来的原因,这样才能够对今天的这些新的技术更了解,也才能明白明天的方向在哪里。学习历史和跟上时代都是相当重要的。使用新型的技术,停下来接受培训,可以让你工作得更快,更高效(参看《未来五年程序员需要掌握的10项技能》)。而学习和总结历史,才会让你在纷乱的世界中找到方向。

  • 积极推动测试活动: 只有测试才能证明软件可以正常工作,只有测试才能保证软件的质量。无论什么产品,都需要经过或多或少的测试。测试地充分的产品或模块,你会发现其质量总是那么好,测试的不充的产品,质量总是那么次。德系汽车,日系汽车质量怎么样,关键还是在于怎么去测试的,测试的是否充分。所以,在你开发软件的过程中,如果你说你的程序写地好,质量高,那么请你拿出实实在在的测试报告。在整个软件开发过程中,做为一个好的程序员,你应该积极地在各个环节推动项目组进行测试活动。不要以为技术需求阶段和设计阶段不需要测试,一样的,只要你要release什么,release的这个东西都需要进行测试。技术需求怎么做测试?用户案例就是测试案例。在软件开发的整个过程中,保证产品质量有时候比实现需求更重要,尤其是那些非常重要甚至人命关天的产品。

上面这些五个观点都是可能让你在不完美的工作环境中可以工作得更好,更快,更高效,希望能够对你有用。另外,也欢迎你留下你的观点!

注:本文转自http://coolshell.cn/?p=2606

2010
07.28

我在之前的文章里谈论过赋值语句的危害性。 使用赋值语句会使程序变的冗长,更难理解。但事实上,赋值语句对编程来说是一种基本语句,想限制它的使用几乎是不可能的。幸运的是,我们实际上是能做到的,下面我就会向你展示如何去做。

用正确的方式初始化

// 错误       |  // 正确
int x;        |
// ...        |  // ...
x = init();   |  int x = init();

“正确”方式的主要优点是你能很方便的浏览x的定义的同时知道它的值。这样也能保证x始终处在一个固定变量状态,大多数的编译器都能检测到这种状态。其次,这样可以使代码减少冗余。

“错误”方式之所以存在完全是因为很多老式的编程语言都强制要求在程序的开始处先声明变量。这样编译器好处理。但现在这已经不是问题了,即使在C语言里。

构造新数据

// 错误          |  // 正确
int x = init();  |  int x = init();
// ...           |  // ...
x = something(); |  int y = something();

这样做很重要。它能保证变量被定义后不会被改变。不留任何机会。x的值我们可以保证它是通过init()初始化的值。

人们使用“错误”方式一般有两个原因:高效和简洁。效率并不是个问题,现代编译器能够通过给变量重新分配地址来优化性能。而由于简洁而导致的语义模糊是得不偿失的。

用函数,不要用过程

// 错误                  |  // 正确
void to_utf8(string s);  |  string to_utf8(string s);
                         |
// ...                   |  // ...
                         |
string s1 = latin();     |  use_string(to_utf8(latin()))
to_utf8(s1);             |
use_string(s1);          |

“正确”方式使用的是一个普通的数字函数:它接受输入值,返回计算后的值。另一边,“错误”方式使用了过程。跟函数不一样,过程不仅会影响返回的结果,还能影响其它数据,例如,过程中可以修改它的参数值。这会使这些参数很容易被污染。

所以,当能够使用函数的时候,尽量不要使用过程。你的程序这样会变得更简单。这种技巧可以让你避免去思考如何去做(变换一个字符串),而是如何被做(一个变换了的字符串)。要着眼于最终结果,而不是处理过程。

“错误”方式之所以存在完全是由于许多老的编程语言很难处理复杂的返回值。你只能返回单个数字。所以,当需要一个内容更丰富的返回值时,你只能在过 程中达到这个目的。而真正的返回值通常是一些简单的错误标号代码。然而现在不同了,返回复杂的结果已经不再是个问题。即使是在C语言里你也可以返回复杂的 结果。

固化你的对象

在很多的入门级的介绍面向对象编程的课程中,你能看到这样一个著名的二维坐标的例子:

// 非常非常错误
class Point
{
public:
  // constructor
  Point() { x = 0; y = 0; }

  float get_x() { return x; }
  float get_y() { return y; }

  void set_x(float new_x) { x = new_x; }
  void set_y(float new_y) { y = new_y; }

  move(Point p) {
    x = x + p.x;
    y = y + p.y;
  }
private:
  float x; float y;
};

这样设计的原因很简单:你可以通过构造函数创建一个新的坐标,然后通过set_x() 和 set_y()进行初始化。内部数据是经过封装的(private),只能通过get_x() 和 get_y()来访问。还有个好处是,你可以通过move()方法来移动这个坐标点。

然而,从代码本身看,却是没必要的复杂化了,而且有几个主要的错误:

  • 构造函数直接把x 和 y 初始化成0了。如果你希望它是其它值,你还需要手工的设置。你不能初始时做到这些
  • 操作一个点的缺省方法就是修改它。这是一种赋值操作。你被限制了创建一个新值
  • set_x()set_y(), 和 move() 方法现场修改这个对象。这些是过程, 不是函数
  • x (和 y) 是私有的,但你可以通过get_x() 和 set_x()操作它们。所以,你认为你是封装了它们,而实际上没有。
  • move()这个方法不需要放在Point类里。放在类里使类的体积变大,影响理解和使用。

正确的设计更简单,而且不失功能:

// 正确的
class Point
{
public:
  // constructor
  Point (float x, float y) {
    _x = x; _y = y;
  }

  x() { return x; }
  y() { return y; }

private:
  float _x; float _y
}

Point move(Point p1, Point p2) {
  return Point(p1.x() + p2.x(),
               p1.y() + p2.y());
}

另外,如果你愿意,你可以把_x 和 _y声明成public和常量。

使用纯功能性数据结构

从上面的介绍里我们说明了应该构建新数据。这个建议即使是大数据结构也是有效的。意外吗,它并不是像你想象的那样失去作用。有时候你为了避免每次都拷贝整个数据结构,你可能要使用修改操作。而数组和hash table就是属于这种情况的。

这种情况下你应该是使用我们所谓的纯功能性数据结构。如果你想对这有所了解,Chris Okasaki’s thesis (也是同名著作)是个好的教材。这里,我只给大家简单的讲讲linked list。

一个链接表要么是个空表,要么是其中有个单元格存着一个指向另一个表的指针。

┌───┬───┐   ┌───┬───┐
│ x │  ───> │ y │  ───> empty
└───┴───┘   └───┴───┘

这样的数据结构如果在ML语言里是很好设计出来的,但在以类为基础的语言里会稍微有点复杂:

-- Haskell
-- A list is either the Empty list,
-- or it contains an Int and a List
data List = Empty
          | NotEmpty Int List

-- utility functions

is_empty Empty         = true
is_empty NotEmpty x xs = false

head Empty         = error
head NotEmpty x xs = x

tail Empty         = error
tail notEmpty x xs = xs
// Java(ish)
class List
{
public:
  // constructors
  List() { _is_empty = true; }
  List(int i, List next) {
    _i        = i;
    _next     = next;
    _is_empty = false;
  }

  bool is_empty() { return _is_empty; }

  int head() {
    if (_is_empty) error();
    return _i;
  }

  List tail() {
     if (_is_empty) error();
     return _next;
  }

private:
  int  _i;
  List _next;
  bool _is_empty;
}

你可以看到,现在这个List类是不可变的。我们不能修改List对象。我们只能在现有的对象外新建新的List。 这很容易。因为当你构建一个新List时,它会共享现有的大多数的单元。假设我们有个list l,和一个整数i

    ┌───┬───┐   ┌───┬───┐
l = │ x │  ───> │ y │  ───> empty
    └───┴───┘   └───┴───┘

i = 42

此时,在l的顶部加入i,这样就会产生一个新的list l2

     ┌───┬───┐
l2 = │ i │   │
     └───┴─│─┘
           │
           │   ┌───┬───┐   ┌───┬───┐
l  =       └──>│ x │  ───> │ y │  ───> empty
               └───┴───┘   └───┴───┘

或者,在代码里:

List l  = List(x, List(y, List()));
int  i  = 42;

List l2 = List(i, l); // cheap

l 仍然存在,不可变,而新建的l2只是多了一个新建的单元。类似的,删除顶部的元素也是不费任何资源的容易。

当我们不能这样做时

有时,你不能避免赋值操作,或者受其它因素限制。也许是你需要更高的效率,你必须修改数据状态来优化程序。或者由于一些外界因素影响,比如一个用户。或者由于你使用的语言不能自动处理内存使用,这些都会阻止你使用纯功能性的数据结构

这种情况下你所能做的最好的方式是隔离那些程序中不合规范的代码(那些使用赋值语句的代码)。比如说,你想给一个数组排序,你必须用quicksort。Quicksort严重的依赖于变换转移操作,但是你可以隐藏这些操作:

array pure_sort (array a)
{
  array a2 = copy(a);
  quicksort(a2); // modify a2, nothing else
  return a2;
}

于是,当pure_sort()这个内部函数不能按照我的建议的去写时,影响并不大,因为它被限制在函数内了。最终,pure_sort()的 行为就像是个普通的函数了。

相反的,当你与其它业务有交互时,要小心的将交互部分的代码和运算部分的代码分隔开。比如你要写段在屏幕上画个点的程序,而且能根据鼠标的移动而移动。写出来可能会是这样:

// 错误

Point p(0, 0);
wile(true) // loop forever
{
  p = move(p, get_mouse_movement());

  if (p.x() < 0   ) p = Point(0    , p.y());
  if (p.x() > 1024) p = Point(1024 , p.y());
  if (p.y() < 0   ) p = Point(p.x(), 0    );
  if (p.y() > 768 ) p = Point(p.x(), 768  );

  draw(p);
}

这里有个错误,它在主程序里对越界坐标进行了检查。更好的方式是这样:

// 正确

point smart_move(point p, point mouse_movement)
{
  float x = p.x() < 0    ? 0
          : p.x() > 1024 ? 1024
          :                p.x();

  float y = p.y() < 0   ? 0
          : p.y() > 768 ? 768
          :               p.y();

  return Point(x, y);
}

// 主程序
Point p(0, 0);
wile(true) // loop forever
{
  p = smart_move(p, get_mouse_movement());
  draw(p);
}

现在,主程序变得更简单了。运算部分,smart_move(),可以进行单独测试,甚至可以在其它地方重用。 现在,如果你不喜欢这样的三元操作的语法,不想按我介绍的规则,不去构造新数据

// 这样也不是很差

point smart_move(point p, point mouse_movement)
{
  float x = p.x();
  float y = p.y();

  if (x < 0   ) x = 0;
  if (x > 1024) x = 1024;
  if (y < 0   ) y = 0;
  if (y > 768 ) y = 768;

  return Point(x, y);
}

不管你怎么写,smart_move()始终应该是个函数

结论

我说的这些都是关于降低耦合的技巧。每个程序都应该有很清晰的内部边界。每个模块应暴露最少量的接口。这能使程序更易于理解和使用。避免使用赋值语句,坚持对象恒定的原则能使接口清晰明确。但这也不是银弹,这只是辅助手段。很有用的辅助手段。

2010
07.28

Ubuntu 10.04 已经发布了
1.sudo gedit /etc/apt/sources.list
编辑你的源列表,将原来的内容全部删除,添加下面列表中最适合你的源(注意不要全部添加),选择一个最合适你的即可,复制到你的列表中,然后保存列表。
2.sudo apt-get update 更新源列表信息
可以在运行“sudo apt-get update ”时查看一下错误信息,把不能连接的源删除再重新运行“sudo apt-get update ”。
3.sudo apt-get upgrade 升 级
或者用ubuntu自带的更新管理器升级也可
Ubuntu 10.04源列表:
台湾
代码:

deb http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted

SRT Sources
代码:

deb http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse

网易(速度很快)
代码:

deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted

ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
代码:

deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted

搜狐
代码:

deb http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted

骨头源,骨头源是bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin
代码:
deb http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted

lupaworld 源,提供 ArchLinux,Everest,FreeBSD,Fedora,LFS,Magiclinux,Mandriva,OpenOffice,openSUSE,Puppy,Red Hat,Slitaz,Turbolinux,Ubuntu,中标普华
deb http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted

rootguide源,ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted

网易开源镜像站,提供 FreeBSD,OpenBSD,archlinux,centos,cygwin,debian,fedora,gentoo,kernel,openSUSE,slackware,ubuntu
deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted

搜狐开源镜像站,提供 CPAN,FreeBSD,NetBSD,OpenBSD,apache,archlinux,centos,cygwin,dag,debian,fedora,gentoo,kernel,lfs,mysql,nginx,openSUSE,php,rpmfusion,slackware,ubuntu
deb http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted

搜狐开源镜像站,提供 CPAN,FreeBSD,NetBSD,OpenBSD,apache,archlinux,centos,cygwin,dag,debian,fedora,gentoo,kernel,lfs,mysql,nginx,openSUSE,php,rpmfusion,slackware,ubuntu
deb http://mirrors.sohu.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.sohu.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.sohu.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.sohu.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.sohu.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ lucid-updates universe main multiverse restricted

网易开源镜像站,提供 FreeBSD,OpenBSD,archlinux,centos,cygwin,debian,fedora,gentoo,kernel,openSUSE,slackware,ubuntu
deb http://ubuntu.cn99.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.cn99.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.cn99.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.cn99.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.cn99.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.cn99.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.cn99.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.cn99.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.cn99.com/ubuntu/ lucid-updates universe main multiverse restricted

骨头源,提供ubuntu,deepin
deb http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted