永远的SKYFEI
喜欢在阳光下,光着脊梁,挥汗如雨地工作,每次回头擦汗,看到的都是成就!

随笔分类 -  编程积累

1 2 下一页
Make webclient support upload the large file which are larger than 1G
摘要:step1: reconstruct the WebClient classpublicclassMyWebClient:WebClient{protectedoverrideWebRequestGetWebRequest(Uriaddress){HttpWebRequestrequest=base.GetWebRequest(address)asHttpWebRequest;request.Timeout=-1;request.CachePolicy=newSystem.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLe. 阅读全文
posted @ 2011-04-08 10:46 skyfei 阅读(465) 评论(0) 推荐(0)
Shortcut key for WPF
摘要:steps:open the window code page, and find the construction function;add code like below:publicMainWindow(){InitializeComponent();//CreatetheCommandBinding.CommandBindingcmd=newCommandBinding();cmd.Command=ApplicationCommands.New;cmd.Executed+=newExecutedRoutedEventHandler(CommandBinding_CmdKey_Exec. 阅读全文
posted @ 2011-04-08 10:07 skyfei 阅读(512) 评论(0) 推荐(1)
get Android information with adb, the build version
摘要:adb get the android version 阅读全文
posted @ 2011-02-12 15:35 skyfei 阅读(491) 评论(1) 推荐(0)
Decodes a QuotedPrintable encoded string
摘要:In android vcard file, the QuotedPrintable string will be like:ENCODING=QUOTED-PRINTABLE:=E9=A3=9E;=E5=88=98;=E7=A7=8D;=E5=85=88=E7=94=9F;=E5=8F=B7while in the outlook vcard, itwill like:ENCODING=QUOTED-PRINTABLE:=E5=95=8A=E5=95=8Athat mean that the android will not encode the normail charso update 阅读全文
posted @ 2010-12-23 14:48 skyfei 阅读(511) 评论(0) 推荐(0)
C# USB Detection - winform and WPF
摘要:Win From Version:代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Management;usingSystem.Runtime.InteropServices;namespaceSyncContac 阅读全文
posted @ 2010-12-23 14:41 skyfei 阅读(3771) 评论(1) 推荐(1)
[转] 线程同步
摘要:原帖:http://www.vckbase.com/document/viewdoc/?id=1708八、线程的同步  虽然多线程能给我们带来好处,但是也有不少问题需要解决。例如,对于像磁盘驱动器这样独占性系统资源,由于线程可以执行进程的任何代码段,且线程的运行是由系统调度自动完成的,具有一定的不确定性,因此就有可能出现两个线程同时对磁盘驱动器进行操作,从而出现操作错误;又例如,对于银行系统的计算... 阅读全文
posted @ 2009-12-23 16:00 skyfei 阅读(338) 评论(0) 推荐(0)
Openxml: 导出excel 设置 cell的格式
摘要:在cell中如果cell中的文本有换行符, 默认是不显示换行的, 只有点了excel 工具栏中的“Wrap Text" 按钮, 才会显示换行, 见下图:这个效果, 可以通过设置openxml的 style sheet 来实现。[代码]在创建stylesheet时, 必须创建fonts, Fills,Borders 和cellXfs(CellFormats)四个节点, 在显示cell是通... 阅读全文
posted @ 2009-07-16 12:12 skyfei 阅读(4663) 评论(5) 推荐(2)
OpenXML: excel 插入BarChart图表
摘要:Openxml format SDK 2.0 v2 的 how to 文章里提供了一个怎样插入 chart 图表的示例, 但这个 chart的数据是独立不是根据excel sheet 上data 动态生成的chart,因此, 我在此示例代码上做了一些改动,可以根据excel sheet 上的数据, 生成 chart 图片, 效果如图画图的逻辑结构为:WorksheetPart<-Drawin... 阅读全文
posted @ 2009-06-17 16:31 skyfei 阅读(5306) 评论(10) 推荐(1)
OpenXML: Asp.net利用OpenXML 导出Excel.
摘要:第一步要先装 Openxml SDK 2.0, 然后引用DocumentFormat.Openxml.dll。引用名称空间[代码]Openxml 只能生成Office2007的文档,并且需要Linq。关于Excel.xlsx:office 2007的excel 实质是zip文件, 把扩展名改为.zip后,我们可以看到里面是一些xml 文件excel的主要内容都在xl目录下,excel数据保存在sh... 阅读全文
posted @ 2009-06-12 11:04 skyfei 阅读(9429) 评论(7) 推荐(2)
'String or binary data would be truncated' error message
摘要:很多人(在google)上遇到这个错误是由于数据的存储空间小于 要插入的数据。 而我遇到这个错误却是由于, column 的顺序没有排对, 我是用 insert <tableName> select * from <tablename> 和delete from <tablename> output deleted.* into 时出错。由于select 或者d... 阅读全文
posted @ 2008-11-18 14:45 skyfei 阅读(839) 评论(0) 推荐(0)
.net Create Excel 2007 file with open xml
摘要:Open XML 是从office 2007 开始被支持的, 用Open xml可以不用Office dcom创建标准office 文档, Office Dcom进程释放不掉, 实在太烦人了, 而且资源消耗大. 用Open xml可以直接生成office 文档, 不过现在文档资料比较少, 且方法不是很可取, 包括msdn上的一些文档, 创建office 文档都是用拼字符串的方法来做的, 个人感觉不符合C#编码习惯, 不过也情有可原, 这文档大多是在open xml sdk1.0 年代写的, 先Open xml SDK2.0出来了, 经过一阵专研, 终于写出了一个excel 文件, 不过可惜, boss 考虑到风险问题, 让我继续要dcom创建, 因此仅仅研究到创建excel 文件, 并往cell里写text. 不过这种方法对于asp.net 动态生成 excel 下载, 还是很有用途的, boss 要求的下载的excel 要求带chart的, 就是根据数据生成chart在下载的excel文件中, 因此那种直接response girdview的方法不能满足要求. 闲话少叙, 阅读全文
posted @ 2008-10-22 10:56 skyfei 阅读(3535) 评论(10) 推荐(0)
利用.Net Framework2.0 zip压缩、解压 string 数据
摘要:利用System.IO.Compression 压缩,解压文件网上能搜索到很多文档了, 但对字符串直接压缩还是很少, 这种压缩还是在webservice返回大量数据时还是用用途的看code吧:using System.Text;using System.IO.Compression;public static string CompressString(string str) { byte[] b... 阅读全文
posted @ 2008-08-07 18:07 skyfei 阅读(1068) 评论(0) 推荐(0)
C#中文和UNICODE字符转换方法
摘要:转自百度博客: http://hi.baidu.com/zzticzh/blog/item/0ffbdd8856b92890a5c2722d.html没想到百度也有这么专业的博主 //中文转为UNICODE字符string str = "中文"; string outStr = ""; if (!string.IsNullOrEmpty(str)) { for (int i = 0; i <... 阅读全文
posted @ 2008-08-01 10:12 skyfei 阅读(3595) 评论(3) 推荐(0)
CSS滤镜(FILTER): 国难日网站灰黑色网页
摘要:2008年5月19日 - 2008年5月21日国难日,难以忘怀的是映入眼帘的一幅幅黑灰色的网站主页。 起先只是奇怪,这么多门户网站,动作怎么这么快, 一下子把所有的网页都变成灰黑色了, 后来,发现原来一行代码就可以搞定. 那就是用CSS滤镜: <STYLE>body {filter:gray}</STYLE> 阅读全文
posted @ 2008-05-20 16:31 skyfei 阅读(770) 评论(3) 推荐(0)
Winform: use the WebBrowser to display XML with xslt, xml, xslt 转 html 字符串
摘要:声明xml字符串: string xml = "...."; 声明xslt 转换类: XslCompiledTransform xslt = new XslCompiledTransform(); 调用xslt sheet文件: xslt.Load("XSLTFile1.xslt"); 将字符串转成流类型 TextReader tr = new StringReader(xml); 声明XPa... 阅读全文
posted @ 2008-04-18 18:38 skyfei 阅读(2707) 评论(0) 推荐(0)
ITempate自定义数据捆绑模板
摘要:转自:http://www.cnblogs.com/DavidFan/archive/2007/06/01/767853.html 代码其实比较简单了,相信大家能够看得懂,我就不多作解释了。 public class MyTemplate : ITemplate { ITemplate 成员#region ITemplate 成员 public void Instantia... 阅读全文
posted @ 2008-01-17 17:42 skyfei 阅读(331) 评论(0) 推荐(0)
Web page context menu (javascript)
摘要:效果图:下载代码文件 web Page context menu (下载后请改名, 去掉.txt 扩展名); Section: s1 (Your health and fitness) Questi... 阅读全文
posted @ 2007-07-26 10:49 skyfei 阅读(835) 评论(0) 推荐(0)
DataGridView显示Datetime高精度字符串
摘要:首先将 DataGridView 要是显示时间的列(比如StartTime) 设为String 类型. 将对应的DateTable对应的列也设位String类型. DataRow row = dt.NewRow(); Row["StartTime"] = DateTime.Now.ToString("HH:mm:ss fffffff"); 注意秒与 秒的小数部分要用一个空格分割, 否则, 会出错.... 阅读全文
posted @ 2007-06-07 17:58 skyfei 阅读(898) 评论(0) 推荐(0)
Custom Script Callbacks in ASP.NET 2.0 without refresh whole Page
摘要:这些天研究AJAX, 没事翻看msdn的文章, 偶然发现一篇>的文章, 顿时眼睛一亮, 心像这不实现我想要得AJAX局部页面更新功能了么! 但这篇文章字太多, 看着费劲, 我就试着找一些代码例子, 结果找到了一些代码, 但都是beta 版http://www.dotnetjunkies.com/Tutorial/E80EC96F-1C32-4855-85AE-9E30EECF13D7.dcik, ... 阅读全文
posted @ 2006-11-08 17:59 skyfei 阅读(1741) 评论(1) 推荐(0)
AVOID "throw e" !!!
摘要:There three kind of catch ... throw method: catch(Exception e) { throw e; } catch(Exception) { throw; } ... 阅读全文
posted @ 2006-09-27 17:05 skyfei 阅读(1316) 评论(5) 推荐(0)

1 2 下一页