<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>前端开发</title>
	<atom:link href="http://www.coolicer.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.coolicer.com</link>
	<description>Live and breathe HTML, CSS and Javascript</description>
	<lastBuildDate>Mon, 21 May 2012 14:14:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>前端教你学PHP-1（PHP环境搭配）</title>
		<link>http://www.coolicer.com/2012/05/21/%e5%89%8d%e7%ab%af%e6%95%99%e4%bd%a0%e5%ad%a6php-1%ef%bc%88php%e7%8e%af%e5%a2%83%e6%90%ad%e9%85%8d%ef%bc%89.html</link>
		<comments>http://www.coolicer.com/2012/05/21/%e5%89%8d%e7%ab%af%e6%95%99%e4%bd%a0%e5%ad%a6php-1%ef%bc%88php%e7%8e%af%e5%a2%83%e6%90%ad%e9%85%8d%ef%bc%89.html#comments</comments>
		<pubDate>Mon, 21 May 2012 14:09:46 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[前端教你学PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-basic]]></category>
		<category><![CDATA[前端]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=687</guid>
		<description><![CDATA[博主无聊，决定出一系列的PHP基础教程，所有内容都可以在网上找到，但是有些菜鸟真的很懒，连找都不懂找。所以博主才想发一个白痴系统的教程，让菜鸟们都能顺利地入门。 首先，当然是要知道什么是PHP，然后废话不说，马上就是PHP的环境搭配。在网上可以说这样的教程多如牛毛，这里只是给一些需要的人看。并且是2012年出的，与时并进。（其实也是没有什么大不了的，代码还是那些代码。） 1、下载所需要的文件 以下是win7环境中的示例： php5.4(VC9 x86 Thread Safe) mysql(mysql-installer-5.5.24.0.msi) apache(httpd-2.2.22-win32-x86-openssl-0.9.8t.msi) 2、然后是安装这三个。 php安装 直接解压就可以了。 Apache安装 也是很简单的安装。安装完成后，可以在浏览器输入http://127.0.0.1测试。 mysql安装 3、配置httpd.conf 安装完php和apache之后，配置apache/conf/下的httpd.conf完成最基础的配置，让其可以运行.php。 LoadModule php5_module "G:/php5.4.3/php5apache2_2.dll" AddHandler application/x-httpd-php .php PHPIniDir "G:/php5.4.3" 别忘了，下面那个目录也要换成你的php根目录，不使用apache的htdocs。 DocumentRoot "G:/root" //1 &#160;&#160;&#160; &#160;&#160;&#160; &#60;Directory "G:/root"&#62; //2 # # Possible values for &#8230; <a href="http://www.coolicer.com/2012/05/21/%e5%89%8d%e7%ab%af%e6%95%99%e4%bd%a0%e5%ad%a6php-1%ef%bc%88php%e7%8e%af%e5%a2%83%e6%90%ad%e9%85%8d%ef%bc%89.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>博主无聊，决定出一系列的PHP基础教程，所有内容都可以在网上找到，但是有些菜鸟真的很懒，连找都不懂找。所以博主才想发一个白痴系统的教程，让菜鸟们都能顺利地入门。</p>
<p>
首先，当然是要知道什么是<arrb title="PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.">PHP</arrb>，然后废话不说，马上就是PHP的环境搭配。在网上可以说这样的教程多如牛毛，这里只是给一些需要的人看。并且是2012年出的，与时并进。（其实也是没有什么大不了的，代码还是那些代码。）
</p>
<p><span id="more-687"></span></p>
<h2>1、下载所需要的文件</h2>
<p>以下是win7环境中的示例：</p>
<ul>
<li><a href="http://windows.php.net/download/" target="_blank">php5.4(VC9 x86 Thread Safe)</a></li>
<li><a href="http://dev.mysql.com/downloads/installer/5.5.html"  target="_blank">mysql(mysql-installer-5.5.24.0.msi)</a></li>
<li><a href="http://httpd.apache.org/download.cgi"  target="_blank">apache(httpd-2.2.22-win32-x86-openssl-0.9.8t.msi)</a></li>
</ul>
<h2>2、然后是安装这三个。</h2>
<h3>php安装</h3>
<p>直接解压就可以了。</p>
<h3>Apache安装</h3>
<p>也是很简单的安装。安装完成后，可以在浏览器输入http://127.0.0.1测试。</p>
<h3>mysql安装</h3>
<h2>3、配置httpd.conf</h2>
<p>安装完php和apache之后，配置apache/conf/下的httpd.conf完成最基础的配置，让其可以运行.php。<br />
<script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
LoadModule php5_module "G:/php5.4.3/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "G:/php5.4.3"
</script></p>
<p>别忘了，下面那个目录也要换成你的php根目录，不使用apache的htdocs。</p>
<p><script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
DocumentRoot "G:/root"  //1
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&lt;Directory "G:/root"&gt; //2
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
&nbsp;&nbsp;&nbsp;
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
&nbsp;&nbsp;&nbsp;
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
&nbsp;&nbsp;&nbsp;
&lt;/Directory&gt;
</script><br />
接下来就是安装mysql，安装也十分地简单，等到要连接数据库的时候，我们再来讨论。我之前有<a href="http://www.coolicer.com/2012/05/12/call-to-undefined-function-mysql_connect.html" target="_blank">一篇文章</a>就是写mysql的配置的。另外，如果要安装phpMyadmin也是十分简单的，网上都有许多的资源。</p>
<h2>总结</h2>
<p>这只是一个开始，希望每天能写一个简单的php教程。前端教你学PHP，与你一起成长。有任务问题，请联系博主，谢谢。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/05/21/%e5%89%8d%e7%ab%af%e6%95%99%e4%bd%a0%e5%ad%a6php-1%ef%bc%88php%e7%8e%af%e5%a2%83%e6%90%ad%e9%85%8d%ef%bc%89.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql启用失败：Call to undefined function mysql_connect</title>
		<link>http://www.coolicer.com/2012/05/12/call-to-undefined-function-mysql_connect.html</link>
		<comments>http://www.coolicer.com/2012/05/12/call-to-undefined-function-mysql_connect.html#comments</comments>
		<pubDate>Sat, 12 May 2012 08:27:07 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[db-connect]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php.ini]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=682</guid>
		<description><![CDATA[现在是php5.4时代，之前有用过XAMPP，WAMP这种集成的环境。这次，我决定手工安装。 安装完成后，我发现了原来没有自带phpMyadmin这个管理工具的，也是，那只是集成环境帮我们安装了。但是，我没有安装这个，我选择了一个客户端Navicat，平时可以用CMD嘛。 今天要连接数据库的时候，出现Fatal error:Call to undefined function mysql_connect。我就郁闷了，我有在php.ini打开mysql扩展的，怎么就不行了呢？上网搜索一番后，有了答案： 首先在php.ini里面把 extension=php_mysql.dll 去掉了前面的 ; mysql/lib/libmySQL.dll 拷贝到 php5.4下面，还有拷贝到 php5.4/ext 目录下 libmySQL.dll ，php5ts.dll 两个文件拷贝到 windows/system32 然后还是失败了，为什么呢？我又一番搜索。最后，答案终于出来了，打开extension_dir这个，并把值设成ext。 extension_dir = "your-path/php/ext" 最后，别忘了重启apache。]]></description>
			<content:encoded><![CDATA[<p>现在是php5.4时代，之前有用过XAMPP，WAMP这种集成的环境。这次，我决定手工安装。</p>
<p>安装完成后，我发现了原来没有自带phpMyadmin这个管理工具的，也是，那只是集成环境帮我们安装了。但是，我没有安装这个，我选择了一个客户端Navicat，平时可以用CMD嘛。</p>
<p>今天要连接数据库的时候，出现Fatal error:Call to undefined function mysql_connect。我就郁闷了，我有在php.ini打开mysql扩展的，怎么就不行了呢？上网搜索一番后，有了答案：</p>
<ol>
<li>首先在php.ini里面把 extension=php_mysql.dll 去掉了前面的 ;</li>
<li>mysql/lib/libmySQL.dll  拷贝到 php5.4下面，还有拷贝到 php5.4/ext 目录下</li>
<li>libmySQL.dll ，php5ts.dll 两个文件拷贝到 windows/system32 </li>
</ol>
<p>然后还是失败了，为什么呢？我又一番搜索。最后，答案终于出来了，打开extension_dir这个，并把值设成ext。</p>
<p><script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
     extension_dir = "your-path/php/ext"
</script></p>
<p>最后，别忘了重启apache。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/05/12/call-to-undefined-function-mysql_connect.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>about closures</title>
		<link>http://www.coolicer.com/2012/05/11/about-closures.html</link>
		<comments>http://www.coolicer.com/2012/05/11/about-closures.html#comments</comments>
		<pubDate>Fri, 11 May 2012 03:34:40 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[closure]]></category>
		<category><![CDATA[闭包]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=671</guid>
		<description><![CDATA[闭包是什么？ 官方的描述我没有看过，一般看文章的时候，博客也是只给出博主自己的理解。如果你问我什么是闭包，我可以一下子说不出来。这鬼东西我没有玩过…… 我的理解： 1、闭包是一种作用域独立的环境？ 2、闭包就是一种内存溢出的体现？ 3、闭包就是内部保持引用外部的变量，使其没有被垃圾回收机制干掉？ 4、忘记了，闭包跟作用域关系比较密切，要了解JS相关作用域知识。 你也许在想，怎么后面都有个问号呢？或者我还不能完全肯定吧。那闭包可以干什么呢？我没有实力展现，所以以下是我读的一篇文章，大家可以参考一下。 http://net.tutsplus.com/tutorials/javascript-ajax/closures-front-to-back/ (function(exports){ &#160;&#160;&#160; function myPrivateMultiplyFunction(num,num2) { return num * num2; } &#160;&#160;&#160; //equivalent to window.multiply = function(num1,num2) { ... exports.multiply = function(num1,num2) { console.log(myPrivateMultiplyFunction(num1,num2)); } })(window); 首先来看这样的一个东西，老鸟表示小菜，这种写法太普通了。那我们新手要从中看中什么呢？答案就是隐藏myPrivateMultiplyFunction这个函数，仅为其提供一个接口multiply。 下面它还有一个例子，是关于检测键盘事件的。 var KeyMap = { &#8230; <a href="http://www.coolicer.com/2012/05/11/about-closures.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>闭包是什么？</h2>
<p>官方的描述我没有看过，一般看文章的时候，博客也是只给出博主自己的理解。如果你问我什么是闭包，我可以一下子说不出来。这鬼东西我没有玩过……</p>
<p>我的理解：<br />
1、闭包是一种作用域独立的环境？<br />
2、闭包就是一种内存溢出的体现？<br />
3、闭包就是内部保持引用外部的变量，使其没有被垃圾回收机制干掉？<br />
4、忘记了，闭包跟作用域关系比较密切，要了解JS相关作用域知识。</p>
<p>你也许在想，怎么后面都有个问号呢？或者我还不能完全肯定吧。那闭包可以干什么呢？我没有实力展现，所以以下是我读的一篇文章，大家可以参考一下。</p>
<p>http://net.tutsplus.com/tutorials/javascript-ajax/closures-front-to-back/</p>
<p><span id="more-671"></span><br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
(function(exports){
&nbsp;&nbsp;&nbsp;
   function myPrivateMultiplyFunction(num,num2) {
      return num * num2;
   }
&nbsp;&nbsp;&nbsp;
   //equivalent to window.multiply = function(num1,num2) { ...
   exports.multiply = function(num1,num2) {
      console.log(myPrivateMultiplyFunction(num1,num2));
   }
})(window);
</script></p>
<p>首先来看这样的一个东西，老鸟表示小菜，这种写法太普通了。那我们新手要从中看中什么呢？答案就是隐藏myPrivateMultiplyFunction这个函数，仅为其提供一个接口multiply。</p>
<p>下面它还有一个例子，是关于检测键盘事件的。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var KeyMap = {
&nbsp;&nbsp;&nbsp;
   "Enter":13,
&nbsp;&nbsp;&nbsp;
   "Shift":16,
&nbsp;&nbsp;&nbsp;
   "Tab":9,
&nbsp;&nbsp;&nbsp;
   "LeftArrow":37
&nbsp;&nbsp;&nbsp;
};
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
for (var key in KeyMap) {
&nbsp;&nbsp;&nbsp;
   KeyMap["is" + key] = (function(compare) {
&nbsp;&nbsp;&nbsp;
      return function(ev) {
&nbsp;&nbsp;&nbsp;
         var code = ev.keyCode || ev.which;
&nbsp;&nbsp;&nbsp;
         return code === compare;
&nbsp;&nbsp;&nbsp;
      };
&nbsp;&nbsp;&nbsp;
   })(KeyMap[key]);
&nbsp;&nbsp;&nbsp;
}
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
var txtInput = document.getElementById('input');
&nbsp;&nbsp;&nbsp;
txtInput.onkeypress = function(e) {
&nbsp;&nbsp;&nbsp;
   if(KeyMap.isEnter(e)) {
&nbsp;&nbsp;&nbsp;
      console.log(txtInput.value);
&nbsp;&nbsp;&nbsp;
   }
&nbsp;&nbsp;&nbsp;
};
</script></p>
<p>其中是应用了闭包，生成了各自的isXXX方法。</p>
<p>最后也可以闭包来扩展方法。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
Function.prototype.cached = function() {
   var self = this, //"this" refers to the original function
      cache = {}; //our local, lexically scoped cache storage
   return function(args) {
      if(args in cache) return cache[args];
      return cache[args] = self(args);
   };
};
</script><br />
chache的好处就是可以把运行过的结果保存下来，看下面的。<br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
Math.sin = Math.sin.cached();
Math.sin(1) // => 0.8414709848078965
Math.sin(1) // => 0.8414709848078965 this time pulled from cache
</script></p>
<p>感兴趣可以去拜读一下原文。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/05/11/about-closures.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[翻译]Prototypes in JavaScript</title>
		<link>http://www.coolicer.com/2012/05/10/prototypes-in-javascript.html</link>
		<comments>http://www.coolicer.com/2012/05/10/prototypes-in-javascript.html#comments</comments>
		<pubDate>Thu, 10 May 2012 04:01:49 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[proto]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=655</guid>
		<description><![CDATA[When you define a function within JavaScript, it comes with a few pre-defined properties; one of these is the illusive prototype. In this article, I’ll detail what it is, and why you should use it in your projects. 当你在Javascript定义一个函数时，它会有一些预定义的属性；其一是让人迷惑的Prototype。在这篇文章中，我会简单地阐述它是什么，还有为什么你要在项目中使用它。 What &#8230; <a href="http://www.coolicer.com/2012/05/10/prototypes-in-javascript.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you define a function within JavaScript, it comes with a few pre-defined properties; one of these is the illusive prototype. In this article, I’ll detail what it is, and why you should use it in your projects.</p>
<p>当你在Javascript定义一个函数时，它会有一些预定义的属性；其一是让人迷惑的Prototype。在这篇文章中，我会简单地阐述它是什么，还有为什么你要在项目中使用它。</p>
<h2>What is Prototype?(什么是原型?)</h2>
<p>The prototype property is initially an empty object, and can have members added to it – as you would any other object.</p>
<p>原型是一个对象里面的空对象，可以在其中添加成员，像其他的对象一样。</p>
<p><span id="more-655"></span><br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var myObject = function(name){
    this.name = name;
    return this;
};
console.log(typeof myObject.prototype); // object
myObject.prototype.getName = function(){
    return this.name;
};
</script></p>
<p>In the snippet above, we’ve created a function, but if we call myObject(), it will simply return the window object, because it was defined within the global scope. this will therefore return the global object, as it has not yet been instantiated (more on this later).</p>
<p>在上面的代码片断，我们创建了一个函数，如果我们调用myObject()，它会简单地返回window这个对象，因为它是定义在全局变量里面，所以会返回全局变量，当前它还有没有实例化（后面更多介绍）。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(myObject() === window); // true
</script></p>
<h2>The Secret Link(背后的秘密链)</h2>
<p>Before we continue, I’d like to discuss the “secret” link that makes prototype work the way it does.</p>
<p>在我们继续之前，我想讨论一下它的“秘密”链是怎么工作的。</p>
<p>Every object within JavaScript has a “secret” property added to it when it is defined or instantiated, named __proto__; this is how the prototype chain is accessed. However, it is not a good idea to access __proto__ within your application, as it is not available in all browsers.</p>
<p>在Javascript中，每一个对象当它被定义时或实例化都会添加一个“秘密”的属性，名字叫__proto__；这就是为什么原型链可以访问的原因。然而，你却不可以通过__proto__来访问你的程序，因为不是所有浏览器都支持。</p>
<p>The __proto__ property shouldn’t be confused with an object’s prototype, as they are two separate properties; that said, they do go hand in hand. It’s important to make this distinction, as it can be quite confusing at first! What does this mean exactly? Let me explain. When we created the myObject function, we were defining an object of type Function.</p>
<p>我们不应该为对象原型中的prototype和__proto__属性感到迷惑，它们的2个分开的属性；换句话说，它们是联合行动的，一定要注意区分它们，在刚开始的时候都会比较让人疑惑！这是到底什么意思呢？让我来解释一下。当我们创建 myObject 函数，我们是在定义一个对象的类型为Function。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(typeof myObject); // function
</script></p>
<p>For those unaware, Function is a predefined object in JavaScript, and, as a result, has its own properties (e.g. length and arguments) and methods (e.g. call and apply). And yes, it, too, has its own prototype object, as well as the secret __proto__ link. This means that, somewhere within the JavaScript engine, there is a bit of code that could be similar to the following:</p>
<p>对于那些没有意识到的，Function在Javascript里面是一个预定义对象，但是，它作为Function对象，它有它自己的属性(例如，length和arguments)和方法(例如，call和apply)。是的， 它也有它自己的原型对象，还有秘密链接“__proto__”。这意味着，在JavaScript引擎的某处，有一些与下面相似的代码：</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
Function.prototype = {
    arguments: null,
    length: 0,
    call: function(){
        // secret code
    },
    apply: function(){
        // secret code
    }
    ...
}
</script></p>
<p>In truth, it probably wouldn’t be quite so simplistic; this is merely to illustrate how the prototype chain works.</p>
<p>事实上，它并没有像上面的代码那样过于简单；这是用来阐明原型链是怎么工作的而已。</p>
<p>So we have defined myObject as a function and given it one argument, name; but we never set any properties, such as length or methods, such as call. So why does the following work?</p>
<p>上面，我们已经定义了 myObject 这个函数，给了它一个唯一的参数，name；但是我们还没有设置任何的属性，例如，长度或方法，再如call。那么接下来怎么做呢？</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(myObject.length); // 1 (being the amount of available arguments)
</script></p>
<p>This is because, when we defined myObject, it created a __proto__ property and set its value to Function.prototype (illustrated in the code above). So, when we access myObject.length, it looks for a property of myObject called length and doesn’t find one; it then travels up the chain, via the __proto__ link, finds the property and returns it.</p>
<p>这是因为，当我们定义了 myObject ，它创建了一个 __proto__ 属性跟设置了它的值为Function.prototype(像上面说的代码那样)。所以，当我们访问 myObject.length，它会查找 myObject里面的属性 length，然后没有找到；然后它就递归到上一层链，通过__proto__链，找到属性并返回它。</p>
<p>You might be wondering why length is set to 1 and not 0 – or any other number for that fact. This is because myObject is in fact an instance of Function.</p>
<p>你也许会觉得奇怪，为什么长度会是1而不是0 &#8211; 或者不是其他的值。这是因为 myObject是Function的一个实例。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(myObject instanceof Function); // true
console.log(myObject === Function); // false
</script></p>
<p>When an instance of an object is created, the __proto__ property is updated to point to the constructor’s prototype, which, in this case, is Function.</p>
<p>当一个对象被实例化，__proto__属性就会更新指向构造器的prototype属性，在这里，指向Function。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(myObject.__proto__ === Function.prototype) // true
</script></p>
<p>Additionally, when you create a new Function object, the native code inside the Function constructor will count the number of arguments and update this.length accordingly, which, in this case, is 1.</p>
<p>另外，当你创建了一个新的Function对象，内部代码中，Function构造器会计算参数的长度和更新到相应的this.length，在这里，是1。</p>
<p>If, however, we create a new instance of myObject using the new keyword, __proto__ will point to myObject.prototype as myObject is the constructor of our new instance.</p>
<p>如果我们使用new关键字来实例化 myObject，__proto__会指向myObject.prototype，因为 myObject是新实例的构造器。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var myInstance = new myObject(“foo”);
console.log(myInstance.__proto__ === myObject.prototype); // true
</script></p>
<p>In addition to having access to the native methods within the Function.prototype, such as call and apply, we now have access to myObject’s method, getName.</p>
<p>除了有访问Function.prototype的内部的方法之外，还可以访问call和apply，现在我们来访问 myObject’s的方法，getName。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
console.log(myInstance.getName()); // foo
var mySecondInstance = new myObject(“bar”);
console.log(mySecondInstance.getName()); // bar
console.log(myInstance.getName()); // foo
</script></p>
<p>As you can imagine, this is quite handy, as it can be used to blueprint an object, and create as many instances as needed – which leads me onto the next topic!</p>
<p>就像你想象那样，这是非常便利的，它可以很好地计划一个对象，可以创建许多的实例 &#8211; 接着带领我进去下一个话题！</p>
<h2>Why is Using Prototype Better?(为什么使用原型会更好?)</h2>
<p>Say, for instance, that we are developing a canvas game and need several (possibly hundreds of) objects on the screen at once. Each object requires its own properties, such as x and y coordinates, width,height, and many others.</p>
<p>例如我们在开发一个canvas做的游戏，需要几个对象（或几百个）同时出现在屏幕上。每个对象都有自己的属性，例如x和y坐标，宽，高，还有其他。</p>
<p>We might do it as follows:</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var GameObject1 = {
    x: Math.floor((Math.random() * myCanvasWidth) + 1),
    y: Math.floor((Math.random() * myCanvasHeight) + 1),
    width: 10,
    height: 10,
    draw: function(){
        myCanvasContext.fillRect(this.x, this.y, this.width, this.height);
    }
   ...
};
var GameObject2 = {
    x: Math.floor((Math.random() * myCanvasWidth) + 1),
    y: Math.floor((Math.random() * myCanvasHeight) + 1),
    width: 10,
    height: 10,
    draw: function(){
        myCanvasContext.fillRect(this.x, this.y, this.width, this.height);
    }
    ...
}; //… do this 98 more times …
</script></p>
<p>What this will do is create all these objects within memory – all with separate definitions for methods, such as draw and whatever other methods may be required. This is certainly not ideal, as the game will bloat the browsers allocated JavaScript memory, and make it run very slowly… or even stop responding.</p>
<p>当在内存中创建如此多对象会发生什么事 &#8211; 所有定义的方法都会占一定的内存，例如draw还有其他的依赖的方法。这不是理想中的效果，这个程序 会使浏览器变得缓慢，占用更多内存，甚至会便程序失去响应。</p>
<p>While this probably wouldn’t happen with only 100 objects, it still can serve to be quite a performance hit, as it will need to look up one hundred different objects, rather than just the single prototype object.</p>
<p>虽然不会可能只有100个对象，它仍然表现得不是很好，它要查找100个不同的对象，而不是单单一个原型属性。</p>
<h2>How to Use Prototype</h2>
<p>To make the application run faster (and follow best practices), we can (re)define the prototype property of the GameObject; every instance of GameObject will then reference the methods within GameObject.prototype as if they were their own methods.</p>
<p>为了让它跑得更快(更好的体验)，我们可以重新定义这个 GameObject的原型；每个 GameObject的实例会引用 GameObject.prototype就像使用自己的方法一样。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
// define the GameObject constructor function
var GameObject = function(width, height) {
    this.x = Math.floor((Math.random() * myCanvasWidth) + 1);
    this.y = Math.floor((Math.random() * myCanvasHeight) + 1);
    this.width = width;
    this.height = height;
    return this;
};
// (re)define the GameObject prototype object
GameObject.prototype = {
    x: 0,
    y: 0,
    width: 5,
    width: 5,
    draw: function() {
        myCanvasContext.fillRect(this.x, this.y, this.width, this.height);
    }
};
</script></p>
<p>We can then instantiate the GameObject 100 times.</p>
<p>然后我们创建100个 GameObject对象。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var x = 100,
arrayOfGameObjects = [];
do {
    arrayOfGameObjects.push(new GameObject(10, 10));
} while(x--);
</script></p>
<p>Now we have an array of 100 GameObjects, which all share the same prototype and definition of the draw method, which drastically saves memory within the application.</p>
<p>现在我们有一个含100个 GameObject对象的数组，共享了相同的属性和定义了draw方法，彻底地解决了问题，节省许多内存。</p>
<p>When we call the draw method, it will reference the exact same function.</p>
<p>当我们访问draw方法，它会引用相同的函数。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
var GameLoop = function() {
    for(gameObject in arrayOfGameObjects) {
        gameObject.draw();
    }
};
</script></p>
<h2>Prototype is a Live Object(prototype是一个动态的对象)</h2>
<p>An object’s prototype is a live object, so to speak. This simply means that, if, after we create all our GameObject instances, we decide that, instead of drawing a rectangle, we want to draw a circle, we can update our GameObject.prototype.draw method accordingly.</p>
<p>prototype是一个动态的对象，这就是说，当我们创建了全部的 GameObject实例后，如果我们想要画一个矩形，我们想画一个圆，我们可能更新相应的 GameObject.prototype.draw方法。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
GameObject.prototype.draw = function() {
    myCanvasContext.arc(this.x, this.y, this.width, 0, Math.PI*2, true);
}
</script></p>
<p>And now, all the previous instances of GameObject and any future instances will draw a circle.</p>
<p>现在，所有之前的实例和后面的都可以画圆了。</p>
<h2>Updating Native Objects Prototypes</h2>
<p>Yes, this is possible. You may be familiar with JavaScript libraries, such as Prototype, which take advantage of this method.</p>
<p>是的，这成为了可能。你可能熟悉JavaScript的库，例如Prototype，扩展了许多高级的方法。</p>
<p>Let’s use a simple example:</p>
<p>让我们做个简单的例子：</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, ‘’);
};
</script></p>
<p>We can now access this as a method of any string:</p>
<p>这样我们的任何字符串就可以访问这个方法了。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
“ foo bar    “.trim(); // “foo bar”
</script></p>
<p>There is a minor downside to this, however. For example, you may use this in your application; but a year or two down the road, a browser may implement an updated version of JavaScript that includes a native trim method within the String‘s prototype. This means that your definition of trim will override the native version! Yikes! To overcome this, we can add a simple check before defining the function.</p>
<p>这里有一个小小的不足，例如，当你在你的应用中使用这个方法；但是一年或两年之后，浏览器内部就已经更新了版本，集成了这个方法。这意味着你的方法trim会覆盖了本地的方法！呀！为了实现和谐，我们可以做一个判断。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
if(!String.prototype.trim) {
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, ‘’);
    };
}
</script></p>
<p>Now, if it exists, it will use the native version of the trim method.</p>
<p>现在，如果当这个方法存在，会使用本地的这个trim方法。</p>
<p>As a rule of thumb, it’s generally considered a best practice to avoid extending native objects. But, as with anything, rules can be broken, if needed.</p>
<p>一般来说，最好不要去扩展本地对象的方法，但是如果需要的时候，那就把规则打破。</p>
<h2>Conclusion(总结)</h2>
<p>Hopefully, this article has shed some light on the backbone of JavaScript that is prototype. You should now be on your way to creating more efficient applications.</p>
<p>If you have any questions regarding prototype, let me know in the comments, and I’ll do my best to answer them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/05/10/prototypes-in-javascript.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZeroClipboard</title>
		<link>http://www.coolicer.com/2012/05/06/zeroclipboard.html</link>
		<comments>http://www.coolicer.com/2012/05/06/zeroclipboard.html#comments</comments>
		<pubDate>Sun, 06 May 2012 03:17:35 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[ZeriClipboard]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=652</guid>
		<description><![CDATA[ZeroClipbord是什么的，相信不用介绍都知道了。 上一次使用ZeroClipboard是在配置好之后，我便没有测试它。我当前总结了2个要注意的地方，在大家配置它的时候，可以有个参考的地方。 首先贴一个参考吧： ZeroClipboard.setMoviePath(set a path here) //正确设置ZeroClipboard.swf的路径 var clip = new ZeroClipboard.Client(); //实例化一个对象 clip.setHandCursor( true ); //鼠标手型 clip.setText( "Copy me!" ); //要复制的内容 clip.glue( 'd_clip_button' ); //复制按钮，接受一个id 下面说说注意事项： 复制按钮接受的是一个DOM元素id 注意z-index。 第2点有必要说一下，是什么意思呢？我也是在刚才看了说明才发现的。这与它的实现方式有关，大概的原理是通过生成一个跟复制按钮一样大小的flash来完成复制的。而它是通过absolute来定位，而页面如果是resize后，它的位置又会变化等，当然，它也有一个方法reposition()是用来反馈重新定位的。但是下面官方又推荐了一种实现的方式，可以比较完美地解决问题的。 &#60;div id="d_clip_container" style="position:relative"&#62; &#60;div id="d_clip_button"&#62;Copy to Clipboard&#60;/div&#62; &#60;/div&#62; 相应的Javscript这样写： &#8230; <a href="http://www.coolicer.com/2012/05/06/zeroclipboard.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ZeroClipbord是什么的，相信不用介绍都知道了。</p>
<p>上一次使用ZeroClipboard是在配置好之后，我便没有测试它。我当前总结了2个要注意的地方，在大家配置它的时候，可以有个参考的地方。</p>
<p>首先贴一个参考吧：</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
   ZeroClipboard.setMoviePath(set a path here)  //正确设置ZeroClipboard.swf的路径
   var clip = new ZeroClipboard.Client(); //实例化一个对象
   clip.setHandCursor( true );  //鼠标手型
   clip.setText( "Copy me!" );  //要复制的内容
   clip.glue( 'd_clip_button' ); //复制按钮，接受一个id
</script></p>
<p>下面说说注意事项：</p>
<ol>
<li>复制按钮接受的是一个DOM元素id</li>
<li>注意z-index。</li>
</ol>
<p>第2点有必要说一下，是什么意思呢？我也是在刚才看了说明才发现的。这与它的实现方式有关，大概的原理是通过生成一个跟复制按钮一样大小的flash来完成复制的。而它是通过absolute来定位，而页面如果是resize后，它的位置又会变化等，当然，它也有一个方法reposition()是用来反馈重新定位的。但是下面官方又推荐了一种实现的方式，可以比较完美地解决问题的。</p>
<p><script type="syntaxhighlighter" class="brush:html; smart-tabs: true;">
&lt;div id="d_clip_container" style="position:relative"&gt;
   &lt;div id="d_clip_button"&gt;Copy to Clipboard&lt;/div&gt;
&lt;/div&gt;
</script></p>
<p>相应的Javscript这样写：</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
clip.glue( 'd_clip_button', 'd_clip_container' );
</script></p>
<p>更多的信息请参与官网</p>
<p>http://code.google.com/p/zeroclipboard/wiki/Instructions</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/05/06/zeroclipboard.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP实现99乘法表的两种常见方法</title>
		<link>http://www.coolicer.com/2012/04/30/php%e5%ae%9e%e7%8e%b099%e4%b9%98%e6%b3%95%e8%a1%a8%e7%9a%84%e4%b8%a4%e7%a7%8d%e5%b8%b8%e8%a7%81%e6%96%b9%e6%b3%95.html</link>
		<comments>http://www.coolicer.com/2012/04/30/php%e5%ae%9e%e7%8e%b099%e4%b9%98%e6%b3%95%e8%a1%a8%e7%9a%84%e4%b8%a4%e7%a7%8d%e5%b8%b8%e8%a7%81%e6%96%b9%e6%b3%95.html#comments</comments>
		<pubDate>Mon, 30 Apr 2012 14:15:30 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-99]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=648</guid>
		<description><![CDATA[第一种： for($i=1;$i]]></description>
			<content:encoded><![CDATA[<p>第一种：<br />
<script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
for($i=1;$i<=9;$i++){
    for($j=1;$j<=$i;$j++){
         echo "$j*$i = ".$j*$i. " ";
    }
   echo "<br/>";
}
</script><br />
第二种：<br />
<script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
for($i=1;$i!=10;$i++){
  for($j=1;$j!=10;$j++){
     echo "$j*$i = ".$i*$j." ";
     if($i == $j) break;
  }
  echo "<br/>";
}
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/04/30/php%e5%ae%9e%e7%8e%b099%e4%b9%98%e6%b3%95%e8%a1%a8%e7%9a%84%e4%b8%a4%e7%a7%8d%e5%b8%b8%e8%a7%81%e6%96%b9%e6%b3%95.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>j小调-javascript的返回值</title>
		<link>http://www.coolicer.com/2012/04/30/j%e5%b0%8f%e8%b0%83-javascript%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc.html</link>
		<comments>http://www.coolicer.com/2012/04/30/j%e5%b0%8f%e8%b0%83-javascript%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc.html#comments</comments>
		<pubDate>Mon, 30 Apr 2012 02:51:18 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[apply]]></category>
		<category><![CDATA[call]]></category>
		<category><![CDATA[javascript-this]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=634</guid>
		<description><![CDATA[JavaScript的网上教程可以说是少得可怜，有的话也是一些博主自己写的，但是不全面。我希望可以每天都研究一个小问题，就是当初学Photoshop一样，当然现在是忘记了许多，不过也觉得非常地熟悉。编程也一样，笨的人要多点思考。 今天在cnblogs上看到一篇博文，关于JavaScript构造函数返回值的。 function Example(){ this.child = 0; return function(){ alert(1); } } var instant = new Example(); alert(install.child) //undefined 一般在Javascript中，返回是关键字return，即遇到return则返回。在上面的程序中，实例化后，this值将会丢失。如果要返回这个this.child，是不是加个回调的函数使用它返回就可以了呢？答应是肯定的，但是觉得还是没有解决为什么会丢失的问题。通常，我们可以用下面这种形式返回this的值。 function abc() { this.age = 10; _this = this; return { a :　function(){ alert(_this.age); //弹出 10 } } } 下面，我们就知道了。与其说是丢失，还不如说this指向了window。 &#8230; <a href="http://www.coolicer.com/2012/04/30/j%e5%b0%8f%e8%b0%83-javascript%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>JavaScript的网上教程可以说是少得可怜，有的话也是一些博主自己写的，但是不全面。我希望可以每天都研究一个小问题，就是当初学Photoshop一样，当然现在是忘记了许多，不过也觉得非常地熟悉。编程也一样，笨的人要多点思考。</p>
<p>今天在cnblogs上看到一篇博文，关于JavaScript构造函数返回值的。<br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
   function Example(){
      this.child = 0; 
      return function(){
         alert(1);
     }
  }
  var instant = new Example();
  alert(install.child)  //undefined
</script></p>
<p>一般在Javascript中，返回是关键字return，即遇到return则返回。在上面的程序中，实例化后，this值将会丢失。如果要返回这个this.child，是不是加个回调的函数使用它返回就可以了呢？答应是肯定的，但是觉得还是没有解决为什么会丢失的问题。通常，我们可以用下面这种形式返回this的值。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
   function abc() {
      this.age = 10;
      _this = this;
      return {
          a :　function(){
               alert(_this.age);  //弹出 10
         }
      }
   }
</script></p>
<p>下面，我们就知道了。与其说是丢失，还不如说this指向了window。<br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
    var age = 100;
    function abc(){
      this.age = 10;
      return function(){
          alert(this.age);
      }
    }
  var instant = new abc;
  instant();   //100
</script><br />
所以，这些都是this的指向问题，在JavaScript中，匿名函数的this会指向window对象，因为window的掌管着所有的对象，不知道描述正确否。总之当你发现变量是undefined，你可以试着看是不是this已经不再是指向当前的对象了。</p>
<p>这时，不得不让人想到，JavaScript中还有2个函数可以改变this的指向的，分别是call()和apple()。</p>
<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
//return function中作以下修改即可
abc.call(this,'age');
alert(age);
</script></p>
<p>不知不觉文章也变长了，本来只是小小的讨论。无所谓，反正是知识的整合。我的目标是，一名合格的前端。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/04/30/j%e5%b0%8f%e8%b0%83-javascript%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5.4之基础</title>
		<link>http://www.coolicer.com/2012/04/30/php5-4-basic.html</link>
		<comments>http://www.coolicer.com/2012/04/30/php5-4-basic.html#comments</comments>
		<pubDate>Mon, 30 Apr 2012 02:42:42 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=636</guid>
		<description><![CDATA[php5.4可以说是出了一段时间，由于没有经常使用PHP，所以也不太了解到底有新出了什么新特性。php也作为一种脚本语言存在，但是已经很成熟了，php的开发社区可以说是排三甲的。 在学习Php.5.4的新特性时，我发现了与javascript有许多相似的地方。比如： 1、转换类型 $a = 'abc1234'; int(a) //这与javascript中的parseInt效果相似。 2、注释 PHP中有三种常见的注释，但是2种最常用的跟javascript是一样的。 //单行注释 /* 多行注释 */ php5.4中，语法变化多，语法更加的严谨。在后面的学习中，所有文章都可能会随时更新。文章也是有生命的，并不是一写就写死在这里了。]]></description>
			<content:encoded><![CDATA[<p>php5.4可以说是出了一段时间，由于没有经常使用PHP，所以也不太了解到底有新出了什么新特性。php也作为一种脚本语言存在，但是已经很成熟了，php的开发社区可以说是排三甲的。</p>
<p>在学习Php.5.4的新特性时，我发现了与javascript有许多相似的地方。比如：</p>
<p>1、转换类型<br />
<script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
   $a = 'abc1234';
   int(a)  //这与javascript中的parseInt效果相似。
</script></p>
<p>2、注释</p>
<p>PHP中有三种常见的注释，但是2种最常用的跟javascript是一样的。</p>
<p><script type="syntaxhighlighter" class="brush:php; smart-tabs: true;">
//单行注释
/*
   多行注释
*/
</script></p>
<p>php5.4中，语法变化多，语法更加的严谨。在后面的学习中，所有文章都可能会随时更新。文章也是有生命的，并不是一写就写死在这里了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/04/30/php5-4-basic.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>for循环的一些问题</title>
		<link>http://www.coolicer.com/2012/04/17/something-about-the-for-loop-in-javascript.html</link>
		<comments>http://www.coolicer.com/2012/04/17/something-about-the-for-loop-in-javascript.html#comments</comments>
		<pubDate>Tue, 17 Apr 2012 09:58:35 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[for-loop]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=627</guid>
		<description><![CDATA[//Syntax for (初始化;条件判断;每次循环段执行结束后执行) for循环大家都会用，可是里面多少涉及一些优化的问题。在信息时代，各种优化很快被我们知道，我就不不说了。国内写这方面的博文也不少，贴上一个网址吧。http://bbs.blueidea.com/thread-3023913-1-1.html 而我的问题是什么呢? 今天在写for的时候，写成了这样： for(var i = 0;len = x.length,i < len;i++){ //...... } 这样的错误的写法，让程序运行起来又卡又怪，于是我找了一个原来的文章，那个写法有误，我又改成了下面这个正确的。 for(var i = 0,len = x.length;i]]></description>
			<content:encoded><![CDATA[<p><script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
//Syntax
for (初始化;条件判断;每次循环段执行结束后执行)
</script></p>
<p>for循环大家都会用，可是里面多少涉及一些优化的问题。在信息时代，各种优化很快被我们知道，我就不不说了。国内写这方面的博文也不少，贴上一个网址吧。<br/>http://bbs.blueidea.com/thread-3023913-1-1.html</p>
<p>而我的问题是什么呢?</p>
<p>今天在写for的时候，写成了这样：<br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
for(var i = 0;len = x.length,i < len;i++){
//......
}
</script><br />
这样的错误的写法，让程序运行起来又卡又怪，于是我找了一个原来的文章，那个写法有误，我又改成了下面这个正确的。<br />
<script type="syntaxhighlighter" class="brush:jscript; smart-tabs: true;">
for(var i = 0,len = x.length;i<len;i++){
//.....
}
</script><br />
这个问题应该是我对它的语法还不够了解深刻，就像我之前不记得Math.ceil()和Math.floor()一样，用得少就不熟悉，不熟就容易搞混，后来我根据英文单词把它们记得了，ceil为有天花板的意思，而floor是地板。一个意为向上取整，一个意为向下取整。经过这次的遭遇，我已经对这个for有深刻的了解了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/04/17/something-about-the-for-loop-in-javascript.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>开发人员的编辑器</title>
		<link>http://www.coolicer.com/2012/04/15/%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e7%9a%84%e7%bc%96%e8%be%91%e5%99%a8.html</link>
		<comments>http://www.coolicer.com/2012/04/15/%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e7%9a%84%e7%bc%96%e8%be%91%e5%99%a8.html#comments</comments>
		<pubDate>Sun, 15 Apr 2012 15:02:23 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[MyPost]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[编辑器]]></category>

		<guid isPermaLink="false">http://www.coolicer.com/?p=624</guid>
		<description><![CDATA[谈到开发人员手中的编辑器，可以说是各有千秋，大家也都有自己喜爱的一个，不会说哪个很好用，就非得用；哪个不适合谁用，就要被淘汰。我们常见的编辑器有很多，我就不说了。但是有一个不好的地方就是，大家很喜欢拿编辑器跟IDE比。我觉得是没什么可比性的。毕竟瑞士军刀跟手枪是没法比，各有用处。 从一开始的Editplus到今天用了vim，可以说经历差不多10款了(甚至现在都可以用浏览器来做编辑器)。到现在为止记忆比较深的就是vim，sublimeText 2这2个，当然如果你在Mac下还有TextMate和Coda，这两个我都用过，那时候的我用起来也觉得不怎么好用。现在开发还在用Notepad++，因为vim还没有太熟练。这几天也就在学学命令跟找几个好用插件。 其实，编辑器强大的地方在于用的人。也就是说任何一款编辑器在适合的人手中，都可以发挥它的作用。像我们一开始用的Editplus，虽然我们没有在用了，但是还有许多人在使用它们。而想要使用号称神级编辑器的菜鸟，如果使用不好，反而会被别人笑话。找一个好的编辑器，适合自己的，Just use it。]]></description>
			<content:encoded><![CDATA[<p>谈到开发人员手中的编辑器，可以说是各有千秋，大家也都有自己喜爱的一个，不会说哪个很好用，就非得用；哪个不适合谁用，就要被淘汰。我们常见的编辑器有很多，我就不说了。但是有一个不好的地方就是，大家很喜欢拿编辑器跟IDE比。我觉得是没什么可比性的。毕竟瑞士军刀跟手枪是没法比，各有用处。</p>
<p>从一开始的Editplus到今天用了vim，可以说经历差不多10款了(甚至现在都可以用浏览器来做编辑器)。到现在为止记忆比较深的就是vim，sublimeText 2这2个，当然如果你在Mac下还有TextMate和Coda，这两个我都用过，那时候的我用起来也觉得不怎么好用。现在开发还在用Notepad++，因为vim还没有太熟练。这几天也就在学学命令跟找几个好用插件。</p>
<p>其实，编辑器强大的地方在于用的人。也就是说任何一款编辑器在适合的人手中，都可以发挥它的作用。像我们一开始用的Editplus，虽然我们没有在用了，但是还有许多人在使用它们。而想要使用号称神级编辑器的菜鸟，如果使用不好，反而会被别人笑话。找一个好的编辑器，适合自己的，Just use it。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coolicer.com/2012/04/15/%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e7%9a%84%e7%bc%96%e8%be%91%e5%99%a8.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

