parameters

How to call the method from a MethodCallExpression in c#

房东的猫 提交于 2019-12-30 00:51:09
问题 I have a method call expression and try to invoke the method. I figured out a way, but I have problems in retrieving the parameter values since not every argument is described with a ConstantExpression. Expression<Action<T>> = t => t.DoSomething(Par0, Par1, Par2); MethodCallExpression methodCallExpression = selector.Body as MethodCallExpression; // get the information which is needed to invoke the method from the provided // lambda expression. MethodInfo methodInfo = methodCallExpression

explicit copy constructor or implicit parameter by value

孤人 提交于 2019-12-30 00:07:10
问题 I recently read (and unfortunately forgot where), that the best way to write operator= is like this: foo &operator=(foo other) { swap(*this, other); return *this; } instead of this: foo &operator=(const foo &other) { foo copy(other); swap(*this, copy); return *this; } The idea is that if operator= is called with an rvalue, the first version can optimize away construction of a copy. So when called with a rvalue, the first version is faster and when called with an lvalue the two are equivalent.

Ghostscript command line parameters to convert EPS to PDF

南楼画角 提交于 2019-12-29 14:15:29
问题 Just installed Ghostscript 8.54 for Windows. Does anyone know of the minimum parameters to pass to gswin32c.exe to make it convert, say, someFile.eps to someFile.eps.pdf ? 回答1: Since the question was about the "minimum parameters to pass to gswin32c.exe to make it convert, say, someFile.eps to someFile.eps.pdf" , let me give an answer: c:/path/to/gswin32c.exe ^ -sDEVICE=pdfwrite ^ -o c:/path/to/output.pdf ^ c:/path/to/input.eps or even shorter: gswin32c ^ -sDEVICE=pdfwrite ^ -o output.pdf ^

Why does passing $null to a parameter with AllowNull() result in an error?

只谈情不闲聊 提交于 2019-12-29 09:27:07
问题 Consider the following code: function Test { [CmdletBinding()] param ( [parameter(Mandatory=$true)] [AllowNull()] [String] $ComputerName ) process{} } Test -ComputerName $null Based on the official documentation for AllowNull I was expecting that $ComputerName could either be [string] or $null . However, running the above code results in the following error: [14,24: Test] Cannot bind argument to parameter 'ComputerName' because it is an empty string. Why doesn't passing $null for

Having the variable names in func_get_args()

别等时光非礼了梦想. 提交于 2019-12-29 09:19:12
问题 As this function can take unknown numbers of parameters: function BulkParam(){ return func_get_args(); } A print_r will print only the values, but how i can retrieve the variable names as well as the array key? For example: $d1 = "test data"; $d2 = "test data"; $d3 = "test data"; print_r(BulkParam($d1, $d2, $d3)); It will print this: Array ( [0] => test data [1] => test data [2] => test data ) But i want to have the variables name as the index name or key name of all arrays. Then the array

Can a method be attached to a delegate with predefined parameters?

…衆ロ難τιáo~ 提交于 2019-12-29 09:05:49
问题 Sometimes I encounter cases where I have to attach a method to a delegate but the signature doesn't match, like trying to attach abc down there to somedelegate with the string parameter being "hi". public class test { //... public void abc(int i, string x) { //Do Something } //... } public class test2 { somedelegate x; //... public test2() { //Do Something test y = new test(); x += y.abc(,"hi"); } delegate void somedelegate(int i); } I can work it around by creating another delegate with the

How to use phonegap FileTransfer parameters with .asmx web service

不想你离开。 提交于 2019-12-29 08:29:16
问题 I am uploading an image to an asmx web service. The file upload works fine, but I am wondering how to access the parameters that I set in the javascript for the filetransfer. I want to pass the image number to the asmx SaveImage web method. Then after the file has successfully been saved I want to return the image number to the Javascript. //Javascript Calling Web Service function uploadPhoto(imageURI, imageNumber) { var options = new FileUploadOptions(), params = {}, ft = new FileTransfer(),

How to pass parameter to a webservice using ksoap2?

女生的网名这么多〃 提交于 2019-12-29 06:10:51
问题 I'm using Eclipse IDE to develop an android app. I'm trying to connect to a .net webservice. I'm using ksoap2 version 2.3 When I'm calling a webmethod with no parameters, it works fine. When I come to pass a parameter to the webmethod, I get null (while debugging the webservice I discovered that) and I get a null from the webmethod in the client side code. Code: package com.examples.hello; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2

Include Twig with multiple parameters

大憨熊 提交于 2019-12-29 05:10:06
问题 Is there a way to include a Twig-template with more than one parameter? I tried this, but it didn't work: The following Twig is rendered by my Symfony Controller: {% for object in objects %} {% if object.type == "simple" %} {% include 'BBLWebBundle:content:simple.html.twig' with [{'picture': object.picture}, {'link': object.link}, {'name': object.name}, {'info': object.info}] %} {% elseif object.type == "mp3" %} {% include 'BBLWebBundle:content:mp3.html.twig' with [{'picture': object.picture}

Syntax for a parameter query in Python (pyodbc)

◇◆丶佛笑我妖孽 提交于 2019-12-29 02:15:22
问题 I am trying to write results of some processing into SQL Server table. My results are store in a list of lists where each item of the list is a list. I am using parameters (6 params) and I am getting the following error: cnxn.execute(sqlStatement, (item[0],item[1],item[2],item[3],item[4],item[5])) pyodbc.ProgrammingError: ('The SQL contains 0 parameter markers, but 6 parameters were supplied', 'HY000') That's my code sqlStatement = "INSERT INTO CEA_CR (`SessionID`, `Session.Call_TYPE_Assigned