Print a null character

Okay, so I open a socket and connect to a networked machine that accepts strings as commands. Commands are terminated by the null character '\0'. I know this works as I've done it in Python with no problems. Right now all I'm trying to do is write an ascii char "0" followed by a null. My machine isn't responding and I'm pretty sure its because Java is ignoring my '\0' and just writing the characters preceding it.
   public void connect() throws IOException{
        System.out.println("Trying to connect...\n");
        //connect to roobt
        Socket outsock = new Socket("13.62.154.243", 15223);
        Socket insock = new Socket("13.62.154.243",15224);
        //setup reading/writing.
        PrintWriter out = new PrintWriter(outsock.getOutputStream());
        BufferedReader in = new BufferedReader(new InputStreamReader(insock.getInputStream()));
        String r = in.readLine();
        System.out.println("Received: " + r + "\n");
        //inform robot that connection is closing
        out.print("0\0");
        //close sockets
        outsock.close();
        insock.close();
    }Am I wrong? Is there a way to force the null character to be written?
And as an aside, is there a way to read lines terminated by a null as opposed to a newline \n or carriage return \r? I can modify the code on the machine to respond with lines terminated by \n's, but I'd rather not have to redo it all. I wrote the code for my machine to function with a Python socket script, and now I'm attempting to rewrite this into Java.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scan
ner.html
Use the null character as the delimiter.Okay, I see how this could be useful, except I don't have a string yet. A have a BuffereReader that I need to make into a string. Once its a string, then I could use the scanner. Right? So, I still have a problem.

Similar Messages

  • Problem is occurring in docx format; it is not printing "New Line" character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.

    Problem: Problem
    is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
    Environment: -
    Operating
    System:
    Windows XP SP2/7
    Language:
    C#
    MS
    Office Version: - MS Office 2007/2010/2013
    Problem
    Description: -
    We
    havedocx
    file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
    Docx
    file format (Sample.docx)
    Test this music
    Word processing
    Testing docx file
    Output:
    - Test this music Word processing Testing docx file
    Requirement:
    - We
    have requirement to get following text in particular format with New Line from docx because client is using docx format only.
    Test this music
    Word processing
    Testing docx file
    Attempt:
    We have tried a lot after changing IFilter configuration,
    but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
    Because it is application specific problem, kindly
    assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
    Doc Filter Location: - %systemroot%\system32\OffFilt.dll
    Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
    Code Snippet for setting property of filter
    internal static IFilter LoadAndInitIFilter(string fileName, string extension)
                IFilter filter
    = LoadIFilter(extension);
                if (filter
    == null)
                    return null;
                IPersistFile persistFile
    = (filter as IPersistFile);
                if (persistFile
    != null)
    persistFile.Load(fileName, 0);
                    IFILTER_FLAGS flags;
                    IFILTER_INIT iflags
    =
                                IFILTER_INIT.CANON_HYPHENS
    |
                                IFILTER_INIT.CANON_PARAGRAPHS
    |
                                IFILTER_INIT.CANON_SPACES
    |
                                IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
    |
                                IFILTER_INIT.HARD_LINE_BREAKS
    |
                                IFILTER_INIT.FILTER_OWNED_VALUE_OK;
                    if (filter.Init(iflags,
    0, IntPtr.Zero, out flags)
    ==IFilterReturnCode.S_OK)
                        return filter;
                Marshal.ReleaseComObject(filter);
                return null;
    Kindly
    assist to resolve this issue and also let us know if any input is required.
    For any help, we would be really
    thankful.

    Kindly
    assist to resolve this issue and also let us know if any input is required.
    For any help, we
    would be really thankful.

  • Match Pattern does not function properly when searching for a null character

    I'm using Match Pattern to extract a null terminated string from a response I'm getting from a device on a serial port. The VI is attached and below is a screenshot of the block diagram.
    It works just fine with index set to 0, 1, or 2. When index is 3, I get the output shown below.
    Why is Match Pattern not finding the null character?
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Grab Nullterm String.vi ‏15 KB

    I'm a dope, need to remove the wire from the Offset control to the Match Pattern control.
    DUH!

  • My keyboard on macbook pro (laptop) is acting weird. One key is not responding at all. Have verified using Keyboard viewer and some other keys are printing the unresponsive character at random.

    my keyboard on macbook pro (laptop) is acting weird. One key is not responding at all. Have verified using Keyboard viewer and some other keys are printing the unresponsive character at random. "z" is the unresponsive character.
    Is it a damaged keyboard ?
    The laptop is just 2 months old, will Apple replace it with a new one if its indeed a damaged keyboard or just repair, I use it for official purposes so being without a laptop is not much of an option.

    No one here works for Apple, so we don't know what Apple might or might not do.  If it's a genuine defect, they will of course repair it under warranty.  It is not their responsibility if it effects your ability to work or not, so that's on you.
    If, however, they determine that the key is problematic as a result of your misuse of the laptop, then everything is on you.  And trust me, if they find a glob of dried up beer or coffee there, they will charge you.
    Your only choice is to take it in for repair.

  • JCO.Server appends null character to string

    I am a complete SAP and JCO newbie so I'll try making as much since as I can, given the fact that I'm not familiar with SAP terminology and technology. I've been lent as a developer to another group which needs a legacy application rewritten. The application processes a RFC and decrypts the RFC encrypted payload and returns it along with a status code.
    I have made progress - I'm able to register my server with the SAP runtime and using the SAP GUI application and the help of a SAP developer, I'm able to make an RFC call to my application. I'm able to read the parameters sent from SAP and write parameters back.
    The problem is that one of the parameters I'm writing back (java.lang.String) appears to have and extra character on SAP side. On the GUI it appears as a '#' (pound) sign. The SAP developer told me the string is terminated with a null character which I know is a C/C++ thing but not a Java thing. I don't think it is a Unicode issue. The Java server is not running in Unicode mode and any attempt to set the jco.server.unicode property (I may have forgotten the exact name) to a value of 1 causes the RFC to fail.
    I think the issue is likely to be the manner in which I defined the function parameters or the manner in which I write them. The following are code snippets:
    Defining the function:
    JCO.MetaData metadata = new JCO.MetaData(Constants.FUNCTION_DECRYPT);
    metadata.addInfo(Constants.PARAMETER_SCHEME,      JCO.TYPE_INT,    255,   0,  0, JCO.IMPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_ENCRYPTED,   JCO.TYPE_STRING, 255,   0,  0, JCO.IMPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_DECRYPTED,   JCO.TYPE_STRING, 255,   0,  0, JCO.EXPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_RETURN_CODE, JCO.TYPE_INT,    255,   0,  0, JCO.EXPORT_PARAMETER, null);
    Server request handling code:
    protected void handleRequest(JCO.Function function)
                    // Obtaining import/export parameter lists.
                    JCO.ParameterList input  = function.getImportParameterList();
                    JCO.ParameterList output = function.getExportParameterList();
                    // Getting scheme and encrypted text parameters.
                    int scheme       = input.getInt(Constants.PARAMETER_SCHEME);
                    String encrypted = input.getString(Constants.PARAMETER_ENCRYPTED);
                    // Decoding base 64 string.
                    byte[] bytes = Base64.decode(encrypted);
                    // Obtaining cipher by scheme and decrypting the text.
                    AppCipher cipher = ApplicationConfiguration.getDecryptor(scheme);
                    if(cipher == null)
                                    logger.error("Unable to get cipher due to an unknown encryption scheme: " + scheme);
                    else
                                    byte[] decrypted = cipher.decrypt(bytes);
                                    String plainText = new String(decrypted);
                                    // Setting decrypted value information and return code.
                                    output.setValue(plainText, Constants.PARAMETER_DECRYPTED);
                                    output.setValue(Constants.RETURN_CODE_SUCCESS, Constants.PARAMETER_RETURN_CODE);

    I seem to have made progress. If I define the parameter type as JCO.TYPE_CHAR instead of JCO.TYPE_STRING, it works:
    metadata.addInfo(Constants.PARAMETER_DECRYPTED,   JCO.TYPE_CHAR,   255,   0,  0, JCO.EXPORT_PARAMETER, null);
    That is the only change I made. I'm still setting the parameter value as java.lang.String. I hope this won't cause issues elsewhere. I was also able to change the field definition and set it as a byte array. However, that had the problem of having to define the exact length of the byte array in the field metadata otherwise the remaining bytes would appear as null bytes on SAP side.

  • Putting a null character in a String?

    Hi,
    I need to send a null character through a nio channel. Specifically, it needs to be decoded from a String into a byte array. Can I append a null character to a String so that getBytes() method will return it? Thanks,
    ranko

    Thanks, I tried that but it doesn't work. I also
    tried appending '\0' and an uninitialized character
    which should by default have a value of a null
    character. I tried creating a String out of a char
    array that has one element containing a null character
    but that did not work either. I guess that since null
    characters end the String, you cannot actually add
    them to the body of the String. Or is there a way?FYI, strings aren't null-terminated in Java.

  • Null character in text file

    I am trying to read text file in stored procedure. The file in text editor looks like some of the lines have funny character looked like sqare. That character is a null character. When I run my procedure I gives me read error. So I tried to oepn that text file in sql editor window and I found that I displayed part of the file. It didnot display the file right where that character is. This sounds like it does not like that symbolic null character and didnot load rest of the text file.
    Any idea ???

    Though u state that the file u are trying to read is a text file , from the description it looks as if its probably a binary.Its also possible that the file u are reading has been created by an editor on machine with a diffrent character set or say by editors like word, notepad which do not always save the file in pure in text format.
    Whats happening in the sql editor window is that the editor encounters a binary character in the file which represents the EOF (End Of File) on u're system and therefore the editor stops reading the file beyond that point and hence u see "half the file".
    Try checking up the source of the file if the file was created and saved in pure text format , if the characterset was converted appropriately on ftp etc.

  • Array keeps printing out null

    I have an array that continues to print out null but when I trace it exactly after I store it, it stores what I want it to store. "White Bread"
    Here is where the errors at:
    int orderNum = 0;
                   while(orderNum < cartItems)
                        printItems = "<html>" + printItems + "<br>1" + itemNameStrings[orderNum] + "</html>";
                        System.out.println(printItems);//Trace
                        System.out.println(cartItems);//Trace
                        System.out.println(orderNum);//Trace
                        System.out.println(itemNameStrings[orderNum]);//Trace
                        orderNum++;
                   }And here is the whole project:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.border.*;
    import java.text.*;
    public class AdrianP1 implements ActionListener
         //---------------GLOBAL DECLARING------------------
         DecimalFormat Currency = new DecimalFormat("#0.00 dollars");//Currency
         //Changing Variables (void)
         String printItems = "Items";
         int arraySize = 2;
         String[] itemNameStrings;
         boolean first = true;
         boolean order = false;
         String itemName = "Error";
         double itemCost = 0.00;
         int cartItems = 0;
         //Main Frames
         final JFrame frame = new JFrame("Subway Sandwich Store");
         JFrame mainFrame = new JFrame("Subway Sandwich Store | Welcome");
         JFrame menuFrame = new JFrame("Subway Sandwich Store | Main Menu");
         JFrame instrucFrame = new JFrame("Subway Sandwich Store | Instructions");
         JFrame playFrame = new JFrame("Subway Sandwich Store | Play Game");
         JFrame breadFrame = new JFrame("Subway Sandwich Store | Order Bread");
         JFrame toppingFrame = new JFrame("Subway Sandwich Store | Order Toppings");
         JFrame condimentFrame = new JFrame("Subway Sandwich Store | Order Condiments");
         JFrame confirmFrame = new JFrame("Subway Sandwich Store | Confirm Your Order");
         JFrame cartFrame = new JFrame("Subway Sandwich Store | Your Cart");
         //---Main Buttons---
         final JButton mainMenuButton = new JButton("Main Menu");
         final JButton mainMenuButton1 = new JButton("Main Menu");
         final JButton mainMenuButton2 = new JButton("Main Menu");
         final JButton mainMenuButton3 = new JButton("Main Menu");
         final JButton goBackButton = new JButton("Go back");
         final JButton goBackButton1 = new JButton("Go back");
         final JButton goBackButton2 = new JButton("Go back");
         final JButton goBackButton3 = new JButton("Go back");
         final JButton goBackButton4 = new JButton("Go back");
         final JButton playButton1 = new JButton("Order Now!");
         final JButton playButton2 = new JButton("Order Now!");
         final JButton instrucButton = new JButton("Instructions");
         final JButton exitButton = new JButton("Exit");
         //---Play Buttons---     
         final JButton checkButton = new JButton("Check Out");
         final JButton checkButton1 = new JButton("Check Out");
         final JButton cartButton = new JButton("Cart (" + cartItems + ")");
         final JButton breadButton = new JButton("Bread");
         final JButton toppingsButton = new JButton("Toppings");
         final JButton condimentsButton = new JButton("Condiments");
         //-------Bread------
         double bwCost = 0.50, bwlCost = 0.50, biCost = 0.75, bhCost = 0.50;
         boolean whiteB = false, wholeB = false, italB = false, harvestB = false;
         final JButton whiteBreadButton = new JButton("Order White");
         final JButton wholeBreadButton = new JButton("Order Wheat");
         final JButton italianBreadButton = new JButton("Order Italian");
         final JButton harvestBreadButton = new JButton("Oder Harvest");
         //-----Toppings-----
         JButton orderTopButton = new JButton("Order the Selected Topping");
         JLabel pictureTop;
         JComboBox toppingList;
         //----Condiments----
         final JButton ketchupButton = new JButton("Order Ketchup");
         final JButton mustardButton = new JButton("Order Mustard");
         final JButton relishButton = new JButton("Order Relish");
         //-----Confirm------
         final JLabel confirmTextLabel;
         final JButton acceptButton = new JButton("Accept");
         final JButton declineButton = new JButton("Decline");
         //----Cart Screen---
         final JLabel cartItemLabel = new JLabel("<html><u>Items</u><br>No Items.</html>", JLabel.LEFT);
         final JLabel cartPriceLabel = new JLabel("<html><u>Price</u><br>No Items.</html>");
         //-------------END GLOBAL DECLARING-----------------     
         //ActionPerformed Method
         public void actionPerformed(ActionEvent event)
              if(event.getSource()==mainMenuButton || event.getSource()==mainMenuButton1 || event.getSource()==mainMenuButton2 || event.getSource()==mainMenuButton3)
                   playFrame.setVisible(false);
                   mainFrame.setVisible(false);
                   instrucFrame.setVisible(false);
                   menuFrame.setVisible(true);
              if(event.getSource()==goBackButton || event.getSource()==goBackButton1 || event.getSource()==goBackButton2 || event.getSource()==goBackButton3 || event.getSource()==goBackButton4)
                   cartFrame.setVisible(false);
                   confirmFrame.setVisible(false);
                   condimentFrame.setVisible(false);
                   toppingFrame.setVisible(false);
                   breadFrame.setVisible(false);
                   instrucFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==instrucButton)
                   menuFrame.setVisible(false);
                   instrucFrame.setVisible(true);
              if(event.getSource()==playButton1 || event.getSource()==playButton2)
                   instrucFrame.setVisible(false);
                   menuFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==breadButton)
                   playFrame.setVisible(false);
                   menuFrame.setVisible(false);
                   breadFrame.setVisible(true);
              if(event.getSource()==toppingsButton)
                   playFrame.setVisible(false);
                   toppingFrame.setVisible(true);
              if(event.getSource()==condimentsButton)
                   playFrame.setVisible(false);
                   condimentFrame.setVisible(true);
              if(event.getSource()==acceptButton)
                   ++arraySize;
                   itemNameStrings = new String[arraySize];
                   itemNameStrings[cartItems] = itemName;
                   System.out.println(itemNameStrings[cartItems]);
                   cartItems++;
                   cartButton.setText("Cart (" + cartItems + ")");
                   confirmFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==declineButton)
                   confirmFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==cartButton)
                   int orderNum = 0;
                   while(orderNum < cartItems)
                        printItems = "<html>" + printItems + "<br>1" + itemNameStrings[orderNum] + "</html>";
                        System.out.println(printItems);//Trace
                        System.out.println(cartItems);//Trace
                        System.out.println(orderNum);//Trace
                        System.out.println(itemNameStrings[orderNum]);//Trace
                        orderNum++;
                   cartItemLabel.setText(printItems);
                   System.out.println(printItems);
                   playFrame.setVisible(false);
                   cartFrame.setVisible(true);
              if(order==true)
                   if(event.getSource()==whiteBreadButton)
                        whiteB = true;
                        itemName = "White Bread";
                        itemCost = bwCost;
                        confirmTextLabel.setText("<html>Would you like to purchase <u>" + itemName + "</u> <br>for a cost of <u>$" + Currency.format(itemCost) + "</u>?</html>");
                        breadFrame.setVisible(false);
                        confirmFrame.setVisible(true);
                   if(event.getSource()==wholeBreadButton)
                        wholeB = true;
                        confirmFrame.setVisible(true);
                   if(event.getSource()==italianBreadButton)
                        italB = true;
                        confirmFrame.setVisible(true);
                   if(event.getSource()==harvestBreadButton)
                        harvestB = true;
                        confirmFrame.setVisible(true);
              if(event.getSource()==exitButton)
                   System.exit(0);
              if(event.getSource()==toppingList)
                   JComboBox cb = (JComboBox)event.getSource();
                 String toppingName = (String)cb.getSelectedItem();
                 updateLabel(toppingName);
         //Main Method   
        public static void main(String[] args) throws Exception
             new AdrianP1();         
        //Constructive and Starting Method
        AdrianP1()
             //--------------------------Action Listeners----------------------------------
             //Creates all action listeners
             mainMenuButton.addActionListener(this);
             mainMenuButton1.addActionListener(this);
             mainMenuButton2.addActionListener(this);
             mainMenuButton3.addActionListener(this);
             goBackButton.addActionListener(this);
             goBackButton1.addActionListener(this);
             goBackButton2.addActionListener(this);
             goBackButton3.addActionListener(this);
             goBackButton4.addActionListener(this);
             exitButton.addActionListener(this);
              instrucButton.addActionListener(this);
              playButton1.addActionListener(this);
              playButton2.addActionListener(this);
              breadButton.addActionListener(this);
              toppingsButton.addActionListener(this);
              condimentsButton.addActionListener(this);
              //Bread buttons
              whiteBreadButton.addActionListener(this);
              //Final buttons
              cartButton.addActionListener(this);
              acceptButton.addActionListener(this);
              declineButton.addActionListener(this);
              //--------------------------Splash Screen----------------------------------
             //Declaring
             order = false;
             final ImageIcon welcomePic = new ImageIcon("welcome.jpg");
             final JPanel sMainPanel = new JPanel(new BorderLayout());
             final JPanel sTopPanel = new JPanel(new BorderLayout());  
             final JPanel sButtonPanel = new JPanel(new FlowLayout ());
             final JLabel sTextLabel = new JLabel("Please click the button below", JLabel.CENTER);     
             final JLabel label = new JLabel("Subway Sandwich Store");
             final JLabel welcomeLPic = new JLabel(welcomePic);
              sTopPanel.add(welcomeLPic , BorderLayout.NORTH);
              sTopPanel.add(sTextLabel);
              sButtonPanel.add(mainMenuButton1);
              sMainPanel.add(sTopPanel , BorderLayout.CENTER);
              sMainPanel.add(sButtonPanel , BorderLayout.SOUTH);
                 mainFrame.setContentPane(sMainPanel);
             mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             mainFrame.pack();
             mainFrame.setVisible(true);
             mainFrame.setSize(350,390);
              //--------------------------Main Menu----------------------------------
              //Declaring
              order = false;
              final ImageIcon mainMenuImage = new ImageIcon("mainMenuImage.jpg");
              final JPanel mMainPanel = new JPanel(new BorderLayout());
              final JPanel mTopPanel = new JPanel(new BorderLayout());
              final JPanel mButtonPanel = new JPanel(new FlowLayout());
              final JLabel imageLabel = new JLabel(mainMenuImage);
              final JLabel textLabel = new JLabel("Please click a button", JLabel.CENTER);
              mTopPanel.add(imageLabel , BorderLayout.NORTH);
              mTopPanel.add(textLabel , BorderLayout.CENTER);
              mButtonPanel.add(playButton1);
              mButtonPanel.add(instrucButton);
              mButtonPanel.add(exitButton);
              mMainPanel.add(mTopPanel, BorderLayout.CENTER);
              mMainPanel.add(mButtonPanel, BorderLayout.SOUTH);
                 menuFrame.setContentPane(mMainPanel);
             menuFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             menuFrame.pack();
             menuFrame.setVisible(false);
             menuFrame.setSize(350,390);
              //--------------------------Instructions----------------------------------
              //Declaring
              order = false;
              final JPanel iTopPanel = new JPanel(new BorderLayout());
              final JPanel iButtonPanel = new JPanel(new FlowLayout());
              final JPanel iMainPanel = new JPanel(new BorderLayout());
              final JLabel iTextLabel = new JLabel("Instructions go HRER!", JLabel.CENTER);
              iTopPanel.add(iTextLabel);
              iButtonPanel.add(mainMenuButton3);
              iButtonPanel.add(playButton2);
              iMainPanel.add(iTopPanel, BorderLayout.CENTER);
              iMainPanel.add(iButtonPanel, BorderLayout.SOUTH);
              iTopPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              instrucFrame.setContentPane(iMainPanel);
             instrucFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             instrucFrame.pack();
             instrucFrame.setVisible(false);
             instrucFrame.setSize(350,390);
              //--------------------------Play Game----------------------------------
              //Declaring
              order = false;
              final ImageIcon playImage = new ImageIcon("playGameImage.jpg");
              final JPanel pTopPanel = new JPanel(new BorderLayout());
              final JPanel pInstrucPanel = new JPanel(new FlowLayout());
              final JPanel pButtonPanel = new JPanel(new FlowLayout());
              final JPanel pButton1Panel = new JPanel(new FlowLayout());
              final JPanel pButton2Panel = new JPanel(new FlowLayout());
              final JPanel pMainPanel = new JPanel(new BorderLayout());
              final JLabel pImageLabel = new JLabel(playImage);
              final JLabel pTextLabel = new JLabel("Click below to customize your sandwich; or check out", JLabel.CENTER);
              pTopPanel.add(pButton2Panel, BorderLayout.NORTH);
              pTopPanel.add(pImageLabel, BorderLayout.CENTER);
              pInstrucPanel.add(pTextLabel, BorderLayout.SOUTH);
              pButton1Panel.add(breadButton);
              pButton1Panel.add(toppingsButton);
              pButton1Panel.add(condimentsButton);
              pButton2Panel.add(checkButton);
              pButton2Panel.add(cartButton);
              pButton2Panel.add(mainMenuButton2);
              pButtonPanel.add(pButton1Panel);
              pMainPanel.add(pTopPanel, BorderLayout.NORTH);
              pMainPanel.add(pInstrucPanel, BorderLayout.CENTER);
              pMainPanel.add(pButtonPanel, BorderLayout.SOUTH);
              pInstrucPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              playFrame.setContentPane(pMainPanel);
             playFrame.setDefaultCloseOperation(playFrame.EXIT_ON_CLOSE);
             playFrame.pack();
             playFrame.setVisible(false);
             playFrame.setSize(350,390);
              //--------------------------Order Bread----------------------------------
              //Declaring
              order = true;
              final ImageIcon whiteBImage = new ImageIcon("whiteB.jpg");
              final ImageIcon wheatBImage = new ImageIcon("wheatB.jpg");
              final ImageIcon italianBImage = new ImageIcon("italianB.jpg");
              final ImageIcon harvestBImage = new ImageIcon("harvestB.jpg");
              final JPanel bTopPanel = new JPanel(new GridLayout(0,2));
              final JPanel bCenterPanel = new JPanel(new FlowLayout());
              final JPanel bButtonPanel = new JPanel(new FlowLayout());
              final JPanel bMainPanel = new JPanel(new BorderLayout());
              final JLabel whiteBLabel = new JLabel(whiteBImage);
              final JLabel wheatBLabel = new JLabel(wheatBImage);
              final JLabel italianBLabel = new JLabel(italianBImage);
              final JLabel harvestBLabel = new JLabel(harvestBImage);
              final JLabel bInstrucTextLabel = new JLabel("Please click the button below a bread to choose", JLabel.CENTER);
              bTopPanel.add(whiteBLabel);
              bTopPanel.add(wheatBLabel);
              bTopPanel.add(whiteBreadButton);
              bTopPanel.add(wholeBreadButton);
              bTopPanel.add(italianBLabel);
              bTopPanel.add(harvestBLabel);
              bTopPanel.add(italianBreadButton);
              bTopPanel.add(harvestBreadButton);
              bCenterPanel.add(bInstrucTextLabel);
              bButtonPanel.add(goBackButton1);
              bMainPanel.add(bTopPanel, BorderLayout.NORTH);
              bMainPanel.add(bCenterPanel, BorderLayout.CENTER);
              bMainPanel.add(bButtonPanel, BorderLayout.SOUTH);
              bTopPanel.setPreferredSize(new Dimension(200, 270));
              bTopPanel.setMinimumSize(new Dimension(200,270));
              bTopPanel.setMaximumSize(new Dimension(200,270));
              bCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              breadFrame.setContentPane(bMainPanel);
             breadFrame.setDefaultCloseOperation(breadFrame.EXIT_ON_CLOSE);
             breadFrame.pack();
             breadFrame.setVisible(false);
             breadFrame.setSize(350,390);
             //--------------------------Order Toppings----------------------------------
              //Declaring
              order = true;
              final JPanel tTopPanel = new JPanel(new FlowLayout());
              final JPanel tCenterPanel = new JPanel(new FlowLayout());
              final JPanel tActionPanel = new JPanel(new BorderLayout());
              final JPanel tButtonPanel = new JPanel(new FlowLayout());
              final JPanel tMainPanel = new JPanel(new BorderLayout());
              final JLabel tInstrucTextLabel = new JLabel("<html>Please select a topping from the drop down list above<br> and then click order</html>");
              //Creates list of toppings - file paths must match name
              String[] toppingStrings = { "Olives", "Tomatoes", "Lettuce", "Turkey", "Ham", "Select a Topping"};
              pictureTop = new JLabel();
              //Selects item at index 5
              toppingList = new JComboBox(toppingStrings);
              toppingList.setSelectedIndex(5);
              tActionPanel.add(toppingList , BorderLayout.NORTH);
              tActionPanel.add(pictureTop , BorderLayout.CENTER);
              tActionPanel.add(orderTopButton , BorderLayout.SOUTH);
              tCenterPanel.add(tInstrucTextLabel);
              tButtonPanel.add(goBackButton2);
              tMainPanel.add(tActionPanel , BorderLayout.NORTH);
              tMainPanel.add(tCenterPanel , BorderLayout.CENTER);
              tMainPanel.add(tButtonPanel , BorderLayout.SOUTH);
              //Must go in this method, do not put in main
              toppingList.addActionListener(this);
            pictureTop.setFont(pictureTop.getFont().deriveFont(Font.ITALIC));
            pictureTop.setHorizontalAlignment(JLabel.CENTER);
            updateLabel(toppingStrings[toppingList.getSelectedIndex()]);
            pictureTop.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
            //Preferred size - widest image and the height of the tallest image
            pictureTop.setPreferredSize(new Dimension(177, 132));
            tCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              toppingFrame.setContentPane(tMainPanel);
             toppingFrame.setDefaultCloseOperation(toppingFrame.EXIT_ON_CLOSE);
             toppingFrame.pack();
             toppingFrame.setVisible(false);
             toppingFrame.setSize(350,390);
              //--------------------------Order Condiments----------------------------------
              //Declaring
              order = true;
              final ImageIcon condimentsImage = new ImageIcon("condiments.gif");
              final JPanel cTopPanel = new JPanel(new FlowLayout());
              final JPanel cCenterPanel = new JPanel(new FlowLayout());
              final JPanel cButtonPanel = new JPanel(new BorderLayout());
              final JPanel cMainPanel = new JPanel(new BorderLayout());
              final JLabel cInstrucTextLabel = new JLabel("<html>Please select a button below to order a Condiment</html>", JLabel.CENTER);
              final JLabel condimentsLabel = new JLabel(condimentsImage);
              cTopPanel.add(goBackButton3);
              cTopPanel.add(condimentsLabel);
              cCenterPanel.add(cInstrucTextLabel);
              cButtonPanel.add(mustardButton , BorderLayout.WEST);
              cButtonPanel.add(ketchupButton , BorderLayout.CENTER);
              cButtonPanel.add(relishButton , BorderLayout.EAST);
              cMainPanel.add(cTopPanel , BorderLayout.NORTH);
              cMainPanel.add(cCenterPanel , BorderLayout.CENTER);
              cMainPanel.add(cButtonPanel , BorderLayout.SOUTH);
              cCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));          
              condimentFrame.setContentPane(cMainPanel);
             condimentFrame.setDefaultCloseOperation(condimentFrame.EXIT_ON_CLOSE);
             condimentFrame.pack();
             condimentFrame.setVisible(false);
             condimentFrame.setSize(350,390);                    
              //--------------------------Confirmation Screen----------------------------------
              final JPanel coMainPanel = new JPanel(new BorderLayout());
              confirmTextLabel = new JLabel("<html>Would you like to purchase <u>" + itemName + "</u> <br>for a cost of <u>$" + Currency.format(itemCost) + "</u>?</html>", JLabel.CENTER);
              final JPanel coTopPanel = new JPanel(new FlowLayout());
              final JPanel coButtonPanel = new JPanel(new FlowLayout());
              final JPanel coCenterPanel = new JPanel(new FlowLayout());
              coTopPanel.add(goBackButton);
              coCenterPanel.add(confirmTextLabel);
              coButtonPanel.add(acceptButton);
              coButtonPanel.add(declineButton);
              coMainPanel.add(coTopPanel , BorderLayout.NORTH);
              coMainPanel.add(coCenterPanel , BorderLayout.CENTER);
              coMainPanel.add(coButtonPanel , BorderLayout.SOUTH);          
              coCenterPanel.setBorder(BorderFactory.createTitledBorder("Correct?"));     
              confirmFrame.setContentPane(coMainPanel);
             confirmFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             confirmFrame.pack();
             confirmFrame.setVisible(false);
             confirmFrame.setSize(350,390);
             //------------------------------Cart Screen----------------------------------
              final JPanel caMainPanel = new JPanel(new BorderLayout());
              final JPanel cartRPanel = new JPanel(new BorderLayout());
              final JPanel caButtonPanel = new JPanel(new FlowLayout());
              final JPanel caCenterPanel = new JPanel(new FlowLayout());
              caCenterPanel.add(cartRPanel);
              cartRPanel.add(cartItemLabel , BorderLayout.WEST);
              cartRPanel.add(cartPriceLabel , BorderLayout.EAST);
              caButtonPanel.add(goBackButton4);
              caButtonPanel.add(checkButton1);
              caMainPanel.add(caCenterPanel , BorderLayout.CENTER);
              caMainPanel.add(caButtonPanel , BorderLayout.SOUTH);          
              //cartItemLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
              //cartItemLabel.setHorizontalTextPosition(SwingConstants.LEFT);
              caCenterPanel.setBorder(BorderFactory.createTitledBorder("Your Items"));     
              cartFrame.setContentPane(caMainPanel);
             cartFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             cartFrame.pack();
             cartFrame.setVisible(false);
             cartFrame.setSize(350,390);     
             //--------------------------End of Constructive Method---------------------------
         //Updates the label when combo box is changed
         protected void updateLabel(String name)
            ImageIcon icon = createImageIcon("images/" + name + ".jpg");
            //Sets the image of the icon
            pictureTop.setIcon(icon);
            if (icon != null)
                pictureTop.setText(null);
            else
                pictureTop.setText("Image not found");
        //Returns an ImageIcon, or null if the path was invalid to the icon
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = AdrianP1.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                 //Prints out if file is not found in system window
                System.out.println("Couldn't find file: " + path);
                return null;
         public void updateConfirm()
              //------------------NOT IN USE-------------------
              if(whiteB==true)
                   itemName = "White Bread";
                   itemCost = bwCost;
              if(wholeB==true)
              if(italB==true)
              if(harvestB==true)
              //------------------NOT IN USE-------------------
         public void receiptPrint ()
              //------------------NOT IN USE-------------------
              final JLabel receiptLabel = new JLabel("<html>Your PST:<br>Your GST:<br>Your Total:</html>");
              final JPanel receiptPanel = new JPanel(new FlowLayout());
              receiptPanel.add(receiptLabel);
              receiptLabel.setFont(new Font("Serif", Font.PLAIN, 15));
              receiptPanel.setBorder(BorderFactory.createTitledBorder("Your Receipt"));
              //------------------NOT IN USE-------------------
    }

    I'm certainly not going to read all of that, perhaps someone else here will.You really think so? I seriously doubt it.
    @OP: Please go through these links:
    [How to ask questions the smart way|http://catb.org/~esr/faqs/smart-questions.html]
    SSCCE
    db

  • Null character removal in sap using a function module

    Little background :
    1) we are using a lot of interfaces with legacy and the data in sap has null characters for example : phone#123 .
    the prob is not on sap side but on bw side when i extract this data it converts to hex format and the load fails.
    2) so i wrote a abap function module for the extractor which uses the function modules SRET_TEXT_TO_BINARY and SRET_BINARY_TO_TEXT and passed the variable that has the null character and replaced it with space.
    3) the prob is i get null characters in a lot of fields now and i am not sure how i can pass it to SRET_BINARY_TO_TEXT OR SRET_TEXT_TO_BINARY as they are SAP standard and it takes in just a single variable. i have all my fields in a internal table .
    I apologize for the the length of the message but any help is greatly appreciated.I want to know how to pass a internal table with null in all fields to a standard function module bec . The code is below :
    =======================================================
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2

    The entire code :
    =======================================================
    FUNCTION YFR1_CA_U_NULL_SPACE.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT) TYPE  C
    *"  EXPORTING
    *"     REFERENCE(OUTPUT) TYPE  C
    *"  EXCEPTIONS
    *"      LENGTH_TOO_LONG
    *"      FAILED
    This function provides the functionality of replacing the NULL
    characters with SPACE .
      DATA : v_hexa(100) TYPE X ,
             c_space(2) TYPE X VALUE '0020' ,
             c_null(2) TYPE X VALUE '0000' ,
             v_length TYPE i .
      COMPUTE v_length = STRLEN( input ) .
      IF v_length > '100'.
        RAISE length_too_long .
      ENDIF .
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2
        IF SY-SUBRC <> 0.
          RAISE FAILED .
        ENDIF.
      ELSE.
        RAISE FAILED .
      ENDIF .
    ENDFUNCTION.

  • Print Without Hyperlink Character Styles

    Hi,
    I have applied a character style to URLs in my document that look like links so that when I export to pdf, people can click the obvious URL link.  However, the document will also be printed and I do not want the text to have this character style applied to it (or be a hyperlink).  I thought when I exported to PDF and unchecked 'Include Hyperlinks', no hyperlink formatting would be present in the pdf, including character styles applied to hyperlinks, but I cannot seem to print without the character style being applied. 
    Is there a way to choose in the print dialog whether I want the character style applied to the text?  Or what is the easiest way to toggle between showing hyperlinks and not showing hyperlinks (including character styles) as I need to switch between print versions and electronic versions of my document?
    Thanks so much!

    Or maybe easier would be to define a second style with attributes, then use find/change to change from one to the other. Easy to go back and forth that way.

  • Cannot print out chinese character

    Hi All,
    I have problem with the printer. I can printed Chinese character without using SAP and from SAP when I print the Chinese character is not come out. On the paper will appear symbol ###. I don't how want to do.
    FYI, my system is Unicode.
    Thank You
    Regards,
    anang78

    Hi,
    Check the OSS note 776507 which talks about print preview for
    characters in Chinese language and print of ## characters during printing Asian languages.
    Please go through the note , as per section " Note on SAPscript/SmartForms Print Preview "
    we need to use device type CNHPLJ4 for printing Chinese character set.
    Thanks
    Jibin

  • Save null character to excel

    Because MS Excel cells expect null terminated strings, I'm losing data when writing to Excel using active X from LabVIEW. What I am doing is typecasting an array to a string, and storing that string in a single Excel cell. But, if that string has a null character, all data after it is lost. Has anyone overcome this, and if so, how? The reason I want to do this is because my Excel spreadsheet is formatted in the following way
    run1, set1, graph1 array, graph 2 array...graph10array
    run 1, set 2, graph1 array, graph 2 array...graph10array
    run2, set 1, graph1 array, graph 2 array...graph10array
    run n, set n,graph1 array, graph 2 array...graph10array 
    This allows me to search for "run n, set n" and get all the corresponding graph data very easily. Also, unfortunately, using a database is not exactly an option .
    CLA, LabVIEW Versions 2010-2013
    Solved!
    Go to Solution.

    Matt,
    Thanks for your response. The first two are customer driven. Their old format was in a DB and they want to keep that format, but move to excel so they can access other data visually from within Excel. If I was to put the graph stuff in a separate file, i'd then have to map to other files, check to make sure the files are there, etc.
    Encoding and reencoding strings crossed my mind. However, this could potentionally cause "unencoding" of something I don't want to be unencoded. For example, let's say I replace all null characters with a, but then there is an a in the typecasted string which I don't want replaced. It will be replaced anyways. Is there a way around this? I'm thinking maybe do something like replace a null character with the ascii characters NULL. Then use a regex to search and replace. 
    The last one would work and I may just map the data to columns on a different sheet and write all the points.
    Matt W wrote:
    Here's some ideas
    Option1: Don't use excel use tdms instead, combine run and set into the group names, and put the graph arrays into channels, this should be much faster, and easier to deal with 
    Option2: Is there a reason a self contained database wouldn't work. Like the SQLite API for LabVIEW
    Option3: Reencode your strings so they don't contain \0, then unencode them when you read them.
    Option4: Change your format (each sample from the graphs goes into it's on cell)
    CLA, LabVIEW Versions 2010-2013

  • Binary Representation of null character

    Is it true that null character is represented by '\u0000'? When I try to convert the above using Character.digit(char, 2), I got the hex value 0xFF. So can I say that the binary representation of a null character is 11111111? Can anybody help me with this? Thank you.

    I managed to store 0x91a3b1f855e62708L in a type long by using the method below provided by dpz from this forum
    public static long hexToLong(String hex) {
    String highOrderDigits = "89abcdef";
    //Only process exactly 16-digit strings.
    if (hex.length() != 16) {     
    throw new IllegalArgumentException("Expect 16-digit hex value");
    boolean overflow = false;
    //Check for most significant digit > 7,
    //which would cause problem for parseLong.
    int highOrderIndex = highOrderDigits.indexOf(hex.charAt(0));
    if (highOrderIndex > -1) {     
    // Clear most-significant bit and set overflow flag.
    overflow = true;
    hex = "" + highOrderIndex + hex.substring(1);
    long result = Long.parseLong(hex, 16);
    if (overflow) {  
    //Manually set most significant bit in result.
    result |= 0x8000000000000000L;
    return result;

  • Inserting Null character through C into Oracle

    Hello,
    I am reading data through pro C program from a file which contains null characters.
    I am fetching data into character buffer but when I try to insert the buf into Oracle of table it is inserting all the charaters before that null character and the remaining characters after the null characters will be truncated.
    So kindly help me how to handle null character ion Pro C and insert the entire characters string which contains null characters in Varchar field.
    Thanks,
    Ananth
    null

    Please check the pro C/C++ developers guide.

  • Why does this print a null?

    I have a snippet here that prints one row from a derby DB. The heading row works fine.
    I
                while (!cells[0].isEmpty()) {
                    for (int col = 0; col < colNames.length; col++) //System.out.print(cells[col].remove(0).toString() + "\t");
                        queryResult += cells[col].remove(0).toString() + "\t";
                        //System.out.print(cells[col].remove(0).toString() + "\t");
                    System.out.println("");results to Output window are:
    IDNUM        KANJI        KANA        ROMAJI        ENGLISH       
    null1        &#24859;        &#12354;&#12356;        ai        love    I should mention that the string "queryResult" is passed out as a return value and printed to output (not shown).
    Example 2, I do the same thing with a direct println to Output:
                while (!cells[0].isEmpty()) {
                    for (int col = 0; col < colNames.length; col++) //System.out.print(cells[col].remove(0).toString() + "\t");
                        //queryResult += cells[col].remove(0).toString() + "\t";
                        System.out.print(cells[col].remove(0).toString() + "\t");
                    System.out.println("");Results are:
    IDNUM        KANJI        KANA        ROMAJI        ENGLISH       
    1        &#24859;        &#12354;&#12356;        ai        love       
    nullAgain we get a null, but this time its at the end!
    Running the query in SQL using the Netbeans interface shows no null, nor does examining the table.
    How am I introducing a null in here?
    Thanks

    I don't know, but the results are a little funky. Perhaps the query results contains some control characters, like a carriage return and a null-terminator (\r and \0)? You could check this by not printing the string, but by printing the ASCII code of each individual character.

Maybe you are looking for

  • How do I edit a pdf form content?

    I have filled out a pdf form and want to edit what I've added to the form.  When i use "Content Editing - edit text & images" I'm only allowed to edit the form itself.  What format should the pdf be in to edit the content I've added to the form?

  • Boot Camp, Vista, Gear Head Bluetooth Keyboard & Mouse

    Just added a Gear Head bluetooth keyboard and mouse for Mac to my Mac Mini. This Mac Mini is running Boot Camp with Windows Vista Home Premium. The bluetooth keyboard and mouse work fine under Mac. When I boot to Vista, I was able to install the Mous

  • Voice Messaging: Cannot enable v8.1 per "accepted ...

    Community:  I have (2-1/2) issues working in unision, and I need some divine intervention from the Microsoft Godz.  Issue 1) Skype "New desktop" windows 8.1 version. I can "enable" Voicemail, but have no ability to configure ring time, greeting, etc.

  • Problems while displaying EXCEL sheets within OUTLOOK

    Dear all, I have the following problem:  a user within the company receives sometimes emails containing excel sheets. the user wants to use/work with the preview within outlook, unfortunately the displayed values are different compared with the value

  • Problems with the elliptical marquee tool in CS6/Mac

    I have CS6 and did the newest update yesterday. I'm working on Mac OS X 10.6.8. The problem is following: The elliptical tool doesn't function anymore correctly. If I want to make an ellipse or circle first it looks normal put if I let go the mouse,