- 博客(126)
- 资源 (1)
- 收藏
- 关注
原创 正则表达式 平衡组
讲解:http://blog.youkuaiyun.com/zm2714/article/details/79464371.匹配嵌套的div:div[^>]*>[^]*(((?'Open'div[^>]*>)[^]*)+((?'-Open'div>)[^]*)+)*(?(Open)(?!))div>2.匹配类似这么的jsonhttp://rate.taobao.com/feed
2013-09-24 16:03:23
1309
原创 外部表不是预期的格式 解决方案
抓取网站的数据 导出到excel中,刚开始还是运行的还顺畅的,但是由于数据过多,开始出现这个错误---“外部表不是预期的格式”百度了下,发现这个是Excel版本问题,我的运行环境是:win7+Office2007using System.Data.OleDb;using System.Data; public void ReadExcelFiless() {
2013-07-19 17:11:43
27489
转载 C#重写WebBrowser组件,禁止跳转到IE新窗口、脚本错误
http://blog.chinaunix.net/uid-16242888-id-146885.html 刚从delphi转到c#,一切重头开始。上来先做个myBrowser,结果发现无法解决跳转到新窗口问题。从网上找到奇客力大侠的《C# webBrowser禁止在新窗口打开,强制在本窗口打开》文章(http://blog.163.com/da7_1@126/blog/static/104072
2013-07-18 14:00:46
4618
原创 获取网站中response.Headers["location"],找到抓取页面
private static string getPageContent(string tastKeyword) { string htmlcontent = ""; HttpWebRequest request = null; HttpWebResponse response = null;
2013-07-13 21:01:59
22692
1
原创 网页内容若使用gzip压缩--获得页面源码
if (String.IsNullOrEmpty(strUrl)) { return "抓取地址为空!"; } HttpWebRequest req = null; HttpWebResponse resp = null; Stream strea
2013-07-08 16:05:16
919
原创 抓取网页中需要的信息,并导出到Excel中
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Net;using System.IO;using System.Text;using S
2013-06-28 12:12:25
3894
1
原创 div中的文字垂直水平居中
.wrap{ background: #000; width: 500px; height: 500px; color: #fff; display:table-cell; vertical-align: middle; float:right;}.verticalWrap{ position: relative; top: 50%; +top: 100%;}.ver
2013-05-16 11:35:52
1279
原创 CSS控制的内容超过容器宽度后显示省略号
li {width:50px;white-space:nowrap;text-overflow:ellipsis;overflow: hidden;}注:“white-space:nowrap”是强制在一行内显示所有文本,不回行。text-overflow是CSS3新增的属性,IE6以上版本支持。它可以带2个参数:clip [不显示省略标记(...),而是简单的裁切],ell
2013-05-16 10:48:39
671
原创 用jQuery控制checkbox
<!-- function countChecked() { var n = $("input[type=checkbox]:checked").length; $("span.checked_cnt").text(n + "项已选"); if(n>=2){ $("input[type=checkbox]").each(function(
2013-03-27 15:40:27
750
转载 收集的材料 关于数据库和抓取器方面的
同事 的博客 里面有很多 不错的东西 值得 我这个水平不高的人学习顺便给他涨个人气 抓取器:C#.NET GB2312编码转化为中文c#验证码下载正则表达式替换---lamda表达式(UniCode编码)去除截取对象中的html代码人人网抓取demodiscuz论坛的抓取玩玩小爬虫——抓取时的几个小细节获取页面源码(自动获取页面的
2013-03-22 15:42:13
575
转载 过滤ilist中的重复数据
using System;using System.Collections.Generic;using System.Linq;using System.Text;/// /// 可以根据字段过滤重复的数据/// /// public class Comparint : IEqualityComparer where T : class, new(){ private
2013-03-19 14:48:43
2661
原创 post数据小例
private string getPageContent(string tastKeyword) { string htmlcontent = ""; HttpWebRequest request = null; HttpWebResponse response = null; str
2012-09-29 15:26:10
770
原创 去除字符串中的html标记
正则表达式匹配下html标记 public static string DeleteHTMLElement(string html) { html = Regex.Replace(html, "]*>{1}", "", RegexOptions.IgnoreCase); html = html.Replace("\n", " ");
2012-09-21 10:35:58
587
转载 一段最短的代码,用上js所有关键字
newfunction() { dobreak;while(typeofdeletethis); for(vara;void 0;) continue if(null) with(0) try{ switch(1 in1 instanceof1) { casefal
2012-07-30 17:58:22
485
原创 模拟登录(一次自动调转)
class Class3 { public static void A() { HttpWebRequest request = null; HttpWebResponse response = null; string gethost = string.Empty;
2012-07-30 17:27:45
717
原创 抓取网址中的信息(需要解码的)
/// /// 根据任务生成抓取要素 /// protected override void initCrawlerModel(IwomTask taskItem) { crawlerModel = new CrawlerModel(); crawlerModel.Keyword =
2012-07-25 13:59:43
752
原创 调用谷歌的方法输出图表,运行中的结果
报告详情 google.load('visualization', '1', { packages: ['corechart'] }); function drawChart(){ drawColumn('ZChart',['负面','中立','正面'],'一周信息量比较',['#FF0000' ,'#ADADAD' , '#2828FF']
2012-07-24 17:03:24
3980
转载 NHibernate操作多个数据库
http://www.codeproject.com/Articles/14846/Using-NHibernate-with-Multiple-DatabasesNHibernate操作多个数据库的
2012-07-24 16:58:41
990
原创 sql中删除多张表的数据
insert a.id into #kkk select a.id from a,b where a.id=b.iddelete from a where a.id in(select id from #kkk)delete from b where b.id in(select id from #kkk)-------------------------第一句得到两个表里的相同记录并插
2012-07-24 10:36:09
8614
原创 调用 google方法生成饼图、条形图、表格
报告详情 google.load('visualization', '1', { packages: ['corechart']}); function drawChart(){ var bid=document.getElementById("");
2012-07-23 13:45:10
3979
原创 NHibernate映射配置
在用NHibernate的时候,当有表中的主键是数据库自动生成的时候(即设置的自增)将使用native。而当是自己填写的时候则需要改为assigned。否则将会出现异常! 以上是映射文件的配置中需要注意的
2012-07-13 17:15:54
470
转载 正则表达式
入门学习正则表达式的最好方法是从例子开始,理解例子之后再自己对例子进行修改,实验。下面给出了不少简单的例子,并对它们作了详细的说明。假设你在一篇英文小说里查找hi,你可以使用正则表达式hi。这几乎是最简单的正则表达式了,它可以精确匹配这样的字符串:由两个字符组成,前一个字符是h,后一个是i。通常,处理正则表达式的工具会提供一个忽略大小写的选项,如果选中了这个选项,它可以匹配hi,HI,
2012-06-28 15:18:35
812
原创 统计网站当天的访问量
/// /// 今日访问人数 /// public static int todayCount; /// /// 更新今日访问数的标志 /// static DateTime lastCleanUp; /// /// 锁对象
2012-06-13 09:34:19
793
原创 C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
// 获取程序的基目录。System.AppDomain.CurrentDomain.BaseDirectory// 获取模块的完整路径。System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName// 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。System.Environment.Curr
2012-06-13 09:32:04
22123
原创 在线人数统计和总访问量统计
1.新建网站,添加几个窗体。webForm1.aspx ,ViewStateForm.aspx2.在网站的根目录下添加全局应用程序类“Global.aspx” 。(重要)3.在“Global.aspx” 有固有的格式和会话信息结构。4.在“Global.aspx”中各个函数中添加处理代码。详细如下: void Application_Start(objec
2012-06-12 17:08:23
5670
原创 强类型--验证用户登录次数
static int errorcount = 0; protected void Button1_Click(object sender, EventArgs e) { T_UserTableAdapter adapter = new T_UserTableAdapter(); string name = t
2012-05-22 21:50:40
1263
原创 gridview排序
private void GetDataTablefenye() { string srotexp = string.Empty; if (ViewState["sortexp"] != null) { Dictionary dic = (Dictionary)View
2012-04-27 13:57:51
459
原创 javascript window对象
window对象window对象表示整个浏览器窗口,但不必表示内容窗口操作移动或调整浏览器窗口的大小 moveBy(dx,dy):移动x,y个位置 //调整窗体距离屏幕的位置 moveTo(x,y):移动到x,y的位置 //指定窗体距离屏幕的位置 resizeBy(dw,dh):调整dw,dh大小 //调整窗体的大小 reziseTo(
2012-04-19 21:48:28
472
原创 treeview动态绑定
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Configuration;using System.Data.SqlClient;usin
2012-04-13 14:49:42
419
原创 gridview 中实现的一些常见的功能
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.SqlClient;using System.
2012-04-12 19:53:55
400
原创 jquery 表单验证
.style1 { width: 100%; } function checkidcard(num){ var len = num.length, re; if (len == 15) re = new RegExp(/^(\d{6})(
2012-04-11 21:13:56
450
原创 递归实现treview的数据绑定
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.SqlClient;using System.
2012-04-10 17:48:38
690
原创 数据库导出到xml中
using (SqlConnection sqlCnn = new SqlConnection(str)) { using (SqlCommand sqlCmm = sqlCnn.CreateCommand()) { sqlCmm.CommandText = "select t
2012-04-09 20:43:16
2345
原创 通过AJAX调用页面后台代码方法实现省级三级联动效果 (简单练习)前台
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/1999/xhtml"> $(function () { $("#ProvinceList").bind("keyup change", function (e) {
2012-04-07 18:12:59
3376
原创 无刷新页面验证用户是否存在
WebService.cs[WebMethod] public string SelectUser(string strUser) { SqlConnection conn = new SqlConnection(strcon); SqlCommand cmd = conn.CreateCommand(); cmd.Co
2012-04-06 21:25:49
544
原创 ajak timer
DateTime dt_Sports = Convert.ToDateTime("2012 - 12 - 21"); lblDate.Text = dt_Sports.Subtract(DateTime.Now).ToString(); string[] dd = lblDate.Text.Split('.'); lblDate.Text =
2012-03-23 15:50:02
531
页面的刷新
2011-09-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人