Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 81/604 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • Passing a variable that can be updated

    - by Rob Bonner
    This seems like a simple thing, but can't get it to work. I pass a variable into a UIViewController thourgh a standard property: [aViewController setProposedDate:proposedWorkLog.entryDate]; which is retained by the controller, and possible changed. I have verified that in the controller, the data is modified. But, after it is popped off the stack and I look in the calling view, the data has not been updated. Is there a way to pass this variable and have it retain the new value, or a way to pass back a response from a closing view controller? Thanks!

    Read the article

  • Passing a NSString to another ViewController using classes

    - by Jeff Kranenburg
    I know this insanely simple, but I am re-teaching myself the basics and trying to get my head around this:-) I have one ViewController called MainVC and I have one called ClassVC In ClassVC I have this code: @interface ClassVC : UIViewController { NSString *mainLine; } @property (nonatomic, retain) NSString *mainLine; @end and I have this in the implementation file: @synthesize mainLine = _mainLine; -(NSString *)_mainLine { _mainLine = @"This a string from a Class"; return _mainLine; } Now I was thinking that if I #import the ClassVC into MainVC I would be able to transfer that string along as well like so: This code is in the viewDidLoad _mainLabel.text = _secondClass.mainLine; NSLog(@"%@", _secondClass.mainLine); But that is not working - so cannot I not pass strings in through this way???

    Read the article

  • Passing Javascript value to PHP Variable using ajax

    - by shels
    I am trying to use a Flash detection script to assess whether Flash Plugin is enabled in the user browser so that a different page loads. The Flash detection script is as follows, using jquery 1.8.2 and jquery.jqplugin 1.0.2 <script type="text/javascript" src="jquery-1.8.2.min.js"></script> <script type="text/javascript" src="jquery.jqplugin.1.0.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#withflash").hide(); $("#noflash").hide(); if ($.browser.flash == true) $("#withflash").show (); else $("#noflash").show (); }); </script> <div id="withflash">Flash Supported</div> <div id="noflash">Flash Not Supported</div> I get the display that "Flash Supported" if Flash Plugin is present.. I need to capture the value whether flash plugin value is true in a php variable $hasFlashSupport as below: <?php echo " $hasFlashSupport"; exit; ?> I am aware that PHP is server based and Javascript is client based.. Hence Ajax would be a nice option to capture the javascript variable to my php variable. I am totally ignorant about Ajax syntax and how to achieve it. Request the experts here to help me out with the code on how this can be achieved... Thanking all of you in advance..

    Read the article

  • Integration test for H1 text failing when it should be passing (Rspec and Capybara)

    - by rebec
    Below you can see my test for what happens when a user tries to access the page to edit a profile photo that they don't own. I've used the same test on the NEW action, where it worked fine, but it surprised me by failing when I copied it down to the EDIT action tests. I've used save_and_open_page to test what Capybara's seeing (as you can see below); the resulting page definitely has an h1 with the specified text in it. No spelling errors, and case is all the same as in the test. I've tried using both have_css and have_selector. Both fail. I'm still learning Ruby, Rails, Rspec and especially Capybara (was using webrat previously and recently switched over), and wonder if I'm misconceiving of something that's making me expect this to pass when it doesn't. Any thoughts? Thanks! describe "EDIT" do let(:user) { FactoryGirl.create(:user) } let(:different_user) { FactoryGirl.create(:user) } let(:admin_user) { FactoryGirl.create(:user, role: "admin") } let(:profile_photo1) { FactoryGirl.create(:profile_photo, user: user) } subject { page } context "when signed in as any member" do before { login different_user visit edit_user_profile_photo_path(:id => profile_photo1, :user_id => profile_photo1.user_id) save_and_open_page } # It should deny access with an Unauthorised/Forbidden message. it { should have_css('h1', text: "Unauthorised/Forbidden.") } end

    Read the article

  • Reference to fnc.

    - by atch
    Hi guys, Is there a way in java to do something like this: void fnc(void Reference_to_other_func()); What I'm trying is basically I have number of places where I need to display this same text to the user and the only difference is which method is invoked after this text. So for example instead of writing: System.out.println("Hello"); f1(); //in some other place System.out.println("Hello"); f2(); //etc I would like to define one function: public void f(void Reference_to_other_func()) { System.out.println("Hello"); Reference_to_other_func();//HERE I'M INVOKING } and then instead of repeating this whole code I could write something like this: f(f1); //in some other place f(f2) //etc. Thanks for answers

    Read the article

  • "Passing Go" in a (python) date range

    - by anonymous coward
    The Rules: An employee accrues 8 hours of Paid Time Off on the day after each quarter. Quarters, specifically being: Jan 1 - Mar 31 Apr 1 - Jun 30 Jul 1 - Sep 30 Oct 1 - Dec 31 The Problem Employees will use an automated system to request paid time off, possibly occurring in the past, as well as the future. Requests should only be accepted if the employee has (or will have) that time available. For instance, if an employee only has 1 Day of Paid Time Off currently available (currently being January 20th), but is requesting 2 Days of Paid Time Off, beginning September 20th, the system should take into account that the employee would have accrued enough time off by then and allow the request. (Obviously ignoring that the employee may use up existing time before that date). I'm currently using Python, and wondering what the correct approach to something like this would be. I'm assuming that using DateTime objects, and possibly the dateutil module, would help here, but my brain isn't wrapping around this problem for some reason.

    Read the article

  • Misunderstanding function pointer - passing it as an argument

    - by Stef
    I want to pass a member function of class A to class B via a function pointer as argument. Please advise whether this road is leading somewhere and help me fill the pothole. #include <iostream> using namespace std; class A{ public: int dosomeA(int x){ cout<< "doing some A to "<<x <<endl; return(0); } }; class B{ public: B(int (*ptr)(int)){ptr(0);}; }; int main() { A a; int (*APtr)(int)=&A::dosomeA; B b(APtr); return 0; } This brilliant piece of code leaves me with the compiler error: cannot convert int (A::*)(int)' toint (*)(int)' in initialization Firstly I want it to compile. Secondly I don't want dosomeA to be STATIC.

    Read the article

  • passing different structs to a function in c

    - by clear2k
    I have different structures that need to be filled out the same way. The only difference is that they are filled based on different data. I was wondering if it's possible to pass different structures to a certain function. What I have in mind is something like: struct stu1 { char *a; int b; }; struct stu2 { char *a; int b; }; static struct not_sure **some_func(struct not_sure *not_sure_here, original_content_list) { // do something and return passed struct for(i=0; i<size_of_original_content_list; i++){ //fill out passed structure } return the_struct; } int main(int argc, char *argv[]) { return_struct1 = some_func(stu1); return_struct2 = some_func(stu2); // do something separate with each return struct... } Any comments will be appreciate it.

    Read the article

  • JSON | Django passing python list

    - by MMRUser
    Hi, I'm trying to send a Python list in to client side (encoded as JSON), this is the code snippet which I have written: array_to_js = [vld_id, vld_error, False] array_to_js[2] = True jsonValidateReturn = simplejson.dumps(array_to_js) return HttpResponse(jsonValidateReturn, mimetype='application/json') So my question is how to access it form client side, can I access it like this: jsonValidateReturn[0] or how I assign a name to the returned JSON array in order to access it?

    Read the article

  • Passing class method as selector problem.

    - by Anoide
    Hi, I want to build a selector from a class method. I'm doing it this way: NavigationTreeActionHandler* handler=[NavigationTreeActionHandler self]; NavigationTreeNode* bombsNode=new NavigationTreeNode("Bombs","bigbomb.tif" ,handler,@selector(BigBombButtonPressed:)); I need to pass to NavigationTreeNode the target and the selector to the target method. I try to get the target using the self property of the class object (Don't know if htis is the correct way to do it). Then I get the selector for the class method I want to call on the class. Everything compiles ok but it fails when I use: [[handler class] instanceMethodSignatureForSelector:selector]; I get a nil and don't really know why... could anybody help please? Thanks in advance, Olson.

    Read the article

  • Passing a string to a function in C++

    - by Chef Flambe
    I want to pass a string like "Celcius" into a function that I have but I keep getting errors tossed back at me from the Function. System::Console::WriteLine' : none of the 19 overloads could convert all the argument types I figure I just have something simple wrong. Can someone point out my mistake please? Using MS Visual C++ 2010 I've posted the offending code. The other functions (not posted) work fine. void PrintResult( double result, std::string sType ); // Print result and string // to the console //============================================================================================= // start of main //============================================================================================= void main( void ) { ConsoleKeyInfo CFM; // Program Title and Description ProgramDescription(); // Menu Selection and calls to data retrieval/calculation/result Print CFM=ChooseFromMenu(); switch(CFM.KeyChar) // ************************************************************ { //* case '1' : PrintResult(F2C(GetTemperature()),"Celsius"); //* break; //* //* case '2' : PrintResult(C2F(GetTemperature()),"Fahrenheit"); //* break; //* //* default : Console::Write("\n\nSwitch : Case !!!FAILURE!!!"); //* } //************************************************************ system("pause"); return; } //Function void PrintResult( double result, std::string sType ) { Console::WriteLine("\n\nThe converted temperature is {0:F2} degrees {1}\n\n",result,sType); return; }

    Read the article

  • How to get reference of activity object ?

    - by Fevos
    Hi i want to show messageBox or notification when connection lost in Static DB class but i cant use getApplicationContext() becouse its a static class and i tried to call other class called notification but i have error so how i could pass activity object to my new class .

    Read the article

  • pass by const reference of class

    - by small_potato
    void foo(const ClassName &name) { ... } How can I access the method of class instance name? name.method() didn't work. then I tried: void foo(const ClassName &name) { ClassName temp = name; ... .... } I can use temp.method, but after foo was executed, the original name screwed up, any idea? BTW, the member variable of name didn't screwed up, but it was the member variable of subclass of class screwed up.

    Read the article

  • Javscript passing and using that function

    - by Totty
    I have: var f1 = function(a){ alert(a) } var f2 = function(data, method){ method(data) // the problem is here, // the method f1 is not called. Is there a way to call that method f1? // the method f1 might not be in this scope, the method f1 can // be in a class or like this... } f2(a, f1) The question is: Is there a way to call that f1 from f2, from the passed method? thanks

    Read the article

  • Passing data from one viewcontroller to another

    - by user1392515
    I subclassed two view controllers. The first one is supposed to pass data, a NSUrl object to the second one. .m of the first one: NSURL *temp = [NSURL URLWithString:@"http://example.com"]; UIViewController *presentationsFullScreen_ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PresentationsFullScreen_ViewController"]; presentationsFullScreen_ViewController.urlToUse = temp; .h of the second one: #import <UIKit/UIKit.h> @interface PresentationsFullScreen_ViewController : UIViewController { NSURL *urlToUse; } @property (nonatomic,retain) NSURL *urlToUse; It is obviously not working and not compiling,telling me essentially that I didn't subclass it and that the property urlToUse is not found on UIViewController. How do I subclass correctly? Thanks!

    Read the article

  • Passing partial arguments in tcshell

    - by R S
    Hey, I'm writing a shell script (tcsh) that is supposed to received 3 parameters or more. The first 3 are to be passed to a program, and the rest are supposed to be passed to another program. All in all the script should look something like: ./first_program $1 $2 $3 ./second program [fourth or more] The problem is that I don't know how to do the latter - pass all parameters that are after the third.

    Read the article

  • Using `g_object_set_data` for passing user name.

    - by PP
    I am using g_object_set_data to set user name with event_box so in call back i can get it with in event_box pointer. g_object_set_data(G_OBJECT(event_box), "user_name", (gpointer)(user_name) ); but problem is that i am setting user_name which is not an pointer allocated string. It is an local string (not allocated on hip) which gets destroyed. So is it necessary to allocated and then use the pointer, i just want to associate one name with this event_box.

    Read the article

  • Pass reference to ArrayLists to a method.

    - by bhavna raghuvanshi
    here is the whole program: public class ListMerge { public static void main( String[] args) { Scanner input = new Scanner(System.in); System.out.println ("Input length of arraylist 1:"); int n = input.nextInt(); ArrayList x = new ArrayList(); ArrayList y = new ArrayList(); for (int i = 0; i < n; i++) { System.out.println ("Input x[ " + i +"] :" ); x.add(new Integer(i)); } System.out.println ("Input length of arraylist 2:"); int m = input.nextInt(); for (int i = 0; i < m; i++) { System.out.println ("Input y[ " + i +"] :" ); y.add(new Integer(i)); } } list int merge(ArrayList x, ArrayList y) { List all = new ArrayList(); all.addAll(x); all.addAll(y); System.out.println(all); return all; } } also tell me how do i call the function merge?

    Read the article

  • Access a static variable by $var::$reference

    - by chuckg
    I am trying to access a static variable within a class by using a variable class name. I'm aware that in order to access a function within the class, you use call_user_func(): class foo { function bar() { echo 'hi'; } } $class = "foo"; all_user_func(array($class, 'bar')); // prints hi However, this does not work when trying to access a static variable within the class: class foo { public static $bar = 'hi'; } $class = "foo"; call_user_func(array($class, 'bar')); // nothing echo $foo::$bar; // invalid How do I get at this variable? Is it even possible? I have a bad feeling this is only available in PHP 5.3 going forward and I'm running PHP 5.2.6. Thanks.

    Read the article

  • Passing values between pages in JavaScript

    - by buni
    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.Web.Services; using System.IO; namespace T_Smade { public partial class ConferenceManagement : System.Web.UI.Page { volatile int i = 0; protected void Page_Load(object sender, EventArgs e) { GetSessionList(); } public void GetSessionList() { string secondResult = ""; string userName = ""; try { if (HttpContext.Current.User.Identity.IsAuthenticated) { userName = HttpContext.Current.User.Identity.Name; } SqlConnection thisConnection = new SqlConnection(@"data Source=ZOLA-PC;AttachDbFilename=D:\2\5.Devp\my DB\ASPNETDB.MDF;Integrated Security=True"); thisConnection.Open(); SqlCommand secondCommand = thisConnection.CreateCommand(); secondCommand.CommandText = "SELECT myApp_Session.session_id FROM myApp_Session, myApp_Role_in_Session where myApp_Role_in_Session.user_name='" + userName + "' and myApp_Role_in_Session.session_id=myApp_Session.session_id"; SqlDataReader secondReader = secondCommand.ExecuteReader(); while (secondReader.Read()) { secondResult = secondResult + secondReader["session_id"].ToString() + ";"; } secondReader.Close(); SqlCommand thisCommand = thisConnection.CreateCommand(); thisCommand.CommandText = "SELECT * FROM myApp_Session;"; SqlDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { test.Controls.Add(GetLabel(thisReader["session_id"].ToString(), thisReader["session_name"].ToString())); string[] compare = secondResult.Split(';'); foreach (string word in compare) { if (word == thisReader["session_id"].ToString()) { test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); } } } thisReader.Close(); thisConnection.Close(); } catch (SqlException ex) { } } private Button GetButton(string id, string name) { Button b = new Button(); b.Text = name; b.ID = "Button_" + id + i; b.Command += new CommandEventHandler(Button_Click); b.CommandArgument = id; i++; return b; } private Label GetLabel(string id, string name) { Label tb = new Label(); tb.Text = name; tb.ID = id; return tb; } protected void Button_Click(object sender, CommandEventArgs e) { Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString()); } } I have this code when a user clicks a button www.mypage/EnterSession.aspx?session=session_name in the EnterSession.aspx i have used the code below to track the current URL _gaq.push(['pageTrackerTime._trackEvent', 'Category', 'Action', document.location.href, roundleaveSiteEnd]); Now I would also like to track in the Action parameter the session_name from the previous page.see the code below from the previous page test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); Some idea how to do it? Thanx

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >