博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 32 下一页

2013年2月19日

摘要: PHP 对客户端输入进行输入转义// 对 用户提交的数据 ' " \ 进行转义if ( get_magic_quotes_gpc() ){ function del_magic_quotes($value) { $value = is_array($value) ? array_map('del_magic_quotes', $value) : stripslashes($value); return $value; } $_POST = del_magic_quotes( $_POST ); $_GET = del_m... 阅读全文

posted @ 2013-02-19 18:31 PHP-张工 阅读(451) 评论(0) 推荐(0)

2012年11月2日

摘要: 生成不重复随机字符串生成1000000个用时不到1秒。如果要生成6位随机的不重复字符串,一般的想法是,使用Random生一个字符串,记录到数组中,再生成一个如果不在数组中则插入。直到生够数量。但这样效率会很低。对于6位随机字符,数字+字母=36个字符。6位转化为数字最大数为 36的6次方 = 2176782336。只要生成小于最大数的随机数,再转化为字符串即可。我的做法是,用最大数除以要生成的个数。得到一个递增值X。第一个随机数在0-X之间。第二个在X-X*2之间。之后以此类推,这样将避免了可能生成的随机数重复。然后再将随机数转化为指定长度的字符串。但这样生成的字符串数组会是顺序的。所以再打乱 阅读全文

posted @ 2012-11-02 21:00 PHP-张工 阅读(15730) 评论(1) 推荐(1)

2012年10月16日

摘要: .NET Framework.NET版本1.01.12.03.03.54.04.5完整版本1.0.3705.01.1.4322.5732.0.50727.423.0.4506.303.5.21022.84.0.30319.14.5.40805发布时间2002-02-132003-04-242005-11-072006-11-062007-11-192010-04-122012-05-24VS开发版本VS2002VS2003VS2005VS2008VS2010VS2012Windows默认安装Windows Server 2003Windows Server 2003 Windows Serv. 阅读全文

posted @ 2012-10-16 17:47 PHP-张工 阅读(2612) 评论(1) 推荐(0)

2012年9月21日

摘要: public class MyLog{ public static void WriteLog(string error) { WriteLog(error, null); } public static void WriteLog(string error, Exception ex) { string dir = Application.StartupPath + "\\LOG"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } error = DateTime.Now.ToString() 阅读全文

posted @ 2012-09-21 16:37 PHP-张工 阅读(2698) 评论(0) 推荐(0)

2012年9月18日

摘要: #region INI 读取写入[DllImport("kernel32")]private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);[DllImport("kernel32")]private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retV 阅读全文

posted @ 2012-09-18 13:35 PHP-张工 阅读(664) 评论(0) 推荐(0)

2012年9月7日

摘要: /// <summary>/// 拷贝文件夹/// </summary>private static void CopyFolder(string from, string to){ if (!to.EndsWith("\\")) { to += "\\"; } if (!Directory.Exists(to)) Directory.CreateDirectory(to); // 子文件夹 foreach (string sub in Directory.GetDirectories(from)) CopyFolder(sub 阅读全文

posted @ 2012-09-07 17:57 PHP-张工 阅读(533) 评论(0) 推荐(0)

摘要: echo windows 服务批处理echo 安装服务%SystemRoot%\system32\SC CREATE mySrv binPath= "%cd%\mySrv.exe" start= auto displayname= "mySrv Service"echo 设置备注%SystemRoot%\system32\SC description mySrv "我的服务"echo 允许服务与桌面交互%SystemRoot%\system32\SC CONFIGmySrvtype= interact type= ownecho 启动 阅读全文

posted @ 2012-09-07 17:15 PHP-张工 阅读(1113) 评论(0) 推荐(0)

2012年7月10日

摘要: C# 执行bat批处理文件private void RunBat(string batPath){Process pro = new Process();FileInfo file = new FileInfo(batPath);pro.StartInfo.WorkingDirectory = file.Directory.FullName;pro.StartInfo.FileName = batPath;pro.StartInfo.CreateNoWindow = false;pro.Start();pro.WaitForExit();} 阅读全文

posted @ 2012-07-10 20:48 PHP-张工 阅读(14138) 评论(0) 推荐(1)

2012年6月29日

摘要: win2003 序列号备忘FJ8DH-TQPYG-9KFHQ-88CB2-Y7V3Y来源:http://www.jb51.net/os/windows/Win2003/24190.htmlFlex Builder 4 正式版 序列号 注册码1424-4118-1138-0912-4001-72221424-4012-2754-1802-2619-89281424-4766-4350-7925-0705-3050来源:http://hi.baidu.com/zjfree/blog/item/e7f382cbae3522f153664f40.html 阅读全文

posted @ 2012-06-29 15:28 PHP-张工 阅读(523) 评论(0) 推荐(0)

2012年6月26日

摘要: Spring.net 获取SQL连接字符串Spring.Context.IApplicationContext ctx = Spring.Context.Support.ContextRegistry.GetContext();IBatisNet.DataMapper.SqlMapper sqlMap = (IBatisNet.DataMapper.SqlMapper)ctx.GetObject("sqlMap");string conString = sqlMap.DataSource.ConnectionString;using (System.Data.SqlClie 阅读全文

posted @ 2012-06-26 16:03 PHP-张工 阅读(834) 评论(0) 推荐(0)

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 32 下一页