optional-parameters

Intermediate route optional parameters in Symfony 2

痞子三分冷 提交于 2019-12-02 02:31:29
问题 Problem to solve Is it possible in Symfony 2, define routes with ' intermediate ' optional parameters. I'll use other question data, for supporting me using the same style, for example: localhost /param 1/param 2/param 3/param 4 Example localhost /param 1/param 4 localhost /param 2/param 4 Because I have a problem where none of my parameters should be mandatory, and different logics come into play, subordinated to those activated parameters. Until now if I don't set like this: - localhost

Set optional parameters in JPQL Query

时光怂恿深爱的人放手 提交于 2019-12-02 02:06:53
I got this list of coins that i want to filter with that 3 optional parameters(Currency, quantity and year) How can I set parameters in JPQL as optional? I dont want to do 9 "if else" for checking if its null I got the function filtradoMonedas (filterCoins) that filter the object Moneda(coin) using that 3 OPTIONAL parameters but its not working if there´s a null parameter. This just work well if dont set empty parameters, if cantidad or ano is "" returns exception of bad query. Just want it as an optional. Heres the method: public List<Moneda> filtradoMonedas(Divisa divisa, BigDecimal cantidad

C# supply values for all optional parameters

ぃ、小莉子 提交于 2019-12-01 23:47:39
问题 I'm reading a book for C# and I'm in the chapter of named and optional parameters. I've read a bullet where it says: "If multiple optional parameters exist and a value is specified for one, all preceding optional parameters must also be supplied values" Can you please give me an example because I'm not able to reproduce the above statement from code. 回答1: Take this method signature for example: public void MyMethod(object arg1, string arg2 = null, int? arg3 = null, MyType arg4 = null) { // do

Can I have a variable number of URI parameters or key-value pairs in Laravel 4?

江枫思渺然 提交于 2019-12-01 23:46:34
问题 I've got a shopping cart that I'd like to be able to pass a variable amount of optional parameters. Things like: sort by, filter by, include/exclude etc. So the URL may be: /products /products/sort/alphabetically /products/filter/cloths /products/socks/true /products/sort/alphabetically/socks/true/hats/false/ Etc. I suppose I could have a route with placeholders for all of the possible parameters and set default values in the URL, so something like: Route::get('products/sort/{$sort?}/filter/{

Intermediate route optional parameters in Symfony 2

99封情书 提交于 2019-12-01 23:34:27
Problem to solve Is it possible in Symfony 2, define routes with ' intermediate ' optional parameters. I'll use other question data , for supporting me using the same style, for example: localhost /param 1/param 2/param 3/param 4 Example localhost /param 1/param 4 localhost /param 2/param 4 Because I have a problem where none of my parameters should be mandatory, and different logics come into play, subordinated to those activated parameters. Until now if I don't set like this: - localhost /param 1/param 2/... ( missing: param 3/param 4 ) I can't play with intermediate parameters and it's a

MATLAB ActiveX optional arguments

与世无争的帅哥 提交于 2019-12-01 23:24:56
问题 there is an ActiveX function, which I want to call from MATLAB, e.g. PrintOut([Background], [Append], [Range], [OutputFileName], [From], [To], [Item], [Copies], [Pages], [PageType], [PrintToFile], [Collate], [FileName], [ActivePrinterMacGX], [ManualDuplexPrint], [PrintZoomColumn], [PrintZoomRow], [PrintZoomPaperWidth], [PrintZoomPaperHeight]) and use it like follows : hdlActiveX = actxserver('Word.Application'); hdlActiveX.PrintOut(opt args, needed args, opt opts, needed args); All arguments

Can I have a variable number of URI parameters or key-value pairs in Laravel 4?

非 Y 不嫁゛ 提交于 2019-12-01 22:02:40
I've got a shopping cart that I'd like to be able to pass a variable amount of optional parameters. Things like: sort by, filter by, include/exclude etc. So the URL may be: /products /products/sort/alphabetically /products/filter/cloths /products/socks/true /products/sort/alphabetically/socks/true/hats/false/ Etc. I suppose I could have a route with placeholders for all of the possible parameters and set default values in the URL, so something like: Route::get('products/sort/{$sort?}/filter/{$filter?}/socks/{$socks?}/hats/{$hats?}/...', function($sort = 'alphabetically', $filter = false,

MATLAB ActiveX optional arguments

走远了吗. 提交于 2019-12-01 21:10:10
there is an ActiveX function, which I want to call from MATLAB, e.g. PrintOut([Background], [Append], [Range], [OutputFileName], [From], [To], [Item], [Copies], [Pages], [PageType], [PrintToFile], [Collate], [FileName], [ActivePrinterMacGX], [ManualDuplexPrint], [PrintZoomColumn], [PrintZoomRow], [PrintZoomPaperWidth], [PrintZoomPaperHeight]) and use it like follows : hdlActiveX = actxserver('Word.Application'); hdlActiveX.PrintOut(opt args, needed args, opt opts, needed args); All arguments in the PrintOut function call are optional arguments. However, for a particular case, I need to specify

C# supply values for all optional parameters

折月煮酒 提交于 2019-12-01 20:22:55
I'm reading a book for C# and I'm in the chapter of named and optional parameters. I've read a bullet where it says: "If multiple optional parameters exist and a value is specified for one, all preceding optional parameters must also be supplied values" Can you please give me an example because I'm not able to reproduce the above statement from code. Take this method signature for example: public void MyMethod(object arg1, string arg2 = null, int? arg3 = null, MyType arg4 = null) { // do stuff } You cannot call this method and only provide values for arg1 and arg3 , like: MyMethod(obj, 5); You

Why isn't the new() generic constraint satisfied by a class with optional parameters in the constructor?

╄→гoц情女王★ 提交于 2019-12-01 19:16:34
The following code fails to compile, producing a "Widget must be a non-abstract type with a public parameterless constructor" error. I would think that the compiler has all of the information it needs. Is this a bug? An oversight? Or is there some scenario where this would not be valid? public class Factory<T> where T : new() { public T Build() { return new T(); } } public class Widget { public Widget(string name = "foo") { Name = name; } public string Name { get; set; } } public class Program { public static void Main() { var widget = new Widget(); // this is valid var factory = new Factory