Search Results

Search found 8673 results on 347 pages for 'kvm switch'.

Page 15/347 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Strange behaviour of switch case with boolean value

    - by Nikhil Agrawal
    My question is not about how to solve this error(I already solved it) but why is this error with boolean value. My function is private string NumberToString(int number, bool flag) { string str; switch(flag) { case true: str = number.ToString("00"); break; case false: str = number.ToString("0000"); break; } return str; } Error is Use of unassigned local variable 'str'. Bool can only take true or false. So it will populate str in either case. Then why this error? Moreover this error is gone if along with true and false case I add a default case, but still what can a bool hold apart from true and false? Why this strange behaviour with bool variable?

    Read the article

  • Why Switch/Case and not If/Else If?

    - by OB OB
    This question in mainly pointed at C/C++, but I guess other languages are relevant as well. I can't understand why is switch/case still being used instead of if/else if. It seems to me much like using goto's, and results in the same sort of messy code, while the same results could be acheived with if/else if's in a much more organized manner. Still, I see these blocks around quite often. A common place to find them is near a message-loop (WndProc...), whereas these are among the places when they raise the heaviest havoc: variables are shared along the entire block, even when not propriate (and can't be initialized inside it). Extra attention has to be put on not dropping break's, and so on... Personally, I avoid using them, and I wonder wether I'm missing something? Are they more efficient than if/else's? Are they carried on by tradition?

    Read the article

  • Ruby switch like idiom

    - by Eef
    Hey, I have recently started a project in Ruby on Rails. I used to do all my projects before in Python but decided to give Ruby a shot. In the projects I wrote in Python I used a nice little technique explained by the correct answer in this post: http://stackoverflow.com/questions/277965/dictionary-or-if-statements-jython I use this technique due to Python not having a native switch function and it also get rid of big if else blocks I have been trying to do recreate the above method in Ruby but can't seem to quite get it. Could anyone help me out? Thanks Eef

    Read the article

  • code optimization; switch versus if's

    - by KaiserJohaan
    Hello, I have a question about whether to use 'case' or 'ifs' in a function that gets called quite alot. Here's the following as it is now, in 'ifs'; the code is self-explanatory: int identifyMsg(char* textbuff) { if (!strcmp(textbuff,"text")) { return 1; } if (!strcmp(textbuff,"name")) { return 2; } if (!strcmp(textbuff,"list")) { return 3; } if (!strcmp(textbuff,"remv")) { return 4; } if (!strcmp(textbuff,"ipad")) { return 5; } if (!strcmp(textbuff,"iprm")) { return 6; } return 0; } My question is: Would a switch perform better? I know if using ifs, I can place the most likely options at the top.

    Read the article

  • Using switch and enumerations as substitute for named methods

    - by MatthewMartin
    This pattern pops up a lot. It looks like a very verbose way to move what would otherwise be separate named methods into a single method and then distinguished by a parameter. Is there any good reason to have this pattern over just having two methods Method1() and Method2() ? The real kicker is that this pattern tends to be invoked only with constants at runtime-- i.e. the arguments are all known before compiling is done. public enum Commands { Method1, Method2 } public void ClientCode() { //Always invoked with constants! Never user input. RunCommands(Commands.Method1); RunCommands(Commands.Method2); } public void RunCommands(Commands currentCommand) { switch (currentCommand) { case Commands.Method1: // Stuff happens break; case Commands.Method2: // Other stuff happens break; default: throw new ArgumentOutOfRangeException("currentCommand"); } }

    Read the article

  • Switch statement for string matching in JavaScript

    - by yaya3
    How do I write a swtich for the following conditional? If the url contains "foo", then settings.base_url is "bar". The following is achieving the effect required but I've a feeling this would be more manageable in a switch: var doc_location = document.location.href; var url_strip = new RegExp("http:\/\/.*\/"); var base_url = url_strip.exec(doc_location) var base_url_string = base_url[0]; //BASE URL CASES // LOCAL if (base_url_string.indexOf('xxx.local') > -1) { settings = { "base_url" : "http://xxx.local/" }; } // DEV if (base_url_string.indexOf('xxx.dev.yyy.com') > -1) { settings = { "base_url" : "http://xxx.dev.yyy.com/xxx/" }; } Thanks

    Read the article

  • C: switch case with logical operator

    - by Er Avinash Singh
    While I am new to c and want help in this program my code is : #include<stdio.h> #include<conio.h> void main(){ int suite=2; switch(suite) { case 1||2: printf("hi"); case 3: printf("byee"); default: printf("hello"); } printf("I thought somebody"); getche(); } I am working in turbo c and it shows no error and the output is helloI thought somebody Please, let me know how is this working ??? note :- here break is not the case as I intentionally left them.

    Read the article

  • switch statement with returns -- code correctness

    - by houbysoft
    Hi, let's say I have code in C with approximately this structure: switch (something) { case 0: return "blah"; break; case 1: case 4: return "foo"; break; case 2: case 3: return "bar"; break; default: return "foobar"; break; } Now obviously, the "break"s are not necessary for the code to run correctly, but it sort of looks like bad practice if I don't put them there to me. What do you think? Is it fine to remove them? Or would you keep them for increased "correctness"?

    Read the article

  • What is the best way to connect a 3 switches with a router?

    - by Carlos Morales
    Hello everyone, I'm trying to rebuild the network from my work and I was thinking what is the best way to connect three switches and a router. The router has 4 ports so I thought to connect 2 switches to the router (each switch connected with 2 cables to the router) and then connect the third switch to one of the others with two cables. So is like this, two cables from switch one to the router, two cables from switch two to the router and two cables from switch 3 to switch 1 or 2. So my questions are: Is it better to connect the router to each switch with a cable or the more cables you have the better? If I connect the switch 3 to switch 1 or 2 is it better to connect it with a cable or you get better performance with more cables. If I'm wrong and there is a better or more efficient way to connect them please let me know. The router is a Netgear RP114 (I'll upgrade it to a Sonicwall NSA 240), switch 1 is a Netgear GS748T, switch 2 is a Cisco Catalyst 2924-XL and switch 3 is a D-link DGS-1024D Thank you very much

    Read the article

  • What is the best way to connect 3 switches with a router?

    - by Carlos Morales
    Hello everyone, I'm trying to rebuild the network from my work and I was thinking what is the best way to connect three switches and a router. The router has 4 ports so I thought to connect 2 switches to the router (each switch connected with 2 cables to the router) and then connect the third switch to one of the others with two cables. So is like this, two cables from switch one to the router, two cables from switch two to the router and two cables from switch 3 to switch 1 or 2. So my questions are: Is it better to connect the router to each switch with a cable or the more cables you have the better? If I connect the switch 3 to switch 1 or 2 is it better to connect it with a cable or you get better performance with more cables. If I'm wrong and there is a better or more efficient way to connect them please let me know. The router is a Netgear RP114 (I'll upgrade it to a Sonicwall NSA 240), switch 1 is a Netgear GS748T, switch 2 is a Cisco Catalyst 2924-XL and switch 3 is a D-link DGS-1024D Thank you very much

    Read the article

  • Switch/case without break inside DllMain

    - by Sherwood Hu
    I have a Dllmain that allocates Thread local storage when a thread attaches to this DLL. Code as below: BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { LPVOID lpvData; BOOL fIgnore; switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: onProcessAttachDLL(); // Allocate a TLS index. if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE; // how can it jump to next case??? case DLL_THREAD_ATTACH: // Initialize the TLS index for this thread. lpvData = (LPVOID) LocalAlloc(LPTR, MAX_BUFFER_SIZE); if (lpvData != NULL) fIgnore = TlsSetValue(dwTlsIndex, lpvData); break; ... } I know that for the main thread, the DLL_THREAD_ATTACH is not entered, as per Microsoft Documentation. However, the above code worked. I am using VC2005. When I entered the debugger, I saw that after it entered DLL_THREAD_ATTACH case when ul_reason_for_call = 1! How can that happen? If I add `break' at the end of DLL_PROCESS_ATTACH block, the DLL failed to work. How can this happen?

    Read the article

  • Just a small help about switch's use

    - by Laurent Fournier
    If an answer on this already exist, my apologies i've not found on this question... is this statement correct if i want presice actions on integers from -2 to 0, and for those between 1 and 6 apply the same methods with only my integer who'll change ? Like this: public void setCaseGUI(Point pt, int i, boolean b){ plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setSelected(b); plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setIcon(null); switch(i) { case -2: plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setText("F"); plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setForeground(Color.red); break; case -1: plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setText("B"); plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setForeground(Color.red); break; case 0: plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setText(""); plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setForeground(null); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setText(String.valueOf(i)); plateau.cellule[(int)pt.getAbs()][(int)pt.getOrd()].setForeground(null); break; default: System.out.println("Erreur de changement d'état/case !"); } } Please don't be too harsh on me i've started to learn dev only a few month ago

    Read the article

  • Are there any generic KVM over IP cards/chips for motherboards without any such capability?

    - by eek142
    I have a remote server that doesn't have any IP KVM capabilities, meaning I can't remotely power cycle it or access the BIOS. I saw that ASUS offers something for their motherboards here: http://www.asus.com/Server_Workstation/Accessories/ASMB5iKVM/ But is there anything like this available for other motherboards? Even something that I could stash away somewhere in a hard drive bay that simply plugs into the board would be great.

    Read the article

  • How do I create a bridged virtual network for libvirt+KVM+ubuntu-server the easy way?

    - by Arthur Ulfeldt
    I see lots of documentation on how to manually set up a network bridge and then manually add vm's tun devices to these bridges and then write a shell script that glues it all together. lots of work, very manual, and not impressive. On the other hand if you want to use NAT to KVM+libvirt VMs to the network you just click the new network button in the virt-manager gui and relax. Am I missing "the easy way" of causing a VM to share the physical network with the host?

    Read the article

  • How to Install KVM and Create Virtual Machines on Ubuntu

    - by Chris Hoffman
    If you’re using Linux, you don’t need VirtualBox or VMware to create virtual machines. You can use KVM – the kernel-based virtual machine – to run both Windows and Linux in virtual machines. You can use KVM directly or with other command-line tools, but the graphical Virtual Machine Manager (Virt-Manager) application will feel most familiar to people that have used other virtual machine programs. How to Banish Duplicate Photos with VisiPic How to Make Your Laptop Choose a Wired Connection Instead of Wireless HTG Explains: What Is Two-Factor Authentication and Should I Be Using It?

    Read the article

  • Switch Statement C++ - error C2046: illegal case, error C2043: illegal break

    - by user318095
    #include <iostream> #include <string> using namespace std; //void multiply(int b); int main() { float total = 0; float b = 0; cout << "Enter number: " << endl; cin >> b; char TorD; cout << "Would you like to times (*), divide (/), add (+) or minus (-) this number?" << endl; cin >> TorD; switch (TorD) case '*' : { int c=0; cout << "by how many?" << endl; cin >> c; total = b * c; cout << b << " * " << c << " = " << total << endl; } break; case '/' : { int c=0; cout << "by how many?" << endl; cin >> c; total = b / c; cout << b << " / " << c << " = " << total << endl; } break; case '+' : { int c=0; cout << "by how many?" << endl; cin >> c; total = b + c; cout << b << " + " << c << " = " << total << endl; } break; case '-' : { int c=0; cout << "by how many?" << endl; cin >> c; total = b - c; cout << b << " - " << c << " = " << total << endl; } break; default: cout << "You did not correctly enter /, *, +, or - !!" << endl; //multiply(b); system("pause"); return 0; }

    Read the article

  • Why do I need a managed switch and which one should I buy?

    - by ascanio1
    I bought a 2nd router and I want both routers to have direct WAN access to the modem. One of the 2 routers directs VOIP traffic to a telephone line port. This VOIP service is provided by the cable carrier which also leases the modem & the router. The cable company technician told me that this VOIP line uses IPv6 addressing and therefore I must employ an IPv6 capable/compliant Giga Hub/Switch or my telephone line won't work anymore. Pls advise me (brand/model) an IPv6 compliant, 2 port, switch to purchase. Pls educate me: By reading this forum I thought that hubs broadcast traffic to all ports, regardless of which input/output is being used and so, theoretically, they have nothing to do with IP. Correct? Same story for unmanaged switches, where the only difference is that these latter devices route traffic only to those ports which are detected to be in use. Correct? I also understood that unmanaged switches route traffic simply by detecting hardware use and not by selecting specific IP traffic. Correct? Finally, there are managed switches which DO select traffic based on IP and, therefore, only these managed switches are involved with IPv6... Why would my cable company explicitly tell me, over and over, that I must use an IPv6 compliant switch? Why would they need a managed switch instead of an unmanaged one? Thanks in advance for helping me understand!

    Read the article

  • Why Would one VLAN have no Communication on one Switch?

    - by Webs
    So the problem is we have a device or host that needs to communicate on a specific VLAN. This VLAN is not new, it is running all throughout our environment and works fine. But the VLAN was recently configured on the switch in question, a Cisco 3750. The DHCP server is handing out addresses on that VLAN with no problem. I have verified the cable between the host and switch and tried multiple hosts, but none of them can communicate or get an address. I plugged my laptop into an empty port which had a different VLAN assigned and immediately got a DHCP address. When I changed that port to the same VLAN I'm having issues with I got the same problem. The laptop just sits there and tries to DHCP an address but nothing happens. I double checked the cores and their Layer 3 VLAN config and its fine too. Plus I figured the issue couldn't be with them because the VLAN works fine everywhere else it exists. So the only other thing I can think of is the switch, but the VLAN exists on the switch and seems to be configured correctly. The trunks appear to be configured just fine as well too. Anyone have any ideas? I'm lost on this one.

    Read the article

  • What are my options in replacing the noisy fan in my Linksys Cisco SRW2008P managed GigE switch?

    - by Fred Sobotka
    My first managed GigE switch, the Linksys SRW2008, was a dream, until it started randomly chattering on various ports. That started while I was on the road all the time, which made it take forever to diagnose, but that's a different problem. When I finally determined that the switch was bad, it was still covered by warranty by Linksys/Cisco, so I opened an RMA ticket and returned it. Unfortunately, Linksys/Cisco "upgraded" my replacement switch to a SRW2008P, which has Power over Ethernet features I never planned on using. That by itself wasn't so bad, but it's my guess that the inclusion of PoE functions in this model required a tiny, super-loud internal fan to keep everything cool. This wasn't something I wanted or asked for, but, now that I am stuck with it, I am investigating options for replacing that little internal fan with something far quieter. For example, if I attach a larger fan to the outsite of the chassis, I think it could push enough air to replace the stock fan that is currently there. Any advice on carrying this out? I have no interest in melting my switch due to insufficient ventilation.

    Read the article

  • Possible to use LVM partitions inside a vmbuilder created KVM virtual machine?

    - by Tauren
    I have an Ubuntu 9.10 host system with LVM partitions running KVM. I've been creating VMs using vmbuilder using LVM partitions for each VM instead of files for the VMs. When I configure a VM using vmbuilder --part, the partitions in the file I'm using are created as regular partitions (sda1, sda2, etc.). What I'd like to do is use LVM inside of the VM in case I need to resize the partitions at some point. But I don't see any options for doing that using the vmbuilder tool. It seems like this might be a common request to avoid using kpartx, etc. Is there something I'm missing, or is this just not possible with vmbuilder?

    Read the article

  • Can KVM CPU assignment count differ from physical hosts CPU count?

    - by javano
    I have read this question. I knew already that I could for example, have a quad core machine with four guests each having two vCPUs. As they don't all be require 100% CPU usage all the time, the scheduler would handle this for me. My question is about how this relates to a fail-over or migration situation; If host1 has two dual-core CPUs, and I assign guest1 four vCPUs (so it accessed all four physical cores), what will happen if I try and migrate it to host2 which only has one dual-core CPU? Can qemu-kvm emulate more vCPUs than there are physical? Or would I have to shut down the virtual machine, change the CPU assignment, migrate it, and then boot it back up (so no live migration)? Many thanks.

    Read the article

  • Shared FC LVM VG with LVs for each KVM VM. Clvm required?

    - by Cocoabean
    I have 2 virtual machine hosts running Ubuntu 12.04 and KVM managed with libvirt. They are both connected to the same VG which is a LUN on my SAN over FC. I provision LVs on this shared VG for each VM. I don't think I need HA or failover, but I do want live migration between the hosts. Do I need clvm in this case? As long as I don't try to start the same VM on each host should this work? Clvm requires lots of overhead with clustering tools that I don't think I need. I can deal with manually restarting VMs on other hosts in the event of a hardware failure.

    Read the article

  • How to test KVM guest CPU maximum allocation limit?

    - by Ace
    Running Ubuntu 13.04 Host and vm Guest. Using virtio for hdd, nic. Max-allocaion CPU cores is 6, minimum is 2. Ive made a vm with virt-manager just to play with, and to test out kvm. Alright, I have a decent understand how the memory balloon driver works, but I still dont know how to test if the guest OS can utilize the max setting for cpu cores. From what i gather, the host will start one thread of qemu for each core allocated per vm. When i run htop inside the guest, it only shows two cores. (also here is the output of cat /proc/cpuinfo: https://gist.github.com/anonymous/93a361545130923537da ) How can I "force" the guest to allocate the other 4 cores so that it can show 6 cores in htop? Is there a way to do this?

    Read the article

  • Is there no such thing as a Gigabit switch?

    - by Torben Gundtofte-Bruun
    According to the manufacturer specification, even my rather plain desktop computer has "Gigabit Ethernet". So when I want to copy large files over the LAN (not Internet) it would make sense to have a gigabit switch. I'm searching eBay for a gigabit switch for a planned home network upgrade. The products I find are all labeled "gigabit" but they all have 24 x 10/100Mbit autosensing ports and sometimes 2 x 10/100/1000Mbit autosensing ports. It was my understanding that 10/100 is ancient and that modern computers have network interfaces that work with 1000Mbit, so it would make sense to get a switch that has 24 x 1000Mbit ports. Did I misunderstand, or are sellers (deliberately?) mislabeling older hardware? (Let's not dive into wired vs. wireless networks and how "N" wireless is fast. You'd be right, but not answering the question.)

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >