parameters

Two functions, or one function with different params?

a 夏天 提交于 2019-12-23 12:49:22
问题 This is a very generic 'best practice' question, but here's an example. Let's say I have a movie cataloging app. I want to give my users the chance to specify, say, IMDb or Metacritic for their synopsis/ rating info. Do I do this: if (preferredSupplier == "imdb"){ getIMDbRating(movieName); }else{ getMetacriticRating(movieName); } Or this: getRating(movieName, preferredSupplier); I like the second one better, but it means that function will have to follow vastly different logic depending on

Why have pointer parameters? [duplicate]

耗尽温柔 提交于 2019-12-23 10:54:11
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Why use pointers? Passing a modifiable parameter to c++ function Why would I want to have pointer parameters? The only reason I can see is for small functions to attempt to reduce confusion and a smaller memory footprint. 回答1: In Passing a modifiable parameter to c++ function I answered when to use a reference instead of a pointer. Conversely, prefer a pointer to a reference when any of the following are true:

Why have pointer parameters? [duplicate]

廉价感情. 提交于 2019-12-23 10:52:57
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Why use pointers? Passing a modifiable parameter to c++ function Why would I want to have pointer parameters? The only reason I can see is for small functions to attempt to reduce confusion and a smaller memory footprint. 回答1: In Passing a modifiable parameter to c++ function I answered when to use a reference instead of a pointer. Conversely, prefer a pointer to a reference when any of the following are true:

How to pass parameters to XSLT?

女生的网名这么多〃 提交于 2019-12-23 10:19:42
问题 I have a problem. I have an XML file that contains information about 100 courses. I have an XSL file that nicely displays the list of 100 courses. But what if I want to only display 1 course. Can I pass a parameter to the XSLT file to tell it to only display "ENGL 100" ? The XML looks something like this: <document> <menu> <item> <name>MTH 300</name> <brief>Mathematics Skill Development</brief> <description>A course in the fundamentals of ...</description> </item> <item> <name>MTH 301</name>

Pass Variables to Project Parameters in SSIS

妖精的绣舞 提交于 2019-12-23 10:15:16
问题 I am new to this network. Hoping I'll find an answer to this problem. I have a SSIS Project with multiple Packages which are using the Project Parameters. I am trying to update the Project Parameters e.g. @PeriodStart: 2014-05-31. I can't find a way to dynamically write to the Project Parameter. I am using Visual Studio 2010 in 4.0 Framework. Please can anyone shed light on this ?! Kind Regards Bal 回答1: Project parameters are read only. What you are after is to assign variables depending on

Python 3 class inheritance with parameters

半城伤御伤魂 提交于 2019-12-23 09:38:27
问题 So I have a class, character(), and a subclass, npc(character). They look like this: class character(): def __init__(self,name,desc): self.name = name self.desc = desc self.attr = "" #large list of attributes not defined by parameters and class npc(character): def __init__(self,greetings,topics): self.greetings = greetings self.topics = topics character.__init__(self) self.pockets = [] #more attributes specific to the npc subclass not defined by parameters however, when I call an attribute

Passing delegate as method parameter

≡放荡痞女 提交于 2019-12-23 09:29:08
问题 I'm currently developing an EventManager class to ensure that no events are left wired to dead WCF duplex clients, and also to control prevent multiple wiring from the same client to the one event. Now basically, I'm what stuck with is trying to pass the event delegate to a function that will control the assignment like this. var handler = new SomeEventHandler(MyHandler); Wire(myObject.SomeEventDelegate, handler); To call this: private void Wire(Delegate eventDelegate, Delegate handler) { //

s:form tag action parameters being removed

穿精又带淫゛_ 提交于 2019-12-23 09:26:43
问题 I have searched and searched and this is destroying me. I have this: <s:form method="post" action="%{methodOne}" cssClass="buttons"> The emailFormUrl returns the URL correctly but the parameters have been stripped. public String methodOne() { return anotherClass.methodTwo(id); } Which speaks of: public static String methodTwo( String id) { return fastEncode("", "longurl/view.jsp", new ParameterPairing("id", id)); } For some reason, the id is being stripped, this leaves me with a validation

OpenGL: Reusing the same texture with different parameters

早过忘川 提交于 2019-12-23 09:12:38
问题 In my program I have a texture which is used several times in different situations. In each situation I need to apply a certain set of parameters. I want to avoid having to create an additional buffer and essentially creating a copy of the texture for every time I need to use it for something else, so I'd like to know if there's a better way? 回答1: This is what sampler objects are for (available in core since version 3.3, or using ARB_sampler_objects ). Sampler objects separate the texture

Passing parameters to powershell script

你。 提交于 2019-12-23 09:01:53
问题 I'm trying to run a powershell script from the run dialog (will be used as a scheduled task), and I'm having troubles passing parameters. The script will take in two parameters, named title and msg. The script is located in: D:\Tasks Scripts\Powershell\script.ps1 This is what I'm trying to do: powershell.exe -noexit 'D:\Tasks Scripts\Powershell\script.ps1' -title 'Hello world' -msg 'This is a test message' But it fails upon reading the parameters. Running .\script.ps1 -title 'Hello world'