帐前卒专栏

code, software architect, articles and novels.
代码,软件架构,博客和小说

XGuru / CC BY-NC-SA 2.5
# Programmer Competency Matrix
Note that the knowledge for each level is cumulative; being at level n implies that you also know everything from the levels lower than n.
Read more »

copy from http://blog.sina.com.cn/s/blog_598529cd0100ecv9.html

大写 小写 英文注音 国际音标注音 中文注音
Α           α       alpha              alfa                 阿耳法
Β           β       beta                beta                贝塔
Γ           γ       gamma            gamma           伽马
Δ           δ       deta                delta               德耳塔
Ε           ε       epsilon            epsilon           艾普西隆
Ζ           ζ        zeta                zeta                截塔
Η           η       eta                  eta                 艾塔
Θ           θ      theta               θita                 西塔
Ι             ι       iota                  iota                约塔
Κ           κ      kappa              kappa            卡帕
∧          λ      lambda            lambda           兰姆达
Μ          μ        mu                    miu                 缪
Ν           ν        nu                    niu                 纽
Ξ           ξ         xi                     ksi               可塞
Ο           ο      omicron           omikron       奥密可戎
∏           π      pi                     pai                   派
Ρ            ρ      rho                   rou                   柔
∑           σ      sigma              sigma            西格马
Τ            τ        tau                  tau                  套
Υ            υ      upsilon             jupsilon     衣普西隆
Φ           φ       phi                    fai               斐
Χ            χ       chi                  khai               喜
Ψ           ψ       psi                  psai            普西
Ω           ω      omega            omiga         欧米伽

符号表
符号 含义
i -1的平方根
f(x) 函数f在自变量x处的值
sin(x) 在自变量x处的正弦函数值
exp(x) 在自变量x处的指数函数值,常被写作ex
a^x a的x次方;有理数x由反函数定义
ln x exp x 的反函数
ax 同 a^x
logba 以b为底a的对数; blogba = a
cos x 在自变量x处余弦函数的值
tan x 其值等于 sin x/cos x
cot x 余切函数的值或 cos x/sin x
sec x 正割含数的值,其值等于 1/cos x
csc x 余割函数的值,其值等于 1/sin x
asin x y,正弦函数反函数在x处的值,即 x = sin y
acos x y,余弦函数反函数在x处的值,即 x = cos y
atan x y,正切函数反函数在x处的值,即 x = tan y
acot x y,余切函数反函数在x处的值,即 x = cot y
asec x y,正割函数反函数在x处的值,即 x = sec y
acsc x y,余割函数反函数在x处的值,即 x = csc y
θ 角度的一个标准符号,不注明均指弧度,尤其用于表示atan x/y,当x、y、z用于表示空间中的点时
i, j, k 分别表示x、y、z方向上的单位向量
(a, b, c) 以a、b、c为元素的向量
(a, b) 以a、b为元素的向量
(a, b) a、b向量的点积
a•b a、b向量的点积
(a•b) a、b向量的点积
|v| 向量v的模
|x| 数x的绝对值
Σ 表示求和,通常是某项指数。下边界值写在其下部,上边界值写在其上部。如j从1到100的和可以表示成:。这表示 1 + 2 + … + n
M 表示一个矩阵或数列或其它
|v> 列向量,即元素被写成列或可被看成k×1阶矩阵的向量
<v| 被写成行或可被看成从1×k阶矩阵的向量
dx 变量x的一个无穷小变化,dy, dz, dr等类似
ds 长度的微小变化
ρ 变量 (x2 + y2 + z2)1/2 或球面坐标系中到原点的距离
r 变量 (x2 + y2)1/2 或三维空间或极坐标中到z轴的距离
|M| 矩阵M的行列式,其值是矩阵的行和列决定的平行区域的面积或体积
||M|| 矩阵M的行列式的值,为一个面积、体积或超体积
det M M的行列式
M-1 矩阵M的逆矩阵
v×w 向量v和w的向量积或叉积
θvw 向量v和w之间的夹角
A•B×C 标量三重积,以A、B、C为列的矩阵的行列式
uw 在向量w方向上的单位向量,即 w/|w|
df 函数f的微小变化,足够小以至适合于所有相关函数的线性近似
df/dx f关于x的导数,同时也是f的线性近似斜率
f ' 函数f关于相应自变量的导数,自变量通常为x
∂f/∂x y、z固定时f关于x的偏导数。通常f关于某变量q的偏导数为当其它几个变量固定时df与dq的比值。任何可能导致变量混淆的地方都应明确地表述
(∂f/∂x)|r,z 保持r和z不变时,f关于x的偏导数
grad f 元素分别为f关于x、y、z偏导数 [(∂f/∂x), (∂f/∂y), (∂f/∂z)] 或 (∂f/∂x)i + (∂f/∂y)j + (∂f/∂z)k; 的向量场,称为f的梯度
向量算子(∂/∂x)i + (∂/∂x)j + (∂/∂x)k, 读作 "del"
∇f f的梯度;它和 uw 的点积为f在w方向上的方向导数
∇•w 向量场w的散度,为向量算子∇ 同向量 w的点积, 或 (∂wx /∂x) + (∂wy /∂y) + (∂wz /∂z)
curl w 向量算子 ∇ 同向量 w 的叉积
∇×w w的旋度,其元素为[(∂fz /∂y) - (∂fy /∂z), (∂fx /∂z) - (∂fz /∂x), (∂fy /∂x) - (∂fx /∂y)]
∇•∇ 拉普拉斯微分算子: (∂2/∂x2) + (∂/∂y2) + (∂/∂z2)
f "(x) f关于x的二阶导数,f '(x)的导数
d2f/dx2 f关于x的二阶导数
f(2)(x) 同样也是f关于x的二阶导数
f(k)(x) f关于x的第k阶导数,f(k-1) (x)的导数
T 曲线切线方向上的单位向量,如果曲线可以描述成 r(t), 则T = (dr/dt)/|dr/dt|
ds 沿曲线方向距离的导数
κ 曲线的曲率,单位切线向量相对曲线距离的导数的值:|dT/ds|
N dT/ds投影方向单位向量,垂直于T
B 平面T和N的单位法向量,即曲率的平面
τ 曲线的扭率: |dB/ds|
g 重力常数
F 力学中力的标准符号
k 弹簧的弹簧常数
pi 第i个物体的动量
H 物理系统的哈密尔敦函数,即位置和动量表示的能量
{Q, H} Q, H的泊松括号
以一个关于x的函数的形式表达的f(x)的积分
函数f 从a到b的定积分。当f是正的且 a < b 时表示由x轴和直线y = a, y = b 及在这些直线之间的函数曲线所围起来图形的面积
L(d) 相等子区间大小为d,每个子区间左端点的值为 f的黎曼和
R(d) 相等子区间大小为d,每个子区间右端点的值为 f的黎曼和
M(d) 相等子区间大小为d,每个子区间上的最大值为 f的黎曼和
m(d) 相等子区间大小为d,每个子区间上的最小值为 f的黎曼和

+:plus(positive正的)
-:minus(negative负的)
*:multiplied by
÷:divided by
=:be equal to
≈:be approximately equal to
():round brackets(parenthess)
[]:square brackets
{}:braces
∵:because
∴:therefore
≤:less than or equal to
≥:greater than or equal to
∞:infinity
LOGnX:logx to the base n
xn:the nth power of x
f(x):the function of x
dx:diffrencial of x
x+y:x plus y
(a+b):bracket a plus b bracket closed
a=b:a equals b
a≠b:a isn’t equal to b
a>b:a is greater than b
a>>b:a is much greater than b
a≥b: a is greater than or equal to b
x→∞:x approches infinity
x2:x square
x3:x cube
√ ̄x:the square root of x
3√ ̄x:the cube root of x
3‰:three peimill
n∑i=1xi:the summation of x where x goes from 1to n
n∏i=1xi:the product of x sub i where igoes from 1to n
∫ab:integral betweens a and b

There is a small example copied from postgreSQL.org

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
45
46
47
48
49
50
51
52
53
54
55

/*
* libpq sample program
*/

