2013年11月30日 星期六

php -web counter


shell#>touch counter.txt

<?php 
session_start();
$fp=fopen("counter.txt","r+");
$counter=fgets($fp,80);
if(! isset($_SESSION['views'])) {
$_SESSION['views']=1;
$counter=doubleval ($counter)+1;
}
fseek($fp,0);
fputs($fp,$counter);
fclose($fp);
?>

<span><?echo $counter ?> </span>

2013年11月28日 星期四

mssql - show-create-table

mssql display structure display stru


SELECT * FROM syscolumns WHERE syscolumns.id =OBJECT_ID(N'[dbo].[myTable]')



foxpro getdao


para p_name
store 'VENDOR' TO P_NAME
CLOS DATA
set dele on
use result in 0
use gendao in 0
sele gendao
SET FILTER TO tableNAME=P_NAME
replace all ftype with 'BIG' FOR 'INT' $ FIELD1
REPLACE ALL FIELD1 WITH ALLT(FIELD1)
REPLACE ALL FIELD1 WITH STRTRAN(FIELD1,space(4),'')
replace ALL fieldname with  STRT(SUBS(FIELD1,AT('TABLE',FIELD1)+5),'(','') , ZTYPE WITH 'TABLE' for 'TABLE' $ FIELD1
replace all fieldname with allt(fieldname)
replace all fieldname with strt(allt(fieldname),chr(9),'')
replace ALL classname  with  proper(fieldname) for 'TABLE' $ FIELD1
replace all fieldname with  LEFT(FIELD1,AT(' ',FIELD1)),ZTYPE WITH 'FIELD'  for (not 'TABLE' $ FIELD1) and (not 'ENGINE' $ FIELD1)
replace all ZTYPE WITH 'ENGINE'  for  'ENGINE' $ FIELD1
*replace all zvariable with  lower(fieldname) for ztype='FIELD'
replace all zvariable with  lower(fieldname)
replace all varName with "seqNum" for zvariable='msg_seq_no'
replace all varName with t2v(zvariable) for (not zvariable='msg_seq_no')
replace ALL classname with upper(left(varName,1))+subs(varName,2)  for ztype='FIELD' or ztype='TABLE'
sele gendao
scan
do case
case aarray(field1,1,' ')='RECORDID'
replace fieldtype with "bigint(20) NOT NULL DEFAULT '0'"
other
if aarray(field1,2,' ')='C'
replace fieldtype with 'NVARCHAR('+aarray(field1,3,' ')+") DEFAULT ''"
endif
if aarray(field1,2,' ')='D'
replace fieldtype with 'DOUBLE DEFAULT 0'
endif
if aarray(field1,2,' ')='I'
replace fieldtype with 'INTEGER DEFAULT 0'
endif

if aarray(field1,2,' ')='F'
replace fieldtype with 'FLOAT DEFAULT 0'
endif
endcase
Endscan

select result
locate for name=p_name
if not found()
insert into result (name) value (p_name)
endif
store  createtable() to _r
replace in result createtab with _r
sele result
brow
sele gendao
set filter to
*brow field field1:30,tablename:30,fieldname:30,classname:30, varname:30,fieldtype:30
function createtable()
r= ''
select gendao
_delimiter=''
quota='"'
quota2="+"
scan
if ztype='TABLE'
r=r+quota+"create table "+allt(tablename) +' ( '+quota+quota2+chr(13)
else
r=r +quota+ _delimiter+allt(fieldname)+' '+ALLT(fieldtype)+quota+quota2+chr(13)
_delimiter=','
endif
endscan
r=r+quota+','+ "PRIMARY KEY (`RECORDID`)"+quota+quota2
r=r+quota+');'+quota+";"+chr(13)
return r

function t2v()
para p_1
for i=0 to 25
p_1=strt(p_1,'_'+chr(97+i),chr(65+i))
endfor
r=p_1
return r

2013年11月27日 星期三

install cvsd server


inf : http://mazanatti.info/archives/67/


Step 1
shell #vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 4.4.4.4
~
`
shell # apt-get install cvsd







 ┌──────────────────────────────────────────────────────┤ Configuring cvsd ├ │ The whole idea of cvsd is to serve repositories. Specify a colon ':' separated list of repositories to serve. The location of  │ │ these repositories is relative to the specified chroot jail (/var/lib/cvsd) and should start with a '/'.                       │ │                                                                                                                                │ │ The repositories here should be initialized by hand with something like 'cvs -d /var/lib/cvsd/myrepos init' after which        │ │ passwords can be set with 'cvsd-passwd /var/lib/cvsd/myrepos anonymous'. See the file /usr/share/doc/cvsd/README.gz for        │ │ details on creating repositories.                                                                                              │ │                                                                                                                                │ │ Repositories to serve:                                                                                                         │ │                                                                                                                                │ │ /demo:/myrepos________________________________________________________________________________________________________________ │ │                                                                                                                                │ │                                     <Ok>                                         <Cancel>                                      │ │                                                                                                                                │ └──────────────────────────────────────────────────────────────────




Quick guide: installing CVS Server on Ubuntu 11.04



  • 1. Install required packages

    sudo apt-get install cvsd

  • 2. Adjust daemon parameters


    Open the configuration file:
    sudo vi /etc/cvsd/cvsd.conf
    Most likely, you gonna need to change these lines:
    # This is to avoid the "address already in use" error when starting cvsd:
    Listen 0.0.0.0 2401
     
    # You may want to change the root folder where your repositories will be created:
    RootJail /var/lib/cvsd
     
    # Go to the end of the file, and enter lines like these, one for each repository you need:
    Repos /project1
    ...
    Save the file and exit the editor.


  • 3. Create and initialize repositories

    sudo mkdir /var/lib/cvsd/project1
    sudo cvs -d /var/lib/cvsd/project1 init

  • 4. Change root folder owner to cvsd

    sudo chown cvsd:cvsd /var/lib/cvsd -R

  • 5. Create repository users

    sudo cvsd-passwd /var/lib/cvsd/project1/ john
    sudo cvsd-passwd /var/lib/cvsd/project1/ mary

  • 6. Fire up (or restart) the daemon

    sudo /etc/init.d/cvsd restart
    Check for errors at /var/log/syslog (you can change this setting at cvsd.conf). If something is wrong, check the message and correct it - probably, something related to network or file permission...


  • 7. Create a reference to the repository and use it!


    Open a terminal, and enter the following commands:
    export CVSROOT=:pserver:fabio@localhost:2401/project1
     
    cvs login
    ...
    cvs logout
    I like to use these commands to test the environment, but you can go ahead and configure your preferred CVS GUI client.


  • Cheers!



install tomcat on windows


inf : http://tomcat.apache.org/download-80.cgi

32-bit/64-bit Windows Service Installer  <== click this

2013年11月26日 星期二

javascript-messagebox-dialog-box


jquery


<div id="dialog" title="Messagebox">
  <p>...</p>
</div>
<script>
  $(function() {
$( "#dialog" ).dialog({ autoOpen: false });
  });
</script>


s=_lookup("oldPassword");

s0='<%=bean.getPassword().trim()%>';
if (s != s0){
$("#dialog").dialog( "open" );
$("#dialog").dialog('option', 'title', 'Password Message');
$("#dialog p").html(" Old password not Match");
return false;
}
s1=_lookup("newPassword").trim();
s2=_lookup("confirmPassword").trim();
s3=<%=bean.getRecordid().trim()%>;