Search Results

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

Page 70/604 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Passing variables to functions in Python

    - by brno792
    Im writing test scripts in python for selenium web testing. How do I pass parameters through a python function to call in a later function? I first have a login test function. Then I have a new user registration function. Im trying to pass the Username and Password I use in the registration function to the testLogin function that I call inside the testRegister function. This is my python code: userName = "admin" password = "admin" #pass username and password variables to this function def testLogin(userName,password): browser = webdriver.Firefox() browser.get("http://url/login") element = browser.find_element_by_name("userName") element.send_keys(userName) element = browser.find_element_by_name("userPassword") element.send_keys(password) element.send_keys(Keys.RETURN) browser.close() # test registration def testRegister(): browser = webdriver.Firefox() browser.get("http://url/register") #new username variable newUserName = "test" element = browser.find_element_by_name("regUser") element.send_keys(newUserName) #new password variable newUserPassword = "test" element = browser.find_element_by_name("regPassword") element.send_keys(newUserPassword) # #now test if user is registered, I want to call testLogin with the test user name and pw. testLogin(newUserName,newUserPassword) browser.close()

    Read the article

  • VB.NET template instance - passing a variable data type

    - by FerretallicA
    As the title suggests, I'm tyring to pass a variable data type to a template class. Something like this: frmExample = New LookupForm(Of Models.MyClass) 'Works fine Dim SelectedType As Type = InstanceOfMyClass.GetType() 'Works fine repoGeneric = New Repositories.Repository(Of SelectedType) 'Ba-bow! repoGeneric = New Repositories.Repository(Of InstanceOfMyClass.GetType()) 'Ba-bow! I'm assuming it's something to do with the template being processed at compile time but even if I'm off the mark there, it wouldn't solve my problem anyway. I can't find any relevant information on using Reflection to instance template classes either. (How) can I create an instance of a dynamically typed repository at runtime?

    Read the article

  • HTML forms and passing data back

    - by coLOLtip
    My html form is spreading over several pages (steps), and I want to let the use to take step back in case they would like to change something they filled in. So, I don't want to make users re-type all the information they already have typed once. Thus, how would I make it so that all the information would go back, to speak so? (I use PHP on server-side.)

    Read the article

  • Passing URL as parameter using mod_rewrite

    - by Dusan
    I would like to rewrite dynamic URL /index.php?pid=login&redirect=/previous-page.html to something like this /login.html-r-previous-page.html I tried this RewriteRule ^login.html-r-(.*)$ /index.php?pid=login&redirect=$1 [L] But no succes. I was also trying to change the regex to .+ or some other forms, but it seems useless. Maybe I am making mistake somewhere else. I am new to regular expressions and also mod_rewrite. Thank you for help

    Read the article

  • DOMNode reference doesn't work anymore after appending it to another element twice

    - by Robbie Groenewoudt
    Hi, I'm using the a wrapper around the PHP5-class DOMDocument to generate my HTML. This makes it easy to modify the HTML by using the DOM. An example is creating element #1 and adding it to the element #2 and still be able to modify element #1 directly. A problem arises however with the following: Element #1 is added to element #2 Element #2 is added to element #3 Element #1 is modified but no changes are visible in the DOM of element #3 (which contains #1 and #2) A simplified sample code: <?php $doc1 = new DOMDocument(); $el1 = $doc1->createElement('h1', 'Hello'); $doc1->appendChild($el1); $doc2 = new DOMDocument(); $el2 = $doc2->createElement('h2', 'World'); $doc2->appendChild($el2); $doc3 = new DOMDocument(); $el3 = $doc3->createElement('h3', 'Today'); $doc3->appendChild($el3); // Import el1 into el2 $el1 = $doc2->importNode($el1, true); $el2->appendChild( $el1 ); $doc1 = $doc2; // Import el2 into el3 $el2 = $doc3->importNode($el2, true); //$el1 = $doc3->importNode($el1, true); Necessary? $el3->appendChild($el2); $doc2 = $doc3; // Modify el1 $el1->nodeValue = "Boo"; // This doesn't work? //$el2->nodeValue = "Boo"; // Changing element2 or 3 works... // Display result echo $doc3->saveHTML(); ?>` Any idea's on why modifying $el1 won't work? (While $el2 works fine) Or an easy way to set $el1 to the right element?

    Read the article

  • passing paramters to component in flex

    - by dubbeat
    Hi, I've got 2 files, my Application and a custom component. In my component I have a httpservice and a string named _requestUrl that is bindable. The httpservice uses this. <mx:HTTPService id="srv" url="{_requestUrl}" result="parseHttpResult(event)" resultFormat="xml" method="GET" useProxy="false"> </mx:HTTPService> In my application file I make an instance of my component in the onCreationComplete function. In this function if I say mycomponent._urlRequest ="http://mysite.com" the httpservice throws a null url error but if I say mycomponent.srv.url="http://mysite.com" it works fine. Why is this?

    Read the article

  • Passing JSON through the URI

    - by Leaf
    I'm trying to create a REST based web service with data encapsulated using JSON. My problem is when I pass the string version of JSON in the URI it turns to something like this: %7B%22coal%22:100,%22ele%22:1500.1%7D. I'm wondering if there are any functions Java for converting between the escaped and unescaped versions so I can parse the string.

    Read the article

  • Passing Data from Usercontrol to controller

    - by nitinkhanna
    Hi, I am new to MVC, and trying something and got stuck somewhere in between. I have a user control there I have three textbox html type(ID, Lastname, firstname) and a submit buttom. I set the button like <input type="button" value="Search" onclick="location.href='<%= Url.Action("action", "controller") %>'" /> I have called this usercontrol on some view through <%= Html.Partial("ucName") %> Now on pressing that button(on user control) I need to pass the data from these textboxes to controller again to some specific action(Http Post action). By using this data I want to do some database interaction and storing the result in a dataset and pass this data set to same view again to show up in some Grid. I know the first part in conventional Asp.net can be done by raising the event through delegate but don't know how to do that in MVC.

    Read the article

  • How to reference other documents in a couchDB view (joining like functionality)

    - by Surfrdan
    We have a CouchDB representation of an XML database which we use to power a javascript based frontend for manipulating the XML documents. The basic structure is a simple 3 level hierachy. i.e. A - B - C A: Parent doucument (type A) B: any number of child documents of parent type A C: any number of child documents of parent type B We represent these 3 document types in CouchDB with a 'type' attribute: e.g. { "_id":"llgc-id:433", "_rev":"1-3760f3e01d7752a7508b047e0d094301", "type":"A", "label":"Top Level A document", "logicalMap":{ "issues":{ "1":{ "URL":"http://hdl.handle.net/10107/434-0", "FILE":"llgc-id:434" }, "2":{ "URL":"http://hdl.handle.net/10107/467-0", "FILE":"llgc-id:467" etc... } } } } { "_id":"llgc-id:433", "_rev":"1-3760f3e01d7752a7508b047e0d094301", "type":"B", "label":"a B document", } What I want to do is produce a view which returns documents just like the A type but includes the label attribute from the B document within the logicalMap list e.g. { "_id":"llgc-id:433", "_rev":"1-3760f3e01d7752a7508b047e0d094301", "type":"A", "label":"Top Level A document", "logicalMap":{ "issues":{ "1":{ "URL":"http://hdl.handle.net/10107/434-0", "FILE":"llgc-id:434", "LABEL":"a B document" }, "2":{ "URL":"http://hdl.handle.net/10107/467-0", "FILE":"llgc-id:467", "LABEL":"another B document" etc... } } } } I'm struggling to get my head around the best way to perform this. It looks like it should be fairly simple though!

    Read the article

  • Reference book on Ruby on Rails social network site for novices

    - by Christopher
    Hey, so I am a novice programmer who has only worked with HTML, CSS, and a touch of Java a couple of years ago. I am looking to try to get a social network site up and running on Ruby on Rails and was looking at RailsSpace: Building a Social Networking Website with Ruby on Rails (Addison-Wesley Professional Ruby Series) - Paperback (July 30, 2007) by Michael Hartl. This was published in 2007, however, and the newer reviews say it is not very helpful. Does anyone know if there are any new publications out there that walk you through building a social network site while teaching you the code(rather than just using a out of the box program)? Thanks

    Read the article

  • Django - Passing arguments to models through ForeignKey attributes

    - by marshall
    I've got a class like this: class Image (models.Model): ... sizes = ((90,90), (300,250)) def resize_image(self): for size in sizes: ... and another class like this: class SomeClassWithAnImage (models.Model): ... an_image = models.ForeignKey(Image) what i'd like to do with that class is this: class SomeClassWithAnImage (models.Model): ... an_image = models.ForeignKey(Image, sizes=((90,90), (150, 120))) where i'm can specify the sizes that i want the Image class to use to resize itself as a argument rather than being hard coded on the class. I realise I could pass these in when calling resize_image if that was called directly but the idea is that the resize_image method is called automatically when the object is persisted to the db. if I try to pass arguments through the foreign key declaration like this i get an error straight away. is there an easy / better way to do this before I begin hacking down into django?

    Read the article

  • Perl passing argument into eval

    - by ehretf
    I'm facing an issue using eval function. Indeed I have some function name inside a SQL database, my goal is to execute those functions within perl (after retrieve in SQL). Here is what I'm doing, considering that $RssSource-{$k}{Proceed} contains "&test" as a string retrieved from SQL: my $str2 = "ABCD"; eval "$RssSource->{$k}{Proceed}";warn if $@; sub test { my $arg = shift; print "fct TEST -> ", $row, "\n"; } This is working correctly and display: fct TEST -> However I would like to be able to pass $str2 as an argument to $RssSource-{$k}{Proceed} but I don't know how, every syntax I tried return an error: eval "$RssSource->{$k}{Proceed}$str2" eval "$RssSource->{$k}{Proceed}($str2)" eval "$RssSource->{$k}{Proceed}"$str2 eval "$RssSource->{$k}{Proceed}"($str2) May someone tell me how to properly pass an argument to the evaluated function? Thanks a lot for your help Regards. Florent

    Read the article

  • Passing a paramter/object to a ruby unit/test before running it using TestRunner

    - by Nahir Khan
    I'm building a tool that automates a process then runs some tests on it's own results then goes to do some other stuff. In trying to clean up my code I have created a separate file that just has the test cases class. Now before I can run these tests, I have to pass the class a couple of parameters/objects before they can be run. Now the problem is that I can't seem to find a way to pass a parameter/object to the test class. Right now I am thinking to generate a Yaml file and read it in the test class but it feels "wrong" to use a temporary file for this. If anyone has a nicer solution that would be great! *********Edit******* Example Code of what I am doing right now: #!/usr/bin/ruby require 'test/unit/ui/console/testrunner' require 'yaml' require 'TS_SampleTestSuite' automatingSomething() importantInfo = getImportantInfo() File.open('filename.yml', 'w') do |f| f.puts importantInfo.to_yaml end Test::Unit::UI::Console::TestRunner.run(TS_SampleTestSuite) Now in the example above TS_SampleTestSuite needs importantInfo, so the first "test case" is a method that just reads in the information from the Yaml file filname.yml. I hope that clears up some confusion.

    Read the article

  • Passing ViewData to PartialView returned from using Html.Action

    - by RWGodfrey
    I want to embed a partial view in an ASP.NET MVC page by returning it from an action method. In my base view, I would have: <%= Html.Action("MyPartialViewAction") %> My controller would have an action method like: [ChildActionOnly] public ActionResult MyPartialViewAction() { return PartialView("MyPartialView"); } I expected the returned partial view (MyPartialView) to have access to the ViewData that was set in the base page's controller action but that doesn't appear to be the case. If I insert the partial view by using the following in my base view it works: <% Html.RenderPartial("MyPartialView") %> I don't want to do that though because I want my "MyPartialViewAction" to execute logic to determine WHICH partial view to return.

    Read the article

  • if a JAR is placed on app servers's classpath how do we reference it from JSP

    - by Omnipresent
    On our application we are getting an error saying: PWC6117: File "/struts-tags" not found code in the file thats giving error is: <%@ taglib prefix="s" uri="/struts-tags" %> This file is in struts2-core.jar which is placed on the classpath of the app server (Sun 9.1). The code will work fine and not complain when the jar is actually in WEB-INF/lib of the application, compared to being on classpath of the appserver. But we can not change that. it has to be on appservers classpath. But how should we change our code so that this error goes away? I can create mapping in my web.xml so that tag uri's are change. but what should taglib-location be changed to? so that it references to app servers classpath? <taglib> <taglib-uri>/WEB-INF/struts-tags.tld</taglib-uri> <taglib-location>/WEB-INF/struts-tags.tld</taglib-location> </taglib>

    Read the article

  • Passing javascript object to webservice via Jquery ajax

    - by kralco626
    I have a webservice that returns an object [WebMethod] public List<User> ContractorApprovals() I also have a webservice that accepcts an object [WebMethod] public bool SaveContractor(Object u) When I make my webservice calls via Jquery: function ServiceCall(method, parameters, onSucess, onFailure) { var parms = "{" + (($.isArray(parameters)) ? parameters.join(',') : parameters) + "}"; // to json $.ajax({ type: "POST", url: "services/"+method, data: parms, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (typeof onSucess == 'function' || typeof onSucess == 'object') onSucess(msg.d); }, error: function(msg, err) { $("#dialog-error").dialog('open');} }); I can call the first one just fine. My onSucess function gets passed a javascript object exactly structured like my User object on the service. However, I am now having trouble getting the object back to the server. I'm accepting Object as a parameter on the server side so I can't inagine there is an issue there. So I'm thinking something is wrong with the parms on the client side but i'm not sure what... I am doing something to the effect ServiceCall("AuthorizationManagerWorkManagement.asmx/ContractorApprovals", "", function(data,args){$("#div").data('user',data[0])}, null) then ServiceCall("AuthorizationManagerWorkManagement.asmx/SaveContractor", $("#div").data('user'), //These also do not work: "{'u': ' + $("#div").data("user") + '}", NOR JSON.stringify({u: userObject}) function(data,args){(alert(data)}, null) I know the first service call works, I can get the data. The second one is causing the "onFailure" method to execute rather then "OnSuccess". Any ideas?

    Read the article

  • Perl, dereference array of references

    - by Mike
    In the following Perl code, I would expect to be referencing an array reference inside an array #!/usr/bin/perl use strict; use warnings; my @a=([1,2],[3,4]); my @b = @$a[0]; print $b[0]; However it doesn't seem to work. I would expect it to output 1. @a is an array of references @b is $a[1] dereferenced (I think) So what's the problem?

    Read the article

  • Passing jquery JSON from Codeigniter controller to view

    - by dede
    I've been struggling to make it work, but cannot pass the inserted data from the controler to the view in CI using JSON. The input value from the form is successfully inserted into the database, but cannot make it appear in the view. This is my view file ajax_view.php: <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.4.2.min.js"></script> $(document).ready(function(){ $("#submit").click(function(){ var inp = $('#inp').val(); $.post("ajax/ajax_input", { 'send' : inp }, function(data){ alert(data.input_text); }, "json"); }); }); </script> </head> <body> <form id="form1" method="post" action=""> <label for="inp">Text</label> <input type="text" name="inp" id="inp" /> <label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /> And this is the ajax_input method of the ajax.php controller: <?php // Initializing controller ..... // ............................. //ajax method function ajax_input(){ $var_1 = trim($this->input->post('send')); $array = array('input_text' => $var_1); echo json_encode($array); $this->db->insert('ajax',$array); } Trying to debug it with Firebug, it gives me that data.input_text is empty. What am I doing wrong? EDIT: I'm using XAMPP on Win, so is it posible that json configuration is the problem?

    Read the article

  • xml error: Object reference not set to an instance of an object after SelectSingleNode

    - by every_answer_gets_a_point
    here's my code: XmlDocument doc = new XmlDocument(); foreach (string c in colorList) { doc.Load(@"http://whoisxmlapi.com/whoisserver/WhoisService?domainName=" + c + @"&username=user&password=pass"); textBox1.Text += doc.SelectSingleNode("WhoisRecord/registrant/email").InnerText + ","; } for the second line of code (textbox1...) is generating this error what am i doing wrong?

    Read the article

  • Passing delimited string to stored procedure to search database

    - by rs
    How can i pass a string delimited by space or comma to stored procedure and filter result? I'm trying to do something like - Parameter Value -------------------------- @keywords key1 key2 key3 Then is stored procedure i want to first find all records with first or last name like key1 filter step 1 with first or last name like key2 filter step 2 with first or last name like key 3

    Read the article

  • DLL with the same reference name in visual studio

    - by Lily
    Hi, I am using Visual Studio for a project and Drools.NET and Proxem Antelope both use a DLL IKVM.Runtime but they're both different versions. Thus I do not know what I'm supposed to do to accommodate both of these. Any help will be appreciated. Thanks! Error: Exception has been thrown by the target of an invocation. The problem is that they both have the same name

    Read the article

  • passing variable from vbscript to batch file

    - by sushant
    i am using vbscript to call a batch file. my script looks like: dim shell set shell=createobject("wscript.shell") shell.run "a.bat" set shell=nothing my batch file is simple and looks like: D: cd D:\d winzip32.exe -min -a D:\a i want to pass a variable from a script to the batch file. lets say the destination folder. how do i do that? any help is very much appreciated.

    Read the article

  • Haskell type classes and type families (cont'd)

    - by Giuseppe Maggiore
    I need some help in figuring a compiler error which is really driving me nuts... I have the following type class: infixl 7 --> class Selectable a s b where type Res a s b :: * (-->) :: (CNum n) => (Reference s a) -> (n,(a->b),(a->b->a)) -> Res a s b which I instance twice. First time goes like a charm: instance Selectable a s b where type Res a s b = Reference s b (-->) (Reference get set) (_,read,write) = (Reference (\s -> let (v,s') = get s in (read v,s')) (\s -> \x -> let (v,s') = get s v' = write v x (_,s'') = set s' v' in (x,s''))) since the type checker infers (-->) :: Reference s a -> (n,a->b,a->b->a) -> Reference s b and this signature matches with the class signature for (--) since Res a s b = Reference s b Now I add a second instance and everything breaks: instance (Recursive a, Rec a ~ reca) => Selectable a s (Method reca b c) where type Res a s (Method reca b c) = b -> Reference s c (-->) (Reference get set) (_,read,write) = \(x :: b) -> from_constant( Constant(\(s :: s)-> let (v,s') = get s :: (a,s) m = read v ry = m x :: Reference (reca) c (y,v') = getter ry (cons v) :: (c,reca) v'' = elim v' (_,s'') = set s' v'' in (y,s''))) :: Reference s c the compiler complains that Couldn't match expected type `Res a s (Method reca b c)' against inferred type `b -> Reference s c' The lambda expression `\ (x :: b) -> ...' has one argument, which does not match its type In the expression: \ (x :: b) -> from_constant (Constant (\ (s :: s) -> let ... in ...)) :: Reference s c In the definition of `-->': --> (Reference get set) (_, read, write) = \ (x :: b) -> from_constant (Constant (\ (s :: s) -> ...)) :: Reference s c reading carefully the compiler is telling me that it has inferred the type of (--) thusly: (-->) :: Reference s a -> (n,a->(Method reca b c),a->(Method reca b c)->a) -> (b -> Reference s c) which is correct since Res a s (Method reca b c) = b -> Reference s c but why can't it match the two definitions? Sorry for not offering a more succint and standalone example, but in this case I cannot figure how to do it...

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >