ITeye博客

低调求生存

wenbois2000 · 共 21 篇文章

[置顶] JavaScript 数据访问(翻译自High Performance Javascript 第二章)

计算机科学中一个经典的问题是决定如何存储数据,以便进行快速的读取和写入操作。 在代码执行期间,数据如何存储将会关系到它们的检索速度。在Javascript中,由于只存在少数的操作来进行数据存储, 这个问题似乎 变得简单了。但是,与其他语言一样,Javascript中数据的存储方式将决定它们访问速度。下面是Javascript中可以进行数据存储的四种基本方式: 字面量值(Literal values) 任何仅仅描述自身,且没有被存储在一个特定位置上的值。Javascript可以将字符串,数字,布尔值,对象,数组,函数,正则表达式 以及特殊值null和undefined 作为字面量。 变量 任何…

2011-02-27 13:21 · Web · 评论(12)

[置顶] Java事务设计策略

最近阅读了InfoQ上的电子书< >之后受益匪浅, 单独花了两周时间将其翻译了一下. 由于英语只是四级水准, 所以翻译内容中的不足之处也请见谅. 附件里第一份是翻译后的文档, 第二份是英文原文. 原文地址:http://www.infoq.com/minibooks/JTDS 下面列出文中映象深刻的几点: 事务模型的分类: 本地事务模式, 管理连接 编程式事务模式, 编程管理JTA事务 声明式事务模式, 以方法为单位,让容器使用配置信息来进行事务管理 最佳实践: 当为方法分配事务属性的时候,把类中对大部分方法最具限制性的属性作为类级别的默认属性, 然后再对有特殊需要的方法进行微调. 事务管理…

2010-11-29 23:01 · 事务管理 · 评论(10)

Foobar 是什么意思?

foobar 不同的字典对其解释相去甚远,一说来自中国“福”字的发音,又有解释为二战时期的一种武器。然而若把众多的解释放在编程领域,关于 foobar的说法是我认为最为贴切的解释。foobar又为foo-bar,其中bar是beyond all recognition的缩写,通俗点就是无法识别,一塌糊涂的意思。而foo是fu的变体,fu是英语习语fuck-up的缩写,同样是一团糟的意思。于是,若你有些编程经验,我想你应该已经明白了为何如今许多编程实例所涉及的事物均被冠名为foo. 1. 介绍 至今约有212 个RFC, 或者约7%的RFC, 从[RFC269]开始,包括了术语'foo','b…

2011-03-26 10:44 · 其它 · 评论(0)

High Performance JavaScript 读书笔记(五)

五.Strings and Regular Expressions Practically all JavaScript programs are intimately tied to strings. For example, many applications use Ajax to fetch strings from a server, convert those strings into more easily usable JavaScript objects, and then generate strings of HTML from the data. A typical …

2011-02-27 21:24 · Web · 评论(0)

High Performance JavaScript 读书笔记(六)

六.Responsive Interfaces There’s nothing more frustrating than clicking something on a web page and having nothing happen. This problem goes back to the origin of transactional web applications and resulted in the now-ubiquitous “please click only once” message that accompanies most form submissions…

2011-02-27 20:49 · Web · 评论(0)

High Performance JavaScript 读书笔记(四)

四.Algorithms and Flow Control The overall structure of your code is one of the main determinants as to how fast it will execute. Having a very small amount of code doesn’t necessarily mean that it will run quickly, and having a large amount of code doesn’t necessarily mean that it will run slowly. …

2011-02-27 19:50 · Web · 评论(0)

High Performance JavaScript 读书笔记(三)

三.DOM Scripting DOM scripting is expensive, and it’s a common performance bottleneck in rich web applications. This chapter discusses the areas of DOM scripting that can have a negative effect on an application’s responsiveness and gives recommendations on how to improve response time. The three ca…

2011-02-27 14:43 · Web · 评论(0)

High Performance JavaScript 读书笔记(一)

一.Loading and Execution JavaScript performance in the browser is arguably the most important usability issue facing developers. The problem is complex because of the blocking nature of JavaScript, which is to say that nothing else can happen while JavaScript code is being executed. In fact, most br…

2011-02-27 13:44 · Web · 评论(0)

JavaScript Patterns 读书笔记(七)

7.Client Pattern DOM Access DOM access is expensive; it’s the most common bottleneck when it comes to JavaScript performance. This is because the DOM is usually implemented separately from the JavaScript engine. From a browser’s perspective, it makes sense to take this approach, because a JavaScrip…

2011-02-15 20:32 · Web · 评论(0)

JavaScript Patterns 读书笔记(六)

6.Design Pattern Singleton The idea of the singleton pattern is to have only one instance of a specific class. This means that the second time you use the same class to create a new object, you should get the same object that was created the first time. And how does this apply to JavaScript? In Jav…

2011-02-15 19:38 · Web · 评论(0)

JavaScript Patterns 读书笔记(五)

5.Inheritance Pattern Classical Pattern #1—The Default Pattern The default method most commonly used is to create an object using the Parent() constructor and assign this object to the Child()’s prototype. Here’s the first implementation of the reusable inherit() function: function inherit(C, P) { …

2011-02-15 19:08 · Web · 评论(0)

JavaScript Patterns 读书笔记(四)

4.Function Pattern Namespace Pattern Namespaces help reduce the number of globals required by our programs and at the same time also help avoid naming collisions or excessive name prefixing. JavaScript doesn’t have namespaces built into the language syntax, but this is a feature that is quite easy …

2011-02-15 18:19 · Web · 评论(0)

JavaScript Patterns 读书笔记(二)

二.Object Object Constructor Catch You have no reason to use the new Object() constructor when you can use an object literal, but you might be inheriting legacy code written by others, so you should be aware of one “feature” of this constructor (or yet another reason not to use it). The feature in q…

2011-02-14 21:20 · Web · 评论(0)

JavaScript Patterns 读书笔记(三)

三.Function Background There are two main features of the functions in JavaScript that make them special—the first is that functions are first-class objects and the second is that they provide scope.Functions are objects that: Can be created dynamically at runtime, during the execution of the progra…

2011-02-14 21:19 · Web · 评论(0)

JavaScript Patterns 读书笔记(一)

一.Global 全局域中的this = window. myglobal = "hello"; // antipattern console.log(myglobal); // "hello" console.log(window.myglobal); // "hello" console.log(window["myglobal"]); // "hello" console.log(this.myglobal); // "hello", 全局域中的this = window. Another antipattern that creates implied globals is to c…

2011-02-14 20:09 · Web · 评论(0)