Re: Re: Using DataGrid in WO
Hi Chuck, this is my html : wo:tPopUpButton list=$personList item=$person value=$selectedPerson/ wo:AjaxModalDialogOpener id=refreshGrid wo:AjaxSubmitButton action=$addSelectedPerson value=addPerson /wo:AjaxModalDialogOpener webobject name=personNavBar webobject namepersonGrid and this is my WOD personGrid : AjaxGrid { configurationData = personDataConfig; displayGroup = personDg; afterUpdate = personNavBarUpdate();; } NavBarPerson : AjaxGridNavPersonBar { containerID = NavBarPerson; displayGroup = personDg; configurationData = personDataConfig; } I don't use AjaxModalDialog but AjaxModalDialogOpener. Can I surround AjaxModalDialogOpener with AjaxModalDialog ? Where I insert AjaxModalDialog in my code to refresh my grid? My AjaxModalDialogOpener is on the good side in html code? Thanks a lot Message du : 25/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO In the plist that has your grid configuration, add a line like this: updateContainerID = resultsContainer; Then in the WOD that defines the dialog: MyDialog : AjaxModalDialog { closeUpdateContainerID = resultsContainer; Chuck On May 20, 2011, at 12:34 PM, naneon.raym...@neuf.fr naneon.raym...@neuf.fr wrote: Hi Chuck, Can you give me an example, I don't know how to introduce it in my code. Thanks Message du : 20/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO Use the closeUpdateContainerID binding on the AjaxModalDialog. On May 20, 2011, at 6:07 AM, naneon.raym...@neuf.fr wrote: Hi Chuck, I try to follow your advice but I have some problems. In HTML (my textfield and button using to add person in my Grid: ) wo:tPopUpButton list=$personList item=$person value=$selectedPerson/ wo:AjaxModalDialogOpener id=refreshGrid wo:AjaxSubmitButton action=$addPerson value=add /wo:AjaxModalDialogOpener webobject name=personNavBar webobject namepersonGrid In WOD ... personGrid : AjaxGrid { configurationData = personDataConfig; displayGroup = personDg; afterUpdate = personNavBarUpdate();; } in java class ... variable declaration public WOActionResults addPerson(){ personDg = new WODisplayGroup(); persondg.setObjectArray(PersonData(selectedPerson.fullname)); } private NSMutableArray PersonData(String aPerson) { NSMutableDictionnary personDico = new NSMutableDictionnary (); if(aPerson.equals(null)){ return null; } personDico.takeValueForKey(aPerson, persnoFullname 1); return (NSMutableArray) personDico.allValues(); } My question is How to refresh my Grid to know if the person I added is present in the grid? Thanks Message du : 19/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO I have never added data directly in a grid. You would need to create a new object in the display group that the grid is using and use AjaxInPlace fields to edit the data. Instead, I use an AjaxModalDialogOpener in the grid and an AjaxModalDialog to add or edit one object. When the modal dialog closed, it refreshes the grid. Chuck On May 19, 2011, at 10:31 AM, naneon.raym...@neuf.fr wrote: Hi Chuck, I want to fill my AjaxGrid by adding data using textField and submitButton. How my addData() method can look like? I want to add person by company (PopUpButton with companies). my configData file .plist is : { tableID = personGrid; updateContainerID = ajaxGridContainer; sortable = true; canReorder = true; batchSize = 4; cssClass = ajaxGridTab; cssStyle = border: thin solid #00;; evenRowCSSClass = none; oddRowCSSStyle = background:lightgrey;; selectedRowCSSStyle = font-weight: bold;; selectedRowCSSClass = ajaxGridSelectedRow; rowIdentifier = number; dragHeaderOnly = true; columns = ( { title = Apple; keyPath = personFullName 1; }, { title = Microsoft; keyPath = personFullName 2; }, { title = Rim; keyPath = personFullName 3; }, { title = Google; keyPath = personFullName 4; } ); sortOrder = ( { keyPath = personFullName 1; direction = descending; }, { keyPath = personFullName 2;
Re: Entity With Compound PK And CLOB Field
Out of curiosity . Any chance the external types of those other locking attributes are not in all caps? varchar2 vs VARCHAR2? Sent from my iPhone On May 25, 2011, at 1:07 AM, Chuck Hill ch...@global-village.net wrote: Hi Michael, On May 24, 2011, at 8:43 PM, Michael Hast wrote: Hi: We had an interesting problem today. We have an entity called ReviewerData which has a personId and fiscalYear compound primary key. It also has 3 more attributes, a CLOB field, a varchar2(4000) and an Integer attribute. All attributes except the CLOB are marked as a locking attribute (see attached image). When we are updating the CLOB field and any of the other 2 attributes and call EC saveChanges, we are getting the error: Expected a LOB count of 0 but could not fetch that many objects. The issues is that there are 2 SQL statements being generated by the Oracle plugin within 1 transaction: UPDATE REVIEWER_DATA SET HAS_DONE_EXTERNAL_REVIEW = ?, REVIEW_QUALIFICATIONS = EMPTY_CLOB() WHERE (PERSON_ID = ? AND FISCAL_YEAR = ? AND DESCRIPTION_OF_WORK = ? AND HAS_DONE_EXTERNAL_REVIEW = ?) withBindings: 1:0, 2:97208, 3:2012, 4:ABC, 5:1 SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ? AND t0.FISCAL_YEAR = ? AND t0.DESCRIPTION_OF_WORK = ? AND t0.HAS_DONE_EXTERNAL_REVIEW = ?) FOR UPDATE withBindings: 1:97208, 2:2012, 3:ABC, 4:1 When you see SELECT ... FOR UPDATE that is often a sign that something has gone wrong in EOF (e.g. you have hit a bug). In this case, however, I think it is just trying to update the CLOB. The SELECT statement fails, causing the error above. If I don't have a compound PK, only have a single PK attribute (personId), the SELECT statement only has one column in the where clause and all works great: SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ?) FOR UPDATE withBindings: 1:97208 I believe there is a bug in how the SQL is being generated. In the where clause it should only use the 2 PK attributes rather than all the lock attributes. My question is how can I fix this? Is it the Oracle plugin? Wonder has an Oracle plugin, should I try that out first? I would try that first. Second, you could move REVIEW_QUALIFICATIONS to its own table with a generated PK and a 1-1 relationship from Reviewer Data. There is a good chance that would avoid the problem. Chuck -- Chuck Hill Senior Consultant / VP Development Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Time profiling
Hi Gennady, Even if you don't use it, you can still download the source and copg or using bits that are useful to you. Regards, Kieran On May 25, 2011, at 1:56 AM, Кушнир Геннадий wrote: But I don't use Wonder in my app... Gennady ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Entity With Compound PK And CLOB Field
Hi: Thanks for the hint. The external type is all caps VARCHAR2. There is no surprise there. I will try out the Wonder Oracle plugin and see how it behaves. Michael. On 5/25/2011 4:14 AM, Mike Schrag wrote: Out of curiosity . Any chance the external types of those other locking attributes are not in all caps? varchar2 vs VARCHAR2? Sent from my iPhone On May 25, 2011, at 1:07 AM, Chuck Hillch...@global-village.net wrote: Hi Michael, On May 24, 2011, at 8:43 PM, Michael Hast wrote: Hi: We had an interesting problem today. We have an entity called ReviewerData which has a personId and fiscalYear compound primary key. It also has 3 more attributes, a CLOB field, a varchar2(4000) and an Integer attribute. All attributes except the CLOB are marked as a locking attribute (see attached image). When we are updating the CLOB field and any of the other 2 attributes and call EC saveChanges, we are getting the error: Expected a LOB count of 0 but could not fetch that many objects. The issues is that there are 2 SQL statements being generated by the Oracle plugin within 1 transaction: UPDATE REVIEWER_DATA SET HAS_DONE_EXTERNAL_REVIEW = ?, REVIEW_QUALIFICATIONS = EMPTY_CLOB() WHERE (PERSON_ID = ? AND FISCAL_YEAR = ? AND DESCRIPTION_OF_WORK = ? AND HAS_DONE_EXTERNAL_REVIEW = ?) withBindings: 1:0, 2:97208, 3:2012, 4:ABC, 5:1 SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ? AND t0.FISCAL_YEAR = ? AND t0.DESCRIPTION_OF_WORK = ? AND t0.HAS_DONE_EXTERNAL_REVIEW = ?) FOR UPDATE withBindings: 1:97208, 2:2012, 3:ABC, 4:1 When you see SELECT ... FOR UPDATE that is often a sign that something has gone wrong in EOF (e.g. you have hit a bug). In this case, however, I think it is just trying to update the CLOB. The SELECT statement fails, causing the error above. If I don't have a compound PK, only have a single PK attribute (personId), the SELECT statement only has one column in the where clause and all works great: SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ?) FOR UPDATE withBindings: 1:97208 I believe there is a bug in how the SQL is being generated. In the where clause it should only use the 2 PK attributes rather than all the lock attributes. My question is how can I fix this? Is it the Oracle plugin? Wonder has an Oracle plugin, should I try that out first? I would try that first. Second, you could move REVIEW_QUALIFICATIONS to its own table with a generated PK and a 1-1 relationship from Reviewer Data. There is a good chance that would avoid the problem. Chuck -- Chuck Hill Senior Consultant / VP Development Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com -- Tel: (602) 279-4600 ext: 635 Desert Sky Software: www.desertsky.com Specializing in the Development and Hosting of e-Business Applications. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Entity With Compound PK And CLOB Field
not sure this is in yours or not, but i think the method you want is OraclePlugIn's updateLOBs method. ms On May 25, 2011, at 12:30 PM, Michael Hast wrote: Hi: Thanks for the hint. The external type is all caps VARCHAR2. There is no surprise there. I will try out the Wonder Oracle plugin and see how it behaves. Michael. On 5/25/2011 4:14 AM, Mike Schrag wrote: Out of curiosity . Any chance the external types of those other locking attributes are not in all caps? varchar2 vs VARCHAR2? Sent from my iPhone On May 25, 2011, at 1:07 AM, Chuck Hillch...@global-village.net wrote: Hi Michael, On May 24, 2011, at 8:43 PM, Michael Hast wrote: Hi: We had an interesting problem today. We have an entity called ReviewerData which has a personId and fiscalYear compound primary key. It also has 3 more attributes, a CLOB field, a varchar2(4000) and an Integer attribute. All attributes except the CLOB are marked as a locking attribute (see attached image). When we are updating the CLOB field and any of the other 2 attributes and call EC saveChanges, we are getting the error: Expected a LOB count of 0 but could not fetch that many objects. The issues is that there are 2 SQL statements being generated by the Oracle plugin within 1 transaction: UPDATE REVIEWER_DATA SET HAS_DONE_EXTERNAL_REVIEW = ?, REVIEW_QUALIFICATIONS = EMPTY_CLOB() WHERE (PERSON_ID = ? AND FISCAL_YEAR = ? AND DESCRIPTION_OF_WORK = ? AND HAS_DONE_EXTERNAL_REVIEW = ?) withBindings: 1:0, 2:97208, 3:2012, 4:ABC, 5:1 SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ? AND t0.FISCAL_YEAR = ? AND t0.DESCRIPTION_OF_WORK = ? AND t0.HAS_DONE_EXTERNAL_REVIEW = ?) FOR UPDATE withBindings: 1:97208, 2:2012, 3:ABC, 4:1 When you see SELECT ... FOR UPDATE that is often a sign that something has gone wrong in EOF (e.g. you have hit a bug). In this case, however, I think it is just trying to update the CLOB. The SELECT statement fails, causing the error above. If I don't have a compound PK, only have a single PK attribute (personId), the SELECT statement only has one column in the where clause and all works great: SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ?) FOR UPDATE withBindings: 1:97208 I believe there is a bug in how the SQL is being generated. In the where clause it should only use the 2 PK attributes rather than all the lock attributes. My question is how can I fix this? Is it the Oracle plugin? Wonder has an Oracle plugin, should I try that out first? I would try that first. Second, you could move REVIEW_QUALIFICATIONS to its own table with a generated PK and a 1-1 relationship from Reviewer Data. There is a good chance that would avoid the problem. Chuck -- Chuck Hill Senior Consultant / VP Development Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com -- Tel: (602) 279-4600 ext: 635 Desert Sky Software: www.desertsky.com Specializing in the Development and Hosting of e-Business Applications. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using DataGrid in WO
Hi Raymond, On May 25, 2011, at 3:10 AM, naneon.raym...@neuf.fr naneon.raym...@neuf.fr wrote: Hi Chuck, this is my html : wo:tPopUpButton list=$personList item=$person value=$selectedPerson/ wo:AjaxModalDialogOpener id=refreshGrid wo:AjaxSubmitButton action=$addSelectedPerson value=addPerson /wo:AjaxModalDialogOpener webobject name=personNavBar webobject namepersonGrid and this is my WOD personGrid : AjaxGrid { configurationData = personDataConfig; displayGroup = personDg; afterUpdate = personNavBarUpdate();; } NavBarPerson : AjaxGridNavPersonBar { containerID = NavBarPerson; displayGroup = personDg; configurationData = personDataConfig; } I don't use AjaxModalDialog but AjaxModalDialogOpener. But... you do have an AjaxModalDialog that the AjaxModalDialogOpener is opening, right? If you don't, you are not using the AjaxModalDialogOpener correctly. If you do have an AjaxModalDialog (even if it is in a different component), then the closeUpdateContainerID goes in that WOD definition. Can I surround AjaxModalDialogOpener with AjaxModalDialog ? No. See how they are used in the AjaxExamples application in Wonder. You also should not have a submit button inside the AjaxModalDialogOpener: wo:AjaxModalDialogOpener id=refreshGrid wo:AjaxSubmitButton action=$addSelectedPerson value=addPerson /wo:AjaxModalDialogOpener Where I insert AjaxModalDialog in my code to refresh my grid? My AjaxModalDialogOpener is on the good side in html code? The AjaxModalDialog was to edit the information shown in your grid. Chuck Message du : 25/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO In the plist that has your grid configuration, add a line like this: updateContainerID = resultsContainer; Then in the WOD that defines the dialog: MyDialog : AjaxModalDialog { closeUpdateContainerID = resultsContainer; Chuck On May 20, 2011, at 12:34 PM, naneon.raym...@neuf.fr naneon.raym...@neuf.fr wrote: Hi Chuck, Can you give me an example, I don't know how to introduce it in my code. Thanks Message du : 20/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO Use the closeUpdateContainerID binding on the AjaxModalDialog. On May 20, 2011, at 6:07 AM, naneon.raym...@neuf.fr wrote: Hi Chuck, I try to follow your advice but I have some problems. In HTML (my textfield and button using to add person in my Grid: ) wo:tPopUpButton list=$personList item=$person value=$selectedPerson/ wo:AjaxModalDialogOpener id=refreshGrid wo:AjaxSubmitButton action=$addPerson value=add /wo:AjaxModalDialogOpener webobject name=personNavBar webobject namepersonGrid In WOD ... personGrid : AjaxGrid { configurationData = personDataConfig; displayGroup = personDg; afterUpdate = personNavBarUpdate();; } in java class ... variable declaration public WOActionResults addPerson(){ personDg = new WODisplayGroup(); persondg.setObjectArray(PersonData(selectedPerson.fullname)); } private NSMutableArray PersonData(String aPerson) { NSMutableDictionnary personDico = new NSMutableDictionnary (); if(aPerson.equals(null)){ return null; } personDico.takeValueForKey(aPerson, persnoFullname 1); return (NSMutableArray) personDico.allValues(); } My question is How to refresh my Grid to know if the person I added is present in the grid? Thanks Message du : 19/05/2011 De : Chuck Hill ch...@global-village.net A : naneon.raym...@neuf.fr Copie à : webobjects-dev@lists.apple.com Sujet : Re: Using DataGrid in WO I have never added data directly in a grid. You would need to create a new object in the display group that the grid is using and use AjaxInPlace fields to edit the data. Instead, I use an AjaxModalDialogOpener in the grid and an AjaxModalDialog to add or edit one object. When the modal dialog closed, it refreshes the grid. Chuck On May 19, 2011, at 10:31 AM, naneon.raym...@neuf.fr wrote: Hi Chuck, I want to fill my AjaxGrid by adding data using textField and submitButton. How my addData() method can look like? I want to add person by company (PopUpButton with companies). my configData file .plist is : { tableID = personGrid; updateContainerID = ajaxGridContainer; sortable = true; canReorder = true; batchSize = 4; cssClass = ajaxGridTab; cssStyle = border: thin solid #00;; evenRowCSSClass = none; oddRowCSSStyle = background:lightgrey;; selectedRowCSSStyle = font-weight: bold;; selectedRowCSSClass = ajaxGridSelectedRow; rowIdentifier = number; dragHeaderOnly = true;
Re: Concurrent request handling
On May 24, 2011, at 10:50 PM, Кушнир Геннадий wrote: Hello How could that be that session is awaken by one thread and action is invoked by another within the same RRloop? Are you sure that is what is happening? Could it be that you have a bug in your session's sleep() method that is sometimes causing the EC to NOT get unlocked? public void sleep() { if(!isTerminating()) ecLockManager.unlock(); super.sleep(); } I can't find any bug here )) Not your problem, but a better way to write that is: public void sleep() { try { if(!isTerminating()) ecLockManager.unlock(); } finally { super.sleep(); } } Can you post the thread traces? 2011-05-2322:17:33INFOtX47k7Qn2z0d6CXNtlL4pw Attempting to lock editing context from WorkerThread14 that was previously locked in WorkerThread3 java.lang.Exception: null [0] net.rujel.reusables.SessionedEditingContext.lock:118 [30] net.rujel.reusables.SessionedEditingContext.saveChanges:73 // here super.saveChanges() is called [31] net.rujel.ui.LessonNoteEditor.save:412 [32] net.rujel.ui.LessonNoteEditor.save:352 [85] net.rujel.reusables.UTF8Application.dispatchRequest:46 {java.lang.Exception: null [0] net.rujel.reusables.SessionedEditingContext.lock:118 [1] net.rujel.reusables.MultiECLockManager.lock:66 [2] net.rujel.Session.awake:118 [9] net.rujel.reusables.UTF8Application.dispatchRequest:46} {} Is the first trace, is this there? [1] net.rujel.reusables.MultiECLockManager.lock:66 [2] net.rujel.Session.awake:118 It looks like you are somehow sharing editing contexts across sessions or using a session's editing context in a non RR loop thread. Chuck traces are filtered to include only my classes and recently active one My first guess is that your EOEditingContext has a bug in it, and the messages you are seeing are not valid. Chuck I have looked through it a lot of times. And could not find any. Maybe you could? private String _nameOfLockingThread = null; private NSMutableArray _stackTraces = new NSMutableArray(); private NSMutableArray _prevTraces = new NSMutableArray(); public void lock() { String nameOfCurrentThread = Thread.currentThread().getName(); // prepare filtered stack trace: String trace = WOLogFormatter.formatTrowable(new Exception()); if (_stackTraces.count() == 0) { _stackTraces.addObject(trace); _nameOfLockingThread = nameOfCurrentThread; } else { if (nameOfCurrentThread.equals(_nameOfLockingThread)) { _stackTraces.addObject(trace); } else { logger.log(WOLogLevel.INFO, Attempting to lock editing context from + nameOfCurrentThread + that was previously locked in + _nameOfLockingThread, new Object[] {session,trace,_stackTraces,_prevTraces}); } } super.lock(); } public void unlock() { super.unlock(); if (_stackTraces.count() 0) _prevTraces.addObject(_stackTraces.removeLastObject()); else _stackTraces.count(); if (_stackTraces.count() == 0) { _nameOfLockingThread = null; _prevTraces.removeAllObjects(); } } I think those methods consist of really simple statements that should not cause problems. --- Gennady Kushnir -- Chuck Hill Senior Consultant / VP Development Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/ smime.p7s Description: S/MIME cryptographic signature ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Hashcode/ETag for EOs
I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
there's not a direct simple way to do it ... probably grab the snapshot off the EO and compute a hash of the values (you can ignore the keys because they're fixed). it might be something where you can make a new interface in ERX that your EO's could implement to provide a more optimal impl (like ERCStamped could use its lastModified as a basis). ms On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
Ah, ERCStamped is fantastic for generating the Last-Modified header! Some day, I will have two weeks off just to look at all the stuff in Wonder... there's not a direct simple way to do it ... probably grab the snapshot off the EO and compute a hash of the values (you can ignore the keys because they're fixed). it might be something where you can make a new interface in ERX that your EO's could implement to provide a more optimal impl (like ERCStamped could use its lastModified as a basis). ms On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
I'm guessing this will trigger another round-trip to the db, but what about adding this to your EOGenericRecord subclass: public int rawHashCode() { return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(), Identity.ENTITY_NAME, ID_KEY, primaryKey()) .lastObject() .hashCode(); } Obviously, getting the value at a higher level would be better, but does this at least return the same hashCode for every fetch? Of course, Mike's ERCStamped solution is probably better with less overhead, but what the heck. If I never try to upstage him then it'll never happen, right?! Dave On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
On May 25, 2011, at 2:20 PM, David Avendasora wrote: I'm guessing this will trigger another round-trip to the db, but what about adding this to your EOGenericRecord subclass: public int rawHashCode() { return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(), Identity.ENTITY_NAME, ID_KEY, primaryKey()) .lastObject() .hashCode(); } Obviously, getting the value at a higher level would be better, but does this at least return the same hashCode for every fetch? Of course, Mike's ERCStamped solution is probably better with less overhead, but what the heck. If I never try to upstage him then it'll never happen, right?! Well, and the fact that it won't work for EOs with compound PKs... but nobody does that, right? Dave On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
Wait .. What? Why? Use the eo's snapshot. Sent from my iPhone On May 25, 2011, at 2:20 PM, David Avendasora webobje...@avendasora.com wrote: I'm guessing this will trigger another round-trip to the db, but what about adding this to your EOGenericRecord subclass: public int rawHashCode() { return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(), Identity.ENTITY_NAME, ID_KEY, primaryKey()) .lastObject() .hashCode(); } Obviously, getting the value at a higher level would be better, but does this at least return the same hashCode for every fetch? Of course, Mike's ERCStamped solution is probably better with less overhead, but what the heck. If I never try to upstage him then it'll never happen, right?! Dave On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
Or in your example, gid.hashcode but you don't want that for an etag. Sent from my iPhone On May 25, 2011, at 2:20 PM, David Avendasora webobje...@avendasora.com wrote: I'm guessing this will trigger another round-trip to the db, but what about adding this to your EOGenericRecord subclass: public int rawHashCode() { return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(), Identity.ENTITY_NAME, ID_KEY, primaryKey()) .lastObject() .hashCode(); } Obviously, getting the value at a higher level would be better, but does this at least return the same hashCode for every fetch? Of course, Mike's ERCStamped solution is probably better with less overhead, but what the heck. If I never try to upstage him then it'll never happen, right?! Dave On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
On May 25, 2011, at 2:24 PM, Mike Schrag wrote: Wait .. What? Why? I thought I covered that: If I never try to upstage (Mike) then it'll never happen, right?! Use the eo's snapshot. Well sure, when you say it like that, my idea sounds stupid. :-) Sent from my iPhone Sent from my Mac, where I have all of the Wonder source code and still can't outdo Mike with just his memory of the codebase. On May 25, 2011, at 2:20 PM, David Avendasora webobje...@avendasora.com wrote: I'm guessing this will trigger another round-trip to the db, but what about adding this to your EOGenericRecord subclass: public int rawHashCode() { return EOUtilities.rawRowsMatchingKeyAndValue(editingContext(), Identity.ENTITY_NAME, ID_KEY, primaryKey()) .lastObject() .hashCode(); } Obviously, getting the value at a higher level would be better, but does this at least return the same hashCode for every fetch? Of course, Mike's ERCStamped solution is probably better with less overhead, but what the heck. If I never try to upstage him then it'll never happen, right?! Dave On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com This email sent to webobje...@avendasora.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
Errest should be using some new method on the rest delegate probably, whose default impl is to check for that interface on the object and then fall back to something hashcodey Sent from my iPhone On May 25, 2011, at 2:14 PM, Pascal Robert prob...@macti.ca wrote: Ah, ERCStamped is fantastic for generating the Last-Modified header! Some day, I will have two weeks off just to look at all the stuff in Wonder... there's not a direct simple way to do it ... probably grab the snapshot off the EO and compute a hash of the values (you can ignore the keys because they're fixed). it might be something where you can make a new interface in ERX that your EO's could implement to provide a more optimal impl (like ERCStamped could use its lastModified as a basis). ms On May 25, 2011, at 1:55 PM, Pascal Robert wrote: I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. -- Pascal Robert prob...@macti.ca WOWODC 2011 : July 1-2-3, Montreal. wowodc.com AIM/iChat : MacTICanada LinkedIn : http://www.linkedin.com/in/macti Twitter : pascal_robert ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
lol Sent from my iPhone On May 25, 2011, at 2:27 PM, David Avendasora webobje...@avendasora.com wrote: Sent from my Mac, where I have all of the Wonder source code and still can't outdo Mike with just his memory of the codebase. ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
Le 2011-05-25 à 13:55, Pascal Robert a écrit : I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? myEO.snapshotDictionary().hashCode() ? That would be based on the attributes values only. hmmm ... not sure how it would deal with relationship though (with regards to faulting). I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. jfv ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hashcode/ETag for EOs
NSDictionary's hashcode is very bad ... you wouldn't want to use that for your etag. ms On May 25, 2011, at 2:03 PM, Jean-Francois Veillette wrote: Le 2011-05-25 à 13:55, Pascal Robert a écrit : I'm trying to find a way to generate a HTTP ETag for EOs so that caching can be done for REST services. What I want to do is to have the same ETag value for each representation of the EO, so when one of the values change, the ETag value will also change, but if the EO have the same value, it will generate the same ETag as another request got. Problem is: I don't know what to use. I tried with myEO.hashCode() but I did some tests and every time I fetch the EO, the hashcode is different even if the data didn't change. I'm thinking of doing a MD5 digest of part of the EO, but I was wondering if another way exist? myEO.snapshotDictionary().hashCode() ? That would be based on the attributes values only. hmmm ... not sure how it would deal with relationship though (with regards to faulting). I could use a last modified date and generate a MD5 of that too, but that date is a better option for the Last-Modified header. jfv ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com