DES加密小结

Posted on 八月 9th, 2010 by lichangyu and tagged .
lichangyu 的头像

import java.io.ByteArrayOutputStream;
import java.security.Key;
import java.security.MessageDigest;

import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

/**

Articles tagged with: for column ’storage_pid’ at row 1′错误

Posted on 八月 6th, 2010 by lichangyu and tagged .
lichangyu 的头像

Articles tagged with: for column ’storage_pid’ at row 1′
Typo3 Issuses »
Typo3: SQL error: ‘Incorrect integer value: ” for column ’storage_pid’ at row 1′
[5 Dec 2009 | No Comment | 8,782 Views]
为了方便调试Typo3程序,所以选择了在本地安装和使用Typo3网站程序,所有安装都完成了,当我开始创建第一个页面时,保存出现错误提示:

向上取整,再向小数点前n位取整;向下取整

Posted on 八月 6th, 2010 by lichangyu and tagged .
lichangyu 的头像

1.向上取整,再向小数点前2位取整
double d = 1484.32;
int i1 =10*(int)( Math.Ceiling( d / 10));//1490//向前一位
int i2 = 100 * (int)(Math.Ceiling(d / 100));//1500向前二位
int i3 = 1000 *(int)(Math.Ceiling(d / 1000));//2000向前三位

2.向下取整
int il = (int)Math.floor(d);//1484
 

db_last_insert_id() 获取最后插入ID

Posted on 七月 30th, 2010 by keeperhan and tagged .
keeperhan 的头像

       db_last_insert_id($table,$field)返回最后插入的ID . 这个函数是线程安全的 . 其中包含两个参数 $table (表名) , $field (表的自动增长字段名) .
       说说我是怎么用到这函数的吧 ,  在表安装时插入一些默认的数据 , 这时候需要在 .install 文件中的 hook_install() 函数内执行插入语句 , 当然一定要在 drupal_install_schema()函数后 , 添加执行数据库操作语句 db_query() , 也就是插入记录 (insert 语句) .

hook_delete() 节点删除

Posted on 七月 29th, 2010 by keeperhan and tagged .
keeperhan 的头像

       hook_delete(&$node)函数通常用于从数据库表中删除信息 .这也是一个被节点使用的钩子函数 . 当执行此操作时 ,  一个节点将从数据库表中被删除.
<?php
/**
*    Implementation of hook_delete()
*/
function demo_delete($node){
    db_query("DELETE FROM {demo_company} WHERE nid=%d " ,$node->nid);
}
?>

hook_update( ) 更新数据

Posted on 七月 29th, 2010 by keeperhan and tagged .
keeperhan 的头像

       当hook_update($node)函数被调用时 ,被编辑节点和核心节点的数据已经被写入数据库。也就是更新了数据库中相关表的记录信息 .
<?php
/**
*    Implementation of hook_update()
*/
function demo_update($node){
    $industry = $node->industry ;
    foreach($industry as $key=>$val) {

hook_load() 加载节点类型特定信息

Posted on 七月 27th, 2010 by keeperhan and tagged .
keeperhan 的头像

       hook_load($node) 加载节点类型的个别信息 . 当你定义一个节点模块时 , 需要将自定义的节点属性添加到节点对象中,构建这个node对象 . 这个对象包含的节点属性将被加载 .
<?php
/*
  *    Implementation of hook_load()
 */
function demo_load($node){

hook_insert() 节点插入

Posted on 七月 26th, 2010 by keeperhan and tagged .
keeperhan 的头像

       hook_insert($node)是节点模块使用的一个钩子函数 . 当一个新节点被保存插入数据库时,hook_insert()函数被回调 . 将自定义数据存储到数据库的相关的表中 . hook_insert()这个钩子函数是唯一被称为是在节点类型的元数据定义的模块 .
<?php
/**
*Implementation of  hook_insert()
*/
function demo_insert($node){
    $industry = $node->industry ;

db_fetch_object()

Posted on 七月 26th, 2010 by keeperhan and tagged .
keeperhan 的头像

       db_fetch_object() 获取数据库查询结果的行记录,并将这条记录转换为一个对象 .
函数定义:
db_fetch_object($result)
       $result 是利用db_query()函数执行数据库操作 ,获取数据库查询的结果集 .
返回值:
        将数据的当前记录转换为一个对象,并将记录指针下移,如果无记录,则返回false.

javascript 操作Cookie函数

Posted on 七月 19th, 2010 by cfanwzl and tagged .
cfanwzl 的头像

function setCookie(name,value,expire) {
    var exp = new Date();
    exp.setTime(exp.getTime()+expire);
    document.cookie = name + "=" + escape(value) + "=;expires=" + exp.toGMTString();
}
function getCookie(name) {