Search Results

Search found 28350 results on 1134 pages for 'command switch'.

Page 30/1134 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • IIS Redirection - command line

    - by clklachu
    I have a website say www.mywebsite.com/demo . When ever if anyone requests this site, i want to navigate to another website www.myanotherwebsite.com . I know that this can be done in IIS by using the HTTP Redirect feature. But since i want to do this for different websites, I would like to write a bat file which would run the command to set the redirect url for a website. Can anyone please help me how to set the redirection URL through command line?

    Read the article

  • Advantages to Multiple Methods over Switch

    - by tandu
    I received a code review from a senior developer today asking "By the way, what is your objection to dispatching functions by way of a switch statement?" I have read in many places about how pumping an argument through switch to call methods is bad OOP, not as extensible, etc. However, I can't really come up with a definitive answer for him. I would like to settle this for myself once and for all. Here are our competing code suggestions (php used as an example, but can apply more universally): class Switch { public function go($arg) { switch ($arg) { case "one": echo "one\n"; break; case "two": echo "two\n"; break; case "three": echo "three\n"; break; default: throw new Exception("Unknown call: $arg"); break; } } } class Oop { public function go_one() { echo "one\n"; } public function go_two() { echo "two\n"; } public function go_three() { echo "three\n"; } public function __call($_, $__) { throw new Exception("Unknown call $_ with arguments: " . print_r($__, true)); } } Part of his argument was "It (switch method) has a much cleaner way of handling default cases than what you have in the generic __call() magic method." I disagree about the cleanliness and in fact prefer call, but I would like to hear what others have to say. Arguments I can come up with in support of Oop scheme: A bit cleaner in terms of the code you have to write (less, easier to read, less keywords to consider) Not all actions delegated to a single method. Not much difference in execution here, but at least the text is more compartmentalized. In the same vein, another method can be added anywhere in the class instead of a specific spot. Methods are namespaced, which is nice. Does not apply here, but consider a case where Switch::go() operated on a member rather than a parameter. You would have to change the member first, then call the method. For Oop you can call the methods independently at any time. Arguments I can come up with in support of Switch scheme: For the sake of argument, cleaner method of dealing with a default (unknown) request Seems less magical, which might make unfamiliar developers feel more comfortable Anyone have anything to add for either side? I'd like to have a good answer for him.

    Read the article

  • How to make a big switch control structure with variable check values?

    - by mystify
    For example, I have a huge switch control structure with a few hundred checks. They're an animation sequence, which is numbered from 0 to n. Someone said I can't use variables with switch. What I need is something like: NSInteger step = 0; NSInteger i = 0; switch (step) { case i++: // do stuff break; case i++: // do stuff break; case i++: // do stuff break; case i++: // do stuff break; } The point of this is, that the animation system calls a method with this big switch structure, giving it a step number. I want to be able to simply cut-copy-paste large blocks and put them in a different position inside the switch. for example, the first 50 blocks to the end. I could do that easily with a huge if-else structure, but it would look ugly and something tells me switch is much faster. How to?

    Read the article

  • How to read Unicode characters from command-line arguments in Python on Windows

    - by Craig McQueen
    I want my Python script to be able to read Unicode command line arguments in Windows. But it appears that sys.argv is a string encoded in some local encoding, rather than Unicode. How can I read the command line in full Unicode? Example code: argv.py import sys first_arg = sys.argv[1] print first_arg print type(first_arg) print first_arg.encode("hex") print open(first_arg) On my PC set up for Japanese code page, I get: C:\temp>argv.py "PC·??????08.09.24.doc" PC·??????08.09.24.doc <type 'str'> 50438145835c83748367905c90bf8f9130382e30392e32342e646f63 <open file 'PC·??????08.09.24.doc', mode 'r' at 0x00917D90> That's Shift-JIS encoded I believe, and it "works" for that filename. But it breaks for filenames with characters that aren't in the Shift-JIS character set—the final "open" call fails: C:\temp>argv.py Jörgen.txt Jorgen.txt <type 'str'> 4a6f7267656e2e747874 Traceback (most recent call last): File "C:\temp\argv.py", line 7, in <module> print open(first_arg) IOError: [Errno 2] No such file or directory: 'Jorgen.txt' Note—I'm talking about Python 2.x, not Python 3.0. I've found that Python 3.0 gives sys.argv as proper Unicode. But it's a bit early yet to transition to Python 3.0 (due to lack of 3rd party library support). Update: A few answers have said I should decode according to whatever the sys.argv is encoded in. The problem with that is that it's not full Unicode, so some characters are not representable. Here's the use case that gives me grief: I have enabled drag-and-drop of files onto .py files in Windows Explorer. I have file names with all sorts of characters, including some not in the system default code page. My Python script doesn't get the right Unicode filenames passed to it via sys.argv in all cases, when the characters aren't representable in the current code page encoding. There is certainly some Windows API to read the command line with full Unicode (and Python 3.0 does it). I assume the Python 2.x interpreter is not using it.

    Read the article

  • what does "Net user administrator /active:yes" do to a computer?

    - by Rees
    i just purchased a new laptop and had some issues with it... I called tech support and they had me run this command in cmd prompt by right clicking the cmd icon and selecting "run as administrator" with root C:\windows\system32: "Net user administrator /active:no" after it was determined that it didn't fix the issue we ran this code "Net user administrator /active:yes" i then rebooted..and was asked for my windows login for my user account "Rees" as usual.. however ALL my settings where gone (including my desktop files) as though it was the first time I booted up. WHAT in the world happened with this command?? I desperately NEED my user accounts and files back to how they were!! (running windows 7) Please help!

    Read the article

  • MSBuild Working with ItemGroup and EXEC Command

    - by obautista
    I created the ItemGroup shown in the code snippet. I need to iterate through this ItemGroup and run the EXEC command - also shown in the code snippet. I cannot seem to get it to work. The code returns the error shown below (note - the Message is written 2 times, which is correct), but the EXEC Command is not running correctly. The value is not being set; therefore the EXEC is not executing at all. I need the EXEC to execute twice or by however sections I define in the ItemGroup. ERROR: Encrypting WebServer appSettings section Encrypting WebServer connectionStrings section C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "" "\gaw\UI" -prov "RSACustomProvider" Encrypting configuration section... The configuration section '' was not found. CODE SNIPPET: appSettings connectionStrings <Exec Command="$(AspNetRegIis) -pef &quot;%(SectionsToEncrypt.Section)&quot; &quot;$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.FlavorToBuild)\$(AnythingPastFlavorToBuild)&quot; -prov &quot;$(WebSiteRSACustomProviderName)&quot;"/>

    Read the article

  • Use the output of a command as input of the next command

    - by r2b2
    so i call this php script from the command line : /usr/bin/php /var/www/bims/index.php "projects/output" and it's output is : file1 file2 file3 What I would like to do is get this output and feed to the "rm" command but i think im not doing it right : /usr/bin/php /var/www/bims/index.php "projects/output" | rm My goal is to delete whatever file names the php script outputs. What should be the proper way to do this? Thanks!

    Read the article

  • What causes a switch port to receive data not destined for it?

    - by user1693454
    We are having an intermittent fault which is effecting one of our control systems on one of our HP Procurve switches. For some reason, this PLC (10mbit port - 192.168.6.56) which is attached directly to the HP Switch intermittantly start's receiving data which is not destined for it. The data is being sent from a Thecus NAS with latest firmware (192.168.6.218) to a physical IBM Server running Win2003R2 and SAP (192.168.6.225). The problem does not just send to this server, it has been to other physical servers in the past too, but always from the Thecus NAS. I am using a monitor port to wireshark what is going in/out of the PLC - normally there would be about 1mb in/out per 2 or 3 minutes - only a server asking the state of the coils. When the problem occurs, there is a flood of data being put onto the PLC line - in this captured instance, about 67mb in less than a minute. Due to this, there is no way that the PLC can be queried as the port is effectively DOSed, in turn killing part of our factory. I know that having Production on the same vlan as IT is not a good idea - I agree, however it cannot be changed at the moment (will have to wait 3 months), as well as the problem has only started happening in the last 3 months. Here is a screen cap of one of the packets being sent from the Thecus NAS which was captured from the PLC port on the HP Switch: And there are over 700 of these in this one 1024kb file. If anyone has any idea on what could be going on, some help would be greatly appreciated. If you need to know anything more, let me know! Cheers!

    Read the article

  • how to find which package certain command belongs to on centos?

    - by hugemeow
    for example i can easily find locate command belongs to mlocate.i386 package. yum search locate mlocate.i386 : An utility for finding files by name [mirror@home /]$ rpm -qa | grep locate mlocate-0.15-1.el5.1 yum search updatedb Loaded plugins: fastestmirror, protectbase 0 packages excluded due to repository protections =========================================== Matched: updatedb =========================================== mlocate.i386 : An utility for finding files by name but it's not so easy to find which package free command belongs to: yum search free // this command just returns too much informationy rpm -qa | grep free freetype-2.2.1-31.el5_8.1 // obviously not the package by which free command is installed so is there any convinent way to know which package a specific command belongs to on linux? for example centos or some other distributions:)

    Read the article

  • How to rename files in a folder using the ls command output as a pipe ?

    - by user1179459
    I am using GNU/Linux and BASH shell, What i wanted to do is in server is to i need to be able to download the files stating with B* and D* and then rename them to ~B* and ~D*(same file name just ~ in-front) i wrote following which works fine for the downloading part ideally i would like it to use ls command output as well but dont know how to do that. cd inbox get D* get B* ls B*|rename $0 ~B.* bye Any idea ? ideally what i would like to do is ls command to send the list of files one by one to the get command and then the once the get command is completed i want rename command executed renaming the server files

    Read the article

  • Creating a command that compress a file and save it on a usb, but cannot detect the usb in linux.

    - by Lance
    First of all I can't detect the USB on linux using the command line. I check the directory dev and still cannot find the usb. used the df command to check the usb. I plug and typed df and then unplug and typed df again and nothing changed. We are using a server(telnet) to use the command line of linux on a windows 7 OS. The second problem I have is how can I execute the bash script that I have made. It seems that I cant put my .sh file in /usr/bin/ I would like to make my command executable in all directories like a normal command. Sorry, im still newbie at this things. This is what I get on staying on Windows too much. Sorry for my english. Thank you in advance.

    Read the article

  • Is the console command cd a wildcard of sorts? [closed]

    - by Spiritios
    I was wondering while developing some application (though this is not a development question) if the cd command used in Windows is a wildcard or cross-platform command of sorts. I looked up on table with comands for Unix/Linux and MAC OS X and it turns out that it seems to be there. I am not a multi-os user, so I ask if anyone with experience in different OSes can tell me: If this command really exists and works If it has the same functionality (change directory) If there are any problems with its use If in any OS there is another command-line command that does the same in a better/more elaborate/more frequetly used way. Thanks in advance! (P.S.I am not 100% sure if this question belongs to this site or some other stackexchange site...) (P.P.S Any help in tagging this will be appreciated!)

    Read the article

  • How can I get command prompt to merge my files in name order?

    - by Anastasia
    I'm using the copy command in command prompt to merge all the files in a directory, for a number of directories. The problem is, I need to edit the first file in each directory before I merge. This means that when I put in the command "copy /b *.mp3 name.mp3", the joined file has part 2 at the start and part 1 at the end, presumably because it was created last. Is there a way of using the copy command so that the files merge in name order? Each folder has a different number of parts, anywhere from 2 to 1000 so I don't want to list each file with a "+" in between. Ideally, I'd like to find something to insert into the copy command I'm already using. Otherwise, is there a way of rearranging the files in a folder so that if you enter "DIR", part 1 shows up first even if it was edited last? I'm using Windows 7 by the way.

    Read the article

  • SQL RENAME TABLE command

    - by Nano HE
    Hello. I can run RENAME TABLE student TO student_new ; The command is same and easy to follow. Is there a methods to rename a lot of tables in simple command. Assume all the tables belog to the same DB name. I don't need write a lot of code as below? RENAME TALBE pre_access TO pre_new_access; RENAME TALBE pre_activities TO pre_new_activities; RENAME TALBE pre_activityapplies TO pre_new_activityapplies; RENAME TALBE pre_adminactions TO pre_new_adminactions; RENAME TALBE pre_admincustom TO pre_new_admincustom; RENAME TALBE pre_admingroups TO pre_new_admingroups; RENAME TALBE pre_adminnotes TO pre_new_adminnotes; ... (there are still so many tables need to be renamed)

    Read the article

  • Adding programatically a command to a listbox in WPF

    - by ajtp
    In my WPF application there is a listbox with items. The listbox is populated via a xmldataprovider from XAML and then binding it to Itemssource property of the listbox. Well, from XAML, I bind a comand to the listbox by doing: <ListBox.CommandBindings> <CommandBinding Command="{x:Static local:mainApp.MyCmd}" CanExecute="CanExecute" Executed ="Executed" /> </ListBox.CommandBindings> but I don't know how to programatically bind a command to each listboxitem. How to do it? Thanks in advance.

    Read the article

  • Missing output when running system command in perl/cgi file

    - by aladine
    I need to write a CGI program and it will display the output of a system command: script.sh echo "++++++" VAR=$(expect -c " spawn ssh -o StrictHostKeyChecking=no $USER@$HOST $CMD match_max 100000 expect \"*?assword:*\" send -- \"$PASS\r\" send -- \"\r\" expect eof ") echo $VAR echo "++++++" In CGI file: my $command= "ksh ../cgi-bin/script.sh"; my @output= `$command`; print @output; Finally, when I run the CGI file in unix, the $VAR is a very long string including \n and some delimiters. However, when I run on web server, the output is ++++++ ++++++ So $VAR is missing when passing in the web interface/browser. I know maybe the problem is $VAR is very long string. But anyway, is there anyway to solve this problem except writing the output to a file then retrieve it from browser? Thanks if you are interested in my question.

    Read the article

  • How do you reset a USB device from the command line?

    - by Casey
    Is it possible to reset the connection of a USB device, without physically disconnecting/connecting from the PC? Specifically, my device is a digital camera. I'm using gphoto2, but lately I get "device read errors", so I'd like to try to do a software-reset of the connection. From what I can tell, there are no kernel modules being loaded for the camera. The only one that looks related is usbhid.

    Read the article

  • Windows Command Line

    - by Markus O'Reilly
    Does anyone know how to break out of a for loop when it's typed directly into the windows command-line? I know you can use gotos and labels to break out of it when it's in a batch file, but I can't find anything about breaking out of one on the command line. Here's a simple example: C:> for /l %i in (1,0,1) do @ping -n 1 google.com || (echo ^G & msg user "Google is down!" & QUIT) This should infinitely ping google.com. If it ever fails, it beeps (echo ^G), displays a message box to the user "user" that says "Google is down!", and QUITs. I don't know how to do the quit part though. I guess I could do something like taskkill /f /im cmd.exe, but I was looking for something more elegant. Any tips?

    Read the article

  • How to pass filename to StandardInput (Process) in C#?

    - by Cosmo
    Hello Guys! I'm using the native windows application spamc.exe (SpamAssassin - sawin32) from command line as follows: C:\SpamAssassin\spamc.exe -R < C:\email.eml Now I'd like to call this process from C#: Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.FileName = @"C:\SpamAssassin\spamc.exe"; p.StartInfo.Arguments = @"-R"; p.Start(); p.StandardInput.Write(@"C:\email.eml"); p.StandardInput.Close(); Console.Write(p.StandardOutput.ReadToEnd()); p.WaitForExit(); p.Close(); The above code just passes the filename as string to spamc.exe (not the content of the file). However, this one works: Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.FileName = @"C:\SpamAssassin\spamc.exe"; p.StartInfo.Arguments = @"-R"; p.Start(); StreamReader sr = new StreamReader(@"C:\email.eml"); string msg = sr.ReadToEnd(); sr.Close(); p.StandardInput.Write(msg); p.StandardInput.Close(); Console.Write(p.StandardOutput.ReadToEnd()); p.WaitForExit(); p.Close(); Could someone point me out why it's working if I read the file and pass the content to spamc, but doesn't work if I just pass the filename as I'd do in windows command line?

    Read the article

  • DOS batch command to read some info from text file

    - by Ray
    Hello All, I am trying to read some info from a text file by using windows command line, and save it to a variable just like "set info =1234" Below is the content of the txt file, actually I just need the revision number, and the location of it is always the same line 5, and from column 11 to 15. In the sample it's 1234, and I am wondering is there a way to save it to a variable in Dos command line. Thanks a lot! svninfo.txt: Path: . URL: https://www.abc.com Repository Root: https://www.abc.com/svn Repository UUID: 12345678-8b61-fa43-97dc-123456789 Revision: 1234 Node Kind: directory Schedule: normal Last Changed Author: abc Last Changed Rev: 1234 Last Changed Date: 2010-04-01 18:19:54 -0700 (Thu, 01 Apr 2010)

    Read the article

  • Command line switches parsed out of executable's path

    - by Roger Pate
    Why do Windows programs parse command-line switches out of their executable's path? (The latter being what is commonly known as argv[0].) For example, xcopy: C:\Temp\foo>c:/windows/system32/xcopy.exe /f /r /i /d /y * ..\bar\ Invalid number of parameters C:\Temp\foo>c:\windows\system32\xcopy.exe /f /r /i /d /y * ..\bar\ C:\Temp\foo\blah -> C:\Temp\bar\blah 1 File(s) copied What behavior should I follow in my own programs? Are there many users that expect to type command-line switches without a space (e.g. program/? instead of program /?), and should I try to support this, or should I just report an error and exit immediately? What other caveats do I need to be aware of? (In addition to Anon.'s comment below that "debug/program" runs debug.exe from PATH even if "debug\program.exe" exists.)

    Read the article

  • /SUBSYSTEM:Windows program will not write to command line

    - by user144182
    I have a mixed mode C++-CLI program in Visual Studio 2005 that is set to use the /SUBSYSTEM:Windows. Generally speaking it is a graphical application that is launched from its shortcut or through the filetype registered to it. However, there is a rare occasion where a user will want to run it from the command line with arguments. I can access the arguments just fine, its when it comes to writing to the console, in response to the program being launched from the command line with arguments, where I don't see Console::WriteLine having any effect. What am I doing wrong?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >