A question about output result

i want to print the query result of a database table into the screen. but i found it difficult to align the results. listed below is an example
Mary F 28
Alexandra M 30
i usd the listed command to print above results:
System.out.println("\t" + name + "\t" + gender + "\t" + age);
i had planed to use '\t' to align the output, but i found length of data are different. like "Mary", it is less 8 characters, while "Alexandra" requires 9 characters. this leads to the output is not aligned. the expected result would be like this:
Mary F 28
Alexandra M 30
anyone knows how can i align the output ? thanks a lot!

by writing something like
public static String leftAlign( String string, int length)
StringBuffer buffer = new StringBuffer( length);
if( string.length() < length)
   buffer.append(string);
   for ( int idx = string.length(); idx < length; ++idx)
     buffer.append( ' ');
else
   buffer.append( string.substring(0,length);
return buffer.toString();
System.out.println( leftAlign( "", 9) + leftAlign( name, 30) + leftAlign( gender, 5) + leftAlign( age, 5) );

Similar Messages

  • Question about outputting DVCPRO HD to MiniDV Tape

    Hi There,
    I have a DVCPRO HD 720p24 project that I need to output onto MiniDV and I have a few questions. I am running FCS2 with the latest updates.
    1) I have an older sony camera (DCR-PC100) that I am outputting to. I would like to maintain my 16x9 aspect ratio. Provided I have selected anamorphic in my sequence settings, will my camera record a 720x480 image with the aspect ration intact? The camera is just a 4:3 consumer camera and it's a bit older. Just don't want to lose any quality.
    2) As it states in my signature, I'm working on a MBP so my only video output for coloring monitoring and that type of thing is through firewire and out of my camera. This doesn't work correctly from my native 720p24 sequence - it just sticks on one frame. I am already in the process of rebuilding a 720x480 NTSC sequence. Is this the only way I can output properly to a monitor?
    Thank you for reading my post

    Hi Spiff,
    Well I mainly assumed so because the most practicle way to screen a selection of films in one session at a short film festival is to compile a tape with all the films set to one ratio (usually 4:3)and I thought you were specifically asked to send a tape.
    However it would be wise indeed to call them.
    Some festivals use/compile miniDV or DVDs some others BetaSP or DigiBeta.
    With regard to transferring the film onto your PC 100 (Mighty PC 100! It was very popular 4-5 years ago amongst domestic camcorders, so popular that Sony put a PC 12O in the market with enahanced features) providing it works fine, then you will be fine to use it. Renting a deck or using a pro camera with miniDV capability will not improve the quality of your video.
    If your anamorphic version looks fine then lay that one on the tape.
    Try to use Panasonic pro master 63 minutes miniDV tapes. THey are white tapes.
    Good luck with the festival!
    G

  • Question about output in Excel file

    Hi all experts
    I am trying to export a report to excel sheet. Got one problem, in the report there are codes of companies,  like "09", "08", but when exported by using WS_EXCEL FBS, i got the result "9", "8".
    That is> the Zero at the beginning is lost.
    How can i solve this problem easily?
    question2, how can i make the alignment better. (now some are left and some are right aligned)
    thank you !
    here is my coding
    CALL FUNCTION 'WS_EXCEL'
    EXPORTING
    FILENAME = file1
    SYNCHRON = ' '
    TABLES
    data = tab_comp
    EXCEPTIONS
    UNKNOWN_ERROR = 1
    OTHERS = 2
    file1 = 'c:\tmp\b.xls'
    Richard

    Hi,
    Conventionally it is not possible.
    If u can compromise to some extent its is possible. Check below code.
    U may have to give one check box in selection screen/Push button in output list.
    Based on the selection(In case of check box)/Click(In case of push button) u can download the data.
    U have loop through ur itab and modify that value by concatenating the special character '
    But it will also be downloaded to excel
    If u don't understand what i am saying just copy paste below code and see whether it will be fine.
    TYPES:BEGIN OF t_tab,
            empno(10) TYPE c,
          END OF t_tab.
    DATA: i_tab TYPE TABLE OF t_tab,
          wa_tab TYPE t_tab.
    CLEAR wa_tab.
    wa_tab-empno = '0075694'.
    APPEND wa_tab TO i_tab.
    CONCATENATE '''' wa_tab-empno INTO wa_tab-empno.
    MODIFY i_tab FROM wa_tab INDEX 1.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = 'E:/test.xls'
    *   FILETYPE                      = 'ASC'
    *   APPEND                        = ' '
       WRITE_FIELD_SEPARATOR         = '#'
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = i_tab
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *Here output in excel is '0075694
    Thanks,
    Vinod.

  • Question regarding outputing results of query to pdf file

    Is there a way in which we can output the results of the query to a PDF file in PLSQL?
    Thanks much,
    Madhu

    I have a situation where there needs to be emails sent to the customers on a daily basis.Right now there is scheduled bat file on a particular machine which calls the Form which has the logic to generate the pdf file using Oracle Reports for each of the customer,which is then mailed using Outlook(OLE in form).But now this is kind of a problem as they are constant network problems which hinder the timely sending of the reports.
    I am trying to look for a solution so that we can do everything on database end instead of relying on the newtork.
    Thank you for any suggestions you have regarding implementing this.
    Madhu

  • NOOB question about outputting final edit

    I'd used FCE for several years, and am in the midst of switching over.
    I've gone through 2/3 of Mr. Wolsky's book and have probably 4-5 completed projects with FCP X. However, there have been some FCP X updates since the book was written.
    I will be filming a concert for a friend, and have learned how to create and edit a multi-cam clip.
    My friend wants a recording of the complete concert, and in addition to the complete concert, he also wants individual songs from the concert separated from the complete show as "stand alone" files.  He wants to be able to upload these "stand alone" song videos to his own website, so I was going to deliver the edited files of the complete concert, and files of the individual, edited songs on a external hard drive. 
    I'm using consumer-level cameras (Sony CX 700, Sony PJ710, Sony HC9, iPhone) recording at 1080.
    My question is, what settings/options should use to share the finished video so that he can upload them (from his PC) at the highest quality?
    Thanks in advance for any assistance.
    Gary

    Gary Markovich wrote:
    …  It there some kind of generic HiDef QuickTime format that is somewhat "universal" to both platforms?
    I'm delivering my son's weekly game-reports to the soccer-moms & -dads on various platforms - incl. Xbox/PS3 as media-players. 'My' universal format is 720p as h264.mp4.
    so, my workflow is:
    • exporting a master-file (for future use, the 'raws' get dumped after a year), which is actually 720p - not fullHD, for two reasons: a) I hadn't the recording equip until now, b) some device stumble with higher bit-rates 1080p makes neccessary
    • open the file in MpegStreamclip, go straight to save-as, and in the drop-down I choose mp4 - this 're-wraps' the file into a mp4 media-wrapper without lossy re-encoding
    ==> the resulting mp4 is fully compatible on all platforms I know of.-
    note:
    I'm still not fully aware of the various 'new' export options since vers06 of FCPX … esp. the 'package' option, which allows multiple exports within one click, is tempting, although I assume, my brave ol' MacMini will start choking on so much encoding
    a friend of mine owning an i7 iMac blows me away when hitting Export - actual hardware makes a difference
    mov asks for Quicktime-for-Windows on PCs - which some Windows users are hesitant to install.
    proRes is a MacOS-proprietary format .... and is a lil' 'bloated' for exchange.
    so, h264 is universal (since YouTube), mp4 is 'more universal' than mov

  • TextArea question about getting results from actionscript

    Hey guys,
    I have got this TextArea in main.mxml and I have another class which is data.as. I have calculated a result at data.as and want to show the result over at the TextArea in main.mxml in a way that, when a new result is calculated, it will override the current text in the TextArea.
    How do I go about doing it?    

    Okie, so does that mean that lets say my data.as trigger some mouse event
    clicked, which will alter the public variable result string, the textarea
    over at main.mxml will change too? As in keep changing whenever the trigger
    of any mouse event clicked?
    Yes. Create that variable as static like,
    public static var data_result:String;
    >
    so u can easily call any where in your application using class name like
    that
    >
    .[global variable]
    >

  • QUESTION ABOUT OUTPUTTING to a .txt File???

    I want to output some input to 3 different Output and then read those in later... my problem is HOW DO I SET 3 DIFFERENT OUTPUT FILES THAT WILL BE ABLE TO GET THE INPUT EVERY TIME THE PROGRAM IS RUN....?? I DO NOT WANT THE USER TO BE ABLE TO NAME THOSE FILES... I WANT THOSE FILES TO BE OPENED OR CREATED WHEN THE PROGRAM IS RUN... RIGHT NOW I JUST HAVE ALL THE INPUT GOING TO THE SCREEN AND THAT'S NOT WHAT I WANT IT TO DO.. I WANT THE INPUT TO GO TO SEPARATE 3 FILES...
    THANKS..
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Assemble
         public static void main(String args[]) throws IOException
              if (args.length > 0)
                   System.out.println("");
                   System.out.println("");
                   System.out.println("");
                   System.out.println("Assemble.class is a small program that");
                   System.out.println("takes in as input a body of text and then");
                   System.out.println("outputs the text in an order according to");
                   System.out.println("the tags that are placed in the input.");
              else
                   System.out.println("");
                   System.out.flush();     
         BufferedReader in = new BufferedReader (new InputStreamReader( System.in ));
         String input;                
         while (true)
              input = in.readLine();
              if (input == null)                          
                   break;
              else if ( (input.compareTo("<HEAD>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</HEAD>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</HEAD>")) != 0);
              else if ( (input.compareTo("<BODY>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</BODY>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</BODY>")) != 0);
              else if ( (input.compareTo("<FOOT>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</FOOT>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</FOOT>")) != 0);

    To write to a file, use PrintStream. It has a method println() like System.out, except you can specify a File as the target, e.g.:
    PrintStream ps=new PrintStream(new FileOutputStream(new File("myfile,.txt")));And to write a string to this file,
    ps.println(String);

  • A question about output of show isakmp sa

    I couldn't find any detail explanation of show isakmp sa output on ASA platform on CCO,
    from ASA show isakmp sa, i can find some SA Type is user,some SAs type is l2l
    all ipsec vpn configured type on this ASA is L2L, why  the type of SA is user under some SA,
    what is means of type is user?
    thank you!
    ASA# show isakmp sa
    IKEv1 SAs:
       Active SA: 5
        Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
    Total IKE SA: 5
    1   IKE Peer: 1.1.1.1
        Type    : user            Role    : initiator
        Rekey   : no              State   : MM_WAIT_MSG2
    2   IKE Peer: 2.2.2.2
        Type    : user            Role    : responder
        Rekey   : no              State   : MM_WAIT_MSG3
    3   IKE Peer: 3.3.3.3
        Type    : L2L             Role    : responder
        Rekey   : no              State   : MM_ACTIVE
    4   IKE Peer: 4.4.4.4
        Type    : L2L             Role    : responder
        Rekey   : no              State   : MM_ACTIVE
    5   IKE Peer: 5.5.5.5
        Type    : L2L             Role    : responder
        Rekey   : no              State   : MM_ACTIVE

    we have many ipsec vpn connection configuration, same config, but only some of them showing Type: User,
    I find when ipsec connection not in active state. show isakmp sa show Type:user.
    is this a default state.
    I haven't found detail explanation from CCO ASA document?

  • Question about Output Preview

    I have a simple Illustrator file. The color values are C=0  M=0  Y=0  K=100
    When I run the file through Acrobat Professional's Output Preview to check the colors (I am looking to make sure there are no C, M or Y values), I get values for all four (CMYK).
    What gives here?
    Thanks

    May I suggest the setText() method?

  • Question about the result of calling JDialog.setAlwaysOnTop(true)

    Let's use these two small code snippets for reference.
    Sample 1
    JDialog d = new JDialog(myFrame, "Dialog Title");
    d.setModal(true);
    d.setAlwaysOnTop(true);
    d.setVisible(true);Sample 2
    JDialog d = new JDialog(myFrame, "Dialog Title");
    d.setModal(true);
    d.setVisible(true);Using #1 I get a modal dialog that is on top of ALL other windows, even things like Firefox and Thunderbird (two greats apps).
    Using #2 I get a modal dialog that is not on top of other apps when the other apps gain focus.
    I would like to avoid using #1 so I don't annoy my users with popup windows that are always on top of other app windows. However, if I use #2, sometimes the modal dialog can "fall behind" it's parent frame, making it very difficult to ever get back. Since the parent frame (myFrame) is waiting on a modal dialog to close, the frame is not movable or minimizable. The modal dialog is hidden behind the parent frame, which makes it hard to get unless I do something like Alt-Tab to cycle through the current open windows. I can't expect my users to know or use the Alt-Tab capability.
    Any suggestions?

    I found the problem. I wasn't passing in 'myFrame' as an argument. This resulted in a modal dialog that had no parent frame. That allows the dialog to fall behind the main application frame. So, as long as the parent frame is specified, the problem situation I described can't happen.

  • Workflow question about output module names

    Hi!
    I have been working on a massive project that requires hundreds of lower thirds.
    After finishing the actual design, my workflow has been like this:
    1. Save the project with a new file name
    2. Replace the old text with the new one
    3. Save
    Before doing that, I have added the render comp to the render queue. For the output module name and location, I have used a template that automatically gives the output module the project name. This has been great, since I have only needed to enter a new project name when "saving as" and the render module has automatically taken that name for the output file name. A great speed saver when you have to do tens of repeats.
    Now here comes the problem:
    After I had created all the necessary AE-projects, I was thinking of importing all the projects in to a single AE-project and then simply hitting render (since all the output modules were automatically added to the render queue when importing the projects) so that I could leave the computer rendering for a few days and do something else in the mean while. BUT when I import the projects, the name for the output module changes for every item in the render que to represent the current project. In other words I loose all my carefully planned names that I used to have in the output modules, because AE replaces them with the current project name.
    Is there any way of keeping the workflow I described without having to rename all the output modules after importing the projects in to a single render project? Is there some other way to get a good workflow on a project like this?
    Any tips will be highly appreciated!

    Should be perfectly doable to iterate through the appProjectIItem list. Off hand I'm not sure if it recognizes folders, though, so maybe it will be a bit more tricky to get what you want. IMO the safest way to avoid any confusion would be to have the script itself do the import. That way it can store the name of the imported file as a variable or some text file and reuse it when it renames the RQ items...
    Mylenium

  • Question about output the com port signal

    Dear all,
    I can successfully change the received signal from COM1 into ASCII, and I can use System.out.print to output the ASCII. However, I cannot output the received signal in the JTextField.
    Could anyone help me to solve this problem please?
    Thank you so much

    May I suggest the setText() method?

  • I am restating my question about outputing specific voltage values

    Hello,
    Right now, I use the function generator vi , an example vi from DAQ and analog out. So from that VI i get functions such as sine, sqaure with a user defined amplitude and frequency. Now what i want to do is this:
    Develop a vi which will output specific voltage values defined by the user (me). i.e, say i want the vi to output voltage values such as 0.1,0.2,0.3,4,6,8,10,12,14,0.4,0.5, then i just write these values in the table and the vi should ouput these voltage values one after the other in near real time. I hope i am clearer this time.
    I am an amatuer user of Labview and am currently working on a student version of Labview 7.0 Express.
    Thank you
    Ujwal

    Thanks for the reply.
    Yes, i think you have understood my problem correctly now. But the only thing i would like to clarify is that I would input the voltage values before starting the program, say in the form of a array/table. Once i put these values the program should output these voltage values. These voltage levels should be output in near real time i.e., the time between two values should be in the microsecond domain.
    Here are the sample voltage levels I am interested in. ( but i want these values alterable, i.e., i should be able to input these values before running the vi)
    Voltage Levels(V)
    0.1
    0.2
    0.3
    0.4
    15.0
    -15.0
    0.5
    0.6
    0.7
    0.8
    0.9
    1.0
    1.1
    1.2
    1.3
    1.4
    1.5
    1.6
    1.7
    1.8
    1.9
    2.0
    The time lag between two levels should be preferably as less as possible in microseconds. I am not able to tell you any specific value, but 5-10 microseconds should be fine.
    Just a query: Can this whole thing be achieved by reading this from a file by changing the interface of the existing function generator vi to a read from file ( spreadsheet). I tried this but the parameters of inputs in the program didnt match and hence the vi failed to run. Is this a possible approach though?

  • Question about output through the DVI port

    The problem: I am using a DVI to HDMI cable to send video to an AV receiver. The AV receiver strictly only accepts a DVI-D (Digital) signal. Upon turning it all on, the MacBook Pro screen reloads and appears to be sending video out, based on the AV receiver's model name appearing in the Display's menu bar. The receiver however reads "No Signal". Most likely this is because the MBP's dual-signal port is giving it problems (it can send both analog and digital).
    Is it possible to elect to send a digital-only signal? The cable itself does not include the extra pins for analog, so I'm not sure why it would think it is.
    Keep in mind I'm not entirely sure this is the problem, I just have confidence in this theory.
    Regards,
    Edward

    HDCP: The cause of, and solution to, all of life's problems.

  • Question about output in Forte 4.0

    I am writing data out to a file, however Forte 4.0 IDE does not generate the file I want, but it works under Windows command prompt using 'javac' & 'java' command.
    I guess I need to change some settings in the Forte 4.0, could anybody tell me how to fix this?

    Need better definition of what the problen is.
    See: http://forum.java.sun.com/thread.jsp?forum=31&thread=271751

Maybe you are looking for

  • My settings menue is in chinese language (help)

    Whenever i enter my settings menu for the new (webcam live ultra for notebooks) all the words are in japanese or chinese. How can i get these to be displayed in english? thanks' leo kowal

  • Conversion/Creating Contract from Install Base Information

    Hi All, My client has just completed Install base conversion from the legacy system (both history and active information).They have also completed sales order conversion for the open orders only from legacy system.They have done the customer conversi

  • 'max case when...then' does it work in Desktop reports as a calculation?

    Hi! I've used 'max case when...then' in my SQL in Admin edition. It works fine. However when I try to use it as a part of my calculation: MAX(CASE WHEN (:Payroll Month 1 - Gross Sal) THEN TO_NUMBER(NVL("Gross Salary ".Basic Salary, 0)) Else 0 END) in

  • MacBook Pro Retina Display 15" 2012

    MacBook Pro Retina Display 15" 2012 remove GeForce GT 650M add GeForce GT 750M 2GB 100% works ??? Helps thanks!

  • Mail hanging

    Since updating to Lion, Mail hangs for ever while trying to retrieve messages. I have my iPhone connected to my iMac all the time whilst I am in my study, and I can hear the alert telling me when new mail arrives on my phone but when I go to Mail it