#include <stdio.h>
#include <stdlib.h>
#include "libpq-feh" /* libpq header file */

int main()
{
char state_code[3]; /* holds user state code */
char query_string[256]; /* holds constructed SQL query */
PGconn *conn; /* holds database connection */
PGresult *res; /* holds query result */
int i;

conn = PQconnectdb("dbname=test"); /* connect to the database */

if (PQstatus(conn) == CONNECTION_BAD) /* did the connection fail? */
{
fprintf(stderr, "Connection to database failed.\n");
fprintf(stderr, "%s", PQerrorMessage(conn));
exit(1);
}

printf("Enter a state code: "); /* prompt user for a state code */
scanf("%2s", state_code);

sprintf(query_string, /* create an SQL query string */
"SELECT name \
FROM statename \
WHERE code = '%s'", state_code);

res = PQexec(conn, query_string); /* send the query */

if (PQresultStatus(res) != PGRES_TUPLES_OK) /* did the query fail? */
{
fprintf(stderr, "SELECT query failed.\n");
PQclear(res);
PQfinish(conn);
exit(1);
}

for (i = 0; i &lt; PQntuples(res); i++) /* loop through all rows returned */
printf("%s\n", PQgetvalue(res, i, 0)); /* print the value returned */

PQclear(res); /* free result */

PQfinish(conn); /* disconnect from the database */

return 0;
}


above is how to connect localhost database. If you want to connect with remote postgreSQL server. You will following those rules(copied from vivek):

Step # 1: Login over ssh if server is outside your IDC

1
$ ssh [email protected]

Step # 2: Enable client authentication

Once connected, you need edit the PostgreSQL configuration file, edit the PostgreSQL configuration file /var/lib/pgsql/data/pg_hba.conf (or /etc/postgresql/8.2/main/pg_hba.conf for latest 8.2 version) using a text editor such as vi.

Login as postgres user using su / sudo command, enter:

1
2
3
4
5
6
7
8
$ su - postgres
Edit the file:
$ vi /var/lib/pgsql/data/pg_hba.conf
OR
$ vi /etc/postgresql/8.2/main/pg_hba.conf
Append the following configuration lines to give access to 10.10.29.0/24 network:
host all all 10.10.29.0/24 trust

Save and close the file. Make sure you replace 10.10.29.0/24 with actual network IP address range of the clients system in your own network.

Step # 3: Enable networking for PostgreSQL

You need to enable TCP / IP networking. Use either step #3 or #3a as per your PostgreSQL database server version.

Step # 4: Allow TCP/IP socket

If you are using PostgreSQL version 8.x or newer use the following instructions or skip to Step # 3a for older version (7.x or older).

You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf or /etc/postgresql/8.2/main/postgresql.conf.

1
2
3
4
5
6
7
8
9
# vi /etc/postgresql/8.2/main/postgresql.conf
OR
# vi /var/lib/pgsql/data/postgresql.conf
Find configuration line that read as follows:
listen_addresses='localhost'
Next set IP address(es) to listen on; you can use comma-separated list of addresses; defaults to 'localhost', and '*' is all ip address:
listen_addresses='*'
Or just bind to 202.54.1.2 and 202.54.1.3 IP address
listen_addresses='202.54.1.2 202.54.1.3'

Save and close the file. Skip to step # 4.

Step #4a - Information for old version 7.x or older

Following configuration only required for PostgreSQL version 7.x or older. Open config file, enter:

1
2
3
# vi /var/lib/pgsql/data/postgresql.conf
Bind and open TCP/IP port by setting tcpip_socket to true. Set / modify tcpip_socket to true:
tcpip_socket = true

Save and close the file.

Step # 5: Restart PostgreSQL Server

Type the following command:

1
2
# /etc/init.d/postgresql restart

Step # 6: Iptables firewall rules

Make sure iptables is not blocking communication, open port 5432 (append rules to your iptables scripts or file /etc/sysconfig/iptables):

1
2
3
4
5
6
7
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 10.10.29.50  --dport 5432\
 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 10.10.29.50 --sport 5432 -d 0/0 --dport \
