foregoing initialization on a page - apache-flex

Once you load an actionscript page from scratch (in my case loading XML data from a file, initializing various other elements in a fairly time consuming way) if you navigate away from that page and then return to it, (via the browser 'back' key for example) is their a way to forego the previous initialization and just immediately bring up the previous Actionscript page in its fully initialized state.

Flash Player will always start up your SWF file from scratch. In most cases, navigating back will load the SWF and things like XML files from the browser's cache, and you'll be up and running faster than if you were to go there the first time. However, you're responsible for adding logic to remember the most recent state and restore it when the SWF is loaded again.
If you're using Flex, the History Manager might be useful. For AS3 without a framework, you might check out SWFAddress instead. Both of those use the browser's URL and history features to track the application state, which can allow you to navigate through the SWF as if it contains "pages" and even bookmark specific locations in the SWF. Alternatively, or maybe even simultaneously, you might also consider using Flash Player's cookie-like flash.net.SharedObject functionality to remember the the state. You lose the more granular browser navigation, but you might be able to remember more about a specific single state.

Related

MVC4: List of all urls available on the site?

We have quite a large MVC4 application and we would like to have Selenium go through every page and make sure it loads - some sort of smoke test.
I can use reflection to go through the assembly, find all controllers and all actions, check if actions are not post, come up with parameters for actions that require parameters.
Then I'll feed this list to Selenium and check that everything I need on the pages is done appropriately.
But before I start playing with reflection, I'd like to check if this has already been done, so I don't reinvent the bicycle. I have googled for such thing, but could not find anything.
p.s. Writing the reflection code is not an issue. Selenium is covered as well. Just checking if this has already been done.
The AttributeRouting project has a route debugger in place, which does work even if you don't use attribute routing inside your project.
You can see the class that handles displaying the routes over on Github but I'm not sure it will display the routing information when the project isn't run locally. You may need to adapt that code so you can access it safely from your Selenium instance (and make it machine readable using JSON or something).

Asynchronous Javascript loading different behaviour

I am developing a widget, and am using extJS framework (along with stomp,orbited servers). It requires 5 different Javascript files. To avoid impacting load time for users, I am trying to load them asynchronously.
Through some callback stacks, I have managed to asynchronously load them in order they are required.
However, the widget does not work at all in the asynchronous case. I then copied the "modified" resultant HTML DOM from Chrome's developer tools, and created a static HTML file.
The static file works. I am printing few alerts when different JS files are loaded in both cases. The order of these alerts is the same.
How do I detect and fix the error. Stumped after lot of debugging.
(Link removed as they were on production server. Managed to detect the issue and find a workaround - please see answer below - keeping for anyone's reference).
The problem is that Ext.onReady is called as soon as document is ready, which is BEFORE any other scripts are loaded asynchronously.
Thus, the initialization code was not getting called. I manage to work it around by calling Ext.each("dummy args", initialization_function, this) in the last javascript that is loaded. This made things work for me.

What happens when a cshtml page changes on IIS?

To be more specific, when a cshtml is needed, what happens? I would need to build an application with only ashx and a template engine, without the MVC stuffs, simple rendering, but i would'not like to loose the capability to change the cshtml files on the fly. So I have somehow to manage their recompilation, possibly without recycling the application server loading and unloading AppDomains.
On the first request I can build the page and load it in a sort of cache (like RazorEngine on codeplex), then reuse it. When the page changes i should change the page and that's it.
But as far as I understood a new assembly is built for every page, so if there are frequent changes (that is likely to happens in my environment) tons of assemblies will get loaded.
The question is,
How it works for the standard MVC ?
CodeDom is used, or directly IL that is subsequently added without creating new assemblies?
One thing that comes me in mind now is that after building the assembly, it can be decompiled and then the IL loaded directly on the app, that would make sense
Ask for further clarification if it's unclear! (and any suggestion to this Stackoverflow newbie is welcome)
Ok,
First the cshtml files are loaded then the files are compild into their own assemblies with the standard CSharp/VbCodeCompiler, no code dom is present as far as i understood...

Need to get the XML of a component's that version which is published

We are iterating the components in a folder in Tridion 2011 and creating our custom XML to be used on CDS on the basis of the publishing status of component. I am giving below example to make you understand the problem.
Supppose we have 10 components in a folder which are all published and we publish our XML then the XML gets generated for 10 items.
Now we make change in one of the component and don't publish it.
After modification of component, we publish the XML again. then the XML get updated for the modified component also. So it creates the difference between the published version of that component and the that is in our XML.
So I want to publish the custom XML in such a way that it should only contain that data which is in sync with published version of component.
So you want to:
determine the XML of the Component that was last published
determine the changes between that XML and the current XML of the Component
only publish the changes
Tridion doesn't keep track of the version that was published (on the Content Manager at least). So the closest you can do is find out when the Component was last published and retrieve the XML of that time. This question is a great starting point for more information on that approach. Based on that XML you can then do steps 2 and 3 above.
Alternatively you can keep a snapshot of the XML that you published "somewhere" (for example in Application Data) when you're rendering the Component. Then when the Component gets published next time, you can retrieve that XML and do steps 2 and 3 above.
Note that with any of those solutions you should really wonder if you should be implementing it to begin with. You are overriding some of Tridion's default rendering behavior and circumventing part of its architecture (a clear, explicit disconnect between Content Management and Content Delivery, with the former knowing "nothing" about the latter) and anything you do will come back to haunt you in time. In this use-case you have to wonder what will happen when the CDS and TCM get out of sync. Simply republishing the content suddenly won't be good enough anymore, since your code will be in there deciding that "nothing changed since last publish, so we'll publish nothing".
Please forgive me if I jump to conclusions, but I strongly feel this question has arisen from a lack of understanding of Tridion. Publishing in Tridion does more than just raise a flag to indicate the item is 'published', in other words ready to be shown to the outside world. I know this is how some (many) content management systems operate (which may explain why you are asking this question).
In Tridion, however, publishing means that the item is actually - physically - transferred from the content management environment to the content delivery environment. This environment always contains versions of your content that represent the state when the item was last published - simply because it was the very act of publishing that created them.
In my opinion, what you are really asking is how to rebuild this publishing functionality. This is never a good idea. Instead, you should take Bart's comment seriously and look at one of the content delivery APIs that Tridion has on offer (the broker API or the OData web service). Optionally you might want to look into DD4T, which is built on top of the broker and exposes the full Tridion data model.
Then your solution is to
Write an event handler on the Publish Transaction Save event
Which saves the publish info (version data) to Application Data of the published Component
I'm mentioning the Publish Transaction Save event because from there you can ensure that the publish info is only saved when the transaction is successfull.
Also be aware that this publish info can go out of sync when the event handler fails to execute, and you might loose all of the application data when moving to another environment.
So when this information is absolutely crucial I would save it to a separate database, and not to Application Data.

Flash inside Flex inside ExtendScript

i have been working on a Photoshop UI project and also working with Flash Builder for about 3 weeks and i can't find a solution to a communication problem. Here are some details about the issue; if you are interested in helping me, thanks.
The main frame of the UI is Extendscript
I have an as3 swf which needs to load a local JPG file dynamicly, I
assume this is a "Access Local Files Only" situation for Flash.
The same SWF needs to communicate with Extendscript, so i load it into
a FLEX app dynamicly via SWFLoader and it passes some variables to,
and triggers some functions in FLEX via a "myFlexParent" object.
Flex is the bridge between Flash and Extendscript so it passes the
variables and functions to Extendscript JSX code via
Externalinterface.call or CSXSInterface.instance.evalScript().
This is where i'm STUCK. I guess ExternalInterface calls or CSXSInterface.instance.evalScript() are threated as a network operation and they don't work if i set the compile option "-use-network=false" in flex. Bu otherwise the local JPG file cannot be loaded.
Adding locations in the Settings Manager wont work for me because i'm going to turn the UI into an Extension and it should be easy to install.
I guess i'm trying to find a way to establish 2 way communication between FLEX and ExtendScript, that would be interpreted by flash player as a LOCAL communication, which actually is.
I'll appreciate any bit of information. Thanks.
ExternalInterface is going to be considered a network call and setting the -use-network=false will break those calls down. This is due to the security sandbox. If it was allowed then the flash app could be used with some simple AJAX to turn a non-network app into a network app very easily.
Adobe doc's say:
This communication relies on the domain-based security restrictions
that the allowScriptAccess and allowNetworking properties define. You
set the values of the allowScriptAccess and allowNetworking properties
in the SWF file’s wrapper.
Reference link:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf6167e-7fff.html#WS2db454920e96a9e51e63e3d11c0bf6167e-7ff5
Look into changing your app into an AIR app as you will be able to do both network and local file operations (different security model since the user installs the application).

Resources