什么是胆识?胆识=胆量+见识。If 胆量>见识,then 会因为轻举妄动而导致失败;If 胆量<见识,then 会因为保守固化而贻误战机。只有胆量又大,见识又多时,我们才能冷静而机智地分析问题,并能用平和的心态、宽广的视野和全新的思维方式来解决问题,我们有自已的主见,不会人云亦云,不会手足无措,而是敢于挑战自已,敢于创新,敢于突破。
什么是远离:一是远离客户,二是远离员工。什么是远离?远离就是不再仔细倾听他们的意见。
回忆那个光影交错的武侠江湖,醉生梦死的凄美时光...

忧伤,孤独,爱情,像迷离眩目的花,漫天飞舞在滚滚黄沙中...

★.任何人都可以变得狠毒,只要你尝试过什么叫嫉妒.

★.你知道喝水和喝酒的区别吗?酒越喝越暖,水会越喝越寒.阅读全文
firefox和ie在修改了本机的hosts文件后,必须重起一下ie才起作用,今天看到有人讨论这个问题,问有没有办法可以用命令行清空dns的cache,直接使修改过的hosts文件生效,而不需要重起ff或者ie。
方法很简单

ipconfig /flushdns
相应的还有
ipconfig/displaydns Display the contents of the DNS Resolver Cache.

显示dns cache的内容,包括hosts文件里的信息也会显示出来。
ipconfig这个命令经常用,常用的有:
/all Display full configuration information.
/release Release the IP address for the specified adapter.
/renew Renew the IP address for the specified adapter.

但是这个关于dns的功能很少用。还有
/registerdns Refreshes all DHCP leases and re-registers DNS names
/showclassid Displays all the dhcp class IDs allowed for adapter.
/setclassid Modifies the dhcp class id
在新的centos6.2里是这样来安这个setup的。

在command terminal输入:

#netconfig



[code][root@vm02 ~]# netconfig
netconfig: Command not found.
[/code]检查你是root?你装了netconfig的rpm包了吗?find / -name netconfig  -print找一下有没有!
当我登陆到 CentOS 5.3 中,尝试使用netconfig 是不能使用的,并不奇怪。。。
以前版本:
rpm -ivh netconfig-0.8.24-1.2.2.1.i386.rpm
在CentOs5.3没有找到。
也可以直接:
vi /etc/sysconfig/network-script/ifcfg-eth0
一 ,修改:
/etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static dhcp
IPADDR=192.168.1.101

NETMASK=255.255.255.0

GATEWAY=192.168.1.254


二修改网关

vi /etc/sysconfig/networkNETWORKING=yes
HOSTNAME=Aaron
GATEWAY=192.168.1.254


三修改DNS

vi /etc/resolv.confnameserver 202.96.128.68
nameserver 219.136.241.206



四重新启动网络配置

/etc/init.d/network restart
service network stop
service network start


改主机名
vi /etc/sysconfig/network

但是我是一个懒人的嘛: 其次就使用 setup 来配置,觉得有点惊奇,因为5.1版本可以使用的命令,现在不能

setup-2.5.58-4.el5.noarch.rpm
rpm -ihv  setup-2.5.58-4.el5.noarch.rpm


rpm -ql  setup-2.5.58-4.el5.noarch.rpm
可能是setup没有添加到环境变量的原因,连setup都没有用上,太他妈的倒霉了饿:
最后,

使用了。只好使用 system-config-network!

注意:netconfig是RHEL4 CentOS4里的命令了, RHEL5和CentOS5用setup了,界面跟以前几乎一样。

# rpm -q -a

或者:
rpm -qa |grep man

rpm -qa |grep netconfig



看有没有man、netconfig的包文件?
没有就要安装


-q name :查询
-qa查询所有已安装的RPM
-qi name 查询这个软件详细信息
-ql 显示列表
-qf path  :查询一个文件属于哪个包
-qp 包名 :查文件是什么
-qpl 包名 :针对一个没装过的包


没有的话安装相应的RPM包吧?

你如果用的是:as5不完全安装时没有这个命令的
直接用setup!
选择:network configuration 即可配置!
其实你也可以修改:

/etc/sysconfig/network-scripts/ifcfg-eth0

进行配置!
Centos6,Rpm安装,不知道是不是这个,但安了才能使用setup:
rpm -ihv ./Packages/setuptool-1.19.9-3.el6.i686.rpm
rpm -ihv ./Packages/usermode-1.102-3.el6.i686.rpm  
我们需要对这个数组先按照score【分数排序:由高到低】,然后再由name[姓名低到高排序]:
特别注意:array_multisort对姓名排序时候要utf8【假如是UTF8】转为gbk,否则排序出现错误,切忌切忌!!!
1.排序代码:[特别注意:我在排序分数的时候有个千分位输出,最后排序发现它会当成整形去处理,逗号{千分位分隔符}会截断],所以,最好是先排好【对score排好--》在通过number_format来千分位输出,见下代码:】
由于调用用户姓名接口是utf8输出,我们这儿的php文件是gbk编码【由于大部规定:除了html模板,接口返回编码和数据存储为utf8外其余都是gbk编码,因此:我这个modle层的编码也是gbk的】,为此,必须转为gbk来进行中文名的二次排序【首先是按照分数来排序,这个数组在后面给出】,
注意:转为GBK编码片段: iconv("UTF-8","GBK",$v);
foreach($resultname as $k =>$v)
      {
              $arraydisplay[$i][name] = iconv("UTF-8","GBK",$v);
              $arraydisplay[$i][uid] = $k;
          $arraydisplay[$i][score] =  $json2array[$k];
          $arraydisplay[$i][potourl] = $resulticon[$k];
          foreach ($level_type as $kka =>$vvc)
          {
            if(($json2array[$k]<=$vvc[1])&&($json2array[$k]>=$vvc[0]))
            {
              $imgurl = $LeavelImg[$kka][0];//取得图片地址  
              $loopimg = $LeavelImg[$kka][1];
              for($jj=0;$jj<$loopimg;$jj++)
              {              
                $imgnum[] = $imgurl;
              }
              break;    
            }
          }
          $arraydisplay[$i][imgsrc] = $imgnum;
          unset($imgnum);
            
              $i++;
      }



排序代码:
      $arraydisplay = array_chunk($arraydisplay,10,TRUE);//截取前10个人的数据给smarty          $data = $arraydisplay[0];
      unset($arraydisplay);  
      unset($arraydisplay);  
      foreach ($data as $key => $row)
      {  
                      $score[$key]  = $row['score'];
                      $name[$key] = $row['name'];
      
      }  
      array_multisort($score, SORT_DESC,  $name, SORT_ASC, $data);
      for($iii=0;$iii<10;$iii++)
      {
        $data[$iii]['name'] = iconv("GBK","UTF-8",$data[$iii]['name']);  
        $data[$iii]['score'] =  number_format($data[$iii]['score']);
      }
      $result = $data;
    }






Array
(
    [0] => Array
        (
            [name] => 盛大师
            [uid] => 1159375663
            [score] => 88,897,776
            [potourl] => http://p8.sinaimg.cn/1159375663/50/1236592606
            [imgsrc] => Array
                (
                    [0] => renyuan_level_1.gif
                    [1] => renyuan_level_1.gif
                    [2] => renyuan_level_1.gif
                    [3] => renyuan_level_1.gif
                    [4] => renyuan_level_1.gif
                    [5] => renyuan_level_1.gif
                )

        )

    [1] => Array
        (
            [name] => 你好
            [uid] => 1377417885
            [score] => 728,888
            [potourl] => http://p6.sinaimg.cn/1377417885/50/1234321817
            [imgsrc] => Array
                (
                    [0] => renyuan_level_1.gif
                    [1] => renyuan_level_1.gif
                    [2] => renyuan_level_1.gif
                    [3] => renyuan_level_1.gif
                )

        )

    [2] => Array
        (
            [name] => 笨蛋
            [uid] => 1584778420
            [score] => 77,909
            [potourl] => http://p5.sinaimg.cn/1584778420/50/
            [imgsrc] => Array
                (
                    [0] => renyuan_level_2.gif
                    [1] => renyuan_level_2.gif
                    [2] => renyuan_level_2.gif
                    [3] => renyuan_level_2.gif
                    [4] => renyuan_level_2.gif
                )

        )

    [3] => Array
        (
            [name] => 吥喜欢
            [uid] => 1581862283
            [score] => 17,776
            [potourl] => http://p4.sinaimg.cn/1581862283/50/1239087886
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                    [5] => renyuan_level_3.gif
                )

        )

    [4] => Array
        (
            [name] => 阿里爸
            [uid] => 1582003980
            [score] => 17,776
            [potourl] => http://p5.sinaimg.cn/1582003980/50/1232551415
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                    [5] => renyuan_level_3.gif
                )

        )

    [5] => Array
        (
            [name] => 科比
            [uid] => 1582157323
            [score] => 17,776
            [potourl] => http://p4.sinaimg.cn/1582157323/50/1232615329
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                    [5] => renyuan_level_3.gif
                )

        )

    [6] => Array
        (
            [name] => 琳琳琳
            [uid] => 1281167662
            [score] => 17,776
            [potourl] => http://p7.sinaimg.cn/1281167662/50/1239361854
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                    [5] => renyuan_level_3.gif
                )

        )

    [7] => Array
        (
            [name] => 克里斯大王
            [uid] => 1141457724
            [score] => 8,988
            [potourl] => http://p5.sinaimg.cn/1141457724/50/1232521326
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                )

        )

    [8] => Array
        (
            [name] => 苗艳宏
            [uid] => 1581837512
            [score] => 8,988
            [potourl] => http://p1.sinaimg.cn/1581837512/50/1236940821
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                )

        )

    [9] => Array
        (
            [name] => 朱阿里
            [uid] => 1180166542
            [score] => 8,988
            [potourl] => http://p7.sinaimg.cn/1180166542/50/
            [imgsrc] => Array
                (
                    [0] => renyuan_level_3.gif
                    [1] => renyuan_level_3.gif
                    [2] => renyuan_level_3.gif
                    [3] => renyuan_level_3.gif
                    [4] => renyuan_level_3.gif
                )

        )

)

          



对二维数组里的某列键值进行排序有点相当于sql语句,array_multisort() 可以用来一次对多个数组进行排序,或者根据某一维或多维对多维数组进行排序。 关联(string)键名保持不变,但数字键名会被重新索引。 :
参考自己http://www.jb51.net/article/25882.htm


输出如下所示:
---------- 调试PHP ----------

Array
(
    [0] => Array
        (
            [id] => 6
            [value] => 6-1
            [parent] => 3
        )

    [1] => Array
        (
            [id] => 5
            [value] => 5-1
            [parent] => 2
        )

    [2] => Array
        (
            [id] => 4
            [value] => 4-1
            [parent] => 2
        )

    [3] => Array
        (
            [id] => 3
            [value] => 3-1
            [parent] => 1
        )

    [4] => Array
        (
            [id] => 2
            [value] => 2-1
            [parent] => 1
        )

    [5] => Array
        (
            [id] => 1
            [value] => 1-1
            [parent] => 1
        )

)

输出完成 (耗时 0 秒) - 正常终止

/stand/sysinstall -->; configure -->; Networking -->; 相应网卡名

建议新手用这个!@阅读全文
//程序中

$smarty->register_function('asc','asc_num');

//函数地定义

function asc_num($params){
    extract($params);    
    echo chr($num+64);
}

//模板中使用

<{asc num=$smarty.section.loop2.iteration}>


实例:


function insert_left($params, &$smarty) {
  global $FOURAPP;
  $o_app = new AppProx;
  $bRet = $o_app->getUserList(&$objarr, $params['cuseruid']);
  if($bRet) {
    if(is_array($objarr) && count($objarr)>0) {
      $userapplist = array_diff_key($objarr, $FOURAPP);
    } else {
      $userapplist = array();
    }
    $smarty->assign('cuseruid', $params['cuseruid']);
    $smarty->assign('userappnum', count($userapplist));
    $smarty->assign('userapplist', &$userapplist);
    $smarty->assign('fourapp', &$FOURAPP);
  }
  $html = &$smarty->fetch('part/left.html');
  return $html;
}

function insert_top($params,&$smarty){
  $smarty->assign('cuseruid',$params['cuseruid']);
  return $smarty->fetch('part/top.html');
}



HTML调用:

        <div class="SG_wrapall">
            {insert name="top" cuseruid=$uidowner}
        </div>
        <div class="SG_wrap950 pybg">
            <div class="SG_colW13 SG_colFirst">
                {insert name="left" cuseruid=$uidowner}
            </div>







参看:http://movoin.com/index.php/archives/182
http://www.phpx.com/happy/thread-123410-1-1.html


{cycle} 用于在值集合中轮换。便于实现下述情况,在一个表格中交替输出两种或多种颜色,在值数组中循环。
Example 8-5. {cycle}

{section name=rows loop=$data}<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">   <td>{$data[rows]}</td></tr>{/section}


The above template would output:

<tr bgcolor="#eeeeee">   <td>1</td></tr><tr bgcolor="#d0d0d0">   <td>2</td></tr><tr bgcolor="#eeeeee">   <td>3</td></tr>


自己测试:
PHP端:

Html输出端:

浏览器展现:
把一个数组按照一定长度截取到另外一个数组中:
$arraydisplay = array_chunk($arraydisplay,10,TRUE);//截取前10个人的数据给smarty

$uids = array();//强制$uids由string改为array()类型
$uids = array_keys($json2array);//把数组的键放到一个数组中。当然可以通过foreach实现,但没有必要!

array_slice -- 从数组中取出一段.
arsort($json2array);

--  对数组进行逆向排序并保持索引关系

<?php
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
arsort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
   echo "$key = $val\n";
}
?>

本例输出如下:

a = orange
d = lemon
b = banana
c = apple
开发中偶尔会遇到需要跳转页面后到达页面的最上方,如何处理呢?锚点!
方法:在各个页面里面下面就立马加入:
<a id="top1" name="top1"></a>


            <div class="PY_page">
        {if $page.totalpage > 1}
        <ul class="PY_pages">
          {if $page.pagenum > 1}
            <li class="PY_pgprev"><a href="{$page.previouspage}#top1" class="Ap_tf">&lt;上一页</a> </li>
          {/if}
             {foreach from=$pagelistarray item=pagelist}
             {if $pagelist.num == $page.pagenum}
             <li class="PY_pgon">{$pagelist.num}</li>
             {else}
             <li><a href='{$pagelist.url}#top1'>{$pagelist.num}</a></li>
             {/if}
             {/foreach}
          {if $page.pagenum < $page.totalpage}
            <li class="PY_pgnext"><a href="{$page.nextpage}#top1" class="Ap_tf">下一页&gt;</a></li>
          {/if}
        </ul>
        {/if}
      </div>


那在页面内呢?

在点击这儿后跳到下描点位置,这儿代码
:<a href="#top1">如何获得积分</a>

锚点位置代码:

<a id="top1" name="top1">如何获得积分</a>

EOF!
            
            $uids = array();    
            foreach($json2array as $keyuid =>$scorevalues)
            {  
                            $uids[] = $keyuid;

            }



$uids = array_keys($json2array);




            
            foreach($json2array as $keyuid =>$scorevalues)
            {  
                            $uids[] = $scorevalues;

            }



$uids =  array_values($json2array);

还没写完,待续。。。
我19号就回去了,没有参加公司年会,有空欣赏欣赏!
新浪2008年年会节目视频已全部上传,请点击收看!
(节目按演出顺序)


1、游戏事业部《Honey Kiss Me》
http://you.video.sina.com.cn/b/18427106-1581909133.html

2、无线《赤壁2008之电信三国》
http://you.video.sina.com.cn/b/18417669-1581909133.html

3、运营视频频道《无所谓》
http://you.video.sina.com.cn/b/18429692-1581909133.html

4、新浪音乐俱乐部《新浪狂欢节》
http://you.video.sina.com.cn/b/18430248-1581909133.html

5、新浪研发部《新浪王牌军》
http://you.video.sina.com.cn/b/18438413-1581909133.html

6、运营中心、互动社区、无线《歌曲串烧》
http://you.video.sina.com.cn/b/18438615-1581909133.html

7、互动社区《囧并快乐着》
http://you.video.sina.com.cn/b/18449292-1581909133.html

8、无线《离骚》
http://you.video.sina.com.cn/b/18449330-1581909133.html
一行搞定:


效率最高:
#while read line
> do
> echo $line
> done < sort.txt
jack 1984
jack 1928
jack 19834
jack 1984
jack 1984
jack 1984
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988

#cat sort.txt |while read LINE
> do
> echo $LINE
> done
jack 1984
jack 1928
jack 19834
jack 1984
jack 1984
jack 1984
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988
xiangdong 1988

#for line in $(cat sort.txt )
> do
> echo ${line}
> done
jack
1984

来自:https://www.cnblogs.com/mgzc-1508873480/p/7866915.html
foreachbreak.php                                                                                  

<?php
$i = array (10, 12, 13, 25);
foreach ($i as $key =>$value) {
    if(13 == $value)
    {  
        break;
    
    }  
    echo $key."=>".$value."\n";
}

?>


Result:

0=>10
1=>12

答案:能break!

continue test:
<?php
$i = array (10, 12, 13, 25);
foreach ($i as $key =>$value) {
    if(13 == $value)
    {  
        continue;
    
    }  
    echo $key."=>".$value."\n";
}

?>



0=>10
1=>12
3=>25

答案:也能continue!

  一、for循环
    最简单也是最直接的方法,用for循环来遍历数组。对于已知维数的数组可以判断,但如果是未知的多维数组,该怎么办?
  二、implode();
    用implode()将数组输出为字符串,判断输出的字串是否为空。初看上去似乎是个不错的方法,可惜跟上一点一样,对于二维以上数组就不行了。举个例子:
$arr= array(array(),array(),array());
$str = implode(',',$arr);

if(empty($str)) echo "空";
else echo "非空";


很明显$arr是个含有三个空数组的二维数组,应该也算是空的,可是输出的确是非空。判断失败。
  三、count();
    不得不承认,我最先想到的也是这个函数,网上也有好多网友把这个当答案,并以为已经解决问题。可是请看下面的例子:
$arr= array("","","");
echo count($arr);
  四、in_array('', $arr));
    不多说,还是看例子:


$arr= array("d","s","");
echo in_array('', $arr);


这个只能说明数组中有空的元素,不能证明数组是空的。很明显也不行
  五、empty();
    这个cpyeh觉得跟前面几种方法差不多


$arr= array("","","");
if(empty($arr)) echo "空";
else echo "非空";


结果还是非空

可以在以上例子上加一句print_r($arr);看看...
  基本上cpyeh能想到的加上网上找到的也就以上这些,不明白的是网上居然有人会提到is_array(),可能是对php还不是很了解,需要多翻翻手册。很遗憾最终还是找不到一个完美的解决方法,不过对于一般的应用,第一种或第二种应该可以满足了,cpyeh选了方便的第二种。如果对以上例子有疑问欢迎留言在此互相交流。

后计:
如果判断一个二维数组可以这样,同时干掉那些空的:        
$this->dataObj->getTotalScore(&$resultinfo,$uids);
        $judge = implode("",$resultinfo);
        if(!empty($judge))//数组不为空
        {  //去掉数组键值为空
          foreach($resultinfo as $key =>$getoutvisnull)
          {
            if(empty($getoutvisnull))
            {
              unset($resultinfo[$key]);
            }
          }
          $allscorearray[] = $resultinfo;
        }


QQ群有哥们用下面函数来做这个事情:


function array_null($arr){
    if(is_array($arr)){
     foreach($arr as $k=>$v){
      if($v&&!is_array($v)){
        return false;
      }
       $t=array_null($v);
       if(!$t){
         return false;
       }
     }
     return true;
     }else{
       if(!$arr){
         return true;
       }
       return false;
     }
  }
  $node=array(array(),array(),array(array()));
  if(array_null($node)){
    echo "fdsa";
  }


用正则:


if (trim(preg_replace("/(\w+\s*=>\s*)?array\s*\(|\),\s+|\)$/i","",var_export($arr,true)))){
  echo 'true';
  }
  else{
    echo "false";
  }



但如果是多维的呢?PHP内核团队能专们提出一个函数来判断和并且去掉多维的键值吗?期待中。。。





原型:

<?php
$keys= "123,234,456";
define("URL","10.69.3.23:8199/?class=0&keys=%s");
$txt = sprintf(URL, urlencode($keys));
echo $txt;
?>

配置文件分离:
define.php

define('BLOGBINDURL',"http://o.xianguo.com/sina/blogbind?email=%s&puid=%s&blogUrl=%s&action=%s&api
key=%s&time=%s&securitykey=%s");


ZZZ.php

        public function bindblog($email,$uid,$blogurl,$action)
        {
                $time = time();
                $securitykey = md5($uid . BIND_BLOG_APIKEY . $time . BIND_BLOG_PRIKEY);
                $url = sprintf(BLOGBINDURL, urlencode($email), urlencode($uid), urlencode("http://".
$blogurl), urlencode($action), BIND_BLOG_APIKEY, urlencode($time), urlencode($securitykey));
                $flag = Check::request($url,$result);
                if(1 == $flag)  {
                        $resultReturn = json_decode($result,true);
                        if(0 === $resultReturn['status'])
                                return 1;
                        if(1 === $resultReturn['status'])
                                return 0;
                } else  {
                        return 0;
                }

        }



Check.php


  static public function request($url,&$result,$timeout=10) {
    $ctx = stream_context_create(array(
      'http' => array(
      'timeout' =>$timeout
      )
    ));
    $result = file_get_contents($url,false,$ctx);
    if ($result === false) {
      error_log("request $url   timeout",0);
      return 0;
    }
    return 1;
  }


参看:http://hi.baidu.com/studyphp/blog/item/055eda62b6bbe0d8e6113a4b.html


一维数组直接用点即可:


显示HTML:








三维数组形式:


Html用Smarty循环出来如下:
分页: 250/339 第一页 上页 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 下页 最后页 [ 显示模式: 摘要 | 列表 ]