11 7, 2008

Obama’s Victory Speech in Chicago



Transcript

Hello, Chicago. (Cheers, applause.)

If there is anyone out there who still doubts that America is a place where all things are possible, who still wonders if the dream of our Founders is alive in our time, who still questions the power of our democracy, tonight is your answer. (Cheers, applause.)

It's the answer told by lines that stretched around schools and churches in numbers this nation has never seen, by people who waited three hours and four hours, many for the first time in their lives, because they believed that this time must be different, that their voices could be that difference.

It's the answer spoken by young and old, rich and poor, Democrat and Republican, black, white, Hispanic, Asian, Native American, gay, straight, disabled and not disabled -- (cheers) -- Americans who sent a message to the world that we have never been just a collection of individuals or a collection of red states and blue states; we are and always will be the United States of America. (Cheers, applause.)

It's the answer that -- that led those who've been told for so long by so many to be cynical and fearful and doubtful about what we can achieve to put their hands on the arc of history and bend it once more toward the hope of a better day. It's been a long time coming, but tonight, because of what we did on this day, in this election, at this defining moment, change has come to America. (Cheers, applause.)

A little bit earlier this evening, I received an extraordinarily gracious call from Senator McCain. (Cheers, applause.) Senator McCain fought long and hard in this campaign, and he's fought even longer and harder for the country that he loves. He has endured sacrifices for America that most of us cannot begin to imagine. We are better off for the service rendered by this brave and selfless leader. (Applause.) I congratulate him, I congratulate Governor Palin for all they've achieved, and I look forward to working with them to renew this nation's promise in the months ahead. (Cheers, applause.)

I want to thank my partner in this journey, a man who campaigned from his heart and spoke for the men and women he grew up with on the streets of Scranton, and rode with on the train home to Delaware, the vice president-elect of the United States, Joe Biden. (Cheers, applause.)

And I would not be standing here tonight without the unyielding support of my best friend for the last 16 years, the rock of our family, the love of my life, the nation's next first lady, Michelle Obama. (Cheers, applause.)

Sasha and Malia, I love you both more than you can imagine, and you have earned the new puppy that's coming with us to the White House. (Cheers, applause.)

And while she's no longer with us, I know my grandmother is watching, along with the family that made me who I am. I miss them tonight, and know that my debt to them is beyond measure.

To my sister Maya, my sister Auma, all my other brothers and sisters, thank you so much for all the support that you've given to me. I am grateful to them. (Cheers, applause.)

And to my campaign manager, David Plouffe -- (cheers, applause) -- the unsung hero of this campaign who built the best -- (cheers) -- the best political campaign I think in the history of the United States of America -- (cheers, applause) -- to my chief strategist, David Axelrod -- (cheers, applause) -- who has been a partner with me every step of the way, to the best campaign team ever assembled in the history of politics -- (cheers) -- you made this happen, and I am forever grateful for what you've sacrificed to get it done. (Cheers, applause.)

But above all, I will never forget who this victory truly belongs to. It belongs to you. (Cheers, applause.) It belongs to you. (Cheers.)

I was never the likeliest candidate for this office. We didn't start with much money or many endorsements. Our campaign was not hatched in the halls of Washington; it began in the backyards of Des Moines and the living rooms of Concord and the front porches of Charleston. It was built by working men and women who dug into what little savings they had to give $5 and $10 and $20 to the cause. (Cheers, applause.) It grew strength from the young people who rejected the myth of their generation's apathy -- (cheers) -- who left their homes and their families for jobs that offered little pay and less sleep. It drew strength from the not-so-young people who braved the bitter cold and scorching heat to knock on the doors of perfect strangers, and from the millions of Americans who volunteered and organized, and proved that more than two centuries later a government of the people, by the people and for the people has not perished from the Earth. This is your victory. (Cheers, applause.)

Now, I know you didn't do this just to win an election, and I know you didn't do it for me. You did it because you understand the enormity of the task that lies ahead. For even as we celebrate tonight, we know the challenges that tomorrow will bring are the greatest of our lifetime: two wars, a planet in peril, the worst financial crisis in a century. Even as we stand here tonight, we know there are brave Americans waking up in the deserts of Iraq and the mountains of Afghanistan to risk their lives for us. There are mothers and fathers who will lie awake after their children fall asleep and wonder how they'll make the mortgage or pay their doctors' bills or save enough for their child's college education.

There's new energy to harness, new jobs to be created, new schools to build, and threats to meet, alliances to repair.

The road ahead will be long. Our climb will be steep. We may not get there in one year or even in one term, but America, I have never been more hopeful than I am tonight that we will get there. I promise you: We as a people will get there. (Cheers, applause.)

AUDIENCE: Yes, we can! Yes, we can! Yes, we can! Yes, we can! Yes, we can!

MR. OBAMA: There will be setbacks and false starts. There are many who won't agree with every decision or policy I make as president, and we know the government can't solve every problem. But I will always be honest with you about the challenges we face. I will listen to you, especially when we disagree. And above all, I will ask you to join in the work of remaking this nation the only way it's been done in America for 221 years -- block by block, brick by brick, calloused hand by calloused hand.

What began 21 months ago in the depths of winter cannot end on this autumn night. This victory alone is not the change we seek; it is only the chance for us to make that change.

And that cannot happen if we go back to the way things were. It can't happen without you, without a new spirit of service, a new spirit of sacrifice. So let us summon a new spirit of patriotism, of responsibility where each of us resolves to pitch in and work harder and look after not only ourselves, but each other.

Let us remember that if this financial crisis taught us anything, it's that we cannot have a thriving Wall Street while Main Street suffers. In this country, we rise or fall as one nation; as one people.

Let's resist the temptation to fall back on the same partisanship and pettiness and immaturity that has poisoned our politics for so long. Let's remember that it was a man from this state who first carried the banner of the Republican Party to the White House -- a party founded on the values of self-reliance and individual liberty and national unity. Those are values we all share. And while the Democratic Party has won a great victory tonight, we do so with a measure of humility and determination to heal the divides that have held back our progress. (Cheers, applause.)

As Lincoln said to a nation far more divided than ours, "We are not enemies, but friends -- though passion may have strained it must not break our bonds of affection." And to those Americans whose support I have yet to earn, I may not have won your vote tonight, but I hear your voices, I need your help, and I will be your president too. (Cheers, applause.)

And to all those watching tonight from beyond our shores, from parliaments and palaces to those who are huddled around radios in the forgotten corners of the world, our stories are singular, but our destiny is shared, and a new dawn of American leadership is at hand. (Cheers, applause.) To those -- to those who would tear the world down: we will defeat you. (Cheers, applause.) To those who seek peace and security: we support you. (Cheers, applause.) And to all those who have wondered if America's beacon still burns as bright: tonight we proved once more that the true strength of our nation comes not from the might of our arms or the scale of our wealth, but from the enduring power of our ideals -- democracy, liberty, opportunity and unyielding hope. (Cheers, applause.)

That's the true genius of America, that America can change. Our union can be perfected. And what we have already achieved gives us hope for what we can and must achieve tomorrow.

This election had many firsts and many stories that will be told for generations. But one that's on my mind tonight's about a woman who cast her ballot in Atlanta. She is a lot like the millions of others who stood in line to make their voice heard in this election, except for one thing: Ann Nixon Cooper is 106 years old. (Cheers, applause.)

She was born just a generation past slavery; a time when there were no cars on the road or planes in the sky; when someone like her couldn't vote for two reasons, because she was a woman and because of the color of her skin. And tonight, I think about all that she's seen throughout her century in America: the heartache and the hope, the struggle and the progress, the times we were told that we can't, and the people who pressed on with that American creed, yes we can.

At a time when women's voices were silenced and their hopes dismissed, she lived to see them stand up and speak out and reach for the ballot. Yes we can.

When there was despair in the Dust Bowl and depression across the land, she saw a nation conquer fear itself with a New Deal, new jobs, a new sense of common purpose. Yes we can.

AUDIENCE: Yes we can!

MR. OBAMA: When the bombs fell on our harbor and tyranny threatened the world, she was there to witness a generation rise to greatness and a democracy was saved. Yes we can.

AUDIENCE: Yes we can!

MR. OBAMA: She was there for the buses in Montgomery, the hoses in Birmingham, a bridge in Selma, and a preacher from Atlanta who told a people that "We shall overcome." Yes we can.

AUDIENCE: Yes we can!

MR. OBAMA: A man touched down on the Moon, a wall came down in Berlin, a world was connected by our own science and imagination. And this year, in this election, she touched her finger to a screen and cast her vote, because after 106 years in America, through the best of times and the darkest of hours, she knows how America can change.

Yes, we can.

AUDIENCE: Yes, we can.

MR. OBAMA: America, we have come so far. We have seen so much. But there's so much more to do. So tonight let us ask ourselves, if our children should live to see the next century, if my daughters should be so lucky to live as long as Ann Nixon Cooper, what change will they see? What progress will we have made?

