<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>时间重开</title>
    <description>　
[color=red]带着最初的激情， 追寻着最初的梦想，感受着最初的体验，我们上路吧。[/color]</description>
    <link>http://taya.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>js犀牛书</title>
        <author>taya</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://taya.javaeye.com">taya</a>&nbsp;
          链接：<a href="http://taya.javaeye.com/blog/108700" style="color:red;">http://taya.javaeye.com/blog/108700</a>&nbsp;
          发表时间: 2007年08月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>第5版真实在</p>
<div>&nbsp;&nbsp;&nbsp; JavaScript functions are a combination of code to be executed and the scope in which to execute them. This combination of code and scope is known as a closure in the computer science literature. All JavaScript functions are closures. These closures are only interesting, however, in the case discussed above: when a nested function is exported outside the scope in which it is defined. When a nested function is used in this way, it is often explicitly called a closure.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; When the JavaScript interpreter invokes a function, it first sets the scope to the scope chain that was in effect when the function was defined. Next, it adds a new object, known as the call object (the ECMAScript specification uses the term activation object) to the front of the scope chain. The call object is initialized with a property named arguments that refers to the Arguments object for the function. Named parameters of the function are added to the call object next. Any local variables declared with the var statement are also defined within this object. Since this call object is at the head of the scope chain, local variables, function parameters, and the Arguments object are all in scope within the function. This also means that they hide any properties with the same name that are further up the scope chain, of course.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; When no nested functions are involved, the scope chain is the only reference to the call object. When the object is removed from the chain, there are no more references to it, and it ends up being garbage collected.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; But nested functions change the picture. If a nested function is created, the definition of that function refers to the call objects because that call object is the top of the scope chain in which the function was defined. If the nested function is used only within the outer function, however, the only reference to the nested function is in the call object. When the outer function returns, the nested function refers to the call object, and the call object refers to nested function, but there are no other references to either one, and so both objects become available for garbage collection.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; Things are different if you save a reference to the nested function in the global scope. You do so by using the nested function as the return value of the outer function or by storing the nested function as the property of some other object. In this case, there is an external reference to the nested function, and the nested function retains its reference to the call object of the outer function. The upshot is that the call object for that one particular invocation of the outer function continues to live, and the names and values of the function arguments and local variables persist in this object. JavaScript code cannot directly access the call object in any way, but the properties it defines are part of the scope chain for any invocation of the nested function. (Note that if an outer function stores global references to two nested functions, these two nested functions share the same call object, and changes made by an invocation of one function are visible to invocations of the other function.)&nbsp;</div>
<div></div>
<div>
<div>&nbsp;&nbsp;&nbsp; The object through which a method is invoked becomes the value of the <tt>this</tt> keyword within the body of the method.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; While it is useful to think of <a></a><a></a>functions and methods differently, there is not actually as much difference between them as there initially appears to be. Recall that functions are values stored in variables and that variables are nothing more than properties of a global object. Thus, when you invoke a function, you are actually invoking a method of the global object. Within such a function, the <tt>this</tt> keyword refers to the global object. Thus, there is no technical difference between functions and methods. The real difference lies in design and intent: methods are written to operate somehow on the <tt>this</tt> object, while functions usually stand alone and do not use the <tt>this</tt> object.</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; When a function<a></a> is invoked as a function rather that as a method, the <tt>this</tt> keyword refers to the global object. Confusingly, this is true even when a nested function is invoked (as a function) within a containing method that was invoked as a method: the <tt>this</tt> keyword has one value in the containing function but (counterintuitively) refers to the global object within the body of the nested function.</div>
<div></div>
<div>
<div class="code_title">js 代码</div>
<div class="dp-highlighter">
<div class="bar"></div>
<ol class="dp-c">
    <li class="alt"><span><span class="keyword">var</span><span>&nbsp;o&nbsp;=&nbsp;{};&nbsp; &nbsp;&nbsp;</span></span></li>
    <li class=""><span>o.m&nbsp;=&nbsp;</span><span class="keyword">function</span><span>&nbsp;test(x)&nbsp;{ &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;alert(</span><span class="keyword">this</span><span>);&nbsp;</span><span class="comment">//&nbsp;o </span><span>&nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;</span><span class="keyword">var</span><span>&nbsp;y&nbsp;=&nbsp;x; &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;</span><span class="keyword">this</span><span>.y&nbsp;=&nbsp;x; &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp; &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;(</span><span class="keyword">function</span><span>()&nbsp;{ &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;&nbsp;alert(</span><span class="keyword">this</span><span>);&nbsp;</span><span class="comment">//&nbsp;window </span><span>&nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;})(); &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp; &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;</span><span class="keyword">var</span><span>&nbsp;z&nbsp;=&nbsp;</span><span class="keyword">function</span><span>()&nbsp;{ &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;&nbsp;alert(</span><span class="keyword">this</span><span>);&nbsp;</span><span class="comment">//&nbsp;window </span><span>&nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;}; &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;z(); &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp; &nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;</span><span class="keyword">return</span><span>&nbsp;</span><span class="keyword">function</span><span>&nbsp;nestedTest()&nbsp;{ &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;&nbsp;alert(</span><span class="keyword">this</span><span>);&nbsp;</span><span class="comment">//&nbsp;window </span><span>&nbsp;&nbsp;</span></li>
    <li class=""><span>&nbsp;&nbsp;</span><span class="keyword">this</span><span>.y&nbsp;=&nbsp;y&nbsp;+&nbsp;x; &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;}(); &nbsp;&nbsp;</span></li>
    <li class=""><span>};&nbsp; &nbsp;&nbsp;</span></li>
    <li class="alt"><span>&nbsp;&nbsp;</span></li>
    <li class=""><span>o.m(4);alert(o.y);&nbsp;</span><span class="comment">//&nbsp;4 </span><span>&nbsp;&nbsp;</span></li>
    <li class="alt"><span>alert(window.y);&nbsp;</span><span class="comment">//&nbsp;8</span><span>&nbsp;&nbsp;</span></li>
</ol>
</div>
</div>
</div>
          <br/>
          <span style="color:red;">
            <a href="http://taya.javaeye.com/blog/108700#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 04 Aug 2007 00:40:51 +0800</pubDate>
        <link>http://taya.javaeye.com/blog/108700</link>
        <guid>http://taya.javaeye.com/blog/108700</guid>
      </item>
      <item>
        <title>System中的properties</title>
        <author>taya</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://taya.javaeye.com">taya</a>&nbsp;
          链接：<a href="http://taya.javaeye.com/blog/78711" style="color:red;">http://taya.javaeye.com/blog/78711</a>&nbsp;
          发表时间: 2007年05月11日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>&nbsp;&nbsp;&nbsp; 看其他东东的时候正好看到有这么一段：</p>
<p>&nbsp;&nbsp;&nbsp; Note that the <code>System</code> properties are initialized in the <code>java.lang.System</code> class's <code>initProperties</code> method. This is a native method, so the source code is unavailable&mdash;unless you want to dig into the native code libraries that come with the J2SE distribution. However, I believe that the <code>System</code> properties are initialized from the Windows registry on Windows systems and from environment variables on Linux/Unix systems. </p>
          <br/>
          <span style="color:red;">
            <a href="http://taya.javaeye.com/blog/78711#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 11 May 2007 01:38:48 +0800</pubDate>
        <link>http://taya.javaeye.com/blog/78711</link>
        <guid>http://taya.javaeye.com/blog/78711</guid>
      </item>
      <item>
        <title>面试失败总结</title>
        <author>taya</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://taya.javaeye.com">taya</a>&nbsp;
          链接：<a href="http://taya.javaeye.com/blog/78205" style="color:red;">http://taya.javaeye.com/blog/78205</a>&nbsp;
          发表时间: 2007年05月09日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <div>&nbsp;&nbsp;&nbsp; 昨天去面了家外资公司，很失败。不知道是因为刚放完长假还是其他的什么原因，状态之差简直到了不能想象的地步，整个面试过程中几乎都答非所问，连自己的思想都未能表达清楚，就更别提展示自己的强项了。过程就不打算详说了，记点想的到的东西，将来可以参考参考，然后更好的提高自己吧。</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;1、外资和外资之间也是有很大差别的，不一定名气越大薪水越高的公司就越好。今天去的公司名气不大，但是一进去就看到不少老外在和中国方面的员工交流工作方面的事项，而且不是少数几个，是几乎视线内处处都有这样的场景。给我的感觉非常不错，以前虽然也在号称是外资的公司呆过，而且还是号称有几千人且比较有名气的公司，但明显只是批了个外资的皮，挂着羊头卖狗肉。-。-</div>
<div>&nbsp;&nbsp;&nbsp; 2、自己的职场英语还不过关。随便聊聊的时候自我感觉还不错，因为平时美剧看的比较多，说说东扯扯西的，还觉得自己挺溜的，但是一旦听到一些平时很少接触到的职场或者专业相关的英语词汇，就傻眼了。听都这样了，就更别提说了，回答专业问题的时候才发现要用这么些平时很少说的词汇来组织语言、表达自己的思想是多难啊。不过没环境怎么练呢，郁闷... @_@</div>
<div>&nbsp;&nbsp;&nbsp; 3、由于2，所以导致3。我这个人有个缺点，很难一心多用，同一时间只能专著与一件事上。如果我在表达的时候感觉很顺利，那后续的思维肯定极其活跃，闪光点一个接一个的冒出来，感觉就和头脑风暴似的。但是一旦在表达的过程中发生卡壳现象，那后续思维就也会卡壳，会将思考的频道一下子就转到如何才能确切的表达当前思想上去，导致说下一句的时候大脑完全不知道在做什么。sigh，这点以后要好好锻炼锻炼。</div>
<div>&nbsp;&nbsp;&nbsp; 4、平时太依赖IDE和doc还有google了。</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; 暂时就想到这些，下次想到了再补，over。&nbsp;
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; [5.10 补]
<div>&nbsp;&nbsp;&nbsp; 5、以前找工作不够慎重。我工作到现在也快满4年了，如果不算当中那次短短2个月的ebao经历，平均在每家公司至少呆2年左右，但是这次去面试，还是被面试官说了一句，说跳得太频繁了。我后来自己思考了一下，好像是有这么点意思。以前刚工作，还不太懂怎样的公司算好怎样的公司算差，见得少自然也就只能想像到眼前的情景，这点以后也要注意了，希望这次能找个为之工作n(n &gt; 5)年的公司。不过还有个更现实的问题，如果不亲自进入一个公司去体验一下，光凭别人说或者网上的信息，又如何能更准确地了解要去的公司是不是适合自己呢？</div>
</div>
</div>
          <br/>
          <span style="color:red;">
            <a href="http://taya.javaeye.com/blog/78205#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 09 May 2007 12:25:02 +0800</pubDate>
        <link>http://taya.javaeye.com/blog/78205</link>
        <guid>http://taya.javaeye.com/blog/78205</guid>
      </item>
      <item>
        <title>ObjectLock &amp; ClassLock</title>
        <author>taya</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://taya.javaeye.com">taya</a>&nbsp;
          链接：<a href="http://taya.javaeye.com/blog/68181" style="color:red;">http://taya.javaeye.com/blog/68181</a>&nbsp;
          发表时间: 2007年04月05日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <div id="msgcns!E9370BB0E82D73DE!168">
<div>对象锁<br />
当一个对象中有synchronized method或synchronized block的时候<br />
调用此对象的同步方法或进入其同步区域时，就必须先获得对象锁<br />
如果此对象的对象锁已被其他调用者占用，则需要等待此锁被释放</div>
<div><br />
同步静态方法/静态变量互斥体<br />
由于一个class不论被实例化多少次，其中的静态方法和静态变量在内存中都只由一份<br />
所以，一旦一个静态的方法被申明为synchronized<br />
此类所有的实例化对象在调用此方法，共用同一把锁，我们称之为类锁<br />
一旦一个静态变量被作为synchronized block的mutex<br />
进入此同步区域时，都要先获得此静态变量的对象锁</div>
<div><br />
类锁<br />
由上述同步静态方法引申出一个概念，那就是类锁<br />
其实系统中并不存在什么类锁<br />
当一个同步静态方法被调用时，系统获取的其实就是代表该类的类对象的对象锁</div>
<div><br />
在程序中获取类锁<br />
可以尝试用以下方式获取类锁<br />
synchronized (xxx.class) {...}<br />
synchronized (Class.forName(&quot;xxx&quot;)) {...}</div>
<div><br />
同时获取2类锁<br />
同时获取类锁和对象锁是允许的，并不会产生任何问题<br />
但使用类锁时一定要注意，一旦产生类锁的嵌套获取的话，就会产生死锁<br />
因为每个class在内存中都只能生成一个Class实例对象</div>
</div>
          <br/>
          <span style="color:red;">
            <a href="http://taya.javaeye.com/blog/68181#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 05 Apr 2007 00:07:22 +0800</pubDate>
        <link>http://taya.javaeye.com/blog/68181</link>
        <guid>http://taya.javaeye.com/blog/68181</guid>
      </item>
      <item>
        <title>我潜我浮</title>
        <author>taya</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://taya.javaeye.com">taya</a>&nbsp;
          链接：<a href="http://taya.javaeye.com/blog/68179" style="color:red;">http://taya.javaeye.com/blog/68179</a>&nbsp;
          发表时间: 2007年04月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>嗯...在je潜水也潜了2、3年了，现在浮出来透透气</p>
          <br/>
          <span style="color:red;">
            <a href="http://taya.javaeye.com/blog/68179#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 04 Apr 2007 23:56:59 +0800</pubDate>
        <link>http://taya.javaeye.com/blog/68179</link>
        <guid>http://taya.javaeye.com/blog/68179</guid>
      </item>
  </channel>
</rss>