» Home ( 440 posts )

Thursday
2010-07-01

permalink Free live feed show

FeedJIT

permalink SQLite's index trick

When create index for sqlite database,you have to make sure the columns refereed in index must also appear in the WHERE clause,and for the right-most column of an index that is used, there can be up to two inequalities that must sandwich the allowed values of the column between two extremes.Otherwise the index won't be used.

I had a SQL whose WHERE clause looks like this:

WHERE t.Status in( '01', '02', '03', '08', '51', '52', '53', '54', '55', '58', '59', '60') AND t.ClientID=a.UserID AND t.Side=s.id AND t.Status=u.status AND substr(t.TimeStamp,1,10)>='2010-01-25' AND substr(t.TimeStamp,1,10)<='2010-01-25'

The index should be created like this:

CREATE INDEX idx1 on tbl (status,TimeStamp)
    • Read more »

Wednesday
2010-04-21

permalink STL map:inherit value type from key type

In some circumstance it might be convenient.

using namespace std;

class Key{
public:
    Key(int k):key(k){}
    int key;
    bool operator < ( const Key & k ) const{
        return key<k.key;
    }
};

class Value:public Key{
public:
    Value(int k,int v):Key(k),value(v){}
    int value;
    bool operator < ( const Value & v ) const{
        return value<v.value;
    }
};

int main()
{
    Value v1(1,100),v2(2,200);
    typedef map<Key,Value> MAP;
    MAP m;
    m.insert(MAP::value_type(v1,v1));
    m.insert(MAP::value_type(v2,v2));
    for(MAP::iterator pos=m.begin();pos!=m.end();++pos){
        cout<<"key="<<pos->first.key<<",value="<<pos->second.value<<endl;
    }
    return 0;
}

Saturday
2010-03-27

permalink 但愿朝阳长照国土 莫忘烈士鲜血满地

Thursday
2010-03-18

permalink Made a wrong decision? ... again?

Sunday
2010-03-14

permalink The path problem while doply django on lighttpd via fastcgi

The official way to deploy django application on lighttpd via fastcgi is to define a fastcgi handling url /mysite.fcgi and then redirect all requests which are supposed to send to the django application to /mysite.fcgi.

Normally this works fine but some django codes uses http reqeust object's get_full_path() to generate the original URL(for example,admin's login view), the above /mysite.fcgi will be embedded in the generated path,which cannot be mapped to any valid URL.

Someone asked the same question on Stack Overflow .

According to the second answer, it is a lighttpd bug,and is fixed in 1.4.23 ,which introduced a new option "fix-root-scriptname" => "enable" to fix the problem.

permalink The Army of Crime/L'Armée du crime

分昨天晚上和今天下午看完了 The Army of Crime

所谓的“The Army of Crime”是德国占领当局的宣传机器在捕获这个由犹太和外国共产主义者组成的反抗组织成员后给他们起名字,电影拍得琐碎冗长,但故事本身值得回味。看到结尾才回想起片子开头他们坐在开往刑场的囚车时旁白在念他们每个人的名字时都会加一句“为法国牺牲”的用意:这个片子不仅是在向这些烈士致敬,更是在反思法国人自己的行为。

片子里借一个纳粹党卫队军官之口说:(你们法国人)主动承诺了连希姆莱都不敢提的要求,在清扫法国犹太人的行动中没有动用一个德国人。

相比之下,中国虽说古人就云“知耻而后勇”,但伟光正大概是永远也做不到的。现在连文革都不让多谈了。。。

Saturday
2010-02-06

permalink 升级desktop内存到4GB

从上海问物的乐天店买的,到了才注意到是Transcend的,用了1000多点乐天点,实付了¥3,852。

主要是想用来跑虚拟机。

permalink 屏蔽点阵字体

在打开AA的情况下浏览器上某些网页时部分字体还是点阵状态,发现是fontconfig在按照网页指定的字体顺序搜索字体时匹配到了非矢量字体。对新版的fontconfig,把 /etc/fonts/conf.avail 下的 70-no-bitmaps.conf 给符号链接到 /etc/fonts/conf.d 下屏蔽点阵字体就可以。

是立即生效的,不需要重启X,重启下浏览器即可。

Tuesday
2009-12-29

permalink Tiling Windows Manager

反反复复用了阵子awesome,除了对每次版本升级就fuck一次前一个版本的设置文件感到受不了外,还有诸多兼容性问题。但问题是习惯了tiling windows的自动布局再用常规的WM感觉那是非常地不自在和低效。

传说KDE 4.4会添加tiling windows功能,不过刚才发现一个好东西:pytyle,会给所有EWMH兼容WM,比如我喜欢的openbox,添加tiling功能 ^_^

• Older posts »  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44 

Trust is hard to earn,easy to lose,and almost impossible to take back.