XSS Cheet Sheet
XSS (Cross Site Scripting) Cheat Sheet 给出很多示例代码用于 XSS 攻击测试,而且标识出所支持的浏览器(版本)。用这里边的代码做了一些测试,效果相当好 ![]()
XSS (Cross Site Scripting) Cheat Sheet 给出很多示例代码用于 XSS 攻击测试,而且标识出所支持的浏览器(版本)。用这里边的代码做了一些测试,效果相当好 ![]()
来自 IBM 的“在 PHP 中养成 7 个面向对象的好习惯”。
如果您尚未打算用 OO 原则创建应用程序,则使用 PHP 的面向对象(OO)的语言特性,这 7 个习惯将帮助您开始在过程编程与 OO 编程之间进行转换。
在 PHP 编程早期,PHP 代码在本质上是限于面向过程的。过程代码 的特征在于使用过程构建应用程序块。过程通过允许过程之间的调用提供某种程度的重用。
但是,没有面向对象的语言构造,程序员仍然可以把 OO 特性引入到 PHP 代码中。这样做有点困难并且会使代码难于阅读,因为它是混合范例(含有伪 OO 设计的过程语言)。使用 PHP 代码中的 OO 构造 — 例如能够定义和使用类、能够构建使用继承的类之间的关系以及能够定义接口 — 可以更轻松地构建符合优秀 OO 实践的代码。
虽然没有过多模块化的纯过程设计运行得很好,但是 OO 设计的优点表现在维护上。由于典型应用程序的大部分生命周期都花费在维护上,因此代码维护是应用程序生命周期的重要部分。并且在开发过程中代码维护很容易被遗忘。如果在应用程序开发和部署方面存在竞争,那么长期可维护性可能被放在比较次要的地位。
模块化 — 优秀 OO 设计的主要特性之一 — 可以帮助完成这样的维护。模块化将帮助封装更改,这样可以随着时间的推移更轻松地扩展和修改应用程序。
总的来说,虽然构建 OO 软件的习惯不止 7 个,但是遵循这里的 7 个习惯可以使代码符合基本 OO 设计标准。它们将为您提供更牢固的基础,在此基础之上建立更多 OO 习惯并构建可轻松维护与扩展的软件。这些习惯针对模块化的几个主要特性。有关独立于语言的 OO 设计优点的更多信息,请参阅 参考资料。
7 个优秀 PHP OO 习惯包括:
1. 保持谦虚。
2. 做个好邻居。
3. 避免看到美杜莎。
4. 利用最弱的链接。
5. 您是橡皮;我是胶水。
6. 限制传播。
7. 考虑使用模式。
Minify 是使用 PHP5 开发的用于合并压缩 js/css 文件的应用程序。合并压缩之后的结果可通过 HTTP gzip/deflate 及一些相关头,优化客户端缓存。可参考 Yahoo 的 Rules for High Performance Web Sites。
Minify 的安装使用很简单,下载最新版本,解压,将 min 目录复制到发布目录下,然后访问 http://example.com/min/,在显示的界面中加入你想合并压缩的 js/css 路径,点击 'Update' 之后会为你生成一个 url,如:
http://localhost/min/b=googletesting/js&f=mootools.js,iAction.js,iAjax.js,global.js
接下来你就可以将这个 url 放到你的页面中了。这样可以使请求数减少,传输的字节数也小了很多。而且 Minify 支持服务器端 cache,即将合并压缩的结果 cache 到服务器端文件中,下次访问就不需要再重新做合并压缩的操作了。如果需要组合的文件很多,url 就会变得很长,Minify 支持 group,可以将这些文件分组,这样 url 中只需指定 g=group名字 就可以了。
总之,Minify 很实用 ![]()
Lazy Linux: 11 secrets for lazy cluster admins
Cluster means different things to different people. In the context of this article, cluster is best defined as scale-out — scale-out clusters generally have a lot of the same type of components like Web farms, render farms, and high performance computing (HPC) systems. Administrators will tell you that with scale-out clusters any change, no matter how small, must be repeated up to hundreds of thousands of times; the laziest of admins have mastered techniques of scale-out management so that regardless of the number of nodes, the effort is the same. In this article, the authors peer into the minds of the laziest Linux® admins on Earth and divulge their secrets.
….
The secrets are
1. Don't reinvent the wheel.
2. Use open source.
3. Automate everything.
4. Design for scale - plan to be lazy from the start.
5. Design for hardware manageability.
6. Use good cluster management software - don't dig wells with teaspoons.
7. Use open source monitoring solutions.
8. Control your users with a queuing system.
9. Verify you get what you pay for - benchmark it!
10. Manage cluster communication.
11. Look for ways to become lazier.