小编Bra*_*ani的帖子

ASP.Net调试目录监视HttpException

当我在调试模式下启动我的ASP.Net 4.0 Web应用程序时,我收到以下异常:

System.Web.HttpException occurred
  Message=Invalid file name for file monitoring: 'C:\src\main-232\src\ZNode\Znode_MultiFront\Web\Controls\Cat5\Navigation'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
  Source=System.Web
  ErrorCode=-2147024809
  WebEventCode=0
  StackTrace:
       at System.Web.DirectoryMonitor.AddFileMonitor(String file)
  InnerException: 
Run Code Online (Sandbox Code Playgroud)

问题是,这是指向IS目录的文件,为什么Visual Studio 2010认为它是一个文件?我在本地计算机上的IIS 7上运行它

asp.net debugging httpexception

10
推荐指数
2
解决办法
5931
查看次数

插入一行并返回其主键

在SSIS中,如何使用执行SQL任务插入没有参数的单行并获取主键,以便将其设置为用户变量?我的插入查询很简单:

INSERT INTO [AdWords.ImportData] (EndDate) VALUES (null)
Run Code Online (Sandbox Code Playgroud)

ssis

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

不同命名空间中的Asp.Net MVC 3自定义WebViewPage打破了IntelliSense

我有自定义类,使用此处概述的方法扩展WebViewPage,我将其用作所有Razor视图的基础:http://haacked.com/archive/2011/02/21/changing-base-type-of-a- razor-view.aspx.一切正常,除非我将它移动到与视图命名空间不同的命名空间,因此IntelliSense停止工作(是的,我在system.web.webPages.razor部分的名称空间部分中包含了自定义WebViewPage的命名空间. views文件夹中的web.config).有没有解决的办法?

我最终想要做的是将所有视图移动到图形设计者可以访问的另一个项目中,但我不希望该项目中的自定义WebViewPage类.这可能不会破坏IntelliSense吗?

razor asp.net-mvc-3

9
推荐指数
1
解决办法
6681
查看次数

如何在Rails视图中使用Ruby优化?

我有一个使用Ruby 2.0的Rails 4项目.我已经定义了一些改进.把

<% using MyRefinements %>
Run Code Online (Sandbox Code Playgroud)

在视图文件的顶部导致错误"未定义的方法'使用'".

当我添加:

using MyRefinements
Run Code Online (Sandbox Code Playgroud)

在我的控制器的顶部(在类声明之上),我可以成功地使用控制器中的细化,但是如果我尝试在视图中使用它,我会收到"未定义的方法"错误.

谢谢!

ruby-2.0 ruby-on-rails-4 refinements

9
推荐指数
1
解决办法
545
查看次数

Linq获取的值不会在多个列表中共享

编写一个比较n个列表并返回所有未出现在所有列表中的值的方法的最有效方法是什么,以便

var lists = new List<List<int>> {
                                  new List<int> { 1, 2, 3, 4 },
                                  new List<int> { 2, 3, 4, 5, 8 },
                                  new List<int> { 2, 3, 4, 5, 9, 9 },
                                  new List<int> { 2, 3, 3, 4, 9, 10 }
                                };


public IEnumerable<T> GetNonShared(this IEnumerable<IEnumerable<T>> lists)
{
  //...fast algorithm here
}
Run Code Online (Sandbox Code Playgroud)

以便

lists.GetNonShared();

返回1,5,8,9,10

我有

public IEnumerable<T> GetNonShared(this IEnumerable<IEnumerable<T>> lists)
{
  return list.SelectMany(item => item)
             .Except(lists.Aggregate((a, b) => a.Intersect(b));
}
Run Code Online (Sandbox Code Playgroud)

但我不确定这是否有效.订单无关紧要.谢谢!

c# linq array-algorithms

8
推荐指数
1
解决办法
1019
查看次数

在T-SQL中分解2列以上的表

如果我有下表

Hour    Clicks  Conversions
12:00   2   0
1:00    3   2
2:00    1   1
Run Code Online (Sandbox Code Playgroud)

我如何编写一个SELECT语句,在两列中分解它,所以我得到:

12:00   1   0
12:00   1   0
1:00    1   0
1:00    1   1
1:00    1   1
2:00    1   1
Run Code Online (Sandbox Code Playgroud)

如果我不能用SELECT做到这一点,我如何用循环编写存储过程?

谢谢!

t-sql stored-procedures sql-server-2008

7
推荐指数
1
解决办法
358
查看次数

Docker:bash终端启动时没有提示

我有一个简单的容器,如下所示:

FROM devbox/rails3.2.1

RUN apt-get install -y -q libmysql-ruby libmysqlclient-dev
RUN apt-get install -y -q libqtwebkit-dev
EXPOSE 3000
CMD /bin/bash
Run Code Online (Sandbox Code Playgroud)

其中devbox/rails3.2.1是我创建的以'FROM ubuntu'开头并安装Ruby on Rails的容器.这是使用Ubuntu 12.04.3 LTS在Vagrant Virtual Box VM中运行的.当我使用以下方式运行时:

 docker run -t -i -name myapp -p 3000:3000 -v /src/myapp:/src/myapp -link myappsql:myappsql devbox/myapp
Run Code Online (Sandbox Code Playgroud)

容器启动,但我的终端显示一个空白行,没有提示,键入不执行任何操作.如果我运行docker ps,我可以看到容器正在运行.更奇怪的是,如果我打开第二个终端并运行'docker attach myapp',我会得到一个正常运行的终端(虽然我必须先按Enter键)然后如果我切换回我的第一个终端并输入,输出会出现在我的第二个终端!

任何帮助非常感谢.

bash ubuntu ubuntu-12.04 docker

5
推荐指数
1
解决办法
3364
查看次数

Ember.js:未捕获的TypeError:无法在transitionTo上读取未定义的属性"enter"

我有一个相当简单的Ember.js应用程序.在视图中我调用this.transitionTo给出了错误:

未捕获的TypeError:无法读取未定义的属性"enter"

错误发生在第24596行的ember.js中,其中currentState未定义

以下是我的应用的相关部分:

window.Plan = Ember.Application.create({});

        Plan.Router = Ember.Router.extend({
        location: 'hash'
    });

    Plan.IndexController = Ember.ObjectController.extend({

    });


    Plan.Router.map(function() {
        this.route('application', { path: '/' })
        this.route('index', { path: "/:current_savings/:monthly_deposit/:time_horizon" });
    });

    Plan.ApplicationRoute = Ember.Route.extend({
        redirect: function(){
            this.transitionTo('index', 200, 200, 200);
        }
    })

    Plan.IndexRoute = Ember.Route.extend({
        model: function(params) {
            var result = this.store.find('calculation', params).then(function(data) {
                return data.content[0];
            });

            return result;
        }
    });

    Plan.CurrentSavingsTextField = Ember.TextField.extend({
        focusOut: function() {
            this.transitionTo('index', 150, 200, 200);
        }
    });

    Plan.MonthlyContributionTextField = Ember.TextField.extend({
        focusOut: function() {
            this.transitionTo('index', 150, …
Run Code Online (Sandbox Code Playgroud)

ember.js ember-data ember-router

5
推荐指数
1
解决办法
5271
查看次数

在 Heroku 上安装私有 ssh 部署密钥

我正在创建一个 node.js 应用程序,作为 Github 的 Web 钩子,在推送更改时将自动部署某个私有存储库。为了使 webhook 应用程序尽可能高效,我想在部署时将私有 repo 克隆并拉入 webhook 的 Heroku 实例中的临时目录中,这样当 webhook 触发时,我只需要“git pull”即可获取最新信息更新并部署它们。在部署 webhook 应用程序时运行 shell 脚本很容易(使用 package.json 或 Procfile),但在我运行 git 命令之前,我必须安装私有部署密钥。目前,私钥和公钥在我的 webhook 存储库中(我知道,我知道,一旦我开始工作,我会做得更好)所以我尝试通过将其添加到我的 shell 脚本中来安装它(这里建议)

mkdir /app/.ssh
cp config/ssh/* /app/.ssh/
mkdir /tmp/repos
git clone --bare ssh://github.com/<username>/<repo>.git /tmp/repos/<repo>
Run Code Online (Sandbox Code Playgroud)

但我得到:

初始化 /tmp/repos/assets/ 中的空 Git 存储库主机密钥验证失败。致命:远端意外挂断

公钥已作为部署密钥添加到我正在提取的存储库中,所以我的问题是:

  • 我是否将私钥安装在正确的目录中?
  • 私钥文件是否必须具有特定名称?
  • 这种方法甚至可能/推荐吗?
  • 如果不是,最好的选择是什么?

谢谢!

github heroku ssh-keys

5
推荐指数
1
解决办法
3074
查看次数

将params传递到Mail on R中的MailView或ActionMailer :: Preview

是否可以使用MailView gem或Rails 4.1邮件预览将参数传递到MailView?我希望能够在预览URL中使用查询字符串参数并在MailView中访问它们以动态选择要在预览中显示的记录.

ruby-on-rails

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

键入不匹配插入:带有Ecto变更集的binary_id

我有一张applications带有外键的桌子,user_id这是一张Postgres uuid.我有我的web.ex:

  @primary_key {:id, :binary_id, autogenerate: true}
  @foreign_key_type :binary_id
Run Code Online (Sandbox Code Playgroud)

我的模型是:

defmodule Dashboard.Application do
  use Dashboard.Web, :model

  alias Dashboard.User
  alias Dashboard.Path

  schema "applications" do
    field :name, :string
    belongs_to :user, User
    has_many :paths, Path
    timestamps
  end

  @required_fields ~w(name user_id)
  @optional_fields ~w()

  def changeset(model, params \\ :empty) do
    model
    |> cast(params, @required_fields, @optional_fields)
  end
end
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用我的users表中的有效uuid进行带有变更集的插入时,我得到了

[error] #PID<0.407.0> running Dashboard.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /applications
** (exit) an exception was raised:
    ** …
Run Code Online (Sandbox Code Playgroud)

elixir ecto phoenix-framework

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

为什么Apache Kafka使用者不使用Log4j2根记录器?

我有这个配置:

的pom.xml

<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-api</artifactId>
  <version>2.11.1</version>
</dependency>
<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-core</artifactId>
  <version>2.11.1</version>
</dependency>

<dependency>
  <groupId>org.apache.kafka</groupId>
  <artifactId>kafka-clients</artifactId>
  <version>1.0.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

资源/ log4j2.properties

name=PropertiesConfig
appenders = console
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
rootLogger.level = ERROR
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT
Run Code Online (Sandbox Code Playgroud)

当我开始使用Kafka消费者时org.apache.kafka.clients.consumer.KafkaConsumer,它会在该INFO级别进行记录.我创建的任何新记录器都使用LogManager.getLogger(name)了级别的配置和日志ERROR,因此我知道log4j2.properties正在加载和使用该文件.卡夫卡似乎无视它.在日志中,当Kafka消费者启动时,我会看到这一行:

Aug 20, 2018 11:03:37 PM org.apache.kafka.common.utils.LogContext$KafkaLogger info

任何帮助赞赏!

java slf4j apache-kafka log4j2 kafka-consumer-api

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