我使用的是从MSDN的SSLStream例子在这里.客户端代码"似乎"工作正常,因为我可以连接到谷歌,它至少得到过去的身份验证,但服务器没有.
从msdn页面的评论中,我使用此页面上的过程生成我自己的私钥,但它不起作用.我得到一个例外,System.NotSupportedException: The server mode SSL must use a certificate with the associated private key. 所以我很确定我做的事情是错的.
所以我的问题很简单:如何从msdn获取/生成适用于我自己的小示例程序的密钥?它可以是自签名的,但是我对SSL来说太新了,甚至不知道我到底需要什么.除了为本地服务器指定自己的证书之外,我想要做的就是运行as-given示例.如果我只是想在他们两个之间进行通信,那么知道我必须在我的第二台机器上安装什么是很好的(所以它不是100%本地主机的例子).
我个人认为这是示例文档中的一个缺陷.它应该说"要运行它,你需要做A,B,C等",但事实并非如此.
我正在制作一个DataGridView带有一系列Checkboxes的水平和垂直相同的标签.任何相同的标签,复选框都将处于非活动状态,并且我只希望每个组合的两个"检查"之一有效.以下屏幕截图显示了我的内容:
DataGridView http://i46.tinypic.com/2e4m3pz.png
在下半部分检查的任何东西,我想要在鞋帮上进行UN检查.因此,如果检查[quux,spam](或[7,8]为基于零的坐标),我想要[垃圾邮件,quux]([8,7])未经检查.到目前为止我所拥有的是以下内容:
dgvSysGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
dgvSysGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
string[] allsysNames = { "heya", "there", "lots", "of", "names", "foo", "bar", "quux", "spam", "eggs", "bacon" };
// Add a column for each entry, and a row for each entry, and mark the "diagonals" as readonly
for (int i = 0; i < allsysNames.Length; i++)
{
dgvSysGrid.Columns.Add(new DataGridViewCheckBoxColumn(false));
dgvSysGrid.Columns[i].HeaderText = allsysNames[i];
dgvSysGrid.Rows.Add();
dgvSysGrid.Rows[i].HeaderCell.Value = allsysNames[i];
// Mark all of the "diagonals" as unable to change
DataGridViewCell curDiagonal = dgvSysGrid[i, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用msdn中的WMI示例:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384724%28v=vs.85%29.aspx
我已经将最后一组代码逐字复制到VS2008中的控制台应用程序中.如果我在win32平台的发布或调试中有应用程序,它可以编译(并运行).如果我在x64平台的发布或调试中使用它,我会收到以下链接器错误:
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemConfigureRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemLocator
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemLocator
fatal error LNK1120: 5 unresolved externals
Run Code Online (Sandbox Code Playgroud)
我已经尝试将wbemuuid.lib直接放入项目属性中的链接器输入中,但这与pragma没有区别.
有没有人用x64做这个工作?或者还有别的我做错了吗?
我正在编写一个程序,该程序从网站列表中抓取数据并将其存储到名为 的结构中,Listing然后将其收集到名为 的最终结构中Listings。
use std::{ thread,\n sync::{ Arc, Mutex }\n };\n\nfn main() {\n // ... some declarations\n let sites_count = site_list.len(); // site_list is a vector containing the list of websites\n\n // The variable to be updated by the thread instances ( `Listing` is a struct holding the information ) \n let listings: Arc<Mutex<Vec<Vec<types::Listing<String>>>>> = Arc::new(Mutex::new(Vec::new()));\n\n // A vector containing all the JoinHandles for the spawned threads\n let mut fetch_handle: Vec<thread::JoinHandle<()>> = Vec::new();\n\n // Spawn …Run Code Online (Sandbox Code Playgroud) 我想知道C#Enumerations以及重复值会发生什么.我创建了以下小程序来测试:
namespace ConsoleTest
{
enum TestEnum
{
FirstElement = -1,
SecondElement,
ThirdElement,
Duplicate = FirstElement
}
/// <summary>
/// Summary description for MainConsole.
/// </summary>
public class MainConsole
{
/// <summary>
/// Constructor for the class.
/// </summary>
public MainConsole()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// Entry point for the application.
/// </summary>
/// <param name="args">Arguments to the application</param>
public static void Main(string[] args)
{
TestEnum first = TestEnum.FirstElement;
TestEnum second = TestEnum.SecondElement; …Run Code Online (Sandbox Code Playgroud) 在C/C++中,您可以使用常规gethostbyname()调用将点分IP地址字符串(在localhost的情况下为"127.0.0.1")转换为适合标准套接字调用的结构.
现在你怎么翻译回来?我知道我可以进行一些位移,以准确得到我想要的位集,然后将它们打印出去,但是有没有"标准"功能为我做这个?它用于输出到日志文件中,因此我"真的"知道我连接的是谁/什么,因此人类可读的虚线地址比原始十六进制要好得多.
谢谢.
我正在尝试为自己制作一个开发证书链,用于WCF的一些测试.我在这里关注msdn上的文章:如何:创建在开发过程中使用的临时证书
不幸的是,说明不起作用.私钥不可导出.我甚至用makecert.exe的"-pe"选项重新尝试了它,它仍然无法正常工作.我在以管理员身份运行时尝试过它并且不起作用.在mmc本身使用"导出"时,它询问私钥的第一个屏幕显示"是/否"选项,并在其下面显示一条消息:"相关的私钥被标记为不可导出.只有证书可以出口."
有什么建议?MSDN上的更新程序可能还是另一个完全?我正在寻找的是与WCF一起用于某些基本测试的证书.这是在Windows 8 Pro上,但我怀疑这很重要.
我正在使用.NET Treeview控件(不是WPF,但是常规winforms),并且当控件内部没有节点时,右键单击事件(或任何单击事件)无法触发.根据对Stackoverflow 上另一个线程的响应,我的事件处理程序代码如下:
private void tvTest_MouseClick(object sender, MouseEventArgs e)
{
// Note: this block below is needed so that the menu appears on
// the correct node when right-clicking.
if (e.Button == MouseButtons.Right)
{
tvTest.SelectedNode = tvTest.GetNodeAt(e.X, e.Y);
if (tvTest.SelectedNode != null)
{
tvTestContextMenuStrip.Show(tvTest, e.Location);
}
else
{
tvTestContextMenuStrip.Show(tvTest, tvTest.Location);
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题在于,当节点存在时这种方法很好,如果控件为空,我无法右键单击该控件并选择"添加节点"以添加到根节点.处理程序未输入AT ALL,因为我在开头设置了一个断点,并且似乎从未输入该方法.
当Treeview为空时,有谁知道如何让"某事"发生?
我需要找到特定用户所属的所有组.我正在使用C++,而不是Powershell,如果这是我道歉的错误论坛.
从我在网上找到的我需要检索memberOf属性,但我得到一个错误,该属性不存在.任何帮助,将不胜感激.这是代码:
HRESULT hrObj = E_FAIL;
HRESULT hr = E_FAIL;
ADS_SEARCHPREF_INFO SearchPrefs;
// COL for iterations
ADS_SEARCH_COLUMN col;
// Handle used for searching
ADS_SEARCH_HANDLE hSearch;
// Search entire subtree from root.
SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
// Set the search preference.
DWORD dwNumPrefs = 1;
hr = pSearchBase->SetSearchPreference(&SearchPrefs, dwNumPrefs);
if (FAILED(hr))
{
return hr;
}
// Create search filter.
LPWSTR pszFormat = L"(&(objectCategory=person)(objectClass=user)(sAMAccountName=%s))";
int len = wcslen(pszFormat) + wcslen(szFindUser) + 1;
LPWSTR pszSearchFilter = new WCHAR[len]; …Run Code Online (Sandbox Code Playgroud) 我是新手,并且认为我会尝试使用.dll的一些实际部署方案,所以我使用以下命令来编译/安装库:
.\bjam install --layout=system variant=debug runtime-link=shared link=shared
--with-date_time --with-thread --with-regex --with-filesystem
--includedir=<my include directory> --libdir=<my bin directory> > installlog.txt
Run Code Online (Sandbox Code Playgroud)
这似乎有效,但我的简单程序(从"入门"页面开始)失败了:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
// Place your functions after this line
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}
Run Code Online (Sandbox Code Playgroud)
这会因以下链接器错误而失败:
fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-1_42.lib'
Run Code Online (Sandbox Code Playgroud)
我确信.lib和.dll都在该目录中,并命名我希望它们如何(例如:boost_regex.lib等,所有未版本化,如--layout =系统所说).那么为什么要寻找它的版本化类型呢?我如何让它来寻找未版本化的库类型?
我已尝试使用更多"正常"选项,如下所示:
.\bjam stage --build-type=complete --with-date_time --with-thread --with-filesystem …Run Code Online (Sandbox Code Playgroud)