人要有专注的东西,人一辈子走下去挑战会更多,你天天换,我就怕了你。 - 马云
 

淘宝,我喜欢

4月3日入职,在淘宝工作一周多,很忙,忙得到现在才有点时间写blog.

杭州的空气很滋润,比北京好多了。还没怎么逛西湖,但看着西湖边上的那片山,心里就欢喜。

淘宝是个武侠世界,一个很不错很上进激烈的国度。在淘宝工作一周,给我印象最深的是淘宝的繁忙。UED部的工作像是永远忙不完,刚去第一天小马师兄就告诉我:淘宝的开发在保证质量的基础上,一定要快,要速度!刚去还真不太适应,每天疯狂工作,搞得星期五玲珑师姐看见我时,还说我怎么这么疲惫。以前自己做东西喜欢追求完美,在淘宝里,一定要不断权衡质量和速度之间的比例,权衡是门艺术,切记。

还有一点令我印象非常深刻的是淘宝的活跃。说起来淘宝的办公环境还真有点吵,以前习惯了安静,初来乍到,这么多人在一个大厅里闹哄哄地工作还真不习惯。但过了一两天后发现也还好,坐在一起,很有利于互相交流讨论。4月10日淘宝B2C正式上线,马云来了。第一次亲眼见马云,马云的口才还真不是盖的。马云讲到淘宝要将游戏里吸引人的因素找出来融入到网上商城上去;马云讲到如何将女人逛街的乐趣转移到网上;马云讲到接下来的中国经济困难,讲到淘宝B2C的使命;马云希望淘宝B2C上能造就一批李宇春和周笔畅;马云也谈到了最近淘宝上的评价门事件…… 台下的师兄师姐们是拿着垃圾桶(干净的)鼓掌的,很热很闹,笑声不断……

淘宝,我喜欢68.gif

补充:在淘宝,崇尚花名文化。在mm的帮助下,挑定玉伯作为我的花名。孙玉伯,出自古龙小说《流星·蝴蝶·剑》。玉伯名言:我相信人品和技术,前者能带来朋友,后者能改变世界,一个男人有了这两样,大约够了吧。初入江湖,还望各路大侠多多关照。

Tags: ,

 

正则匹配不含某特定词的行

需求:

有一文本含有若干行,某些行含有“希特勒”。现在想将含有“希特勒”的行都删除掉,请问用正则如何实现?

分析:

翻译成正则语言就是:如何匹配不含某特定词的行。

解决方案:

这是一个正则反向匹配问题,在这篇文章(正则表达式中的反向匹配)中曾解释过lookaroud的用法。在这里,也得利用lookaround的威力来实现:

^(?!.*希特勒).*$

含义是:匹配行首^后面没有.*希特勒字符的所有行。

在EmEditor中验证如下:

regex_1.png

上面利用lookahead来实现。逆反一下思路,利用lookbehind也可以实现:

^.*(?<!希特勒.*)$

含义是:匹配行尾$前面没有.*希特勒字符的所有行。

在RegexBuddy中验证通过:

regex_2.png

注意:lookbehind的方法在EmEditor中无法通过,EmEditor对lookbehind的支持并不是太好。

Tags:

 

Web前端开发工具介绍PPT

给公司员工做的一个简单培训,走马观花似的介绍了在Web前端开发中所用到的一些工具,内容如下:

web_development_tools.gif

web_development_tools.zip (2.5 M, 438 次下载)

Tags:

 

JavaScript里的Global Object

阅读完《ppk on JavaScript》,很容易认为Global object就是window对象,在Chapter 6 Section A部分对window对象有如下描述:

At the center of the BOM stands the window object. It serves four purposes:

1. It is the global object that JavaScript Core needs to function.
2. It represents the browser window that users see on their computer screen.
3. It grants access to the HTML document loaded in the window.

It contains miscellaneous information and functionality.

As JavaScript’s global object, the window object contains all the variables and functions defined in your scripts. (We discussed the global object in 5J.)

然而在《Professional JavaScript for Web Developers》原书81页和83页中,谈到Global object时 ( 感兴趣?继续阅读 » )

Tags:

 

浅析《Pro JavaScript Techniques》Listing2-25 中的错误

《Pro JavaScript Techiniques》原书37页中:

Listing 2-25. Example of Dynamically Generated Methods That Are Created When a New Object Is Instantiated

// Create a new user object that accepts an object of properties
function User( properties ) {
	// Iterate through the properties of the object, and make sure
	// that it's properly scoped (as discussed previously)
	for ( var i in properties ) { (function(){
		// Create a new getter for the property
		this[ "get" + i ] = function() {
			return properties[i];
		};
		// Create a new setter for the property
		this[ "set" + i ] = function(val) {
			properties[i] = val;
		};
	})(); }
}
// Create a new user object instance and pass in an object of
// properties to seed it with
var user = new User({
	name: "Bob",
	age: 44
});
// Just note that the name property does not exist, as it's private
// within the properties object
alert( user.name == null );
// However, we're able to access its value using the new getname()
// method, that was dynamically generated
alert( user.getname() == "Bob" );
// Finally, we can see that it's possible to set and get the age using
// the newly generated functions
user.setage( 22 );
alert( user.getage() == 22 );

sml_projs_book_cover.jpg

这个例子不能正常工作。会提示user.getname和user.setage没有定义。

纳闷琢磨了许久,在Arrix的blog中找到了答案:Possible mistakes in Pro JavaScript Techniques. Arrix发现,匿名函数中的this指向的是window对象。

为了验证Arrix的观点,我们来看下面的例子:

vvar testObj = {
	func: function() {
		(function() {
			alert(this === window);
		})();
		alert(this === testObj);
	}
};

testObj.func();

第一个alert中this指向了window对象 ( 感兴趣?继续阅读 » )

Tags:

 
Pages (6):[1]2345»...Last »