Search Results

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

Page 24/297 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Argument constraints in RhinoMock methods

    - by Khash
    I am mocking a repository that should have 1 entity in it for the test scenario. The repository has to return this entity based on a known id and return nothing when other ids are passed in. I have tried doing something like this: _myRepository.Expect(item => item.Find(knownId)).Return(knownEntity); _myRepository.Expect(item => item.Find(Arg<Guid>.Is.Anything)).Return(null); It seems however the second line is overriding the first and the repository always returns null. I don't want to mock all the different possible IDs asked (they could go up to hundreds) when the test scenario is only concerned with the value of one Id.

    Read the article

  • Best practice for passing configuration to each GUI object

    - by Laimoncijus
    Hi, I am writing an application, where I do have few different windows implemented, where each window is a separate class. Now I need somehow to pass a single configuration object to all of them. My GUI is designed in way, where I have one main window, which may create some child windows of its own, and these child windows can have their own childs (so there is no possibility to create all windows in initialization part and feed the config object to all of them from the very beginning)... What would be best practice for sharing this configuration object between them? Always passing via constructor or maybe making it somewhere as final public static and let each window object to access it when needed? Thanks

    Read the article

  • Passing Global Variable value to Facebook - Gets NULL only

    - by Viral
    hi all friends, I am making a game application in that I want to pass my score on wall of face book. I've completed all the things (the log in and message passing part) but when I passes the score via global variable, I am getting only null as a value and not the score that I want. Is there any way to pass data or string to Face book and write on a wall? My code is (void)viewDidLoad { static NSString* kApiKey = @"be60415be308e2b44c0ac1db83fe486b"; static NSString* kApiSecret = @"4f880c7e100321f808c41b1d3c813dfa"; _session = [[FBSession sessionForApplication:kApiKey secret:kApiSecret delegate:self] retain]; score = [NSString stringWithFormat:@"%@",appDelegate.myTextView]; [_session resume]; [super viewDidLoad]; } whre score is NSString and myTextView is NSString in other viewcontrollerfile, And appDelegate is global variable. Any help?? thanks in advance.

    Read the article

  • Passing 2D array with variable dimensions as function argument

    - by TheCrazyProgrammer
    I just saw the following code among the successful submissions at codechef. http://www.codechef.com/viewplaintext/1595846 I used to think that float max(int n,int arr[n][n]) {....} is not allowed in C++ (as 'n' is a variable). My CodeBlocks (on windows) with MinGW [gcc 4.4] gives compile time error. that "error: array bound is not an integer constant. Then how can be such a solution be accepted by CodeChef's judge. Is there any special flag that allows us to do that in C++??? EDIT: A link showing status as AC (accepted) : http://www.codechef.com/viewsolution/1595846

    Read the article

  • Ruby - Passing Blocks To Methods

    - by Chris Bunch
    I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is: new_pass = ask("Enter your new password: ") { |prompt| prompt.echo = false } verify_pass = ask("Enter again to verify: ") { |prompt| prompt.echo = false } And what I'd like to change it to is something like this: foo = Proc.new { |prompt| prompt.echo = false } new_pass = ask("Enter your new password: ") foo verify_pass = ask("Enter again to verify: ") foo Which unfortunately doesn't work. What's the correct way to do this?

    Read the article

  • Passing HTML using JSON

    - by ActionFactory
    Hi All, I'm passing Data using JSON to iPhone and iPad. One Field of Data is HTML. The problem is the encoding. Here's what I get back: > "GadgetHTML": "<strong>Hello</strong> > from Catworld<br />\n<img alt=\"\" > src=\"http://www.iconarchive.com/icons/fasticon/ifunny/128/dog-icon.png\" > />", The \ are killing me. The \n does not help. Any good way to do this? Any JSON to HTML Cleaning Functions? Encoding? (There must be something better than manually removing ) Thanks

    Read the article

  • Inserting new argument to table through search form of another table

    - by owca
    In my database I have a form for searching products (fields : id, name, manufacturer_id[set to display manufacturer's name], category_id, price). I would like to have the ability of adding manufacturers through this form. So I've created vba script but it does not work. Still when I enter new name it gives me prompt to "Select element from the list". What am I doing wrong ? Private Sub manufacturer_id_NotInTheList(NewData As String, Response As Integer) Dim strSQL As String, strInfo As String strInfo = "Manufacturer " & NewData & " is not on the list." & vbCrLf & "Add?" If MsgBox(strInfo, vbYesNo + vbQuestion, "Element not on the list") = vbYes Then strSQL = "INSERT INTO manufacturer (name, country, id_distributor) VALUES ('" & NewData & "','Undefined', '0');" DoCmd.SetWarnings (False) DoCmd.RunSQL strSQL Response = acDataErrAdded Else Response = acDataErrContinue NewData = "" Me.manufacturer_id.Text = "" End If End Sub

    Read the article

  • passing Perl method results as a reference

    - by arareko
    Some XML::LibXML methods return arrays instead of references to arrays. Instead of doing this: $self->process_items($xml->findnodes('items/item')); I want to do something like: $self->process_items(\$xml->findnodes('items/item')); So that in process_items() I can dereference the original array instead of creating a copy: sub process_items { my ($self, $items) = @_; foreach my $item (@$items) { # do something... } } I can always store the results of findnodes() into an array and then pass the array reference to my own method, but let's say I want to try a reduced version of my code. Is that the correct syntax for passing the method results or should I use something different? Thanks!

    Read the article

  • c# passing something from child form to parent

    - by Alan Bennett
    hi guys. so i have this form and on it is a combo box populated from a database via a SQL method. and i have another form which allows us to maintain the database table etc. so i make a new instance of the second form doing: Form1 frm = new Form2; frm.show(); once i have done what ever i wanted to do on the second form and i close it, i need to somehow trigger an event or something which will refresh the combo box and the code behind it. i was thinking of some onchange or focus event for the whole form, the problem is i have 5 of these combo boxes and running all the SQL again. i also thought of passing somesort of variable thro but then i would still need an event for that. any ideals would be awesome

    Read the article

  • passing something from child form to parent

    - by Alan Bennett
    so i have this form and on it is a combo box populated from a database via a SQL method. and i have another form which allows us to maintain the database table etc. so i make a new instance of the second form doing: Form1 frm = new Form2; frm.show(); once i have done what ever i wanted to do on the second form and i close it, i need to somehow trigger an event or something which will refresh the combo box and the code behind it. i was thinking of some onchange or focus event for the whole form, the problem is i have 5 of these combo boxes and running all the SQL again. i also thought of passing somesort of variable thro but then i would still need an event for that. any ideals would be awesome

    Read the article

  • built in Soap extension php5 passing in params as associative array

    - by Ageis
    I have this xml I'm wanting to pass to this web service function <UserName>myuser</UserName> <Password>password</Password> <User> <AddCoverCode /> <title>sdadasdsa</title> </User> </CreateNewUser>','',array(),'document', 'literal'); I'm using the soap extension buit in php5. Is this what I'm supposed to be passing in the soapcall function as parameters? array('CreateNewUser' => array( 'UserName' => 'sc', 'Password' => 'i82372', 'Registration' => array('username' =>'new','password' =>'ss'));

    Read the article

  • decorating a function and adding functionalities preserving the number of argument

    - by pygabriel
    I'd like to decorate a function, using a pattern like this: def deco(func): def wrap(*a,**kw): print "do something" return func(*a,**kw) return wrap The problem is that if the function decorated has a prototype like that: def function(a,b,c): return When decorated, the prototype is destroyed by the varargs, for example, calling function(1,2,3,4) wouldn't result in an exception. Is that a way to avoid that? How can define the wrap function with the same prototype as the decorated (func) one? There's something conceptually wrong?

    Read the article

  • Drupal pass argument to page

    - by stotastic
    I have a custom Drupal module displaying some data in a table. Each row has a link which if clicked will delete the relevant row. Specifically, when the link is clicked it will take the user to a confirmation page. This page is really just a drupal form which says 'are you sure' with two buttons: 'Yes', 'No'. I figure I will need to pass the rowID to the confirmation page. My question: What is the typically way to pass data to a new page in Drupal 7? I guess I could just add the rowID to the URL and use the $_GET[] from the confirmation page... I don't think this is very safe and was wondering if there was a better 'Drupal' way. Thanks!

    Read the article

  • g++ doesn't think I'm passing a reference

    - by Ben Jones
    When I call a method that takes a reference, g++ complains that I'm not passing a reference. I thought that the caller didn't have to do anything different for PBR. Here's the offending code: //method definition void addVertexInfo(VertexInfo &vi){vertexInstances.push_back(vi);} //method call: sharedVertices[index]->addVertexInfo(VertexInfo(n1index, n2index)); And here's the error: GLUtils/GLMesh.cpp: In member function 'void GLMesh::addPoly(GLIndexedPoly&)': GLUtils/GLMesh.cpp:110: error: no matching function for call to 'SharedVertexInfo::addVertexInfo(VertexInfo)' GLUtils/GLMesh.h:93: note: candidates are: void SharedVertexInfo::addVertexInfo(VertexInfo&)

    Read the article

  • Missing something with Reader monad - passing the damn thing around everywhere

    - by Richard Huxton
    Learning Haskell, managing syntax, have a rough grasp of what monads etc are about but I'm clearly missing something. In main I can read my config file, and supply it as runReader (somefunc) myEnv just fine. But somefunc doesn't need access to the myEnv the reader supplies, nor do the next couple in the chain. The function that needs something from myEnv is a tiny leaf function. So - how do I get access to the environment in a function without tagging all the intervening functions as (Reader Env)? That can't be right because otherwise you'd just pass myEnv around in the first place. And passing unused parameters through multiple levels of functions is just ugly (isn't it?). There are plenty of examples I can find on the net but they all seem to have only one level between runReader and accessing the environment.

    Read the article

  • Function argument treated as undeclared

    - by Mikulas Dite
    I've prepared this simple example which is not working for me #include <stdio.h> #include <stdlib.h> FILE *fp; char filename[] = "damy.txt"; void echo (char[] text) { fp = fopen(filename, "a"); fwrite(text, 1, strlen(text), fp); fclose(fp); printf(text); } int main () { echo("foo bar"); return 0; } It's supposed to write both to command window and to file. However, this gives compilation error - the text used in echo() is not declared. Does c need another declaration of the variable?

    Read the article

  • .NET: Calling GetInterface method of Assembly obj with a generic interface argument

    - by Khnle
    I have the following interface: public interface PluginInterface<T> where T : MyData { List<T> GetTableData(); } In a separate assembly, I have a class that implements this interface. In fact, all classes that implement this interface are in separate assemblies. The reason is to architect my app as a plugin host, where plugin can be done in the future as long as they implement the above interface and the assembly DLLs are copied to the appropriate folder. My app discovers the plugins by first loading the assembly and performs the following: List<PluginInterface<MyData>> Plugins = new List<PluginInterface<MyData>>(); string FileName = ...;//name of the DLL file that contains classes that implement the interface Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { //Type type = AsmType.GetInterface("PluginInterface", true); // Type type = AsmType.GetInterface("PluginInterface<T>", true); if (type != null) { PluginInterface<MyData> Plugin = (PluginInterface<MyData>)Activator.CreateInstance(AsmType); Plugins.Add(Plugin); } } The trouble is because neither line where I am getting the type as by doing Type type = ... seems to work, as both seems to be null. I have the feeling that the generic somehow contributes to the trouble. Do you know why?

    Read the article

  • Double variable argument list.

    - by Lukasz Lew
    I need something like this: class Node (left : Node*, right : Node*) I understand the ambiguity of this signature. Is there a way around it better than the following? class Node (left : Array[Node, right : Array[Node]) val n = new Node (Array(n1, n2), Array(n3)) Maybe some kind of separator like this? val n = new Node (n1, n2, Sep, n3)

    Read the article

  • Passing arguments to UILabel [ 2 ] *

    - by DesperateLearner
    I'm trying to call a method of the below (Scroll animation class) type from a viewcontroller class. -(void)CreateLabel:(CGRect )frame andLabel:(UILabel *[NUM_LABELS])label andview:(UIView *)view; I got some errors when I tried passing the argument. Any suggestion on how to call this? This is how I called that method ScrollAnimation *newAnimation = [[ScrollAnimation alloc] init]; [newAnimation CreateLabel:CGRectMake(0, 50, 300,30) andLabel:animateLabel[NUM_LABELS] andview:self.view]; I have the error /Volumes/Red Drive/CarTransition/CarTransition/ViewController.m:120:66: Implicit conversion of an Objective-C pointer to 'UILabel **' is disallowed with ARC /Volumes/Red Drive/CarTransition/CarTransition/ViewController.m:120:66: Incompatible pointer types sending 'UILabel *__strong' to parameter of type 'UILabel **'

    Read the article

  • Passing a pointer to an array to glGenBuffers

    - by Josh Elsasser
    I'm currently passing an array to a function, then attempting to use glGenBuffers with the array that is passed to the function. I can't figure out a way to get glGenBuffers to work with the array that I've passed. I have a decent grasp of the basics of pointers, but this is beyond me. This is basically how the render code works. It's a bit more complex, (colours using the same array idea, also not working) but the basic idea is as follows: void drawFoo(const GLfloat *renderArray, GLuint verticeBuffer) { glBindBuffer(GL_ARRAY_BUFFER, verticeBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(verticeBuffer)*sizeof(GLfloat), verticeBuffer, GL_STATIC_DRAW); glVertexPointer(2, GL_FLOAT, 0, 0); glEnableClientState(GL_VERTEX_BUFFER); glDrawArrays(GL_TRIANGLE_FAN, 0, 45); glDisableClientState(GL_VERTEX_BUFFEr); } Thanks in advance for the help

    Read the article

  • Passing a String from PHP to a JavaScript function

    - by user635614
    Hello. am trying to write a code to pass a php string when clicked on the table : <?php . . . echo("<td onclick = 'print_("$file[$i]->Name");' >". $files[$i]->Name."</td>"); ... ?> where files[] is an array, and each element is a class with Name as a String, and it is put in a ''for'' loop, Am trying to pass it to a JavaScript function where i need the name there,and it's not working,i tried passing the i variable and it was passed correctly so i thought there should be a special syntax for dealing with strings... function print_(var x) { alert(x);}

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >