How to improve this timer code ??

Dear Sir:
I have following code, it can works and if I remove the line "new JFrame("New Test Timer").setVisible(true);"
Then It did not show up timer message,
What is wrong here??
I want to remove this line but still keep timer moving,
How to do this??
Thanks
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.Timer;
public class TimerSample {
  public static void main(String args[]) {
    new JFrame("New Test Timer").setVisible(true);
    ActionListener actionListener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        System.out.println("Hello World Timer");
    Timer timer = new Timer(1000, actionListener);
    timer.start();
}

Swing timers are called in the event dispatch thread. If you don't start the event dispatch thread (by setting your GUI visible) then they don't get called.
If you want a timer but you don't want a GUI, then use a java.util.Timer.

Similar Messages

  • When I use AirPlay to mirror a video through my iPad there is a lag at times. Does anyone know how to improve this?

    When I use AirPlay to mirror a video through my iPad there is a lag at times. Does anyone know how to improve this?

    Since I updated my apple TV firmware the other day to 4.4.2 (3160) My video streamed from my iphone 4s loads inconsistently, and more troubling, much more slowly that with the previous version of the software.
    Since I'm not technically, 'mirroring' as you are, on it's face, doesn't seem related. I'm just throwing this out since after looking for comments about radical changes in airplay after this update, I couldn't find much on this.
    Did you install  this latest Apple TV update?  For me it's an  obvious difference. Previously I could start the airplay from my phone and not really have delays for loadiing or buffering. I don't have any other  'load' on my wifi or anything new that could be delaying the link from phone to airpay.
    Anyone?.....

  • How to Improve this PL/SQL script

    Hi All,
    I have a package/procedure that insert data into table but it takes time more than 2 days. Have any known how to modify this script to improve the performance and reduce loading time, The following code is procedure I used to insert data.....
    Procedure INSERT_DATA (p_month IN DATE, p_product_id IN NUMBER ) IS
    cursor c1 is select * from tab#1; --reference data
    cursor c2 is select * from tab#2;
    cursor c3 is select * from tab#3;
    cursor c4 is select * from tab#4;
    cursor c5 is select * from tab#5;
    v_rec claim_table%rowtype;
    Begin
    for c1rec in c1 loop
    exit when c1%notfound;
    call procedure in package....;
    open c2(c1rec.claim_no);
    fetch c2 into v_location_cd ,v_claim_type_cd ;
    close c2;
    v_rec.location_cd := v_location_cd;
    v_rec.claim_type_cd := v_claim_type_cd ;
    open c3(c1rec.claim_no);
    fetch c3 into v_col#3,v_col#4;
    close c3;
    v_rec.col#3 := v_col#3 ;
    v_rec.col#4 := v_col#4 ;
    open c4(c1rec.claim_no);
    fetch c4 into v_col#5,v_col#6;
    close c4;
    v_rec.col#5 := v_col#5 ;
    v_rec.col#6 := v_col#6 ;
    insert into claim_table values ( v_rec.location_cd, v_rec.claim_type_cd , v_rec.col#3 , .......) ;
    if (c1%rowcount/1000) = trunc(c1%rowcount /1000) then
         commit;
    end if;
    end loop;
    commit;
    Exception
    exception statement....
    commit;
    End;
    Thanks All,
    Mcka

    A copy and paste of a reply I posted just a hour or so ago to the exact same approach used by a poster in [url http://forums.oracle.com/forums/thread.jspa?threadID=636929]this thread.
    Yucky code IMO. You are using PL/SQL to drive a nested loop join. Why? SQL is by far more capable of joining tables and is not limited to a using a nested loop approach only.
    Also, as you are using PL/SQL to drive it, it means that each cursor fetch in each (nested) FOR loop is a slow context switch from PL/SQL to SQL, in order to ship the row's data from the SQL engine to the PL/SQL engine. Only then to have that very same data shipped back (via yet another context switch) to the SQL engine to be inserted into table4.
    This code violates one of the most rudimentary performance principles in Oracle - it is not maximizing SQL and it it not minimizing PL/SQL. It is doing the exact opposite.
    As for the ad-hoc commits inside the loop - this does not make much sense. This will generate more redo and more overheads. Also, when something goes pear shape in that process, some rows would have been processed and inserted and committed. Some not.
    In this case, how do you expect to restart the failed process at the very first row that failed to be committed and continue processing from there?

  • How to improve this query speed ?....help me

    How to improve the query speed. Any hints can u suggest in the query or any correction. Here i am using sample tables for checking purpose, When i am trying with my original values, this type of query taking longer time to run
    select ename,sal,comm from emp where(comm is null and &status='ok') or (comm is not null and &status='failed');
    Thanx in advance
    prasanth a.s.

    What about
    select ename,sal,comm from emp where comm is null and &status='ok'
    union all
    select ename,sal,comm from emp where comm is not null and &status='failed';
    Regards
    Vaishnavi

  • How to conver this sqlserver code into Oracle

    Hi,
    Any one can help me how to covert below sqlserver code into Oracle?
    DECLARE @t1 DATETIME;
    DECLARE @t2 DATETIME;
    SET @t1 = GETDATE();
    select * from table;
    SET @t2 = GETDATE();
    SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;

    Hi,
    Do Like This ,
    This is The function going to calculate elapsed time ,execute this before the second script,
    CREATE function DATEDIFF
      startTime in timestamp with time zone,
      endTime in timestamp with time zone
    return number
    as
      interval_ interval day (9) to second (3);
    begin
      interval_ := endTime - startTime;
      return (extract(day from (interval_)) * 86400 +
             extract(hour from (interval_)) * 3600 +
             extract(minute from (interval_)) * 60 +
             extract(second from (interval_))) * 1000;
    end;And this Is the Script that i converted to oracle,
    SET server out put on;
    DECLARE
       v_t1         TIMESTAMP;
       v_t2         TIMESTAMP;
       lv_cur       sys_refcursor;
       lv_elapsed   VARCHAR2 (30);
    BEGIN
       v_t1 := SYSTIMESTAMP;
       OPEN lv_cur FOR
          SELECT *
            FROM emp;
       v_t2 := SYSTIMESTAMP;
       SELECT datediff (v_t1, v_t2) elapsed_ms
         INTO lv_elapsed
         FROM DUAL;
       DBMS_OUTPUT.put_line (v_t1);
       DBMS_OUTPUT.put_line (v_t2);
    END;Thanks & Rgds
    BCV.

  • How to use this example code in Flash AS3?

    Hi,
    How can I use this AS3 code in my Flash CS4 document? The following code is in the below link:
    http://pv3d.org/2009/12/18/tweenmax-tweening-a-timeline-advanced-tweening/#
    Please help.
    Thanks.

    Hi,
    It is working quite nice. I want to use the same code but instead of as "Document Class" I want to put that code in a first key frame of my project. I tried the following but gets an error:
    The error is : 1131: Classes must not be nested.
    And the following code  I tried is:
        import com.greensock.TimelineMax;
        import com.greensock.TweenMax;
        import com.greensock.easing.Linear;
        import com.greensock.easing.Quart;
        import flash.display.Sprite;
         * @author John Lindquist
        [SWF(width="900", height="480", frameRate="31")]
        class EasingATimeline extends Sprite
            private var square:Sprite;
            private static const STEP_DURATION:Number = 1;
            public function EasingATimeline()
                square = new Sprite();
                square.graphics.beginFill(0xcc0000);
                square.graphics.drawRect(0, 0, 50, 50);
                square.graphics.endFill();
                square.x = 100;
                square.y = 50;
                addChild(square);
                //set all the eases of your steps to Linear.easeNone
                var step1:TweenMax = TweenMax.to(square, STEP_DURATION, {x: 700, y: 50, ease: Linear.easeNone});
                var step2:TweenMax = TweenMax.to(square, STEP_DURATION, {x: 700, y: 350, ease: Linear.easeNone});
                var step3:TweenMax = TweenMax.to(square, STEP_DURATION, {x: 100, y: 350, ease: Linear.easeNone});
                var step4:TweenMax = TweenMax.to(square, STEP_DURATION, {x: 100, y: 50, ease: Linear.easeNone});
                var timeline:TimelineMax = new TimelineMax();
                timeline.append(step1);
                timeline.append(step2);
                timeline.append(step3);
                timeline.append(step4);
                //pause your timeline
                timeline.pause();
                //tween your timeline with whatever ease you want
                TweenMax.to(timeline, timeline.totalDuration, {currentTime: timeline.totalDuration, ease: Quart.easeInOut, repeat: -1});
    Please help me to solve this problem.
    Thanks.

  • How to transform this pascal code into java code!

    I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
    Thanks!
    {CALCULATE HOHN-LONDON FACTORS}
    var kk:tab4;
    PROCEDURE INTENS(var kk:tab4);
    begin
    for n:=0 to nr+2 do
    begin
    kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
    kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
    kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
    kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
    kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
    end;
    end;
    BEGIN
    new (kk);
    intens(kk);
    writeln(f2,' ','N ','V','branch ','H-L');
    for n:=1 to np do
    begin
    fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
    fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
    writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
    end;
    for n:=1 to nq do
    begin
    fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
    fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
    fq1[n,v]:=fq1[n,v]*(n+1);
    writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
    end;
    for n:=1 to nr do
    begin
    fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
    fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
    fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
    writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
    end;

    Basically it looks like this:
    public class KK{
         private your_type[][] kk = new your_type[length][length];
         private void intens(your_type[] kk){
              for(int n= 0; n<nr+2; n++){
                   kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
                   kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
                   kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
         public static void main(String args[]){
              KK k = new KK();
              k.intens(kk);
              System.out.println(f2  + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
              for(int n=1; n < np; n++){
                   fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
                   fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
              for(int n=1; n< nq;n++){
                   fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
                   fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
                   fq1[n][v] = fq1[n][v]*(n+1);
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
              for(int n=1; n < nr; n++){
                   fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
                   fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
                   fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
    }I'm not very sure because my pascal knowledge is extremely "dated".
    What about the converter I told you about?

  • Please make suggestions on how to improve this code.

    Hello Experts,
    I am currently modifying a report where a certain code is giving
    me run time error. When I debugged the program, the internal table
    has 20,000+ records. Now, is there any alternative to this code?
    I really need to speed this up. Help would be greatly appreciated and rewarded.
    LOOP AT it_cdpos INTO wa_cdpos.
        l_matnr = wa_cdpos-objectid+00(18).
        l_charg = wa_cdpos-objectid+22(10).
        l_zustd = wa_cdpos-value_new+00(01).
        READ TABLE it_batch INTO wa_batch
             WITH KEY matnr = l_matnr
                      charg = l_charg.
        IF sy-subrc EQ 0.
          l_tabix = sy-tabix.
          wa_batch-zustd = l_zustd.
          MODIFY it_batch FROM wa_batch INDEX l_tabix
                 TRANSPORTING zustd.
        ELSE.
          wa_batch-matnr = l_matnr.
          wa_batch-charg = l_charg.
          wa_batch-zustd = l_zustd.
          wa_batch-code  = 'A'.              "selected within period
          APPEND wa_batch TO it_batch.
        ENDIF.
      ENDLOOP.

    Check the SQL statement from which u get the result otherwise
    the code which u sent is optimized or u can use the binary search option for the Read statement for MATNR
    while the rest of the code is optimized....
    or u can use
    loop at it_cdpos assinging <fs>.
                 <FS>-cols = value.
    <b>note: in this case <FS>-col = value</b>
    u wont have to use <b>modify</b> statement for internal table for updating the line contents
    since assinging it to field-symbol will dynamically modifies the contents.
    <b>this method is faster than the below modify process </b>
    endloop.

  • How can I get rid of this time code bar at the top of my rendered/exported video?

    This is the video after I rendered:
    This is the setting I used:

    That problem has nothing to do with format settings. It is a burn-in, which is set in the view settings (timeline panel), and also you can deactivate in the render settings.

  • Help how to simplify this problem code.

    Is there a way to edit the code to enable that i don have so many if statements..
    what can do to improve pls help.
    my code is:
    public class tradeFair1 {
         public static void main(String[]arguments){
              double studentM=1.00, studentA=1.20, studentE=3.50;
              double SnrCitizenM=1.20,SnrCitizenA=1.50, SnrCitizenE=3.50;
              double GenPubM=2.00, GenPubA=2.50, GenPubE=3.50;
              boolean weekDays = false;
              double price, status;
         int day = Console.readInt("Enter 1 for Monday, 2 for Tuesday.....6 for Saturday, 7 for Sunday: ");
         int buyer = Console.readInt("Enter 1 for Student, 2 for SnrCitizen, and 3 for GeneralPublic: ");
    int timeOfDay = Console.readInt("Enter the timeOfDay 1 for Morning, 2 for afternoon, 3 for evening: ");
              int numOfTickets = Console.readInt("Enter the number of Tickets");
                   if (day >= 1 && day <= 5) {
                        weekDays = true;
                        if (buyer==1 && timeOfDay==1) {
                             status = studentM;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price -(price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==1 && timeOfDay==2) {
                             status = studentA;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==1 && timeOfDay==3) {
                             status = studentE;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==2 && timeOfDay==1) {
                             status = SnrCitizenM;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==2 && timeOfDay==2) {
                             status = SnrCitizenA;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==2 && timeOfDay==3) {
                             status = SnrCitizenE;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==3 && timeOfDay==1) {
                             status = GenPubM;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==3 && timeOfDay==2) {
                             status = GenPubA;
                             price = numOfTickets*status;;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (buyer==3 && timeOfDay==3) {
                             status = GenPubE;
                             price = numOfTickets*status;
                             if (numOfTickets >=10 && numOfTickets <=15)
                                  price = price - (price*0.1);
                                  if (numOfTickets >15)
                                  price = price - (price*0.15);
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                   else if (weekDays = false) {
                        if (timeOfDay ==1) {
                             status = GenPubM;
                             price = numOfTickets*status+0.50;
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (timeOfDay ==2) {
                             status = GenPubA;
                             price = numOfTickets*status+0.50;
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);
                        if (timeOfDay ==3) {
                             status = GenPubE;
                             price = numOfTickets*status+0.50;
                             price = price + (price*0.05);
                             System.out.println("The price is: $" +price);

    this is total aircode - just to give you an idea
    class TradeFair1
      double[][] prices = {{1.00,1.20,3.50},{1.20,1.50,3.50},{2.00,2.50,3.50}};
      double cost = 0;
      public TradeFair1()
        int buyer = Console.readInt("Enter 1 for Student, 2 for SnrCitizen, and 3 for GeneralPublic: ") - 1;
        int timeOfDay = Console.readInt("Enter the timeOfDay 1 for Morning, 2 for afternoon, 3 for evening: ") - 1;;
        int numOfTickets = Console.readInt("Enter the number of Tickets");
        int day = Console.readInt("Enter 1 for Monday, 2 for Tuesday.....6 for Saturday, 7 for Sunday: ");
        double disc;
        if(numOfTickets < 10) disc = 1.00;
        else if(numOfTickets < 16) disc = 0.90;
        else disc = 0.85;
        if(day < 6) cost = numOfTickets * prices[buyer][timeOfDay] * disc;
        else cost = numOfTickets * prices[2][timeOfDay] + 0.50;
      public static void main(String[]arguments){new TradeFair1();}
    }

  • How to improve response time of database

    We have 8.0.5 Oracle database with multiple users. that is running on NT. And several clients are accessing database trough application. The response time is really slow. How can I make access faster and where can I make my changes to take effect.
    Thank you.

    I tried several times to open/print The white paper on following address but always got an error something like 'There is an error on this document (14)':
    http://otn.oracle.com/products/reports/pdf/275641.pdf
    Can U please help to resolve this problem so that I can open this doc in Acrobat PDF viewer. I need this paper urgently as explained at the start of this question.
    Tariq

  • How to improve run time

    Hi!
    So attached are the codes I had for retrieving data from a network analyzer. I wanted to divide the sweep range into 800 subintervals, to run several times on each sub, and to generate an averaged data point for that subinterval. Now it takes me 30s to run once on each subinterval, so in total that's gonna take me over 20hours, which is way too much... I am just wondering if there's a way to drastically reduce the total run time to, say 1h? Thanks!
    Attachments:
    QCM_new.vi ‏146 KB
    Retrieve_Data.vi ‏154 KB
    Merge and Plot Data Sets.vi ‏37 KB

    First, get rid of all the timed structures. I don't know what you think they do but at best, all they will actually do is report that they are running late. If a GPIB Write takes x number of msec, then that is how long it will take. The timed structures are just adding overhead. Use the error in/error connections to enforce dataflow and use the VISA functions instead of the low level GPIB. Make sure to add error in/error out connections to your subVIs. Move the file write out of the loop and use a producer/consumer architecture.
    Finally, as I hinted, the GPIB communication speed is dependent on how many bytes you read and write. The instrument itself may not be capable of high speed communication. GPIB itself is not really designed for high speed communication.
    I'll also mention that changing the timeout points to a fault in your code. You really aren't tracking errors, but if you did and got timeout errors, then you need to fix that. You are perhaps not sending a correct command, the instrument is not sending the correct termination, whatever.

  • How to improve lag time for WVC-210 for remote viewing

    Hi,
    My 2 camera WVC-210 is all setup.  When I operate the camera remotely, I instanly hear the lens motor operate but there is aproximately 30 to 60 seconds lag time before the video is refreshed.  This can be very frustrating at time. I have both cameras set up wireless.
    Can somebody first explain to me why this happens and what I can do to improve the lag time.  Perhaps I should tweak some settings.  I would also consider buying what ever gadget is needed to make it work better.
    Just to review my problem.  Sound is instant but video lags.
    Thank you all in advance,
    Rod

    May I ask if this is also happening if you’re not viewing the camera remotely? Have yoy tried adjusting the sensitivity of the WVC210?

  • How to improve response time of queries?

    Although it looks that that this question relates to Reports but actually the problem is related to SQL.
    I have a Catalogue type report which retrieves data and prints. That is not much calculations involved.
    It uses six tables.
    The data model is such that I have a separate query for each table and then all
    these tables are liked thru link tool.
    Each table contains 3000 to 9000 rows but one table contains 35000 rows.
    The problem is that the report is taking too much time - about 3-1/2 hours while
    expectation is that it should take 20 to 40 minutes max.
    What can I do to reduce the time it takes to produce report.
    I mean should I modify data model to make a single query with equi-join?
    A)Specially I want to know what is traffic between client and server when
    1) we have multiple quieries and LINK tool is used
    2) Single query and equi-join is used
    B)Which activity is taking most of time ?
    1) Retrieving data from server to client
    2) Sorting according to groups (at client) and formating data and saving in file
    Pl. guide.
    Every body is requested to contribute as per his/her experience and knowledge.
    M Tariq

    Generally speaking, your server is faster than your PC (if it is not, then you have bigger problems than a slow query), let the server do as much of the work as possible, particularly things like sorting, and grouping. Any calculations that can be pushed off onto the server (e.g. aggregate functions, cola + colb etc.) should be.
    A single query will always be faster than multiple queries. Let the server do the linking.
    The more rows you return from the server to your PC, the more bytes the network and your PC have to deal with. Network traffic is "expensive", so get the result set as small as possible on the server before sending it back over the network. PC's generally have little RAM and slow disks compared to servers. Large datasets cause swapping on the PC, this is really expensive.
    Unless you are running on a terribly underpowered server, I think even 30 - 40 minutes would be slow for the situation you describe.

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this?
    I dont know how to check the containsKey using jstl tags?
    <%
         LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");
         TreeSet nocSet               =     (TreeSet)request.getAttribute("nocSet");
         Iterator     yearMapIt     =     yearMap.keySet().iterator();
         while(yearMapIt.hasNext())
              int yearValue               =     (Integer)yearMapIt.next();
    %>
    <tr>
              <td><%=yearValue%></td>
    <%
              LinkedHashMap monthMap     =     (LinkedHashMap)yearMap.get(yearValue);
              Iterator     nocSetIt     =     nocSet.iterator();
              while(nocSetIt.hasNext())
                   String nCase=(String)nocSetIt.next();
                   if(monthMap.containsKey(nCase))
                        String count     =     (String)monthMap.get(nCase);
    %>
                        <td> <%= count %> </td>
    <%            }
                   else
    %>          
                        <td> 0 </td>     
    <%          
    %>
    </tr>
    <% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM

    <c:forEach var="yearMap" items="${requestScope.yearMap}">
         <th> <c:out value="${yearMap.key}"/> </th>
    <bean:define id="monthMap" value="${yearMap.value}"/>
    <c:forEach var="nocSet" items="${nocSet}">
    then how to write containsKey using tags??

Maybe you are looking for