out

Working with WinAPI functions which use C style strings as OUT parameters

橙三吉。 提交于 2019-12-12 03:56:20
问题 Given a WinAPI function which returns it's result via a C style string OUT parameter e.g.: int WINAPI GetWindowTextW( _In_ HWND hWnd, _Out_ LPTSTR lpString, _In_ int nMaxCount ); Is there a better way of using the function than what I'm doing below? HWND handle; // Assume this is initialised to contain a real window handle std::wstring title; wchar_t buffer[512]; GetWindowTextW(handle, buffer, sizeof(buffer)); title = buffer; The above code works, but I have the following issues with it: The

WebLogic: Getting Standard Error Into A File

拟墨画扇 提交于 2019-12-12 02:44:42
问题 I'm using WebLogic 9.2. I found an option in the Admin Server web page to send standard out to the server log files. I would like the same for standard error, but I can't find an option for it in the Admin Server web page. I haven't found Oracles documentation very clear. Do I need to set this option by hand in a config file somewhere and if so where and how? Thanks in advance 回答1: If you are using 'RedirectStdoutToServerLogEnabled' feature as described in http://download.oracle.com/docs/cd

Using an expect Script to send the output of a command and store in a file

筅森魡賤 提交于 2019-12-11 11:14:05
问题 Hi I am trying to store the output of a command run through a spawn ssh remote window into my local host, I am new to expect and am not able to figure out where I am wrong. My Code: #!/bin/bash while read line do /usr/bin/expect <<EOD spawn ssh mininet@$line expect "assword:" send -- "mininet\r" set output [open "outputfile.txt" "a+"] expect "mininet@mininet-vm:*" send -- "ls\r" set outcome $expect_out(buffer) send "\r" puts $output "$outcome" close $output expect "mininet@mininet-vm:*" send

Large images in WebView cause Out Of Memory

家住魔仙堡 提交于 2019-12-11 07:01:32
问题 I have activity that parses XML feed (with news) and loads parsed data (text and image url) in WebView's, which are inside gallery widget. Something like this: mimeType = "text/html"; encoding = "utf-8"; String html = "<img src=\"" + newsImageUrl.get(position) + "\" style=\"max-width:200px; max-height:200px;\" align=\"left\"" + "/>" + newsDescription.get(position); data.loadDataWithBaseURL("", html, mimeType, encoding, ""); Everything works fine, but sometimes inside news feed there is this

calling C++/CLI from C# with out parameter

十年热恋 提交于 2019-12-11 03:09:47
问题 Need some references to better understand the out parameter (and the '%' operator used) when interfacing C# with C++/CLI. Using VS2012 and this msdn reference:msdn ref C++ DLL code compiled with /clr #pragma once using namespace System; namespace MsdnSampleDLL { public ref class Class1 { public: void TestOutString([Runtime::InteropServices::Out] String^ %s) { s = "just a string"; } void TestOutByte([Runtime::InteropServices::Out] Byte^ %b) { b = (Byte)13; } }; } And the C# code: using System;

TryXXX-like methods with “out” parameters vs returning a nullable value type?

守給你的承諾、 提交于 2019-12-10 15:34:53
问题 I often see methods like this in C#: (doing a computation that may or may not give a result) bool TrySomething(SomeType inputData, out SomeOtherType result) { ... } Why people don't use instead something like this? Nullable<SomeOtherType> TrySomething(SomeType inputData) { ... } Is it just performance difference? This is a struct , so there must be no heap allocation, right? Or I have missed something? 回答1: Nullable was introduced - like generics - in C# 2.0. There is a lot of code that

Python NET call C# method which has a return value and an out parameter

我只是一个虾纸丫 提交于 2019-12-09 23:08:15
问题 I'm having the following static C# method public static bool TryParse (string s, out double result) which I would like to call from Python using the Python NET package. import clr from System import Double r0 = Double.IsNaN(12.3) # works r1, d1 = Double.TryParse("12.3") # fails! TypeError: No method matches given arguments. This works in IronPython. d2 = 0.0 r2, d2 = Double.TryParse("12.3", d2) # fails! TypeError: No method matches given arguments Any idea? Update I found the following answer

Change flash player audio output device

半世苍凉 提交于 2019-12-08 19:37:59
问题 Is there a way to change flash players audio output device? if not, is there a swf player who has this possibility? Thanks! 回答1: I had an issue until a few minutes ago regarding this. Two audio devices are available to my XP box: an iMic USB audio I/O device, in which I have permanently plugged my desktop speakers; and a pair of USB headphones with microphone that I plug in occasionally. The USB headset would take precedence over the USB iMic for applications because apps appear to access the

Out parameter in c#

风格不统一 提交于 2019-12-08 16:51:22
问题 I am new to C#. I've tried this with out parameter in C# using System; using System.Collections.Generic; using System.Linq; using System.Text; class First { public void fun(out int m) { m *= 10; Console.WriteLine("value of m = " + m); } } class Program { static void Main(string[] args) { First f = new First(); int x = 30; f.fun(out x); } } but i get some errors like " Use of unassigned out parameter 'm'" and The out parameter 'm' must be assigned to before control leaves the current method.

The filename, directory name, or volume label syntax is incorrect

可紊 提交于 2019-12-08 08:28:27
问题 I have a simple python (2.7) script that should execute few svn commands: def getStatusOutput(cmd): print cmd p = subprocess.Popen([cmd],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, status = p.communicate() return status, output svn_cmd = [ ["svn co " + FIRMWARE_URL + "/branches/interfaces/ interfaces --depth empty", ""], ["svn up interfaces/actual_ver.txt", " Getting current version of a branch "] ] status, output = getStatusOutput(svn_cmd[0][0]) Unfortunately when it