问题列表 - 第35447页

Python DNS 服务器

我正在向当前的项目添加一项功能,该功能将允许网络管理员将软件安装到网络上。我需要用 Python 编写一个 DNS 服务器,如果请求地址在我的列表中,它允许我重定向到某个页面。我能够编写服务器,只是不知道如何重定向。

谢谢。我在 Windows XP 上使用 Python 2.6。

python windows dns redirect

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

在构造函数中使用HttpContextBase时出现Structuremap错误

我正在.NET 4.0上构建一个ASP.NET MVC 2.0应用程序,并使用Structuremap 2.6.1 for IoC.我最近添加了一个ICookie和Cookie类,Cookie类将HttpContextBase作为构造函数参数(见下文),现在当我运行我的应用程序时,我收到此错误:没有为PluginFamily System.Web.HttpContextBase定义默认实例.

我之前在另一个具有相同堆栈的MVC应用程序中使用过此方法,但没有收到此错误.我错过了什么吗?如果我确实需要在我的structuremap配置文件中为HttoContextBase添加一些映射代码,我会使用什么?

帮助会很棒!!!

Cookie.cs

public class Cookie : ICookie
{
    private readonly HttpContextBase _httpContext;
    private static bool defaultHttpOnly = true;
    private static float defaultExpireDurationInDays = 1;
    private readonly ICryptographer _cryptographer;
    public Cookie(HttpContextBase httpContext, ICryptographer cryptographer)
    {
        Check.Argument.IsNotNull(httpContext, "httpContext");
        Check.Argument.IsNotNull(cryptographer, "cryptographer");
        _cryptographer = cryptographer;
        _httpContext = httpContext;
    }
    public static bool DefaultHttpOnly
    {
        [DebuggerStepThrough]
        get { return defaultHttpOnly; }

        [DebuggerStepThrough]
        set { defaultHttpOnly = value; }
    }

