Reference to an object by String(ID)?
I am trying to build a glow container/manager in order to
turn off and turn on appropriate component. In fact, when a
specific component respond to a click, it will be glowed. But if
the user click on another specific component, the previous glowed
should unglow and the new one will be glowed.
Now, to do this, I created a class with 2 elements:
objReference:String and glowActive:Boolean. I also created an
ArrayCollection of all the component that can respond to the glow
effect and put them inside like this:
objReference = [object].ID
And every component get FALSE for glowActive at the
initiation of the ArrayCollection.
I have a problem with the recognization of the object ID.
When I tried to play the glow using the objReference, the system
indicate the following error:
TypeError: Error #1006: value is not a function.
at
mx.effects::EffectInstance/play()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\effec ts\EffectInstance.as:584]
at
mx.effects.effectClasses::GlowInstance/play()[E:\dev\3.0.x\frameworks\projects\framework\ src\mx\effects\effectClasses\GlowInstance.as:194]
at
mx.effects::EffectInstance/startEffect()[E:\dev\3.0.x\frameworks\projects\framework\src\m x\effects\EffectInstance.as:569]
at
mx.effects::Effect/play()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\effects\Effec t.as:930]
at accueil/setCategoryGlowIn()[C:\Documents and Settings\DJ
FYB\My
Documents\CharlesValcourt\includes\charlesvalcourt_logique.as:303]
at accueil/clickCategoryBox()[C:\Documents and Settings\DJ
FYB\My
Documents\CharlesValcourt\includes\charlesvalcourt_logique.as:282]
I am a bit confuse on how to call an object by reference and
stored the referene of the object in somewhere else (in my case, in
a ArrayCollection).
Youpi!!! I found how to made it!!!
First, I finally have to make the property objReference in my
class GlowObjectReferencer as an Object in order to work.
Than, I have to pass myHB as the Object (which, if I
understand properly, will put a reference of the current Object
into the new class Object).
var _objReference:GlowObjectReferencer = new
GlowObjectReferencer (myHB, false);
And when I run my functions to manage the Glow FX
(setAllCategoryGlowOut and setCategoryGlowIn), it is now working
fine!!!
I am so happy now! I knew it was possible but in my mind, it
was just not logic to store an Object in the class but it seems
that it is what I need to do! But just to make sure: what I pass to
the class GlowObjectReferencer as the first property is only the
reference to myHB? Not a copy of myHB; right?
Again, thank Tracy because you force me to find the way to do
it!!! ;-))
Similar Messages
-
Hello,
In my program i am considering of inserting string or object in a hashmap
String term;
map.put(key, term)
or
map.put(key new String(term))
which one is most efficient?Hi Nilsen,
I would think that map.put(key, term) is far more efficient. Instanciating a new object is always expensive. Java references strings in a way that minimizes the memory and CPU. If you have a reference in one class to a string "string", and another reference to an exact duplicate "string" in another class in fact the JVM references the same String object in memory, this is why Strings are not malleable as they are referenced by potentially many classes, i.e. changing the string from one class would affect the reference from the next.
So to make a short story long, the first option would be much more efficient.
See ya
Michael -
Difference between reference variable and object ?
I am getting confused with reference variable and object ?
1. int a; // is a variable
2. Car c = new Car(); // is a object of car type
Suggest me what are the difference between the two.....jverd wrote:
Shelby wrote:
Something about an interned string literal?_
I remember something from class about the way Java treats strings that contain the same data. yawmark
posted a link for me that cleared up my confusion. thanks yawmark.
>>
Can you actually point back to the original reference?Not clear what you're asking here. Nothing points to references. References point to objects.
Goodness, correct wording is as important as getting the syntax right, isn't it? ;-} What I was trying to ask is if it is possible to point back to the same String once you change the pointer on the variable?
And you answered my question succintly with the rest of your post. thanks jverd
>
String str = "abc";
str = null;'At this point, we've lost the reference to the original String object. However, at runtime, the VM will still be maintaining it in the constant pool. For any non-constant-pooled object, as we're writing our code, we'd have no way to refer to that object again. In this case, we are able to refer to the same object later in our code by simply using the same string literal. "abc" elsewhere in our code will cause the VM to give us a reference to that same pooled String. Same goes for Integer, etc. in the range -128..127.
However, it's not good design to rely on this. If your design requires you to later point to "the same object" (as opposed to any object of a compatible type and holding the same contents), then you should explicitly maintain a reference to it. In the case of Strings, you really shouldn't care whether it's the same object or not. All you care about is the character sequence that defines the String's state. -
Error while activating XI App: references the inactive object
Guys,
I am getting this error when I am activating my XI application .
<i><b>Activation of the change list canceled Check result for Message Mapping Stockquote_Request_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01: Object Message Mapping Stockquote_Request_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01 references the inactive object RFC Message ZGET_STOCKQUOTE | urn:sap-com:document:sap:rfc:functions | ZGET_STOCKQUOTE Check result for Message Mapping Stockquote_Response_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01: Object Message Mapping Stockquote_Response_Map_01 | http://sapteched/XI/sessionid_XI251/inb/student_01 references the inactive object RFC Message ZGET_STOCKQUOTE | urn:sap-com:document:sap:rfc:functions | ZGET_STOCKQUOTE.Response</b></i>Hi Manish,
Make sure you have saved and activated all your dependent objects. If you have imported RFC structure then check
for e.g. ZGET_STOCKQUOTE is your imported RFC structure then make sure its saved and activated.
Then try activating your message mapping.
Regards,
Sridhar -
How can i reference a MIME object within a correspondence format through...
how can i reference a MIME object within a correspondence format through TX oofo or se71?
Hi, I need to put a MIME object within a correspondence's format that i've already done through Tx oofo. My problem is, that i don't know exactly how can i make the reference of that MIME object in the format? and What structure type do i have to use in order to make appear the MIME object in my correspondence's format? Does anybody can help me with this?
Regards HectorFrank,
I tried to find some examples/samples on how to create CollectionModel for a table component but not successful.
Can you clarify the following ?
1. "CollectionModel" is referenced only by af:table attributes "value", "selectedRowKeys" and "selectionListener".
The rest of af:table attributes such as "rows", "fetchSize" used to reference the iterator binding in the binding container via the EL expression "#{bindings.VOIteratorBinding.xxx} .
What should I replace that EL expression with?
2. I heck out the bean method to create the CollectionModel as following, is it close to what you mean?
public void initBusinessDataDashboardView() {
OperationBinding operation = BeanUtils.getOperationBinding("getPanelBusinessData");
Map params = operation.getParamsMap();
Key panelKey = getPanelInfoView().getKey();
params.put("panelKey", panelKey);
params.put("maximizedView", false);
panelView = (ViewObject)operation.execute();
// Heck code to create CollectionModel
RowSet rowSet = panelView.getRowSet();
ArrayList rowList = new ArrayList();
while (rowSet.hasNext()) {
rowList.add(rowSet.next());
model = new ChildPropertyTreeModel(rowList, null);
// To be used to set up af:table value, selectRowKeys, selectionListener via EL expr #{backingBeanScope.MyBean.model.xxx}
public CollectionModel getModel() {
return model;
Am I on the right track?
Edited by: Pricilla on May 4, 2010 2:20 PM -
Getting references to the objects in a VM to dynamically link MBeans
Hi, I am dynamically generating MBeans and using Apache BCEL to change the resource classes to link themselves to the MBeans. The objective is to instrument applications wich we can't access the code and, if possible, do it on a running one.
I could use the Instrumentation API to change the classes of the application and the Attach API to do it on a running application, but only new instances would be affected, so the previously created objects would not be managed. I can generate MBeans in many ways, but can't link them to already running application objects.
So, what i want to know is in the title: is there a way to get references to the objects actually loaded in a Virtual Machine or another way to link an MBean to a running object?
I saw McManus talk at Sun One 2006 about the different ways to link MBeans to application objects, but all of them look to need code changes or previous suport to dependency injection, for example.
http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-3523.html
I need it to a technical writing, so an official word can be enough, or even more helpful than a solution.
Thanks,
GustavoGustavo,
Assuming I understand your question correctly, the only way I can see that you can enumerate instances of objects in a Java VM without changing the classes of those objects in any way is to use JVMTI <http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#Heap_1_0>. That requires you to write native code somewhere as part of your solution. It is applicable to already-running apps via attach-on-demand <http://java.sun.com/javase/6/docs/jdk/api/attach/spec/index.html>. The MLet service from the JMX API might be convenient here to bridge from the jar file that the Attach API expects to the native code that you need to access JVMTI.
As you can see this is pretty advanced stuff, but your ideas are interesting and I'd be interested in knowing how they work out.
Regards,
�amonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus -
Reference to C# objects in TestStand - how to save and retreive them
I am new to LabView and TestStand.
I want to use 2 .NET objects in those applications
In Labiew, I successfully created the objects, manipulate the functions through VIs and closed the references.
While I could use the VIs for TestStand, I would rather use the DLL directly.
I am able to create both objects in a sequence, but I have problems with the following:
- I don't know how to save the reference to the object after the constructor is run.
- is the object stored in Globlal variables? I tried 'RunState.Engine' but it does not work
- I don't know how to get the reference back in the other steps where I want to reuse the object to invoke a method on.
- Once I can do the above, I need to get it to work in the 'batch' or 'parallel' modes.
I am using successfully the 'RunState.TestSockets.MyIndex' to select my testing resources,
but I am still confuse as where the array of objects would be.
Note that I already set the number of DUT <> 1 and I can create successfully my 2 objects in X instances.
Thanks,
Daniel Coupaldcoupal,
Getting the reference to the object involves specifying that as a return value in one of your parameters when you specify the module for that action. Inside of the parameters table you can also save that return value as a local object reference and then use it later on in the sequence.
Regarding your second question, I'm not sure what the array of objects is that you're referring to but this KB might be of some assistance.
Message Edited by Jon M on 11-01-2006 12:44 PM
Test Engineer - CTA -
Resolved reference placed in object with no cache
Hi ,
I have been seeing this error in my weblogic logs.The workflows are
running fine and doing intended work. Have a look at the error message
WARNING: Resolved reference placed in object with no cache.
java.lang.Exception: printStackTrace
at com.waveset.util.Util.printStackTrace(Util.java:6259)
at com.waveset.object.PersistentObject.cacheWarning(PersistentObject.java:476)
at com.waveset.object.PersistentObject.checkReference(PersistentObject.java:2683)
at com.waveset.object.PersistentObject.checkReferences(PersistentObject.java:2718)
at com.waveset.object.PersistentObject.addMemberObjectGroup(PersistentObject.java:1513)
at com.waveset.workflow.WorkflowEngine.buildWorkItem(WorkflowEngine.java:4406)
at com.waveset.workflow.WorkflowEngine.callManualAction(WorkflowEngine.java:4284)
at com.waveset.workflow.WorkflowEngine.callAction(WorkflowEngine.java:3811)
at com.waveset.workflow.WorkflowEngine.callAction(WorkflowEngine.java:3229)
at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:3070)
at com.waveset.workflow.WorkflowEngine.makeTransition(WorkflowEngine.java:2809)
at com.waveset.workflow.WorkflowEngine.checkExplicitTransitions(WorkflowEngine.java:2700)
at com.waveset.workflow.WorkflowEngine.checkTransitions(WorkflowEngine.java:2486)
at com.waveset.workflow.WorkflowEngine.processSteps(WorkflowEngine.java:1891)
at com.waveset.workflow.WorkflowEngine.walkCases(WorkflowEngine.java:1748)
at com.waveset.workflow.WorkflowEngine.walkCases(WorkflowEngine.java:1656)
at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:816)
at com.waveset.workflow.WorkflowEngine.execute(WorkflowEngine.java:478)
at com.waveset.workflow.WorkflowExecutor.execute(WorkflowExecutor.java:235)
at com.waveset.task.Scheduler.execute(Scheduler.java:2393)
at com.waveset.task.Scheduler.executeTask(Scheduler.java:2295)
at com.waveset.task.TaskManager.executeTask(TaskManager.java:277)
at com.waveset.workflow.Workflow.checkinWorkItem(Workflow.java:378)Any Ideas,
ThanksDid anybody resolve this issue?
I am getting com.waveset.util.WavesetException:Class com.omd.session.WorkflowServices not found.
It seems the workflow status shows finished, but did not start the acctual workflow process of approvals and emails to the appropriate user accounts.
Anybody has any clues about this exception?
G -
Vector clone references the same objects??
Hi all
I'm developing a simple chess program.
Obviously, each move the user tries must be checked against the following sets of chess rules:
1.) Whether it is that colour player's turn to move
2.) Whether this move is valid for this specific piece (eg. 3 forward for a King --> invalid of course)
3.) Whether this move will jeopardize the player's king (put it in check)
If from any of the above the move is found to be invalid, the move is not executed.
My program structure is briefly this:
A. abstract super class 'ChessPiece' - subclassed by the various specific Chess Piece classes.
Each of the specific ChessPiece subclasses must implement an abstract method to check if a
proposed move is valid, and also a method to actually do the move...
B. 'PieceManager' class - has a Vector of ChessPieces:
This class checks whether the given move is valid:
For the piece: by calling the checking method (see A above)
For the general game: by making sure the given move doesn't put the player's king in check.
NOTE: In chess (for those who don't know), it is illegal to move any piece if, at the end of
the move, your king will be in check [possible to be captured by any enemy piece]
This last check I want to do in the following way:
1) copy/clone the entire PieceManager object
2) in this copied object, actually do the move
3) still in the copied/cloned object, see if the moving player's king is now in check
4) based on this evaluation, execute the move in the original PieceManger object or don't...
The Problem:
When I clone this PieceManager object, its 'pieces' Vector is obviously also cloned.
BUT it seems that the cloned 'pieces' Vector references the same ChessPiece objects
as those referenced by the original 'pieces' Vector; ie the 2 Vectors are sharing the same Objects.
Thus, when I actually execute the move in the test/cloned PieceManager object,
the original PieceManager's corresponding piece is moved too (well, it seems it is the same piece...).
I am pretty stuck with this.
I've tried the Vector clone method; it doesn't seem to copy the objects, but create another reference
to the same objects, as I've said.
I've tried cloning the entire object ; also not helping......
I'd love any comments, helpful pointers, suggestions.
Also any comments on my program structure... is a Vector the best tool for this job?
Thanks very much -
luthaHi all, OP here.
Ok thanks guys for all your posts...
two points:
1) I have tried the "copy constructor", and it seems to be doing the same thing. (ie 'shallow clone')
What's really frustrating me is that nothing I do seems to actually physically copy the Vector's objects
to new, separate copies of those objects...
I had my PieceManager class implement Cloneable (just in case - not too sure on that one; in fact I
commented that out later), and I overrode the clone method like this:
public Object clone ()
PieceManager pm = new PieceManager ();
Vector pcs = new Vector ();
// Enumeration e = pieces.elements ();
//while (e.hasMoreElements ())
// ChessPiece p = (ChessPiece) e.nextElement ();
//pcs.add ();
//} // still references the same objects!!
pieces.trimToSize ();
int size = pieces.size ();
Object[] arr = new Object [size];
Object[] initial = pieces.toArray ();
System.arraycopy (initial, 0, arr, 0, size);
for (int i = 0 ; i < size ; i++)
ChessPiece p = (ChessPiece) arr ;
pcs.add (p);
pm.pieces = pcs;
return pm;
This all still does the same 'shallow cloning'...
2) m.winter, my ChessPiece objects are not immutable - they have a co-ordinate field that
changes as they are moved. This is for getting as called by another object, and for checking in
the ChessPiece's own internal method for checking whether the passed-in square co-ordinate
is a valid destination.
Anyway, I don't think that's the main issue here. How can I properly clone/copy a Vector, resulting
in :
a) the original Vector
b) a new, totally unrelated Vector.
Thanks again all for your input.
regards,
lutha -
Cannot create weak reference to 'classobj' object
I am trying to run the python Script in a C# program using Iron Python I am getting this type of Error
cannot create weak reference to 'classobj' object
I am using this code for running the python code
var ironPythonRuntime = Python.CreateRuntime();
try
dynamic loadPython = ironPythonRuntime.UseFile("Program.py");
catch (Exception ex)
Console.WriteLine(ex.Message);Hi Mahesh,
About IronPython issue, It's third-party product. Please redirect to IronPython forum. The link as below.
https://ironpython.codeplex.com/workitem/list/basic
After search this error,
this thread tells me.
Try to use virtualenv. It is used to separate many instances of python and it's libraries - you can have as many virtual environments as possible: python 2.5 , 2.6 , 2.7, whatever - with any combinations of libraries - so you can have for example five
python 2.6 instances with different sets of libraries configured.
By the way, here is also a blog talking about
Running IronPython Scripts from a C# 4.0 Program
Now I will move your thread to "off-topic" forum. Thanks for your understanding.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Obtaining a reference to an object created in another page
Hello, In my webapp, i have a controller servlet which delegates the task to appropriate handler classes. My handler class performs the database access, then packages the result set object into a vector. I then create a new object of a javabean with a setPost() method which houses the output. My question is after this is done i forward control to the appropriate jsp for display. But how can i reference the object created in the page before. Will the request.setAttribute() method work for passing the reference to the object, to that jsp page? In other words i just want to access an object created in a different sevlet. Any help would be much appreciated
thanks
GabrielHi
Yes, if you set the attribute, in this case the Java Bean in the request, it will be available in the JSP to where the request has been forwarded. Note however that the Object's lifetime is limited by that of the request. For Objects which need longer lifetimes you could place them either in the session or the ServletContext. The latter case will give the Object application wide scope and also a lifetime limited only by the lifetime of the application.
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support -
Set reference point in objects and measure distance
1) How can I set the reference point in objects?
for example:
a) exactly in the center of a pad or a via
b) exactly in any corner of the board outline
2) How can I measure the distance of two points with the maximum accuracy?
for example:
a) measure the distance between two pads or via
b) measure the lenght of a linedear Semaphore, thanx for your response.
I already use the ways that you refer me, but like this I can't measure with accuracy, or setting the zero reference is not guarantee that I set it exactly in the center of via or pad.
With grid seted in smallest option is difficult to target the center of a pad, and also is difficult to target the point in the edje of a line with accuracy. With ruler I also have the same problem, I cant be sure that the ruler is pointing exactly to the center of a via or pad.
That I need is a kind of a snap option to attach the mouse-cursor exactly in the center of an object, that can help me to target exactly in the center and have an accurate measurement or accurate set the zero reference without mistake.
Any other suggestion for accurate measurements? -
Unable to add reference for Excel Object Library for use within Script Task
I have a requirement to use a Script Tax that needs to reference the Excel Object Model. There are numerous articles on using this such as
http://www.databasejournal.com/features/mssql/article.php/3921141/SSIS-Script-Task-and-Microsoft-Office-Automation.htm.
Simply, I need to add a reference to the Microsoft Excel 12.0 Object Library.
I have selected this from the Object List on the COM tab and when this adds the reference it states 'The System cannot find the reference specified', even though the referenced file for this Object is C:\Program Files(x86)\Microsoft Office\Office12\Excel.exe
and this file location exists on my local machine ?Please search where "Microsoft.Office.Interop.Excel.dll" exist in your system and try adding the reference.
If you don't find the dll there then there might be problem while installing.
To install the PIAs by using the redistributable package
http://www.microsoft.com/en-us/download/details.aspx?id=3508
http://www.microsoft.com/en-us/download/details.aspx?id=18346
Regards, RSingh -
Anonymous class - reference to enclosing object
Hi,
I have a class (which is in fact an Adapter that implements several interfaces
for EventListener) that should be instantiated in the code via an anonymous
class, i.e. like this
this.addAdapter( new Adapter() {
// implemented methods here
Now I have the problem that when I pass the instance of the anonymous class
later to a method somewhere else, I need a reference to the object which
instantiated it:
public class AClass {
priavte BClass bClass;
private Adapter adapter;
public AClass() {
this.addAdapter( new Adapter() {
// implemented methods here
bClass = new BcLass();
bClass.doSomething
void addAdpater( Adpater ad ) {
this.adpater = ad;
public class BClass {
public BClass() {
doSomething( Adapter ad ) {
// how can I get a reference to the instance
// of AClass that called this method ?????
My IDE shows the needed object as member this$0 of the Adpater, so I
suppose there is some way to get at the reference to this enclosing
object, but how???
Thanks in advance for any idea,
LeifIf it's possible to get the reference without the adapter explicitly giving it to you, then everything that's been written about read-only adapters is silly, so I would bet that it's not possible.
Your adapter is written as an inner class, so it has access to all the enclosing object's state. If you can modify the adapter class, you could expose as much of that state as you wanted. Maybe that's as good as the reference for your purposes.
But maybe not. So the only option I could see is that the adapter itself has a method
public AClass getEnclosingAClassInstance()
which returns a reference to the enclosing class. The way to set it might be to make a corresponding set method which AClass calls with 'this' before handing off the adapter to BClass, or by AClass itself providing a getThis method, which the adapter could call. I'm pretty sure you can't get anymore direct access to the enclosing 'this', because the adapter's 'this' shadows it.
All of which leaves me wondering--why? It's so weird and un-adapter-like that I suspect it's the wrong idiom. But maybe you know something I don't.... -
How to add a reference to an Object?
In a particular class, how can we create a reference to an object created in a different class?
Have that "different" class provide that reference, possibly as the result of calling a method in that "different" class.
Maybe you are looking for
-
Daisy chain Voyager hard drives & iMac Intel Core2Duo (white model)
It would appear that Voyager hard drive enclosures from Newertek won't allow you to daisy chain them via SATA. Yet they conveniently provide you with a SATA cable if you have an eSATA port on your Mac. Is there any sort of KVM switch/ hub that makes
-
How to find optimal timeout period for trans-timeout-seconds element.
we are using Weblogic 7.0 Integration Studio,in one workflow we got "weblogic.transaction.internal.TimedOutException" and the exception text is "Transaction timed out after 1089 seconds". Presently we are using timeout period as 1089 seconds. On what
-
Nothing happens when I click on any app in the iTunes Store
I launched my iTunes and clicked on iTunes Store link on the left. The iTunes Store home page loaded as usual. However when I tried clicking on various apps to view their details, nothing happened. Occasionally the "Accessing iTunes Store" message ap
-
Problems with iOS 7 Mail and Cisco Unified Messaging attachments?
Does anyone out there use Cisco Unified Messaging in their workplace? I am seeing an issue with iOS 7 (7.0.0-7.0.2) where the following scenario occurs: You check an email in the Mail app that is from the Cisco Unified Messaging system when you get a
-
Like others on these boards, I get spurious 4s 5s and 6s generated when I am on a call. This does not happen for every call. I have twice taken the phone to the shop that sold it to me (Carphone Warehouse) and their engineer has cleaned behind the ke