HTMLEditorKit : How you handle FRAMES, IFRAMES and JAVASCRIPT

Hi all,
Currently im using the HTMLEditorKit to parse through the HTML page. Obviously its easier when the elements are on the body of the page. But what if the page has frames,iframes or javascript and i want to extract links that these elements reference to. How do i do it? I know some of you would recommend my class to extend the parsercallback class. But is there a way for example i can use 3 or even 4 different iterators each pointing to the different elements ?
and lets say if i reference to a SCRIPT tag of the HTML, how do i extract the possible URLs in it. Same goes for iFrames and JavaScripts. Can anyone please help me with this ?

Tim,
The form action needs to be the page URL. The INPUT fields/objects of your form will be sent as parameters when the form is submitted. These parameters can be read by your portlet by using the parameter passing PDK services. It is recommended to use qualified parameters in case the portlet that reads the parameters is the same as the one that has submitted them.
As far as I remember the parameter passing sample portlet contains similar code to what you're looking for.

Similar Messages

  • In  BDC how you handled header data and item data

    In  BDC how you handled header data and item data

    Raja,
    Can you be more clear ?
    Usually you load the header data one and then loop at the item data and then load the item data.
    This example should help you.
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • How to Handle the lower and upper case in 'POPUP_GET_VALUES'

    Hi All
    i am using the following FM and when i enter value on the
    popup in lower case or with capital letters i see the field
    with upper case ,this is problem for me since i need to
    take the field and compare it ,there is a way to handle this
    issue ?
    CALL FUNCTION 'POPUP_GET_VALUES'                      "#EC FB_RC
            EXPORTING
              popup_title     = lv_head_msg
            IMPORTING
              returncode      = lv_rc    " User response
            TABLES
              fields          = lt_field    " Table fields, values and attributes
            EXCEPTIONS
              error_in_fields = 1
              OTHERS          = 2.
    Best regards
    Alex

    Hi Alex,
    This because, the field and table name that You are passing in lt_field, has a conversion attached to it, which causes the converison in case.
    For e.g. If You pass MARA-MATNR and try to get the values from pop-up, the value will get converted to upper case, but if You pass MAKT-MAKTX (which does not have a converison attached to it), the value will be retrieved as it was entered. This is standard SAP, which is correct.
    If You need to get values of any text field, pass any SAP text field as reference in your table lt_field. Hope this helps...
    Rgds,
    Birendra

  • How to handle monster fact and monster diamension in obiee

    Hi,
    what are ways to handle handle monster fact and monster diamension in obiee 10g.
    Thanks

    Hi,
    Thanks for your reply, I was trying things suggested, I found that the actual physical SQL (which I can get from "Manage Session" link) run in like 4-5 seconds in Query analyzer but: when I studied SQL carefully it does not contain some fiters which we I have applied in report.
    From example i have a filter in report <Measure.Present = 1 > but in Physical SQL i cannot see that filter. However, the results it gives on dashboard are correct that is after it applies the fillter.
    Any idea why is this happening?
    My guess is because above filter is not being applied at physical sql level thats why query fetches like 20000 recors in server cache and then it applies <Measure.Present = 1 >. Thats why it might be taking time ?
    Please give me your suggestions.
    Thanks !

  • This is how you extract frames from video

    right then, in answer to many posts about how to get the individual frames from video, here is my solution. it seems to work with mpg files but it doesnt seem to work with any of the avi files i tried. not sure why it doesnt work with those. i have modified javas frame access.
    nothing is displayed except it prints which frame it is doing.
    if anyone wants to improve it, please do. i still dont understand fully how it works so i probably wont be able to answer many questions about it. anyway here it is:
    * @(#)FrameAccess.java 1.5 01/03/13
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear
    * facility. Licensee represents and warrants that it will not use or
    * redistribute the Software for such purposes.
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.*;
    import java.util.*;
    import javax.media.util.*;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess implements ControllerListener {
         Processor p;
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         public boolean alreadyPrnt = false;
         * Given a media locator, create a processor and use that processor
         * as a player to playback the media.
         * During the processor's Configured state, two "pass-thru" codecs,
         * PreAccessCodec and PostAccessCodec, are set on the video track.
         * These codecs are used to get access to individual video frames
         * of the media.
         * Much of the code is just standard code to present media in JMF.
         public boolean open(MediaLocator ml) {
              try {
                   p = Manager.createProcessor(ml);
              } catch (Exception e) {
                   System.err.println(
                        "Failed to create a processor from the given url: " + e);
                   return false;
              p.addControllerListener(this);
              // Put the Processor into configured state.
              p.configure();
              if (!waitForState(Processor.Configured)) {
                   System.err.println("Failed to configure the processor.");
                   return false;
              // So I can use it as a player.
              p.setContentDescriptor(null);
              // Obtain the track controls.
              TrackControl tc[] = p.getTrackControls();
              if (tc == null) {
                   System.err.println(
                        "Failed to obtain track controls from the processor.");
                   return false;
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for (int i = 0; i < tc.length; i++) {
                   if (tc.getFormat() instanceof VideoFormat) videoTrack = tc[i];
                   else     tc[i].setEnabled(false);
              if (videoTrack == null) {
                   System.err.println("The input media does not contain a video track.");
                   return false;
              String videoFormat = videoTrack.getFormat().toString();
              Dimension videoSize = parseVideoSize(videoFormat);
              System.err.println("Video format: " + videoFormat);
              // Instantiate and set the frame access codec to the data flow path.
              try {
                   Codec codec[] = { new PostAccessCodec(videoSize)};
                   videoTrack.setCodecChain(codec);
              } catch (UnsupportedPlugInException e) {
                   System.err.println("The process does not support effects.");
              // Realize the processor.
              p.prefetch();
              if (!waitForState(Processor.Prefetched)) {
                   System.err.println("Failed to realise the processor.");
                   return false;
              p.start();
              return true;
         /**parse the size of the video from the string videoformat*/
         public Dimension parseVideoSize(String videoSize){
              int x=300, y=200;
              StringTokenizer strtok = new StringTokenizer(videoSize, ", ");
              strtok.nextToken();
              String size = strtok.nextToken();
              StringTokenizer sizeStrtok = new StringTokenizer(size, "x");
              try{
                   x = Integer.parseInt(sizeStrtok.nextToken());
                   y = Integer.parseInt(sizeStrtok.nextToken());
              } catch (NumberFormatException e){
                   System.out.println("unable to find video size, assuming default of 300x200");
              System.out.println("Image width = " + String.valueOf(x) +"\nImage height = "+ String.valueOf(y));
              return new Dimension(x, y);
         * Block until the processor has transitioned to the given state.
         * Return false if the transition failed.
         boolean waitForState(int state) {
              synchronized (waitSync) {
                   try {
                        while (p.getState() != state && stateTransitionOK)
                             waitSync.wait();
                   } catch (Exception e) {
              return stateTransitionOK;
         * Controller Listener.
         public void controllerUpdate(ControllerEvent evt) {
              if (evt instanceof ConfigureCompleteEvent
                   || evt instanceof RealizeCompleteEvent
                   || evt instanceof PrefetchCompleteEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = true;
                        waitSync.notifyAll();
              } else if (evt instanceof ResourceUnavailableEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = false;
                        waitSync.notifyAll();
              } else if (evt instanceof EndOfMediaEvent) {
                   p.close();
                   System.exit(0);
         * Main program
         public static void main(String[] args) {
              if (args.length == 0) {
                   prUsage();
                   System.exit(0);
              String url = args[0];
              if (url.indexOf(":") < 0) {
                   prUsage();
                   System.exit(0);
              MediaLocator ml;
              if ((ml = new MediaLocator(url)) == null) {
                   System.err.println("Cannot build media locator from: " + url);
                   System.exit(0);
              FrameAccess fa = new FrameAccess();
              if (!fa.open(ml))
                   System.exit(0);
         static void prUsage() {
              System.err.println("Usage: java FrameAccess <url>");
         * Inner class.
         * A pass-through codec to access to individual frames.
         public class PreAccessCodec implements Codec {
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Pre: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              * The code for a pass through codec.
              // We'll advertize as supporting all video formats.
              protected Format supportedIns[] = new Format[] { new VideoFormat(null)};
              // We'll advertize as supporting all video formats.
              protected Format supportedOuts[] = new Format[] { new VideoFormat(null)};
              Format input = null, output = null;
              public String getName() {
                   return "Pre-Access Codec";
              //these dont do anything
              public void open() {}
              public void close() {}
              public void reset() {}
              public Format[] getSupportedInputFormats() {
                   return supportedIns;
              public Format[] getSupportedOutputFormats(Format in) {
                   if (in == null)
                        return supportedOuts;
                   else {
                        // If an input format is given, we use that input format
                        // as the output since we are not modifying the bit stream
                        // at all.
                        Format outs[] = new Format[1];
                        outs[0] = in;
                        return outs;
              public Format setInputFormat(Format format) {
                   input = format;
                   return input;
              public Format setOutputFormat(Format format) {
                   output = format;
                   return output;
              public int process(Buffer in, Buffer out) {
                   // This is the "Callback" to access individual frames.
                   accessFrame(in);
                   // Swap the data between the input & output.
                   Object data = in.getData();
                   in.setData(out.getData());
                   out.setData(data);
                   // Copy the input attributes to the output
                   out.setFlags(Buffer.FLAG_NO_SYNC);
                   out.setFormat(in.getFormat());
                   out.setLength(in.getLength());
                   out.setOffset(in.getOffset());
                   return BUFFER_PROCESSED_OK;
              public Object[] getControls() {
                   return new Object[0];
              public Object getControl(String type) {
                   return null;
         public class PostAccessCodec extends PreAccessCodec {
              // We'll advertize as supporting all video formats.
              public PostAccessCodec(Dimension size) {
                   supportedIns = new Format[] { new RGBFormat()};
                   this.size = size;
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   if (!alreadyPrnt) {
                        BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
                        Image stopImage = stopBuffer.createImage(frame);
                        try {
                             BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
                             Graphics og = outImage.getGraphics();
                             og.drawImage(stopImage, 0, 0, size.width, size.height, null);
                             //prepareImage(outImage,rheight,rheight, null);
                             Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
                             ImageWriter writer = (ImageWriter) writers.next();
                             //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
                             File f = new File(frame.getSequenceNumber() + ".jpg");
                             ImageOutputStream ios = ImageIO.createImageOutputStream(f);
                             writer.setOutput(ios);
                             //Finally, the image may be written to the output stream:
                             //BufferedImage bi;
                             //writer.write(imagebi);
                             writer.write(outImage);
                             ios.close();
                        } catch (IOException e) {
                             System.out.println("Error :" + e);
                   //alreadyPrnt = true;
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Post: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              public String getName() {
                   return "Post-Access Codec";
              private Dimension size;

    The quality of the produced video from this example is very poor.
    It comes to huuuuge surprise the following fact.
    If you comment the line where you set the PostAccessCodec, the chain of the codecs is:
    MPEG-1 decoder -> YUV2RGB -> Direct Draw Renderer. ( The one used from the system to decode and render)
    If you run the example purely as is above you get the following sequence(as long with the poor quality):
    MPEG-1 decoder -> YUV2RGB -> Windows GDI Renderer.
    So you say lets set another Renderer. So
    you add the following line videoTracker.setRenderer( new DDRenderer() )
    What comes to a surprise is the following chain of codecs:
    MPEG-1 decoder -> YUV2RGB -> Post Codec -> Java RGB Converter - > DDRenderer
    The quality now may be perfect but video runs to slow. The surprising thing here is that even though we have set the outputFormat of the PostAccessFrame codec to RGBFormat the system converts it again to RGB through codec Java RGB Format.
    After searching a lot and reaching the conclusion that the deference between the 2 RGB's is their sizes I sudently was brought in front of a method called grabFrame(). Bels started ringing inside my head. Starts were comming up. Looking at the definition of the class com.sun.media.renderer.video.DDRenderer I descovered that this damn class implements the FrameGrabbingControl Interface. What the f.....? The problem that consumed 4 days of my life and multiplied with 10 to give hours has finally come to an and.
    Summing up the solution for grabbing frames is this!!!!!
    DDRenderer renderer = new DDRenderer();
    videoTrack.setRenderer( renderer );
    and in your actionPerformed implementation
    FrameGrabbingControl fr = (FrameGrabbingControl)renderer.getControl( "javax.media.control.FrameGrabbingControl");
    Buffer frame = fr.grabFrame();
    The following stuff ...are stated in FrameAccess
    --Sniper

  • How to handle Stored Procedure and Views

    Dear All
    While dealing with Oracle database related scenario. I came across Stored Procedures and Views. Which are complex in nature. Using SAP XI how we can handle them ?
    Is JDBC adaptor is capable of that.? Can you help me Data type structure for oracle.
    How max occur play important role in that. How to identify root and item level structure for oracle
    I am dealing with stored procedures while inserting data. and using views i need to get data from oracle database.
    What is the syntax of query we use to put while using JDBC adaptor?
    Please help and provide bit detail information over this so that i can execute scenario
    Thanks
    Gaurav

    1) jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:sid
    2)Occurence==> o,1, >1 , Unbounded
    Occurrence=> ready to accept 0 / 1 / more than 1/ multiple record  (for source) and how it will be passed to target.
    http://help.sap.com/saphelp_erp2004/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
    3)
    <StatementName5>
    <storedProcedureName action=” EXECUTE”>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=”true”] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName5>
    refer
    http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm

  • How to handle Frames

    Hai all,
       Once agian i am here to share my doubts with u ppl,I am currently working on BSP application using frames.
    i have a parent document which contains top frame and bottom frame.my top frame contains menubar wher i can select my choice.based on my selection bottom frame should get refreshed with the desired content.this will work fine with pages with flow logic.but using mvc i am little bit confused to get the desired output.the thing is when i perform some actions in my bottom frame my control should go back to parent window(contains two frames) that page should deside which one should display in bottom frame... how can we perform this..?
    does anyone worked on this ..?if so, plz share ur knowledge with me
    leoiz.

    Hi,
    read the answer from Rainer first then take a look at this view:
        <phtmlb:matrix>
          <phtmlb:matrixCell design = "PADLESS"
                             row    = "1" />
           <bsp:call url     = "left.do"
                            comp_id = "left" />
          <phtmlb:matrixCell design = "PADLESS"
                             row    = "1" />
             <phtmlb:matrix>
               <phtmlb:matrixCell design = "PADLESS"
                             row    = "1" />
                  <bsp:call url     = "header.do"
                            comp_id = "menu" />
               <phtmlb:matrixCell design = "PADLESS"
                             row    = "2" />
                  <bsp:call url     = "body.do"
                            comp_id = "body" />
               <phtmlb:matrixCell design = "PADLESS"
                             row    = "3" />
                  <bsp:call url     = "footer.do"
                            comp_id = "footer" />
           </phtmlb:matrix>
        </phtmlb:matrix>
    This is an example how your default.htm view could look like. When you need automate scrolling take a look at this extension <xhtmlb:overflowContainer> perhaps it can help you.
    regards
    Thomas

  • Jdev 10.1.2 UIX: How to handle page event and also follow link destination

    Hello guys, I think this should be easy:
    I have a frame with a link that produces an event which is handled by an event handler. But this link also has destination and targetFrame attributes.
    The event handling just updates the visual state of the frame which contains the link, but I also need the link to load the destination into the targetFrame, but this is not happening, just the event is handled but the link doesn't work.
    How can I get both, the event handling and the destination, work?
    Here is the code for the link:
    <link text="${uix.current.title}" destination="${uix.current.destination}"                                                             
                    targetFrame="main">
      <primaryClientAction>
       <fireAction event="optionClick">
         <parameters>
           <parameter key="clickedIndex" value="${uix.current.index}" />
          </parameters>
        </fireAction>
      </primaryClientAction>
    </link>Thanks
    Fer

    Thanks to everyone who read it. I figured out how to solve this.
    The workaround was to set every link destination to one action which performs 2 things:
    1. Update the visual state of the first frame (setting attributes to a session object) and;
    2. Puts the destination that I wanted to be loaded into the second frame as a request attribute;
    besides all the above, the link had its targetFrame set to "_parent", so the Frameset page was reloaded and therefore reloaded both frames, this way the first frame renders updated (thanks to the changes made to the session object) and the second frame has its source attribute bound to ${requestScope.frameDestination} to load the desired page (actually a struts action).
    Hope this helps someone else.
    Bye.

  • How you handle your signatures

    What are you doing with your signatures which fire and are false positives? Are you using event action filters or are you disabling the signature? In some cases I see where disabling that signature would be fine. Like if you have a DNS box which is patched and not susceptible to a exploit being noticed by IPS - Since your system is patched and no other boxes are susceptible to the exploit then it seems only logical to disable the signature, yes? But event action filters come into place for signatures like sig-3030 which, in most cases, should only fire when the source is from outside your network. Just want to make sure Im on the right track. Anyone know of a good site which discusses IPS best practice, administration and policy?
    Also how many of ya'll monitor your internal network?
    Thanks

    When I'm troubleshooting a new alert I usually enable 'log pair packets' so I can put more context around the alert itself. Although they get correlated in MARS I use CSM to tune the sensors and signatures. I'll cross-launch to IDM to pull down the packet captures, saving them with somewhat descriptive names in case I need to revisit them later. I also use a great netflow reporting engine (mazu networks) to see where else the suspect PC has been going, and then use online tools like dnsstuff.com, spamhaus DROP lists, Dshield, to see if the IP address is on any block lists. This tool (as well as Arbor Networks, Lancope, etc) also do their own non-signature-based network behavior analysis, and sometimes (not always) something with correlate here too.
    After I get enough information I try to tune the actions on the sensor itself. Sometimes you have to fall back on a MARS drop rule, just to screen out false positives or handle special cases, but I think its better to keep the alert from occuring in the first place. Having too many filters gets ugly fast.
    You should also be leveraging Cisco's Intellishield service ; each IPS sig subscription gives you (free) access to detailed information on the IPS sigs and the vulnerabilities that prompted the sig in the first place. Great service. I've been able to disable a bunch of sigs using this alone.
    Good luck.

  • How to handle multiple updates and creates sequentially

    Hi All,
    I have a requirement where multiple updates and creates will happen on an Order (say Purchase Order). I need to capture all these updates/creates and synchronize the other system in real time. In other words, as soon an order is updated/created in EBS, the same needs to be reflected in other system database.
    I have thought of using a JMS queue that'll store all the incoming creates/updates and a BPEL process will keep polling this queue. But in this case how do I ensure the sequence in which the new instances will be created. e.g. create order message was picked first from the queue and an instance got created. While this instance was in execution, another update happened on the same order for which another instance got created. Now before the first instance could get completed and created an order, second instance is trying to update the custom database because of which it would fail. How to restrict second instance from running before the completion of the first one?
    I have also thought of capturing Order Update/Create business events from EBS but there also the same problem. Instance created by Update event can try to do the update before the instance created by Order Create could create a new order.
    Any method to solve this.
    Any pointers/suggestions/approaches are more than welcome.
    SOA Suite 11.1.1.3
    Regards,
    Neeraj Sehgal

    maybe unit of order and unit of work can help you on that, though i haven't any experience on both topics :
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/uow.html
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/uoo.html
    or the mediator supports some sort of sequencer, see : http://www.xenta.nl/blog/2010/05/14/oracle-soa-suite-11g-resequence-messages-in-mediator/

  • DBMS_FGA.add_policy .. How to handle multiple tables and multiple users

    Dear All,
    My database is 11gR1 and Linux is the platform.
    I have more then 50 very important tables and around 15 database users.
    I want to implement fine grained auditing on these important tables.
    This is how I am going to implement it:
    SQL>BEGIN
    DBMS_FGA.add_policy(
    object_schema     =>     'Scott',
    object_name     =>     'SAL',
    policy_name     =>     'SALARY_CHK_AUDIT',
    audit_condition     =>     NULL,
    handler_schema     =>     'imran',
    statement_types     =>     'SELECT,INSERT,UPDATE,DELETE',
    audit_column     =>     NULL);
    END;
    what is i have to pass multiple tables in object_schema and multiple users in handler_schema.
    I hope i am able to clear my question, any doubts please let me know.
    Regards, Imran

    Hi,
    object_schema - The schema of the object to be audited. (If NULL, the current log-on user schema is assumed.)
    in case if you like to audit for multiple users - then try to test by holding a null value and test access the important tables -where the relevant auditing records are generated as per your requirement or not. i have not tested.. try it
    - Pavan Kumar N

  • How to handle when Client and server write to the socket at the same time

    Hi all,
    I'm writing a socket communication when client and server may write information the the socket at the same time. I look every where but the samples from the internet only shows example of server replies to client after receiving requests from clients.
    Let's say that:
    Client 1 ->Socket 1 -> Server 1
    Now if there are two threads in the server, one blocked waiting for the input from client on socket 1, the second one write something on the socket to client 1, is it possible?
    And if it's possible, if at the time Server 1 writes information to Client 1, Client 1 writes some information to Server 1 too, will there be any conflict problem or the socket could handle that two ways communication simultaneously?
    It's critical questions for me. Thanks for your help.

    I really use Server Client paradigm. However, beside the request, response mechanism, there is also an additional mechanism called update which server periodically send information update to client without the need for a request from client.
    So you suggest client should initiate 2 sockets, one for request and response, one for receiving update from the server? Will this work?

  • How to handling Binary data and File operation?

    Hello Everyone,
    I think this question might have been asked a lot of time but I was unable to find one solution so, please help needed in this from all you guys..
    I am creating a byte[] of the media files of mp4, and jpg, using the below code,,
    File ff = new File(filename);
            fos = new FileOutputStream(ff);
            int b;
            byte[] f = this.getMediaFile();
            for (b = 0; b < f.length; b++) {
                if (f[b] != -1) {
                    fos.write(f);
    fos.flush();
    fos.close();
    After i convert it i have to store it in the MySql Database as BLOB object, for retrieving byte[] from the database is simple i can do that also successfully with this code.java.sq.Blob obj = (java.sql.Blob) rs.getBlob("file");
    InputStream is = null;
    ByteArrayOutputStream bc = null;
    is = obj.getBinaryStream();
    bc = new ByteArrayOutputStream();
    int b;
    while ((b = is.read()) != -1) {
    System.out.print(b + " ");
    bc.write(b);
    Now the real problem is that when i want to recreate a mp4 audio or video file i am unable to do so, the file created is smaller in size and also it doesn't get played in windows default player nor VLC. I am able to get the image file of jpg format using the BufferedImage & ImageIO.writer();
    How do i do for mp4 file, have no clue for that.
    Pleases help out with this.
    Thanks..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    if (f[b] != -1) {I don't get that line. What if you try to output the data without that condition, like this:
    fos = new FileOutputStream(ff);
            byte[] f = this.getMediaFile();
            for (int b = 0; b < f.length; b++) {
                 fos.write(f);
    fos.close();

  • How do handle a rollbackException and other transaction exceptions

    Hello,
    I'm trying to do commit and rollbacks for my stateless session bean and I'm having a problem handling exceptions like javax.transaction.RollbackException. This causes me to be unable to complile my code. When I do put a catch in for the rollbackException it says it can't be reached. Below is the code:
    if (madeConnection != true)
    returnCode = 8;
    else
    UserTransaction ut = ejbContext.getUserTransaction();
    ut.begin();
    try{          
         statement = c.prepareCall("{call NBA907(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");                    
         java.lang.Integer dept = Integer.valueOf(department);
         short dpt = dept.shortValue();
         TrxNum = (short) recordId;
         //**** Input parameters ****
         statement.setString(1, AAA.toUpperCase());
         statement.setString(2, BBB);
         statement.setShort(3, CCC);
         statement.setString(4, DDD.toUpperCase());
         statement.setString(5, EEE);
         statement.setString(6, FFF);
         statement.setString(7, GGG);
         statement.setString(8, HHH);
         statement.setString(9, III);
         statement.setString(10, JJJ);
         statement.setString(11, KKK);
         statement.setString(12, LLL);
         statement.setShort(13, MMM);
         statement.setString(14, NNN);
         statement.setString(15, OOO);
         //**** Output parameters ****
         statement.registerOutParameter(16, Types.CHAR);
         statement.registerOutParameter(17, Types.SMALLINT);
         statement.registerOutParameter(18, Types.CHAR);
         rs = statement.executeQuery();
         sProcedureCode = statement.getString(16);
         sqlCode = statement.getShort(17);
         returnMessage = statement.getString(18);
         if (!(sProcedureCode.equals("01")))
         ut.setRollbackOnly();
         System.out.println ("***************************************");
         System.out.println("Method - updateRecord");
         system.out.println("SQL Code - " + sqlCode);
         System.out.println("SP Code - " + sProcedureCode);
         System.out.println("Message - " + returnMessage);
         System.out.println("*****************************************");
         if (sProcedureCode.equals("99"))
         returnCode = sqlCode;
         else     
              returnCode = Integer.parseInt(sProcedureCode);           
    catch(SystemException e) {
    System.out.println("SQLException caught: " + e.getMessage());
    catch(SQLException e) {
    System.out.println("SQLException caught: " + e.getMessage());
    finally {
    try {
              ut.commit();
              statement.close();
              c.close();
         catch (SQLException ignored) {}
    Any ideas?
    TIA,
    J.Clancey

    I got past the exception errors but the line
    UserTransaction ut = ejbContext.getUserTransaction();
    is returning a null. Below is the changes I made to get past that error.
    public int updateRecord(String User, String Password, int recordId, String department, String description, String classCatg, String coordinate, String startMonth, String startYear, String endMonth, String endYear, String POSeason, String merchType, String Chain)
              int returnCode = 0;
              String sProcedureCode = null;
              String returnMessage = null;
              short sqlCode = 0;
              String collectionId = "BA_ANBCS";
              CallableStatement statement= null;
              ResultSet rs = null;
              String tranType = "C";
              String tranNumber = null;      
              String storedProCode = null;
              short TrxNum = 0;
              boolean madeConnection = true;
              Context ctx = null;
              DataSource ds = null;
              Connection c = null;          
              java.util.Properties parms = new java.util.Properties();
              parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                   "com.ibm.websphere.naming.WsnInitialContextFactory");               
              try {
                   ctx = new InitialContext(parms);               
              catch (Exception e1)
                   System.out.println("Unable to get initial context");
                   System.out.println(e1);
              try
                   ds = (DataSource)ctx.lookup("jdbc/DB2T");
                   c = ds.getConnection(User, Password);
              catch (SQLException e) {
                   System.out.println("SQLException caught: " + e.getMessage());
                   madeConnection = false;
              catch (Exception e) {
                   e.printStackTrace();
                   madeConnection = false;
              if (madeConnection != true)
                   returnCode = 8;
              else
                   System.out.println("Made Else");
                   UserTransaction ut = ejbContext.getUserTransaction();
                   try{
                        System.out.println("Before Begin");
                        ut.begin();
                        System.out.println("After Begin");
                   statement = c.prepareCall("{call NBA907(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");                    
                        java.lang.Integer dept = Integer.valueOf(department);
                        short dpt = dept.shortValue();
                        TrxNum = (short) recordId;
                        //**** Input parameters ****
                        statement.setString(1, Chain.toUpperCase());
                        statement.setString(2, collectionId);
                        statement.setShort(3, dpt);
                        statement.setString(4, classCatg.toUpperCase());
                        statement.setString(5, merchType);
                        statement.setString(6, coordinate);
                        statement.setString(7, POSeason);
                        statement.setString(8, startMonth);
                        statement.setString(9, startYear);
                        statement.setString(10, endMonth);
                        statement.setString(11, endYear);
                        statement.setString(12, description);
                        statement.setShort(13, TrxNum);
                        statement.setString(14, tranType);
                        statement.setString(15, User);
                        //**** Output parameters ****
                        statement.registerOutParameter(16, Types.CHAR);
                        statement.registerOutParameter(17, Types.SMALLINT);
                        statement.registerOutParameter(18, Types.CHAR);
                        rs = statement.executeQuery();
                        sProcedureCode = statement.getString(16);
                        sqlCode = statement.getShort(17);
                        returnMessage = statement.getString(18);
                        System.out.println("Before SP Check");               
                        if (!(sProcedureCode.equals("01")))
                             //c.rollback();
                             ejbContext.setRollbackOnly();                         
                             System.out.println("***********************************************");
                             System.out.println("Method - updateRecord");
                             System.out.println("Stored Procedure - NBA 907");
                             System.out.println("Record Number - " + TrxNum);
                             System.out.println("Department - " + dpt);
                             System.out.println("Class Category - " + classCatg);
                             System.out.println("Merch Type - " + merchType);
                             System.out.println("coordinate - " + coordinate);
                             System.out.println("POSeason - " + POSeason);
                             System.out.println("Start Month - " + startMonth);
                             System.out.println("Start Year - " + startYear);
                             System.out.println("End Month - " + endMonth);
                             System.out.println("End Year - " + endYear);
                             System.out.println("Description - " + description);
                             System.out.println("Chain - " + Chain);
                             System.out.println("User Id - " + User);
                             System.out.println("SQL Code - " + sqlCode);
                             System.out.println("SP Code - " + sProcedureCode);
                             System.out.println("Message - " + returnMessage);
                             System.out.println("***********************************************");
                        ut.commit();     
                        if (sProcedureCode.equals("99"))
                             returnCode = sqlCode;
                        else     
                             returnCode = Integer.parseInt(sProcedureCode);                     
                   catch (SystemException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   catch (RollbackException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   catch (NotSupportedException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   catch (HeuristicMixedException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   catch (HeuristicRollbackException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   catch(SQLException e) {
                        System.out.println("SQLException caught: " + e.getMessage());
                   try {
                                  ut.setRollbackOnly();
                             catch (SystemException sysex) {
                                  throw new EJBException
                                  ("Rollback failed: " + sysex.getMessage());
                   finally {
                        try {
                             statement.close();
                             c.close();
                        catch (SQLException ignored) {}
              return returnCode;
    I will also check page 396.
    Thanks vickyk.
    TIA for any help resolving this null problem.
    J.Clancey

  • How to Handle Large Dumps and Complex Calculations in OBIEE

    Hi,
    We are working on some reports in OBIEE and we are unable to optimize performace. Please consider following scenerios:
    1) Detail Report
    In this particular report we have essentaily data dump. That is there are 5 Dimentions and a Fact table and we are just selecting
    fields from various Dimentions and facts. But the problem is there are over 5000 records. I guess that is making report very slow.
    Another issue is when we click on PAGE Contols, they simply dont work, that is if we click on (>>) to see all records its takes lots
    of time but show only first 25 records. Any idea what is the problem.
    2) Calculated Report
    We have one calculated report where there are 7 calculated columns. Because every column contains different Measures and we have to
    use lots of Filter expressions
    Eg: Filter (Measure1 USING {@VarDate} BETWEEN DIM1.FromDate and Dim1.Todate AND {@VarDate} BETWEEN DIM2.FromDate and Dim2.Todate AND <SOME OTHER FILTERS> )
    The Granuality of data is at employee level and there are around 1388726 records in Fact table.
    Is there is any way to optimize above except to create a summary table instead?
    kindly guide us on above scenerios

    Hi,
    Thanks for your reply, I was trying things suggested, I found that the actual physical SQL (which I can get from "Manage Session" link) run in like 4-5 seconds in Query analyzer but: when I studied SQL carefully it does not contain some fiters which we I have applied in report.
    From example i have a filter in report <Measure.Present = 1 > but in Physical SQL i cannot see that filter. However, the results it gives on dashboard are correct that is after it applies the fillter.
    Any idea why is this happening?
    My guess is because above filter is not being applied at physical sql level thats why query fetches like 20000 recors in server cache and then it applies <Measure.Present = 1 >. Thats why it might be taking time ?
    Please give me your suggestions.
    Thanks !

Maybe you are looking for

  • Yosemite Mail preferences are not saved

    Hello, I just update my Yosemite to 10.10.3. After some problems with Mail, I've been forced to delete container files and enveloppe index file, all is better except that now mail doesn't saved preferences anymore.. Also, the windows positions are no

  • Error:Dataflows abap program

    Hi, Dataservices 4.2 Sql server 2008 SAP (4.6 I make a migration of dataservices 11.5 towards 4.2 on new waiter. when I try to execute my dataflow abap, I have this message  error : error:"RFC Call Receive error<Function/BODS/ABAP_RUB:RFC_ABAP_EXCEPT

  • MacBook Air shuts down when I close it

    Whenever I close my MacBook, it shuts down instead of going into sleep mode. At first, I thought it was a problem with my MacBook not waking up from sleep at all, but if I use the Sleep function from the drop down menu, it will wake up normally. I've

  • Air badge installApplication() problems

    The installer for the application of air stopped working for the user who has not installed the air. I tested this in my installer (http://www.artclick.vn/article/download-install-acbook-offline-version-software-design-pho tobook-41.html) and other a

  • Aplicativo

    Olá pessoal, um instalei um aplicativo, e depois comprei a versão completa dele, porém sem querer desintalei. Agora quando o instalei de novo eu perdi a versão completa, terei que pagar de novo ou tem como recuperar? Obrigada desde já, Anna