    public static float DefaultExpireDurationInDays
    {
        [DebuggerStepThrough]
        get …
Run Code Online (Sandbox Code Playgroud)

structuremap asp.net .net-4.0 asp.net-mvc-2

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

同一列是否可以将主键和外键约束添加到另一列

同一列是否可以将主键和外键约束到另一列?

Table1: ID - Primary column, foreign key constraint for Table2 ID
Table2: ID - Primary column, Name 
Run Code Online (Sandbox Code Playgroud)

如果我尝试删除table1数据,这会是一个问题吗?

Delete from table1 where ID=1000;
Run Code Online (Sandbox Code Playgroud)

谢谢.

mysql sql foreign-keys

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

删除链接在Rails 3视图中发送"Get"而不是"Delete"

我正在使用Rails 3,并且有一个页面可以输出数据库中的帖子列表.我希望能够从链接中删除帖子.

下面的第二个例子有效,但第一个没有.谁知道为什么第一个不起作用?我的观点包含:

# this link sends a "GET" request which asks for the #show function  
<%= link_to 'Delete', post, :method => :delete %>

# this link sends the proper "DELETE" request which asks for the #destroy function
<%= button_to 'Delete', post, :method => :delete %>
Run Code Online (Sandbox Code Playgroud)

我的路线文件包含以下内容:

resources :posts 
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3

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

在C++中创建对象时出现"未解析的外部符号"错误

我是一个经验丰富的程序员,但我现在正在深入研究C++,而且......比...更难......比PHP和Python更难.尝试从某些类创建对象时,我一直有未解决的外部错误.它分为多个标题和文件,但这是我的一个类的基本想法:

die.h:

#ifndef DIE_H
#define DIE_H

using namespace std;

class Die {
 public: 
  int throwDie();
  Die();
};

#endif
Run Code Online (Sandbox Code Playgroud)

die.cpp

#include <iostream>
#include <cstdlib>
#include "Die.h"

using namespace std;

int Die::throwDie() 
{
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

sixsidedie.h

#ifndef SIXSIDEDIE_H
#define SIXSIDEDIE_H

#include "Die.h"

using namespace std;

class SixSideDie : public Die
{
 public:
  SixSideDie();
  int throwDie();

 private: 
         int randNumber;
};

#endif
Run Code Online (Sandbox Code Playgroud)

sixsidedie.cpp

#include <iostream>
#include <cstdlib>
#include <time.h>
#include "Die.h"
#include "SixSideDie.h"

using namespace std;

const int SIX_SIDE = 6;

int SixSideDie::throwDie() …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance class

0
推荐指数
1
解决办法
1330
查看次数

Windows Phone 7中哪种背景颜色处于活动状态?

我怎么知道WP7是处于暗模式还是亮模式?我想根据哪种模式处于活动状态来显示不同的图像.

silverlight windows-phone-7

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

链表有哪些用途?

链接列表是否具有任何实际用途.许多计算机科学书籍将它们与数组进行比较,并说它们的主要优点是它们是可变的.但是,大多数语言都提供可变版本的数组.链接列表在现实世界中是否有任何实际用途,或者它们只是计算机科学理论的一部分?

computer-science linked-list data-structures

16
推荐指数
5
解决办法
4万
查看次数

多次迭代的循环?

鉴于:

x = ['a','b','c','d','e']
y = ['1','2','3']
Run Code Online (Sandbox Code Playgroud)

我想迭代导致:

a, 1
b, 2
c, 3
d, 1
e, 2
a, 3
b, 1
Run Code Online (Sandbox Code Playgroud)

...两个iterables独立循环直到给定计数.

Python的循环(可迭代)可以做到这一点w/1 iterable.map和itertools.izip_longest等函数可以使用函数来处理None,但不提供内置的自动重复.

一个不那么狡猾的想法是将每个列表连接到一定的大小,我可以从中均匀地迭代.(Boooo!)

建议?提前致谢.

python

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

如何更新神经网络反向传播中的偏差?

有人可以向我解释如何在整个反向传播中更新偏见吗?

我读了不少书,但找不到偏见更新!

我知道偏差是1的额外输入,附加了一个重量(对于每个神经元).必须有一个公式.

谢谢,

@msw

最有趣的.谢谢,我认为有两个好点:1."如果省略偏差项,多层感知器的"通用近似"属性与最常用的隐藏层激活函数不成立.但Hornik(1993)证明了没有偏差的通用逼近性质的充分条件是激活函数的衍生物在原点处没有消失,这意味着利用通常的S形激活函数,可以使用固定的非零偏置项代替可训练的偏差.2.偏差项可以像其他权重一样学习."所以我要么增加'恒定权重',要么像所有其他权重一样使用梯度下降训练这个权重.

我理解对吗?

math artificial-intelligence machine-learning neural-network

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

Sharepoint 2010与SPSite构造函数的FileNotFound异常

我尝试在控制台应用程序中在服务器场服务器上实例化SPSite实例,并在参数中提供整个网站(http:// sp2010 /).我还确保运行MyApp.exe的帐户是网站集管理员.

但是,无论我想做什么,我都无法制作SPSite的实例.我总是回复"FileNotFoundException".

有人有个主意吗?

堆栈跟踪:

System.IO.FileNotFoundException:找不到http:// localhost/sandbox上的Web应用程序.验证您是否正确输入了URL.如果URL应该为现有内容提供服务,则系统管理员可能需要将新请求URL映射添加到预期应用程序.在Microsoft.SharePoint.SPSite..ctor(SPFarm farm,Uri requestUri,Boolean contextSite,SPUserToken userToken)的Microsoft.SharePoint.SPSite..ctor(String requestUrl)at Conchango.xyzzy.GetExistingDocument(String minId,String maxId,String titleFilter) )在C:\ Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\xyzzy\BDC_DocReview\BDC_DocReview\DocReviewFacade.asmx.cs:第69行

当我使用App Pool Identity帐户运行此应用程序时,它工作正常.但是,当我使用不同的用户(即网站集管理员,Farm Admin)运行此控制台应用程序时,对于Sharepoint Web应用程序的内容数据库具有dbowner权限..它无法正常工作,并且给了我这个Filenot Founf异常.

Console应用程序使用.Net Framework 3.5和x64作为CPU平台.如果我使用应用程序池身份帐户,但是不使用任何其他帐户,这又有效

sharepoint sharepoint-2010

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