How to grab a certain number of bits

hi,
I have a 32 bit number, and I want to grab the second byte only, so from:
00001000 00000000 01001011 00100101
I want my variable q = 01001011, how do I do this?
many thanks, Ron

Hi, hmm, I still seem to be getting an error though (or a value that I am not expecting!).
So this is what I am doing:
q = (m_d2.getCardIntVal(j)>>>8)&0xFF;
r = (m_d2.getCardIntVal(k)>>>8)&0xFF;
s = q|r;
System.out.println(...Ok, it seems fine, but when I examine the values I get this (printing out the output):
Three of Spades 17 Ten of Spades 24 combined value = 25
10001 11001
Three of Spades 17 Jack of Spades 25 combined value = 25
10001 11010
Three of Spades 17 Queen of Spades 26 combined value = 27
10001 11011
Three of Spades 17 King of Spades 27 combined value = 27
10001 11100
Three of Spades 17 Ace of Spades 28 combined value = 29
10001 100000
Three of Spades 17 Deuce of Hearts 32 combined value = 49
10001 100001
Three of Spades 17 Three of Hearts 33 combined value = 49
Is it because something is happening when the values are being | together because they are of different sizes?
What I am doing is going through the deck generating all the 2 card combinations, and trying to generate a distinct value for each pair type, for example any suited jack/queen combination should generate the same value, whereas an an offsuit jack/queen would have a different value. Anyway, I just don't get why the three of spades, and deuce of hearts pair give me a value of 49, and so does the three of spades and three of hearts combo!
This is getting annoying! Many thanks, Ron

Similar Messages

  • How to display a certain number of channels...

    Hi!
    I am using LabVIEW 8.5 and I am trying to display a certain number of channels using multiple channels ...
    I can display them in a graph, but I am displaying the 16 analog input channels
    that NI 6024E have and I need to display only the channels that have something
    connected to them (I do not know which channel will have something connected to
    it). If they have a signal (temperature), I will like to display that channel/s in a graph and save that  channel/s in a txt file. If not
    I do not want to show or save the channel/s.
    How can I do that using DQA Assistance?
    I am able to do all this using one channel, I can display in
    a graph, I can save it in a txt file, but I am not able to do it for n number
    of active channels only. Any advice or suggestion will be appreciated.
    Sincerely,
    Julieta.
    Solved!
    Go to Solution.

    Hi,
    I am trying to give the user the opportunity of selecting how
    many channels he/she want to connect to the board… Now I only have two channels and I know what
    those channels are, but I want to do something that allow the user to select
    the channels that he/she needs (maybe the 16 or maybe only 3 or 7). I saw that
    in older versions of Labview there exists in Analog Input a “AI MULT PT” that
    maybe could allow me to input there specific channel (I am using 8.5 version of LabView).
    I am doing this to detect the channels, but it is not even
    close of how it supposes to be, because the user can not select… I just want to
    display the channels the user select and calculate the mean only for those
    channels.
    Any suggestion advice will be appreciated…
    Sincerely,
    Julieta.
    P.D.: My English is not so good…
    Attachments:
    Temperature.PNG ‏15 KB

  • How can i find a total of minutes from and to a certain number

    I need to track the amount of time to and from a certain number on my cell phone. How do I do that?

    Log in, as klue said, and once you are viewing the details for the line, click the heading of the column where the phone number is listed.  That should sort the column, so all the calls to and from that specific number are at least grouped together, making it easier to add up.
    You can also download all the details to a spreadsheet, and depending on your Excel skills, pull the data out and total up the minutes.
    If you are looking for a button or other quick tool to get the info, it isn't there.  You have to manipulate the data yourself.

  • How to get checkbox checked when sum equals a certain number

    I have created a spreadsheet with 25 rows that will have numerical entries. How do I put in a checkbox that becomes checked once the sum of the numbers Un that row equals a certain number?
    Thanks in advance.

    A hack would be to use CHAR. You have thousands of symbols to choose from. I scanned through some and found a check (there are many more which might better fit your needs).
    So, if your numbers are listed in B1:B25 and 100 is your magic number, then:
    =IF(SUM(B1:B25)=100, CHAR(10004), "")
    or something like:
    =IF(SUM(B1:B25)=100, CHAR(10004), CHAR(10063))

  • How to block call from certain number -Iphone 4?

    How to block call from certain number -Iphone 4?

    Also try searching for apps that can do this. Never heard of it before but there should be one around.

  • I need to block a certain number from my daughters phone and need to know how to do it, help?

    I need to block a certain number from my daughters phone and need to know how to do it, help?

    Go on your account and under where it says plan, there is a tab for blocking calls but the block only lasts for 30days i think or more. You may have to re-apply the block if needed.

  • How do I send out a certain number of pulses

    I am using the E-Series DAQ board, and in my programing I have three stages, I need to send out a certain number of pulse depending on the stage selected. For example if stage one is selected 30 pulses will be sent out and thats it. The pulses will be used to move a stepper motor. The stepper motor is a linear stepper so the pulses will be used to move the shaft 1 inch or 3 inches, depending on the stage selected.

    It sounds like you want to generate a "Finite Pulse Train". Depending on which programming language you intend to implement this with (LabVIEW, LabWindows/CVI, Measurement Studio for Visual Basic or C++), we probably already have an example written. From our website at www.ni.com simply search for Finite Pulse Train. You will want to only use examples that have been written for the DAQ-STC chip, which our E-Series DAQ devices leverage.
    The finite pulse train examples will show you how to output a finite pulse, of say 30 pulses, as well as configure the frequency and duty cycle.
    Regards,
    Justin Britten
    Applications Engineer
    National Instruments

  • How to calculate standard deviation of a certain number of points?

    Hi, I have an application that I acquire force signals and pu then on a array.
    I need to calculate the standard deviation and the mean each a certain number of points, 1000 for example.
    I'm having problems with this, if you can help me I'd be thankful.
    Thanks
    Douglas
    Solved!
    Go to Solution.

    So you need something like this?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Std_Deviation.png ‏12 KB

  • Use hardware to generate a certain number of pulses using PXI-5652

    Is it possible to generate a certain number of periods (turn on the output for a predetermined amount of time using hardware with micro-second resolution) using the PXI-5652.

    Hello Matt,
    If you had a Vector Signal Generator, this would be more controllable using something similar to this forum.
    Otherwise, the only way to control time on the 565x would be to use OOK modulation scheme. This will allow you to turn on the signal for a little time On and Off.
    There is a shipped example called "565x Digital Modulation.vi" (on versions 1.3 and later of the RFSG driver) that can perform this task. Basically it uses the function named "niRFSG Configure Digital Modulation User Defined Waveform.vi" to write the user bit sequence and with property nodes you will configure the OOK scheme and the symbol rate (refer to specifications of your card for the possible values).
    Hope this helps,
    Gerardo O.
    RF Systems Engineering
    National Instruments

  • I'm using acrobat pro in my project after debuging the project and after opening a certain number of PDF files I receive the message: the maximum number of files opened has been reached, you have to close some files to continu.even doing that, I steel rec

    I'm using acrobat pro in my project after debuging the project and after opening a certain number of PDF files I receive the message: the maximum number of files opened has been reached, you have to close some files to continu.even doing that, I steel receive the same message.Some one can tel what to do please? Thanks

    Hi Memalyn
    Essentially, the bare issue is that you have a 500GB hard drive with only 10GB free. That is not sufficient to run the system properly. The two options you have are to move/remove files to another location, or to install a larger hard drive (eg 2TB). Drive space has nothing to do with SMC firmware, and usually large media files are to blame.
    My first recommendation is this: download and run the free OmniDiskSweeper. This will identify the exact size of all your folders - you can drill down into the subfolders and figure out where your largest culprits are. For example, you might find that your Pictures folder contains both an iPhoto Library and copies that you've brought in from a camera but are outside the iPhoto Library structure. Or perhaps you have a lot of purchased video content in iTunes.
    If you find files that you KNOW you do not need, you can delete them. Don't delete them just because you have a backup, since if the backup fails, you will lose all your copies.
    Don't worry about "cleaners" for now - they don't save much space and can actually cause problems. Deal with the large file situation first and see how you get on.
    Let us know what you find out, and if you manage to get your space back.
    Matt

  • How do I limit the number of rows retrieved at a time using RefCursor?

    I have a PL/SQL package in use, that returns a REF CURSOR. This is currently being used in a Forms 6i application. Now I want to develop an ASP.NET web application that displays exactly the same information as my Forms 6i module. In fact those two applications will be used concurrently for a while.
    I looked at the sample code provided on otn.oracle.com and decided to use the OracleDataAdapter.Fill()-method to fill a dataset and bind that dataset to a pageable GridView. Now I wonder, whether this method retrieves ALL records of the query at once and how I can limit the number of rows fetched? The Select statement retrieves up to 10000 rows at a time. Most of the time, a user is only interested in the first 20-30 rows. Forms 6i fetches more rows as the user scrolls down, how can I implement the same behavior in ODP.NET?
    - Markus

    Excuse me, but the reply does not quite answer my question. Maybe I did not explain my concerns clear enough:
    I understand the use of the two properties (RowSize and FetchSize) to reduce the amount of round trips needed to transfer the data - not the number of rows fetched in total. This would still lead to a situation where all rows are transferred, when I am using the OracleDataAdapter.Fill()-Method. Is this correct or did I misunderstand the function of this method?
    I quote the otherwise really helpful article you send me:
    Of course, there is a cost if the fetch size is arbitrarily large. More client-side memory and processor cycles will be needed to store and manage a larger amount of data. The goal is to find a high-performing balance between the number of round trips and the amount of data retrieved per trip.
    My RowSize is for sure a bit larger than the one in the given example. The query will probably be used by up to 100 users at a time, so I would like to limit the resource-costs not only on the network by the number of round trips, but also on the web-server which is storing all these records in it's memory per user-request.

  • How do I find the number of physical CPUs , number of cores in OEL ?

    In RHEL , it is easy to find the number of Physical CPUs and the number of cores within each CPU
    -- Ouput from Red Hat Enterprise Linux 5.4
    -- This a real machine. Not a VM
    $ cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 46
    model name      : Intel(R) Xeon(R) CPU           X7550  @ 2.00GHz
    stepping        : 6
    cpu MHz         : 1995.048
    cache size      : 18432 KB
    physical id     : 0              --------------> This will give info on the physical CPU
    siblings        : 8
    core id         : 0
    cpu cores       : 8              --------------> This will give the number of cores within a CPU
    apicid          : 0
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm
    bogomips        : 3990.09
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 44 bits physical, 48 bits virtual
    power management: [8]Output from Oracle Linux . Physical CPU Id and Number of Cores info is missing.
    -- Output from Oracle Enterprise Linux 6.3
    -- This is a virtual machine created using Virtual Box
    -- Processor ID , number of cores is missing
    $ cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 42
    model name      : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
    stepping        : 7
    cpu MHz         : 2298.627
    cache size      : 6144 KB
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good nopl pni monitor ssse3 lahf_lm
    bogomips        : 4597.25
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 36 bits physical, 48 bits virtual
    power management:Is this the expected output in Oracle Enterprise Linux ? If so, how can I find the number of Physical CPUs and the number of cores within a Physical CPU in OEL?
    Is this info missing because I am running OEL in a virtual machine ?

    Oracle Linux behaves exactly like Red Hat in this matter an /proc/cpuinfo can be used for that. I guess this is because you have set up VirtualBox to only assign one virtual CPU to your guest Linux.
    processor     : 0
    vendor_id     : AuthenticAMD
    cpu family     : 15
    model          : 33
    model name     : Dual Core AMD Opteron(tm) Processor 275
    stepping     : 2
    cpu MHz          : 1000.000
    cache size     : 1024 KB
    physical id     : 0
    siblings     : 2
    core id          : 0
    cpu cores     : 2
    apicid          : 0
    initial apicid     : 0
    fpu          : yes
    fpu_exception     : yes
    cpuid level     : 1
    wp          : yes
    flags          : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good extd_apicid pni lahf_lm cmp_legacy
    bogomips     : 1994.47
    TLB size     : 1024 4K pages
    clflush size     : 64
    cache_alignment     : 64
    address sizes     : 40 bits physical, 48 bits virtual
    power management: ts fid vid ttpAnother example is this one, OEL 5.6 inside of VirtualBox but with 2 virtual CPUs assigned:
    [root@oel56proxy ~]# cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 23
    model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
    stepping        : 10
    cpu MHz         : 2064.652
    cache size      : 6144 KB
    physical id     : 0
    siblings        : 2
    core id         : 0
    cpu cores       : 2
    apicid          : 0
    fdiv_bug        : no
    hlt_bug         : no
    f00f_bug        : no
    coma_bug        : no
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc pni ssse3 lahf_lm
    bogomips        : 4129.30
    processor       : 1
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 23
    model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
    stepping        : 10
    cpu MHz         : 2064.652
    cache size      : 6144 KB
    physical id     : 0
    siblings        : 2
    core id         : 1
    cpu cores       : 2
    apicid          : 1
    fdiv_bug        : no
    hlt_bug         : no
    f00f_bug        : no
    coma_bug        : no
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc pni ssse3 lahf_lm
    bogomips        : 7494.15I have not tried to replicate this with a VM that only has one vCPU assigned but I guess that is why you only see one CPU and no processor_id and so on.
    Bjoern

  • How to default an address number delivery address in the PO item

    Hi All,
    I have some combination of certain Material / Vendor / Delivery address.
    I have created some address numbers from transaction MEAN.
    I can successfully assign these in PO detail manually. Then the address gets updated from it
    for plant or storage location if specified.
    What I need to know is how to "default" this address number in the PO detail.
    I couldn't fine appropriate field in info record, but I have a feeling that it should be possible.
    Could anyone help me on this please?
    Thanks,
    ATO

    Hi Nadia,
    Thank you for your reply.
    The plan is that storage location gets default on the PO by material master setting.
    I have configured the storage location address, so this defaults in the delivery address tab.
    This storage location is our warehouse to receive goods.
    Sometimes we delivery goods directory to the vendor without receiving into the warehouse.
    In this scenario, we are using the address number to print the vendor address on the PO output.
    The combination of material and vendor is unique when we need to deliver directory.
    So the expectation is to default this address number in this certain case.
    Do you mean this will be possible without user exit?
    Thanks,
    ATO

  • I own CS6. I just built a new computer with Win-7. How do I change to the 64 bit version and install on the new computer?

    I own CS6. I just built a new computer with Win-7. How do I change to the 64 bit version and install on the new computer?
    Lance

    download the installation file(s) and activate with your serial number,
    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.
    window using the Lightroom 3 link to see those 'Important Instructions'.<

  • How to use a random number equal another number. (with my source code)

    hi, i'm having trouble with this assignment.
    3. Determine how many times a die must be rolled in order to
    win a prize. (This represents one trial.) Print this value to a
    text file.
    4. Conduct at least 1,000 trials.
    5. Read the data back in from all of the trials.
    6. Calculate the average number of times a die must be rolled in order to win a prize.
    7. Print the result to the screen
    This is what I have so far.
    But I get a "int cannot be dereferenced" error
    * Write a description of class BottleCapPrize here.
    * @author (your name)
    * @version (a version number or a date)
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Scanner;
    import java.util.Random;
    import java.io.File;
    public class BottleCapPrize
    public static void main (String [ ] args) throws IOException
    PrintWriter outFile = new PrintWriter(new File("bah.txt"));
    Random randomGenerator = new Random();
    int random = randomGenerator.nextInt(5);
    int count = 0;
    for (int loop = 1; loop <= 1000; loop++)
    if(random.equals("3"))
    outFile.println("Congratulations, both pairs matched.");
    count++;
    outFile.close ( );
    }

    And the random generator can only choose a 1 or 2 or 3 or 4 or 5. This is then randomly chosen 1000 times like 400 2s and 200 5s for example.I think you have still to appreciate that the task is not to roll a dice 1000 times and see how many of each number you get.
    Tackle it one step at a time:
    3. A - Determine how many times a die must be rolled in order to win a prize. (This represents one trial.)
    B - Print this value to a text file.
    Even the first part of the problem can be broken down into two parts. I strongly suggest to get step 3A working correctly before you move any further. Notice that this step does not involve 1000 rolls of the dice. Rather it asks you to roll the dice as many times as needed until you get a three. Start there: write a method that does no more than report the number of times it had to roll the dice in order to get a three.
    import java.util.Random;
    public class BottleCapPrize
        public static void main (String [ ] args) throws IOException
            Random randomGenerator = new Random();
            int count = 0;
             * Your code here.
             * At the end of it count should be equal to the number of
             * dice rolls it took to get a three.
            System.out.println("It took " + count + "dice rolls to get a three");
    }Once you have this method working correctly - that is you run it lots of times and it agrees with what you find experimentally with an actual dice - then you can move on to saving this result to a file (step 3B). The steps of the assignment provide a framework that makes sense - follow them one at a time.
    but only thing is that the random number is all a certain number.That's a fairly major defect in a randomly generated number ;). Read the API documentation for the [nextInt(n)|http://java.sun.com/javase/6/docs/api/java/util/Random.html#nextInt(int)] method. It should be clear that this is the method that randomly generates a number. So if you want lots of randomly generated numbers (rather than one randomly generated number lots of times) then you have to call this method lots of times. A call to nextInt(n) is the programming equivalent to rolling a dice.

Maybe you are looking for

  • Report to check org units without any position display

    Dear All, I want a report which i can see only the org units in a graphical way. When i am checking through Simple maintainence mode I am getting org units along with positions also with in the graphical mode i have selected the view option under opt

  • Combined with similar request

    I need to filter a column in a combined query results, and managed to add a filter but I get the following error "Element doesn't contain required attribute ." please helpme

  • Archive Log Gap between Disaster recovery server & Production Server

    Hi     Can anybody provide me the script  to find out the archive log missing on Production Server means that archive log backed up & deleted from the production server & rest of the Archive logs has been shipped on to the DR server. Means it will sh

  • Workflow - Assign serial tasks

    Hi, Perhaps I'm overthinking this or I just have got my brain in a knot, but I'm so confused.  What I want to do using Designer is set up a workflow that does this (at its most basic): InfoPath form is submitted 1) Send a task to person A (listed on

  • Problems using mailRoutingSmartHost in MS 5.2

    I need to use the mailRoutingSmartHost attribute in my domain because I share the domain with other site, which is the owner of the domain. So when I�m trying to use the mailRoutingSmartHost attribute I get an address like this: �@smarthost:user@doma