US elimiation

HI friends,
i'm working on US elimination.
Dim: ENTITY , is it mandatory  to maintain INTCO property for each of entity.
Eg: two entities E_US,E_UK in ENTITY Dim and I_US,I_UK are ids of INTCO dim.
Usually in INTCO dim, for each intco member id (I_US), we need to maintain propery "Entity" (i.e E_US).
source records:
Time | Parterner| Rptcurrency|Acct| Category| Datasrc| Flow| Groups| Intco| Amount
2010.APR     E_US     USD     ICSALES     100     INPUT     F_NONE     LC     I_JP     20.000,0000000-
2010.APR     E_JP     USD     ICCOST     100     INPUT     F_NONE     LC     I_US     20.000,0000000
Script logic Is:
*RUN_PROGRAM US_ELIM
CATEGORY = %C_CATEGORY_SET%
GROUP = %GROUPS_SET%
TID_RA = %TIME_SET%
OTHER = [ ]
*ENDRUN_PROGRAM
BPC excel, DM package (dynamic view editor) : code:
PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%,GROUPS,%TIME_DIM%")
INFO(%EQU%,=)
INFO(%TAB%,;)
TASK(/CPMB/IC_ELIMINATION_LOGIC,TAB,%TAB%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,EQU,%EQU%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,SUSER,%USER%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,SAPPSET,%APPSET%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,SAPP,%APP%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,SELECTION,%SELECTION%)
TASK(/CPMB/IC_ELIMINATION_LOGIC,LOGICFILENAME,ICELIM.LGF)
After running DM package, in formula log: 0 submitted 0 success 0 fail.
Is passage of group value  from DM script to script logic is correct or not?
thanks,
naresh

Time | Parterner| Rptcurrency|Acct| Category| Datasrc| Flow| Groups| Intco| Amount
2010.APR  | E_US |USD| ICSALES | 100 | INPUT | F_NONE |G_NONE | I_JP |20.000,0000000-
2010.APR | E_JP |  USD  | ICCOST | 100  | INPUT | F_NONE |  G_NONE | I_US  | 20.000,0000000
Groups Dim:
ID | EVdescriptionj | curr_type
LC  | Local currency |  L
G_NONE  | No Group  |  L
Entity Dim:
ID  | EvDescription  | Intco | Currency
E_US | USA |  I_US | JPY
E_JP |  JAPAN | I_JP | USD
Intco Dim:
ID | Evdes | Entity
I_JP | Intco Japan | E_JP
I_US | Intco US | E_US
Datasrc Dim:
ID | Evdes | datasrc_type  | is_converted
INPUT | Manual input  | I  | Y
AJ_ELIM | Adj Elimin  | A  |
Does above configuration requires any modification ?
thanks.

Similar Messages

  • How do I delete cascade with a PL/SQL procedure?

    This script will create a PL/SQL procedure that deletes cascade. This is a post to contribute to the Oracle community. Take the code as is and test it before you use it in production. Make sure this is what you want.
    Procedure Delete Cascade (prc_delete_cascade)
    Description
    =============
    The principle is very simple. The procedure uses a table called TO_BE_DELETED to keep a list of records to be deleted. This
    table keeps the table name and the rowid of those records that need to be deleted. The procedure also uses a function called
    DELETE_BOTT_ROW which takes one record of the table and tries to delete it. If the deletion fails with a foreign key constraint
    violation, the function parses the SQL error message (SQLERRM) to get the name of the constraint. With the name of the constraint,
    the function finds the name of the child table, all the child records that have references to the parent table primary or unique key,
    and the parent key primary or unique key column name. Once the child records of the failed delete are identified, the function takes their table name and rowids
    and records them into the TO_BE_DELETED table by inserting records of their table name and their rowids. Al the records inserted also contain the level (which
    is 1 for the original records, 2 for child records, 3 for granchild records, etc.) and the sequence number of the order in wich they
    are recorded. This way, when the function picks up a record to be deleted, it takes the one with the highest level and the highest
    inserted sequence, or the "bottom" record. Once all the child records of the failed delete are appended to the TO_BE_DELETED table, it calls itself
    recursevely, and the function takes the record at the "bottom" of the table and tries to delete it. If it succeeds, it calls
    itself recursevely to delete the next record. If it fails, it goes and finds the child records as described before and once they are
    inserted into the TO_BE_DELETED table, it calls itself again recursevely to try to delete again the "bottom" record. All records
    that are successfully deleted are flagged as deleted usig the flag_del column so they are not pickt up again. Once all the (parent,
    child, grandchild, etc.) records are deleted, the procedure ends without commiting, giving the option to the user to commit or
    rollback deletions. The table TO_BE_DELETED is, at the end of the procedure, a list of all the records that were deleted, including their table names
    and the order in with they were deleted. The user then can review its content and decide to commit or rollback.
    Restrictions
    ============
    1. Single tables only. The procedure only takes one table name and a WHERE clause to identified the records to be deleted.
    2. Single columns only. Ther procedure only works with single-column primary, unique and foreign key constraints.
    3. Single schema only.
    4. Unpredictable results with circular references.
    drop table to_be_deleted purge;
    create table to_be_deleted
    (tname varchar2(30)       -- table name
    ,rid rowid                -- rowid
    ,lvl number               -- level: 1=parent, 2=child, 3=grandchild, etc.
    ,seq_ins number           -- sequence order of record inserted
    ,flg_del char             -- flag deleted: Y=record deleted
    ,seq_del number           -- global order of record deletion
    set serveroutput on size 1000000
    create or replace procedure prc_delete_cascade
    (p_tname varchar2  -- table name
    ,p_where varchar2  -- where clause identifying records to be cascade deleted
    is
      dummy         char;
      v_sqlcode     number;
      v_sqlerrm     varchar2(32767);
      v_param_val   integer := 0;
      v_sql         varchar2(4000);
      v_ret_cde     number;
      e_bad_params  exception;
      v_iter        number;
      v_plvl        number;
      v_seq_del     number;
      v_max_iter    number := 1000000000;
      function delete_bott_row
      return number
      is
        v_sql        varchar2(4000);
        v_ptname     varchar2(30);  -- parent table name
        v_ppkname    varchar2(30);  -- parent primary key constraint name
        v_ppkcname   varchar2(30);  -- parnet primary key column name
        v_prowid      rowid;
        v_crowid      rowid;
        v_ctname     varchar2(30);  -- child table name
        v_cfkname    varchar2(30);  -- child foreign key constraint name
        v_cfkcname   varchar2(30);  -- child foreign key column name
        v_ins        number;
        v_seq_ins    number;
        v_sqlerrm    varchar2(4000);
        v_sqlcode    number;
        e_const_viol exception;
        pragma exception_init(e_const_viol, -2292);
        e_max_iter_reached exception;
      begin
        v_iter := v_iter + 1;
        if v_iter >= v_max_iter then
          raise e_max_iter_reached;
        end if;
        dbms_output.put_line('- Iter '||to_char(v_iter));
        dbms_output.put_line('----------');
        dbms_output.put_line('- Starting function delete_bott_row');
        v_sql := 'select tname, rid, lvl, seq_ins from (select * from to_be_deleted where flg_del = ''N'' order by lvl desc, seq_ins desc) where rownum=1';
        --  dbms_output.put_line('- SQL: '||v_sql);
        execute immediate v_sql into v_ptname, v_prowid, v_plvl, v_seq_ins;
        dbms_output.put_line('- Selected row: table name: '||v_ptname||', level: '||v_plvl||', seq: '||v_seq_ins);
        v_sql := 'delete from '||v_ptname||' where rowid='''||v_prowid||'''';
        dbms_output.put_line('- SQL: '||v_sql);
        execute immediate v_sql;
        dbms_output.put_line('- Row deleted !!!');
        v_ret_cde := 1;
        v_seq_del := v_seq_del + 1;
        dbms_output.put_line('- Mark the row deleted');
        v_sql := 'update to_be_deleted set flg_del = ''Y'', seq_del = '||to_char(v_seq_del)||' where tname='''||v_ptname||''' and rid='''||v_prowid||'''';
        -- dbms_output.put_line('- SQL: '||v_sql);
        execute immediate v_sql;
        -- dbms_output.put_line('- Updated table to_be_deleted, row marked deleted');
        -- dbms_output.put_line('- End of iter '||to_char(v_iter));
        dbms_output.put_line('----------');
        -- call function delete_bott_row recursively
        v_ret_cde := delete_bott_row;
        return 0;
      exception
        when no_data_found then
          dbms_output.put_line('- Table to_be_deleted is empty, delete cascade has completed successfully.');
          v_ret_cde := 0;
          return 0;
        when e_const_viol then
          v_sqlcode := SQLCODE;
          v_sqlerrm := SQLERRM;
          v_ret_cde := v_sqlcode;
          dbms_output.put_line('>Constraint Violation. Record has children');
          -- dbms_output.put_line('Error code: '||to_char(v_sqlcode));
          v_cfkname := substr(v_sqlerrm,instr(v_sqlerrm,'.')+1,instr(v_sqlerrm,')') - instr(v_sqlerrm,'.')-1);
          dbms_output.put_line('>Child FK name: '||v_cfkname);
          select table_name, column_name
            into v_ctname, v_cfkcname
            from user_cons_columns
           where constraint_name=v_cfkname;
          dbms_output.put_line('>Child table name: '||v_ctname||'. FK column name: '|| v_cfkcname);
          select constraint_name, column_name
            into v_ppkname, v_ppkcname
            from user_cons_columns
           where constraint_name = (select r_constraint_name
                                      from user_constraints
                                      where constraint_name=v_cfkname);
          dbms_output.put_line('>Parent PK/UK name: '||v_ppkname||'. Parent PK/UK column: '||v_ppkcname);
          v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) '||
                   'select '''||v_ctname||''', rowid, '||to_char(v_plvl+1)||', rownum, ''N'' '||
                   'from '||v_ctname||' '||
                   'where '||v_cfkcname||' =any (select '||v_ppkcname||' from '||v_ptname||' where rowid =any (select rid from to_be_deleted where tname = '''||v_ptname||'''))';
          -- dbms_output.put_line('- SQL: '||v_sql);
          execute immediate v_sql;
          select count(*)
            into v_ins
            from to_be_deleted
           where lvl = v_plvl+1
             and tname = v_ctname
             and flg_del = 'N';
          dbms_output.put_line('>Found '||to_char(v_ins)||' child records which were added to table to_be_deleted');  
          v_ret_cde := delete_bott_row;
          return  v_ret_cde;
        when e_max_iter_reached then
          dbms_output.put_line('Maximum iterations reached.  Terminating procedure.');
          raise;
        when others then
          raise;
      end delete_bott_row;
    begin
      dbms_output.put_line('Beginning');
      dbms_output.put_line('================================');
      -- validate p_table
      begin
        select 'Y'
          into dummy
          from user_tables
         where table_name=upper(p_tname);
      exception
        when no_data_found then
        v_param_val := 1;
        dbms_output.put_line('Table '||p_tname||' does not exist.');
        raise e_bad_params;
      end;
      dbms_output.put_line('- Parameter p_tname validated');
      -- validate p_where
      begin
        execute immediate 'select ''Y'' from '||p_tname||' where '||p_where INTO dummy;
      exception
        when no_data_found then  -- where clause returns no records
          dbms_output.put_line('Record(s) not found.  Check your where clause parameter');
          v_param_val := 2;
          raise e_bad_params;
        when too_many_rows then  -- found multiple records means it is ok
          null; 
        when others then  --  any other records means where clause has something wrong.
          dbms_output.put_line('Where clause is malformed');     
          v_param_val := 2;
          raise e_bad_params;
      end;   
      dbms_output.put_line('- Parameter p_where validated');
      if v_param_val > 0 then raise e_bad_params; end if;
      v_iter := 0;
      v_plvl := 1;
      v_seq_del := 0;
      v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) select '''||upper(p_tname)||''', rowid, '||to_char(v_plvl)||', rownum, ''N'' from '||p_tname||' where '||p_where;
      dbms_output.put_line('- Inserting initial record');
      dbms_output.put_line('- SQL: '||v_sql);
      execute immediate v_sql;
      dbms_output.put_line('- Record(s) inserted');
      dbms_output.put_line('- Calling function delete_bott_row to delete last row of table to_be_deleted');              
      dbms_output.put_line('-----------------------------------');              
      v_ret_cde :=  delete_bott_row;
      -- dbms_output.put_line('- Back from function delete_bott_row');              
      -- dbms_output.put_line('Return code: '||to_char(v_ret_cde));              
      dbms_output.put_line('- End of procedure');              
    exception
      when e_bad_params then
        dbms_output.put_line('Bad parameters, exiting.');
    end;
    show errors
    spool prc_delete_cascade.log
    --  Call to the procedure
    exec prc_delete_cascade('xent','xent_id between 1669 and 1670')
    select tname "Table Name", count(*) "Rows deleted"
      from to_be_deleted
    group by tname;
    spool off
    set lines 120
    select *
      from to_be_deleted
    order by seq_del;
    prompt  Now commit or rollaback deletions.
    -- commit;
    -- rollback;Edited by: Rodolfo4 on Mar 23, 2011 10:45 AM

    Interesting.
    I see a few areas where this could be useful. Elimiating specific test records from a Test DB for example.
    Some comments:
    <li>Since this is a recursive logic you must add a stop criteria. In this case I would add a max iteration variable. If that one is reached, raise an error message and let the procedure stop with that error.</li>
    <li>The when others exception at the end should be removed completely</li>
    <li>The when others exception in the middle should be replaced by a specific exception that handles the -2292 error</li>
    <li>A list of tables where no record should be deleted could be usefull. If the logic would encounter such a table, it should also stop. This would be to prevent that data from some system critical tables could be deleted per accident.</li>
    <li>The reference from the FK constraint to the PK constraint should include the table name and if possible the owner (as long as you use user_* views the owner is always the same. But we could extend this to the ALL_* views). I never met a system where different tables have the identical FK constraint names, however just make this fool proof.</li>

  • && Substitution Variable in Package Body using SQL Developer

    Hi Folks,
    I've moved over to working to in SQL Developer (its a very early version - 1.0.0) from a combination of SQL*Plus command line and a text editor. I'm trying to get this upgrgraded, but I think the question will be the same with a newer version anyway.
    I am creating a package, and in the package body I have some &&my_var substitutions that I was previoulsy prompted for when calling the .sql from the command line SQL*Plus. I need this as the variable needs to be different for the development and live environment.
    When working in SQL Developer, I can load the package body from Connection->Packages->My Package->My Package Body, and click the edit button to edit the code, however, when I click the Compile button in the top of the window my code error's because of the substituion variablle. An example is:
    CREATE OR REPLACE
    PACKAGE BODY MY_PACKAGE AS
    PROCEDURE MY_PROCEDURE
    BEGIN
    my_variable := &&my_function_from_live_or_dev_database
    END MY_PROCEDURE
    Can anyone tell me if there is a way of defining a compiler variable within the IDE widow while editing a package body stored in the database, without manually copying the code into the Worksheet and running it as a script?
    Thanks,
    AM

    953104 wrote:
    Thanks for the reply, the code was just quickly typed to show the sort of thing I am doing, it wasn't actual code form my project.
    I've come from a C background so what I would have done would be create a #define and changed to when on live or development - or passed the variable to the build environment from the IDE or makefiles and the change would have reflected through my whole project.
    What I want to be able to do is alter a definition of some sort that will reflect throughout my whole project, so I can change it in one location to minimize code changes before going live. I don't really want to be prompted at all. On one system it needs to be DEV_10 and on the other it needs to be LIVE_10.Is there a possibility to elimiante this difference at all?
    For example if DEV_10 is the oracle schemauser on the development database and LIVE_10 would be the one on the production system. THen you could just remove all references to the schema from your code.
    IF you are already connected to this schema, then you don't need to specify the schema name anymore.
    example
    instead of
    create or replace package dev_10.myPackage
    ...you can simply use
    create or replace package myPackage
    ...If needed you can alter the cuurently connected user just before you run the script.
    alter session set current_schema = LIVE10;
    create or replace package myPackage
    ...This would be a different working window in the developer (script worksheet, instead of direct pl/sql editor).
    Substitution variables are allowed there.

  • Insert values from more than one select query

    Hi all, I've a simple question:
    I need to insert values into a table from two select statements.
    There's what I need to accomplish:
    I need to monitor the cursors opened on a database, so:
    I created the following table:
    O_CURSORS
    Cols: TOTAL (Number 5), USER (VARCHAR2 20), DATE (TIMESTAMP)
    I think some query like the following should work, but unfortunately, it doesn't.
    insert into O_CURSORS (total,user,date)
    values (
    (select a.value, s.username from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic#  and s.sid=a.sid and b.name = 'session cursor cache count'),
    (select sysdate from dual)
    )This statement is not working, the message is
    "Not enough values"
    If I modify the statement as follows, it works fine
    insert into O_CURSORS (total,user)
    (select a.value, s.username from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic#  and s.sid=a.sid and b.name = 'session cursor cache count'),
    )Any advice would be very appreciated!
    Thanks in advance.

    You don't have to select sysdate from dual; it can be a part of any select statement. Just include sysdate in your first query:
    INSERT INTO O_CURSORS (total,user,date)
    SELECT a.value, s.username, SYSDATE
    FROM v$sesstat a,  v$statname b,   v$session s
    WHERE a.statistic# = b.statistic#
      AND s.sid=a.sid and b.name = 'session cursor cache count'You'll note also that I elimiated the VALUES keyword, and just used a SQL statement to satisfy the INSERT statement.
    Edited by: user13640471 on Feb 21, 2011 1:17 PM
    Edited by: user13640471 on Feb 21, 2011 1:18 PM

  • Intercompany Profit eliminations

    Hi Experts
    I am working on intercompany profit elimination and trying to understand how it works.
    We have implemented intercompany profit elimiation for US and trying to work for other countries. My client is using Dual costing for materials to record profit made in intercompany and later to eliminate (I/C profit elimination) at month end.
    Can any one explain how does this work ?
    Thanks
    Deepa

    Hello Deepa!  I too am just beginning to work on our intercompany profit elimination techniques using 4.7 in SAP and Material Ledger actual costing.  We previously set up 3 currencies.  The currencies are as follows:
    10 - Called Local currency.  this currency will include the profit in the cost estimate and std of the transferred parts.
    30 - Called Group currency.  This one is a straight conversion to the group currency (if different) at the exchange rates provided in the rate table.
    31 - Called Group at Group.  This currency is expected to provide the cost estimate standard cost of all inventory without the extra profit layer. 
    So, we have a couple of things that must happen.  We need a layer within the cost estimate that gets picked up in currencies 10 and 30, but not in 31.  I believe this behavior is handled by the way the layer is created.  If we use Additive Costs, the Accounting department would add the profit layer to the cost estimate for the normal costing variant.  We would not apply an additive cost layer for the other costing variant that applies to the 31 currency.  The other thing is that we then need to find a report that shows the currencies with (30) and without (31) intercompany profit layer.  This report will show us the remaining intercompany profit layer in inventory which should be eliminated.
    That is the basic strategy we are going to test with.  Another way we plan on adding the layer is to use Purchasing Information Records (PIR) - Pricing Conditions.  If we can get the PIR pricing conditions to work as described above using Additive Costs, we can hand off the daily maintenance to the purchasing side of the organization.  This is just another option to explore.
    If you have arrived at any additional epiphanies, please let me know.
    David

  • How does Hs.con function work

    <p>Hi:</p><p>   I want to know the hs.con funtion workprocess.Where does the function result store,and what is the resultcalculating formula.</p><p> </p><p>Thanks & Regards!</p><p> </p><p>Jasun</p>

    Jasun,The current POV is going to be the source for this . For eg if you are writing to the [Elimiation] Value dim , the amt eliminated during the ICP process is the source . If you are going to write to the [Propotion] value member , your total contribution excluding the eliminations is going to be the source value . I hope I answered your question...Naveen

  • Daylight Savings started in my country... Alarm clock time did not change

    Hi,
    DST began in mexico. My iphone clock is set to "Mexico City" time zone and the clock indeed adjusted automatically to DST this past sunday.
    The iphone alarm (not a 3rd party app, but the original iphone alarm app) is what had a weird behavior... the time for "Alarm 1" was displayed to be set at, say 7am. But the alarm went off at 8am!
    The time shown in the app for all my alarms is correct but they are all coming off one our late of the time shown; as if set at the pre daylight savings time.
    Please Help.
    FWIW, all my calendar (exchange-synconized) appointments are working correctly.

    I found that even though the correct time and time zone where set on my iPhone, it depended on what my iTunes account time zone was set to. I had relocated country recently, and because I had to open a new iTunes account in my new country of residence, my iPhone alarms and calendar reminders would pop up depending on what iTunes account I happened to be singed in with. So I closed my old iTunes account, and thus elimiated the problem of accidentally singing in with my old itunes account that was set to a different time zone. Hope this helps someone, as I was frustrated for months before I discovered this. Cheers.

  • Login Window: Screen does not refresh correctly after waking 10.7.2 iMac and MacBook.

    I have a client who brought to my attention that when we wakes his iMac and MacBook after the screen dims or sleeps at login screen, that sometimes the screen does not refresh correctly and you must use the cursor to basically "clear the screen."  I have witnessed this myself and elimiated all third party products and this still happens.  I am starting to believe that is is a bug in 10.7.2.  Has anyone witnessed this or have any suggestions on how to remedy?  Thank you.

    Thanks lynque.  It turns out I did need a keychain repair, but that didn't fix the problem.  I probably should have done this earlier, but I ended up unplugging all peripherals (2 firewire + 3 USB) then powered up without issue.
    So I shut down, plugged in one at a time, and ran into the problem again after plugging in an external hard drive (WD My Book Essential).  I repaired with disk utility, but the problem remained.
    I then rebuilt the partitions with Disk Warrior, and now everything seems to work....

  • Gradient mesh dying, CS 6 gradient stroke gonna take over?

    Hi just wondering,
    I had a look at the CS6 sneak peek video and thought to myself will there be any use for a gradient mesh now since you can use  a gradient stroke to fill in colors to the contours of a shape?
    Anyone played around with it enough to tell me what would be the major disadvantage or advantage between a gradient mesh vs a gradient stroke?

    Can't do anythign close to this with a gradient stroke or gradient fill.
    I think, if anything, they may elimiante the need for blends a bit and provide better options for some situations. With a gradient stroke you can easily blend two flat colors to each other simply via the stroke.
    And it does make directional cradients a snap with the "along" setting.
    And you can somewhat fake conical gradients with a thick stroke.

  • Calendar alarm goes of late

    After setting alarm in the calendar the time is going off Late. 

    I found that even though the correct time and time zone where set on my iPhone, it depended on what my iTunes account time zone was set to. I had relocated country recently, and because I had to open a new iTunes account in my new country of residence, my iPhone alarms and calendar reminders would pop up depending on what iTunes account I happened to be singed in with. So I closed my old iTunes account, and thus elimiated the problem of accidentally singing in with my old itunes account that was set to a different time zone. Hope this helps someone, as I was frustrated for months before I discovered this. Cheers.

  • Help with some simple coding

    Hello
    I am very new to Java and am currently studying a course in the language.
    I am working through a tutorial at the moment and a question has been asked and I am struggling a bit
    I have been given the code to a program that creates a window with a ball bouncing around inside the window.
    There are 2 classes (code below) - Call class - this contains all the code need to create the ball and BallWorld Class (the main Class) this create the window and moves the ball, it also detects if the ball hits the edge of the window, whne this happens it redirects the ball. I understand how all this code works
    I have been asked the following:-
    Rather than testing whether or not the ball has hit the wall in the nmain program, we could use inhertitance to provide a specialized forom of Ball. Create a class BoundedBall that inherits from the class Ball. The constructor for this class should provide the height and width of the window, which should be maintained as data fields in the class, rewrite the move method so that the ball moves outside the bound, it automatically reflects its direction. Finally rewrite the BallWorld class to use an instance of BoundedBall rather than ordianary Ball, and elimiante the bounds test in the main program.
    I am having trouble with this and I can not get my code to work, I think I may be going in completly the wrong direction with the code can sombody please provide me with a simple working code for both the BoundedBall and ammended BallWorld class, as this will help me understand whare I am going wrong
    Ball class
    //a generic round colored object that moves
    import java.awt.*;
    public class Ball {
    public Ball (Point lc, int r) {     //constructor for new ball
         //ball centre at point loc, radius rad
         loc = lc;
         rad = r;
    protected Point loc; //position in window
    protected int rad; //radius of ball
    protected double changeInX = 0.0; //horizontal change in ball position in one cycle
    protected double changeInY = 0.0; //vertical change in ball position in one cycle
    protected Color color = Color.blue; //colour of ball
    //methods that set attributes of ball
    public void setColor(Color newColor) {color = newColor;}
    public void setMotion(double dx,double dy)
    {changeInX = dx; changeInY = dy;}
    //methods that access attributes of ball
    public int radius() {return rad;}
    public Point location() {return loc;}
    //methods to reverse motion of the ball
    public void reflectVert(){ changeInY = -changeInY; }
    public void reflectHorz(){ changeInX = -changeInX; }
    //methods to move the ball
    public void moveTo(int x, int y) {loc.move(x,y);}
    public void move(){loc.translate((int)changeInX, (int)changeInY);}
    //method to display ball
    public void paint (Graphics g) {
    g.setColor(color);
    g.fillOval(loc.x-rad, loc.y-rad, 2*rad, 2*rad);
    BallWorld class
    //A bouncing ball animation
    import java.awt.*;          //import the awt package
    import javax.swing.JFrame;     //import the JFrame class from the swing package
    public class BallWorld extends JFrame{
         public static void main (String [] args){
              BallWorld world = new BallWorld(Color.red);
              world.show();
    for(int i = 0; i < 1000; i++) world.run();
    System.exit(0);
         public static final int FrameWidth = 600;
         public static final int FrameHeight = 400;
    private Ball aBall = new Ball(new Point (50,50),20);
         private BallWorld(Color ballColor) {     //constructor for new window
              //resize frame, initialize title
         setSize(FrameWidth, FrameHeight);
         setTitle("Ball World");
    //set colour and motion of ball
         aBall.setColor(ballColor);
         aBall.setMotion(3.0, 6.0);
         public void paint (Graphics g) {
    //first draw the ball
    super.paint(g);
         aBall.paint(g);
    public void run(){
              //move ball slightly
         aBall.move();
    Point pos =aBall.location();
    if ((pos.x < aBall.radius()) ||
    (pos.x > FrameWidth - aBall.radius()))
    aBall.reflectHorz();
    if ((pos.y < aBall.radius()) ||
    (pos.y > FrameHeight - aBall.radius()))
    aBall.reflectVert();
    repaint();
    try{
    Thread.sleep(50);
    } catch(InterruptedException e) {System.exit(0);}

    Here - you can study this :0))import java.awt.*;
    import javax.swing.*;
    public class MovingBall extends JFrame {
       mapPanel map   = new mapPanel();
       public MovingBall() {
          setBounds(10,10,400,300);
          setContentPane(map);
       public class mapPanel extends JPanel {
          Ball ball  = new Ball(this);
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            ball.paint(g);
    public class Ball extends Thread {
       mapPanel map;
       int x  = 200, y = 20, xi = 1, yi = 1;
    public Ball(mapPanel m) {
       map = m;
       start();
    public synchronized void run(){
       while (true) {
          try{
            sleep(10);
          catch(InterruptedException i){
            System.out.print("Interrupted: ");
          move();
    public void move() {
        map.repaint(x-1,y-1,22,22);
           if (x > map.getWidth()-20 || x < 0)  xi = xi*-1;
           if (y > map.getHeight()-20 || y < 0) yi = yi*-1;
           x = x + xi;
           y = y + yi;
           map.repaint(x-1,y-1,22,22);
        public void paint(Graphics g) {
           Graphics2D g2 = (Graphics2D)g;
           g2.setColor(Color.red);
           g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_ON);
           g2.fillOval(x,y,20,20);
           g2.dispose();
    public static void main(String[] args) {
       new MovingBall().show();
    }

  • Exported slideshow from Iphoto11 to IDVD 7.12 so I could burn DVD for play on DVD player. Fine but show stops 1/2way through because DVD has 2 chapters. How do I eliminate chapters?

    I exported slideshow from Iphoto 11 to IDVD 7.12 so I could burn DVD for play on DVD player. Fine, but then when playing on DVD player show stops about 12 way and starts over. Seems there are 2 chapters in show. I wan t show to play straight through until end. How do I elimiante chapters or solve problem. Thanks. Bob Low

    Try this workflow:
    Once you have the project as you want it save it as a disk image via the  File ➙ Save as Disk Image  menu option.  This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image and launch DVD Player and play it.  If it plays OK with DVD Player the encoding was good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    Play the disk image with DVD Player and see if you get the same start over half way thru.
    Did you create the slideshow in iPhoto in the slideshow mode?
    or were you in an album and then used the Share ➙ iDVD menu option?  What I'm trying to find out is if the slideshow in iDVD is a movie file or an iDVD slideshow with the photos from iPhoto? If it's the latter how many photos in the slideshow?
    OT

  • Automatic subdomains based on folders mod_vhost_alias

    I guess the mod_vhost_alias should give me this solution, but im not shure how to use it.
    My goal is to have new folders in my root folder become a subdomain.
    like this: folder: root/test
    Gives: test.domain.com
    Under Aliases it says "Aliases make folders on this server publicly accessible via URLs on this server"
    Need to find out what to set in "type" and "Alias Path"
    Any ideas?

    Assuming your main site www.example.com is using the default directory path:
    /library/webserver/documents
    Create a virtual host (what Apple calls a "Site"), and specify the path to the files. 
    Here, assuming that:
    /library/webserver/documents/test
    will be the files you want to serve for that test.example.com site.  Specify that as the path for the virtual host.
    The whole "subdomain" stuff foo.example.com isn't central; it's a virtual host, just like www.example.com host.
    Your web browser clients will have to have a www.example.com translation (as they likely already do) and a test.example.com DNS translation (and that's usually a DNS CNAME for the same host as www.example.com), as the name of the virtual host to be selected arrives from the browser client.
    Aliases aren't related to this stuff.  They're a way to have two (or more) names resolve to one host ("site").  However.... Watch out for any wildcard (*) aliases that might be around.  Those * wildcards can sometimes be found in some configurations, and can cause confusing behavior with which sites get selected for an incoming request, until found and elimiated.

  • Wrong Timezone

    My MacBook Pro thinks it is in Paris (I'm actually in the US) and set my timezone to Central European Time. My Mom's iPad was doing the exact same thing. How do I fix this?

    I found that even though the correct time and time zone where set on my iPhone, it depended on what my iTunes account time zone was set to. I had relocated country recently, and because I had to open a new iTunes account in my new country of residence, my iPhone alarms and calendar reminders would pop up depending on what iTunes account I happened to be singed in with. So I closed my old iTunes account, and thus elimiated the problem of accidentally singing in with my old itunes account that was set to a different time zone. So all in all, maybe check and see what time zone your iTunes account is set to.

  • Selling emac/upgrade

    I am selling my emac soon and getting an imac how do I get rid of my personal details,I want to leave the music on as well as other programs,I want to leave it as it is now just remove the personal stuff.
    Thanks
    John

    Johnboy651,
    Welcome to the Apple Discussions!
    Don't move or delete anything until you've used Setup Assistant / Migration Assistant to transfer your old data and settings over to the new iMac!
    There are two ways you caan go, depending on whether you ever used your computer for financial record keeping and the like and how serious you'd consider any effort by fiture owners to access anything off the eMac.
    The most time-consuming but safest method is to erase the hard drive, using the zero all data option, then reinstall OS X and restore the included applications. You may then create a new admin user account and use that to check Software Update to apply OS, security, and application updates; if you have broadband internet access and your buyer has a dialup account, they'll thank you for that. Your post doesn't note the OS version on the eMac; you can search the Knowledge Base via the "Advanced Search" link at the top of the Discussions pages for e.g. "erase and install 10.2" for references on how to reinstall and restore software (the details will depend on the OS and optical drive type of the eMac).
    A less secure method is to just eliminate your user account while leaveing everything else behind; that may appeal to you if you never had anything particularly sensitive on the computer or if you're selling to a close friend or family member and want them to have access to some part of the files you've collected or created.
    Move anything in the ~/Users/ [yourusername]/ path that you want left behind to the ~/Users/ Shared folder. Note that music you ripped from CDs into iTunes remains under the original copyright holder's rights and should be removed unless you're selling your CDs along with the computer. If your have music from ther iTunes Music Store, deauthorize the eMac before selling it.
    Create a new administrative user account on the eMac and log on to that. Don't set up any e-mail or online accounts for the new user --- you don't want to leave any trace of your old accounts and passwords behind. Check that files you want left behind are accessible in the Shared folder. Switch back and forth between accounts until you have things arranged to your satisfaction. Test-run a couple of programs to make sure they work. You can then delete your original user account from the ~/Users folder. Select Secure Empty Trash (if you're running 10.3 or later). Double-check that System Preferences/ Network doesn't contain any personal info about your ISP account if you're using PPPoE.
    Applications originally included with the Mac or freeware downloads can be left alone, as can commercial and shareware software to which you're transferring the license. Paid programs you migrate to your next computer should be removed by dragging the program to the Trash and emptying it. You can further elimiante the paid programs's preferences and support files (in Library/ Application Support and Library/ Preferences) if you want to be really complete.
    Either way, it's helpful to make sure you include all the discs that came with the eMac when you sell it. That will help your buyer if he/she ever needs to run Disk Utility from the OS X Install disk or the like.

Maybe you are looking for

  • Problem with shopping cart

    When I click on "buy now" i get an error message saying items in my cart have changed, etc and to check it again and then hit buy now. I just keep getting same message over and over. If I choose one-click shopping, I can buy. But I hate having 20-25

  • How to use rsync on Solaris 10

    I have set up rsync to run as a daemon on 2 Solaris 10 servers rsync --daemon with a /etc/rsyncd.conf file of motd file = /etc/motd max connections = 5 syslog facility = local3 [ftp] comment = ftp area path = / read only = yes list = yes uid = nobody

  • Acrobat X offline help

    Hi, i have just noticed that Adobe Acrobat X has no oflline help function anymore. Every time when hitting F1 or chosing help from the menu Acrobat is trying to connect to the internet. Of course it can not connect through an authentication proxy and

  • Need help from executives above elite customer services

    Below is our attempts to change our services with Verizon FIOS.  It has been an ongoing frustration with different infromation and redirection.  We are trying to get a consistant answer form someone in the customer service division.  Otherwise we wil

  • Production order backflush - Batch determination

    Hi, We are following discrete manufacturing with backflush setup for auto GI of materials. The entire flow is functioning smoothly, like 1. Creation of production order & release to production. 2. Auto goods issue upon first operation confirmation. T