Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 35/297 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Passing an NSDate

    - by Garry
    I'm new to the iPhone and objective-c and I am still trying to get my head around ownership of objects so bear with me. I have a DOBViewController that has a datepicker on it. I have created a custom init method: -(id)initWithInitialDate(NSDate *)initialDate; Another view controller has a date instance declared (NSDate *dob) that holds a value. I would like to pass this to the DOBViewController so that it can scroll the datepicker to the passed value. Here is the custom init method: - (id)initWithInitialDate:(NSDate *)initialDate { // Initialise ourselves self = [super init]; // Set the date of the date picker if (initialDate != nil) { datePicker.date = initialDate; } else { // Set it to today datePicker.date = [NSDate date]; } return self; } This is how I am sending the dob NSDate object: DOBViewController *dobViewController = [[DOBViewController alloc] initWithInitialDate:dob]; Where dob is a variable of type NSDate that is declared in the header file. This doesn't seem to work as initialDate is always NULL. What am I doing wrong?

    Read the article

  • Accessing 2D array and passing string to label.text

    - by Amir
    Hi. I'm trying to create 2D array and initialize it with NSStrings. When I try to copy content of a cell from the array to a label.text, the application crashes. NSMutableArray *array = [NSMutableArray arrayWithCapacity:0]; [array addObject:[NSMutableArray arrayWithObjects: [NSArray arrayWithObjects: @"0-0", @"0-1", @"0-2", nil], [NSArray arrayWithObjects: @"1-0", @"1-1", @"1-2", nil], [NSArray arrayWithObjects: @"2-0", @"2-1", @"2-2", nil], nil]]; label.text = [[array objectAtIndex:0] objectAtIndex:0]; Any idea why and what am I doing wrong?

    Read the article

  • Obj-C : Passing parameters back from a detailViewController in a navigation controller

    - by Garfield81
    Hi I am using a navigation Controller on an iPhone app. I am able to pass data forward when I push a controller into the navigation stack but how do I pass data back when I pop the controller. What I am basically trying to achieve is the root navigation controller view displays a number of fields that can be edited. A user then clicks on one of the fields to be edited and a EditViewController is pushed onto the stack with the name of the field the user wants to edit. Now the users enters the new value of the field and presses save to pop the view controller. So how do I get the value from the editViewController back to the root navigation controller view?

    Read the article

  • Passing methods/functions as args in Objective C

    - by Baishampayan Ghose
    Hello, I am new to Objective C and I am trying to implement an async library which works with callbacks. I need to figure out a way to pass callback methods as args to my async methods so that the callback can be invoked when the task is finished. What is the best way to achieve this in Objective C? In Python, for example I could easily pass a function, but in Objective C it seems selectors are the way to go(?). Can anyone point me to an example from where I can get some ideas? Thanks in advance.

    Read the article

  • JQuery Passing Variable From href to load()

    - by dvancouver
    I am trying to pass an href id to load() in JQuery, I can see from the alert the returned id# 960, so I know the id value is getting past I just don't know how to append the load url, well the $("#refreshme_"+add_id) is the important part, I use that to refresh the unique div id in the page assigned by the database pull, so it would be looking for id="refreshme_960". My simple example that is obviously not working. I want to refresh the db select part of the page showing the new list of cars. Any ideas? $(document).ready(function() { $(".add_to_favorites").livequery("click", function(event) { var add_id = this.id.replace("add_", ""); //taken from a.href tag alert (id); $.get(this.href, function(data) { $("#refreshme_"+add_id).load("http://www.example.com/car_list/"+add_id); <a class="add_to_cars" href="/car-add/960/add'}" id="add_960">Add Car</a>

    Read the article

  • C++ Newbie: Passing an fstream to a function to read data

    - by vgm64
    I have a text file named num.txt who's only contents is the line 123. Then I have the following: void alt_reader(ifstream &file, char* line){ file.read(line, 3); cout << "First Time: " << line << endl; } int main() { ifstream inFile; int num; inFile.open("num.txt"); alt_reader(inFile, (char*)&num); cout << "Second Time: " << num << endl; } The output is: First Time: 123 Second Time: 3355185 Can you help me figure out how to get an fstream that is read in a function still assign the variable in main? I'm doing this because alt_reader really has a lot more to it, but this is the part I'm stuck on. Thanks a lot for the help.

    Read the article

  • Excel VBA: Passing a collection from a class to a module issue

    - by Martin
    Hello, I have been trying to return a collection from a property within a class to a routine in a normal module. The issue I am experiencing is that the collection is getting populated correctly within the property in the class (FetchAll) but when I pass the collection back to the module (Test) all the entries are populated with the last item in the list. This is the Test sub-routine in the standard module: Sub Test() Dim QueryType As New QueryType Dim Item Dim QueryTypes As Collection Set QueryTypes = QueryType.FetchAll For Each Item In QueryTypes Debug.Print Item.QueryTypeID, _ Left(Item.Description, 4) Next Item End Sub This is the FetchAll property in the QueryType class: Public Property Get FetchAll() As Collection Dim RS As Variant Dim Row As Long Dim QTypeList As Collection Set QTypeList = New Collection RS = .Run ' populates RS with a record set from a database (as an array), ' some code removed ' goes through the array and sets up objects for each entry For Row = LBound(RS, 2) To UBound(RS, 2) Dim QType As New QueryType With QType .QueryTypeID = RS(0, Row) .Description = RS(1, Row) .Priority = RS(2, Row) .QueryGroupID = RS(3, Row) .ActiveIND = RS(4, Row) End With ' adds new QType to collection QTypeList.Add Item:=QType, Key:=CStr(RS(0, Row)) Debug.Print QTypeList.Item(QTypeList.Count).QueryTypeID, _ Left(QTypeList.Item(QTypeList.Count).Description, 4) Next Row Set FetchAll = QTypeList End Property This is the output I get from the debug in FetchAll: 1 Numb 2 PBM 3 BPM 4 Bran 5 Claw 6 FA C 7 HNW 8 HNW 9 IFA 10 Manu 11 New 12 Non 13 Numb 14 Repo 15 Sell 16 Sms 17 SMS 18 SWPM This is the output I get from the debug in Test: 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM 18 SWPM Anyone got any ideas? I am probably totally overlooking something! Thanks, Martin

    Read the article

  • Autocomplete and Dynamic Parameter Passing

    - by abcParsing
    The code below works fine using jQuery UI 1.8 and jQuery 1.4.2 $("#sid_entry_box").autocomplete( {source:"autocomplete_sid.php?database="+database_name, minLength:4, delay:1000, enable:true, cacheLength:1 }); The database name is passed as a get parameter of the php call. In this application, I have two databases selected by a radio button. Since jQuery loads and assigns this function when the document is loaded, the database name is whatever was checked at that momemnt. What I really need to pass to the php call is the following: database=$("input[name=rf_database_option]:checked").val(); Is ther ean easy to understand way to be able to pass a dynamic dom value?

    Read the article

  • Passing JSON object from Controller to View(jsp)

    - by user752233
    I am trying to send JSON object to my view from controller but unable to send it. Please help me out! I am using following code public class SystemController extends AbstractController{ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mav = new ModelAndView("SystemInfo", "System", "S"); response.setContentType("application/json;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); JSONObject jsonResult = new JSONObject(); jsonResult.put("JVMVendor", System.getProperty("java.vendor")); jsonResult.put("JVMVersion", System.getProperty("java.version")); jsonResult.put("JVMVendorURL", System.getProperty("java.vendor.url")); jsonResult.put("OSName", System.getProperty("os.name")); jsonResult.put("OSVersion", System.getProperty("os.version")); jsonResult.put("OSArchitectire", System.getProperty("os.arch")); response.getWriter().write(jsonResult.toString()); // response.getWriter().close(); return mav; // return modelandview object } } and in the view side I am using <script type="text/javascript"> Ext.onReady(function(response) { //Ext.MessageBox.alert('Hello', 'The DOM is ready!'); var showExistingScreen = function () { Ext.Ajax.request({ url : 'system.htm', method : 'POST', scope : this, success: function ( response ) { alert('1'); var existingValues = Ext.util.JSON.decode(response.responseText); alert('2'); } }); }; return showExistingScreen(); });

    Read the article

  • raising events passing parameters in wpf

    - by Thiago
    Hi, I'd like to add tabs to my window when an item in the GridView is double-clicked. But the tab that will be added depends on the clicked item. Which way should I do this on WPF? I thought about RoutedEvents, but I don't know how to pass a parameter with it. Any suggestions?

    Read the article

  • Having trouble passing text from MySQL to a Javascript function using PHP

    - by Nathan Brady
    So here's the problem. I have data in a MySQL DB as text. The data is inserted via mysql_real_escape_string. I have no problem with the data being displayed to the user. At some point I want to pass this data into a javascript function called foo. // This is a PHP block of code // $someText is text retrieved from the database echo "<img src=someimage.gif onclick=\"foo('{$someText}')\">"; If the data in $someText has line breaks in it like: Line 1 Line 2 Line 3 The javascript breaks because the html output is <img src=someimage.gif onclick="foo('line1 line2 line3')"> So the question is, how can I pass $someText to my javascript foo function while preserving line breaks and carriage returns but not breaking the code? =========================================================================================== After using json like this: echo "<img src=someimage.gif onclick=\"foo($newData)\">"; It is outputting HTML like this: onclick="foo("line 1<br \/>\r\nline 2");"> Which displays the image followed by \r\nline 2");"

    Read the article

  • Passing parameter in C#

    - by Lu Lu
    In C++, I have a function: void MyFunction(int p) { p=5; } Assume, I have: int x = 10; MyFunction(x); // x = 10 MyFunction(&x); // x = 5 How to archive this in C# with condition: I create only one MyFunction. Thanks.

    Read the article

  • Problem passing ELMAH log id to Custom Error page in ASP.NET

    - by Ronnie Overby
    I am using ELMAH to log unhandled exceptions in an ASP.NET Webforms application. Logging is working fine. I want to pass the ELMAH error log id to a custom error page that will give the user the ability to email an administrator about the error. I have followed the advice from this answer. Here is my global.asax code: void ErrorLog_Logged(object sender, ErrorLoggedEventArgs args) { Session[StateKeys.ElmahLogId] = args.Entry.Id; // this doesn't work either: // HttpContext.Current.Items[StateKeys.ElmahLogId] = args.Entry.Id; } But, on the Custom error page, the session variable reference and HttpContext.Current.Items are giving me a NullReference exception. How can I pass the ID to my custom error page?

    Read the article

  • C# NullReferenceException when passing DataTable

    - by Timothy
    I've been struggling with a NullReferenceException and hope someone here will be able to point me in the right direction. I'm trying to create and populate a DataTable and then show the results in a DataGridView control. The basic code follows, and Execution stops with a NullReferenceException at the point where I invoke the new UpdateResults_Delegate. Oddly enough, I can trace entries.Rows.Count successfully before I return it from QueryEventEntries, so I can at least show 1) entries is not a null reference, and 2) the DataTable contains rows of data. I know I have to be doing something wrong, but I just don't know what. private delegate void UpdateResults_Delegate(DataTable entries); private void UpdateResults(DataTable entries) { dataGridView.DataSource = entries; } private void button_Click(object sender, EventArgs e) { Thread t = new Thread(new ThreadStart(PerformQuery)); t.Start(); } private void PerformQuery() { DateTime start = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, 0, 0, 0); DateTime stop = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month, dateTimePicker2.Value.Day, 0, 0, 0); DataTable entries = QueryEventEntries(start, stop); Invoke(new UpdateResults_Delegate(UpdateResults), entries); } private DataTable QueryEventEntries(DateTime start, DateTime stop) { DataTable entries = new DataTable(); entries.Columns.Add("colEventType", typeof(Int32)); entries.Columns.Add("colTimestamp", typeof(Int32)); entries.Columns.Add("colDetails", typeof(String)); ... conn.Open(); using (SqlDataReader r = cmd.ExecuteReader()) { while (r.Read()) { entries.Rows.Add(result.GetInt32(0), result.GetInt32(1), result.GetString(2)); } } return entries; }

    Read the article

  • Passing variables across a multi page form in php

    - by Chris
    Forgive me as I am a newbie. I have a multi page form in which I am using $_SESSIONS to record the variables. <?php session_start(); foreach ( $_POST as $key=>$value ) { if ( $key!="submit" ) { $value= htmlentities(stripslashes(strip_tags($value))); $_SESSION[$key] = $value; } }` I have two problems actually. When I get to a checkform.php that I made that prints out the variables, The variables from page 1 doesn't show up even though that code listed above is on each page. I am using Firefox web developers tool to disable cookies and in the php ini, I altered session.use_trans_sid to 1 to turn it on. For the final page on my checkform.php I print_r($_POST) for the final page which works fine. Why doesn't variables from page 1 not show up? What am I missing? The 2nd problem is that when I print_r($_SESSION), some fields, specifically the checkbox arrays, print as [payment] => Array [agerange] => Array [meals] => Array [mealtypes] => Array What am I missing?

    Read the article

  • Sorting a nodeset before passing to xsl:for-each

    - by Zack Mulgrew
    I have a situation where loop through a sorted nodeset and apply a template on each of the nodes: <div id="contractscontainer"> <xsl:for-each select="document"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> I want to do something special with the "first" 5 nodes in the node set and render them nested element. The problem is that they need to be in the same order as if they were sorted (as they are in the loop). I had planned on doing this by using two xsl:for-each elements, each with the correct nodes selected from the set. I can't do this, however, because they need to be sorted before I can select the "first" 5. Example: <div id="contractscontainer"> <div class="first-five"> <xsl:for-each select="document[position() < 6]"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> <div class="rest-of-them"> <xsl:for-each select="document[position() > 5]"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> </div> I don't think this will work because I'm selecting the nodes by position before sorting them, but I can't use xsl:sort outside of the xsl:for-each. Am I approaching this incorrectly?

    Read the article

  • Passing an instantiated class to concrete class derived by Castle Windsor

    - by Tr1stan
    I have a system that I'm using to test some new architecture. I have the following setup (In MVC2 .Net - C Sharp): View < Controller < Service < Repository < DB I'm using Castle Windsor as my DI (IoC) controller, and this is working just fine in both the Service and Repo layers. However, I'm now at a point where I would like to pass an Entity Framework (DatabaseNameEntity) to the constructor to the Service, and then to the Repo, so that I have something similar to a Unit of Work pattern per request (This feels like what I'm trying to achieve anyway) - and I'm having trouble working out how this can be done using Castle Windsor. Am I going off on a silly tangent? Any pointers appreciated.

    Read the article

  • Passing parameter to controller from route in laravel

    - by bretterer
    Given the following route Route::get('groups/(:any)', array('as' => 'group', 'uses' => 'groups@show')); And the URL I would like to use, http://www.example.com/groups/1 I would like to be able to use the (:any) value in my controller. My controller looks like class Groups_Controller extends Base_Controller { public $restful = true; public function get_show($groupID) { return 'I am group id ' . $groupID; } } How is this possible to do? I have tried a few things including the following Route::get('groups/(:any)', array('as' => 'group', 'uses' => 'groups@show((:1))')); but it did not work. UPDATE Anytime I try to pass in the arguments as show above i get a 404 error. Thanks for the help!

    Read the article

  • Django Passing Custom Form Parameters to Formset

    - by Paolo Bergantino
    I have a Django Form that looks like this: class ServiceForm(forms.Form): option = forms.ModelChoiceField(queryset=ServiceOption.objects.none()) rate = forms.DecimalField(widget=custom_widgets.SmallField()) units = forms.IntegerField(min_value=1, widget=custom_widgets.SmallField()) def __init__(self, *args, **kwargs): affiliate = kwargs.pop('affiliate') super(ServiceForm, self).__init__(*args, **kwargs) self.fields["option"].queryset = ServiceOption.objects.filter(affiliate=affiliate) I call this form with something like this: form = ServiceForm(affiliate=request.affiliate) Where request.affiliate is the logged in user. This works as intended. My problem is that I now want to turn this single form into a formset. What I can't figure out is how I can pass the affiliate information to the individual forms when creating the formset. According to the docs to make a formset out of this I need to do something like this: ServiceFormSet = forms.formsets.formset_factory(ServiceForm, extra=3) And then I need to create it like this: formset = ServiceFormSet() Now how can I pass affiliate=request.affiliate to the individual forms this way?

    Read the article

  • Passing Activity to non-activity object properly

    - by rayman
    In my app ive got a non-activity object which it's role is being a manager class. many times i need to pass "source activity" to methods as parameter to that manager class in order to make some operations on that activity. for exaple let's assume we have MyActivity which gotta do some toast. so i have this manager class called MyManager, and i have this method in it raiseToast(Activity sourceActivity) { Toast.makeText(sourceActivity, demo, Toast.LENGTH_LONG).show(); } and from Myactivity class we calling that method this way: MyManager manager=new MyManager(); manager.raitetoast(MyActivity.this); it works fine. what I'm asking here, is this a proper way to pass an Activity as parameter to a non-activity object? I'm having a memory leaks on real device(not the emulator), I wonder if this could also causing any reason for that? Thanks Idan.

    Read the article

  • Passing pointer position to an object in Java.

    - by Gabriel A. Zorrilla
    I've got a JPanel class called Board with a static subclass, MouseHanlder, which tracks the mouse position along the appropriate listener in Board. My Board class has fields pointerX and pointerY. How do i pass the e.getX() and e.getY() from the MouseHandler subclass to its super class JPanel? I tried with getters, setters, super, and cant get the data transfer between subclass and parent class. I'm certain it's a concept issue, but im stuck. Thanks!

    Read the article

  • Passing an TAdoDataset as parameter using TADOStoredProc

    - by Salvador
    i have an oracle stored procedure with 2 parameters declarated as input cursors. how i can assign this parameters the TADOStoredProc component? ORACLE PROCEDURE MYSTOREDPROCEDURE(P_HEADER IN TCursor, P_DETAL IN TCursor, P_RESULT OUT VARCHAR2) BEGIN //My code goes here END; Delphi function TMyClass.Add(Header, Detail: TADODataSet;var _Result: string): boolean; Var StoredProc : TADOStoredProc; begin Result:=False; StoredProc:=TADOStoredProc.Create(nil); try StoredProc.Connection :=ADOConnection1; StoredProc.ProcedureName:='MYSTOREDPROCEDURE'; StoredProc.Parameters.Refresh; StoredProc.Parameters.ParamByName('P_HEADER').Value :=Header;//How can assign this parameter? try StoredProc.Open; _Result:=VarToStrNull(StoredProc.Parameters.ParamByName('P_RESULT').Value); StoredProc.Close; Result:=True; except on E : Exception do begin _Result:=E.Message; //exit; end; end; finally StoredProc.Free; end; end;

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >