Urgent - 4/16 binary to hexadecimal decoder

Hi...
I have to send an example from multisim to my proffesor assistant, till 28.05.2008...
I have to create a decoder the will 4/16, that will decode binary equivalent digits to hexadecimal digits...
I really have no Idea how to do this with multisim...
Can someone make an example of it or make a tutorial how to do it...
thnx a lot

Multisim has a very easy learning curve, especially for something this simple. Just place the components you want, click on their pins to connect them, and you are set. If you need instructions on placing parts, use the help file. (Hit F1)
Since I can't be doing your school work for you, I'll make a deal with you. You draw up the schematic you want to build and post it, and I'll put it together in multisim. If you weren't introduced to boolean algebra before being given this assignment, then you might be ill-prepared for this. Just stick to the basics: you have AND gates and you know how those work, so just use AND gates to take the inverted and non-inverted binary inputs and give a certain output for a given binary sequence, just like the example your assistant gave you.
Ryan R.
R&D

Similar Messages

  • Convert Binary to Hexadecimal

    Hi,
    Can anyone show me how do I convert Binary to Hexadecimal ?
    Thank you,
    Any help will be appreciated.

    Well, everything is stored in binary on computers so your explanation of the problem sucks big time, however maybe you want something like this.
    String binString = "101001010101101";
    String hexString = Integer.toHexString(Integer.parseInt(binString, 2));

  • Converting from decimal to binary to hexadecimal to octal

    hello everyone,
    my question is, Is there a way to get decimal input from user and print the binary, hexadecimal and octal value of that decimal? just like C does in printf command

    http://java.sun.com/j2se/1.3/docs/api/java/lang/Integer.html

  • Binary to hex convertor

    Hello all,
    I was searching on the internet an binary to hex convertor in java language, but I was found 0 results.
    I want to converting an binary number to hex number, but not binary or hex calculator.
    I need a java code for converting binary code into hex code.
    For example:
    I have got a file with some binary codes and I want to converting it.
    For converting the binary code I must type followings:
    java <project's name> bynary.txt hex.txt
    The binary code has been converted into hex code to hex.txt file.
    Please help me.
    Thank you!

    If you are converting a binary file to a hex file I'd just read in the binary file and write the hex file a nibble at a time matching the 4 bit Strings, prolly best to use a HashMap.
    import java.util.*;
    public class BinaryToHexConversion { 
         static final HashMap<String, Character > binaryToHexMap = new HashMap<String, Character >();
          * load binaryToHexMap values
         static {
              binaryToHexMap.put( "0000", '0');
              binaryToHexMap.put( "0001", '1');          
              binaryToHexMap.put( "0010", '2');
              binaryToHexMap.put( "0011", '3');          
              binaryToHexMap.put( "0100", '4');
              binaryToHexMap.put( "0101", '5');
              binaryToHexMap.put( "0110", '6');
              binaryToHexMap.put( "0111", '7');
              binaryToHexMap.put( "1000", '8');
              binaryToHexMap.put( "1001", '9');
              binaryToHexMap.put( "1010", 'A');
              binaryToHexMap.put( "1011", 'B');
              binaryToHexMap.put( "1100", 'C');
              binaryToHexMap.put( "1101", 'D');
              binaryToHexMap.put( "1110", 'E');
              binaryToHexMap.put( "1111", 'F');     
         public static char convert( String binaryString ) {
              Character returnChar = binaryToHexMap.get( binaryString );
              if ( returnChar != null ) {
                   return returnChar;
              } else {
                   throw new IllegalArgumentException( "Method convert requires 4 character binary String to convert binary to hexadecimal" );
    }

  • How can I get the data array from SQL Server Database?

    Hi,
    I can write a data array(2D)into a table of my SQL Server Database. The data array was writen to a column with image type. I know a data array is transformed a binary string when writing into database, but I dont know how to get the data array when I fetch the binary string from database.
    My question is:
    How to transform the binary string into data array? which vi's should I use? I have tried unflatten from string but failed.
    Any response is appriciated.
    Red

    happyxh0518 wrote:
    > I can write a data array(2D)into a table of my SQL Server Database.
    > The data array was writen to a column with image type. I know a data
    > array is transformed a binary string when writing into database, but I
    > dont know how to get the data array when I fetch the binary string
    > from database.
    >
    > My question is:
    > How to transform the binary string into data array? which vi's should
    > I use? I have tried unflatten from string but failed.
    In order to use Unflatten from string you first need to Flatten it
    before writing it. Also depending on the database driver, the returned
    data may actually not be binary but Hexadecimal encoded ASCII which you
    would first have to decode to binray.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Encode Bytecode in source field to base64 in target field

    Hello,
    I have already posted a similar question regarding base64 encoding of attachment. However now the bytecode is sent in a single field in the source message. This bytecode has to be encoded in base64.
    So far I have not found any solution to do so. I have read about the following API com.sap.aii.utilxi.base64.api.Base64  which should contain two static methods for encoding end decoding.
    However the package cannot be found when trying to import it into an UDF. As this API is not documented, could it be that it is not available anymore on PI 7.1?
    What other possibilites do I have? Do you have any idea? I
    Thank you very much!

    Hi Florian,
    com.sap.aii.utilxi.base64.api.Base64 is no official API, so there is no official documentation on this. Also, if you use this, there can be a possibility that changes might occur in this class without any notice.
    This class has two static methods:
    String encode(byte[]) // binary -> base64
    byte[] decode(String) // base64 -> binary
    Try looking for this class in aii_utilxi_misc.jar, which can be found on PI server - C:\usr\sap\*\*\j2ee\cluster\server0\bin\ext\com.sap.xi.util.misc
    Hope this helps.
    Regards,
    Neetesh

  • Certificate based authentication

    I have a client application that requires certificate based authentication.
    I could not find any instructions on how to set this up in the 11g manuals. So I reverted to the 5.2 manual (http://docs.oracle.com/cd/E19850-01/816-6698-10/ssl.html#18500), and followed some instructions found online.
    I have completed the setup, and the client is able to authenticate using his certificate, and I have verified this in the logs.
    [22/Mar/2012:13:13:33 -0500] conn=34347 op=-1 msgId=-1 - SSL 128-bit RC4; client CN=userid,OU=company,L=city,ST=state,C=US; issuer CN=issuing,DC=corp,DC=company,DC=lan
    [22/Mar/2012:13:13:33 -0500] conn=34347 op=-1 msgId=-1 - SSL client bound as uid=userid,ou=employees,o=company
    [22/Mar/2012:13:13:33 -0500] conn=34347 op=0 msgId=1 - BIND dn="" method=sasl version=3 mech=EXTERNAL
    When adding the usercertificate attribute to the ID I used the following LDIF:
    version: 1
    dn: uid=userid,ou=employees,o=company
    changetype: modify
    replace: userCertificate
    usercertificate: < file:///home/user/Certs/usercert.bin
    the file was a binary encoded certificate file.
    Here is the part that I don't understand when I do a search (or LDIF export) of the user object with the certificate it just returns a short base64 encoded string. when I decode this string, it is just the literal string of "< file:///home/user/Certs/usercert.bin".
    So it appears that the certificate has not been stored on the user object in binary, and yet the certificate authentication still works. The file mentioned, does not exist on the LDAP server (the cert was loaded from another server), so there is no way that it is reading the cert from the file.
    Anyone have any idea what is going on here? And why certificate auth works, when there appears to be not cert stored in LDAP?
    If by chance this is how it is all suppose to work, then how do I go about backing up the usercertificate attribute when I do my LDAP data backups?
    Thanks
    Brian

    Cyril,
    Thanks for the reply.
    I believe I am doing both types of certificate authentication, you are describing. My issue is that when I perform the steps to store the PEM formatted cert into the directory server, rather than storing a binary value of the cert, it appears to be storing the path to the file I attempted to import. The odd part is that I can still authenticate even after this is done.
    I tried to post as much info as I could before without posting any sensitive data, I'll try and expand on that below.
    Here is my documentation of the steps taken to configure the server and setup a user, for what I believe to be certificate based authentication, where the user is authenticated solely on the certificate that they provide (no password is sent).
    1. Server must be running SSL, all connections for Certificate Auth are done over SSL (just a note)
    2. From the DSCC
    ----a. Directory Servers Tab -> Servers Tab -> Click Server Name
    ----b. Security Tab -> General Tab
    ----c. In "Client Authentication" section, select:
    --------i. LDAP Settings: "Allow Certificate-Based Client Authentication"
    --------ii. This should be the default setting.
    3. On the directory server setup the /ldap/dsInst/alias/certmap.conf file:
    ----a. certmap default default
    ----default:DNComps
    ----default:FilterComps uid,cn
    4. restart the directory server
    5. Do the following to setup the user who will be connecting. On their unix account (or similar)
    ----a. Create a directory to hold the certDB
    --------i. mkdir certdb
    ----b. Create a CertDB
    --------i. /ldap/dsee7/bin/certutil -N -d certdb
    ------------1) Enter a password when prompted
    ----c. Import the CA cert
    --------i. /ldap/dsee7/bin/certutil -A -n "OurRootCA" -t "C,," -a -I ~/OurRootCA.cer -d certdb
    ----d. Create a cert request
    --------i. /ldap/dsee7/bin/certutil -R -s "cn=userid,ou=company,l=city,st=state,c=US" -a -g 2048 -d certdb
    ----e. Send the cert request to the PKI Team to generate a user cert
    ----f. Take the text of the generated cert & save it to a file
    ----g. Import the new cert into your certdb
    --------i. /ldap/dsee7/bin/certutil -A -n "certname" -t "u,," -a -i certfile.cer -d certdb
    ----h. Create a binary version of cert
    --------i. /ldap/dsee7/bin/certutil -L -n "certname" -d certdb -r > userid.bin
    ----i. Add the binary cert to the user's LDAP entry (version: 1 must be included - I read this in a doc somewhere, but it doesn't seem to matter)
    --------i. ldapmodify
    ------------1) ldapmodify -h host -D "cn=directory manager" -w password -ac
    ------------2)
    ------------version: 1
    ------------dn: uid=userid,ou=employees,o=company
    ------------sn: Service Account
    ------------givenName: userid
    ------------uid: userid
    ------------description: Service Account for LDAP
    ------------objectClass: top
    ------------objectClass: person
    ------------objectClass: organizationalPerson
    ------------objectClass: inetorgperson
    ------------cn: Service Account
    ------------userpassword: password
    ------------usercertificate: < file:///home/userid/Certs/userid.bin
    ------------nsLookThroughLimit: -1
    ------------nsSizeLimit: -1
    ------------nsTimeLimit: 180
    After doing this setup I am able to perform a search using the certificate:
    ldapsearch -h host -p 1636 -b "o=company" -N "certname" -Z -W CERTDBPASSWORD -P certdb/cert8.db "(uid=anotherID)"
    This search is successful, and I can see it logged, as having been a certificate based authentication:
    [23/Mar/2012:13:25:20 -0500] conn=44605 op=-1 msgId=-1 - fd=136 slot=136 LDAPS connection from x.x.x.x:53574 to x.x.x.x
    [23/Mar/2012:13:25:20 -0500] conn=44605 op=-1 msgId=-1 - SSL 128-bit RC4; client CN=userid,OU=company,L=city,ST=state,C=US; issuer CN=issuer,DC=corp,DC=company,DC=lan
    [23/Mar/2012:13:25:20 -0500] conn=44605 op=-1 msgId=-1 - SSL client bound as uid=userid,ou=employees,o=company
    [23/Mar/2012:13:25:20 -0500] conn=44605 op=0 msgId=1 - BIND dn="" method=sasl version=3 mech=EXTERNAL
    If I understand correctly that would be using the part 2 of your explanation as using the binary encoded PEM to authenticate the user. If I am not understanding that corretly please let me know.
    Now the part that I am really not getting is that the usercertificate that is stored on the ID is as below:
    dn: uid=userid,ou=employees,o=company
    usercertificate;binary:: PCBmaWxlOi8vL2hvbWUvdXNlcmlkL0NlcnRzL3VzZXJpZC5iaW4
    which decodes as: < file:///home/userid/Certs/userid.bin
    So I'm still unclear as to what is going on here, or what I've done wrong. Have I set this up incorrectly such that Part 2 as you described it is not what I have setup above? Or am I missunderstanding part 2 entirely?
    Thanks
    Brian
    Edited by: BrianS on Mar 23, 2012 12:14 PM
    Just adding ---- to keep my instruction steps indented.

  • GetContextURL returns null using the default ECM repository

    Hello experts,
    This is the scenario.
    We are using the SAP ECM repositoy for document storage in our BPM proyect. In this case we are using the default configuration and repository location  (ecm/default  and DefaultUser), but after the upload, when i try to get the document URL with the method getContentURL(), returns null.
    The ECM documentarion saids than this condition is expected when using a third party repostiory, but this is not the case.
    I appreciate a lot your advices and recomendations,
    Best regards!
    Julio C. Leyva

    Hi Vasil,
    We didn't resolve this issue by this method, because we are using the default ECM repository witch doesn't support the operation getContextURL() and gets the "null" result. If you are using a different repository maybe works.
    Re-checking the API specification, saids:
    getContentURL
    java.lang.String getContentURL() throws InvalidStateException, RepositoryException  Returns a URL that can be used to retrieve the content directly from the respective backend, thus bypassing ECM. Note that this URL might have several restrictions which depend on the connector's backend store, such as a limited lifetime or requiring a user to authenticate with different credentials than the ones used to connect to ECM. Other stores might provide no content URL at all, in which case this method returns null. Applications might want to consider utilizing the ECM WebDAV server to present their users a URL that is located on the same system as ECM.  
    Finally, you would consider to expose a webservice (EJB Session Bean) witch encapsulates the ECMI implementation and extract your file content as a binary array (encode/decode), sending as the input your path/fileName for lookup in the ECM repository.
    Regards!

  • Huffman Coding! HELP!

    I need to create a huffman code which reads in a file of at least 1000 chars, creating a frequency table, then puts them into a huffman tree, in prioity order, create a code table, which contains the Huffman code for each character, encode the message into binary, and then decodes it from binary back to text and stores it into a new file! can anyone plz help?
    here is my code so far:
    import java.io.*;
    import java.util.*; // for Stack class
    class Node
    public int iData; // data item (key)
    public double dData; // data item
    public Node leftChild; // this node's left child
    public Node rightChild; // this node's right child
    public void displayNode() // display ourself
    System.out.print('{');
    System.out.print(iData);
    System.out.print(", ");
    System.out.print(dData);
    System.out.print("} ");
    } // end class Node
    class Tree
    private Node root; // first node of tree
    public Tree() // constructor
    { root = null; } // no nodes in tree yet
    public Node find(int key) // find node with given key
    {                           // (assumes non-empty tree)
    Node current = root; // start at root
    while(current.iData != key) // while no match,
    if(key < current.iData) // go left?
    current = current.leftChild;
    else // or go right?
    current = current.rightChild;
    if(current == null) // if no child,
    return null; // didn't find it
    return current; // found it
    } // end find()
    public void insert(int id, double dd)
    Node newNode = new Node(); // make new node
    newNode.iData = id; // insert data
    newNode.dData = dd;
    if(root==null) // no node in root
    root = newNode;
    else // root occupied
    Node current = root; // start at root
    Node parent;
    while(true) // (exits internally)
    parent = current;
    if(id < current.iData) // go left?
    current = current.leftChild;
    if(current == null) // if end of the line,
    {                 // insert on left
    parent.leftChild = newNode;
    return;
    } // end if go left
    else // or go right?
    current = current.rightChild;
    if(current == null) // if end of the line
    {                 // insert on right
    parent.rightChild = newNode;
    return;
    } // end else go right
    } // end while
    } // end else not root
    } // end insert()
    public void traverse(int traverseType)
    switch(traverseType)
    case 1: System.out.print("\nPreorder traversal: ");
    preOrder(root);
    break;
    case 2: System.out.print("\nInorder traversal: ");
    inOrder(root);
    break;
    case 3: System.out.print("\nPostorder traversal: ");
    postOrder(root);
    break;
    System.out.println();
    private void preOrder(Node localRoot)
    if(localRoot != null)
    System.out.print(localRoot.iData + " ");
    preOrder(localRoot.leftChild);
    preOrder(localRoot.rightChild);
    private void inOrder(Node localRoot)
    if(localRoot != null)
    inOrder(localRoot.leftChild);
    System.out.print(localRoot.iData + " ");
    inOrder(localRoot.rightChild);
    private void postOrder(Node localRoot)
    if(localRoot != null)
    postOrder(localRoot.leftChild);
    postOrder(localRoot.rightChild);
    System.out.print(localRoot.iData + " ");
    class Buffer
    public BufferedReader(Reader in, 10000){
    } // end class Tree
    class TreeApp
    public static void main(String[] args) throws IOException
         BufferedReader in = new BufferedReader(new FileReader("foo.in"));
         Tree theTree = new Tree();
         double foundValue;
    } // end main()
    } // end class TreeApp
    ////////////////////////////////////////////////////////////////

    import java.io.*;
    import java.util.*; // for Stack class
    class Node
    public int iData; // data item (key)
    public double dData; // data item
    public Node leftChild; // this node's left child
    public Node rightChild; // this node's right child
    public void displayNode() // display ourself
    System.out.print('{');
    System.out.print(iData);
    System.out.print(", ");
    System.out.print(dData);
    System.out.print("} ");
    } // end class Node
    class Tree
    private Node root; // first node of tree
    public Tree() // constructor
    { root = null; } // no nodes in tree yet
    public Node find(int key) // find node with given key
    { // (assumes non-empty tree)
    Node current = root; // start at root
    while(current.iData != key) // while no match,
    if(key < current.iData) // go left?
    current = current.leftChild;
    else // or go right?
    current = current.rightChild;
    if(current == null) // if no child,
    return null; // didn't find it
    return current; // found it
    } // end find()
    public void insert(int id, double dd)
    Node newNode = new Node(); // make new node
    newNode.iData = id; // insert data
    newNode.dData = dd;
    if(root==null) // no node in root
    root = newNode;
    else // root occupied
    Node current = root; // start at root
    Node parent;
    while(true) // (exits internally)
    parent = current;
    if(id < current.iData) // go left?
    current = current.leftChild;
    if(current == null) // if end of the line,
    { // insert on left
    parent.leftChild = newNode;
    return;
    } // end if go left
    else // or go right?
    current = current.rightChild;
    if(current == null) // if end of the line
    { // insert on right
    parent.rightChild = newNode;
    return;
    } // end else go right
    } // end while
    } // end else not root
    } // end insert()
    public void traverse(int traverseType)
    switch(traverseType)
    case 1: System.out.print("\nPreorder traversal: ");
    preOrder(root);
    break;
    case 2: System.out.print("\nInorder traversal: ");
    inOrder(root);
    break;
    case 3: System.out.print("\nPostorder traversal: ");
    postOrder(root);
    break;
    System.out.println();
    private void preOrder(Node localRoot)
    if(localRoot != null)
    System.out.print(localRoot.iData + " ");
    preOrder(localRoot.leftChild);
    preOrder(localRoot.rightChild);
    private void inOrder(Node localRoot)
    if(localRoot != null)
    inOrder(localRoot.leftChild);
    System.out.print(localRoot.iData + " ");
    inOrder(localRoot.rightChild);
    private void postOrder(Node localRoot)
    if(localRoot != null)
    postOrder(localRoot.leftChild);
    postOrder(localRoot.rightChild);
    System.out.print(localRoot.iData + " ");
    class Buffer
    public BufferedReader(Reader in, 10000){
    } // end class Tree
    class TreeApp
    public static void main(String[] args) throws IOException
    BufferedReader in = new BufferedReader(new FileReader("foo.in"));
    Tree theTree = new Tree();
    double foundValue;
    } // end main()
    } // end class TreeApp
    ////////////////////////////////////////////////////////////////

  • File Numbering

    I've  taken care to number files in a folder; F1, F2, and so on through say F45, when I use  "Open" I get something like F1, F10, F11, F12.... F2, F20, F21 and so on but I want just the simple sequence 1, 2, 3, 4, and so on. My fading memory  recalls it being something to do with binary or hexadecimal and it no longer happens in Windows Explorer.
    When creating a contact sheet, images are out of sequence relative to a narrative.
    I feel a little ashamed as it is so basic. I'm using CS2 with XP SP2 Professional  but will soon have Win 7 Professional and CS5 & DW CS5 once my new PC is "delivered".
    thanks in anticipation
    graham

    Thank you to all who helped me.
    As suggested, I've added leading zeroes after the F which stands for Fig, e.g. F001 ...  F011 and so on, and now "Open" produces file names in the correct sequence with a correct sequence follow-on in "Contact Sheet".
    Brilliant, so thank you all
    regards
    graham (cobtramg)

  • JMF on Raspberry Pi

    I have a proyect running on linux x86 using JMF
    The app uses JMF to play videos of phisical workout in a gym. Im trying to port the app to a Raspberry Pi running raspbian
    My problem is that the JMF has binary libs to decode the media
    Is there any way to get those libs for armv6 of the raspberry pi ?
    is the source open to try do it myself ?
    Thanks in advance
    Pablo

    loskylp wrote:
    but just in case im askingI really don't understand why you want to ask futile questions. Its abandoned and ancient - the fact that you know that makes it even more strange that you want to pursue it anyway.
    Even though it is less outdated, you may also note that FMJ hasn't been updated in a while too.
    "Last updated : Oct, 2007"
    And the forums are also pretty dead:
    http://sourceforge.net/p/fmj/discussion/546432
    I don't know about you, but I make hard decisions based on such information. If you run into issues I see near zero chance that it will ever be fixed. I tend to stick only to APIs and frameworks which are actually still actively maintained.

  • The lilo vga variable

    one thing i wanted to know in detail ... and i think i'm not the only one who dont know the details about that (also when reading the howtos in other distros)
    ... it can be a chapter in the linux-howtos for newbies in archlinux ... for the collection Gyroplast started on his page (great job, great idea, Kompliment)
    what i'm asking: for lilo (or grub): what video-modes exist? what i know from the /Documentation/fb/vesafb.txt
    | 640x480 800x600 1024x768 1280x1024
    ----+-------------------------------------
    256 | 0x301 0x303 0x305 0x307
    32k | 0x310 0x313 0x316 0x319
    64k | 0x311 0x314 0x317 0x31A
    16M | 0x312 0x315 0x318 0x31B
    they are in hex, but of course you should say lilo the mode in a decimal number e.g. vga=798
    that's what i know ... any additions?
    -> is there a way to find out the modes a card (chipset) support?

    you could take this time to lean how to convert amongst binary, octal, hexadecimal, and base ten  decmal:
    BIN OCT HEX B10 BIN HEX B10
    0000 0 0 0 1000 8 8
    0001 1 1 1 1001 9 9
    0010 2 2 2 1010 A 10
    0011 3 3 3 1011 B 11
    0100 4 4 4 1100 C 12
    0101 5 5 5 1101 D 13
    0110 6 6 6 1110 E 14
    0111 7 7 7 1111 F 15
    Hex and binary work just like base 10 except with base 16 and base 2
    i.e. for each digit to the left of the decimal, its that digit multiplied by the base raised to thepower of the distanc from the decimal
    Take these numbers for example:
    Base 10:
    5293 = 5 * 10^3 + 2 * 10^2 + 9 * 10^1 + 3 * 10^0 = 5293 ##remember, anything to the 0th powor is 1
    Base 8 (octal):
    12255 = 1 * 8^4 + 2 * 8^3 + 2 * 8^2 + 5 * 8^1 + 5 * 8^0 = 5293
    Base 16 (hexadecimal):
    14AD = 1 * 16^3 + 4 * 16^2 + 10 * 16^1 + 13 * 16 ^ 0 = 5293
    Base 2 (binary):
    Now the neat thing about converting to binary is if you have something in octal or fex, just use your handy conversion table. ::NOTE:: Octal digits only have 3 bits (drop the insignificant... i.e. leftmost bit off the chart above)
    5293 = 14AD = 12255 = 1010010101101
    Also... note that the permissions of a file are displayed in one of two ways
    1)
    As a bitstring (like when you ls -l)
    rwxrwxrwx rw-rw-r--
    Or as octal... pair those permissions in groups of three and you have a 3 digit octal number
    777 664
    I hope i did not insult your intelligence by posting this, but i figured it wouldnt hurt either
    ::EDIT:: sorry i think i misunderstood your original post... please don't take offence to this ::/EDIT::

  • Decode Base64 and save as binary file

    Hi there,
    I am using Adobe Air 1.5 with JavaScript and want to save a file to my hard
    drive. I get the data from a WebService via SOAP as a Base64 encoded string. A test-string is attached. When I try to decode it with
    the WebKit function "atob()" and try to save this bytes with following code, I can't open the file.
    this.writeFile = function(outputfile, content, append){
    var file =a ir.File.applicationStorageDirectory.resolvePath(outputfile);
    var stream = newa ir.FileStream();
    if (append) {
    stream.open(filea, ir.FileMode.APPEND);
    }else {
    stream.open(filea, ir.FileMode.WRITE);
    try{//Binärdaten
    stream.writeBytes(content0, , content.length);
    }catch(e){//Textdaten
    stream.writeUTFBytes(content);
    stream.close();
    The same happens when I try to open a file from my HDD and read in the bytes. When I decode it to base64, the string is not equal to the string, which is correct.
    I attached a working Base64 string, which I could convert back to a zip-file via a only encoder.
    So my question is, how can I decode a Base64 string and save the binary data to a file?
    Thank you for your help.

    I rewrote the Base64 decoder/encoder to use it with a ByteArray. Here ist the code:
    var byteArrayToBase64 = function(byteArr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var encOut = "";
        var bits;
        var i = 0;
        while(byteArr.length >= i+3){
            bits = (byteArr[i++] & 0xff) << 16 | (byteArr[i++] & 0xff) << 8 | byteArr[i++] & 0xff;
              encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
        if(byteArr.length-i > 0 && byteArr.length-i < 3){
            var dual = Boolean(byteArr.length - i - 1);
            bits = ((byteArr[i++] & 0xff) << 16) | (dual ? (byteArr[i] & 0xff) << 8 : 0);
            encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + (dual ? base64s.charAt((bits & 0x00000fc0) >> 6) : '=') + '=';
        return encOut;
    var base64ToByteArray = function(encStr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var decOut = new air.ByteArray(); 
        var bits;
        for(var i = 0, j = 0; i<encStr.length; i += 4, j += 3){
            bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
            decOut[j+0] = ((bits & 0xff0000) >> 16);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 2) != 61){
                   decOut[j+1] = ((bits & 0xff00) >> 8);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 1) != 61){
                   decOut[j+2] = (bits & 0xff);
        return decOut;

  • Converting a Hexadecimal String to a Binary String

    Hello NG,
    I would like to convert an 8 Bit Hexadecimal String (example C0034000)
    to it´s equivalent in binary (in this case---> 1100 0000 0000 0011...
    and so on), I didn´t find any possible way to do this. I´am not
    talking about the simple representation on the front pannel. Some
    Postings say that this ist possible with the "Format Value" Function
    adding an "%b" to the entring, but in my case it does not function.
    Could someone help me, thanks in advance!

    > I would like to convert an 8 Bit Hexadecimal String (example C0034000)
    > to it´s equivalent in binary (in this case---> 1100 0000 0000 0011...
    > and so on), I didn´t find any possible way to do this. I´am not
    > talking about the simple representation on the front pannel. Some
    > Postings say that this ist possible with the "Format Value" Function
    > adding an "%b" to the entring, but in my case it does not function.
    The task here is to convert a string to a different string. The easiest
    way to do this is to convert the string to a numer, then format the
    number as a binary string.
    On the string palette the Scan from String using %x can be used to
    change a hex string into a numeric integer. The Format to String with
    %b and other nodes can take a numeric i
    nteger and return a string of
    binary characters. These two nodes wired together with the correct
    constants should do what you want.
    Greg McKaskle

  • [Urgent!!] How to do quadrature decoding using DAQCard 6062E??

    Hi,
    I am Xiaofei, a beginner of LabVIEW. Now i am dealing with a project involving quadrature decoding by using DAQ Card 6062E and breakout board CB68LP. We need to use 2 optical encoders simutaneously, and for each encoder, we need to use 3 digital channels (A,B and Index), therefore there will be totally 6 digital channels in use. For this reason, is it still good to use the counter channel? or we'd better use 6 DIO?
    I'm not sure if there is any existing VI that can help us with decoding, if there is,  could you please let me know how we can find it?
    If we will need to make the decoding code by ourselves, could you please give me some hint so that we can start it?
    I heard that there should be an example called "How to Count.vi" that shows how to decode, however i failed to find it by using example finder, so does anyone know how to find it?
    This is kinda urgent, i have to figure it out by tonight in order to keep my project rolling. So if you have any idea about it, pleeeeeeeeeease let me know!  Thanks a million!!!
    Regards,
    Xiaofei

    Duplicate post.
    Please do not generate a new message thread with the same question.
    Keep your messages to the original post.

Maybe you are looking for