arguments

PHP How to call parent::__call() and pass in the arguments

Hi, If I am overloading the __call method in a PHP class, how could I call the actual method if my code doesn't do something else? For example: public function __call($name, $arguments) { if($name == 'tom') { $this->doName($name); } else { // Something here to carry on the __call maybe: // $t...

Passing arguments when loading custom CodeIgniter library

I'm trying to implement a class I've written as CodeIgniter library. Somehow I can't get CI's load() method to pass multiple arguments to the class's constructor function. My class is designed to get 3 arguments, 2 arrays and one optional string. The constructor looks somewhat like this: public function __construct($array, $array,$st...

View with a page using arguments wtih a path using %

Hi, I've just started using Drupal and I must admit its brilliant. Im still finding my way around it, so this might be a stupdi question, but Id like to know what the best and least perofrmance impacting way to achieve the below. I have created a view with the "Node: Nid" argument to bascially list certain information about additioanl ...

Python list function argument names

Is there a way to get the argument names a function takes? def foo(bar, buz): pass magical_way(foo) == ["bar", "buz"] ...

Passing more than one argument to a callback function (using PHP 5.2)

I'm writing a content management system. The page admin enters content for a page and, when he enters a number surrounded by special characters, it's replaced by a database entry on the viewer's screen when parsed. To accomplish this in the parsing, I'm using preg_replace_callback(). However, I can't pass my database connection variab...

Dynamic filters

I am setting up a gallery block in views that I am including on different nodes. The main nodes are related to different girls, who I have created as users with custom roles, and each of these girls has a number of photos, each photo brought in as its own node, associated with them. In order to associate the photo with the girl I created...

php function foo(array $arg = NULL) -- why the array and NULL?

I've seen the following a few times lately: function foo(array $arg = NULL) { ... } My question being why make the default of $arg NULL when it will be just cast into an array? Why not do: function foo(array $arg = array()) { ... } I know it doesn't really make much difference--it's mostly just reading code--but why encourage PHP...

Subroutines vs scripts in Perl

I'm fairly new to Perl and was wondering what the best practices regarding subroutines are with Perl. Can a subroutine be too big? I'm working on a script right now, and it might need to call another script. Should I just integrate the old script into the new one in the form of a subroutine? I need to pass one argument to the script and...

Bug import main with arguments in Python.

Hello, In a script I'm trying to import the main module from another script with an argument. I get the error message "NameError: global name 'model' is not defined". If someone sees the mistake, I'd be grateful ! My code : script1 #!/usr/bin/python import sys import getopt import pdb import shelve class Car: """ class repre...

Pass each element of a list to a function that takes multiple arguments in Python?

For example, if I have a=[['a','b','c'],[1,2,3],['d','e','f'],[4,5,6]] How can I get each element of a to be an argument of say, zip without having to type zip(a[0],a[1],a[2],a[3])? ...

Create list of nodes that are referenced at least once

I'm sure this is simple with the Node Relationship module but I can't wrap my head around it. I have a list called 'Comedian Profile' which has a node reference field for it. You then make - you guess it - profiles for comedians. To make an 'Events' (that doubles as an Ubercart item) you select the comedian. It then creates a view in th...

Preserving argument spacing, etc when passing into mvn exec:java

I have a shell script that launches a Maven exec:java process - exec mvn exec:java -Dexec.mainClass=... -Dexec.args="$*" Now sadly if I run ./myMagicShellScript arg1 "arg 2" the single string arg 2 doesn't make it through as a single argument as I'd like. Any thoughts as to how to escape / pass things through properly (perferably ...

How to pass args to method in java, like f(*args) in python?

In python, I can do: args = [1,2,3,4] f(*args) # this calls f(1,2,3,4) Is this possible in java? to clarify - f has an argument list of variable length. ...

Getting HTTP GET arguments in Python

I'm trying to run an Icecast stream using a simple Python script to pick a random song from the list of songs on the server. I'm looking to add a voting/request interface, and my host allows use of python to serve webpages through CGI. However, I'm getting hung up on just how to get the GET arguments supplied by the user. I've tried the ...

Parsing JavaScript argument values in python

Is there a way to parse the argument values passed to a JavaScript function in python? I want to be able to automatically document JavaScript function calls in order to make sure they have the right arguments passed to them. For example, in: function mymethod(fruit, vegetable, drink) { // dummy function } function drink(drink) ...

codeigniter display warning error if argument in URL not provided

If I don't provide the value in the URL for Codeigniter, it'll display a PHP Error was encountered saying it's missing argument for a function call. I do NOT want it displayed at all. If there's no argument in the URL, it should just reroute to its index function. How do I prevent that from happening? For example, www.example.com/profi...

Adding parameters to Runtime.getRuntime() ??

void restartWeb() { try { String[] command = new String[] {"webRestarter.exe" , ">>","webLog.log"}; Runtime.getRuntime().exec(command); } catch (java.io.IOException err) { webServer.logError(err.getMessage()); } } Why doesn't this work? How could I fix it so it does work like ...

Create an array of function arguments not equal to NULL?

I'll start with explaining what my end goal is as there may be better solutions to it. I have a function called updateUser which accepts the following parameters: function updateUser($password = NULL, $name = NULL, $lastname = NULL, $age = NULL, $email = NULL, $relation = NULL) As you can see I've set them to NULL, so if they aren't ...

C# Passing Function as Argument

Hey, I've written a function in C# that does a numerical differentiation. It looks like this: public double Diff(double x) { double h = 0.0000001; return (Function(x + h) - Function(x)) / h; } I would like to be able to pass in any function, as in: public double Diff(double x, function f) { double h = 0.0000001; re...

how to get args to constructor at extjs?

Hello everyone! I have a some class AddOrgWindowUI = Ext.extend(Ext.Window, { title: 'form', width: 400, height: 198, layout: 'form', padding: 5, initComponent: function() { this.items = [ { xtype: 'textfield', fieldLabel: 'parapapa', anchor: '95%', value: m, emptyT...