Advice needed on design issue

Hi
     I have the following problem at hand for which I have been looking at tangosol coherence lately :
     I have a huge deal dataset (~500,000 deals which are scattered across several tables in a database) and I have a process that would need to pull out the entire dataset for processing (several times a day). The database was too slow, so we designed a simple cache that writes to files on disk and keeps the file cache and database in sync.
     The file cache (each deal detail is written to a file, ~5 gigs in size on disk) is now proving to be too slow and we are looking at in-memory caches to speed up the data retrieval process. The deal dataset is not highly dynamic (typically 400-500 updates take place per day) but it is accessed by several consumers.
     We are looking at tangosol coherence to alleviate our problems. I am looking for a setup which will allow me to query an in-memory cache for data and if something bad happens and the in-memory cache goes down, I could fall back upon the file cache on disk.
     Is there a caching scheme that would allow me to use the existing file system cache as a backup (instead of replicating in memory?). We are a bit apprehensive about removing the file cache altogether. Also could you advise on what caching scheme would work best for such a setup? Any help would be highly appreciated.
     Thanks much
     Sachin

Hi Sachin,
     with the Coherence write-through/write-behind feature you can have an arbitrary persistent storage for your cached data (so you can write to a file instead of a DB).
     However, if you want to use files for such persitent storage, then you should use a network filesystem which is visible the same way on each storage node, which again might be slower. This is required because write-through is usable only with partitioned caches and in that case each node stores only a part of the entire dataset to the disk.
     However, you should also try Coherence with write-through/write-behind to the disk.
     Also, you should leverage all possible optimizations Coherence provides to you, e.g. if you had problems with slow data transfer speeds, then you can reduce the amount of transferred data with ExternalizableLite, speed up queries with indexes, use aggregations to possibly transfer only parts of the data entries, use a near cache for the most frequently used entries when retrieving them by key, etc.
     However it will be a very rare occasion that Coherence would go down without external intervention.
     Please be aware though, that to query Coherence caches to return the same kind of data as originally, the entire data-set should be cached.
     Just my 2 cents, of course...
     Best regards,
     Robert

