Friday, November 28, 2008

科大网教不上网的常客

A white cat set the netroom at USTC as his home. I take a series of photo and a video.

Sleeping


Feeling asleep


Almost sleeping


Distant speepy.


Sleep, Yes or no?


OK, I sleep now!

Monday, November 24, 2008

Fedora 10 final 装好了。

I have downloaded fedora 10 final 4 days before the final release date. Generally speaking, it is very stable and faster than fedora 9. I tried the ext4 filesystem. It is up to 70% faster than ext3 and enumerating files are lightning fast. The new intel driver gives faster intel GMA 900 performance(about 30% in glxgears, previous 597 fps, now about 799fps).
Ok enough speaking, let's see the screenshots! Plymouth is cool. But I cannot take screenshot in the booting sequence.


I have 2 ext4 volume


Fedora 10


Openoffice3



ibus input method


empathy IM client and pulseaudio


nautilus


clean desktop

Tuesday, October 28, 2008

让Dell Latitute X1 不自动降频!

I have finally solved( partially) solved this problem.
1. You should have all ACPI related kernel module compiled as modules not in kernrel.
2. Run this: #modprobe -r acpi_cpufreq

OK, The frequency will never go down because of overheat.

Monday, October 27, 2008

(zz)关于修改注册表(hv或rgu)的小技巧

一、改hv是最吃力不讨好的事情,要改就尽量在rgu里面改。
二.、几种改注册表方法,在合成rom过程中的优先级:provxml>rgu>hv,高优先级的覆盖低优先级的。
三、 同样是rgu,在处理的时候经常会遇到同一个地方,不同的键值,有两种处理方法:
1.把所有rgu单独复制到一个文件夹中,attrib -h -s -r *.rgu; ren *.rgu *.txt,然后搜索,选择“文件中的一个字或者词组”,输入你的关键字,这样所有包含了相关内容的rgu你就找到了,保留其中一处,或者改成一样。这是 传统方法,可以清清楚楚重复的在什么地方。
2.简单的方法:GUID在处理的时候也是有分前后优先的,这两个rgu
c60ad864-134f-4bdb-87e7-880e72c03821.rgu f558e727-40f2-49f4-b20c-6db169a62777.rgu
在处理的时候,f558e727-40f2-49f4-b20c-6db169a62777是后处理的,如果有相同主键,后处理的就会覆盖之前的。
所以你要改注册表,可以不管3721,搞一个ffffffff开头的rgu就可以。
四、我估计还是有人喜欢直接改hv文件的,当然,有时候小改一下,这样也无妨。但是生成的txt在转hv之前,检查下是否已经是unicode格式,如果是用记事本编辑的,注意不要自动换行,不然就注定失败。
五、在rgu中,文件路径要有两个\\,这是最容易出错的地方之一。

From xbeta.cn

Saturday, October 18, 2008

看看程序员都祈祷什么

The daily prayer of MLDonkey developers:
Our MLDOnkey who art in heaven,
hallowed be thy name.
Thy version come,
Thy will be done
on Overnet as it is in eDonkey.
Give us this day our daily CVS.
And forgive us our annoying,
as we forgive those who annoy us.
And lead us not into chunkloss,
but deliver us better downloads.
For thine is the kingdom, and the power, and the glory,
for ever and ever.
Amen!

Thursday, September 11, 2008

Opera Mobile 9.5 With Flash lite 3.1

Opera mobile 9.5 has yet released. But many OEM versions can be extracted through ROMs.
Flash lite 3.1 will never be retailed. But it is also in some ROMs.
What about combination!
Kuhl! It works. Now Opera Mobile have the capability to Flash 8&9 contents!
I can now display youtube inside the little screen.

http://forum.xda-developers.com/showthread.php?t=425268
http://forum.xda-developers.com/showthread.php?t=423860

Monday, September 8, 2008

关于计算机围棋的一些事实

1.Yose in the opening
2.Sente - myth or legend?
3.The advantages of gote
4.Sides are for suckers
5.Helping your opponent
6.Life - How to avoid it
7.Increasing a dead group
8.Play threats before starting a ko
9.Invasions after dame
10.Don't secure, pass!

Wednesday, September 3, 2008

回学校了

Leave and return.

Thursday, August 21, 2008

