parameters

C++ * vs [] as a function parameter

随声附和 提交于 2019-12-19 18:20:54
问题 What is the difference between: void foo(item* list) { cout << list[xxx].string; } and void this(item list[]) { cout << list[xxx].string; } Assuming item is: struct item { char* string; } With the pointer pointing to the first of an array of chars and list is just an array of items... 回答1: To the compiler, there is no difference. It reads different though. [] suggests you want to pass an array to the function, whereas * could also mean just a simple pointer. Note that arrays decay to pointers

Parameterized SPARQL query with JENA

元气小坏坏 提交于 2019-12-19 17:37:46
问题 I'm trying to build a small semantic web application using Jena framework, JSP and JAVA. I have a remote SPARQL endpoint and I've already written a simple query which works fine but now I need to use some parameters. Here is my code so far: final static String serviceEndpoint = "http://fishdelish.cs.man.ac.uk/sparql/"; String comNameQuery = "PREFIX fd: <http://fishdelish.cs.man.ac.uk/rdf/vocab/resource/> " + "SELECT ?name ?language ?type" + "WHERE { ?nameID fd:comnames_ComName ?name ;" + "fd

Html.BeginForm loses routeValues with FormMethod.GET

坚强是说给别人听的谎言 提交于 2019-12-19 17:31:12
问题 I have noticed what Html.BeginForm() method encodes supplied routeValues into action attribute of FORM tag. This works well with POST method. But if method is GET all parameters in action URL are stripped by browser (tested on IE8 and Firefox 3.0.7). For example, this code in view <% using (Html.BeginForm("TestAction", "TestController", new { test = 123 }, FormMethod.Get)) { Response.Write("<input type='submit'>"); }; %> gives such HTML <form action="/TestController/TestAction?test=123"

How to create IN OUT or OUT parameters in Java

∥☆過路亽.° 提交于 2019-12-19 15:25:16
问题 In PL/SQL (or many other languages), I can have IN OUT or OUT parameters, which are returned from a procedure. How can I achieve a similar thing in Java? I know this trick: public void method(String in, String[] inOut, String[] inOut2) { inOut[0] = in; } Where the in parameter represents an IN parameter and the inOut parameter can hold a return value. The convention would be that String[] inOut is an array of inOut.length == 1 . That's kind of clumsy. EDIT Feedback to answers : Other tricks

Codeigniter Routing Unlimited Paramaters

这一生的挚爱 提交于 2019-12-19 11:42:38
问题 I currently have this in my CodeIgniter routes file. It maps anything with a URI api/controller/function to controller/api_function . $route['api/(:any)/(:any)/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4/$5/$6'; $route['api/(:any)/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4/$5'; $route['api/(:any)/(:any)/(:any)/(:any)'] = '$1/api_$2/$3/$4'; $route['api/(:any)/(:any)/(:any)'] = '$1/api_$2/$3'; $route['api/(:any)/(:any)'] = '$1/api_$2'; As you can see, this isn't very efficient. I

Parameter order evaluation

为君一笑 提交于 2019-12-19 10:46:07
问题 In previous versions of the standard (C++03) the order of evaluation of parameters to a function call was unspecified. Has this been changed in subsequent version of the standard (C++11 or C++14)? i.e. Can we rely on a specific ordering (left to right) or not. 回答1: No this has not changed but there is a very recent proposal to change this: N4228: Refining Expression Evaluation Order for Idiomatic C++, this was part of the Pre-Urbana mailing that came out this October The introduction says (

passing parameters to powershell from c#

天大地大妈咪最大 提交于 2019-12-19 10:39:10
问题 I'm trying to pass a parameter to PowerShell from C# web app, but keep getting an error: Reason = {"The term 'Param($ds)\r\n\r\n$ds\r\n\r\n\r\n' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."} My Powershell script is as follows: Param($ds) write-host $ds My C# is: protected void drpCluster_SelectedIndexChanged(object sender, EventArgs e) { //

passing parameters to powershell from c#

梦想的初衷 提交于 2019-12-19 10:39:08
问题 I'm trying to pass a parameter to PowerShell from C# web app, but keep getting an error: Reason = {"The term 'Param($ds)\r\n\r\n$ds\r\n\r\n\r\n' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."} My Powershell script is as follows: Param($ds) write-host $ds My C# is: protected void drpCluster_SelectedIndexChanged(object sender, EventArgs e) { //

How to pass a parameter from JSP to Struts 2 action

≡放荡痞女 提交于 2019-12-19 10:17:35
问题 I have an application and I want to pass item id to the action every time the button for that item is pressed. My JSP : <s:submit value="addToCart" action="addToCart" type="submit"> <s:param name="id" value="%{#cpu.id}" /> </s:submit> Action: public class ProductsCPU extends BaseAction implements Preparable, SessionAware { private static final long serialVersionUID = 2124421844550008773L; private List colors = new ArrayList<>(); private List cpus; private String id; public String getId() {

Extra argument 'method' in call of Alamofire

独自空忆成欢 提交于 2019-12-19 10:07:35
问题 I've searched for this issue and there are many answers available but none are solving. I've defined parameters as: let parameters = [ "name": username, "mobile": "", "email": email, "password": "", "blood_donor": "0", "registration_id": defaults.string(forKey: "FCMToken"), "platform": platform, "appID": "3" ] And after that when I send the request: Alamofire.request(url, method: .post, parameters: parameters, encoding: URLEncoding(), headers: headers).responseJSON { response in So I get a