Boolean conversion

How can I convert a Boolean expression into a string?
I know the toString method is used. Can someone show some sample code that it is used in? I am attempting to finish a program and am trying to use the toString method.
Thanks In Advance,
Patrick deAlbuquerque

Note that there are virtually no circumstances under which you should call the constructor for Boolean.
There are only two possible discernable instances of Boolean and both of these have already been instantiated for you. instantiating Boolean is a waste of memory and adding to the load on the Garbage Collector.
Use instead
int i = 1;
String s = Boolean.valueOf(i == 1).toString();Hope this helps even though I missed the dukes.
NB: at least you dolled out your dukes, most posts I make in forums offering dukes never see any dukes because the original author never assigns them...
Talden

Similar Messages

  • String (binary) to boolean conversion problem.

    Hello,
    Im facing problems converting a string (presumably in the binary format) to turn on LEDs according to its respective weight. ie.binary input = 1010. Thereby it would turn on the first (MSB) and third LEDs while the second and third are left off.
    What I have managed to obtain is a direct conversion of decimal to binary but have not much idea on how to achieve the above goal. The attached file shows two operations; top part does the boolean to binary conversion is fine. The bottom is supposed to be the binary to boolean conversion.
    Attachments:
    boolean to string.vi ‏21 KB

    OK, let's back up a second here. I don't understand what your "boolean to string" VI is doing. Are you starting with a string, a number, or a bunch of Boolean controls? The top part is dealing with Boolean controls and creating a string of characters of "0" and "1". The bottom part you have a numeric control. By the way, it is pointless to take the output of Number to Boolean Array, converting it to an array of 0s and 1s, indexing out each element, and then using the Not Equal to Zero operator. Just take the Boolean array output from Number to Boolean Array directly into an Index Array!
    You seem to be saying that you have a string in the binary format. This is somewhat meaningless, so I'm assuming you mean you have a string that consists of a sequence of the ASCII characters "1" and "0" to indicate a numerical 1 or 0. You then want to convert this into something that is programmatically useful. What that is is not clear, so let's assume an array of Booleans. If that's the case, then you can simply take advantage of the fact that you're starting out with ASCII characters, and use the ASCII codes to find out what you have. The ASCII code for the character "0" is 30 (hex) or 48 (decimal). The ASCII code for the character "1" is 31 (hex) or 49 (decimal). Assuming this is what you have and what you want, then you can simply do this:
    Attachments:
    Example_VI.png ‏8 KB

  • Latch to switch boolean conversion, or toggling flip flop in labview

    I'm a labview newbie, and i've been scratching my head about a particular problem.
    I want to use a joystick (11button, 3 axis) to operate 2 PI microscope stages in tandem. I am thinking about the best solution to this problem:
     the joystick buttons provide latched booleans: they are only true while the button is held down. once the button is released, the boolean becomes false again.
    I want to take this toggle and produce a true boolean the first time the button is pressed, and change that boolean to a false when the button is subsequently pressed.
    My current idea is to try and construct something with either an occurance structure or notifier structure, or even something like a boolean to integer conversion then modulo-2 division.
    Can anyone give me some pointers here?
    thanks!
    Solved!
    Go to Solution.

    zipmanx wrote:
    From a programming standpoint, which is better to use? an event handler as trob has suggested, or something like an occurance or a notifier?
    Here's another one: can you do a bitwise shift in labview?
    Since you are reading hardware, you probably need to poll it, so an event is out.
    Yes, you ca do bitwise shifts in LabVIEW. Look in the "numeric...data manipulation" palette.
    Here's one possibility to solve your problem (LabVIEW 8.5). There are many other ways to do this, but you dfefinitely don't need any blue wires for the logic. .
    Message Edited by altenbach on 12-01-2008 01:05 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    JoystickBoolean.PNG ‏6 KB
    JoystickBoolean.vi ‏10 KB

  • New Toplink JPA release?

    In another thread a fix was made to the Toplink JPA codebase.
    Toplink comes to a halt in the merge
    The question is how to get to the fix. The latest build on the website is 2b41 from March 2007! I cannot find a source access.
    How to get the latest Toplink JPA implementation?

    There are no converter related enhancements for TopLink Essentials. If you want advanced support in this area you'll need to move to either Oracle TopLink or EclipseLink. It's pretty easy to do.
    In TopLink Essentials you have the option to customize a basic mapping with your own converter. You declare the customizer in the persistence.xml, e.g.:
    <property name="toplink.descriptor.customizer.Book "value="example.toplink.BookCustomizer"/>And in your customizer you can plug in a Converter, e.g.:
    public class BookCustomizer implements DescriptorCustomizer {
        public void customize(ClassDescriptor descriptor) throws Exception {
            DirectToFieldMapping categoryMapping = (DirectToFieldMapping)
                      descriptor.getMappingForAttributeName("category");
            categoryMapping.setConverter(new BookCategoryConverter());
        }The converter you set on the DirectToFieldMapping (i.e., Basic) has to implement oracle.toplink.essentials.mappings.converters.Converter. In the converter you can do pretty much whatever you like including Integer/Boolean conversion.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • ConversionException thrown in OC4J

    Hi, for some reason when I deploy an EAR and run in OC4J I get the following exception (things run fine in Jdev using a main method):
    An exception was thrown while loading the <project-xml> file [toplink-project.xml]
    Exception Description: The object[undefined], of class [class java.lang.String], could not be converted to [class java.lang.Boolean]
    I use the SessionManager.getManager().getSession("NewSession", SessionLocator.class.getClassLoader()); Also, I don't have any String to Boolean conversion happening. Any help would be greatly appreciated.
    Thanks,
    Dave

    Thanks... here it is:
    04/11/09 07:54:59 Error creating Server Session !
    Local Exception Stack:
    Exception Description: Several [1] SessionLoaderExceptions were thrown:
    Exception [TOPLINK-9005] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: An exception was thrown while loading the <project-xml> file [toplink-project.xml].
    Internal Exception: Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [undefined], of class [class java.lang.String], could not be converted to [class java.lang.Boolean].
         at oracle.toplink.exceptions.SessionLoaderException.finalException(SessionLoaderException.java:89)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.load(XMLLoader.java:156)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:219)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:181)
         at com.yahoo.reputation.persistence.SessionLocator.launchServer(SessionLocator.java:51)
         at com.yahoo.reputation.persistence.SessionLocator.<clinit>(SessionLocator.java:12)
         at com.yahoo.reputation.test.RollupTest.<init>(RollupTest.java:70)
         at com.yahoo.reputation.test.TestServlet.doGet(TestServlet.java:38)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    SessionLoaderExceptions:
    Local Exception Stack:
    Exception [TOPLINK-9005] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: An exception was thrown while loading the <project-xml> file [toplink-project.xml].
    Internal Exception: Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [undefined], of class [class java.lang.String], could not be converted to [class java.lang.Boolean].
         at oracle.toplink.exceptions.SessionLoaderException.failedToLoadProjectXml(SessionLoaderException.java:74)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.process_project_xml_Tag(XMLLoader.java:945)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.process_session_Tag(XMLLoader.java:415)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.processRootTag(XMLLoader.java:223)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.load(XMLLoader.java:153)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:219)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:181)
         at com.yahoo.reputation.persistence.SessionLocator.launchServer(SessionLocator.java:51)
         at com.yahoo.reputation.persistence.SessionLocator.<clinit>(SessionLocator.java:12)
         at com.yahoo.reputation.test.RollupTest.<init>(RollupTest.java:70)
         at com.yahoo.reputation.test.TestServlet.doGet(TestServlet.java:38)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [undefined], of class [class java.lang.String], could not be converted to [class java.lang.Boolean].
         at oracle.toplink.exceptions.TopLinkException.<init>(TopLinkException.java:48)
         at oracle.toplink.exceptions.ConversionException.<init>(ConversionException.java:26)
         at oracle.toplink.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:35)
         at oracle.toplink.internal.helper.ConversionManager.convertObjectToBoolean(ConversionManager.java:234)
         at oracle.toplink.internal.helper.ConversionManager.convertObject(ConversionManager.java:127)
         at oracle.toplink.internal.databaseaccess.DatabasePlatform.convertObject(DatabasePlatform.java)
         at oracle.toplink.mappings.DirectToFieldMapping.getAttributeValue(DirectToFieldMapping.java)
         at oracle.toplink.mappings.DirectToFieldMapping.valueFromRow(DirectToFieldMapping.java)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:860)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
         at oracle.toplink.sdk.SDKAggregateCollectionMapping.valueFromRow(SDKAggregateCollectionMapping.java:493)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:860)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
         at oracle.toplink.sdk.SDKAggregateObjectMapping.valueFromRow(SDKAggregateObjectMapping.java:124)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:860)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
         at oracle.toplink.sdk.SDKAggregateCollectionMapping.valueFromRow(SDKAggregateCollectionMapping.java:493)
         at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:860)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:331)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:226)
         at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:344)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:498)
         at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:111)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1968)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1096)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1048)
         at oracle.toplink.tools.workbench.XMLProjectReader.read(XMLProjectReader.java:133)
         at oracle.toplink.tools.sessionconfiguration.XMLLoader.process_project_xml_Tag(XMLLoader.java:931)
         ... 28 more

  • Setting control parameters programmatically - using variables...

    Please excue typos - I lost my glasses the other day and I'm waiting on a new pair to come in.
    I need to be able to change the 'editable' and 'enabled' properties on a variety of controls programmatically. I'm adding 'after the fact' Role support to an application and the customer has asked for a way to change the visibility and editability on specific controls.
    I've created a role management system where the controls are stored in an XML file and the application administrator has the ability to define roles by changing what a user (belonging to a Role) can see and change.
    based on:
    <filename canAccess="false" fileName="canSearch.mxml" friendlyName="Claim Search">
      <controls>
        <control controlID="control ID" controlLabel="control ID" controlType="type" editable="false" visible="false"/>
        <control controlID="control ID" controlLabel="control ID" controlType="type" editable="false" visible="false"/>
      </controls>
    </filename>
    I could:
    if(controlType == whatever)
         display based on xml information
    but I'd have to add new code for each additional control type that we may add later..
    what I'd like to do is:
    var controlID:controlType;
    controlID.editable = controls.control.@editable;
    but of course,
    "Type was not found or type was not a compile-time constant: controlType"
    Is there a way to do this entirely programmatically?

    This is the code I'm testing:
    for each(var control:XML in roleInfo.role.(name == rolesA[0]).filename.(@fileName == calledFileName).controls.control)
         var tempControlID:String = control.@controlID;
         this[tempControlID].enabled = control.@enabled;
         this[tempControlID].editable = control.@visible;
    against the following XML structure:
    <roles>
    <role>
        <name>Claims Viewer</name>
        <description>This User can only view claims.</description>
        <filename canAccess="false" fileName="canSearch.mxml" friendlyName="Claim Search">
          <controls>       
            <control controlID="txtTIN" controlLabel="TIN:" controlType="Text Input" editable="true" visible="true"/>
            <control controlID="txtNPI" controlLabel="NPI:" controlType="Text Input" editable="true" visible="true"/>
          </controls>
        </filename> 
        <filename canAccess="true" fileName="canNewClaim.mxml" friendlyName="New Claim">
          <controls>
             <control controlID="txtPatientID" controlLabel="Patient ID:" controlType="Text Input" editable="true" visible="true"/>
             <control controlID="txtSubscribe" controlLabel="Subscriber ID:" controlType="Text Input" editable="true" visible="true"/>
             <control controlID="txiDOB" controlLabel="Patient DOB:" controlType="Text Input" editable="true" visible="true"/>
          </controls>
        </filename>
      </role>
    </roles>
    The idea is to be able to change editable, enabled, and other properties such as 'includeInLayout' based on the role restrictions contained in the XML file.
    I am hoping to be able to do this without having to resort to:
    if(controlType == mxLabel)
      apply settings
    else ig(controlType == someOtherControl)
    apply settings
    (repeat until all control types are covered)
    The problem is that not all controls use all, or even the same, properties e.g; <mx:Label> doesn't support 'editble' so evein this method may not be optimal.  I was thinking to use a try-catch block with it to contain errors, but that sounds a little too 'brute-force'.
    for each(var control:XML in roleInfo.role.(name == rolesA[0]).filename.(@fileName == calledFileName).controls.control)
         var tempControlID:String = control.@controlID;
         this[tempControlID].enabled = control.@enabled;
         try
           this[tempControlID].editable = control.@visible;
         catch(e:ErrorMessage)
              //handle 'editable' differently
    Where rolesA[0] is the Claims role from the User database that we want to match to the applicable role in the XML file, and calledFileName is the name of the file we want to manage the controls for.
    I am using an XSD to support the XML file, so I may change the XML structure to have appropriate controls for each control type, however that would make the page that supports modifying the XML very difficult to code (for me , at least)
    On the boolean conversions, could I do this?
    this[tempControlID].enabled = control.@enabled as Boolean;
    Does this make any sense, or am I overcomplicating things?

  • How can I measure the time between each two successive rising edges ,using Digital Input ?

    Hello
    I'm trying two measure the time in seconds between each two successive rising edges on a digital input .
    Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned
    all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.
    but I don't know how to do this
    Can somebody please help me !!!
    Solved!
    Go to Solution.
    Attachments:
    Counter without time.vi ‏11 KB

    Woah!  
    Sorry Apok, but your code is becoming way too complicated/messy. I don't think that all of those shift registers or boolean conversion/operators are needed at all.
    If you want to measure the timing between two button presses then this is a different (much less complicated) way. It simply records the timing of the button press into a shift register then compares the two.
    Spoiler (Highlight to read)
    Of course this is a very quick and basic solution just to show you that it can be much simpler than you are making it (remember to use the mechanical actions of the buttons to get the behaviour you want).
    A better way would be to use an event structure looking at value changes of the buttons to determine the timings between clicks.
    -CC
    "If anyone needs me, I'll be in the Angry Dome!"
    Attachments:
    Time between clicks.vi ‏9 KB

  • Boolean Array to Hex String - LabVIEW Supplementary Data Conversion Library in version 12 please

    Hello,
    I would like to use the Boolean Array to Hex String.vi in LabVIEW Supplementary Data Conversion Library at http://zone.ni.com/devzone/cda/epd/p/id/3727
    But it is version 4. Can someone give me the library in version 12? Attached herewith.
    Attachments:
    cnvrsion.zip ‏38 KB

    Mass compiled in 8.2.1, which you can open with 2012.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    convrzun.llb ‏65 KB

  • Run time error message - Conversion from string "Mobile Telecommunications" to type 'Boolean' is not valid.

    I get a error message when I select an element in the combo box, please review my variables:
     Public Sector As String
        Public Index As Decimal
    ...and code
     Select Case ComboBox1.Text
                Case "Banks"
                    Sector = "Bank" And Index = -0.086
                Case "Mobile Telecommunications"
                    Sector = "Mobile Telecommunications" And Index = -0.024
                Case "Real Estate Investment Trusts"
                    Sector = "Real Estate Investment Trusts" And Index = 0.132
            End Select

    And is a boolean operator. Try it like this instead:
    Select Case ComboBox1.Text
    Case "Banks"
    Sector = "Bank"
    Index = -0.086
    Case "Mobile Telecommunications"
    Sector = "Mobile Telecommunications"
    Index = -0.024
    Case "Real Estate Investment Trusts"
    Sector = "Real Estate Investment Trusts"
    Index = 0.132
    End Select
    Still lost in code, just at a little higher level.

  • 1D Boolean Array to 1D Integer Array conversion for FPGA FIFO

    Hello, I am using a PXI7813R card. I would like to pass some data between the target (FPGA) vi and the host vi using the FIFO. I have a FIFO setup to 1023 "32 bit integer" samples. I have a boolean array of 32000 samples which would be the same as 1000 32 bit integers, that I acquired using the PXI7813R card.  I would like to convert the 1D boolean array to a 1D "32 bit intger" array. This seems like a more a difficult problem than I first thought as the labview functions are reduced when targetting a FPGA device. I have attached a jpg of how I would like to do it. I am getting a "Arrays must be fixed size in current target" error for the output from the array subset function. I know this is because one of the inputs is not exactly a constant, i.e. the index input  for array subset, but regardless of the index, I will only ever be taking 32 bits from the boolean array at any time to convert to a 32 bit integer to then place in the FIFO. Any suggestions of how I may get around this problem would be gratefully recieved. Regards, Michael.
    Message Edited by Michael_Limerick on 02-08-2008 04:54 AM
    Attachments:
    fifo_out1.JPG ‏52 KB

    Hi Daniel,
    Thanks for your reply.
    I had a look at the thread that you suggested and I'm not sure if that would solve the problem I was having, the option box was checked as default. I think my issue has to do with the limitations of the different LV functions when targeting a FPGA device.
    I have decided to take another route anyway, it seems that trying to compile a large array (even a 1D boolean array) for a FPGA target both takes a long time and also a lot of FPGA resources.
    Thanks again for your reply,
    Regards,
    Michael.

  • Error upon inserting data in sql Database using stream analytics job: Datatye error conversion

    I have a data passed into the Event Hubs, queried by stream analytic job inserting it into sql database. Upon running the job, it becomes idle a few seconds after since it has an error:
    Message: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64. Exception message at level [1], exception number [0], parent exception number [0]: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    The data type in one of my field(IsHistorical) is Boolean with a value of false. The data type of the column in the sql table where this is to be inserted is of type bit. In this case, it seems that stream analytics could not convert the value "false"
    into a bit data type when inserting in sql table.
    I'm wondering if you already have encountered this problem. Could you help me resolve this problem?
    Thank you.

    Azure Stream Analytics does not have Boolean type. On input we will convert JSON Boolean value to bigint.
    Here is the list of supported types and conversions:
    https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx 
    You  can fix this erro by changing column type from bit to int in SQL table schema.

  • How to use boolean transition as trigger 0to1= 1impulse, 1to0= 0 impulse

    Hello!
    I have a boolean button HVenable which will be used to enable/disable the high voltage output of a voltage source.
    The problem:
    I only need one True value to send the Open HV command
    and one False value to send the Close HV command; the boolean button sends a continuous train of True values when it is on and a continuous train of F values when off.
    How can I convert a transition from off to on / F to T into a single 1 impulse or T impulse 
    and the transition from on to off/ T to F into a single 0 impulse or T impulse.
    What instrument converts a transition from F to T into a 1 or T impulse
    and a transition from T to F into a 0 impulse (different from the first kind of transition)?
    In the attached test vi, such an instrument would be inserted between HVenable button and Select;
    when True it will send an open command to visa O 01 CR
    when False  it will send a close command O 00 CR.
    Solved!
    Go to Solution.
    Attachments:
    bultrig.vi ‏11 KB

    First, Do Not Use Continuous Run to make code run more than once! Place the repeating code inside a loop. Continuous Run is a troubleshooting tool to be used (sparingly) during development.
    The key to your issue is to use the Event structure. A Value Change event on the HVenable boolean will do exactly what you want.
    You do not need Type Cast and all the conversions. Set string constants to '\' Codes display mode and enter the data you want.
    Lynn
    Attachments:
    bultrig.2.vi ‏11 KB

  • ORA-06502: PL/SQL: error TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;

    Hi,
    I've a Compiled Body Package which code I described below:
    create or replace
    PACKAGE body emp_pkg
    IS
    TYPE boolean_tabtype2
    IS
      TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
      valid_jobs boolean_tabtype2; 
    PROCEDURE add_employee(
        first_name employees.first_name%TYPE,
        last_name employees.last_name%TYPE,
        deptid employees.department_id%TYPE,
        jobid employees.job_id%type)
    IS
    BEGIN
      IF valid_deptid(deptid) THEN
      if valid_jobid(jobid) then
                  INSERT
                  INTO employees
                      employee_id,
                      first_name,
                      last_name,
                      email,
                      hire_date,
                      job_id,
                      department_id
                    VALUES
                      employees_seq.NEXTVAL,
                      first_name,
                      last_name,
                      SUBSTR(first_name,1,1)
                      ||SUBSTR(last_name,1,7)
                      ||'@buongio.com',
                      sysdate,
                      'SA_REP',
                      deptid
         ELSE
            RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
          END IF;
    END add_employee;
    PROCEDURE init_jobs
    is
    begin
    FOR rec IN
      (SELECT job_id FROM jobs
      LOOP
        valid_jobs(rec.job_id):=true;
      END LOOP;
    END init_jobs;
    function valid_jobid(
        jobid employees.job_id%type)
      return boolean
    is
    BEGIN
    return valid_jobs.exists(jobid);
    EXCEPTION
    WHEN no_data_found THEN
    dbms_output.put_line('no valid');
      RETURN FALSE;
    END valid_jobid ;
    BEGIN
      init_jobs;
    END emp_pkg;and the server gives me the next output
    ORA-06502: PL/SQL: error : error de conversión de carácter a número numérico o de valorI suspect that the problem is the procedure init_jobs but I don't Know what could I do to resolve it.
    Thanks in advance...

    sorry
    I forget to remove it,
    the code:
    create or replace
    PACKAGE body emp_pkg
    IS
    TYPE boolean_tabtype2
    IS
      TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
      valid_jobs boolean_tabtype2; 
    PROCEDURE add_employee(
        first_name employees.first_name%TYPE,
        last_name employees.last_name%TYPE,
        deptid employees.department_id%TYPE,
        jobid employees.job_id%type)
    IS
    BEGIN
      if valid_jobid(jobid) then
                  INSERT
                  INTO employees
                      employee_id,
                      first_name,
                      last_name,
                      email,
                      hire_date,
                      job_id,
                      department_id
                    VALUES
                      employees_seq.NEXTVAL,
                      first_name,
                      last_name,
                      SUBSTR(first_name,1,1)
                      ||SUBSTR(last_name,1,7)
                      ||'@buongio.com',
                      sysdate,
                      'SA_REP',
                      deptid
         ELSE
            RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
          END IF;
    END add_employee;
    PROCEDURE init_jobs
    is
    begin
    FOR rec IN
      (SELECT job_id FROM jobs
      LOOP
        valid_jobs(rec.job_id):=true;
      END LOOP;
    END init_jobs;
    function valid_jobid(
        jobid employees.job_id%type)
      return boolean
    is
    BEGIN
    return valid_jobs.exists(jobid);
    EXCEPTION
    WHEN no_data_found THEN
    dbms_output.put_line('no valid');
      RETURN FALSE;
    END valid_jobid ;
    BEGIN
      init_jobs;
    END emp_pkg;

  • Problem with conversion of strings like THISStr - this_str capitalization

    Problem with conversion of strings like. THISStr -> this_str
    Can anybody pass on the reverse code. I have one, but its faulty.
    public static String convertFromPolycaps(String str) {
              Pattern pattern = Pattern.compile("\\p{Upper}+");
              Matcher matcher = pattern.matcher(str);
              StringBuffer result = new StringBuffer();
              // We do manual replacement so we can change case
              boolean notFirst = false;
              int grpP = 0, grpA = 0;
              String last = "";
              String now = "";
              while (matcher.find()) {
                   grpA = matcher.end();
                   if (notFirst) {
                        now = matcher.group().substring(0).toLowerCase();
                        if (grpA - grpP > 1) {
                             matcher.appendReplacement(result, now);
                             result =
                                  new StringBuffer(
                                       result.substring(0, (result.length() - 1))
                                            + "_"
                                            + result.substring(result.length() - 1));
                        } else {
                             matcher.appendReplacement(result, "_" + now);
                   } else {
                        matcher.appendReplacement(result, matcher.group().substring(0).toLowerCase());
                        notFirst = true;
                   grpP = matcher.end();
                   ////index++;
                   last = now;
              matcher.appendTail(result);
              System.err.println(str + " : " + result.toString());
              return result.toString();
         }succesfully converts :
    AccountNmnc : account_nmnc
    CustNameJ : cust_name_j
    Resume : resume
    BeneBrCode : bene_br_code
    ApprovedPerson : approved_person
    but fails for:
    GLCode : glcode
    VISHALErrCode : vishalerr_code
    GHASUNNAcNo : ghasunnac_no

    Can anybody pass on the reverse code. I have one, but
    its faulty.Post it, I'm sure we can fix it...

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

Maybe you are looking for