Cannot access the SQL Server 2008 R2 Express database from windows service

Let me begin with saying that i have gone through the various artical which indicates the similar issue but solution posted there are not applicable to my issue. My problem is:- I have on WCF service which is accessing the SQL server database. This wcf service is hosted in windows service. Every thing works fine, But when i restart the computer system then my service fails to connect to SQL s

无法从Windows服务访问SQL Server 2008 R2 Express数据库

首先让我说,我已经通过了各种表明类似问题的文章,但是发布的解决方案并不适用于我的问题。 我的问题是: - 我有访问SQL服务器数据库的WCF服务。 此wcf服务托管在Windows服务中。 每件事情都很好,但是当我重新启动计算机系统时,我的服务无法连接到SQL服务器数据库。 我得到异常 - System.Data.SqlClient.SqlException(0x80131904): 与服务器建立了连接,但在登录过程中发生错误。 (提供程序:共享内存提供程序,

How to use standard validation data annotations with custom types?

Is it possible to use the standard data annotations within the .NET framework (such as StringLength, RegularExpression, Required, etc.) with custom types? What I want to do is something like this: class MyProperty<TValue> { public bool Reset { get; set; } public TValue Value { get; set; } } class MyClass { [Required] [StringLength(32)] MyPrope

如何将标准验证数据注释与自定义类型一起使用?

是否可以在.NET框架中使用标准数据注释(如StringLength,RegularExpression,Required等)和自定义类型? 我想要做的是这样的事情: class MyProperty<TValue> { public bool Reset { get; set; } public TValue Value { get; set; } } class MyClass { [Required] [StringLength(32)] MyProperty<string> Name { get; set; } [StringLength(128)] My

.net mvc 2 validation: summing up values of several attributes

I am using .NET 4 MVC 2 in my project. I basically have two classes, which I use for my validation. Class A is my (main) model, class B is an composite attribute which class A may have. The code looks like the following: [Bind(Exclude = "A_ID")] public class A_Validation { [Required(ErrorMessage = "something is missing")] public string title { get; set; } //

.net mvc 2验证:总结几个属性的值

我在我的项目中使用.NET 4 MVC 2。 我基本上有两个类,我用它来验证。 A类是我的(主)模型,B类是A类可能具有的复合属性。 代码如下所示: [Bind(Exclude = "A_ID")] public class A_Validation { [Required(ErrorMessage = "something is missing")] public string title { get; set; } // some more attributes ... public B b { get; set; } } 我所有基于A类的验证工作

Custom Validation Attribute is not called ASP.NET MVC

Hello everyone I have create custom validation attribute and assign it to class level validation. Unfortunately, it is not called. I try every way that it think it could be solve the problem. However, it take me for hours and I can't find the attribute is not called by validation mechanism. For illustrate you I put the following code. Attribute [AttributeUsage(AttributeTargets.Class,

自定义验证属性不称为ASP.NET MVC

大家好,我已经创建了自定义验证属性并将其分配给类级验证。 不幸的是,它没有被调用。 我想尽一切办法认为它可以解决问题。 然而,它花了我几个小时,我无法找到该属性不被验证机制调用。 为了说明你我把下面的代码。 属性 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class BooleanDependencyAttribute : ValidationAttribute { private const

Minmax algorithm chooses the worst move for some depths

I have to code a player for the FloodWars, the game on Android. So far I succeeded in coding a minmax and a material evaluator, which is straightforward. My problem is that on a specific table, on odd depths greater than 9, it gives the worst move. Here is the table: @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.##

Minmax算法选择一些深度的最差移动

我必须为FloodWars(Android上的游戏)编写代码。 到目前为止,我成功地编写了一个minmax和一个材料评估器,这很简单。 我的问题是,在一个特定的桌子上,奇数以上的深度超过9,这是最糟糕的举动。 这里是表格: @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.## @@**..**@@.#@@.##

Implementing and using MinMax with four in row (connect4) game

I'm trying to implement the MinMax algorithm for four in a row (or connect4 or connect four) game. I think I got the idea of it, it should build a tree of possible boards up to a certain depth, evaluate them and return their score, then we just take the max of those scores. So, aiChooseCol() checks the score of every possible column by calling MinMax() and returns the column with the max

实施和使用四行(connect4)游戏的MinMax

我试图为连续四次(或连接四次或连接四次)游戏实现MinMax算法。 我认为我有这个想法,它应该建立一个可能的板到一定深度的树,评估它们并返回它们的分数,然后我们就取得这些分数的最大值。 因此, aiChooseCol()通过调用MinMax() aiChooseCol()检查每个可能列的得分,并返回最大得分的列。 现在我不确定,这是调用MinMax()的正确方法吗? 检查temp = Math.Max(temp, 1000);是否正确temp = Math.Max(temp, 1000); ?

How to use negamax algorithm

I was wondering how I can use the negamax algorithm. I am trying to write an agent for the game mancala in C#. The algorithm gives you a single number when given a game node. Suppose my AI player wants to make a move. The negamax function returns a single number. So it tells me what the score of the best move from that point is. How can I use this one number? if it's player A's t

如何使用negamax算法

我想知道如何使用negamax算法。 我正在尝试在C#中为游戏mancala编写一个代理。 当给定游戏节点时,该算法给你一个单一的数字。 假设我的AI玩家想要采取行动。 negamax函数返回一个单一的数字。 所以它告诉我从这一点来看,最佳举动的得分是多少。 我怎样才能使用这个号码? 如果是玩家A,我会试着做出可能的动作并检查每个人的负值。 但是,如果我首先进行移动并检查negamax,那么当negamax运行时(让我们假设我们仍

Negamax Alpha Beta search

I'm looking for help with implementing the Negamax Alpha-Beta search algorithm. My C isn't the best, but I've got a working framework for playing the game so far and I am having trouble with my Alpha-Beta search always returning what seems to be the last move found, rather than returning the best move found. Below is my source file for my alpha beta search. If anyone can help I wo

Negamax Alpha Beta搜索

我正在寻求实施Negamax Alpha-Beta搜索算法的帮助。 我的C并不是最好的,但是我已经有了一个工作框架来玩这款游戏,而且我的Alpha-Beta搜索一直在返回似乎是最后一招的问题,而不是返回最佳举措找到。 以下是我的alpha测试搜索源文件。 如果任何人都可以帮助,我将不胜感激。 我不是在寻找任何人“做我的作业”,因为很多人害怕,因为我真的很感兴趣,而且我已经用其他语言实施过搜索技术。 再次,任何帮助将不胜感激。

WPF Navigate through views using MVVM pattern

I'm building my first WPF using MVVM pattern. With the help of this community, I manage to create my Model, my first ViewModel and view. Now I want to add some complexity to the app designing the basic application layout interface. My idea is to have at least 2 child views and one main view and separate them on several XAML: Main.XAML Products.XAML Clients.XAML Main will have a men

WPF使用MVVM模式浏览视图

我正在使用MVVM模式构建我的第一个WPF。 在这个社区的帮助下,我设法创建了我的模型,我的第一个ViewModel和视图。 现在我想为设计基本应用程序布局界面的应用程序增加一些复杂性。 我的想法是至少有两个子视图和一个主视图,并将它们分开放在几个XAML上: Main.XAML Products.XAML Clients.XAML Main将有一个菜单和一个空间来加载子视图(产品和客户端)。 现在,遵循MVVM模式,视图之间的所有导航逻辑应该写在View

How to bind WPF button to a command in ViewModelBase?

I have a view AttributeView that contains all sorts of attributes. There's also a button that when pressed, it should set the default values to the attributes. I also have a ViewModelBase class that is a base class for all ViewModels I have. The problem is I can't seem to get the button bound to the command with WPF. I've tried this, but it just doesn't do anything: <Butt

如何将WPF按钮绑定到ViewModelBase中的命令?

我有一个包含各种属性的视图AttributeView 。 还有一个按钮,按下时,它应该将默认值设置为属性。 我也有一个ViewModelBase类,它是我拥有的所有ViewModel的基类。 问题是我似乎无法获得绑定到WPF命令的按钮。 我试过这个,但它没有做任何事情: <Button Command="{Binding DataInitialization}" Content="{x:Static localProperties:Resources.BtnReinitializeData}"></Button> 该命令是这样定义的(在ViewM