Tag: C#的

std :: min给出错误

#include <algorithm> #include <Windows.h> int main() { int k = std::min(3, 4); return 0; } 什么是Windows在做什么,如果我包括Windows.h我不能在Visual Studio 2005中使用std :: min。错误消息是: error C2589: '(' : illegal token on right side of '::' error C2059: syntax error : '::'

如何散列密码

嘿,我想在手机上存储密码的散列,但我不知道该怎么做。 我似乎只能findencryption方法。 散列密码的最佳方法是什么? 谢谢

如果你已经知道variables应该是常量,为什么你会使用关键字const?

我正在阅读的很多书籍都使用关键字const时,不应该修改variables的值。 除了向代码读者指定如果您修改此variables(您可以使用注释执行此操作),您可能会导致错误,为什么您需要该关键字成为任何编程语言的一部分? 在我看来,如果你不想要一个variables修改,根本就不要。 有人能为我澄清这个吗?

我如何创buildMin stl priority_queue?

默认的stl优先级队列是最大的一个(Top函数返回最大的元素)。 为简单起见,说这是一个int值的优先级队列。

性能问题:Java与C ++

我一直听说C ++比Java更有效率(所以大多数游戏都是用C ++开发的)。 我写了一个小的algorithm来解决Java和C ++中的“八皇后问题”,使用完全相同的algorithm,然后开始提高数量或方块。 当达到20 * 20甚至22 * 22的检查板时,看起来Java效率更高(C ++为3秒,而66秒为多)。 我不知道为什么,但我很早就开始使用C ++,所以我可能犯了一些巨大的性能错误,所以我会很乐意接受任何有助于我理解正在发生的事情的信息。 以下是我在Java中使用的代码: import java.awt.Point; import java.util.ArrayList; import java.util.List; public class HuitDames { /** * La liste des coordnnées des dames. */ private static List<Point> positions = new ArrayList<>(); /** * Largeur de la grille. */ private static final int LARGEUR_GRILLE = 22; /** […]

如何在创build自定义MSBuild任务时从C#代码中获取当前项目目录?

而不是运行硬编码path的外部程序,我想获得当前的项目目录。 我正在使用自定义任务中的进程调用外部程序。 我该怎么做? AppDomain.CurrentDomain.BaseDirectory只是给了我VS 2008的位置。

无法安装Windows服务

我使用visual studio 2010和.N ET 4.0创build了一个非常简单的窗口服务。 除了已经添加了安装程序以外,此服务没有从默认的Windows服务项目中添加function。 如果我在我的域中的我的开发盒或其他Windows 2008 R2机器上运行“installutil.exe appName.exe”,Windows服务安装没有问题。 当我尝试在我们的客户网站上做同样的事情时,它将无法安装,并出现以下错误。 Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\TestService\WindowsService1.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515). 此解决scheme只有1个项目,并没有添加任何依赖关系。 我已经在我们的环境中使用了多台机器,而我们的客户则使用了两台。 […]

为什么即使散列函数不是O(1),也可以通过键O(1)访问字典的元素?

我看你如何通过密钥访问你的collections。 但是,哈希函数本身在幕后有很多操作,不是吗? 假设你有一个非常有效的散列函数,它仍然可能需要很多操作。 这可以解释吗?

你如何禁用未使用的variables警告从gcc出来?

我想知道你传递给gcc编译器的什么开关来closures未使用的variables警告? 我得到错误的窗口提升,我不想触摸升压代码: C:\boost_1_52_0/boost/system/error_code.hpp: At global scope: C:\boost_1_52_0/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable] C:\boost_1_52_0/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable] C:\boost_1_52_0/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable] 我试着使用-Wunused-value和-Wno-unused-value但都没有抑制上面的消息。 什么是正确的命令,这里是我的编译线: g++ -g -fno-inline -Wall -Werror -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wno-conversion -Wdisabled-optimization -Wredundant-decls -Wunused-value -Wno-deprecated -IC:\\boost_1_52_0 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o […]

无法使用DotNetOpenAuth ServiceProvider使用PLAINTEXT签名

我正在使用DotNetOpenAuth (NuGet包DotNetOpenAuth.OAuth.ServiceProvider, version = 4.1.4.12333 )构build一个OAuth 1.0(a)授权服务器。 服务器托pipe在ASP.NET应用程序中,但与问题无关。 我的ServiceProvider是这样configuration的: private ServiceProvider GetServiceProvider() { var baseUri = "http://myauth.com"; return new ServiceProvider( new ServiceProviderDescription { UserAuthorizationEndpoint = new MessageReceivingEndpoint( new Uri(baseUri + "/get_request_token"), HttpDeliveryMethods.GetRequest ), RequestTokenEndpoint = new MessageReceivingEndpoint( new Uri(baseUri + "/authorize"), HttpDeliveryMethods.PostRequest ), AccessTokenEndpoint = new MessageReceivingEndpoint( new Uri(baseUri + "/get_token"), HttpDeliveryMethods.PostRequest ), ProtocolVersion = […]