2012年2月15日

摘要: #region 用户自定义变量 private static readonly Cache _cache;//缓存实例 private static readonly int hourfactor; #endregion #region 构造函数 static SetCache() { hourfactor = 3600; _cache = HttpRuntime.Cache; } private SetCache() { } #endregion #region 清除所有缓存 /// <summary> /// 清除所有缓存 /// </summary> public 阅读全文
posted @ 2012-02-15 14:27 xupeng 阅读(195) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 从1到33中任意选取不重复的6个随机数 /// </summary> /// <returns></returns> public List<int> GenerateNumber2() { //用于存放1到33这33个数 List<int> container = new List<int>(7); //用于保存返回结果 List<int> result = new List<int>(6); Random random = new Random() 阅读全文
posted @ 2012-02-15 14:25 xupeng 阅读(121) 评论(0) 推荐(0) 编辑
摘要: i = 5print (i)i = i + 1print (i)s = "This is the first sentence.\This is the second sentence."print (s)print ('-------------------')length = 5breadth = 2area = length * breadthprint ('Area is', area)print ('Perimeter is', 2 * (length + breadth))print ('--------- 阅读全文
posted @ 2012-02-15 11:53 xupeng 阅读(937) 评论(0) 推荐(0) 编辑
摘要: 批量替换MySQL指定字段中的字符串是数据库应用中很常见的需求,但是有很多初学者在遇到这种需求时,通常都是用脚本来实现;其实,MySQL内置的有批量替换语法,效率也会高很多批量替换的具体语法是:UPDATE 表名 SET指定字段 = replace(指定字段, ’要替换的字符串’, ’想要的字符串’)WHERE 条件;如果你想把 article 表中 ID 小于5000的记录,content 字段中“解决”替换成“解放”,那么语法就是:UPDATE article SETcontent = replace(content, ’解决’, ’解放’)WHERE ID<5000; 阅读全文
posted @ 2012-02-15 11:52 xupeng 阅读(200) 评论(0) 推荐(0) 编辑

导航