Working with a lot of elements in collections

I'm facing a problem: i need to store many items (something about 1,000,000) in a structure similar to Collection or Hashtable, but these are all stored in memory. I want to know if is there any structure like these that stores the items in some secundary storage (such as HD), because i'm getting an OutOfMemoryException when trying to use Hashtable to store this data.

I don't think there's anything in the standard libraries that can handle this, but it's something you can put together fairly quickly.
The key idea is that instead of maintaining the values directly, you wrap all of the values with a java.lang.ref.SoftReferences. A SoftReference will discard the value when memory starts running out. You then assign all of your SoftReferences to a java.lang.ref.ReferenceQueue which notifies you that a value is about to evicted so that you can write it to disk.
Here's how it looks in memory for a hash table:
key -- soft reference -- value
Here's what you need to write:
A put method that wraps the values in a reference before entering it into the table.
A get method that first checks if a value is in the table, and if not, if the value has been evicted to disk.
A thread that repeatedly calls remove() on the reference queue to catch values as they are evicted.
The class to look at is sun.misc.SoftCache. It demonstrates everything you need for implementation except for writing the value to disk. If you used SoftCache, you would just need to change processQueue () to write your objects to disk and fill () to read the object back from disk.

Similar Messages

  • I am considering buying an iPad 3. I have an iMac with OSX 10.6.8. On the iMac I have many photos and work with iPhoto and Photoshop Elements on the computer. Can I interchange or transfer photos and other work from the iMac to the iPad? How?

    I am considering buying an iPad 3. I have an iMac with OSX 10.6.8. On the iMac I have many photos and work with iPhoto and Photoshop Elements on the computer. Can I interchange or transfer photos and other work from the iMac to the iPad? How?

    velma Monreal wrote:
    I am considering buying an iPad 3. I have an iMac with OSX 10.6.8. On the iMac I have many photos and work with iPhoto and Photoshop Elements on the computer. Can I interchange or transfer photos and other work from the iMac to the iPad? How?
    Yes you can. In iPhoto create a Album with the photos you want in it. You can drag them from your Events folder. In iTunes with your iPad connected go to Photos by cliking on your iPad. You can then select the album or events you want.

  • Working with layers | Learn Photoshop Elements 11 | Adobe TV

    In this movie, author Jan Kabili discusses using layers in the Editor workspace in Photoshop Elements 11. Jan explains what layers are, why you might choose to use them, and how to create and work with layers in the Layers panel.

    I have downloaded & installed flash player at least 4 four but your programs do not find it. What do I need to do?

  • Working with Layers | Learn Photoshop Elements 9 | Adobe TV

    With layers, you can work nondestructively and save all of your creative ideas in a single file. Learn about the various options in the Layers panel and how to harness the true power of Photoshop Elements by working with layers.

    What is the best way to work on photographs, editing them, and preparing for print if I can't save layers as .jpg or non-layered .tiffs? The photo lab I will be using does not allow layered .tiff. I have seen many videos that show how to let's say enhance eyes using layers, but in this video it says that .jpg cannot be used. I am new to photography and PSE an would like to know if there is an alternative way to edit an image that can be saved as .jpg. Thank you!

  • Working with iphoto AND Photoshop Elements

    I currently use iPhoto 5 and want to begin using Photoshop Elements. I am wondering if someone could share their ideas on how to go about using both programs. Here is my objective. I think that I can get more out of my photographs but moving up to Photoshop Elements. I think that perhaps this program can make better black & white photos as well as color (has more adjustments that are capable of specific controls).
    That said, once I have finished with a photo, should I then import it into iPhoto?
    What type of work flow routines do others use when they have both of these programs?
    Thanks for any ideas!

    If I may take the opportunity to expound on this thread to incorporate my own question...
    I too wish to edit in Elements and retain iPhoto as an organization tool, but have read that saving to jpg is not the best idea. After editing and/or flattening tiff is the better option, no? Anyway, the default directory in Elements in the save as dialog I believe is to the same roll the original came from, but often after an edited jpg is saved into tiff iPhoto doesn't see it. Stoplight tells me it is there, but there is apparently something about the process that iPhoto doesn't like.
    Lori, can you be kind enough to expound on this?
    ps: Tatty - I took a Elements class at a local high school and learned bunches. Alternatively has a nice DVD available too
    Power Mac G5 Dual 2.0   Mac OS X (10.4.5)  

  • Term-Driven Page with Friendly URL doesn't work with a page in another Site Collection

    Hi all,
    It appears that the Term-Driven Page with Friendly URL does not work when it is referencing a page in another Site Collection. When I set my Managed Navigation to use a term that points to another Site Collection page, the link shows in my navigation, but
    gives the error:
    "Sorry, something went wrong"
    This does not happen if I link to a page in the same site.
    Personal Blog:

    i got similiar (i am not sure whether the same) issue recently:
    I have a site collection (address http://spserver/) which use managed navigation, and term-driven page with friendly url. The address of the term-driven page is set as /pages/teamsitehome.aspx . A friendly url takes the form such as http://spserver/menulevel1/submenu1
    I create a new site collection http://spserver/sites/newsitecollection and i want it to have the same navigation menu as the other site collection. Since i cannot use the same termset for the two site collection, i have to create a new term set
    for the new site collection, "pin term with chidrem" or "reuse term" to the old term set. The friendly url in newly created site collection and term set takes the form such as http://spserver/sites/newsitecollection/menulevel1/submenu1, and still
    points to /pages/teamsitehome.aspx. Notice that the term-driven page here in the new site collection still points to the old site collection.
    Actually, it works! I mean, when i click the navigation menu, friendly url http://spserver/sites/newsitecollection/menulevel1/submenu1 appears in the browser address. And SharePoint knows to load /pages/teamsitehome.aspx for this url. If this is a simple
    blank page, it just open fine here.
    However, my custom page teamsitehome.aspx calls TaxonomyNavigationContext.Current.NavigationTerm in its page load event, it should returns a valid NavigationTerm for the friendly url. But it returns null here. I traced the code to find that it calles
    internal static NavigationTerm GetNavigationTermFromTargetUrlGuids(SPWeb contextWeb, Guid termStoreId, Guid termSetId, Guid termId, bool includeInheritedSettings, bool enableExclusions)
    The passed in contextWeb points to http://spserver/ , since the term-driven page is in this web. But the termSetId points to the new termset. TermId won't be problem, since its the same in both new and old term set for pinned term. The combination of contextWeb
    and termSetId just make the output NavigationTerm null. I think its simply because the termset is not associated with this spweb.
    My workaround is create a copy of /pages/teamsitehome.aspx in new site collection. The term-driven page address is set to ~sitecollection/pages/teamsitehome.aspx in term management. This time, all works. Just because the contextWeb parameter i mentioned
    above now points to the root web at new site collection, where the term driven page resides.

  • Is CS3 better for working with RAW images than Elements 6?

    Hi all,
    I am trying to find out if it is worth buying CS3 in stead of elements 6. Surprisingly, nobody has been able to tell me what the difference exactly is.
    The best I got so far was that elements is a trimmed down version of CS3 but what more can I do with CS3?
    As I am in England, CS3 would cost me about $1100, as opposed to $650 in the US, which is a bit much if you don’t know exactly what you get for that amount.
    It says something on the adobe features section about BETTER raw processing, but not compared to what. Old version? Other software? Better than nothing?
    I will be running it under XP, and the only use will be to optimise images from a digital camera in RAW format, 90%, and a jpeg (10)%, partially for web use, partially for prints.
    The most common things are:
    Correcting exposure when pics are unevenly lit.
    Correcting color temperature.
    Removing unwanted parts of a picture e.g. somebody stepping into the picture, advertising signs or copyrighted material.
    Altering color of small parts of an image like that of a single flower in a bouquet.
    Removing blemishes in portraits.
    The photos will always stay single photos, I can not foresee any use for slide shows, animations, video or anything related.
    From what I have been able to find out so far, it seems that Elements 6 will do all this and I don’t need to spend the extra $1000, or should I?

    I have not used Photoshop Elements since version 2.0. In that version it was very similar to Photoshop as far as how the interface was designed. There were a few key elements that were missing such as the Curve adjustment. It is my understanding that there is a free download available from a third party source that will provide that capability.
    As far as Camera Raw is concerned, you only have the adjustments that are on the basic panel and the details panel. That means you don't have all of the hue/saturation/luminance adjustments, or lens correction, or the capability to create presets, or to calibrate ACR specifically for your camera. As I understand it, it is not possible to load multiple images into ACR so that you can apply changes to all of them at once. And I don't believe you have the option of working in ACR in 16-bit mode.
    With Photoshop Elements it is not possible to record actions to enable you to do batch processing of your images. What you have is a good quality basic single image photo editor.
    I cannot tell you which to purchase. I don't know what you are accustomed to, nor do I fully understand your expectations. There are trial versions of both programs that you can download and try for 30 days to see what you think. They are fully functioning programs for that trial period, which should be ample time for you to determine which program will give you the most value.

  • Working with org.w3c.dom.Element

    I have next XML code:
      <union name="FirstUnion">
                 <switch disctype="QuestionType">
                      <case discvalue="List" type="ChoiceSeq" name="choices"/>
                      <default type="ChoiceSeq" name="choices"/>
       </union>I have org.w3c.dom.Element link which represents switch element .
    So how can I get case or default element by name if i dont want to pass collection by my own code?

    Parse using XPath: "/union/switch/case"
    The 1.5 (maybe 1.4?) JDK has a set of XPath APIs that will work on a parsed DOM.

  • "Licensing Has Stopped Working" with Mountain Lion & PS Elements

    After installing Mountain Lion Photoshop Elements will not open. IT produces a dialog box that says "Licensing has stopped working - ERROR 6 "  Restarting the computer is no help.
    How do I reenter my license - and WHY am I having to do this?

    That link calls for deletion of the "FlexNet Publisher" file in the HardDrive>>Library>>Preferences folder. No such file exists in that folder on my 10.8 machine.
    It also calls for downloading and opening the file. I have done that and insise the LicenseRecovery Folder ran the LicenseRecover application. That app opens but appears to be non-responsive.
    Any other avenues?

  • Working with converted .mov files in Premiere Elements 2

    I recently got a digital camera that records .mov clips with H.264 technology. I use it for back up when Im having problems with my regular camcorder. Of course I can work with these .mov files in QuickTime Pro with no problem. But in order to work with them in Premiere Elements 2, it appears I have to export it into the .avi format first. After exporting in QuickTime Pro, when I bring the new .avi file up into Premiere Elements, the color quality is retained, but much of the resolution is lost. Its very pixelated. I understand that .avi and .mov work differently in the way information is stored avi in chunks and mov in streams, but Im wondering if there is a way I can work around this. The reason why I got QuickTime Pro initially was to be able to convert my finished .avi videos made in Premiere Elements 2 into MPEG-4 files using the H.264 codec for better quality. And Im doing that all the time now with no problem. So I am wondering if when I reconvert the .mov clip thats been converted into .avi back into mpeg-4, will the resolution be restored? That is part of my question. The other part is regarding the initial conversion process. Are there settings in QuickTime Pro for converting .mov to .avi with as little loss in resolution as possible? The manual doesnt address this issue specifically. Any ideas or suggestions? OS is Windows XP Media Center edition, computer Sony Vaio dual processor. Thanks, Judy

    Hi again Steve. I'm so embarrassed. After my initial reply to your message I went to the Adobe site to see if they even made Premiere for Mac and learned they don't. I also read a review in Wired that says Premiere 6 is just as good if not better than iMovie which they say has actually been downgraded. I'm using Premiere 2, so I thought I might consider upgrading. Then I watched "Steve's Story" and realized it was you. (Your daughter is a cutie! Adobe must love you.) So my question is this: Would my problem be solved by simply upgrading to Premiere 4? If I do that, would it be compatible with regard to catalog integration with Photoshop Elements 4 or would I have to upgrade to Elements 6? If I upgraded the whole package would my current Photoshop Elements 4 catalog transfer with all tags intact? This is vital for me to know because I rely on them heavily. I realize that I would be skipping a version in the upgrade. Is that possible? Does that matter? Please read my reply to Bill because it explains why I want to use those particular .mov files. Another question for you. I use your excellent book a lot. If I upgrade will it become useless? Finally, since you're the expert, let me tell you what I'm really aiming for and get your advice. I need to start composing my own musical soundtracks to my videos. I want to do it as I'm viewing the timeline. Therefore, I know I need to invest in a midi-capable keyboard or controller and software. The problem is that there are few controllers compatible with Windows XP Media Center Edition. I am told I would need to disable the XP Media Center registry keys for anything to work which wouldn't matter because I don't use Media Center features anyway (like TV hookup, media player, etc.). But messing with the registry sounds a little complex and dangerous to me. There's got to be an easier way. Do you have any advice or recommendations? Can you point me to any helpful resources? Now you see why I want a Mac? Everyone says all this kind of stuff would be so much easier with a Mac. Problem is I have a limited budget and would like to make the most with what I have. I hope I haven't overtaxed you with my questions. Thanks for your patience! Judy

  • Working with colours in a Gauge UI Element In VC

    Hi all,
    Iam working with a Gauge UI Element in my model in VC....iam displaying arc rate ( which is a percentage) using a Gauge UI Element...Can i know whether we can change the colour of needle to depending on the value of arc rate...i.e...
    .if arc rate is less than 30 ...display the needle as green
    if arc rate is between 30 and 60  ...Yellow Colour
    if the arc rate is > 60 .......Red
    Or the other way is display the sector covering the value as  red or green or yellow depending on the value ?
    If any of this is possible ...please let me know the procedure.
    Thanks & regards,

    Unfortunatly, currently the gauge cannot be dynamically styled like that.

  • New JVC GY-HM100u won't work with Premiere Elements 4...?????Help

    Does anyone know if, and why Premeire Elements 4 w
    ill not work with JVC GY-HM100U camera?
    The video uploads into premeire 4, but I have no audio. Please help.

    You really need to define what you are recording with that JVC camcorder and trying to edit in Premiere Elements 4. Are you recording AVCHD (represented as MPEG4 AVC/H.264) and frame size 1920 x 1080 30 frames per second OR 1440 x 1080 30 frames per second OR what might be AVCHD Lite (MPEG4 AVC/H.264) but with the lesser resolution of 1280 x 720, 30 frames per second?
    AVCHD is not supported by Premiere Elements 4. AVCHD support for Premiere Elements exists for versions 7 and 8. There is a special case where, with certain Sony Vaio and Sony Add On, you end up with AVCHD support for your setup. As I recall, in the days of Premiere Elements 4 users who did not have this special Sony Vaio, they needed to convert the AVCHD to a non AVCHD format in order to work with it in Premiere Elements 4.0 (with 3rd party software).
    To avoid the speculation, best to download and install the first utility named gspot and give us a read out for Video Codec: Name: Status; Audio Codec: Name: Status; frame rate, frame size, etc. Be sure to indicate what the file extension is for these videos (.mov, .mp4, .m2t, .mts, .m2ts, or other.
    From what I have read this camcorder does not record SD, but is probably recording AVCHD and HDV. If I am on the right track with this one, have you taken time to look at Premiere Elements 4 with other JVC formats, like HDV, besides whatever you are using now?

  • Safari not working with Yosemite- incompatible with google search too

    Ever since I upgraded my macbook pro, Safari has been slow.  In the past 2 days, it's more than slow - it's impossible.  I am able to get to pages I have bookmarked or get to links in email documents - but every time I try to do a search using the search bar in Safari, it hangs.  Sometimes I get a list of possible websites (after a few minutes) but if I click on any of those, Safari just hangs there and won't go.  I even had to use Chrome in order to generate this question in the discussion groups. Does anyone have any suggestions other than using an alternate browser.   Is it possible that google and Safari on Yosemite are incompatible? I did try using the "Develop" menubar option and chose DuckDuckgo as the search tool and it worked a bit better.
    This is now the 2nd big issue I've had with Yosemite -- it totally would not work with my Adobe Photoshop Elements program -- I spent hours on the Adobe forums and discovered that 100s of others were also having issues.  It turned out to be a problem with Yosemite and the trackpad.  Adobe finally came up with a temporary plugin that allows Elements (and other Adobe programs) to run.
    Suggesions on Safari other than ditching it and using Chrome?

    Try a Safari reset.
    Safari/Preferences/Advanced - enable the Develop menu, then go there and Empty Caches. Quit/reopen Safari and test. Then try Safari/History/Show History and delete all history items.  Quit/reopen Safari and test. You can also try try Safari/Clear History and Web Site Data. The down side is it clears all cookies.Doing this may cause some sites to no longer recognize your computer as one that has visited the web site.

  • I have a client who was working with Now to Date, which is now obsolete.  She is looking for a mac calendar program that is as close to Now to Date as possible.  She has installed Outlook 2012 but finds that is takes too much time to enter data.  Help?

    I have a client who has been using Now to Date on her Mac.  That program is now obscure and she is looking for software that is extremely similar.  She has tried Outlook for Mac and it is too labor-intensive for her.  She wants a professional look, and something that is not linked to e-mail as she works with a lot of proprietary information.  Help?

    I could not identify that app in If a Calendar program, what about iCal? did she try it and disliked? If you go to, and type ‘calendar’ in seach filed, you will be given a lot of apps, you or she should test what it most appropriate for your/her needs.

  • Too many web sites that I go to do not work with your latest version. How can I use a previous version? Right now, I have to switch to IE because I do not upgrade it until I absolutely have to.

    I have to work with a lot of company web sites that are slow to adopt new browser features and expectations. The end result is that when Firefox updates my browser automatically, I frequently find myself broken, and in some cases, simply denied access, for having an "unsupported" browser or browser version. I would like to be able to open a previous version of Firefox, so that I can access that web site. But it appears that when you update, you remove/replace the previous version(s), and I am forced to use another browser.

    I am currently using HP Simple Pass version 6.0, and it had been working like a dream until Firefox recently upgraded to v. 30. Now it doesn't work at all :( The current software won't have anymore updates (last one in 2013), because the omnipresent Apple bought Aunthentec (the company that makes (made) Simple Pass) back in 2012. Dear Firefox, please update whatever you have to to make the 2 compatible again, or I won't be able to use Firefox anymore. :(

Maybe you are looking for

  • Report on Internal Orders

    Hi, The users while recording the entries in the system, maintained the Internal Orders to differentiate between the different types of transactions, The users are now desiring to have the report generated from the system, that would give the details

  • How can i delete my granddaughters i phone from my itunes account?

    When i sign into itunes on my ipad it asks for my granddaughters details for her ipod & if i keep pressing cancel it will then let me sign in with my daetails.

  • How to temporaly switch off flash in opera browser?

    How to temporaly switch off flash in opera browser?

  • Table Maintenance Generator Issue

    Hello Experts, I have created and activated a Z-table ZRATE with 4 fields. Field Name   |        Field Type MANDT          |      MANDT ZRATE           |      ZRATE (DEC 5, 4) FROM_DATE  |     DATAB TO_DATE       |     DATBI And then I generated the

  • Unable to login to IB:  MISSING_DATA

    Dear SDN, After upgrading CMS 7.0 to SP 10 we can't login to IB. The raised error is: MESSAGE ID: MISSING_DATA      at