Confused about bitwise operations

how do i get the right most bit of an integer?
i have an integer value that counts from 0 to 31 and i am wanting to store each as a boolean array of 5 length.
i.e.
Int = 1 boolean array=00001
Int = 31 boolean array=11111
I have been trying to use >> which does seem to be working however i am not sure how to read only the last bit.
Thanks

thanks that works a treat.
maybe i am going about this the wrong way, what i am trying to do is store the 5 right most bits of a number of integers and then store the resultant bits into a file.
I thought i would make a bit array of the 5 bit representation of the 32 bit integers, however i cannot seem to write one bit at time to a file, so i am forced to manufacture byte repsentations of the bit array (every 8 bits encoded into a byte) before i can save the file.
This seems a very convaluted way of doing it. I think it would be better to not use a bit array at all and just use bytes, however i am not sure how to so this.

Similar Messages

  • Confused about passing by reference and passing by valule

    Hi,
    I am confuse about passing by reference and passing by value. I though objects are always passed by reference. But I find out that its true for java.sql.PreparedStatement but not for java.lang.String. How come when both are objects?
    Thanks

    Hi,
    I am confuse about passing by reference and passing
    by value. I though objects are always passed by
    reference. But I find out that its true for
    java.sql.PreparedStatement but not for
    java.lang.String. How come when both are objects?
    ThanksPass by value implies that the actual parameter is copied and that copy is used as the formal parameter (that is, the method is operating on a copy of what was passed in)
    Pass by reference means that the actual parameter is the formal parameter (that is, the method is operating on the thing which is passed in).
    In Java, you never, ever deal with objects - only references to objects. And Java always, always makes a copy of the actual parameter and uses that as the formal parameter, so Java is always, always pass by value using the standard definition of the term. However, since manipulating an object's state via any reference that refers to that object produces the same effect, changes to the object's state via the copied reference are visible to the calling code, which is what leads some folk to think of java as passing objects by reference, even though a) java doesn't pass objects at all and b) java doesn't do pass by reference. It passes object references by value.
    I've no idea what you're talking about wrt PreparedStatement, but String is immutable, so you can't change its state at all, so maybe that's what's tripping you up?
    Good Luck
    Lee
    PS: I will venture a guess that this is the 3rd reply. Let's see...
    Ok, second. Close enough.
    Yeah, good on yer mlk, At least I beat Jos.
    Message was edited by:
    tsith

  • Confusion about recovery

    Hi ,
    I am new to the DBA field and I have a confusion about recovery.
    The confusion is if a database is in noarchivelog mode can a database be recovered from commited changes that were there in the redo log files ?
    If I provide the path name of the redo log files while using recover database using cancel will it work at all given that the database is in noarchivelog mode ?
    Please help to clear my doubts..

    Oracle can use the Online Redo Logs for Recovery. Normally this happens in the case of Instance Recovery (e.g. from a server crash or shutdown abort) -- where the datafiles are not restored from a prior backup.
    If you restore datafiles from a prior backup, you are doing a media recovery. In NOARCHIVELOG mode, you could not have run a backup with the database OPEN, so the backup would have been run with the database SHUTDOWN or MOUNTed. At the subsequent startup, transactions would be in the online redo logs only until LGWR does a "wrap around" and overwrites the first redo log used after the startup. It is only within this window that transactions are in the redo logs.+
    Remember that LGWR uses a "round-robin" algorithm to cycle through the online redo logs. So, if the Online Redo Log that was CURRENT at the time of the backup has been overwritten, you cannot use the Online Redo Logs for a RECOVERy+._
    You must also ensure that there are no NOLOGGING operations !!
    One thing that you might trip up on is the behaviour of CTAS. A "CREATE TABLE AS SELECT" is, by default LOGGING in an ARCHIVELOG database. However, it is automatically a Direct Path operation in a NOARCHIVELOG database ! So the blocks for such a table would be "corrupt" if you attempt a recovery from the Online Redo Log as the row inserts are not captured.
    Hemant K Chitale
    Edited by: Hemant K Chitale on Oct 10, 2011 11:43 AM
    Edited by: Hemant K Chitale on Oct 10, 2011 11:44 AM
    Edited by: Hemant K Chitale on Oct 10, 2011 4:33 PM
    Edited by: Hemant K Chitale on Oct 10, 2011 4:34 PM

  • How to make Bitwise operation in Labview ?

    Hello.. everyone,
    I need to make the bitwise operation (or) in Labview, but I can't find it somewhere!!!
    Anybody has the experiece about it, pls help me !!
    Thanks a lot

    Hi Nok,
    The standard OR function in the boolean sub palette of the functions palette performs a bitwise operation on it's input data. This is a polymorphic function so you can input scalar booleans, arrays of booleans or numerics.
    Hope this helps,
    Nick

  • Confusion about TreeMap

    Hi,
    I'm currently studying for SCJP exam and am confused about the following code.
         public static void main(String[] args) {
         TreeMap myMap = new TreeMap();
         myMap.put("ab", 10);
         myMap.put("cd", 5);
         myMap.put("ca", 30);
         myMap.put("az",20);
         NavigableMap myMap2 = myMap.headMap("cd", true);
         myMap.put("bl",100);
         myMap.put("hi",100);
         myMap2.put("bi", 100);
         System.out.println(myMap.size() + " " + myMap2.size());
         }When I run it, it outputs 7 6.
    What I'm confused about is how when after the line NavigableMap myMap2 = myMap.headMap("cd", true);and values are being entered into the myMap object, that it is still possible for them to be entered in the NavigableMap object? Are the 2 entities not seen seperately? Is it to do with the "inclusive" field of the headMap method.
    The solution states that the myMap contains the objects "ab","cd","ca","az","b1","h1","bi"
    and myMap2 "ab","cd","ca","az","b1","bi".
    But how when adding key-value pairs do both objects (myMap,myMap2) get considered for putting into?
    Thanks.

    From the API:
    headMap
    public NavigableMap<K,V> headMap(K toKey,
    boolean inclusive)
    Description copied from interface: NavigableMap
    Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map >supports all optional map operations that this map supports. So myMap2 contains all the elements from myMap that are <= "cd" (which are all except "hi"), and changes in either map are reflected on both, as stated.

  • I am confused about something.  How do I read a book on my MacBook Pro?  I can't find the iBook app anywhere, which is what I use on my iPad.  The book I want to read is in my iTunes but I can't click on it.  My iBook library does not show up in iTunes.

    I am confused about something.  How do I read a book on my MacBook Pro?  I can't find the iBook app anywhere, which is what I use on my iPad.  The book I want to read is in my iTunes but I can't click on it.  Some of my iBooks show up in my iTunes but they are "grayed" out.  The only books that respond in iTunes are audiobooks and that's not what I'm looking for.  Is this a stupid question?

    Nevermind - I answered my own question, which is I CAN"T READ ANY BOOKS I purchased in iBooks on my MacBook Pro.  If I want to read on my mac I have to use Kindle or Nook.  Which means any book I've already purchased through iBooks has to be read on my iPad.  Kind of a drag because there are times when it's more convenient for me to read while I'm sitting with my Mac.

  • Confuse about the injecting entity in EJB 3.0?

    Hi all,
    I have an customersBean which is inherit from customersRemote and my problem is i' am little confuse about injecting the entity(customer).
    Where can you apply the EntityManagerFactory is it outside on EJB or Inside the EJB? means outside EJB is use the web application or java application. i have and example.
    this is inside on EJB...............
    public class CustomersBean implements com.savingsaccount.session.CustomersRemote {
    @PersistenceContext(unitName="SavingAccounts")
    EntityManagerFactory emf;
    EntityManager em;
    /** Creates a new instance of CustomersBean */
    public CustomersBean() {
    public void create(int id, String name, String address, String telno, String mobileno)
    try{
    //This is the entity.
    Customer _customer = new Customer();
    _customer.setId(id);
    _customer.setName(name.toString());
    _customer.setAddress(address.toString());
    _customer.setTelno(telno.toString());
    _customer.setMobileno(mobileno.toString());
    em = emf.createEntityManager();
    em.persist(_customer);
    emf.close();
    }catch(Exception ex){
    throw new EJBException(ex.toString());
    in web application, i'm using the @EJB in customer servlets.
    public class CustomerProcessServlet extends HttpServlet {
    @EJB
    private CustomersRemote customerBean;
    blah blah inject directly coming request field from jsp.
    }

    Hi all,
    I have an customersBean which is inherit from customersRemote and my problem is i' am little confuse about injecting the entity(customer).
    Where can you apply the EntityManagerFactory is it outside on EJB or Inside the EJB? means outside EJB is use the web application or java application. i have and example.
    this is inside on EJB...............
    public class CustomersBean implements com.savingsaccount.session.CustomersRemote {
    @PersistenceContext(unitName="SavingAccounts")
    EntityManagerFactory emf;
    EntityManager em;
    /** Creates a new instance of CustomersBean */
    public CustomersBean() {
    public void create(int id, String name, String address, String telno, String mobileno)
    try{
    //This is the entity.
    Customer _customer = new Customer();
    _customer.setId(id);
    _customer.setName(name.toString());
    _customer.setAddress(address.toString());
    _customer.setTelno(telno.toString());
    _customer.setMobileno(mobileno.toString());
    em = emf.createEntityManager();
    em.persist(_customer);
    emf.close();
    }catch(Exception ex){
    throw new EJBException(ex.toString());
    in web application, i'm using the @EJB in customer servlets.
    public class CustomerProcessServlet extends HttpServlet {
    @EJB
    private CustomersRemote customerBean;
    blah blah inject directly coming request field from jsp.
    }

  • About query Operator in find page??

    hi all~
    I hava a trouble about query operator.
    for example:
    In find page , there are some attribute for query.
    attribute BRAND for query the vender's name,
    Assume database has the follow data:
      BRAND
    =================
    1.IBM
    2.RedIBM
    3.BLUEIBMCO
    Case 1:When i input IBM in BRAND attribute and press Find,the result is :IBM
    Case 2:When i input %IBM in BRAND attribute and press Find,the result is : RedIBM,BLUEIBMCO
    How could I get above two result just input IBM??
    I want to serch the value of BRAND that contain IBM whether it location at the frond or middle.

    Spray Lin,
    I'm afraid that this time I do not quite understand what you are after.
    When I understand you correctly, you are saying that the current behavior is not what I think it should be, for example IBM results in IBM and IBMblue. That is strange indeed.
    Furthermore is it that when you try to find on IBM it should find everything with IBM in it? Said in other words, entering IBM should have the same result as entering %IBM%?
    If that is the case, you can achieve that by adding an extra property to the find form bean: "wildcardUsage". Setting this to "surround" will result in a "%" being put in front and at the end of the value you enter.
    You can look this up in the JHeadstart Developers Guide in the section Model-Aware Form Beans.
    Jan Kettenis,
    JHeadstart Team

  • Confused about logical table source

    Hi,
    I'm confused about logical table source(LTS), there are 'General', 'Column Mapping', 'Content' tabs in
    LTS, in General tab ,there are some information,like 'Map to there tables' and 'joins',
    just here, we have created relationships in physical layer and BMM layer, so I would like to ask what's the use of the 'joins' here?

    Hi Alpha,
    Valid query, when you establish a complex join it is always between a logical fact and dimension table.Consider a scenario,
    Example:w_person_dx is an extension table not directly joined to a fact but joins to a dimension w_person_d.
    When you model the person_d tables in BMM, you ll have a single logical table with w_person_d as source.If you have to pull columns from both w_person_d and w_person_dx tables in a report, you add dx table as inner join to persond table in the general tab.Now when you check your physical query, you can see the inner join fired between the two dimensions.
    Rgds,
    Dpka

  • Confused about transaction, checkpoint, normal recovery.

    After reading the documentation pdf, I start getting confused about it's description.
    Rephrased from the paragraph on the transaction pdf:
    "When database records are created, modified, or deleted, the modifications are represented in the BTree's leaf nodes. Beyond leaf node changes, database record modifications can also cause changes to other BTree nodes and structures"
    "if your writes are transaction-protected, then every time a transaction is committed the leaf nodes(and only leaf nodes) modified by that transaction are written to JE logfiles on disk."
    "Normal recovery, then is the process of recreating the entire BTree from the information available in the leaf nodes."
    According to the above description, I have following concerns:
    1. if I open a new environment and db, insert/modify/delete several million records, and without reopen the environment, then normal recovery is not run. That means, so far, the BTree is not complete? Will that affact the query efficiency? Or even worse, will that output incorrect results?
    2. if my above thinking is correct, then every time I finish commiting transactions, I need to let the checkpoint to run in order to recreate the whole BTree. If my above thinking is not correct, then, that means that, I don't need to care about anything, just call transaction.commit(), or db.sync(), and let je to care about all the details.(I hope this is true :>)
    michael.

    http://www.oracle.com/technology/documentation/berkeley-db/je/TransactionGettingStarted/chkpoint.html
    Checkpoints are normally performed by the checkpointer background thread, which is always running. Like all background threads, it is managed using the je.properties file. Currently, the only checkpointer property that you may want to manage is je.checkpointer.bytesInterval. This property identifies how much JE's log files can grow before a checkpoint is run. Its value is specified in bytes. Decreasing this value causes the checkpointer thread to run checkpoints more frequently. This will improve the time that it takes to run recovery, but it also increases the system resources (notably, I/O) required by JE.
    """

  • Confused about extending the Sprite class

    Howdy --
    I'm learning object oriented programming with ActionScript and am confused about the Sprite class and OO in general.
    My understanding is that the Sprite class allows you to group a set of objects together so that you can manipulate all of the objects simultaneously.
    I've been exploring the Open Flash Chart code and notice that the main class extends the Sprite class:
    public class Base extends Sprite {
    What does this enable you to do?
    Also, on a related note, how do I draw, say, a line once I've extended it?
    Without extending Sprite I could write:
    var graphContainer:Sprite = new Sprite();
    var newLine:Graphics = graphContainer.graphics;
    And it would work fine. Once I extend the Sprite class, I'm lost. How do I modify that code so that it still draws a line? I tried:
    var newLine:Graphics = this.graphics;
    My understanding is that since I'm extending the Sprite class, I should still be able to call its graphics method (or property? I have no idea). But, it yells at me, saying "1046: Type was not found or was not a compile-time constant: Graphics.

    Thanks -- that helped get rid of the error, I really appreciate it.
    Alas, I am still confused about the extended Sprite class.
    Here's my code so far. I want to draw an x-axis:
    package charts {
        import flash.display.Sprite;
        import flash.display.Graphics;
        public class Chart extends Sprite {
            // Attributes
            public var chartName:String;
            // Constructor
            public function Chart(width:Number, height:Number) {
                this.width = width;
                this.height = height;
            // Methods
            public function render() {
                drawAxis();
            public function drawAxis() {
                var newLine:Graphics = this.graphics;
                newLine.lineStyle(1, 0x000000);
                newLine.moveTo(0, 100);
                newLine.lineTo(100, 100);
    I instantiate Chart by saying var myChart:Chart = new Chart(); then I say myChart.render(); hoping that it will draw the axis, but nothing happens.
    I know I need the addChild method somewhere in here but I can't figure out where or what the parameter is, which goes back to my confusion regarding the extended Sprite class.
    I'll get this eventually =)

  • Confused about standby redo log groups

    hi masters,
    i am little bit confuse about creating redo log group for standby database,as per document number of standby redo group depends on following equation.
    (maximum number of logfiles for each thread + 1) * maximum number of threads
    but i dont know where to fing threads? actually i would like to know about thread in deep.
    how to find current thread?
    thanks and regards
    VD

    is it really possible that we can install standby and primary on same host??
    yes its possible and i have done it many times within the same machine.
    For yours confusion about spfile ,i agree document recommend you to use spfile which is for DG broker handling if you go with DG borker in future only.
    There is no concern spfile using is an integral step for primary and standby database implementation you can go with pfile but good is use spfile.Anyhow you always keep pfile on that basis you created spfile,i said you make an entry within pfile then mount yours standby database with this pfile or you can create spfile from this pfile after adding these parameter within pfile,i said cause you might be adding this parmeter from SQL prompt.
    1. logs are not getting transfered(even i configure listener using net manager)
    2.logs are not getting archived at standby diectory.
    3.'ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION' NEVER COMPLETE ITS RECOVERY
    4. when tried to open database it always note it 'always' said system datafile is not from sufficiently old backup.
    5.i tried 'alter database recover managed standby database camncel' also.Read yours alert log file and paste the latest log here..
    Khurram

  • Confused about SOAP

    Hi all,
    As far as I know, SOAP is initially designed to be an XML based
    RPC protocol.
    But Java API for XML Messaging (JAXM), which is actually a
    messaging API (and not RPC), is also based on SOAP.
    How do they fit to each other?
    In a few words, what does actually SOAP define?
    I am confused about that, can you help me?
    Any idea will be appreciated.
    Thank you

    In a few words -- no. Try here:
    http://java.sun.com/webservices/docs/1.0/tutorial/index.html

  • PSE 7 confusion about folder location, help needed

    Here's some background: I'm using PhotoShop Elements 7 on Win XP.  I have an external firewire hard drive I use for overflow/backups.  Originally, this showed up as a K: drive on my system.
    I added a RAID controller and two more drives to stripe as a single drive for temp space rendering movies.  This ended up as a K: drive and the external moved to L:  However, when I did this there were some pictures from my catalog that I had on the external drive.  I have used File > reconnect missing files to handle the moves, but PSE is still confused (very).
    PSE has started to mix up the RAID (K:) and external (L:) content.  If I move a set of pictures (e.g. a folder of them) onto the external drive (L:) via drag and drop in the folder location view, the folder will show up empty on the L: heirarchy, but will show up as a gray folder icon in the K: RAID drive hierarchy.  If I open up windows explorer, the RAID drive will appear empty.  In other cases (I'm not sure when/how yet), pictures physically end up on the RAID drive itself instead of the external.  I have uninstalled both the external drive and the RAID drive and reinstalled them both, but they are still getting confused in the folder view by PSE.  I've also tried moving content outside of PSE and just reconnecting missing files, but it still wants to put things under the K: RAID drive instead of the external L:.
    I've searched everywhere I can think of for a description of what gray folder icons in the folder location view means and can find none.  I'm not sure how to convince PSE that there's nothing on the RAID K: drive and it shouldn't try to connect the two.  Any suggestions?
    Thanks,
    Jim

    Thank you!  I ran psedbtool and the output shows the catalog has the wrong drive letter for the L: drive.
    Is there a way to make PSE forget about the K: and L: drives that it is so confused about so that it can relearn of their existence?  If I use the drive letter reassignment to fix PSE, it will break other apps that are now dependent on the current drive letter assignments.  I've tried removing all files from the L: drive, but it's still remembered as part of the catalog.
    Thanks,
    Jim
    psedbtool version 1.07
    Opening catalog C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\Catalogs\Moms pics\catalog.pse7db
    Photoshop Elements version:      7
    Total files               :   4833
    Total files missing       :      0
    Total files offline       :    278
    Total files wrong volume  :      0
    ****** Volumes with warnings: 1
    PSE Volume Table
    Path used by PSE        : F:
    Type                    : builtin_drive
    Status                  : online
    Total files             : 0
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : MEDIA
    Serial                  : 1C2F-9805
    Drive_path_if_builtin   : F:
    Id                      : 32520
    Path used by PSE        : M:
    Type                    : builtin_drive
    Status                  : online
    Total files             : 938
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : FreeAgent Drive
    Serial                  : 7830-2970
    Drive_path_if_builtin   : M:
    Id                      : 93626
    Path used by PSE        : E:
    Type                    : builtin_drive
    Status                  : online
    Total files             : 0
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : GAMES
    Serial                  : 025A-4B70
    Drive_path_if_builtin   : E:
    Id                      : 93625
    Path used by PSE        : L:
    Type                    : builtin_drive
    Status                  : online
    Total files             : 114
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : FreeAgent Drive
    Serial                  : 60AE-A816
    Drive_path_if_builtin   : K:
    Id                      : 31354
    ***** WARNING *****     : Wrong drive letter in catalog
    Path used by PSE        : \\dmzhost\media
    Type                    : network_drive
    Status                  : offline
    Total files             : 278
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : //dmzhost/media
    Serial                  : //dmzhost/media
    Drive_path_if_builtin   :
    Id                      : 26948
    Path used by PSE        : J:
    Type                    : builtin_drive
    Status                  : online
    Total files             : 3503
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : MEDIA2
    Serial                  : BAC0-B5A3
    Drive_path_if_builtin   : J:
    Id                      : 108
    Path used by PSE        : C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\Catalogs\Moms pics
    Type                    : database_relative_drive
    Status                  : online
    Total files             : 0
    Total files missing     : 0
    Total files wrong volume: 0
    Description             : database relative
    Serial                  : amoc:database_relative_volume
    Drive_path_if_builtin   :
    Id                      : 2
    Windows Drives
    Drive  Type             Serial     Path
    A:     removable_drive  0000-0000 
    C:     builtin_drive    9088-07F9 
    D:     builtin_drive    F408-1CB0 
    E:     builtin_drive    025A-4B70 
    F:     builtin_drive    1C2F-9805 
    G:     builtin_drive    242D-15ED 
    H:     readonly_drive   0000-0000 
    I:     builtin_drive    427D-3F6B 
    J:     builtin_drive    BAC0-B5A3 
    K:     builtin_drive    64E8-9846 
    L:     builtin_drive    60AE-A816 
    M:     builtin_drive    7830-2970
    Thanks so much for your help!
    Jim

  • Confused about schema..

    I'm currently working on a project using VB 2010 Express and Oracle 11g XE. On my Oracle My SQL Developer, I am currently logged on as 'user X' and I created three tables. All of which are just listed on the 'tables' tree. Does it mean that 'user X' is like a schema when compared to MySQL?
    I have already integrated my database to my vb project and is working fine ATM. I'm just really confused about schemas in Oracle 11g XE.

    I'm just really confused about schemas in Oracle 11g XE.http://docs.oracle.com/cd/E11882_01/server.112/e25789/intro.htm#CEGJFFFD

Maybe you are looking for

  • When you have 1 itunes library.. and 2 ipods.. different names.. how can you share the same library???

    When you have 1 itunes library.. and 2 ipods.. different names.. how can you share the same library???  All of the songs that were put on there from a CD will sync, but the songs that were purchased.. "cannot be found"   How can we merge them?? or ho

  • Finding table used in CJI3 transaction

    Hi experts,   I am creating a report to produce the output of cji3 transaction.Getting the input as project or WBS i have to calculate actual amount. For that i want to know the tables used in this transaction.Please help me.. If any one can tell the

  • Cookies and Javascript enabling

    Looking for instructions on enabling cookies and javascript on my IMAC. Can anyone please provide quick instruction ?

  • OWB + OWF Migration Doubts

    Hi, I have worked with OWB 9.2 but not with Oracle Workflow. Now I have to migrate a Data warehouse to another server. The Data warehouse has OWB 9.0.4.10 and Oracle Workflow. I have to use the same OWB and OWF version but the Operating System will b

  • Currency translation code at transformations

    hi i ahve written this code for source currency to target currency usd based on system date. please and let me know any modifications nedd DATA : w_to_amt     TYPE /bi0/oiamount,            w_from_curr  TYPE /bi0/oicurrency,            calmonth type