Separation of tiers

Hi...,
In one of our application, we are thinking to separate the Web Layer(Jsp/JSF) & deploy it on the Web Server , EJB's on the App Server. My question is ,
-what benefits does it provide having such separation?
-When should we decide to separate the web tier from the application server?
- Which web server is stable enough to handle up to 10 thousand hits a day?
Regards,
P

But what are the benefits of separating the 2 in terms of :
- Having static pages on web server & EJB's on App server does make any difference to performance?
- Security?
- Industry Standard?These are architectural design decisions and should be based upon the business/domain requirements of the application. If the architectural design is crappy, then the performance will be crappy. If the design is good, then the performance will be good. The benefits would be discoverd/identified/revealed in the architectural design. And you can't get an architectural design without the application's business/domain requirements.
Some factors to consider are: the content of the web pages, the type of EJB used and the technical design of how the EJB communicate with the web application.
Whether there are benefits to having the web server on a different machine than the application server or not, depends upon how the application is designed, a multitude of possible constraints, and the application's quality-of-service requirements. What are the security requirements? What are the perfomance requirements? What are the maintainability requirements? Scalability requirements? What application server are we talking about? JBoss is nice, Weblogic is better, Websphere is worst, etc.

Similar Messages

  • Tiered DMZ Design Question

    I am working on taking our ASA5510 into the 21st century and putting a two tiered DMZ into place.  I just wanted some advice on how a tiered DMZ is typically configured and used. To start off we 100% virtualized so this will all be done with sub-interfaces and 802.1q trunks on our inside physical interface.
    I have laid it out like this........OUTSIDE <--> DMZ_EXTERNAL <--> DMZ_INTERNAL <--> INSIDE  (See attached for further clarification)
    I would like to know if servers are generally single homed or multi-homed in this architecture.  If they are multi-homed then I understand that I would probably NAT to the DMZ_External and create a static route on the server to get from DMZ_Internal back to the Inside network.  For example, Microsoft Lync Edge server needs two NIC's.  One connected to the external DMZ and one to the internal DMZ (could also go directly on the inside network as well).
    I get a bit confused if I am not attaching two nics to a server to bridge these networks. 
    Should my inside network be able to "route" to both networks?  Meaning treat both DMZ's equally and allow public NAT to both as well as internal routing.
    Should Inside only route to the DMZ_Internal and go out to the internet to hit the NATed DMZ_External server interfaces? 
    Should I be using NAT from Outside to DMZ_Internal or not even allow that scenario and only NAT Outside to DMZ_External
    Any assistance would be much appreciated.  I have uploaded a picture for clarification.  Thank you.

    Marc,
    Off late, I have seen a lot of implementations using VLAN for separating the zones and using the same switch. As far as you have tight control to the the device, strict change control process, auditing, Best Practices, up to date software updates on Security Advisories, etc, you should be fine using VLANs. Also, one important factor that is going to drive your decision is the companies "Security Policy".
    With that said, below are some white papers that you might find useful.
    VLAN Security White Paper
    http://www.cisco.com/en/US/products/hw/switches/ps708/products_white_paper09186a008013159f.shtml#wp39832
    Data Center Architecture Overview
    http://www.cisco.com/en/US/docs/solutions/Enterprise/Data_Center/DC_Infra2_5/DCInfra_1.html
    Also, check out the the Data Center Sectiion of "Cisco Validated Design" for some good information.
    http://www.cisco.com/en/US/netsol/ns742/networking_solutions_program_category_home.html
    Regards,
    Arul
    *Pls rate if it helps*

  • N-tiered programming in Java

    I'm new to Java/JSP and am looking for tutorials and examples of how to do web n-tiered programming in Java. In .NET, I've often separated the web presentation layer from the business logic and data access layers. How do you accomplish this in Java? Thank you.

    What do you mean "accomplish"? You write java classes. N-tiered architecture is not limited to specific programming languages. It is a paradigm.
    Additionally, check this out: http://java.sun.com/blueprints/corej2eepatterns/Patterns/

  • Is there a way to adjust the settings on launchpad so that when I swipe into it all the open apps/pages are fully separated (like in exposé) so that I can fully view all of them simultaneously?

    Hi Apple community,
    This is my first go at this so be kind,
    My question concerns launchpad. Coming from Snow Leopard I had been using spaces. I like to keep certain bundles of programs on separate desktops, for example all word processing related tasks in one place. I have set up the equivalent on Yosemite.
    My problem is concerns the loss of exposé. Now I know when you swipe into launch pad you get a very similar effect but the issue I am having concerns the "zoom out" effect when you swipe into launchpad. With exposé all open apps/pages etc would be fully exposed - in my case several (sometimes as many as 9 word documents). What I am running into is when I do this in / into launch pad the "pile" of docs is exposed but they are still overlapping so I can't get a good look at which is which and visually identify where I want to navigate to.
    My question is this; Is there a way to adjust the settings on launchpad so that when I swipe into it all the open apps/pages are fully separated (like in exposé) so that I can fully view all of them simultaneously? If so, instructions on how to do so would be greatly appreciated. Any alternative suggestions to doing this outside of launchpad are also welcome. If there is an exposé app for example, I would be quite willing to go that route.
    My main concern is being able to quickly (ie a touchpad gesture) expand all the open pages so I can bounce between them.
    Much thanks from a loyal Apple friend.

    Hey Eric,
    Thanks for taking the time. Unfortunately no that does not solve it. Same as swipe it will get me there and it will show separate programs spaced out. The issue I am having is that all my open word files are bunched up in a pile on top of each other. I can see the edges of each one but I want them to be separated from each other enough that I can visually identify what file is what.
    Again, thanks for trying, it is appreciated.

  • ICal "all day events" separator bar

    Is it possible to adjust the "all day events" separator bar in iCal in the Daily or Weekly view.  When you have more than 6 all day events on one day a scroll bar appears, and it's not possible to view all of the all day events at once.  I know that this sounds like nit-picking, but I've developed a work-flow where I would like to look at all of the informaiton at once without extra clicks or scrolls, or to glance at the information without having to bring the application to the surface, or make it the active application.
    Does anyone know if there is a way to adjust the separator bar to allow the user to see more then 6 all day events in the weekly or daily iCal views
    Another ideal solution would be additions to the View or the Preference options that would allow the user to view all of the "all day events" and have the separator bar automatically adjust.
    thanks,

    I agree with you...  this used to be a flexible field and would handle infinate "all day" events.    To answer your question...  no, you cannot adjust this field.  I too use this for business and really need to view all the "all day" events.  I've been forced to use the daily view and put a date notation in the "location" field to know when the event ends.  It's the only way to see everything.
    I found a nice little calendar program SaiSuke but Apple doesn't play well with others.  You can enter into the iCal or iCloud calendar program and it will seemlessly appear through iCloud into the SaiSuke calendar.  But Apple will not release the information allowing SaiSuke to talk back to iCloud. 
    Basically what I'm saying is it's a one way conversation between SaiSuke & iCloud, it can bring data in but not return data back.  So if you enter a new event in SaiSuke it will not be anywhere other than the iPhone or iPad you entered it on, it cannot make it back to iCloud without plugging your phone in and doing a manual Sync.  Of course this process will produce duplicate events. 
    So unless someone out there has more knowledge ...  and you want to have your events be the same on multiple platforms (phone, pad & desktop) we are stuck with using their iCal product.  Apple calls this progress.

  • How to get some character as a field separator while in GUI_DOWNLOAD ?

    Hi Friends,
    I have to download data from an internal table to a text file. The field separator
    between the fields should be comms (,). So, after getting the data into internal table i'm calling the Function Module GUI_DOWNLOAD. Now using this function module can i insert a comma spearator between the fields, if not what is the other way to do it?

    Hi,
    Its not possible to give the field separator as ',' directly with gui_download from you internal table.
    Below is the example through which you can achieve the following,
    this is a tested program and is working fine on the system....
    so you can use the logic to achieve the following result.... hope this logic helps you to achieve your functionality....
    DATA:
    BEGIN OF fs,
       col1(6) TYPE c,
       col2(4) TYPE c,
       col3 TYPE c,
       END OF fs.
    DATA :
    BEGIN OF line,
    line(255) TYPE c,
    END OF line.
    DATA: itab LIKE TABLE OF fs,
          itab2 LIKE TABLE OF line.
    DEFINE m_tab.
      clear fs.
      fs-col1 = &1.
      fs-col2 = &2.
      fs-col3 = &3.
      append fs to itab.
    END-OF-DEFINITION.
    m_tab '006000' '0010' 'J'.
    m_tab '006000' '0010' 'J'.
    m_tab '006000' '0010' 'M'.
    m_tab '006000' '0010' 'M'.
    m_tab '006000' '0010' 'O'.
    m_tab '006000' '0010' 'O'.
    m_tab '006000' '0010' 'T'.
    m_tab '006000' '0010' 'T'.
    LOOP AT itab INTO fs.
      CONCATENATE fs-col1
                  fs-col2
                  fs-col3
             INTO line
    SEPARATED BY ','.
      APPEND line TO itab2.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                    =
        filename                        = 'C:\filename.txt'
    *   FILETYPE                        = 'ASC'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    *   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *   SHOW_TRANSFER_STATUS            = ABAP_TRUE
    * IMPORTING
    *   FILELENGTH                      =
      TABLES
        data_tab                        = itab2
    *   FIELDNAMES                      =
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22
    IF sy-subrc <> 0.
      WRITE sy-subrc.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Siddarth

  • Field separator in gui_download

    Hi,
    How to get '|' (pipeline)  separator in FM gui_download?
    We tried passing '|' in the parameter write_separator.
    Still the downloaded file doesn't have this separator.
    Thanks for your time.

    Hi,
    Try this, ihope it may work.
    WRITE_FIELD_SEPARATOR  = ' | '
    regards,
    ravi shankar reddy

  • SPED - Plano de contas referencial da Receita - Separação de Ativo

    Olá,
    - O plano de contas referencial que está no Site da Receita não está contemplando a medida provisoria 449/08, onde se faz necessário a separação de ativo (Circulante e não Cirulante).
    - Lógico que esta separação pode ser feita na estrutura de balanço do ativo circulante  não circulante com as contas que estão no plano de contas referencial,  entretanto teremos risco (meu ponto de vista) porque neste plano (referencial) trata somente como circulante todas as contas do grupo de ativo 1.01.
    - Como também a lei 11.638, onde temos varias mudanças, o plano de contas referencial não está tratando como por exemplo ativos em  Tangíveis e Intangíveis
    - Mas a grande dúvida é a seguinte: para empresas que utilizam o ano base de 2008 para entrega da ECD, onde estes mesmos dados são utilizados no balanço de transição, isto em função do enquandramento na  lei 11.638 que segraga alguns grupos (ex.: tangíveis e intangíveis) entretando o plano de conta referencial não esta com base na medida provisoria 449 e na lei 11.638.
    - Alguem está passando por esta situação ?

    Ola Marlene,
    É possível inativar todas as contas do plano de contas, e posteriormente importar um novo plano de contas. Porém, o novo plano de contas deverá ter codificação diferente do plano de contas anterior. Outro problema, é que quando visualizar o plano de contas, mesmo as contas inativas continuaram aparecendo, deixando uma visualização mais suja. Não esqueça que terá que substituir todas as contas da determinação contábil, dos PNs, dos Itens (quando houver), das contas bancárias, dos depósitos, grupos de itens e dos impostos.
    Quanto a estrutura, é possivel sim trabalhar na gaveta "Receita" com todas as contas de Resultando (receita, custo e despesa). Basta estruturar o template de importação para tal forma.
    Caso precise de alguma ajuda quanto ao template, estou a disposição.
    Att
    Everton Silva

  • Is there an application like "snag it" for mac?  Does it come with the Mountain Lion OS, or do I have to buy it separately?

    Is there an application like "snag it", which is part of the Microsoft Office suite for mac?  Does it come with the Mountain Lion OS, or do I have to buy it separately?  If it is a separate purchse, what would you recommend?

    Built-in to OS X is the ability to capture an entire screen or selected portions. Snaps are saved to the Desktop by default:
    COMMAND-SPACE-3 snaps the entire screen.
    COMMAND-SPACE-4 lets you select a portion of the screen to snap.
    In your Utilities folder is a utility called Grab that provides similar functionality and more.
    Then there are dozens of third-party solutions such as SnapNDrag and SnapzProX. You will find them and others at MacUpdate or CNET Downloads. Most have trial versions or trial times so you can test them out.

  • Decimal Separator in SELECT Clause

    Hi
    I have the following decimal format parameters:
    SQL> select value
    2 from v$nls_parameters
    3 where parameter = 'NLS_NUMERIC_CHARACTERS';
    VALUE
    If I show a number with decimal I get a comma as the decimal separator
    SQL> select 10/100 from dual;
    10/100
    ,1
    But if I use a decimal separator in the SELECT clause I get:
    SQL> select 100 * 1,1 from dual;
    100*1 1
    100 1
    It doesn't work. But using a period as the decimal separator works:
    SQL> select 1.1 * 100 from dual;
    1.1*100
    110
    Maybe this is something I've never had to deal with before but I thought that the numeric format applied to the sql results and also the numbers that you used in the sql clauses.
    Regards,
    Néstor Boscán

    Hi,Néstor,
    user594312 wrote:
    ... I thought that the numeric format applied to the sql results and also the numbers that you used in the sql clauses.No; it applies to results, and it can affect implicit conversions, but it doesn't apply to SQL code.
    The period (or dot, '.') is always the decimal separator in numeric literals. There is no way to change that.
    Think how confusing it would be if it did apply to SQL code! For example:
    WHERE   num_col  IN (1,2)Are we comparing num_col to 1 value or 2 values? Whichever it is, what if we wanted to do the opposite?
    If you really wanted to use comma as the decimal separator, you could have to use strings, not numbers, and that could be a lot less efficient.
    For example:
    SELECT  100 * TO_NUMBER ('1,1')    -- This assumes your NLS settings are correct
    FROM    dual;Of course, efficiency won't be an issue when you're selecting 1 row from dual.

  • Trinidad-config.xml, number-grouping-separator and decimal-separator

    Hi,
    According to my application locale, numbers are formatted as 1.234,56
    Now I want numbers to be formatted the US flavour: 1,234.56
    Here is my trinidad-config.xml file contents:
    <?xml version="1.0" encoding="windows-1252"?>
    <trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
    <skin-family>mySkin</skin-family>
    <number-grouping-separator>,</number-grouping-separator>
    <decimal-separator>.</decimal-separator>
    </trinidad-config>
    The file above is declared in the web.xml file (although I'm not pretty sure this is really necessary):
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/trinidad-config.xml</param-value>
    </context-param>
    And an example of a numerical input text:
    <af:inputText value="#{row.bindings.Salary.inputValue}" label="#{bindings.EmployeesView3.hints.Salary.label}"
    required="#{bindings.EmployeesView3.hints.Salary.mandatory}" columns="#{bindings.EmployeesView3.hints.Salary.displayWidth}"
    maximumLength="#{bindings.EmployeesView3.hints.Salary.precision}" shortDesc="#{bindings.EmployeesView3.hints.Salary.tooltip}"
    id="it5">
    <f:validator binding="#{row.bindings.Salary.validator}"/>
    <af:convertNumber pattern="#{bindings.EmployeesView3.hints.Salary.format}" />
    </af:inputText>
    Where the pattern is set at Entity Object level: Employees EO > Salary attribute > UI Hints > Format: #,##0.00
    But it doesn't work. I don't know what I'm missing... Please, help!
    JDev 11.1.1.3.0

    Hello. With my application locale, numbers are formatted as 1234,56
    But i need 1 234.56 format.
    To achieve this, I use trinidad-config.xml, that contains few options:
    <?xml version="1.0" encoding="windows-1251"?>
    <trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
    <skin-family>mySkin</skin-family>
    <number-grouping-separator> </number-grouping-separator>
    <decimal-separator>.</decimal-separator>
    </trinidad-config>
    On my page i use af:outputText with af:convertNumber as shown below:
    <af:outputText value="1234567,890" id="ot2">
    <af:convertNumber currencySymbol="USD" minFractionDigits="2"
    groupingUsed="true" type="currency"
    maxFractionDigits="2"/>
    </af:outputText>
    Output: *1 234 567,89 USD*
    Why decimal separator hasn't changed?
    Byt the way. With convertNumber type "percent" output will be *1 234 567.89%*

  • 2004s BI Portal (BI-Java) and BI-ABAP: doublestack vs. separated stack

    Hi specialists,
    We plan to migrate our NW2004 System (no Portal in use) to NW7.0.
    For the NW7.0 Portal Architecture we are not sure what to choose:
    - BI-ABAP and BI Portal (BI-Java) on the same instance (doublestack)
    - BI-ABAP and BI Portal (BI-Java) on seperate instances (separated stack architecture)
    Medium term we assume, that the portal is used for Web-Reporting and integrated planning. The development of applications (Java, Visual Composer) will be the exception.
    But if our reporting requirements changes and the number of own applications is increasing?
    Which is the best possibility to be future-proof?
    - Is it possible to separate the doublestack architecture later?
    - Is it possible to "transport" Portal stuff/applications from a doublestack system to a separated stack system?
    - If the number of Portal-applications is increasing, is it an opportunity to set up an additional BI-Portal which is connected to the doublestack BI system?
    Thanks for your help.
    Regards
    Karin.

    Hi
    Too many questions .But its interesting.Ok lets take one by one.
    You can have either of the options depending on the amount of data and your hardware.
    I would suggest if you have the hardware go for seperate machines for each kind of installation.I mean have a BI system((dual Stack) + Portal or you can have portal on a seperate machine also.Then you can have another portal (single stack).And using the FPN(Federated Portal Network) concept you can actually implement ur scenrio.
    Note :BI-Java cannot be installed seperately you need a portal for it.
    Yes FPN can be used to transport the data from one portal to another.To the last questioin i have already answered ,its better to go for a seperate BI system.
    Any other doubts feel free to ask:
    Reward maximum points

  • Multiple Artist, Genre... Separator (Semi-Colon) instead of Smart Playlists

    In my opinion, one of the greatest features of ID3 tags is the ability to use semi-colons to differentiate between multiple artists, genres, albums, etc... for any given field. This feature has been available since ID3 tags for MP3's were first implemented over a decade ago.
    With Windows Media Player 10, it's database was finally able to parse the information separated by semi-colons correctly. What this means is that if I have a song like "Picture" by Sheryl Crow and Kid Rock, in the ID3 tag, I type "Sheryl Crow; Kid Rock", and in WMP, if I click on Artist | Sheryl Crow, "Picture" appears. And if I click on Artist | Kid Rock, "Picture" appears. In fact, when I rip songs using WMP, it places semi-colons in numerous ID3 fields from the album description.
    In iTunes, however, when I import a song with a semi-colon in an ID3 tag field, the database reads the artist as "Sheryl Crow; Kid Rock", or essentially, it treats "Sheryl Crow; Kid Rock" as a THIRD artist. The same is true if I have a song that I feel crosses two genres--like "Picture". In WMP, if I put in the Genre field "Pop; Country", when I choose Genres | Pop, "Picture" appears, and when I choose Genres | Country, "Picture" appears.
    Does anyone know if a bug fix for this is in the works for iTunes? It seems Apple and iTunes have been trying to push Smart Playlists for this kind of organization, but that's the poor man's way of organizing songs and not nearly as efficient. I don't want to have to create Smart Playlist for all songs with "Sheryl Crow" in the artist field. It should be inherent based on the semi-colon.
    Does anyone know if anything smarter than Smart Playlists is in the works that matches the intuitiveness of Windows Media Player's database?
    Thanks,
    Bill

    Whereas in WMP & the ID3 spec. you would use a semi-colon to separate items you will find that iTunes & the Music store use a slash instead. However as you so rightly say iTunes takes the information and construes a new artist entity rather than two artists connected to the same track. (WMP might also respond to slash - I recall AC/DC always presenting issues so they exist as AC-DC in my library.)
    If you'd like to make feature request go to: iTunes Feedback.
    Working on the assumption that such ideas are unlikely to implemented any time soon however you might like to see my post on Grouping Tracks Into Albums which covers workarounds for this & other quirks.
    tt2

  • Collisions (Separating Axis Theorem)

    Hi,
    I'm working on a 2D game, it's top-down like GTA2, but I'm havinfgproblems with the collision detector. I know there are a lot of posts about collision already but they didn't help me much. I'm using the separating axis theorem (explained here: http://www.harveycartel.org/metanet/tutorials/tutorialA.html#section1) and most of the code is inspired by http://www.codeproject.com/cs/media/PolygonCollision.asp .
    Separating axis theorem:
    find all axis perpendicular to all the edges of both objects,
    project both objects on the axis,
    if there is an axis where the projections do not overlap, then the objects do not overlap.
    The problem is that I think my code should work. And guess what, it doesn't. I checked the code 30 times this weekend but maybe there is some tiny mistake I overlook each time..
    When I run the program with 6 objects I get this:
    1 2 3 4 5 6
    1: - 0 0 0 0 0
    2: 0 - 1 0 0 0
    3: 0 1 - 0 0 0
    4: 0 0 0 - 0 0
    5: 0 0 0 0 - 0
    6: 0 0 0 0 0 - (1=intersect, 0=doesn't intersect)
    but this is completely wrong. You can run the program yourself to see the exact locations of the objects.
    1 is the triangle at the top,
    2 and 3 are the triangles who share an edge
    4 is the one on the left intersecting with 3
    5 is the triangle on the right
    6 is the parallelogram
    But it really gets weird when I add a 7th object (the one in the comments):
    1 2 3 4 5 6 7
    1: - 0 0 0 0 0 0
    2: 0 - 0 0 0 0 0
    3: 0 0 - 0 0 0 0
    4: 0 0 0 - 0 0 0
    5: 0 0 0 0 - 0 0
    6: 0 0 0 0 0 - 0
    7: 0 0 0 0 0 0 -
    Now 2 and 3 don't intersect anymore! They didn't change I just added another object.
    I'm adding a short explanationof all the classes and the code itself. I know it's a lot of code but I added all the test classes so you can just run Test.Test
    I hope someone can help me with this.
    Thanks,
    El Bandano
    _<h5>package CollisionDetector:</h5>_
    <h6>CollisionDetector</h6>
    The class that is supposed to check for collisions. It will take 2 Props and return a CollisionResult
    <h6>CollisionResult</h6>
    A small class with 2 public fields. For now only the boolean Intersect matters.
    <h6>Interval</h6>
    Another small class that represents an interval of floats. It's pretty simple. Distance should return something negative if 2 intervals overlap.
    _<h5>package World</h5>_
    <h6>MovableProp</h6>
    An interface of an object. All objects should be convex.
    <h6>Vector2D</h6>
    A 2D-vector. It has an x and a y value (floats) and some simple methods. a 2D vector can represent a point or an edge/axis. For a point the x and y are the coordinates. For an axis you need a normalized vector (x^2+y^2=1) and the x and y are coordinates on a parrallell line through (0,0).
    _<h5>package Test</h5>_
    <h6>Test</h6>
    The main class. It makes some objects, prints a matrix showin which intersect eachother and shows a window with all objects.
    <h6>TestMovProp</h6>
    A basic implementation of MovableProp.
    <h6>TestPanel</h6>
    A panel that draws MovableProp.
    _<h5>package CollisionDetector:</h5>_
    <h6>CollisionDetector</h6>
    package CollsisionDetector;
    import World.MovableProp;
    import World.Vector2D;
    import java.util.ArrayList;
    public class CollisionDetector {
        public CollisionDetector(){
        public CollisionResult DetectCollision(MovableProp propA, MovableProp propB) {
            CollisionResult result = new CollisionResult();
            result.Intersect = true;
            result.WillIntersect = true;
            Vector2D[] edges = UniqueEdges(propA, propB);
            // loop through the edges
            // find an axis perpendicular to the edge
            // project the props on the axis
            // check wether they intersect on that axis
            for (Vector2D edge: edges){
                Vector2D axis = edge.getPerpendicular();
                Interval intA = projectPointsOnAxis(propA.getCoordinates(), axis);
                Interval intB = projectPointsOnAxis(propB.getCoordinates(), axis);
                if (intA.distance(intB) > 0)
                    result.Intersect = false;
            return result;
        public Interval projectPointsOnAxis(Vector2D[] points, Vector2D axis){
            Interval i = new Interval();
            for (Vector2D p: points)
                i.add(projectPointOnAxis(p, axis));
            return i;
        public float projectPointOnAxis(Vector2D point, Vector2D axis){
            // axis <-> y=a*x
            float a  = axis.y / axis.x;
            // line <-> y=(-a/1)*x+b
            float a2 = -axis.x / axis.y;
            // b = y-a2*x
            float b = point.y - a2*point.x;
            // y = a *x
            // y = a2*x + b
            // => a*x = a2*x + b
            float x = b/(a-a2);
            float y = a*x;
            // is there a better way to do this?
            return new Float(Math.sqrt(x*x + y*y)).floatValue();
         * Put all edges in 1 array, eliminate doubles (parallels).
        public Vector2D[] UniqueEdges(MovableProp propA,MovableProp propB){
            Vector2D[] aEdges = propA.getEdges();
            Vector2D[] bEdges = propB.getEdges();
            ArrayList<Vector2D> tmp = new ArrayList<Vector2D>();
            for (Vector2D v: aEdges){
                tmp.add(v);
            for (Vector2D v: bEdges){
               if (! tmp.contains(v))
                    tmp.add(v);
            return tmp.toArray(new Vector2D[tmp.size()]);
    }<h6>CollisionResult</h6>
    package CollsisionDetector;
    import World.Vector2D;
    public class CollisionResult {
        public boolean WillIntersect;
        public boolean Intersect;
        public Vector2D MinimumTranslationVector;
        public CollisionResult() {
    }<h6>Interval</h6>
    package CollsisionDetector;
    public class Interval {
        public float min;
        public float max;
        public Interval() {
            min = Float.MAX_VALUE;
            max = Float.MIN_VALUE;
        public void add(float f){
            // no 'else'! In an empty interval both will be true
            if (f>max)
                max = f;
            if (f<min)
                min = f;
        public float distance(Interval interval){
            if (this.min < interval.min) {
                return interval.min - this.min;
            } else {
                return this.min - interval.min;
    }_<h5>package World</h5>_
    <h6>MovableProp</h6>
    package World;
    public interface MovableProp {
        public int getNPoints();
        public Vector2D[] getEdges();
        public Vector2D[] getCoordinates();
    }<h6>Vector2D</h6>
    package World;
    public class Vector2D {
        public float x;
        public float y;
        public Vector2D(float x, float y) {
            this.x = x;
            this.y = y;
        public boolean equals(Object obj){
            if (!(obj instanceof Vector2D)){
                return false;
            }else
                return (this.x == ((Vector2D)obj).x && this.y == ((Vector2D)obj).y);
        public String toString() {
            return ("Vector2D  x=" + x + " ,  y=" + y);
        public void normalize(){
            if (x*x + y*y != 1){
                float x2 = x;
                x /= Math.sqrt(x2*x2+y*y);
                y /= Math.sqrt(x2*x2+y*y);
        public Vector2D getPerpendicular(){
            Vector2D per = new Vector2D(-y,x);
            per.normalize();
            return per;
    }_<h5>package Test</h5>_
    <h6>Test</h6>
    package Test;
    import CollsisionDetector.CollisionDetector;
    import World.MovableProp;
    import java.awt.Polygon;
    import java.util.ArrayList;
    import java.util.Vector;
    import javax.swing.JFrame;
    public class Test {
        public static void main(String args[]) {
            CollisionDetector detect = new CollisionDetector();
            float[] x = new float[3];
            float[] y = new float[3];
            ArrayList<MovableProp> list = new ArrayList<MovableProp>();
            x[0] = 200; x[1] = 300; x[2] = 500;
            y[0] = 400; y[1] = 200; y[2] = 300;
            list.add(new TestMovProp(x,y));
            x[0] = 300; x[1] = 500; x[2] = 600;
            y[0] = 400; y[1] = 400; y[2] = 500;
            list.add(new TestMovProp(x,y));
            x[0] = 200; x[1] = 300; x[2] = 600;
            y[0] = 600; y[1] = 400; y[2] = 500;
            list.add(new TestMovProp(x,y));
            x[0] = 100; x[1] = 200; x[2] = 300;
            y[0] = 800; y[1] = 500; y[2] = 700;
            list.add(new TestMovProp(x,y));
            x[0] = 600; x[1] = 600; x[2] = 700;
            y[0] = 400; y[1] = 700; y[2] = 500;
            list.add(new TestMovProp(x,y));
    //        x[0] = 100; x[1] = 001; x[2] = 900;
    //        y[0] = 001; y[1] = 900; y[2] = 500;
    //        list.add(new TestMovProp(x,y));
            x = new float[4];
            y = new float[4];
            x[0] = 450; x[1] = 550; x[2] = 500; x[3] = 400;
            y[0] = 200; y[1] = 250; y[2] = 650; y[3] = 600;
            list.add(new TestMovProp(x,y));
            int n = list.size();
            boolean[][] matrix = new boolean[n][n];
            for (int i=0; i<n; i++){
                for (int j=0; j<n; j++){
                    if (i!=j)
                    matrix[i][j] = detect.DetectCollision(list.get(i),list.get(j)).Intersect;
            System.out.print("  ");
            for (int i=0; i<n; i++){
                System.out.print("  " + (i+1));
            for (int i=0; i<n; i++){
                System.out.print("\n" + (i+1) + ":  ");
                for (int j=0; j<n; j++){
                    if (i==j)
                        System.out.print("-  ");
                    else if (matrix[i][j])
                        System.out.print("1  ");
                    else
                        System.out.print("0  ");
            System.out.println();
            JFrame window = new JFrame();
            window.setDefaultCloseOperation(window.EXIT_ON_CLOSE);
            window.pack();
            window.setVisible(true);
            window.setContentPane( new TestPanel(list));
            window.pack();
    }<h6>TestMovProp</h6>
    package Test;
    import World.MovableProp;
    import World.Vector2D;
    public class TestMovProp implements MovableProp{
        float[] X;
        float[] Y;
        Vector2D[] coor;
        public TestMovProp(float[] x, float[] y) {
            X=x; Y=y;
            coor = new Vector2D[getNPoints()];
            for(int i=0; i< getNPoints(); i++){
                coor[i] = new Vector2D(X, Y[i]);
    public Vector2D[] getCoordinates(){
    return coor;
    public int getNPoints() {
    return X.length;
    public Vector2D[] getEdges() {
    int n = getNPoints();
    Vector2D[] v = new Vector2D[n];
    for (int i=0; i<n-1; i++){
    v[i] = new Vector2D(X[i]-X[i+1], Y[i]-Y[i+1]);
    v[i].normalize();
    v[n-1] = new Vector2D(X[0]-X[n-1], Y[0]-Y[n-1]);
    v[n-1].normalize();
    return v;
    public String toString() {
    String s = "\n";
    for (Vector2D v: getCoordinates())
    s += ("\n" + v);
    return s;
    <h6>TestPanel</h6>package Test;
    import World.MovableProp;
    import World.Vector2D;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Polygon;
    import java.util.ArrayList;
    import javax.swing.JPanel;
    public class TestPanel extends JPanel {
    public ArrayList<MovableProp> list;
    public TestPanel(ArrayList<MovableProp> list) {
    super();
    this.list = list;
    setPreferredSize(new Dimension(1000,850));
    public void paint(Graphics g) {
    super.paint(g);
    for (MovableProp prop:list){
    Vector2D[] coor = prop.getCoordinates();
    int n = prop.getNPoints();
    g.drawLine((int)coor[0].x, (int)coor[0].y, (int)coor[n-1].x, (int)coor[n-1].y);
    for (int i=0; i<n-1; i++){
    g.drawLine((int)coor[i].x, (int)coor[i].y, (int)coor[i+1].x, (int)coor[i+1].y);

    .java wrote:
    I have been search for what seems like hours, Nice try, but in less than 15 seconds I found a complete discussion on the subject.
    and I still have not managed to find anybody or anything that can clearly answer these three questions:
    1. What is SAT?
    2. How does it apply to 2D collision detection? (How would it be different with 3D collision detection?)
    3. How can this be implemented in Java using Shape objects?
    Note: I am easily confused by geometric terminology.This really looks like a question you should have an answer for in your notes from class, or in your book. If not perhaps you need to go ask your teacher what it is and explain why you don't have it in your notes or book.

  • Need to Convert Comma separated data in a column into individual rows from

    Hi,
    I need to Convert Comma separated data in a column into individual rows from a table.
    Eg: JOB1 SMITH,ALLEN,WARD,JONES
    OUTPUT required ;-
    JOB1 SMITH
    JOB1 ALLEN
    JOB1 WARD
    JOB1 JONES
    Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
    But I need to use a database independent solution
    Thanks in advance for your valuable inputs.
    George

    Go for ETL solution. There are couple of ways to implement.
    If helps mark

Maybe you are looking for

  • What's wrong with Safari, my Safari?

    I couldn't log into my bank this morning. Instead of one slot for Username and another for Password, there was only one slot for Username/Password. This seemed strange, and it didn't work, so I called the bank. Fortunately, as I started to explain th

  • Transaction variant for Payment terms in VA01

    Hello experts I already found lot of forms regarding, by using transaction variant how to control the Payment terms while creating Sales order as well as in tras code VA02(Change sales order). I have created T.Var and screen variant and done all othe

  • SAP ECC 6.0 on AS/400: Is it possible to link with a Windows AS (AppSrvr)?

    Helo BC Guru's, I'm came to the same conclusion as Re: DBCON to SQL server - What is required. I'm wondering now whether it is possible to connect a Windows Application Server to a AS/400 DB4 SAP instalation or is that a bit to exotic? I'm intersted

  • Cancel PO after Posted Invoice.

    Hi all I have PO already receipt and Post Invoice on system. Now I want cancel this PO, could you please tell me step by step Cancel this PO. If I already pay this PO, can I cancel PO ? Thank and Best regards, Thang

  • Single-word location bar searches are slow

    I constantly use my location bar to perform google searches, and have noticed that when my search is only for one word, the search results are not displayed for about ten seconds. This does not happen if more than one word is entered. For example, se