| micheal 的个人资料游之晶莹日志列表网络 | 帮助 |
|
游之晶莹空间关闭,请访问我的BLOG:http://michealyou.yculblog.com 9月9日 Visual Basic程序 数学问题1.判断奇数\偶数 Function IsEven(num as Integer) as Boolean IsEven=if(num mod 2=0,True,False) '偶数返回True,奇数返回False end Function 2.判断一个数是不是素数 Function IsPrime(num as Integer) as Boolean '素数和1返回False,负数\合数和0返回True Dim i as Integer,sqr_num=sqr(num) If num<1 Then IsPrime=True ElseIf num=1 Then IsPrime=False Else For i=2 To sqr_num If num mod i=0 Then IsPrime=True Exit For End If IsPrime=False End If end Function 3.求最小公倍数 Function ComMul_min(num1 as Integer,num2 as Integer) as Integer dim i as integer If num1<num2 Then i=num1:num1=num2:num2=i i=num1 do if i mod num2=0 then ComMui_min=i i=i+num1 loop End Function 4.求最大公约数 算法一: Function ComDiv_max(num1 as Integer,num2 as Integer) as Integer dim i as integer If num1<num2 Then i=num1:num1=num2:num2=i i=num2 do if num1 maod i=0 and num2 mod i=0 then ComDiv_max=i i=i-1 loop End Function 算法二: 辗转相除法(暂空) 6.验证哥德巴赫猜想 返回值为一结构 Type Prime num1 as integer num2 as integer End Type 下面的程序去掉了验证参数的步骤(即假设参数已经是大于2的偶数),而且用到了前面判断素数的程序 Function GDBH(num as integer) as Prime Dim n as Prime,i as integer For i=2 to num/2 If not(IsPrime(i) and IsPrime(num-i)) Then n.num1=i:n.num2=num-i Exit For End If Next GDBH=n End Function 直接生成XML的Google SiteMap代码[ASP版本]ASP版本,需要空间的FSO支持
使用方法就不说了 <% Server.ScriptTimeout=50000 ' sitemap_gen.asp ' A simple script to automatically produce sitemaps for a webserver, in the Google Sitemap Protocol (GSP) ' by Francesco Passantino ' www.iteam5.net/francesco/sitemap ' v0.2 released 5 june 2005 (Listing a directory tree recursively improvement) ' ' BSD 2.0 license, ' http://www.opensource.org/licenses/bsd-license.php ' 收集整理: 重庆森林@im286.com session("server")="http://192.168.0.111" '你的域名 vDir = "/" '制作SiteMap的目录,相对目录(相对于根目录而言) set objfso = CreateObject("Scripting.FileSystemObject") root = Server.MapPath(vDir) 'response.ContentType = "text/xml" 'response.write "<?xml version='1.0' encoding='UTF-8'?>" 'response.write "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>" str = "<?xml version='1.0' encoding='UTF-8'?>" & vbcrlf str = str & "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>" & vbcrlf Set objFolder = objFSO.GetFolder(root) 'response.write getfilelink(objFolder.Path,objFolder.dateLastModified) Set colFiles = objFolder.Files For Each objFile In colFiles 'response.write getfilelink(objFile.Path,objfile.dateLastModified) str = str & getfilelink(objFile.Path,objfile.dateLastModified) & vbcrlf Next ShowSubFolders(objFolder) 'response.write "</urlset>" str = str & "</urlset>" & vbcrlf set fso = nothing Set objStream = Server.CreateObject("ADODB.Stream") With objStream '.Type = adTypeText '.Mode = adModeReadWrite .Open .Charset = "utf-8" .Position = objStream.Size .WriteText=str .SaveToFile server.mappath("/sitemap.xml"),2 '生成的XML文件名 .Close End With Set objStream = Nothing If Not Err Then Response.Write("<script>alert('成功生成站点地图!');history.back();</script>") Response.End End If Sub ShowSubFolders(objFolder) Set colFolders = objFolder.SubFolders For Each objSubFolder In colFolders if folderpermission(objSubFolder.Path) then 'response.write getfilelink(objSubFolder.Path,objSubFolder.dateLastModified) str = str & getfilelink(objSubFolder.Path,objSubFolder.dateLastModified) & vbcrlf Set colFiles = objSubFolder.Files For Each objFile In colFiles 'response.write getfilelink(objFile.Path,objFile.dateLastModified) str = str & getfilelink(objFile.Path,objFile.dateLastModified) & vbcrlf Next ShowSubFolders(objSubFolder) end if Next End Sub Function getfilelink(file,datafile) file=replace(file,root,"") file=replace(file,"\","/") If FileExtensionIsBad(file) then Exit Function if month(datafile)<10 then filedatem="0" if day(datafile)<10 then filedated="0" filedate=year(datafile)&"-"&filedatem&month(datafile)&"-"&filedated&day(datafile) getfilelink = "<url><loc>"&server.htmlencode(session("server")&vDir&file)&"</loc><lastmod>"&filedate&"</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url>" Response.Flush End Function Function Folderpermission(pathName) '需要过滤的目录(不列在SiteMap里面) PathExclusion=Array("\temp","\_vti_cnf","_vti_pvt","_vti_log","cgi-bin","\admin","\edu") Folderpermission =True for each PathExcluded in PathExclusion if instr(ucase(pathName),ucase(PathExcluded))>0 then Folderpermission = False exit for end if next End Function Function FileExtensionIsBad(sFileName) Dim sFileExtension, bFileExtensionIsValid, sFileExt 'modify for your file extension (http://www.googleguide.com/file_type.html) Extensions = Array("png","gif","jpg","jpeg","zip","pdf","ps","html","htm","php","wk1","wk2","wk3","wk4","wk5","wki","wks","wku","lwp","mw","xls","ppt","doc","swf","wks","wps","wdb","wri","rtf","ans","txt") '设置列表的文件名,扩展名不在其中的话SiteMap则不会收录该扩展名的文件 if len(trim(sFileName)) = 0 then FileExtensionIsBad = true Exit Function end if sFileExtension = right(sFileName, len(sFileName) - instrrev(sFileName, ".")) bFileExtensionIsValid = false 'assume extension is bad for each sFileExt in extensions if ucase(sFileExt) = ucase(sFileExtension) then bFileExtensionIsValid = True exit for end if next FileExtensionIsBad = not bFileExtensionIsValid End Function %> 几个bat例子文件下面几个bat文件示例,希望对你有点用处,根据需要自己修改一下再使用。
删除默认共享(别存为bat文件放在开始菜单中):net_share_delete.bat,删除默认共享的另一个种方法
登陆到局域网的机器快捷方式(对方机器有密码且为2000或以上系统)nethood.bat
批处理中的循环newfolder.bat
删除临时文件夹中的文件(window 2000或以上操作系统) del_tempfile.bat
解决IE无法在新窗口中打开链接的问题,关闭所有的ie窗口,运行下面内容的bat iedll.bat
重命名从IE临时文件夹中拷贝的文件 renameIEtempfile.bat(从Temporary Internet Files复制过来的文件都会在文件名上加上[1]或者[n],用此bat文件可以很快的给他们改名)
在Windows 2000/XP 下巧拒强行关机 从去年8月到现在,冲击波和震荡波让无数人的爱机无数次重启,折腾得要命。当然现在有了补丁,有了专杀工具,它们的威力已大大减弱。但还是常有一些人
遭受它们的毒害,由于重启不得不关闭看得正好的电影,中止运行处于关键阶段的程序,因而丢失重要的数据,让人痛恨不已!那么能不能阻止由冲击波和震荡波引
起的强制重启,先做完重要的工作,然后再去收拾这两个家伙呢? 为找到答案,我们有必要先了解一下WINDOWS XP的关机。Windows XP系统通过一个名为Shutdown.exe的程序来完成关机操作(位置在Windows\System下),一般情况下XP的关机是由关机程序 shutdown.exe来实现的,关机的时候调用shutdown.exe。由此可知要阻止强行关机就是要取消对shutdown.exe的调用。而笔 者发现冲击波和震荡波的关机重启都要调用这个程序,于是答案由此而生: 在弹出强行关机的对话框时,快速打开[运行]窗口(按下CTRL+R),输入“shutdown.exe -a”(注意有一个空格),回车,这时你可以看到强行关机的对话框消失了。然后就可以轻松地干掉冲击波和震荡波。 当然这种方法不仅可用于此,其它一些原因引起的关机也如法炮制。 既然谈到shutdown.exe,有必要将其它重要参数介绍一下: shutdown.exe -a 取消关机 shutdown.exe -f 强行关闭应用程序。 shutdown.exe -m \计算机名 控制远程计算机。 shutdown.exe -i 显示图形用户界面,但必须是Shutdown的第一个参数。 shutdown.exe -l 注销当前用户。 shutdown.exe -r 关机并重启。 shutdown.exe -t时间 设置关机倒计时。 shutdown.exe -c"消息内容" 输入关机对话框中的消息内容(不能超127个字符)。 比如你的电脑要在23:00关机,可以选择“开始→运行”,输入“at 23:00 Shutdown -s”,这样,到了23点,电脑就会出现“系统关机”对话框,默认有30秒钟的倒计时并提示你保存工作。如果你想以倒计时的方式关机,可以输入 “Shutdown.exe -s -t 3600”,这里表示60分钟后自动关机,“3600”代表60分钟。 如果想取消的话,可以在运行中输入“shutdown -a”。另外输入“shutdown -i”,则可以打开设置自动关机对话框,对自动关机进行设置。 虽然shutdown.exe是Windows XP下的程序,在Windows2000中是调用Windows下System中的Shell32.dll文件来实现关机的,例如“indir\ RunDLL32.exe indir\System\Shell32.dll,SHExitWindowsEx 8”,但在Win2000也可利用它,方法如下: 在WinXP安装目录下的System32文件夹中找到Shutdown.exe,将它复制到Win2000安装目录下的System32文件夹中,在“运行”中输入“Shutdown.exe”,即可像在Windows XP中一样使用该程序了。 当然,shutdown.exe还有一些强大的功能,读者可以进一步实践探讨,充分利用 shutdown.exe 的强大功能。 Windows XP Home Edition上安装IIS事前准备
1、Windows XP HomeEdit 中文版 CD(拷在硬盘也可以) 2、Windows 2000 Advanced Server CD(最好也是中文版) 3、默认你的XP是安装在C:\WINDOWS下 开始动手 (如果你怕改错,先把C:\WINDOWS\INF\SYSOC.INF做一份备份) 用记事本打开C:\WINDOWS\INF\SYSOC.INF,在[COMPONENTS]下找到一行: iis=iis.dll,OcEntry,iis.inf,hide,7 然后把它改成 iis=iis2.dll,OcEntry,iis2.inf,,7 保存。 然后把Windows 2000 Advanced Server CD里的两个文件IIS.DL_和IIS.IN_拷贝到一个临时的目录(例如C:\IISonXPHome),然后在命令提示符状态下将当前目录转到C:\IISonXPHome,执行 EXPAND IIS.DL_ IIS2.DLL EXPAND IIS.IN_ IIS2.INF 解出IIS2.DLL及IIS2.INF两个文件,将IIS2.INF复制到C:\WINDOWS\INF目录下,将IIS2.DLL 复制到C:\WINDOWS\SYSTEM32\SETUP目录下。 现在按“开始->设置->控制面板->添加或删除程序->添加/删除Windows组件”,这时你可以很兴奋地发现IIS出现了!!! 此后的过程就和PRO版的XP安装IIS差不多了,过程中复制文件时会多次要求你选择Windows 2000 Advanced Server光盘和Windows XP HomeEdit光盘的位置(都在I386中),输入指定的目录即可正常安装。 安装完毕以后还不能直接用的,需要对IIS进行一些设置: 控制面板->管理工具->Internet服务管理器 然后点“默认WEB站点”的右键,转到“目录安全性”选项卡,点“匿名访问和验证控制”的“编辑”按钮,回弹出匿名方法新窗口,再点击其中“匿名访问”中的“编辑”按钮,将“允许IIS控制密码”前面的勾去掉,然后一路确定返回即可。 |
||||||||||
|
|