1024:65535 -m state --state ESTABLISHED -j ACCEPT
Restart firewall:
# /etc/init.d/iptables restart

Step # 7: Test your setup

Use psql command from client system. Connect to remote server using IP address 10.10.29.50 and login using vivek username and sales database, enter:

1
2
$ psql -h 10.10.29.50 -U vivek -d sales

Step #8: Change your code

1
2
3
4
const char * connstr = "host='10.10.29.50' dbname='my_database' user='postgres' password='secret'"
conn = PQconnectdb(connstr); /* connect to the database */


转载自:http://www.cnblogs.com/luliang/archive/2008/08/21/1272746.html

** 1 基本解释
** extern可以置于变量或者 函数 前,以标示变量或者 函数 的定义在别的文件中,提示编译器遇到此变量和 函数 时在其他模块中寻找其定义。
另外,extern也可用来进行链接指定。

** 2 问题:extern 变量 **
在一个源文件里定义了一个数组:char a[6];
在另外一个文件里用下列语句进行了声明:extern char *a;
请问,这样可以吗?
答案与分析:
1)、不可以,程序运行时会告诉你非法访问。原因在于,指向类型T的 指针 并不等价于类型T的数组。extern char a声明的是一个 指针
变量而不是字符数组,因此与实际的定义不同,从而造成运行时非法访问。应该将声明改为extern char a[ ]。
2)、例子分析如下,如果a[] = “abcd”,则外部变量a=0x61626364 (abcd的ASCII码值),a显然没有意义
显然a指向的空间(0x61626364)没有意义,易出现非法内存访问。
3)、这提示我们,在使用extern时候要严格对应声明时的格式,在实际编程中,这样的错误屡见不鲜。
4)、extern用在变量声明中常常有这样一个作用,你在
.c文件中声明了一个全局的变量,这个全局的变量如果要被引用,就放在
.h中并用extern来声明。
** 4 问题:extern 函数 2 **
当 函数 提供方单方面修改 函数 原型时,如果使用方不知情继续沿用原来的extern申明,这样编译时编译器不会报错。但是在运行过程中,因为少了或者多
了输入参数,往往会照成系统错误,这种情况应该如何解决?
答案与分析:
目前业界针对这种情况的处理没有一个很完美的方案,通常的做法是提供方在自己的xxx_pub.h中提供对外部 接口
的声明,然后调用方include该头文件,从而省去extern这一步。以避免这种错误。
宝剑有双锋,对extern的应用,不同的场合应该选择不同的做法。

** 5 问题:extern “C” **
在 C++ 环境下使用C 函数 的时候,常常会出现编译器无法找到obj模块中的C 函数 定义,从而导致链接失败的情况,应该如何解决这种情况呢?

