Search Results

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

Page 11/141 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Java strings and substrings

    - by omaxgreen
    hey folks, Can someone help me with this Java problem? I want to write a method that takes two strings as arguments and returns true if each character (including space and punctuation) that appears in one string also appears in the other. Thanks

    Read the article

  • Setting jvmargs in log4j.properties file

    - by Thomas
    Hey This is a bit of a weird request but I am trying to set some jvmargs in the log4j.properties file. At present I use ant to for example set some args.... jvmarg value="-Dmail.smtp.socketFactory.port=465" ... but it would be great to group a few of these logging relevant arguments into the .properties file. Does anyone know how to do this? Thanks in advance!

    Read the article

  • Customized command line parsing in Python

    - by Moshe
    I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 [email protected] My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my requirements. Any ideas how can this be solved? Any existing library for this?

    Read the article

  • How to obtain argument not preceded by '-' or '--'

    - by Simone Margaritelli
    Hi guys, i have a program that needs command line arguments in the form : ./my_program -m256M -tm -t some_other_file The "some_other_file" argument is not bound to -t (-t it's just another functionality) so i can't take it as the optarg of any of the flags, neither can i assume it is the last argument in the list. How can i do this? Thanks

    Read the article

  • Bash alias and bash function with several arguments

    - by sanemat
    I want to use both bash alias and bash function with several arguments. I emulate svn sub commands. $ svngrep -nr 'Foo' . $ svn grep -nr 'Foo' . My expectation is both act as below: grep --exclude='*.svn-*' --exclude='entries' -nr 'Foo' . But actual, only alias ('svngrep') does well, function ('svn grep') causes invalid option error. How to write my .bashrc? #~/.bashrc alias svngrep="grep --exclude='*.svn-*' --exclude='entries'" svn() { if [[ $1 == grep ]] then local remains=$(echo $@ | sed -e 's/grep//') command "$svngrep $remains" else command svn "$@" fi }

    Read the article

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Passing arguments to java vm from NSIS script

    - by CodeBuddy
    I'm developing my first java application using Eclipse. I've recently needed to adjust the amount of memory allocated by passing -Xmx256M to the JVM. The application is currently package up as a runnable jar and installed using the NSIS. I'm having a problem passing arguments to the jar file once its installed. What is the common practice for doing this? Here is what I'm currently doing in my nsi file: CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" "$SYSDIR\javaw.exe" "-jar -Xmx256M $INSTDIR\Foo.jar" This results in the following being created as the shortcut Target on windows: C:\WINDOWS\system32\javaw.exe -jar -Xmx256M C:\Program Files\Foo\Foo.jar Unfortunately this does not work due to the space in C:\Program Files, If I change the link created manually to include quotes all is well: C:\WINDOWS\system32\javaw.exe -jar -Xmx256M "C:\Program Files\Foo\Foo.jar"

    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

  • 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

  • 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

  • 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

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >