2009年10月13日

mysql 常用语句

摘要: 1.添加用户GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;flush privileges; 2.远程连接use mysql; update user set host='%' where user='root';3. mysql -u root mysql mysql>... 阅读全文

posted @ 2009-10-13 15:27 alon 阅读(156) 评论(0) 推荐(0) 编辑

MSSQL 日期转换参数

摘要: --日期转换参数,值得收藏select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')20040912110608select CONVERT(varchar(12)... 阅读全文

posted @ 2009-10-13 11:53 alon 阅读(187) 评论(0) 推荐(0) 编辑

Hashtable快速查找的方法

摘要: 一般来说我们都是用 Hashtable 的 ContainsKey 方法来查找 Hashtable 中是否存在某个键值然后读取他,但是这个方法并不是效率最好的方法。比较好的方法是直接读取键值然后判断这个对象是否为 null 然后读取。两种代码分别如下:以下为引用的内容:一般慢速的方法:if (objHash.ContainsKey(keyValue)) { strValue=(String)ob... 阅读全文

posted @ 2009-10-13 11:51 alon 阅读(252) 评论(0) 推荐(0) 编辑

Hashtable的遍历

摘要: 两种方法:1.DictionaryEntryforeach( DictionaryEntry de in hashTable) { console.WriteLine("Key -- {0}; Value --{1}.", de.Key, de.Value); } 2.IDictionaryEnumeratorHashtable food = new Hashtable();IDictionary... 阅读全文

posted @ 2009-10-13 11:47 alon 阅读(151) 评论(0) 推荐(0) 编辑

字符串中查找字符串的算法(常规方法)

摘要: #include <stdio.h>int strlen2(char *str){ for(i=0; str[i]!='\0'; i++) //使用循环来计算长度 return i;}//在字符串中寻找子字符int strindex(char *str,char *substr){ int end,i,j; end = strlen2(str)-strlen2(substr); if ... 阅读全文

posted @ 2009-10-13 11:38 alon 阅读(489) 评论(0) 推荐(0) 编辑

利用Curl、socket POST数据

摘要: <?php/** * Socket版本* 使用方法:* $post_string = "app=socket&version=beta";* request_by_socket('facebook.cn','/restServer.php',$post_string);*/functionrequest_by_socket($remote_server,$remote_path,$p... 阅读全文

posted @ 2009-10-13 11:34 alon 阅读(604) 评论(0) 推荐(0) 编辑

静态页htm传参数

摘要: //从转向过来的URL中截取参数 开始function SplitUrl(key){var fstr=key;var getstr='';var url=document.URL.toString();url=url.toLowerCase();//转为小写var loc=url.indexOf(fstr);if(loc>0){getstr=url.substring(loc+fstr.le... 阅读全文

posted @ 2009-10-13 11:31 alon 阅读(171) 评论(0) 推荐(0) 编辑

用JS得到上一页表单提交过来的信息

摘要: <script>function get(p){//var url=location.search;var url="http://www.163.com/?time=2&tid=10&id=3";var tmpStr=p+"=";var tmp_reg=eval("/[\?&]"+tmpStr+"/i");if(url.search(tmp_reg)==-1)... 阅读全文

posted @ 2009-10-13 11:29 alon 阅读(307) 评论(0) 推荐(0) 编辑

SortedList实现排序

摘要: SortedList类默认是升序的,要改成降序要怎么改呢?通过实现IComparer: public class ReverserSort : IComparer<string> { private bool Asc=true; int IComparer<KeyValueItem>.Compare(string x,string y) { if (Asc) return ... 阅读全文

posted @ 2009-10-13 11:26 alon 阅读(655) 评论(0) 推荐(1) 编辑

关于SQL替换字段文字的命令

摘要: 字段不超过8000的话可以这样: update 表名 set 字段名=replace(convert(varchar(8000),字段名),'要替换的','替换为的') 阅读全文

posted @ 2009-10-13 11:22 alon 阅读(321) 评论(0) 推荐(0) 编辑

导航