Question on || (or) operator

For example, if I'm trying to:
int num = 3;
if (num == 1 || 2) { // If num equals to 1 or 2, then num takes on value of 0
num = 0;
However I couldn't do this because || is a boolean operator, is there another way around this?

you're writing it as "if num is 1 or 2"
you need to write it as "if num is 1 or num is 2"
e.g.
if (num == 1 || num == 2) {
  num = 0;
}

Similar Messages

  • HT4623 Hi I have a question, I am operating my iPhone 4S on 6.1.1iOS, as my power button is not working, I have jailbreoked my device so that I have a option to restart and shutdown my device. If i upgrade to iOS 7 do i have such option?

    Hi I have a question, I am operating my iPhone 4S on 6.1.1iOS, as my power button is not working, I have jailbreoked my device so that I have a option to restart and shutdown my device. If i upgrade to iOS 7 do i have such option?

    Jailbreaking your iPhone forfeits your ability to receive any support on that phone, including from this forum.
    You'll have to search elsewhere for answers to your issue.

  • Question concerning WiSM operation

    I have a question concerning the operation of the wireless network and the WiSM in a 6500 that we have put in place. My customer has the following setup: On thier mainsite, they have a core 6500 with a WiSM module in place. They have 4 remote sites, with several APs at each remote site. Each remote site is setup in an all Cisco environment, where its typically AP --> cisco switch --> fiber to main site cisco switch --> core --> then on to where ever. I have an engineer telling me this, that whatever wireless data traffic (internet, anything) that hits the AP (at any site), it must go THROUGH the WiSM module. I would have thought that the WiSM module would be for ONLY management of APs, not for data traffic handling.
    Again, he says that ALL traffic (internet, etc) goes through the WiSM module, then on out through the infrastructure.
    I would have thought that traffic would go through the AP only, then through the infrastructure.
    Can you verify wheather data traffic from any wireless device through the AP actually traverses the WiSM module or not?
    Again, I thought the WiSM module would be only for management of APs. Thanks.

    The engineer is largely correct. By default, the APs will tunnel all traffic to the controller to be distributed according to VLAN/SSID. The controller and the AP work together to perform the normal wireless <-> wired bridging. This allows some flexibility in how the infrastructure handles mobile clients. There are many benefits to the Cisco Unified model (or LWAPP).
    We have three hospital campuses and only a couple remote wireless sites. They are all well-connected. As all our primary app servers are on one campus, we only have controllers on that one campus. The client traffic is bridged at the main campus.
    The Cisco Unified model does offer other modes of operation (H-REAP for example) that allow some local traffic to bypass the controller and be bridged by the AP to the local LAN. There are some caveats to this, however, and you'd want to read up on it before trying it:
    http://www.cisco.com/univercd/cc/td/doc/product/wireless/control/c44/ccfig41/index.htm
    or more specifically:
    http://www.cisco.com/univercd/cc/td/doc/product/wireless/control/c44/ccfig41/c41hreap.htm

  • Question about bit operation

    1/ I know I can use << to translate from number of index to the binary number.
    But how can I translate from binary number to number of index? (e.g. 1024 translates to 10)
    2/ How can I separate two bits in a number? (e.g. 144 translates to 128+16)
    3/ How can I know that the number exists a required bit? (e.g. check 144 if there exists 4th bit)
    Currently, I translate to binary number string first and then use indexOf and lastIndexOf methods to get the location of the bits.
    3rd question I use number==(number|10000)
    Is it any other more efficient methods to achieve that?
    Thanks.

    nwoedf wrote:
    1/ I know I can use << to translate from number of index to the binary number.
    But how can I translate from binary number to number of index? (e.g. 1024 translates to 10)Convert the number to a binary String and go through it keeping track of the 1 bit positions.
    You can use Integer.toString(1024, 2); to convert for example.
    2/ How can I separate two bits in a number? (e.g. 144 translates to 128+16)Same as the first one, then you just need to go through the bits again and translate the indices into the values.
    3/ How can I know that the number exists a required bit? (e.g. check 144 if there exists 4th bit)The & operator can be used for that for example.
    Currently, I translate to binary number string first and then use indexOf and lastIndexOf methods to get the location of the bits.
    3rd question I use number==(number|10000)
    Is it any other more efficient methods to achieve that?Why, is your computer not doing this fast enough?

  • Questions about Deployment Operations Manager 2012 R2

    Hi Folks
    Questions: I have one infrastructure with Operations Manager 2012 R2, two Management Server.
    Now, I'm trying install feature operations manager reporting in SQL Server.
    added the OMDRA and OMDWWA accounts as a local administrator of the SQL server.
    I'm using media installation Operations Manager 2012 R2, but I'm received erros, any idea? Or I need using media installation Operations Manager 2012 SP1?
    Thanks
    Wilsterman Fernandes

    Hi There,
    I had seen a similar issue here. The error log has a point mentioning " ApplyUpdates: Unable to load QFE file."
    I saw this error on this below thread as well.
    https://social.technet.microsoft.com/Forums/en-US/a10ce69e-2584-4a4d-86b9-64ee8c5bf85d/reporting-services-installation-failing?forum=operationsmanagerreporting
    He said he fully re installed the whole setup and it solved the issue.
    But i understand that is quiet difficult and complicated to do.
    =================================================
    I would suggest you check the permissions again
    1.Does your data reader and writer account have SQL permissions i.e sysadmin permissions ?
    2.Also is your SQL server in the same AD Domain or is it in a different domain ?
    3.Is the SQL Server scale of deployment joined ?
    4. Did you look in the ops manager event logs ? Can you check and post them here plz.
    5. Is the operationsmanager DB and warehouse DB as well hosted on the same SQL server where you are trying to install reporting.
    Gautam.75801

  • Question on executing operations in Background

    Hi All,
    I am building up an universal app targeting 8.1 runtime and also new to whole .NET world.
    I have some operations  in my application which I want to perform in parallel, asynchronously and also in background. These operations include file upload, download (both I/O and compute bound).
    So I wanted to execute them In threads.  I would like to process them in 3 threads. Each thread will work on the operation queue and keep waiting perpetually (in while(true) loop) unless an operation is available for execution. These threads would also
    pass task status or progress updates to UI.
    Would also like to have these threads running on Application lock or if the app suspends . If my application terminates or if the network connections is lost these threads will stop. Also would like
    to cancel the operations running in the threads according to me requirements (like cancelling a file download).
    My initial hunch was to use threads. But since threads are not available for windows store apps and my exploration about threading in Windows store apps revealed to use task to perform this.
    I read about the Tasks Asynchrony pattern (TAP) whitepaper published by MS ,channel 9 videos from Bruce Kyle and lot of other blogs. I am convinced to use Tasks .As it runs on a thread pool which
    can take advantage  of multi core processor and is better performing
    Questions on Tasks will be
    Will it be useful as background thread. Can tasks be run as a background thread perpetually.
    I don't really need my tasks to return results. The result from the operations can be relayed to UI through events.
    Do I have to schedule my tasks from a background task API when the app suspend ?
    Does the Task API fit my scenario ?
    Are Background tasks in Windows same as services in Android.  ?
    Thanks a lot and Regards,
    Saurav

    You app's threads will all suspend when the app suspends. If you need to continue running in the background you will need to register a background task.
    BackgroundUploader and Downloader are the best ways to accomplish uploading and downloading in the background.
    For other functionality in the background it depends on what specifically you need to do. Background processing is deliberately limited, but you can create Background Tasks for specific purposes. As hereafter suggested, please see
    Guidelines for background tasks

  • Question about KDM Operation

    Hi Gurus,
    I have the following issue with KDM operation while posting invoice document in MIRO t-code:
    I have a PO where value is  EUR 100 currency, then I did the Goods Receipt and then the invoice entry in MIRO also in EUR but instead of EUR100 I enter EUR130.  After posting I display the account document in USD instead of EUR and in some cases I find that all the difference is charge in a KDM account and in others in PRD operation. The exchange rate varies between the goods receipt in MIGO and the invoice entry in MIRO.
    my question is why in some cases all the difference is charge in KDM and in others examples with the same values, same material/plant, same currency and same exchange rate variation the difference is sent to a PRD account and nothing to KDM.....
    PLease advice....
    Thanks

    Hello,
    This issue was solved.
    PRD appears always when there is a difference value enters in MIRO in comparison with the goods receipt, independent of the reason. KDM, instead where there is a variation in the rate exchange between the goods receipt and the invoice registration in MIRO, when the value is equal, minor or higher than the value entered in MIGO up to the equivalent in the conversion currency . Higher than this value only PRD appears.
    Hope this will be useful for anyone of you!

  • Flashing Question Mark - Lion Operating System

    I removed my hard drive and then put it back. When I boot the computer I get a gray screen with a flashing question mark.  Info I found requires an op disk, but I have lion and it is downloaded, what do I do to get my computer to boot?

    Try this:
    Reinstalling Lion Without the Installer
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alterhatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall Lion: Select Reinstall Lion and click on the Continue button.
    Note: You can also re-download the Lion installer by opening the App Store application. Hold down the OPTION key and click on the Purchases icon in the toolbar. You should now see an active Install button to the right of your Lion purchase entry. There are situations in which this will not work. For example, if you are already booted into the Lion you originally purchased with your Apple ID or if an instance of the Lion installer is located anywhere on your computer.

  • Better practice question on sqlite operation

    Hi everyone,
    This is an open ended question, and I am sure there will be a lot of different directions on this, so here goes....
    I have a master template database (empty), that I copy to a working location.
    At this point, i need to load the working database with some items from another query of the master item list.
    the databases do not have the same fields, only an identifier that tells the application what group of items to copy from the master list and place into the working database.
    So the question is this.....
    What is the better approach to performing this operation?
    The databases are different, so an inline SQL query will not work, and my guess is that an array of items that is built from a query that performs the proper where clause and sorting, then write that array to the working database.
    Does anyone have a better approach?
    take care
    tony

    A similar approach if you do not need the data to be transferred for any other process would be to generate the SQL insert/update statement from your query and then execute the array of statements.

  • Blinking question mark/lost operating system

    My imac G3 333MHz was running on OS9.2 which was installed by an Apple store, I do not have a disk for it since it was installed in the store after I was told that I was sold the wrong memory and that OSX really shouldn't run on the machine. So to make up for the mistake they took out OSX and did a clean install of 9.2. Now (months later) the flashing question mark appeared when I started up the computer. The only way I could get the computer to work at all was to start it up from the original OS 8.6 disk that came with it. Is there any way that I can get back to 9.2 or do I have to try to purchase the disk for the old operating system? It seems like most of the folders for it are still on the Hard Drive, but no matter what I tried I can't get it to start up from them.
    imac G3 333MHz   Mac OS 8.6 or Earlier  

    I'd be a bit annoyed at the apple store who did this for you. OS X works fine on that model iMac, up through 10.3. So if you ahd that installed, it was fine. i don't know what the memory issue was they were reffering to. I don't know how you can be sold the wrong memory if it fit and worked, and what bearing that had on OS X.
    To reinstall 9.2, you would have to buy it. No way around it.
    But there's a deeper problem potentially. Often times when the OS just goes MIA like this, the problem is directory damage. Run disk first aid fromt he 8.6 disk. Does it return any errors that it can't fix. If so, more often than not, this is a corrupt directory. This could be solved by reformatting (erasing everything), or using third party utilities like diskwarrior. if you use a third party utility, it can often bring the whole thing back to life with no further problems.
    Note that if you do have directory problems, reinstalling the OS without fixing those problems will only make it worse.

  • Question regarding container operations in BPM

    Hi there,
    i used a container operation to retreive a value from an Idoc, later in the process i need to put that value to a different message on a specified field, the thing is the container operation box only allows me to set a container as the target, any ideas how can i do this?, or if this should be done in a message mapping??, thanks!!
    Roberto.

    Hi if you can use a variable in a mapping use this code and write and UDF function
    Set the Variable
       import com.sap.aii.mappingtool.tf3.rt.*
        public static void setGlobalVar(String gvName , String gvValue , Container container) {       
            GlobalContainer gc = container.getGlobalContainer();
            gc.setParameter(gvName, gvValue);
    Get the variable
        public static String getGlobalVar(String gvName , Container container) {
            GlobalContainer gc = container.getGlobalContainer();
            String output = "";
            if (gc.getParameter(gvName) != null)
                output = String.valueOf(gc.getParameter(gvName));
            return output;

  • A quick question  of Logical Operator - NOT?

    I know that the logical operator for NOT is " ! " sign.
    But someone could please tell me how do I use the NOT operator in the below code.
    if (c instanceof JLabel) Thanks

    Before you use this, think long and hard if there's a better way to
    achieve your goal than wandering through all of a panel's
    components checking for those that aren't JLabels.
    import javax.swing.*;
    public class Not {
         public static void main(final String[] argv) {
              final JComponent panel = new JPanel();
              if (!(panel instanceof JLabel)) {
                   System.out.println("It works.");
    }

  • Stupid questions about float operation

    Hi guys.
    I have this code:
    public class Stupida{
         public static void main(String args[]){
              float uno = 14.8210f;
              float due = 14.7110f;
              System.out.println("" + uno + " - " + due + " = " + (uno-due));
    and this is the output:
    14.821 - 14.711 = 0.10999966
    Why the result it's not 0.110????
    I tried with double, but the problem's the same.
    I tried to use the "strictfp" modifier, but the compiler doesn't recognize it.
    What should I do to get the exact result?
    Thanx,
    Pierlu.

    and this is the output:
    14.821 - 14.711 = 0.10999966
    Why the result it's not 0.110????Because floating-point calcuations are inherently imprecise.
    I tried with double, but the problem's the same.If you use double, the answer should be more accurate - you still can not expect it to be precise.
    I tried to use the "strictfp" modifier, but the
    compiler doesn't recognize it.Then you should get a new compiler.
    Even so, the result you have posted is what I got using the strictfp modifier.
    What should I do to get the exact result?I'm not going to go into detail because there are many threads in the forums that already cover this, and there's plently of good technical explainations on the Web - you just have to do a couple of simple searches.
    In short, there are a couple of ways to get correct results. The safest is to use BigDecimal. Another (faster) option is to perform all your calculations using int or long, and keep track of where the decimal point should be, then add it in afterwards for display purposes (however, this requires a prior knowledge of a bounding range in which the figures you are operating on lie).

  • Question for latest Opera 10.53 users, if I may...

    I do not know if this is the proper forum for other browsers, but I will ask anyway:
    How does one highlight text in Opera? In Safari, one goes to anywhere in the middle of text, clicks the mouse to begin highlighting, goes to the end of the text and shift-clicks; anything in between is highlighted. Not so in Opera (at least that I am aware of).
    I know that you can click at the start of the text, hold the mouse down and scroll to the end of where you want it. That is not what I want.
    Any help is appreciated.

    HI,
    This may help. http://www.ehow.com/how2315888take-notes-opera-browser.html
    Carolyn

  • Question on ASM operation

    Hi,
    i am using oracle 11gR1 and ASM as storage option. user sys is ASM admin but i am not able to access ASM instance with sys user. if i do su oracle then i can access asm instance , do asm dg operation etc. i thought ASM admin is the one who can do execute some operation on asm instance and asm dg etc. should i always use "oracle" user for ASM operation . cant i use "sys" user for this. Please share your view on this.
    Thanks for your help,

    user11305560 wrote:
    is it possible to make one OS user owner of crs and make one OS user admin of ASM instance. i believe the CRS owner will have permission to do ASM administration also. Following is the error message, i am getting when i am doing su sys.
    $ export ORACLE_SID="+ASM1"
    $ su sys
    $ sqlplus '/ as sysdba'
    SQL*Plus: Release 11.1.0.6.0 - Production on Thu Nov 5 20:19:45 2009
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    ERROR:
    ORA-01031: insufficient privileges
    Enter user-name: sys
    Enter password:
    ERROR:
    ORA-15000: command disallowed by current instance type
    ############################################3
    when i do su oracle it works fine.
    $ su oracle
    $ sqlplus '/ as sysdba'
    SQL*Plus: Release 11.1.0.6.0 - Production on Thu Nov 5 20:21:05 2009
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    SQL>If you install ASM by "oracle" user, you should use "oracle" to connect ASM as sysdba

Maybe you are looking for

  • How do I download video from my Sony Handycam recorder to my macbook pro ?

    How do I download video from my Sony Handcam Video Recorder (DCR-SX44) to my macbook pro, using imovie? Seems like it was meant to work with a PC (lots of info and a CD for PC use...instructions to contact Apple for macs!)  I've saved video to both t

  • IPod officially Dead, how much does it cost to repair?

    i accidentally dropped my iPod in water for about 2 seconds and i dry it out. my mum said it will work but it doesn't! i think the water wiped it blank. it won't do anything at all! light flashed on when i put head phones in but now it's legally dead

  • Two licence servers in one environment

    Hi, Is it possible to install two licence servers in one environment and point some of the users to one licence server and others to another. Is there where i can change on the local PC to point to a licence server. My assumption is that it is stored

  • How to calculate with Characteristics

    Hi, we working in Reporting with SAP BW 3.1 release 3.1. In the report we need to show a column in the Bex-report, which show the Key Figure. The problem we have is that the Key Figure has to be multiply with a factor. The Factor is delivered as a ke

  • Cannot get photoshop to print hi-def images

    For the last week I have not been able to find the print settings for hi-def printing in photoshop. They disappeared after the last software update. This problem appears on my Macbook and on my imac as well. Can any one advise? I have  Cs4 and it has