Search Results

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

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

  • How do I embed an expect script that takes in arguments into a bash shell script?

    - by fzkl
    I am writing a bash script which amongst many other things uses expect to automatically run a binary and install it by answering installer prompts. I was able to get my expect script to work fine when the expect script is called in my bash script with the command "expect $expectscriptname $Parameter". However, I want to embed the expect script into the shell script instead of having to maintain two separate script files for the job. I searched around and found that the procedure to embed expect into bash script was to declare a variable like VAR below and then echo it.: VAR=$(expect -c " #content of expect script here ") echo "$VAR" 1) I don't understand how echoing $VAR actually runs the expect script. Could anyone explain? 2) I am not sure how to pass $Parameter into VAR or to the echo statement. This is my main concern. Any ideas? Thanks.

    Read the article

  • Redirecting via .htaccess to .php with arguments in current folder.

    - by Jengerer
    Hey, I'm trying to redirect something like foo/bar to ?foo=bar, so I can do www.mydomain.com/hey/foo/bar to www.mydomain.com/hey/?foo=bar, but I can't seem to get the syntax right. I tried the following: RewriteEngine on RewriteRule ^foo/(.*)$ ?foo=bar [NC] But this doesn't work. How would I accomplish this? I tried adding a forward slash behind the question mark, but that makes it link to the root directory. Thanks, Jengerer

    Read the article

  • How can I mix command line arguments and filenames for <> in Perl?

    - by Jimmeh
    Consider the following silly Perl program: $firstarg = $ARGV[0]; print $firstarg; $input = <>; print $input; I run it from a terminal like: perl myprog.pl sample_argument And get this error: Can't open sample_argument: No such file or directory at myprog.pl line 5. Any ideas why this is? When it gets to the < is it trying to read from the (non-existent) file, "sample_argument" or something? And why?

    Read the article

  • Why does my program not react to any arguments?

    - by Electric Coffee
    I have a simple test program in C++ that prints out attributes of a circle #include <iostream> #include <stdlib.h> #include "hidden_functions.h" // contains the Circle class using namespace std; void print_circle_attributes(float r) { Circle* c = new Circle(r); cout << "radius: " << c->get_radius() << endl; cout << "diameter: " << c->get_diameter() << endl; cout << "area: " << c->get_area() << endl; cout << "circumference: " << c->get_circumference() << endl; cout << endl; delete c; } int main(int argc, const char* argv[]) { float input = atof(argv[0]); print_circle_attributes(input); return 0; } when I run my program with the parameter 2.4 it outputs: radius: 0.0 diameter: 0.0 area: 0.0 circumference: 0.0 I've previously tested the program without the parameter, but simply using static values, and it ran just fine; so I know there's nothing wrong with the class I made... So what did I do wrong here? Note: the header is called hidden_functions.h because it served to test out how it would work if I had functions not declared in the header

    Read the article

  • In python, how do I drag and drop 1 or more files onto my script as arguments with absolute path? (f

    - by chromejs10
    I am writing a simple Python script with no GUI. I want to be able to drag and drop multiple files onto my python script and have access to their absolute paths inside of the script. How do I do this in Mac, Linux, and windows? For times sake, just Mac will be fine for now. I've googled this question and only found one related one but it was too confusing. I am currently running Mac OS X Snow Leopard. Any help is much appreciated. Thanks!

    Read the article

  • Avoiding new operator in JavaScript -- the better way

    - by greengit
    Warning: This is a long post. Let's keep it simple. I want to avoid having to prefix the new operator every time I call a constructor in JavaScript. This is because I tend to forget it, and my code screws up badly. The simple way around this is this... function Make(x) { if ( !(this instanceof arguments.callee) ) return new arguments.callee(x); // do your stuff... } But, I need this to accept variable no. of arguments, like this... m1 = Make(); m2 = Make(1,2,3); m3 = Make('apple', 'banana'); The first immediate solution seems to be the 'apply' method like this... function Make() { if ( !(this instanceof arguments.callee) ) return new arguments.callee.apply(null, arguments); // do your stuff } This is WRONG however -- the new object is passed to the apply method and NOT to our constructor arguments.callee. Now, I've come up with three solutions. My simple question is: which one seems best. Or, if you have a better method, tell it. First – use eval() to dynamically create JavaScript code that calls the constructor. function Make(/* ... */) { if ( !(this instanceof arguments.callee) ) { // collect all the arguments var arr = []; for ( var i = 0; arguments[i]; i++ ) arr.push( 'arguments[' + i + ']' ); // create code var code = 'new arguments.callee(' + arr.join(',') + ');'; // call it return eval( code ); } // do your stuff with variable arguments... } Second – Every object has __proto__ property which is a 'secret' link to its prototype object. Fortunately this property is writable. function Make(/* ... */) { var obj = {}; // do your stuff on 'obj' just like you'd do on 'this' // use the variable arguments here // now do the __proto__ magic // by 'mutating' obj to make it a different object obj.__proto__ = arguments.callee.prototype; // must return obj return obj; } Third – This is something similar to second solution. function Make(/* ... */) { // we'll set '_construct' outside var obj = new arguments.callee._construct(); // now do your stuff on 'obj' just like you'd do on 'this' // use the variable arguments here // you have to return obj return obj; } // now first set the _construct property to an empty function Make._construct = function() {}; // and then mutate the prototype of _construct Make._construct.prototype = Make.prototype; eval solution seems clumsy and comes with all the problems of "evil eval". __proto__ solution is non-standard and the "Great Browser of mIsERY" doesn't honor it. The third solution seems overly complicated. But with all the above three solutions, we can do something like this, that we can't otherwise... m1 = Make(); m2 = Make(1,2,3); m3 = Make('apple', 'banana'); m1 instanceof Make; // true m2 instanceof Make; // true m3 instanceof Make; // true Make.prototype.fire = function() { // ... }; m1.fire(); m2.fire(); m3.fire(); So effectively the above solutions give us "true" constructors that accept variable no. of arguments and don't require new. What's your take on this. -- UPDATE -- Some have said "just throw an error". My response is: we are doing a heavy app with 10+ constructors and I think it'd be far more wieldy if every constructor could "smartly" handle that mistake without throwing error messages on the console.

    Read the article

  • C# Adds Optional and Named Arguments

    Earlier this month Microsoft released Visual Studio 2010, the .NET Framework 4.0 (which includes ASP.NET 4.0), and new versions of their core programming languages: C# 4.0 and Visual Basic 10. In designing the latest versions of C# and VB, Microsoft has worked to bring the two languages into closer parity. Certain features available in C# were missing in VB, and vice-a-versa. Last week I wrote about <a href="http://www.4guysfromrolla.com/articles/042110-1.aspx">Visual Basic 2010's language enhancements</a>, which include implicit line continuation, auto-implemented properties, and collection initializers - three useful features that were available in previous versions of C#. Similarly, C# 4.0 introduces new features to the C# programming language that were

    Read the article

  • LASTDATE dates arguments and upcoming events #dax #tabular #powerpivot

    - by Marco Russo (SQLBI)
    Recently I had to write a DAX formula containing a LASTDATE within the logical condition of a FILTER: I found that its behavior was not the one I expected and I further investigated. At the end, I wrote my findings in this article on SQLBI, which can be applied to any Time Intelligence function with a <dates> argument.The key point is that when you write LASTDATE( table[column] )in reality you obtain something like LASTDATE( CALCULATETABLE( VALUES( table[column] ) ) )which converts an existing row context into a filter context.Thus, if you have something like FILTER( table, table[column] = LASTDATE( table[column] ) the FILTER will return all the rows of table, whereas you probably want to use FILTER( table, table[column] = LASTDATE( VALUES( table[column] ) ) )so that the existing filter context before executing FILTER is used to get the result from VALUES( table[column] ), avoiding the automatic expansion that would include a CALCULATETABLE that would hide the existing filter context.If after reading the article you want to get more insights, read the Jeffrey Wang's post here.In these days I'm speaking at SQLRally Nordic 2012 in Copenhagen and I will be in Cologne (Germany) next week for a SSAS Tabular Workshop, whereas Alberto will teach the same workshop in Amsterdam one week later. Both workshops still have seats available and the Amsterdam's one is still in early bird discount until October 3rd!Then, in November I expect to meet many blog readers at PASS Summit 2012 in Seattle and I hope to find the time to write other article on interesting things on Tabular and PowerPivot. Stay tuned!

    Read the article

  • Allow any arguments for a given command with sudo

    - by Mark L
    I have the following sudo config entry which I added via sudo visudo: mark ALL = NOPASSWD: /usr/bin/lxc-ls* I can run lxc-ls with my user fine but I can't append any parameters without it demanding I prefix the command with sudo. $ whoami mark $ lxc-ls test-container $ lxc-ls --fancy lxc-ls: error: You must be root to access advanced container properties. Try running: sudo /usr/bin/lxc-ls Any idea how I can edit via sudo visudo to allow for any argument after the command? I don't want to prefix the command with sudo as I'm using a python library to execute the command and it's being funny about sudo prefixes.

    Read the article

  • alias/function with command line arguments

    - by Agzam
    I'm tired of typing manage.py startserver 10.211.55.4:4000, so decided to make an alias for that. Only thing is: the port sometime changes. So I did this in bash profile: function runserver() { python manage.py runserver 10.211.55.4:$1 } But then when I call it: runserver 3000, it starts it, but immediately stops saying: "Error: That IP address can't be assigned-to". However if I type the same thing right into command line it works with no complains.

    Read the article

  • Directory structure and script arguments

    - by felwithe
    I'll often see a URL that looks something like this: site.com/articles/may/05/02/2011/article-name.php Surely all of those subdirectories don't actually exist? It seems like it would be a huge redundancy, even if it was only an identical index file in every directory. To change anything you'd have to change every single one. I guess my question is, is there some more elegant way that sites usually accomplish this?

    Read the article

  • What's the difference between arguments with default values and keyword-arguments?

    - by o_O Tync
    In Python, what's the difference between arguments having default values: def f(a,b,c=1,d=2): pass and keyword arguments: def f(a=1,b=2,c=3): pass ? I guess there's no difference, but the tutorial has two sections: 4.7.1. Default Argument Values 4.7.2. Keyword Arguments which sounds like there are some difference in them. If so, why can't I use this syntax in 2.6: def pyobj_path(*objs, as_list=False): pass ?

    Read the article

  • Limit on number of kernel arguments in OpenCL

    - by Rakesh K
    Hi, I wanted to know if there is any limit on the number of arguments that are set to kernel function in OpenCL. I am getting the error as INVALID_ARG_INDEX while setting arguments. I am setting 9 arguments in the kernel function. Please help me in this regard. Thanks, Rakesh.

    Read the article

  • Accessing Arguments, Workflow Variables from custom activities

    - by yang
    I have a workflow composed of many custom activities. All these activities need to access startup arguments of the workflow itself. I can define InArgument inside all these custom activities and bind the workflow arguments to custom activity arguments but I am not comfortable with this solution. What is the best way to access workflow level argument and variable declarations from custom activities. Can I get them from ActivityContext? Thanks.

    Read the article

  • How to pass arguments to Go program?

    - by oraz
    I can't see arguments for main() in package main. How to pass arguments from command line in Go? A complete program, possibly created by linking multiple packages, must have one package called main, with a function func main() { ... } defined. The function main.main() takes no arguments and returns no value.

    Read the article

  • How to print arguments passed to configure script?

    - by Sam
    Hi, I'm trying to print arguments passed to a ./configure script. Calling 'echo' on $BASH_ARGV will just print the last set of arguments. For example if I run: ./configure --enable-foo --enable-bar echo $BASH_ARGV will print only "--enable-bar" How do I print all the arguments? Thanks!

    Read the article

  • Strange errors in Visual C++ :: 'malloc' : function does not take 1 arguments

    - by pecker
    Error 38 error C2660: 'malloc' : function does not take 1 arguments C:\VolumeRenderer\render.cpp 296 1 VolumeRenderer Error 39 error C2660: 'malloc' : function does not take 1 arguments C:\VolumeRenderer\render.cpp 412 1 VolumeRenderer Error 40 error C2660: 'malloc' : function does not take 1 arguments C:\VolumeRenderer\render.cpp 414 1 VolumeRenderer Error 41 error C2660: 'read_den' : function does not take 4 arguments C:\VolumeRenderer\render.cpp 506 1 VolumeRenderer My all malloc sections are like this: /* allocate space for the raw data */ density_size = BRAIN_XLEN * BRAIN_YLEN * BRAIN_ZLEN; density = (unsigned char*)malloc(density_size); if (density == NULL) { fprintf(stderr, "out of memory\n"); exit(1); } regarding read_den (last error) unsigned char *read_den(char *filename,int *xptr,int *yptr,int *zptr)// function prototype src_volume = read_den(src_file, &src_xlen, &src_ylen, &src_zlen);// fucntion call Is it my code or the errors that are absurd. How to rectify them?

    Read the article

  • Obtaining command line arguments in a QT application

    - by morpheous
    The following snippet is from a little app I wrote using the QT framework. The idea is that the app can be run in batch mode (i.e. called by a script) or can be run interactively. It is important therefore, that I am able to parse command line arguments in order to know which mode in which to run etc. [Edit] I am debugging using QTCreator 1.3.1 on Ubuntu Karmic. The arguments are passed in the normal way (i.e. by adding them via the 'Project' settings in the QTCreator IDE). When I run the app, it appears that the arguments are not being passed to the application. The code below, is a snippet of my main() function. int main(int argc, char *argv[]) { //Q_INIT_RESOURCE(application); try { QApplication the_app(argc, argv); //trying to get the arguments into a list QStringList cmdline_args = QCoreApplication::arguments(); // Code continues ... } catch (const MyCustomException &e) { return 1; } return 0; } [Update] I have identified the problem - for some reason, although argc is correct, the elements of argv are empty strings. I put this little code snippet to print out the argv items - and was horrified to see that they were all empty. for (int i=0; i< argc; i++){ std::string s(argv[i]); //required so I can see the damn variable in the debugger std::cout << s << std::endl; } Does anyone know what on earth is going on (or a hammer)?

    Read the article

  • Windows service - supplying arguments in "path to executable"

    - by Jono
    I cannot figure out how to pass (constant) arguments into my Windows service when it is started. I'm using the standard .NET classes like ServiceBase to implement (and ServiceProcessInstaller and ServiceInstaller to install) my service. On the general tab of a Windows Service properties dialog box (once installed), there's a "Path to executable" in which I can see that some of the standard Windows services have command line arguments specified. System.ServiceProcess.ServiceBase.OnStart takes string[] args, which I presume would enable these arguments to be accessed from within .NET code. Are there some properties on ServiceProcessInstaller or ServiceInstaller that I can set to allow me to pass startup arguments to my own service, or does anyone know how it's supposed to be done?

    Read the article

  • file:// command-line arguments

    - by Cory Grimster
    Is it possible to pass command-line arguments to a program that is invoked via a file:// url? I'm trying to include Remote Desktop links in a wiki page that lists some servers: <a href="file:///c|/windows/system32/mstsc.exe /v:serverName">serverName</a> When I omit the argument the link works fine, but when I include it the link doesn't work. I Googled around a bit and couldn't find any references to this. I suspect that the answer is that file:// urls simple don't accept arguments (I can think of all kinds of ways to abuse them if they do), but I thought I'd throw it out there in case I've simply got the syntax wrong. Thanks.

    Read the article

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