Search Results

Search found 4670 results on 187 pages for 'jvm arguments'.

Page 21/187 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Matlab Error: Too many output arguments

    - by lebland_Matlab
    I use the following function in a Matlab program: ... ... ... [A, B, C, D, E] = function (F, G, H, I, J, K, L, M, N, O, P) ... ... ... and I get the following error message: ??? Error using == function Too many output arguments. A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P are the vectors of inputs and outputs of the function. but the same program works very well when I replaced the line of the function by its full script! Can you tell me where I should look to find the error..

    Read the article

  • using objc_msgSend to call a Objective C function with named arguments

    - by Markus Pilman
    Hi all, I want to add scripting support for an Objective-C project using the objc runtime. Now I face the problem, that I don't have a clue, how I should call an Objective-C method which takes several named arguments. So for example the following objective-c call [object foo:bar]; could be called from C with: objc_msgSend(object, sel_getUid("foo:"), bar); But how would I do something similar for the method call: [object foo:var bar:var2 err:errVar]; ?? Best Markus

    Read the article

  • java regex illegal escape character error not occurring from command line arguments

    - by Shades88
    This simple regex program import java.util.regex.*; class Regex { public static void main(String [] args) { System.out.println(args[0]); // #1 Pattern p = Pattern.compile(args[0]); // #2 Matcher m = p.matcher(args[1]); boolean b = false; while(b = m.find()) { System.out.println(m.start()+" "+m.group()); } } } invoked by java regex "\d" "sfdd1" compiles and runs fine. But if #1 is replaced by Pattern p = Pattern.compile("\d");, it gives compiler error saying illegal escape character. In #1 I also tried printing the pattern specified in the command line arguments. It prints \d, which means it is just getting replaced by \d in #2. So then why won't it throw any exception? At the end it's string argument that Pattern.compile() is taking, doesn't it detect illegal escape character then? Can someone please explain why is this behaviour?

    Read the article

  • macro returning length of arguments in C

    - by anon
    Is it possible to write a C macro that returns the length of its arguments? I want something that does: foo(1) -> 1 foo(cat, dog) -> 2 foo(red, green, blue) -> 3 Even better if this macro can be defined in such a way that it works with ## so that foo(1) -> bar1(1) foo(cat, dog) -> bar2(cat, dog) foo(red, green, blue) -> car3(red, green, blue) Thanks! EDIT: I really want a macro, not a function. Suggestions to use functions will be downvoted.

    Read the article

  • Separating arguments to a function, in locales with comma as decimal marker

    - by Chris Pousset
    In locales, e.g. French, with comma as decimal indicator (where "5,2" means five and two-tenths), how do users separate function arguments from each other? For example, in many programming/scripting languages, I could specify MAX(1.5, X) in a EN-US locale. How do you avoid the ambiguity between the comma as decimal indicator, and as argument separator? In particular, I'm interested in how software that's perceived as user-friendly in the foreign locale does it. Obviously, it's a no-brainer to say, "thou shalt use decimal POINTs", but that's not particularly "friendly".

    Read the article

  • How invoke live method with arguments

    - by dorelal
    I am learning how to write jQuery plugin. So why I am doing what I am doing does not matter. I writing a plugin called live2 which does nothing else but internally calls live method. (function($) { $.fn.live2 = function() { /* if there are no elements then just return */ if (!this.length) return this; return this.each(function() { var $this = $(this); jQuery.fn.live.apply(this, arguments); }); // end of return this.each(function()) }; // end of plugin })(jQuery); Above code should be invoked just live any live method. Instead of live use live2. $('#container').live2('click',function(){ return false; }) But the plugin is not working. Any idea what the fix should be.

    Read the article

  • nested if: too many arguments?

    - by FLX
    For some reason this code creates problems: source="/foo/bar/" destination="/home/oni/" if [ -d $source ]; then echo "Source directory exists" if [ -d $destination ]; then echo "Destination directory exists" rsync -raz --delete --ignore-existing --ignore-times --size-only --stats --progress $source $destination chmod -R 0755 $destination else echo "Destination directory does not exists" fi else echo "Source directory does not exists" fi It errors out with: Source directory exists /usr/bin/copyfoo: line 7: [: too many arguments Destination directory does not exists I used nested if statements in bash before without a problem, what simple mistake am I overlooking? Thanks!

    Read the article

  • how do arguments work with dojo.connect?

    - by sprugman
    I've read the docs, but I must be missing something. I've got a grid, I want to connect to the event that fires when the column headers are clicked for sorting, thus: dojo.addOnLoad(function(){ var grid = dijit.byId("grid"); dojo.connect(grid, "setSortInfo", 'afterSort'); }); function afterSort() { console.info('after sort'); } That works fine as far as it goes. I know the setSortInfo method has an argument which is the column number. How do I get that value? I've tried putting a parameter in the sig for afterSort to no avail. The docs say "the method receives the same arguments as the event", but where are they???

    Read the article

  • Lua : Dynamicly calling a function with arguments.

    - by Tipx
    Using Lua, I'm trying to dynamicly call a function with parameters. What I want to have it done is I send a string to be parsed in a way that : 1st argument is a class instance "Handle" 2nd is the function to be called All that is left are arguments "modules" is a a table like { string= } split() is a simple parser that returns a table with indexed strings function Dynamic(msg) local args = split(msg, " ") module = args[1] table.remove(args, 1) if module then module = modules[module] command = args[1] table.remove(args, 1) if command then if not args then module[command]() else module[command](unpack(args)) -- Reference 1 end else -- Function doesnt exist end else -- Module doesnt exist end end When I try this with "ignore remove bob", by "Reference 1", it tries to call "remove" on the instance associated with "ignore" in modules, and gives the argument "bob", contained in a table (with a single value). However, on the other side of the call, the remove function does not receive the argument. I even tried to replace the "Reference 1" line with module[command]("bob") but I get the same result.

    Read the article

  • Lua : Dynamically calling a function with arguments.

    - by Tipx
    Using Lua, I'm trying to dynamically call a function with parameters. I want to send a string to be parsed in a way that: 1st argument is a class instance "Handle" 2nd is the function to be called All that is left are arguments "modules" is a a table like { string=<instance of a class> } split() is a simple parser that returns a table with indexed strings. function Dynamic(msg) local args = split(msg, " ") module = args[1] table.remove(args, 1) if module then module = modules[module] command = args[1] table.remove(args, 1) if command then if not args then module[command]() else module[command](unpack(args)) -- Reference 1 end else -- Function doesnt exist end else -- Module doesnt exist end end When I try this with "ignore remove bob", by "Reference 1", it tries to call "remove" on the instance associated with "ignore" in modules, and gives the argument "bob", contained in a table (with a single value). However, on the other side of the call, the remove function does not receive the argument. I even tried to replace the "Reference 1" line with module[command]("bob") but I get the same result.

    Read the article

  • arguments into instance methods in ruby

    - by aharon
    So, I'd like to be able to make a call x = MyClass.new('good morning', 'good afternoon', 'good evening', 'good night', ['hello', 'goodbye']) that would add methods to the class whose values are the values of the arguments. So now: p x.methods #> [m_greeting, a_greeting, e_greeting, n_greeting, r_greeting, ...] And p x.m_greeting #> "good morning" p x.r_greeting #> ['hello', 'goodbye'] I realize that this is sort of what instance variables are to do (and that if I wanted them immutable I could make them frozen constants) but, for reasons beyond my control, I need to make methods instead. Thanks!

    Read the article

  • copying program arguments to a whitespace separated std::string

    - by PaulH
    I have a Visual Studio 2008 C++ application where I would like to copy all of program arguments in to a string separated by a whitespace " ". i.e., if my program is called as foo.exe \Program Files, then my folder string below would contain \Program Files Below is an example of what I'm doing now. I was wondering if there was a shorter or easier method of doing this. Is there an easy way to eliminate the std::wstringstream variable? int _tmain( int argc, _TCHAR* argv[] ) { std::wstringstream f; std::copy( argv + 1, argv + argc, std::ostream_iterator< std::wstring, wchar_t >( f, L" " ) ); std::wstring folder = f.str(); // ensure the folder begins with a backslash if( folder[ 0 ] != L'\\' ) folder.insert( 0, 1, L'\\' ); // remove the trailing " " character from the end added by the std::copy() above if( *folder.rbegin() == L' ') folder.erase( folder.size() - 1 ); // ... } Thanks, PaulH

    Read the article

  • C++ -- typedef "inside" template arguments?

    - by redmoskito
    Imagine I have a template function like this: template<Iterator> void myfunc(Iterator a, Iterator::value_type b) { ... } Is there a way to declare a typedef for Iterator::valuetype that I can use in the function signature? For example: template< typename Iterator, typedef Iterator::value_type type> void myfunc(Iterator a, type b) { ... } Thus far, I've resorted to using default template arguments and Boost concept checking to ensure the default is always used: template< typename Iterator, typename type = Iterator::value_type > void myfunc(Iterator a, type b) { BOOST_STATIC_ASSERT(( boost::type_traits::is_same< typename Iterator::value_type, type >::value )); ... } ...but it would be nice if there was support in the language for this type of thing.

    Read the article

  • Usage of closures with multiple arguments in swift

    - by Nilzone-
    This question is largely based on this one: Link The main difference being that I want to pass in arguments to the closure as well. Say I have something like this: func someFunctionThatTakesAClosure(completionClosure: (venues: Dictionary<String, AnyObject>, error: NSError) -> ()) { // function body goes here var error: NSError? let responseDictionary: Dictionary<String, AnyObject> = ["test" : "test2"] completionClosure(venues: responseDictionary, error: error!) } No error here. But when I call this function in my main view controller I have tried several ways but all of the result in different errors: venueService.someFunctionThatTakesAClosure(completionClosure(venues: Dictionary<String, AnyObject>, error: NSError){ }) or like this: venueService.someFunctionThatTakesAClosure((venues: Dictionary<String, AnyObject>, error: NSError){ }) or even like this: venueService.someFunctionThatTakesAClosure(completionClosure: (venues: Dictionary<String, AnyObject>, error: NSError) -> (){ }); I'm probably just way tired, but any help would be greatly appreciated!

    Read the article

  • Passing URIs as URL arguments in Drupal

    - by wynz
    I'm running into problems trying to pass absolute URIs as parameters with clean URLs enabled. I've got hook_menu() set up like this: function mymodule_menu() { return array( 'page/%' = array( 'title' = 'DBpedia Display Test', 'page callback' = 'mymodule_dbpedia_display', 'page arguments' = array(1), ), ); } and in the page callback: function mymodule_dbpedia_display($uri) { // Make an HTTP request for this URI // and then render some things return $output; } What I'm hoping to do is somehow pass full URIs (e.g. "http://dbpedia.org/resource/Coffee") to my page callback. I've tried a few things and nothing's worked so far... http://mysite.com/page/http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee Completely breaks Drupal's rewriting http://mysite.com/page/?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FCoffee Gives a 404 http://mysite.com/page/http://dbpedia.org/resource/Coffee Returns just "http:", which makes sense I could probably use $_GET to pull out the whole query string, but I guess I'm hoping for a more 'Drupal' solution. Any suggestions?

    Read the article

  • validate constructor arguments or method parameters with annotations, and let them throw an exceptio

    - by marius
    I am validating constructor and method arguments, as I want to the software, especially the model part of it, to fail fast. As a result, constructor code often looks like this public MyModelClass(String arg1, String arg2, OtherModelClass otherModelInstance) { if(arg1 == null) { throw new IllegalArgumentsException("arg1 must not be null"); } // further validation of constraints... // actual constructor code... } Is there a way to do that with an annotation driven approach? Something like: public MyModelClass(@NotNull(raise=IllegalArgumentException.class, message="arg1 must not be null") String arg1, @NotNull(raise=IllegalArgumentException.class) String arg2, OtherModelClass otherModelInstance) { // actual constructor code... } In my eyes this would make the actual code a lot more readable. In understand that there are annotations in order to support IDE validation (like the existing @NotNull annotation). Thank you very much for your help.

    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 TK : How to pass arguments to subroutines

    - by kiruthika
    Hi all, I have designed one sign-up form,in this form after getting all necessary values I will click submit button. And while clicking that submit button I want to call one function and I want to pass the arguments to that function. I have written code for this purpose,but the function is called first before getting the details.(i.e)after getting the details in sign-up form I need to pass these values to one function and I need to validate those values. But what happened was,before getting the details the function get called. Please help me in this issue. Thanks in advance..

    Read the article

  • Calling javascript function with arguments using JSNI

    - by jav_000
    I'm trying to integrate Mixpanel with GWT, but I have problems calling an event with a property and one value. My function to track an simple event (without values): public native void trackEvent(String eventName)/*-{ $wnd.mixpanel.track(eventName); }-*/; It works. But when I want to add some properties and values, it doesn't work properly: public native void trackComplexEvent(String eventName, String property, String value)/*-{ $wnd.mixpanel.track(eventName, {property:value}); }-*/; I have 2 problems with this: 1) Mixpanel says the property name is: "property"(yes, the name of the variable that I'm passing, not the value). 2) Mixpanel says the value is:undefined An example from mixpanel web is: mixpanel.track("Video Play", {"age": 13, "gender": "male"}); So, I guess the problem is I'm doing a wrong call or with wrong type of arguments.

    Read the article

  • How to deal with name/value pairs of function arguments in MATLAB

    - by Richie Cotton
    I have a function that takes optional arguments as name/value pairs. function example(varargin) % Lots of set up stuff vargs = varargin; nargs = length(vargs); names = vargs(1:2:nargs); values = vargs(2:2:nargs); validnames = {'foo', 'bar', 'baz'}; for name = names validatestring(name{:}, validnames); end % Do something ... foo = strmatch('foo', names); disp(values(foo)) end example('foo', 1:10, 'bar', 'qwerty') It seems that there is a lot of effort involved in extracting the appropriate values (and it still isn't particularly robust again badly specified inputs). Is there a better way of handling these name/value pairs? Are there any helper functions that come with MATLAB to assist?

    Read the article

  • Scala's lazy arguments: How do they work?

    - by python dude
    In the file Parsers.scala (Scala 2.9.1) from the parser combinators library I seem to have come across a lesser known Scala feature called "lazy arguments". Here's an example: def ~ [U](q: => Parser[U]): Parser[~[T, U]] = { lazy val p = q // lazy argument (for(a <- this; b <- p) yield new ~(a,b)).named("~") } Apparently, there's something going on here with the assignment of the call-by-name argument q to the lazy val p. So far I have not been able to work out what this does and why it's useful. Can anyone help?

    Read the article

  • Error: Too Many Arguments Specified when Inserting Values from ASP.NET to SQL Server

    - by SidC
    Good Afternoon All, I have a wizard control that contains 20 textboxes for part numbers and another 20 for quantities. I want the part numbers and quantities loaded into the following table: USE [Diel_inventory] GO /****** Object: Table [dbo].[QUOTEDETAILPARTS] Script Date: 05/09/2010 16:26:54 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[QUOTEDETAILPARTS]( [QuoteDetailPartID] [int] IDENTITY(1,1) NOT NULL, [QuoteDetailID] [int] NOT NULL, [PartNumber] [float] NULL, [Quantity] [int] NULL, CONSTRAINT [pkQuoteDetailPartID] PRIMARY KEY CLUSTERED ( [QuoteDetailPartID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[QUOTEDETAILPARTS] WITH CHECK ADD CONSTRAINT [fkQuoteDetailID] FOREIGN KEY([QuoteDetailID]) REFERENCES [dbo].[QUOTEDETAIL] ([ID]) ON UPDATE CASCADE ON DELETE CASCADE GO Here's the snippet from my sproc for this insert: set @ID=scope_identity() Insert into dbo.QuoteDetailParts (QuoteDetailPartID, QuoteDetailID, PartNumber, Quantity) values (@ID, @QuoteDetailPartID, @PartNumber, @Quantity) When I run the ASPX page, I receive an error that there are too many arguments specified for my stored procedure. I understand why I'm getting the error, given the above table layout. However, I need help in structuring my insert syntax to look for values in all 20 PartNumber and Quantity field pairs. Thanks, Sid

    Read the article

  • Arguments to convince to switch from CVS to SVN

    - by ereOn
    Hi, The UNIX department of my company currently uses CVS as source-version control system. They use it in a very strange way: different repositories for development/testing/production code (for the same project), no one tags anything, weird directory architecture, and so on. The system has been set for ages but now, I have an opportunity to organize a meeting where I have to suggest changes. I'd like to make them change from CVS to SVN (Mercurial or Git might be even better, however I can't really recommand using a system I don't know well, and switching to SVN will already be a great step forward). I don't have much experience with CVS so I can't compare them efficiently: I just know it doesn't support atomic operations and that it is deprecated. What killer arguments would you use to convince my collegues to do the switch ? Thank you very much.

    Read the article

  • How to create a bash function with variable parameters/arguments to grep several keywords/tags

    - by CornSmith
    I'm using the :!grep "tag1" filename | grep "tag2" filename | grep -n "tag3 or more" filename command in vim to search for my code snippets based on their tags (a simple comment at the top of a snippet) in one big file. I use snippets to remember tricky things. This is painful to write out each time. I'd like to make an alias, or function to do something like this: :!greptag tag1 tag2 ... tag39 And it should search the current doc and return the lines with all the tags on them. Vim is set to interactive shell mode so that it can parse my bashrc for aliases/functions. set shellcmdflag=-ic How can I construct a function that allows for variable arguments like this in bash?

    Read the article

  • Using function arguments as local variables

    - by Rubys
    Something like this (yes, this doesn't deal with some edge cases - that's not the point): int CountDigits(int num) { int count = 1; while (num >= 10) { count++; num /= 10; } return count; } What's your opinion about this? That is, using function arguments as local variables. Both are placed on the stack, and pretty much identical performance wise, I'm wondering about the best-practices aspects of this. I feel like an idiot when I add an additional and quite redundant line to that function consisting of int numCopy = num, however it does bug me. What do you think? Should this be avoided?

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >