如果找到了对您有用的资料,烦请点击右手边的Google广告支持我继续共享知识,谢谢! http://dengpeng.spaces.live.com/

2007年5月15日星期二

Grid Resources Brokers

/* Keywords: Grid, Grid middle ware, Globus Toolkit, Gridway, Gridbus, Gridbus Broker, Nimrod/G, Grid Resource Broker */

Grid Resources Brokers Term Paper

I reserve all rights for this document. Cite it and email me for permission before use. Thank you for your co-operation :)

My email is dengpeng dot cn (at) gmail dot com.

2007年5月13日星期日

悠悠锦官城——记成都

日期:2005-11-29/ 来源:校报第14期 第4版

    写下“成都”这两个字的时候,感动的滋味突然在心里无可抑制地蔓延开来。我所生长的地方,是一个弥漫着氤氲水气的城市,带着南方特有的纤巧和精致。

    成都确是被水萦绕着的城市。它的水不仅是自然的,更是历史与意志的。这水好似它的灵魂,若没了它,便失了那灵气。整座城市都浸在淡淡的、湿润的雾气中,记忆里的那些薄雾好像也带着一抹暗绿。薄雾如纱、天色沉沉,在暗绿色的湿润空气中,成都竟让人疑惑身处江南。

    府南河和春熙路,是成都的两大标志。前者承载着厚重的历史,荡漾着悠远的古风,仿佛依稀可见昔日浣纱溪畔的万种风情;后者则是这个城市都市味道最浓郁的一面,流光溢彩,熙来攘往,红粉如云。漫步在号称西南第一步行街的成都春熙路上,仿佛走在时尚的前沿。街上的行人神色从容,满目都是小巧精致,有着润泽、粉白肌肤的娇俏女子,衣着入时,手上拿着串串香,迈着轻盈的步子,边吃边走、旁若无人,让人目不暇接。成都盛产“红粉”,女孩子娇俏可爱、古灵精怪,但辣妹子火爆的脾气却也是不好消受的。

    成都的美食可谓一绝。夜晚街边的“鬼饮食”让清理违章占道的部门十分头疼,却也形成了一道别样的风景。几十桌上百桌地沿街边铺展开来,其阵容十分壮观。这里的食客是不能按社会阶层划分的,沿街停着奔驰、宝马,也有夏利、奥托,更多的是自行车。这种场景在其他城市很难目睹。在成都浓酽且平和的市井空间里,所谓阶层之间的差距,在一定的场合和特定的时刻,是很容易被模糊的。夜幕下的成都别具一番风情。灯火辉煌、人流如织,人们似乎才从白日的慵懒中苏醒,开始丰富多彩的夜生活。这座不夜城展示出它激情四溢的一面。

    成都人的生活就像杯青花磁茶碗装的盖碗茶,不张不扬,不温不火,不疾不徐,喜怒哀乐随袅袅茶香慢慢蒸发。都说成都人活的悠闲,这主要取决于一种平和笃定、安之若泰的心境。也许正是成都天气的温和湿润,造就了这个奇妙的城市。闲散,安适,滋润,唯美,微微颓废,一切都恰到好处。作个比喻,成都,一块玉!
(信管系  02B11班 左冰洁)

摘自大连东软学院校园文学

2007年5月11日星期五

Term Paper: Processing High Volumes of Streaming Data 巨量数据流处理

/* keywords: Data Stream, Continuous Query Language, Data Stream Management System, 数据流, 连续查询语言, 数据流管理系统 */

433-654 Sensor Networks and Applications论文演讲幻灯片和论文。

Presentation slide:

Processing High Volumes of Streaming Data

巨量数据流处理

Term paper:

Processing High Volumes of Streaming Data (Google Document)

Processing High Volumes of Streaming Data (PDF)

2007年5月3日星期四

Opensource: Parallel Matrix Multiply

Requirements are here: http://www.cs.mu.oz.au/678/assignment2.html or http://www.csse.unimelb.edu.au/678/assignment2.html

 

/*
Name: 433-678 Cluster and Grid Computing
Student Number: 263497
Author: Peng Deng
Login Name: pdeng
Date: 18-04-07 07:50
*/

#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int Number_Of_Nodes, My_Rank, Source=0;

int Number_of_Elements = 0 ;
int Number_of_Rows = 0;
int Remainder;
int Remaind_Elements;

int i, j, k;

double StartTime, EndTime;

char Processor_Name[MPI_MAX_PROCESSOR_NAME];
int NameLength;

int * matrixA; //pointer to matrix A
int * matrixB; //pointer to matrix B
int * matrixC; //pointer to matrix C
int * matrixTemp;
int * matrixTempResult;

int * Data_Counts;
int * Data_Displs;

int size;
size=atoi(argv[1]); // The first argument of the program receives the size of matrices
/* NOTE: The MPICH NT 1.2.5 implementation is different from Linux distributation.*/
/* ONLY Rank = 0 can get the values from command line arguments in Linux distributation. But in mpich nt, every node has this value */

MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &Number_Of_Nodes);
MPI_Comm_rank(MPI_COMM_WORLD, &My_Rank);
MPI_Get_processor_name(Processor_Name,&NameLength);

MPI_Bcast (&size, 1,MPI_INTEGER,Source,MPI_COMM_WORLD); // In The MPICH NT 1.2.5, this line is not necessary

matrixA = (int *) malloc(size * size * sizeof(int)); // this matrix will be scatter to every nodes
matrixB = (int *) malloc(size * size * sizeof(int)); // This matrix will be broadcast to every nodes
matrixC = (int *) malloc(size * size * sizeof(int)); // this matrix will be gather to My_Rank==0 from every nodes

Data_Counts = (int *) malloc(Number_Of_Nodes * sizeof(int)); //int array. Every element in this array contains a value describe how many elements per node.
Data_Displs = (int *) malloc(Number_Of_Nodes * sizeof(int)); //int array. Every element in this array contains a value describe the offset related to matrixA

if(My_Rank == 0)
{
/* fill random number into matrix */
for (k=0; k<size*size; k++)
{
matrixA[k]=rand()/1000;
matrixB[k]=rand()/1000;
}
}

/* check the size and number of nodes in MPI_COMM_WORLD */
if(size % Number_Of_Nodes ==0)
{
Number_of_Rows = size / Number_Of_Nodes; // How many rows per node
Number_of_Elements = size * Number_of_Rows; // Length multiply width. How many elements per node
matrixTemp = (int *) malloc(Number_of_Elements * sizeof(int)); //Store elements in temp array from matrix A
matrixTempResult = (int *) malloc(Number_of_Elements * sizeof(int)); //Store result to temp array

for(i=0; i<Number_Of_Nodes; i++)
{
Data_Counts[i]=Number_of_Elements; // How many elements in the i node
Data_Displs[i]=i * Number_of_Elements; // The start offset of data which will be send to node i related to matrixA(send buffer)
}
}else{
/* Last node takes all remain rows */
/*
Number_of_Rows = size / Number_Of_Nodes; // How many rows per node on average. For example, 8/3=2; 5/2=2; ......
Number_of_Elements = size * Number_of_Rows; // Length multiply width. How many elements per node on average
Remainder = size % Number_Of_Nodes; // How many rows remains. For example, 8%3=2; 5%2=1; ......
Remaind_Elements = size * Remainder; // How many elements remains
matrixTemp = (int *) malloc((Number_of_Elements + Remaind_Elements)* sizeof(int)); //Store elements from matrix A
matrixTempResult = (int *) malloc((Number_of_Elements + Remaind_Elements)* sizeof(int)); //Store result to temp array
for(j=0; j<Number_Of_Nodes-1; j++) // Fill properties of Number_Of_Nodes-1 nodes into int array.
{
Data_Counts[j]=Number_of_Elements; // How many elements in j node, j starts from 0 to Number_Of_Nodes-1. The last node is reserved.
Data_Displs[j]=j * Number_of_Elements; // The start offset of data which will be send to node i related to matrixA(send buffer)
}
//Deal with The last node
Data_Counts[Number_Of_Nodes-1]=Remaind_Elements + Number_of_Elements; // The last node take more workload to do -- Remaind_Elements
Data_Displs[Number_Of_Nodes-1]=(Number_Of_Nodes-1) * Number_of_Elements;
*/


/* The difference number of rows to process on every node is restrict to 1 */
Number_of_Rows = size / Number_Of_Nodes; // How many rows per node on average. For example, 8/3=2; 5/2=2; ......
Number_of_Elements = size * Number_of_Rows; // Length multiply width. How many elements per node on average

Remainder = size % Number_Of_Nodes; // How many rows remains. For example, 8%3=2; 5%2=1; ......
Remaind_Elements = size * Remainder; // How many elements remains

matrixTemp = (int *) malloc((Number_of_Elements + size)* sizeof(int)); //Store elements from matrix A
matrixTempResult = (int *) malloc((Number_of_Elements + size)* sizeof(int)); //Store result to temp array

for(j=0; j<Remainder; j++) // Fill properties of first Number_Of_Nodes nodes into int array.
{
Data_Counts[j]=Number_of_Elements + size; // How many elements in j node, j starts from 0 to Remainder. Every node takes one more row from Remainder.
Data_Displs[j]=j * (Number_of_Elements + size); // The start offset of data which will be send to node i related to matrixA(send buffer)
}

for(i=Remainder; i<Number_Of_Nodes; i++) // Fill properties of latter nodes into int array.
{
Data_Counts[i]=Number_of_Elements; // How many elements in i node, i starts from Remainder to Number_Of_Nodes. These nodes take one less row compare to previous nodes.
Data_Displs[i]=Remainder * (Number_of_Elements + size) + (i - Remainder) * Number_of_Elements; // The start offset of data which will be send to node i related to matrixA(send buffer)
}
}

