摘要: 在head中加入<style type="text/css"> html{ filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'>< 阅读全文
posted @ 2013-04-23 18:19 DCLancer 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 在MVC的站点中使用OutputCache实现缓存可以提高页面的打开速度,如:#if !DEBUG [OutputCache(VaryByHeader = "Content-Type", Duration = 600)]#endif public ActionResult Index() { return View(); } 如果每次想要更改缓存时间的话,则需要重新编译,但是可以通过在Web.Config添加配置节点来实现不编译更改缓存配置在<system.web>节点中添加如下配置<caching> ... 阅读全文
posted @ 2013-04-19 11:19 DCLancer 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 一些网站的页面是通过GZIP技术进行压缩传输的,这样会加快加载速度。但是通过WebClient获取到的html代码则是乱码,所以需要通过GZIP解压来正常显示html代码。byte[] btArrWebHtmlCode = this.GetWebHtmlBytes(url); if (btArrWebHtmlCode.Length == 0) { return string.Empty; } Encoding webEncoding = Encoding.UTF8; ... 阅读全文
posted @ 2013-04-03 16:52 DCLancer 阅读(496) 评论(0) 推荐(0) 编辑
摘要: 这是由于百度广告引起的。如果网站修改了document.domain,投放广告的站点需要引入一个名称为跨域策略文件的页面,并使得JS可以准确调用到该页面。跨域策略文件是一个标准的html页面,其内容如下所示:<!DOCTYPE html><meta http-equiv="Cache-Control" content="max-age=8640000" /><script>document.domain = '**.com';</script>请将上述代码中的document.domain的 阅读全文
posted @ 2013-03-28 14:29 DCLancer 阅读(344) 评论(0) 推荐(0) 编辑
摘要: HtmlAgilityPack可以对Html进行解析,获取某个标签的属性的值、InnerText、InnerHtml等,还可以去除js代码,css样式和注释。using HtmlAgilityPack; HtmlDocument htmlDocContent = new HtmlDocument();htmlDocContent.LoadHtml(strHtmlContent);htmlDocContent.DocumentNode为这段Html的根标签,它的ChildNodes属性为其子标签。比如,要获取这段Html中所有的img的src属性的值,和每个标签的InnerText,可以通过递归 阅读全文
posted @ 2013-03-27 18:21 DCLancer 阅读(1555) 评论(0) 推荐(0) 编辑
摘要: 将字符串转换为Unicode编码形式的字符串private static string ToUnicode(string chineseText) { if (chineseText.IsNullOrEmpty()) { return string.Empty; } byte[] btChinese = Encoding.Unicode.GetBytes(chineseText); StringBuilder sbun... 阅读全文
posted @ 2013-03-22 10:38 DCLancer 阅读(572) 评论(0) 推荐(0) 编辑
摘要: 盘古分词的使用简介 阅读全文
posted @ 2013-03-13 11:27 DCLancer 阅读(1790) 评论(0) 推荐(0) 编辑
摘要: 实际的显示效果是这样的<?xml version="1.0" encoding="GB2312"?><document xmlns:bbs="http://www.baidu.com/search/bbs_sitemap.xsd"><webSite>bbs.diaoyu.com</webSite><webMaster>pengzhijie@tiexue.net</webMaster><updatePeri>0.5</updatePeri>& 阅读全文
posted @ 2013-03-05 15:19 DCLancer 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 首先,需要引用Iesi.Collections和Nhibernate程序集,或者通过NuGet搜索NHibernate,直接安装程序集,首先需要创建NHibernate的配置文件,这里是连接MSSQL2012的数据库,所以创建MSSQL相应的配置文件 1 <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > 2 <session-factory name="NibernateDemo"> 3 <property name="conne 阅读全文
posted @ 2013-03-05 15:10 DCLancer 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 我们经常会遇到对时间进行转换,达到不同的显示效果,默认格式为:2006-6-6 14:33:34如果要换成成200606,06-2006,2006-6-6或更多的格式该怎么办呢?这里将要用到:DateTime.ToString的方法(String, IFormatProvider)示例:using System;using System.Globalization;String format="D";DateTime date=DataTime.Now;Response.Write(date.ToString(format, DateTimeFormatInfo.Invar 阅读全文
posted @ 2013-02-20 16:11 DCLancer 阅读(156) 评论(0) 推荐(0) 编辑
(function() { var c = document.createElement('script'); c.type = 'text/javascript'; c.async = true; c.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.clicki.cn/boot/48212'; var h = document.getElementsByTagName('script')[0]; h.parentNode.insertBefore(c, h); })();