Search Results

Search found 25414 results on 1017 pages for 'default arguments'.

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

  • Ruby Methods: how to return an usage string when insufficient arguments are given

    - by Shyam
    Hi, After I have created a serious bunch of classes (with initialize methods), I am loading these into IRb to test each of them. I do so by creating simple instances and calling their methods to learn their behavior. However sometimes I don't remember exactly what order I was supposed to give the arguments when I call the .new method on the class. It requires me to look back at the code. However, I think it should be easy enough to return a usage message, instead of seeing: ArgumentError: wrong number of arguments (0 for 9) So I prefer to return a string with the human readable arguments, by example using "puts" or just a return of a string. Now I have seen the rescue keyword inside begin-end code, but I wonder how I could catch the ArgumentError when the initialize method is called. Thank you for your answers, feedback and comments!

    Read the article

  • Command Line arguments - PHP

    - by Chaitanya
    Am trying the following php script which finds out the maximum between 2 numbers, it accepts the arguments through command line. I check whether the input is provided right, based on the number of command line arguments. <?php function larger($arg1,$arg2) { return max($arg1,$arg2); } if($argc > 3 || $argc < 3) print 'Invalid Arguments'; exit(1); if($argc==3) { print larger($argv[1],$argv[2]); } ?> Am executing the program in a windows system, and the file resides in xampp/php directory. While executing I don't get any output neither any error report. How do i check whether am right or wrong?

    Read the article

  • how to pass arguments into function within a function in r

    - by jon
    I am writing function that involve other function from base R with alot of arguments. For example (real function is much longer): myfunction <- function (dataframe, Colv = NA) { matrix <- as.matrix (dataframe) out <- heatmap(matrix, Colv = Colv) return(out) } data(mtcars) myfunction (mtcars, Colv = NA) The heatmap has many arguments that can be passed to: heatmap(x, Rowv=NULL, Colv=if(symm)"Rowv" else NULL, distfun = dist, hclustfun = hclust, reorderfun = function(d,w) reorder(d,w), add.expr, symm = FALSE, revC = identical(Colv, "Rowv"), scale=c("row", "column", "none"), na.rm = TRUE, margins = c(5, 5), ColSideColors, RowSideColors, cexRow = 0.2 + 1/log10(nr), cexCol = 0.2 + 1/log10(nc), labRow = NULL, labCol = NULL, main = NULL, xlab = NULL, ylab = NULL, keep.dendro = FALSE, verbose = getOption("verbose"), ...) I want to use these arguments without listing them inside myfun. myfunction (mtcars, Colv = NA, col = topo.colors(16)) Error in myfunction(mtcars, Colv = NA, col = topo.colors(16)) : unused argument(s) (col = topo.colors(16)) I tried the following but do not work: myfunction <- function (dataframe, Colv = NA) { matrix <- as.matrix (dataframe) out <- heatmap(matrix, Colv = Colv, ....) return(out) } data(mtcars) myfunction (mtcars, Colv = NA, col = topo.colors(16))

    Read the article

  • Change the Default Font Size in Word

    - by Matthew Guay
    Are you frustrated by always having to change the font size before you create a document it Word?  Here’s how you can end that frustration and set your favorite default font size for once and for all! Microsoft changed the default font font to 11 point Calibri in Word 2007 after years of 12 point Times New Roman being the default.  Although it can be easily overlooked, there are ways in Word to change the default settings to anything you want.  Whether you want to change your default to 12 point Calibri or to 48 point Comic Sans…here’s how to change your default font settings in Word 2007 and 2010. Changing Default Fonts in Word To change the default font settings, click the small box with an arrow in the right left corner of the Font section of the Home tab in the Ribbon.   In the Font dialog box, choose the default font settings you want.  Notice in the Font box it says “+Body”; this means that the font will be chosen by the document style you choose, and you are only selecting the default font style and size.  So, if your style uses Calibri, then your font will be Calibri at the size and style you chose.  If you’d prefer to choose a specific font to be the default, just select one from the drop-down box and this selection will override the font selection in your document style. Here we left all the default settings, except we selected 12 point font in the Latin text box (this is your standard body text; users of Asian languages such as Chinese may see a box for Asian languages).  When you’ve made your selections, click the “Set as Default” button in the bottom left corner of the dialog. You will be asked to confirm that you want these settings to be made default.  In Word 2010, you will be given the option to set these settings for this document only or for all documents.  Click the bullet beside “All documents based on the Normal.dotm template?”, and then click Ok. In Word 2007, simply click Ok to save these settings as default. Now, whenever you open Word or create a new document, your default font settings should be set exactly to what you want.  And simply repeat these steps to change your default font settings again if you want. Editing your default template file Another way to change your default font settings is to edit your Normal.dotm file.  This file is what Word uses to create new documents; it basically copies the formatting in this document each time you make a new document. To edit your Normal.dotm file, enter the following in the address bar in Explorer or in the Run prompt: %appdata%\Microsoft\Templates This will open your Office Templates folder.  Right-click on the Normal.dotm file, and click Open to edit it.  Note: Do not double-click on the file, as this will only create a new document based on Normal.dotm and any edits you make will not be saved in this file.   Now, change any font settings as you normally would.  Remember: anything you change or enter in this document will appear in any new document you create using Word. If you want to revert to your default settings, simply delete your Normal.dotm file.  Word will recreate it with the standard default settings the next time you open Word. Please Note: Changing your default font size will not change the font size in existing documents, so these will still show the settings you used when these documents were created.  Also, some addins can affect your Normal.dotm template.  If Word does not seem to remember your font settings, try disabling Word addins to see if this helps. Conclusion Sometimes it’s the small things that can be the most frustrating.  Getting your default font settings the way you want is a great way to take away a frustration and make you more productive. And here’s a quick question: Do you prefer the new default 11 point Calibri, or do you prefer 12 point Times New Roman or some other combination?  Sound off in the comments, and let the world know your favorite font settings. Similar Articles Productive Geek Tips Change the Default Font in Excel 2007Add Emphasis to Paragraphs with Drop Caps in Word 2007Keep Websites From Using Tiny Fonts in SafariMake Word 2007 Always Save in Word 2003 FormatStupid Geek Tricks: Enable More Fonts for the Windows Command Prompt TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Spyware Blaster v4.3 Yes, it’s Patch Tuesday Generate Stunning Tag Clouds With Tagxedo Install, Remove and HIDE Fonts in Windows 7 Need Help with Your Home Network? Awesome Lyrics Finder for Winamp & Windows Media Player

    Read the article

  • Writting this Bash Script to accept Arguments?

    - by Urda
    How would I go about converting this bash script: mkdir /store/sftp/%USERNAME% sudo useradd -d /incoming %USERNAME% sudo passwd %USERNAME% ## Password needs to be typed or passed in here sudo usermod -g sftp %USERNAME% sudo usermod -s /bin/false %USERNAME% sudo chmod 755 /store/sftp/%USERNAME% sudo chown root:root /store/sftp/%USERNAME% sudo mkdir /store/sftp/%USERNAME%/incoming sudo chown %USERNAME%:sftp /store/sftp/%USERNAME%/incoming To accpet a username and a password?

    Read the article

  • How to add command line arguments to command line arguments in Windows shortcut?

    - by Pawin
    I know I can add a command line argument/option to a shortcut this way; for example: "C:\Program Files\Internet Explorer\iexplore.exe" www.a.com So IE will connect to a.com when it starts up. What I would like to do is to get IE connecting to a.com when I call it through another program like the following: C:\Windows\SysWOW64\ForceBindIP.exe 192.168.1.151 "C:\Program Files\Internet Explorer\iexplore.exe" www.a.com This does not work. IE starts up but doesn't go to a.com. It seems like the argument is either ignored or is understood as an argument of ForceBindIP instead (I'm not sure). What I am trying to do is to create 2 IE shortcuts such each of them binds one IE window to one NIC and one particular website. So adding the www.a.com etc in its startup list won't help. OS is Windows 8. Apologize if this has been asked and answered before. Please suggest keywords for searching if that's the case.

    Read the article

  • IIS7 default document for urlMapped url throws 403 error

    - by MorningZ
    Hopefully this all makes sense: I have a Web Application project against an IIS7 server that is "theme-able" using different master pages. As a result of what I am trying to do, the root of the project has no aspx files, so I am using the web.config's ability to rewrite "~/default.aspx" to "~/themes/a/default.aspx" this works great as long as i type in "http://www.mysite.com/default.aspx", but typing just "http://www.mysite.com" results in a "403 - Forbidden: Access is denied" error I was hoping that the combination of urlMapping and default document would be smart enough to handle this, but it's not <system.webServer> <defaultDocument enabled="true"> <files> <clear /> <add value="default.aspx"/> </files> </defaultDocument> </system.webServer> i also tried <system.webServer> <defaultDocument enabled="true"> <files> <clear /> <add value="~/themes/a/default.aspx"/> </files> </defaultDocument> </system.webServer> to no avail I was hoping a browser would come in without a document defined, IIS7 would assume it was default.aspx, and then the urlMapping would map it accordingly, but nope any pointers? I've read a ton of posts here with similar issues, but not the exact issue

    Read the article

  • Passing multiple sets of arguments to a command

    - by Alec
    instances contains several whitespace separated strings, as does snapshots. I want to run the command below, with each instance-snapshot pair. ec2-attach-volume --instance $instances --device /dev/sdf $snapshots For example, if instances contains A B C, and snapshots contains 1 2 3, I want the command to be called like so: ec2-attach-volume -C cert.pem -K pk.pem --instance A --device /dev/sdf 1 ec2-attach-volume -C cert.pem -K pk.pem --instance B --device /dev/sdf 2 ec2-attach-volume -C cert.pem -K pk.pem --instance C --device /dev/sdf 3 I can do either one or the other with xargs -n 1, but how do I do both?

    Read the article

  • Pass command line arguments to Windows "Open With"

    - by Josh
    I have a program that opens with a specific shortcut, but the shortcut seems to send parameters to the application. If I go directly to the target directory and double-click, it does not work. However, if I use the command line and pass in a certain argument, the application opens correctly. I want to open certain file types using the application, but the application must have the parameters, or it will not work. Is it possible to do this sort of thing?

    Read the article

  • Purpose of Explicit Default Constructors

    - by Dennis Zickefoose
    I recently noticed a class in C++0x that calls for an explicit default constructor. However, I'm failing to come up with a scenario in which a default constructor can be called implicitly. It seems like a rather pointless specifier. I thought maybe it would disallow Class c; in favor of Class c = Class(); but that does not appear to be the case. Some relevant quotes from the C++0x FCD, since it is easier for me to navigate [similar text exists in C++03, if not in the same places] 12.3.1.3 [class.conv.ctor] A default constructor may be an explicit constructor; such a constructor will be used to perform default-initialization or value initialization (8.5). It goes on to provide an example of an explicit default constructor, but it simply mimics the example I provided above. 8.5.6 [decl.init] To default-initialize an object of type T means: — if T is a (possibly cv-qualified) class type (Clause 9), the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor); 8.5.7 [decl.init] To value-initialize an object of type T means: — if T is a (possibly cv-qualified) class type (Clause 9) with a user-provided constructor (12.1), then the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor); In both cases, the standard calls for the default constructor to be called. But that is what would happen if the default constructor were non-explicit. For completeness sake: 8.5.11 [decl.init] If no initializer is specified for an object, the object is default-initialized; From what I can tell, this just leaves conversion from no data. Which doesn't make sense. The best I can come up with would be the following: void function(Class c); int main() { function(); //implicitly convert from no parameter to a single parameter } But obviously that isn't the way C++ handles default arguments. What else is there that would make explicit Class(); behave differently from Class();? The specific example that generated this question was std::function [20.8.14.2 func.wrap.func]. It requires several converting constructors, none of which are marked explicit, but the default constructor is.

    Read the article

  • How to read default key value with dconf or gsettings?

    - by Zta
    I would like to know the default value of a dconf/gsettings key. My question is a followup of the question below: Where can I get a list of SCHEMA / PATH / KEY to use with gsettings? What I'm trying to do, so create a script that reads all my personal preferences so I can back them up and restore them. I plan to iterate though all keys, like the script above, see what keys have been changed from their default value, and make a note of these, that can be restored later. I see that the dconf-editor display the keys' default value, but I'd very much like to script this. Also, I don't see how parsing the schemas /usr/share/glib-2.0/schemas/ can be automated. Maybe someone can help? gsettings get-default|list-defaults would be nice =) (Geesh, it was much easier in the old days where you just kept your ~/.somethingrc in subversion ... =\ Based on the answer given below, I've updated the script to print schema, key, key's data type, default value, and actual value: #!/bin/bash for schema in $(gsettings list-schemas | sort); do for key in $(gsettings list-keys $schema | sort); do type="$(gsettings range $schema $key | tr "\n" " ")" default="$(XDG_CONFIG_HOME=/tmp/ gsettings get $schema $key | tr "\n" " ")" value="$(gsettings get $schema $key | tr "\n" " ")" echo "$schema :: $key :: $type :: $default :: $value" done done This workaround basically covers what I need. I'll continue working on the backup scrip from here.

    Read the article

  • launch an application from HTML with arguments

    - by Jugglingnutcase
    Is there a way to allow an HTML file to open an application on the local computer and send that application arguments? We have an application that allows a user to set a link to an external application. We also provide a summary page in HTML (they usually interact with the application from outside the browser) with the link in HTML as well. We can get applications to launch if the program exists, but cant seem to send arguments through the HTML link. Is this even possible?

    Read the article

  • Pass arguments when using the File protocol

    - by Ando
    I found this question being asked on several places on the internet (including the File protocol MSDN page) but no clear answer. So, if I am calling my application like this: file://c:\myapp.exe is there any way to pass it some command line arguments, like /nospashscreen=true Things I've tried: file://c:\myapp.exe?/nospashscreen=true - launches the app, but with no command line arguments :( Thanks in advance.

    Read the article

  • How to iterate over function arguments

    - by Jack
    I have a Python function accepting several string arguments def foo(a, b, c): and concatenating them in a string. I want to iterate over all function arguments to check they are not None. How it can be done? Is there a quick way to convert None to ""? Thanks.

    Read the article

  • Windows 7 DHCP Default Gateway not Overridden by manual Default Gateway

    - by dgwilson
    We have recently installed Windows 7 for student computers. All student computers must be routed through our content filter which is located at 192.168.0.63. This was done in WinXP by adding a Default Gateway in the network adapter settings TCP/IP Properties Advanced Default Gateway. All teacher computers are routed through the DHCP assigned Default Gateway of 192.168.0.1. In WinXP the dhcp default gateway was correctly overridden by this manual setting. In Win7 it appears that the dhcp default gateway is retained and the manual one is added to the list so that there are two with the dhcp one having the primary metric. I have tried several ways to remove the dhcp default gateway such as, running the "route delete 0.0.0.0 192.168.0.1" command. Doing this from an administrator command prompt works but it just resets upon reboot. I've tried adding this command to the registry's Run section but it seems to run as a non-administrator and therefore will not complete successfully. Is there any way to prevent this and force the manual default gateway to override the dhcp one? Or to remove the dhcp assigned one automatically on boot/login? HELP! We CANNOT allow student computers to connect to the internet without going through the content filter.

    Read the article

  • Windows 7 DHCP Default Gateway not Overridden by manual Default Gateway

    - by dgwilson
    We have recently installed Windows 7 for student computers. All student computers must be routed through our content filter which is located at 192.168.0.63. This was done in WinXP by adding a Default Gateway in the network adapter settings TCP/IP Properties Advanced Default Gateway. All teacher computers are routed through the DHCP assigned Default Gateway of 192.168.0.1. In WinXP the dhcp default gateway was correctly overridden by this manual setting. In Win7 it appears that the dhcp default gateway is retained and the manual one is added to the list so that there are two with the dhcp one having the primary metric. I have tried several ways to remove the dhcp default gateway such as, running the "route delete 0.0.0.0 192.168.0.1" command. Doing this from an administrator command prompt works but it just resets upon reboot. I've tried adding this command to the registry's Run section but it seems to run as a non-administrator and therefore will not complete successfully. Is there any way to prevent this and force the manual default gateway to override the dhcp one? Or to remove the dhcp assigned one automatically on boot/login? HELP! We CANNOT allow student computers to connect to the internet without going through the content filter.

    Read the article

  • Mac OS X: Getting detailed process information (specifically its launch arguments) for arbitrary run

    - by Jasarien
    I am trying to detect when particular applications are launched. Currently I am using NSWorkspace, registering for the "did launch application" notification. I also use the runningApplications method to get apps that are currently running when my app starts. For most apps, the name of the app bundle is enough. I have a plist of "known apps" that I cross check with the name of that passed in the notification. This works fine until you come across an app that acts as a proxy for launching another application using command line arguments. Example: The newly released Portal on the Mac doesn't have a dedicated app bundle. Steam can create a shortcut, which serves as nothing more than to launch the hl2_osx app with the -game argument and portal as it's parameter. Since more Source based games are heading to the Mac, I imagine they'll use the same method to launch, effectively running the hl2_osx app with the -game argument. Is there a nice way to get a list of the arguments (and their parameters) using a Cocoa API? NSProcessInfo comes close, offering an `-arguments' method, but only provides information for its own process... NSRunningApplication offers the ability to get information about arbitrary apps using a PID, but no command line args... Is there anything that fills the gap between the two? I'm trying not to go down the route of spawning an NSTask to run ps -p [pid] and parsing the output... I'd prefer something more high level.

    Read the article

  • Processing command-line arguments in prefix notation in Python

    - by ejm
    I'm trying to parse a command-line in Python which looks like the following: $ ./command -o option1 arg1 -o option2 arg2 arg3 In other words, the command takes an unlimited number of arguments, and each argument may optionally be preceded with an -o option, which relates specifically to that argument. I think this is called a "prefix notation". In the Bourne shell I would do something like the following: while test -n "$1" do if test "$1" = '-o' then option="$2" shift 2 fi # Work with $1 (the argument) and $option (the option) # ... shift done Looking around at the Bash tutorials, etc. this seems to be the accepted idiom, so I'm guessing Bash is optimized to work with command-line arguments this way. Trying to implement this pattern in Python, my first guess was to use pop(), as this is basically a stack operation. But I'm guessing this won't work as well on Python because the list of arguments in sys.argv is in the wrong order and would have to be processed like a queue (i.e. pop from the left). I've read that lists are not optimized for use as queues in Python. So, my ideas are: convert argv to a collections.deque and use popleft(), reverse argv using reverse() and use pop(), or maybe just work with the int list indices themselves. Does anyone know of a better way to do this, otherwise which of my ideas would be best-practise in Python?

    Read the article

  • Configuring default gateway returned by dhcp server

    - by comp1mp
    Hello, I have a machine which connects via ethernet to a private LAN, and wireless to a network which provides internet connectivity. The private LAN uses a wireless router to perform DHCP. The problem is that the wireless and NIC adapters have different default gateways. The default gateway for the private LAN has a lower adapter metric, and is thus chosen by the routing algorithm. I am thus unable to browse the internet when connected to both adapters. The following link has a solution for manually setting the adapter metric to a high number. http://superuser.com/questions/77822/how-to-tell-windows-7-to-ignore-a-default-gateway I was hoping to find a different solution. Does any one know of a router that allows you to configure its DHCP server to return an empty default gateway? I cannot find such an option for my linksys wrt300n. Configuring a static ip address with no default gateway does work, however I would like to use DHCP if possible. Does anyone know of a different way to specify a default gateway for a windows 7 machine with multiple network adapters without mucking with the adapter metric? Thanks, Matthew

    Read the article

  • Variadic functions and arguments assignment in C/C++

    - by Rizo
    I was wondering if in C/C++ language it is possible to pass arguments to function in key-value form. For example in python you can do: def some_function(arg0 = "default_value", arg1): # (...) value1 = "passed_value" some_function(arg1 = value1) So the alternative code in C could look like this: void some_function(char *arg0 = "default_value", char *arg1) { ; } int main() { char *value1 = "passed_value"; some_function(arg1 = value1); return(0); } So the arguments to use in some_function would be: arg0 = "default_value" arg1 = "passed_value" Any ideas?

    Read the article

  • Haskell: reading multiple command line arguments

    - by Survot
    Hi all, Okay, so I am making a program in Haskell that needs to change certain words based on two command line arguments. I have made the replace function and everything works great, but I am stumped getting it to work with command line arguments. Here is the main code: (replace function not included) main = do text <- getContents (command1:command2:_) <- getArgs putStrLn (replace (read command1) (read command2) text) So for intstance in the terminal I want to be able to type something like: "--- cat textfile.txt | ./replace oldword newword" I know this code is close since I have seen others do it this way. O_o Thanks for any help

    Read the article

  • Ruby Methods: return an usage string when insufficient arguments are given

    - by Shyam
    Hi, After creating a serious bunch of classes, with initialize methods, loading them in IRb requires to look back at the code. However, I think it should be easy enough to return a usage message, instead of: ArgumentError: wrong number of arguments (0 for 9) So I prefer to return a string with the human readable arguments, by example using "puts" or just a return of a string. Now I have seen the rescue keyword inside begin-end code, but I wonder how I could catch the ArgumentError when the initialize method is called. Thank you for your answers, feedback and comments!

    Read the article

  • Passing arguments to Shared Function - C

    - by SpyrosR
    I have used dlopen to load an object and dlsym to get a function pointer to a shared object function. Everything works fine. I have tested it calling then the shared function which (for now) only prints and it works-prints fine in the main program calling it. Now I want to pass two arguments to this function. An int and a char * .Can anyone help me understand how can I pass arguments to a shared function? I have searched in the web but I cannot understand how it works.

    Read the article

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