MPI_Barrier(MPI_COMM_WORLD); // Wait untill all nodes reach this point

StartTime=MPI_Wtime(); // Start time recorded

/* Broadcast matrix B */
MPI_Bcast (matrixB, size*size,MPI_INTEGER,Source,MPI_COMM_WORLD);

/* Scatter matrixA to nodes */
MPI_Scatterv(matrixA, Data_Counts, Data_Displs, MPI_INTEGER, matrixTemp, Data_Counts[My_Rank], MPI_INTEGER, Source, MPI_COMM_WORLD);

/* Do computation matrixTempResult = matrixTemp * matrixB */
for(i=0; i<Data_Counts[My_Rank]/size; i++)
{
for(j=0; j<size; j++)
{
matrixTempResult[size*i+j]=0;
for(k=0; k<size; k++)
{
matrixTempResult[size*i+j] += matrixTemp[i*size+k] * matrixB[k*size+j];
}
}
}
/* Gather matrixTempResult from all nodes to matrixC on source node */
MPI_Gatherv(matrixTempResult, Data_Counts[My_Rank], MPI_INTEGER, matrixC, Data_Counts, Data_Displs, MPI_INTEGER, Source, MPI_COMM_WORLD);

EndTime=MPI_Wtime(); // End time recorded

if(My_Rank==0){
printf("Time: %f\n",EndTime-StartTime); // Print out th time used in the communication and computation
}

/* Free the memory allocations */
free(matrixA);
free(matrixB);
free(matrixC);

MPI_Finalize();
return 0;
}

Resume

Paul Peng DENG (Mr.)                                      Mobile: 04028?????
?????, ?????, Australia                    ????????@????????????

EDUCATION
Master of Engineering in Distributed Computing, University of Melbourne, 2006 – present
Bachelor of Software Engineering, Southwest Petroleum University, 2002 - 2006

HONORS AND AWARDS
3rd Prize “Challenge Cup” National College Science and Technology Competition, China, 2005
ConocoPhillips (China) Scholarship, Southwest Petroleum University, 2004

EXPERIENCE
Sensing Ubiquity Mobility (SUM) Lab Intern, University of Melbourne, 2007 – present

RESEARCH INTERESTS
Wireless Sensor Networks; Human-Computer Interaction; Radio-frequency identification (RFID); High performance cluster and Grid computing; Web application

PROJECTS
Wireless Sensor Network Environmental Monitor: Use WSN to monitor temperature, light changes in physical world. (Sun Small Programmable Object Technology) SUM Research Lab, 2007
Sun SPOT Mouse: Use 3D accelerometer chip in sensor to get human gesture data and emulates mouse actions. SUM Research Lab, 2007
FeedEx RSS Reader: A speech enabled C# RSS Reader. It works like a radio which only speaks news contains keywords defined by you and it also can compress news contents to MP3 files. 2006
Digital Pen: A small pen like device that can record all vector movements while people writing or drawing on any surface and translates recorded data to text or vector image. 2005

SKILLS
Language: Chinese (Native speaker), English
SRA and Documentation: UML, Visio, Rational Rose, LaTex, MS Office, Adobe Acorbat
Implementation: Java, C#, SQL, PHP, Python, C; J2ME, .Net, J2EE, LAMP, MPI, OpenMP; HTML, Ajax, Swing, SWT, WPF; Network Socket, CORBA, RPC, RMI, Web Service, REST; ADO.Net, JDBC, ODBC, ADO; XML, MS SQL 2005/2000, MS Access, Mysql, Oracle 10g, PostgreSQL; Apache Tomcat, Apache Axis, IIS; Windows Server System, Linux/Unix; CVS, SVN
Testing: Mercury WinRunner, Apache JMeter
Build and Installation: Apache Ant, InstallSheild, Nullsoft Scriptable Install System

ACTIVITIES
Lecturer, Introduction to SPOT, Mobile Computing Systems Programming, 8 Aug. 2007
Grid Demo Volunteer, Open Day 2006 at University of Melbourne, 26 Aug. 2006
Founder of Student Photographers’ Task Group, Southwest Petroleum University, 2003-2006
Organizer, Microsoft (China) Presentations in University, Southwest Petroleum University, 2004

2007年4月15日星期日

被点名暴露隐私~

游戏规则:

1.由某个blog发起,出一个题目。

2.在自己的blog中完成题目 (同时以回帖的方式回复在本贴下面),然后点名另外5个blog完成同样的题目

3.另外的5个blog完成题目以后再分别点名,依次类推。

4.被点名的blog在完成题目时要注明被哪个blog点名。

5.点名者要去被点名者的blog里留言,告知他(她)已被点名。

6.不可回传,加一条自己出的题。

1.传下去的五个人

Michael

Kurt

Fedrara

Steve

MZD

2.你的名字

Paul

3.多大

22

4.职业是

计算机的奴隶

5.兴趣是

计算机, 摄影,游泳

6.喜欢的异性类型

不好意思,回答这个问题的时候内存溢出了

7、专长/特技是什么?

睡觉,吃饭

8.有沒有什么证书

小学毕业证,中学毕业证,……没了

9.有烦恼的事情吗

太多了,都忘了

10.喜欢和讨厌的食物

喜欢:都,尤其怀念我妈做的菜,三只耳和溜洋狗

讨厌:肥肉 (出来了,开始吃了…)

11.对你爱的人说一句话

乖

12.请介紹一下你要传下去的那5个人

我是被逼的~~J

13.选一种颜色來比喻传问卷給你的人

红色

14.用一种动物來比喻传问卷給你的人

猎豹

15.用喜欢的角色來比喻传问卷給你的人角色

相当有特色,还没有符合其特色的角色

16.用食物來比喻传问卷給你的人

烧烤

17.用颜色來比喻將接棒的五人

黄色,浅蓝,银色,matrix绿,白色

18.怎么看《东京爱情故事》

没看过

19.你心中最简单卻又最难做到的事情是什么

成功人士

20.有哪三個地方是觉得不去的话就枉度此生的

美国,Google,IBM

21.今天晚上吃什么

方便面

22.如果现在有一碗孟婆汤在你面前 你会喝么?

不喝,我喜欢喝可乐(无糖的那种)

23. 用一款香水或者一种味道來比喻传问卷給你的人

芥末,绝对够劲

24、你最近的一个目标是什么呢?

考试得高分

25、你自己最爱的收藏是什么?

照片,软件

26、现在最想去旅游的地方?(箫扬添加)

悉尼

27、如果有下辈子,你愿意是什么性别?(六弦添加)

美女

28、没有朋友,真正的朋友,你会怎样?(TT添加)

垮掉

29、你知道怎样是爱上一个人吗?(yy+)

不知道

30、喜欢什么样的异性?(day+)

不太清楚,反正走在街上眼睛就没停过

31、圣诞节会送偶一张贺卡不?(Vivi+)

请把电子邮件留下,给你eCard

32,能不能稍稍多关注一下国家队?……(羞愧的飘过)

有难度

33。什么时候能真正富裕起来啊?(曹添加+)

前途渺茫,走一步算一步

34.最想什么时候组建自己的家庭?(靓茹+)

我还是青少年

35.最怕的事情(Annie+)

一直是穷人

36.不开心的时候干什么(Judy+)

喝酒,睡觉

37你最介意自己的男友(女友)什么 (杨磊添加)

心

38 你会为对方改变自己么?(徐佳+)

最开始,我尝试调教她。结果失败,我反而被调教了

39 里面, 最喜欢哪个人物? (Wei Ren +)

周围的人都在看,就我不看

40. 找两三个词形容一下传问卷这个人 (朱学敏 +)

聪明,活力,魅力

41.你能立马写出洛仑兹变换的公式吗? (李爽 +)

最近弄的是矩阵运算和数论…初高中数学40/150分的人,现在天天和数学打交道

42.上次回家看父母是什么时候?(Paul +)

快一年了,但愿明年春节能够回家


被李爽点名

2007年4月2日星期一

Double Click to Run JAR File

Digested from Java Tip 127: See JAR run

The manifest file and the Main-Class entry

Inside most JARs, a file called MANIFEST.MF is stored in a directory called META-INF. Inside that file, a special entry called Main-Class tells the java -jar command which class to execute.

The problem is that you must properly add this special entry to the manifest file yourself—it must go in a certain place and must have a certain format. However, some of us don't like editing configuration files.


Let the API do it for you

Since Java 1.2, a package called java.util.jar has let you work with jar files. (Note: It builds on the java.util.zip package.) Specifically, the jar package lets you easily manipulate that special manifest file via the Manifest class.

Let's write a program that uses this API. First, this program must know about three things:

1. The JAR we wish to make runnable
2. The main class we wish to execute (this class must exist inside the JAR)
3. The name of a new JAR for our output, because we shouldn't simply overwrite files

Write the program

The above list will constitute our program's  arguments. At this point, let's choose a suitable name for this application. How does MakeJarRunnable sound?
Check the arguments to main

Assume our main entry point is a standard main(String[]) method. We should first check the program arguments here:

    if (args.length != 3) {
System.out.println("Usage: MakeJarRunnable "+ "<jar file> <Main-Class><output>");
System.exit(0);
}

Please pay attention to how the argument list is interpreted, as it is important for the following code. The argument order and contents are not set in stone; however, remember to modify the other code appropriately if you change them.



Access the JAR and its manifest file


First, we must create some objects that know about JAR and manifest files:

    //Create the JarInputStream object, and get its manifest
JarInputStream jarIn = new JarInputStream(new FileInputStream(args[0]));
Manifest manifest = jarIn.getManifest();
if (manifest == null) {
//This will happen if no manifest exists
manifest = new Manifest();
}

Set the Main-Class attribute

We put the Main-Class entry in the manifest file's main attributes section. Once we obtain this attribute set from the manifest object, we can set the appropriate main class. However, what if a Main-Class attribute already exists in the original JAR? This program simply prints a warning and exits. Perhaps we could add a command-line argument that tells the program to use the new value instead of the pre-existing one:

    Attributes a = manifest.getMainAttributes();
String oldMainClass = a.putValue("Main-Class", args[1]);
//If an old value exists, tell the user and exit
if (oldMainClass != null) {
System.out.println("Warning: old Main-Class value is: "
+ oldMainClass);
System.exit(1);
}

Output the new JAR

We need to create a new jar file, so we must use the JarOutputStream class. Note: We must ensure we don't use the same file for output as we do for input. Alternatively, perhaps the program should consider the case where the two jar files are the same and prompt the user if he wishes to overwrite the original. However, I reserve this as an exercise for the reader. On with the code!

    System.out.println("Writing to " + args[2] + "...");
JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(args[2]),manifest);
We must write every entry from the input JAR to the output JAR, so iterate over the entries:
    //Create a read buffer to transfer data from the input
byte[] buf = new byte[4096];
//Iterate the entries
JarEntry entry;
while ((entry = jarIn.getNextJarEntry()) != null) {
//Exclude the manifest file from the old JAR
if ("META-INF/MANIFEST.MF".equals(entry.getName())) continue;
//Write the entry to the output JAR
jarOut.putNextEntry(entry);
int read;
while ((read = jarIn.read(buf)) != -1) {
jarOut.write(buf, 0, read);
}
jarOut.closeEntry();
}
//Flush and close all the streams
jarOut.flush();
jarOut.close();
jarIn.close();

Complete program

Of course, we must place this code inside a main method, inside a class, and with a suitable set of import statements. The Resources section provides the complete program.



Usage example


Let's put this program to use with an example. Suppose you have an application whose main entry point is in a class called HelloRunnableWorld. (This is the full class name.) Also assume that you've created a JAR called myjar.jar, containing the entire application. Run MakeJarRunnable on this jar file like so:

java MakeJarRunnable myjar.jar HelloRunnableWorld myjar_r.jar

Again, as mentioned earlier, notice how I order the argument list. If you forget the order, just run this program with no arguments and it will respond with a usage message.

Try to run the java -jar command on myjar.jar and then on myjar_r.jar. Note the difference! After you've done that, explore the manifest files (META-INF/MANIFEST.MF) in each JAR. (You can find both JARs in the source code.)

Here's a suggestion: Try to make the MakeJarRunnable program into a runnable JAR!



Run with it


Running a JAR by double-clicking it or using a simple command is always more convenient than having to include it in your classpath and running a specific main class. To help you do this, the JAR specification provides a Main-Class attribute for the JAR's manifest file. The program I present here lets you utilize Java's JAR API to easily manipulate this attribute and make your JARs runnable.

source code and JARs for this tip