This is our chance to answer that call. This is our moment. This is our time -- to put our people back to work and open doors of opportunity for our kids; to restore prosperity and promote the cause of peace; to reclaim the American dream and reaffirm that fundamental truth that out of many, we are one; that while we breathe, we hope; and where we are met with cynicism and doubt and those who tell us that we can't, we will respond with that timeless creed that sums up the spirit of a people: Yes, we can.

AUDIENCE: Yes, we can.

MR. OBAMA: Thank you. God bless you. And may God bless the United States of America. (Cheers, applause.)

07 29, 2008

J2EE环境下web前端优化方案

软件产品(项目)中的数据库schema管理方案

1. 方案目标
a. 实现数据库schema和源程序的同步
b. 为开发人员、测试人员创建个人的数据库开发环境提供可能
c. 可以和Continuous Integration服务器集成

2. 文件目录结构
与数据库相关的内容以sql文件的形式存在。
sql文件主要包含以下几方面内容:
a. 表、视图、存储过程等创建语句
b. 表外键等约束关系创建语句
c. 数据库最基本的数据初始化语句
d. 系统测试环境、开发环境需要的初始化语句

对于比较大的软件系统而言,建议以模块为单位来组织相关的sql语句。同一模块的相关sql语句在同一文件中。
以CRM系统为例(假设产品为BlueCrm),sql文件目录结构可如下组织:

blumcrm
build.xml
src

    java

    test
database

    oracle

        bluecrm.sql

        bluecrm-create.sql

        bluecrm-key.sql

        bluecrm-data.sql

        module1

            module1.sql

            module1-create.sql

            module1-key.sql

            module1-data.sql

        module2

            module2-create.sql

            module2-key.sql

            module2-data.sql

        module3

        ...

        ...

*create.sql为对象(表、序列、视图)创建语句

*key.sql为表外键建立语句

*.data.sql为该模块的初始化插入数据


module1.sql语句调用该模块的sql语句,以oracle为例,可写为:

@module1-create.sql
@module1-key.sql

@module1-data.sql
COMMIT;


bluecrm-create.sql语句调用各模块的*create.sql语句

@module1/module1-create.sql
@module2/module2-create.sql
COMMIT;

bluecrm.sql语句为所有sql语句的总入口:

@bluecrm-create.sql;
@bluecrm-key.sql
@bluecrm-data.sql;

bluecrm.sql语句应以建表、外键、数据的先后顺序创建。bluecrm.sql主要由数据库的客户端使用,在CI时一般不使用该入口语句。

我们的CI服务器最终使用ant来创建数据库,相关的脚本可如下所示:

<target name="db-create" depends="init" description="creates database tables for ${database.type}">
    <echo message="Detected Oracle, creating database..."/>
    <echo>Creating database for user '${jdbc.username}'</echo>
    <echo>URL: ${jdbc.url}</echo>
   
    <sql onerror="continue" encoding="GBK"
            driver="${jdbc.driverClassName}"
            url="${jdbc.url}"
            userid="${jdbc.username}"
            password="${jdbc.password}">
        <classpath refid="compile.classpath"/>
        <fileset dir="${basedir}/database/oracle">
            <exclude name="*.sql"/>
            <include name="**/*-create.sql"/>
        </fileset>
        <fileset dir="${basedir}/database/oracle">
            <exclude name="*.sql"/>
            <include name="**/*-key.sql"/>
        </fileset>
        <fileset dir="${basedir}/database/oracle">
            <exclude name="*.sql"/>
            <include name="**/*-data.sql"/>
        </fileset>
    </sql>
</target>


3. 使用方法

开发人员可以修改本地环境的相应数据库链接参数,创建自己开发使用的数据库环境。

测试系统可以根据测试需要增加相应的初始化测试数据脚本来满足不同的测试环境需要。

无论是开发人员还是测试人员一般都是运行ant db-create命令来初始化数据库环境。

开发人员也可以运行某个模块下的语句如module1.sql来重新初始化本模块的相关数据库对象。


07 20, 2008

浏览器并发请求连接数

浏览器在同一时刻能够下载的最大资源数受到浏览器的最大并发链接数限制,HTTP1.1规范里推荐最大链接数不要超过2. 这也是目前主流的浏览器(IE6 IE7 FF2)的缺省值。FF3的缺省值为6,IE8的为18.

Browser 
       max-connections/server
IE6                  2
IE7                  2
IE8                  18
FireFox2           2
FireFox3           6

FireFox3的参数在Firefox3\greprefs\all.js中。
pref("network.http.max-connections", 30);
pref("network.http.max-connections-per-server", 15);
pref("network.http.max-persistent-connections-per-server", 6);
pref("network.http.max-persistent-connections-per-proxy", 8);

IE的参数修改方法可参考 http://support.microsoft.com/?kbid=282402

以上参数全部实在Http1.1协议下。Http1.0协议对应的值一般要稍大一倍。
参考资料:
https://bugzilla.mozilla.org/show_bug.cgi?id=423377
http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/
http://www.ajaxperformance.com/2008/03/16/testing-ie8s-connection-parallelism/

07 19, 2008

Web前端优化基本原则

Steve SoudersHigh Performance Web Sites很全面的总结了web开发前端需要注意的性能问题。这些性能优化原则也从14条更新到34条。对于我工作中比较重要的优化原则总结如下:

1. 减少Http请求数
这个是最基本的优化原则了,后面的好多原则都是围绕这个基本原则细化的。
合并文件将多个js文件合并为一个js文件。将多个css文件合并为一个文件。高访问的页面(一般是首页)尽量将js、css 内嵌在html页面中。

2. 使用Expires 或 Cache-Control Header
一些不经常变化的内容,如js、css、image、flash/静态页面的请求返回header中可以加上Expires或Cache-Control头信息。这样用户再次访问时客户端浏览器可以使用本地的缓存,而不需要重复方面或有条件的get请求。
服务器端的js、css等文件发生变化时如何让客户端重新获取最新文件,一种常用策略是在文件名上加上版本号,如application-2.1.js, 如果版本发生变化,浏览器会认为这是新文件,会向服务器发出请求。

3. 使用Gzip压缩服务器返回内容
Gzip 虽然会损失部分CPU(一般高5%),但它的效果还是很明显。一般将内容减少65%左右。需要压缩的内容为js、css、html等文本内容。图片、PDF等内容不需要压缩。

4. 将javascript、css文件以单独的文件形式存在
在html页面中以的方式引入。将js、css外置后就可以利用规则2、规则3来优化js、css内容了。

5. 将javascript脚本放在页面的最下面
浏览器在加载js脚本时会阻塞其它内容的下载(浏览器同一时刻只能下载一个脚本),因此可以将js放到页面的最下面,这样不会阻碍文档的展现。

6. 将css文件放到html文件顶端
标准的做法是将css文件放到文档的head块中。并且使用link这种引用方式。
浏览器会在页面所有的css文件全部下载后才开始render页面,所以应尽早加载css文件。
css的引入应该使用标签而不是 @import。在IE中@import的效果和在文件底部link进css文件的效果一样。

7. 优化图片
尽量使用png格式,bmp这种格式肯定是不容许的。可以使用imagemagick工具将gif格式的图片转变为png格式的图片。
有关优化图片的方法以后有机会再详细描述。

8. 图片服务器尽量使用独立的域名
这个问题涉及的内容较多。主要有两点原因:


  • 可以增加浏览器并发请求的数量

  • 可以充分利用proxy server、F5类型的第三层交换系统的图片缓存功能


IE6、FireFox2、FireFox3默认情况下对同一域名的最大并发请求数为2. 也就是说如果你的页面有20个图片,浏览器一次也只能请求2个图片。使用独立的图片域名img1.trucyimg.org
img2.trucyimg.org这种方法后可以增加浏览器并发请求资源的概率。
国内的sina等网站的图片就是使用独立域名。

假使你的域名为www.domainname.com,你的图片域名为image.domainname.com,则在请求image.domainname.com下的内容是http头中会包含所有domainname.com下的cookie值。这些cookie无疑会浪费带宽。而且好多proxy server、cache服务器对于带有cookie的请求一般都会将请求直接转发给最终的服务器而不是从自己的cache中返回结果。

9. 尽量限制cookie的大小。
cookie中只存放与用户相关的关键参数。并使cookie在最小的域名名称空间中。

10. 减少 DNS Lookups
一个页面一般包含2-4个域名是最理想的。

11. 谨慎的使用Etags
Etags的生成算法(IIS、Apache)缺省情况下会把文件系统的inode包含在内,对于多web服务器的系统而言,同样的资源两次请求时其Etags值可能不一样,浏览器还会重复获取资源,从而失去Etags的功能。对于js、css、image的静态资源可以用Expires 或 Cache-Control Header达到同样效果。直接把web服务器的Etags功能关闭就可。

12. 使用CDN( Content Delivery Network)网络
CDN网络系统会在网络节点上(国内网通、电信的网络节点)上缓存网站的静态内容,从而可以在离用户最近的网络。CDN也只是像sina、sohu这样的有钱人才用的起的。国内的主要CDN服务商有蓝汛。现在也有许多中小型的网站组成了CDN联盟为其程序提供服务。

参考资料:
http://developer.yahoo.com/performance/rules.html

相关软件:
http://developer.yahoo.com/yslow/
http://crockford.com/javascript/jsmin
http://www.alphaworks.ibm.com/tech/pagedetailer
http://livehttpheaders.mozdev.org/
http://www.blunck.se/iehttpheaders/iehttpheaders.html

06 4, 2008

JBoss部署指南

1. 部署环境
操作系统:RedHat Enterprise Linux 5.1
jdk: Java SE 6 Update 6版本
安装目录:/opt

2. 安装JDK
cd /opt
chmod 755 jdk-6u6-linux-i586.bin
./jdk-6u6-linux-i586.bin
mkdir /opt/java
mv jdk1.6.0_06/ /opt/java/jdk1.6.0_06/

在/etc/profile.d目录下增加java.sh脚本(也可以修改用户的bash配置文件:~/.bash_profile),内容如下:

JAVA_HOME=/opt/java/jdk1.6.0_06
CLASSPATH=.
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

3. 安装Jboss
wget http://jaist.dl.sourceforge.net/sourceforge/jboss/jboss-4.2.2.GA.zip
unzip jboss-4.2.2.GA.zip

4. 增加Jboss ARP支持
JBoss对tomcat的Arp支持做了修改,所以需要从Jboss站点下载arp支持文件
wget http://www.jboss.org/file-access/default/members/jbossweb/freezone/dist/2.0.4.GA/jboss-native-2.0.4-linux2-x86-ssl.tar.gz
mkdir jboss-native
mv jboss-native-2.0.4-linux2-x86-ssl.tar.gz jboss-native/
cd jboss-native/
tar -zxvf jboss-native-2.0.4-linux2-x86-ssl.tar.gz
cp bin/META-INF/bin/linux2/x86/* /opt/jboss-4.2.2.GA/bin/
mkdir /opt/jboss-4.2.2.GA/bin/native
cp -r bin/META-INF/lib/linux2/x86/* /opt/jboss-4.2.2.GA/bin/native/

5. 去除JBoss的冲突包
Jboss在/opt/jboss-4.2.2.GA/server/default/lib/ 目录下缺省提供了许多jar文件,有些可能和相关使用的有冲突,需要删除。

6. 修改Jboss参数
1) 修改run.conf参数
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms128m -Xmx512m
-XX:MaxPermSize=256m -XX:MaxNewSize=256m –server
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000"
fi

2) 修改/opt/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/server.xml,
将将8080修改为80。将${jboss.bind.address}修改为0.0.0.0,允许从eth0,lo都能够访问jboss 80端口
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" />

7. 配置iptables防火墙
RedHat缺省情况下启动了iptables防火墙,需求打开防火墙的80端口。
修改文件/etc/sysconfig/iptables,增加以下授权 :
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

重新启动iptables服务:
[root@benserver sysconfig]# /sbin/service iptables restart

8. 部署应用
将应用部署到/opt/jboss-4.2.2.GA/server/default/deploy/


参考资料:
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
http://www.unixville.com/~moazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html
http://wiki.jboss.org/wiki/HowToAddAprToJBoss

06 3, 2008

安装vsftpd

安装环境:RHEL5.1
安装步骤:
1)安装
wget http://down1.chinaunix.net/distfiles/vsftpd-2.0.4.tar.gz
chmod 755 vsftpd-2.0.4.tar.gz
tar -zxvf vsftpd-2.0.4.tar.gz
cd vsftpd-2.0.4
make

mkdir /var/ftp
/usr/sbin/useradd -d /var/ftp/ ftp
chown root.root /var/ftp/
chmod og-w /var/ftp/

mkdir /var/ftp/pub
chmod 744 /var/ftp/pub

make install
cp vsftpd.conf /etc

修改/etc/vsftpd.conf
增加一行指令以使vsftpd可以不通过inetd直接启动
listen=YES

启动vsftpd:
/usr/local/sbin/vsftpd &

可以通过netstat查看端口状态:
netstat -na|grep 21

2)修改安全策略
可以修改/etc/vsftpd.conf的相关参数改变安全策略
如打开以下几个参数使匿名用户可以上传文件(生产系统严禁这样配置)
anonymous_enable=YES
write_enable=YES
anon_upload_enable=YES

3)配置为xinit服务