parameters

AJAX & ASP.net, Referencing server controls in external file

∥☆過路亽.° 提交于 2019-12-12 12:29:10
问题 I've got some JavaScript in an ASP.NET page that looks like this: var list = $get('<%=Topics.ClientID %>'); I have many functions written now where this syntax is used, and I would like to centralize my JavaScript and move this into an external JavaScript file. This breaks however, since 'Topics' cannot be found. What is the best strategy for getting this to work? I assume I should pass the control/control information as a parameter to the function, but I can't seem to get the syntax to work.

Is it possible to pass parameters to F# modules?

耗尽温柔 提交于 2019-12-12 12:06:49
问题 I'm new to F# and learning the basics. I have two modules. A generic one for tree data structures called Tree : module Tree let rec getDescendants getChildren node = seq { yield node for child in getChildren node do yield! getDescendants getChildren child } let isLeaf getChildren node = Seq.isEmpty (getChildren node) let getLeaves getChildren node = getDescendants getChildren node |> Seq.filter (isLeaf getChildren) As you can see, all functions have a getChildren argument, which is a function

(Python 2.7) Use a list as an argument in a function?

寵の児 提交于 2019-12-12 12:04:09
问题 So I'm trying to learn Python using codecademy but I'm stuck. It's asking me to define a function that takes a list as an argument. This is the code I have: # Write your function below! def fizz_count(*x): count = 0 for x in fizz_count: if x == "fizz": count += 1 return count It's probably something stupid I've done wrong, but it keeps telling me to make sure the function only takes one parameter, "x". def fizz_count(x): doesn't work either though. What am I supposed to do here? Edit: Thanks

Default parameter value for a TSomething in Delphi

a 夏天 提交于 2019-12-12 11:40:56
问题 I'd like to know if this is possible in Delphi (or if there's a clean way around it): type TSomething = record X, Y : Integer; end; GetSomething( x, y ) -> Returns record with those values. ... and then you have this function with TSomething as parameter, and you want to default it as function Foo( Something : TSomething = GetSomething( 1, 3 ); The compiler spits an error here, however I'm not sure if there's a way around it! Can this be done? 回答1: The easiest way is to use overloaded

JDO Exception: “Query requires 1 parameters, yet 2 values have been provided.”

被刻印的时光 ゝ 提交于 2019-12-12 10:57:59
问题 Despite the fact that my JDO query contains TWO declareParameters statements, the code below produces an error claiming only one parameter is accepted : Query requires 1 parameters, yet 2 values have been provided. The two parameters are amountP and taxP : javax.jdo.Query query= pm.newQuery(Main.class); query.setFilter("amount == amountP && tax < taxP"); query.declareParameters("int amountP"); query.declareParameters("int taxP"); List<Main> results = (List<Main>)query.execute (amountP, taxP);

How to use parameters in Entity Framework in a “in” clause?

佐手、 提交于 2019-12-12 10:51:30
问题 I am using Entity Framework 4.0 and I want to use the following query: To do that I do the following: strSQLQuery = "select * from MyTable where IDData IN (@IDs)"; lstParameters.Clear(); myParameter = new SqlParameter("@IDs", strIDs); lstParameters.Add(myParameter); myContext.MyTable.SqlQuery(strSQLQuery, lstParameters.ToArray<object>()).ToList<MyTable>(); But I get an exception that say that it is not possible to convert nvarchar to bigint . That is because the parameter is the type string,

F# pipe first parameter

一世执手 提交于 2019-12-12 10:47:33
问题 is that possible to pipe the first parameter into a multiple parameter function? for example date = "20160301" Is that possible to pipe date into DateTime.ParseExact( , "yyyyMMDD", CultureInfo.InvariantCulture) 回答1: As @yuyoyuppe explains in his/her answer, you can't pipe directly into ParseExact because it's a method, and thereby not curried. It's often a good option to define a curried Adapter function, but you can also pipe into an anonymous function if you only need it locally: let res =

Batch parse each parameter

北慕城南 提交于 2019-12-12 10:37:20
问题 I am trying to create a batch script which would perform the same action for each parameter given. For example, giving X files as parameters: script.bat "file1.txt" "file2.txt" "file3.txt" "file4.txt" ... "fileX.txt" will rename them to: "file1.bin" "file2.bin" "file3.bin" "file4.bin" ... "fileX.bin" Rename is just an example, I will need it for more complex operations too. I guess it should be something like for each but I'm new in batch scripts. I just wonder if I could just increment %1

Optional parameter on urlManager rules

十年热恋 提交于 2019-12-12 10:35:30
问题 I used the Yii::app()->request->getParam() so I can have a friendly url like /listings/amenities/1 . I got 3 actions on my controller that get the parameter $property_id = Yii::app()->request->getParam('property_id') . The two actions amenities and meals are working fine but in the last action photos , the var property_id got a null value. I tried removing the second param on the photos rule and everything works. How should I solve this without removing the second param gallery_id ? Below is

Utility of parameter 'out' in numpy functions

可紊 提交于 2019-12-12 10:29:06
问题 What is the utility of the out parameter in certain numpy functions such as cumsum or cumprod or other mathematical functions? If the result is huge in size does it help to use the out parameter to improve computational time or memory efficiency? This thread gives some information about how to use it. But I want to know when should I use it and what could the benefits be? 回答1: Functions that take the out parameter create new objects. This is usually what you would expect from the function: