Simple slug on output

Does anyone have any advice on creating a slug with only the filename when an indesign document is exported to PDF or printed out?
It would also be helpful if the slug was just outside the bleed area (at the top).
It's also for many indesign files at different sizes with various page amounts that go through an automated batch printing process (Zevrix batchoutput), so human intervention on a document by document basis is not viable
We're using Indesign CS4.
Thanks in advance, Tim

Thanks Peter. I got that working. My problem now is that I have at least a thousand indesign files and more coming every day to apply this to. I do have a set of "master templates" that I can apply this to and distribute to our workers for future work they create. But for exisiting artwork would it be possible to update their master pages from the "master templates" via a script in an automated fashion. Existing artwork do contain a same three letter text string as the "master templates".... for example finished artwork would have BBB, TCN in the file name and so do the "master templates" (although filenames are not exactly the same in their entirety).
What do you think Peter?
Regards, Tim

Similar Messages

  • Convert Tree output of IH01 transaction to simple ALV list output

    Hi,
    We have immediate requirement of changing the ALV TREE output of transaction IH01 to general ALV LIST display (with rows and columns) . To match with the requirement, I have to analyze the standard program first, copy the code to custom program and then do the changes which will consume lot of time.
    Request your suggesttions if there are any simple ways to get the desired output so that i can quickly complete the development.
    Murthy

    Hi,
    ALV Tree uses a different class and added logic. What logic is common is fetching and building of internal tables from data perspective. You can re-use this logic by calling the subroutine in the program and passing required values. It would be fast but in this case would take a bit of time, as you still need to analyse the code to make sure everything is right.
    Regards,
    Arnab.

  • A simple question of output to EXCEL

    Hi, all
    I am using WS_EXCEL to output a interntable to excel file.( filename will be input on dynpro). the file will be created.
    the Problem is, everytime i run the following codes,
    1. the file content is not well formated is poor, words in the column are some aligned at right of the cell , some are at left. how can I defined the alignment?
    2. everytime i create the file, the excel document is opened, can that be avoided ( run in background and file get created?)
    3. everytime i create the file, the old file will be covered, how can I use other sheets of the same file to save the table content?
    thanks a lot!!!
    Fan
    CALL FUNCTION 'WS_EXCEL'
    EXPORTING
       FILENAME      = cfile
      SYNCHRON            = ' '
      TABLES
        data                = tab_ssu
    EXCEPTIONS
       UNKNOWN_ERROR       = 1
       OTHERS              = 2
    cfile = 'c:\tmp\b.xls'

    Hi
    For the question related to alignment and different sheet you need to use OLE .
    Now for ole ,it runs in Foreground ,this will open up the sheet for display.
    Now i can suggest one thing but i am not sure if it is a good way of doing it..You can generate different sheets in background and store it on application server  and while displaying them you can read them one by one and display it on different sheets of same excel.
    please see the reference code for ole....
    **ake refrence fom this programm.
    **& Report ZNEGI9 *
    REPORT ZNEGI9 NO STANDARD PAGE HEADING.
    INCLUDE ole2incl .
    DATA: gs_excel TYPE ole2_object ,
    gs_wbooklist TYPE ole2_object ,
    gs_application TYPE ole2_object ,
    gs_wbook TYPE ole2_object ,
    gs_activesheet TYPE ole2_object ,
    gs_sheets TYPE ole2_object ,
    gs_newsheet TYPE ole2_object ,
    gs_cell1 TYPE ole2_object ,
    gs_cell2 TYPE ole2_object ,
    gs_cells TYPE ole2_object ,
    gs_range TYPE ole2_object ,
    gs_font TYPE ole2_object ,
    gs_interior TYPE ole2_object ,
    gs_columns TYPE ole2_object ,
    gs_charts TYPE ole2_object ,
    gs_chart TYPE ole2_object ,
    gs_charttitle TYPE ole2_object ,
    gs_charttitlechar TYPE ole2_object ,
    gs_chartobjects TYPE ole2_object .
    DATA gv_sheet_name(20) TYPE c .
    DATA gv_outer_index LIKE sy-index .
    DATA gv_intex(2) TYPE c .
    DATA gv_line_cntr TYPE i . "line counter
    DATA gv_linno TYPE i . "line number
    DATA gv_colno TYPE i . "column number
    DATA gv_value TYPE i . "data
    PARAMETERS: p_sheets TYPE i .
    START-OF-SELECTION .
    DO p_sheets TIMES .
    *--Forming sheet name
    gv_intex = sy-index .
    gv_outer_index = sy-index .
    CONCATENATE 'Excel Sheet #' gv_intex INTO gv_sheet_name .
    *--For the first loop, Excel is initiated and one new sheet is added
    IF sy-index = 1 .
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooklist .
    GET PROPERTY OF gs_wbooklist 'Application' = gs_application .
    SET PROPERTY OF gs_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF gs_wbooklist 'Add' = gs_wbook .
    GET PROPERTY OF gs_application 'ActiveSheet' = gs_activesheet .
    SET PROPERTY OF gs_activesheet 'Name' = gv_sheet_name .
    *--For the rest of loops, other sheets are added
    ELSE .
    GET PROPERTY OF gs_wbook 'Sheets' = gs_sheets .
    CALL METHOD OF gs_sheets 'Add' = gs_newsheet .
    SET PROPERTY OF gs_newsheet 'Name' = gv_sheet_name .
    ENDIF .
    gv_line_cntr = 1 . "line counter
    *--Title
    *--Selecting cell area to be merged.
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = 1
    #2 = 4.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    *--Merging
    CALL METHOD OF gs_cells 'Merge' .
    *--Setting title data
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'KISHAN' .
    *--Formatting the title
    GET PROPERTY OF gs_cell1 'Font' = gs_font .
    SET PROPERTY OF gs_font 'Underline' = 2 .
    SET PROPERTY OF gs_font 'Bold' = 1 .
    SET PROPERTY OF gs_cell1 'HorizontalAlignment' = -4108 .
    GET PROPERTY OF gs_cell1 'Interior' = gs_interior .
    SET PROPERTY OF gs_interior 'ColorIndex' = 15 .
    SET PROPERTY OF gs_interior 'Pattern' = -4124 .
    SET PROPERTY OF gs_interior 'PatternColorIndex' = -4105 .
    gv_line_cntr = gv_line_cntr + 1 .
    *--Writing some additional data for the title
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'Sheet No' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    SET PROPERTY OF gs_cell1 'Value' = ':' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 6.
    SET PROPERTY OF gs_cell1 'Value' = gv_intex .
    *--Formatting the area of additional data 1
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_cells 'Font' = gs_font .
    SET PROPERTY OF gs_font 'Bold' = 1 .
    *--Formatting the area of additional data 2
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 5.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_cells 'Columns' = gs_columns .
    CALL METHOD OF gs_columns 'AutoFit' .
    *--Bordering title data area
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 6.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    CALL METHOD OF gs_cells 'BorderAround'
    EXPORTING
    #1 = 1 "continuous line
    #2 = 4. "thick
    *--Putting axis labels
    gv_colno = 2 .
    gv_line_cntr = gv_line_cntr + 5 .
    gv_linno = gv_line_cntr - 1 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_linno
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'X' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'Y' .
    *--Generating some data
    DO 3 TIMES .
    gv_value = gv_outer_index * sy-index * 10 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_linno
    #2 = gv_colno.
    SET PROPERTY OF gs_cell1 'Value' = sy-index .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = gv_colno.
    SET PROPERTY OF gs_cell1 'Value' = gv_value .
    gv_colno = gv_colno + 1 .
    ENDDO .
    *--Source data area
    gv_colno = gv_colno - 1 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING #1 = gv_linno
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING #1 = gv_line_cntr
    #2 = gv_colno.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_application 'Charts' = gs_charts .
    CALL METHOD OF gs_charts 'Add' = gs_chart .
    CALL METHOD OF gs_chart 'Activate' .
    SET PROPERTY OF gs_chart 'ChartType' = '51' . "Vertical bar graph
    CALL METHOD OF gs_chart 'SetSourceData'
    EXPORTING #1 = gs_cells
    #2 = 1.
    SET PROPERTY OF gs_chart 'HasTitle' = 1 .
    GET PROPERTY OF gs_chart 'ChartTitle' = gs_charttitle .
    GET PROPERTY OF gs_charttitle 'Characters' = gs_charttitlechar .
    SET PROPERTY OF gs_charttitlechar 'Text' = 'Sample Graph' .
    *--Locate the chart onto the current worksheet
    *--Activate current sheet
    CALL METHOD OF gs_excel 'WorkSheets' = gs_activesheet
    EXPORTING #1 = gv_sheet_name.
    CALL METHOD OF gs_activesheet 'Activate' .
    CALL METHOD OF gs_chart 'Location'
    EXPORTING #1 = 2
    #2 = gv_sheet_name.
    *--Reposition the chart on the worksheet (cut&paste)
    CALL METHOD OF gs_activesheet 'ChartObjects' = gs_chartobjects .
    CALL METHOD OF gs_chartobjects 'Select' .
    CALL METHOD OF gs_chartobjects 'Cut' .
    *--Select new area
    gv_line_cntr = gv_line_cntr + 2 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    CALL METHOD OF gs_activesheet 'Paste' .
    enddo.
    *--Deallocating memory
    FREE: gs_excel, gs_wbooklist, gs_application, gs_wbook,
    gs_activesheet,gs_sheets, gs_newsheet, gs_cell1,
    gs_cell2, gs_cells, gs_range, gs_font, gs_interior,
    gs_columns, gs_charts, gs_chart, gs_charttitle,
    gs_charttitlechar, gs_chartobjects .
    Edited by: sushilnath shukla on Jul 9, 2008 7:21 PM

  • Simple input and output in a loop

    I'm trying to get some user input in a loop. This is a simplification.
    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            for (int i = 0; i < 3; i++) {
                System.out.println("Enter a string:");
                String myString = input.nextLine();
                System.out.println("output: " + myString);
    }In NetBeans, it usually runs fine for a few loops, but eventually (running the program 5 times or so) I get output like this:
    run:
    Enter a string:
    1
    output: 1
    Enter a string:
    output: 2
    Enter a string:
    2
    3
    output: 3
    BUILD SUCCESSFUL (total time: 9 seconds)It starts writing the prompt before the output and gets all jumbled. The problem is worse if I have more input and output statments in the loop. I thought it might just be a timing issue, but it doesn't matter how fast or slow I enter the information. After a few successive runs, the output always gets out of order. How can I keep in line?

    hi!
    why dont you try using printf it will give you a better formating capasities.
    it work like this.
    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            for (int i = 0; i < 3; i++) {
                System.out.println("Enter a string:");
                String myString = input.nextLine();
                System.out.printf("output: %s  \n" ,  myString );  // the %s is the place the string will apear
                                                                                       //and the \n is a escape caracter that creates a new line.
    }if you need more help with printf read this:
    http://en.wikipedia.org/wiki/Printf

  • Simple report list output sent as attachment thru email

    Hi All,
    Here's my task : I need to schedule a bi-weekly report that obviously runs in the background and produces output. From that output, I want to capture (with no manual intervention) the list output to an attachment and email a recipient. I've looked over code snippets and understand most of the <b>LIST</b> functions, but most deal with uploading a file from the frontend, which I do not want. Any ideas? Thx in advance.
    Jim

    Hi
    see the sample report to send mail as attachement
    modify it as per your requirement
    Mailing with Attachment by ABAP Coding  
    Refer this link:
    Mail with attachment.
    FORM send_list_to_basis .
      DATA: w_path      LIKE rlgrap OCCURS 0 WITH HEADER LINE,
            lt_index    TYPE sy-tabix,
            doc_type(3) TYPE c,
            descr       LIKE it_objpack_basis-obj_descr,
            temp_data   LIKE w_path,
            temp1       TYPE string,
            tab_lines   TYPE i,
            langu(15)   TYPE c,
            expirydate  TYPE so_obj_edt,
            L_FILE1(100).
      CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
      W_PATH-FILENAME = L_FILE1.
      APPEND w_path.
      CLEAR w_path.
      wa_doc_chng-obj_descr  = 'User List not logged on for 180 days'.
      wa_doc_chng-obj_langu  = 'E'.
      wa_doc_chng-obj_expdat = sy-datum.
      CLEAR w_subject.
      CONCATENATE 'Please find attached document with list of users'
                  'not logged on for 180 days for client' sy-mandt
                  INTO w_subject SEPARATED BY space.
      it_objtxt_basis-line = w_subject.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      it_objtxt_basis-line = text-004.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      CLEAR w_tab_line.
      DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
      READ TABLE it_objtxt_basis INDEX w_tab_line  INTO l_cline.
      wa_doc_chng-doc_size =
       ( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
      CLEAR it_objpack_basis-transf_bin.
      it_objpack_basis-head_start = 1.
      it_objpack_basis-head_num   = 0.
      it_objpack_basis-body_start = 1.
      it_objpack_basis-body_num   = w_tab_line.
      it_objpack_basis-doc_type   = 'RAW'.
      APPEND it_objpack_basis.
      CLEAR it_objpack_basis.
      LOOP AT w_path.
        temp1 = w_path.
        descr = w_path.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '\'
            string    = descr
          IMPORTING
            head      = descr
            tail      = temp_data.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '.'
            string    = descr
          IMPORTING
            head      = temp_data
            tail      = doc_type.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename      = temp1
            filetype      = 'BIN'
            header_length = 0
            read_by_line  = 'X'
            replacement   = '#'
          TABLES
            data_tab      = it_upload.
        DESCRIBE TABLE it_upload LINES tab_lines.
        DESCRIBE TABLE it_objbin_basis LINES lt_index.
        lt_index = lt_index + 1.
        LOOP AT it_upload.
          wa_objbin_basis-line = it_upload-line.
          APPEND wa_objbin_basis TO it_objbin_basis.
          CLEAR wa_objbin_basis.
        ENDLOOP.
        it_objpack_basis-transf_bin = 'X'.
        it_objpack_basis-head_start = 0.
        it_objpack_basis-head_num   = 0.
        it_objpack_basis-body_start = lt_index.
        it_objpack_basis-body_num   = tab_lines.
        it_objpack_basis-doc_type   = doc_type.
        it_objpack_basis-obj_descr  = descr.
        it_objpack_basis-doc_size   = tab_lines * 255.
        APPEND it_objpack_basis.
        CLEAR it_objpack_basis.
      ENDLOOP.
      it_reclist_basis-receiver = '[email protected]'.
      it_reclist_basis-rec_type = 'U'.
      APPEND it_reclist_basis.
      CLEAR it_reclist_basis.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_objpack_basis
          contents_txt               = it_objtxt_basis
          contents_bin               = it_objbin_basis
          receivers                  = it_reclist_basis
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc EQ 0.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
      ENDIF.
    ENDFORM.                    " send_list_to_basis
    Reward points if useful
    Regards
    Anji

  • Simple select query output-

    Hi Guys,
         I have the following select statement…
    SELECT *
    FROM (SELECT '111', '222', '333' FROM dual)
    Output
         ‘111’     ‘222’     ‘333’
    1     111     222     333
    But the output I was looking for was,
         my_col
    1 111
    2 222
    3 333
    Can someone let me know how to achieve this?
    Many Thanks…
    Napster

    SELECT rownum,
      column_value
       FROM
      (SELECT '111' col1, '222' col2, '333' col3 FROM dual
      ) t,
      TABLE(sys.odcivarchar2list(t.col1,t.col2,t.col3))Ravi Kumar

  • Help!  Simple Formula, Unique Output?

    Post Author: kjameson70
    CA Forum: Crystal Reports
    In order to save space, I am creating a simple formula to include a company name, location, contact & phone instead of putting each field into a Text Box, which makes the Detail section of the report the same size whether data is reported or not. 
    Creating the formula is easy, but I want each field to print on a new line, instead of in the same row or to wrap. 
    How do I tell the formula to go to the next line? **
    Current Formula:  + + +
    Preferred Result:   Company   Location   Contact   Phone
    Not:  CompanyLocationContactPhone2
    What needs to be done to get the Preferred Result?
    This result is one of many columns on the report.

    Post Author: SKodidine
    CA Forum: Crystal Reports
      & chrw(13) & & chrw(13) & & chrw(13) &

  • Simple SQL Query Output

    Table1:
    ID      EMPNAME COUNTRY
    101     XYZ     USA
    102     ABC     UK
    103     XYZ     USA
    104     ABC     UK
    Required output:
    ID      EMPNAME COUNTRY CALCULATED_VALUE
    101     XYZ     USA     1
    102     ABC     UK     1
    103     XYZ     USA     0
    104     ABC     UK     0
    Every 1st record of (EMPNAME, COUNTRY) combination should have CALCULATED_VALUE =1 and all succeeding records of same (EMPNAME, COUNTRY) combination should have CALCULATED_VALUE =0

    Try this ->
    scott>
    scott>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.02
    scott>
    scott>
    scott>with t
      2  as
      3    (
      4      select 101 ID, 'XYZ' EMPNAME, 'USA' COUNTRY from dual
      5      union all
      6      select 102, 'ABC', 'UK' from dual
      7      union all
      8      select 103, 'XYZ', 'USA' from dual
      9      union all
    10      select 104, 'ABC', 'UK' from dual
    11    )
    12  select ID,
    13         EMPNAME,
    14         COUNTRY,
    15         case
    16           when rn = 1 then
    17             1
    18         else
    19           0
    20         end CALCULATED_VALUE
    21  from (
    22         select ID,
    23                EMPNAME,
    24                COUNTRY,
    25                row_number() over(partition by COUNTRY order by ID) rn
    26         from t
    27       )
    28  order by ID;
            ID EMP COU CALCULATED_VALUE
           101 XYZ USA                1
           102 ABC UK                 1
           103 XYZ USA                0
           104 ABC UK                 0
    Elapsed: 00:00:00.00
    scott>Regards.
    Satyaki De.

  • Need help with a simple prime number output program

    ok, the teacher asked for a program to output the first 90 prime numbers and i have been able to do that so far. but now he is asking for the numbers to be printed in a grid of columns and rows. specifically 9 across and 10 down.
    im stumped. what should i do 0_o
    so far, this is my program:
    package primetest;
    public class Main {
    public static void main(String args[]){
    int num1,num2;
    int flag=0; //Checks to see if the number in question is prime or not
    for(num1=1;num1<=463;num1++)
    flag=0;
    for(num2=1;num2<num1;num2++) //Remove the num2<=num1 and let it be as shown
    if(((num1%num2)==0) & num2!=1) //Thus you can remove the third condition
    flag=1; //Flag set to indicate that the number is prime
    if(flag==0)
    System.out.println(num1);
    }

    Congratulations, your code compiles, runs, and appears to produce correct output. (I didn't check every result.) That's far more than most students manage.
    I'd recommend that you separate generating the values from printing them. Can you store primes in an array and then pass that array to another method that prints them out according to your assignment's requirements?
    The good news is that you've solved a good chunk of the problem already. You only have the printing to worry about.
    I'd improve on your class naming. Main? C'mon. How 'bout PrimeFinder or something with a bit more imagination. Names matter in programming. If you gave me this class I'd have to look at the source code to figure out what Main did, but PrimeFinder gives me a hint just from the name.
    Move that stuff out of the main() method and into one of its own. Maybe you can pass in the upper limit over which you want the method to search for primes and return an array of values.
    %

  • Simple query-strange output

    Hi all,
    I have a table x having some data.
    if I do,
    select * from x where dt='31-OCT-08';
    It retrieves the data.
    But if do
    select * from x where dt=last_day(sysdate);
    it retrieves nothing.
    Why is that so?
    Last_day(sysdate)='31-OCT-08'

    MYH wrote:
    Why is that so?
    Last_day(sysdate)='31-OCT-08'Wrong!
    Last_day(sysdate) >'31-OCT-08'
    Boneist already gave the correct answer. Sysdate has a time component. THis time component is still there after you used the last_day function.
    You can check it for yourself by simply testing this condition.
    Proof
    SQL*Plus: Release 9.2.0.2.0 - Production on Wed Oct 22 12:59:22 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select * from dual
      2  where Last_day(sysdate)='31-OCT-08';
    no rows selected
    SQL>
    SQL> select * from dual
      2  where Last_day(sysdate)>'31-OCT-08';
    D
    X
    SQL> While the point with the datatypes is important it is not the real reason for this behaviour.
    Edited by: Sven W. on Oct 22, 2008 1:02 PM

  • Simple digital output

    How can i use counter as simple digital output(On, OFF) for 6602?
    I want to use counter output (PFI_32) as simple On/Off output, because in the future
    I want to change my application to pulse generation.

    Hi,
    An example of writing to a digital output line can be found at:
    C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Do\DOoneline.C
    As in the LabVIEW example, you will have to set the line to number 28. Program is hardcoded to use
    DIO_28 of TIO board. DIO_28 is pin 32.
    I hope this helps, and have a Great Day!
    George

  • How to control a digital output signal using the DAQ assistant?

    I am using a USB 6251 DAQ board and would like to control a switch. I am gathering airflow, pressure, and acoustic data on the same board (analog input) and would like the switch to trigger when the airflow value is within a pre-determined range. Finally, I would like to reverse the polarity of the switch (to off) about a second after the initial digital signal, all of which is during continuous data acquisition.
    I am able to actuate the switch only when pressing the "run" button in the DAQ assistant window. I am proficient with data acquisition but have never tried programming an output... Please help!
    Thanks!
    -a troubled researcher
    P.S. I am running LabVIEW 8.5 as well.

    blsmith4,
    You probably won't get the control of the digital port on your card by only using the DAQ Assistant. One of the following examples should provide you the functionality that you would like out of the box:
    Digital - SW - Timed Output (Simple)
    Digital - Continuous Output (More Complex)
    Continuous Write Digital Port - External Clock - Non Regeneration (Most Complex)
    Let me know if these work better for you.
    Best,
    Jason M.
    Applications Engineer
    National Instruments

  • FPGA output different to emulator

    I've written a simple vi that outputs a sine wave using the FPGA sine generator. This passes through a half-wave rectifier setup (via a SCB-68 connector block) and back into the FPGA. When I set the execution target to the FPGA emulator the vi works perfectly. A full sine wave is displayed on one wave-chart, and a half wave on other. However, when I target the FPGA device and compile and download the vi, the output turns into what appears to be random noise. Both wave-charts show nothing like a sine wave. Whats going on?
    Cheers,
    Rob.

    Actually i've just found the following in a help file, i'll give it a go...
    Sine Generator Details
    If you target an FPGA device emulator, the Sine Generator VI outputs every point of the generated sine wave, regardless of the rate at which LabVIEW calls the VI. To produce the same data while targeting an FPGA device emulator as when targeting an FPGA device, change phase increment to take into account the rate at which the FPGA VI calls the Sine Generator VI. The following equation determines the correction for using an FPGA device emulator.
    phase increment (emulation) = phase increment (FPGA) * FPGA loop time (ticks)

  • Save SQL select output as html page on another box.

    How can I save a simple sql select output on another server as a html page?

    Hi,
    You can use the Oracle product WebDB (Oracle Portal) to create reports in HTML over the DB (simplest way).
    Instead You can use SQL*Plus on the remote server (where You want to spool), enable the spool to file (using SPOOL) and create the select as
    SELECT 'html tags' &#0124; &#0124; field/s &#0124; &#0124; 'html tags'
    FROM your_table;Using this solution You have to manually "draw" the report.
    Hope this helps.
    Bye Max
    null

  • Query output based on date - Oracle 8i

    I am trying to write a very simple query to output data based
    on date ranges, but I keep encountering an error.
    When I do this statement:
    select * from my.table
    where startdate > '2008-01-01'
    I get this error:
    [ODBC][Ora]ORA-01861: literal does not match format string
    When I format the select statement this way:
    select * from my.table
    where startdate > #2008-01-01#
    i get this error:
    [ODBC][Ora]ORA-00932: inconsistent datatypes: expected DATE
    got NUMBER
    Currently using CF8, and what I believe is Oracle 8i. I have
    tried formatting this data in many other ways, but can't get it to
    work. I know that when I query the database via access, it has no
    problem returning results with the SQL date formatted like
    #01/01/2008#

    You can use the Oracle to_date() function to convert your
    string to a date/time object:
    select * from my.table
    where startdate > to_date('2008-01-01', 'YYYY-MM-DD')
    Or, since you are using an ODBC connection to Oracle, you can
    try using the ColdFusion CreateODBCDate() function:
    select * from my.table
    where startdate > #CreateODBCDate("2008-01-01")#
    Or, as already suggested, use cfqueryparam with the
    appropriate CFSQLType, such as
    CF_SQL_TIMESTAMP instead of CF_SQL_INTEGER like you are
    attempting to do.
    You can't use a "string" date value against a date/time
    column in an Oracle query, as it won't perform an implicit type
    conversion.
    Phil

Maybe you are looking for