2013年5月27日

用于正则表达式的 Regex.Matches静态方法的几种用法 转载

摘要: //①正则表达式 = > 匹配字符串 string Text = @"This is a book , this is my book , Is not IIS"; //定义一个模式字符串,不仅仅是纯文本,还可以是正则表达式 string Pattern = "is"; MatchCollection Matches = Regex.Matches( Text, Pattern, RegexOp... 阅读全文

posted @ 2013-05-27 16:13 seaven 阅读(465) 评论(0) 推荐(0) 编辑

2013年5月25日

C#中将dll汇入exe,并加壳(转载)

摘要: 这几天在做自己的一个小程序,因为使用了3层架构,运行目录下有很多dll文件,最终发布时,我打算将dll文件都合并到exe文件中去。微软发布的免费软件ILmerge可以完成这项工作,研究了一下,其用法如下:1、合并file1.dll、file2.dll到destination.dllILmerge /ndebug /target:dll /out:C:\destination.dll /log C:\file1.dll C:\file2.dll2、合并file1.dll、file2.dll以及myApp.exe到newApp.exeILmerge /ndebug /target:winexe / 阅读全文

posted @ 2013-05-25 15:10 seaven 阅读(1365) 评论(0) 推荐(1) 编辑

2013年5月13日

用wininet库模拟cookie方式验证码登录

摘要: #include "stdafx.h"#include <windows.h>#include <wininet.h>#include <tchar.h>#include <conio.h>#include <time.h>DWORD WriteDataToFile(LPSTR lpFileName, LPSTR data, int size){ DWORD dwWritten; HANDLE hFile = CreateFileA(lpFileName, GENERIC_WRITE, 0, NULL, CREAT 阅读全文

posted @ 2013-05-13 20:54 seaven 阅读(2232) 评论(0) 推荐(0) 编辑

2013年5月9日

wininet.dll函数库:不会过期的cookie

摘要: using System;using System.Text;using System.Runtime.InteropServices;namespace seaven{ class Program { /// <summary> /// 设置cookie /// </summary> [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool InternetSetCookie... 阅读全文

posted @ 2013-05-09 23:18 seaven 阅读(380) 评论(0) 推荐(0) 编辑

2013年5月5日

Python采集网页数据保存到excel

摘要: urllib读取网页,然后用Py-excel写excel。import urllibfrom xlwt import Workbookimport datetimedef FetchData(): book = Workbook(encoding='gbk') #如果采集数据有中文,需要添加这个 sheet1 = book.add_sheet('Sheet 2') #表格缓存 i = 0 theday = datetime.date(2009,12,31) while i < 100: #这边的场景就是采集100个网页,每个网址都包含日期 ... 阅读全文

posted @ 2013-05-05 17:35 seaven 阅读(8357) 评论(0) 推荐(0) 编辑

2013年5月3日

使用Python抓取网页图片[转载]

摘要: ImgDownloaderimport win32com.client,time,win32inet,win32file,osclass ImgDownloader: def __init__(self,url,dir): self.__dir=dir self.__ie=win32com.client.Dispatch('InternetExplorer.Application') self.__ie.Navigate(url) self.__wait__() def __wait__(self): while... 阅读全文

posted @ 2013-05-03 09:14 seaven 阅读(516) 评论(0) 推荐(0) 编辑

2013年3月27日

替换SQL Server数据库中所有表的所有字段的某些内容

摘要: exec sp_msforeachtable @command1=N' declare @s nvarchar(4000),@tbname sysname select @s=N'''',@tbname=N''?'' select @s=@s+N'',''+quotename(a.name)+N''=replace(''+quotename(a.name)+N'',N''''aa'''&# 阅读全文

posted @ 2013-03-27 19:50 seaven 阅读(203) 评论(0) 推荐(0) 编辑

2013年3月21日

Oracle插入大数据、获取大数据

摘要: 插入数据库CLOB tempClob = null;try { Connection conn = getConnection(); PreparedStatement = = conn.prepareStatement("UPDATE PROGRAM_HISTORY SET DETAILS = ? WHERE ID = 12"); tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); tempClob.open(CLOB.MODE_READWRITE); Writer tempClobWri 阅读全文

posted @ 2013-03-21 09:26 seaven 阅读(891) 评论(0) 推荐(0) 编辑

2013年2月18日

mysqldump备份数据库的操作大全

摘要: 常见选项:--all-databases, -A: 备份所有数据库--databases, -B: 用于备份多个数据库,如果没有该选项,mysqldump把第一个名字参数作为数据库名,后面的作为表名。使用该选项,mysqldum把每个名字都当作为数据库名。--force, -f:即使发现sql错误,仍然继续备份--host=host_name, -h host_name:备份主机名,默认为localhost--no-data, -d:只导出表结构--password[=password], -p[password]:密码--port=port_num, -P port_num:制定TCP/IP 阅读全文

posted @ 2013-02-18 11:48 seaven 阅读(604) 评论(0) 推荐(0) 编辑

2013年2月2日

tar包压缩 解压缩 相对路径问题

摘要: 一、问题描述现在有一个需求,不知道该如何才能实现压缩: tar czvf /data/backup/test.tar.gz /data/a/b/directory解压: cd /data/test tar xzvf /data/backup/test.tar.gz问题是,解压后的文件,在/data/test/data/a/b/directory里面能否压缩时只保留directory以下的所有目录,以directory作为/,而不是/data/a/b/directory?二、解决方案(1)直接cd到当前目录再进行打包和压缩(2)使用-C参数GNU tar的官方资料http://www.delor 阅读全文

posted @ 2013-02-02 13:20 seaven 阅读(9598) 评论(0) 推荐(0) 编辑

导航