Question about Finder-Load-Beans flag

Hi all,
I've read that the Finder-Load-Beans flag could yield some valuable gains in performance
but:
1) why is it suggested to do individual gets of methods within the same Transaction
? (tx-Required).
2) this strategy is useful only for small sets of data, isn't it? I imagine I
would choose Finder-Load-Beans to false (or JDBC) for larger sets of data.
3) A last question: its default value is true or false ?
Thanks
Francesco

Because if there are different transactions where the get method is called
then the state/data of the bean would most be reloaded from the database. A
new transactions causes the ejbLoad method to be invoked in the beginning
and the ejbStore at the end. That is the usual case but there are other ways
to modify this behavior.
Thanks
Gaurav
"Francesco" <[email protected]> wrote in message
news:[email protected]
>
Hi thorick,
I have found this in the newsgroup. It's from R.Woolen answering
a question about Finder-Load-Beans flag.
"Consider this case:
tx.begin();
Collection c = findAllEmployeesNamed("Rob");
Iterator it = c.iterator();
while (it.hasNext()) {
Employee e = (Employee) it.next(); System.out.println("Favorite color is:"+ e.getFavColor());
tx.commit();
With CMP (and finders-load-beans set to its default true value), thefindAllEmployeesNamed
finder will load all the employees with the name of rob. The getFavColormethods
do not hit the db because they are in the same tx, and the beans arealready loaded
in the cache.
It's the big CMP performance advantage."
So I wonder why this performance gain can be achieved when the iterationis inside
a transaction.
Thanks
regards
Francesco
thorick <[email protected]> wrote:
1) why is it suggested to do individual gets of methods within thesame Transaction
? (tx-Required).I'm not sure about the context of this question (in what document,
paragraph
is this
mentioned).
2) this strategy is useful only for small sets of data, isn't it? Iimagine I
would choose Finder-Load-Beans to false (or JDBC) for larger sets ofdata.
>
If you know that you will be accessing the fields of all the Beans that
you get back from a
finder,
then you will realize a significant performance gain. If one selects
100s or more beans
using
a finder, but only accesses the fields for a few, then there may be some
performance cost.
It could
depend on how large some of the fields are. I'd guess that the cost
of 1 hit to the DB per
bean vs.
the cost of 1 + maybe 1 more hit to the DB per bean, would usually be
less. A performance
test using
your actual apps beans would be the only way to know for sure.
3) A last question: its default value is true or false ?The default is 'True'
-thorick

