草庐IT

num_of_statuses

全部标签

C++ : Getting HTTP status code from a URL

我正在开发一个应用程序,我必须点击一个URL并获取从该URL返回的HTTP状态代码。目前我正在使用WININET函数来实现这一点。实现这一点的代码:hOpen=InternetOpenA("MYAPP",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);hFile=InternetOpenUrlA(hOpen,url.c_str(),NULL,0,INTERNET_FLAG_RELOAD,0);HttpQueryInfoA(hFile,HTTP_QUERY_STATUS_CODE,(void*)buffer,&dwBufLen,NULL);我做了一些检查以查

windows - 终端上的 git status 暂停列表

当我在我的GitBash上执行gitstatus时,由于大量未跟踪和添加的文件,终端就像将列表滚动到文件末尾一样。有什么方法可以暂停它,以便我可以一个一个地查看所有文件?类似于dir/p的工作方式。 最佳答案 最便携的方法是将gitstatus命令的输出重定向到文件output_file:gitstatus>output_file如果您没有指定任何路径,这个新创建的文件将在当前目录中创建,并显示为未跟踪。使用:gitstatus>C:\Users\user\output_file将输出重定向到任何位置。

c# - "Property elements cannot be in the middle of an element' s 内容。”WPF 应用程序中的错误

我正在使用Dragablz我的WPF应用程序中的选项卡控件。我的App.xaml中的以下代码昨晚运行良好,但当我今天加载项目时,它向我显示此错误:Propertyelementscannotbeinthemiddleofanelement'scontent.Theymustbebeforeorafterthecontent. 最佳答案 原因很简单:首先添加样式“OpenSans”,然后设置MergedDictionary属性,然后再添加两个样式。要修复,只需像这样重新排序: 关于c#-"

windows - cmd 相当于 std::string::find_first:of

C++、Java、JavaScript和其他可能的编程语言都有一个字符串函数,可以在字符串中搜索指定字符串模式中的任何字符。例如,C++的std::string::find_first_of像这样工作:std::coutCMD中是否有任何等效项?我尝试搜索“dos字符串函数”,但似乎找不到任何内容。 最佳答案 没有直接的方法,但您可以很容易地编写自己的方法。搜索一个字符@echooffcall:charposition"Searchmeforvowels"aposechoFoundaatposition%pos%goto:eof:c

windows - Powershell 脚本 : Can't read return value of executed program

我正在使用PowerShell运行一个脚本,该脚本执行wget以获取网页(一个简单的数据库导入脚本)并分析其输出(错误消息或“OK”)。我正在使用thispreviousquestion的答案中的代码我的。$a=c:\path_to_wget\wget.exe--quiet-O-"http://www.example.com/import_db"$rc=$a.CompareTo("OK")exit$rc当wget操作的结果是404-并且wget可能返回错误级别1或127-我从PowerShell收到以下错误消息:Youcannotcallamethodonanull-valuedexp

windows - PE : Relation between SizeOfRawData and VirtualSize fields of the section header

我看到对于图像文件中的部分,VirtualSize字段是加载到内存中时部分的总大小,而SizeOfRawData字段是部分的大小磁盘上的初始化数据。在检查.idata部分时,VirtualSize字段设置为0x14,而SizeOfRawData字段设置为0x400。为什么链接器-在本例中为MinGWld-使文件部分如此之大,而加载到内存中的部分只是其大小的一小部分?此外,VirtualSize字段的用途是什么?为什么不总是加载整个部分,即加载SizeOfRawData字节?我在官方PE文档中没有看到描述或它们之间的关系。 最佳答案

windows - 如何将 RPC_STATUS 翻译成 HRESULT?

在我的COM组件中,我需要将所有错误转换为最合适的HRESULT值。目前,如果我调用一些RPC接口(interface)方法(我调用一个MIDL生成的stub,它又调用NdrClientCall2())并且调用失败,我将返回E_FAIL,这不是很方便。有所谓facilityinHRESULT.我可以用这个吗?我尝试执行以下操作:HRESULTRpcStatusToHresult(RPC_STATUSstatus){if(status这会正确地将RPC_STATUS转换为有意义的HRESULT吗? 最佳答案 您的RpcStatusTo

c# - 异常:指定类别中不存在实例 'Name of instance'

当我像这样创建和使用性能计数器时:privatereadonlyPerformanceCounter_cpuPerformanceCounter;publicProcessViewModel(Processprocess){_cpuPerformanceCounter=newPerformanceCounter("Process","%ProcessorTime",process.ProcessName,true);}publicvoidUpdate(){CPU=(int)_cpuPerformanceCounter.NextValue()/Environment.ProcessorC

c# - 存储库模式 : Implementation and lazy loading of model relationships

我有一个处理产品和产品类别的应用程序。对于其中的每一个,我都有使用POCO定义的模型。//Representsaproduct.classProduct{publicvirtualintID{get;set;}publicvirtualstringName{get;set;}publicvirtualProductCategoryCategory{get;set;}}//Representsaproductcategory.classProductCategory{publicvirtualintID{get;set;}publicvirtualstringName{get;set;}

c# - 为什么我可以通过索引访问 KeyCollection/ValueCollection 中的项目,即使它没有实现 IList(Of Key)?

我注意到一个奇怪的VB.NET东西。来自thisquestion我提供了一种访问字典的键和值的方法'KeysCollection和ValuesCollection通过索引获取第一项。我知道它只在SortedDictionary中才有意义因为正常Dictionaryisnotordered(好吧,你不应该依赖它的顺序)。这是一个简单的例子:DimsortedDictAsNewSortedDictionary(OfDateTime,String)sortedDict.Add(DateTime.Now,"Foo")DimkeysAsSortedDictionary(OfDateTime,St