parameters

C++ class member functions that use dummy parameters

I know that you can use a dummy "int" parameter on operator++ and operator-- to override the postfix versions of those operators, but I vaguely recall something about a dummy parameter that you could declare on a destructor. Does anyone know anything about that, and if so, what that dummy parameter did? This was in my old Turbo C++ tuto...

Can I use identical names for fields and constructor parameters?

class C { T a; public: C(T a): a(a) {;} }; Is it legal? ...

How to run a console application with command line parameters in Visual C++ 6.0?

I've got a console application that compiles and executes fine with Visual C++ 6.0, except that it will then only get as far as telling me about missing command line parameters. There doesn't seem to be anywhere obvious to enter these. How do I run or debug it with command line parameters? ...

Passing parameter to VBA Macro

I am trying to run a macro when I double click on Visio shapes. I want to pass the shape object to the VBA macro so that I could do something in the macro depending on the id of the Shape object. Is it possible to pass the parameter to VBA macro. If yes, please let me know how? Thanks. ...

Nested Datalists using stored procedure parameters

Hi, I'm working with some nested datalist controls and cannot get the SP parameters for my nested stored procedure to work. In debug I can see that SqlDataSource2.SelectParameters.Add("Section",oLabel.Text.ToString()); is getting the correct value from the label but when the results display I always get the results for the last parame...

How do I pass a string parameter greater than varchar(8000) in SQL Server 2000?

You get a compilation error if you define the string parameter to have a size greater than 8000 e.g. The size (9000) given to the type 'varchar' exceeds the maximum allowed for any data type (8000). Any ideas? ...

Mark parameters as NOT nullable in C#/.NET?

Is there a simple attribute or data contract that I can assign to a function parameter that prevents null from being passed in C#/.NET? Ideally this would also check at compile time to make sure the literal null isn't being used anywhere for it and at run-time throw ArgumentNullException. Currently I write something like ... if (null ...

Finding Dll Function Parameters

How would one go about finding the parameters of an undocumented Dll function? I have searched all over the internet and have found one way involving decorated functions but I cannot find a way to get those. Any help would be appreciated. Thanks! ...

Page auto reload with parameters

I am trying to autoreload my page after every 20 seconds. I am using JavaScript for this instead of the <meta>. I have <body onload="SetTimer()"> and here is my JavaScript function function SetTimer(){ setTimeout('window.location.replace(window.location.pathname)', 20000) } Now my problem is I also pass a parameter wi...

Display Parameter(Multi-value) in Report

Hi, Can anyone tell me how to display all the selected value of my multi value parameter in SSRS report. When giving parameter.value option it gives error. Thanks in advance. Suni ...

Parameterized Queries with LIKE and IN conditions

Parameterized Queries in .Net always look like this in the examples: SqlCommand comm = new SqlCommand("SELECT * FROM Products WHERE Category_ID=@categoryid", conn); comm.Parameters.Add("@categoryid", SqlDbType.Int); comm.Parameters["@categoryid"].Value = CategoryID; But I'm running into a brick wall trying to do the following: Sql...

How do you use optional parameters in VB?

How can I create a method that has optional parameters in it in Visual Basic? ...

C++ array size dependent on function parameter causes compile errors

I have a simple function in which an array is declared with size depending on the parameter which is int. void f(int n){ char a[n]; }; int main() { return 0; } This piece of code compiles fine on GNU C++, but not on MSVC 2005. I get the following compilation errors: .\main.cpp(4) : error C2057: e...

C++ Parameter Reference

Hi, if I am given void (int a[]) { a[5] = 3; // this is wrong? } Can I do this so that the array that is passed in is modified? Sorry for deleting, a bit new here... I have another question which might answer my question: If I have void Test(int a) { } void Best(int &a) { } are these two statements equivalent? Test(a); Best(&a...

Writing stringstream contents into ofstream

I'm currently using a std::ofstream a function and a std::stringstream std::ofstream outFile; outFile.open(output_file); Then I call a function GetHolesResults(..., std::ofstream &outFile){ float x = 1234; std::stringstream ss; ss << x << std::endl; outFile << ss; } Now my outFile contains nothing but garbage "0012E708" re...

Is there a sweet, efficient way to call the same method twice with two different arguments?

Say for example I have the following string: var testString = "Hello, world"; And I want to call the following methods: var newString = testString.Replace("Hello", "").Replace("world", ""); Is there some code construct that simplifies this, so that I only have to specify the Replace method once, and can specify a bunch of parameters ...

Passing a dictionary to a function in python as keyword parameters

I'd like to call a function in python using a dictionary. Here is some pseudo-code: d = dict(param='test') def f(param): print param f(d) This prints {'param': 'test'} but I'd like it to just print test. I'd like it to work similarly for more parameters: d = dict(p1=1, p2=2) def f2(p1,p2): print p1, p2 f2(d) Is this pos...

Parameterizing a SQL IN clause?

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? select * from Tags where Name in ('ruby','rails','scruffy','rubyonrails') order by Count desc In this query, the number of arguments could be anywhere from 1 to 5. I would prefer not to use a dedicated stored procedure for this ...

C# Syntax - Your preferred practice for getting 2 or 3 answers from a method

I'm just wondering how other developers tackle this issue of getting 2 or 3 answers from a method. 1) return a object[] 2) return a custom class 3) use an out or ref keyword on multiple variables 4) write or borrow (F#) a simple Tuple<> generic class http://slideguitarist.blogspot.com/2008/02/whats-f-tuple.html I'm working on some cod...

Sql reports 2008 error

Hello guys I am running some code too setup my report parameters but I am getting the following error in Visual Studio 2008: "Client found response content type of '', but expected 'text/xml'.\r\nThe request failed with an empty response." System.Exception {System.InvalidOperationException} Thios only happened recently, I assume it is ...