Archive for 十一月, 2010

如何安装和配置Cassandra

Cassandra属于最近比较流行的一款NoSQL数据库,http://nosql-database.org/中给NoSQL的定义如下:

下一代的数据库产品应该具备这几点:非关系型的,分布式的,开源的,可以线性扩展的。这类数据库最初的目的在于提供现代网站可扩展的数据库解决方案。这个运动开始于2009年初,目前正在迅速的发展。这种类型的数据库具有:自由的schema,数据多处备份,简单的编程API,数据的最终一致性保证等等。所以我们将这种类型的数据库称为NoSQL(不仅仅是SQL,全称为“not only sql”)。

下面我们一起来看看如果分别在Windows和Linux环境下安装和部署Cassandra。 (continue reading…)


subversion SVN服务器的使用

在机子上装上subversion后建立一个文件夹如:svn\project。project为存储的仓库名。

进入doc命令下用svnadmin create –fs-type bdb d:\svn\project创建svn的仓库。 (continue reading…)

1 Comment more...

Location href search hash …

location对象
含有当前URL的信息.
属性
href 整个URL字符串.
protocol 含有URL第一部分的字符串,如http:
host 包含有URL中主机名:端口号部分的字符串.如//www.cenpok.net/server/
hostname 包含URL中主机名的字符串.如http://www.cenpok.net ;
port 包含URL中可能存在的端口号字符串.
pathname URL中”/”以后的部分.如~list/index.htm
hash “#”号(CGI参数)之后的字符串.
search “?”号(CGI参数)之后的字符串.

location对象 含有当前URL的信息. 属性 href 整个URL字符串.  protocol 含有URL第一部分的字符串,如http:  host 包含有URL中主机名:端口号部分的字符串.如//www.cenpok.net/server/  hostname 包含URL中主机名的字符串.如http://www.cenpok.net ; port 包含URL中可能存在的端口号字符串.  pathname URL中”/”以后的部分.如~list/index.htm  hash “#”号(CGI参数)之后的字符串.  search “?”号(CGI参数)之后的字符串.


判断网页是否在IFRAME或FRAME中

判断网页是否在frame中:
if(top!=this){
// 在frame中时处理
}
判断网页是否在iframe中:
if(self.frameElement.tagName==”IFRAME”){
// 页面在iframe中时处理
}

Cookie跨域操作

正常的cookie只能在一个应用中共享,即一个cookie只能由创建它的应用获得。 (continue reading…)

1 Comment more...

深入理解session与cookie

1. 当第一次请求一个网站,网站返回有session时只返回session的ID。当再请求这个网站的任何页面,都会把session的ID发送到服务器,页面返回不再有session ID 。 (continue reading…)


密码保护:高性能系统的挑战在那里?

这是一篇受密码保护的文章,您需要提供访问密码:

要查看留言请输入您的密码。 more...

无限多级分类删除父id后子parent_id自动更新

删除一个分类以后,它的子分类的 parent_id 号就需要改变一下,而不能继续指向这个不存在的分类,因此我希望删除这个分类以后,它的子分类的父分类变为它的父分类。

lock tables `categories` write, `categories` as `c1` write,   `categories` as `c2` write;

update `categories` as `c1`, `categories` as `c2` set `c1`.`parent_id` = `c2`.`parent_id` where `c1`.`parent_id` = `c2`.`cat_id` and `c2`.`cat_id` = $cat_id;

delete from `categories` where `cat_id` = $cat_id;

unlock tables;

这里需要注意的一点是,锁定表的时候,一定要把要操作的表和Mysql表别名都锁定,否则下面的语句会出错.

demo

c1 (new)
uid     parent_id
1         0
2        1
3        2
4        3
res
1        0
3        1
4        3
c2 (old)
uid    parent_id
1        0
2        1
3        2
4        3
where条件查询结果c1为 3   2,c2为2  1,set之后结果就是res里的3  1.

TCA – color picker

The colorpicker wizard allows you to select a HTML color value from a user-friendly pop-up box. The wizard type is “colorbox” which will first of all add a colored box next to an input field. Here’s how it looks in a “haiku” record of the “examples” extension:

onefunction (color) (continue reading…)


JavaScript数组去掉重复

引用Ext中实现方法:

Java代码
  1. unique: function( array ) { (continue reading…)

Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress