一晃又有好久没更新博客了,唉
由于想起来“啊!得要开始写论文了!”的时候已经非常晚了,所以干脆把之前定的题目给改了,用写过的五子棋程序作为毕业设计,写了三四十页文字翻译了二三十页文字就差不多了,然后再使劲的折腾格式,然后再答辩,两个星期就过去了。
嗯——话说答辩这事儿比想象的轻松多了。
和更新博客一起被忘记了要更新的还有某个说了要重写的五子棋AI,还有某个待修复的把普通的后缀树当成广义后缀树使用的bug,还有作为程序员不折腾出一个就会死的属于自己的语言,等等。再说吧。
对了,回到学校发现女士们都一律小清新了,叹气,其实我挺喜欢那种样子的,可是大家都一样就没意思了。
千万不要有人把 Enya 和 Cara Dillon 叫做小清新就好。
最后,看点花花草草吧




以前为了尝试 Win7 把 Fedora 给 X 掉了,不久之后很有点后悔,因为很多程序只有在 Linux 下才好玩;后来在虚拟机里面又装了个 Fedora 、给了他 1G 的内存,慢得跟乌龟似的。
考虑到电脑上所有的磁盘都有不方便移动位置的重要文件,所以, ubuntu。
下面记几条感受:
Update I:
- 感觉很神奇,也不知道他们是怎么想的, su 不能用,但是 sudo su 就可以了,汗。
- 默认的中文字体挺好看的。
Update II:
- AppEngine 骗了我,它说 export http_proxy="http://ip:port" 然后就可以使用代理来 update,然而我试了不行。
想知道问题出在哪儿, grep -r -i http_proxy * 得到的是——nothing。
Update III:
- 突然想到,可能,python 的 urllib 或是 httplib 之类的底层库已经实现了连接代理,于是很暴力的直接 grep -r -i http_proxy /usr/lib/py* ,以及 grep -r -i http_proxy /usr/share/py*
——依旧没有一个看上去哪怕有一点点儿靠谱的可能出现问题的文件
然后发现有个看上去很壮的家伙正扛着小小白拍荷花,自卑死了,遂遁走。



