wang 的个人资料Nirvana照片日志列表 工具 帮助

日志


3月29日

上传了最近一个月的照片

把最近一个月的照片上传了
包括
1. M Street钓的蜘蛛蟹
2. 蒸馒头 煮肉
3. M Street钓的蝎子鱼和Perch
4. 80刀买的Washburn垃圾琴(毕竟是Washburn 动静不错)和百威的小箱子
5. 其实最近我还在blue lake和M street分别钓了些大嘴鲈和sand bass, 不过那条sand bass不够大 被我放生了
 
比较堕落的事情是:
1. 看完了连续剧 血色浪漫1 和 血色浪漫2
    觉得2比1更好看,可能是我以前看过王朔那本《玩的就是心跳》,也可能我习惯于把吃饱的感觉归咎于最后一个馒头吧。
    卑鄙是卑鄙者的通行证, 高尚是高尚者的墓志铭
 
比较笨的事情是:
1. 买了ACER的500块的本本 之后才知道不hot. 没打开 明天去退
2. QA Search的工作 目前处于停滞状态,以前的思路是 把Answer Pattern 的选择,首先作为一个分类问题处理,之后从feature vector上导出Answer Pattern。目前的困境是 不知道Answer Sentence的feature vector什么. New Grammar Tree的结构是松散的树结构,如果采用树结构作为feature的话(这个是理想情况),就要严格定义树之间的距离,这个做法似乎是王道 可是老爷子不会给我这么多时间的。
一个 凑数的做法是用Grammar Tree的所有节点做一个Vector, 每个Vector的节点有不同的关键词,如某vector node是PP, 则包括关键词 where, of, in , at, for,...每个关键词 对应个数字(合理么?) 对于NP 则等于Question中的NP(这个作为Query的必要因素)。不过这样的做法 怎么处理 Answer中包含的Grammar Compoent不唯一的情况呢?
----看来起义要提前发起了!
 
 
   
3月27日

6 steps to creating a super startup

6 steps to creating a super startup

Thinking about starting a business? Follow these crucial tips and your company might just become the next big thing.

FORTUNE Small Business Magazine
By Anne Field
March 26 2007: 4:53 PM EDT

(Fortune Small Business) -- If you want to be an entrepreneur, you're in good company. An average of 464,000 adults a month create new businesses, according to the most recent statistics available from the Kauffman Foundation (kauffman.org), which tracks and promotes entrepreneurship.

But starting a business is a complicated, risky, all-consuming effort. Indeed, just two-thirds of new small businesses survive at least two years, and only 44 percent survive at least four years, according to a study by the U.S. Small Business Association.

business_startup.03.jpg
Quiz launchTake the quiz
Are you ready to start your own business? Being your own boss may sound great, but not everyone has what it takes to succeed as an entrepreneur. Do you?

1. If I have to, I'm willing to lower my standard of living for a while - take fewer (or no) vacations and cut back on nonessentials like eating out - while trying to get my business off the ground.
True
False

Taking the six steps below will help put you on the road to success.

1. Determine if you're an entrepreneur or just a wannabe. Starting a successful business requires a unique set of characteristics. You have to be willing to take calculated risks. In addition, a mix of optimism, high energy, and an ability to live with ambiguity are also crucial.

According to a recent study of 1,600 Columbia Business School alumni who started businesses, the desire most related to success was the inclination to build something.

"They took a long-term view," says Murray Low, director of the Eugene M. Lang Center for Entrepreneurship at Columbia.

Make sure you're prepared to wear many hats, at least in the beginning. "You need to be willing to meet with the chairman of the board, then go back to the office and fix the toilet," says Low.

2. Pinpoint an opportunity. There are lots of ways to find the right business idea. But for most people, it's wise to begin with your interests, say small-business experts.

"You should start with what you know best and are most passionate about," says Sarah Chiles, director of Programs at NYU Stern's Berkley Center for Entrepreneurial Studies.

Back in 1999, Julie Dix started sewing satin tags onto her baby's blankets, after she discovered the infant liked playing with soft edges. Soon, other mothers began telling her what a great idea it was. That's when she teamed with friend Danielle Ayotte and formed Spencer, Mass.-based Taggies. Today, the company sells the blankets, and dozens of other products in six countries.

The bottom line: "You have to find an underlying need that's not being fully met," says Timothy Faley, managing director of the Samuel Zell & Robert H. Lurie Institute for Entrepreneurial Studies at the University of Michigan's Ross School of Business.

3. Make sure there's a market for your idea. Get out there and talk to as many potential customers, suppliers and distributors as you can. Trade-show attendees are a particularly good source of information. And remember: You're not trying to sell anything yet; you're just exploring the opportunity.

"Everyone will be more willing to talk if they think you're just looking for information," says Faley.

It's also a good idea to make a prototype of your product, so customers can test it out. That goes even for low-tech wares. Early on, Dix and Ayotte made samples and brought them to crafts fairs, as well a local store. When it sold out in just a few days, they knew they were onto something.

As you get feedback, good or bad, fine-tune your concept accordingly.

4. Write a business plan. Any plan needs to answer a few key questions: What is your product or service? Who is your customer? What need does it address? And, how are you going to turn your idea into a money-making venture?

The plan "should lay the foundation on which you build your business," says Faley.

Divide the document into a few sections. First, and perhaps most important, is the executive summary, detailing in no more than two pages the key information in your plan.

Next should be a market analysis that describes the needs you're addressing and any potential competitors; a discussion of your marketing plans and the management team; and a financial analysis of the first five years in business, with a sample income statement and balance sheet.

Be prepared to revisit the plan many times. "It should grow and change along with your company," says Faley.

5. Determine your business structure. You have four basic choices -- sole proprietorship, partnership, LLC, or corporation. Each offers different legal protections, tax savings, and ownership requirements. They also vary in how complicated they are to set up.

For example, sole proprietorships and partnerships require little paperwork to establish, but also don't provide the tax breaks and liability protections of other structures.

With limited liability companies (LLCs), you are personally protected from creditors and lawsuits and can have as many owners as you'd like.

Corporations also shield your personal assets from creditors and provide various tax breaks. If you incorporate as a C corporation, owners are not responsible for liabilities, because the corporation is considered to be a separate legal entity. But there's also a double taxation, on both earned dividends and profits. An S corporation avoids that problem by having shareholders report earnings on their personal tax forms. But there are limitations on who and how many people can be shareholders.

6. Look for funding. Most entrepreneurs start their businesses by dipping into their savings, and hitting up friends and family. Perhaps half of all startups, in fact, are funded initially by the founder's credit cards, according to Faley.

Getting a bank loan is tough unless you have assets - and that often means using your home as collateral.

Other likely sources include potential suppliers and even prospective customers, who might be willing to help out in return for steep discounts.

What about venture capital? Fact is, VCs rarely invest in startups.

3月17日

strtoken 分割char*

     
Sample Code :
 
      #include <syslib.h>
      #include <string.h>
      #include <stdio.h>

      main()
      {
        char s[]="Golden Global View";
        char *d=" ";
        char *p;
        
        
        p=strtok(s,d);
        while(p)
        {
          printf("%s\n",s);
          p=strtok(NULL,d);
        }

        getchar();
        return 0;
      }
3月6日

shell script

Shell Script设计要点

Shell Script其实就是命令集,可以构成功能强大的命令文件。由于linux命令多,而且功能强大,加上Shell Script提供的完整程序解释程序以及读取和执行你自己的shell程序手段,几乎成了linux管理人员的必修课。
Shell Script本身学起来很简单,但由于linux命令多且功能参数多,写Shell Script有时并不是容易的事,要靠日积月累。
要掌握的内容有:
Shell Script如何构成命令文件
Shell Script变量
Shell Script参数
登录 Script
交互输入和命令替换
自动化状态变量
流程控制
信号
*****************************
Shell Script如何构成命令文件
1.用文本编辑器写入任何标准的Linux命令或管道行,或相关的一组命令或管道行;
2.用chmod命令将这一文件变为可执行文件。
然后可象执行其它文件一样来执行它。
最简单的例子:
vi编辑dirsize文件含以下行:
ls /usr/sbin |wc -w
然后执行:
chmod 755 dirsize
这样在当前目录下就形成了dirsize命令文件,试着运行 :
./dirsize
将列出/usr/sbin目录下文件个数。

*****************************

❑ Shell Script变量

所有的程序都用到变量,Shell Script也不例外。变量就是一到多个内存单元标以名称,或者说将变量的内容存到一到多个内存单元中。除了我们可以定义变量外,linux系统或一些应用程序已经在shell设置了一些变量。
1. linux shell著名的变量有:PS1,PS2,PWD,UID,PATH,HOME
其中,PS1和PS2是shell提示字符串,它们的作用你用echo查一下就知道了:
echo $PS1
echo $PS2
如果还不明白,就给它一些值,如:
PS1='what is PS1?'
echo $PS1
你会在shell下看到变化吗?
PWD就不用说了,经常用,一般不要让它变化,在转到不同路径时,系统会重新给它值。
UID是用户识别号。
PATH是环境变量,多项值用:号分开,让shell按PATH中列出的目录去找执行文件。如果多个目录中有相同名称的可执行文件,以第一个找到的为算,下面就不再找了。找的次序是从前往后,你可以修改它的值,让shell能找到,并正确执行要找的文件。
HOME是登录系统时,存放某登录用户家目录的完整路径名,常用~来代替HOME,用cd 命令回到的地方。
2.自定义变量很方便,在shell下可直接给值:
myvar='This is shell test!'
查看用echo命令:
echo $myvar
在echo命令行中,变量名前要加$,否则,echo会当字符串来操作,而不是当做命令。
对了,在shell script编程中,echo命令是用得最多的,要掌握熟练哟。
在ehco中变量后的空格,意味着变量的结束,就是说你的变量不能有空格,如果你的变量组合(运算)要用()将整个变量表达式放在一起:
echo My kernel ver is : $(uname -r )
echo Now time is : $(date |tr -s ' ' |cut -d' ' -f4)
3.让变量字符串在使用时不留空格空方法
对比:
myvar=Th
echo $myvaris test!
结果为: test!
因为echo 将$myvaris理解为变量,没有给值的被置空,你的想法不能实现。
echo ${myvar}is test!
结果为:
This test!

这是你的想法。用{}来处理类似问题。
4.shell的局部变量和全局变量
如果不声明,上面所用的都是局部变量,只适用于当前shell.
要适用于当前用户的所有shell,可用export来声明,如:
export myvar

export myvar='This public var test!'
*****************************

❑ Shell Script参数

1.在实用的shell script中,一般都要用到Shell Script参数。表示形式为:
$n
n=0,1,2......
$0 代表命令本身(命令行的第一个字,至空格结束),在Script中可用以对该命令再操作;
$1 代表命令后的第一个参数(命令行的第二个字,至空格结束);
$2 代表命令后的第二个参数(命令行的第三个字,至空格结束);
举例说明更容易理解:
dirsize /uer/sbin /usr /etc
$0=dirsize
$1= /uer/sbin
$2=/usr
$3=/etc
如果我们想用dirsize对/uer/sbin /usr /etc 目录文件分别计数,或任何三个目录(或以上,参见后面的流程控制)的文件计数,在“❑ Shell Script如何构成命令文件”中的例子显然无能为力。这个要用到Shell Script参数。
vi dirsize
包含以下内容:
echo $1 dirsize is:
ls $1 |wc -w
echo $2 dirsize is:
ls $2 |wc -w
echo $3 dirsize is:
ls $3 |wc -w

就能列出三个目录下的文件个数。
如果参数不足,以当前目录作为参数。
2.PATH变量的设置
做为程序,特别是常用的程序,输入完整路径是件麻烦的事,有必要通过PATH参数的设置,使得在任何目录环境下都能执行,这里还以dirsize为例。
查看当前PATH参数
debian:~# echo $PATH
/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games
在当前用户家目录下建立一个myshell目录,并在PATH中加入该目录。
debian:~# mkdir ~/myshell
debian:~# mv dirsize ~/myshell
debian:~# PATH=$PATH:~/myshell
debian:~# echo $PATH
/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games:/root/myshell
试着转到/usr目录来执行dirsize
debian:~# cd /usr
debian:/usr# dirs(用tab补齐,已经能看到dirsize)
dirs dirsize dirsplit
debian:/usr# dirsize /bin /usr /etc
/bin dirsize is:
100
/usr dirsize is:
13
/etc dirsize is:
210

************************************************

登录 Script

登录 Script,分为两种情况,全局登录 Script和用户登录 Script.
1.全局登录 Script,是由系统管理员建立的登录 Script,适用于所有用户,执行优先于用户登录 Script。存放在:
/etc/profile
2.用户登录 Script,必须存放在起始目录下(HOME,即~)才能执行。
有三个文件可用于写用户登录 Script:
~/.bash_profile
~/.bash_login
~/.profile
bash按上面的顺序找这些文件,并且只执行最先找到的一个。
3.当退出登录时,bash也能执行退出登录Script,这个文件存放在:
~/.bash_logout

*****************************

❑ 交互输入和命令替换
1.交互输入
交互输入就是以交互方式从键盘取值,然后将值存放在变量中。

1.1用read命令和REPLY变量,实现交互输入
用示例更容易理解:
vi test1
echo -n 'what's your name:'
read
echo your name is: $REPLY


debian:~#chmod +x test1
debian:~#./test1
what's your name:my test1
your name is: my test1
这里的-n作用是抑制新换行符输出,能够在同一行输入字符。
REPLY作用是直接获取标准输入设备读取的字符串。

1.2如果在read命令后指定变量,输入行将直接送给变量,而不送给REPLY。
vi test2

echo -n 'what's your name:'
read first second last
echo The first word was: $first
echo The second word was: $second
echo The last word was: $last

debian:~#chmod +x test2
debian:~#./test1
what's your name: a b c
The first word was: a
The second word was: b
The last word was: c

如果参数不够用,没有用到的置空(null)

debian:~#./test1
what's your name: a b
The first word was: a
The second word was: b
The last word was:

如果参数多,多余的被放在最后:

debian:~#./test1
what's your name: a b c d e
The first word was: a
The second word was: b
The last word was: c d e

2.命令替换

命令替换就是将管道行的输出给值变量。
示例说明:
[root@main ~]# date
Sat Mar 11 13:16:05 CST 2006
[root@main ~]# datestore=$(date)
[root@main ~]# date
Sat Mar 11 13:16:14 CST 2006
[root@main ~]# echo $datestore
Sat Mar 11 13:16:11 CST 2006

有一条常用的替换命令是basename,这条命令用完整的文件路径名作为参数,去除路径名,只送回文件名:

[root@main ~]# file1=$(basename /usr/sbin/sucap)
[root@main ~]# echo $file1
sucap

在shell script中,命令替换是经常使用的方法,需要熟练掌握。

***************************************************

自动化状态变量

所有的linux命令程序,在设计时都 做了规定,它们运行结束后都返回一个值,这个值称为它的退出状态(exit status),退出状态为0值表示程序运行正常,非0值表示退出不正常。对退出的非0值所代表的意思,可参考源代码或相关的说明。
自动化状态变量,是指在编写的shell script中,针对所使用linux命令对应的退出状态采取自动化或程序化处理方法。同时要求,在编写shell script时,除了正常退出非0值外,对非正常值在程序中做出说明或注释,以便采取相应措施或方便其它shell script调用时进行自动化处理。
1、对于管道行来说,返回状态只是管理行中最后一条命令返回退出状态。
2、运行 linux命令或管道行时,shell用$?这一特殊变量来保存返回状态值。
如:
debian:~# cat xyz
cat: xyz: 没有那个文件或目录
debian:~# echo $?
1
debian:~# echo $?
0
试图列出当前目录xyz文件的内容,由于没有这个文件,返回值为1。由于已经正确执行了echo $?,并得到了返回值,所以再执行echo $?时,返回值为1。
3、在shell script中,用exit n命令规定返回状态值:
debian:~# cat >xyz
exit 3
Ctr-d
debian:~#chmod +x xyz
debian:~#./xyz
debian:~#echo $?
3
debian:~#echo $?
0
4、主要状态变量
4.1 $?
用来保存shell 最后执行的命令退出状态值。
4.2 $$
用来保存当前shell的PID。
debian:~# su chinajz
chinajz@debian:/root$ cd ~
chinajz@debian:~$ ls
Desktop hyzqstock40jy.exe Projects swfdec-0.3.6
chinajz@debian:~$ touch test$$
chinajz@debian:~$ ls
Desktop hyzqstock40jy.exe Projects swfdec-0.3.6 test6846
用touch test$$创建了test6846文件,PID=6846。
4.3 $#
它保存传送给当前script命令的参数数目。对应于$1,$2,$3...的个数。这个是很有用的。
4.4 $*
它保存传送给当前script命令的所有参数。对应于$1,$2,$3...的清单。
4.5 对于上面的四个状态变量,只能对其取值,而不能给值。

************************************************

一句有哲理的话

 
直到昆哥和阿芬死后,我才知道 人为什莫要吸毒。
其实原因 只有一个:
  空虚
 
                                    -------电影《门徒》
3月5日

苏轼 《留候论》

 
留  侯 论      苏 轼
 
古之所谓豪杰之士者,必有过人之节。人情有所不能忍者,匹夫见辱,拔剑而起,挺身而斗,此不足为勇也。天下有大勇者,卒然临之而不惊,无故加之而不怒。此其所挟持者甚大,而其志甚远也。
      夫子房受书于圯上之老人也,其事甚怪;然亦安知其非秦之世,有隐君子者出而试之。观其所以微见其意者,皆圣贤相与警戒之义;而世不察,以为鬼物,亦已过矣。且其意不在书。
  当韩之亡,秦之方盛也,以刀锯鼎镬待天下之士。其平居无罪夷灭者,不可胜数。虽有贲、育,无所复施。夫持法太急者,其锋不可犯,而其末可乘。子房不忍忿忿之心,以匹夫之力而逞于一击之间;当此之时,子房之不死者,其间不能容发,盖亦已危矣。
    千金之子,不死于盗贼,何者?其身之可爱,而盗贼之不足以死也。子房以盖世之材,不为伊尹、太公之谋,而特出于荆轲、聂政之计,以侥幸于不死,此圯上老人之所为深惜者也。是故倨傲鲜腆而深折之。彼其能有所忍也,然后可以就大事,故曰:“孺子可教也”
  楚庄王伐郑,郑伯肉袒牵羊以逆;庄王曰:“其君能下人,必能信用其民矣。”遂舍之。句践之困于会稽,而归臣妾于吴者,三年而不倦。且夫有报人之志,而不能下人者,是匹夫之刚也。夫老人者,以为子房才有余,而忧其度量之不足,故深折其少年刚锐之气,使之忍小忿而就大谋。何则?非有生平之素,卒然相遇于草野之间,而命以仆妾之役,油然而不怪者,此固秦皇之所不能惊,而项籍之所不能怒也。
  观夫高祖之所以胜,而项籍之所以败者,在能忍与不能忍之间而已矣。项籍唯不能忍,是以百战百胜而轻用其锋;高祖忍之,养其全锋而待其弊,此子房教之也。当淮阴破齐而欲自王,高祖发怒,见于词色。由此观之,犹有刚强不忍之气,非子房其谁全之?
      太史公疑子房以为魁梧奇伟,而其状貌乃如妇人女子,不称其志气。呜呼!此其所以为子房欤!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
------------------------
顺,不妄喜;逆,不惶馁;安,不奢逸;危,不惊惧;胸有激雷而面如平湖者,可拜上将军