parameter-passing

C Variable Scope Specific Question

Here is a particular scenario that I have been unclear about (in terms of scope) for a long time. consider the code #include <stdio.h> typedef struct _t_t{ int x; int y; } t_t; typedef struct _s_t{ int a; int b; t_t t; }s_t; void test(s_t & s){ t_t x = {502, 100}; s.t = x; } int main(){ s_t s; test(s); printf("value i...

How can I get a variable into Silverlight 3 control from my ASP.NET code?

I'm playing with Silverlight 3 at the mo. I'm trying to get the current user ID into the Silverlight 3 page. I've done a bit of research and initParams seems to be the right way to go. Trouble is, they seemed to use the asp:Silverlight control and that's gone in SL3. I'm stuck trying to get a variable into the initParams list, assumi...

MSAccess 2003 - VBA for passing a value from one form to another

So how can I pass a value from one form to another? For example: The user select's an organization from a list and this opens up a trip form that allows a user to enter various information regarding the trip. At one place I would like to add another little pop up form where they can enter contact information (just a name and phone for PO...

In common-lisp, how do I modify part of a list parameter from within a function without changing the original list?

I'm trying to pass a list to a function in Lisp, and change the contents of that list within the function without affecting the original list. I've read that Lisp is pass-by-value, and it's true, but there is something else going on that I don't quite understand. For example, this code works as expected: (defun test () (setf origina...

How to pass a Generic class as a Parameter to a non-generic class constructor

Assume the following code (Please read my question in the code comments in the final class): //This is my Generic Class public class ClientRequestInfo<K, V> { public string Id { get; set; } private Dictionary<K, V> parameters; public ClientRequestInfo() { parameters = new Dictionary<K, V>(); } public vo...

How to send multiple arguments to jquery click function?

Currently I'm using something like: $('.myclass').click(function(){ var msg = $(this).attr('id'); alert(msg) }); And HTML: < a href="#" class="myclass" id="101">Link</a> If I need additional parameters how would I read them? Also is the current way I am using the proper way? Originally I was using hidden input fields so...

Passing a value from child window to parent

Here is my scenario: i have a parent web page, in my javascript code I open a new window. This new window is a server-side aspx page. This child page needs to save some data in the database, and after saving it returns an ID. Now, I need to pass this ID from the child server page to the parent's javascript. Essentially I need the child ...

How to pass stored procedure parameter values from vb6 application to show a report (made by crystal reports 8.5)?

Hi How Can I pass stored procedure parameter values from vb6.0 application to show a report (made by crystal reports 8.5) ? any help will be appreciated Below lines are what I have done but still have problem on showing the report: Private Sub FeedReport() Dim mobjReport as New CrystalReport1 Dim CRXParamDefs As CRAXDDRT.Par...

jQuery, how to call a function while passing a variable

I want to use jQuery's .get method to send an ajax call to the server. I am using this line: $.get("InfoRetrieve", { },addContent(data)); As you can see I want to call a function call addContent and pass it the data that is retrieved from the server. The function addContent is below: function addContent(data){ $("#0001").append...

Setting an SQL Query AS a variable or parameter (Integer prefered) and using it

Hello All, I couldn't solve that mistery question in SQL SERVER. Here an example that I tried to do and it didn't work. DECLARE @Total int; SET @Total = (SELECT COUNT(*)-10 FROM MYTABLE) SELECT TOP @Total IdColumn FROM MYTABLE How can I use the following query SELECT COUNT(*)-10 FROM MYTABLE as an integer variable, somewhere el...

parameter passing to a shared object function

i have a c-application which should load a shared object at runtime and call an arbitrary function of the shared object. The shared object was build by the user and gave me the signature of his function. int func(int a, int b, double c) i use dlopen to load the object and dlsym to get a function pointer to the shared object function...

PHP: variable-length argument list by reference?

Is it possible to create a PHP function that takes a variable number of parameters all of them by reference? It doesn't help me a function that receives by reference an array of values nor a function that takes its arguments wrapped in an object because I'm working on function composition and argument binding. Don't think about call-tim...

Need to escape the quotes of a variable in MVC View to pass as a parameter to Javascript

Hi all, I have a MVC view in which I have to pass a string variable to javascript, but that string variable has single quotes in it ('). I am trying to do something like this <a onclick="JavaScript:AddressHandler.ProcessAddress('<%= homeAddress %>');" class="button-link">change</a> homeAddress has single ...

Avoid excessive function parameters: class-centered or function-centered approach?

How would you fix the following bad code that passes too many parameters around? void helper1(int p1, int p3, int p5, int p7, int p9, int p10) { // ... } void helper2(int p1, int p2, int p3, int p5, int p6, int p7, int p9, int p10) { // ... } void foo(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9...

Parsing a bit field parameter, how to "discard" bits in an unsigned long?

Hey all, First of all, I want to know if this is possible: let's say I have an unsigned long which contains some abritrary unsigned shorts, which may or may not be in the number. For example: unsigned short int id1 = 3456, id2 = 30998; unsigned long long bitfld = id1|id2; Can the other 2 fields be assumed as 0? An...

C: Passing Struct to a Function doesn't result in a call by value operation

Hello! I have the following problem with a program which I wrote in Visual C++ and I hope that anyone can help me please: typedef struct spielfeld { int ** Matrix; int height; int width; Walker walker; Verlauf history; } Spielfeld; void show(Spielfeld fieldToShow); //Prototype of the Function where I have this ...

parameter passing to a standalone qooxdoo application

Hi, How can I pass parameters to a stand alone qooxdoo applicatoin? Thanks in advance :) update: I was thinking of passing URL parameters; something like GET/POST params when an html FORM is submitted. Initially, "arguments" in standalone application caught my attention. I think Tobi has correctly answered me (thanks a bunch); but fe...

passing parameters to remote beanshell

Hello, I need to pass parameter to remote beanshell script which is run through java -cp bsh-2.0b4.jar bsh.Remote http://10.0.0.1/beanshell script.bsh p1 p2 p3 call. Is it somehow possible to read params 'p1', 'p2' and 'p3' from within the script.bsh? p.s. Local params passing through bsh.args works fine, but it's unusable with rem...

How can I use "Dependency Injection" in simple php functions, and should I bother?

I hear people talking about dependency injection and the benefit of it all the time, but I don't really understand it. I'm wondering if it's a solution to the "I pass database connections as arguments all the time" problem. I tried reading wikipedia's entry on it, but the example is written in Java so I don't solidly understand the dif...

C#.NET: Modify a RichTextBox of other Form..

I'm building a Notepad. I have a Find and Replace form. When I click a button that form opens, user gives two input in two textboxes and press a button. Then the RichTextBoxes from the main form is supposed to get modified. Here's the form of the FindAndReplace form : private void btnReplaceAll_Click(object sender, EventArgs e) ...