Using structure map with MSTest - exception

I have created myself a test project with a single test in it. Within the "TestInitialize" method I'm trying to call my StructureMap setup method where I set which concrete instances should be used for which interfaces.
However as soon as the test tries to run I get a {"Operation could destabilize the runtime."} exception. Without using structuremap it works fine (but obiviously I need it in there).
Can anyone point me in the right direction as to what might be causing this exception?

After a lot of messing around, I discovered that all I needed to do was to right-click on the StructureMap dll and click "Unblock" and the permissions were sorted.

Related

Trace Flash Builder compiling commands

is there a way to trace the compiler command for flash builder? I mean, I want to know the parameters and files that is compiling internally when I click "build" on FB.
Basically I moved a project to Flash Builder, and everything works fine but I have some runtime issues, and looks like the compiler is doing something wrong with some files (like using old files instead of using the one im changing, this occur only for a particular file, the rest works fine or I think that works fine). Also is different the way to embed some file, that's another reason to check what's doing internally.
I ran the game with mxmlc before, and probably I can compare what's the difference if I get the command executed by FB.
Also, I want to know how to do it if I need to research something in future.
Thanks for any help,
Regards
Flash Builder only recompiles if there has been a change to the code. So if you are changing an asset (image), for example, you won't recompile unless you also make a change to the project.
There are a few ways around this:
Easiest way is to just go into a file and press the space bar at the end of a line. It will add an extra byte to your file, but not to the project (compiler is "smart" and gets rid of unused files, classes, and characters). Since this is not a common thing, it shouldn't be an issue
Project->Clean.... That will force your workspace to rebuild and, in most cases, will also recompile your project
If #2 is failing, first delete bin-debug or whatever you are using as your debug folder, then run Project->Clean...
It's a tad bit annoying (especially when editing external libraries), but it allows for quicker re-launches of the debugger, which is the ultimate goal of that behavior.

Spring-Roo Push In via Command Line

I need to perform push-ins for my json controllers, however, doing it via STS will make it really tedious. For my demo project, it works since it only contains 10 pojos, but for real world project this may become 20-50 pojos.
Is there a way to perform push-ins via command line or any way to automate it?
I am asking due to my previous issue which cannot be solved by spring-roo's current version :
RooWebJson and KendoUI Grid
No, there is no way to push-in code via command line. The best way is to use STS, but note you will push-in the code only one time.

Not receiving onSync delete events for multiple SharedObjects in same SWF

I have an application that uses Remote SharedObjects and I am seeing some strange behaviour. I am writing an ActionScript application in AS3 using Flash Builder and connecting to Wowza Media Server 2.
My application is working just fine but I am now trying to write unit tests for it using FlexUnit. My unit tests involve creating multiple connections to the same remote SharedObject and making sure that I am getting updates correctly. Everything seems to be working well except that I am not getting any of the SyncEvent.SYNC events with an info.code of "delete". When I run my applications independently in separate tabs or even separate swfs embedded in the same page it works fine. For some reason though it does not work when inside a unit test. I have also found that if I load the swfs using a Loader inside the same SWF then I get the same behaviour. It seems to me to be something strange about the way multiples of the same SharedObject behave within the same SWF. I have had to work around other strange behaviour in the unit tests such as oldValues not being set properly in the onSync events too.
Anyone have any ideas how I can work around this? Is this a known issue? Am I crazy? :)
Would appreciate any help!
I also faced this problem before when I was working on some Flex application using some coding frameworks like Cairngorm, and connecting to AMFPHP with multi remote objects.
At that time what I come up with to resolve the issue is to make sure that those remote objects won't be fired at the same time. That is trying to make some so called "sequential chain" to fire those remote objects one after another.
In order to achieve this it may be difficult if you do it from scratch, you may consider making use of those modern ActionScript framework 2.0 to help you (e.g. SWIZ or Robotlegs). This may be too complex to handle in the very beginning. I suggest you can just place the remote object parts to be handled by the framework while keeping other things intact.
To get your sharedObject instance, you are using the static method SharedObject.getRemote(). I believe this method will always return the same instance for a given name (and if the persistence parameter has the same value).
You can have the same kind of issue when you remove a SharedObject from your app (mySO = null) and you reinstantiate it before the garbage collector did its job).
This kind of behavior makes sense to me, but it can sometimes be a problem I must admit. Anyway it should be easy to test in a debug session (Have a look at your objects instance number).
Now talking about unit tests, what are you testing? The SharedObjects behavior? If so, I believe there is some misconception here. It you really want to test this kind of behavior (and I would be interested in the reason behind), then I guess you will need some more complex tests that run two separate applications.
Hope it helps!
We had similar behavior with deletes in our project.
When we call so.close(). Then delete some key in shared object. Then connect SO again - it still see deleted key alive.
Workarounds: do not close SO or update deleted keys with some constants values (-2 for example) to mark them deleted.
Wowza 3 was used.

grails and mysql batch processing

I'm trying to implement the advice found in this great blog post for batch processing in grails with MySQL. The problem that I'm having is that inclusion of periodic calls to session.clear() in my loop causes org.hibernate.LazyInitializationException's to be thrown. There's a quote down in the comments section of the page:
You’re second point about potentially
causing LIEs is absolutely true. If
you’re doing other things outside of
importing with the current thread,
you’ll want to make sure to reattach
any objects to the session after
you’re doing your clearing.
But how do I do that? Can anyone help me specifically understand how to "reattach any objects to the session after I'm done clearing?
I'm also interested in parallelizing the database insertion process so that I can take advantage of having a multi core processor. Can anyone provide advice on how to do that in Grails?
Grails has a few methods to help with this (they leverage hibernate under the covers).
If you know an object is detached, you can use the attach method to reconnect it.
If you've made changes to the object while it was detatched, you can use merge.
If for whatever reason, you're not sure if an object is attached to the session, you can use the link text method to find out if it is or isn't.
It might also be worth reviewing the Hibernate documentation on Session.

Syntax/error checking breaks in FlexBuilder/Flashbuilder with class libraries over Samba?

We have our class libraries on a shared server we access via Samba (and ssh for command line). Sadly, several features seem to fail in both Flex Builder and Flash Builder/Gumbo with this setup. For example, we no longer get automatic syntax and error checking. Anyone familiar with this issue and able to suggest a solution? Thanks!
Turns out this problem had nothing to do with our abstruse setup. I had simply forgotten to create a reference to the top-level class in the application file (bear in mind that with this setup the Flex project folder exists only to satisfy FB's need to place project files somewhere...all the real code is off on the server). Once this was done, all normal services were restored.