2011 March

如果系统不是很干净的话,架设php运行环境,如phpnow,可能会出现问题,查找也会很麻烦,多运行了一些服务恐怕也不那么舒服。
一个可行的很干净的解决办法就是在虚拟机中构建,我实际测试可行。
步骤如下:
1.安装vmware 7.1
2.建立xp虚拟机,网络 选 host-only,briged也行,不过host-only即便在无网络连接,无路由器时仍然很好的通过虚拟网络工作。
3.在xp虚拟机中部署php环境如phpnow
4.搞定,这样一个很干净的xp系统仅有php运行环境,可以通过在主机中访问虚拟机的ip,通过设置共享,也可以直接访问虚拟机的htdocs文件夹。这样就可以需要时才运行虚拟机的php环境。这可以很方便用于测试开发。

share to»

About Rainmeter taskbar shadow plugin

it is designed for taskbar on top situation,tested only in
win7 64 bit,
rainmeter 64bit,2.0 edition,
22 pix height, 1366 width taskbar.
you can edit it to suit your system.

DOWNLOAD

http://html5beta.com/files/shadow.zip

SCREENSHOT

Rainmeter taskbar shadow plugin

Rainmeter taskbar shadow plugin

share to»

ABOUT WP Simple Captcha

lots of robot spam commenters,i really get rid of them,hope it will not cost much.so I write this little plugin to do the work,you can just add these lines of code into your theme’s function.php file ,put them before the last:

?>

it will just work.

these are the code you should put into your function.php:>

class zxdRoboCheck{
  function zxd_robokiller_fields($fields) {
    $rnum1 =rand(1,10);
    $rnum2 = rand(2,8);
    $rnum = $rnum1 + $rnum2;
    $fields['robo'] = '<p class="comment-form-robo"><label for="robo">'.$rnum1.'+'.$rnum2.'=?'.__('(robot check)').'</label> <span class="required">*</span><input id="robo" name="robo" type="text" value="" size="30" aria-required="true" /><input id="rnum" name="rnum" type="hidden" value="'.$rnum.'" size="0" aria-required="true" class="hide" /></p> ';
    return $fields;
  }
  function roboCheck($comment){
                $userId = get_current_user_id();
                if($userId!=0) return($comment);
    if (empty($_POST['robo']) || trim($_POST['robo']) == '' ) {
      wp_die( __('Error: you are not robot,are you?do the math,fill the blank '));
    }
    $robo_num1 = (int)$_POST['robo'];
    $robo_num2 = (int)$_POST['rnum'];
    if ( $robo_num2 == $robo_num1) {
      return($comment);
    } 
    else {
      wp_die( __('Error: you are not robot,are you?'));
    }
  }
}
if (class_exists("zxdRoboCheck")) {
  $aRoboCheck = new zxdRoboCheck();
  add_action('comment_form_default_fields', array(&$aRoboCheck, 'zxd_robokiller_fields'),1);
  add_filter('preprocess_comment', array(&$aRoboCheck, 'roboCheck'), 1);
}

FAQ

it is simple,so it is easy to crack,if spammers want.lets just hope they do not really have to deal with your site.

DOWNLOAD

http://wordpress.org/extend/plugins/wp-simple-captcha/

CHANGE LOG

1.1 fix login user can not comment bug.

share to»

1.啥也不显示的标题栏仍然占据相当的高度。
2.仍然顽固的不支持rotate,但是支持圆角了。
3.既然已经学习其他浏览器的好处了,干吗不学全了。
4.开发模式很不错,提供ie7,ie8兼容模式,便于测试。

share to»

ABOUT

Simply download WP ajax Collapsing Categories plugin from wordpress plugin panel and enable it is the easy way to add WP ajax Collapsing Categories widget.but not the best way.we can just add some code to theme’s function.php to make it work.i will explain the details here.

WALKTHROUGH

1.download WP ajax Collapsing Categories,unzip it,put “wp-ajax-collapsing-categories.js” into your theme folder
2.add these lines of code into your theme’s function.php (before the last “?>”)

/*a function to check if post_is_in_descendant_category ,which will work with */
/**
* a function to check if post_is_in_descendant_category
* @param $cats the category object to check
* @return true if post_is_in_descendant_category or false if not in
*/
    function zxd_post_is_in_descendant_category( $cats, $_post = null ){
    foreach ( (array) $cats as $cat ) {
      $descendants = get_term_children( (int) $cat, 'category');
      if ( $descendants && in_category( $descendants, $_post ) ) return true;
    }
    return false;
  }
  /**
  * get all top level categories
  * @return top level categories objects array
  */
  function getTopLevelCats() {
    $allCats = get_all_category_ids();
    $cats = array();
    foreach ($allCats as $id){
      $obj = get_category($id);
      $name = get_cat_name($id);
      if (!$obj -> parent) array_push($cats,$obj);
    }
    return $cats;
  }
  /**
  * wp ajax collapsing categories class
  */
  class ajax_cc_Widget extends WP_Widget{
    function ajax_cc_Widget() {
      $widget_ops = array('classname' => 'widget_ajax_cc', 'description' => 'WP ajax Collapsing Categories' );
      $this->WP_Widget('ajax_cc_widget','ajax_cc_widget',$widget_ops);
    }
    /**
    * implent widget fucntion
    */
    function widget($args, $instance) {
      extract($args, EXTR_SKIP);
      echo $before_widget;
      $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
      if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
      echo '<ul class="zxd_ajax_cc"' ;
      echo ' zid="';
      the_ID();
      echo '">';
      if(!$instance['zxdIncludeCats']) {
        $zxdCatArrayPool = getTopLevelCats();
      }
      else {
        $zxdCatArrayPool = array();
        $zxdCatTempPool = preg_split('/[,]+/',$instance['zxdIncludeCats']);
        sort($zxdCatTempPool);
        foreach($zxdCatTempPool as $a) {
          if(!get_category_by_slug($a)) {
            $zxdCatArrayPool = getTopLevelCats();
            break;
          }
          $obj = get_category_by_slug($a);
          array_push($zxdCatArrayPool,$obj);
        }
      }
      $zxdPostId = is_single()?get_the_ID():0;
      foreach ($zxdCatArrayPool as $zxdCatObj){
        $zxdCatid = $zxdCatObj -> term_id;
        $zxdCatdesc = $zxdCatObj->description;
        $zxdCatCount = $zxdCatObj->count; 
        echo '<li class="zxd_ajax_cc_li"><span class="zxd_expand">[+]</span>'.'<a '; 
        if(in_category( $zxdCatid,$zxdPostId)||zxd_post_is_in_descendant_category($zxdCatid,$zxdPostId)) {
          echo 'class="zxd_current_cat" '; 
        }
        echo 'href="'.get_category_link($zxdCatid).'" '.'title="'.$zxdCatdesc.'">'.get_cat_name( $zxdCatid ).'</a>'.'('.$zxdCatCount.')'.'</li>';
      }
      echo '</ul>' ;
      echo $after_widget;
    }
    /**
    * implent widget fucntion
    */
    function update($new_instance, $old_instance) {
      $instance = $old_instance;
      $title = strip_tags($new_instance['title']);
      $zxdIncludeCats=$new_instance['zxdIncludeCats'];
      $instance = compact('title','zxdIncludeCats');
      return $instance;
    }
    /**
    * implent widget fucntion
    */
    function form($instance) {
      $defaults=array(
      'title' => __('ajax Categories', 'WP ajax collapsing categories'),
      'zxdIncludeCats' => '',
      );
      $options = wp_parse_args( $instance,$defaults );
      extract($options);  
      ?>
            <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this-/>get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
            <p>include these categories (category slugs,separated by commas): </p>
            <p><input type="text" name="<?php echo $this-/>get_field_name('zxdIncludeCats'); ?>" value="<?php echo $zxdIncludeCats ?>" id="<?php echo $this->get_field_id('zxdIncludeCats') ?>" </p>
      <?php
        }
    }
  /**
  * register_widget
  */
  function zxd_widgets_init() {
    register_widget('ajax_cc_Widget');
  }
  add_action( 'widgets_init', 'zxd_widgets_init' );
  if ( !is_admin() ) {
    function zxd_init_method() {
      wp_register_script( 'wp-ajax-collapsing-categories', get_template_directory_uri().'/wp-ajax-collapsing-categories.js',array('jquery'),'1.0',true);
      wp_enqueue_script( 'wp-ajax-collapsing-categories');
      wp_localize_script( 'wp-ajax-collapsing-categories', 'ajaxCC', array( 'ajaxurl' =&gt; admin_url( 'admin-ajax.php' )) );
    }
    add_action('init', 'zxd_init_method');
  }
  add_action( 'wp_ajax_nopriv_zxd_cc_submit', 'zxd_cc_submit' );
  add_action( 'wp_ajax_zxd_cc_submit', 'zxd_cc_submit');
  function zxd_cc_submit(){
      $zxdCatUrl = $_POST['catZxd'];
    $zxdCurrentPostID =  (int)$_POST['currentID'];
    $items1 = explode('/',$zxdCatUrl);
    $zxdCatSlug =  $items1[count($items1)-1]?$items1[count($items1)-1]:$items1[count($items1)-2];
    $items2 = explode('=',$zxdCatSlug);
    if($items2[0] == '?cat') $zxdCatId = (int)$items2[1];
    else{
      $zxdCatObj = get_category_by_slug($zxdCatSlug);
      $zxdCatId = $zxdCatObj-&gt;term_id;
    }
    $zxdArgs = array(
    'parent'                   =&gt; $zxdCatId,
    'orderby'                  =&gt; 'slug',
    'order'                    =&gt; 'ASC',
    'hide_empty'               =&gt; 1,
    );
    $zxdChildCats = get_categories( $zxdArgs );
    echo '&lt;ul class="child_cat hide"&gt;' ;
    if(!empty($zxdChildCats)){
      $zxdChildCatsIdArray =array();
      foreach($zxdChildCats as $zxdtemp1){
        array_push($zxdChildCatsIdArray, $zxdtemp1-&gt;term_id);
      }
    $zxdArgs2 = array(
    'post_type' =&gt; 'post',
    'category__in'  =&gt; array($zxdCatId),
    'category__not_in' =&gt; $zxdChildCatsIdArray,
    );
    foreach ($zxdChildCats as $zxdEachCatChild){
      $zxdCatChildId =  $zxdEachCatChild -&gt;term_id;
      $zxdCatChildDesc = $zxdEachCatChild-&gt;description;
      $zxdCatChildCount = $zxdEachCatChild-&gt;count;
      if ( in_category( $zxdCatChildId,$zxdCurrentPostID )||zxd_post_is_in_descendant_category( $zxdCatChildId,$zxdCurrentPostID )) {
        echo '&lt;li class="zxd_ajax_cc_li"&gt;&lt;span class="zxd_expand"&gt;[+]&lt;/span&gt;'.'&lt;a class="zxd_current_cat" href="'.get_category_link($zxdCatChildId).'" '.'title="'.$zxdCatChildDesc.'"&gt;'.get_cat_name( $zxdCatChildId ).'&lt;/a&gt;'.'('.$zxdCatChildCount.')'.'&lt;/li&gt;';
      }
      else{
        echo '&lt;li class="zxd_ajax_cc_li"&gt;&lt;span class="zxd_expand"&gt;[+]&lt;/span&gt;'.'&lt;a href="'.get_category_link($zxdCatChildId).'" '.'title="'.$zxdCatChildDesc.'"&gt;'.get_cat_name( $zxdCatChildId ).'&lt;/a&gt;'.'('.$zxdCatChildCount.')'.'&lt;/li&gt;';
      }
    };
  }
  else{
    $zxdArgs2 = array(
    'post_type' =&gt; 'post',
    'category__in'  =&gt; array($zxdCatId),
    );
  };
  $zxdQuery = new WP_Query($zxdArgs2);
  if($zxdQuery-&gt;have_posts()){
    while ($zxdQuery-&gt;have_posts()) {
        $zxdQuery-&gt;the_post();
      echo '&lt;li class="zxd_ajax_cc_li"&gt;&lt;a';
      if  ($zxdQuery-&gt;post-&gt;ID==$zxdCurrentPostID) echo ' class="zxd_current_cat"';
      echo ' href="';
      echo the_permalink();
      echo '" rel="bookmark" title="';
      echo  the_title_attribute();
      echo '"&gt;';
      echo  the_title();
      echo '&lt;/a&gt;&lt;/li&gt;';
    }
  }
  echo '&lt;/ul&gt;' ;
  exit;
}

3.done,it should work now.without enable a plugin.
4.if your theme already has a javascript loaded,you can just skip the step1,do step2,then find these lines:

      wp_register_script( 'wp-ajax-collapsing-categories', get_template_directory_uri().'/wp-ajax-collapsing-categories.js',array('jquery'),'1.0',true);
      wp_enqueue_script( 'wp-ajax-collapsing-categories');
      wp_localize_script( 'wp-ajax-collapsing-categories', 'ajaxCC', array( 'ajaxurl' =&amp;gt; admin_url( 'admin-ajax.php' )) );

,replace these lines with this one line(replace 'yourloadedjsfilename' with your js file's realname)
wp_localize_script( 'yourloadedjsfilename', 'ajaxCC', array( 'ajaxurl' =&amp;amp;gt; admin_url( 'admin-ajax.php' )) );

then,put these lines in your loaded js file:
/*
+----------------------------------------------------------------+
|                                              |
|  WordPress  Plugin: WP ajax collapsing categories                    |
|  Copyright (c) 2011 ZHAO Xudong                  |
|                                              |
|  File Written By:                                  |
|  - ZHAO Xudong                            |
|  - http://html5beta.com                            |
|                                              |
|  File Information:                                  |
|  - WP ajax collapsing categories Javascript File                          |
|  - wp-content/plugins/wp-ajax-collapsing-categories/wp-ajax-collapsing-categories.js     |
|                                              |
+----------------------------------------------------------------+
*/
jQuery( function($) {
  var zxdExpander = function() {
    var zxdExpand =$(this);
    var exp ='[—]';
    var exp2 = '[+]';
    if(zxdExpand.html() ==exp){
      zxdExpand.parent('.zxd_ajax_cc_li').children('ul').hide("normal");
      zxdExpand.html(exp2);
    }
    else{
      zxdExpand.html(exp);
      var zxdExpandChild =  zxdExpand.parent('.zxd_ajax_cc_li').children('.child_cat');
      if(zxdExpandChild.length&gt;0) zxdExpandChild.show("normal");
      else{
        var zxdIdDiv = $('.zxd_ajax_cc').eq(0).attr("zid");
        var zxdID =zxdIdDiv?zxdIdDiv:0;
        var zxdCatLink = zxdExpand.parent('.zxd_ajax_cc_li').children('a').attr("href");
        $.ajax({
          type: 'POST',
          url:ajaxCC.ajaxurl,
          data: {
            action : 'zxd_cc_submit',
            catZxd: zxdCatLink,
            currentID:zxdID
          },
          success:function(data) {
            zxdExpand.parent('.zxd_ajax_cc_li').append(data).children('.child_cat').show("normal");
          } ,
          dataType:"html"
        });
      }
    }
  };
  $(".zxd_expand").live ('click',zxdExpander);
})

share to»

应用proxychains和sshcenter免费ssh。我在Ubuntu 10.10自己试的,安装dropbox成功
1.到sshcenter.info注册免费24小时的ssh,到邮箱激活
2.下载dropbox 安装文件安装
3.安装proxychains,

sudo apt-get install proxychains

4,设置proxychains
sudo chmod a+w /etc/proxychains.conf
gedit  /etc/proxychains.conf

添加如下设置
dynamic_chain
socks5   127.0.0.1 7070

5.开启ssh隧道,用到申请的sshcenter的用户名和密码
ssh -D 7070 yourusername@ssh.sshcenter.info

连接后会提示输入密码
6,另开一终端
proxychains dropbox start -i

然后就会成功下载了

share to»

不支持ie6,用现代浏览器吧。 firefox, google chrome, opera, safari 等,或请升级到 更高版本的Internet Explorer

you see this because you are using ie6,which is old ,ugly,and not supported by this site,try get a modern browser!
firefox, google chrome, opera, safari , or upgrade to Internet Explorer 8+