Re: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
On 12/08/2010, at 10:44 AM, Ramsey Lee Gurley wrote:

> I believe the difference is that yes, GregorianCalendar _is_ timezone aware.  
> NSTimestamp is not.  NSTimestamp's getTime() value is fixed when the 
> timestamp is created.  If you then adjust your timezone frame of reference, 
> the time does not adjust with you.  GregorianCalendar is the opposite.  It 
> has fixed gregorian values (calendar day, month, year, etc) and the getTime() 
> value fluctuates based on the timezone you set on it.

Maybe it would work then.  I'll add it to my list of things to try.  :-)


-- 
Paul.

http://logicsquad.net/


 ___
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: postNotification and editingContext().saveChanges() /editingContext().revert()

2010-08-11 Thread Cheong Hee (Gmail)
You may already know this...If your thread belongs to the session, another 
option I think is MultiECLockManager.


Cheers

Cheong Hee

- Original Message - 
From: "Farrukh Ijaz" 

To: "Chuck Hill" 
Cc: "WebObjects-Dev List" 
Sent: Thursday, August 12, 2010 5:47 AM
Subject: Re: postNotification and editingContext().saveChanges() 
/editingContext().revert()






Guessing, concurrent threads, and locking.  Never a good combination.


Thanks Chuck! Is there any choice then? Or every Workflow may have it's own 
editingContext() considering the ec would be lightweight and won't do 
anything else except modifying a single row?





On Aug 11, 2010, at 2:35 PM, Farrukh Ijaz wrote:

I am using ERXEC with default settings. I guess it takes care of the 
locking automatically.


Sent from my iPad

On 11-Aug-2010, at 11:58 PM, Chuck Hill  wrote:



On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:




Sent from my iPad

On 11-Aug-2010, at 7:35 PM, Chuck Hill  
wrote:




On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:


Hi All,

Is it safe to invoke editingContext().saveChange() or 
editingContext().revert() in a method that is used through NSSelector 
and invoked by the NSNotificationCenter on postNotification()?



That likely depends on which notification.


Okay, here is the real scenario. I have developed a Workflow Engine 
which is capable to run multiple workflows in parallel in their 
individual threads. Each workflow has methods as start(), stop(), 
suspend(), and resume(). The behavior of these methods is understood. 
Everything remains in memory. Now in order to persist their state I 
have created a corresponding entity. There are two columns of the 
entity, status and serializedInstance which change at any stage and 
that is depending upon user actions and workflow code.


I have a workflow management dashboard which provides ability to view 
all the workflows defined in the system and to start, stop, resume and 
suspend. When I start the workflow, I call the method start() of the 
workflow entity, which internally triggers the associated workflow's 
start() method and also registers the entity to receive notifications 
from the workflow thread. The workflow thread post notifications such 
as when it completes the job or explicitly stopped, resumed, suspended 
etc. So upon these notifications, the workflow entity's onNotify() 
method is invoked which in turn based on the message, modifies the 
status column and serializedInstance column value and invokes, 
editingContext().saveChanges() inside the onNotify() method.


You will have to make sure that the EC is locked before touching any of 
the entity's persistent values or calling saveChanges()




I guess the story is too long but it is working fine so far. I just 
want to confirm that if this does not break anything at any stage or 
cause a deadlock situation?




Chuck

--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their 
overall knowledge of WebObjects or who are trying to solve specific 
problems.

http://www.global-village.net/products/practical_webobjects









--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.

http://www.global-village.net/products/practical_webobjects









--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.

http://www.global-village.net/products/practical_webobjects








___
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/chng34%40gmail.com

This email sent to chn...@gmail.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: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Chuck Hill

On Aug 11, 2010, at 2:47 PM, Farrukh Ijaz wrote:

> 
> 
>> Guessing, concurrent threads, and locking.  Never a good combination.
> 
> Thanks Chuck! Is there any choice then? Or every Workflow may have it's own 
> editingContext() considering the ec would be lightweight and won't do 
> anything else except modifying a single row?

I think the thread should own the EC.  It is still responsible to lock and 
unlock it.  And you probably don't need the notifications in this case.

Chuck


>> On Aug 11, 2010, at 2:35 PM, Farrukh Ijaz wrote:
>> 
>>> I am using ERXEC with default settings. I guess it takes care of the 
>>> locking automatically.
>>> 
>>> Sent from my iPad
>>> 
>>> On 11-Aug-2010, at 11:58 PM, Chuck Hill  wrote:
>>> 
 
 On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:
 
> 
> 
> Sent from my iPad
> 
> On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:
> 
>> 
>> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
>> 
>>> Hi All,
>>> 
>>> Is it safe to invoke editingContext().saveChange() or 
>>> editingContext().revert() in a method that is used through NSSelector 
>>> and invoked by the NSNotificationCenter on postNotification()?
>> 
>> 
>> That likely depends on which notification.
> 
> Okay, here is the real scenario. I have developed a Workflow Engine which 
> is capable to run multiple workflows in parallel in their individual 
> threads. Each workflow has methods as start(), stop(), suspend(), and 
> resume(). The behavior of these methods is understood. Everything remains 
> in memory. Now in order to persist their state I have created a 
> corresponding entity. There are two columns of the entity, status and 
> serializedInstance which change at any stage and that is depending upon 
> user actions and workflow code.
> 
> I have a workflow management dashboard which provides ability to view all 
> the workflows defined in the system and to start, stop, resume and 
> suspend. When I start the workflow, I call the method start() of the 
> workflow entity, which internally triggers the associated workflow's 
> start() method and also registers the entity to receive notifications 
> from the workflow thread. The workflow thread post notifications such as 
> when it completes the job or explicitly stopped, resumed, suspended etc. 
> So upon these notifications, the workflow entity's onNotify() method is 
> invoked which in turn based on the message, modifies the status column 
> and serializedInstance column value and invokes, 
> editingContext().saveChanges() inside the onNotify() method.
 
 You will have to make sure that the EC is locked before touching any of 
 the entity's persistent values or calling saveChanges()
 
> 
> I guess the story is too long but it is working fine so far. I just want 
> to confirm that if this does not break anything at any stage or cause a 
> deadlock situation?
> 
>> 
>> Chuck
>> 
>> -- 
>> Chuck Hill Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 
 
 -- 
 Chuck Hill Senior Consultant / VP Development
 
 Practical WebObjects - for developers who want to increase their overall 
 knowledge of WebObjects or who are trying to solve specific problems.
 http://www.global-village.net/products/practical_webobjects
 
 
 
 
 
 
 
>> 
>> -- 
>> Chuck Hill Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









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

Re: Dates (1-day resolution) redux

2010-08-11 Thread Ramsey Lee Gurley


On Aug 11, 2010, at 8:20 PM, Paul Hoadley wrote:

> Hi Ramsey,
> 
> On 12/08/2010, at 9:19 AM, Ramsey Lee Gurley wrote:
> 
>> Perhaps this is a stupid question, but is there any reason a 
>> GregorianCalendar wouldn't work?  It seems it only needs a simple subclass 
>> providing factory methods for an EOAttribute prototype.
> 
> GregorianCalendar has millisecond resolution and is timezone-aware, so I 
> don't know that it's going to be an improvement on NSTimestamp.  Is it?
> 
> 
> -- 
> Paul.

http://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSTimestamp.html

If I'm wrong, I blame the Apple docs for misleading me (^_^)  

I believe the difference is that yes, GregorianCalendar _is_ timezone aware.  
NSTimestamp is not.  NSTimestamp's getTime() value is fixed when the timestamp 
is created.  If you then adjust your timezone frame of reference, the time does 
not adjust with you.  GregorianCalendar is the opposite.  It has fixed 
gregorian values (calendar day, month, year, etc) and the getTime() value 
fluctuates based on the timezone you set on it.

Ramsey

 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
Hi Ramsey,

On 12/08/2010, at 9:19 AM, Ramsey Lee Gurley wrote:

> Perhaps this is a stupid question, but is there any reason a 
> GregorianCalendar wouldn't work?  It seems it only needs a simple subclass 
> providing factory methods for an EOAttribute prototype.

GregorianCalendar has millisecond resolution and is timezone-aware, so I don't 
know that it's going to be an improvement on NSTimestamp.  Is it?


-- 
Paul.

http://logicsquad.net/


 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
Hi Henrique,

On 12/08/2010, at 3:31 AM, Henrique Prange wrote:

> Have you tried Joda Time LocalDate [1]? 
> 
> "LocalDate is an immutable datetime class representing a date without a time 
> zone."
> 
> You could create a custom type to map the DATE external type to the LocalDate 
> class, instead of using NSTimestamp or java.util.Date. It is similar to the 
> Boolean solution.

Thanks, I will look at that.  How much work is involved in using custom types 
like this?  (I've never done it before.)  For example, do I need to provide a 
corresponding custom comparator somewhere so that EOF can sort on this 
attribute?


-- 
Paul.

http://logicsquad.net/


 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Ramsey Lee Gurley
Perhaps this is a stupid question, but is there any reason a GregorianCalendar 
wouldn't work?  It seems it only needs a simple subclass providing factory 
methods for an EOAttribute prototype.

Ramsey

On Aug 11, 2010, at 11:10 AM, Mike Schrag wrote:

> Julian Day is a really handy way to store days, too ... You get easy relative 
> comparison, and there are plenty of impls in java for making covers on your 
> EOs.
> 
> On Aug 11, 2010, at 10:27 AM, David Avendasora wrote:
> 
>> On Aug 10, 2010, at 10:04 AM, Jon Nolan wrote:
>> 
>>> IMO, this fight is absolutely not worth the effort. Store your "birthday" 
>>> attributes as integers (19700302) or strings and create cover methods on 
>>> your EOs to convert to date and back.
>> 
>> This seems the most accurate way to handle it. Noon GMT just displaces the 
>> problem to the opposite side of the planet, no? It would have to be noon in 
>> the timezone in which the event is recorded, but then, what if the user 
>> moves? A mess.
>> 
>> This is something that we are going to be dealing with as our markets 
>> expands globally. Some dates are locale-specific, some aren't, and some can 
>> even be locale-specific but only when compared to other local-specific dates 
>> (it would be helpful to know that you're wishing someone a happy birthday on 
>> the day they recognize as their birthday and not a day late).
>> 
>> Dave
>> 
>> 
>> ___
>> 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/rgurley%40mac.com
> 
> This email sent to rgur...@mac.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: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
On 11/08/2010, at 11:57 PM, David Avendasora wrote:

> On Aug 10, 2010, at 10:04 AM, Jon Nolan wrote:
> 
>> IMO, this fight is absolutely not worth the effort. Store your "birthday" 
>> attributes as integers (19700302) or strings and create cover methods on 
>> your EOs to convert to date and back.
> 
> This seems the most accurate way to handle it. Noon GMT just displaces the 
> problem to the opposite side of the planet, no? It would have to be noon in 
> the timezone in which the event is recorded, but then, what if the user 
> moves? A mess.

I agree that it's a mess.  The normalise-to-noon idea seemed attractive to me, 
though, because it would require almost no intervention (just a single extra 
method call) in an app that's already in production.  Maybe that's a false 
economy.


-- 
Paul.

http://logicsquad.net/


 ___
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: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Farrukh Ijaz


> Guessing, concurrent threads, and locking.  Never a good combination.

Thanks Chuck! Is there any choice then? Or every Workflow may have it's own 
editingContext() considering the ec would be lightweight and won't do anything 
else except modifying a single row?

> 
> 
> On Aug 11, 2010, at 2:35 PM, Farrukh Ijaz wrote:
> 
>> I am using ERXEC with default settings. I guess it takes care of the locking 
>> automatically.
>> 
>> Sent from my iPad
>> 
>> On 11-Aug-2010, at 11:58 PM, Chuck Hill  wrote:
>> 
>>> 
>>> On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:
>>> 
 
 
 Sent from my iPad
 
 On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:
 
> 
> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
> 
>> Hi All,
>> 
>> Is it safe to invoke editingContext().saveChange() or 
>> editingContext().revert() in a method that is used through NSSelector 
>> and invoked by the NSNotificationCenter on postNotification()?
> 
> 
> That likely depends on which notification.
 
 Okay, here is the real scenario. I have developed a Workflow Engine which 
 is capable to run multiple workflows in parallel in their individual 
 threads. Each workflow has methods as start(), stop(), suspend(), and 
 resume(). The behavior of these methods is understood. Everything remains 
 in memory. Now in order to persist their state I have created a 
 corresponding entity. There are two columns of the entity, status and 
 serializedInstance which change at any stage and that is depending upon 
 user actions and workflow code.
 
 I have a workflow management dashboard which provides ability to view all 
 the workflows defined in the system and to start, stop, resume and 
 suspend. When I start the workflow, I call the method start() of the 
 workflow entity, which internally triggers the associated workflow's 
 start() method and also registers the entity to receive notifications from 
 the workflow thread. The workflow thread post notifications such as when 
 it completes the job or explicitly stopped, resumed, suspended etc. So 
 upon these notifications, the workflow entity's onNotify() method is 
 invoked which in turn based on the message, modifies the status column and 
 serializedInstance column value and invokes, 
 editingContext().saveChanges() inside the onNotify() method.
>>> 
>>> You will have to make sure that the EC is locked before touching any of the 
>>> entity's persistent values or calling saveChanges()
>>> 
 
 I guess the story is too long but it is working fine so far. I just want 
 to confirm that if this does not break anything at any stage or cause a 
 deadlock situation?
 
> 
> Chuck
> 
> -- 
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
>>> 
>>> -- 
>>> Chuck Hill Senior Consultant / VP Development
>>> 
>>> Practical WebObjects - for developers who want to increase their overall 
>>> knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/products/practical_webobjects
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
> 
> -- 
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
 ___
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: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Chuck Hill
Guessing, concurrent threads, and locking.  Never a good combination.


On Aug 11, 2010, at 2:35 PM, Farrukh Ijaz wrote:

> I am using ERXEC with default settings. I guess it takes care of the locking 
> automatically.
> 
> Sent from my iPad
> 
> On 11-Aug-2010, at 11:58 PM, Chuck Hill  wrote:
> 
>> 
>> On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:
>> 
>>> 
>>> 
>>> Sent from my iPad
>>> 
>>> On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:
>>> 
 
 On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
 
> Hi All,
> 
> Is it safe to invoke editingContext().saveChange() or 
> editingContext().revert() in a method that is used through NSSelector and 
> invoked by the NSNotificationCenter on postNotification()?
 
 
 That likely depends on which notification.
>>> 
>>> Okay, here is the real scenario. I have developed a Workflow Engine which 
>>> is capable to run multiple workflows in parallel in their individual 
>>> threads. Each workflow has methods as start(), stop(), suspend(), and 
>>> resume(). The behavior of these methods is understood. Everything remains 
>>> in memory. Now in order to persist their state I have created a 
>>> corresponding entity. There are two columns of the entity, status and 
>>> serializedInstance which change at any stage and that is depending upon 
>>> user actions and workflow code.
>>> 
>>> I have a workflow management dashboard which provides ability to view all 
>>> the workflows defined in the system and to start, stop, resume and suspend. 
>>> When I start the workflow, I call the method start() of the workflow 
>>> entity, which internally triggers the associated workflow's start() method 
>>> and also registers the entity to receive notifications from the workflow 
>>> thread. The workflow thread post notifications such as when it completes 
>>> the job or explicitly stopped, resumed, suspended etc. So upon these 
>>> notifications, the workflow entity's onNotify() method is invoked which in 
>>> turn based on the message, modifies the status column and 
>>> serializedInstance column value and invokes, editingContext().saveChanges() 
>>> inside the onNotify() method.
>> 
>> You will have to make sure that the EC is locked before touching any of the 
>> entity's persistent values or calling saveChanges()
>> 
>>> 
>>> I guess the story is too long but it is working fine so far. I just want to 
>>> confirm that if this does not break anything at any stage or cause a 
>>> deadlock situation?
>>> 
 
 Chuck
 
 -- 
 Chuck Hill Senior Consultant / VP Development
 
 Practical WebObjects - for developers who want to increase their overall 
 knowledge of WebObjects or who are trying to solve specific problems.
 http://www.global-village.net/products/practical_webobjects
 
 
 
 
 
 
 
>> 
>> -- 
>> Chuck Hill Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









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

Re: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Farrukh Ijaz
I am using ERXEC with default settings. I guess it takes care of the locking 
automatically.

Sent from my iPad

On 11-Aug-2010, at 11:58 PM, Chuck Hill  wrote:

> 
> On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:
> 
>> 
>> 
>> Sent from my iPad
>> 
>> On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:
>> 
>>> 
>>> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
>>> 
 Hi All,
 
 Is it safe to invoke editingContext().saveChange() or 
 editingContext().revert() in a method that is used through NSSelector and 
 invoked by the NSNotificationCenter on postNotification()?
>>> 
>>> 
>>> That likely depends on which notification.
>> 
>> Okay, here is the real scenario. I have developed a Workflow Engine which is 
>> capable to run multiple workflows in parallel in their individual threads. 
>> Each workflow has methods as start(), stop(), suspend(), and resume(). The 
>> behavior of these methods is understood. Everything remains in memory. Now 
>> in order to persist their state I have created a corresponding entity. There 
>> are two columns of the entity, status and serializedInstance which change at 
>> any stage and that is depending upon user actions and workflow code.
>> 
>> I have a workflow management dashboard which provides ability to view all 
>> the workflows defined in the system and to start, stop, resume and suspend. 
>> When I start the workflow, I call the method start() of the workflow entity, 
>> which internally triggers the associated workflow's start() method and also 
>> registers the entity to receive notifications from the workflow thread. The 
>> workflow thread post notifications such as when it completes the job or 
>> explicitly stopped, resumed, suspended etc. So upon these notifications, the 
>> workflow entity's onNotify() method is invoked which in turn based on the 
>> message, modifies the status column and serializedInstance column value and 
>> invokes, editingContext().saveChanges() inside the onNotify() method.
> 
> You will have to make sure that the EC is locked before touching any of the 
> entity's persistent values or calling saveChanges()
> 
>> 
>> I guess the story is too long but it is working fine so far. I just want to 
>> confirm that if this does not break anything at any stage or cause a 
>> deadlock situation?
>> 
>>> 
>>> Chuck
>>> 
>>> -- 
>>> Chuck Hill Senior Consultant / VP Development
>>> 
>>> Practical WebObjects - for developers who want to increase their overall 
>>> knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/products/practical_webobjects
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
> 
> -- 
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
 ___
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: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Chuck Hill

On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote:

> 
> 
> Sent from my iPad
> 
> On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:
> 
>> 
>> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
>> 
>>> Hi All,
>>> 
>>> Is it safe to invoke editingContext().saveChange() or 
>>> editingContext().revert() in a method that is used through NSSelector and 
>>> invoked by the NSNotificationCenter on postNotification()?
>> 
>> 
>> That likely depends on which notification.
> 
> Okay, here is the real scenario. I have developed a Workflow Engine which is 
> capable to run multiple workflows in parallel in their individual threads. 
> Each workflow has methods as start(), stop(), suspend(), and resume(). The 
> behavior of these methods is understood. Everything remains in memory. Now in 
> order to persist their state I have created a corresponding entity. There are 
> two columns of the entity, status and serializedInstance which change at any 
> stage and that is depending upon user actions and workflow code.
> 
> I have a workflow management dashboard which provides ability to view all the 
> workflows defined in the system and to start, stop, resume and suspend. When 
> I start the workflow, I call the method start() of the workflow entity, which 
> internally triggers the associated workflow's start() method and also 
> registers the entity to receive notifications from the workflow thread. The 
> workflow thread post notifications such as when it completes the job or 
> explicitly stopped, resumed, suspended etc. So upon these notifications, the 
> workflow entity's onNotify() method is invoked which in turn based on the 
> message, modifies the status column and serializedInstance column value and 
> invokes, editingContext().saveChanges() inside the onNotify() method.

You will have to make sure that the EC is locked before touching any of the 
entity's persistent values or calling saveChanges()

> 
> I guess the story is too long but it is working fine so far. I just want to 
> confirm that if this does not break anything at any stage or cause a deadlock 
> situation?
> 
>> 
>> Chuck
>> 
>> -- 
>> Chuck Hill Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









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

Re: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Farrukh Ijaz


Sent from my iPad

On 11-Aug-2010, at 7:35 PM, Chuck Hill  wrote:

> 
> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:
> 
>> Hi All,
>> 
>> Is it safe to invoke editingContext().saveChange() or 
>> editingContext().revert() in a method that is used through NSSelector and 
>> invoked by the NSNotificationCenter on postNotification()?
> 
> 
> That likely depends on which notification.

Okay, here is the real scenario. I have developed a Workflow Engine which is 
capable to run multiple workflows in parallel in their individual threads. Each 
workflow has methods as start(), stop(), suspend(), and resume(). The behavior 
of these methods is understood. Everything remains in memory. Now in order to 
persist their state I have created a corresponding entity. There are two 
columns of the entity, status and serializedInstance which change at any stage 
and that is depending upon user actions and workflow code.

I have a workflow management dashboard which provides ability to view all the 
workflows defined in the system and to start, stop, resume and suspend. When I 
start the workflow, I call the method start() of the workflow entity, which 
internally triggers the associated workflow's start() method and also registers 
the entity to receive notifications from the workflow thread. The workflow 
thread post notifications such as when it completes the job or explicitly 
stopped, resumed, suspended etc. So upon these notifications, the workflow 
entity's onNotify() method is invoked which in turn based on the message, 
modifies the status column and serializedInstance column value and invokes, 
editingContext().saveChanges() inside the onNotify() method.

I guess the story is too long but it is working fine so far. I just want to 
confirm that if this does not break anything at any stage or cause a deadlock 
situation?

> 
> Chuck
> 
> -- 
> Chuck Hill Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
 ___
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


[WOWODC 2010] 3 days left for registration!

2010-08-11 Thread Pascal Robert
Hello everyone,

This is the last message about WOWODC 2010, I promise! Registration close in 3 
days, so hurry up if you want to join us for 3 days of learning and fun!

About the hotel, we ran out of rooms in our room block, and the hotel is almost 
full, the only rooms available are the superior ($169+) and business class 
($199+). Since the room block is full, you can't apply for the "Stay at the 
hotel" rebate.

If you want a cheaper alternative for your room, check the Grand Plaza :

http://www.grandplazamontreal.com/

See you in two weeks! Can't wait to drink some beers with other WO devs :-)


Pascal Robert
prob...@macti.ca

AIM: MacTICanada
Twitter : pascal_robert
LinkedIn : http://www.linkedin.com/in/macti
WO Community profile : http://wocommunity.org/page/member?name=probert

 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Henrique Prange
Hi Paul,

Have you tried Joda Time LocalDate [1]? 

"LocalDate is an immutable datetime class representing a date without a time 
zone."

You could create a custom type to map the DATE external type to the LocalDate 
class, instead of using NSTimestamp or java.util.Date. It is similar to the 
Boolean solution.

[1]http://joda-time.sourceforge.net/apidocs/org/joda/time/LocalDate.html

Cheers,

Henrique

On 11/08/2010, at 03:56, Paul Hoadley wrote:

> On 10/08/2010, at 11:33 PM, John Huss wrote:
> 
>> On Tue, Aug 10, 2010 at 6:12 AM, Paul Hoadley  wrote:
>> For the attribute that we may as well call the "birthday" attribute, I'm 
>> using the "date" prototype from ERPrototypes.  Curiously (IMHO), this 
>> prototype has an external type of "TIMESTAMP", even though Postgres offers 
>> the 1-day-resolution "DATE" type.  In any case, I stuck with the prototype 
>> as shipped.
>> 
>> I would consider that a bug in ERPrototypes, since there is a dateTime 
>> prototype, the date prototype only makes sense if it is different.  But 
>> fixing it is difficult since it could break everyone using it.  Even so, it 
>> wouldn't be the first time such a thing was done, and I am a proponent of 
>> getting things right, as long as the community is sufficiently notified.
> 
> I wonder if it's incidental to the real problem, though, which is that EOF 
> and Java have no 1-day-resolution date type.  That is, and I haven't tested 
> it (though it's on my list), I'm not sure that using PostgreSQL's DATE type 
> would actually solve the problem.
> 
> 
> -- 
> Paul.
> 
> http://logicsquad.net/
> 
> 
> ___
> 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/hprange%40gmail.com
> 
> This email sent to hpra...@gmail.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: postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Chuck Hill

On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote:

> Hi All,
> 
> Is it safe to invoke editingContext().saveChange() or 
> editingContext().revert() in a method that is used through NSSelector and 
> invoked by the NSNotificationCenter on postNotification()?


That likely depends on which notification.

Chuck

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









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

Re: Dates (1-day resolution) redux

2010-08-11 Thread Mike Schrag
Julian Day is a really handy way to store days, too ... You get easy relative 
comparison, and there are plenty of impls in java for making covers on your EOs.

On Aug 11, 2010, at 10:27 AM, David Avendasora wrote:

> On Aug 10, 2010, at 10:04 AM, Jon Nolan wrote:
> 
>> IMO, this fight is absolutely not worth the effort. Store your "birthday" 
>> attributes as integers (19700302) or strings and create cover methods on 
>> your EOs to convert to date and back.
> 
> This seems the most accurate way to handle it. Noon GMT just displaces the 
> problem to the opposite side of the planet, no? It would have to be noon in 
> the timezone in which the event is recorded, but then, what if the user 
> moves? A mess.
> 
> This is something that we are going to be dealing with as our markets expands 
> globally. Some dates are locale-specific, some aren't, and some can even be 
> locale-specific but only when compared to other local-specific dates (it 
> would be helpful to know that you're wishing someone a happy birthday on the 
> day they recognize as their birthday and not a day late).
> 
> Dave
> 
> 
> ___
> 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: Dates (1-day resolution) redux

2010-08-11 Thread David Avendasora
On Aug 10, 2010, at 10:04 AM, Jon Nolan wrote:

> IMO, this fight is absolutely not worth the effort. Store your "birthday" 
> attributes as integers (19700302) or strings and create cover methods on your 
> EOs to convert to date and back.

This seems the most accurate way to handle it. Noon GMT just displaces the 
problem to the opposite side of the planet, no? It would have to be noon in the 
timezone in which the event is recorded, but then, what if the user moves? A 
mess.

This is something that we are going to be dealing with as our markets expands 
globally. Some dates are locale-specific, some aren't, and some can even be 
locale-specific but only when compared to other local-specific dates (it would 
be helpful to know that you're wishing someone a happy birthday on the day they 
recognize as their birthday and not a day late).

Dave


 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
Hi Andrew,

On 11/08/2010, at 6:11 PM, Andrew Lindesay wrote:

> I'm not sure if that would work if you had people viewing and entering data 
> from the perspective of different time-zones?  Maybe it would be better to 
> normalise to midday for the user's timezone as opposed to the application 
> server's timezone -- assuming your application server operates in GMT+0.

Thanks Andrew.  I think you're right.


-- 
Paul.

http://logicsquad.net/


 ___
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


postNotification and editingContext().saveChanges() / editingContext().revert()

2010-08-11 Thread Farrukh Ijaz
Hi All,

Is it safe to invoke editingContext().saveChange() or editingContext().revert() 
in a method that is used through NSSelector and invoked by the 
NSNotificationCenter on postNotification()?

Thanks,
Farrukh

 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Andrew Lindesay
Hello Paul;

I'm not sure if that would work if you had people viewing and entering data 
from the perspective of different time-zones?  Maybe it would be better to 
normalise to midday for the user's timezone as opposed to the application 
server's timezone -- assuming your application server operates in GMT+0.

cheers.

>> public static NSTimestamp normalisedDate(NSTimestamp date) {
...
> Thanks for all the input on this.  I think I'll try the approach above in the 
> first instance.

___
Andrew Lindesay
www.silvereye.co.nz

 ___
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: Dates (1-day resolution) redux

2010-08-11 Thread Paul Hoadley
On 10/08/2010, at 11:44 PM, Simon wrote:

> For dates like this, I force the time component to 12:00 noon.  That at least 
> reduces the chance of timezone shifts of the day portion.
> 
> Chuck
> 
> same here:
> 
> public static NSTimestamp normalisedDate(NSTimestamp date) {
>   GregorianCalendar gc = new GregorianCalendar();
>   gc.setTime(date);
>   int d = gc.get(GregorianCalendar.DAY_OF_MONTH);
>   int m = gc.get(GregorianCalendar.MONTH) + 1;
>   int y = gc.get(GregorianCalendar.YEAR);
>   NSTimeZone tz = NSTimeZone.systemTimeZone();
>   return new NSTimestamp(y, m, d, 12, 0, 0, tz);
>   } 
> 
> over 250 references to that method in our code base!

Thanks for all the input on this.  I think I'll try the approach above in the 
first instance.


-- 
Paul.

http://logicsquad.net/


 ___
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