Avoiding new instance

hi all this is my code
     Set<Person> list = new HashSet<Person>();
          Person p=new Person();
          p.setName("peter");
          list.add(p);
          p.setName("paul");
          list.add(p);
          list.add(new Person("other"));
          list.add(new Person("other"));
     System.out.println(list.size());
          for (Person o : list)
          System.out.println(o.getName());
     the output i see is      
3
other
other
paul
I want to know why peter is not considered here? but if i create a new instance it works , why cant i push a same instance twice in a set with two different values
Person is a simple bean with a name attribute
Thanks

j_peter wrote:
hi all this is my code
     Set<Person> list = new HashSet<Person>();
          Person p=new Person();
          p.setName("peter");
          list.add(p);
          p.setName("paul");
          list.add(p);
          list.add(new Person("other"));
          list.add(new Person("other"));
     System.out.println(list.size());
          for (Person o : list)
          System.out.println(o.getName());
     the output i see is      
3
other
other
paul
I want to know why peter is not considered here? but if i create a new instance it works , why cant i push a same instance twice in a set with two different values
Person is a simple bean with a name attribute
ThanksI think this can solve your problem,
p=null;
p=new Person();
p.setName("dfasdf");
p=null;
p=new Person();
p.setName("hghg");
-----

Similar Messages

  • Internet Shortcuts saved on Desktop open new instance of Firefox 3.6 using clean profile--how can I make it open all shortcuts using current profile?

    I rely heavily on Firefox's profiling ability to assist me in my web design projects. Lately, using Firefox 3.6, I have run into some problems with how it opens Internet Shortcuts that are saved locally (i.e.- shortcuts that reside on my Desktop). When I double-click on one of these shortcuts, a new instance of Firefox 3.6 is loaded with the saved website from the shortcut, but it's also initialized a fresh profile (i.e.- my bookmarks are gone, no add-ons, etc.--it's as if it uses some sort of "hidden" clean slate to load the shortcuts).
    Is there any way to force Firefox to load all shortcuts into whatever profile I'm currently using at that given moment? I think the reason this has happened to begin with is because of the fact that I did some stuff to Internet Explorer awhile back that caused some problems with the Internet Shortcut associations and it all led to this eventuality.
    I'm running Windows XP Pro and have the following profiles with my Firefox versions:
    "C:\Program Files\Mozilla Firefox 3.6\firefox.exe" -no-remote -p Firefox3.6
    "C:\Program Files\Mozilla Firefox N\firefox.exe" -no-remote -p FirefoxN
    "C:\Program Files\Mozilla Firefox 3\firefox.exe" -no-remote -p Firefox3
    "C:\Program Files\Mozilla Firefox 2\firefox.exe" --no-remote -p Firefox2
    When I go into the "Folder Options / File Types" and double-click on "Internet Shortcut", I have the following within the "Advanced" settings (for the "open" action):
    Action: open
    Application used to perform action: rundll32.exe shdocvw.dll,OpenURL %l
    "Use DDE" is checked...
    "DDE Message" is blank...
    "Application" is "shdocvw"...
    "DDE Application Not Running" is blank...
    "Topic" is "System"
    Again, I think the root problem here is to do with the profiles and how they're handled when being opened with Firefox but I can't discern how to apply a fix with all this as I've obviously goobered this up a bit. I would really appreciate some professional knowledge on this and would prefer to avoid any reinstalls of anything if possible.

    To save your sanity with this issue, my advice is to find a method other than desktop shortcuts to open those URL's.
    1. Desktop shortcuts are going to open the Default Browser.
    a. With multiple versions of Firefox installed that would be the last version that was installed when you have Firefox set as the Default Browser in Windows..
    b. The Default Browser is going to use the Profile that shows a Default=1 in the profiles.ini file.
    c. The Default Browser with the Default Profile isn't going to open if you have any other versions of Firefox already running, and the -no-remote command line parameter doesn't work in this situation.
    2. The use of multiple Profiles and multiple versions isn't officially supported by Mozilla, and all the Bug reports that I have ever read about Requests for Enhancement have been WONTFIX'd by the developers. Basically we have to work with the limitations in Firefox and maybe improvise work arounds by ourselves. I've even seen a few threats about removing Profiles altogether in RFE Bug reports about Profiles.
    I have had so many problems over the years with this Default Browser / Default Profile thing over the years that personally I find it easier to just set Opera as the Default Browser in Windows rather than have a Profile get b0rked because some other program I am using decides it wants to open the Default Browser unexpectedly. I don't use Opera for much, but it is a lot better than IE for purposes of being the Default Browser, considering the quirks I have seen with Firefox and multiple Profiles.
    I have written a number of postings over at the MozillaZine Builds forum over the years about installing multiple versions of Firefox and using multiple Profiles. There's a lot of tips and comments provided by other multiple Profile users in one of those threads. Why don't you read those threads and see if it gives you some ideas or solutions I haven't thought of.
    http://forums.mozillazine.org/viewtopic.php?f=23&t=1062975
    http://forums.mozillazine.org/viewtopic.php?t=613873
    http://forums.mozillazine.org/viewtopic.php?t=462431
    The last thread listed has a lot of comments offered by other users, the first two threads were locked as a How-to sticky thread.

  • PS2013 - When creating a new instance of Project Server hangs in 'Waiting for resources' status

    Hi,
    I have one instance of Project Server 2013 fully operational and I tried to duplicate the instance to make some tests. As I know the issue of using the same Content Database of Project Server in the same Server Farm, I used the powershell  backup/restore/dismount
    and mount the content database to change the site IDs to avoid index duplication. The Project server database was a regular SQL backup and restore in another database.
    I created a new Web App in the port 90 as show below.
    Then I included the Content database of Project Server as separated DB from SharePoint for this new SharePoint -acme90 and I tried to create the new instance. The creation hanged in "Waiting for Resources" status.
    To make another check excluding the reuse of the SharePoint-80 I tried to create another instance both in the SharePoint-80 where is the working instance and in the SharePoint-90, everything default and again they all hanged in Waiting for Resource.
    If I try to create the instance using PowerShell I got the following error:
    PS C:\Users\epm_setup> Mount-SPProjectWebInstance -DatabaseName Test_EPM -SiteCo
    llection http://acme02/epm -Lcid 1046
    Mount-SPProjectWebInstance : Cannot find an SPSite object with Id or Url:
    http://acme02/epm.
    At line:1 char:1
    + Mount-SPProjectWebInstance -DatabaseName Test_EPM -SiteCollection
    http://acme02/ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : InvalidData: (Microsoft.Offic...ountPwaInstance:
       PSCmdletMountPwaInstance) [Mount-SPProjectWebInstance], SPCmdletPipeBindEx
      ception
        + FullyQualifiedErrorId : Microsoft.Office.Project.Server.Cmdlet.PSCmdletM
       ountPwaInstance
    All SharePoint and Project Server services are running, all App Pools and sites are started at the IIS. I could not find a hanging timer job.
    I cannot stop the hanged process or dismount the instances using Powershell since no instance created.
    How should I solve the hanging status of creation of the instance? As they are in Hyper-V I can go back using one snapshot.
    Thank you.
    Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner

    Hi Eric,
    Thank your for your interest in this case.
    I checked for running and crashed PWA jobs and deleted all of them just after restoring the snapshot and tried to create the new instance in the new web app in port 90 (besides the existing and working instance in port 80), but again it hanged in "waiting
    for resources". There is not any timer job hanging, no error in event viewer or in log. So the error is well before working with cloned dbs.
    Answering your questiion, I am working all on 2013. My intention is backup one instance of the port 80 and copy to the instance of port 90, changing of course the url and the index of the content db of SharePoint. The process I used was:
    Create a new web app in port 90, creating a new SharePoint_Content_2 on a
    http://server:90 site.
    Created the top level site called Portal using the Team Site template.
    Create a new content db for new instance of Project Server named EPM_Content_2 using Central Admin.
    Backup content db from port 80 instance of Project Server and restore to this EPM_content_2 using PowerShell cmd.
    Dismounted and mounted this Project Server content db to create new index for existing sites to avoid index conflicts.
    Backup the Project Server DB from port 80 using SQL backup and restored as ProjectWebApp2 db for port 90 instance.
    Tried to create a new instance of Project Server
    http://server:90/pwa on web app of port 90 using the ProjectWebApp2 db and using the same app pool of the other instance. But as in the previous case, it hang out in "Waiting for resources".
    Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner

  • SharePoint 2010 creates a new instance for SharePoint server.

    I have installed SP 2010.My env is Windows server 2008 R2 and SQL 2008 r2 (10.50.1600). When I install the SP 2010,
    configuration wizard (Start the SharePoint Products Configuration Wizard) directly goes to configuration wizard and installed SP 2010 server successfully.
    It skips the below Manual configuration.
    1. Specify Configuration DB settings
    2. Specify Farm Security settings.
    3. Configure CA Web Application settings. etc...
    So I get the new SQL instance with the name <MachineName>\sharepoint.
    This new Instance is looking SQL 2008 version(10.0.2531).
    Now I face the below issues,
    1. When I restore DB backup, i get the compatability issue 
    2. Unable to restore the SP2010 site which is backuped from SQL 2008 r2 (10.50.1600) has 9GB size.
    3. Unable to extend the DB size from 4096 MB. 
    How to avoid create new SQL instance with the name <MachineName>\sharepoint and install in SQL server default <MachineName> instance?
    Loganathan S

    Hi Paul
    stork,
    thanks for the help. Now I have another Two questions. I'm search service application in SP 2010. It works fine when I search data from home sites it works fine.
    1. When I search from within sub-sites i don't get any search results. What mistake I have done here?
    Second question from Restore spsite...
    2. When I restore the site in 80 port, the search service does not crawl and pick the new properties from the restore site. But when I restore the same site in another port<8080/8099/etc>  the search service does crawl and pick the new
    properties from the restore site. Why the service not working in 80 port.?
    Note: I have checked with 3 test env my bak file. but all the 3 env gives same result.... 80 port  does not crawl and pick the new properties.
    Loganathan S

  • Best practice for creating a bulk of new instances

    Hi,
    My customer has a requirement to create a bulk of 30,000 new instances by scanning a database table (an export from a billing system) which contains a list of a call center tasks (interactive) to be performed. They will be executed throughout the month.
    What is the best way to do it? If the answer is "this is a worst practice" that's a good answer too, but the question is how do I provide a solution to their needs.
    When the process was executed as is we ran into the maximum limit of 1,000. Configuring the automatic item queue removed the 1,000 limit exception but caused JTA timeout and other exceptions against the engine database.
    It seems to me that some sort of division into bulks of a few hundred instances should be the way to do it instead of just exploding the engine with so many instances. Am I right? If so, how would be the best way to code it? If not, any other suggestions?
    Any recommendations would be highly appreciated.
    Thanks,
    ~ronen

    Hi,
    Know how you feel.
    Others are sure to have other ideas, but here are a thoughts:
    1) You might also want to consider only creating 995 in a single transactional boundary at a time. Once 995 have been created, end the transaction so it will commit. You could then fire another transaction that creates another 995. Keep doing this in separate transactions until all have been created. Sure you know many ways you could keep track of where each group of 995 ended and where your next group of 995 should begin, but a common technique is to keep track of the last row processed in a separate database.
    2) Sure you've thought of this, but consider running this from a Global Automatic that is scheduled to run at a time when everyone's gone home. The last thing you want is to get complaints from the end users about performance. Their interaction will be degraded and your creations will take longer.
    3) If you can, be especially conservative about your instance size when creating instances in a batch. Avoid adding attachments and binary variables as they are being created (both of these can potentially be huge). Get rid of the incoming argument variables that you do not need right away in the process. Many times you can look up the additional information downstream when needed later in the process.
    4) Note what is happening immediately downstream of your Begin activity in the process. If for example, you have more than one automatic activity that immediately follow the Begin, consider either turning all the automatic activities it a procedure (one transaction) or set your process to "Greedy" execution. If you have a Multiple activity immediately after the Begin, you might be creating 10x the number of instances (e.g. your Multiple's logic creates 10 copies). If the is the case, you might want to throttle back the number of instances created in one transaction even further.
    Hope this helps,
    Dan

  • Why is it that sometimes when I use my middle mouse button to click on a link to open it in a new tab I will have it open it in an entirely new instance of Firefox instead of a new tab?

    Occasionally when I click on a link with my middle mouse button, instead of opening the page in a new tab, it will open a new instance of Firefox.
    I've looked through some of the settings and I wasn't able to find anything. It really gets to be bothersome at times because I prefer things to be in tabs instead of a new browser.

    It's not specific sites. I can middle-click on the same link 50 times and it will open it in a new tab 45 times and 5 of those times, it will randomly open it in an entirely new window. I don't know what's causing this.
    It happens so randomly that I don't know how to pin-point what it could be.

  • Schedule Webi (and Crystal) report without creating a new instance

    Hi all,
    I'm looking for the way to not create a new instance of the report when we schedule a report? Is it any actions on the InfoObject object? Or is it just impossible to do?
    Thanks in advance !
    Edited by: jerome.vervier on Nov 21, 2011 11:40 AM

    Hi,
    With regards to your query, whenever a report is scheduled an instance of it will be created.
    Therefore, it is not possible to schedule a report without creating an instance.
    Regards,
    Shreyans

  • I need to transition my 1st Generation Apple TV from an older instance of iTunes to a new instance of iTunes on my brand new Mac... How do I "switch" from one instance of iTunes to another? How do I get the 5 Digit Code Network to come back on my Screen?

    I need to transition my 1st Generation Apple TV from an older instance of iTunes on my iBook to a new instance of iTunes on my new Mac... How do I get the 5 digit Network code to come back? Is there anyway for 1st Generation Apple TV to be synched to two instances of iTunes or do I have to choose one or the other? I appreciate any advice or suggestions. Thanks!

    The 5 digit code is every time different. That does not matter. Just integrate every device into your network.
    You can connect many computers to Apple TV but syncronisation works exactly with one computer. That's why I use "streaming". But you can sync one computer, then another, and so on. The content on your Apple TV is the content from your computer that has synced last. But you can not mix it.
    The new Apple TV has no syncronisation. Everything is streamed,
    Regards,
    Torsten,
    Germany

  • How can i create a new instance on unix

    Hi,
    How can i create a new instance(instance only) on UNIX and how can i mount my database with this new instance.

    udayjampani wrote:
    Hi,
    How can i create a new instance(instance only) on UNIX and how can i mount my database with this new instance.1) Define Instance in your way!!?
    If you simply create a pfile and startup nomount with it, then -in theory- you have an instance running ( this method is used e.g. for restoring a rman backup )
    2) You can't. Database files are bound to a certain instance. What you can do is recreate an instance with e.g. a different name, using the scripts generated by a 'alter database backup controlfile to trace;' command
    Cheers
    FJFranken

  • How can we open a new instance of Firefox without URL bar and any other control (except PREV, NEXT and RELOAD)?

    Dear Volunteers,
    I am looking for a solution for Firefox Win App and Mobile Apps where on click of a button from the website page, we should be able to launch a new instance of firefox instance (like a popup box) with following features:
    a. It SHOULD NOT have any URL bar to display.
    b. It SHOULD NOT show any plug-ins or any other functionality except Previous, Next and Reload.
    c. This instance of firefox should always be on-top of all other application.
    Please advise, how firefox can be customized to offer in all platforms by default.
    With lot of hope from this volunteer community,
    Rajiv

    You would need your visitors to install some kind of add-on, since web pages do not have permission to block the display of the page address and users do not need to allow a new window to be modal and block other Firefox windows, much less other OS windows.
    Over the years, people have developed extensions for kiosk-style displays. You could investigate those for ideas.

  • How can i run a new instance of API by providing seperate JVM.

    Hello,
    I have some static member and function and they conflicted while opening the new instance of API. Can i run a new instance in separate JVM so it will run independently even we have static members and functions.
    Or do we have any other procedure, without removing "static" we can run with out conflicting ?
    Thanks
    Ashish Pancholi

    YuccaS wrote:
    Once again someone thinks static is the same in a distributed application/clustered system. The OP must realise that static is only static per jvm of which there can be more than one in an environment and may not work in a cluster if pooling is used across the cluster. I am no expert on this myself but I think the solution has something to do with creating your own class loader or use JEE which may provide the OP with the flexibility they wish to have?Personally I think they've just found a new version of some API they're using, and don't want to refactor all their code to fit it. Writing web service layers and the like, even a bunch of RMI code, is going to be more painful than that.

  • Create a new instance in HPUNIX 8.1.7.database without Xwindows

    Can Somebody help me?
    I want to create a new instance in HP-UX 8.1.7 database. There is no Xwindows installed. I think i should do this in SQL plus.
    If so can sombody give my this script.
    thanks

    Can Somebody help me?
    I want to create a new instance in HP-UX 8.1.7 database. There is no Xwindows installed. I think i should do this in SQL plus.
    If so can sombody give my this script.
    thanks I have not tried this but expect you could use dbca (database creation assistant) with a script on the HP host.
    RP.

  • ORA - 01034 : ORACLE NOT AVAILABLE  Error while creating new instance.

    I was trying to create new instance in unix environment. I have configured all my shell scripts to run and install but while performing the install I get the
    following error message and fails.
    ORA-01034: ORACLE not available
    I have previously installed an instance using same scripts but fails this time when I copy the scripts and modify them in new folder. Pointed out the path in the scripts correctly.
    I am a junior DBA and I would appriciate your help.

    Paste here scripts, your .profile (or environment variables according to Oracle) and your init.ora

  • Problems when creating a new instance of an Input parameter for a REM

    I am working in a small demo which calls a Remote Enable Function Module in order to read data from the back end system. Since the function module I need to call ("BP_BUPA_SEARCH_BY_USER") is not Remote Enable I created a copy of it and made it Remote Enable ("Z_BUPA_SEARCH_BY_USER"). I have created the model within webdynpro without any problems but when my application reaches the line where I create a new instance of the object Z_Bupa_Search_By_User_Input (see below the source code), just before to call the remote function, the application stops there. I have exactly the same code in another bapi calls and it works fine. I am wondering if my problem has anything to do with the fact the function module i am calling is the function module I created. Any advice is very welcome.
    Regards,
    Diego.
    Source Code:
    msg.reportSuccess("------>>>");  "THIS LINE IS PRINTED
    Z_Bupa_Search_By_User_Input searchByUser =
    new Z_Bupa_Search_By_User_Input();  "PROGRAM STOPS HERE          
    msg.reportSuccess("<<<------");  "THIS LINE DOES NOT                
    wdContext.nodeZ_Bupa_Search_By_User_Input().bind(searchByUser);
    msg.reportSuccess("<----
    msg.reportSuccess("if (Internet_User != null)");
    if (Internet_User != null) {
    Usselmodbe ir_user = new Usselmodbe();
    ir_user.setSign("I");
    ir_user.setOption("EQ");
    ir_user.setLow(Internet_User);
    searchByUser.addIr_User(ir_user);

    Hi,
    Try to get some more error info, e.g. like this:
    try {
    Z_Bupa_Search_By_User_Input searchByUser =
    new Z_Bupa_Search_By_User_Input(); "PROGRAM STOPS HERE
    } catch (Exception e) {
        msg.raiseException(e.getMessage(), true);
    msg.reportSuccess("<<<------"); "THIS LINE DOES NOT
    good luck,
    Roelof

  • Checking for a value in a field within a subform before allowing a user to add a new Instance

    Form setup:
    Page name = Page1
    1st Subform within Page1 = Info (set to flowed)
    Objects within Info subform: Name (textfield) and Email (textfield)
    I also have a 2nd subform within Page 1 which contains an add instance button
    What I'm trying to do:
    1. The user needs to enter their Name and Email address then click "Add Instance button" to create a new instance of the Info subform :  _Info.addInstance(1);
    2. If the user fails to enter an email address, I want there to be a mesage box that infos the user that an email address is required before he/she can create a new instance. Note: It would also be nice if the cursor is Set to foucs on the email field within that particular subform instance.
    3. As long as the user tries to continue adding an instance, he/she will be denied if they do not enter an email in that instance
    4. If the user includes an email address in that instance, then the script will create add a new isntance
    5. The process should continue in this manner for each each click of the add instance button
    I presume there nees to be a loop and perhaps a somExpression scipt, but I'm not sure.
    Here's what i have so far (see below)....The script works for the first instance on the page, but it doesn't prevent new instances from being created when the email field in that "current instance" is empty. I want it to prevent the user from adding new instances if the email field is balnk in that "current instance". So, I guess I'm not sure how ot test a field in the current instance in a repeating subform.
    var vName = Info.somExpression + ".email";
        var vEmail = xfa.resolveNode(vName).rawValue;
        if(vEmail == null)
    xfa.host.messageBox("PLease enter an email address.");
    else{
    Form._Info.addInstance(1);
            var i = Form._Info.count - 1;
            xfa.host.setFocus(xfa.resolveNode("Info[" + i + "].Name")); //This set's the focus of the cursor in the Name field of the newly created subform
    Please advise, and thank you in advance!!!!!!

    Hi,
    I think you can acheive what you want just by adding "lastRow.presence = "hidden";" when you do the addInstance, so it now looks like;
    var lastRow = Form.resolveNode("Info["+(_Info.count - 1)+"]"); // Get last row
    if (lastRow.Email.isNull) // If email field empty
        xfa.host.messageBox("Please enter an email address.");
    else
        lastRow.presence = "hidden";
            var newRow = _Info.addInstance();
        xfa.host.setFocus(newRow.Name.somExpression); // set focus to Name field on the row just added
    So whenever you add a row the previous one is hidden?
    For your second issue, if you could have another button on your form, you could ask the user for a password and if they enter it correctly then show for the Info subforms, so;
    var response = app.response({ cQuestion: "Do you want to see all respones?",
                                  cTitle: "Unlock Form",
                                  bPassword: true,
                                  cLabel: "Please enter the password:" });
    if (response === "Password")
        var infoSubforms = Form.resolveNodes("Info[*]");
        for (var i = 0; i < infoSubforms.length; i++)
                    var infoSubform = infoSubforms.item(i);
            infoSubform.presence = "visible";
    You would want to password protect your template as well (in Form ... Form Properties ... PDF Security) so people couldn't just open the form and look at the password.
    Probably the simplest approach.
    Hope this helps
    Bruce

Maybe you are looking for

  • Ipod touch won't charge at all

    iPod touch won't charge at all - think it's the port on the ipod itself not the charging cord - any suggestions?

  • Why i get server connection error 901 in my new hp and no apps connection?

    IM getting very mad,  my first time buying an HP brand and IM already tired . Printer just won't  connect by itself to the apps and keeps showing messages of unable to connect to server or server connection error 1 or error 901.... Any help  on the p

  • Workspace Quicklinks

    Hello, In Workspace 11.1.2.2, is it possible to display > 4 'Favorites' under the quick links section of homepage? Thank you.

  • Content disappearing from MUSD on project load...

    I have a student working in MUSE on a class project.  She loads her project file, and the content is visible in thumbnail view.  As the project loads, however, all content (including embedded images) disappear completely.  So far, searches have not y

  • PS CS4 3D - Raytrace and Glossiness problem

    When working with a 3D layer, I cannot use any textures besides the diffuse texture at the same time as using the render setting "Ray Traced".  For example, everything works great when the render setting is set to "Solid": I can use a high quality gl