parameter-passing

Rails inconsistently fails to send datetime parameters

I am revising someone else's project which allows users to submit content either for either immediate or scheduled publication. There are a pair of radio buttons to select this, and a datetime field that is enabled by javascript if the radio button for 'scheduled' is selected <%= f.hidden_field :scheduled_state %> <%= f.radio_button :im...

How can I pass additional parameters to predicate functions?

Can I pass additional parameters to a predicate function? I need it in a sorting process actually. public void Sort( Comparison<T> comparison ) where I would like to use Comparison predicate in this form: public delegate int Comparison<T>( T x, T y, object extraParameter ) Is this possible? Thanks, ...

How to share array(list)/variables between tabbed pane in Java swing?

Hi, I been trying to do "the question title". Here is my current code: Main.java import java.awt.*; import javax.swing.*; public class Main { public static void main(String[] args) { JFrame f= new JFrame ("My Frame"); f.setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE); JTabbedPane tp = new JTabbedPane(); User user = new User(); tp...

Javascript passing string parameter - then using setStyle

Current function: function SetPopup() { x$('body').setStyle('overflow', 'hidden'); x$('#divOne').setStyle('height', document.body.offsetHeight + 'px'); x$('#divOne').setStyle('width', 100 + '%'); x$('#divOne').setStyle('display', 'block'); } What I would like to do is change this function such that 'divOne' would be re...

Default value for parameter in Controller Method is overriding everything

Hello i have just started learning mvc2 and im having a problem with the default value for the parameter page(you can see the method below). Its always 0 regardless of what i type in the URL. For example this h.ttp://localhost:52634/Products/List/2 should show page 2 but when in debug mode the page parameter is 0, so im always gettin...

Powershell: How can I pass a variable as a parameter value?

I have code that prompts a user for input for $dom. $dom = "'DC=my,DC=com'" Get-QADUser -SearchRoot $dom -SearchScope 'SubTree' -objectattributes @{"EmployeeID"=$eid} | Select-Object SamAccountName, employeeID, DisplayName, Description, Email, LastLogon, legacyExchangeDN I get the following error when I run this. Get-QADUser : A ref...

Filling an array passed as a parameter with objects

I have a function similar to this: void foo(obj ary[], int arysize) { for (int i = 0; i < arysize; i++) ary[i] = obj(i, "abc"); } And I call it like this: obj array[5]; foo(array, 5); It's supposed to populate the array with my objects. However, when it returns, the objects are garbage. It works with value types like i...

Array parameter passing in C#: why is it implicitly by reference?

Assume the following code, without any ref keyword, that obviously won't replace the variable passed, since it's passed as value. class ProgramInt { public static void Test(int i) // Pass by Value { i = 2; // Working on copy. } static void Main(string[] args) { int i = 1; ProgramInt.Test(i); ...

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 ...

How can I pass a PHP variable to javascript?

I want to use a PHP variable as a javascript variable - specifically I want to user the PHP variable session_id(); and use this as a javascript variable. <?php $php_var = session_id(); ?> <script language="JavaScript" type="text/javascript"> js_var = <?php echo($php_var ?>; </script> This seems like it should work for me but it doesn...

Send list/array as paramater with jQuery getJson

I have the following where I'm trying to send list/array to MVC controller method: var id = []; var inStock = []; $table.find('tbody>tr').each(function() { id.push($(this).find('.id').text()); inStock.push($(this).find('.stocked').attr('checked')); }); var params = {}; params.ids = id; params.stocked = inStock; $.getJSON('My...

How would I pass my program a string from the start menu search in Windows (like ping)?

When my program is launched from the start menu shortcut I would like to send it a string. I see that ping does this because I can type in ping [and a domain] and it will pop the cmd window and do the ping. However I think this must be working differently than what I have setup because even though the shortcut to the program is in the st...

How can I handle a possibly empty parameter List when using a named query in NHibernate?

I'm having issues on handling a situation where a list of parameters sent to a named query in NHibernate is empty. This is an example of my situation: <sql-query name="MyClass_FilterByCategoryID"> <return alias="MyClass" class="MyProject.BusinessEntities.MyClassBE"/> <![CDATA[ SELECT DISTINCT MyClass.* FROM MyClassTable...

Am i passing the value correctly to my controller from jquery?

I am doing a delete on a table using jquery, $('table#chkbox td a.delete').click(function() { if (confirm("Are you sure you want to delete this row?")) { var id = $(this).parent().attr('id'); var parent = $(this).parent().parent(); $.ajax( { type: "...

In C++, are changes to pointers passed to a function reflected in the calling function?

If I pass a pointer P from function f1 to function f2, and modify the contents of P in f2, will these modifications be reflected in f1 automatically? For example, if I need to delete the first node in a linked list: void f2( Node *p) { Node *tmp = p; p = p -> next; delete tmp; } Will the changes made to P be reflected in ...

PHP - Faked Multiple inheritance - How to pass multiple parameters to functions

I found this while searching for how to fake multiple inheritance in PHP (since PHP does not support multiple inheritance directly). http://stackoverflow.com/questions/356128/can-i-extend-a-class-using-more-than-1-class-in-php/356431#356431 Here is the complete code given there:- class B { public function method_from_b($s) { ...

the value parameter is not being passed using jquery?

<textarea name="inputField" id="inputField" tabindex="1" rows="2" cols="40"onblur="DoBlur(this);" onfocus="DoFocus(this);" ></textarea> <input class="submitButton inact" name="submit" type="submit" value="update" disabled="disabled" /> <input name="status_id" type="hidden"> the javascript(jquery): function insertParamIntoField(anchor,...

How to conditionally pass parameters in Java to a method that takes a variable number of arguments?

I'm using the JDO Query class and I need to conditionally pass certain parameters to the execute method, as demonstrated in the code below. I don't know how to do this in Java. query.declareParameters("String alphaP"); query.declareParameters("String bravoP"); query.declareParameters("String charlieP"); if (condition == true) { if...

C: Passing an array into a function 'on the fly'

I have a function, and I want to pass an array of char* to it, but I don't want to create a variable just for doing that, like this: char *bar[]={"aa","bb","cc"}; foobar=foo(bar); To get around that, I tried this: foobar=foo({"aa","bb","cc"}); But it doesn't work. I also tried this: foobar=foo("aa\0bb\0cc"); It compiles with a w...

Where is the Report Parameters Dialog Box

I am using Visual Studio 2010 Professional. I need to add a parameter to a local report. All the information I have found says to use the Report Parameters Dialog Box. Great!! It seems like I should select the rdlc file then the Report Menu option is displayed and I select the Dialog Box from the menu. But it is not there. Where is ...