PRC returns same FolderID as ParentFolderID in simple test

Greetings,
I have been trying to learn the PRC API and encountered an interesting artifact. Basically I get the same FolderID as ParentFolderID for community objects when I invoke a query.
Now, I might be dumb, but I am using the very code out of Plumtree's tutorial on "Extending Server Functionality with Remote API's" so I find it unlikely I copy and pasted wrong.
Interested in knowing if anyone has any insight into this or if this is a Plumtree Bug.
To duplicate just write a little client program:
1. initiate a session with the portal,
2. Retrieve object manager
3. Query the community objects
4. Display portal object properties (For this you have to add folderID yourself.)
Please, Please let me know what you find.
This is G6 , running C#.
Thanks,
Richard

Greetings All,
For your review is the code in which I am noticing the problem. This is code from a Visual Studio.NET project I created. To compile, you must first bind in your IDK references.
Notes:
1. Do a search on "REVIEWER" to see special notes.
2. ALL CAPS MEANS YOU MAY HAVE TO ADD YOUR OWN INFO.
// Start of Code:
using System;
using Plumtree.Remote.PRC;
using Plumtree.Remote.Portlet;
using com.plumtree.openfoundation.web;
namespace PortalRemoteClient
     public class HelloWorldSession
          public static void Main(string[] args)
               try
                    // REVIEWER: Port 11905 is Plumtree's default, yours may be different!!!
                    IRemoteSession session = RemoteSessionFactory.GetExplicitLoginContext(
                         new Uri("http://USEYOUROWNSERVER:11905/ptapi/services/QueryInterfaceAPI"),
                         "YOURUSERID","YOURPASSWORD");
               QueryCommunities(session);
               catch(Exception e)
                    Console.Error.WriteLine(e.Message);
                    Console.Error.WriteLine(e.StackTrace);
          public static void QueryCommunities(IRemoteSession session)
               ObjectProperty[] propsToReturn = new ObjectProperty[3];//choose to return specific properties
               propsToReturn[0] = CommunityProperty.Name;
               propsToReturn[1] = CommunityProperty.ClassID;
               propsToReturn[2] = CommunityProperty.ObjectID;
               // To Query Communities get this object manager.
               ICommunityManager communityManager = (ICommunityManager)session.GetObjectManager(ObjectClass.Community);
               try
               IObjectQuery queryResults = communityManager.QueryObjects(-1,
                    0,
                    -1,
                    CommunityProperty.ObjectID,
                    true);
                    for(int i = 0; i < queryResults.GetRowCount(); i++)
                         IObjectQueryRow queryObject = queryResults.GetRow(i);
PrintCommunityProperties(queryObject);
               catch(Exception e)
                    Console.Error.WriteLine (e.Message);
                    Console.Error.WriteLine (e.StackTrace);
          public static void PrintCommunityProperties(IObjectQueryRow communityObject)
               Console.Out.WriteLine("Object ID is " + communityObject.GetID());
               Console.Out.WriteLine("Name is " + communityObject.GetName());
               if(communityObject.GetObjectClass() == ObjectClass.Community) //only one instance so reference comparison is ok
                    Console.Out.WriteLine("Folder ID is " + communityObject.GetValue(CommunityProperty.FolderID));
                    Console.Out.WriteLine("Parent folder ID is " + communityObject.GetParentFolderID());
               else Console.Out.WriteLine ("Not a community object!");
// REVIEWER: YOU CAN IGNORE THE FOLLOWING CODE, I DO NOT REFERENCE IT!!!!!!!
          public static void QueryUserObjects(IRemoteSession session)
               IObjectManager objectManager = session.GetObjectManager(ObjectClass.User);
               int folderID = -1;//search all folders
               int startRow = 0;//start at the first found
               int maxRows = -1;//return unlimited results
               ObjectProperty sortProperty = UserProperty.UniqueName;//sort on the unique name
               bool ascending = true;//sort ascending
               ObjectProperty[] propsToReturn = new ObjectProperty[4];//choose to return specific properties
               propsToReturn[0] = UserProperty.SimpleName;
               propsToReturn[1] = UserProperty.UniqueName;
               propsToReturn[2] = UserProperty.AuthName;
               propsToReturn[3] = ObjectProperty.Created;
               QueryFilter[] filters = new QueryFilter[1];//filter the results
                              filters[0] = new StringQueryFilter(UserProperty.AuthName,
                                   Operator.Contains,
                                   "cromer");//where the simple name contains "user"
               DateTime yesterday = new DateTime(2006,8,8).AddDays(-60.0);
               filters[0] = new DateQueryFilter(ObjectProperty.Created,
                    Operator.GreaterThan, yesterday);//where created at most a day ago
               try
                    IObjectQuery queryResults = objectManager.QueryObjects(
                         folderID,
                         startRow,
                         maxRows,
                         sortProperty,
                         ascending,
                         propsToReturn,
                         filters);
                    for(int i = 0; i < queryResults.GetRowCount(); i++)
                         IObjectQueryRow queryObject = queryResults.GetRow(i);
                         Console.Out.WriteLine(
                              "User: " + queryObject.GetStringValue(UserProperty.SimpleName) +
                              ", Created:" + queryObject.GetCreated());
               catch(Exception e)
                    Console.Error.WriteLine (e.Message);
                    Console.Error.WriteLine (e.StackTrace);
}

Similar Messages

  • Will a sequence return same value for two different sessions?

    Is there a possibility that a sequence will return same value to two different sessions when it is referred exactly at the same instance of time?

    @Justin... Thanks for your insight; indeed, we too feel this shouldn't ever happen and never heard of it either, but there it is. (No, we haven't logged a TAR yet -- whatever that is -- partly because it didn't occur to us and partly because we only recently came across the issue and sensibly want to do some testing before we cry foul.)
    However, the code is pretty straight-forward, much like this (inside a FOR EACH ROW trigger body):
    SELECT <seqname>.NEXTVAL INTO <keyvar> FROM DUAL;
    INSERT INTO <tblname> (<keyfield>, <... some other fields>)
    VALUES(<keyvar>, <... some other values> );
    (where <tblname> is NOT the table on which the trigger is fired). This is the only place where the sequence is ever accessed. The sequence state is way below its limits (either MAXVALUE or <keyfield>/<keyvar> datatype size).
    In this setup, end users sometimes got an out-of-the-blue SQL error to the effect that uniqueness constraint has been violated -- as I said, we used to have a unique index on <keyfield> -- which leads us to assume that the sequence generated a duplicate key (only way for the constraint to be violated, AFAIK). We released the constraint and indeed, using a simple SELECT <keyfield>, COUNT(*) FROM <tblname> GROUP BY <keyfield> HAVING COUNT(*)>1 got us some results.
    Unfortunately, the <tblname> table gets regularly purged by a consumer process so it's hard to trace; now we created a logger trigger, on <tblname> this time, which tracks cases of duplicate <keyfield> inserts... We'll see how it goes.
    @Laurent... winks at the CYCLE thing Our sequence is (needless to say) declared as NOCYCLE and the datatype is large enough to hold MAXVALUE.

  • Why does getdate() function return same time value for multiple select statements executed sequentially

    When I run the following code
    set nocount on
    declare @i table(id int identity(1,1) primary key, sDate datetime)
    while((select count(*) from @i)<10000)
    begin
    insert into @i(sDate) select getdate()
    end
    select top 5 sDate, count(id) selectCalls
    from @i
    group by sDate
    order by count(id) desc
    I get the following results. 
    sDate                   selectCalls
    2014-07-30 14:50:27.510 406
    2014-07-30 14:50:27.527 274
    2014-07-30 14:50:27.540 219
    2014-07-30 14:50:27.557 195
    2014-07-30 14:50:27.573 170
    As you can see the select getdate() function returned same time up to the milisecon 406 time for the first date value.  This started happening when we moved our applications to a faster server with four processors.  Is this correct or am I
    going crazy?
    Please let me know
    Bilal

    Observe that adding 2 ms is accurate only with datetime2.  As noted above, datetime does not have ms resolution:
    set nocount on
    declare @d datetime, @i int, @d2 datetime2
    select @d = getdate(), @i = 0, @d2 = sysdatetime()
    while(@i<10)
    begin
    select @d2, @d, current_timestamp, getdate(), sysdatetime()
    select @d = dateadd(ms,2,@d), @i = @i+1, @d2=dateadd(ms,2,@d2)
    end
    2014-08-09 08:36:11.1700395 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1720395 2014-08-09 08:36:11.173 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1740395 2014-08-09 08:36:11.177 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1760395 2014-08-09 08:36:11.180 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1780395 2014-08-09 08:36:11.183 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1800395 2014-08-09 08:36:11.187 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    DATE/TIME functions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • HashCode method return same value for different string?

    Hello. I am finding hashCode method of string return same hashcode for many different string? It seem when string is long we get same value many times? What is solution? I am useing JDK 1.0.2. Thank you.

    Hello. I am finding hashCode method of string return
    same hashcode for many different string? There are about 4 billion possible hashcode values.
    How many possible strings do you think there are?
    Obviously many strings will have the same hashcode.
    What is
    solution?The solution is to not depend on hashcodes being unique.

  • Simple test suite for regression testing

    Hi,
    I was wondering if anyone has a simple test suite available.
    I'm after these main areas:
    1. arbitary script lanching (or just firing off ud32 files)
    2. database comms (inserting test data, extracting final status)
    3. comparison (ala diff) for regression tests.
    I have knocked out a partial (i.e. not 100% finished!) one myself in perl, but was wondering what else other people have created .
    i'm Looking for insparation / use what has already been done!
    Thank in adavance,
    Wayne

    Subclass the test case itself, and have a factory method to return instances of the correct class you wish to test, or, use a protected instance variable to put it in
    e.g
    public class TestMyClass extends TestCase {
       public MyClass getMyClass() {
         return new MyClass();
      public void testSomething() {
           MyClass myClass = getMyClass();
           assertTrue(myClass.isWorking());
      public class TestSubclass extends TestMyClass {
         @Override
         public MyClass getMyClass() {
            return new Subclass(); // assume this extends MyClass
         // all the superclass test methods still get run
      }or
    public class TestMyClass extends TestCase {
      protected MyClass myClass;
      public void setup() {
        this.myClass = new MyClass();
      public void testSomething() {
           assertTrue(myClass.isWorking());
      public class TestSubclass extends TestMyClass {
      public void setup() {
        this.myClass = new SubClass();
         // all the superclass test methods still get run
      }

  • Noobie: unable to compile a simple test

    Hello all,
    I'm unable to compile a simple test to connect to the database, here is the env data:
    OS: windowsXP (32bit).
    compiler/linker: mingw.
    IDE: codeblocks.
    the program is:
    #include <iostream>
    #include <algorithm>
    #include <occi.h>
    using namespace oracle::occi;
    using namespace std;
    class occicoll
    private:
    Environment *env;
    Connection *conn;
    Statement *stmt;
    string tableName;
    string typeName;
    public:
    occicoll (string user, string passwd, string db)
    env = Environment::createEnvironment (Environment::OBJECT);
    conn = env->createConnection (user, passwd, db);
    ~occicoll ()
    env->terminateConnection (conn);
    Environment::terminateEnvironment (env);
    int main()
    return 0;
    and I get this compiler errors:
    |=== TestOCCI, Debug ===|
    C:\XEClient\oci\include\oratypes.h|98|Error E2257 : , expected|
    C:\XEClient\oci\include\oratypes.h|99|Error E2238 : Multiple declaration for '_int64'|
    C:\XEClient\oci\include\oratypes.h|98|Error E2344 : Earlier declaration of '_int64'|
    C:\XEClient\oci\include\oratypes.h|99|Error E2257 : , expected|
    C:\XEClient\oci\include\oratypes.h|104|Error E2257 : , expected|
    C:\XEClient\oci\include\oratypes.h|105|Error E2257 : , expected|
    main.cpp|33|Error E2176 : Too many types in declaration|
    main.cpp|34|Error E2111 : Type 'occicoll' may not be defined here|
    main.cpp|36|Error E2034 : Cannot convert 'int' to 'occicoll' in function main()|
    ||=== Build finished: 9 errors, 0 warnings ===|
    most like I'm missing a few flags, any Ideas?
    thanks,
    Gal

    Hi,
    OS: windowsXP (32bit).
    compiler/linker: mingw.
    On Windows the only supported environment is Visual Studio / cl.exe (the Microsoft compiler).
    Regards,
    Mark

  • Help:set up simple test sequence, operator selects particular test then teststand links to part of sequence file and performs test

    Hi,
    I am extremely new to TestStand, please see question below and offer advice.
    I want to set up a simple test sequence.
    I want a message to popup on screen that asks the operator which unit of 6(max 10) Units to test(i.e. there are say 6-10 box's to select from).
    Then the sequence goes to the particular part of the sequence and performs the test on which ever unit was selected.
    What is the best way to do this?
    Could i use message popups to do this?and if so what do i need to do link it to the correct part of the sequence file?
    Do message popups only allow 6 options to select from?
    Thanks,
    Solved!
    Go to Solution.

    Hi,
       You can do using message popup method. You can ask the user which unit want to execute by inserting message in message expression in message popup step settings.Something like below
    "Enter unit number to execute 
     1.  Unit1
     2.  Unit 2
     10. Unit 10"
    then check "Enable response text box" from options tab in step settings.When user enters unit number you can get the user entered value by inserting the below statement in post expression of message popup step settings
        Locals.String = Step.Result.Response 
        Note : String is a local variable to be defined.
    Convert that string in to number and send that output to switch expression there by you can use a sequence call step to call sequence whichever to be executed. (I hope your each unit will be seperate sequence file)
    I hope these resolves your problem. If you don't understand let me know so that I can develop a small example and send it to.
    Cheers,
    krishna 

  • Unable to create a simple test client. Got ConfigException: JBO--33001

    I am trying to create a simple test client as per ADF training manual. Have just created an empty AM. The test client is giving this error at runtime.
    The test client looks like:
    public static void main(String args[])
    String amDef = "test.TestModule";
    String config = "TestModuleLocal";
    ApplicationModule am =
    Configuration.createRootApplicationModule(amDef, config);
    // Work with your appmodule and view object here
    Configuration.releaseRootApplicationModule(am, true);
    Getting the following error
    Exception in thread "main" oracle.jbo.ConfigException: JBO-33001: Cannot find the configuration file /test/common/bc4j.xcfg in the classpath
         at oracle.jbo.client.Configuration.loadFromClassPath(Configuration.java:432)
         at oracle.jbo.common.ampool.PoolMgr.createPool(PoolMgr.java:284)
         at oracle.jbo.common.ampool.PoolMgr.findPool(PoolMgr.java:539)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1252)
         at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1230)
         at amit.bc4j.TestClient.main(TestClient.java:18)
    Process exited with exit code 1.
    I have added JAXB and Applications Core libraries to the default library list.
    (added JaxB because of http://myforums.oracle.com/jive3/thread.jspa?messageID=3425268&#3425268
    and Unable to create a simple test client. Error JAXBException
    I have checked that /home/aagupta/jdevhome/home/aagupta/jdevhome/FusionJdev/mywork/Test2/TestProj/classes/amit/bc4j/common/bc4j.xcfg file exists.
    I even tried to add this directory using Add lib/directory pane, but no help.
    Please suggest what to do...
    Thanks,
    Amit

    Got it....i paid the price of not understanding the error messages and expecting bc4jclient and ctrl+enter is a magic wand :)
    Thanks to Steinmeier,Oliver http://myforums.oracle.com/jive3/thread.jspa?messageID=3408700&#3408700
    The shortcut only generates sample code. We need to substitute the actual AM location.
    public static void main(String args[])
    String amDef = "amit.bc4j.model.TestAM";
    String config = "TestAMLocal";
    ApplicationModule am =
    Configuration.createRootApplicationModule(amDef, config);
    System.out.println("Read the messages!");
    // Work with your appmodule and view object here
    Configuration.releaseRootApplicationModule(am, true);
    }

  • SAP Business Connector : Simple Test

    Hi Folks,
    Before I start , let me mention here that I am completely new to BC . And my requirement (I think) is also very simple.
    I have installed the business connector developer in my pc , and the BC server connection to SAP server is also working alright.
    My requirement is very simple , I want to pass a XML document to sap server . It is just a simple test as I am not going for any middleware setup etc.
    I just want to send this XML document to SAP for testing . I have tried by creating a "Flow" which expects a XML document but somehow it does not seem to work .
    Kindly let me know if possible the manual steps for sending XML doc to SAP.
    Thanks in Advance....

    You may use the standard developer's guide example to configure your scenario.
    Suppose you have File to RFC scenario.
    1. First create a structure for file system. This should be created as a Record in BC. Import the RFC structure too in BC.
    2. There is a standard ftp service (I guess in WmPublic package) which should be the first flow step of your flow service.
    3. Then use map steps to map the Records of file structure and Idoc.
    4. Then you may use imported RFC flow step to call RFC.
    5. At server, you need to define to routing rule from SAP BC -> R/3.
    Regards,
    Prateek

  • Environment for Simple Tests

    For Debug and Release configurations one can set environment variables (eg LD_LIBRARY_PATH) under Project Properties -> Run -> Environment. However, these settings are not used in my projects and are also not used for Test "targets", ie C++ Simple Tests. Is there a way to set the environment and for tests? (I'm using Solaris 12.3 under SL 6.2.)
    Many thanks!
    Edited by: user7741736 on May 11, 2012 5:16 PM

    It is OK to use LD_LIBRARY_PATH temporarily and in limited contexts, such as when testing a new shared library, but zootle is correct that you should not rely on it for more than that. It is not a sustainable or scalable solution. For more on this topic, see the blog post by Rod Evans:
    https://blogs.oracle.com/rie/entry/tt_ld_library_path_tt
    and the paper on using shared libraries by Darryl Gove and myself:
    http://www.oracle.com/technetwork/articles/servers-storage-dev/redistrib-libs-344133.html

  • Quick & Simple Test 3 : OC on i7 920 with X58 Eclipse...4200mhz air cooling

    Xmas still have a few days ahead..but Santa had filled my Xmas stocking..... ...with MSI X58 Eclipse ( bios 1.34 ), Core i7 920 at 1.4vcore, Corsair TR3X3G1600C9 at 1600mhz 1.65vdimm, HSF Noctua NH-U12P SE1366,  MSI R4870T2D1G-OC, Corsair TX650w, WDGP640gb, DVR216BK, CM690, and Synmaster T220.  So..i tried to make a quick & simple  test with my new toys..and here the temporal result : 4ghz very easily and stable...
    feeewww...guys...this board are  ...have more than enough OC's ability ...MSI made a very good  board with this...
    cheers...
    p.s : still looking the max oc with air cooling...

    Just to update this simple test...max OC with air cooling and simply tweak...4200 mhz..and then hit the wall...
    I made your image clickable
    -Frankenputer

  • The same problem again with HP Simple Pass fingerprint reader after upfrading from Firefox 4 to Firefox 5. I have already installed HPSimPlePass 7.0.74.0 to fix the problem after upgrading to Firefox 4.

    I have a HP Pavilion dv6 with a fingerprint reader. I had the same problem as many other people when upgrading to Firefox 4, : I couldn't use the HP Simple Pass to enter a website needing a username and password by just swiping my fingerprint. I fixed the problem by downloading the new HPSimPlePass 7.0.74.0. This fixed the problem and I was very happy. Since upgrading to Firefox 5 I have the same problem again, but I already have the new version of HP Simple Pass. How can this be fixed so that I can use this fingerprint scan feature again, or where can I download Firefox 4 again?

    ''FredMcD [[#answer-709783|said]]''
    <blockquote>
    The programers know of this and are working on it.
    </blockquote>

  • FindByProperty Returns Same Record Twice

    I have a curious situation in which the findByProperty method is returning the same record twice. I have only two records in the file for this test, and they are both tied to the same contact ID. But, instead of bringing back both records, it brings back the first record twice. Any ideas?
    ContactNote entity
    @Entity
    @Table(name = "CONTNOTEP", schema = "CRMLIB", catalog = "S657567F", uniqueConstraints = {})
    public class ContactNote implements java.io.Serializable
         // Fields
         @Id
         @Column(name = "CONTACTID", unique = false, nullable = false, insertable = true, updatable = true, precision = 5, scale = 0)
         private Long                    contactId;
         @Temporal(TemporalType.DATE)
         @Column(name = "CNDATE", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
         private Date                    lastUpdatedDate;
         @Temporal(TemporalType.TIME)
         @Column(name = "CNTIME", unique = false, nullable = false, insertable = true, updatable = true, length = 8)
         private Date                    lastUpdatedTime;
         @Column(name = "CNNOTE", unique = false, nullable = false, insertable = true, updatable = true, length = 100)
         private String                    note;
         @Column(name = "CNSALMNUM", unique = false, nullable = false, insertable = true, updatable = true, length = 2)
         private String                    salesmanNumber;
         @ManyToOne(fetch = FetchType.LAZY, cascade = {})
         @JoinColumn(name = "CONTACTID", insertable = false, updatable = false)
         private Contact                    contact;
         @Transient
         private GregorianCalendar     date;
    ContactServiceImpl
         public List<ContactNote> getContactNotes(String sessionId, Long contactId) throws AuthenticationFault
              authenticateSession(sessionId);
              List<ContactNote> contactNoteList = contactNoteDao.findByProperty("contactId", contactId);
              if (contactNoteList.size() == 0)
                   ContactNote contactNote = new ContactNote();
                   contactNoteList.add(contactNote.defaultContactNote());
              return contactNoteList;
    JUnit Test Method
         @SuppressWarnings("unchecked")
         public void runGetContactNotes() throws Exception
              UserDao userDao = (UserDao) applicationContext.getBean("userDao");
              User user = userDao.login("[email protected]", "password");
              assertNotNull(user);
              ContactService dao = (ContactService) applicationContext.getBean("contactService");
              List<ContactNote> contactNoteList =
                   dao.getContactNotes(user.getSessionId(), 1276L);
              for (ContactNote note : contactNoteList)
                   System.out.println(note.getContactNoteId() + " " + note.getNote());
    Results of Test
    [TopLink Fine]: 2007.10.02 08:50:30.988--ClientSession(7339385)--Connection(6964063)--Thread(Thread[main,5,mai
    n])--SELECT CONTACTID, CNTIME, CNNOTE, CNDATE, CNSALMNUM FROM CRMLIB.CONTNOTEP WHERE (CONTACTID = CAST (? AS B
    IGINT ))
         bind => [1276]
    1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cards
    1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cardsThanks for any help that can be provided. This has me stumped.
    R. Grimes
    Message was edited by:
    rdgrimes

    I was able to resolve this situation by splitting the ContactNote entity in two: ContactNoteId and ContactNote. I had combined them because it seemed kind of silly to have the id, date, time in the ContactNoteID entity, while the ContactNote entity just had two fields beyond the embedded id.
    R. Grimes

  • During goods returns same accounting entry as when good issue

    Hi,
           In our project we have a condition that charge on a provision account during goods receipt of a purchase document. Hers the accounting entries generated is ok. However we also create purchase order with return item. During goods issue (mvt 161) the accounting entries created is same as the goods receipt instead of being the inverse.
    I do not understand how this is determine and will be grateful if you could help me. Thanks.

    hi,
    Check the details and TE key which is hit while 161..
    If its correct then go to OBYC and check the G/L account which is getting hit in the inverse for your transaction...whether it is properly set or not...
    it may be possible that instead of deibt it would be getting credit n visa versa....
    Regards
    Priyanka.P

  • Random returning same values for all threads?

    <p>I "translated" an Applet example from a book to a MIDlet (as part of my learning process). However the MIDlet does not react as it should, and when the particles are all moving independently in the Applet, they are stuck together (as one) in the MIDlet.</p>
    <p>So far, only one possibility was suggested to me: if the Random object are created one after the other, they could end up based on the same seed (which is the clock by default) and will generate the same numbers.</p>
    <p>I tried to delay between the creation of the threads with no result. And the fact that the applet runs properly makes me wonder...</p>
    <p>Does anyone have a clue?</p>
    <p>In the MIDlet:</p>
    protected Thread makeThread(final Particle p) { // utility
        Runnable runloop = new Runnable() {
          public void run() {
            try {
              for(;;) {
                p.move();
                canvas.repaint();
                Thread.sleep(100); // 100msec is arbitrary
            catch (InterruptedException e) {  return; }
        return new Thread(runloop);
      }<p>In the particle:</p>
    protected final Random rng = new Random();
      public synchronized void move() {
        x += rng.nextInt(step) - (step/2);
        y += rng.nextInt(step) - (step/2);
        //returns exactly the same 10 times in a row
      }

    You might try justing just one static Random object.
    Also note that als long as your using CLDC 1.0, you don't have any floating point support.

Maybe you are looking for

  • What is difference between interactive list and interactive reports?

    what is difference between interactive list and interactive reports?

  • User Defined Fields are read-only for a specific user

    I have a user that has lost her ability to edit user defined fields.  They are all grayed-out for all UDFs, all document types.  Other users have access to these fields.  I've even copied the authorizations from a user not experiencing the problem, b

  • Remittance advice to vendors

    I want to know how i can see the remittance advice form layout what is the procedure for issue of of remittance advice to the vendors. I have checked it by using F110 transation for automatic payment but the output is in the report form but i want th

  • My available balance is no longer visible...

    Normally the available balance is available in the top right hand of the screen, however this has now disappeared and whenever I try to download anything it says it will charge my credit card.  I know I have in excess of $160 in credit and I have che

  • If you are trying to lose weight, treat foods

    Green Horizon Garcinia If you are trying to lose weight, treat foods that are high in calories differently than the rest of your diet. You will need to severely limit your intake of high calorie food and there a methods that make it easier for you to