In need of advice on how to structure class

Hi Guys
I am building a mail webapp. The user can send emails to multiple contacts. I have a table for the mail, mail_reciepiants and contacts. The mail content is in the "mail" table and the "mail_reciepiants" table contains the contact_id and the mail_id. I want to construct a class which gets the mail data from the "mail" table and all the reciepiants data from the mail_reciepiants table. The problem I am having is how can I have multiple contacts in one class ? I am thinking of creating a list for all the contacts and then insert that into each object. Does that sound like a good solution ? Or is there a better way of doing it ?
Edited by: shaolinf on Sep 5, 2008 5:27 PM

There are several ways to approach this, and the way you are thinking is a way.
public class Contact {
// Whatever data a contact instance needs
public class ContactList {
private ArrayList<Contact> contacts;
public void addContact(Contact c) {
if (c == null) throw new NullPointerException("Your errror message here");
if (contacts == null) contacts = new ArrayList<Contact>();
contacts.add(c);
// etc...
}

Similar Messages

  • Need some advice on how to make this Flash movie

    I have 5 flash movies which are all exported swf files from Camtasia. Now I have to design a Flash movie which has 5 Icons on a blank screen which point to each of these movies. When the user clicks on one movie the exported swf from Camtasia should play and when its finished it shoudl go back to Main Menu page.
    a) Is it possible to include a controllable progress bar for a SWF movie
    I am just looking for advice , like do this and do that. I shall try and write the code myself.
    cheers
    peanutlife.

    You may find the VideoPlayer class helpful:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/video/VideoPlayer.html#includ eExamplesSummary
    There's some sample code there which shows you how to put a video player on a movie and play something.  You would just need to add some buttons and stuff.  That example is Actionscript 3.  Things will be different if you have an older version of Flash.

  • Need Some Advice on How to Sell Star Wars Cards

    I'm looking for some free advice. I've noticed that there are quite a few posters who sell cards. I have a box of Star Wars Cards from 1977.  I've had them for about 10 years and there is an unorganized mass of hundreds and hundreds of cards.I haven't counted them but there are a LOT of cards.  It seems like these came directly from the factory. I have no idea what they're about, nor do I have any interest in organizing them, but I do want to sell them and think they have some value. I could list them as is on eBay as is but I'm pretty sure that would be asking for problems on so many levels. I could take them to several stores in my town to see about selling. I can't stress just how far this is from my comfort zone.  That's why I thought I'd ask for advice here. I've started to list these about a dozen times and always end up tossing the box in a corner because it just gives me a headache.   

    I think Pierre makes a good point. What is "lowball" anyway? We all know that to make money here, one needs to at least triple the price paid, so that means at best one is going to get 33% of actual retail from a reseller. So if the cards have an actual marketable value of $300 (ie the SOLD price), the best one could hope for would be $100. For a boxlot like this, there is a lot of work, so figuring one's processing time in, it is likely more reasonable to expect half of that, ie $50. if one is lucky. In my opinion, the value one gets offered will be based on whether the seller has an easy market for it and/or how much time it takes to process it and sell it.  I have encountered situations where I have paid multiple times the price other reputable dealers have offered because "I have a guy" that buys the stuff being sold which allows me to pay more because I have a quick turnaround with little time invested. I am sure other folks who have not sold to me have found other dealers who have paid more, perhaps because the other dealer "has a guy" too that buys different stuff than my customers.  So I know likely for certain, depending on who you ask, there will be people who think I am better than fair in terms of what I offer and others who think I am less than fair because they found someone else who offered more. I also know that I divest some stuff to fellow dealers because other stamp dealers have cultured customer bases and I actually get more money selling it to my fellow dealer than I would get trying to sell it directly myself, and with no risk of loss. Anyway, because I get collateral (non stamps) stuff like this in the big boxes/estates I buy, I try to keep "I have a guy" for the non-stamp related stuff. Usually I find them by taking "free" collateral stuff, and as it becomes clear they're trustworthy, I divert the better stuff to them later. None of that is fast, I'm in my 37th selling year now and it takes a lot of time and energy to "find the guy".... but that's what I try to do... This doesn't really answer the original question, if I personally came across these, and didn't want/have the time to spend sorting them out etc, the route I would probably go is one of my trusted antique sellers. These probably have better chance of going well in an antique store than trying to compete against the loads of stuff here - but I wouldn't have had much invested in them because they'd have been collateral..... sometimes stuff like this goes better than it should in a general auction because folks believe star wars cards are worth a lot (they can be depending on condition, if there are actually complete sets etc). 

  • I need some advice ..How would you..

    I know I can ask this is in a dedicated Forum (of some sort)... but for now ...I am after quick and easy thoughts to start with.
    I want to make a "Home Page" for a retail IN STORE computer screen.
    Its for customers to access specific websites at the click of an icon (LOGO).
    ie 16 logos on screen ..in  custom-skinned Chrome Browser.
    I need this to be simple.
    Placement of Logos ...easy!
    1. So ...what simple application will end me up with an HTML file with each logo , linked.
    I want to avoid apps such as MUSE
    2. I assume its simple enough to place an appropriate file (folder?)  in a Chrome "local location" and make it a Favourite and a Home Page?
    Thoughts.
    Thanx!

    I used to have dreamweaver when it was macromedia .. before adobe got it. Did some pretty cool stuff with it using MS Visual Studio and MS Sql Server for database ASP ( dot net framework with local computer as the " server " ( called IIS ).. using windows ( pc )... pretty much the same as what Bill said...
    You had choices back then about business apps or straight HTML stuff.. and it does get complicated no many levels...
    One is design element ( page design ) and the other is code behind stuff ( what gets delivered from server to client pages ).
    I don't have CC which would probably include dreamweaver now right ??? So, if you do have CC I'd go with dreamweaver and use their templates maybe, or else their forum for help on what you wanna do. They are cool over there at that forum.
    As you probably know, the page design is basically around tables and cells and layers and all sorts of junk.. and that is dependent on the browsers and platforms ( smartphones and desktops and so on )...there's a girl over at dreamweaver forum who is really good and helpful about simple stuff and also complex stuff. and also some guys too... I'd go with that.
    If you want " free " dumb HTML stuff and have windows OS .. you can try Microsoft Expression.. which I got free a couple months ago.. from MS.. it is kinda like DW but more simple...
    In fact, the reason it became " free " was cause they couldn't compete with DW at all.. so they just give it away now. But it works fine for real simple stuff..
    No matter what you use you have to deal with the gazillion " client " things.. desktop, tablets, smartphones, etc .. AND the browser differences.. that code ALONE to seek out what the client is and then choose how to deliver the page ... is a challenge... I bet the DW forum would be a good place to start with that...
    good luck !

  • Need some advice on how to approach a problem

    Hi,
    I have a Jpanel, in which i use paintComponent() to draw a lot of things....
    I pretty much have a large grid...and within this grid, i have lines, which are connected by points....The lines are moved around by dragging the points.
    To check if a point is grabbed....i just get the x,y coordinates from the mouse listener....loop through my list of points, and check if the x,y coordinates of the mouse click fall within a rectangle of the point....this is pretty simple...especially since the points are rather small...
    I now have to figure out a way to enable a right click popup menu to appear if the user right click on top of a line (give or take a few pixels)....now I could take the approach mentioned above...and loop through all the lines....but i would not be able to do 1 check per line...since the lines can be long/short, and take any angle...thus its not as simple to just check a specific area around the whole line (because this area might turn out to be too large)....
    so what i was thinking is to create my own component, which would draw a line, and have its own mouse listeners...and the popup menu would only occur if the mouse listener for the component went off....
    im not so sure of this idea...thats why i am posting to this forum....any and add advice is greatly appreciated!
    thanks!

    thanks for your help...i read the distance formula...and i tried to implement it...but i couldn't get it working....I think i am confused as to what the distance formula is returning...here is my math:
    we have a line between points: (105,239) & (153,239)...this is a straight line across the x - axis....and i click on a point: (140,230)
    first thing i need to do is convert these points into Ax + By + C = 0....so:
    y = (A/B)x + C
    A = (y1-y2); ==> 0
    B = (x1-x2); ==> -48
    C = C*B; ==> 239 * -48 => -11,472
    now we have our equation Ax + By + C = 0 ==> 0x - 48y - 11,472 = 0;
    the distance formula states: abs(Ar + Bs + C)/sqrt(A^2 + B^2)....using r=140, and s = 230...we get:
    abs(0 - 48*230 - 11,472) / sqrt(48^2) ==> approximately 469....
    now this doesn't make sense....since the point is actually only 9 pixels away from the line (in the Y direction)....
    thanks for your help!

  • Needs some Advice on How-to, Real time Price Quote Page?

    I need to create a page that gives  a real time price quote. I would like to be able to allow the end user to  select the an option and in real time update the price and up date a  running total. I have looked around for some extentions but have not  found anything. Can anyone point me in the right direction?? If a DB is  need I use Access and ASP pages.
    thanks
    Dogger

    Anyone????

  • I need an advice regarding my site Work Breakdown Structure.

    Hi,
    I need an advice on how to design my work breakdown structure?!
    I have my WBS divided to Phases and each phase divided to task, there is no details in task(i.e. no lowest tasks under each task).
    So may i design my WBS structure as follow:-
    Project
    Phases "top task"
    Task under phases "Lowest task"
    Please advice, Thanks in advance.

    Hi
    The structure you have described in a valid one.
    The level of granularity of a WBS depends on the practicality of planning and collecting accurate cost for each one of the individual tasks. This may also depend on the company culture, the team discipline, and customer or management control requirements.
    Dina

  • Need samples how to use classes in WebDynpro

    Hi,
    I Need To simple Samples how to use classes in WebDynpro.
    Regards

    Continued....
    and in the model
    right click->create model
    select the radio button import java bean .
    next ADD jars option will be seen
    Browse the jar on the dekstop.
    now add this model to the used models by right clicking on it.
    Now if you go to Data Modeler.
    You will find the used model.
    From there map to the component controller->view Controller.
    And continue with ur coding.
    Hope this helps you.
    Thanks & Regards,
    Lokesh.

  • Need help understanding Time Capsule file structure and how to get it back

    I have the original Time Capsule on which I backup both my Mac Pro and my wife’s Macbook. When Snow Leopard came out, I successfully used the ‘Restore from Time Machine’ feature on my Mac Pro so I know it has worked. However, my wife’s MacBook harddrive died the other day and I was trying to do the ‘Restore from Time Machine’ and all it would find was a backup from April (when I put her in a new larger drive). Time Machine would not find any backup files newer that April. She stated that she had seen the the Time Machine backup notices regularly and as recent as the day the haddrive died (Nov. 23) so I figured that I should have no problem. Here is what I have found in my trouble shooting and what leads to my questions below.
    This is the file structure I found: (note that our ID’s are ‘Denise’ and ‘John’)
    *Time Capsule* (the drive as listed in my Finder window sidebar under ‘shared’)
    >Folder called ‘Time Capsule’ (when logged in as either ‘Denise’ or ‘John’)
    >>Denise Sparsebundle
    >>>Backup of Denise’s iBook (mounted image)
    >>>>Folder called ‘Backups.backupdb’
    >>>>>Folder called ‘Denise’s iBook
    >>>>>>Single folder with old April backup (not the right files)
    >>John Sparsebundle
    >>>Backup of John’s Mac Pro (mounted image)
    >>>>Folder called ‘Backups.backupdb’
    >>>>>Folder called ‘John’s Mac Pro’
    >>>>>>Folders containing all my backup files
    >Folder Called ‘Denise’ (if logged as ‘Denise’)
    >>Denise’s Sparsebundle (a disk image)
    >>>Backup of Denise iBook (the mounted image. Name from old machine)
    >>>>Backups.Backupdb
    >>>>>Denise’s iBook (Contains the backup I need)
    >Folder Called ‘John’ (if logged in as ‘John’)
    >> (empty)
    For some reason, my wife’s backup files are stored within a folder located at the top level of the Time Capsule drive called ‘Denise’, however, mine are within a folder called ‘Time Capsule’ which is at the same level as the ‘Denise’ folder.
    For some reason, when trying to use Time Machine to recover, it bypasses the top level ‘Denise’ folder which contains the correct files and goes into the ‘Time Capsule’ folder and finds the outdated backup files.
    I would assume that both my backup files and my wife’s should be at the same level of the Time Capsule.
    I was eventually able to use Migration Assistant to recover the files after installing a fresh OS and mounting the correct Sparsebundle image.
    So, my question, how do I get this fixed so that if I have to recover a drive with Time Capsule, it will find the correct files.
    Sorry for the long post and thanks in advance for any help.

    John Ormsby wrote:
    What I was trying to determine is why different backups for one particular machine are located at different file structure levels on my Time Capsule and why the most resent one for that machine is at a different level that for my other machine. Also, what is the correct level that both machines backups should be at.
    well John, first can you clarify if you are on 10.4.8 as your profile suggests ? if so, i'm wondering how you can use TM at all because TM was introduced with Leo. if you're not on 10.4.8, please update your profile. if you could, please also indicate details of your machine such as available RAM, processor, etc.
    second, what OS is your wife's machine running ?
    third, i frankly don't know too much about TM's file structure or if there indeed is such a thing as the correct one. however, i do know that it is best to leave TM to do its thing (as long as it's working). FWIW, though off-topic, you may want to have a look at this read for further information.
    last but not least, i see TM backups to my TC only as a part of my backup strategy. the backbone of my strategy is to create bootable clone of my startup disk(s) using e.g. Carbon Copy Cloner on a regular basis. while TM is capable of doing a full system restore, i don't trust it as much as a working clone. i use TM to retrieve a file i accidentally trashed a week ago but you cannot boot from a TM backup if your startup disk goes belly up.
    If I have missed this information in either the FAQs or the Troubleshooting article, I would greatly appreciate being pointed to it .
    i expect you didn't miss anything and i'm sorry you didn't find any help there. perhaps if Pondini (author of the FAQ and troubleshooting user tips) reads this thread, you will get the necessary advice on the file structure and more besides.
    good luck to you !

  • Need advice on how to slice layout

    I am fairly new to web design. I have studied it for two semesters in college, but I have forgotten many techniques since. However, I know enough to follow any advice given.
    What I am seeking is some advice on how to break down my layout. Particularly, I need help deciding how to slice the layout and organize the divs.
    I have a good idea how to slice and manage the header and footer; however, I am puzzled on how I should structure the menu on the right. See the attachment, how the menu drives up from the body content, past the secondary navigation, and into the main image?
    I need help in the middle area there.
    Thank you in advace!
    Hayden W.
    [IMG]http://i19.photobucket.com/albums/b184/HayWet/whetstonelayout.jpg[/IMG]

    If your design comp is in layers, you can toggle layers on/off to save individual elements.
    Taking a Fireworks comp to a CSS Layout in DW
    Part 1 - Initial Design
    http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt1.html
    Part 2 - Markup preparation
    http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt2.html
    Part 3 - Layout and CSS
    http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt3.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Advice on how to access photos on an iPad that were synced from a now failed laptop? The question stems from a need to return my current iPad having just taken delivery of a new unit. Thanks

    I am after some advice on how to access photos on an iPad that were synced from a now failed laptop? The question stems from a need to return my current iPad having just taken delivery of a new unit. Thanks

    If you have a dropbox account, there's a free app (probably more) that syncs photos to your dropbox account - picbox. 
    There's also PhotoSync that syncs photos to/from a number of different services and devices.

  • Everytime I try to open a creative cloud product, the program closes. I need to use both illustrator and indesign for school and I was wondering if anyone had any advice on how to actually make the program work?

    If anyone has any advice on how to make creative cloud programs work please let me know!
    Any help is appreciated.

    These questions below may be for a different product... but the KIND of information you need to supply is the same, for the products you use
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • Newbie needs advice on how to approach a new project using iMovie/Cubase

    Hi all.
    As you have probably guessed it's a music to picture problem, never done it before so I need some advice. I'm doing a guitar tuition DVD so there will be some playing and some speech. I can combine both real time via the mixing desk and feed it straight to the camera's mike input. This seems to be the least flexible and most low tech approach. I would prefer to fiddle about in Cubase to get the audio right before fixing it to the video. I am unsure how to use iMovie and Cubase in a combined way to produce what I'm after. Cubase will handle video and iMovie will handle sound but which way round do I do it? I'm at a loss as even what questions to ask! At the moment I'm setting iMovie to record from the camera, setting Cubase to record the audio and clapping in time with the count in to act as a sync. Once I have my audio file I can import the vid into Cubase or import the audio into iMovie. Am I missing something here or is this the right way to do it? ( I might sound vaguely clever but don't rely on it in your answers ! I'm a guitarist after all....)
    TIA Nick.
    ,quad G5 Mac Mini   Mac OS X (10.4.6)  

    musicians are used to do everything simultanously (=band), film/video is doing each thing after the other ;-):
    I would
    * record the video to a camcorder, incl. guitar/music but NO voice-over…
    * import that into iM…
    * edit all together
    * THEN use this as a "click track" for any audio processing…, mainly adding the narration
    * re-import the final audio track back to iM, create videoDVD, getting rich by selling zillions of them....
    advantage: you concentrate on playing guitar OR telling the tricks&clues...
    besides: whatfor you need Cubase in such a project...? or is it "Guitar IN Cubase"?

  • Advice Needed - Sports Highlight Video - How to Combine Projects?

    I am trying to create a Soccer Highlight Video of my daughter.  The purpose is to be able to showcase her skills in a video and hopefully generate interest from collegiate coaches.  I have recorded video of multiple games which are each about 80 minutes long.  I am guessing I average about roughly 2 minutes of submittable footage from each game.  Once the final video is complete, it will be posted on you tube and the link will be sent out to the appropriate college coaches.
    I am currently working with each game separately as an individual project.  Once I have all the games editted, I would like to combine all of these individual game projects into one big project.  Once combined, I will then want to cut out a good portion of the game clips and just keep the really good stuff for the final product.
    My biggest question is in regard to bringing each small project together for the final project.  Can I "publish" each project and then import the "published" product into Permier Elements 11?  Is there an easy method?
    Any advice on how to easily do this would be very much appreciated.
    (I am using Premier Elements 11 (trial version) and AVCHD video files taken with a standard video camera.  If I can get this figured out I will definitly be purchasing the software.)

    The smartest way to work would be to set the Work Area Bar in each project so that you only output the segments of your videos you're going to use in your compilation. This will save you a lot of editing later as well as save you having to work with big, whopping files that you're only using short segments from.
    The best way to do this depends on how you're going to publish your finished video. Is it going onto a DVD? BluRay? YouTube or other online site? Video for a portable device, like an iPad?
    Each has its own best workflow.

  • HELP: NEED ADVICE ON HOW TO UPGRADE MBP!

    Specs: 13" MBP (Early 2011) 2.3 GHz Core i5, 4GB of RAM, 320GB HDD -- upgrading to new computer is not an option since every component inside is now sautered into the motherboard.
    I have a predicament that I REALLY need your advice on. BACK STORY: 1. Planning on upgrading MacBook Pro to SSD - reason: increase speed and performance (currently using traditional HDD) 2. Double RAM to 8GB. 3. For Computer Science courses in college, will possibly need to install Windows 7 OS for Programming.
    Choice #1: Clone Mac OS and create a Partition to Install Windows OS on SSD. (basically run 2 OSs on 1 SSD.)
    Drawback to choice #1: Not a good idea to write large files to SSD (2 OSs + programs + other docs.) Will potentially kill SSD.
    Choice #2: Clone Mac OS to SSD, Wipe the current HDD and Install Windows OS on that. After installation, remove Optical Drive and install HDD (with a caddy) with Windows OS in its place. (basically take out Optical Drive and have 2 Hard Drives inside computer.)
    Drawback to Choice #2: When powering on computer, will have 2 HDs running. A. 2 HDs running regardless if I need them or not. B. Will significantly drain more power from computer and potentially kill it.
    Choice #3: Install Parallels and run Windows off of that.
    Drawback to Choice #3: If Parallels crashes or freezes, Windows will need to start and that is bad for computer.
    Any suggestions? Thanks.

    Apparently you are committed to certain hardware.  There is no question that the SSD should be installed in the current HDD bay.  Should you choose to have a second HDD, it should be installed in place of the DVD drive.  Note that some early 2011 MBPs had SATAII connections to the DVD drive and some had SATAIII connections (presumably later production models).
    I do not run Windows on my MBPs but I do know that parallels is a resource hog.  On that basis, I suspect that it should be installed on the SSD where you can take advantage of the faster processing.  The SSD will be electrically more efficient than than a HDD.  If you have concerns about battery run time, then do not install the HDD in place of the DVD drive.  I do not know if there are third party applications that allow user intervention for controlling a HDD in the DVD bay.  You might search for same.  If there is, then the argument of installing it there becomes a stronger one.
    You will have to assess your own work flows to determine what impact it has on the configuration options.  Since I do not know them, I cannot comment on that.
    Ciao.

Maybe you are looking for

  • Problem with cache and applications

    Hello, I'm facing a problem with webcache in my portal (v2). I have some reports and their data it's not renewed unless I restart the webcache. How can I disable webcahe for this applications? Thanks

  • I cant receive text

    I have taken my phone to verizon they sent me a new one and i still cant receive text unless they have a picture in them please help i can send text fine

  • How to set width of cfgid in percentage?

    I have to make the cfgrid compatible irrespective of screen size. But it is not taking width in perecntage(giving error : Attribute vallidation error, height/width can not be given in percentage.) I put the cfgrid inside a div and set width of the di

  • Service Provider - Stack of instance - SCASE

    I need to Switch to display mode when a Business Object is opened using the access sequence which is described below, cause standard behavior opens the case in modification mode. (Trx. SCASE) For achieving the problem, i was given the following solut

  • Date from System

    Hi All, How to get output like below.... day 08-Oct-2o12Above day is current day like If today is thursday then thursday,,,, tomorrow is friday then friday and so on..... please help.