Search Results

Search found 3518 results on 141 pages for 'arguments'.

Page 17/141 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Problem with literal arguments in the PATTERN string for a python 2to3 fixer

    - by Zxaos
    Hi folks. I'm writing a fixer for the 2to3 tool in python. In my pattern string, I have a section where I'd like to match an empty string as an argument, or an empty unicode string. The relevant chunk of my pattern looks like: (args='""' | args='u""') My issue is the second option never matches. Even if it's alone, it won't match. However, if I simply say args=any and then output args, I can catch cases where args is exactly equal to the second option. Is there some weird unicode handling thing going on? Why won't the second literal option ever match?

    Read the article

  • Too Few Arguments

    - by NoahClark
    I am trying to get some Javascript working in my Rails app. I want to have my index page allow me to edit individual items on the index page, and then reload the index page upon edit. My index.html.erb page looks like: <div id="index"> <%= render 'index' %> </div> In my index.js.erb I have: $('#index').html("<%=j render 'index' %>"); and in my holders_controller: def edit holder = Holder.find(params[:id]) end def update @holder = Holder.find(params[:id]) if @holder.update_attributes(params[:holder]) format.html { redirect_to holders_path } #, flash[:success] = "holder updated") ## ^---Line 28 in error format.js else render 'edit' end end When I load the index page it is fine. As soon as click the edit button and it submits the form, I get the following: But if I go back and refresh the index page, the edits are saved. What am I doing wrong?

    Read the article

  • Passing arguments to scope_procedure in searchlogic

    - by Greg
    I'd like to use searchlogic's scope_procedure feature like so class MyModelObject < ActiveRecord::Base scope_procedure :my_scope_proc, lambda { |p1, p2| { :conditions => "p1 >= #{p1} AND p2 < #{p2}" }} end Then, I am doing the search: scope = MyModelObject.search(:my_scope_proc => true) scope.all The above code obviously doesn't work because I didn't pass p1 and p2 parameters to my named scope. I can't figure out how to pass parameters to the named scope.

    Read the article

  • How to pass common arguments to Perl modules

    - by Leonard
    I'm not thrilled with the argument-passing architecture I'm evolving for the (many) Perl scripts that have been developed for some scripts that call various Hadoop MapReduce jobs. There are currently 8 scripts (of the form run_something.pl) that are run from cron. (And more on the way ... we expect anywhere from 1 to 3 more for every function we add to hadoop.) Each of these have about 6 identical command-line parameters, and a couple command line parameters that are similar, all specified with Euclid. The implementations are in a dozen .pm modules. Some of which are common, and others of which are unique.... Currently I'm passing the args globally to each module ... Inside run_something.pl I have: set_common_args (%ARGV); set_something_args (%ARGV); And inside Something.pm I have sub set_something_args { (%MYARGS) =@_; } So then I can do if ( $MYARGS{'--needs_more_beer'} ) { $beer++; } I'm seeing that I'm probably going to have additional "common" files that I'll want to pass args to, so I'll have three or four set_xxx_args calls at the top of each run_something.pl, and it just doesn't seem too elegant. On the other hand, it beats passing the whole stupid argument array down the call chain, and choosing and passing individual elements down the call chain is (a) too much work (b) error-prone (c) doesn't buy much. In lots of ways what I'm doing is just object-oriented design without the object-oriented language trappings, and it looks uglier without said trappings, but nonetheless ... Anyone have thoughts or ideas?

    Read the article

  • Ninject: Syntax for dependency arguments?

    - by Rosarch
    I have a class with a public constructor: public MasterEngine(IInputReader inputReader) { this.inputReader = inputReader; graphicsDeviceManager = new GraphicsDeviceManager(this); Components.Add(new GamerServicesComponent(this)); } How can I inject dependencies like graphicsDeviceManager and new GamerServicesComponent while still supplying the argument this?

    Read the article

  • What are some arguments to support the position that the Dojo JavasScript library is secure, accessi

    - by LES2
    We have developed a small web application for a client. We decided on the Dojo framework to develop the app (requirements included were full i18n and a11y). Originally, the web app we developed was to be a "prototype", but we made the prototype production quality anyway, just in case. It turns out that the app we developed (or a variant of it) is going to production (many months hence), but it's so awesome that the enterprise architecture group is a little afraid. 508c compliant is a concern, as is security for this group. I now need to justify the use of Dojo to this architecture group, explicitly making the case that Dojo does not pose a security risk and that Dojo will not hurt accessibility (and that Dojo is there to help meet core requirements). Note: the web app currently requires JavaScript to be turned on and a stylesheet to work. We use a relatively minor subset of Dojo: of course, dojo core, and dijit.form.Form, ValidationTextBox and a few others. We do use dojox.grid.DataGrid (but no drag N drop or editable cells, which are not fully a11y). I have done some research of my own, of course, but I any information or advice you have would be most helpful. Regards, LES2

    Read the article

  • error: polymorphic expression with default arguments

    - by 0__
    This following bugs me: trait Foo[ A ] class Bar[ A ]( set: Set[ Foo[ A ]] = Set.empty ) This yields <console>:8: error: polymorphic expression cannot be instantiated to expected type; found : [A]scala.collection.immutable.Set[A] required: Set[Foo[?]] class Bar[ A ]( set: Set[ Foo[ A ]] = Set.empty ) ^ It is quite annoying that I have to repeat the type parameter in Set.empty. Why does the type inference fail with this default argument? The following works: class Bar[ A ]( set: Set[ Foo[ A ]] = { Set.empty: Set[ Foo[ A ]]}) Please note that this has nothing to do with Set in particular: case class Hallo[ A ]() class Bar[ A ]( hallo: Hallo[ A ] = Hallo.apply ) // nope Strangely not only this works: class Bar[ A ]( hallo: Hallo[ A ] = Hallo.apply[ A ]) ...but also this: class Bar[ A ]( hallo: Hallo[ A ] = Hallo() ) // ???

    Read the article

  • Passing arguments from loading activity to main activity

    - by ZelluX
    I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing. For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits. I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this? Many thanks.

    Read the article

  • How to run perl script with a few arguments from php

    - by Cristalla
    My html webpage calls php script to upload files to the server from a local computer as follows. <form enctype="multipart/form-data" action="upload.php" method="POST"> <p><b><h3> <font color="#003366"> (1) Upload your reading text file. </font> </h3> </b> </p> <INPUT type="file" name="uploaded" size="50" > <br/> <input type="submit" name="files" value="upload"> </form> In order to process with an uploaded file, my php script calls shell script $output=system('/bin/sh connector_0.sh'); and my shell script is composed of a series of python/perl scripts. #!/bin/sh python main_senselearner_final_0.py senseLearner.pl -i Uploaded_Files/slinput_0.txt -o Uploaded_Files/presloutput_0 .txt -model modelNNCollocations -model modelJJCollocations -model modelVBColloc ations -pos python smutngslout_0.py python genhtml_0.py Now, the problem is the following: all python scripts in shell script worked fine through php. But perl script didn't work. When I run shell script by myself in my server, all four scripts in shell worked perfectly. However, when I run shell script from php, only perl script doesn't work. Would you please give me any tips to solve this problem? Many thanks!!!

    Read the article

  • Arguments against Create or Update

    - by Nix
    Recently someone stated that they thought all Creates should be CreateOrUpdates. Instinctively i thought bad, but now I am trying to find out if I have any grounds. Situation interface IService{ void Create(Object a); void Update(Object a); } or interface IService{ void CreateOrUpdate(Object a); } My first thought is if you implemented everything CreateOrUpdate then you have no control if someone accidentally sends you wrong data, or concurrency issues where someone changes a "primary" field right before you call update.... But if you remove those cases, are there any other cons?

    Read the article

  • XNA and Ninject: Syntax for dependency arguments?

    - by Rosarch
    I have a class with a public constructor: public MasterEngine(IInputReader inputReader) { this.inputReader = inputReader; graphicsDeviceManager = new GraphicsDeviceManager(this); Components.Add(new GamerServicesComponent(this)); } How can I inject dependencies like graphicsDeviceManager and new GamerServicesComponent while still supplying the argument this?

    Read the article

  • generating function arguments in java

    - by aloishis89
    I'm very new to java and am working on my first Android app. I am using the webview demo as a template. I am trying to generate a random integer between 1 and 12 and then call a certain javascript function based on the result. Here's what I have: int number = 1 + (int)(Math.random() * ((12 - 1) + 1)); number = (int) Math.floor(number); String nextQuote = "javascript:wave" + number + "()"; mWebView.loadUrl(nextQuote); So mWebView.loadUrl(nextQuote) will be the same as something like mWebView.loadUrl("javascript:wave1()") I just want to know if what I have here is correct and will work the way I think it will. The application isn't responding as expected and I suspect this bit of code is the culprit.

    Read the article

  • How to pass function reference into arguments

    - by Ockonal
    Hi, I'm using boost::function for making function-references: typedef boost::function<void (SomeClass &handle)> Ref; someFunc(Ref &pointer) {/*...*/} void Foo(SomeClass &handle) {/*...*/} What is the best way to pass Foo into the someFunc? I tried something like: someFunc(Ref(Foo));

    Read the article

  • Creating anonymous functions in loop with not the same arguments

    - by onio9
    Hello! I want to make in loop set of buttons, and add to them some events, but anonymous functions is the same. I write example code: for(var i:int=0;i<5;i++) { var button:SimpleButton = new SimpleButton(...); ... button.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { trace(i); }); } ... And I want to trace 1,2,3.. from click buttons instead of 4,4,4,4 .. Do you know how can I make this ?

    Read the article

  • mysql_query arguments in PHP

    - by Chris Wilson
    I'm currently building my first database in MySQL with an interface written in PHP and am using the 'learn-by-doing' approach. The figure below illustrates my database. Table names are at the top, and the attribute names are as they appear in the real database. I am attempting to query the values of each of these attributes using the code seen below the table. I think there is something wrong with my mysql_query() function since I am able to observe the expected behaviour when my form is successfully submitted, but no search results are returned. Can anyone see where I'm going wrong here? Update 1: I've updated the question with my enter script, minus the database login credentials. <html> <head> <title>Search</title> </head> <body> <h1>Search</h1> <!--Search form - get user input from this--> <form name = "search" action = "<?=$PHP_SELF?>" method = "get"> Search for <input type = "text" name = "find" /> in <select name = "field"> <option value = "Title">Title</option> <option value = "Description">Description</option> <option value = "City">Location</option> <option value = "Company_name">Employer</option> </select> <input type = "submit" name = "search" value = "Search" /> </form> <form name = "clearsearch" action = "Search.php"> <input type = "submit" value = "Reset search" /> </form> <?php if (isset($_GET["search"])) // Check if form has been submitted correctly { // Check for a search query if($_GET["find"] == "") { echo "<p>You did not enter a search query. Please press the 'Reset search' button and try again"; exit; } echo "<h2>Search results</h2>"; ?> <table align = "left" border = "1" cellspacing = "2" cellpadding = "2"> <tr> <th><font face="Arial, Helvetica, sans-serif">No.</font></th> <th><font face="Arial, Helvetica, sans-serif">Title</font></th> <th><font face="Arial, Helvetica, sans-serif">Employer</font></th> <th><font face="Arial, Helvetica, sans-serif">Description</font></th> <th><font face="Arial, Helvetica, sans-serif">Location</font></th> <th><font face="Arial, Helvetica, sans-serif">Date Posted</font></th> <th><font face="Arial, Helvetica, sans-serif">Application Deadline</font></th> </tr> <? // Connect to the database $username=REDACTED; $password=REDACTED; $host=REDACTED; $database=REDACTED; mysql_connect($host, $username, $password); @mysql_select_db($database) or die (mysql_error()); // Perform the search $find = mysql_real_escape_string($find); $query = "SELECT job.Title, job.Description, employer.Company_name, address.City, job.Date_posted, job.Application_deadline WHERE ( Title = '{$_GET['find']}' OR Company_name = '{$_GET['find']}' OR Date_posted = '{$_GET['find']}' OR Application_deadline = '{$_GET['find']}' ) AND job.employer_id_job = employer.employer_id AND job.address_id_job = address.address_id"; if (!$query) { die ('Invalid query:' .mysql_error()); } $result = mysql_query($query); $num = mysql_numrows($result); $count = 0; while ($count < $num) { $title = mysql_result ($result, $count, "Title"); $date_posted = mysql_result ($result, $count, "Date_posted"); $application_deadline = mysql_result ($result, $count, "Application_deadline"); $description = mysql_result ($result, $count, "Description"); $company = mysql_result ($result, $count, "Company_name"); $city = mysql_result ($result, $count, "City"); ?> <tr> <td><font face = "Arial, Helvetica, sans-serif"><? echo $count + 1; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $title; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $company; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $description; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $date_posted; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $application_deadline; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $education_level; ?></font></td> <td><font face = "Arial, Helvetica, sans-serif"><? echo $years_of_experience; ?></font></td> <? $count ++; } } ?> </body> </html>

    Read the article

  • Passing arguments and conditions to model in codeigniter

    - by stormdrain
    I'm adding some models to a project, and was wondering if there is a "best practice" kind of approach to creating models: Does it make sense to create a function for each specific query? I was starting to do this, then had the idea of creating a generic function that I could pass parameters to. e.g: Instead of function getClients(){ return $this->db->query('SELECT client_id,last FROM Names ORDER BY id DESC'); } function getClientNames($clid){ return $this->db->query('SELECT * FROM Names WHERE client_id = '.$clid); } function getClientName($nameID){ return $this->db->query('SELECT * FROM Names WHERE id ='.$nameID); } } Something like function getNameData($args,$cond){ if($cond==''){ $q=$this->db->query('SELECT '.$args.' FROM Names'); return $q; }else{ $q=$this->db->query('SELECT '.$args.' FROM Names WHERE '.$cond); return $q; } } where I can pass the fields and conditions (if applicable) to the model. Is there a reason the latter example would be a bad idea? Thanks!

    Read the article

  • windows media player command arguments

    - by TonyNeallon
    Hi There, Is it possible to launch a mp3 or wmv file using windows media player at a specified time offset? e.g I watched 10 seconds of video and closed it. the next time my app launches the video it starts playing a timeline of 10 seconds. The videos and mp3s are being launched in windows mobile 5 and 6 apps.

    Read the article

  • Typedef equivalence in function arguments

    - by Warren Seine
    Hi guys, The question is kind of hard to ask without an example so here it is: #include <vector> struct O { }; struct C { template <typename T> void function1(void (C::*callback)(const O*)); template <typename T> void function2(void (C::*callback)(const typename T::value_type)); void print(const O*); }; int main() { C c; c.function1< std::vector<O*> >(&C::print); // Success. c.function2< std::vector<O*> >(&C::print); // Fail. } The error that I am given is: error: no matching function for call to ‘C::function2(void (C::*)(const O*))’. Basically, the only difference between calls is that in function2, I'm more generic since I use the typedef std::vector<O*>::value_type which should resolve to O*, hence similar to function1. I'm using G++ 4.2.1 (I know it's old), but Comeau confirms I'm wrong. Why does the compilation fail?

    Read the article

  • Pass Arguments to Included Module in Ruby?

    - by viatropos
    I'm hoping to implement something like all of the great plugins out there for ruby, so that you can do this: acts_as_commentable has_attached_file :avatar But I have one constraint: That helper method can only include a module; it can't define any variables or methods. The reason for this is because, I want the options hash to define something like type, and that could be converted into one of say 20 different 'workhorse' modules, all of which I could sum up in a line like this: def dynamic_method(options = {}) include ("My::Helpers::#{options[:type].to_s.camelize}").constantize(options) end Then those 'workhorses' would handle the options, doing things like: has_many "#{options[:something]}" Here's what the structure looks like, and I'm wondering if you know the missing piece in the puzzle: # 1 - The workhorse, encapsuling all dynamic variables module My::Module def self.included(base) base.extend ClassMethods base.class_eval do include InstanceMethods end end module InstanceMethods self.instance_eval %Q? def #{options[:my_method]} "world!" end ? end module ClassMethods end end # 2 - all this does is define that helper method module HelperModule def self.included(base) base.extend(ClassMethods) end module ClassMethods def dynamic_method(options = {}) # don't know how to get options through! include My::Module(options) end end end # 3 - send it to active_record ActiveRecord::Base.send(:include, HelperModule) # 4 - what it looks like class TestClass < ActiveRecord::Base dynamic_method :my_method => "hello" end puts TestClass.new.hello #=> "world!" That %Q? I'm not totally sure how to use, but I'm basically just wanting to somehow be able to pass the options hash from that helper method into the workhorse module. Is that possible? That way, the workhorse module could define all sorts of functionality, but I could name the variables whatever I wanted at runtime.

    Read the article

  • Given an array of arguments, how do I send those arguments to a particular function in Ruby?

    - by Steven Xu
    Forgive the beginner question, but say I have an array: a = [1,2,3] And a function somewhere; let's say it's an instance function: class Ilike def turtles(*args) puts args.inspect end end How do I invoke Ilike.turtles with a as if I were calling (Ilike.new).turtles(1,2,3). I'm familiar with send, but this doesn't seem to translate an array into an argument list. A parallel of what I'm looking for is the Javascript apply, which is equivalent to call but converts the array into an argument list.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >