Named parameters enable you to specify an argument for a particular parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list.
Questions tagged [named-parameters]
371 questions
0
votes
1 answer
cakephp default controller/action routing with pagination breaks with named parameters
I have default routing rule set:
Router::connect('/', array('controller' => 'photos', 'action' => 'index'));
when i go to
http://url.com/photos/index/page:1/limit:10/direction:desc/
everything works fine but it breaks when i go to…

okwme
- 740
- 1
- 7
- 19
0
votes
2 answers
CakePHP named paramaters in FireFox Causing issues
We have a cakephp app running on 2.0 and we seem to be having some encoding issues with Firefox.
The URL we are accessing is /newcms/core/users/index/conditions[User][group_id]:6 to apply a filter in out cms system.
In everything but FireFox we get…

Dean
- 165
- 1
- 8
-1
votes
1 answer
How do you take multiple named parameters in a function and pass them to a dictionary in python?
One of the coolest things I've learned about python recently is that a dictionary can take parameters like this:
dict(red=3,blue=2,yellow=5)
How could I make a function that takes arguments in the same fashion and pass them to a dictionary? I don't…

KemptCode
- 34
- 6
-1
votes
2 answers
How to spread object as method input parameter but not as arguments array?
I have a function expecting multiply parameter and an input object that contains information with same key name as parameter field name, take a small example, e.g
const input = {
firstName: 'first',
lastName: 'last',
age: 19
}
function…

Drex
- 3,346
- 9
- 33
- 58
-1
votes
4 answers
JavaScript function - named parameters issue when skipping an optional parameter
If you run the below code in browser's console:
function named_param(a, b=null, c=5) {
console.log("a="+a);
console.log("b="+b);
console.log("c="+c);
}
named_param(3, c=10)
The output received is:
a=3
b=10
c=5
The output I am looking for,…

Rahul Singh
- 374
- 4
- 13
-1
votes
1 answer
How can Ruby functions with named arguments get called with a hash instead?
I'm trying to get this foo function to output "first" and then "second" but instead it is outputting {:x=>"first", :y=>"second"} and "this is y".
How can I use the hash as named arguments?
def foo(x='hi', y='this is y')
puts x
puts y
end
hash =…

Some Guy
- 12,768
- 22
- 58
- 86
-1
votes
1 answer
Syntax error with python3 and sqlite3 when using parameters
I am trying pull in a setting file that creates the tables I need. I started out with this.
cursor.execute("CREATE TABLE IF NOT EXISTS measurement (time DATETIME)")
This works. Moving it to using parameters I tried many different variation on this,…

Rhett
- 11
- 4
-1
votes
1 answer
Groovy (Grails) named parameters constructor doesn't set superclass fields
New to Groovy. So I have a superclass
class AbstractClass {
User user
}
and a subclass
class Category extends AbstractClass {
String name
}
when I try to create object in the BootStrap.groovy (I'm using Grails) like:
User user1 = new…

ldepablo
- 424
- 6
- 19
-2
votes
4 answers
What are the limitations of PDO and select statments
Can PDO return the number of rows in a db when using a SELECT staement? And does php even support named parameters?

stevenmw
- 689
- 2
- 8
- 15
-3
votes
4 answers
How to pass a parameter as a default?
I want to use the default of a parameter, but include its name in the call. I thought that setting the parameter to None would do that, but it doesn't.
For example:
def a(num=3):
print(num)
a(num=None) #returns "None", not "3" like I want it…

Pro Q
- 4,391
- 4
- 43
- 92
-30
votes
2 answers
Can a string like 'LIMIT 0,50' be used with a named parameter?
I'm updating some old PHP code and ran across an issue I don’t completely understand. In the old days of mysql_* functions you could include a variable in your SQL query like:
$query = "SELECT * FROM table $limit";
Where $limit = "LIMIT 0,50";.…

j08691
- 204,283
- 31
- 260
- 272