Search Results

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

Page 37/1134 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Is using decimal ranges in a switch impossible in C#?

    - by phobia
    I'm justing starting out learning C# and I've become stuck at something very basic. For my first "app" I thought I'd go for something simple, so I decided for a BMI calculator. The BMI is calculated into a decimal type which I'm now trying to use in a switch statement, but aparently decimal can't be used in a switch? What would be the C# solution for this: decimal bmi = calculate_bmi(h, w); switch (bmi) { case < 18.5: bmi_description = "underweight."; break; case > 25: bmi_description = "overweight"; case > 30: bmi_description = "very overweight"; case > 40: bmi_description = "extreme overweight"; break; }

    Read the article

  • Confused about GNU `sort(1)` of a numerical sub field

    - by Chen Levy
    I wish to sort a space separated table, with the numerical value that found on the 2nd field. I can assume that the 2nd field is always fooN but the length of N is unknown: antiq. foo11 girls colleaguing foo2 Leinsdorf Cousy foo0 Montgomeryville bowlegged foo1 pollack Chevrier foo10 ill-conceived candlebomb foo3 seventieths autochthony foo101 re-enable beneficiate foo100 osteometric I read man sort(1) and played with all sort of options. On my system I found the line: sort -n -k2.5 table to work. My question is why? According to the man page: -k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin 1) ... POS is F[.C][OPTS], where F is the field number and C the characterposition in the field. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key. So why sort -n -k2.4 table don't work and sort -n -k.5 does?

    Read the article

  • C++ Long switch statement or look up with a map?

    - by Rachel
    In my C++ application, I have some values that act as codes to represent other values. To translate the codes, I've been debating between using a switch statement or an stl map. The switch would look something like this: int code; int value; switch(code) { case 1: value = 10; break; case 2: value = 15; break; } The map would be an stl::map<int, int> and translation would be a simple lookup with the code used as the key value. Which one is better/more efficient/cleaner/accepted? Why?

    Read the article

  • Different subnets routing with just one layer 3 switch

    - by GustavoFSx
    Our current network looks like this: Location 1: 2 Layer 2 switches | subnet 192.168.1.0/24 | Firewall for our VPN Location 2: 1 Layer 2 switch | subnet 192.168.3.0/24 | Firewall for our VPN Location 3: 1 Layer 2 switch | subnet 192.168.5.0/24 | Firewall for our VPN We just got a direct fiber connection between location 1 and 2, we also got a new HP V1910 24G layer 3 switch. I tried to follow the instructions on this site, but I can't get it to work. I think our network should look like this: Location 1: HP Switch FIBER to L2 | subnet 192.168.1.0/24 | Firewall for our VPN Location 2: 1 Layer 2 switch | subnet 192.168.3.0/24 | FIBER to L1 Location 3: 1 Layer 2 switch | subnet 192.168.5.0/24 | Firewall for our VPN So, how can I get routing working on our location 2? It's old gateway was a firewall device on ip 192.168.3.1. I'm thinking on creating a VLAN Interface on 192.168.3.1 on the switch for the Location 2. But how will I handle that on the HP switch that has a direct fiber connection with that switch? Please help, I'm not very good with networking.

    Read the article

  • KVM Switch for multiple monitors possible?

    - by jasondavis
    I have been curious about this for YEARS! I have never used a KVM switch (keyboard, mouse, monitor) switch to allow you to use 1 keyboard, mouse, monitor to operate 2 or more computers however I understand the concept and what they are for, just never really had a huge need for 1 until now. Here is my issue though. If possible I need to have a KVM switch hooked up to 2 computers in my room. The catch, I have 2-3 monitors on the PC, so I am looking for a way to have a KVM switch that will support multiple monitors. So PC #1 can be using a mouse, keyboard, 2-3 monitors like normal. I then hit the switch and it makes my mouse, keyboard, and 2-3 monitors switch to PC #2. Has anyone ever heard of a KVM switch being able to support multiple monitors like I described? Or how I can achieve this goal? Please help.

    Read the article

  • Is it possible to change the voltage on a single port on an HP ProCurve 2910al POE switch and how?

    - by hjoelr
    I have a couple of HP ProCurve 2910al POE+ switches at my company that we are primarily using to power our VOIP phones that run on 48V DC. However, I have one wireless access point that I need to run off of POE, but it has to be 24V DC. I'm afraid to plug it into the POE ProCurve because I'm not sure if it will zap the device. I'm wondering if there is a way to make sure to change the voltage on a specific port to 24V instead of the (seemingly) default value of 48V. Thanks! Joel

    Read the article

  • KVM switching on the cheap

    - by Stuart Hemming
    I have a machine at home for my personal use. I also have a machine for work. I have a pair of DVI monitors. An ideal set up for a KVM switch. Sadly the cheapest switch I can find that will switch 2 DVI monitors is nearly £300. However, I can get, for just £40, a switch for a single monitor. Is there any reason why I couldn't employ 2 of these much cheaper switches? My thought was to have the keyboard, mouse and one of the monitors in one switch and just the 2nd monitor in the 2nd switch. Logically, I can't think of a reason why this wouldn't work, but I have no real background to be able to say, definatively, whether or not it would. It it makes any difference, both machines are running Win7. Appreciate any thoughts. -- Stuart

    Read the article

  • Cascading switches: uplink to uplink?

    - by wuckachucka
    I'm a bit confused as to why I haven't seen any references online to using Switch A's uplink port (1Gbps, 24-port 10/100) to connect to Switch B's uplink port: everything I've seen -- including documentation, forums, articles, etc. -- has Switch A's uplink port going to one of Switch B's 10/100 access ports. As I understand it, the Uplink port (besides greater speed normally) is no different than another port except that it's "internally crossed-over" so that you can use a straight cable with it. I've also seen documentation on using the uplink port to connect a switch to a gateway router, or even a server, as it provides greater bandwidth than the access ports, but yet not sure why nobody seems to be cross-uplinking, even when there's 2 uplink ports available on some higher-end switches. Switch in question is Linksys SRW224P (x2). Am I missing something?

    Read the article

  • Looking for a small, portable, port-mirroring ethernet switch.

    - by user37244
    I recently had a mac go haywire, taking half a minute or more to get www.google.com loaded. Getting its owner to give up the machine for repair was like pulling teeth - they were insisting that it must be something to do with the network, since so much had changed with the local configuration at about the same time their box went haywire. I eventually set up a port mirror to a box that I could remote to so I could show that the mac was only irregularly getting packets onto the network. Demonstrating this faced an additional challenge: the latency of the remote desktop software I was using meant that I had to point to timestamps instead of just the moment the packet flashed up on the screen as my evidence. This particular user was the reason this was so challenging this time around, but I would like to have a box that I can cart from desk to desk to use wireshark on my laptop at any station where I need it. 3com, cisco, netgear, etc. (ad nauseum), all make switches that can be configured for port mirroring, but in my case, the smaller, the better. For the sake of my sanity, I'll probably end up running it off a battery anyway. If my laptop had two ethernet ports, this would be easy. So, whaddya recommand for a device that requires 0 configuration at each powerup (though I'm fine with poking at it for a while to set it up initially.) Small, light, and cheap enough to get it past purchasing? Thanks,

    Read the article

  • Can a switch consume bandwidth?

    - by aashiq
    I have a network with a router and a switch. At first my ISP's optical fiber is connected with media converter input port. Than Ethernet cable (output port of Media converter) is connected with the switch. Then an output Ethernet cable is connected with our inner Microtik router. Then this router is connected with another LAN switch. From this switch we have got every connection other switch. It is our total network structure. Our bandwidth is 2 Mbps. From the 11th of March our MRTG graph shows high all the time even when my all switch is switched off except LAN switch. That's why our line is breaking up (Voice call). How could be it possible? My all PC's bandwidth is limited but when connected PC with media converter directly then the graph shows normal. That's why I can't blame my ISP.

    Read the article

  • What's the best way to block IP spoofing on a layer 3 switch?

    - by toupeira
    We're hosting Dedicated Servers and are currently using old 3com switches with IP-based ACLs. So each port has an ACL that allows all IP addresses assigned to this customer, and blocks everything else. But now 3com was bought by HP, and the follow-up model only supports basic ACL that aren't flexible enough to both allow certain IPs while blocking others. Looking at other switches in a similar price-range, we've found that most of them have similar problems or don't offer any ACL features at all. I assume this could also somehow be done with VLANs, but if I understand this correctly we'd still need some kind of ACL to actually specify the valid IP addresses for each port. What do you use to make sure your customers don't use unassigned IP addresses? Or what switches can you recommend that have flexible ACL functionality?

    Read the article

  • WPF Binding KeyDown event to Command

    - by Daniil Harik
    Hello, I want to bind KeyDown event handler (when user presses Ctrl+C and Ctrl+V) on Telerik's GridView to RelayCommand object in my ViewModel. I know about this post http://blog.functionalfun.net/2008/09/hooking-up-commands-to-events-in-wpf.html But I'm still bit confused about implementation of my scenario. I just don't understand how it works. Could someone point out how should my scenario be implemented. Thank You very much!

    Read the article

  • actionscript - testing actionscript via command line

    - by ludicco
    Hello, I would like to know if is there any easy way to test actionscript by using some kind of application like ruby's irb or javasctip spidermonkey where you can just open up your terminal and type the code straight away. This would be a good time saver when speaking of actionscript, since to test some syntaxes, classes, etc. you would need to compile it via fsch. but still not a good option just for quick testing, etc... Cheers

    Read the article

  • How to Automate your Database Documentation

    - by Jonathan Hickford
    In my previous post, “Automating Deployments with SQL Compare command line” I looked at how teams can automate the deployment and post deployment validation of SQL Server databases using the command line versions of Red Gate tools. In this post I’m looking at another use for the command line tools, namely using them to generate up-to-date documentation with every database change. There are many reasons why up-to-date documentation is valuable. For example when somebody new has to work on or administer a database for the first time, or when a new database comes into service. Having database documentation reduces the risks of making incorrect decisions when making changes. Documentation is very useful to business intelligence analysts when writing reports, for example in SSRS. There are a couple of great examples talking about why up to date documentation is valuable on this site:  Database Documentation – Lands of Trolls: Why and How? and Database Documentation Using SQL Doc. The short answer is that it can save you time and reduce risk when you need that most! SQL Doc is a fast simple tool that automatically generates database documentation. It can create documents in HTML, Word or pdf files. The documentation contains information about object definitions and dependencies, along with any other information you want to associate with each object. The SQL Doc GUI, which is included in Red Gate’s SQL Developer Bundle and SQL Toolbelt, allows you to add additional notes to objects, and customise which objects are shown in the docs.  These settings can be saved as a .sqldoc project file. The SQL Doc command line can use this project file to automatically update the documentation every time the database is changed, ensuring that documentation that is always up to date. The simplest way to keep documentation up to date is probably to use a scheduled task to run a script every day. However if you have a source controlled database, or are using a Continuous Integration (CI) server or a build server, it may make more sense to use that instead. If  you’re using SQL Source Control or SSDT Database Projects to help version control your database, you can automatically update the documentation after each change is made to the source control repository that contains your database. To get this automation in place,  you can use the functionality of a Continuous Integration (CI) server, which can trigger commands to run when a source control repository has changed. A CI server will also capture and save the documentation that is created as an artifact, so you can always find the exact documentation for a specific version of the database. This forms an always up to date data dictionary. If you don’t already have a CI server in place there are several you can use, such as the free open source Jenkins or the free starter editions of TeamCity. I won’t cover setting these up in this article, but there is information about using CI servers for automating database tasks on the Red Gate Database Delivery webpage. You may be interested in Red Gate’s SQL CI utility (part of the SQL Automation Pack) which is an easy way to update a database with the latest changes from source control. The PowerShell example below shows how to create the documentation from a database. That database might be your integration database or a shared development database that is always up to date with the latest changes. $serverName = "server\instance" $databaseName = "databaseName" # If you want to document multiple databases use a comma separated list $userName = "username" $password = "password" # Path to SQLDoc.exe $SQLDocPath = "C:\Program Files (x86)\Red Gate\SQL Doc 3\SQLDoc.exe" $arguments = @( "/server:$($serverName)", "/database:$($databaseName)", "/username:$($userName)", "/password:$($password)", "/filetype:html", "/outputfolder:.", # "/project:$args[0]", # If you already have a .sqldoc project file you can pass it as an argument to this script. Values in the project will be overridden with any options set on the command line "/name:$databaseName Report", "/copyrightauthor:$([Environment]::UserName)" ) write-host $arguments & $SQLDocPath $arguments There are several options you can set on the command line to vary how your documentation is created. For example, you can document multiple databases or exclude certain types of objects. In the example above, we set the name of the report to match the database name, and use the current Windows user as the documentation author. For more examples of how you can customise the report from the command line please see the SQL Doc command line documentation If you already have a .sqldoc project file, or wish to further customise the report by including or excluding specific objects, you can use this project on the command line. Any settings you specify on the command line will override the defaults in the project. For details of what you can customise in the project please see the SQL Doc project documentation. In the example above, the line to use a project is commented out, but you can uncomment this line and then pass a path to a .sqldoc project file as an argument to this script.  Conclusion Keeping documentation about your databases up to date is very easy to set up using SQL Doc and PowerShell. By using a CI server to run this process you can trigger the documentation to be run on every change to a source controlled database, and keep historic documentation available. If you are considering more advanced database automation, e.g. database unit testing, change script generation, deploying to large numbers of targets and backup/verification, please email me at [email protected] for further script samples or if you have any questions.

    Read the article

  • Hiding Command Prompt with CodeDomProvider

    - by j-t-s
    Hi All I've just got my own little custom c# compiler made, using the article from MSDN. But, when I create a new Windows Forms application using my sample compiler, the MSDOS window also appears, and if I close the DOS window, my WinForms app closes too. How can I tell the Compiler? not to show the MSDOS window at all? Thank you :) Here's my code: using System; namespace JTS { public class CSCompiler { protected string ot, rt, ss, es; protected bool rg, cg; public string Compile(String se, String fe, String[] rdas, String[] fs, Boolean rn) { System.CodeDom.Compiler.CodeDomProvider CODEPROV = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp"); ot = fe; System.CodeDom.Compiler.CompilerParameters PARAMS = new System.CodeDom.Compiler.CompilerParameters(); // Ensure the compiler generates an EXE file, not a DLL. PARAMS.GenerateExecutable = true; PARAMS.OutputAssembly = ot; PARAMS.CompilerOptions = "/target:winexe"; PARAMS.ReferencedAssemblies.Add(typeof(System.Xml.Linq.Extensions).Assembly.Location); PARAMS.LinkedResources.Add("this.ico"); foreach (String ay in rdas) { if (ay.Contains(".dll")) PARAMS.ReferencedAssemblies.Add(ay); else { string refd = ay; refd = refd + ".dll"; PARAMS.ReferencedAssemblies.Add(refd); } } System.CodeDom.Compiler.CompilerResults rs = CODEPROV.CompileAssemblyFromFile(PARAMS, fs); if (rs.Errors.Count > 0) { foreach (System.CodeDom.Compiler.CompilerError COMERR in rs.Errors) { es = es + "Line number: " + COMERR.Line + ", Error number: " + COMERR.ErrorNumber + ", '" + COMERR.ErrorText + ";" + Environment.NewLine + Environment.NewLine; } } else { // Compilation succeeded. es = "Compilation Succeeded."; if (rn) System.Diagnostics.Process.Start(ot); } return es; } } }

    Read the article

  • Best way to parse command line arguments in C#

    - by Paul Stovell
    When building console applications that take parameters, you can use the arguments passed to Main(string[] args). In the past I've simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pretty ugly. More recently, I built the world's simplest Backus-Naur Form parser in C# to parse the arguments. It does the job, but it also feels like overkill. So I'm interested in: Libraries that you use Patterns that you use Assume the commands always adhere to common standards such as answered here.

    Read the article

  • Shell - Run additional command on failure

    - by Shawn
    I have this script that I am currently running that works great for all instances but one: #!/bin/sh pdfopt test.pdf test.opt.pdf &>/dev/null pdf2swf test.opt.pdf test.swf [ "$?" -ne 0 ] && exit 2 More lines to execute follow the above code ... How would I go about changing this script to run "pdf2swf test.pdf test.swf" if "pdf2swf test.opt.pdf test.swf" fails? If the second attempt fails, then I would "exit 2". Thanks

    Read the article

  • Switch or a Dictionary when assigning to new object

    - by KChaloux
    Recently, I've come to prefer mapping 1-1 relationships using Dictionaries instead of Switch statements. I find it to be a little faster to write and easier to mentally process. Unfortunately, when mapping to a new instance of an object, I don't want to define it like this: var fooDict = new Dictionary<int, IBigObject>() { { 0, new Foo() }, // Creates an instance of Foo { 1, new Bar() }, // Creates an instance of Bar { 2, new Baz() } // Creates an instance of Baz } var quux = fooDict[0]; // quux references Foo Given that construct, I've wasted CPU cycles and memory creating 3 objects, doing whatever their constructors might contain, and only ended up using one of them. I also believe that mapping other objects to fooDict[0] in this case will cause them to reference the same thing, rather than creating a new instance of Foo as intended. A solution would be to use a lambda instead: var fooDict = new Dictionary<int, Func<IBigObject>>() { { 0, () => new Foo() }, // Returns a new instance of Foo when invoked { 1, () => new Bar() }, // Ditto Bar { 2, () => new Baz() } // Ditto Baz } var quux = fooDict[0](); // equivalent to saying 'var quux = new Foo();' Is this getting to a point where it's too confusing? It's easy to miss that () on the end. Or is mapping to a function/expression a fairly common practice? The alternative would be to use a switch: IBigObject quux; switch(someInt) { case 0: quux = new Foo(); break; case 1: quux = new Bar(); break; case 2: quux = new Baz(); break; } Which invocation is more acceptable? Dictionary, for faster lookups and fewer keywords (case and break) Switch: More commonly found in code, doesn't require the use of a Func< object for indirection.

    Read the article

  • Command-line input causes SyntaxError

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in <module> phoneNumber = str(input("Please enter a phone number: ")) File "<string>", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo> By the way, I did import re and tried using rstrip in case of the \n What else could I be missing? Thanks in advance.

    Read the article

  • Bind command to X-button of window title bar

    - by LukePet
    My WPF maintenance window have a toolbar with a button "Exit"; a CommandExit is bind with this button. The CommandExit perform some checks before exit. Now, if I click to close button of the window (x-button of title bar), this checks are ignored. How can I do to bind CommandExit to window x-button?

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >