Separated by ~

i have input string like this
i have four fields separated by ~
required output is separate those value by ~
ex:
1234~56~897~12
means:
1234
56
897
12
ex:
~~123~34
null
null
123
34

OraclePLSQL wrote:
solutions ???
or links ??
select substr( '12~34~56~78'||'~', 1, instr('12~34~56~78','~')-1 ) first_val,
substr( '12~34~56~78'||'~~', instr( '12~34~56~78'||'~~', '~') +1,
instr( '12~34~56~78'||'~~', '~', 1, 2 )-instr('12~34~56~78'||'~~','~')-1 ) second_val
from dual
FIRST_VAL SECOND_VAL
12        34        
1 rows selected
required output:
12   34   56   78
Your required output has changed significantly from your first post to now. In your first post you showed the output in rows, now you are using a technique that suggests you want columns.
For columns you can use this
WITH x as
(   select '12~34~56~78' a from dual UNION ALL
    select '~34~56~78' a from dual UNION ALL
    select '12~~56~78' a from dual UNION ALL
    select '12~34~~78' a from dual UNION ALL
    select '12~34~56~' a from dual UNION ALL
    select '~~~' a from dual UNION ALL
    select '~~~100' a from dual
SELECT
    a||'~',
    substr(a||'~',1,INSTR(a||'~','~',1,1)-1) cola,
    substr(a||'~',INSTR(a||'~','~',1,1)+1,INSTR(a||'~','~',1,2)-INSTR(a||'~','~',1,1)-1) colb,
    substr(a||'~',INSTR(a||'~','~',1,2)+1,INSTR(a||'~','~',1,3)-INSTR(a||'~','~',1,2)-1) colc,
    substr(a||'~',INSTR(a||'~','~',1,3)+1,INSTR(a,'~',1,4)-INSTR(a,'~',1,3)-1) cold
FROM
    xOr even better, the one from Kim Berg Hansen - quite a bit neater!
Edited by: Bravid on Sep 7, 2011 12:58 PM

Similar Messages

  • 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

  • Need to convert values into coma separated

    Need to convert values into coma separated
    I have a string value that stores data like 'NYK,IND,SGP,GER'
    FOR EXAMPLE
    V_CITY_CODE = 'NYK,IND,SGP,GER'
    When I query
    select * from city where city_code = V_CITY_CODE;I get no rows, this is because V_CITY_CODE has all city code as single code.
    I need a function to search , and replace with ','.
    I tried using instr and replace but was unable to convert it.
    could some one pls assist me.
    thanks in advance
    Saz

    Looking for this?
    SQL> select * from emp
      2  /
         EMPNO     DEPTNO ENAME                                 SAL DOJ       JOB
             1          1 Karthick                               80 03-DEC-11
             2          1 Karthick_1                             90 23-NOV-11
             3          2 Ram                                    80 03-DEC-11
             4          2 Ram_1                                  90 23-NOV-11
    SQL> var v_ename varchar2(1000)
    SQL> exec :v_ename := 'Karthick,Karthick_1'
    PL/SQL procedure successfully completed.
    SQL> select *
      2    from emp
      3   where ename in (
      4                     select regexp_substr(val, '[^,]+', 1, level)
      5                        from (select :v_ename val from dual)
      6                    connect by level <= length(val) - length(replace(val, ','))+1
      7                  ) 
      8  /
         EMPNO     DEPTNO ENAME                                 SAL DOJ       JOB
             1          1 Karthick                               80 03-DEC-11
             2          1 Karthick_1                             90 23-NOV-11

  • MODEL clause to process a comma separated string

    Hi,
    I'm trying to parse a comma separated string using SQL so that it will return the parsed values as rows;
    eg. 'ABC,DEF GHI,JKL' would return 3 rows;
    'ABC'
    'DEF GHI'
    'JKL'
    I'm thinking that I could possibily use the MODEL clause combined with REGULAR expressions to solve this as I've already got a bit of SQL which does the opposite ie. turning the rows into 1 comma separated string;
    select id, substr( concat_string, 2 ) as string
    from (select 1 id, 'ABC' string from dual union all select 1, 'DEF GHI' from dual union all select 1, 'JKL' from dual)
    model
    return updated rows
    partition by ( id )
    dimension by ( row_number() over (partition by id order by string) as position )
    measures ( cast(string as varchar2(4000) ) as concat_string )
    rules
    upsert
    iterate( 1000 )
    until ( presentv(concat_string[iteration_number+2],1,0) = 0 )
    ( concat_string[0] = concat_string[0] || ',' || concat_string[iteration_number+1] )
    order by id;
    Can anyone give me some pointers how to parse the comma separated string using regexp and create as many rows as needed using the MODEL clause?

    Yes, you could do it without using ITERATE, but FOR ... INCREMENT is pretty much same loop. Couple of improvements:
    a) there is no need for CHAINE measure
    b) there is no need for CASE in RULES clause
    c) NVL can be applies on measures level
    with t as (select 1 id, 'ABC,DEF GHI,JKL,DEF GHI,JKL,DEF GHI,JKL,DEF,GHI,JKL' string from dual
       union all
        select 2,'MNO' string from dual
        union all
       select 3,null string from dual
    SELECT  id,
             string
      FROM   T
       MODEL
        RETURN UPDATED ROWS
        partition by (id)
        DIMENSION BY (0 POSITION)
        MEASURES(
                 string,
                 NVL(LENGTH(REGEXP_REPLACE(string,'[^,]+','')),0)+1 NB_MOT
        RULES
         string[FOR POSITION FROM  1 TO NB_MOT[0] INCREMENT 1] = REGEXP_SUBSTR(string[0],'[^,]+',1,CV(POSITION))
    SQL> with t as (select 1 id, 'ABC,DEF GHI,JKL,DEF GHI,JKL,DEF GHI,JKL,DEF,GHI,JKL' string from dual
      2     union all
      3      select 2,'MNO' string from dual
      4      union all
      5     select 3,null string from dual
      6      )
      7   SELECT  id,
      8           string
      9    FROM   T
    10     MODEL
    11      RETURN UPDATED ROWS
    12      partition by (id)
    13      DIMENSION BY (0 POSITION)
    14      MEASURES(
    15               string,
    16               NVL(LENGTH(REGEXP_REPLACE(string,'[^,]+','')),0)+1 NB_MOT
    17              )
    18      RULES
    19      (
    20       string[FOR POSITION FROM  1 TO NB_MOT[0] INCREMENT 1] = REGEXP_SUBSTR(string[0],'[^,]+',1,CV(POSITION))
    21      )
    22  /
            ID STRING
             1 ABC
             1 DEF GHI
             1 JKL
             1 DEF GHI
             1 JKL
             1 DEF GHI
             1 JKL
             1 DEF
             1 GHI
             1 JKL
             2 MNO
            ID STRING
             3
    12 rows selected.
    SQL> SY.

  • Look Up For Comma Separated Strings

    Hi,
    How to look up for comma separated string from livecycle forms manager ??
    Plz gimme an idea on this.
    Raghava Kumar V.S.S.

    Hi
    My point is that the more detailed you ask your question, the more likely you are to get an answer.
    Those of us who monitor these newsgroups also appreciate you doing as much of your own research as possible, before asking us for help - we're more likely to spend our own (personal and valuable) time helping you, if we know that you've spent your own time doing research, and you've still not been able to solve the problem.
    I look forward to your next question :-)
    Howard

Maybe you are looking for

  • ANT error while doing a setup-bpm from the OBPM documentation - antlib err

    Hi, Have anyone see this particular error and found a solution for the following problem: I've tried using the samples in OBPM Enterprise version for weblogic. It has samples under OBPMWlHome directory samples/interop. Setup my environment settings s

  • No commitment item entered in item 00002 0300 8291002

    Hi I'm getting error message FI311 - No commitment item entered in item 00002 0300 8291002 when transferring SD downpayment documents to FI. We are currently on EA PS release 200, support pack SAPKGPPB14. Regards Thuso

  • Export data in ANSI format using GUI_DOWNLOAD

    Hi, Please find below the issue description. We have a program that exports txt file which inturn is uploaded in a 3rd party system. Before upgrade, we were getting the txt file in ANSI format. (The program uses GUI_DOWNLOAD without any code page and

  • Macbook Not Reading Disc

    I went and purchased Microsoft Office 2011 to install on to my Macbook Pro, but once I insert my disc..the loading stalls. The icon doesn't show up on my desktop and I've always ended up going to Disk Utilities to eject my disc. Is there a problem wi

  • I have a 1 Hour shoot with 3 cameras and I

    I have a 1 Hour shoot with 3 cameras and I need to make a dvd with chapters. What is my best work flow? 1. Do I edit the whole thing at once and then save to file using compressor? After that how do I burn a DVD with chapter marks? 2. Edit each secti