小编Lie*_*oen的帖子

代码合同减慢了Visual Studio 2008的速度

自从我开始在Visual Studio 2008(C#)中使用代码约定以来,构建我的dll的速度非常慢.我没有打开静态检查,但显然重写需要永远......

有没有办法解决这个问题,这将在未来版本的Microsoft Code Contracts中得到改进吗?

更新:在VS2008中构建时,即使在程序集的属性中关闭静态分析,它也会为每个dll运行静态分析...

code-contracts visual-studio-2008

3
推荐指数
1
解决办法
564
查看次数

IIS7集成模式中不存在HttpContext.Current

我刚刚从经典模式切换到集成模式,现在我的ASP.NET应用程序中似乎不存在HttpContext.我甚至无法向HttpContext添加Watch,也不能添加HttpContext.Current.

我正在使用FluorineFX,在Web.config中定义了一个HttpModule.显然,在IIS7集成模式下,需要将这些HttpModule添加到System.WebServer中的Modules部分.我已经这样做了,但现在我遇到了这个HttpContext问题......

任何想法为什么会发生这种情况?

代码在Flex(amf)调用的简单服务类中.

if (HttpContext.Current.User.Identity != null)
{
    ...
Run Code Online (Sandbox Code Playgroud)

Web.Config(我不知道如何在Stack中正确显示这个...):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
        <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <sectionGroup name="fluorinefx">
      <section name="settings" type="FluorineFx.Configuration.XmlConfigurator, FluorineFx" requirePermission="false"/>
    </sectionGroup>
    <sectionGroup name="spring">
            <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
        </sectionGroup>
    </configSections>
  <cachingConfiguration configSource="WebCachingConfiguration.config"/>
  <dataConfiguration defaultDatabase="ConnectionString"/>
  <spring>
        <context>
      <resource uri="~/spring/Commands.xml"/>
      <resource uri="~/spring/Management.xml"/>
      <resource uri="~/spring/DomainModel.xml"/>
      <resource uri="~/spring/Repositories.xml"/>
      <resource uri="~/spring/Services.xml"/>
            <resource uri="~/spring/MsmqQueues.xml"/>
      <resource uri="~/spring/MsmqMessageQueueTemplates.xml"/>
      <resource uri="~/spring/Jobs.xml"/>
        </context> …
Run Code Online (Sandbox Code Playgroud)

asp.net iis-7 fluorinefx

3
推荐指数
1
解决办法
3373
查看次数

压缩swf文件是否有可能导致更大的文件?

当我GZIP一个swf文件时,大小从1,21 mb到1,86 mb ......所以,我的问题有点自己回答.真正的问题是这是如何可能的?我想,正如我的同事所说,swf已经是二进制的,不能再被压缩了.

结论也是不应该执行压缩swf文件.

apache-flex flash gzip

3
推荐指数
2
解决办法
502
查看次数

你能确保所有线程都是以特定文化开始的吗?

在我的Windows服务中,Spring.NET创建了一些处理作业的线程.是否有可能确保所有这些线程都是以特定文化开始的?或者我必须在每个线程中设置文化?

在ASP.NET中,您可以在应用程序级别设置文化(web.config中的全球化标记)...这可以在Windows窗体/ Windows服务中完成吗?

.net culture multithreading

3
推荐指数
1
解决办法
1201
查看次数

在Rails中为每个日志添加会话ID

有没有办法将会话ID添加到Rails中的每个日志.

现在,我在环境中添加了这个.rb:

class Logger
  def format_message(severity, timestamp, progname, msg)
    "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" 
  end 
end
Run Code Online (Sandbox Code Playgroud)

首先,这是最好的做法吗?我如何添加会话ID?

ruby-on-rails-3

3
推荐指数
1
解决办法
7570
查看次数

在Visual Studio中的宏中设置断点

有没有办法在Visual Studio里面为C代码设置一个断点#define?当我设置断点时,它未到达,其余代码继续执行.例如:

#define YY_USER_ACTION sn_yylloc.first_line = sn_yylloc.last_line =sn_yylineno; \
sn_yylloc.first_column = sn_yycolumn; \
sn_yylloc.last_column = sn_yycolumn + sn_yyleng -1; \
sn_yycolumn += sn_yyleng;
Run Code Online (Sandbox Code Playgroud)

代码是Flex生成的词法分析器,但这并不重要.

c macros breakpoints visual-studio-2012

3
推荐指数
1
解决办法
1664
查看次数

ASP.NET清除缓存

如果你用HttpHandler缓存页面

_context.Response.Cache.SetCacheability(HttpCacheability.Public);
_context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(180));
Run Code Online (Sandbox Code Playgroud)

是否可以从缓存中清除某个页面?

asp.net caching

2
推荐指数
1
解决办法
1万
查看次数

找不到类型为"System.Web.HttpPostedFile"的构造函数

我正在尝试用HttpPostedFile创建一个实例

var obj2 = Activator.CreateInstance(
    typeof(HttpPostedFile), 
    BindingFlags.NonPublic | BindingFlags.Instance,
    null,
    new object[] { },
    System.Globalization.CultureInfo.CurrentCulture
);
Run Code Online (Sandbox Code Playgroud)

但我收到错误'类型'构造函数'System.Web.HttpPostedFile'找不到.'.

有没有其他方法来创建HttpPostedFile的实例或我做错了什么?

c# asp.net reflection

2
推荐指数
1
解决办法
4026
查看次数

如何将SqlServer数据库移植到MySQL?

我有一个SqlServer数据库,我想移植到MySQL.什么是最好的方法.需要移植的东西是:

  • 表(和数据)
  • FileStream→MySQL等效?
  • 存储过程
  • 功能

mysql sql t-sql sql-server

2
推荐指数
1
解决办法
1726
查看次数

flex-mojos的问题

如果我在http://flexmojos.sonatype.org/getting-started.html上尝试入门,我会遇到一些错误.有人可以帮帮我吗?我是maven的新手,但由于它是一个入门,我一直在跳'一切都会顺利......不是.

错误:

Missing:
----------
1) net.sf.saxon:saxon-dom:jar:9.0

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dv
ersion=9.0 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:

      mvn deploy:deploy-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dver
sion=9.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.sonatype.flexmojos:flexmojos-maven-plugin:maven-plugin:3.4.2
        2) net.sf.saxon:saxon-dom:jar:9.0

2) org.graniteds:granite-generator-share:jar:2.0.0.GA

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file …
Run Code Online (Sandbox Code Playgroud)

flex-mojos maven

2
推荐指数
1
解决办法
3782
查看次数