parameters

Using object property as default for method property

I'm trying to do this (which produces an unexpected T_VARIABLE error): public function createShipment($startZip, $endZip, $weight = $this->getDefaultWeight()){} I don't want to put a magic number in there for weight, since the object I am using has a "defaultWeight" parameter that all new shipments get if you don't specify a weight. I ...

pass by reference or pass by value?

When learning a new programming language, one of the possible roadblocks you might encounter is the question whether the language is, by default, pass-by-value or pass-by-reference So here is my question to all of you, in your favorite language, how is it actually done? and what are the possible pitfalls? your favorite language can, of...

PowerShell - How do I pass string parameters correctly?

Is there documentation or an article on the rules for passing strings into PowerShell functions? I just trying to do some string concatenation/formatting, but it's putting all the parameters into the first placeholder. Code function CreateAppPoolScript([string]$AppPoolName, [string]$AppPoolUser, [string]$AppPoolPass) { # Command to...

How many constructor arguments is too many?

Let's say you have a class called Customer, which contains the following fields: UserName Email First Name Last Name Let's also say that according to your business logic, all Customer objects must have these four properties defined. Now, we can do this pretty easily by forcing the constructor to specify each of these properties. Bu...

Is Java pass by reference?

I always thought Java was pass by reference, however I've seen a couple of blog posts (e.g. this blog) that claim it's not. I don't think I understand the distinction they're making. Could someone explain it please? ...

Can .NET check other running programs command line parameters?

We've got an interesting case where we are trying to determine how different instances of our app were launched. Is there any way for .NET to be able to query another running instance and get the command line parameters passed to that instance? I've not been able to find any way to do it in .NET so far, so I thought I'd check here to see...

Default Integer type in ASP.Net from a Stored Procedure

I have a web page that has I'm hooking up a stored procedure on. In this SQL Data Source, I have a parameter that I'm passing back to the SP of type int. ASP seems to want to default to int32 but the number won't get higher than 6. Is it ok to override the ASP default and put in 16 or will there be a conflict somewhere down the road...

PHP - command line arguments in Windows

I'm trying to run PHP from the command line under Windows XP. That works, except for the fact that I am not able to provide parameters to my PHP script. My test case: echo "param = ".$param."\n"; var_dump($argv); I want to call this as: php.exe -f test.php -- param=test But I never get the script to accept my parameter. The r...

Output parameters not readable when used with a DataReader

When using a DataReader object to access data from a database (such as SQL Server) through stored procedures, any output parameter added to the Command object before executing are not being filled after reading. I can read row data just fine, as well as all input parameters, but not output ones. [This question is actually just for anyo...

binding variables to parameters in ADOdb for PHP

does binding variables to parameters in ADOdb for PHP prevent SQL injection in any way? I thought ADOdb also did data sanitation or escaping within the same functionality by default. Or am I just confusing it with Code Igniter's built-in processes? ...

Best way to read commandline parameters in console application

Below are two ways of reading in the commandline parameters. The first is the way that I'm accustom to seeing using the parameter in the main. The second I stumbled on when reviewing code. I noticed that the second assigns the first item in the array to the path and application but the first skips this. Is it just preference or is ...

SSRS 2005 - Looping Through Report Parameters

I would like to be able to loop through all of the defined parameters on my reports and build a display string of the parameter name and value. I'd then display the results on the report so the user knows which parameters were used for that specific execution. The only problem is that I cannot loop through the Parameters collection. T...

How can I avoid the warning fom an unused parameter in PLSQ?

Sometimes, in PL SQL you want to add a parameter to a Package, Funtion or Procedure in order to prepare future functionallity. For example: create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number is Result number(12,2); begin Result := 10000; IF char <> 'EUR' THEN -- ERROR NOT IMPLEME...

How do I use FlashVars with ActionScript 3.0?

I found this guide for using the flash parameters, thought it might be useful to post here, since Flash CS3 lacks a usage example for reading these parameters. See answers for the link ...

Problems with accessing FlashVars via parameters in AS3

I keep getting compiler errors when I try to access flashVars in an AS3 class. Here's a stripped version of the code: package myPackage { import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; public class myClass { public function CTrafficHandler() { var myVar:String = LoaderInfo(this.root.l...

Accessing URL parameters in Oracle Forms / OC4J

How do I access parameters passed into an Oracle Form via a URL. Eg given the url: http://example.com/forms90/f90servlet?config=cust&amp;form='a_form'&amp;p1=something&amp;p2=else This will launch the 'a_form' form, using the 'cust' configuration, but I can't work how (or even if it's possible) to access p1 (with value of 'somethi...

Best way to safely read query string parameters?

Hello all, We have a project that generates a code snippet that can be used on various other projects. The purpose of the code is to read two parameters from the query string and assign them to the "src" attribute of an iframe. For example, the page at the URL http://oursite/Page.aspx?a=1&amp;b=2 would have JavaScript in it to read the...

Is there a standard framework for .NET parameter validation that uses attributes?

Is there a standard framework (maybe part of Enterprise Library... or .NET itself) that allows you to do common parameter validation in method attributes? ...

Java: Enum parameter in method

Hi guys, I have a method lets say: private static String drawCellValue(int maxCellLength, String cellValue, String align) { } and as you can notice, I have a parameter called align. Inside this method I'm going to have some if condition on whether the value is a 'left' or 'right'.. setting the parameter as String, obviously I can pass...

Why is my parameter passed by reference not modified within the function ?

I have got a C function in a static library, let's call it A, with the following interface : int A(unsigned int a, unsigned long long b, unsigned int *y, unsigned char *z); This function will change the value of y an z (this is for sure). I use it from within a dynamic C++ library, using extern "C". Now, here is what stune me : y ...