IIssNan's Notes

Quick notes


  • 首页

  • 归档

  • 标签

  • 搜索

Install Node.js from source on CentOS

发表于 2014-07-14 | | 阅读次数

Before we start, it would be a good idea to update software repository to
the latest version:

1
yum -y update

Steps:

Install Development Tools. Development Tools is a group of tools
for compiling software from sources.

1
yum -y groupinstall "Development Tools"

Download Node.js source code. Navigate to /usr/src directory, download the
source file.You can find the latest Node.js source code in Node.js Official Download Page.

1
2
3
4
5
6
cd /usr/src
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz
# uncompress the tarball
tar zxf node-v0.10.29.tar.gz
cd node-v0.10.29

Now we are ready to install.

1
2
3
./configure
make
make install

After the install process done, run node -v to check if it was installed correctly.

Note: to enable to run an executable in /usr/local/bin through sudo, you
have to add /usr/local/bin to your secure_path using visudo:

1
sudo visudo

Find the secure_path and add :/usr/local/bin to the end of the path string.
Don’t forget the prefix colon.

Reference:

  • How To Install And Run A Node.js App On Centos 6.4 64bit

Check CentOS system version

发表于 2014-07-14 | | 阅读次数

Login to your CentOS server using SSH and run:

1
2
3
4
cat /etc/centos-release
# OR
cat /etc/redhat-release

Transfer files using scp

发表于 2014-07-13 | | 阅读次数

command: scp <from> <to>

Fetch files from Remote Server:

1
2
3
4
5
# Fetch a file
scp user@remote-server:/home/username/file.zip ~/downloads/file.zip
# Fetch a directory
scp -r user@remote-server:/home/user/dir ~/downloads/dir

Upload files to Remote Server:

1
2
scp ~/downloads/file.zip user@remote-server:/home/username/file.zip
scp -r ~/downloads/dir user@remote-server:/home/username/dir

For Windows, Use WinSCP

JavaScript Array methods and Array-like Objects

发表于 2014-06-10 | | 阅读次数

The JavaScript array methods are purposely defined to be generic, so that they work correctly when applied to array-like objects in addition to true arrays. In ECMAScript 5, all array methods are generic. In ECMAScript 3, all methods except toString() and toLocaleString() are generic. (The concat() method is an exception: although it can be invoked on an array-like object, it does not property expand that object into the returned array.) Since array-like objects do not inherit from Array.prototype, you cannot invoke array methods on them directly. You can invoke them indirectly using the Function.call method, however:

// An array-like object
var a = {"0":"a", "1":"b", "2":"c", length:3}; 
Array.prototype.join.call(a, "+");  // => "a+b+c"
Array.prototype.slice.call(a, 0);   // => ["a","b","c"]: true array copy
Array.prototype.map.call(a, function(x) { 
    return x.toUpperCase(); // => ["A","B","C"]
})                                 

JavaScript: The Definitive Guide

JavaScript版本简要概述

发表于 2014-05-29 | | 阅读次数

谈及JavaScript版本时,可能与早几年浏览器大战时对于JavaScript的实现一样让人困惑。比如,可能会看到JavaScript 1.5, JavaScript 2.0, ECMAScript 3, JScript 5诸如此类的。

了解JavaScript版本的信息,看似毫无必要。但知己知彼百战不殆,了解JavaScript代码运行的环境所支持的版本,可以编写出更为高效的代码。《Effective JavaScript》第一条,Know which JavaScript you are using。

版本信息

在经过一番资料的检索后,我发现Wiki上ECMAScript词条下有一个JavaScript版本的对应图表很直观的说明各个版本称呼之间的关系(图表有缩减):

JavaScript JScript ECMAScript
1.0 (Netscape 2.0) 1.0 IE 3.0
1.3 (Netscape 4.06-4.7x) 3.0 (IE 4.0) Edition 1, Edition 2
1.5 (Netscape 6.0) 5.5 (IE 5.5) Edition 3
1.6 - 1.8 Edition 3 + extras
JavaScript 2.0 Harmony

JavaScript最初由Netscape推出,在其Netscape Navigator上使用,并一直使用”JavaScript X.X”的版本,后Mozilla沿用这种版本信息。
JScript是Microsoft在Netscape推出JavaScript不久后,在自家产品Internet Explorer上推出的脚本语言。为了避免商标授权问题,将其称为JScript。
之后,为了保证统一性,便产生了ECMAScript。ECMAScript目前有1、2、3、5、6,五个版本。ECMAScript 6预计在2014年年底发布。

值得一提的是,ECMAScript 4并未发布,被打回重审,最后被ECMAScript 6取代。关于这点可以在Wiki ECMAScript词条下的ECMAScript 4和ECMAScript 6中看出端倪。

阅读全文 »
1…161718…37
IIssNan

IIssNan

胡编一通,乱写一气

183 日志
6 分类
111 标签
RSS
GitHub Twitter 豆瓣 知乎
© 2011 - 2017 IIssNan
由 Hexo 强力驱动
主题 - NexT.Pisces
0%