Similar Messages

  • Question about message driven bean

    hello
    i can find tons of tutoriala about developing session bean and entity bean by using jdeveloper,but can't find even one article that tell me how to develop message driven bean and jms by using jdeveloper,who can help me,where can i find such tutorial?
    thank you!

    I setup breakpoints setting thru the MDB examples in j2eesdk 1.4.
    I realize that the message to the being are being process sequentially.
    Is there a way to process message in MDB concurrently?
    Thank you.

  • Questions about the load processing of OpenSparc T1 Dcache

    Hi,
    I have some questions about OpenSparc T1 Dcache load processing.
    During load processing, subsequent loads to the same address need to search the store buffer for a valid store to that address. If there is a CAM hit, data is sourced from the store buffer, not from the D-cache, and no load request will be sent to the L2.
    What if there is no CAM hit. Would the load request be sent to L2? Or would Dcache be checked for the requested data?
    If the load request would be sent to L2, what next? Would the Dcache be updated?
    Thanks

    Store buffer is checked for Read after Write (RAW) condition on loads. If there is full RAW - i.e. full data exists in the store buffer - then the data is bypassed and no D cache access happens.
    If RAW is partial (e.g. word store followed by a double word load) then load is treated as a miss. Store is allowed to complete in L2 cache and then load instruction is completed.
    For the miss in STB, D cache is accessed. If hit, data is fetched from D$. If miss, data is fetched from L2$ and allocated in D$.

  • Question about Find and Replace PL/SQL option in Forms Builder

    Dear All
    I have a small question .
    I am using Find and Replace PLSQ/SQL in forms Builder ( Edit - Find and Replace PLSQL) to search any code in a form.
    Let say I am searching for EMP .
    Then all the places is coming where EMP is used as well as EMPloyee , EMPloyee_Desc tables also coming .
    So is there any way to serach only the EMP part .

    If you look closely to the right of the "Find What" field, you should see a button - "Expression". This allows you to add some logic to your search. Alternatively, depending on how you code, you could just look for spaces. For example, if you are looking for EMP and not EMPLOYEE, search for EMP with a blank space before and after it (assuming you code this way) or use something like this \bEMP\b This would work for me because I code the same way I write sentences - each work is separated by spaces.
    <blockquote> EMPLOYEE := EMP || ' - ID';</blockquote>
    In this example, seaching for EMP with a blank space after would find what I wanted. However, if you only search for a trailing blank, you may end up also finding words like tEMP. This is where have a blank space before each word is helpful.
    Other, more valuable expressions could be written to accomplish your task. Refer to the Forms Builder Online help for more information about using Expressions in the Find and Replace search window.

  • Iphone 5s Lost/Stolen - Questions about Find my Phone on ios7

    OK, I have done something very stupid but I need some advice anyway, will likely not ever get my phone back but I'm curious as to how it works.
    1) I bought an unlocked iPhone 5s for travel.
    2) I installed "find my phone" before leaving Canada
    3) I came to China to live for 6 months and I inserted a China Unicom SIM card.
    4) I purchased a cell phone plan that has basically no data
    5) I then went into my settings and turned off Cellular Data for all apps (this was the stupid thing that I did without thinking).
    Therefore, find my phone is off in Cellular Data.  Last night my phone was lost and/or stolen.  I immediately tried to use "find my phone."  As soon as it said my device was offline I realized what I had done and how stupid it was. I did still set the lock and send it a messages so if for some reason it comes online it will be locked, but....here are my questions:
    1) Will "find my phone" work over Wifi automatically if Cellular Data is off?
    2) If my phone IS in the hands of a thief, is this even helpful?  Could a thief just pop out my SIM card, insert their SIM card, somehow bypass my fingerprint/passcode (I know there are hacks for that) and then just turn off / disable Find My Phone?  Because if they put in their SIM card and use 3G, but haven't started using Wifi yet, then "find my phone" won't be activated yet, correct?
    3) So is my only hope to leave a thief with a worthless brick that they take the phone somewhere and try to use it on Wifi to set it up?  IF they insert a new SIM and manage to hack my passcode, BUT they fail to deactivate "find my phone" and then they join a wireless network, would my phone immediately lock

    Use Find My iPhone to track iPhone only if the following conditions are met:
    1. Find My iPhone is ON and activated.
    2. iPhone has Internet connection.
    3. iPhone is not switched OFF.
    To track
    https://www.icloud.com/#find
    Lost or Stolen
    http://support.apple.com/kb/HT5668

  • Flash newbie questions about slow loading site

    Hi all. I am new to Flash and web-site building in general and I have been learning while doing. Its fun, but frustrating. I really need some help, hope someone out there with Flash experience can give me some advice.
    My problem is this: I built a Flash website, but it is painfully slow to load up (3-5 minutes via cable modem) when I visit the site (via Firefox, etc). Once it does load up, everything is fine with navigation. I'm having a hard time figuring out why its taking so long to load up on the web because, basically, I don't know how to trouble shoot. Hope you guys can help!
    Details: the site is just a portfolio site with pictures and a few motion-things, no complicated animations. The swf file is about 9MB. I do have a flash preloader, but it doesn't show up until after the 3-5 minute "load-up" time. When I do the testing via Flash, its Ok and doesn't show the lag. But once I upload the website files and try to visit my website, the load time problem occurs.
    My thoughts:
    - do I have to purge my Flash file/library of unused images before creating my swf file?
    - Is there a problem with my html code in my index file?
    - because it is a portfolio site, I've got about 90 images on it, each image about 300-400K.  Is this too big, or about right?
    Please help! Sorry for the long email, just desperate for help. Thanks in advance for any advise!!!! Just in case, here is the html code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Acme Company</title>
    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    <style type="text/css">
    <!--
    body {
    background-color: #000000;
    -->
    </style>
    <link href="favicon.ico" rel="icon" />
    </head>
    <center>
    <body>
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','800','heigh t','600','title','Acme Company','vspace','100','src','development files/company site_AS2_2008 OCT_final','loop','false','quality','high','plugin spage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgco lor','#000000','scale','exactfit','movie','develop ment files/company site_AS2_2008 OCT_final' ); //end AC code
    </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="600" vspace="100" title="Acme Company">
    <param name="movie" value="development files/comapny site_AS2_2008 OCT_final.swf" />
    <param name="quality" value="high" /><param name="BGCOLOR" value="#000000" /><param name="LOOP" value="false" /><param name="SCALE" value="exactfit" />
    <embed src="development files/company site_AS2_2008 OCT_final.swf" width="800" height="600" vspace="100" loop="false" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#000000" scale="exactfit"></embed>
    </object></noscript>

    Yeah I'm with Ned on this one. Dynamically loading your images is the way to go. The fact that you are new to Flash, try this tutorial (http://www.entheosweb.com/Flash/loading_external_images.asp). As you move along in learning Flash, look for tutorials on actionscript arrays and loading images dynamically. Arrays allow you to call each images from a folder outside your fla. That way your site moves right along without much loading time.
    Hope I was of help,
    -Sly

  • Question about Spring Loaded links icon

    Was wondering how I am able to change the icon for the spring loaded links on the dock, I know there is a method. How would I go about doing that?
    Intel based iMac; 13" MacBook   Mac OS X (10.4.9)  

    MrToberlone, all the icons in the Dock are aliases.
    You can drag any URL from the top address window of your browser by grabbing it on its icon and dragging it to the Dock (to the right of the hairline on the side with Trash.) It will turn into a "spring". You can delete any spring icon by dragging it off the Dock and "poofing" it. Have fun
    -mj
    [email protected]

  • A Question About Message Driven Bean Exception Handling

    "Your onMessage method should handle all exceptions. It must not throw checked exceptions, and throwing a RuntimeException is considered a programming error."
    The above sentence is from the JMS documentation.
    I will use a message driven bean for guarenteeing to send an email with some critical info in case of an unexpected system failure. Say I was not able to save into db some critical info, therefore I want to send that info to myself with a mail to be able to handle that situation manually. Now in case of failure I will send a message to a queue which contains the critical info, and a message driven bean will listen for the message and send email to me. But what if the message driven bean fails ? If I am to handle any exceptions on my onMessage method, how will the messaging system be able to redeliver that message ? It seems to me the message will not remain in the queue anymore(I have consumed it) ?
    Any help appreciated, thanks in advance.

    Fatih.Karakoc wrote:
    "Your onMessage method should handle all exceptions. It must not throw checked exceptions, and throwing a RuntimeException is considered a programming error."
    The above sentence is from the JMS documentation.
    I will use a message driven bean for guarenteeing to send an email with some critical info in case of an unexpected system failure. Say I was not able to save into db some critical info, therefore I want to send that info to myself with a mail to be able to handle that situation manually. Now in case of failure I will send a message to a queue which contains the critical info, and a message driven bean will listen for the message and send email to me. But what if the message driven bean fails ? If I am to handle any exceptions on my onMessage method, how will the messaging system be able to redeliver that message ? It seems to me the message will not remain in the queue anymore(I have consumed it) ?
    You can configure your queue to guarantee delivery. If you use JTA you can also make it transational, so the message is put back on the queue in the event of failure. Your configuration should also include max retries and a failure queue to make sure you don't get stuck in an infinite loop where a message can never be processed.
    Which app server are you using? WebLogic makes it pretty easy to set these config parameters.
    %

  • Question about Finder file listing order when sorting by "Name"

    I quite often add a suffix to some of my file names when I save them so that I can keep a complete history of changes. For example, I usually add "_000" at the end, and progress to "_001" through "_009". However after "_009" I don't increase the next digit to "_010" but instead, after "_009" comes "_00A" then "_00B" on to "_00Z" and then to "_010". I have been doing this for a while now (several years) and it has worked well for me.
    I have noticed in the finder window, when in "List" view a file ending in "_00A" is listed lexicographically before a file ending in "009" instead of the other way around.
    I think that this is due to my UNIX Locale being set to LANG="en_US.UTF-8"
    1. Is this a correct assumption?
    I would like it to be listed in POSIX order.
    2. Is there a way I can make just specific folders list file names in POSIX order?
    I was thinking of changing my Language to POSIX using the terminal command:
    $ export LANG=POSIX
    but this may have undesirable effects with the rest of Mac OS X.
    3. Is there a finder preference (plist item) I can change so this just changes the listing order to POSIX? (I have no problem if all Finder windows use this sort order for file names.)
    Thank you in advance.
    Jeff Cameron

    I don't know of a GUI way to change it or if you unix trick will work/do anything, but the Mac OS has always sorted that way, if I'm understanding you correctly. It looks at the entirety of the naming and puts 2 immediately after 1 instead of putting 10 there like Windows does (and Alpha comes before numeric).
    I don't think the unix underpinnings changed sort order, but I may be remembering wrong. It's been a long time since OS 9. That's why I don't think the LANG switch will work.

  • Question about Finder Behavior

    When I go to Finder/Go/Network, sometimes the Finder won't open the Network window, and when it does, the icons are won't stay in icon-view mode. Any ideas what the problem might be?
    Also, when I run System Maintenance Scripts, will they clean up all the partitions? Thanks.

    The maintenance scripts only run on the active startup volume. If you have other partitions that do not have OS X installed, then there's no need to run the maintenance scripts on those volumes. If you do have OS X installed on the other volumes, then you will have to start up from them to run the maintenance scripts on those volumes.
    Note that with Tiger there's little need to force the maintenance scripts to run unless you turn off your computer. If the computer is simply put to sleep, then the scripts will be run automatically at or near that time. With Tiger and later OS X uses launchd to run the maintenance scripts and no longer relies on using cron. Though not significantly different in Leopard there are some improvements in this behavior over those in Tiger. See the following excerpt for The XLab FAQs FAQ on maintenance scripts:
    *Scheduling under Tiger*
    Under Tiger, the new launchd process invokes each script on a schedule specified in a script-specific property list (.plist file) in the /System/Library/LaunchDaemons directory. The specific property list for each script is as follows:
    daily script: com.apple.periodic-daily.plist
    weekly script: com.apple.periodic-weekly.plist
    monthly script: com.apple.periodic-monthly.plist
    How the timer used by launchd handles sleep time has led many to believe that they no longer need to run the maintenance scripts, and that the scripts are run automatically if the Mac was asleep or shutdown at the scheduled time, ala third-party utilities such as Anacron. However, this is untrue.
    While it may appear that launchd executes the maintenance scripts "on the fly" if the computer is asleep or shutdown at the appointed time, this is a side effect of how the timer treats time the computer has spent in sleep mode. The timer used by launchd does not count sleep time. If your Mac is asleep at the scheduled time at which a given script is supposed to run, the script may run later that day, at a time shifted by the amount of time the Mac was asleep. However, if you restart your Mac before the time-shifted execution time, pending events are lost and the script will not run off-schedule: the next chance for the script to run will be at its regularly scheduled time.
    If you regularly restart your Mac and the computer regularly sleeps or is shutdown at the scheduled times, it's possible that the scripts will never run, hence one should still run them manually, say on a weekly basis.
    The sleep time shift is also cumulative. For example, if you don't restart your Mac for weeks or months at a time, but let it sleep when not in use, this can result in:
    The daily script running once every few days or never.
    The weekly script once every few weeks or never.
    The monthly script once every few months or never.
    The time shift in each case is the total amount of time the Mac has spent in sleep since its last restart. If you have a process that writes heavily to the logs, you can wind up devoting good hard disk space to the log files.

  • Question about finder-building

    hi once again, new mac user, new macbook pro. when i click on 'finder' in the upper left corner, scroll down to 'services' it just has 1 greyed out section that says "building...". what does that mean and what should be showing there?

    Like you, I had the Services "Building", and it never stopped building over a few days. Then I turned the computer off and rebooted - now Services are no longer building. However, for every application, I'm getting "No Services Apply" - no matter what I do within Services Preferences and checking and unchecking boxes.
    (And the search through the forums continues for a solution... I did find one help message from Apple that suggests reinstalling the OS. That option doesn't appeal.)

  • Question about Finder thumbnails

    A nice way of assigning custom thumbnails to items in Finder is by bringing up the Get Info panel of a given item, and pasting a copied image (either from the web or an image viewer) to the thumbnail editor in the top left corner.
    However, something I've noticed is Finder's inconsistency with resolution. If I'm lucky, the thumbnail will retain the resolution of the copied image, so that no matter what size I readjust the items in a Finder window, the thumbnail will stay crisp. But a lot of the time, and sometimes as soon as the image has copied, Finder seems to decrease the resolution. A way of checking is to copy the thumbnail back from the Get Info panel and paste it into an image viewer. Lo and behold, the image is lower res.
    Does anyone know if there is any way to control this and maintain high res thumbnails?
    Thanks very much.

    Hi, what format are the Pastes o begin with?
    I think Finder/OSX prefers PNGs.

  • Question about Google Translator with flags for BC website

    Hello
    I am looking for a solution for my website , I am using Business Catalyst as platform to create the website.  I am looking for simple one code/plugin/HTML solution which I can copy paste in the website for the translation. I want to put google translator with flags on my website in the top right hand side. I want to translate my website in 9 languages and want to put 9 country flags on the top right hand side,  which translate languages on click event on "same page" , I want the translation must take place at the same page after clicking on the flag. How-ever I successfully integrated google translate with dropdown option but want to integrate google flag translations on my website.
    Please let me know what can be done here.
    Regards'

    Don't use google translate, it's the worst user experience you can ever give a user and makes the site look like it was designed by a 12 year old with a grammer problem. Machine translation is no were near anything good for a production website currently and even more so for non latin languages like Japanese, Chinese, Korean etc.
    Case and point, throw a few lines of text into google translate, then reverse the translation back to english, you'll see my point.

  • Question about image loading problem

    Dear Java Gurus,
    I am writing a simple Java Applet application. Basically what it does is every 3 seconds, it tries to get an image from a server and display it (also based on the browser�s client size to do some resize of the image to fit the width of the browser�s client area). But frequently I got this kind of exceptions:
    ----------------------------- Exception 1 --------------------------------------
    Uncaught error fetching image:
    java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at sun.awt.image.PNGFilterInputStream.read(Unknown Source)
    at java.util.zip.InflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at sun.awt.image.PNGImageDecoder.produceImage(Unknown Source)
    at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
    at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
    at sun.awt.image.ImageFetcher.run(Unknown Source)
    ----------------------------- Exception 2 ------------------------------------------
    sun.awt.image.PNGImageDecoder$PNGException: crc corruption
    at sun.awt.image.PNGImageDecoder.getChunk(Unknown Source)
    at sun.awt.image.PNGImageDecoder.getData(Unknown Source)
    at sun.awt.image.PNGFilterInputStream.read(Unknown Source)
    at java.util.zip.InflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at sun.awt.image.PNGImageDecoder.produceImage(Unknown Source)
    at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
    at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
    at sun.awt.image.ImageFetcher.run(Unknown Source)
    Which will cause the image goes to blank in the browser and also degreed down the performance, and I do not know where they are coming from. I tried to put try-catch blocks at possible method calls, but still it does not catch these kind exceptions.
    ---------------------------- My Source Code ----------------------------
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.util.*;
    import java.applet.*;
    import javax.swing.*;
    import java.awt.event.*;
    // This is for Popup Menu
    class PopupListener extends MouseAdapter
    JPopupMenu popup;
    PopupListener(JPopupMenu popupMenu)
    popup = popupMenu;
    public void mousePressed(MouseEvent e)
    maybeShowPopup(e);
    public void mouseClicked(MouseEvent e)
    maybeShowPopup(e);
    public void mouseReleased(MouseEvent e)
    maybeShowPopup(e);
    private void maybeShowPopup(MouseEvent e)
    if (e.isPopupTrigger())
    popup.show(e.getComponent(), e.getX(), e.getY());
    // Image Component who contains the image and will be hosted in the ScrollPane
    class ImageComponent extends JComponent
    Image onscrImage;
    Dimension comSize;
    ImageComponent(Image image)
    onscrImage = image;
    setDoubleBuffered(true);
    comSize = new Dimension(onscrImage.getWidth(null), onscrImage.getHeight(null));
    setSize(comSize);
    public synchronized void paint(Graphics g)
    super.paint(g);
    g.drawImage(onscrImage, 0, 0, this);
    public Dimension getPreferredSize()
    return comSize;
    // Update the image with new image
    public void setImage(Image img)
    onscrImage = img;
    comSize = new Dimension(onscrImage.getWidth(null), onscrImage.getHeight(null));
    setSize(comSize);
    // The main Applet hosted in the browser
    public class MWRemotingApplet extends JApplet
    //Media Tracker to manage the Image loading
    MediaTracker medTracker;
    Image my_Image;
    // ScollPane who contains the image component
    JScrollPane scrollPane;
    ImageComponent imgComp;
    // The applet base URL and image filename passed from htm who hosted the Applet
    URL base;
    String filename;
    // Schedules getting the image
    private java.util.Timer timer;
    private int delay = 3000;
    private boolean bFitToBrowser = false;
    private int iVScrollbarWidth = 20;
    // Popup Menu
    JPopupMenu jPopupMenu;
    JMenuItem popupMenuItem;
    public void init()
    // Set the layout to GridLayout then the it can fill in the Applet
    setLayout(new GridLayout());
    try
    // getDocumentbase gets the applet path.
    base = getCodeBase();
    // Get the image file name from the parameter
    filename = getParameter("filename");
    catch (Exception e)
    JOptionPane.showMessageDialog(null, "Failed to get the path and filename of the image!", "Message", 0);
    return;
    // Create the Media Tracker
    medTracker = new MediaTracker(this);
    // Download the image from the remote server
    // If the image width is greater than the width of the current browser client area
    // Resize the image to fit the width
    // This is because for some reason, this will lead to image not refreshing
    DownloadImage();
    //Add the popup menu
    jPopupMenu = new JPopupMenu();
    popupMenuItem = new JMenuItem("Fit to Browser");
    popupMenuItem.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event) {
    bFitToBrowser = !bFitToBrowser;
    if(bFitToBrowser)
    popupMenuItem.setText("Original Size");
    FitToBrowser();
    else
    popupMenuItem.setText("Fit to Browser");
    DownloadImage();
    if(my_Image != null)
    imgComp.setImage(my_Image);
    jPopupMenu.add(popupMenuItem);
    // Create the image component
    imgComp = new ImageComponent(my_Image);
    //Add listener to the image component so the popup menu can come up.
    MouseListener popupListener = new PopupListener(jPopupMenu);
    imgComp.addMouseListener(popupListener);
    // Create the scroll pane
    scrollPane = new JScrollPane(imgComp);
    scrollPane.setDoubleBuffered(true);
    // Catch the resize event of the Applet
    addComponentListener(new ComponentAdapter()
    public void componentResized(ComponentEvent e)
    super.componentResized(e);
    if(bFitToBrowser)
    FitToBrowser();
    else
    DownloadImage();
    if(my_Image != null)
    imgComp.setImage(my_Image);
    //Add Components to the Applet.
    add("Center", scrollPane);
    validate();
    // Start the timer to periodically download image
    // from remote server
    public void start()
    timer = new java.util.Timer();
    timer.schedule(new TimerTask()
    //creates a timertask to schedule
    // overrides the run method to provide functionality
    public void run()
    DownloadImage();
    if(my_Image != null)
    imgComp.setImage(my_Image);
    , 0, delay);
    public void stop()
    timer.cancel(); //stops the timer
    public synchronized void DownloadImage()
    if(my_Image != null)
    my_Image.flush();
    my_Image = null;
    try
    my_Image = getImage(base, filename);
    catch (Exception e)
    my_Image = null;
    return;
    medTracker.addImage( my_Image, 0 );
    try
    medTracker.waitForAll();
    if ( my_Image != null )
    medTracker.removeImage(my_Image);
    catch (InterruptedException e)
    JOptionPane.showMessageDialog(null, "waitForAll failed while downloading the image!", "Message", 0);
    catch(Exception e1)
    System.out.println("Get Exception = " + e1.getMessage());
    e1.printStackTrace();
    if(bFitToBrowser)
    FitToBrowser();
    else if(my_Image.getWidth(null) > this.getSize().width)
    FitToWidth();
    // Resize the image to fit the browser width and height
    public synchronized void FitToBrowser()
    if(my_Image != null)
    my_Image = my_Image.getScaledInstance(this.getSize().width - 5, this.getSize().height - 5, java.awt.Image.SCALE_SMOOTH);//java.awt.Image.SCALE_AREA_AVERAGING);//java.awt.Image.SCALE_SMOOTH);
    medTracker.addImage( my_Image, 0 );
    try
    medTracker.waitForAll();
    medTracker.removeImage(my_Image);
    catch (InterruptedException e)
    JOptionPane.showMessageDialog(null, "waitForAll failed!", "Message", 0);
    catch (Exception e1)
    System.out.println("Get Exception = " + e1.getMessage());
    e1.printStackTrace();
    // Resize the image to fit the browser width only
    public synchronized void FitToWidth()
    if(my_Image != null)
    int fitHeight = (int)((this.getSize().width - iVScrollbarWidth)*(my_Image.getHeight(null)+0.0)/my_Image.getWidth(null));
    my_Image = my_Image.getScaledInstance(this.getSize().width - iVScrollbarWidth, fitHeight, java.awt.Image.SCALE_SMOOTH);
    medTracker.addImage( my_Image, 0 );
    try
    medTracker.waitForAll();
    medTracker.removeImage(my_Image);
    catch (InterruptedException e)
    JOptionPane.showMessageDialog(null, "waitForAll failed!", "Message", 0);
    catch (Exception e1)
    System.out.println("Get Exception = " + e1.getMessage());
    e1.printStackTrace();
    }

    [url http://forum.java.sun.com/thread.jsp?thread=518979&forum=14]Please[url http://forum.java.sun.com/thread.jsp?thread=518977&forum=32] do[url http://forum.java.sun.com/thread.jsp?thread=518973&forum=37] not[url http://forum.java.sun.com/thread.jsp?thread=518978&forum=42] crosspost. Or [url http://forum.java.sun.com/thread.jsp?forum=7&thread=518976]double-post. Or post to the wrong forum. Or use non-sense subject.

  • REGEX: question about finding Overlapping matches using regular expressions

    I have the following problem.
    Say for my pattern I use:
    Pattern pattern = Pattern.compile("AAA");
    Matcher matcher = pattern.matcher("AAAAAA");when I run a loop
    while (matcher.find())
    System.out.println("Match Found: "+matcher.start()+" "+matcher.end());I get 2 Hits shown in the following output:
    Match Found: 0 3
    Match Found: 3 6
    therefore the regex is seeing the first AAA then the second AAA.
    I want it to find the other AAA's in there that are overlapping the other two finds i.e. I want the output to find
    AAA from 0 to 3
    AAA from 1 to 4
    AAA from 2 to 5 and finally
    AAA from 3 to 6
    thereby including the overlapping finds.
    How can I do this using regex? what am I missing that prevents the overlapping matches to be found? Do I need a quantifier?
    Thanks for the help!

    While the solutions above work fine with the given input, they don't really find all overlapping matches. They just find the longest possible match at each start position. Here's a more thorough approach:import java.util.*;
    import java.util.regex.*;
    public class Test
      public static List<String> matchAllWays(String rgx, String str)
        Pattern p = Pattern.compile(rgx);
        Matcher m = p.matcher(str);
        List<String> result = new ArrayList<String>();
        int len = str.length();
        int start = 0;
        int end = len;
        while (start < len && m.region(start, len).find())
          start = m.start();
          do
            result.add(m.group());
            end = m.end() - 1;
          } while (end > start && m.region(start, end).find());
          start++;
        return result;
      public static void main(String[] args)
        List<String> matches = matchAllWays("a.*a", "abracadabra");
        System.out.println(matches);
    }This approach requires JDK 1.5 or later; that's when the regions API was added to Matcher.

Maybe you are looking for

  • How to sum space delimited hex values in a string, and do other stuff?

    Hello I am trying to write a Bourne shell script that takes a non-constant-length character string as input, converts each character to hexidecimal value, sums each value, takes the two's complement of the sum, logically ANDS it with FF, and if any o

  • Save and Close the PDF form

    I've created PDF Form (Acrobat XI standard) with various field and button for sending the link of document location by outlook mail. I need the adobe java script for save the document in same location and close the document while i use the button for

  • J2SE 5.0 CORBA logging

    I am running the J2SE 5.0 update 2 CORBA features. Just before a CORBA exception is thrown the logging service logs out the following stack trace. I was wondering if there is a way to disable only this function�s console logging? Apr 14, 2005 3:03:27

  • Oracle Scheduler Steps End time (log_date) is completed with lag ?

    We have a job with 4 steps CRM_STG_S1,CRM_STG_S2,CRM_STG_S3,CRM_STG_S4 each step will start after its previous got completed , and each will run for 10 Mins no other dependency or condition, I started the steps at 1.05 PM Here the step one got starte

  • File name renamed from Skydrive import

    When I Open in a PDF in Skydrive, the resulting PDF in Adobe Reader (iPhone) has its file name renamed to File_xxxxxxxxxxxxxxxxxxxxx. How do I prevent this from happening?