2012年5月11日
摘要: function BinarySearch($array,$findVal,$left,$right){ if($right>$left){ echo "找不到"; return; } $middle=round(($left+$right)/2); if($findVal>$array[$middle]){ BinarySearch($array,$findVal,$middle+1,$right); } else if($findVal<$array[$middle]){ BinarySearch(#array,$findVal,$left,$midd 阅读全文
posted @ 2012-05-11 15:32 捣乃忒 阅读(118) 评论(0) 推荐(0) 编辑
摘要: function QuickSort($left,$right,&$array){ $l=$left; $right=$right; $pos=$array[($left+right)/2]; while($l<$r){ while($array[$l]<$pos) $l++; while($array[$r]>$pos) $r--; if($l>=$r) break; $temp=$array[$l]; $array[$l]=$array[$r]; $array[$r]=$temp; if($array[$l]==$pos) --$r... 阅读全文
posted @ 2012-05-11 15:26 捣乃忒 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 1 function InsertSort(&$array){ 2 3 for($i=1;$i<count($array);$i++){ 4 5 $insertVal=$array[$i]; 6 $insertIndex=$i-1; 7 while($insertIndex>=0&&insertVal<$array[$insertIndex]){ 8 9 //后移10 $array[$insertIndex+1]=$array[$insertIndex];11 $insertIndex--;12 }13 /... 阅读全文
posted @ 2012-05-11 15:19 捣乃忒 阅读(159) 评论(0) 推荐(0) 编辑
摘要: function SelectSort(&$array){ for($i=0;$i<count($array)-1;$i++){ $minVal=$array[$i]; $minIndex=$i; for($j=0;$j<count($array);$j++){ if($minVal>$array[$j]){ $minVal=$array[$j]; $minIndex=$j; } } $temp=$array[$i]; $array[$i]=$array[$minIndex]; $array[$minI... 阅读全文
posted @ 2012-05-11 15:14 捣乃忒 阅读(120) 评论(0) 推荐(0) 编辑
摘要: function BubbleSort(&$array){ for($i=0;$i<count($array)-1;$i++){ for($j=0;$j<count($array)-1-$i;$j++){ if($array[$j]>$array[$j+1]){ $temp=$array[$j]; $array[$j]=$array[$j+1]; $array[$j+1]=$temp; } } }} 阅读全文
posted @ 2012-05-11 15:09 捣乃忒 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 方案一:通过端口来区分不同的站点 在httpd.conf文件中让apache监听不同的端口方案二:通过ServerName端来区分域名 配置http-vhosts.conf文件 <VirtualHost *:80> #指定域名 ServerName 域名 ... </VirtualHost> 阅读全文
posted @ 2012-05-11 14:58 捣乃忒 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 配置apache的config目录下的httpd.conf文件1.让apache载入php处理模块LoadModule php5_module `php安装路劲/php5apache2_2.dll2.指定php的ini文件PHPIndir "`PHP安装路径"3配置资源类型AddType application/x_httpd_php .php .phtml4.将php.ini_development改成php.ini5.在php.ini中指定php的扩展库路径extention_dir="`php路径/ext" 阅读全文
posted @ 2012-05-11 14:55 捣乃忒 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1.启用httpd-vhosts.conf在httpd.config文件中打开#Virtual hosts节点2.在httpd-vhosts.conf文件中配置<VirtualHost 127.0.0.1:80> DocumentRoot "网站路径" DirectoryIndex 欢迎页面 <Directory> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory></VirtualHost>3.修改hos 阅读全文
posted @ 2012-05-11 14:49 捣乃忒 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1.添加虚拟目录节点(httpd.conf)<IfModule dir_module> DirectoryIndex index.html index.htm index.php Alias /站点别名 --"路径" <Directory 路径> order allow,deny --配置访问权限 Allow from all </Directory></IfModule>2.注销documentroot路径#DocumentRoot ...3.测试浏览器中输入:http://locahost/路径/页面4.设置首页Direc 阅读全文
posted @ 2012-05-11 14:44 捣乃忒 阅读(116) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 利用com组件读取excel文件 3 /// </summary> 4 /// <param name="fileName">文件路径</param> 5 /// <returns></returns> 6 private System.Data.DataTable ExcelToDataSet(string fileName) 7 { 8 //创建Excel对象 9 M... 阅读全文
posted @ 2012-05-11 14:29 捣乃忒 阅读(170) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 使用OLEDB对excel文件进行读取,将Excel文件作为数据源 3 /// </summary> 4 /// <param name="p"></param> 5 /// <returns></returns> 6 private DataSet ExcelToDataSet(string fileName) 7 { 8 //定义连接字符串 9 string strC... 阅读全文
posted @ 2012-05-11 14:26 捣乃忒 阅读(144) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 截图 3 /// </summary> 4 /// <param name="sender"></param> 5 /// <param name="e"></param> 6 private void btnCut_Click(object sender, EventArgs e) 7 { 8 //判断是否在播放 9 if (!isPlay)10 ... 阅读全文
posted @ 2012-05-11 14:23 捣乃忒 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: /** 基本思路:本字符串共20位,采用14位数字+6位字母组合* 数字部分:系统当前时间* 字母部分:26个英文字母* 随即组合:字母随即插入数字部分*/View Code 1 private static string CreateString() 2 { 3 string[] words = new string[] { "A","B","C","D","E","F","G","H","I","J&q 阅读全文
posted @ 2012-05-11 14:18 捣乃忒 阅读(254) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 计算相差天数 3 /// </summary> 4 /// <param name="date1"></param> 5 /// <param name="date2"></param> 6 /// <returns></returns> 7 private static int DaysBetweenTwoDate(string date1, string date2) 8 { 9 ... 阅读全文
posted @ 2012-05-11 14:14 捣乃忒 阅读(198) 评论(0) 推荐(0) 编辑
摘要: ///------------灰度图处理计算方法--------------/////------浮点算法:Gray=R*0.3+G*0.59+B*0.11----/////------整数方法:Gray=(R*30+G*59+B*11)/100---/////------移位方法:Gray =(R*28+G*151+B*77)>>8--/////------平均值法:Gray=(R+G+B)/3------------/////------仅取绿色:Gray=G----------------------//View Code 1 /// <summary> 2 .. 阅读全文
posted @ 2012-05-11 14:13 捣乃忒 阅读(199) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 计算余弦函数值 3 /// sinx的平方+cos的平方=1 4 /// </summary> 5 /// <param name="number"></param> 6 /// <returns></returns> 7 private static double Cos(double number) 8 { 9 //误差 10 dou... 阅读全文
posted @ 2012-05-11 14:10 捣乃忒 阅读(215) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 遍历对应磁盘中所有文本文件 3 /// </summary> 4 /// <param name="di">要遍历的目录</param> 5 /// <param name="fileType">文件类型</param> 6 private void SearchFiles(DirectoryInfo di,string fileType) 7 { 8 try 9 {10 ... 阅读全文
posted @ 2012-05-11 14:07 捣乃忒 阅读(199) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 蛮力法实现字符串匹配 3 /// </summary> 4 /// <param name="longStr"></param> 5 /// <param name="shortStr"></param> 6 /// <returns></returns> 7 private static bool IsContains(string longStr, string shortStr) 8 { 9 阅读全文
posted @ 2012-05-11 14:01 捣乃忒 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1.变量定义View Code 1 //源字符串2 private static string old = string.Empty;3 //被替换的字符串4 private static string replace = string.Empty;5 //替换成的字符串6 private static string newStr = string.Empty;2.替换方法View Code 1 /// <summary> 2 /// 字符串替换 3 ... 阅读全文
posted @ 2012-05-11 13:59 捣乃忒 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1.变量定义View Code 1 //大写数字2 private static String[] LargeNumber = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾" };3 //金额单位4 private static String[] MoneyUnit = { "元", " 阅读全文
posted @ 2012-05-11 13:56 捣乃忒 阅读(304) 评论(0) 推荐(0) 编辑