📄 博客堂20040527.htm
字号:
<div class="post">
<h3>
<a id="RecentPosts__ctl13_Hyperlink2" href="http://blog.joycode.com/lostinet/posts/22730.aspx">ContextBoundModel 更新</a></h3>
这次用NUnit做了三个测试<STRONG><FONT face="Trebuchet MS" color=#ff6600><A class=entrylisttitle id=_ctl0_pageBody-0_Days_Entries__ctl11_TitleUrl HREF="/lostinet/posts/22086.aspx">ContextBoundModel</A></FONT></STRONG>的类.测试了基本的AspectObject的行为.<BR>IAspectServerMessageHandler,IMessageHandler,IMessageHandlerAttribute的一些行为.<BR>下载:<A href="http://www.lostinet.com/files/">http://www.lostinet.com/files/</A> 找到 lcbm 的最后的版本.<BR>另外,如果你有兴趣,希望你能和我一起讨论IMessageHandlerBase的优先级别的问题.<BR>这个是一个优先级别的enum.在v1.0出来前不给它们具体的值.<BR>TraceMessageHandling的级别最高.代表它在最外层调用.<BR>FinalImplementation则放在最内层,用于替换默认实现过程<BR>public enum MessageHandlerPriority<BR> {<BR> //,AspectObjectProxy , Setup MessageContext<BR> TraceMessageHandling ,<BR> CheckArguments ,<BR> SetupComPlusContext ,<BR> SetupEnvironment ,<BR> CheckPermission ,<BR> SetupTransaction ,<BR> Default ,<BR> CheckReturnValues ,<BR> PrepareImplementation ,<BR> AspectImplementation ,<BR> /// <SUMMARY><BR> /// You can replace the default implementation here!<BR> /// </SUMMARY><BR> FinalImplementation<BR> }<BR>对于一个AOP的拦截,目前我能想到的就是这些过程.如果你有些想法,请给我意见.<BR>谢谢!!
<p class="postfoot" align="right">
2004-05-26 23:56:00
by
<a id="RecentPosts__ctl13_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/lostinet/">Lostinet</a>
【评论:3)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl14_Hyperlink2" href="http://blog.joycode.com/fish/posts/22728.aspx">解決PictureBox對 Dynamic GIF與Icon 8bit~32bit 支援的問題</a></h3>
<P>我想很多人都知道 PictureBox 是支援 GIF與Icon圖形檔的,<BR>但是有兩種狀況卻會導致PictureBox產生例外<BR>1. 部分動態GIF: 當動態GIF在 PictureBox下撥放時會在讀取完最後一張的圖形時產生<BR> 'System.Runtime.InteropServices.ExternalException GDI+' 的錯誤, 而無法正常循環<BR> 如: <A href="http://www.codeproject.com/cs/miscctrl/PropertyConverter/propertyconverter.gif">http://www.codeproject.com/cs/miscctrl/PropertyConverter/propertyconverter.gif</A></P>
<P>2. 8bit~32bit色Icon檔: 相同的問題也發生在ImageList上, 當您試著載入時會產生例外或參數不正確的錯誤訊息</P>
<P>針對這兩個問題我的解決方式是<BR>1. 轉為靜態撥放的方式<BR> <FONT color=#ff0000>Dim img As Image = Image.FromStream(dynaGifBLOBData)<BR> Dim b As Bitmap = New Bitmap(img, CType(img.Width, Integer), CType(img.Height, Integer))<BR> picturebox.Image = b<BR></FONT> <BR>2. 轉換格式(如: 轉bitmap)<BR> <FONT color=#ff0000>picturebox.image = New Icon(picfile).ToBitmap</FONT></P>
<P>同樣的情形不曉得您會如何來處理, 歡迎來信討論...<BR></P>
<p class="postfoot" align="right">
2004-05-26 23:10:00
by
<a id="RecentPosts__ctl14_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/fish/">fish</a>
【评论:7)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl15_Hyperlink2" href="http://blog.joycode.com/ghj/posts/22722.aspx">.net 下操作 Excel 文件</a></h3>
<P>最近做的一个项目,需要把数据导出到Excel。搜索了一下,CSDN 上问这方面问题的竟然不少。特整理一下相关资料,供参考:</P>
<P>如果你安装了 VS.net 2003 中的例子,在 C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Technologies\Interop\Applications\Office\Excel 目录下可以看到调用Excel的范例。使用之前请先阅读那个目录下的 Readme.htm 。</P>
<P>那个例子是用一个控制台程序新建一个Excel,并把数据、图表写进去,然后关闭。</P>
<P>微软的知识库中,也有很多关于Excel 调用的文章。比如下面的几篇:</P>
<P>HOW TO: Transfer Data to an Excel Workbook by Using Visual C# .NET<BR><A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;306023&Product=vcSnet#8">http://support.microsoft.com/default.aspx?scid=kb;en-us;306023&Product=vcSnet#8</A></P>
<P>这篇里面有很多相关连接,具体请自己去看。</P>
<P>如果你需要把大数据量倒入到Excel 表的话,建议使用 ClipBoard(剪贴板)的方法。实现方法参看上面的连接,讨论参看:<A href="http://expert.csdn.net/Expert/topic/3086/3086690.xml">http://expert.csdn.net/Expert/topic/3086/3086690.xml</A> </P>
<P>倒完数据后,在程序退出之前,如果需要结束Excel 的进程,讨论参看:<A href="http://expert.csdn.net/Expert/topic/3068/3068466.xml">http://expert.csdn.net/Expert/topic/3068/3068466.xml</A><BR>讨论的结果就是:提前垃圾回收,或者杀死进程。</P>
<P>不过上面的两种方法,有时候会有问题,但是。。。。</P>
<P> </P>
<p class="postfoot" align="right">
2004-05-26 22:12:00
by
<a id="RecentPosts__ctl15_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/ghj/">蝈蝈俊</a>
【评论:10)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl16_Hyperlink2" href="http://blog.joycode.com/lostinet/posts/22712.aspx">MSDN上对AOP的介绍</a></h3>
<P>想不到2年前MSDN上就有用ContextBoundObject来实现AOP的文章.</P><A href="http://msdn.microsoft.com/msdnmag/issues/02/03/AOP/">Aspect-Oriented Programming Enables Better Code Encapsulation and Reuse</A>
<P>但是为什么现在网络上基于ContextBoundObject的AOP.NET框架不多呢?</P>
<P>也许是很多致力于AOP的人都希望用机器码的角度去做这件事.目的当然是性能.</P>
<P>不过按我的理解,ServicedComponent就是实实在在的ContextBoundObject实现的AOP的样板.</P>
<P>详细可以看 ServicedComponentProxy 的实现.<BR><BR><A href="http://blog.joycode.com/lostinet/posts/22730.aspx">ConextBoundModel</A></P>
<p class="postfoot" align="right">
2004-05-26 18:57:00
by
<a id="RecentPosts__ctl16_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/lostinet/">Lostinet</a>
【评论:15)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl17_Hyperlink2" href="http://blog.joycode.com/technofantasy/posts/22700.aspx">替换webbrowser中选中的文本的方法</a></h3>
<P>今天有网友问起来了,就给他分别写了VB和Delphi的实现方法,其实很简单,通过WebBrowser.Document.selection就可以了。</P>
<p class="postfoot" align="right">
2004-05-26 16:41:00
by
<a id="RecentPosts__ctl17_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/technofantasy/">陈锐</a>
【评论:3)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl18_Hyperlink2" href="http://blog.joycode.com/kaneboy/posts/22659.aspx">ASP.NET Tips : 用JS产生Postback</a></h3>
<P>用Page.GetPostBackEventReference()方法可以返回一个产生Postback的JS Method,不再详叙。这里演示如何Postback以后知道是哪个元素触发的Postback。<BR><BR>在页面上:<BR><BR><FONT color=#0000ff>...onClick="javascript:<% this.Page.GetPostBackEventReference(this, "@@@@@SomeTag" %>"...</FONT><BR><BR>在页面的Page_Load()里面:<BR><BR><FONT color=#0000ff>if (this.IsPostBack)<BR>{<BR> String eventArg = Request[ "__EVENTARGUMENT" ];<BR> if (eventArg.IndexOf("@@@@@" ) > -1)......<BR>}</FONT><BR><BR>Source : <A href="http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx">http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx</A></P>
<p class="postfoot" align="right">
2004-05-26 11:46:00
by
<a id="RecentPosts__ctl18_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/kaneboy/">kaneboy</a>
【评论:1)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl19_Hyperlink2" href="http://blog.joycode.com/toby/posts/22656.aspx">在C#中实现高性能计时</a></h3>
<P>很多BBS系统都带有“本页执行时间”这样的性能统计数据显示在页面的最底部。准确地时间能够让我们清晰地知道一个页面的性能优略。</P>
<P>下面的代码来自<A href="http://www.codeproject.com/csharp/highperformancetimercshar.asp">http://www.codeproject.com/csharp/highperformancetimercshar.asp</A></P>
<P>/*************************************************************/<BR>using System;<BR>using System.Runtime.InteropServices;<BR>using System.ComponentModel;<BR>using System.Threading;</P>
<P>namespace Win32<BR>{<BR> internal class HiPerfTimer<BR> {<BR> [DllImport("Kernel32.dll")]<BR> private static extern bool QueryPerformanceCounter(<BR> out long lpPerformanceCount);</P>
<P> [DllImport("Kernel32.dll")]<BR> private static extern bool QueryPerformanceFrequency(<BR> out long lpFrequency);</P>
<P> private long startTime, stopTime;<BR> private long freq;</P>
<P> // Constructor<BR> public HiPerfTimer()<BR> {<BR> startTime = 0;<BR> stopTime = 0;</P>
<P> if (QueryPerformanceFrequency(out freq) == false)<BR> {<BR> // high-performance counter not supported<BR> throw new Win32Exception();<BR> }<BR> }</P>
<P> // Start the timer<BR> public void Start()<BR> {<BR> // lets do the waiting threads there work<BR> Thread.Sleep(0);</P>
<P> QueryPerformanceCounter(out startTime);<BR> }</P>
<P> // Stop the timer<BR> public void Stop()<BR> {<BR> QueryPerformanceCounter(out stopTime);<BR> }</P>
<P> // Returns the duration of the timer (in seconds)<BR> public double Duration<BR> {<BR> get<BR> {<BR> return (double)(stopTime - startTime) / (double) freq;<BR> }<BR> }<BR> }<BR>}<BR>/*************************************************************/<BR>代码有注释,而且本身很容易理解。</P>
<p class="postfoot" align="right">
2004-05-26 11:35:00
by
<a id="RecentPosts__ctl19_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/toby/">Microtoby</a>
【评论:9)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl20_Hyperlink2" href="http://blog.joycode.com/ff/posts/22650.aspx">My First Book!</a></h3>
<P><FONT face=Verdana size=2>第一本书!Shameless plugs </FONT><A href="http://msmvps.com/bernard/posts/7089.aspx"><FONT face=Verdana size=2>here</FONT></A><FONT face=Verdana size=2> <img alt='笑脸' src=http://messenger.msn.com/Resource/emoticons/regular_smile.gif> <BR>谢谢支持,谢谢Grace.</FONT><BR><BR></P>
<p class="postfoot" align="right">
2004-05-26 11:16:00
by
<a id="RecentPosts__ctl20_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/ff/">FF</a>
【评论:10)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl21_Hyperlink2" href="http://blog.joycode.com/moslem/posts/22624.aspx">Aero , I got it !</a></h3>
<P><FONT face=Georgia><IMG style="FLOAT: right" alt=longhorn src="/images/blog.joycode.com/moslem/215/o_longhorn.gif">自从 WinHEC 2004 上有了新的 Longhorn Build 后,这么多天一直期望能亲自感受一把 Longhorn 传说中的多层式用户界面(Tiered User Experience) --- Aero 。</FONT></P>
<P><FONT face=Georgia>在单位的机器上(DirectX 8 显卡),装完 Longhorn 只要一启动 Windows Desktop Manager ,机器的硬盘就再也不停了,折腾了好长时间,也没搞定。</FONT></P>
<P><FONT face=Georgia>几经努力,终于在 HomePC 上搞到一块支持 DirectX 9.0 的显卡,在这台配置较高的机器上,终于如愿以偿 <IMG alt=吐舌笑脸 src="http://messenger.china.msn.com/Resource/emoticons/tongue_smile.gif"></FONT></P>
<P><FONT face=Georgia></P>
<IMG src="/images/blog.joycode.com/moslem/821/o_A6.jpg"></FONT>
<br>
<IMG src="/images/blog.joycode.com/moslem/821/o_13.jpg"><P><FONT face=Georgia>更多 Aero 截图,<A href="http://blog.joycode.com/moslem/gallery/821.aspx">请看这里</A> (有详细说明)</FONT></P>
<P><FONT face=Georgia>HomePC 的配置:</FONT></P>
<UL>
<LI><FONT face=Georgia>CPU: P4 2.6G HT</FONT>
<LI><FONT face=Georgia>RAM: 1 G DDR</FONT>
<LI><FONT face=Georgia>HardDisk:120G</FONT>
<LI><FONT face=Georgia>Display Adapter:nVIDIA FX5200 </FONT>
<LI><FONT face=Georgia>Monitor:MGA 770</FONT></LI></UL>
<P><FONT face=Georgia>BTW:装完 Longhorn 仅玩了半个小时,估计还有更多 Features 等待发现。</FONT></P>
<p class="postfoot" align="right">
2004-05-26 10:16:00
by
<a id="RecentPosts__ctl21_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/moslem/">moslem</a>
【评论:21)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl22_Hyperlink2" href="http://blog.joycode.com/ghj/posts/22620.aspx">ConfigurationSettings.AppSettings[""] 只是程序初始化的时候获得数据,之后不再从config文件获得。</a></h3>
<P>ConfigurationSettings.AppSettings[""] 只是程序初始化的时候获得数据,之后不再从config文件获得。直接使用的是初始化获得的数据。(不论config文件之后是不是修改了)</P>
<P>对于Web 应用程序来说,由于修改 web.config 文件,会让Web 应用自动重起。所以不存在啥问题。</P>
<P>对于Win应用程序来说。由于没有默认监视config文件的机制。这部分要自己留意。避免修改后,没有效果。</P>
<P>自己写的一个Win程序,就是因为没有注意到这点,产生了一个bug。</P>
<P> </P>
<p class="postfoot" align="right">
2004-05-26 10:13:00
by
<a id="RecentPosts__ctl22_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/ghj/">蝈蝈俊</a>
【评论:14)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl23_Hyperlink2" href="http://blog.joycode.com/lostinet/posts/22616.aspx">自定义的 Exception 类。</a></h3>
<P>通常自己做一套Framework的时候,都会自己弄套 Exception 类。</P>
<P>例如:public class MyFrameworkException : Exception</P>
<P>不过,这个类最好是[Serializable],并且提供满足ISerializable协议的构造方法:</P>
<P>[Serializable] public class MyFrameworkException : Exception<BR>{<BR> public MyFrameworkException(string msg):base(msg){}<BR> public MyFrameworkException(SerializationInfo info,StreamingContext context):base(info,context){}<BR>}</P>
<P>当然,如果有成员数据,最好</P>
<P> public override void GetObjectData(SerializationInfo info, StreamingContext context)<BR>{<BR> base.GetObjectData (info, context);<BR> //添加自己的数据。。<BR>}</P>
<p class="postfoot" align="right">
2004-05-26 09:57:00
by
<a id="RecentPosts__ctl23_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/lostinet/">Lostinet</a>
【评论:4)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl24_Hyperlink2" href="http://blog.joycode.com/xinz/posts/22589.aspx">大家好 - 开场白</a></h3>
<P>应 Charles Li 和 开心就好的邀请,也出一次 blog 的麻疹。</P>
<P>关于我:</P>
<P><A href="http://www.microsoft.com/china/community/Professional/Chime/chimepeople.aspx">http://www.microsoft.com/china/community/Professional/Chime/chimepeople.aspx</A> 邹欣 </P>
<P>一些想法:</P>
<P>1。blog 尽量用中文写 - <STRIKE>so far</STRIKE> 迄今为止,好像也不难。<BR>2。坚持和技术有关 - 和大家一样,我对万事万物都有看法,人生经历也可歌可泣,但是这些都留到另外的地方发表吧。<BR>3。主题1 - 软件工程,我对此一直有兴趣,希望能和大家讨论。<BR>4。主题2 - VS.NET Burton,就是新的VS.NET 软件开发系统,我是其中的程序员之一,自然要自吹自擂一番。</P>
<P>看到已经有不少同志宣布了 vs.net team server 的消息,看来我只能找一些“以现状提供,无品质保证”的内幕了。</P>
<P> </P>
<p class="postfoot" align="right">
2004-05-26 05:17:00
by
<a id="RecentPosts__ctl24_Hyperlink3" class="clsSubText" href="http://blog.joycode.com/xinz/">可以清心也</a>
【评论:10)】
</p>
</div>
<div class="post">
<h3>
<a id="RecentPosts__ctl25_Hyperlink2" href="http://blog.joycode.com/lost
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -