Ubuntu 8.10 配置记录

前段时间装了Ubuntu玩玩,用wubi装的,只分配了6G的空间,导致最后空间不足,不能更新,FF也出问题,只好重装。每次装Ubuntu都会忘掉怎么配置,然后上Ubuntu中文社区找东西找来找去,想想干脆自己写个具体的记录,免得下次还这么麻烦。
Ubuntu 8.10的镜像我一直存在移动硬盘上,安装用的wubi(大牛BS我吧,只因为这个比较节省时间=,=)。
安装好后第一件要做的事情就是选择软件源。这次我没有去用第三方源,而是在 软件源 里面使用choose best server 选择了一个最快的官方源 : http://mirror.rootguide.org/ubuntu . 这个源我在教学区基本上都能保持200KB/S以上的下载速度,快的时候有2000+KB/S.
接下来就是安装语言支持和更新, 中间为了能使用闪讯安装了build-essential, cvs.
然后是安装显卡驱动,我的本本用的是 NVIDIA G8400S 显卡, 去官网上下载了驱动后, 按照下面这个帖子进行安装:
Nvidia官方最新180.22显卡驱动安装详解 .
有个需要注意的地方是我用

  1. sudo /etc/init.d/gdm stop

以后, x-window虽然关闭,但ubuntu并不会自动进入命令行的终端. 而是需要按 ctrl + alt + f1 组合建, 启动终端. Read the rest of this entry »

No Comments

到底谁知道

昨天买的nano3,早上连接到iTurns之后突然死机了。于是去Google上搜了下“nano3 死机”,看了第一个搜索结果,说死机了只要hold开关拨两下,同时按住menu和play键10秒左右就好了,照做,无效。然后看了其他很多求助帖,说的都一样,这样一来就只能放电了。
实在无奈,翻出说明书来看了下,发现上面说的是:先把hold开关拨到HOLD位置,在拨回原位,然后同时按下menu和中间按钮6秒直到出现apple标志。
唉,原来如此~Google出来的结果前两位是百度知道,后面有论坛有天涯问答之类的,没有一个提供了正确的答案……
中国的网络是普及了,但是我觉得大部分的网民都是盲目的。比如百度知道上面的垃圾答案,我已经见过很多了,然后这些回答的链接还被不加验证的随便乱贴,在Google上的排名都很高……
唉,倒底谁才是真的知道呢?

No Comments

HDOJ 2269 Cross The River

