Re: Session count

2016-09-12 Thread Thomas LATTER
Hi Calvin,

My app was already fetching the application().activeSessionsCount() from
the server every 30 seconds.
So now in the same DirectAction I also update a new small table in my
database with a row for each of my instances and two columns(Instance ID,
active count). I can now fetch this data and display the active counts of
the other instances of my app. I had to add a little extra so that when an
instance's last session terminated the count in the database would go down
to zero, to do this I overrid the terminate() function in Session.java to
something like this:

public void terminate(){
// If this is the last session on the instance we update the DB session
count to 0 before terminating it
if(this.application().activeSessionsCount() == 1){
EOEditingContext editingContext = this.defaultEditingContext();
String instanceId =
String.valueOf(this.context().request().applicationNumber());
WebInstance instance = WebInstance.fetchRequiredWebInstance(editingContext,
ERXQ.equals(WebInstance.ID_KEY, Integer.valueOf(instanceId)));
instance.setActiveCount(0);
editingContext.saveChanges();
}
}
super.terminate();
}

2016-09-12 18:33 GMT+02:00 Calven Eggert <cal...@mac.com>:

> Thomas,
>
> I'm interested in knowing the solution you used. thanks.
>
> Calven
> ---
> Message: 3
> Date: Mon, 12 Sep 2016 18:01:53 +0200
> From: Thomas LATTER <latter...@gmail.com>
> To: Marco A Gonzalez <marco...@mac.com>,
> webobjects-dev@lists.apple.com
> Subject: Re: get active session count for all instances
> Message-ID:
> 

Re: get active session count for all instances

2016-09-12 Thread Thomas LATTER
Thanks Marco,

I found a solution to this. Yes I have got all this in my JavaMonitor, but
I needed to retrieve the info in java to display on screen from within one
of the instances. So now I just continuously update a small table in a
database with the active counts of each instance.

Thomas

2016-09-12 17:33 GMT+02:00 Marco A Gonzalez <marco...@mac.com>:

> Thomas,
>
> My current JavaMonitor shows me running session count. I think I updated
> it myself a while ago and had issued a pull request but there was some git
> confusion on the part of the committers that may have lost my pull-request
> (not pointing fingers, not blaming anyone… just explaining)
>
> I see the following in my JavaMonitor. If you don’t, let me know and I’ll
> try to put together another pull-request so that you can get it from the
> “proper” place.
>
>
>
> - Marco A.
>
> - - - - - From your posting on the WO list -  - - - -
> *From: *Thomas LATTER <latter...@gmail.com>
> *Subject: **get active session count for all instances*
> *Date: *September 9, 2016 at 7:59:35 AM EDT
> *To: *webobjects-dev@lists.apple.com
>
>
> Hi all,
>
> I'm not sure this is possible but is there an easy way to get the total
> number of active sessions in all the instances of an application? We have 4
> instances of the app in a javamonitor, 
> this.application().activeSessionsCount()
> will return the count for the current instance only, whereas I'd like the
> sum of all 4.
>
> Thanks in advance!
>
> Thomas
>
>
>
> --
> Marco A. Gonzalez, President
> Amagavi, Inc.
> Developer of database-driven web sites
>
> web: http://www.amagavi.com/
> email: marco...@mac.com
> Skype: amagavimarco
> cell: 202-222-5137
>
>
>
>
>
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

get active session count for all instances

2016-09-09 Thread Thomas LATTER
Hi all,

I'm not sure this is possible but is there an easy way to get the total
number of active sessions in all the instances of an application? We have 4
instances of the app in a javamonitor,
this.application().activeSessionsCount() will return the count for the
current instance only, whereas I'd like the sum of all 4.

Thanks in advance!

Thomas
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

maven.wocommunity.org : server not responding ?

2015-09-25 Thread Thomas LATTER
Hi everyone,

Is maven.wocommunity.org down ?
The server is not responding;

regards,

Thomas
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Virtual Column equivalent in EOModel ?

