php給javascript传值

lrenwang , 2011/02/18 06:09 , Javascript , 评论(0) , 阅读(701) , Via 本站原创

<?php
$a = array(
  array('id'=>1,'title'=>'abc'),
  array('id'=>2,'title'=>'asd'),
  array('id'=>3,'title'=>'fff'),
  array('id'=>4,'title'=>'ggg'),
);
?>

<script>
var mes_list = <?=json_encode($a);?>;
for(i in mes_list)
{
  document.write(mes_list[i]['title']+'<br />');
}
</script>

Serv-U6.4汉化完美版

lrenwang , 2011/02/16 05:41 , windows , 评论(0) , 阅读(742) , Via 本站原创
Serv-U 是一种被广泛运用的FTP服务器端软件,支持 9x/ME/NT/2K 等全Windows系列。它设置简单,功能强大,性能稳定。FTP 服务器用户通过它用 FTP协议能在 internet上共享文件。它并不是简单地提供文件的下载,还为用户的系统安全提供了相当全面的保护。例如:您可以为您的FTP 设置密码、设置各种用户级的访问许可等等。Serv-U不仅100%遵从通用FTP标准,也包括众多的独特功能可为每个用户提供文件共享完美解决方案。它可以设定多个FTP 服务器、限定登录用户的权限、登录主目录及空间大小等,功能非常完备。它具有非常完备的安全特性,支持SSl FTP传输,支持在多个Serv-U和FTP客户端通过SSL加密连接保护您的数据安全等。

自动寻路算法(JS版)

lrenwang , 2011/02/10 08:22 , Javascript , 评论(0) , 阅读(704) , Via 本站原创



<html><head><title>A* 寻路算法</title></head>

<body style="margin:0px">

<script>



var closelist=new Array(),openlist=new Array();

var gw=10,gh=10,gwh=14;

var p_start=new Array(2),p_end=new Array(2);

var s_path,n_path="";

var num,bg,flag=0;

var w=30,h=20;

function GetRound(pos){

  var a=new Array();

  a[0]=(pos[0]+1)+","+(pos[1]-1);

  a[1]=(pos[0]+1)+","+pos[1];

  a[2]=(pos[0]+1)+","+(pos[1]+1);

  a[3]=pos[0]+","+(pos[1]+1);

  a[4]=(pos[0]-1)+","+(pos[1]+1);

  a[5]=(pos[0]-1)+","+pos[1];

  a[6]=(pos[0]-1)+","+(pos[1]-1);

  a[7]=pos[0]+","+(pos[1]-1);

  return a;

}

function GetF(arr){

  var t,G,H,F;

  for(var i=0;i<arr.length;i++){

    t=arr[i].split(",");

    t[0]=parseInt(t[0]);t[1]=parseInt(t[1]);

    if(IsOutScreen([t[0],t[1]])||IsPass(arr[i])||InClose([t[0],t[1]])||IsStart([t[0],t[1]])||!IsInTurn([t[0],t[1]]))

        continue;

    if((t[0]-s_path[3][0])*(t[1]-s_path[3][1])!=0)

        G=s_path[1]+gwh;

    else

        G=s_path[1]+gw;

    if(InOpen([t[0],t[1]])){

        if(G<openlist[num][1]){

          openlist[num][0]=(G+openlist[num][2]);

          openlist[num][1]=G;

          openlist[num][4]=s_path[3];

        }

        else{G=openlist[num][1];}

    }

    else{

        H=(Math.abs(p_end[0]-t[0])+Math.abs(p_end[1]-t[1]))*gw;

        F=G+H;

        arr[i]=new Array();

        arr[i][0]=F;arr[i][1]=G;arr[i][2]=H;arr[i][3]=[t[0],t[1]];arr[i][4]=s_path[3];

        openlist[openlist.length]=arr[i];

    }

    if(maptt.rows[t[1]].cells[t[0]].style.backgroundColor!="#cccccc"&&maptt.rows[t[1]].cells[t[0]].style.backgroundColor!="#0000ff"&&maptt.rows[t[1]].cells[t[0]].style.backgroundColor!="#ff0000"&&maptt.rows[t[1]].cells[t[0]].style.backgroundColor!="#00ff00")

    {

        maptt.rows[t[1]].cells[t[0]].style.backgroundColor="#FF00FF";

        //maptt.rows[t[1]].cells[t[0]].innerHTML="<font color=white>"+G+"</font>";

    }

  }

}

function IsStart(arr){

  if(arr[0]==p_start[0]&&arr[1]==p_start[1])

    return true;

  return false;

}

function IsInTurn(arr){

  if(arr[0]>s_path[3][0]){

    if(arr[1]>s_path[3][1]){

        if(IsPass((arr[0]-1)+","+arr[1])||IsPass(arr[0]+","+(arr[1]-1)))

          return false;

    }

    else if(arr[1]<s_path[3][1]){

        if(IsPass((arr[0]-1)+","+arr[1])||IsPass(arr[0]+","+(arr[1]+1)))

          return false;

    }

  }

  else if(arr[0]<s_path[3][0]){

    if(arr[1]>s_path[3][1]){

        if(IsPass((arr[0]+1)+","+arr[1])||IsPass(arr[0]+","+(arr[1]-1)))

          return false;

    }

    else if(arr[1]<s_path[3][1]){

        if(IsPass((arr[0]+1)+","+arr[1])||IsPass(arr[0]+","+(arr[1]+1)))

          return false;

    }

  }

  return true;

}

function IsOutScreen(arr){

  if(arr[0]<0||arr[1]<0||arr[0]>(w-1)||arr[1]>(h-1))

    return true;

  return false;

}

function InOpen(arr){

  var bool=false;

  for(var i=0;i<openlist.length;i++){

    if(arr[0]==openlist[i][3][0]&&arr[1]==openlist[i][3][1]){

        bool=true;num=i;break;}

  }

  return bool;

}

function InClose(arr){

  var bool=false;

  for(var i=0;i<closelist.length;i++){

    if((arr[0]==closelist[i][3][0])&&(arr[1]==closelist[i][3][1])){

        bool=true;break;}

  }

  return bool;

}

function IsPass(pos){

  if((";"+n_path+";").indexOf(";"+pos+";")!=-1)

    return true;

  return false;

}

function Sort(arr){

  var temp;

  for(var i=0;i<arr.length;i++){

    if(arr.length==1)break;

    if(arr[i][0]<=arr[i+1][0]){

        temp=arr[i];

        arr[i]=arr[i+1];

        arr[i+1]=temp;

    }

    if((i+1)==(arr.length-1))

        break;

  }

}

function main(){

    GetF(GetRound(s_path[3]));

    Sort(openlist);

    s_path=openlist[openlist.length-1];

    closelist[closelist.length]=s_path;

    openlist[openlist.length-1]=null;

    if(openlist.length==0){alert("找不到路径");return;}

    openlist.length=openlist.length-1;

    if((s_path[3][0]==p_end[0])&&(s_path[3][1]==p_end[1])){

        getPath();

    }

    else{maptt.rows[s_path[3][1]].cells[s_path[3][0]].style.backgroundColor="#00ff00";setTimeout("main()",100);}

}

function getPath(){

  var str="";

  var t=closelist[closelist.length-1][4];

  while(1){

    str+=t.join(",")+";";

    maptt.rows[t[1]].cells[t[0]].style.backgroundColor="#ffff00";

    for(var i=0;i<closelist.length;i++){

        if(closelist[i][3][0]==t[0]&&closelist[i][3][1]==t[1])

          t=closelist[i][4];

    }

    if(t[0]==p_start[0]&&t[1]==p_start[1])

        break;

  }

  alert(str);

}

function setPos(){

  var h=(Math.abs(p_end[0]-p_start[0])+Math.abs(p_end[1]-p_start[1]))*gw;

  s_path=[h,0,h,p_start,p_start];

}

function set(id,arr){

  switch(id){

    case 1:

        p_start=arr;

        maptt.rows[arr[1]].cells[arr[0]].style.backgroundColor="#ff0000";break;

    case 2:

        p_end=arr;maptt.rows[arr[1]].cells[arr[0]].style.backgroundColor="#0000ff";break;

    case 3:

        n_path+=arr.join(",")+";";maptt.rows[arr[1]].cells[arr[0]].style.backgroundColor="#cccccc";break;

    default:

        break;

  }

}

function setflag(id){flag=id;}

</script>

<table id="maptt" cellspacing="1" cellpadding="0" border="0" bgcolor="#000000">

<script>

for(var i=0;i<h;i++){

  document.write("<tr>");

  for(var j=0;j<w;j++){

    document.write('<td onclick="set(flag,['+j+','+i+']);" bgcolor="#ffffff" width="20" height="20"></td>');

  }

  document.write("</tr>");

}

</script>

</table>

<a href="javascript:setflag(1);">设置起点</a><br>

<a href='javascript:setflag(2);'>设置终点</a><br>

<a href='javascript:setflag(3);'>设置障碍点</a><br>

<input type="button" onclick="setPos();main();this.disabled=true;" value="find">

</body>

</html>

android 铃声位置

lrenwang , 2011/02/08 13:56 , android , 评论(1) , 阅读(2181) , Via 本站原创
  来电铃声:在SD卡上任意位置创建新文件夹命名为"ringtones",把音频文件(MP3、wav、ogg等格式)扔进去。
      通知铃声:在SD卡上任意位置创建新文件夹命名为"notifications",把音频文件(MP3、wav、ogg等格式)扔进去。
      闹钟铃声:在SD卡上任意位置创建新文件夹命名为"alarms",把音频文件(MP3、wav、ogg等格式)扔进去。
然后重启一下机器,在设置里就能看到自己放进去的铃声了。


     附:系统自带铃声文件位置
      来电铃声:/system/media/audio/ringtones
      通知铃声:/system/media/audio/notifications
      闹钟铃声:/system/media/audio/alarms
      界面操作事件音:/system/media/audio/ui



前天,金山网络的一位同事向我咨询了一个问题:很多用户反映,网站上提供的Android手机应用程序文件“xxx.apk”,用IE浏览器下载,扩展名就被自动被重命名成了“xxx.zip”,拷贝到手机上无法安装。我发现,由于APK文件本身就是压缩包,如果用户的电脑上装了WinRAR(85%的装机量),用IE下载APK文件,扩展名就会被自动改为“.zip”。

  如果你的下载服务器为Nginx服务器,那么,在Nginx安装目录下的conf/mime.types文件的对应位置,加上以下一行语句,指定APK文件的MIME类型为 application/vnd.android.package-archive 即可:

application/vnd.android.package-archive apk;


转载 http://blog.s135.com/android_apk_zip/

我以前也遇到过xls格式变成xml, 道理应该是一样的


apache 修改 conf里面的 mime.types 这个文件
分页: 10/36 第一页 上页 5 6 7 8 9 10 11 12 13 14 下页 最后页 [ 显示模式: 摘要 | 列表 ]