Blog: Image Caching in PL/SQL Applications

Blog: Image Caching in PL/SQL Applications
http://tylermuth.wordpress.com/2008/02/04/image-caching-in-plsql-applications/
Enjoy,
Tyler

Anyone? Or is it the wrong forum?
Alessandro

Similar Messages

  • Image cache not working with Firefox and apex

    Hi,
    I'd like to cache all my images to save page rendering time and bandwidth because my images are all static and never change.
    I use the John Scott's caching technique Link: [http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-or-less/], in a few words this technique consists of adding a header line "Expires: date in the future" in the http response.
    It works very well in IE, the images are cached and the same image can be accessed several times (within the same session or in different sessions) without issuing an http request to the server each time.
    with Firefox it does not work, the same image is asked again and again to the server (i'm using FF 3.5 and APEX 3.2).
    - Is it a date format problem? no, because when i type about:cache in FF, i can find my image in the cache with an expire date in the future.
    The weird thing here is that the counter is incremented each time u request the image, so FF knows it is in the cache and even if the expire date is in the future, FF asks it again to the server.
    - Is it a FF bug? If u read the http specs or if u google a little, u can come to the conclusion that FF does not follow the standards,
    but... images.google.com for example manages to get its images cached with FF.
    They use an http response header "cache-control: public, max-age=604800".
    I tried the same and all kinds of combinations but without success.
    When i compare my image with the one from google in the FF cache, they both have the same attributes.
    - It's not an apex issue neither because it works with IE, most probably an incompatibility between apex and FF?
    Maybe the use of cookie? or the http request (not the response) containing "cache-control: max-age=0"?
    I've found so far 2 half solutions:
    1) use ETag and modified date, see the Tyler Muth's note Link: [http://tylermuth.wordpress.com/2008/02/04/image-caching-in-plsql-applications/].
    with this technique FF continues to send request each time but the answer is shorter because it's just a "304 not modified" instead of "200 OK" (200 response is bigger as it contains the image).
    it's better than nothing but you still have 1 request + 1 response for nothing.
    Another problem is that you need SYS access to implement this, which is not possible on an hosted server. (note that for images from the file system it is already foreseen by apex 3.1, Tyler's note is for images from the db)
    2) if you preload the image (using myimage=new Image();myimage.src='...';), then there is max 1 request per browser session.
    There are 2 minor issues here:
    - no caching across sessions
    - if u don't want to preload all the images (example a page with lots of thumbnails, when user clicks it show a bigger image, in that case the thumbnails can be preloaded but overkill for the big images), then you need to load the image, wait until the image has loaded before displaying it, it does not slow down the execution, but requires some extra JS.
    I'm not asking anyone to investigate it, i can live with the 2 workarounds,
    but just in case someone encountered the same problem and already fixed it.
    Let me know if u managed to use the John Scott's technique with Firefox. (U can use Firebug to see the http traffic)
    Thx
    Tim

    Hi Anshul, hope these help. Let me know if you need to see anything else.
    Best,
    Menu Settings:
    Tab Hyperlink:
    Label Text with with hyper link option not available (works as a hyperlink in chrome and IE though):
    Thanks for the help in advance!

  • Image Caching

    Hi
    I'm trying to implement Image Caching on an Oracle XE database following Tyler Muth's blog post http://tylermuth.wordpress.com/tag/oracle-plsql-images-caching/
    Has anyone managed to implement this successfully?
    I've run the following as sys :
    begin
    DBMS_EPG.SET_DAD_ATTRIBUTE (
       dad_name    => 'APEX',
       attr_name   => 'cgi-environment-list',
       attr_value  => 'HTTP_IF_NONE_MATCH');
    DBMS_EPG.SET_DAD_ATTRIBUTE (
       dad_name    => 'APEX',
       attr_name   => 'cgi-environment-list',
       attr_value  => 'IF_MODIFIED_SINCE');
    end;
    /And my function to download the images includes the following:
        v_etag_head := owa_util.get_cgi_env('HTTP_IF_NONE_MATCH');
        v_etag_str := lpad(p_file_id,2,0)||to_char(v_date_last_modified,'DDMMYYYYHH24MISS');
        if v_etag_head = v_etag_str then
          owa_util.status_line(
          NSTATUS         => 304,
          CREASON         => 'Not Modified',
          BCLOSE_HEADER   => true);
          return;
        else
          owa_util.mime_header(v_mimetype, FALSE );
          htp.p('Date: ' ||to_char(sysdate,'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('Content-length: '||v_file_length);
          htp.p('Content-Disposition: inline; filename="'||v_filename||'"');
          htp.p('Last-Modified: '||to_char(v_date_last_modified,'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('ETag: '||v_etag_str);
          htp.p('Expires: ' ||to_char(sysdate+(1/12),'Dy, DD Mon RRRR hh24:mi:ss')||' GMT');
          htp.p('Cache-Control: max-age=300');
          owa_util.http_header_close;
          wpg_docload.download_file(v_blob);
       end if;However, owa_util.get_cgi_env('HTTP_IF_NONE_MATCH') always returns null. I've checked using LiveHTTPHeaders and the If-None-Modified is being sent. This is running on a local Oracle XE database (using the EPG), running APEX 4.0.0.00.46 and Windows 7.
    I've searched the forum and there are four other posts that refer to HTTP_IF_NONE_MATCH, however these haven't helped. If anyone has any ideas or needs any more information, please let me know. And if you have got this working I'd love to know how, even just so I know it's possible!!
    Thanks for any help.
    Sara

    Bump.
    Has anyone managed to implement this successfully? Is there anything I can check? Or is this a bug with the EPG?
    This is causing us massive problems and I can't see what I've done wrong. Any help is really appreciated.
    Thanks
    Sara

  • Clear Image Cache

    hi ,
    in my application i have to cache the image to some extend..
    and that i need to clear the image cache as my url dont
    change.
    is there anyway programatically i can refresh the image ?
    thanks

    "sohilr" <[email protected]> wrote in
    message
    news:ghts86$ls8$[email protected]..
    > hi ,
    > in my application i have to cache the image to some
    extend..
    > and that i need to clear the image cache as my url dont
    change.
    > is there anyway programatically i can refresh the image
    > thanks
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
    Q7

  • Increase still image cache when working only with images?

    I've been having hundreds of out of memory issues when working on a still image project. Thought it was solved but it hasnt.
    If im working totally with still images (Jpegs, Tiffs and PSD's) should I increase the Still Image cache from its default amount? I have scoured the internet trying to find out what the Still Image Cache is but cant find an explanation anywhere.
    I increased it this morning and all is well so far.....
    Might this solve my problem.

    The Still image cache is the amount of RAM assigned to the playback of the stills. That's what that slider adds... it should help to make it larger when you are working with a lot of stills. They are cached to RAM instead of being read from disk...
    From the manual:
    Still Cache: This specifies the amount of RAM used to hold still images for real-time playback. The still cache that is allocated is a percentage of the excess RAM allocated to Final Cut Pro, so adjusting the Application slider also adjusts the amount of RAM available to the still cache. The more RAM allocated to the still cache, the more still frames can be played back in real time in the currently selected sequence. If another sequence is opened, the contents of the still cache are replaced with stills from the new sequence. If there is no excess RAM available, this slider is dimmed.
    Jerry

  • Image Caching With JList

    Hi all, I need to know, how can I implement an Image Cache feature with a JList that is effective, ie. basic I would like the images to be stored in memory when the list is visible (done that already using a WeakHashMap<String, Icon>) and removed from memory when the JList is not displayed.
    Currently I use the following code section, to try and remove the data from memory, seems not work according to task manager. Sorry I cannot seem to come up with a good SSCCE since I'm not exactly sure how to make an example that loads images. Any suggestion with that?
    WeakHashMap<String,Icon> icons = new WeakHashMap<String,Icon>();
    JList list = new JList(); // something like this in actual code
    public void startClearTimer() {
        new javax.swing.Timer( 30000, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if(!list.isShowing() && icons.size() > 0 ) {
                    resetIconCache();
                    System.out.println("Icons Cleared");
                    System.gc();
                    //((javax.swing.Timer)e.getSource()).stop();
        }).start();
    public void resetIconCache() {
        if(icons == null) {
            return;
        Iterator<Icon> images = icons.values().iterator();
        while(images.hasNext()) {
            ImageIcon icon = (ImageIcon)images.next();
            icon.getImage().flush(); // smoke but no cigar
            icon = null;
        icons.clear();
        icons = new WeakHashMap<String,Icon>();
    }This code is used in a ListCellRenderer, which loads the images, scales them, caches them in memory so the repaints are faster and displays them along side some JLabels.
    So basically how can I load the images in memory and release the resources used when the images are not required?
    ICE

    you can't be cleverer than JVM for memory usage.
    Of course you can, because the point of caching is that it requires (or at the very least is optimised by) some understanding of the use case. JVMs are somewhat unlikely to predict how any given set of users will use any given application, nor are they capable of factoring in the cost of downloading (or otherwise obtaining) data which has been freed from memory. To a JVM, a lump of voidable memory is no different to any other.
    Take an example of an applet (which is limited to 96Mb of heap) which browses images on a server. Let's say it's looking at images which occupy 20Mb of memory each (far from unreasonable) in memory. They might each be 1Mb or so in compressed file size, which is an appreciable delay in download time.
    Each time the user switches between images, the applet will probably want to implement a policy that says "that last image should be kept in memory if possible, since the user might return to it and they won't want another long delay to load it, but if you run out of memory downloading the next image, feel free to discard the first, because the next is more important." (Furthermore, your workflow might permit you to prioritise images.)
    In order to indicate to the JVM that the first image is disposable, you must clear all strong references to it. However, this simply makes it eligible for garbage collection: simple as that. You have no control over whether the garbage collector will clean that image data (which takes several seconds to retrieve) or a bunch of other data which is completely useless or can be recreated in milliseconds. Also note that in practice, weak and soft references do not actually encourage the GC to retain the data: it is cleared long before the memory is actually required.
    Note, too, that the suggestion of tweaking the heap allocation is no use for an applet (unless you have a very small, very knowledgeable and very tolerant user base).

  • ADO Recordset Cache Size Breaking SQL Reads

    I've got a C++ application that uses ADO/ODBC to talk to various databases using SQL.
    In an attempt to optimize performance, we modified the Cache Size parameter on the Recordset object from the default Cache Size of 1 to a slightly larger value. This has worked well for SQL Server and Access databases to increase the performance of our SQL reads.
    However, talking to our Oracle 8i (8.1.6 version) database, adjusting the Cache Size causes lost records or lost fields.
    We've tried the same operation using a VB application and get similar results, so it's not a C++ only problem.
    For the VB app, changing the cursor-type from ForwardOnly to Dynamic does affect the problem, but neither work correctly. With a ForwardOnly cursor the string fields start coming back NULL after N+1 reads, where N is the Cache Size parameter. With a Dynamic cursor, whole records get dropped instead of just string fields: for example with a Cache Size of 5, the 2nd, 3rd, 4th and 5th records are not returned.
    In our C++ application, the symptom is always lost string fields, regardless of these two cursor types.
    I've tried updating the driver from 8.01.06.00 to the latest 8.01.66.00 (8.1.6.6) but this didn't help.
    Is anybody familiar with this problem? know any workarounds?
    Thanks
    [email protected]

    I am displaying you mine test db's buffer cache size : (11.2.0.1 on Windows box)
    SQL> show parameter db_cache_size;
    NAME                                 TYPE        VALUE
    db_cache_size                        big integer 0
    SQL> select name, current_size, buffers, prev_size, prev_buffers from v$buffer_pool;
    NAME                 CURRENT_SIZE    BUFFERS  PREV_SIZE PREV_BUFFERS
    DEFAULT                       640      78800          0            0
    SQL> select name,bytes from v$sgainfo where name='Buffer Cache Size';
    NAME                                  BYTES
    Buffer Cache Size                 *671088640*
    SQL> show sga;
    Total System Global Area 1603411968 bytes
    Fixed Size                  2176168 bytes
    Variable Size             922749784 bytes
    *Database Buffers          671088640 bytes*
    Redo Buffers                7397376 bytes
    SQL> select * from v$sga;
    NAME                      VALUE
    Fixed Size              2176168
    Variable Size         922749784
    *Database Buffers      671088640*
    Redo Buffers            7397376
    SQL> show parameter sga_target;
    NAME                                 TYPE        VALUE
    sga_target                           big integer 0
    SQL>Regards
    Girish Sharma
    Edited by: Girish Sharma on Oct 18, 2012 2:51 PM
    Oracle and OS Info added.

  • Designer6i: About Page template filename Web PL/SQL Applications

    how can change the About Page template filename Web PL/SQL Applications
    Thank!!!
    my e-mail is: [email protected]

    Hi,
    Have you upgraded Apex?
    I assume you use XE EPG.
    Have you grant execute privilege on procedure to DAD user ANONYMOUS?
    GRANT EXECUTE ON WOLF_22.HELLO_WORLD TO ANONYMOUS;Have you changed wwv_flow_epg_include_mod_local that it allow execute WOLF_22.HELLO_WORLD?
    And write schema.procedure at upper case to function.
    If you have not upgraded Apex, run as SYS or SYSTEM
    CREATE OR REPLACE function FLOWS_020100.wwv_flow_epg_include_mod_local(
        procedure_name in varchar2)
    return boolean
    is
    begin
        -- Administrator note: the procedure_name input parameter may be in the format:
        --    procedure
        --    schema.procedure
        --    package.procedure
        --    schema.package.procedure
        -- If the expected input parameter is a procedure name only, the IN list code shown below
        -- can be modified to itemize the expected procedure names. Otherwise you must parse the
        -- procedure_name parameter and replace the simple code below with code that will evaluate
        -- all of the cases listed above.
        if upper(procedure_name) in (
              'WOLF_22.HELLO_WORLD'
        ) then
            return TRUE;
        else
            return FALSE;
        end if;
    end wwv_flow_epg_include_mod_local;
    /Regards,
    Jari

  • Messages Opening Image Cache Folder when Sending Files

    Messages / iChat seems to be opening my image cache folder every time I send an image to my contacts the image cache folder opens in Finder and stays open with the copied image. Is there a way to get rid of this? It's really annoying. It started happening after I updated to Mavericks.
    Thanks!

    Hi,
    I don't have an answer for this one.
    Are you finding those items are zipped before Sending ?
    Where are they from?
    I get them zipped when sending a pic dragged from a Browser or from iPhoto but not from the Desktop or a Finder window.
    10:44 pm      Tuesday; November 5, 2013
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How to disable image cache in Mail 7

    I urgently need to disable the image cache in Mail 7. How can I do that?
    Reason: I regularly get mails with image files that are essential parts of customer orders. The image content is different in each mail, but the filename is the same.
    Mail 7 displays the same image in every mail until I restart it, it obviously displays a cached file instead of the original image.
    Where is the Mail-cache-file? Can I writeprotect it?

    I think Private Browsing might be what you are looking for,
    have a look here for more info
    [https://support.mozilla.com/en-US/kb/Private%20Browsing]
    also not sure how much access you have on a company workstaion to change settings in Firefox
    Hope this helps :-)

  • Mail attachment image caching problem with C7

    Using C7-00 and Mail for Exchange with up to date software. I received two Mobile Boarding Pass emails from Lufthansa for my flights. These emails contain barcode.gif as an attachment that one can show at the gate when boarding. Now the two emails contain attachment with same name (barcode.gif) and the images are equal in size too. The problem is that for the second mail the phone shows the attachment of the first email!
    I have read that Symbian^3 has for performance reasons aggressive image caching feature. But in this case this causes a real nasty bug!
     - Juha

    I have found a solution.
    In the IMG src tag we had been using /images/gfx/image.gif
    By changing this to /./images/gfx/image.gif the images are no longer cached and update immediately when changed.
    PQ

  • Mail attachment image caching problem

    Using C7-00 and Mail for Exchange with up to date software. I received two Mobile Boarding Pass emails from Lufthansa for my flights. These emails contain barcode.gif as an attachment that one can show at the gate when boarding. Now the two emails contain attachment with same name (barcode.gif) and the images are equal in size too. The problem is that for the second mail the phone shows the attachment of the first email!
    I have read that Symbian^3 has for performance reasons aggressive image caching feature. But in this case this causes a real nasty bug!
     - Juha

    I have found a solution.
    In the IMG src tag we had been using /images/gfx/image.gif
    By changing this to /./images/gfx/image.gif the images are no longer cached and update immediately when changed.
    PQ

  • Copy and paste image from PDF to another application

    how do you copy and paste an image from PDF into another application such as Word or Excel? I know how to copy>> hover cursor over picture until it turns into a select "+" tool, select and right click to copy but when I try to paste it into another application, its loses all of its formatting. Thanks

    Not sure what you mean by formatting of a picture. You can export all images and get a files to import to word. You can also use the snapshot tool, though it captures a screen copy. If you select an image and copy, my experience has been that it will only copy to PhotoShop, but it is not something I do very much. If the image is part of the document (not markup like a stamp or such), you can use the select tool to select the image and copy it to the clipboard. Just tried it and it worked fine. If it is a stamp (like pasted in), then you can not copy it in this way, if at all.

  • How To Convert Multi Page Tiff Image Through open office in application

    I will Appreciate Any Effort Or Reply Which Can Tell Me , To convert a multi-page tiff image in pdf format in application i.e not on desktop using simple open -office but through coding. I doubt if there Exists Ny Plugin Or Separate Library Which Can Do Tht.  Code Or Library inJava Language will Be Preferable

    Your question does not make any sense. First, PDF does not support multi-page TIFFs. DO you have a PDF that you are trying to convert to WORD or what. It is unclear of what you are starting with and what your end goal is. If you are dealing with coding, you may need to check the SDK forum, but trying to understand what you are trying to do would be a good idea first.

  • Prob in sql application forgotten paword

    I dont have much idea how to set the sql.
    i forgotten my password how i will set the pasword fro the sql application please tell me.

    got it prob is there only i am having only application acces not db.thats why cant login as sqlplus "/as sysdba"

Maybe you are looking for

  • Computer crashed, trying to register on new computer

    My computer recently crashed which had I think CS5. (Cant remember if it was 5.5 or 5.) I have gotten a new computer now and am trying to install the program on my new Mac. I have logged into my adobe account but it does not show any products registe

  • Can I Add a Second Apple ID to Share Calendars?

    My boss and I each have an iphone and Microsoft Surface Pro tablets. I downloaded the iCloud Control Panel to sync my iPhone and Outlook calendars on my Surface Pro. Is there a way I can add my boss so that I can have access to his calendar in my Out

  • Problem in BDC for CA02

    hello all,          i am doing BDC for change routing (ca02) transaction. in that my need is to assign PRT allocation for operations. i have written a program for it but if suppose for a particlular operation i want to assign PRT and if there are no

  • Help with IPHOTO storage vs. Google Drive

    I presently store all my photos in Finder in a folder call Main Photos.  I have tried to avoid synching to Iphoto, but the photos are showing up in Iphoto now.  My question is, are the photos being stored twice?  I have 110 GIG of photos ... help ple

  • Client Proxy through WSDL

    Hi, I am creating a Client Proxy through WSDL Link in SE80 Transaction. I am getting an error 'NO Vendor Specified'. Please throw some light. Thanks, Mathivanan.G