最新评论
Re:我对Singleton模式的泛型解决方案的改进 Alan@Net 2010-11-30 15:50
NGenerics的代码:
public static class Singleton<T>
{
#region Delegates
/// <summary>
/// A custom delegate for the creation of objects. Used instead of Func for backwards compatibility with .NET 2.
/// </summary>
public delegate T FactoryDelegate();
#endregion
#region Globals
private static FactoryDelegate createInstance = Activator.CreateInstance<T>;
#endregion
#region Public Members
/// <summary>
/// Sets a method of construction of the value of this singleton.
/// </summary>
/// <value>The construct with.</value>
/// <example>
/// <code source="..\..\Source\Examples\ExampleLibraryCSharp\DataStructures\General\SingletonExamples.cs" region="ConstructWith" lang="cs" title="The following example shows how to use the ConstructWith property."/>
/// <code source="..\..\Source\Examples\ExampleLibraryVB\DataStructures\General\SingletonExamples.vb" region="ConstructWith" lang="vbnet" title="The following example shows how to use the ConstructWith property."/>
/// </example>
public static FactoryDelegate ConstructWith
{
set
{
if (value != null)
{
createInstance = value;
RuntimeHelpers.RunClassConstructor(typeof(Container).TypeHandle);
}
}
}
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>The instance.</value>
/// <example>
/// <code source="..\..\Source\Examples\ExampleLibraryCSharp\DataStructures\General\SingletonExamples.cs" region="Singleton" lang="cs" title="The following example shows how to use the Instance method."/>
/// <code source="..\..\Source\Examples\ExampleLibraryVB\DataStructures\General\SingletonExamples.vb" region="Singleton" lang="vbnet" title="The following example shows how to use the Instance method."/>
/// </example>
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
public static T Instance
{
get
{
return Container.Instance;
}
}
#endregion
#region Nested type: Container
/// <summary>
/// Internal container class fo the actual value - needed so that the CLR
/// can guarantee thread safety.
/// </summary>
private static class Container
{
internal static readonly T Instance = createInstance();
}
#endregion
}
Re:看看baidu是如何AJAX跨域的 chyingp 2010-10-12 13:25
LZ只是把代码贴了上去,希望能够稍微解释一下是这个过程是怎么实现的,因为只有一堆的函数在这里,缺乏上下文,看着也是晕头转向的。。。
Re:Flash还能走多远? Lu@SH 2010-02-25 10:24
Flash的平台优势还是很明显的,Adobe已经为其打造了一整套开发环境,而且更新同步也很快。单从界面开发这方面来看,我个人觉得无人能出其右,而且是整套体系。Flash能走多远,应该归根到Adobe能走多远的问题。就简单的一点来说,纯粹的美工,会更喜欢拿什么来做RIA的应用。我觉得未来是多种技术应用融合的RIA时代。
Re:Flash还能走多远? 被偷De贼 2010-02-24 13:49
一次性看完,深有感触!
对HTML5到来后时,未来市场、程序开发等都有了很高见解~!
允许别人宣称自己是谁,这种标准自身就存在着幼稚的错误。
@司徒正美
UserAgent 翻译成用户代理 就是客户端的意思
和翻墙有何种联系,求解
说错了,是1.3
IE的版本错误问题,现在主推特征探测
不过,UserAgent之所以造成这局面,代理也付一定责任,看来哪个国家也有墙
原来如此,怪说都是Mozilla
@司徒正美
jquery还有3.0的?
所以我才尽力避免用UserAgent,jQuery1.3之前的版本被弄晕了
你怎么确定是正则的问题?难道你加上就有问题,一去掉就没问题,然后再加上就立刻又有问题???
Re:C#获取 Flv视频文件信息 iTech 2009-08-14 21:52
顶,我以前都是用第三方的lib
!
Re:C#获取 Flv视频文件信息 支持 2009-08-13 21:10
这是有用的知识。支持。
在GET方法中使用双重锁的来判断是否存在感觉比较好些,线程安全的。
re: 巧用泛型和Lambda解决只读对象的缓存技巧 passer.net 2009-01-14 15:47
@轻舞flash
不是缓存MyModel对象,而是typof(MyModel).GetProperties()
你缓存MyModel对象,MyModel对象的所有属性不会被缓存?
我试过了,开了一百多个线程都没问题
Birdshover是正确的
re: 我对Singleton模式的泛型解决方案的改进 Barton131420 2009-01-09 15:17
楼主相信Birdshover没错,直接改成private就行了。
re: 我对Singleton模式的泛型解决方案的改进 passer.net 2009-01-09 14:21
@Jeffrey Zhao
http://terrylee.cnblogs.com/archive/2005/12/09/293509.html
查资料 这应该称延迟初始化
也是terrylee推荐的方法
re: 我对Singleton模式的泛型解决方案的改进 passer.net 2009-01-09 14:16
@Jeffrey Zhao
这是基于原作者的算法改进
双check是否是最好的解决方案貌视也有争论
re: 我对Singleton模式的泛型解决方案的改进 passer.net 2009-01-09 14:11
@Birdshover
原文是不可以的
改进之后可以为private
re: 我对Singleton模式的泛型解决方案的改进 passer.net 2009-01-09 14:11
@n_n
本文就是为了解决这个问题
re: 我对Singleton模式的泛型解决方案的改进 Birdshover 2009-01-09 14:07
构造函数public那改成private好了
re: 我对Singleton模式的泛型解决方案的改进 Jeffrey Zhao 2009-01-09 14:00
兄弟你这个完全……不是那么一回事……
double check
缺点:
构造函数只能是public的,导致可能由开发人员的失误引发多个Instance
就这一个缺点就......
re: 看看baidu是如何AJAX跨域的 Andre- 2008-10-05 08:29
博主您好,想跟您请教以下有关这个帖子的详细内容,由于不知道该如何联系您,所以麻烦您给我发封邮件。谢谢了
生成的解决方案用VS2008打开后,Web项目不可用。如何解决?
用lz的模板连接oracle数据库,报错:
OS Version: Microsoft Windows NT 5.1.2600 Service Pack 2
EXE Version: 1.3.0.3
-----------------------------------------------------------------
Date: 2008-7-28 14:51:02
TemplateFileName: E:\suntools\ibatis\ibatis\IBatis多模块.csgen
TemplateIdentifier: 35fe419c-4e2c-4da0-970e-c6db73eff4fa
Class: Template
IsWarning: False
IsRuntime: True
IsTemplateCodeSegment: True
ErrorType: NullReferenceException
SourceLine: EngineExecuteCode
LineNumber: 0
ColumnNumber: 0
Message: 未将对象引用设置到对象的实例。
Detail: 在 Zeus.DotNetScript.DotNetScriptExecutioner.EngineExecuteCode(IZeusCodeSegment segment, IZeusContext context)
在 Zeus.ZeusExecutioner.ExecuteCode(IZeusExecutionHelper helper, IZeusTemplate template, IZeusContext context, ArrayList templateGroupIds)
--------------------------------------------------------
请问是什么问题呢?
谢谢楼主的文章!
“that is a questtion”,questtion???
o(∩_∩)o...
移植到winform下,怎么修改基类BasePage ?
请教LZ,有没有用过Ibatisnet+castle开发过winform的程序呢,如何将一个对象绑定到一个winform的一个gridview控件,然后怎么实现将修改或者新增,删除这些数据保存到数据库呢,谢谢
re: IBatisNet+Castle构架开发指南 petersun 2007-07-31 09:49
原来是个sqlMap,我有几个问题!?
1.效率问题,读取一个xml文件效率会不会高?本身xml的读取速度就很慢的,再加上所有的都放到一个xml里如果项目很大的话那样会不会更慢.
2.文件冲突问题,团队开发的时候,对sqlMap的访问冲突怎么解决?
3.解藕.因为不是真正的ORM,那解藕是不是无法解决?
4.在这个基础上如何实现接口模式开发?
谢谢!
为什么我生成的代码提示找不到IBatisNet??
错误 2 找不到类型或命名空间名称“IBatisNet”(是否缺少 using 指令或程序集引用?)
C:\Program Files\MyGeneration\GeneratedCode\Dao\gleee\GFeaSubjectDao.cs 14 7 gleee.Dao
Castle.Facilities.IBatisNetIntegration,Castle.Facilities.AutomaticTransactionManagement
这两者各自的功能和关系是什么?
在使用(IBatisNet+Castle构架)开发asp.net时在App_Code文件夹下有这么一个基类BasePage (用来初始化容器),现在要把它移植到winForm下面,该怎么改这个基类,放在什么位置
我用模板重新生成一个
运行的时候
AddFacility("IBatisNet", new IBatisNetFacility());
出错了。
那位大哥支个招???????
我也是
AddFacility("IBatisNet", new IBatisNetFacility());
出错了。
AddFacility("IBatisNet", new IBatisNetFacility());
初始化类型异常
@passer.net2
请问你一个问题啊,就是如何用代码来实现VS2005生成解决方案这个过程阿,就是说,比如“用vs2005新建一个asp.net网站,同时在这个解决方案增加一些类库,如BLL、Model、DAL等”这个过程,最后生成的文件有“项目名称.sln,BLL\BLL.csproj, DAL\DAL.csproj, Model\Model.csproj等”
那么,我怎么用代码来生成这些代码呢?谢谢您的回答!