小编Ric*_*III的帖子

如何为每个项目配置设置不同的项目依赖项?

我想拥有不同的项目依赖项,具体取决于我目前正在构建的项目配置.

例如,我不想在Release配置中构建和链接SomeTestLib.vcproj,但我想在Debug中构建并链接到它.

一种解决方案,即sorta工作,是使用条件编译宏:

#ifdef DEBUG  
#pragma comment( lib, "SomeTestLib" )  
#endif
Run Code Online (Sandbox Code Playgroud)

但在这种情况下,调试器和IntelliSense不适用于SomeTestLib.
是否有我可以使用的.sln或.vcproj hack?
谢谢.

solution vcproj visual-studio

6
推荐指数
1
解决办法
4286
查看次数

VS损坏的.sln文件?

当我尝试打开我的.sln文件时,Visual Studio退出了我.我可以通过打开TFS,获取特定版本,选择最新版本,强制覆盖,打开.sln文件,然后忽略"不兼容的文档消息"来打开它.

但是,我想知道什么是错的以及如何修复它,以防有一天我不能这样做.

怎么解决这个问题?

tfs solution corruption visual-studio

6
推荐指数
1
解决办法
9833
查看次数

Objective-C正确创建只有一个实例的类的方法

我正在尝试直接实现一个类,即NSObject在使用它的应用程序运行的整个过程中只能有一个实例可用.

目前我有这种方法:

// MyClass.h

@interface MyClass : NSObject

+(MyClass *) instance;

@end
Run Code Online (Sandbox Code Playgroud)

并实施:

// MyClass.m

// static instance of MyClass
static MyClass *s_instance;

@implementation MyClass

-(id) init
{
    [self dealloc];
    [NSException raise:@"No instances allowed of type MyClass" format:@"Cannot create instance of MyClass. Use the static instance method instead."];

    return nil;
}

-(id) initInstance
{
    return [super init];
}

+(MyClass *) instance {
    if (s_instance == nil)
    {
        s_instance = [[DefaultLiteralComparator alloc] initInstance];
    }

    return s_instance;    
}

@end
Run Code Online (Sandbox Code Playgroud)

这是完成这项任务的正确方法吗? …

initialization objective-c

6
推荐指数
1
解决办法
3342
查看次数

如何从Bloomberg API获得交易假期

我正在使用Bloomberg Java api下载交易数据.我需要有人告诉我是否存在可以返回交易假期列表的功能.我查看了手册但找不到一个.如果没有这样的东西,有没有一种方法可以创造一个?谢谢.

java api bloomberg

6
推荐指数
1
解决办法
9167
查看次数

哪个运算符更快(>或> =),(<或<=)?

是否<比<=(和>更快)更便宜(更快)>=?

免责声明:我知道我可以测量,但这只会在我的机器上,我不确定答案是否可能是"特定于实现"或类似的东西.

c optimization performance assembly operators

6
推荐指数
2
解决办法
3037
查看次数

无法加载文件或程序集Microsoft.ApplicationServer.Caching.Core

我正在尝试使用Windows Azure缓存预览.

我有一个专用缓存工作者角色,一个使用以前缓存的webrole,以及一个持续更新缓存的工作者角色.

我按照Windows Azure指南中的说明操作,但仍然出现错误:

无法加载文件或程序集"Microsoft.ApplicationServer.Caching.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

我加倍三重1000000检查依赖,有正确的.我注意到有两组dll:我想要使用的版本1.0.0.0,以及我不想要的另一个版本101.0.0.0.我BindingRedirect在所有.config文件中添加了语句,将101个版本映射到1.0.0.0我检查了\ bin文件夹,用Jetbrains反编译了dll,它们是正确的.我开始失去耐心.为什么.NET在我放置显式路径时不采用我指定的DLL?

azure azure-caching

6
推荐指数
1
解决办法
6071
查看次数

存储在共存Azure缓存中的会话在多个实例上不同步

对于我的MVC4应用程序,在Azure中运行,我将会话存储在共存的缓存中.如Microsoft提供的本方法文档中所述.

我运行两个小实例,一切似乎都运行正常.我可以登录到应用程序,当我在应用程序中浏览时,我仍然保持登录状态.因此,会话似乎适用于两个实例.

