Search Results

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

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

  • Why was the arguments.callee.caller property deprecated in JavaScript?

    - by pcorcoran
    Why was the arguments.callee.caller property deprecated in JavaScript? It was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Others (Safari, Opera) have adopted support for it, but support on older browsers is unreliable. Is there a good reason to put this valuable functionality in limbo? (Or alternately, is there a better way to grab a handle on the calling function?)

    Read the article

  • Pass Types as arguments to a function in Haskell?

    - by Charles Peng
    The following two functions are extremely similar. They read from a [String] n elements, either [Int] or [Float]. How can I factor the common code out? I don't know of any mechanism in Haskell that supports passing types as arguments. readInts n stream = foldl next ([], stream) [1..n] where next (lst, x:xs) _ = (lst ++ [v], xs) where v = read x :: Int readFloats n stream = foldl next ([], stream) [1..n] where next (lst, x:xs) _ = (lst ++ [v], xs) where v = read x :: Float I am at a beginner level of Haskell, so any comments on my code are welcome.

    Read the article

  • Create function in python to find the highest of all function arguments, and return the "tag" of the value.

    - by gatechgrad
    Consider the following: p1=1; p2=5; p3=7; highest=max(p1,p2,p3). The max function would return 7. I am looking to create a similar function, which would return "p3". I have created a small function (by simple comparisons) for the above example, shown below. however I am having trouble when the number of arguments go up. def highest(p1,p2,p3) if (p1p2) and (p1p3): return "p1" if (p2p1) and (p2p3): return "p2" if (p3p1) and (p3p1): return "p3". Is there a simpler way to do this

    Read the article

  • Issues running python scripts in Command Prompt (Specifically with command line arguments)?

    - by dmanatunga
    I am trying to run my python scripts in DOS without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing: django-admin.py startproject helloworld I get the message: Type 'django-admin.py help' for usage. Now, after some experimentation, I realized the problem is that the secondary arguments to these scripts are not being passed for some reason, since I tried it with a some other python scripts I have. I know I could avoid this problem by simply doing: python C:\Python26\Scripts\django-admin.py startproject helloworld But I know it should be possible to run the first command only and get it to work, because I had it working before. I've looked everywhere, and not many places have been helpful so any idea would be useful for me at this point.

    Read the article

  • How to bind the arguments in NSString in iphone?

    - by Prash.......
    Hi, i developing an application in which i want to bind my own parameter with an URL for http post request. But i findout the serious problem during the string binding, The code snippet as follows: NSString *mainURL1 = @"http://xxx.xxx.xx.xx/webservice/Service.asmx?op=UserDetailsNew?"; NSString *mainURL2 = [mainURL1 stringByAppendingString:@"MobileNo=%@",txtMobile.text]; NSString *mainURL3 = [mainURL2 stringByAppendingString:@"&Country=%@",txtCountry.text]; NSString *mainURL4 = [mainURL3 stringByAppendingString:@"&UserName=%@",txtName.text]; NSString *mainURL5 = [mainURL4 stringByAppendingString:@"&ScreenName=%@",txtScreenname.text]; NSString *mainURL6 = [mainURL5 stringByAppendingString:@"&EmailId=%@",txtemailid.text]; NSString *mainURL7 = [mainURL6 stringByAppendingString:@"&Password=%@",txtpassword.text]; NSString *mainURL8 = [mainURL7 stringByAppendingString:@"&RetypePassword=%@",txtretypepassword.text]; NSString *mainURL9 = [mainURL8 stringByAppendingString:@"%20HTTP/1.1"]; on binding the runtime arguments it ginev me too many parameter appending in NSString function. how i solve above problem?

    Read the article

  • Can fields of the class and arguments of the method interfere?

    - by Roman
    I have a class with a fields called "a". In the class I have a method and in the list of arguments of this method I also have "a". So, which "a" I will see inside of the method? Will it be the field or it will be the argument of the method? public class myClass { private String a; // Method which sets the value of the field "a". public void setA(String a) { a = a; } } By the way, there is a similar situation. A method has some local (for method) variables whose names coincide with the names of the fields. What will the "see" the method if I refer to such a method-local variable inside the method (the field or the local variable)?

    Read the article

  • Multiple (variant) arguments overloading in Java: What's the purpose?

    - by fortran
    Browsing google's guava collect library code, I've found the following: // Casting to any type is safe because the list will never hold any elements. @SuppressWarnings("unchecked") public static <E> ImmutableList<E> of() { return (ImmutableList<E>) EmptyImmutableList.INSTANCE; } public static <E> ImmutableList<E> of(E element) { return new SingletonImmutableList<E>(element); } public static <E> ImmutableList<E> of(E e1, E e2) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2)); } public static <E> ImmutableList<E> of(E e1, E e2, E e3) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3)); } public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4)); } public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4, E e5) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4, e5)); } public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4, E e5, E e6) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4, e5, e6)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4, e5, e6, e7)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4, e5, e6, e7, e8)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) { return new RegularImmutableList<E>( ImmutableList.<E>nullCheckedList(e1, e2, e3, e4, e5, e6, e7, e8, e9)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) { return new RegularImmutableList<E>(ImmutableList.<E>nullCheckedList( e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) { return new RegularImmutableList<E>(ImmutableList.<E>nullCheckedList( e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)); } public static <E> ImmutableList<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) { final int paramCount = 12; Object[] array = new Object[paramCount + others.length]; arrayCopy(array, 0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12); arrayCopy(array, paramCount, others); return new RegularImmutableList<E>(ImmutableList.<E>nullCheckedList(array)); } And although it seems reasonable to have overloads for empty and single arguments (as they are going to use special instances), I cannot see the reason behind having all the others, when just the last one (with two fixed arguments plus the variable argument instead the dozen) seems to be enough. As I'm writing, one explanation that pops into my head is that the API pre-dates Java 1.5; and although the signatures would be source-level compatible, the binary interface would differ. Isn't it?

    Read the article

  • Why does the Scala compiler disallow overloaded methods with default arguments?

    - by soc
    While there might be valid cases where such method overloadings could become ambiguous, why does the compiler disallow code which is neither ambiguous at compile time nor at run time? Example: // This fails: def foo(a: String)(b: Int = 42) = a + b def foo(a: Int) (b: Int = 42) = a + b // This fails, too. Even if there is no position in the argument list, // where the types are the same. def foo(a: Int) (b: Int = 42) = a + b def foo(a: String)(b: String = "Foo") = a + b // This is OK: def foo(a: String)(b: Int) = a + b def foo(a: Int) (b: Int = 42) = a + b // Even this is OK. def foo(a: Int)(b: Int) = a + b def foo(a: Int)(b: String = "Foo") = a + b val bar = foo(42)_ // This complains obviously ... Are there any reasons why these restrictions can't be loosened a bit? Especially when converting heavily overloaded Java code to Scala default arguments are a very important and it isn't nice to find out after replacing plenty of Java methods by one Scala methods that the spec/compiler imposes arbitrary restrictions.

    Read the article

  • How would one call std::forward on all arguments in a variadic function?

    - by Noah Roberts
    I was just writing a generic object factory and using the boost preprocessor meta-library to make a variadic template (using 2010 and it doesn't support them). My function uses rval references and std::forward to do perfect forwarding and it got me thinking...when C++0X comes out and I had a standard compiler I would do this with real variadic templates. How though, would I call std::forward on the arguments? template < typename ... Params void f(Params ... params) // how do I say these are rvalue reference? { y(std::forward(...params)); //? - I doubt this would work. } Only way I can think of would require manual unpacking of ...params and I'm not quite there yet either. Is there a quicker syntax that would work?

    Read the article

  • How to test that invalid arguments raise an ArgumentError exception using RSpec?

    - by John Topley
    I'm writing a RubyGem that can raise an ArgumentError if the arguments supplied to its single method are invalid. How can I write a test for this using RSpec? The example below shows the sort of implementation I have in mind. The bar method expects a single boolean argument (:baz), the type of which is checked to make sure that it actually is a boolean: module Foo def self.bar(options = {}) baz = options.fetch(:baz, true) validate_arguments(baz) end def self.validate_arguments(baz) raise(ArgumentError, ":baz must be a boolean") unless valid_baz?(baz) end def self.valid_baz?(baz) baz.is_a?(TrueClass) || baz.is_a?(FalseClass) end end

    Read the article

  • Why am I getting "ArgumentError: wrong number of arguments (1 for 0)" when running my rails function

    - by Hisham
    I'm stumped on what's causing this. I get this error and stack trace in all my functional tests where I call 'post'. Here is the full stack trace: 7) Error: test_should_validate(UsersControllerTest): ArgumentError: wrong number of arguments (1 for 0) /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:48:in `to_query' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:48:in `build_query_string' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:46:in `each' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:46:in `build_query_string' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:233:in `append_query_string' generated code (/Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:154):3:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:365:in `__send__' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:365:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:364:in `each' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:364:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:208:in `rewrite_path' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:187:in `rewrite_url' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:165:in `rewrite' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:450:in `build_request_uri' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:406:in `process' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:376:in `post' functional/users_controller_test.rb:57:in `test_should_validate' /Users/hisham/src/rails/ftuBackend/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__' /Users/hisham/src/rails/ftuBackend/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run' This is the test I'm running: def test_should_validate post :validate, :user => { :email => '[email protected]', :password => 'quire', :password_confirmation => 'quire', :agreed_to_terms => "true" } assert assigns(:user).errors.empty? assert_response :success end

    Read the article

  • Can addition of an ActionListener be short? Can I add arguments to the actionPerformed?

    - by Roman
    I have a big table containing a button in each cell. These buttons are very similar and do almost the same. If I add an action listener to every button in this way: tmp.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent evt) { proposition = proposition + action; SwingUtilities.invokeLater(new Runnable() { public void run() { updatePropositionPanel(); } }); } }); Actually, every action listener differ from all others by the value of the action. proposition and updatePropositionPanel are a field and a method of the class. First i thought that I can make it shorter if I do not use inner classes. So, I decided to program a new ActionListener class. But than I realized that in this case "proposition" will not be visible to the instances of this class. Then I decided to add the actionPerformed method to the current class and do that: addActionListener(this). But than I realized that I do not know how give arguments to the actionPerformed method. So, how does it work. Can I add an action listener in a short and elegent way?

    Read the article

  • PowerShell function arguments: Can the first one be optional first?

    - by Johannes Rössel
    I have an advanced function in PowerShell, which roughly looks like this: function Foo { [CmdletBinding] param ( [int] $a = 42, [int] $b ) } The idea is that it can be run with either two, one or no arguments. However, the first argument to become optional is the first one. So the following scenarios are possible to run the function: Foo a b # the normal case, both a and b are defined Foo b # a is omitted Foo # both a and b are omitted However, normally PowerShell tries to fit the single argument into a. So I thought about specifying the argument positions explicitly, where a would have position 0 and b position 1. However, to allow for only b specified I tried putting a into a parameter set. But then b would need a different position depending on the currently-used parameter set. Any ideas how to solve this properly? I'd like to retain the parameter names (which aren't a and b actually), so using $args is probably a last resort. I probably could define two parameter sets, one with two mandatory parameters and one with a single optional one, but I guess the parameter names have to be different in that case, then, right?

    Read the article

  • In .NET, how do you send multiple arguments into a DOS command prompt?

    - by donde
    I am trying to execute DOS commands in ASP.NET 2.0. What I have now calls a BAT file which, in turn, calls a CMD file. It works (with the end result being a file gets ftp'ed). However, I'd like to dump the BAT and CMD files and run everything in .NET. What is the format of sending multiple arguments into the command window? Here is what I have now. The .NET Code: System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "C:\\MyBat.BAT"; proc.Start(); proc.WaitForExit(); The Bat File looks like this (all it does is run the cmd file): ftp.exe -s:C:\MyCMD.cmd And here is the content of the Cmd file: open <my host> <my user name> <my pw> quote site cyl pri=1 sec=1 lrecl=1786 blksize=0 recfm=fb retpd=30 put C:\MyDTLFile.dtl 'MyDTLFile.dtl' quit

    Read the article

  • Package and Publish Web Sites with TFS 2010 Build Server

    - by jdanforth
    To package and publish web sites with TFS 2010 Build Server, you can use MSDeploy and some of the new MSBuild arguments. For example: /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:DeployIisAppPath="Default Web Site/WebApplication1" /p:MsDeployServiceUrl=localhost Does all the work for you! Unfortunately these arguments are not very well documented, yet. Please feel free comment with pointers to good docs. You can enter these arguments when editing the Build Definition, under the Process tab and the Advanced section: If you’re working with these things, I’m sure you’ve not missed the PDC 2009 presentation by Vishal Joshi about MS Deploy. A few links on the topic: http://stackoverflow.com/questions/2636153/where-is-the-documentation-for-msbuild-arguments-to-run-msdeploy http://blogs.msdn.com/aspnetue/archive/2010/03/05/automated-deployment-in-asp-net-4-frequently-asked-questions.aspx http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx

    Read the article

  • TechDays 2010: What’s New On C# 4.0

    - by Paulo Morgado
    I would like to thank those that attended my session at TechDays 2010 and I hope that I was able to pass the message of what’s new on C#. For those that didn’t attend (or did and want to review it), the presentation can be downloaded from here. Code samples can be downlaoded from here. Here’s a list of resources mentioned on the session: The evolution of C# The Evolution Of C# Covariance and contravariance  C# 4.0: Covariance And Contravariance In Generics Covariance And Contravariance In Generics Made Easy Covarince and Contravariance in Generics Exact rules for variance validity Events get a little overhaul in C# 4, Afterward: Effective Events Named and optional arguments  Named And Optional Arguments Alternative To Optional Arguments Named and Optional Arguments (C# Programming Guide) Dynamic programming  Dynamic Programming C# Proposal: Compile Time Static Checking Of Dynamic Objects Using Type dynamic (C# Programming Guide) Dynamic Language Runtime Overview COM Interop Improvements COM Interop Improvements Type Equivalence and Embedded Interop Types Conclusion Visual C# Developer Center Visual C# 2010 Samples C# Language Specification 4.0 .NET Reflector LINQPad

    Read the article

  • How to override puppet class arguments in child node?

    - by Jon Skarpeteig
    I'm attempting to accomplish something like the below: node 'basenode' { class { 'puppet' : disable => false, } } node 'child' inherits 'basenode' { class { 'puppet' : disable => true, } } This gives me: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Class[Puppet] is already defined How can I override this setting for this single node, and still have a parameterised class?

    Read the article

  • Start Chrome by command line, but adding some arguments to make it login into your Google account automatically

    - by jim
    Is there a way to start Chrome calling it from the command line (using Linux), but providing it some argument to make it login into some Google account automatically? I'm looking for something like google-chrome -account foo -pass bar that I can easily put in a bash script later. A little background: I have a laptop connected to my TV, which is currently using just a mouse for user interaction. There's no google account logged in by default, and that's the way I want to keep it, so my kids can't come across videos and pictures in google and youtube that they are not supposed to see (e.g.: adult content, or anything marked as not appropriate for kids by the google's safe search filters). The bad thing about this is that there are some music videos in youtube that requires you to be logged in to see, usually those we (the adults) used to sing when playing karaoke... as the only input available is a mouse, I'm looking for a way to start with my google account without having to type the whole thing usin the on-screen keyboard. You may think "Why you can't use the keyboard, if the laptop is right there?". Well, it's in a kind of uncomfortable position - too high for me without a chair or something, as it's right above the furniture in where the TV is located. Is there a way to make this scriptable? If not, do you know any other workaround? Note: using the remember me after logging off or alike options are discarded, as the safe-search chrome version must be always the default version to run.

    Read the article

  • What LPR arguments do I need to print a 1400x800 pixel image on a 4x6 label?

    - by Nick
    This is driving me nuts. UPS sends our system a 1400x800 GIF image of a shipping label, which is supposed to fit nicely on a 4x6 page. Unfortunately, I can't seem to get the command line options right to make it happen. We're using an Eltron/Zebra 2844 with a network adapter, and printing from our Ubuntu 8.04 server using CUPS. We're using the correct drivers, and test pages print correctly. No matter what I try though, it insists on printing the UPS labels accross 6 pages, with a little bit of the label on each page, or way too small. I've tried a bazillion different lpr settings, most of them producing garbage. The closest I've gotten is this: lpr -P Eltron2844 -o natural-scaling=55 -o page-right=0 -o page-left=0 -o landscape -o media="4x6" ./1ZY437560399620027.gif but it causes the image to be too small on the page. It's about an inch too short, and there's a 1/2" margin on both sides. If I bump the scale up to 56, it explodes the image onto two pages, and squashes it. Any ideas?

    Read the article

  • Upcasting without any added data fields.

    - by Benjamin Manns
    In my project I have a generic Packet class. I would like to be able to upcast to other classes (like LoginPacket or MovePacket). The base class contains a command and arguments (greatly simplified): public class Packet { public String Command; public String[] Arguments; } I would like to have be able to convert from Packet to LoginPacket (or any other) based on a check if Packet.Command == "LOGIN". The login packet would not contain any new data members, but only methods for accessing specific arguments. For example: public class LoginPacket : Packet { public String Username { get { return Arguments[0]; } set { Arguments[0] == value; } } public String Password { get { return Arguments[1]; } set { Arguments[1] == value; } } } It would be great if I could run a simple code that would cast from Packet to LoginPacket with something like LoginPacket _Login = (LoginPacket)_Packet;, but that throws a System.InvalidCastException. It seems like this would be an easy task, as no new data is included, but I can't figure out any other way than copying everything from the Packet class to a new LoginPacket class.

    Read the article

  • Why does my jQuery/YQL call not return anything?

    - by tastyapple
    I'm trying to access YQL with jQuery but am not getting a response: http://jsfiddle.net/tastyapple/grMb3/ Anyone know why? $(function(){ $.extend( { _prepareYQLQuery: function (query, params) { $.each( params, function (key) { var name = "#{" + key + "}"; var value = $.trim(this); if (!value.match(/^[0-9]+$/)) { value = '"' + value + '"'; } query = query.replace(name, value); } ); return query; }, yql: function (query) { var $self = this; var successCallback = null; var errorCallback = null; if (typeof arguments[1] == 'object') { query = $self._prepareYQLQuery(query, arguments[1]); successCallback = arguments[2]; errorCallback = arguments[3]; } else if (typeof arguments[1] == 'function') { successCallback = arguments[1]; errorCallback = arguments[2]; } var doAsynchronously = successCallback != null; var yqlJson = { url: "http://query.yahooapis.com/v1/public/yql", dataType: "jsonp", success: successCallback, async: doAsynchronously, data: { q: query, format: "json", env: 'store://datatables.org/alltableswithkeys', callback: "?" } } if (errorCallback) { yqlJson.error = errorCallback; } $.ajax(yqlJson); return $self.toReturn; } } ); $.yql( "SELECT * FROM github.repo WHERE id='#{username}' AND repo='#{repository}'", { username: "jquery", repository: "jquery" }, function (data) { if (data.results.repository["open-issues"].content > 0) { alert("Hey dude, you should check out your new issues!"); } } ); });

    Read the article

  • Passing the form scope to a Remote cfc

    - by cf_PhillipSenn
    What is the syntax for passing the form scope into a cfc with access="remote"? I have: <cfcomponent> <cfset Variables.Datasource = "xxx"> <cffunction name="Save" access="remote"> <cfset var local = {}> <!--- todo: try/catch ---> <cfif arguments.PersonID> <cfquery datasource="#Variables.Datasource#"> UPDATE Person SET FirstName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.FirstName#"> ,LastName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.LastName#"> WHERE PersonID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.PersonID#"> </cfquery> <cfset local.result = arguments.PersonID> <cfelse> <cfquery name="local.qry" datasource="#Variables.Datasource#"> INSERT INTO Person(FirstName,LastName) VALUES( <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.FirstName#"> ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.LastName#"> ); SELECT PersonID FROM Person WHERE PersonID=Scope_Identity() </cfquery> <cfset local.result = local.qry.PersonID> </cfif> <cfreturn local.result> </cffunction> </cfcomponent> I need to pass in form.PersonID, form.firstname, form.lastname.

    Read the article

  • 1136: Incorrect number of arguments. Expected 0.? AS3 Flash Cs4

    - by charmaine
    Basically i am working through a book called..Foundation Actionscript 3.0 Animation, making things move. i am now on Chapter 9 - collision detection. On two lines of my code i get the 1135 error, letting me know that i have an incorrect number of arguments. Can anybody help me out on why this may be? package { import flash.display.Sprite; import flash.events.Event; public class Bubbles extends Sprite { private var balls:Array; private var numBalls:Number = 10; private var centerBall:Ball; private var bounce:Number = -1; private var spring:Number = 0.2; public function Bubbles() { init(); } private function init():void { balls = new Array(); centerBall = new Ball(100, 0xcccccc); addChild(centerBall); centerBall.x = stage.stageWidth / 2; centerBall.y = stage.stageHeight / 2; for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = new Ball(Math.random() * 40 + 5, Math.random() * 0xffffff); ball.x = Math.random() * stage.stageWidth; ball.y = Math.random() * stage.stageHeight; ball.vx = Math.random() * 6 - 3; ball.vy = Math.random() * 6 - 3; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = balls[i]; move(ball); var dx:Number = ball.x - centerBall.x; var dy:Number = ball.y - centerBall.y; var dist:Number = Math.sqrt(dx * dx + dy * dy); var minDist:Number = ball.radius + centerBall.radius; if(dist < minDist) { var angle:Number = Math.atan2(dy, dx); var tx:Number = centerBall.x + Math.cos(angle) * minDist; var ty:Number = centerBall.y + Math.sin(angle) * minDist; ball.vx += (tx - ball.x) * spring; ball.vy += (ty - ball.y) * spring; } } } ***private function move(ball:Ball):void*** { ball.x += ball.vx; ball.y += ball.vy; if(ball.x + ball.radius > stage.stageWidth) { ball.x = stage.stageWidth - ball.radius; ball.vx *= bounce; } else if(ball.x - ball.radius < 0) { ball.x = ball.radius; ball.vx *= bounce; } ***if(ball.y + ball.radius > stage.stageHeight)*** { ball.y = stage.stageHeight - ball.radius; ball.vy *= bounce; } else if(ball.y - ball.radius < 0) { ball.y = ball.radius; ball.vy *= bounce; } } } } The bold parts are the lines im having trouble with! please help..thanks in advance!!

    Read the article

  • 1136: Incorrect number of arguments. Expected 0.? AS3 Flash Cs4 (Round 2)

    - by charmaine
    (I have asked this before but I dont think I was direct enough with my question and therefore it did not get resolved so here goes again!) I am working through a book called Foundation Actionscript 3.0 Animation, making things move. I am now on Chapter 9 - Collision Detection. On two lines of my code I get the 1135 error, letting me know that I have an incorrect number of arguments. I have highlighted the two areas in which this occurs with asterisks: package { import flash.display.Sprite; import flash.events.Event; public class Bubbles extends Sprite { private var balls:Array; private var numBalls:Number = 10; private var centerBall:Ball; private var bounce:Number = -1; private var spring:Number = 0.2; public function Bubbles() { init(); } private function init():void { balls = new Array(); ***centerBall = new Ball(100, 0xcccccc);*** addChild(centerBall); centerBall.x = stage.stageWidth / 2; centerBall.y = stage.stageHeight / 2; for(var i:uint = 0; i < numBalls; i++) { ***var ball:Ball = new Ball(Math.random() * 40 + 5, Math.random() * 0xffffff);*** ball.x = Math.random() * stage.stageWidth; ball.y = Math.random() * stage.stageHeight; ball.vx = Math.random() * 6 - 3; ball.vy = Math.random() * 6 - 3; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = balls[i]; move(ball); var dx:Number = ball.x - centerBall.x; var dy:Number = ball.y - centerBall.y; var dist:Number = Math.sqrt(dx * dx + dy * dy); var minDist:Number = ball.radius + centerBall.radius; if(dist < minDist) { var angle:Number = Math.atan2(dy, dx); var tx:Number = centerBall.x + Math.cos(angle) * minDist; var ty:Number = centerBall.y + Math.sin(angle) * minDist; ball.vx += (tx - ball.x) * spring; ball.vy += (ty - ball.y) * spring; } } } private function move(ball:Ball):void { ball.x += ball.vx; ball.y += ball.vy; if(ball.x + ball.radius > stage.stageWidth) { ball.x = stage.stageWidth - ball.radius; ball.vx *= bounce; } else if(ball.x - ball.radius < 0) { ball.x = ball.radius; ball.vx *= bounce; } if(ball.y + ball.radius > stage.stageHeight) { ball.y = stage.stageHeight - ball.radius; ball.vy *= bounce; } else if(ball.y - ball.radius < 0) { ball.y = ball.radius; ball.vy *= bounce; } } } } I think this is due to the non-existance of a Ball.as, when reading the tutorial I assumed it meant that I had to create a movie clip of a ball on stage and then export it for actionscript with the class name being Ball, however when flicking back through the book I saw that a Ball.as already existed, stating that I may need to use this again later on in the book, this read: package { import flash.display.Sprite; public class Ball extends Sprite { private var radius:Number; private var color:uint; public var vx:Number=0; public var vy:Number=0; public function Ball(radius:Number=40, color:uint=0xff0000) { this.radius=radius; this.color=color; init(); } public function init():void { graphics.beginFill(color); graphics.drawCircle(0, 0, radius); graphics.endFill(); } } } This managed to stop all the errors appearing however, it did not transmit any of the effects from Bubbles.as it just braught a Red Ball on the center of the stage. How would I alter this code in order to work in favour of Bubbles.as? Please Help! Thanks!

    Read the article

  • What arguments do I send a function being called by a button in python?

    - by Jared
    I have a UI, in that UI is 4 text fields and 1 int field, then I have a function that calls to another function based on what's inside of the text fields, this function has (self, *args). My function that is being called to takes five arguments and I don't know what to put in it to make it actually work with my UI because python button's send an argument of their own. I have tried self and *args, but it doesn't work. Here is my code, didn't include most of the UI code since it is self explanatory: def crBC(self, IKJoint, FKJoint, bindJoint, xQuan, switch): ''' You should have a controller with an attribute 'ikFkBlend' - The name can be changed after the script executes. Controller should contain an enum - FK/DYN(0), IK(1). Specify the IK joint, then either the dynamic or FK joint, then the bind joint. Then a quantity of joints to pass through and connect. Tested currently on 600 joints (200 x 3), executed in less than a second. Returns nothing. Please open your script editor for details. ''' import itertools # gets children joints of the selected joint chHipIK = cmds.listRelatives(IKJoint, ad = True, type = 'joint') chHipFK = cmds.listRelatives(FKJoint, ad = True, type = 'joint') chHipBind = cmds.listRelatives(bindJoint, ad = True, type = 'joint') # list is built backwards, this reverses the list chHipIK.reverse() chHipFK.reverse() chHipBind.reverse() # appends the initial joint to the list chHipIK.append(IKJoint) chHipFK.append(FKJoint) chHipBind.append(bindJoint) # puts the last joint at the start of the list because the initial joint # was added to the end chHipIK.insert(0, chHipIK.pop()) chHipFK.insert(0, chHipFK.pop()) chHipBind.insert(0, chHipBind.pop()) # pops off the remaining joints in the list the user does not wish to be blended chHipBind[xQuan:] = [] chHipIK[xQuan:] = [] chHipFK[xQuan:] = [] # goes through the bind joints, makes a blend colors for each one, connects # the switch to the blender for a, b, c in itertools.izip(chHipBind, chHipIK, chHipFK): rotBC = cmds.shadingNode('blendColors', asUtility = True, n = a + 'rotate_BC') tranBC = cmds.shadingNode('blendColors', asUtility = True, n = a + 'tran_BC') scaleBC = cmds.shadingNode('blendColors', asUtility = True, n = a + 'scale_BC') cmds.connectAttr(switch + '.ikFkSwitch', rotBC + '.blender') cmds.connectAttr(switch + '.ikFkSwitch', tranBC + '.blender') cmds.connectAttr(switch + '.ikFkSwitch', scaleBC + '.blender') # goes through the ik joints, connects to the blend colors cmds.connectAttr(b + '.rotate', rotBC + '.color1', force = True) cmds.connectAttr(b + '.translate', tranBC + '.color1', force = True) cmds.connectAttr(b + '.scale', scaleBC + '.color1', force = True) # connects FK joints to the blend colors cmds.connectAttr(c + '.rotate', rotBC + '.color2') cmds.connectAttr(c + '.translate', tranBC + '.color2') cmds.connectAttr(c + '.scale', scaleBC + '.color2') # connects blend colors to bind joints cmds.connectAttr(rotBC + '.output', a + '.rotate') cmds.connectAttr(tranBC + '.output', a + '.translate') cmds.connectAttr(scaleBC + '.output', a + '.scale') ------------------- def execCrBC(self, *args): g.crBC(cmds.textField(self.ikJBC, q = True, tx = True), cmds.textField(self.fkJBC, q = True, tx = True), cmds.textField(self.bindJBC, q = True, tx = True), cmds.intField(self.bQBC, q = True, v = True), cmds.textField(self.sCBC, q = True, tx = True)) ------------------- self.bQBC = cmds.intField() cmds.text(l = '') self.sCBC = cmds.textField() cmds.text(l = '') cmds.button(l = 'Help Docs', c = self.crBC.__doc__) cmds.setParent('..') cmds.button(l = 'Create', c = self.execCrBC) Here is the code causing the problem as requested: import maya.cmds as cmds import jtRigUI.createDummyRig as dum import jtRigUI.createSkeleton as sk import jtRigUI.generalUtilities as gu import jtRigUI.createLegRig as lr import jtRigUI.createArmRig as ar class RUI(dum.Dict, dum.Dummy, sk.Skel, sk.FiSkel, lr.LeanLocs, lr.LegRig, ar.ArmRig, gu.Gutils): def __init__(self, charNameUI, gScaleUI, fingButtonGrp, thumbCheckBox, spineButtonGrp, neckButtonGrp, ikJBC, fkJBC, bindJBC, bQBC, sCBC): rigUI = 'rigUI' if cmds.window(rigUI, exists = True): cmds.deleteUI(rigUI) rigUI = cmds.window(rigUI, t = 'JT Rigging UI', sizeable = False, tb = True, mnb = False, mxb = False, menuBar = True, tlb = True, nm = 5) form = cmds.formLayout() tabs = cmds.tabLayout(innerMarginWidth = 1, innerMarginHeight = 1) rigUIMenu = cmds.menu('Help', hm = True) aboutMenu = cmds.menuItem('about') cmds.popupMenu('about', button = 1) deleteUIMenu = cmds.menu('Delete', hm = True) cmds.menuItem('dummySkeleton') cmds.formLayout(form, edit = True, attachForm = ((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)), w = 30) tab1 = cmds.rowColumnLayout('Dummy') #cmds.columnLayout(rowSpacing = 10) #cmds.setParent('..') cmds.frameLayout(l = 'A: Dummy Skeleton Setup', w = 400) self.charNameUI = cmds.textFieldGrp (label="Optional Character Name:", ann="Insert a name for the character or leave empty.", tx = '', w = 1) fingJUI = cmds.frameLayout(l = 'B: Number of Fingers', w = 10) cmds.text('\n', h = 5) self.fingButtonGrp = cmds.radioButtonGrp('fingRadio', p = fingJUI, l = 'Fingers: ', sl = 4, w = 1, numberOfRadioButtons = 4, labelArray4 = ['One', 'Two', 'Three', 'Four'], ct2 = ('left', 'left'), cw5 = [60,60,60,60,60]) self.thumbCheckBox = cmds.checkBoxGrp(l = 'Thumb: ', v1 = True) cmds.text('\n', h = 5) spineJUI = cmds.frameLayout(l = 'C: Number of Spine Joints') cmds.text('\n', h = 5) self.spineButtonGrp = cmds.radioButtonGrp('spineRadio', p = spineJUI, l = 'Spine Joints: ', sl = 2, w = 1, numberOfRadioButtons = 3, labelArray3 = ['Three', 'Five', 'Ten'], ct2 = ('left', 'left'), cw4 = [95,95,95,95]) cmds.text('\n', h = 5) neckJUI = cmds.frameLayout(l = 'D: Number of Neck Joints') cmds.text('\n', h = 5) self.neckButtonGrp = cmds.radioButtonGrp('neckRadio', p = neckJUI, l = 'Neck Joints: ', sl = 0, w = 1, numberOfRadioButtons = 3, labelArray3 = ['Two', 'Three', 'Four'], ct2 = ('left', 'left'), cw4 = [95,95,95,95]) cmds.text('\n', h = 5) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.frameLayout('E: Creation') cmds.text('SAVE FIRST: CAN NOT UNDO', bgc = (0.2,0.2,0.2)) cmds.button(l = '\nCreate Dummy Skeleton\n', c = self.build) # also have it make char name field grey cmds.text('Elbows and Knees must have bend.', bgc = (0.2,0.2,0.2)) cmds.columnLayout() cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') tab2 = cmds.rowColumnLayout('Skeleton') cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'A: Skeleton Setup') cmds.text('SAVE FIRST: CAN NOT UNDO', bgc = (0.2,0.2,0.2)) cmds.button(l = '\nConvert to Skeleton - Orient - Set LRA\n', c = self.buildSkel) self.gScaleUI = cmds.textFieldGrp (label="Scale Multiplier:", ann="Scale multipler of Character: basis for all further base controllers", tx = '1.0', w = 1, ed = False, en = False, visible = True) cmds.frameLayout('B: Manual Orientation') cmds.text('You must manually check finger, thumb, leg, foot orientation specifically.\nConfirm rest of joints.\nSpine: X aim, Y point backwards from spine, Z to the side.\nFingers: X is aim, Y points upwards, Z to the side - Spread on Y, curl on Z.\nFoot: Pivots on Y, rolls on Z, leans on X.') cmds.columnLayout() cmds.setParent('..') cmds.frameLayout('C: Finalize Creation of Skeleton') cmds.button(l = '\nFinalize Skeleton\n', c = self.finishS) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') tab3 = cmds.rowColumnLayout('Legs') cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'A: Leg Rig Setup') cmds.button(l = '\nGenerate Foot Lean Locators\n', c = self.makeLean) cmds.text('Place on either side of the foot.\nDo not rotate: Automatic orientation in place.') cmds.frameLayout(l = 'B: Rig Legs') cmds.button(l = '\nRig Legs\n', c = self.makeLegs) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') tab4 = cmds.rowColumnLayout('Arms') cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'A: Arm Rig Setup') cmds.button(l = '\nA: Rig Arms\n', c = self.makeArms) cmds.setParent('..') cmds.setParent('..') tab5 = cmds.rowColumnLayout('Spine and Head') cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'Spine Rig Setup') cmds.setParent('..') cmds.setParent('..') tab6 = cmds.rowColumnLayout('Stretchy IK') cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'Stretchy Setup') cmds.setParent('..') cmds.setParent('..') tab6 = cmds.rowColumnLayout('Extras') cmds.scrollLayout(saw = 600, sah = 600, cr = True) cmds.columnLayout(columnAttach = ('both', 5), rowSpacing = 10, columnWidth = 150) cmds.setParent('..') cmds.frameLayout(l = 'General Utitlities') cmds.text('\nHere are all my general utilities for various things') cmds.frameLayout(l = 'Automatic Blend Colors Creation and Connection') cmds.rowColumnLayout(nc = 5, w = 10) cmds.text('IK Joint:') cmds.text(l = '') cmds.text('FK/Dyn Joint:') cmds.text(l = '') cmds.text('Bind Joint:') self.ikJBC = cmds.textField() cmds.text(l = '') self.fkJBC = cmds.textField() cmds.text(l = '') self.bindJBC = cmds.textField() cmds.text(' \nBlend Quantity:') cmds.text(l = '') cmds.text(' \nSwitch Control:') cmds.text(l = '') cmds.text(l = '') self.bQBC = cmds.intField() cmds.text(l = '') self.sCBC = cmds.textField() cmds.text(l = '') cmds.button(l = 'Help Docs', c = self.crBC.__doc__) cmds.setParent('..') cmds.button(l = 'Create', c = self.execCrBC) cmds.text(l = '') cmds.setParent('..') cmds.frameLayout(l = 'Make Spline IK Curve Stretch And Squash') cmds.rowColumnLayout(nc = 5, w = 10) cmds.text('Curve Name:') cmds.text(l = '') cmds.text('Setup Name:') cmds.text(l = '') cmds.text('Joint Quantity:') self.ikJBC = cmds.textField() cmds.text(l = '') self.fkJBC = cmds.textField() cmds.text(l = '') self.bindJBC = cmds.textField() cmds.text(' \nSwitch Control:') cmds.text(l = '') cmds.text(' \nGlobal Control:') cmds.text(l = '') cmds.text(l = '') self.bQBC = cmds.intField() cmds.text(l = '') self.sCBC = cmds.textField() cmds.text(l = '') cmds.button(l = 'Help Docs', c = self.crBC.__doc__) cmds.setParent('..') cmds.button(l = 'Create', c = self.execCrBC) cmds.setParent('..') cmds.showWindow(rigUI) r = RUI('charNameUI', 'gScaleUI', 'fingButtonGrp', 'thumbCheckBox', 'spineButtonGrp', 'neckButtonGrp', 'ikJBC', 'fkJBC', 'bindJBC', 'bQBC', 'sCBC') # last modified at 6.20 pm 29th June 2011

    Read the article

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