Opendir - pattern usage

Is it possible to get subset of files in given directory, e.g. for file pattern search instead of entire directory list.
I.e. instead of below, getting only a subset ?
// Open directory
struct dirent           dp = (struct dirent ) buff;
DIR* l_dir = opendir(p_filepath);
if (l_dir != NULL } {
// Read in entries in the directory
while ((readdir_r(l_dir, dp)) != NULL)
RWCString l_filename = dp->d_name;
if (l_filename != "." && l_filename != "..")
l_dirlist.append(l_filename); // Entire directory in list
closedir(l_dir);

What types of patterns are other Creator users
employing in their development? I am curious to know
if people are just doing all of their business and
display logic in a single page bean or if they are
applying some abstraction and using page beans only
for views.
I plan to use page beans only for views myself and
employ some data access objects and business objects
to add some abstraction, but is there a standard or
recomended approach to application design with this
new component model?I expect that we will see two common application architecture patterns be used.
The first is fairly simple, with components bound directly to database columns, and the corresponding database update logic embedded directly in the event handlers in a page bean. Creator has some particular support to enable developing this sort of application, because it is targeted to meet the needs of corporate developers who may not understand (or be able to build, or have time to build) data abstraction layers.
On the other hand, more sophisticated or enterprise scale applications, or those built by Java developers who understand object oriented development, and who have already created data abstractions, will want to reuse those objects in the Creator-built applications as well. This is certainly a reasonable thing to do, and you will see Creator evolve some additional support for this model in future versions.
Craig McClanahan

Similar Messages

  • Translation Pattern Usage Report

    I am trying to determine if a translation pattern is still needed.  Is there a report that can be run?  Call Manager Release 6.1.  Thank you.       

    Hi,
    You can try to check in CDR for the Called Party number (Original and Final) if they match the Translation pattern or the Called Party Transformed number (using Mask or Prefix).
    HTH,
    Jagpreet Singh Barmi

  • Pattern usage

    What types of patterns are other Creator users employing in their development? I am curious to know if people are just doing all of their business and display logic in a single page bean or if they are applying some abstraction and using page beans only for views.
    I plan to use page beans only for views myself and employ some data access objects and business objects to add some abstraction, but is there a standard or recomended approach to application design with this new component model?

    What types of patterns are other Creator users
    employing in their development? I am curious to know
    if people are just doing all of their business and
    display logic in a single page bean or if they are
    applying some abstraction and using page beans only
    for views.
    I plan to use page beans only for views myself and
    employ some data access objects and business objects
    to add some abstraction, but is there a standard or
    recomended approach to application design with this
    new component model?I expect that we will see two common application architecture patterns be used.
    The first is fairly simple, with components bound directly to database columns, and the corresponding database update logic embedded directly in the event handlers in a page bean. Creator has some particular support to enable developing this sort of application, because it is targeted to meet the needs of corporate developers who may not understand (or be able to build, or have time to build) data abstraction layers.
    On the other hand, more sophisticated or enterprise scale applications, or those built by Java developers who understand object oriented development, and who have already created data abstractions, will want to reuse those objects in the Creator-built applications as well. This is certainly a reasonable thing to do, and you will see Creator evolve some additional support for this model in future versions.
    Craig McClanahan

  • CUCM SIP Route Pattern Discussion

    Hello,
    I have some questions about SIP route pattern configuration but the main question is I can configure SIP route pattern to match any IP address. so if the user dial any ip address it will hit this route pattern.
    Regards,

    Help -> For this page
    IPv4 Pattern
    (Required) Enter the domain, sub-domain, IPv4 address, or IP subnetwork address.
    For Domain Routing pattern usage, enter a domain name IPv4 Pattern field that can resolve to an IPv4 address. The domain name can contain the following characters: [, -, ., 0-9, A-Z, a-z, *, and ].
    For IP Address Routing pattern usage, enter an IPv4 address the IPv4 Pattern field that follows the format X.X.X.X, where X represents a number between 0 and 255.
    For the IP subnetwork address, in Classless Inter-Domain Routing (CIDR) notation, X.X.X.X/Y; where Y is the network prefix that denotes the number of bits in the address that will be the network address.
    Tip   
    If the SIP trunk supports IPv6 or both IPv4 and IPv6 (dual-stack mode), configure the IPv6 Pattern in addition to the IPv4 pattern.

  • Which Design Pattern and how to design using OOP this scenario

    I am having trouble designing a module, can anybody help me?
    Because it will be hard to maintain this kind of module, I also think that this can test my skill of design pattern usage.
    Requirement
    This is basically an agricultural project (web application). I need to design a module where some calculation takes place.
    There are different crops involved like maize, tomato, okra etc. Each of these crops has different traits.
    Each trait has a measurement scale which lies in integer like 200-1000. Now let's say I have planted the crop and done measurement noted down the traits. Now I want to do some sort of measurement. Some measurements are simple and some are complex.
    Example
    Lets take an example of crop maize. I have recorded observations for 15 traits. (We'll use trait1-trait15 as examples, the actual name can be like plt_ht, yld, etc.)
    I recorded 5 observations for each trait:
    trait1 trait2 trait3 trait5 trait6..... trait15
    01,02,03,04 01,02,03,04 01,02,03,04
    User logs into system and selects his crops and enters data for these observations. I have to calculate either average or sum of the data entered for each trait.
    Complexity / centre of the problem
    So far it's simple but complexity comes when I have some different formulas for some of the traits.
    Example: trait YLD has a formula based on which I have to calculate its value, which may also depend on some other traits. Each different crop can have different traits.
    All this I am able to do - whenever user selects crop I will check for those specific traits and do calculations (if it's not a special trait then I either average or sum it, based on db entry), but there is a lot of hard coding.
    I would like to have suggestions on a better way of handling this.
    My code needs to handle both simple and complex calculations.
    Simple calculations are easy, I have take average of value entered for trait.
    The problem comes when I have to do complex calculations, since each crop have different traits with their own formulas, so to calculate I have to check for crop and then for complex trait. So I have to hardcode the trait name of complex traits.
    Can any tell me how I can design this using Java oops [?!?] so that I can make it generic?
    I have about 10 different crops. Some calculations are specific to crops, so there will be lot of code like the if below:
    hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
    } else if(cropId.equalsIgnoreCase("MZ") && traitName.equalsIgnoreCase("Shelling")) {
        avg=HybridTestDataUtility.calculateAvg(traitName, dataPoint, dataTraits, traitValues,dataPvalues, dataPoint, type);
        avg=avg*dataPoint;
        traitAvg=getMaizeYeild(traitName, traitAvg, population, avg, hybrid, area);
    } else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YLDGM")) {
        avg=HybridTestDataUtility.calculateAvg(traitName, dataPoint, dataTraits, traitValues,dataPvalues, dataPoint, type);
        //avg=avg*dataPoint;
        Object[] dataValues=getOKRAYield(traitName, traitAvg, population, avg, dividend,hasZeroValue,hybrid,repl);
        traitAvg = (HashMap<String, Float>) dataValues[0];
        hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
    } else if(cropId.equalsIgnoreCase("HP") && traitName.equalsIgnoreCase("w1-w10")) {
        avg=HybridTestDataUtility.calculateAvg(traitName, dataPts, dataTraits, traitValues,dataPvalues, dataPoint, type);
        avg=avg*dataPoint;
        Object[] dataValues=getHotPepperYield(traitName, traitAvg, population, avg,dividend,hasZeroValue,hybrid,repl);
        traitAvg = (HashMap<String, Float>) dataValues[0];
        hasZeroValue = (HashMap<String, ArrayList<String>>) dataValues[1];
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("TLSSG_70")) {
        traitAvg=calculateTLCV(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues,50);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("TLSSG_100")) {
        traitAvg=calculateTLCV(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues,50);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_60")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_90")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("YVMV_120")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_60")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_90")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("TO") && traitName.equalsIgnoreCase("ELCV_120")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_60")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_90")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg,dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("YVMV_120")) {
        traitAvg=tomatoYVMVCalculation(traitName, traitAvg, dataPoint, dataTraits, hybrid, repl, traitValues, dataPvalues);
    } else if(cropId.equalsIgnoreCase("OK") && traitName.equalsIgnoreCase("ELCV_60")) {Can anybody think of a way to make a generic approach to this?

    There are crops and each crop have traits , traits are actually a mesuremet
    scale to decide growth of a seed of a particular crop.
    This module is to for planters to observe growth of seeds sowed of certain
    crops and take down n no of observation for each trait and upload in csv format.Once they enter
    data i have to either avg out the values or sum the values or sometimes
    there are more complex function that i have to apply it may differe for each
    trait .This is the whole module about.Just to give an idea about how they
    will enter data
    Hyubrid(seed) trait1 trait2 trait3 trait5 trait6..... trait15
    Hybrid1 01 02 03 04 01
    HYbrid2 04 06 08 04 01
    HYbrid2 04 06 08 04 01
    HYbrid2 04 06 08 04 01
    HYbrid2 04 06 08 04 01
    Once they enter data in this format i have to give result something like
    this.
    Here avg colum does not necessaryly mean avg it can be sum or any formula
    based resutl.Hybrid is the seed for which they record the observation.
    I have shown avg column only for two tratis it is actually for all the
    traits.
    Hyubrid(seed) trait1 Avg trait2 avg trait3 trait5 trait6..... trait15
    Hybrid1 01 01 02 04 03 04 01
    HYbrid2 04 04 06 10 08 04 01
    HYbrid2 04 04 06 12 08 04 01
    HYbrid2 04 04 06 14 08 04 01
    HYbrid2 04 04 06 12 08 04 01
    Hope this clarifies atleat a but
    The data are not correctly indented but there is no way i can format it.

  • Why issues in the bug tracker are ignored?

    Almost 3 months ago I opened two ticket in Mojarra bug tracker.
    https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1751
    https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1752
    The first one is really important, it limits "redirect after post" pattern usage. I would use flash scope to keep operation status message across second GET request after initial POST request. But the flash scope is broken in RI :-( The issue was discussed on this forum also: http://forums.sun.com/thread.jspa?threadID=5445714.
    I'm wondering why the opened issue have been ignored for 3 months. The issue status is still unconfirmed, but all information required to reproduce the error was provided. I'm really worried about JSF future if the development team ignore the community.
    Fortunately there is a competitor, MyFaces ...
    Marcin

    Hi,
    My complaints about Mojarra team ignorance brought some effect :-) Today morning I got notification that Ed took ownership of
    https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1751
    Thanks,
    Marcin

  • How to track EM usage pattern in a fixed time interval?

    Hi, all.
    I am trying to get an idea of how much EM our system is using at different time during the day in order to find out the EM usage pattern on the ECC6.0 system. From ST02, I only see the current usage and max usage. But there is no history on the EM usage. I checked st03 and came up empty too. Would you know if there is any other way to do that? I guess we can write a custom abap to do it and schedule the job in sm37. But it is probably because I don't know better.
    Please advise.
    Thanks,
    Jonathan.
    Edited by: Jonathan Ma on Jun 24, 2010 5:19 PM

    Anyone, please?

  • Usage of Pattern Development UIElements in NW CE or Ehp1

    Hi All,
    Can we use Pattern Development UIElements in NW CE or Ehp1 ?
    Still I see a message in NWDS saying "ContextualPanel: To be used only by the Portal Platform group. Other usages by applications and customers WILL NOT BE SUPPORTED!" .
    Regards, Anil

    Hi Stefanie,
    I agree with you.
    For example : Pattern Tray UIElement will give you enhanced look & fell interms of layout compared to normal Tray UIElement.
    But coming to the functionaly,Looks like we need to code for collapse and expand features !!!
    1 .If someone is looking for functionality and looking for more look&feel then can they go for Pattern based UIElements ??
    2. How about the support on pattern UIElements going forward in future releases ??
    Regards, Anil

  • Need Usage Pattern Report in OBIEE 11g

    Hi All,
    I have a requirement, where I need to know who logged in, to OBI Application in the last 3 months and who has not. How do I get that? Basing on START_DT in S_NQ_QCCT, I can put a filter with Start Date using BETWEEN RANGE, but since OBIEE logs in only those users who logs in, am not sure how to capture the records for non-logged in users during the same period. I have to report output in a pie chart with the percentages.
    Any help would be highly appreciated, since its an urgent need. Thanks in advance.
    Regards,
    Vinag

    You need to have all users in some custom table and customize the usage tracking BMM model by using outer joins so that you can see user who are not logged in.
    If helps pls mark

  • Azure API Management Usage Pattern for Enterprise - Grouping APIs

    Consider the following scenario:
    I have a 100 people in one org with 4 divisions
    I create on Azure API Management instance
    All 100 people are developing APIs and adding them to this single API management instance
    Can I achieve following? If yes, how?
    I want to group the APIs by those 4 division. Allow access of APIs only if it is added by people in their division. When I say allow access, basically I mean search the APIs and call the APIs.

    You can achieve this by using "Groups". First, you need to have a group per division. You can either manually create the groups and add users to them or if you use Azure Active Directory and enable developers to login with AAD to the portal, then
    their existing group membership will also be available to use.
    Once you have the group set up you need to have a product for each group. You can set the visibility settings of the product so that only members of a given group can see it. Then you can set which APIs the product contains and thus complete the mapping
    of groups to APIs.

  • Keeps crashing, twice today and yesterday, once the day before. No particular pattern I can discern, just normal usage, usually 3-5 tabs open.

    Crashes usually just looking at a web page, not downloading anything, sometimes not even touching computer. So frustrating....

    Two of the four reports seem to be related to known issues, while two were not. One of the two with data shows numerous "closed" bugs so possibly Firefox 22 addresses those issues. The other one sounds as though it could be related to graphics drivers and/or Flash.
    '''Graphics Drivers'''
    Could you try disabling graphics hardware acceleration? Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches and driver updates may cause new incompatibilities.
    You usually need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    orange Firefox button (or Tools menu) > Options > Advanced
    On the "General" mini-tab, uncheck the box for "Use hardware acceleration when available"
    If you restart Firefox, is the issue resolved (or at least improved)?
    '''Flash'''
    The Flash player also has its own acceleration setting that you can disable. See this support article from Adobe: http://helpx.adobe.com/flash-player/kb/video-playback-issues.html#main_Solve_video_playback_issues
    Let us know about any new issues with Firefox 22.

  • Why do I have mysterious cellular data usage (Verizon) every 6 hours on all 3 of my iphone 5's?

    I have recently uncovered mysterious cellular usage on three different iPhones. I am a Verizon customer and discovered this by examining the cellular data use logs. What I found are a long series of mysterious data usage logs. I have visited the Genius Bar at my local Apple Store 3 times now to log notes and discuss the issue. It is being escalated.
    The characterstics are as follows:
    All my family phones have the appropriate IOS and hardware updates (verified by the GeniusBar at my local Apple Store).
    This is occuring across three phones, which happen to all be iphone 5. Two are 5 and the other a new 5s. We do have one iphone 4 in the family but the issue (so far as I can tell), is not happening on it.
    One iphone 5 has IOS 7, the other IOS 6. The new 5s has of course IOS 7.
    Mysterious data use happens even while connected to wifi.
    Each mysterious data use log entry is exactly 6 hours apart. For example: 2:18 AM, 8:18 AM, 2:18 PM, 8:18 PM, 2:18 AM ... etc. It cycles AM and PM, same times, for a day to many days until some condition causes it to change (evolve).
    The times evolve. One day it could be cycling through at one time series, then it changes to another time sequence and continues until the next condition.
    The data usage is anywhere from a few K to many MB. The largest I've seen is over 100 MB.
    The logs clearly show these usages are not due to human interaction. It is a program.
    If cellular connection is used frequently (by the owner), the pattern is hard to pick out. Luckily, my family member is very good about only using wifi whenever possible, so these mysterious use patterns are easy to pick out.
    Verizon allows access to 90 days worth of data logs, so I downloaded and analyzed them. This has been happening for at least 90 days. I have found 298 instances of mysterious use out of 500 total connections to cellular. A total of 3.5 GB of mysterious cellular data has been recorded as used in that 90 days by this phone alone. Only .6 GB of the total cellular data use is legitimate, meaning by the person.
    This issue is occuring across three different phones. Two are iPhone 5, and the third is a recently purchased iPhone 5s. The 5s I have not touched beyone the basic startup. I have left it alone on a desk for 3 days, and looking at the logs, the mysterious data use in the same pattern is occuring.
    So ... I am speaking to both sides, Verizon and Apple to get answers. Verizon puts their wall up at data usage. It doesn't matter how it is being used, you simply need to pay for it. Yes, the evidence I have gathered is getting closer to someting on Verizon's end.
    Before pressing in that direction, I am hoping someone reading this may recognize this issue as a possible iPhone 5 issue ... OR ... you, right now, go look at your data usage logs available through your carrier's web account, and see if you can pick out a pattern of mysterious use. Look especially at the early morning instances when you are most likely sleeping.
    I am hoping this is a simple issue that has a quick resolution. I'm looking for the "ooohhh, I see that now ..." But I am starting to think this might be much bigger, but the fact is, most customers rarely or never look at their data usage details, much less discover mysterious use patterns.
    The final interesting (maybe frightening part) thing about all this is that I discovered while talking to Verizon ... they do not divulge which direction the data is going. This goes for any use, mysterious or legitimate. Is cellular data coming to your phone, or leaving it? Is something pulling data from your phone? We know that it is possible to build malware apps, but the catch with my issue is that it is also happening on a brand new iphone 5s with nothing downloaded to it.
    Thanks for your time

    Thanks for the replies. It took a while not hearing anything so thought I was alone. I have done many of the suggestions already. The key here is that it occurs on both phones with apps, and phones still packaged in a box.
    A Genius Bar supervisor also checked his Verizon data usage log and found the same 6 hour incremental use. Suprisingly, he did not express much intrigue over that. Maybe he did, but did not show it.
    I think the 6 hour incremental usage is the main issue here. I spoke with Verizon (again) and they confirmed that all they do is log exactly when the phone connected to the tower and used data. The time it records is when the usage started. I also found out that the time recorded is GMT.
    What is using data, unsolicited, every 6 hours?
    Why does it change?
    Why does it only happen on the iPhone 5 series and not the 4?
    Since no one from Apple seems to be chiming in on this, and I have not received the promised calls from Apple tech support that the Genius Bar staff said I was suppose to receive, it is starting to feel like something is being swept under the rug.
    I woke up the other day with another thought ... What application would use such large amounts of data? Well ... music, video, sound and pictures of course. Well ... what would someone set automatically that is of any use to them? hmmm ... video, pictures, sound. Is the iPhone 5 succeptible to snooping? Can an app be buried in the IOS that automatically turns on video and sound recording, and send it somewhere ... every 6 hours? Chilling. I noted that the smallest data usage is during the night when nothing is going on, then it peaks during the day. The Genius Bar tech and I looked at each other when I drew this sine wave graph on the log print outs during an appointment ...

  • Copyright Question about Adobe Patterns

    I have created illustrations for a book and am using Adobe Photoshop Elements to "color in" my drawings. In addition to the patterns which came with my program, I have downloaded patterns from Adobe Exchange. How would you suggest I reference/give credit to Adobe in my publication since these patterns are under copyright protection?

    Unless you sell it as your own creation (that is the pattern template/ swatches, not the result), the usage of provided content is covered in the EULA. No need to make any extra mention of specific stuff beyond perhaps a generic © Adobe for the relevant parts. For third-party content that may be different, but you should find the relevant info from the authors there...
    Mylenium

  • Massive memory hemorrhage; heap size to go from about 64mb, to 1.3gb usage

    **[SOLVED]**
    Note: I posted this on stackoverflow as well, but a solution was not found.
    Here's the problem:
    [1] http://i.stack.imgur.com/sqqtS.png
    As you can see, the memory usage balloons out of control! I've had to add arguments to the JVM to increase the heapsize just to avoid out of memory errors while I figure out what's going on. Not good!
    ##Basic Application Summary (for context)
    This application is (eventually) going to be used for basic on screen CV and template matching type things for automation purposes. I want to achieve as high of a frame rate as possible for watching the screen, and handle all of the processing via a series of separate consumer threads.
    I quickly found out that the stock Robot class is really terrible speed wise, so I opened up the source, took out all of the duplicated effort and wasted overhead, and rebuilt it as my own class called FastRobot.
    ##The Class' Code:
        public class FastRobot {
             private Rectangle screenRect;
             private GraphicsDevice screen;
             private final Toolkit toolkit;
             private final Robot elRoboto;
             private final RobotPeer peer;
             private final Point gdloc;
             private final DirectColorModel screenCapCM;
             private final int[] bandmasks;
             public FastRobot() throws HeadlessException, AWTException {
                  this.screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                  this.screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
                  toolkit = Toolkit.getDefaultToolkit();
                  elRoboto = new Robot();
                  peer = ((ComponentFactory)toolkit).createRobot(elRoboto, screen);
                  gdloc = screen.getDefaultConfiguration().getBounds().getLocation();
                  this.screenRect.translate(gdloc.x, gdloc.y);
                  screenCapCM = new DirectColorModel(24,
                            /* red mask */    0x00FF0000,
                            /* green mask */  0x0000FF00,
                            /* blue mask */   0x000000FF);
                  bandmasks = new int[3];
                  bandmasks[0] = screenCapCM.getRedMask();
                  bandmasks[1] = screenCapCM.getGreenMask();
                  bandmasks[2] = screenCapCM.getBlueMask();
                  Toolkit.getDefaultToolkit().sync();
             public void autoResetGraphicsEnv() {
                  this.screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                  this.screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
             public void manuallySetGraphicsEnv(Rectangle screenRect, GraphicsDevice screen) {
                  this.screenRect = screenRect;
                  this.screen = screen;
             public BufferedImage createBufferedScreenCapture(int pixels[]) throws HeadlessException, AWTException {
        //          BufferedImage image;
                DataBufferInt buffer;
                WritableRaster raster;
                  pixels = peer.getRGBPixels(screenRect);
                  buffer = new DataBufferInt(pixels, pixels.length);
                  raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
                  return new BufferedImage(screenCapCM, raster, false, null);
             public int[] createArrayScreenCapture() throws HeadlessException, AWTException {
                       return peer.getRGBPixels(screenRect);
             public WritableRaster createRasterScreenCapture(int pixels[]) throws HeadlessException, AWTException {
             //     BufferedImage image;
                 DataBufferInt buffer;
                 WritableRaster raster;
                  pixels = peer.getRGBPixels(screenRect);
                  buffer = new DataBufferInt(pixels, pixels.length);
                  raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
             //     SunWritableRaster.makeTrackable(buffer);
                  return raster;
        }In essence, all I've changed from the original is moving many of the allocations from function bodies, and set them as attributes of the class so they're not called every time. Doing this actually had a significant affect on frame rate. Even on my severely under powered laptop, it went from ~4 fps with the stock Robot class, to ~30fps with my FastRobot class.
    ##First Test:
    When I started outofmemory errors in my main program, I set up this very simple test to keep an eye on the FastRobot. Note: this is the code which produced the heap profile above.
        public class TestFBot {
             public static void main(String[] args) {
                  try {
                       FastRobot fbot = new FastRobot();
                       double startTime = System.currentTimeMillis();
                       for (int i=0; i < 1000; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                  } catch (AWTException e) {
                       e.printStackTrace();
        }##Examined:
    It doesn't do this every time, which is really strange (and frustrating!). In fact, it rarely does it at all with the above code. However, the memory issue becomes easily reproducible if I have multiple for loops back to back.
    #Test 2
        public class TestFBot {
             public static void main(String[] args) {
                  try {
                       FastRobot fbot = new FastRobot();
                       double startTime = System.currentTimeMillis();
                       for (int i=0; i < 1000; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 500; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 200; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 1500; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                  } catch (AWTException e) {
                       e.printStackTrace();
        }##Examined
    The out of control heap is now reproducible I'd say about 80% of the time. I've looked all though the profiler, and the thing of most note (I think) is that the garbage collector seemingly stops right as the fourth and final loop begins.
    The output form the above code gave the following times:
    Time taken: 24.282 //Loop1
    Time taken: 11.294 //Loop2
    Time taken: 7.1 //Loop3
    Time taken: 70.739 //Loop4
    Now, if you sum the first three loops, it adds up to 42.676, which suspiciously corresponds to the exact time that the garbage collector stops, and the memory spikes.
    [2] http://i.stack.imgur.com/fSTOs.png
    Now, this is my first rodeo with profiling, not to mention the first time I've ever even thought about garbage collection -- it was always something that just kind of worked magically in the background -- so, I'm unsure what, if anything, I've found out.
    ##Additional Profile Information
    [3] http://i.stack.imgur.com/ENocy.png
    Augusto suggested looking at the memory profile. There are 1500+ `int[]` that are listed as "unreachable, but not yet collected." These are surely the `int[]` arrays that the `peer.getRGBPixels()` creates, but for some reason they're not being destroyed. This additional info, unfortunately, only adds to my confusion, as I'm not sure why the GC wouldn't be collecting them
    ##Profile using small heap argument -Xmx256m:
    At irreputable and Hot Licks suggestion I set the max heap size to something significantly smaller. While this does prevent it from making the 1gb jump in memory usage, it still doesn't explain why the program is ballooning to its max heap size upon entering the 4th iteration.
    [4] http://i.stack.imgur.com/bR3NP.png
    As you can see, the exact issue still exists, it's just been made smaller. ;) The issue with this solution is that the program, for some reason, is still eating through all of the memory it can -- there is also a marked change in fps performance from the first the iterations, which consume very little memory, and the final iteration, which consumes as much memory as it can.
    The question remains why is it ballooning at all?
    ##Results after hitting "Force Garbage Collection" button:
    At jtahlborn's suggestion, I hit the Force Garbage Collection button. It worked beautifully. It goes from 1gb of memory usage, down to the basline of 60mb or so.
    [5] http://i.stack.imgur.com/x4282.png
    So, this seems to be the cure. The question now is, how do I pro grammatically force the GC to do this?
    ##Results after adding local Peer to function's scope:
    At David Waters suggestion, I modified the `createArrayCapture()` function so that it holds a local `Peer` object.
    Unfortunately no change in the memory usage pattern.
    [6] http://i.stack.imgur.com/Ky5vb.png
    Still gets huge on the 3rd or 4th iteration.
    #Memory Pool Analysis:
    ###ScreenShots from the different memory pools
    ##All pools:
    [7] http://i.stack.imgur.com/nXXeo.png
    ##Eden Pool:
    [8] http://i.stack.imgur.com/R4ZHG.png
    ##Old Gen:
    [9] http://i.stack.imgur.com/gmfe2.png
    Just about all of the memory usage seems to fall in this pool.
    Note: PS Survivor Space had (apparently) 0 usage
    ##I'm left with several questions:
    (a) does the Garbage Profiler graph mean what I think it means? Or am I confusing correlation with causation? As I said, I'm in an unknown area with these issues.
    (b) If it is the garbage collector... what do I do about it..? Why is it stopping altogether, and then running at a reduced rate for the remainder of the program?
    (c) How do I fix this?
    Does anyone have any idea what's going on here?
    [1]: http://i.stack.imgur.com/sqqtS.png
    [2]: http://i.stack.imgur.com/fSTOs.png
    [3]: http://i.stack.imgur.com/ENocy.png
    [4]: http://i.stack.imgur.com/bR3NP.png
    [5]: http://i.stack.imgur.com/x4282.png
    [6]: http://i.stack.imgur.com/Ky5vb.png
    [7]: http://i.stack.imgur.com/nXXeo.png
    [8]: http://i.stack.imgur.com/R4ZHG.png
    [9]: http://i.stack.imgur.com/gmfe2.png
    Edited by: 991051 on Feb 28, 2013 11:30 AM
    Edited by: 991051 on Feb 28, 2013 11:35 AM
    Edited by: 991051 on Feb 28, 2013 11:36 AM
    Edited by: 991051 on Mar 1, 2013 9:44 AM

    SO came through.
    Turns out this issue was directly related to the garbage collector. The default one, for whatever reason, would get behind on its collection at points, and thus the memory would balloon out of control, which then, once allocated, became the new normal for the GC to operate at.
    Manually setting the GC to ConcurrentMarkSweep solved this issue completely. After numerous tests, I have been unable to reproduce the memory issue. The garbage collector does an excellent job of keeping on top of these minor collections.

  • Help me understanding server memory usage

    I am trying to determine how much memory our weblogic server needs and
    am seeing what seems to me to be strange memory growth patterns in the
    server. I am running weblogic6.1sp4(with CR093850) on solaris 2.7.
    I have written an emulator for testing performance and stability of
    our system. The emulator has sleeps in it between actions so it is
    emulating a real end user interaction with the system, it is not
    trying to emulate a super heavy load.
    I configured weblogic server to have a high max heap to begin with(1.5
    gig) and thought I could turn 10 emulators on and let them run for a
    while to get all my entity bean cached filled up, then I could see
    what the size of my server was at that point and expect that to be
    close to what it will need. Is this an appropriate way to determine
    size?
    However, when I do this and try to let my emulators run for 24 hours,
    I never make it past 13 hours. The weblogic server never stops
    growing and of course I eventually end up with all the emulators
    exiting with 'out of memory' errors from the server.
    The process grows slowly at first, even seems pretty well behaved for
    the first 2-4 hours. Then the process size starts to grow a little
    more rapidly, then there is some drastic up and downs then eventually
    it just stays high. During the spikes the CPU usage spikes as well
    even though the load from my emulators has not increased.
    If our code had a small memory leak I would expect to see a steady,
    constant slow growth problem, but that is not whats happening, it
    starts out small growth but then becomes more spiky.
    I have max-beans-in-cache and max-beans-in-free-pool said reasonably
    low on my entity beans that are used in this test. There are only 8
    entity bean types being used in this test run. 1 stateful session
    bean type and 3 stateless session beans.
    Has anyone else seen this odd behavior? Has anyone had success in
    setting a reasonable heap size?
    any insight would be greatly appreciated!
    Kelly

    Hi Kelly,
    That looks pretty much like a memory leak. You could use a memory
    profiler like OptimizeIt, or at least search though the code for
    appearances of static public Hashtable
    - that's where ever-growing "caches" live.
    Regards,
    Slava Imeshev
    "Kelly Kingdon" <[email protected]> wrote in message
    news:[email protected]...
    I am trying to determine how much memory our weblogic server needs and
    am seeing what seems to me to be strange memory growth patterns in the
    server. I am running weblogic6.1sp4(with CR093850) on solaris 2.7.
    I have written an emulator for testing performance and stability of
    our system. The emulator has sleeps in it between actions so it is
    emulating a real end user interaction with the system, it is not
    trying to emulate a super heavy load.
    I configured weblogic server to have a high max heap to begin with(1.5
    gig) and thought I could turn 10 emulators on and let them run for a
    while to get all my entity bean cached filled up, then I could see
    what the size of my server was at that point and expect that to be
    close to what it will need. Is this an appropriate way to determine
    size?
    However, when I do this and try to let my emulators run for 24 hours,
    I never make it past 13 hours. The weblogic server never stops
    growing and of course I eventually end up with all the emulators
    exiting with 'out of memory' errors from the server.
    The process grows slowly at first, even seems pretty well behaved for
    the first 2-4 hours. Then the process size starts to grow a little
    more rapidly, then there is some drastic up and downs then eventually
    it just stays high. During the spikes the CPU usage spikes as well
    even though the load from my emulators has not increased.
    If our code had a small memory leak I would expect to see a steady,
    constant slow growth problem, but that is not whats happening, it
    starts out small growth but then becomes more spiky.
    I have max-beans-in-cache and max-beans-in-free-pool said reasonably
    low on my entity beans that are used in this test. There are only 8
    entity bean types being used in this test run. 1 stateful session
    bean type and 3 stateless session beans.
    Has anyone else seen this odd behavior? Has anyone had success in
    setting a reasonable heap size?
    any insight would be greatly appreciated!
    Kelly

Maybe you are looking for

  • Google Apps account now showing Unknown Error when trying to sign in

    This is a post I made over at webosnation.com, but no one knows what's going on over there (but a handful of people are having the same problem). For some reason my main email account has decided to fly off a cliff on both my FrankenPre2 and my Touch

  • This is a stumper of a problem

    This is quite a specialised problem and i hope someone can help me I am writing a jsp web page to display information from a ldap directory. It works fine except i need to specify where the program is to search the ldap tree. When i specify no locati

  • Any idea how to download itunes update on a dial-up connection?

    Got a new ipod 30gb for xmas. Attached it to my mac and was told I needed to update itunes. Came to this site and started the download. Three days later and download will not complete. Unfortunately I only have access to dial-up in this backwoods par

  • Software update wont install

    What do i do when my itunes will start downloading the software update. But then once its done, it will tell me that it cant connect to the server. even when i am?

  • CONSOLIDATION BETWEEN TWO COMPANY CODES

    hello! plz help me to make a doc n configuration in: CONSOLIDATION BETWEEN TWO COMPANY CODES in version 6.00 mail id: [email protected] regards sirisha