Search Results

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

Page 64/604 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Passing variables to callback functions

    - by mickyjtwin
    I am trying to write a jQuery plugin, that can be applied to a selector. Within this plugin, there are multiple calls to webservices, where callback methods are required. The problem I am having is maintaining the current context item in the each loop of the selector. (function($){ $.fn.myMethod = function(){ return this.each(function(){ var c = $(this); $.api.methodToCall("", CallbackFunction); }); }; function CallbackFunction(data, result){ // do stuff based on c } })(jQuery); Normally, you would provide the callback function straight away, which allows me to access c, however within the callback function, there potentially is another api call, so it would start to get messy. Is there any way to do this?

    Read the article

  • Passing multiple arguments to a UNIX shell script

    - by Waffles
    I have the following (bash) shell script, that I would ideally use to kill multiple processes by name. #!/bin/bash kill `ps -A | grep $* | awk '{ print $1 }'` However, while this script works is one argument is passed: end chrome (the name of the script is end) it does not work if more than one argument is passed: $end chrome firefox grep: firefox: No such file or directory What is going on here? I thought the $* passes multiple arguments to the shell script in sequence. I'm not mistyping anything in my input - and I the programs I want to kill (chrome and firefox) are open. Any help is appreciated.

    Read the article

  • Converting an array to JSON and passing that to asmx

    - by user96403
    Hi. I am trying to use JSON.stringify() (from json2.js of json[dot]org ) to convert a JavaScript array to JSON string and to pass it to an asmx web method. I use jQuery AJAX. The call reaches the web method where I take a List <Object> as parameter but I get an empty list there in debug mode. My JSON string looks like well formed with all data , I even tried having single-quotes and double-quotes(escaped) around the 'names' of the JSON string. Please help.

    Read the article

  • Passing window handler for the SFML

    - by Ockonal
    Hello, I'm using SFML Input system for my own application. Here is my code: size_t windowHnd = %MY_WINDOW_HANDLER%; sf::Window MyWindow(windowHnd); const sf::Input& MyInput = MyWindow.GetInput(); cannot convert ‘sf::Window’ to ‘size_t’ in assignment In official documentation I found sf::Window constructor signature: WindowHandle Handle What is the correct way to pass window handler for the SFML?

    Read the article

  • Passing in **kwargs from Flex over PyAMF

    - by cookiecaper
    Anyone know if it is easily possible to send **kwargs over PyAMF from NetConnection.call()? I would like it. I could write a wrapper around the actual function and expose that and perform some parsing manually to determine the kwargs to pass in, but I don't want to do that. I will just use a normal argument list in that case.

    Read the article

  • Passing IDisposable objects through constructor chains

    - by Matt Enright
    I've got a small hierarchy of objects that in general gets constructed from data in a Stream, but for some particular subclasses, can be synthesized from a simpler argument list. In chaining the constructors from the subclasses, I'm running into an issue with ensuring the disposal of the synthesized stream that the base class constructor needs. Its not escaped me that the use of IDisposable objects this way is possibly just dirty pool (plz advise?) for reasons I've not considered, but, this issue aside, it seems fairly straightforward (and good encapsulation). Codes: abstract class Node { protected Node (Stream raw) { // calculate/generate some base class properties } } class FilesystemNode : Node { public FilesystemNode (FileStream fs) : base (fs) { // all good here; disposing of fs not our responsibility } } class CompositeNode : Node { public CompositeNode (IEnumerable some_stuff) : base (GenerateRaw (some_stuff)) { // rogue stream from GenerateRaw now loose in the wild! } static Stream GenerateRaw (IEnumerable some_stuff) { var content = new MemoryStream (); // molest elements of some_stuff into proper format, write to stream content.Seek (0, SeekOrigin.Begin); return content; } } I realize that not disposing of a MemoryStream is not exactly a world-stopping case of bad CLR citizenship, but it still gives me the heebie-jeebies (not to mention that I may not always be using a MemoryStream for other subtypes). It's not in scope, so I can't explicitly Dispose () it later in the constructor, and adding a using statement in GenerateRaw () is self-defeating since I need the stream returned. Is there a better way to do this? Preemptive strikes: yes, the properties calculated in the Node constructor should be part of the base class, and should not be calculated by (or accessible in) the subclasses I won't require that a stream be passed into CompositeNode (its format should be irrelevant to the caller) The previous iteration had the value calculation in the base class as a separate protected method, which I then just called at the end of each subtype constructor, moved the body of GenerateRaw () into a using statement in the body of the CompositeNode constructor. But the repetition of requiring that call for each constructor and not being able to guarantee that it be run for every subtype ever (a Node is not a Node, semantically, without these properties initialized) gave me heebie-jeebies far worse than the (potential) resource leak here does.

    Read the article

  • Question about passing data using intents

    - by Joe K 1973
    Hi everyone, I'm trying to modify the Notepad tutorial (the Notepadv3 solution) to take in a value into the NoteEdit class, given to by the Notepadv3 class. I've successfully used .putExtra in the OnListItemClick method to place the value into the NoteEdit class, but I'm struggling to do this for the createNote method; I'm getting a force close when I try to create a new note. I bet there's a simple solution, but I'm pretty new to Java & Android and would very much appreciate your help. Here's the code in question in the Notepadv3 class: private void createNote() { Intent i = new Intent(this, NoteEdit.class); i.putExtra("key", 1); startActivityForResult(i, ACTIVITY_CREATE); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Intent i = new Intent(this, NoteEdit.class); i.putExtra(NotesDbAdapter.KEY_ROWID, id); i.putExtra("key", 1); startActivityForResult(i, ACTIVITY_EDIT); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); fillData(); } And here's the receiving code in the NoteEdit class: mRowId = savedInstanceState != null ? savedInstanceState.getLong(NotesDbAdapter.KEY_ROWID) : null; if (mRowId == null) { Bundle extras = getIntent().getExtras(); mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null; value = extras.getInt("key"); } I'm fairly sure that (mRowId == null) is not true when I'm using the createNote method so therefore getExtras won't be called. One of my questions would be how can I make my NoteEdit class get this value when I use the createNote method? I'm new to this so sorry if this is a simple question for you all. Thanks, Joe

    Read the article

  • passing form values from one jsp to another

    - by shil
    hi i need to access form data given entered in one jsp in another.. this is how my code looks fisrt jsp: second jsp: <%=request.getParameter("firstame")% now this prints a null value.. what is the mistake here? how do i get to access the values in my second jsp?

    Read the article

  • Passing data back from detailViewController to Uitableview

    - by jsetting32
    I am currently at the issue where I have a UITableviewCell that needs to be updated. When the user presses on the uitableviewcell - THERES ONLY 1!!, the user is pushed to a UITABLEVIEWCONTROLLER where the user is allowed to select 1 of multiple cells with their own titles. I need to get the clicked tableviewcells title and pass the value back to the parentviewcontroller and update the 1 tableviewcell's name to the one the user clicked in the pushed uitableivewcontroller. Here is a picture of the parent viewcontroller... And heres the picture of the pushed viewcontroller.... I was told earlier yesterday that delegation would be needed but I am unsure what to do at this point :/. Heres some code I use in the parent viewcontroller... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; ProblemTypes *view = [[ProblemTypes alloc] init]; [self.navigationController pushViewController:view animated:YES]; } I am also NOT USING storyboards, just a few xibs. Also heres the code for the pushedviewcontroller to pop to the parent viewcontroller when a cell is selected... #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; NSLog(@"Cell's text: %@",cell.textLabel.text); [self.navigationController popViewControllerAnimated:YES]; } Thank you guys!

    Read the article

  • Scala passing type parameters to object

    - by Shahzad Mian
    In Scala v 2.7.7 I have a file with class Something[T] extends Other { } object Something extends OtherConstructor[Something] { } This throws the error: class Something takes type parameters object Something extends OtherConstructor[Something] { However, I can't do this object Something[T] extends OtherConstructor[Something[T]] { } It throws an error: error: ';' expected but '[' found. Is it possible to send type parameters to object? Or should I change and simply use Otherconstructor

    Read the article

  • passing unicode string from C# exe to C++ DLL

    - by Martin
    Using this function in my C# exe, I try to pass a Unicode string to my C++ DLL: [DllImport("Test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int xSetTestString(StringBuilder xmlSettings); This is the function on the C++ DLL side: __declspec(dllexport) int xSetTestString(char* pSettingsXML); Before calling the function in C#, I do a MessageBox.Show(string) and it displays all characters properly. On the C++ side, I do: OutputDebugStringW((wchar_t*)pString);, but that shows that the non-ASCII characters were replaced by '?'.

    Read the article

  • Passing Text for command line

    - by Kasun
    Hi, I need to pass some text which is in richtext box to command line. This is my Button click even which start the cmd. private void button1_Click(object sender, EventArgs e) { ProcessStartInfo psi = new ProcessStartInfo { FileName = "cmd", Arguments = @"/k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat""", }; Process.Start(psi); } In my rich text box contain following text. include iostream using namespace std; int main() { cout << "Welcome to the wonderful world of C++!!!\n"; return 0; } Can anyone provide me necessary codes.

    Read the article

  • Passing parameters in MVC

    - by Avinash
    Thare is two forms in a page first one for searching and another for deleting.... <table><tr><td> <% using(Html.BeginForm("ViewList","ControllerName", [values],FormMethod.Post,new{id="viewListForm"})) { %> Name: <%=Html.TextBox("Name", "[value]", new { maxlength = "250" })%> Location: <%=Html.TextBox("Location", "[Value]", new { maxlength = "250" })%> <input type="submit" id="Search" name="Search" value="Search" /> <% } %> </td></tr> <tr><td> <% using(Html.BeginForm("DeleteList","ControllerName", new { name=?,location=? },[values],FormMethod.Post, new{id="deleteListForm"})) { %> [here the code for all items displayed in a table.] <input type="submit" id="Delete" name="Delete" value="Delete" /> When delete buttom pressed i need to pass two parameters ie name and location. The values of name and location are in the above viewListForm. How i take this value from the viewListForm at run time ? <% } %> </td></tr><table>

    Read the article

  • Using Reflection Invoke static generic method passing a Lamba as parameter

    - by Nikos Baxevanis
    Is it possible to write the following code via Reflection? var fake = A.Fake<Foo>( o => o.WithArgumentsForConstructor(new[] { "Hello" })); Where o is: Action<IFakeOptionsBuilder<T>> Where WithArgumentsForConstructor is: IFakeOptionsBuilder<T> WithArgumentsForConstructor(IEnumerable<object> argumentsForConstructor); The Foo class is: class Foo { public Foo(string s) { } } What I did was: object fake = typeof(A) .GetMethod("Fake", new Type[] { }) .MakeGenericMethod(new[] { this.targetType }) .Invoke(null, /* Here I need to pass the lambda. */);

    Read the article

  • Groovy: stub typed reference

    - by Don
    Hi, I have a Groovy class similar to class MyClass { Foo foo } Under certain circumstances I don't want to initialize foo and want to stub out all the calls to it. Any methods that return a value should do nothing. I could do it like this: Foo.metaClass.method1 = {param -> } Foo.metaClass.method2 = { -> } Foo.metaClass.method3 = {param1, param2 -> } While this will work, it has a couple of problems Tedious and long-winded, particularly if Foo has a lot of methods This will stub out calls to any instance of Foo (not just foo) Although Groovy provides a StubFor class, if I do this: this.foo = new groovy.mock.interceptor.StubFor(Foo) I get a ClassCastException at runtime. Although this would work if I could redefine foo as: def foo But for reasons I won't go into here, I can't do that. Thanks, Don

    Read the article

  • Boost signals and passing class method

    - by Ockonal
    Hello, I've defined some signal: typedef boost::signals2::signal<void (int temp)> SomeSig; typedef SomeSig::slot_type SomeSigType; I have some class: class SomeClass { SomeClass() { SomeSig.connect(&SomeClass::doMethod); } void doMethod(const SomeSig &slot); }; And got a lot of errors: error: ‘BOOST_PP_ENUM_SHIFTED_PARAMS_M’ was not declared in this scope error: ‘T’ was not declared in this scope error: a function call cannot appear in a constant-expression error: a function call cannot appear in a constant-expression error: template argument 1 is invalid error: ‘BOOST_SIGNALS2_MISC_STATEMENT’ has not been declared error: expected identifier before ‘~’ token error: expected ‘)’ before ‘~’ token error: expected ‘;’ before ‘~’ token

    Read the article

  • Passing single attributes to associated factories

    - by lambdabutz
    I'm looking for a way to pass fields into the factories of associated models without having to explicitly call the factory itself. For example, lets say I have some factories like so: Factory.define :person do |person| person.name "Default Bob" person.sex "M" person.house {|p| p.association(:house)} end Factory.define :house do |house| house.color "Red" house.has_ac true house.suburb {|h| h.association(:suburb)} end Factory.define :suburb do |suburb| suburb.name "Little boxes" end This is fine and all, but if I want to use factories to create someone in a specific house in a specific suburb I have do this: sub = Factory(:suburb, :name => "Blue town") house = Factory(:house, :color => "Blue", :suburb => sub) person = Factory(:person, :name => "Bill", :house => house) While this isn't bad in this small case, my actual models sometimes have 7 or 8 associations, and when I want to create an object whose associations I only care about a single attribute, the code for this starts to get really heavy. Is there somewhat I can pass attributes to nested Factories without having to recall the Factory itself?

    Read the article

  • Passing Multiple values Through Query String?

    - by Googler
    Hi all, I tried to pass more than one value through Query String from page1.aspx to page2.aspx. This is my Query string in the Grid View <a href="javascript:void(0);" onclick='javascript:window.open("Update.aspx?Regno= <%#Eval ("ID") %>'+ ","'&Fn=<%#Eval ("FIRSTNAME") %>' +", "'&Ln=<%#Eval ("LASTNAME") %>'")';> Edit</a> On My Page2.aspx, my code behind on PageLoad is: if (Page.IsPostBack) return; string id = Request.QueryString["ID"]; string Firstname = Request.QueryString["FIRSTNAME"]; string LastName = Request.QueryString["LASTNAME"]; My Visual Studio IDE shows a syntax error on this query string. I dont know the exact way to pass multiple values through Query String. How to make it work? Can anyone pls help me on this.. Which is the right syntax to pass multiple query string?

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >