C#的时间正则表达式
[
2008/06/26 11:40 | by Else ]
2008/06/26 11:40 | by Else ]
[codes=C#]
///
public string timeformat(string timestr)
{
timestr = timestr.Trim();
if (Regex.IsMatch(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$"))
{
//this.Nodate = true;
return Regex.Replace(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$", "$1-$2-$3", RegexOptions.None);
}
else
{
// this.Nodate = false;
return timestr;
}
}[/codes]
///
public string timeformat(string timestr)
{
timestr = timestr.Trim();
if (Regex.IsMatch(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$"))
{
//this.Nodate = true;
return Regex.Replace(timestr, @"^(\d{4})\D*(\d{2})\D*(\d{2})$", "$1-$2-$3", RegexOptions.None);
}
else
{
// this.Nodate = false;
return timestr;
}
}[/codes]
php-et 分页的类写好了
[
2008/06/23 22:21 | by Else ]
2008/06/23 22:21 | by Else ]
哈哈,慢慢的完成,要是当时写成这样子的话,我写在做网站的速度应该会快很多,今天玩成了很多,注册了园子,然后问的问题,解决,接着完成这个类,然后在改代码!
现在是升级,网站这样写的快多了!
代码还在不断的完成中!原来的cuku.net的程序,现在在改成这样的! 目前cuku.php这个类的话叫1.0好了!
好了,先这样了,目前还没有什么代码要封装了!
现在是升级,网站这样写的快多了!
代码还在不断的完成中!原来的cuku.net的程序,现在在改成这样的! 目前cuku.php这个类的话叫1.0好了!
好了,先这样了,目前还没有什么代码要封装了!
Excel to DataGridView using excel 2007
[
2008/06/20 17:14 | by Else ]
2008/06/20 17:14 | by Else ]
object oMissing = Missing.Value;
Microsoft.Office.Interop.Excel.Application ExcelObj =
new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook WBook;
Microsoft.Office.Interop.Excel.Worksheet WSheet;
Microsoft.Office.Interop.Excel.Range Selection;
WBook = ExcelObj.Workbooks.Open(@"c:\test\1.xlsx",
oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing);
[codes=C#] private void btn_select_Click(object sender, EventArgs e)
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Filter = "All files (*.xls)|*.xls|All files (*.xls)|*.xls";
fdlg.FilterIndex = 2;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txt_file_path.Text = fdlg.FileName;
}
}[/codes]
{
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Filter = "All files (*.xls)|*.xls|All files (*.xls)|*.xls";
fdlg.FilterIndex = 2;
if (fdlg.ShowDialog() == DialogResult.OK)
{
txt_file_path.Text = fdlg.FileName;
}
}[/codes]
这个是目前用cookie做的,之前听说php4对cookie的支持不好之类的话,没有试过,但是现在认为,没有必要为php4而限制代码
现在这个是用一个cookie来保存这些投票
[codes=php]if (!isset($_COOKIE['time_report']))
{
$_COOKIE['time_report']=array();
}
foreach ($_COOKIE["time_report"] as $upid)
{
if ($upid==$_POST['up'])
{
die("你已投过票了");
}
}
setcookie("time_report[".$_POST['up']."]",$_POST['up'],time()+3600);
$db->query(sprintf("UPDATE ck_comment set zc=zc+1 where id=%d",$_POST['up']));
$sql=sprintf("select zc from ck_comment where id=%d",$_POST['up']);
$rs=$db->rows($sql);
echo $rs['zc'];[/codes]
现在这个是用一个cookie来保存这些投票
[codes=php]if (!isset($_COOKIE['time_report']))
{
$_COOKIE['time_report']=array();
}
foreach ($_COOKIE["time_report"] as $upid)
{
if ($upid==$_POST['up'])
{
die("你已投过票了");
}
}
setcookie("time_report[".$_POST['up']."]",$_POST['up'],time()+3600);
$db->query(sprintf("UPDATE ck_comment set zc=zc+1 where id=%d",$_POST['up']));
$sql=sprintf("select zc from ck_comment where id=%d",$_POST['up']);
$rs=$db->rows($sql);
echo $rs['zc'];[/codes]
php cookie
[
2008/06/10 11:07 | by Else ]
2008/06/10 11:07 | by Else ]
昨天晚上到现在的一个测试
代码通过测试
[codes=php]// 设定 cookie
for ($i = 0; $i < 10; $i++) {
$time[$i] = time();
setcookie("time_report[$i]",$time[$i], $time[$i]+3600*$i);
}
print_r($_COOKIE["time_report"]);
?>
echo $_COOKIE["time_report"][2];
?>
echo $_COOKIE["time_report[2]"];//这个是错误的
?> [/codes]
代码通过测试
[codes=php]// 设定 cookie
for ($i = 0; $i < 10; $i++) {
$time[$i] = time();
setcookie("time_report[$i]",$time[$i], $time[$i]+3600*$i);
}
print_r($_COOKIE["time_report"]);
?>
echo $_COOKIE["time_report"][2];
?>
echo $_COOKIE["time_report[2]"];//这个是错误的
?> [/codes]
一、打开CD-ROM
mciSendString("Set cdAudio door open wait",NULL,0,NULL);
二、关闭CD_ROM
mciSendString("Set cdAudio door closed wait",NULL,0,NULL);
三、关闭计算机
OSVERSIONINFO OsVersionInfo; //包含操作系统版本信息的数据结构
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&OsVersionInfo); //获取操作系统版本信息
if(OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
//Windows98,调用ExitWindowsEx()函数重新启动计算机
DWORD dwReserved;
ExitWindowsEx(EWX_REBOOT,dwReserved); //可以改变第一个参数,实现注销用户、
//关机、关闭电源等操作
// 退出前的一些处理程序
}
mciSendString("Set cdAudio door open wait",NULL,0,NULL);
二、关闭CD_ROM
mciSendString("Set cdAudio door closed wait",NULL,0,NULL);
三、关闭计算机
OSVERSIONINFO OsVersionInfo; //包含操作系统版本信息的数据结构
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&OsVersionInfo); //获取操作系统版本信息
if(OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
//Windows98,调用ExitWindowsEx()函数重新启动计算机
DWORD dwReserved;
ExitWindowsEx(EWX_REBOOT,dwReserved); //可以改变第一个参数,实现注销用户、
//关机、关闭电源等操作
// 退出前的一些处理程序
}
算法大全(C,C++)
[
2008/05/30 14:17 | by Else ]
2008/05/30 14:17 | by Else ]
一、 数论算法
1.求两数的最大公约数
2.求两数的最小公倍数
3.素数的求法
A.小范围内判断一个数是否为质数:
1.求两数的最大公约数
function gcd(a,b:integer):integer;
begin
if b=0 then gcd:=a
else gcd:=gcd (b,a mod b);
end ;
begin
if b=0 then gcd:=a
else gcd:=gcd (b,a mod b);
end ;
2.求两数的最小公倍数
function lcm(a,b:integer):integer;
begin
if a<b then swap(a,b);
lcm:=a;
while lcm mod b>0 do inc(lcm,a);
end;
begin
if a<b then swap(a,b);
lcm:=a;
while lcm mod b>0 do inc(lcm,a);
end;
3.素数的求法
A.小范围内判断一个数是否为质数:
function prime (n: integer): Boolean;
var I: integer;
begin
for I:=2 to trunc(sqrt(n)) do
if n mod I=0 then begin
prime:=false; exit;
end;
prime:=true;
end;
var I: integer;
begin
for I:=2 to trunc(sqrt(n)) do
if n mod I=0 then begin
prime:=false; exit;
end;
prime:=true;
end;
Ajax应用实例: asp+mdb数据库注册模块例子
[
2008/05/27 20:05 | by Else ]
2008/05/27 20:05 | by Else ]
這個是最新的下載地址
到時候換個php的
文件下载地址
http://www.uushare.com/user/cukunet/file/877278
到時候換個php的
文件下载地址
http://www.uushare.com/user/cukunet/file/877278
OleDbType 枚举
[
2008/05/26 14:32 | by Else ]
2008/05/26 14:32 | by Else ]














