php zval类型定义

#define IS_NULL 0
#define IS_LONG 1
#define IS_DOUBLE 2
#define IS_BOOL 3
#define IS_ARRAY 4
#define IS_OBJECT 5
#define IS_STRING 6
#define IS_RESOURCE 7
#define IS_CONSTANT 8
#define IS_CONSTANT_ARRAY 9
#define IS_CALLABLE 10

WebLogic 密码恢复

Title : How to recover the Password in WebLogic Server

The below steps need to follow to cover the password in weblogic server.

Step 1:

Run setWlstEnv.sh for setting up the environment variables.

Ex:-

. /u01/Middleware/oracle_common/common/bin/setWlstEnv.sh

Step 2:

weblogic password recover command –

[oracle@localhost bin]$ /opt/installations/tools/jdk1.7.0_55/bin/java weblogic.WLST decryptpassword.py /opt/ntdomain/domains/NT {AES}68+XWFqzaQdP5DmEgmkJZWnRWtIvjBd7v+y6h49tCd0\=

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands
========================================
Decrypted Password:p0o9i8u7
========================================

Step 3:

weblogic user recovery command –

[oracle@localhost bin]$ /opt/installations/tools/jdk1.7.0_55/bin/java weblogic.WLST decryptpassword.py /opt/ntdomain/domains/NT {AES}WsnwdqROocsh6D1YOclnc1ySRyzheBNtZD2AGLnjIFM\=

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands
========================================
Decrypted Password:weblogic
========================================

 

 

decryptpassword.py:

import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService
 
def decryptString(domainPath, encryptedString):
    es = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainPath)
    ces = weblogic.security.internal.encryption.ClearOrEncryptedService(es)
    decryptedString = ces.decrypt(encryptedString)
    print "=" * 70
    print " " * 10 +"Decrypted Password:" + decryptedString
    print "=" * 70
 
try:
    #os.system('clear')
    if len(sys.argv) == 3:
        decryptString(sys.argv[1], sys.argv[2])
    else:
        print "=" * 70
        print "INVALID ARGUMENTS"
        print "Usage: java weblogic.WLST %s " %sys.argv[0]
        print "example.:"
        print "    java weblogic.WLST %s /oracle/fmwhome/user_projects/domains/NT/ {AES}68+XWFqzaQdP5DmEgmkJZWnRWtIvjBd7v+y6h49tCd0\=" %sys.argv[0]
        print "=" * 70
except:
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise

WordPress 结合Memcache进行缓存加速

WordPress博客是一个非常耗费性能的博客系统,若将原版Wordpress博客系统直接用作博客站点或者门户站点,等到访问量变大之后,就会发现系统性能根本吃不消,mysql查询数量惊人的大,而且CPU资源非常高,wordpress打开过慢等.

实际上,我们可以想办法对wordpress进行优化,使得系统性能耗费没有那么高.
首先最主要的一个操作就是减少数据库查询数量.
一般情况下,博客文章发表后就不会再做修改,因此我们可以将这些页面进行缓存,从而减少数据库查询.
大多数的wordpress官方插件都是进行文件形式的缓存,而且要执行许多步操作,非常麻烦,实际上缓存效果是有一点,但是没有明显的降低系统的资源消耗.

这里提供一种方法,可以减少wordpress系统资源的消耗,由于wordpress是单一入口的程序,因此我们在index.php中所添加的所有代码,在前台访问时均会被执行.
因此在index.php中添加页面缓存代码.如下:

 

function is_cached($uri=''){
//echo "saemc://html_cache/".sha1($uri);

@$c=file_get_contents("saemc://html_cache/".sha1($uri));
if($c!=''&&sha1($uri)!='42099b4af021e53fd8fd4e056c2568d7c2e3ffa8'){
echo $c;
die();
}else{
ob_start(cache_html);
}
}
function cache_html($c){
$c=str_replace('/<div id="wpadminbar" class="">(.|\r|\n)*登出</a>(\r|\n)*\s*</div>/','',$c);
file_put_contents("saemc://html_cache/".sha1($_SERVER['REQUEST_URI']),$c);
return $c;
}
is_cached($_SERVER['REQUEST_URI']);
ob_start(myzip);

以SAE环境为例:在index.php文件前加入该代码即可.

当然如果为自建memache/redis,加上连接账号密码,key设置为sha1值即可.