Socket in python

server:
#!/usr/bin/env python
import socket
if __name__ == '__main__':
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 8001))
sock.listen(5)
while True:
connection,address = sock.accept()
try:
connection.settimeout(5)
buf = connection.recv(1024)
if buf == '1':
connection.send('this is one')
else:
connection.send('this is not one')
except socket.timeout:
print 'time out'
connection.close()

client:
#!/usr/bin/env python
def send():
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 8001))
import time
time.sleep(1)
time.sleep(1)
sock.send('1')
print sock.recv(1024)
sock.close()

if __name__ == '__main__':
while(True):
send()

Monday, August 18, 2008

这个谜语有意思。

清代的谜学家张起南在《橐园春灯话》有个谜语真是bt到极点了。

杜甫诗句“无边落木萧萧下“打一个字:

谜底是"日"

因为萧是齐、梁朝的国姓,故萧->陳, 陳无边->東,東落木->日。

BQ27200芯片的编程


BQ27200 is a commonly used chip in mobile phone like HP IPAQ 6828's battery. It is possible to make a program that interact with the chip in windows ce platform.

First, you will need PXA27X's DDK for windows CE 5.0 or bulverde board development files.

Then, you can start programming. The most important thing is to allocate virtual memory for addressing the chip.

void InitializeBulverde(){
vg_pGPIORegs = NULL;
vg_pI2CRegs = NULL;
vg_pClkRegs = NULL;
vg_pOSTRegs = NULL;

PUCHAR pVMem; // for virtual memory address
DWORD VMemSize; // Total size needed for virtual memory

// Total size needed for virtual memory :
// Page size is 4Kbytes
// Driver Globals is also 4Kbytes
VMemSize = (PAGE_SIZE*5);
////////////////////////////////////////
// Size needed for register space.
pVMem = (PUCHAR)VirtualAlloc(0, VMemSize, MEM_RESERVE, PAGE_NOACCESS);
if(!pVMem) {
MessageBox(NULL, TEXT("Virtual Allocate failed!"), TEXT("InitBatteryDriver"), MB_OK);
}

// Map register space to virtual memory.
// 1. GPIO register
if(!VirtualCopy(pVMem, (LPVOID)(BULVERDE_BASE_REG_PA_GPIO >> 8), PAGE_SIZE,
PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL)) {
NKDbgPrintfW(_T("InitBatteryDriver: Virtual Copy: GPIO space failed\r\n"), GetLastError());
MessageBox(NULL, TEXT("GPIO space failed"), TEXT("Virtual Copy"), MB_OK);
}
vg_pGPIORegs = (DWORD *)pVMem;
pVMem += PAGE_SIZE;

// 2. I2C register
if(!VirtualCopy(pVMem,(LPVOID)(BULVERDE_BASE_REG_PA_I2C >> 8), PAGE_SIZE,
PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE)) {
MessageBox(NULL, TEXT("I2C space failed"), TEXT("Virtual Copy"), MB_OK);
}
vg_pI2CRegs = (DWORD *)pVMem;
pVMem += PAGE_SIZE;

// 3. CLKMGR register
if(!VirtualCopy(pVMem,(LPVOID)(BULVERDE_BASE_REG_PA_CLKMGR >> 8), PAGE_SIZE,
PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE)) {
MessageBox(NULL, TEXT("CLKMGR space failed"), TEXT("Virtual Copy"), MB_OK);
}
vg_pClkRegs = (DWORD *)pVMem;
pVMem += PAGE_SIZE;

// 4. OST register
if(!VirtualCopy(pVMem,(LPVOID)(BULVERDE_BASE_REG_PA_OST >> 8), PAGE_SIZE,
PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE)) {
MessageBox(NULL, TEXT("OST space failed"), TEXT("Virtual Copy"), MB_OK);
}
vg_pOSTRegs = (DWORD *)pVMem;

XllpI2cInit((P_XLLP_I2C_T)vg_pI2CRegs, (P_XLLP_GPIO_T)vg_pGPIORegs, (P_XLLP_CLKMGR_T)vg_pClkRegs, (XLLP_UINT32_T) 0x1);

Then you can you can read the registry like this:

if (XllpI2CReadS((P_XLLP_I2C_T)vg_pI2CRegs, (XLLP_OST_T *)vg_pOSTRegs, BQ27200_SLAVE, (XLLP_UINT8_T *)&buff, 1, bSENDSTOP) == XLLP_TRUE) {
return L" Battdrvr: XllpI2CReadS() is failed \r\n";
}
and write like this:

if (XllpI2CWriteS((P_XLLP_I2C_T)vg_pI2CRegs, (XLLP_OST_T *)vg_pOSTRegs, BQ27200_SLAVE, (XLLP_UINT8_T *)&buff, 1, bSENDSTOP) == XLLP_TRUE) {
MessageBox(NULL, TEXT("XllpI2CWriteS() is failed"), TEXT("Battdrvr"), MB_OK);
}

Note, in driver programming, one should use NKDbgPrintfW to print out the debug information instead of fprintr(stderr ...). This is because, this is a real-time function and will be used only in WinCE programs that interact with the kernel. So it is better.

Ok. here I will publish the the battery calibration for BQ27200 called BQ27200Expert. It can display various information about the BQ27200 and also calibrate the battery.

Download the program from XDA!

http://forum.xda-developers.com/showpost.php?p=2527251&postcount=1525


Tuesday, August 5, 2008

Python, a viper that bite me!

I should have learnt it before. It is soooo convenient to process strings and the language is beautiful. My previous programs have taken me 7 or 8 days. But in python, it takes me only 1 day. The debuging time is sharply reduced.

Also I like the philosophy of python.

wchar_t , wcs[insert function in string.h], and w[function in stdio.h]

These functions appears as an addition in C++98 standard and c99. I thought it is windows-only before.

Sunday, August 3, 2008

Mr Angry and Mrs Calm(生气先生和平静女士)


This is an interesting image.

Look at two persons closely. You can find that the left one is angry and the right one is calm. But When looking far away, the left one is calm and the right one is angry, just the opposite!

There are even more:

This is a catdog image:

Note: these images are from Philippe G. Schyns and Aude Oliva of the University of Glasgow.

Sunday, July 27, 2008

intel gma900在Linux下设置分辨率极限的方法。

I have posted an article about the dual head. But the resolution is limited to 1600x1600. Now I have figured out that one can set the resolution very high.
Edit xorg.conf
Below mode
Add
Virtual 2048 2048
This can set the maxium resolution to 2048x2048
If the resolution exceeds 2048x2048, the DRI must be disabled.

Wednesday, July 23, 2008

Kaiser可以刷Android的ROM了!


It is hard to believe, but it is true that hacker have already successfully made google's Android running on Kaiser(TyTN2).

Method:

Booting Google Android
1. Start HaReT.exe.
2. Pres: Listen for network connection. Meanwhile also press run (Doing this makes Android boot most of the time).
3. Google Android is now booting or you're Kaise freezes.
4. Have fun or Soft-Reset!

Thursday, July 17, 2008

大研第一天(part2)

What I do after windows installed, I have many  many things to do. 

Oh, the lab limit the international traffic to mere 3MB, which I don't even know that one will be charged 100RMB if exceeded!

Wednesday, July 16, 2008

If it walks like a duck and quacks like a duck, I would call it a duck.


Programs:

class Duck:
  def quack(self): print "Quaaaaaack !"
  def feathers(self): print "The duck has white and gray feathers."
 
class Person:
  def quack(self): print "The person imitates a duck."
  def feathers(self): print "The person takes a feather from the ground and shows it."
 
def in_the_forest(duck):
  duck.quack()
  duck.feathers()
 
def game():
  donald = Duck()
  john = Person()
  in_the_forest(donald)
  in_the_forest(john)

Debates:

Tom Brokaw: Senator Quayle, I don't mean to beat this drum until it has no more sound in it. But to follow up on Brit Hume's question, when you said that it was a hypothetical situation, it is, sir, after all, the reason that we're here tonight, because you are running not just for Vice President — (Applause) — and if you cite the experience that you had in Congress, surely you must have some plan in mind about what you would do if it fell to you to become President of the United States, as it has to so many Vice Presidents just in the last 25 years or so.
Quayle: Let me try to answer the question one more time. I think this is the fourth time that I've had this question.
Brokaw: The third time.
Quayle: Three times that I've had this question — and I will try to answer it again for you, as clearly as I can, because the question you are asking is, "What kind of qualifications does Dan Quayle have to be president," "What kind of qualifications do I have," and "What would I do in this kind of a situation?" And what would I do in this situation? [...] I have far more experience than many others that sought the office of vice president of this country. I have as much experience in the Congress as Jack Kennedy did when he sought the presidency. I will be prepared to deal with the people in the Bush administration, if that unfortunate event would ever occur.
Judy Woodruff: Senator [Bentsen].
Bentsen: Senator, I served with Jack Kennedy: I knew Jack Kennedy; Jack Kennedy was a friend of mine. Senator, you're no Jack Kennedy. (Prolonged shouts and applause) What has to be done in a situation like that is to call in the —
Woodruff: Please, please, once again you are only taking time away from your own candidate.
Quayle: That was really uncalled for, Senator. (Shouts and applause)
Bentsen: You are the one that was making the comparison, Senator — and I'm one who knew him well. And frankly I think you are so far apart in the objectives you choose for your country that I did not think the comparison was well-taken.

大研第一天(part 1)

What I really do is reinstalling the Windows XP and its softwares.

Monday, July 14, 2008

一个游戏开发者的无奈

Ryosuke Aiba:
I made a lot of monsters.
Over 100, actually!
But because they're monsters,
every one of them will be defeated.
That's kinda sad, really...
They didn't do anything wrong.
Don't tell me you...
Nah, you wouldn't do such a terrible thing.
..................
You didn't...did you...?

Maybe there is a kid from another world looking for you.

Why?Meaninglessly hurting one another... The disappearing life-forms...
The words that become deleted...
The thoughts that become buried...
The pool of cells that slowly evaporate...
The echoes of consciousness that slowly fade...
Love to hate...
Hate to love...
Why are we born?
Why do we die?
Evolution?
The '"survival of the fittest?"'
What is there to be achieved from harming one another... killing one another...

When one of those countless seeds inseminates a planet, a new universe is born.
But until that occurs, hundreds of millions of years will pass, and innumerable life-forms will be born, then die...

That is the be-all and end-all. Everything exists for that one moment. All so that the universe can evolve into the next dimension...

Does that make us all just pawns? Are each of our short lives nothing but a cheap sacrifice just so the one chosen life-form can be born?

An eternity has passed... Fleeting dreams fade into the distance... All that is left now is me and my memories...

Let us open the door to the great unknown, come across another reality, and live another today... Even when the decision has been make, life goes on...

Sunday, July 13, 2008

F9下XeLatex如何使用beamer制作幻灯片

It is almost the same as the latex but you should add
\def\pgfsysdriver{pgfsys-dvipdfm.def}
in the first line.
To add images:
\XeTeXpicfile "./image.jpg" xscaled 300 yscaled 300
% The [options] in the \XeTeXpicfile command use the following keywords:
% width
% height
% scaled
% xscaled
% yscaled
% rotated
}