答案与分析:
C++ 语言在编译的时候为了解决 函数 的多态问题,会将 函数 名和参数联合起来生成一个中间的 函数 名称,而 C语言
则不会,因此会造成链接时找不到对应 函数 的情况,此时C 函数 就需要用extern
“C”进行链接指定,这告诉编译器,请保持我的名称,不要给我生成用于链接的中间 函数 名。
下面是一个标准的写法:
//在.h文件的头上
#ifdef __cplusplus
#if __cplusplus
extern “C”{
#endif
#endif /* __cplusplus /


//.h文件结束的地方
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /
__cplusplus */

** 3 问题:extern 函数 1 **
常常见extern放在 函数 的前面成为 函数 声明的一部分,那么, C语言 的关键字extern在 函数 的声明中起什么作用?
答案与分析:
如果 函数 的声明中带有关键字extern,仅仅是暗示这个 函数 可能在别的源文件里定义,没有其它作用。即下述两个 函数 声明没有明显的区别:
extern int f(); 和int f();
当然,这样的用处还是有的,就是在程序中取代include “*.h”来声明 函数 ,在一些复杂的项目中,我比较习惯在所有的 函数
声明前添加extern修饰。

Now I should do some work in investgate Facebook API. The Facebook API can be called as the following format( I use php as an example):
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
&lt;?php
/**
* Set the configuration settings for Facebook
*/
~~$~~facebook_config['debug'] = false;
$facebook_config['api_key'] = '&lt;your_api_key&gt;';
$facebook_config['secret_key'] = '&lt;your_secret_key&gt;';
/**
* include the Facebook client library
*/
require_once('&lt;path_to_client_library&gt;/facebook.php');
/**
* Set up the facebook object
*/
$facebook = new Facebook($facebook_config['api_key'],
$facebook_config['secret']);
/**
* Ensure the user has logged on to Facebook
*/
$user = $facebook-&gt;require_login();
/**
* Make an API call to call get a user's friends using the PHP library's
* library
*/
$friends = $facebook-&gt;api_client-&gt;friends_get();
echo "&lt;pre&gt;Friends:" . print_r($friends, true). "&lt;/pre&gt;";
?&gt;

The structure of the above codes is:

  • set api_key and secret_key by your own
  • send facebook_config to Facebook class and create an object of Facebook.
  • call some method of this object and get some data of facebook which you want
  • using those data to create an application
In technology, facebook uses RESTful technology, such as web services. facebook api transform data in JSON or XML format. And FBML( facebook Markup Language ) is used to combine and present data coming from developers' application servers. There are some technologic points: first, APIs should be packet into web services. Second, developers' application data should be presented in web pages. But I don't think there is new technology here.

The flow diagram of calling facebook api is:

Chinese version is here:

Facebook_API.doc

the price of borrowing a boy-friend in international women’s day.

今天12点的火车,想想这三个星期也没有在家干啥事。不过是吃吃喝喝,看看电视电影,聚聚会,玩玩游戏,编编程。不过在家里就是放松,不管啥时候进家都犯困。今天自己
查了下这个blog的pagerank,发现已经到6.还算不错。自己新开的blog:chillyc.info还依旧是0。虽然在春节前后经历了垃圾评论的洪泛攻击
,点击率是直线上升,可惜pr依旧是0。这只能说指向它的那几个网站排名还相对差一点,以及他指向的还大多是无名的网站。不过seo倒是挺有点子,找到某个网站的跟帖
处,只要没有验证码就不停的洪泛呀,评论里不忘粘贴些自己的地址啥的。这样做虽然有点技术含量,但是google貌似已经对此种做法有一定的戒备,所以得不偿失。只是
可怜我不停的删除垃圾评论。暑假里也看了阿凡达、风声、吉普森的一家、潘神的迷宫啥的。都是一些不错的片子。只不过没有来得及写下自己的评论。玩过不少的游戏,也没有
一一做评。归家的火车上看到一群科苑的小朋友们在火车上玩三国杀,玩得不亦乐乎。但是距他们较远,并且自己需看好行李,所以也就没有参与。杀人游戏规则是相对简单的,
但是要求人们要诚实守信。三国杀到没这要求,不过规则比较繁琐,并且大都是有二义性的规则构成,所以解释起来比较麻烦。在家参加聚会,大多只是和三五个好友一起聚聚。
人多反而觉得不热闹。工作的都工作的安居乐业,学习的也多混出了点名堂。浩浩说要回国,我实在想不通在日本打工和在中国打工到底有啥差别。在国外打工的钱至少还能在国
内买套房子。浩浩或者自觉不是苦命的主,可能决心回国创业。小杜子在德意志幸好学对了专业,如果学金融恐怕回国都找不到工作。话说老板有心让门下的弟子去德意志学学计
算机,可惜没有积极响应号召的人。或许大家都觉得德国经济维持不了他们的工资罢了。不过学了八年之后德国经济是否能养的起呢?这又是一个未知数。正如做研究,总是在未
知中寻找已知。却发现啥事往往是自己说了算,无须证明。因为这本来就是一个NP,没有人会怪你为啥不能更好。计算机界的科研中或许有许多有趣的现象,好看的规律,值得
人们去研究。不过在研究的路上有一个难题人们始终无法解决。人们喜欢绕开它继续前行。不知谁曾说过一句话:计算机科学本不是科学。我更觉得它只是在数据上的数学推演。
不知是看透才觉得黑暗,还是因为看不透才觉得更加黑暗。既然大家都在走,那就认定一个方向走呗。走的再远,心还是近的。

该是出发的时候了。

Glory be to Google,
As it was in 1998,
Is now,
And ever shall be,
Searching without end,
Amen.

By Todd Berry

Our Google, who art in internet,
Greatness be thy Name.
Thy Answers come.
When Searches be Done,
On Pc’s as its calculated in internet.
Give us our Maps and daily Gmail.
And give us our Daily Trends,
As we seek out those in ZeitGeist.
And lead us not into the darkness of MSN,
But deliver us from Microsoft.
The Google is my Lord; I shall never want,
Thy Maketh me search in the great vastness:
Thy leadeth me to proper results.
Thy Restoreth my page:
Thy leadeth me in the links of righteiusness for the crawlers sake.
YEA!!! though I walk through the Valley of the shadow of Microsoft.
I will “do no evil” For thou art with me;
Oh, thy Picasa and thy webaccelerator, they Comfort me,
Thou preparest a page before me in the presence of mine enemies:
Microsoft, Yahoo, Aim, and others who give to evil too willingly.
Oh, my cache runneth over with your light.
Surely security and viruslessness shall follow me all the days of my life:
and I will dwell in the system of the Google for ever.
Heil to your Greatness;
For thine is the truest Kingdom of all,
and the Ultimate Power,
and the Glory,
for ever and ever.
For you are all knowing and good.
Amen

By Texas Schultz

Trust in the GOOGLE with all your heart
and lean not on your own understanding;
in all your ways acknowledge Her,
and She will direct your paths.

By Susan Harrison

The Google is my Engine; I shall not want.
She maketh me to improve myself:
She leadeth me to troves of knowledge.
She cacheth my lost pages:
She leadeth me in the paths of pagerank for her name’ sake.

Yea, though I walk through the valley of the shadow of ignorance,
I will fear no linkfarms: For thou art with me;
Thy rank and thy mail, they comfort me.
Thou preparest tables before me with the presence of mine results;
Thou annointest my search with value; My content runneth over.

Surely pagerank and content shall follow me all the days of my life,
and I will dwell at the site of Google forever.

By Gavin McDonald

Dear users, we had joined this newsgroup (forum/chat/chainletter/etc) to unite certain two of you in a holy and(,,…) function. and (and others, if there`s more then two), please, come forward with your posts.

(Involved users acknowledge presence)

If any of the present here has an exception to raise against this function, speak up now, or erase tbe function call forever!

(pause for objections)

Let us proceed! Users, exchange parity bits!

(users exchange bits (use imagination _))

By the grace of our lord omnipotent, Google, I declare this search a successful one, and merge the caches of users in one. You may now perform CRC checks.

(Festivities commence. Cake should be divided with N cuts through (where N is number of users present), and each user has to have two slices. Cake is advocated to be .jpg, .gif, .png, or ASCII art for old-time people.)

By Alice Shade

Google grant me
Serenity to accept search engines that fail to produce,
Courage to explore new things Google, and
Wisdom to know that Google will dominate.
Amen.

By Mathew Taylor

This prayer is in binary.

01010111 01100101 00100000 01101010 01101111 01101001 01101110 00100000 01110100 01101111 01100111 01100101 01110100 01101000 01100101 01110010 00100000 01110100 01101111 00100000 01110100 01101000 01100001 01101110 01101011 00100000 01000111 01101111 01101111 01100111 01101100 01100101 00100000 01100110 01101111 01110010 00100000 01110100 01101000 01100101 00100000 01101011 01101110 01101111 01110111 01101100 01100001 01100111 01100101 00100000 01100001 01101110 01100100 00100000 01110111 01101001 01110011 01100100 01101111 01101101 00100000 01110011 01101000 01100101 00100000 01100010 01110010 01101001 01101110 01100111 01110011

By Jonathan Hill

this is a small game to find the play icon.

the play icon is in every screening.

here is the address of small flash game:

http://www.ilogoer.com.cn/artical/vd/vd074.aspx

Recently, I have not taken care of this web site. It is filled with spam comments. Some SEO companies use this technology to improve some sites page-rank. Now I use CAPTCHA code to stop spam flood.

0%