Ubuntu 8.10 配置记录
Posted by twcai in Ubuntu Notes on April 15, 2009
前段时间装了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显卡驱动安装详解 .
有个需要注意的地方是我用
- sudo /etc/init.d/gdm stop
以后, x-window虽然关闭,但ubuntu并不会自动进入命令行的终端. 而是需要按 ctrl + alt + f1 组合建, 启动终端. Read the rest of this entry »
到底谁知道
Posted by twcai in Some parts on April 12, 2009
昨天买的nano3,早上连接到iTurns之后突然死机了。于是去Google上搜了下“nano3 死机”,看了第一个搜索结果,说死机了只要hold开关拨两下,同时按住menu和play键10秒左右就好了,照做,无效。然后看了其他很多求助帖,说的都一样,这样一来就只能放电了。
实在无奈,翻出说明书来看了下,发现上面说的是:先把hold开关拨到HOLD位置,在拨回原位,然后同时按下menu和中间按钮6秒直到出现apple标志。
唉,原来如此~Google出来的结果前两位是百度知道,后面有论坛有天涯问答之类的,没有一个提供了正确的答案……
中国的网络是普及了,但是我觉得大部分的网民都是盲目的。比如百度知道上面的垃圾答案,我已经见过很多了,然后这些回答的链接还被不加验证的随便乱贴,在Google上的排名都很高……
唉,倒底谁才是真的知道呢?
HDOJ 2269 Cross The River
广搜题again,本来不应该卡那么久,一个原因是逻辑不清楚,另一个原因就是位运算时犯错。
位运算是个好东东,如果某个计算过程会被大量用到,用位运算优化能够严重提高效率。但是位运算符有一个需要注意的地方就是他们的优先级都很低,除了左移右移(>>, <<)以外的几个位运算符甚至比比较运算符(比如==, >=, <=)还要低,而且位运算符之间也有优先级差别:依次为~, &, ^, |. 具体的优先级可以查阅这里:C++ Operator Precedence
正如软件工程课上所讲的:为了阅读上的需要,有时候加上冗余的括号也是很有必要的。
- #include <iostream>
- #include <map>
- #include <vector>
- #include <string>
- #include <queue>
- #include <cstring>
- using namespace std;
- int n, m, t, end;
- int d[110];
- bool hash[3000][2];
- map <string, int> mm;
- vector <int> vv;
- vector <int> vn;
- struct node{
- int sta[2], no[2], np, t;
- };
- queue <node> qq;
- inline void dfs(int sta, int chosen, int x, int y){
- if(y == t || x == n){
- vv.push_back(chosen);
- vn.push_back(y);
- }
- else{
- if(sta & (1 << x))
- dfs(sta, chosen | (1 << x), x +1, y +1);
- dfs(sta, chosen, x +1, y);
- }
- }
- inline int bfs()
- {
- int i, j, k;
- bool fg;
- end = (1 << n) - 1;
- while(!qq.empty()) qq.pop();
- memset(hash, 0, sizeof(hash));
- hash[0][1] = 1;
- node now, next;
- now.np = 1, now.t = 0;
- now.sta[0] = 0, now.sta[1] = end;
- now.no[0] = 0, now.no[1] = n;
- qq.push(now);
- while(!qq.empty())
- {
- now = qq.front(), qq.pop();
- if(now.sta[0] == end)
- return now.t;
- if(now.no[1] <= t && now.np == 1){
- next.no[0] = n;
- next.no[1] = 0;
- next.sta[0] = end;
- next.sta[1] = 0;
- next.t = now.t + 1;
- next.np = 1 - now.np;
- hash[next.sta[0]][next.np] = 1;
- qq.push(next);
- continue;
- }
- else{
- vv.clear(), vn.clear();
- dfs(now.sta[now.np], 0, 0, 0);
- for(i = 0; i < vv.size(); i++){
- next.sta[1 -now.np] = now.sta[1 -now.np] | vv[i];
- next.sta[now.np] = now.sta[now.np] & (~vv[i]);
- fg = 1;
- for(j = 0; j < m; j++){
- if((d[j] & next.sta[now.np]) == d[j]){
- //Here is my mistake
- //I wrote (d[j] & next.sta[now.np] == d[j]) at first
- fg = 0;
- break;
- }
- }
- if(!fg) continue;
- next.np = 1 - now.np;
- if(hash[next.sta[0]][next.np]) continue;
- next.no[next.np] = now.no[next.np] + vn[i];
- next.no[now.np] = now.no[now.np] - vn[i];
- next.t = now.t + 1;
- hash[next.sta[0]][next.np] = 1;
- qq.push(next);
- }
- }
- }
- return -1;
- }
- int main()
- {
- int i, ret;
- char ts[30], ln[1010];
- string name;
- while(scanf("%d %d %d", &n, &m, &t) != EOF)
- {
- mm.clear();
- for(i = 0; i < n; i++){
- scanf("%s", ts);
- name = ts;
- mm[name] = i;
- }
- gets(ln);
- for(i = 0; i < m; i++){
- gets(ln);
- d[i] = 0;
- int ct = 0;
- while(ln[ct] != '\0'){
- sscanf(ln + ct, "%s", ts);
- name = ts;
- d[i] |= 1 << mm[name];
- ct += name.length();
- for(; ln[ct] == ' '; ct++);
- }
- }
- ret = bfs();
- printf("%d\n", ret);
- }
- return 0;
- }
- /*
- 3 1 1
- cab
- sheep
- wolf
- cab
- */
Android Tattoo
Posted by twcai in Geek Stuff on April 8, 2009
很久以前在煎蛋上看到的,突然想到去找了她的PP
So cute~

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

andoid robot
不管怎么说,很不错,哈哈~~
I wish I can have a G-Phone.
A Start
Posted by twcai in Some parts on April 6, 2009
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.