Similar Messages

  • Advice needed on designing schema to accomodate multiple transaction tables.

    Hi,
    The attached images shows my current schema. It consists of three transaction tables, a product table and a calendar table.
    - Background -
    The product table 'Q1 Data Set' contains all unique sales. In addition it also contains a number of columns by which I will later filter my pivot tables (e.g. whether the customer of the order is new/returning). This
    table also contains a column named 'DateOrdered',the date the order was originally placed (but not paid). 
    Each sale that is paid can be done so either in a single transaction, or across multiple transactions of different transaction types.
    An example of a sale  paid in multiple parts would be an order that has three transactions;
    one online (table 'trans_sagepay',
    one over the phone (table'trans_epdq')
    and another by card (table'trans_manual'). Furthermore there can be more than one transaction of each type for an sale.
    I have created measures which total the sales in each transaction table.
    Each transaction has a 'transaction_date' which is the date of that individual transaction.
    The calendar is simply a date table that has some friendly formatted columns for laying out pivot tables. An example column
    is FiscalMonthAbbrv which displays months similar to '(04) - January'
    to accommodate our fiscal year.
    - Problem -
    My problem is that I need the ability to create some tables that have the
    Date Ordered as the rows (listed by Year>Month), and I need to produce other tables that have
    Transaction Date as the rows.  
    Date ordered works fine, however the problem comes when I try and create a table based on the transaction date.
    With the current model seen in the attached image I cannot do it because the transactions have a relationship to
    Q1 Data Set and this table has the relationship with the
    Cal_Trans table. What happens in this scenario is that whenever I set the rows to be FiscalMonthAbbr  the values it displays is the transactions based not on transaction date but date ordered. To explain further:
    If I have an order A with a DateOrdered of 01/01/2014, but the transaction of £100 for that order was made later on the 05/01/2014, that £100 is incorrectly attributed to the 01/01/2014.
    To clarify the type of table I am aiming for see the mock-up below, I however NEED the ability to filter this table using columns found in
    Q1 Data Set.
    How can I make a schema so that I can use both DateOrdered and TransactionDate? I cannot combine all three transaction tables into one because each transaction type has columns unique to that specific type.

    Thanks for your suggestions, at the moment I don't have time to prepare a non-confidential copy of the data model, however I've taken one step forward, and one step back!
    First to clarify; to calculate sales of each transaction type I have created the following measures (I've given them friendly names):
    rev_cash
    rev_online
    rev_phone
    I then have a measure called rev_total which sums together the above measures. This allows me to calculate total revenue, but also to break it down by transaction type.
    With this in mind I revised the schema based on Visakh original suggestion to look like this:
    Using this I was able to produce a table which looked like that below:
    There were two issues with this:
    If I add the individual measures for each transaction type I get no errors, as soon as I add the 'Total Sales' measure on the end of the table I get an error "Relationship between tables may be needed". Seemingly however the numbers still calculate as expected
    - what is causing this error and how do I remove it?
    I CAN with this scenario filter by 'phd' which is a column in the Q1 Data Set table
    and it works as expected. I cannot however filter by all columns in this table, an example would be 'word count'.
    'Word Count' is a integer column, each record in the Q1 Data Set table has a value set for this column.
    I would like to take the column above and add a new measure called 'Total Word Count' (which I have created) which will calculate the total number of words in that monthly period. When I add this however I get the same relationship error as above and it
    display the word count total for the entire source tbale for every row of the pivot table.
    How can I get this schema working so that I can filter by word count and other columns from the product table. It Is confusing me how I can filter by one column, but not by a another in the same table.
    Also, I don't fully understand how I would add a second date table or how it would help my issues.
    Thanks very much for you help.

  • Design Issue - Need Help

    Okay so I'm having a little bit of a design issue. This is how the section is question looks in design mode:
    I have temporarily published the site for now. IE and Firefox load absolutely fine with no problems at all, but when opened in chrome is looks like this:
    The temporary link for the site is: CCTV Dorset, CCTV Somerset, CCTV Systems Hampshire, CCTV Security Wiltshire - RS1
    As said it is working in IE and Firefox FINE but will not load correctly in chrome.
    Can anyone help as to why because obviously I want this to work in all browsers.
    Thanks.

    Is your text inside the blue boxes?   Might be how chrome makes the text flow if you just placed a formatted them behind...   I would format the text box with color, border and padding to get the same effect and make it flow properly...
    Do you have a separate text box for each text area? 
    I am guessing your issue is might be from how it was put together...
    I have fixed sites that were doing this in mobile chrome with this css change ... but I am guessing you are using the desktop version..
    I know this fixes similar issues in chrome for mobile
    Try adding this to your site global css...
    html * {max-height:1000000px;}
    I know it fixes issues with the mobile version of chrome
    css - how to override font boosting in mobile chrome - Stack Overflow

  • Advice needed on Hyperion Job Opportunities

    Hello,
    I'm trying to venture into Hyperion Consulting and I need some advice on Hyperion Job Opportunities. I thought this would be a good place to ask.
    Let me give you my background. I have a Bachelors degree in Computer Engineering, a Masters degree in Computer Science, and an MBA in Finance from a TOP 15 Business School in the U.S. I have been working as a Senior Financial Analyst for the past 5 yrs primarily doing Forecasting, Budgeting etc using Excel. I'm an advanced user of Excel proficient in vlookups, pivot tables etc. I've also used Hyperion sparingly to get budget and actuals numbers from the Hyperion system.
    Now,I would like to get into Hyperion Consulting. I'm debating whether I should learn Hyperion Planning or HFM (Hyperion Financial Management) and I'm not able to decide. I want to base my decision on which one of these two systems (HFM/Hyperion Planning) has more job opportunities and pays a higher billing rate.
    I've been told that job opportunities in HFM are much less than Hyperion Planning but the billing rates for HFM are higher than Hyperion Planning. Is this true?
    I would really appreciate if anyone can advice me on this issue. It would be great if you could also provide me with the average billing rates for both HFM and Hyperion.
    Thank you very much in advance for your help

    Hi,
    This topic is quite controversial for many consultants who chose to carry on with Planning. Let us be honest for a minute: As Planning consultants, we don't like HFM'ers much, but there is a reason behind it. They tend to perceive us like IT geeks. Well, you may argue that it's not particularly a bad thing but are we not more than that? Once I had a rather strange conversation with the head of HFM team in my previous firm. They were trying to hire someone to their team and interviewing a few people weekly but couldn't find anyone for a long time. I happened to ask him how it was going and he said: "well, you know, physical appearence and candidate's care for outfit is very important for us. We are not like you guys, we are dealing with CFOs and even CEOs s". I replied: "yeah, you are right, we do the design with janitors."
    But on the contrary, most of the time Planning projects urge you to interact with a much larger community within the company than that of HFM's. I can say, for example, I have discussed with production unit heads about the processes involved in producing steel products, or petrochemicals. I have hands-on knowledge about telecommunication, insurance and government sectors. That's why it's so much fun for me and I love doing it.
    About how well you make, it might be true that HFM consultants are paid little more than what Planning conultants are paid on initial grades. But as you move ahead in your carreer, the gap is closed. You can check monster or glassdoor yourself, Planning architects are paid more than HFM counterparts by a significant margin.
    It's I think with little argument is a fact that, Planning requires you to be little more technical compared to HFM but in return you have more fun and gain more experience with it. It's a personal choice of course and I know people who does both. The world needs HFM'ers as much as it needs Planning consultants, well, maybe half as much.
    Good luck.
    Cheers,
    Alp

  • Data mart from two DSOs to one - Loosing values - Design issue

    Dear BW experts,
    I´m dealing with a design issue for which I would really appreciate any help and suggestions.
    I will be as briefly as possible, and explain further based on the doubts , questions I received in order to make it easier go through this problem.
    I have two standard DSOs (DSO #1 and #2) feeding a third DSO (DSO #3), also standard.
    Each transformation DOES NOT include all fields, but only some of them.
    One of the source DSO (let´s call it DSO #1) is uploaded with a datasource that allows reverse type of records  (Record Mode = 'R'). Therefore some updates on DSO #1 comes with one entry with record mode 'R' and a 2nd entry with record mode = 'N' (new).
    Both feeds are delta mode, and not the same entries are updated through each of them, but the entries that are updated can differ (means an specific entry (unique key values)  could be update by one of the feeds, but no updates on the 2nd feed for that entry).
    Issue we have:  When a 'R' and 'N' entries happen in DSO #1 for any entry, that entry is also reversed and re created in the target DSO #3 (even being that not ALL fields are mapped in the transformation), and thefore we loose ALL the values that are exclusively updated through DSO #2, becoming blank.
    I don´t know it we are missing something in our design, or how should we fix this issue we have.
    Hope I was more or less clear with the description.
    ´d really appreciatted your feedback.
    Thanks!!
    Gustavo

    Hi Gustavo
    Two things I need to know.
    1. Do you have any End Routine in your DSO? If yes, what is the setting under "Update behavior of End Routine Display"....Option available right side of Delete Button ater End Rouine.
    2. Did you try with Full Load from DSO1 and DSO2 to DSO3? Do you face the same problem?
    Regards
    Anindya

  • Design issue with sharing LV2 style global between run-time executables

    Hi,
    Just when I though that I had everything figured out, I ran into this design issue.
    The application that I wrote is pretty much a client-server application where the server publishes data and the client subscribes data using data sockets. Once the client gets all the data in the mainClient.vi program, I use LV2 style (using shift registers) to make the data global to all the other sub-vi’s. So the LV2 is in initialize mode in the mainClient.vi program and then in the sub-vi’s the LV2 is in read mode. Also, I had built the run time menu for each sub-vi that when an item is selected from the menu, I would use the get menu selection to get the item tag which will be the file nam
    e of the sub-vi and open the selected sub-vi using vi server. This all worked great on my workstation where I have labVIEW 7.0 Express installed. But the final goal is to make exe’s for each of these sub-vi’s and install runtime on the PC’s that do not have labVIEW installed. Of course when I did that only the mainClient.exe program was getting the updated data from the server but the sub-vi’s were not getting the data from the mainClient.exe. I did realize that the reason for this is due to the fact that I had compiled all the sub-vi’s separately and so the LV2 vi is now local to each executable (i.e. all executables have their own memory location). Also, the run-time menu did not work because now I am trying to open an executable using vi server properties.
    To summarize, is there a way to share LV2 style global's between executables without compiling all of the sub-vi’s at one time? I tried using data-sockets (local-host) instead of LV2 st
    yle gloabls to communicate between the sub-vi’s but I ran into performance issues due to the large volume of data.
    I would really appreciate it if anyone can suggest a solution/alternative to this problem.
    Thanks
    Nish

    > 1)   How would I create a wrap-around for the LV2.vi which is
    > initialized in my mainClient.vi and then how would I use vi server in
    > my sub-vi to refer to that LV2.vi?
    > You mentioned that each sub-vi when opened will first connect to the
    > LV2.vi via via-server and will keep the connection in the shift
    > register of that sub-vi. Does this mean that the sub-vi is accessing
    > (pass-by-reference) the shared memory of the mainClient.vi? If this
    > is what you meant I think that this might work for my application.
    >
    If the LV2 global is loaded statically into your mainClient.vi, then any
    other application can connect to the exe and get a reference to the VI
    using the VI name. This gives you a VI reference you can use to call
    the VI. Ye
    s, the values will be copied between applications. That is
    why you need to add access operations to the global that returns just
    the info needed. If you need the average, do that in the global. If
    you need the array size, do that in the global. Returning the entire
    array shouldn't be a common operation on the LV2 style global anyway.
    > 2) Just to elaborate on my application, the data is
    > transferred via DataSockets from the mainServer.vi on another PC to
    > the client’s PC where the mainClient.vi program subscribes the
    > data (i.e. 5 arrays of double type and each arrays has about 50,000
    > elements). The sub-vi’s will have to access these arrays
    > located on the mainClient.vi every scan. Is there any limitation on
    > referencing the mainClient.vi data via vi-server from each sub-vi?
    Your app does need to watch both the amount of data being passed across
    the network, and the amount being shared between the apps. You might
    want to consider puttin
    g the VIs back into the main app. What is the
    reason you are breaking them apart for?
    Greg McKaskle

  • Advice Needed - Should I just do a Clean Install?

    I've got an older 17" iMac FP that I handed down to the kids (6 and 9). The mainly use Garageband and Pages. Since this was my original machine (before getting my new 20" iMac G5) I decided to leave my account on there, just for a backup. Lately they've been getting lots of "Program quit unexpectedly" on lots of apps, including Garageband, iTunes, TextEdit, and Marble Blast Gold. Things have gotten worse since the 10.4.7 upgrade. I just ran a "fix permissions" and "Verify Disk" all looked good. The machine is in good shape, lots of RAM and about 15G of disc space available.
    So, what's my question... I've been thinking of just starting over; doing a clean install. This machine was originally upgraded from 10.2.8 directly to 10.4.x. I just think that maybe starting from a clean disk would help things out.
    Some questions. What is the best way to backup the kids accounts? I have a FW drive connected to it, so I can back up stuff to it. I really don't want a "clone" just a decent backup. Also, is it a good idea to delete my and my wife's user accounts (I hear a disk image of each account is created). I could copy those over to the FW just as insurance. I've been moved over to the new G5 for about 3 months now, so I'm pretty sure I got everything over. But you know what happens, as soon as I wipe the old system I will discover I am missing something form the old machine.
    What do you all suggest I do? I realize that even after wiping the drive I will probably end up with 10.4.7 after all is said and done. I just think that a clean system may be a good start.
    Thanks,
    Alfredo

    Hi, Alfredo.
    1. You wrote: " Lately they've been getting lots of "Program quit unexpectedly" on lots of apps..."See my "Multiple applications quit unexpectedly or fail to launch" FAQ for advice on troubleshooting this issue.
    2. I trust you've enabled Parental Controls, Simple Finder, etc. to keep the children from discarding system-related files? I presume they do not know the Admin password on that computer and their accounts are not set up as Admin, yes?
    3. You wrote: "What is the best way to backup the kids accounts? I have a FW drive connected to it, so I can back up stuff to it. I really don't want a "clone" just a decent backup."The advantage of duplicating (cloning) is that if you decide to reinstall Tiger from scratch, you can restore their accounts simply using the Migration Assistant from the clone on the FireWire drive after you've set up the an Admin account for yourself to manage their Mac. It's a little-known fact that you can use the Migration Assistant to migrate from an a duplicate of the startup disk of an "old" Mac on a FireWire drive vs. Target Disk mode.
    That would also settle the question of saving a backup of your account and your wife's account on that computer for the time being. At some point you could startup from that clone, then use the instructions in "Mac OS X 10.4 Help: Deleting a user account" to delete those accounts from the clone and move the disk images for such to another drive on your new Mac. Note that if one of the accounts you are deleting from such is the only Admin account, you may want to first create another Admin account on the clone and use it to delete-and-preserve your account and that of your wife as you need to use an Admin account to remove accounts.
    For advice on the backup and recovery solution I employ, see my "Backup and Recovery" FAQ.
    4. If you're going to perform a full, fresh reinstall of Tiger on your children's computer, I also recommend — after cloning the drive and assuring you have good, bootable clone — to first "zero" the drive to remove any bad sectors that may have developed. See "Disk Utility 10.5 Help: Securely erasing disks." Select at least the "Zero Out Data" security option.
    5. FYI: If your children access the Internet, see my "Internet Safety for Children" FAQ for my advice on protecting your children on the Internet. This FAQ lists some Mac-based solutions, tips I have suggested in prior posts, and a list of links for additional information.
    Note that some of the information above is from the "Moving to a New Mac" and "Zeroing Volumes" chapters of my book, Troubleshooting Mac® OS X, Tiger Edition.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • A web service design issue with patterns

    Hello,
    I�d like to ask for your help in the following design issue:
    I need to create an email sending web service (with Axis). Only just one method which returns with an integer return code. This handles the following:
    - based on the given parameters gets the email addresses from an
    LDAP server (with netscape ldap for java)
    -     makes a cache from them (only after a timeout period will be the cache
    refreshed) (don�t know what tool to use for this)
    -     selects html templates which to be sent based on the given parameters
    -     sends emails with the appropriate templates (with Velocity)
    -     the whole process is logged (with log4j)
    I have to write the code as generic as possible. I know that some design pattern should be used for this. (some from GoF , and I know there exists design patterns specially created for web services as well).
    Could you enumerate me which patterns (and for what part of the program) would be the best choice to solve this problem? I have read through some books about patterns, but don�t have the knowledge to pick up the right one for a concrete problem like this..
    Thank you in advance,
    nagybaly

    Hello,
    I�d like to ask for your help in the following design
    issue:
    I need to create an email sending web service (with
    Axis). Only just one method which returns with an
    integer return code. This handles the following:Lots of responsibilities here. You would do well to break this up into several classes that you can test separately.
    I would also advise that you not embed all this in a servlet. Make a service that collaborates with several objects to accomplish the task and let the serlvet just call it.
    .> - based on the given parameters gets the email
    addresses from an
    LDAP server (with netscape ldap for java)I'd recommend Spring's LDAP module. Pretty terrific stuff.
    cache from them (only after a timeout period will be
    the cache
    refreshed) (don�t know what tool to use for
    this)Maybe EhCache or OsCache or something like that.
    -     selects html templates which to be sent based on
    the given parametersWhere does this come from? Certainly not the LDAP. A relational database? Write a DAO for the document template.
    -     sends emails with the appropriate templates (with
    Velocity)Have an e-mail sender service using Java Mail.
    -     the whole process is logged (with log4j)Easily done.
    I have to write the code as generic as possible. I
    know that some design pattern should be used for
    this. No pattern. There might be patterns, if you say that the DAOs to access the LDAP and RDB are patterns.
    Stop thinking patterns and start thinking objects.
    (some from GoF , and I know there exists design
    patterns specially created for web services as
    well).Nope.
    Could you enumerate me which patterns (and for what
    part of the program) would be the best choice to
    solve this problem? I have read through some books
    about patterns, but don�t have the knowledge to pick
    up the right one for a concrete problem like this..
    Thank you in advance,
    nagybalyYou haven't read them because they aren't there. Your problem is pretty specific, even if it's common.
    %

  • Design Issue: Localization using Lookup OR Dependency Injection

    Hello Forums!
    I'm having a design issue regarding localization in my application. I'm using Spring Framework (www.springframework.org) as an
    application container, which provides DI (dependency injection) - but the issue is not Spring- but rather design related. All localization
    logic is encapsulated in a separate class ("I18nManager"), which basically is just a wrapper around multiple Java ResourceBundles.
    Right now localization is performed in the "traditional" look-up style, e.g.
    ApplicationContext.getMessage("some.message.key");
    where ApplicationContext is a wrapper around the Spring application context and getMessage(...) is a static method on that
    context. The advantage of that solution is a clean & simple interface design, localization merely becomes a feature of classes, but
    is not part of their public API. The only problem with that approach is the very tight coupling of Classes to the ApplicationContext, which
    really is a problem when you want to use code outside of an application context. The importance of this problem increases if one considers
    that I18N is a concern that can be found in every application layer, from GUI to business to data tier, all those components suddenly depdend
    on an application context being present.
    My proposed solution to this problem is a "Localizable" interface, which may provide mutators for an "I18NManager" instance that can be
    passed in. But is this really a well-designed solution, as almost any object in an application may be required to implement this interface?
    I'm too concerned about performance: the look-up solution does not need to pass references to localizable objects, whereas my proposed solution
    will require 1 I18NManager reference per localizable object, which might cause troubles if you let's say load 10.000 POJOs from some database that
    are all localizable.
    So (finally) my question: how do you handle such design issues? Are there any other solutions out there that I'm not aware of yet? Comments/Help welcome!

    michael_schmid wrote:
    Hello Forums!
    I'm having a design issue regarding localization in my application. I'm using Spring Framework (www.springframework.org) as an
    application container, which provides DI (dependency injection) - but the issue is not Spring- but rather design related. All localization
    logic is encapsulated in a separate class ("I18nManager"), which basically is just a wrapper around multiple Java ResourceBundles.Why do you think you need a wrapper around resource bundles? Spring does very well with I18N, as well as Java does. What improvement do you think you bring?
    Right now localization is performed in the "traditional" look-up style, e.g.
    ApplicationContext.getMessage("some.message.key");
    where ApplicationContext is a wrapper around the Spring application context and getMessage(...) is a static method on that
    context. Now you're wrapping the Spring app context? Oh, brother. Sounds mad to me.
    The advantage of that solution is a clean & simple interface design, localization merely becomes a feature of classes, but
    is not part of their public API. The only problem with that approach is the very tight coupling of Classes to the ApplicationContext, which
    really is a problem when you want to use code outside of an application context. The importance of this problem increases if one considers
    that I18N is a concern that can be found in every application layer, from GUI to business to data tier, all those components suddenly depdend
    on an application context being present.One man's "tight coupling" is another person's dependency.
    I agree that overly tight coupling can be a problem, but sometimes a dependency just can't be helped. They aren't all bad. The only class with no dependencies calls no one and is called by no one. We'd call that a big, fat main class. What good is that?
    Personally, I would discourage you from wrapping Spring too much. I doubt that you're improving your life. Better to use Spring straight, the way it was intended. I find that they're much better designers than I am.
    My proposed solution to this problem is a "Localizable" interface, which may provide mutators for an "I18NManager" instance that can be
    passed in. But is this really a well-designed solution, as almost any object in an application may be required to implement this interface?I would say no.
    I'm too concerned about performance: the look-up solution does not need to pass references to localizable objects, whereas my proposed solution
    will require 1 I18NManager reference per localizable object, which might cause troubles if you let's say load 10.000 POJOs from some database that
    are all localizable.
    So (finally) my question: how do you handle such design issues? Are there any other solutions out there that I'm not aware of yet? Comments/Help welcome!I would use the features that are built into Spring and Java until I ran into a problem. It seems to me that you're wrapping your way into a problem and making things more complex than they need to be.
    %

  • Design Issues, suggestions welcome

    I have stumbled across some design issues, with a carhire system i am making.
              kept in
         [CAR]------------------->[GARAGE]
    |
                        |
                        | Retives car from garage
    |
    |
    |
                        [TIMESLOT]
    As it stands the GARAGE class automatically has CAR objects added as attributes.     
    import java.util.*;
    public class Garage {
         //class attributes     
              private LinkedList carhold;
              Car ford_ka = new Car("A",135);
              Car ford_focus = new Car("B",149);
              Car ford_Mondeo = new Car("C",179);
               Car Vauxhall_Vectra = new Car("D",239);
              Car Mercedes_E240 = new Car("H",290);
              Car Renault_Espace = new Car("V",399);
         public Garage() {
              carhold = new LinkedList();
              carhold.add(ford_ka);
              carhold.add(ford_focus);
              carhold.add(ford_Mondeo);
              carhold.add(Vauxhall_Vectra);
              carhold.add(Mercedes_E240);
              carhold.add(Renault_Espace);          The TIMESLOT class has an GARAGE object as an attribute, thus enabling it access mehtods.
    import java.util.*;
    public class TimeSlot {
           Garage g = new Garage();
    public void getCarCost(String input) {
               Car theCar = g.search(input);problem is each time a new TIMESLOT is create so too is a
    new garage created with all the cars.
    I really need the garage to be a seperate entity, but still allowing
    the TIMESLOT class to use its methods.
    would in heritence be the appropriate solution, or maybe something else.
    I would like to hear other suggestions.

    I believe a Singleton pattern works perfectly here. A singleton ensures that only one instance of an object is created. You would use it as follows:
    public class Garage {
        private LinkedList carhold;
        // Car declarations here
        private Garage() {
            carhold = new LinkedList();
            // add cars here  
        public static Garage getInstance() {
            static Garage instance = null;
            if (instance == null)
                instance = new Garage();
            return instance;
    public class TimeSlot {
        public void getCarCost(String input) {
            Garage g = Garage.getInstance();
            // do some other stuff
    }Notice the PRIVATE constructor on the Garage class. This keeps classes other than Garage from instantiating it. In fact, the only way to get an instance of Garage is to call Garage.getInstance(), which will always return the same instance.
    You might also consider the Builder pattern, which will keep you from having to instantiate all those Car objects inside of your Garage. You would do something like this:
    public class Garage {
        LinkedList carhold;
        public Garage() {
            carhold = new LinkedList();
        public void addCar(Car c) {
            carhold.add(c);
    public class GarageBuilder {
        public static final int BOBS_GARAGE = 0;
        public static final int BILLS_GARAGE = 1;
        public static Garage buildGarage(int garage) {
            Garage g = new Garage();
            switch (garage) {
                case BOBS_GARAGE:
                    Car c = new Car("bobsCar", 200);
                    g.add(c);
                    break;
                case BILLS_GARAGE:
                    Car c = new Car("billsCar", 400);
                    g.add(c);
                    break;
            return g;
    }

  • Non-profit needs Dreamweaver design help

    Small non-profit serving homeless veterans and veterans in crisis needs design help with Dreamweaver website.  The website was created as a school project by university students but there are some design issues that we are not able to correct.

    It appears to be template driven so the basic layout is inside your site folder's Templates directory -- main.dwt.   This file drives the site wide elements such as navigation, common headers, footers and sidebars. 
    Child pages created from that main.dwt file contain editable regions for content that will change from page to page.  Only content in these editable regions are editable from child pages.
    Whoever will be responsible for updating content should get familiar with CSS & HTML code.  This is required knowledge to work with Dreamweaver.
    Start here:
    HTML & CSS Tutorials - http://w3schools.com/
    Code validation tools
    http://jigsaw.w3.org/css-validator/
    http://validator.w3.org/
    Also thoroughly read DW's Help docs (F1) under working with DW Templates. 
    It looks like the students did a pretty fair job of building the basic site for you.  Now it's up to your org to swap out the generic stuff with relevant content.   I don't advise you to alter the basic layout or structure.  It's all there.  You just need to get up to speed on how to work with it.
    Nancy O.

  • Design issue  - Historical data - referencial integrity

    Hi,
    I dont know if this is the right place to post this question, but
    I would to like know about the design issues in storing historical data .
    I have a historical table about events ( notifications, alarms, etc ).
    In historical table would I store fields with foreign key to the master table ( device table ) ?
    In this design , how handle then updates ( remove record ) to the master table ?
    would I have a trigger to update the historical table too ? Or I mustn' t permit
    updates in master table primary Keys ?
    And about no store The foreign keys in the historical data ?
    What are the disvantages of this model ?
    Thank you,
    Faria

    Faria,
    The answer depends on why you want historical data.
    Is the historical data to be used for auditing or legal purposes?
    Are you trying to move historical data for performance reasons?
    Is there some other purpose?
    If you're doing this for auditing purposes, I don't recommend using foreign keys since you won't easily be able to capture delete activity.
    I mostly use Designer for all of our designs and typically will turn on server side journaling for this purpose. Designer will then generate the journaling tables and write the triggers to manage the whole process. You don't even need to be a programmer to figure it out.
    Let me know back if this isn't your purpose or you need clarification.
    Thanks, George

  • Design issue using JFrame, JPanel, JLabel

    I have been working on this problems for several months now and I and nearly finished.
    I have a design question I hope others from this forum can provide some incite to the best approach.
    The problem space is a 8 X 8 Chessboard. I have designed a board using JPanels and JLables sitting inside a JFrame. In each square on the chessboard is a JLabel with an image. The "board" sits in the DEFAULT LAYER of a JLayeredPane. As the user clicks a specific square, a queen is placed in the square (8-queens problem). The only thing I do is swap out the image. All this works well--thanks to several of you from this forum. :-)
    When I add a new queen to the board, the application goes through the evaluation of attack positions. Next, the application should display the new chessboard with only the queens not threaten by other queens. I keep up with the chessboard using an boolean array internally. I build a second boolean array for the new or refreshed chessboard.
    What I want to do is build a second chessboard and "swap" it out with the one in the default layered pane. Can someone be so kind and shine some light on this design issue for me?
    Thank you for taking the time to read my post.

    I don't understand this approach. Swing is by default 'double buffered' and will not flicker. You will get this be default since this is one of the things the Swing painting model gives over AWT.
    You should look at just using JComponent and the paintComponent() method for drawing what you need.
    What I've done in the past is have a simple XML JDoM model. Have components that render themselves based on this model.
    Changing the model then I just issues a call to repaint() at the top level container.
    You can also add and remove items from the parent container. Then issue validate() or repaint(). Can't remember now but I think validate() hits the layout manager logic and then repaints.
    I'm pretty sure the Romain guy posted an example of how to easily draw a background chess board in a panel. ;-)
    The tree concept might really prove useful for a 'gaming tree' approach at the AI also.
    If you look at the Java3D API you will see they use a tree to represent what is rendered and the details about it. Really nice until you change something in the tree that cause the renderer to blow up. ;-)
    I guess the moral is always make small simple changes and test.
    Hope this is helpful.

  • Design issue?- T530 Lid Flex

    just got my t530 , so far pretty happy with it
    but i have realised a possible design issue with the lid
    if i applied strength on the middle of the lid, the latches closes well on both left and right of the lid
    however,if i just applied strength on either left or right side of the lid,
    the latch locks for the corresponding side when i applied pressure on, but not for the other side and vice versa
    this creates slight flex on the lid whereby one side is latched onto the laptop body and the other side doesnt.
    i believe the lid is not as rigid or strong enough such that both sides of the latch can lock on regardless where i apply pressure on when closing
    has anybody tried or seen such scenarios?
    now i am pretty worried if this flex has created stresses on my lcd screen and unnecessary damage

    anybody encountered the same scenario?need some advise.thanks

  • Design Issue- Experts Help

    Hi,
    I need some ideas from experts in this design issue.
    I am in just the beginning of my data flow design.
    I have 10 fields to be displayed on my report.
    All these fields come from 4 different datasources.
    What would be the ideal way to proceed.
    Thanks,
    JB

    JB,
       First analyse the data which comes from 4 ODS's. Check what are the common fields in four. Based upon that you can go for various options. More analysis will lead you choose a proper and consistent design.
    If possible give the fields of four data sources.

Maybe you are looking for

  • After installing Lion, Win XP no longer works with Parallels 6. Help!

    The start-up button won't work, windows explorer doesn't work, everything i click on has the hourglass that goes on forever and nothing happens.  If I can't find a solution soon, I will be asking for info on wiping out windows and Parallels completel

  • Which Intel Mac for Music Recording, Please?

    Hi-- I'm brand new here. I'm a music professional who is in the middle of switching my recording setup toan Intel Mac-based studio, running either Logic Pro or Digital Performer (once it's ready for Intel Macs, that is). I've got an indie filmscoring

  • How to validate a date item  "DD/MM/YYYY HH24:MI" ?

    Hi, I want to create a validation item. I have a date item usinhg this mask : "DD/MM/YYYY HH24:MI". I want to validate if a date entered according to this syntax "DD/MM/YYYY HH24:MI" Unfortunately APEX gives me only the choice to validate if a date i

  • "No Service" post - 1.1.2 upgrade

    Good day all, Since I upgraded my iPhone to V1.1.2 I frequently receive a "No Service" condition after my phone has been left on for some time. (overnight or longer) Other cell phones which have been on for the same time period (Nokia 8801) continue

  • I lost my admin user

    Note: this is not a replacement for I lost my admin user, which probably ought to be renamed "I lost my admin user (OS X 10.4 and earlier)", but that Tip will not work with Leopard. I lost my admin user (OS X 10.5) If you are unfortunate enough to de