Cache Studio not reflecting changes made by custom %Projection.AbstractProjection classes - intersystems-cache

I sometimes make use of projection classes (subclasses of %Projection.AbstractProjection) to generate various things, and I'm finding that if I use the %Dictionary classes to modify other classes from within the CreateProjection method, the changes make it into ^oddDEF correctly, the changed classes compile and run correctly, but Cache Studio doesn't see the changes, and keeps displaying them the way they were prior to modification. If I then compile from Cache Studio, it overwrites the changes made by the projection class.
It's fairly "sticky" - if I close the changed classes, remove them from my project, then add them back and open them, the unchanged, cached version is still there in Cache Studio.
I am calling QueueClass on the changed classes, but that doesn't seem to matter. I'm on 2008.2, in case that matters.
How can I programatically get Cache Studio to update its cache, or otherwise fix this problem in a reasonable way (closing Cache Studio each time isn't really reasonable, for example)?

Try to reset TimeChanged property of %Dictionary.ClassDefinition

Related

eclipse e4 restore perspective on startup automatically

We all know that by default eclipse saves application state in workbench.xmi and then recreates perspective only if this file is absent. However, I've got a project on e4 which ignores this file even though it exists and -clearPersistentState is NOT specified in arguments. I think there should be some piece of code somewhere responsible for this but the project is too big I don't know how to track it down. My goal is to make this app to use workbench.xmi once again to restore perspective.
To investigate why this happens I want to know which eclipse method is responsible for perspective restoration so I could make sure that this project at least launches this method. That's the main question.
The less main and the less clear question is how this default restoration behavior can be avoided? I mean where should I look for the possible source of this problem? Could there be some option in some .xml which makes the project forget about workbench.xmi? Could it be some sort of startup handler which manually restores default perspective? Maybe some hint about which methods are possibly should be involved in this so I could search for them. Any help is appreciated. Thanks in advance.
-UPDATE-
So it turned out that the problem arises because the project UI is defined in fragments rather than in main Application.e4xmi and eclipse has a bug due to which fragments UI merge with main application after previous state restoration thus replacing restored settings with predefined ones. This bug is discussed in this thread.
This useful article describes how one can manually save and load various application components. Another useful source of inspiration is the source code of ResourceHandler itself.
The main E4Application class controls loading and saving the application model.
E4Application calls a class implementing IModelResourceHandler to load and save the model and the persisted state. It is possible for an application to use its own version of IModelResourceHandler but normally the default org.eclipse.e4.ui.internal.workbench.ResourceHandler is used.
ResourceHandler uses the clearPersistedState, persistState and the deprecated deltaRestore options to control loading the persisted state. These values can be set by command line options.
Add apply="initial" to fragment tag in your plugin.xml to restore stored perspective from workbench.xmi
Example:
<fragment
uri="fragment.e4xmi"
apply="initial">
</fragment>

Eclipse IDE debugging with code change

I am using Eclipse IDE for Java Developers
Version: Helios Service Release 1
Build id: 20100917-0705
In remote debugging Web app with tomcat 7.0.37, when I make some changes, even a line, the changes can not be made into the runtime, so I need to recompile and re-deploy the war application. Wast a lot of time. The message:
Hot code replace failed - Delete method not implemented
I do not understand the message.
Anyone know the secret on how to auto reflect the code change in debug mode? Thanks.
I've found that for hot code replacement to work the code being modified/replaced must be in the execution stack. So you can hot replace changes made to a method you've stopped in, but you can't hot replace changes to that method once you step out of that method... unless you first stop back in the method on a successive call to the method.
With the standard JVM (Oracle's), you can only modify existing methods. Both adding and deleting methods, and changing structure of class (moving methods, fields) are NOT supported. For that, go to JRebel!
One thing to notice is that changes to seemingly "normal code" inside some method will actually need for the java compiler to add or delete methods - and hence it will fail. This happens e.g. if you in an inner class accesses private fields in the outer class - the java compiler will need to add synthetic accessor-methods to the outer class to let the inner class access those fields - which hence will fail to Hot Code Replace. Also, if you remove some code accessing such fields, the java compiler wants to remove the corresponding synthetic accessor-method, which also will fail.
I think there is no way to reflect the code change in debug mode
Debug mode is to trace program flow and find if any issues or errors at particular piece of code....
it just points to line of code in eclipse, which is running in your tomcat, ie. code in eclipse is not used to run application the code u have installed or put in tomcat runs
hence your changes made in eclipse cant reflect in tomcat code

Entity Framework 4.1 Code First Changes in Relationships often do not take

I often get errors when running test cases after changing relationships. When checking the relationships on the data diagram I notice that they are often not reflecting any of the changes I did or only some of them, confusing the model. This only seems to be the case when creating the diagram within Server Explorer of Visual Studio. When creating the diagram in SQL Server the changes show up fine.
Unfortunately, this also affects testing the code, because I'm never sure if a fails because of a problem with a change in the relationships I did or Visual Studio not updating. Having to detach and attach the database each time is a bit of a pain.
The database is dropped and recreated correctly, but Visual Studio seems to run the code against a cached version. Had anybody else similar problems, any fix?
I've certainly seen issues where I've updated SPs/function imports and tried to update the associated complex type, the dialog window says 'update', 'delete' etc next to the columns changed, so it's certainly seeing the different, but when applying the update these often don't seem to take and I end up manually adjusting the complex type.
In the above example I'm not sure whether the correct approach is to delete and recreate the type, but the existence of the update functions seem to suggest that an update should be possible. As you say mine too feels like a caching issue and whilst I've not yet found a solution I will be interested to see if you can find a solution, if I make any ground on this I will post back here too!

How do I force Eclipse to rebuild if files in another project change (any change)?

I've got an Eclipse (Galileo) project (called ProguardBuilder) that runs Proguard over a set of class files in other projects and produces a jar file.
I'd like to have the ProguardBuilder project get rebuilt any time any class file in the other projects changes. AutoBuild doesn't do that; presumably it's smart enough to recognize and ignore any changes that don't affect anything externally visible.
My problem is that I don't care whether or not the change is visible, since I need to completely rebuild ProguardBuilder any time the class files it depends on change at all.
How do I tell Eclipse to do this sort of rebuild?
You might have to use an external builder. Check the documentation, because I've never done this. But the place to start is the "Builders" section of the project properties dialogue.

Eclipse hot code replace not updating

Why might simple changes to code fail to update? The 'hot code replace' message appears as usual when making big changes, but changing a println string, or commenting out a method call sometimes does nothing, and the app has to be restarted to apply the change. I think it may have something to do with native calls, but other than that there seems no pattern to it.
If you are not introducing changes that affect the class signature as Stephen mentioned, it should work. If it's not working, makesure that you have enabled 'Build Automatically' for the project (Project -> Build Automatically).
This is required for Eclipse to perform local builds when you do changes and push those to the server when you make a change.
Hot code replace does not allow you to change a class signature. That means, no attribute changes, no adding or removing methods, etc.
What you are allowed to do is to change a method's implementation.