广搜题again,本来不应该卡那么久,一个原因是逻辑不清楚,另一个原因就是位运算时犯错。
位运算是个好东东,如果某个计算过程会被大量用到,用位运算优化能够严重提高效率。但是位运算符有一个需要注意的地方就是他们的优先级都很低,除了左移右移(>>, <<)以外的几个位运算符甚至比比较运算符(比如==, >=, <=)还要低,而且位运算符之间也有优先级差别:依次为~, &, ^, |. 具体的优先级可以查阅这里:C++ Operator Precedence
正如软件工程课上所讲的:为了阅读上的需要,有时候加上冗余的括号也是很有必要的。

  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4. #include <string>
  5. #include <queue>
  6. #include <cstring>
  7. using namespace std;
  8.  
  9. int n, m, t, end;
  10. int d[110];
  11. bool hash[3000][2];
  12. map <string, int> mm;
  13. vector <int> vv;
  14. vector <int> vn;
  15.  
  16. struct node{
  17.     int sta[2], no[2], np, t;
  18. };
  19. queue <node> qq;
  20.  
  21. inline void dfs(int sta, int chosen, int x, int y){
  22.     if(y == t || x == n){
  23.         vv.push_back(chosen);
  24.         vn.push_back(y);
  25.     }
  26.     else{
  27.         if(sta & (1 << x))
  28.             dfs(sta, chosen | (1 << x), x +1, y +1);
  29.         dfs(sta, chosen, x +1, y);
  30.     }
  31. }
  32.  
  33. inline int bfs()
  34. {
  35.     int i, j, k;
  36.     bool fg;
  37.     end = (1 << n) - 1;
  38.     while(!qq.empty()) qq.pop();
  39.     memset(hash, 0, sizeof(hash));
  40.     hash[0][1] = 1;
  41.     node now, next;
  42.     now.np = 1, now.t = 0;
  43.     now.sta[0] = 0, now.sta[1] = end;
  44.     now.no[0] = 0, now.no[1] = n;
  45.     qq.push(now);
  46.  
  47.     while(!qq.empty())
  48.     {
  49.         now = qq.front(), qq.pop();
  50.         if(now.sta[0] == end)
  51.             return now.t;
  52.         if(now.no[1] <= t && now.np == 1){
  53.             next.no[0] = n;
  54.             next.no[1] = 0;
  55.             next.sta[0] = end;
  56.             next.sta[1] = 0;
  57.             next.t = now.t + 1;
  58.             next.np = 1 - now.np;
  59.             hash[next.sta[0]][next.np] = 1;
  60.             qq.push(next);
  61.             continue;
  62.         }
  63.         else{
  64.             vv.clear(), vn.clear();
  65.             dfs(now.sta[now.np], 0, 0, 0);
  66.             for(i = 0; i < vv.size(); i++){
  67.                 next.sta[1 -now.np] = now.sta[1 -now.np] | vv[i];
  68.                 next.sta[now.np] = now.sta[now.np] & (~vv[i]);
  69.                 fg = 1;
  70.                 for(j = 0; j < m; j++){
  71.                     if((d[j] & next.sta[now.np]) == d[j]){
  72.                         //Here is my mistake
  73.                         //I wrote (d[j] & next.sta[now.np] == d[j]) at first
  74.                         fg = 0;
  75.                         break;
  76.                     }
  77.                 }
  78.                 if(!fg) continue;
  79.                 next.np = 1 - now.np;
  80.                 if(hash[next.sta[0]][next.np]) continue;
  81.                 next.no[next.np] = now.no[next.np] + vn[i];
  82.                 next.no[now.np] = now.no[now.np] - vn[i];
  83.                 next.t = now.t + 1;
  84.                 hash[next.sta[0]][next.np] = 1;
  85.                 qq.push(next);
  86.             }
  87.         }
  88.     }
  89.     return -1;
  90. }
  91.  
  92. int main()
  93. {
  94.     int i, ret;
  95.     char ts[30], ln[1010];
  96.     string name;
  97.     while(scanf("%d %d %d", &n, &m, &t) != EOF)
  98.     {
  99.         mm.clear();
  100.         for(i = 0; i < n; i++){
  101.             scanf("%s", ts);
  102.             name = ts;
  103.             mm[name] = i;
  104.         }
  105.         gets(ln);
  106.         for(i = 0; i < m; i++){
  107.             gets(ln);
  108.             d[i] = 0;
  109.             int ct = 0;
  110.             while(ln[ct] != '\0'){
  111.                 sscanf(ln + ct, "%s", ts);
  112.                 name = ts;
  113.                 d[i] |= 1 << mm[name];
  114.                 ct += name.length();
  115.                 for(; ln[ct] == ' '; ct++);
  116.             }
  117.         }
  118.  
  119.         ret = bfs();
  120.         printf("%d\n", ret);
  121.     }
  122.     return 0;
  123. }
  124.  
  125. /*
  126. 3 1 1
  127. cab
  128. sheep
  129. wolf
  130. cab
  131. */

, ,

No Comments

Android Tattoo

很久以前在煎蛋上看到的,突然想到去找了她的PP
So cute~

android-tattoo

android-tattoo


不知道这个MM算不算Geek,还是只是喜欢Android robot logo.
andoid robot

andoid robot


不管怎么说,很不错,哈哈~~
I wish I can have a G-Phone.

,

No Comments

A Start

Learning English is just a joke without practicing. So, it is why this post sees the light.
Honestly, I don’t know if there exists some funny things can be recorded in this post. But, well, actually some things happened.
I started to download The Big Bang Theory tonight, because I really love the tees of Sheldon’s. I plan to buy one or more from Taobao. Another reason maybe one episode of Gossip Girl each week is not enough for me. I should keep my ears being filled of English words when I’m busy doing nothing, lol.
I think 100 words is enough. So, stop here.

,

No Comments