OOP dynamic naming of objects
I'm creating an instance in this way:
var newhouse:House = new House();
But I need to create fourty of these objects named:
"newhouse1","newhouse2",...,"newhouse40"
How can I name the var dynamicly, since the syntax won't
allow brackets
Well, at least to me, having all the instances located in an
array is
cleaner. I realize it's not _really_ cleaner, I just like
sticking stuff
into arrays. <g>
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
Similar Messages
-
RE: Named anchored objects
Albert,
In my case I was using a named anchored object to get a handle to an actual
service object. My named object that I registered in the name service was
an intermediary to which I did not maintain a connection. So I have not
explicitly tested what you are asking.
However, I too was not using a hard coded reference to the SO, and fail over
and load balancing worked fine. The functions of fail over and load
balancing are not done by the service object but by the name service, proxy
and router. Since you are getting a proxy back any time you do a lookup in
the name service I would think that fail over should work with any anchored
object that is registered in the name service. When you do a RegisterObject
call you will notice that one of the arguments is the session duration,
which implies to me that fail over will be handled the same as for service
objects.
Load balancing adds another wrinkle. Load balancing is handled by a router.
You must get a proxy to the router and not a proxy to an instance of the
object that the router is doing the load balancing for. In the latter
scenario you will be bypassing the router. If you are creating, anchoring
and registering your objects dynamically you will not have a router so you
will not be able to load balance! This applies even if the objects are
instantiated within partitions that are load balanced because you will still
be getting proxies back to a particular instance of the anchored objects.
There are ways to accomplish load balancing between objects that you
register yourself. However, the best solution will vary depending on the
actual problem trying to be solved. If you would like to discuss this
further, include a little more detail about the scenario you need to
implement and I will give you what I know.
BTY what I have outlined above also applies to getting references via a
system agent.
Sean
Cornice Consulting, Inc.
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Albert Dijk
Sent: Friday, July 03, 1998 11:01 AM
To: [email protected]
Subject:
Alex, David, Jez, Sean,...
My question about both solutions (using Nameservice and agents) is:
If I reach a remote service object using either a BindObject or an agent, do
fail-over and load-balancing work the same way as they normally do when
using a hard coded reference to the SO.
Albert Dijk
From: Sean Brown[SMTP:[email protected]]
Reply To: [email protected]
Sent: Thursday, June 25, 1998 6:55 AM
To: Ananiev, Alex; [email protected]
Subject: RE: multiple named objects with the same name and
interface
Alexander,
I can not comment on the speed difference because I never tested it.
But, I
will say that we looked at the agent solution at a client sight
before. I
will give the same warning I gave them. If you go the agent direction
you
are now using agents for a purpose that they were not intended. Even
though
it technically works, as soon as you start using a piece of
functionality in
a way the developer did not intend it to be used you run the risk of
forward
compatibility problems. By this I mean, since agents were not
originally
intended to be used to look up service / anchored object references,
it may
not work in the future because it is not likely to be given
consideration in
any future design.
As we all know, programmers are always stretching the bounds of the
tools
they use and you may have a good reason (i.e. performance). I just
wanted to
let you know the possible risk.
One final note on a limitation of using system agents to obtain
references
to anchored objects. You can not access agents across environments.
So, if
you have connected environments and need to get references to services
in
another environment for fail-over or whatever, you will not be able to
do it
with agents.
Just some thoughts!
Sean
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]]On">mailto:[email protected]]On</a> Behalf Of Ananiev, Alex
Sent: Wednesday, June 24, 1998 12:14 PM
To: '[email protected]'
Subject: RE: multiple named objects with the same name and interface
David,
The problem with dynamic binding is that in this case you have to keep
the reference to the service object somewhere. You don't want to call
"bindObject" every time you need to use this service object, "bind" is
a
time-consuming operation, even on the same partition. Keeping
reference
could be undesirable if your object could be moved across partitions
(e.g. business object).
The alternative solution is to use agents. You can create custom
agent,
make it a subagent of an active partition agent and use it as a
placeholder for whatever service you need. "FindSubAgent" works much
faster than "bindObject", we verified that and agent is "user-visible"
by its nature.
Alexander
From: "Sean Brown" <[email protected]>
Date: Wed, 24 Jun 1998 09:12:55 -0500
Subject: RE: multiple named objects with the same name and interface
David,
I actually determined it through testing. In my case I did not want
this to
happen and was trying to determine why it was happing. It makes sense
if
you think about it. Forte is trying to avoid making a remote method
invocation if it can.
Now, for anything more complex than looking locally first and if none
is
found give me any remote instance you can find, you will need to do
more
work. Using a naming scheme like Jez suggests below works well.
Sean
- -----Original Message-----
From: Jez Sygrove [<a href="mailto:[email protected]">mailto:[email protected]</a>]
Sent: Wednesday, June 24, 1998 4:34 AM
To: [email protected]; 'David Foote'
Cc: [email protected]
Subject: RE: multiple named objects with the same name and interface
David,
there's a mechanism used within SCAFFOLDS that allows the
location of the 'nearest' SO when more than one is available.
It involves registering each duplicated SO under three dynamically
built
names. The names include the partition, the node or the environment
name.
When wishing to locate the nearest SO the BO builds a SO name using
its
own partition and asks the name service for that.
If there is an SO registered under that name then it must be in the
same
partition and all is well. No cross partition calls.
If not, then the BO builds the name using its node and asks the name
service for that.
This means that if there is an SO outside the BO partition but still
on
the same node then this can be used. Again, relatively 'local'.
If neither of these work then the BO has to resort to an environment
wide search.
It may be that this approach could be adapted / adopted; I like it's
ingenuity.
Cheers,
Jez
From: David Foote[SMTP:[email protected]]
Reply To: David Foote
Sent: 24 June 1998 03:17
To: [email protected]
Cc: [email protected]
Subject: RE: multiple named objects with the same name and
interface
Sean,
First, thank you for your response. I have wondered about this fora
long time.
I looked at the documentation for ObjectLocationManager and on page
327
of the Framework Library and AppletSupport Library Guide indescribing
the BindObject method Forte says:
"The name service allows more than one anchored object (from
different
partitions) to be registered in the name service under the same
registration name. When you invoke the BindObject method with a
request
for a name that has duplicate registration entries, the BindObject
method finds an entry corresponding to an active partition, skipping
any
entries that do not. If no such active partition is found, or if the
requested name is not found in the name service registry, a
RemoteAccessException will be raised when the BindObject method is
invoked."
My question is: How did you discover that in the case of duplicate
registrations the naming service will return the local object if one
exists? This is not apparent from the documentation I have quoted.
Is
it documented elsewhere? Or did you determine it empirically?
David N. Foote,
Consultant
----Original Message Follows----
David,
First I will start by saying that this can be done by using named
anchored
objects and registering them yourself in the name service. There is
documentation on how to do this. And by default you will get mostof
the
behavior you desire. When you do a lookup in the name service
(BindObject
method) it will first look in the local partition and see if thereis
a
local copy and give you that copy. By anchoring the object and
manually
registering it in the name service you are programmatically creating
your
own SO without defining it as such in the development environment.
BTW
in
response to your item number 1. This should be the case there as
well.
If
your "mobile" object is in the same partition where the serviceobject
he is
calling resides, you should get a handle to the local instance ofthe
service object.
Here is the catch, if you make a bind object call and there is no
local
copy
you will get a handle to a remote copy but you can not be sure which
one!
It end ups as more or less a random selection. Off the top of myhead
and
without going to the doc, I am pretty sure that when you register an
anchored object you can not limit it's visibility to "User".
Sean
-----Original Message-----
From: [email protected]
[<a href=
"mailto:[email protected]]On">mailto:[email protected]]On</a> Behalf Of David Foote
Sent: Monday, June 22, 1998 4:51 PM
To: [email protected]
Subject: multiple named objects with the same name and interface
All,
More than once, I have wished that Forte allowed you to place named
objects with the same name in more than one partition. There aretwo
situations in which this seems desirable:
1) Objects that are not distributed, but are mobile (passed by value
to
remote objects), cannot safely reference a Service Object unless it
has
environment visibility, but this forces the overhead of a remote
method
call when it might not otherwise be necessary. If it were possibleto
place a copy of the same Service Object (with user visibility) ineach
partition, the overhead of a remote method call could be avoided.
This
would only be useful for a service object whose state could besafely
replicated.
2) My second scenario also involves mobile objects referencing a
Service
Object, but this time I would like the behavior of the calledService
Object to differ with the partition from which it is called.
This could be accomplished by placing Service Objects with the same
name
and the same interface in each partition, but varying the
implementation
with the partition.
Does anyone have any thoughts about why this would be a good thingor
a
bad thing?
David N. Foote
Consultant
Alexander Ananiev
Claremont Technology Group
916-558-4127
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href="http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>
>
>
Alexander Ananiev
Claremont Technology Group
916-558-4127
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>Albert,
In my case I was using a named anchored object to get a handle to an actual
service object. My named object that I registered in the name service was
an intermediary to which I did not maintain a connection. So I have not
explicitly tested what you are asking.
However, I too was not using a hard coded reference to the SO, and fail over
and load balancing worked fine. The functions of fail over and load
balancing are not done by the service object but by the name service, proxy
and router. Since you are getting a proxy back any time you do a lookup in
the name service I would think that fail over should work with any anchored
object that is registered in the name service. When you do a RegisterObject
call you will notice that one of the arguments is the session duration,
which implies to me that fail over will be handled the same as for service
objects.
Load balancing adds another wrinkle. Load balancing is handled by a router.
You must get a proxy to the router and not a proxy to an instance of the
object that the router is doing the load balancing for. In the latter
scenario you will be bypassing the router. If you are creating, anchoring
and registering your objects dynamically you will not have a router so you
will not be able to load balance! This applies even if the objects are
instantiated within partitions that are load balanced because you will still
be getting proxies back to a particular instance of the anchored objects.
There are ways to accomplish load balancing between objects that you
register yourself. However, the best solution will vary depending on the
actual problem trying to be solved. If you would like to discuss this
further, include a little more detail about the scenario you need to
implement and I will give you what I know.
BTY what I have outlined above also applies to getting references via a
system agent.
Sean
Cornice Consulting, Inc.
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of Albert Dijk
Sent: Friday, July 03, 1998 11:01 AM
To: [email protected]
Subject:
Alex, David, Jez, Sean,...
My question about both solutions (using Nameservice and agents) is:
If I reach a remote service object using either a BindObject or an agent, do
fail-over and load-balancing work the same way as they normally do when
using a hard coded reference to the SO.
Albert Dijk
From: Sean Brown[SMTP:[email protected]]
Reply To: [email protected]
Sent: Thursday, June 25, 1998 6:55 AM
To: Ananiev, Alex; [email protected]
Subject: RE: multiple named objects with the same name and
interface
Alexander,
I can not comment on the speed difference because I never tested it.
But, I
will say that we looked at the agent solution at a client sight
before. I
will give the same warning I gave them. If you go the agent direction
you
are now using agents for a purpose that they were not intended. Even
though
it technically works, as soon as you start using a piece of
functionality in
a way the developer did not intend it to be used you run the risk of
forward
compatibility problems. By this I mean, since agents were not
originally
intended to be used to look up service / anchored object references,
it may
not work in the future because it is not likely to be given
consideration in
any future design.
As we all know, programmers are always stretching the bounds of the
tools
they use and you may have a good reason (i.e. performance). I just
wanted to
let you know the possible risk.
One final note on a limitation of using system agents to obtain
references
to anchored objects. You can not access agents across environments.
So, if
you have connected environments and need to get references to services
in
another environment for fail-over or whatever, you will not be able to
do it
with agents.
Just some thoughts!
Sean
-----Original Message-----
From: [email protected]
[<a href="mailto:[email protected]]On">mailto:[email protected]]On</a> Behalf Of Ananiev, Alex
Sent: Wednesday, June 24, 1998 12:14 PM
To: '[email protected]'
Subject: RE: multiple named objects with the same name and interface
David,
The problem with dynamic binding is that in this case you have to keep
the reference to the service object somewhere. You don't want to call
"bindObject" every time you need to use this service object, "bind" is
a
time-consuming operation, even on the same partition. Keeping
reference
could be undesirable if your object could be moved across partitions
(e.g. business object).
The alternative solution is to use agents. You can create custom
agent,
make it a subagent of an active partition agent and use it as a
placeholder for whatever service you need. "FindSubAgent" works much
faster than "bindObject", we verified that and agent is "user-visible"
by its nature.
Alexander
From: "Sean Brown" <[email protected]>
Date: Wed, 24 Jun 1998 09:12:55 -0500
Subject: RE: multiple named objects with the same name and interface
David,
I actually determined it through testing. In my case I did not want
this to
happen and was trying to determine why it was happing. It makes sense
if
you think about it. Forte is trying to avoid making a remote method
invocation if it can.
Now, for anything more complex than looking locally first and if none
is
found give me any remote instance you can find, you will need to do
more
work. Using a naming scheme like Jez suggests below works well.
Sean
- -----Original Message-----
From: Jez Sygrove [<a href="mailto:[email protected]">mailto:[email protected]</a>]
Sent: Wednesday, June 24, 1998 4:34 AM
To: [email protected]; 'David Foote'
Cc: [email protected]
Subject: RE: multiple named objects with the same name and interface
David,
there's a mechanism used within SCAFFOLDS that allows the
location of the 'nearest' SO when more than one is available.
It involves registering each duplicated SO under three dynamically
built
names. The names include the partition, the node or the environment
name.
When wishing to locate the nearest SO the BO builds a SO name using
its
own partition and asks the name service for that.
If there is an SO registered under that name then it must be in the
same
partition and all is well. No cross partition calls.
If not, then the BO builds the name using its node and asks the name
service for that.
This means that if there is an SO outside the BO partition but still
on
the same node then this can be used. Again, relatively 'local'.
If neither of these work then the BO has to resort to an environment
wide search.
It may be that this approach could be adapted / adopted; I like it's
ingenuity.
Cheers,
Jez
From: David Foote[SMTP:[email protected]]
Reply To: David Foote
Sent: 24 June 1998 03:17
To: [email protected]
Cc: [email protected]
Subject: RE: multiple named objects with the same name and
interface
Sean,
First, thank you for your response. I have wondered about this fora
long time.
I looked at the documentation for ObjectLocationManager and on page
327
of the Framework Library and AppletSupport Library Guide indescribing
the BindObject method Forte says:
"The name service allows more than one anchored object (from
different
partitions) to be registered in the name service under the same
registration name. When you invoke the BindObject method with a
request
for a name that has duplicate registration entries, the BindObject
method finds an entry corresponding to an active partition, skipping
any
entries that do not. If no such active partition is found, or if the
requested name is not found in the name service registry, a
RemoteAccessException will be raised when the BindObject method is
invoked."
My question is: How did you discover that in the case of duplicate
registrations the naming service will return the local object if one
exists? This is not apparent from the documentation I have quoted.
Is
it documented elsewhere? Or did you determine it empirically?
David N. Foote,
Consultant
----Original Message Follows----
David,
First I will start by saying that this can be done by using named
anchored
objects and registering them yourself in the name service. There is
documentation on how to do this. And by default you will get mostof
the
behavior you desire. When you do a lookup in the name service
(BindObject
method) it will first look in the local partition and see if thereis
a
local copy and give you that copy. By anchoring the object and
manually
registering it in the name service you are programmatically creating
your
own SO without defining it as such in the development environment.
BTW
in
response to your item number 1. This should be the case there as
well.
If
your "mobile" object is in the same partition where the serviceobject
he is
calling resides, you should get a handle to the local instance ofthe
service object.
Here is the catch, if you make a bind object call and there is no
local
copy
you will get a handle to a remote copy but you can not be sure which
one!
It end ups as more or less a random selection. Off the top of myhead
and
without going to the doc, I am pretty sure that when you register an
anchored object you can not limit it's visibility to "User".
Sean
-----Original Message-----
From: [email protected]
[<a href=
"mailto:[email protected]]On">mailto:[email protected]]On</a> Behalf Of David Foote
Sent: Monday, June 22, 1998 4:51 PM
To: [email protected]
Subject: multiple named objects with the same name and interface
All,
More than once, I have wished that Forte allowed you to place named
objects with the same name in more than one partition. There aretwo
situations in which this seems desirable:
1) Objects that are not distributed, but are mobile (passed by value
to
remote objects), cannot safely reference a Service Object unless it
has
environment visibility, but this forces the overhead of a remote
method
call when it might not otherwise be necessary. If it were possibleto
place a copy of the same Service Object (with user visibility) ineach
partition, the overhead of a remote method call could be avoided.
This
would only be useful for a service object whose state could besafely
replicated.
2) My second scenario also involves mobile objects referencing a
Service
Object, but this time I would like the behavior of the calledService
Object to differ with the partition from which it is called.
This could be accomplished by placing Service Objects with the same
name
and the same interface in each partition, but varying the
implementation
with the partition.
Does anyone have any thoughts about why this would be a good thingor
a
bad thing?
David N. Foote
Consultant
Alexander Ananiev
Claremont Technology Group
916-558-4127
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:<a href="http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
>
>
>
Alexander Ananiev
Claremont Technology Group
916-558-4127
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:<a href=
"http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>> -
Dynamic Positioning of Objects in a Grid (rows and columns) AS3 Tutorial
The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/Hard to tell from your description but this might help:
http://dtptools.com/product.asp?id=atid
Bob -
Dynamic Positioning of Objects in a Grid (rows and columns) with AS3 Tutorial
The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/Hard to tell from your description but this might help:
http://dtptools.com/product.asp?id=atid
Bob -
Dynamic table of object references possible?
How can I create a dynamically typed table of object references, based on the
name of the reference type (which could be an interface)?
The following will not work, because cl_abap_tabledescr=>create() only accepts a
cl_abap_datadescr as the line type, not a cl_abap_objectdescr:
lo_line_type = cl_abap_typedescr=>describe_by_name( 'Z_MY_INTF' ).
lo_table_type = cl_abap_tabledescr=>create(
p_line_type = lo_line_type
p_table_kind = cl_abap_tabledescr=>tablekind_std
p_unique = abap_false ).
Can I somehow create a reference type description from the object description and
use that as the line type? Or what?
-- SebastianHello Sebastian
I have improved my sample report according to your requirement:
*& Report ZUS_SDN_OO_INSTANCE_ITERATOR
*& Thread: Dynamic table of object references possible?
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1381471"></a>
REPORT zus_sdn_oo_instance_iterator.
TYPE-POOLS: abap.
DATA:
gd_instanceof TYPE abap_bool,
go_objdescr TYPE REF TO cl_abap_objectdescr,
gd_clsname TYPE string,
gt_objects TYPE swf_utl_object_tab,
go_object TYPE REF TO object,
go_msglist TYPE REF TO if_reca_message_list,
go_iterator TYPE REF TO cl_swf_utl_iterator.
START-OF-SELECTION.
* Create instances and collect into generic instance itab
DO 3 TIMES.
CLEAR: go_msglist.
go_msglist = cf_reca_message_list=>create( ).
" NOTE: This class method cannot determine interface instances
CALL METHOD cl_lcr_util=>instanceof
EXPORTING
object = go_msglist
class = 'CL_RECA_MESSAGE_LIST'
RECEIVING
r_ = gd_instanceof.
clear: gd_instanceof.
" NOTE: This class method works both with classes and interfaces
CALL METHOD cl_wdy_wb_reflection_helper=>is_instance_of
EXPORTING
object = go_msglist
type_name = 'IF_RECA_MESSAGE_LIST'
receiving
is_instance = gd_instanceof.
IF ( gd_instanceof = abap_true ).
APPEND go_msglist TO gt_objects.
ENDIF.
ENDDO.
* Create iterator with collected instances
CREATE OBJECT go_iterator
EXPORTING
im_object_list = gt_objects.
* Iteration through collected instances
WHILE ( go_iterator->get_current( ) IS BOUND ).
go_object = go_iterator->get_current( ).
go_objdescr ?= cl_abap_objectdescr=>describe_by_object_ref( go_object ).
gd_clsname = go_objdescr->get_relative_name( ).
WRITE: / syst-index, gd_clsname.
go_msglist ?= go_iterator->get_current( ).
go_iterator->get_next( ).
ENDWHILE.
END-OF-SELECTION.
Regards
Uwe -
Creating a dynamic number of objects
Hi,
I write a program that has to use a dynamic number of object let say Strings (st1, st2, st3.....)
for (i=1;i<4;i++){
String "str"+i = new String (" ");
How do I do that?
Eliuse collections. list. hashtable or something like that. even an array would be ok and keep adding data to it
-
Dynamically Named Restore Points?
Does anyone know how to create dynamically named restore points? I have an RMAN script that is currently setup like this:
sql 'drop restore point lv_restore';
sql 'create restore point lv_restore';
backup database plus archivelog;
delete noprompt obsolete;
exit;
The first line is where I drop the restore point and the second line is where I create it again. This way the restore point is set just before the backup begins.
Okay - it's setup like this because when I don't drop the restore point ahead of time I get the following error:
sql statement: create restore point lv_restore
RMAN-00571: =================================================
RMAN-00569: ======== ERROR MESSAGE STACK FOLLOWS ===========
RMAN-00571: =================================================
RMAN-03009: failure of sql command on default channel at 04/29/2008 15:22:44
RMAN-11003: failure during parse/execution of SQL statement: create restore point lv_restore
ORA-38778: Restore point 'LV_RESTORE' already exists.
This makes sense to me, actually. What I would love to do is to dynamically append the current date to the end of the restore point name. The idea is to have the restore points named something like this:
lv_restore_2008-04-25
lv_restore_2008-04-26
lv_restore_2008-04-27
lv_restore_2008-04-28
lv_restore_2008-04-29
etc...
Is there any way I can dynamically name restore points?Can anyone explain to me how to use the syntax provided by damorgan to actually append a value to the restore point name in the script I provided?
Any help is greatly appreciated. -
File dynamically named & want to ignor some characters
Hi,
My ODI sources are files dynamically named with structure SR_10-04-2011-22-54.tx.gz --> SR_dd-mm-yyyy-hh24-mi.txt.gz , i'm trying to extract thoes files with ODIunzip so i created a package and passed a variable with that structure to the ODIunzip component, but as my files are generated by a platforme in a time, and the extraction begin later , the sysdate browth form Oracle by : select to_char(sysdate,'dd-mm-yyyy-hh24-mi') from dual ; to the variable is not conform with the file structure (minuts & seconds) so i'll bring just the dd-mm-yyyy form the sysdate, and what i need is to extract the file with that date , and ignor the seconds & minuts in the name of the file.
so Plz how can i do that?
or is there other way to extract this file?
thx a lot :)Jython tutorials..
http://www.jython.org/docs/tutorial/indexprogress.html
I would also look at the blogs on http://odiexperts.com/, and Oracles own tutorials around ODI -
Trying to reference a dynamically named object
Hi. I'm trying to make an interactive deck of cards and am
mostly done (
http://cards.positivedesign.co.uk
) but i'm having a slight problem. If you click on the link above
you'll see a pile on the right, click on the pile and the top card
lifts and flips into the center. Click on the right pile again and
the center card moves down to a pile on the left, and the next card
flips up to the center, and so on. The problem occurs when you
click on the right pile the 3rd time, the center card moves down to
the left, but goes BELOW the pile rather than on top of it.
I know WHY its doing this - i'm using the child index of the
cards to select which cards to flip, so if you click on a card on
the right and it has an index of 5, it moves the card with index 6
from the center to the left, etc. - I'm just not sure of another
way to do it. I tried naming the cards by numbers, so the top card
has a name of '1', and then I used a currentCard variable to keep
track of which cards I should be moving. However this wouldn't work
when I tried to select which object to tween, because I was
referencing 'cardLayer.currentCard' rather than say,
'cardLayer.card1'...
Hope that all makes sense. I'd appreciate any suggestions on
where I'm going wrong, or a better way of doing it?a clean solution, nice
Craig
"fatbuoy1" <[email protected]> wrote in
message
news:gkipvm$1gj$[email protected]..
> Yeah but by changing the order of the objects on stage,
like say bringing
> a
> card to the top, I then couldn't use the child index to
work out what
> cards to
> use.
>
> I found another way of referencing the right objects
though.. when I'm
> creating the cards in a for loop, I put the objects
themselves into an
> array,
> and then reference them through their index in the array
when I want to
> manipulate them.
>
> Thanks anyway!
> -
I'm looking for a way to name my objects, without having to name them in hard-code, so instead of
Item randomName = new Item();I could do something like
for(int i=0;i<10;i++){
Item i = new Item();
}Which would hopefully give me 10 new items, named 1-10. I'm sure this must be possible, but I imagine I am approaching it completely wrong. And help would be appreciated.cheesysam wrote:
Okay. I'll forget trying to give them names. And read up about ArrayLists. Thanks for the help. Like I said I think I'm just approaching it wrong.A List (like ArrayList or LinkedList) is what you'd use if you don't carea about duplicates, but do care about the ordering of the things, but you only want to access them sequentially or by index.
A Set (like HashSet) is what you'd use if you don't care about order, don't want duplicates, and are going to process them sequentially (as opposed to picking one out by "name").
If you want no dupes AND care about order, use a LinkedHashSet (to preserve insertion order) or a SortedSet (like TreeSet) to keep them sorted by some attribute(s).
If you want to retrieve things randomly by "name" or some other non-numeric property, use a Map (like HashMap). -
How to create dynamically named objects?
I want to create some numbered XML classes, like this:
var myXML1:XML = new XML();
var myXML2:XML = new XML();
var myXML3:XML = new XML();
...etc.
I want to do that without creating them manually. Can
somebody show me the code that would generate multiple XML
objects?You could store them in an array like this:
var myXML = new Array();
for (var i=0; i<100; i++) {
myXML
= new XML();
You could then refer to each XML Object created with
myXML[0], myXML[1], etc. -
Comparing dynamic fields of objects using equals and hashCode methods
To compare the different objects of the same class with their contents like jobTitleId, classificationId, deptId & classificationId was to be done and do some manipulations later using Set and Map. I was able to do that by simply overriding the equals and hashCode methods of Object class and was able to fetch the information (like in the following Map).
Map<LocationData, List<LocationData>>
The following is the class I used (its been shown to you so that it can be referred for my problem statement):
LocationData class
package com.astreait.bulkloader;
public class LocationData {
String locId, deptId, jobTitleId, classificationId;
@Override
public boolean equals(Object obj) {
LocationData ld = (LocationData)obj;
return this.deptId.equals(ld.deptId) && this.jobTitleId.equals(ld.jobTitleId) && this.classificationId.equals(ld.classificationId) &&
this.locId.equals(ld.locId);
@Override
public int hashCode() {
return deptId.hashCode() + jobTitleId.hashCode() + classificationId.hashCode() +locId.hashCode();
Problem:
I'm already known to which all fields of this object I need to make the comparison.
i.e I'm bound to use the variables named classificationId, deptId, jobTitleId & locId etc.
Need:
I need to customize this logic such that the fields Names (classificationId, deptId, jobTitleId & locId etc) can be pulled dynamically along with their values. So, as far as my understanding I made use of 2 classes (TableClass and ColWithData) such that the List of ColWithData is there in TableClass object.
I'm thinking what if I override the same two methods `equals() & hashCode();`
such that the same can be achieved.
TableClass class #1
class TableClass{
List<ColWithData> cwdList;
@Override
public boolean equals(Object obj) {
boolean returnVal = false;
// I need to have the logic to be defined such that
// all of the dynamic fields can be compared
return returnVal;
@Override
public int hashCode() {
int returnVal = 0;
// I need to have the logic to be defined such that
// all of the dynamic fields can be found for their individual hashCodes
return returnVal;
ColWithData class #2
class ColWithData{
String col; // here the jobTitleId, classificationId, deptId, locId or any other more fields info can come.
String data; // The corresponding data or value for each jobTitleId, classificationId, deptId, locId or any other more fields.
Please let me know if I'm proceeding in the right direction or I should make some any other approach. If it is ok to use the current approach then what should be performed in the equals and hashCode methods?
Finally I need to make the map as: (Its not the concern how I will make, but can be considered as my desired result from this logic)
Map<TableClass, List<TableClass>> finalMap;Hello,
What is the relation with the Oracle Forms tool ?
Francois -
Is member.erase() good for dynamic delete of objects/members?
Hi,
after creating a few members dynamically at runtime (
_movie.newmember(#text)), they accumulate at the cast. I
want to erase/delete them, to prevent memory problems in complex
instances of the application, but the Director Reference/Help warns
of using
member.erase() at run-time:
quote:
For best results, use this method during authoring and not in
projectors. Using this method in projectors may cause memory
problems.
So, should I use it, or should I count on the user memory
capacity to withstand the... ~100 objects (approximation) that will
be created at runtime?
PS: When I try to remove the member from the cast library at
run-time, when I'm done with the member, the cursor turns to a
rotating sandwatch for a few seconds. I wonder why, and how much
CPU that takes (tested at the Director IDE).Hi,
The only issues I've had is that erasing and creating members
in the same slot - in Shockwave, you would occasionally get a flash
of the previous cast member and other similar visual oddness. So I
generally use a wrapper script that keeps track of used slots and
ensures that all 'creates' use an empty slot.
-- Luke -
Hai
There is a calss Firm like below
public class Firm
public void sayHai()
System.out.println("Hai");
There is a main class like below
public main
public void getObject(String className,Object firmObject)
In this method I am passing Object as a parameter.
I want to accessw sayHai() method of Firm Class by using firmObject
variable.
Actually i am trying like below
Class clsFirm = Class.forName(className);
Object objFirm = clsFirm.newInstance();
objFirm.sayHai(); // Here it is showing error. I am not getting
// How to cast the ObjFirm to actual object.
// Since I know className only.
public static void main(String args[])
Main doMain = new Main();
Firm doFirm = new doFirm();
dc.getObject("Firm",doFirm);
Thnks in advance for clarifying my doubt.There are two approaches. Usually the best one is to predefine an interface which your dynamically loaded are required to implement. Then you can cast the dynamically created object to that interface and call it from there.
public interface DynInterface {
public void sayHI();
public class Firm implements DynInterface {
public void sayHi() {
Class cls = Class.forName("Firm");
DynInterface obj = (Dyninterface)cls.newInstance();
obj.sayHi();If you don't have that kind of control over the specs of the dynamically loaded classes they you need to resort to introspecion. In this can use the getMethod() call of Class to get a java.lang.reflect.Method object and use "invoke" on it:
Class cls = Class.forName("Firm");
Method m = cls.getMethod("sayHi", null);
Object obj = cls.newInstance();
m.invoke(obj, null); -
Dynamic sortation of objects in a document
I am designing a project management solution and i am not sure if the functionaility is natively built in to do what i want or if we need to hire a developer to use scripting ui.
I created a project management document that is more pleasing to the eye than a spreadsheet but needs a sortation function. Each project is a block with text and a color bar that indicates project status and text that indicates priority.
1. The content blocks are sorted in a table like layout with two columns. I was wanting to find a way to dymanically sort the objects by priority or color status without the need to cut and paste and shift objects around manually everytime projects change status and priority.
2. Can i achieve through stylesheets the change of the colorbar dynamically without the need to select teh bar and mannually select the color value?
If this is doable in InDesign natively can you point me to the propper documentation. If not can you tell me if its possible to develop within the scripting api.Hard to tell from your description but this might help:
http://dtptools.com/product.asp?id=atid
Bob
Maybe you are looking for
-
Problems with MSI K7N2 DELTA ILSR
I set my bios to high performance defaults and now when i turn it on the diagnosis LED's say that the processor, then the RAM are damaged, but this isnt the case as i have tested them in a different machine and they are ok. I have tried clearing the
-
How do I return an e-library book on adobe digital editions?
How do I return an e-library book on adobe digital editions?
-
I have done searches and gotten suggestions and or results from pornographic sites. Does that mean some one has used this computer to view pornography and those sites have left cookies on my computer that effect future search results and suggestions?
-
Just bought Premiere CS6. Have an issue importing ProRes files. Have searched a dozen forums and FAQ pages, and not got a clear or functional answer. I'm trying to find a phone number for Adobe Product support. It is almost evil. Every page take
-
Query output format changing from GRID to LIST
Hi experts, I am ading an additional table to an Infoset (SQ02) and selcting some of its fields in corresponding query(SQ01) for display. Now when I am trying to execute the query I am getting error message at bottom as below: 'The line sequence does