Saturday, July 12, 2008

Fedora 9中Tex的中文解决方案

Fedora 9 have texlive 2007 in both the DVD and the repository. But making it supporting Chinese is not as easy as the non-rpm texlive.

That's NOT the case because there are xetex and xelatex which can help you out in a unicode settings.

What should be done?
Install texlive-*

How to write?
This is a sample to make everything clear:

\documentclass[12pt,a4paper]{article}
\usepackage{hyperref}%不能有unicode选项,否则bookmark会是乱码
\usepackage{fontspec}
\setromanfont{SimSun}%定义中文字体
%中文断行
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\defaultfontfeatures{Mapping=tex-text}
\newfontinstance\rmfont{Liberation Sans}%定义非中文字体
\newcommand{\nc}[1]{{\rmfont #1}}


\hypersetup{pdfauthor={曹雪芹},
pdftitle={诗歌}} %注意,在document之外的导言区

\begin{document}
\tableofcontents

\section{其二}

蘅芷阶通萝薜门,也宜墙角也宜盆。花因喜洁难寻偶,人为悲秋易断魂。玉烛滴干风里泪,晶帘隔破月中痕。幽情欲向嫦娥诉,无奈虚廊夜色昏。
Chinese English \nc{Englisch English}
\setromanfont{SimHei}
\section{咏白海棠}

斜阳寒草带重门,苔翠盈铺雨后盆。玉是精神难比洁,雪为肌骨易消魂。芳心一点娇无力,倩影三更月有痕。莫谓缟仙能羽化,多情伴我咏黄昏。

\end{document}

Thursday, July 10, 2008

VS2008 学生版本

Just wanna develop a small app for my mobile device but I have to install more 3G bloatware and 3 hr installation time. It is just a free student edition of visual studio 2008. Sigh....

Cegcc is much much smaller but unluckly far less documented. 

Friday, July 4, 2008

今天尝试了Dual Head

In linux setting up the dual head is not hard at all. A few simple commands will help.

First run:
$xrandr -q
to see whether there are two displays installed. Here is an example:
VGA connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
1440x900 59.9*+ 75.0 59.9*
1600x1024 60.2
1400x1050 60.0
1280x1024 75.0 60.0 60.0
1280x960 60.0 60.0
1360x768 59.8
1152x864 75.0 75.0 75.0 70.0 60.0
1024x768 75.1 75.0 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
640x480 75.0 72.8 72.8 75.0 66.7 60.0 59.9
720x400 70.1
LVDS connected 1280x768+0+768 (normal left inverted right x axis y axis) 264mm x 159mm
1280x768 59.9*+
1024x768 60.0
800x600 60.3
640x480 59.9

You can see two displays VGA and LVDS.
Ok let's get dual head using this:
$xrandr --output VGA --below LVDS
You can replace --below with --left-of --right-of and --above
See, dual head now!

But my video card, namely intel 915, is rather bad that it support resolution no larger than 1600x1600 so I get this error:
xrandr: screen cannot be larger than 1600x1600 (desired size 1440x1668)
or
xrandr: screen cannot be larger than 1600x1600 (desired size 2720x900)

Too bad, I need to lower the screen resolution of one screen to get it working. Any comments, thanks?

Wednesday, July 2, 2008

附近宿舍有人养了只小狗

One of my neighbours have brought a little dog in the dorm. The dog is so frisky and naughty that he always runs here and there, in and out. Once he came to my room, and I took some pictures and videos.




I don't know whether he can live here for long because pets are forbidden in dorms.

图画完了!

I have completed my first electronic schematic image. It is soooooooooooo large that spreads on 16 A4 pages or 1 A0 page.
All my works.
I have to trim all the A4 pages so that I can stick them together.
Working in progress.

设计电路真麻烦。

In the parallel processing course, there is an assignment -- designing a parallel computer using 4 processors and 8 memorys as well as 4 ROM chips. Quite daunting at first, but not so hard as I had expected. Well, it is really a nuisance that requires me to connect almost every pin of the more than 30 chips. OK, it is nearly done.
Note, I use gEDA, a set of open-source EDA softwares, which is very convenient and meet my needs.
The following screenshot is taken when I am designing.

Tuesday, July 1, 2008

侍书待书新说


Dai Shu(1754) ShiShu (1760) Shi Shu (1791)



The controversy of whether the maidservant of Tan Chun in "Stone Story" is Shi Shu or Dai Shu has never met a unanimous idea. But a great idea come to my mind yesterday.

Before pointing out my idea, I will say something about this problem. Many of the handwritten copies label as "Stone Story" use "Dai Shu" while the printed editions labeled as "A dream of red mansions" use "Shi Shu".

My idea is that "Shi Shu" and "Dai shu" are very different in Chinese though, they are almost the same in English. Confused? "Dai Shu" means "wait for books" while "Shi Shu" means "waiter of the books". Get the idea? They ALL need to WAIT! So what the author want to say is that the reader have to wait before reading a book. So "Dai Shu" is better because it directly points out the meaning of wait.

休言举世无谈者,解语何妨话片时

This is my first post of this blog. The title poem is from “a dream of red mansions” aka "Stone Story" which describes that the chrysanthemum is so solitary and aloof that no one can have a talk with her, but the author wants to have a talk with her because she has the same characteristic as the chrysanthemum's.
I haven't set a blog for a long time since I am not good at writing. But even chrysanthemum wants to share her experiences, why I don't. So I decided to set up my blog.

This blog focuses on technology and my personal experiences I'd like to share as well as some misc information about what I've done recently.

Hope you will like my little blog.