但是,当我更新会话数据时,如下所示:

HttpContext.Current.Session["someVar"] = "new value";
Run Code Online (Sandbox Code Playgroud)

该更改似乎只对处理该特定请求的实例产生影响.现在,当我浏览应用程序时,有时我得到初始值,有时我得到更新的值.

我没有对web.config进行任何更改,因此它看起来与Nuget包添加时完全一样:

<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
  <providers>
    <add name="AppFabricCacheSessionStoreProvider"
          type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
          cacheName="default"
          useBlobMode="true"
          dataCacheClientName="default" />
  </providers>
</sessionState>
Run Code Online (Sandbox Code Playgroud)

在使用Azure缓存时,是否需要以其他方式处理会话,或者这是我在这里缺少的其他内容?

c# asp.net asp.net-mvc azure azure-caching

6
推荐指数
1
解决办法
1294
查看次数

Azure Web角色抛出的web.config中无法识别的元素"autoDiscover"

我正在尝试在两个Web角色实例上运行的共存缓存上使用会话状态提供程序进行Windows Azure缓存.我有一个ASP.NET MVC4项目.我按照微软的指导如何设置它,并经历了多次,但结果相同.当我发布到Azure时,我在每个页面上都有一个YSOD.

我已经浏览了我的Azure实例上的日志,发现了可能导致此问题的异常:

Event code: 3008 
Event message: A configuration error has occurred. 

...

Exception information: 
    Exception type: DataCacheException 
    Exception message: ErrorCode<ERRCMC0003>:SubStatus<ES0001>:Error in client configuration file.
   at Microsoft.ApplicationServer.Caching.ConfigFile.ThrowException(Int32 errorCode, Exception e)
   at Microsoft.ApplicationServer.Caching.ClientConfigReader.Init(String path)
   at Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration..cctor()

Unrecognized element 'autoDiscover'. (E:\sitesroot\0\web.config line 20)
   at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc azure azure-caching

6
推荐指数
1
解决办法
1640
查看次数

Web应用程序应在缓存中存储什么?

我意识到这可能是一个模糊的问题,而遗赠却是一个模糊的答案,但是我需要一些用于为Web应用程序缓存数据的真实示例,想法和/或最佳实践。我阅读的所有示例本质上都是技术性更高的(如何从相应的缓存存储区添加或删除缓存数据),但是我无法找到更高级的缓存策略。

例如,我的Web应用程序为每个用户提供一个收件箱/邮件功能。到目前为止,我一直在将典型的会话数据存储在缓存中。在此示例中,当用户登录时,我进入数据库并检索用户的邮件并将其存储在缓存中。我开始怀疑我是否应该一直只是在缓存中维护所有用户消息的副本,并且仅在需要时从缓存中检索它们,而不是在登录时从数据库中加载它们。我在登录时(产品目录和相关实体)还加载了一堆其他数据,并且登录开始变慢。

因此,我想向社区提出我的问题,在这种情况下,您会/建议采取什么措施?

谢谢。

optimization memcached caching web-applications azure-caching

6
推荐指数
1
解决办法
1640
查看次数

无法在Azure网站中使用缓存

我正在尝试在我的Windows Azure网站上运行缓存.缓存是在我的一个Worker Roles上配置的.

我用这篇文章开始:http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/

最初,由于缺少程序集错误,我无法使Azure Cache Client dll正常工作.

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'msshrtmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

虽然我已经得到了这篇文章的帮助来解决这个问题:http://www.thedailyparker.com/PermaLink,guid,0be6425e-b509-4122-af01-7086ce2f811e.aspx

但接下来我遇到了SEHException,听起来像配置问题.虽然我不知道我错过了什么.例外细节:

[SEHException (0x80004005): External component has thrown an exception.]
   RdGetApplicationConfigurationSetting(UInt16* , UInt16** ) +0
   RoleEnvironmentGetConfigurationSettingValueW(UInt16* pszName, UInt16* pszDest, UInt32 cchDest, UInt32* …
Run Code Online (Sandbox Code Playgroud)

azure azure-web-sites azure-caching

6
推荐指数
1
解决办法
2561
查看次数