Casting without "explicit" coding

Hi,
I have some problem with casting. Here is the code:
* public interface ViewInt...
* public class View extends JInternalFrame implements ViewInt...
* public class View2 extends JInternalFrame implements ViewInt...
* public class Main
ViewInt frame=new View();
In some other class, I need to add this frame into a DesktopPane,
but his code isn't work
this.getDesktopPane().add(frame);
because the method add(ViewInt) doesn't exist!
But it works like this: this.getDesktopPane().add((View)frame);
My problem is that in this class, we are not supposed to know the class View!
How can I make this work with View2 too or another classes without instanceof because it is supposed to accept any class which extends JInternalFrame?
I try this but doesn't work: this.getDesktopPane().add((frame.getClass())frame);
Any idea?

Option 1: Add a common view class, so that you can refer to both objects through the same reference, i.e.
public interface ViewInt {...}
public abstract class AbstractView extends JInternalFrame implements ViewInt {}
public class View extends AbstractView {...}
public class View2 extends AbstractView {...}
public class Main {
    AbstractView frame=new View();
        getDesktopPane().add(frame);
}Using this approach, you can refer to either type of view using the same reference, and they are both Frames and ViewInts. However, your code is still aware of the View class, albeit through a new common base class.
Option 2: Make the interface aware of the fact that it'll be implemented mixin with a Frame, and have it provide access to this Frame, i.e.
public interface ViewInt {
    JInternalFrame asJInternalFrame();
public class View extends JInternalFrame implements ViewInt {
    public JInternalFrame asJInternalFrame() { return this; }
public class View2 extends JInternalFrame implements ViewInt {
    public JInternalFrame asJInternalFrame() { return this; }
public class Main {
    AbstractView frame=new View();
        getDesktopPane().add(frame.asJInternalFrame());
}Using this approach, you can refer to either type of view using the same reference, but they are not Frames, only ViewInts. However, your code can still access the frame.
Any other classes implementing this interface must support this method. They could throw an UnsupportedOperationException, and this approach is a bit messy in that it mixes the model and the view. However, you're already mixing the two by expecting to be able to be able to add a model object as a view object.

Similar Messages

  • How do I read a properties file in WEB-INF without hard-coding a path?

    Hello,
    How do I read a properties file in WEB-INF without hard-coding a path?
    I tried:
    Properties properties = new Properties();
    properties.load(new FileInputStream("db.properties"));
    driver = properties.getProperty("driver");
    but it cannot find the db.properties file.
    Thanks for the help.
    Frank

    Don't use a File to read those properties.
    Better to use the servlet context and
    getResourceAsStream() method to get the InputStream.
    It'll look for any file in the CLASSPATH. If you put
    that properties file in the WEB-INF/classes directory
    you'll have no problems, even if you deploy with a
    WAR file.Completely agree with this approach. Just have to mention the following for completeness
    according to the API,
    "This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
    So using this method, the resource can be anywhere under your web context, not just in the classpath.
    Cheers,
    evnafets

  • How to get the table name in the trigger definition without hard coding.

    CREATE  TRIGGER db.mytablename
    AFTER UPDATE,INSERT
    AS
        INSERT INTO table1(col1)
        SELECT InsRec.col1   
        FROM
        INSERTED Ins
       --Below i am calling one sp for which i have to pass the table name
       EXEC myspname 'tablename'
      In the above trigger,presently i am hard coding the tablename
      but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name

    I really liked your audit table concept.  You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields.  Wanted to share my end result.
    USE [YourDB]
    GO
    /****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
    ON [dbo].[YourTable]
    AFTER INSERT,DELETE,UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    Declare @v_AuditID bigint
    IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
    CREATE TABLE [dbo].[AutoAudit]
    ( [AuditID] bigint identity,
    [AuditDate] DateTime,
    [AuditUserName] varchar(128),
    [TableName] varchar(128) NULL,
    [OldContent] XML NULL,
    [NewContent] XML NULL
    ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
    PK_AutoAudit PRIMARY KEY CLUSTERED
    [AuditID]
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
    ( [TableName] ASC,
    [AuditDate] ASC
    )WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    END
    Select * Into #AuditDeleted from deleted
    Select * Into #AuditInserted from inserted
    While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
    Begin
    INSERT INTO [dbo].[AutoAudit]
    ( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
    SELECT
    GETDATE(),
    SUSER_NAME(),
    [TableName]=object_name([parent_obj]),
    [OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
    [NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
    FROM sysobjects
    WHERE
    [xtype] = 'tr'
    and [name] = OBJECT_NAME(@@PROCID)
    Set @v_AuditID = SCOPE_IDENTITY()
    Delete from AutoAudit
    Where AuditID = @v_AuditID
    AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
    Delete top(1) from #AuditDeleted
    Delete top(1) from #AuditInserted
    End
    END

  • How to use model clause without hard coding the values in it?

    Query
    select acct_no,
           gl_code,
           CASE
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             ELSE
              'Deferred Revenue Credit'
           END AS entry_type_label,
           CASE
             WHEN entry_type_label IN ('Opening Balance') THEN
              'Opening Balance'
             WHEN entry_type_label IN ('Deferred Revenue Credit') THEN
              'Invoice Amount'
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             WHEN entry_type_label IN ('Closing Balance') THEN
              'Closing Balance'
             ELSE
              'Deferred Revenue Credit'
           END AS label,
           entry_type_no,
           orig_chg_start_date,
           period_no,
           -amt as amt
      from revrec_test
    WHERE acct_no = 1788562
       AND entry_type_no IN (2, 4) model dimension by(acct_no,
              gl_code,
              entry_type_label,
              entry_type_no,
              orig_chg_start_date,
              period_no) measures(amt) rules upsert
    all(amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               190 - amt 1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 191 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 191) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 192 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 192) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 193 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 193) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               193)
    ORDER BY period_no, entry_type_no;
    The above query works fine. But i have hard coded the values. I want to do the same operation for different account number which is going to have different periodic no. How can I achieve it?
    Thanks in advance.

    Create Statement
    CREATE TABLE table_one(
    ACCT_NO             NUMBER(38),                                               
    GL_CODE             VARCHAR2(300),
    ENTRY_TYPE_LABEL    CHAR(50),                                                  
    ENTRY_TYPE_NO       NUMBER,                                                    
    ORIG_CHG_START_DATE TIMESTAMP(0) WITH LOCAL TIME ZONE,
    ORIG_CHG_END_DATE   TIMESTAMP(0) WITH LOCAL TIME ZONE,
    PERIOD_NO           NUMBER(38),
    AMT                 NUMBER(38,10)
    Insert Statement
    INSERT ALL
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,-14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,-14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,-0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Credit',2,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-44)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-35.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,35.91)
    SELECT * FROM dual;
    Expected Result
    S.NO
    ACCT_NO
    GL_CODE
    ENTRY_TYPE_LABEL
    ENTRY_TYPE_NO
    ORIG_CHG_START_DATE
    PERIOD_NO
    AMT
    DESCRIPTION
    1
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    0
    Opening Account
    2
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    44
    Invoice
    3
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    100
    13.87
    Invoice Paid
    4
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    30.13
    Closing Account
    5
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    30.13
    Opening Account
    6
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    0
    Invoice
    7
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    101
    14.35
    Invoice Paid
    8
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    15.78
    Closing Account
    9
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    15.78
    Opening Account
    10
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0
    Invoice
    11
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    102
    14.83
    Invoice Paid
    12
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0.95
    Closing Account
    13
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0.95
    Opening Account
    14
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Invoice
    15
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    103
    0.95
    Invoice Paid
    16
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Closing Account
    Description
    We must start opening account as zero and end with closing account as zero by doing manipulation with invoice and invoice paid.
    Process
    Initial Stage
    Subsequent stage
    Opening Account
    0
    (=closing Account)
    Invoice
    max value of account no which has entry type no 2
    0
    Invoice Paid
    taken from the  field amount which has entry type no 4
    taken from the  field amount which has entry type no 4
    Closing Account
    (=[opening account + invoice] - invoice paid)
    (=[opening account + invoice] - invoice paid)
    Note
    1) Each account may have different periodic no.
    2) Some account may have more than 4 distinct period no and less than 4 distinct periodic no.
    3) Description column from expected result is not an part of table. It is been added for easier understanding.

  • How to replace the audio track of a videofile without re-coding the video

    hey,
    i did an animation in after effects which took about 4 hrs to render. now the sound designer did some changes and i have to replace the audio track. is that possible (in ae, premiere or ame) without encoding the video track again?
    thx
    u

    hello,
    DDVideo QuickTime video converter gain can help you.it only copys and normalises the audio for your mov video without encoding again.
    Operation Steps:
    1.Run the programe.
    2.Add you MOV video,
    3.Select MOV format in ProfileSettings,
    4.There is a "Video Codec" in Video parameter,Please select "  copy  "
    5,Please tick "VolumeGain" box and adjust output target video volume From 75DB to 105DB
    6.Select output files directory,
    7.click "convert " button to convert video.
    The programe also can convert your video to other video format.you need to change Video codec to realize encoding again.
    url:http://daydayvideo.com/quicktime-video-converter.htm
    Hope it helps you.

  • How to put entries in a for loop without hard coding the values

    I have a below pl/sql block that needs to flag a claim based on claim number values given that I have in an excel sheet. Is there a way to capture those 500 claims efficiently in the select statement in the pl/sql without hardcoding these from value 1 ...to value 500 (as listed below)???
    DECLARE
       ln_ctr   NUMBER := 0;
    BEGIN
       FOR lrecclaimnumber
       IN ( SELECT   entityid claimnumber
             FROM   mpi_fnx.wfTokenEntity wte
            WHERE   wte.entityid IN
                          ('Value1','Value2',....'Value 500')
    LOOP
       mpi_fnx.pkgSaveClaimData.spMarkClaimInvalid (pivClaimNumber          => lrecclaimnumber.claimnumber,
                                                    pininvalidreasonid      => 304,
                                                    pinuserid               => 4999
       ln_ctr := ln_ctr + 1;
       END LOOP;
       DBMS_OUTPUT.put_line ('Total Entries Processed: ' || ln_ctr);
    END;
    /

    DECLARE
       ln_ctr   NUMBER := 0;
    BEGIN
       FOR lrecclaimnumber
       IN ( SELECT   entityid claimnumber
             FROM   mpi_fnx.wfTokenEntity wte
            WHERE   wte.entityid IN
                          (select 'Value '|| level as col_name from dual  connect by level <=500)
    LOOP
       mpi_fnx.pkgSaveClaimData.spMarkClaimInvalid (pivClaimNumber          => lrecclaimnumber.claimnumber,
                                                    pininvalidreasonid      => 304,
                                                    pinuserid               => 4999
       ln_ctr := ln_ctr + 1;
       END LOOP;
       DBMS_OUTPUT.put_line ('Total Entries Processed: ' || ln_ctr);
    END;
    / bye
    TPD

  • How do I manage dynamic narrowing casts without instanceof?

    Hi all,
    I need to extract arbitrary Objects from a given Collection and cast them to their original types. The problem is: checking with instanceof won't work for me, because the number of possible types is practically unlimited. Can anybody help?
    Thanks in advance,
    Wolfgang

    I don't think you have to do the cast in the set method. The following code works for me:
    [Main is a simple class with attributes <String a>, <int b> and <Main c>, and has getters for them]
    Note that the code is not nice, it's just a quick-n-dirty test case I wrote in a few minutes.
    Note also that I use Objects in the set method, rather then a String, an Integer and a Main.
          Class mainClass = Class.forName("dynamicinstantiation.Main");
          Constructor ctr = mainClass.getConstructor(new Class[0]);
          // object of class main, not known to the client
          Object main = ctr.newInstance(new Object[0]);
          // fieldvalues to set
          Object a = "String";
          Object b = new Integer(100);
          Object c = new Main();
          // get fields
          Field fldA = main.getClass().getDeclaredField("a");
          Field fldB = main.getClass().getDeclaredField("b");
          Field fldC = main.getClass().getDeclaredField("c");
          fldA.set(main, a);
          fldB.set(main, b);
          fldC.set(main, c);
          // Cast main to Main class, so we;re able to access it's methods
          Main m = (Main)main;
          System.out.println(m.getA());
          System.out.println(m.getB());
          System.out.println(m.getC().getA());
          System.out.println(m.getC().getB());

  • How to use REFNUM to communicate between Tab Control Indicator panel and subVI without explicit connections?

    Hi! One of my test programs needs to show many readings on the fron panel. I used a 4 page Tab Control to separate
    different catagory readings and put them in the clusters. If I connect these indicator clusters to the subVI by refnum explicitly, the program runs too slow. So I am trying to make the subVI communicate with the front panel without explicite refnum connection. So far, the subVI can communicate with the clusters on the front panel but not on the Tab Controls. Is anyone can give me some ideas how to communicate/pass the data to the clustes on the
    Tab Control? Thanks,

    Hi Qian,
    If I understand the question correctly; you want to know if there is some other way to access the controls on the tab control without actually using a refnum from the VI that has the controls.
    To answer this question I would say that LabVIEW is a very powerful programming language and one of the very cool features is that it gives you access to all the controls on a VI into another VI without actually passing any data between them.
    The best way to do this would be using VI Server. The functions that you need to call would be Open VI reference to open a reference to your VI having all the controls. Then use a combination of Invoke nodes and Property node get access to the controls on the front panel of your VI.
    Do let me know if you have further questions.
    Ankita A.

  • Is it possible to script with Photoshop without explicit BridgeTalk use?

    Not sure if I'm just "doing it wrong", but let me try to explain.
    I know the usual "BridgeTalk.send()" process for sending messages to another application. What I'd like to do is join the scripts that I use for the different applications and have the process initiated from one, without having to use "eval()"'d scripts.
    When my #target is "illustrator" the app object refers to the Illustrator object. The "photoshop" object within Illustrator is not the same as the "Application" object that would be available if the #target was something else. Is it possible to do this?
    Simply put, with Photoshop and Illustrator open, I want to use a script ran from Illustrator to affect Photoshop without using the "eval()" method (and BridgeTalk.send() -- which is still just an "eval()"'d body.)
    Thanks!
    Edit: Not sure if it's hindsight or just a moment of clarity. I see there's a Application.doAction() method, is there one for running a specific script? That might be a better way to accomplish what I want to do.

    Well part of my workflow has me creating the drawing in Illustrator then exporting it to Photoshop to do all the raster things. These are architectural drawings (before they get to Illustrator they are born as CAD drawings.) I'm generating "pretty" display drawings. There is a lot of them so a lot of the "actions" on the files are repetitive and consistent. I've already got scripts for both the Illustrator and Photoshop side (that include exporting now). I'd like to invoke the Photoshop script from the Illustrator one, rather than having to manually run it from Photoshop.
    The reason that the BridgeTalk "eval()" solution isn't ideal, is that these are fairly "large" scripts. Preparing them to be escaped so they could be "eval()"'d is just a bit of a nuissance to me. Not the end of the world mind you, just a nuissance.

  • Embedding images without explicit style definitions

    I'm designing an app with a big row of buttons.  They are all identical except for the label and icon.  Ideally I would like to be able to define them via ActionScript using a for loop.  I'm stuck on how to embed the icon images though without doing a separate style entry for each button.
    example code:
    var labels:Array = ["hello", "interior", "exterior", "photos", "videos", "accessories", "games"];
                for each (var s:String in labels) {
                    var b:Button = new Button();
                    b.label = s;
                    buttonBox.addChild(b);
    For each button I've got graphics called name.png and name-b.png.  So how would I set the skin and over-skin properties of each button programmatically, as if I had made a separate style for each button ala:
    .hello {
       skin: Embed(source="assets/hello.png");
       over-skin: Embed(source="assets/hello-b.png");

    [Embed(source="assets/hello.png")]
    public var buttonskin:Class;
        b.setStyle("skin", buttonskin);

  • Without hard coding it how can I add a java app to my path variable

    I'm not sure how to phrase this but I wrote a quick utility program and I wrote a quick batch file to call the program. I put the batch file in a folder in the path variable and put the folder containing the classes in there as well. I was hoping that when I called the batch it would check the relative location and see the folder for the utility program and run it. However I got an error message acting like it couldn't find the class. I think it's checking the current directory I'm in, not the current directory of the batch file that's actually calling it. I don't want to hardcode the path into the batch file since it's mobile and could be run from different folders so I was wondering how can I fix this?

    I am assuming you got a ClassNotFoundException?
    echo the command your batch file is running to this forum and then I'll be able to help you

  • Year to date report - how do I get dates without hard coding a year?

    I am writing a monthly report that will run for example on Sept1 but want to extract data for Jan 1, 2012 thru Aug 31, 2012. But also need to consider when I run report on Jan 1, 2013 for all of 2012. I know I could use the add_months(sysdate,-1) to get previous month but then will still have issues running on Jan 2013 for the year.
    SELECT data
    FROM tables
    WHERE data_date between start-date (which would be Jan 1, 2012 but also when I run on Jan 1 2013 for previous year)
    and last_day(add_months(sysdate, -1)
    Thanks in advance
    Jackie

    Hi,
    This would do it :SQL> !cat q.sql
    with t (dt, val) as (
         select to_date('2011/01/04','yyyy/mm/dd'), 123 from dual union all
         select to_date('2011/04/09','yyyy/mm/dd'), 234 from dual union all
         select to_date('2011/06/28','yyyy/mm/dd'), 345 from dual union all
         select to_date('2011/10/18','yyyy/mm/dd'), 456 from dual union all
         select to_date('2011/12/23','yyyy/mm/dd'), 567 from dual union all
         select to_date('2012/01/07','yyyy/mm/dd'), 678 from dual union all
         select to_date('2012/05/13','yyyy/mm/dd'), 789 from dual union all
         select to_date('2012/07/19','yyyy/mm/dd'), 890 from dual union all
         select to_date('2012/08/30','yyyy/mm/dd'), 901 from dual union all
         select to_date('2012/09/22','yyyy/mm/dd'), 012 from dual
    ------ end of sample data ------
    select *
    from t
    where dt >= trunc( add_months(trunc( &&dateexec. ,'month'),-1) ,'year')
    and dt < trunc( &&dateexec. ,'month')
    undefine dateexecThe dateexec parameter is just here to "simulate" sysdate of different points in year.
    <i>(your actual query would have sysdate where the dateexec parameter appears)</i>
    SQL> @q
    Enter value for dateexec: sysdate
    DT                         VAL
    07/01/2012 00:00:00        678
    13/05/2012 00:00:00        789
    19/07/2012 00:00:00        890 sysdate does the current year up to previous month.
    SQL> @q
    Enter value for dateexec: to_date('20120122','yyyymmdd')
    DT                         VAL
    04/01/2011 00:00:00        123
    09/04/2011 00:00:00        234
    28/06/2011 00:00:00        345
    18/10/2011 00:00:00        456
    23/12/2011 00:00:00        567when ran in january, it retrieves all the previous year.

  • Scatter-Gather EIP without hard coding Provider Systems

    Hi,
    I am trying to work out the best way to create a service that follows the scatter gather pattern.
    http://camel.apache.org/scatter-gather.html
    The problem is I do not want to hard code the provider services into BPEL. (There may be a lot of them.)
    Instead I want them to subscribe to a JMS topic and send the required responsere to a JMS queue. If the requestor service waits a predetermined time before picking up all the responses from the queue it would work. Unfortunatly the JMS adapter dosen't support picking up messages form the JMS queue on demand.
    I have considered replacing the JMS queue with a database table and in theory this would work - but seems complex.
    I have also considered simply using a correlated reply service. The requestor service would only be able to process one response at the time but the Providors could be configured to retry mutiple times. This won't scale well if there are 10 or more providor systems.
    Is there a simple way to achieve what I am trying to do that I am missing?
    Robert

    Hi,
    I think this is a good idea.
    I can see a number of possible ways of writing the code:
    1. As a Java Application with a service interface and call it as a service from a BPEL
    2. As a Java activity embedded into the BPEL
    3. As a Java function delpoyed in a jar and referenced by the app in a simular way to aia.jar - this would be called via a Java activity.
    Which of these methods would you recomend using to do this?
    Robert

  • Writing to globals without explicit wiring

    Hi,
    Apologies if the topic title is vague, I didn't know how to phrase myself.
    In a current software project I'm working on, I have a VI that loads
    configuration data from a config file and writes them into several
    globals.
    The surefire way is to manually make the connections to the "Read Key"
    VI, explicitly stating the section and key, then manually wiring the
    output to the relevant global.
    However, as I have nearly 100 config data, this would seem excessively tedious.
    I'm stumped on this one. Anyone have any ideas?
    Thanks in advance.
    cheers

    The easiest way to do what you want is to open a reference to the globals VI and then get\set all the control values:
    But this is a hack and I would advise against that unless your data is really static. The better way would be to move away from globals, as they are usually a recipe for race conditions and bugs. There are other alternatives. Using an action engine with the OpenG variant config VIs might help you.
    Try to take over the world!
    Attachments:
    Example_VI_BD4.png ‏2 KB

  • Dynamic casting in java

    Hello everyone....
    i am having a problem as follows:
    i have a method in my project which is taking a reference of object type...
    i want to cast the object to the passing type,bt i dont want to cast explictily inside the method...
    can something be done by which the object itself get casted to passing type automatically by determining the runtime of the instance being passesd at runtime?
    public void change(Object o)
    /// i want to cast this object to A type without explicit casting.... can it be done through reflection or some other method?
    call of the above method from main///
    p.s.v.main(String[] args)
    A a =new A();
    a.call(new A());
    }

    807784 wrote:
    can something be done by which the object itself get casted to passing type automatically by determining the runtime of the instance being passesd at runtime?When you cast an Object to a specific class or interface you are telling the compiler that the object is really of that class or interface. The only thing a cast does at run time is to verify that the actual object is of the specified class. Hence, for a cast to do any good, it must be present at compile time.
    I don't know exactly what you are trying to do, but you might want to look at the visitor pattern.

Maybe you are looking for

  • Which is better bluetooth 4.0 wireless technology and edr wireless technology ? which is better between the two ?

    i saw in the tech specs that macbook air has "bluetooth 4.0 wireless technology" while macbook pro has "bluetooth 2.1 + edr wireless technology". what's the difference ? and which one is better ?

  • ITS Theme Generator tool

    Hi Everyone, I am trying to apply my custom portal theme to an IAC (CLPBID). I have been trying to use the ITS theme generator without success. I am following the link http://help.sap.com/erp2005_ehp_04/helpdata/EN/af/807f72a20d11d5b580006094b9451c/f

  • Group addresses

    I am trying to migrate to Mail from Claris Emailer and one of the main reasons I use CE still is its easy group address feature. I am wondering how to get a group of 63 work-related addresses that I use rarely, (I have several such groups n my CE Add

  • Srollpane scrolls when loaded data from XML, not when loaded data from ASP

    Hi, I load into scrollpane a swf, which has a dynamicly loaded data. If I use the XML file, it works (the scrollbar is visible), but if I use a asp file, which creates xml, it doesn't work (the scrollbar is not visible). Any ideas?

  • DIAPI posting Delivery Document with Serial Numbers

    Hi, I am using SAP 2005A, SP01, Patch 8. I am not able to create a delivery document based on Sales Order with serial number items. Code is given below. The error i get is Error No: -10, Message: [DLN1.WhsCode][line: 0] , 'The selected quantity of ba