Search Results

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

Page 3/141 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • x86_64 Assembly Command Line Arguments

    - by Brandon oubiub
    I'm new to assembly, and I just got familiar with the call stack, so bare with me. To get the command line arguments in x86_64 on Mac OS X, I can do the following: _main: sub rsp, 8 ; 16 bit stack alignment mov rax, 0 mov rdi, format mov rsi, [rsp + 32] call _printf Where format is "%s". rsi gets set to argv[0]. So, from this, I drew out what (I think) the stack looks like initially: top of stack <- rsp after alignment return address <- rsp at beginning (aligned rsp + 8) [something] <- rsp + 16 argc <- rsp + 24 argv[0] <- rsp + 32 argv[1] <- rsp + 40 ... ... bottom of stack And so on. Sorry if that's hard to read. I'm wondering what [something] is. After a few tests, I find that it is usually just 0. However, occasionally, it is some (seemingly) random number. EDIT: Also, could you tell me if the rest of my stack drawing is correct?

    Read the article

  • Passing arguments and values from HTML to jQuery (events)

    - by Jaroslav Moravec
    What is the practice to pass arguments from HTML to jQuery events function. For example getting id of row from db: <tr class="jq_killMe" id="thisItemId-id"> ... </tr> and jQuery: $(".jq_killMe").click(function () { var tmp = $(this).attr('id).split("-"); var id = tmp[0] // ... } What's the best practise, if I want to pass more than one argument? Is it better not to use jQuery? For example: <tr onclick="killMe('id')"> ... </tr> I didn't find the answer on my question, I will be glad even for links. Thanks. Edit (pre solution) So you suggested two methods to do that: Add custom attributes to element (XHTML) Use attribute ID and parse it by regex Attribute data-* attributes in HTML5 Use hidden children elements I like first solution, but... I would like to (I have to (employer)) produce valid code. Here is a nice question and answers: http://stackoverflow.com/questions/994856/so-what-if-custom-html-attributes-arent-valid-xhtml And the second is not so pretty as the first, but valid. So the compromise is... The third is the solution for future, but here is a lot of CMS where we have to use XHTML or HTML4. (And HTML5 is the long process)

    Read the article

  • Mathematica: get number of arguments passed to a function?

    - by dbjohn
    How do I get the number of arguments passed to a function, such as Plus[2,3,4,5] has 4 arguments passed to it. I was thinking it may involve the use of the function Length and getting the arguments into a list. The intention is to iterate an operation based on the number of arguments for a function. There is probably a simple solution or function but I haven't come across it yet. Any other ways or suggestions are welcome as well?

    Read the article

  • How to use the AAA syntax to do an AssertWasCalled but ignore arguments

    - by Toran Billups
    I'm using the new AAA syntax and wanted to know the syntax to do the below and have the mock ignore the agruments. mockAccount.AssertWasCalled(account = account.SetPassword("dsfdslkj")); I think the below is how I would do this with the record/ replay model but I wanted to see if this could be done with AAA using 3.6 mockAccount.Expect(account = account.SetPassword("sdfdsf")).IgnoreArguments(); mockAccount.VerifyAllExpectations(); Thank you in advance

    Read the article

  • Xcode & passing command line arguments

    - by Brisco
    I just started working with C & Xcode and I've run into a little difficulty. All I want to do is read a file from the command line and see the output in the terminal. I think my problem lies with the path to the file that I want to read in. I'm using a Mac and the file is on my desktop, so the path should be Users/myName/Desktop/words.txt. Is this correct? This is my code: #import <Foundation/Foundation.h> int main (int argc, const char* argv[]){ if(argc == 1){ NSLog(@" you must pass at least one arguement"); return 1; } NSLog(@"russ"); FILE* wordFile = fopen(argv[1] , "r"); char word[100]; while (fgets(word,100,wordFile)) { NSLog(@" %s is %d chars long", word,strlen(word)); } fclose(wordFile); return 0; }//main

    Read the article

  • Invoke Java via Batch File with Filepath Arguments

    - by EricIdyll
    Hi there, I'm having an issue getting files loaded into an app called GCS, by dragging them onto the executable. GCS can be invoked on Windows with a bat file, which goes like this: @echo off start javaw -Xmx256M -jar "GURPS Character Sheet.app/Contents/Resources/Java/GCS.jar" %* If I hard code a filepath in place of the batch argument wildcard (with quotes), it works. If I run the debugger with a filepath argument it works. If I echo %, it gives me the correct filename with quotes around it. If I add quotes around % it still breaks. I have a disconnect here between DOS and Java, and I'm at a loss. Does anyone recognize this problem? Thanks in advance.

    Read the article

  • GCC, functions, and pointer arguments, warning behaviour

    - by James Morris
    I've recently updated to a testing distribution, which is now using GCC 4.4.3. Now I've set everything up, I've returned to coding and have built my project and I get one of these horrible messages: *** glibc detected *** ./boxyseq: free(): invalid pointer: 0x0000000001d873e8 *** I absolutely know what is wrong here, but was rather confused as to when I saw my C code where I call a function which frees a dynamically allocated data structure - I had passed it an incompatible pointer type - a pointer to a completely different data structure. warning: passing argument 1 of 'data_A_free' from incompatible pointer type note: expected 'struct data_A *' but argument is of type 'struct data_B *' I'm confused because I'm sure this would have been an error before and compilation would never have completed. Is this not just going to make life more difficult for C programmers? Can I change it back to an error without making a whole bunch of other warnings errors too? Or am I loosing the plot and it's always been a warning?

    Read the article

  • struct and arguments

    - by jay
    I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference. func ( [?] *val ) { }

    Read the article

  • Passing arguments to a C program

    - by Radhika
    Hi All, I was writing a C program where I use 6 variables a,b,c,d,e,f a,b,c are constant values which I should pass as an argument(command line) d,e,f are going to be size of arrays(which are a part of a structure) typedef struct { blah blah } ex; ex ex0[d]; I am very confused about how to pass all these as argument. Right now I have hard coded these values,which apparently I should not be doing.

    Read the article

  • Small Python optional arguments question

    - by ooboo
    I have two functions: def f(a,b,c=g(b)): blabla def g(n): blabla c is an optional argument in function f. If the user does not specify its value, the program should compute g(b) and that would be the value of c. But the code does not compile - it says name 'b' is not defined. How to fix that? Someone suggested: def g(b): blabla def f(a,b,c=None): if c is None: c = g(b) blabla But this doesn't work, because maybe the user intended c to be None and then c will have another value.

    Read the article

  • Automatically open files given as command line arguments in Python

    - by mk
    I have a lot of Perl scripts that looks something like the following. What it does is that it will automatically open any file given as a command line argument and in this case print the content of that file. If no file is given it will instead read from standard input. while ( <> ) { print $_; } Is there a way to do something similar in Python without having to explicitly open each file?

    Read the article

  • Passing arguments to UILabel [ 2 ] *

    - by DesperateLearner
    I'm trying to call a method of the below (Scroll animation class) type from a viewcontroller class. -(void)CreateLabel:(CGRect )frame andLabel:(UILabel *[NUM_LABELS])label andview:(UIView *)view; I got some errors when I tried passing the argument. Any suggestion on how to call this? This is how I called that method ScrollAnimation *newAnimation = [[ScrollAnimation alloc] init]; [newAnimation CreateLabel:CGRectMake(0, 50, 300,30) andLabel:animateLabel[NUM_LABELS] andview:self.view]; I have the error /Volumes/Red Drive/CarTransition/CarTransition/ViewController.m:120:66: Implicit conversion of an Objective-C pointer to 'UILabel **' is disallowed with ARC /Volumes/Red Drive/CarTransition/CarTransition/ViewController.m:120:66: Incompatible pointer types sending 'UILabel *__strong' to parameter of type 'UILabel **'

    Read the article

  • drupal views block arguments

    - by slimcady
    I currently have a view (Drupal 6 using Views2) that properly aggregates a custom content type (videos) and filters them for a page display. When I create a block display, it previews the results in live preview just great, but when i go to the page expecting to see the block it doesn't appear. I'm fairly certain the argument I'm attempting to pass it fails because when I select "Display all results" for "Action to take if argument does not validate:" the block shows up on the page just fine. Any advice definitely appreciated.

    Read the article

  • bash tools for parsing arguments

    - by BCS
    I have a bash script that uses a few variables (call them $foo and $bar). Right now the script defines them at the top with hard coded values like this: foo=fooDefault bar=barDefault .... # use $foo and $bar What I want is to be able to use the script like any of these: myscript # use all defaults myscript -foo=altFoo # use default bar myscript -bar=altBar # use default foo myscript -bar=altBar -foo=altFoo An ideal solution would allow me to just list the variable that I want to check for flags for. Is there a reasonably nice way to do this? I've seen getopt and I think it might do about 70% of what I'm looking for but I'm wondering if there is a tool or indium that builds on it or the like that gets the rest.

    Read the article

  • C# 4.0: Alternative To Optional Arguments

    - by Paulo Morgado
    Like I mentioned in my last post, exposing publicly methods with optional arguments is a bad practice (that’s why C# has resisted to having it, until now). You might argument that your method or constructor has to many variants and having ten or more overloads is a maintenance nightmare, and you’re right. But the solution has been there for ages: have an arguments class. The arguments class pattern is used in the .NET Framework is used by several classes, like XmlReader and XmlWriter that use such pattern in their Create methods, since version 2.0: XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Auto; XmlReader.Create("file.xml", settings); With this pattern, you don’t have to maintain a long list of overloads and any default values for properties of XmlReaderSettings (or XmlWriterSettings for XmlWriter.Create) can be changed or new properties added in future implementations that won’t break existing compiled code. You might now argue that it’s too much code to write, but, with object initializers added in C# 3.0, the same code can be written like this: XmlReader.Create("file.xml", new XmlReaderSettings { ValidationType = ValidationType.Auto }); Looks almost like named and optional arguments, doesn’t it? And, who knows, in a future version of C#, it might even look like this: XmlReader.Create("file.xml", new { ValidationType = ValidationType.Auto });

    Read the article

  • How can I process command line arguments in Python?

    - by photographer
    What would be an easy expression to process command line arguments if I'm expecting anything like 001 or 999 (let's limit expectations to 001...999 range for this time), and few other arguments passed, and would like to ignore any unexpected? I understand if for example I need to find out if "debug" was passed among parameters it'll be something like that: if 'debug' in argv[1:]: print 'Will be running in debug mode.' How to find out if 009 or 575 was passed? All those are expected calls: python script.py python script.py 011 python script.py 256 debug python script.py 391 xls python script.py 999 debug pdf At this point I don't care about calls like that: python script.py 001 002 245 568 python script.py some unexpected argument python script.py 0001 python script.py 02 ...first one - because of more than one "numeric" argument; second - because of... well, unexpected arguments; third and fourth - because of non-3-digits arguments.

    Read the article

  • Named arguments (parameters) as a readability aid

    - by Damian Mehers
    A long time ago I programmed a lot in ADA, and it was normal to name arguments when invoking a function - SomeObject.DoSomething(SomeParameterName = someValue); Now that C# supports named arguments, I'm thinking about reverting to this habit in situations where it might not be obvious what an argument means. You might argue that it should always be obvious what an argument means, but if you have a boolean argument, and callers are passing in "true" or "false" then qualifying the value with the name makes the call site more readable. contentFetcher.DownloadNote(note, manual : true); I guess I could create Enums instead of using true or false (Manual, Automatic in this case). What do you think about occasionally using named arguments to make code easier to read?

    Read the article

  • Input to program without command-line arguments

    - by Core Xii
    Let's assume that there are no command-line arguments. How do you pass input data to a program? I'm thinking you'd write the input to a file with a specific name, such that the program knows to open and read it as input. However, how would one discover the name of that file? Usually, running a command-line program without arguments or with some standard help argument (e.g. \?) produces some instruction on how to use it. But given an environment with no command-line arguments, how does one discover how to operate a program?

    Read the article

  • C++0x, How do I expand a tuple into variadic template function arguments?

    - by Gustaf
    Consider the case of a templated function with variadic template arguments: template<typename Tret, typename... T> Tret func(const T&... t); Now, I have a tuple t of values. How do I call func() using the tuple values as arguments? I've read about the bind() function object, with call() function, and also the apply() function in different some now-obsolete documents. The GNU GCC 4.4 implementation seems to have a call() function in the bind() class, but there is very little documentation on the subject. Some people suggest hand-written recursive hacks, but the true value of variadic template arguments is to be able to use them in cases like above. Does anyone have a solution to is, or hint on where to read about it?

    Read the article

  • grep - what arguments do you usually specify?

    - by meder
    My most common grep line is just.. grep -IRl "text" * However I'm kinda getting tired of retyping this over and over - is there some way I can make an alias command so that those arguments are always enabled? And, I was wondering what arguments you usually specify for text searching - my two arguments 'R' for recursion, 'I' for not including binary types like jpg/gif, and 'l' for line number seem a bit too minimal. Which arguments do you use?

    Read the article

  • Get a list/tuple/dict of the arguments passed to a function?

    - by digitala
    Given the following function: def foo(a, b, c): pass How would one obtain a list/tuple/dict/etc of the arguments passed in, without having to build the structure myself? Specifically, I'm looking for Python's version of JavaScript's arguments keyword or PHP's func_get_args() method. What I'm not looking for is a solution using *args or **kwargs; I need to specify the argument names in the function definition (to ensure they're being passed in) but within the function I want to work with them in a list- or dict-style structure.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >