分类: 技术

  • submit 和 button的区别

    type=button      就单纯是按钮功能   
    type=submit      是发送表单

    但是对于从事WEB UI的人应该要注意到,使用submit来提高页面易用性:
    使用submit后,页面支持键盘enter键操作,而很多WEB软件设计师,可能没有注意到submit统一. 

    用button后往往页面不支持enter键了。所以需要支持enter键,必须要设置个submit,默认enter键对页面第一个submit进行操作。

     

     

    <input type="submit" name="b1" value="提交"     onClick="bt_submit_onclick()">
    执行完onClick,转到action。可以自动提交不需要onClick。所以说onclick这里可以不要。

    <input type="button" name="b1" value="提交"     onClick="bt_submit_onclick()">
    执行完onClick,跳转文件在 js文件里控制。提交需要onClick。

     

     

    比如:

    1,onclick="form1.action='a.jsp';form1.submit();"     这样就实现了submit的功能了。

    2,<form    name="form1"    method="post"    action="http://www.sina.com.cn">   
           <input    type="button"    name="Button"    value="Button"    onClick="submit()">   
       </form>

    3,<input    type="button"    name="Button"    value="Button"    onClick="javascript:windows.location.href="你的url"">

     

     

    ===============submit 和 button的区别=================================== 

     submit:特殊的button,会自动将表单的数据提交 ,onClick方法不加return 会自动提交,并不会起到约束的作用,所以,使用submit时需要验证请加 return 例: 
      <input type="submit" name="Submit" value="  注 册  " onClick=" return check();">  ,在JS中判断的时候 写return true 或者 return false

     button:普通的按钮,不会自动提交表单数据  可以在JS中显式提交:document.form1.submit(),使用场合: 一个页面有多个提交按钮,需要根据用户的操作来确定到底提交到哪个控制器,这种情况下,就需要在JS中判断用户的操作,然后根据操作来给document.form1.action赋值并且document.form1.submit()来提交

     

    ===============如果想好所有的提交都在一个servlet中处理,该怎么做==================
     提交的按钮也是HTML组件,所以也可以通过 getParameter()来
     得到,那么getParameter()的参数也需要固定下来
     参数就是所有的表单的提交按钮的name,当然提交按钮的name要一样才能统一在一个servlet中根据提交按钮的值来区别操作

     

    ======================关于路径的设置===================================
    A。在页面中直接写路径,如 href="jsp/a.html" 表示 平级目录的访问,此例表示平级目录中有个JSP文件夹,访问的是文件夹中的a.html文件

    B。在JAVA中直接写路径 如 response.sendRedirect("jsp/a.jsp")表示项目根目录下有个JSP文件夹,访问的是文件夹中的a.jsp文件

    c.如果发现以上设置在浏览器中的地址栏不正确,可以采取绝对路径写法: 
      /工程名/文件夹名/文件名

    ************在以后的开发中可能有N多的文件夹N多的类和页面,在访问的过程中可能需要访问上几层中的文件夹
    —–aaa文件夹      a.html
     |
     |——bbb文件夹  b.html
       |
       |
       |——-CCC文件夹  c.html
     

     如果想要在c.html中访问  a.html 有几 种写法: 
      1。 ../../a.html  说明:  ../表示上级目录
      2.  /工程名/aaa/a.html 说明:使用绝对路径

    ***********以上内容供以后开发复杂项目时参考,暂时作为了解
    ***********更改路径小窍门: 可以根据浏览器中地址栏显示出来的路径来有针对性的修改至正确的URL
      

    ========================默认显示页面=================================
    当访问 web项目时,默认会显示根目录下的index.jsp or index.html文件

    资料来源

    http://www.cnblogs.com/Myhsg/archive/2008/08/14/1268201.html

    http://blog.csdn.net/qianjunxian/article/details/4088515

     

    今天在做拖拽效果的时候发现用a点击可以实现,用button与submit都不可以,搜索后有其他发现。转载之。

     

  • 移动应用的四大分类

    目前市面上有着各种各样的移动应用,Chris Dixon根据人们使用应用的方式给出了一个“黄金四分类”。这一分类可以为那些想做一个新应用的开发者和想判断一个应用是否有价值的投资者提供更好的指导。

    ceb748cf-5676-3a8d-9762-69ce16981ef8.jpg

    1.  消磨时间的应用

          该分类的代表是各类游戏:比如水果忍者和愤怒的小鸟。这类应用就是供用户在短暂的闲暇时间里使用,比如等人或者排队时。当然有一些应用兼具消磨时间和核心应用两种特性。比如Facebook,排队时隔一会就刷新下好友新鲜事属于消磨时间,但是发送Facebook站内信息就属于核心功能了。

          此类应用会随着时间推移渐渐冷下去。人们很容易迷上新游戏,但也很容易觉得厌烦。如果你想创立一个专门做消磨时间应用的大公司,你需要建立相应的制作、营销和货币化机制,就像Zynga做的一样。

    2.  核心应用

          核心应用是指你主屏幕上的应用,相机、照片、联系人、日历、短信等等。核心应用的使用模式大多在智能手机出现之前已经变得根深蒂固了。过去人们一般会带着纸质日历,或者是莱卡相机。核心应用对用户的黏性是惊人的,如果你能做出一款用户众多的核心应用,那将是一笔长期的生意。

          对创业公司来说一个可能的进入策略是用自己的应用来置换某类核心应用。Instagram正是用这一招成功取代了手机内置相机的地位。目前我们尚不清楚视频版Instagram是否会取代手机内置摄像机成为核心应用。相较而言,创造一种全新的核心应用类别是比较困难的,目前做的比较好的有Foursquare,它成功的创造出了“签到”这一之前从未有过的核心应用。

    3.  边缘应用

          这类应用一般不会出现在你的主屏幕上,但是在某些情况会非常有用。比如当你需要打车时,Uber能帮你实时找到空车;或者当你需要在餐馆订位置时,Opentable可以帮你轻松订位。这类边缘应用一般着眼于特定的细分市场,做精做细,让消费者在碰到此类问题时第一时间想到它们。此类应用大多需要用户进行购买,因此更容易产生现金流。

    4.  消息提醒类应用

          消息提醒类应用在市场上出现的越来越多。人们一般对联系类应用比如Email、短信会开启消息提醒。其他的应用目前还没有广泛采用此类消息提醒,因为提醒的时机选择不当会很容易让用户心烦,而且这种后台程序会极大的消耗电池电量。随着将来提醒系统更加智能,手机电池容量的增大,这一领域的应用会逐渐增多。

          当然这一分类并未遵循严格的“相互独立,完全穷尽”的MECE原则,有些应用可能在不同的使用场景下处于不同的分类中(文中的Facebook就是一例)。

    http://cdixon.org/2012/05/21/four-use-cases-for-mobile-apps/

  • Jquery插件–easyUI属性汇总(转)

    找了个时间看了下EasyUI插件,对它的插件感觉是很舒服,特地把Easy UI的大部分功能属性做了一下汇总。

    此属性列表请对照jQuery EasyUI 1.0.5,关于它的更多资讯请猛击这里

    属性分为CSS片段和JS片段。

    CSS类定义:
    1、div easyui-window        生成一个window窗口样式。
          属性如下:
                       1)modal:是否生成模态窗口。true[是] false[否]
                       2)shadow:是否显示窗口阴影。true[显示] false[不显示]
                
    2、div easyui-panel           生成一个面板。
           属性如下:
                     1)title:该标题文本显示在面板头部。
                     2)iconCls:在面板上通过一个CSS类显示16×16图标。
                     3)width:设置面板宽度。默认auto。
                     4)height:设置面板高度。默认auto。
                     5)left:设置面板左边距。
                     6)top:设置面板顶部位置。
                     7)cls:在面板中增加一个Class类。
                     8)headerCls:在面板头部中增加一个Class类。
                     9)bodyCls:在面板内容中增加一个Class类。
                    10)style:在面板中增加一个指定样式。
                    11)fit:当True时设置该面板尺寸适合于它的父容器。默认false。
                    12)border:当定义时显示面板边界。默认true。
                    13)doSize:如果设置为True,该面板将重绘大小,并重建布局。默认true。
                    14)collapsible:当定义时显示可折叠面板的按钮。默认false。
                    15)minimizable:当定义时显示最小化面板的按钮。默认false。
                    16)maximizable:当定义时显示最大化面板的按钮。默认false。
                    17)closable:当定义时显示关闭面板的按钮。默认false。
                    18)tools:自定义工具栏,每个工具都包含两个属性:iconCls、handler。
                    19)collapsed:当定义时该面板初始化时处于收缩状态。默认false。
                    20)minimized:当定义时该面板初始化时处于最小化状态。默认false。
                    21)maximized:当定义时该面板初始化时处于最大化状态。默认false。
                    22)closed:当定义时该面板初始化时处于关闭状态。默认false。
                    23)href:一个url,加载远程数据并显示在面板中。
                    24)loadingMessage:当加载远程数据时,在面板中显示一个消息。默认Loading…
                 事件如下:
                     1)onLoad:当远程数据加载完毕后激活。
                     2)onBeforeOpen:当面板打开前激活。
                     3)onOpen:当面板打开后激活。
                     4)onBeforeClose:当面板关闭前激活。
                     5)onClose:当面板关闭后激活。
                     6)onBeforeDestroy:当面板销毁前激活。
                     7)onDestroy:当面板销毁后激活。
                     8)onBeforeCollpase:当面板收缩前激活。
                     9)onCollapse:当面板收缩后激活。
                    10)onBeforeExpand:当面板扩展前激活。
                    11)onExpand:当面板扩展后激活。
                    12)onResize:当面板重绘后激活。
                          width:新建的外部宽度
                          height:新建的外部高度
                    13)onMove:当面板移动后激活。
                         left:左侧新位置。
                         top:顶部新位置。
                    14)onMaximize:当窗口最大化

  • jquery-easyui Calendar 日历中文

    这两天一直在试用jquery-easyui

    里面的日历是英文的

     

    直接调用locale里面的语言版本cn或者tw

     

  • JS代码放在head和body中有区别吗?

    很多人对js代码放在网页中的位置并没有太多的了解,一般认为是放在head中的,放在body里也没什么所谓吧。

    事实上还是有区别的。

    放在head中的JS代码会在页面加载完成之前就读取,而放在body中的JS代码,会在整个页面加载完成之后读取。

    那么有什么不同呢?先看一个例子:
    一个二级级联动态下拉列表框,一级分类(即大类别)id=”vSort0″.
    代码如下:
    <head>
    function changelocation(id)
    {…………}
    </head>
    <body><select id=”vSort0″ name=”vSort0″ onChange=”changelocation(document.form4.vSort0.options[document.form4.vSort0.selectedIndex].value);” style=”width:100px;”>……省略……</select>
    ………………
    </body>

    现在有个js脚本:
    代码如下:
    <script LANGUAGE= “JavaScript” >
    changelocation(document.form4.vSort0.options[document.form4.vSort0.selectedIndex].value); //初始化第一个一级分类的二级分类,去掉后第一个一级分类的二级分类在页面载入之后不显示。回选才显示。将一级分类的value传给changelocation()函数,生成二级分类的列表
    </script>

    那么把这个js脚本放head里面还是body里面呢?
    答案是不仅要放到body里面,而且还得放到定义id=’vSort0′的列表框后面,因为这个js脚本中有document.form4.vSort0.selectedIndex,如果放到head里或者body的id=’vSort0′前,页面加载后顺序执行代码,执行到这个js发现vSort0未定义(即undefind),这个js也就失去了作用。
    而为什么我们经常看到有很多的人把js脚本放到head里面没事呢?对!
    就是因为你看到的在head里的js代码有onclick等事件传递了变量给函数。
    这就告诉我们,如果我们想定义一个全局对象,而这个对象与页面中的某个按钮(等等)有关时, 我们必须将其放入body中,道理很明显:如果放入head,那当页面加载head部分的时候,那个按钮(等等)都还没有被定义(也可以说是还没有被加 载,因为加载的过程就是执行代码的过程,包括了定义),你能得到的只可能是一个undefind。

    看来还是要注意了,js放的位置也很重要的。

  • CSS基础:解决图片元素下多余空白的BUG

     
     屏幕尺(推荐fast stone capture)

     

     
    在进行页面的DIV+CSS排版时,遇到IE6、IE7(当然有时Firefox下也会偶遇)浏览器中的图片元素img下出现多余空白的问题绝对是常见的对于该问题的解决方法也是「见机行事」,根据原因的不同要用不同的解决方法,这里把解决直接把解决image图片布局下边的多余空隙的BUG的常用方法归纳, 供大家参考。
    1、将图片转换为块级对像
    即,设置img为:
    display:block;
    在本例中添加一组CSS代码:
    #sub img {display:block;}
    2、设置图片的垂直对齐方式
    即设置图片的vertical-align属性为「top,text-top,bottom,text-bottom」也可以解决。如本例中增加一组CSS代码:
    #sub img {vertical-align:top;}
    3、设置父对象的文字大小为0px
    即,在#sub中添加一行:
    font-size:0;
    可以解决问题。但这也引发了新的问题,在父对像中的文字都无法显示。就算文字部分被子对像括起来,设置子对像文字大小依然可以显示,但在CSS效验的时候会提示文字过小的错误。
    4、改变父对象的属性
    如果父对象的宽、高固定,图片大小随父对像而定,那麽可以设置:
    overflow:hidden;
    来解决。如本例中可以向#sub中添加以下代码:
    width:88px;height:31px;overflow:hidden;
    5、设置图片的浮动属性
    即在本例中增加一行CSS代码:
    #sub img {float:left;}
    如果要实现图文混排,这种方法是很好的选择。
    6、取消图片标签和其父对象的最後一个结束标签之间的空格。
    这个方法要强调下,在实际开发中该方法可能会出乱子,因为在写代码的时候为了让代码更体现语义和层次清晰,难免要通过IDE提供代码缩进显示,这必然 会让标签和其他标签换行显示,比如说DW的「套用源格式」命令。所以说这个方法可以供我们了解出现BUG的一种情况,具体解决方案的还得各位见招拆招了.

  • 来自某群的99的分享

    盛大创新院面试页面重构的js题目。。。

    ★列出display的值
    可用值 值的说明
    block 象块类型元素一样显示。
    none 缺省值。向行内元素类型一样显示。
    inline-block 象行内元素一样显示,但其内容象块类型元素一样显示。
    list-item 象块类型元素一样显示,并添加样式列表标记。
    table-header-group 显示在任何表格行和行组合之前,在头部标题之后。
    table-footer-group 显示在任何表格行和行组合之后,在底部标题前。

    ★清除浮动与闭合浮动的不同点 (http://www.cnblogs.com/mofish/archive/2012/05/14/2499400.html)

    ★如何为元素绑定事件(就是addEvent)

    function addEvent(elm, evType, fn, useCapture) {
    if (elm.addEventListener) {
    elm.addEventListener(evType, fn, useCapture);//DOM2.0
    return true;
    }
    else if (elm.attachEvent) {
    var r = elm.attachEvent(‘on’ + evType, fn);//IE5+
    return r;
    }
    else {
    elm['on' + evType] = fn;//DOM 0
    }
    }

    ★window.onbeforeunload 的用法
    (http://www.cnblogs.com/snandy/archive/2012/05/03/2481019.html)

    ★说一下window.onerror的参数
    (http://blog.csdn.net/zzxll5566/article/details/6187943)

    ★列出IE与FF的事件对象的不同点
    (http://www.ok12.net/js/125.html)

    ★如何用CSS画三角形
    (利用border属性)

    ★你平时是如何调试JS代码的
    (firebug,IE开发人员工具,opera是当中最好的)

    ★如何判定一个脚本是否加载成功

    var script = document.createElement(‘script’) ;
    var head = document.getElementsByTagName(“head”)[0];
    head.insertBefore(script, head.firstChild);//规避IE6下自闭合base标签BUG
    script.onload = script.onreadystatechange = function(){//先绑定事件再指定src发出请求
    if(/loaded|complete|undefined/.test(this.readyState) && !this.once ){
    this.once = 1;
    this.parentNode.removeChild(this);
    }
    }
    script.src = ’http://files.cnblogs.com/rubylouvre/html5.js’

    (IE onreadystatechange事件,判定节点的readyState值是否为loaded或complete, 其他浏览器则使用onload)

    ★如何判定iframe里面的资源都加载完毕
    (http://www.cnblogs.com/lhgstudio/archive/2010/10/24/1859946.html)

    ★怎么判定一个节点是在DOM树中
    (http://www.cnblogs.com/rubylouvre/archive/2009/10/14/1583523.html)

    ★指出JS拖动的原理
    (将元素绝对定位,一点点地改变其top,left样式来实现移动的效果,top,left可以通过鼠标获取)

    ★说一下css transform2D与transform3D的区别(一个是2*3矩阵,一个是4*4矩阵,transform3D支持GPU硬件加速,更加流畅,建议用transform3D模拟transform2D)

    ★指出{}+[]与[]+{}的值,为什么 (第一个为0,因为{}放在语句在前面,JS引擎认为它只是一个块,不是空对象,相当于+[] ===> +”" ==> 0, 第二个是”[object Object]“,两者取toString(),然后相加)

    ★说一下浏览器资源加载的情况,IE与其他浏览器各版本的不同之外
    (http://www.otakustay.com/browser-strategy-loading-external-resource/)

    ★说一下最近非常流行模块加载,大概是怎么实现的,有什么好处(http://www.cnblogs.com/muguaworld/archive/2011/11/27/2265356.html)

     

  • 你全家长的都技术化!!!

    某日,下班回住处,有街头推荐培训英语推介,华尔街英语什么的。

    然后,我由于在公司发现办入职都弄个英文名且有外国人,是个外企神马的。觉得去看看英语培训,吸取吸取对于神马未来职业规划什么的,最不济旅游也有用的心理去了。ps她说有免费的宣传册可以拿,我自己做过宣传册,看他们册子做得很不错,确实抱着有便宜不占白不占的心理进去了。

    后来直接导致我三个小时后的无比之后悔!

    然后那个人猛一通说啊。我云里雾里的,只保持住抓住钱袋子一文也不放的精神!那女女然后就开始交流感情,说你这么大了有对象了嘛,你是北京的吗,哦来北京多久了啊,有什么职业规划……..

    然后我最后直接都说,那啥,我不要画册了成不,我还有事儿呢,我先回去吧(当时晚上九点了都…..)。她抿嘴一笑,呵,这是赠给你的,你不来做培训也可以的。我问参加啊培训多少钱啊。她说按照各个级别的不同来缴纳,要做个测试,你先缴纳300块哦,这边可以刷卡的哦。我说哦,那不好意思我先去网上搜一下,华尔街英语的价位吧。然后嗯嗯嗯噢噢噢噢。你是什么星座的呢,你对这个有研究吗?…..嗯嗯嗯哈哈哈

    直至说哦你是做技术的啊,啊,我不懂技术的,不过我有学生也是做技术的呢。你做了多久技术啦?女生都不太做技术行业哟,是IT的啊。哦怪不得哦,我说句话哦 你不要生气哟,我觉得你长的很技术化哦!我??哦就是那种一看都很冷,跟机器打交道多了的样子哦。嗯一看就长的很技术化呀。

    “我去!!!你长得才很技术化!!

    这是什么形容词,我哪里长的技术化!

    你才长的技术化!你全家都长的技术化呢!!!!!!”

     

    泪流满面….时间是宝贵的,绝对不抱着占小便宜的心理了!!!

    其实我喜欢搜集画册的有木有,自己做册子发现有个对比的有木有!

    我长得还国际化呢。

    哼!!!

     

    揽镜自照,是不是说不化妆就是技术化啊。纳闷。改天整个双眼皮儿贴有木有!!

  • Stay Hungry, Stay Foolish--2005斯坦福大学05年毕业演讲

    斯蒂夫•保罗•乔布斯(Steve Paul Jobs,1955年2月24日出生-)是蘋果電腦的現任首席執行長(首席执行官)兼創辦人之一。同時也是Pixar動畫公司的董事長及首席執行長。这是他2005在斯坦福大学做的毕业演讲。。。很鼓舞人。。。也许精彩就在平实之间。。。

    Thank you.
    I’m honored to be with you today for your commencement from one of the finest universities in the world. Truth be told, I never graduated from college, and this is the closest I’ve ever gotten to a college graduation. Today, I want to tell you three stories from my life. That’s it. No big deal. Just three stories.

    The first story is about connecting the dots.

    I dropped out of Reed College after the first six months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?

    It started before I was born. My biological mother was a young, unwed graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife — except that when I popped out they decided at the last minute that they really wanted a girl.

    So my parents, who were on a waiting list, got a call in the middle of the night asking, “We’ve got an unexpected baby boy; do you want him?” They said, “Of course.” My biological mother found out later that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would go to college. This was the start in my life.

    And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents’ savings were being spent on my college tuition. After six months, I couldn’t see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life.

    So I decided to drop out and trust that it would all work out okay. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didn’t interest me, and begin dropping in on the ones that looked far more interesting.

    It wasn’t all romantic. I didn’t have a dorm room, so I slept on the floor in friends’ rooms. I returned coke bottles for the five cent deposits to buy food with, and I would walk the seven miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:

    Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didn’t have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science can’t capture, and I found it fascinating.

    None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the “Mac” would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, it’s likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on that calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards 10 years later.
    Again, you can’t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something — your gut, destiny, life, karma, whatever — because believing that the dots will connect down the road will give you the confidence to follow your heart, even when it leads you off the well-worn path, and that will make all the difference.

    My second story is about love and loss.

    I was lucky — I found what I loved to do early in life. Woz1 and I started Apple in my parents’ garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a two billion dollar company with over 4000 employees. We’d just released our finest creation — the Macintosh — a year earlier, and I had just turned 30.

    And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. And so at 30, I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.

    I really didn’t know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down — that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me: I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.

    I didn’t see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.

    During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the world’s first computer-animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, and I returned to Apple, and the technology we developed at NeXT is at the heart of Apple’s current renaissance. And Laurene and I have a wonderful family together.

    I’m pretty sure none of this would have happened if I hadn’t been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometime life — Sometimes life going to hit you in the head with a brick. Don’t lose faith. I’m convinced that the only thing that kept me going was that I loved what I did. You’ve got to find what you love.

    And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking — and don’t settle. As with all matters of the heart, you’ll know when you find it. And like any great relationship, it just gets better and better as the years roll on. So keep looking — don’t settle.

    My third story is about death.

    When I was 17, I read a quote that went something like: “If you live each day as if it was your last, someday you’ll most certainly be right.” It made an impression on me, and since then, for the past 33 years, I’ve looked in the mirror every morning and asked myself: “If today were the last day of my life, would I want to do what I am about to do today?” And whenever the answer has been “No” for too many days in a row, I know I need to change something.

    Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure — these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.

    About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didn’t even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctor’s code for “prepare to die.” It means to try and tell your kids everything you thought you’d have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.

    I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and, thankfully, I’m fine now.

    This was the closest I’ve been to facing death, and I hope it’s the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept: No one wants to die.

    Even people who want to go to heaven don’t want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It’s Life’s change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it’s quite true.

    Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

    When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the “bibles” of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 60s, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and Polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along. It was idealistic, overflowing with neat tools and great notions.

    Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: “Stay Hungry. Stay Foolish.” It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I’ve always wished that for myself. And now, as you graduate to begin anew, I wish that for you.

    Stay Hungry. Stay Foolish.
    Thank you all very much.

    译文如下:

    今天,很荣幸来到各位从世界上最好的学校之一毕业的毕业典礼上。我从来没从大学毕业过,说实话,这是我离大学毕业最近的一刻。
    今天,我只说三个故事,不谈大道理,三个故事就好。

    第一个故事,是关于人生中的点点滴滴如何串连在一起。

    我在里德学院(Reed College)待了六个月就办休学了。到我退学前,一共休学了十八个月。那么,我为什么休学?(听众笑)
    这得从我出生前讲起。

    我的亲生母亲当时是个研究生,年轻未婚妈妈,她决定让别人收养我。她强烈觉得应该让有大学毕业的人收养我,所以我出生时,她就准备让我被一对律师夫妇收养。但是这对夫妻到了最后一刻反悔了,他们想收养女孩。所以在等待收养名单上的一对夫妻,我的养父母,在一天半夜里接到一通电话,问他们「有一名意外出生的男孩,你们要认养他吗?」而他们的回答是「当然要」。后来,我的生母发现,我现在的妈妈从来没有大学毕业,我现在的爸爸则连高中毕业也没有。她拒绝在认养文件上做最后签字。直到几个月后,我的养父母保证将来一定会让我上大学,她的态度才软化。

    十七年后,我上大学了。但是当时我无知地选了一所学费几乎跟史丹佛一样贵的大学(听众笑),我那工人阶级的父母将所有积蓄都花在我的学费上。六个月后,我看不出念这个书的价值何在。那时候,我不知道这辈子要干什么,也不知道念大学能对我有什么帮助,只知道我为了念这个书,花光了我父母这辈子的所有积蓄,所以我决定休学,相信船到桥头自然直。

    当时这个决定看来相当可怕,可是现在看来,那是我这辈子做过最好的决定之一。(听众笑)
    当我休学之后,我再也不用上我没兴趣的必修课,把时间拿去听那些我有兴趣的课。

    这一点也不浪漫。我没有宿舍,所以我睡在友人家里的地板上,靠着回收可乐空罐的退费五分钱买吃的,每个星期天晚上得走七哩的路绕过大半个镇去印度教的Hare Krishna神庙吃顿好料,我喜欢Hare Krishna神庙的好料。

    就这样追随我的好奇与直觉,大部分我所投入过的事务,后来看来都成了无比珍贵的经历(And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on)。举个例来说。

    当时里德学院有着大概是全国最好的书写教育。校园内的每一张海报上,每个抽屉的标签上,都是美丽的手写字。因为我休学了,可以不照正常选课程序来,所以我跑去上书写课。我学了serif与sanserif字体,学到在不同字母组合间变更字间距,学到活字印刷伟大的地方。书写的美好、历史感与艺术感是科学所无法掌握的,我觉得这很迷人。

    我没预期过学这些东西能在我生活中起些什么实际作用,不过十年后,当我在设计第一台麦金塔时,我想起了当时所学的东西,所以把这些东西都设计进了麦金塔里,这是第一台能印刷出漂亮东西的计算机。

    如果我没沉溺于那样一门课里,麦金塔可能就不会有多重字体跟等比例间距字体了。又因为Windows抄袭了麦金塔的使用方式(听众鼓掌大笑),因此,如果当年我没有休学,没有去上那门书写课,大概所有的个人计算机都不会有这些东西,印不出现在我们看到的漂亮的字来了。当然,当我还在大学里时,不可能把这些点点滴滴预先串连在一起,但在十年后的今天回顾,一切就显得非常清楚。

    我再说一次,你无法预先把点点滴滴串连起来;只有在未来回顾时,你才会明白那些点点滴滴是如何串在一起的(you can’t connect the dots looking forward; you can only connect them looking backwards)。所以你得相信,眼前你经历的种种,将来多少会连结在一起。你得信任某个东西,直觉也好,命运也好,生命也好,或者因果报应。这种作法从来没让我失望,我的人生因此变得完全不同。(Jobs停下来喝水)

    我的第二个故事,是有关爱与失去。

    我很幸运-年轻时就发现自己爱做什么事。我二十岁时,跟Steve Wozniak在我爸妈的车库里开始了苹果计算机的事业。我们拼命工作,苹果计算机在十年间从一间车库里的两个小伙子扩展成了一家员工超过四千人、市价二十亿美金的公司,在那事件之前一年推出了我们最棒的作品-麦金塔计算机(Macintosh),那时我才刚迈入三十岁,然后我被解雇了。
    我怎么会被自己创办的公司给解雇了?(听众笑)

    嗯,当苹果计算机成长后,我请了一个我以为在经营公司上很有才干的家伙来,他在头几年也确实干得不错。可是我们对未来的愿景不同,最后只好分道扬镳,董事会站在他那边,就这样在我30岁的时候,公开把我给解雇了。我失去了整个生活的重心,我的人生就这样被摧毁。
    有几个月,我不知道要做些什么。我觉得我令企业界的前辈们失望-我把他们交给我的接力棒弄丢了。我见了创办HP的David Packard跟创办Intel的Bob Noyce,跟他们说很抱歉我把事情给搞砸了。我成了公众眼中失败的示范,我甚至想要离开硅谷。

    但是渐渐的,我发现,我还是喜爱那些我做过的事情,在苹果计算机中经历的那些事丝毫没有改变我爱做的事。虽然我被否定了,可是我还是爱做那些事情,所以我决定从头来过。

    当时我没发现,但现在看来,被苹果计算机开除,是我所经历过最好的事情。成功的沉重被从头来过的轻松所取代,每件事情都不那么确定,让我自由进入这辈子最有创意的年代。

    接下来五年,我开了一家叫做 NeXT的公司,又开一家叫做Pixar的公司,也跟后来的老婆(Laurene)谈起了恋爱。Pixar接着制作了世界上第一部全计算机动画电影,玩具总动员(Toy Story),现在是世界上最成功的动画制作公司(听众鼓掌大笑)。然后,苹果计算机买下了NeXT,我回到了苹果,我们在NeXT发展的技术成了苹果计算机后来复兴的核心部份。
    我也有了个美妙的家庭。

    我很确定,如果当年苹果计算机没开除我,就不会发生这些事情。这帖药很苦口,可是我想苹果计算机这个病人需要这帖药。有时候,人生会用砖头打你的头。不要丧失信心。我确信我爱我所做的事情,这就是这些年来支持我继续走下去的唯一理由(I’m convinced that the only thing that kept me going was that I loved what I did)。

    你得找出你的最爱,工作上是如此,人生伴侣也是如此。
    你的工作将占掉你人生的一大部分,唯一真正获得满足的方法就是做你相信是伟大的工作,而唯一做伟大工作的方法是爱你所做的事(And the only way to do great work is to love what you do)。

    如果你还没找到这些事,继续找,别停顿。尽你全心全力,你知道你一定会找到。而且,如同任何伟大的事业,事情只会随着时间愈来愈好。所以,在你找到之前,继续找,别停顿。(听众鼓掌,Jobs喝水)

    我的第三个故事,是关于死亡。

    当我十七岁时,我读到一则格言,好像是「把每一天都当成生命中的最后一天,你就会轻松自在。(If you live each day as if it was your last, someday you’ll most certainly be right)」(听众笑)

    这对我影响深远,在过去33年里,我每天早上都会照镜子,自问:「如果今天是此生最后一日,我今天要做些什么?」每当我连续太多天都得到一个「没事做」的答案时,我就知道我必须有所改变了。

    提醒自己快死了,是我在人生中面临重大决定时,所用过最重要的方法。因为几乎每件事-所有外界期望、所有的名声、所有对困窘或失败的恐惧-在面对死亡时,都消失了,只有最真实重要的东西才会留下(Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything – all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important)。提醒自己快死了,是我所知避免掉入畏惧失去的陷阱里最好的方法。人生不带来、死不带去,没理由不能顺心而为。

    一年前,我被诊断出癌症。我在早上七点半作断层扫描,在胰脏清楚出现一个肿瘤,我连胰脏是什么都不知道。医生告诉我,那几乎可以确定是一种不治之症,预计我大概活不了三到六个月。医生建议我回家,好好跟亲人们聚一聚,这是医生对临终病人的标准建议。那代表你得试着在几个月内把你将来十年想跟小孩讲的话讲完。那代表你得把每件事情搞定,家人才会尽量轻松。那代表你得跟人说再见了。

    我整天想着那个诊断结果,那天晚上做了一次切片,从喉咙伸入一个内视镜,穿过胃进到肠子,将探针伸进胰脏,取了一些肿瘤细胞出来。我打了镇静剂,不醒人事,但是我老婆在场。她后来跟我说,当医生们用显微镜看过那些细胞后,他们都哭了,因为那是非常少见的一种胰脏癌,可以用手术治好。所以我接受了手术,康复了。(听众鼓掌)

    这是我最接近死亡的时候,我希望那会继续是未来几十年内最接近的一次。经历此事后,我可以比先前死亡只是纯粹想象时,要能更肯定地告诉你们下面这些:

    没有人想死。即使那些想上天堂的人,也想活着上天堂。(听众笑)
    但是死亡是我们共同的终点,没有人逃得过。这是注定的,因为死亡很可能就是生命中最棒的发明,是生命交替的媒介,送走老人们,给新生代开出道路。现在你们是新生代,但是不久的将来,你们也会逐渐变老,被送出人生的舞台。抱歉讲得这么戏剧化,但是这是真的。

    你们的时间有限,所以不要浪费时间活在别人的生活里。不要被教条所局限–盲从教条就是活在别人思考结果里。不要让别人的意见淹没了你内在的心声。最重要的,拥有追随自己内心与直觉的勇气,你的内心与直觉多少已经知道你真正想要成为什么样的人(have the courage to follow your heart and intuition. They somehow already know what you truly want to become),任何其它事物都是次要的。(听众鼓掌)

    在我年轻时,有本神奇的杂志叫做《Whole Earth Catalog》,当年这可是我们的经典读物。那是一位住在离这不远的Menlo Park的Stewart Brand发行的,他把杂志办得很有诗意。那是1960年代末期,个人计算机跟桌上出版还没出现,所有内容都是打字机、剪刀跟拍立得相机做出来的。杂志内容有点像印在纸上的平面Google,在Google出现之前35年就有了:这本杂志很理想主义,充满新奇工具与伟大的见解。

    Stewart跟他的团队出版了好几期的《Whole Earth Catalog》,然后很自然的,最后出了停刊号。当时是1970年代中期,我正是你们现在这个年龄的时候。在停刊号的封底,有张清晨乡间小路的照片,那种你四处搭便车冒险旅行时会经过的乡间小路。

    在照片下印了行小字:求知若饥,虚心若愚(Stay Hungry, Stay Foolish)。

    那是他们亲笔写下的告别讯息,我总是以此自许。当你们毕业,展开新生活,我也以此祝福你们。

    求知若饥,虚心若愚(Stay Hungry, Stay Foolish)。
    非常谢谢大家。

  • 你要不整个爆炸的发型谁注意你啊

    你要不整个爆炸的发型谁注意你啊,你现在啥都不引人注目。学人家朴素朴素装,可是本来你就够朴素的了啊。人家朴素,人家是大学教授,是什么大隐隐于市的境界,你呢,你走出去就是一不用隐就已经泯然众人矣。

    人乔布斯在没出名,1980年年轻那会演讲还是留的长头发呢。

    敢于表现自己哟~

    好多东西啊,在未得到前就已经仿若自己得到的样子。等真正达到的时候,你就制定自己的游戏规则,让别人来遵守了。那时你的潮流就是他们的潮流了。

    不过不要为了曝光率,物极必反呢,请珍惜羽毛哦。

    不是一瞬的炫目,是永久的注视。

    昨天跟舍友聊天,她说自己超喜欢三毛的 《做一棵树》。“一半埋在尘土,一半风中飞扬,一半沐浴阳光,一半洒落阴凉。非常沉默非常骄傲。”

    另一个说自己这段时间不听情歌,因为刚失恋,发现所有的情歌自己都能听懂,就像专门描写的自己,太tm痛苦了。

    再一个舍友说,自己准备辞职,找一个月的工作,找不到就回家。(她家是湖南长沙)。

    另一个已经订好21号回大连老家的火车票了。现在都没有卧铺和座位了,现在她应该还在床上补觉。

    我在看张晓风的《别人的同学会》散文集,看一页我就得查一个字,这本书让我深刻意识到自己文盲的本质,想我看了那么小说都没发现这么多不认识的字儿呢。楼上说,我以前看的作者肯定不是文化素质高的人写的。艾,看张晓风的发现延展性太强了,而且太多了,什么典故什么诗词什么什么的,我都觉得她是不是有卖弄之嫌,还是说那个年代的写得文章大都如此呢。

    不过确实感慨良多,能让你开怀大笑,也能让你跟着落泪,那么好的杜老师那么早的离去。哎呀呀的,总是每个页上有一两个字不认识,就像是一个床单你欣欣然的平铺好了,可上面竟然有根儿头发,你指定要把它揪下来。不揪下来心里就不舒服,只能打开着百度的手写输入框查字,“轭,酽,徵,浚,巇……”最后只要折起页码以后一鼓作气查完了。

    好了,回去换套衣服吧。

    “……我去!!!你就想让我换个衣服,有必要说这么多么、吗?!!”

    “且!!!我这不是为了好的理论与实践结合的么….艾,孺子不可教也,朽木不可雕也.”

    “还有呢?”

    “粪土之墙不可圬也~”