2015-06-09 Thread Thomas LATTER
Hi,

In one of my Oracle tables I've got a virtual column. In my EOModel I had
to set this field as Read-Only in order to do an Insert in this table.
Otherwise the generated SQL included this field and an Oracle error occured.

My problem now is to edit/update a row in this table because even with this
field as Read-Only in the EOModel the generated SQl includes this field in
the 'Where' clause of it's 'UPDATE' query.

Is there a certain way to set this field in the EOModel for it not to be
included in the sql for an edit/update? Or should I just use rawrows?

Thanks in advance,
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

ERXExistsQualifier

2015-04-23 Thread Thomas LATTER
Hi,

The ERXExistsQualifier currently doesn't seem to work when multiple tables
are referenced in the 'exists' condition. I think a few people are already
aware of this but could anyone tell be if they know a way to work around
this ? Because the only alternatives I see are either redesigning tables in
my database or trying to correct the ERXExistsQualifier.class myself.
Thanks in advance for any advice!


Here's the SQL output of two examples explaining why one works and not the
other:
1) Example 1 - where the exists condition only refers to one table
(works because OBS table is correctly aliased exists0)
 SELECT t0.*
FROM PTF t0
WHERE ( EXISTS ( SELECT exists0.ID
 FROM OBS exists0
 WHERE exists0.OBS_DATE BETWEEN date1 AND date2
 AND exists0.PTF_ID = t0.ID
 )
)
2) Example 2 - where the exists condition refers to multiple tables
(doesn't work because OBS table is aliased t0 instead of exists0, ...and
the PTF_LOC table shouldn't be aliased T1 either)
SELECT t0.*
FROM PTF t0
WHERE ( EXISTS ( SELECT exists0.ID
 FROM OBS t0, PTF_LOC T1
 WHERE T1.LAT BETWEEN -40 AND 91
 AND exists0.PTF_LOC_ID = T1.ID
 AND exists0.PTF_ID = t0.ID
 )
)
Next exception:SQL State:42000 -- error code: 904 -- msg: ORA-00904:
EXISTS0.PTF_ID : identificateur non valide


...And here's the 2 equivalent queries but with the IN qualifier(same
problem):
1bis) SELECT t0.*
FROM PTF t0, PROGRAM T1, MASTER_PROG T2, PTF_STATUS T3
WHERE (t0.ID IN ( SELECT exists0.PTF_ID
  FROM OBS exists0
  WHERE exists0.OBS_DATE BETWEEN ? AND ? )
 )

2bis) SELECT t0.*
FROM PTF t0
WHERE (t0.ID IN ( SELECT exists0.PTF_ID
  FROM OBS t0, PTF_LOC T1
  WHERE T1.LAT BETWEEN ? AND ?
  AND exists0.PTF_LOC_ID = T1.ID
)
)
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSTimestamp

2014-12-02 Thread Thomas LATTER
Hi, what is the simplest way these days to convert a string or Date to
NSTimestamp ?

I can't seem to use SimpleDateFormat because java.util.Date cannot be cast
to com.webobjects.foundation.NSTimestamp ...
String stringDate = 01/01/2014;
SimpleDateFormat dateFormat = new SimpleDateFormat(dd/MM/);
NSTimestamp deplDate = (NSTimestamp) dateFormat.parse(stringDate);

Thanks in advance,
tom
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Best way to use raw SQL

2014-10-23 Thread Thomas LATTER
Hi, what would be the best way to query in SQL these days in Project Wonder
?
I would like to use SQL directly sometimes for complex queries including
calculations (averages, medians..). Some of the previous solutions are
deprecated. Thanks in advance
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

[no subject]

2014-09-28 Thread Thomas LATTER
Is there a known bug on ERXExistsQualifiers? The generated SQL code is
false. It compares the primary keys of both tables instead of the foreign
key and primary key as specified in the relationship. Someone posted this
same bug in 2011, has anyone been able to use them since and otherwise what
would be the best alternative ?
 ___
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com