iOS 4.0 的确有些很激动人心的新功能,而且又免费——所以我想决定升级到 iOS 4.0 应该不算是个非主流的想法吧。
下载,备份,升级,这些都还算顺利,然而悲剧的是,软件安装完了、固件刷新好了,最后重启,固定在了一个连接 iTunes 的图像上面,连接 iTunes 则会出现某编号 –9812 的错误信息,像极了传说中会以小概率出现的死机状况;俺于是按对付那种情况的方法以强制恢复的方式重装系统,还是一样的结果。
回忆装机的过程,想起似乎有哪里提到过程是这样的:备份,安装系统,与 Apple 进行验证。
看样子问题可能出在与 Apple 验证这一步上面了。
想到这里——第一反应便是——被 q1ang 了?
fan q1ang,结果还是不行!
最后讨教万能的 Google,才发现有个地方说得算是比较靠谱: http://bbs.weiphone.com/read-htm-tid-632015.html
原来是缺少 iTunes 和 Apple 安全连接用的根证书,囧,那以前从 3.1.2 到 3.1.3 为啥可以直接升级呢,为什么查看 iTunes 帐号信息的时候它也安慰一句正在使用安全连接呢,我就纠结了。
把这个问题解决掉、成功升级之后,还是挺不爽,本以为 iTouch 是我的,其实原来是乔帮主的,他一个意念之间就可以把它废了,妈的。
最后,希望装 iOS 4.0 并且遇到同样问题的生物们,可以直接在这里下载根证书的更新包:http://is.gd/dcaLs
前几天看到Matrix67大牛推荐的名曰Manufactoria的编程游戏,非常之喜欢,玩得快要通关的时候,转念一想,诶,玩这个还不如玩BF呢。
嗯,要么我自己写个类似的BF的网页游戏?
这么一冲动,就刷刷刷写了下面的东西——剩下来的工作主要就是界面了,结果我又发现我没有时间做那工作,还得复习啊。
所以……这个烂尾工程就这么捐出来算了罢,下面的代码属于公有领域:
bfcfg = {
memLen:1024,
vLimit:0xff
};
function BFRunner ( ostream, istream ) {
this.mem=new Array(bfcfg['memLen']);
var i;
for(i=0; i<this.mem.length; ++i)
this.mem[i]=0;
this.codepos=0;
this.mempos=0;
this.ostream=ostream;
this.istream=istream;
return this;
}
BFRunner.prototype.compile = function(bfCode) {
var code=[], n=0, i=0, p=[];
for(i=0; i<bfCode.length; ++i) {
if(bfCode[i].match(/[+-<>,.]/)) {
code.push(bfCode[i]);
++n;
} else if(bfCode[i]=='[') {
p.push(code.length);
code.push('!');
} else if(bfCode[i]==']') {
if(p.length<1) {
throw "too many ']'s";
}
var jumpPoint=p.pop()
code[jumpPoint]=code.length;
code.push(-jumpPoint);
}
}
if(p.length!=0) {
throw "too many '['s";
}
this.code = code;
return this;
}
BFRunner.prototype.reset = function() {
var i;
for(i=0; i<this.mem.length; ++i)
this.mem[i]=0;
this.codepos=0;
this.mempos=0;
return this;
}
BFRunner.prototype.step = function() {
if(this.codepos<this.code.length) {
if( this.code[this.codepos] == '+' ) {
if(++(this.mem[this.mempos])>bfcfg['vLimit'])
this.mem[this.mempos]=0;
} else if( this.code[this.codepos] == '-' ) {
if(--(this.mem[this.mempos])<0)
this.mem[this.mempos]=bfcfg['vLimit'];
} else if( this.code[this.codepos] == '<' ) {
--this.mempos;
if(this.mempos<0)
this.mempos=bfcfg['memLen']-1;
} else if( this.code[this.codepos] == '>' ) {
++this.mempos;
if(this.mempos>=bfcfg['memLen'])
this.mempos=0;
} else if( this.code[this.codepos] == ',' ) {
this.mem[this.mempos] = this.istream.get();
} else if( this.code[this.codepos] == '.' ) {
this.ostream.put(this.mem[this.mempos]);
} else if( typeof(this.code[this.codepos]) == 'number' ) {
var pos=Number(this.code[this.codepos]);
if ( pos>0 && !this.mem[this.mempos] )
this.codepos = pos;
else if( pos<=0 )
this.codepos = -pos-1;
} else {
throw("WTF!!");
}
++this.codepos;
return this;
} else {
return undefined;
}
}
BFRunner.prototype.run = function() {
var p=0, i=0;
for(i=0; i<this.mem.length; ++i)
this.mem[i]=0;
i=0;
while(i<this.code.length) {
if( this.code[i] == '+' ) {
if(++this.mem[p]>bfcfg['vLimit'])
this.mem[p]=0;
} else if( this.code[i] == '-' ) {
if(--this.mem[p]<0)
this.mem[p]=bfcfg['vLimit'];
} else if( this.code[i] == '<' ) {
--p;
if(p<0)
p=bfcfg['memLen']-1;
} else if( this.code[i] == '>' ) {
++p;
if(p>=bfcfg['memLen'])
p=0;
} else if( this.code[i] == ',' ) {
this.mem[p] = this.istream.get();
} else if( this.code[i] == '.' ) {
this.ostream.put(this.mem[p]);
} else if( typeof(this.code[i]) == 'number' ) {
var pos=Number(this.code[i]);
if ( pos>0 && this.mem[p]===0 )
i = pos;
else if( pos<=0 )
i = -pos-1;
}
++i;
}
return this;
}
function ISStream(str) {
this.arr=new Array(str.length);
this.pos=0;
for(var i=0; i<str.length; ++i){
this.arr[i] = str.charCodeAt(i);
}
return this;
}
ISStream.prototype.set = function(str) {
this.arr=new Array(str.length);
this.pos=0;
for(var i=0; i<str.length; ++i){
this.arr[i] = str.charCodeAt(i);
}
return this;
}
ISStream.prototype.get = function() {
if(this.pos>=this.arr.length) {
return 0;
} else {
return this.arr[this.pos++];
}
}
ISStream.prototype.reset = function() {
this.pos = 0;
return this;
}
function OSStream() {
this.arr=[];
}
OSStream.prototype.reset = function() {
this.arr=[];
}
OSStream.prototype.put = function(ch) {
this.arr.push(String.fromCharCode(ch));
}
OSStream.prototype.str = function() {
return this.arr.join("");
}
示例:

#include "exceptions.hpp"
#include "human.hpp"
#include "school.hpp"
#include "food.hpp"
#include "life.hpp"
void life::eat(food &f) {
if(!f.tasty())
throw(error("WTF is it?!"));
else {
this->money -= f.price();
f = excrement;
this->grow();
}
}
void life::sleep() {
int sheep;
for(sheep = 0; !asleep(); ++sheep)
if(sheep<0)
throw(astonishment("OMG!"));
this->grow();
}
void life::work( thing& t ) {
t = nothing;
error up("Okay, I messed it up");
throw up;
}
void life::haveFun() {
throw(error("How is it possible?"));
}
void life::live() {
while(this->alife_) {
eat();
work();
haveFun();
eat();
sleep();
work();
haveFun();
eat();
work();
haveFun();
sleep();
}
}