parameters

C# Winforms - How to Pass Parameters to SQL Server Stored Procedures

my practice is that i fill use databinded listboxes and using a tablebindingsource and tableadapter. Then to get selective records in listbox i build stored procedure and select required records. But now i want that the stored procedure must take some parameter from some textbox value. like i to implement the following query string q...

When a method has too many parameters?

When debugging some web-service client code today (in Java, with jax-ws) I ran across a web-service method with the mind-blowing amount of 97 parameters! I had to create a test case that calls this method, and I noticed several things: code assist/hover doesn't scale well. I am using Eclipse, and the tooltip over the method is as wide...

Analog of PHP "MAX_FILE_SIZE" param for JSP

Is there analog of PHP "MAX_FILE_SIZE" parameter for JSP? It's needed to perform validation on UI before upload process triggered on backend. ...

Function argument already initialized in function declaration C++

So here's my question in the function declaration there is an argument and it is already initialized to a certain value. What are the procedures to call this function and use that default value, or is it just a way to document code, telling other programmers what you expect them to use as a value for the parameter? Thank you. enum File...

In Ruby, how can you invoke a method using its default argument or with a specified argument without repeating code?

Say I have a ruby method: def blah(foo=17) ... end In code I want to invoke blah with a specific argument "blah(a)" or invoke blah using its default argument "blah()" Is there any way to do that without specifying the method name twice? I'm trying to avoid: if a.nil? blah() else blah(a) end Because it makes the code look m...

When to use constants as parameters instead of magic values

I have read (and generally agree) that to increase code legibility, you should use constants instead of magic numbers as method parameters. For example, using PHP: // no constants //////////////////// function updateRecord($id) { if ($id == -1) { // update all records } else { // update record with "id = $id" ...

Android TextViews. Is parametrization possible? Is binding to model possible?

Hello everybody, I am new to both Android and Stack Overflow. I have started developing and Android App and I am wondering two things: 1) Is it possible to parametrize a TextView? Lets say I want to render a text message which states something like: "The user age is 38". Lets suppose that the user age is the result of an algorithm. Usin...

How to improve maintainability of functions

I will expand here on a comment I made to http://stackoverflow.com/questions/2244860/when-a-method-has-too-many-parameters where the OP was having minor problems with someone else's function which had 97 parameters. I am a great believer in writing maintainable code (and it is often easier to write than to read, hence Steve McConnell(p...

How to use a parameter in a xslt as a XPath?

I'd like to add an element to a xml document and I'd like to pass as a parameter the path to the element. sample.xml file: <?xml version="1.0"?> <stuff> <element1> <foo>2</foo> <bar/> </element1> <element2> <subelement/> <bar/> </element2> <element1> <foo/> <bar/> </element1> </stuff> Using: xalan.exe -p my...

Datatype mismatch issue in a Parametrized insert query

I have this code to transfer records from one-table to the other cmd2.CommandText = "select * from " + TableName; reader = cmd2.ExecuteReader(); if (reader != null) { String s = "".PadLeft(reader.FieldCount - 1, 'X').Replace("X", "?,") + "?"; ...

MATLAB: How do I pass a parameter to a function?

I have the following function: function ypdiff = ypdiff(t,y) a = 0.01; b = 0.1; ypdiff(1) = -a*y(1)*y(2); ypdiff(2) = b*y(1)*y(2)-b*y(2); ypdiff(3) = b*y(2); ypdiff = [ypdiff(1) ypdiff(2) ypdiff(3)]'; If I want to solve this, I would call the ode45 function as follows: [t y] = ode45(@ypdiff, [to tf], yo); Bu...

MS Access & Excel: Turning a query with dynamic parameters into something useful

I got stuck in the problem beneath, because I don´t use Access or Excel much and I have some basic programming language. So here's the deal: I just made a fairly simple database in MS Access (2007) with a nice query to retrieve data, depending on which parameters you pass. In Excel (2007), I have this big 'template' which basically has...

SLI Systems search get parameters for limit

I was wondering if anyone had used the SLI Systems search system on their website. I was wanting to know the parameters for adjusting the limit of products returned per page in a search. For example this site. ...

How can I use an optional array argument in a VBA procedure?

I've got a private procedure in a VBA script for MS Access: Private Sub drawLineDiagram(chartSpace As Variant, title As String, caption As String, x_val() As Variant, y_val() As Variant, Optional y_val2() As Variant = ????) As you see, I want to have an optional last parameter for an array of values. What kind of default parameter mu...

How to pass the parameter in SQL query from PowerShell

I have this code in PowerShell, that executes SQL query for UPDATE table: $Connection=new-object data.sqlclient.sqlconnection "server=server;database=mydb;trusted_connection=true;" $Connection.open() For( $i = 0; $i -le $ActID.Length; $i ++ ){ $cmd = New-Object System.Data.SqlClient.SqlCommand $cmd.Connection = $Connection $cmd.Comma...

Class Inheritance through Multiple Classes

Hello, I have 3 classes and I run the first class and declare a variable in the second class and want the 3rd class to be able to print out this variable. I have code below to explain this more clearly. from class2 import Class2 class Class1(Class2): def __init__(self): self.value1 = 10 self.value2 = 20 def a...

.NET ParameterizedThreadStart wrong return type

Hello, I just started experimenting with Threads and I ran in to a problem I'm not able to solve on my own. I get the error: Error 1 'bool projekt.ftp.UploadFil (object)' has the wrong return type I use this code to start a thread using the method ftp.Uploadfile: Thread ftpUploadFile = new Thread(new ParameterizedThreadStart(ftp.Upl...

Howto create a facelet-hyperlink with variable data as parameter?

Hi, I have two facelet-pages: customers.xhtml (with a list of customers) and customer.xhtml for detail-view of just one customer. I use a h:dataTable component inside the customers.xhtml: <h:dataTable var="customer" value="#{customerBackingBean.customers}">...</h:dataTable> Now I want to create a hyperlink for each customer in the ta...

call jQuery JSON function and pass back resulting payload

I would like to call jQuery JSON function and pass back results as JSON object (Javascript array?), but I am not quite understanding dynamics of what is happening here. myJSON = myFunction(productNo) $.each(myJSON, function(i,user){ alert (user.description) } function myFunction(productNo) { $.getJSON ( "processors/proces...

php class function -> call the function according to a passing parameter

Hi, I have a class 'abc', with several functions inside it: 'abc_function1' 'abc_function2' 'abc_function3' 'abc_function4' 'abc_function5' I would like to call a function of the class 'abc' according to a parameter that I enter, a string containing 'function1' or 'function 4' for example, to refer to the corresponding function of the ...