Flex application suspended while in the background using Safari on Mac - apache-flex

Users of my Flex application report that sometimes the application is freezed when the browser window is minimized or they select another active tab over it. In this suspended state, the application receives no CPU share and all network connections it uses are closed. When the browser window is restored, the application is resumed. This happened with Safari 5 on Mac OS Leopard, with both Flash player 10.0 and 10.1. I searched a lot but I could not find any information about such behavior.
This behavior is not reproducible on each Mac with Safari, so my questions are:
Under which circumstances this may happen?
Is it possible entering in suspended state to be prevented and how?
Is it possible for the Flex application to be notified about going into sleep mode and wake up back?

This is a Safari thing and is by design. Newer versions of Safari suspend flash content that is not in the foreground tab (not sure when this started, version 4?) For instance, if you have multiple tabs open, each with a youtube video playing and you go back and forth between the tabs, only one of the videos will be playing at a time. To answer your specific questions:
This will happen to any flash content that is in a background tab (not sure about the minimized state.)
Not aware of a means of disabling this behavior.
You may want to dig around in the Safari documentation to see if there is some sort of JavaScript event that you can grab onto, but I don't think you are likely to have success there.
Good luck.

Are your users using Flash Player 10.1 ? As part of the performance improvements in 10.1; I believe an application in a minimized state will get throttled in order to use less system resources / battery power.
I don't think there is any way to prevent this; and no APIs exposed that relate to this.
Other people I've spoken to have had issues with using local connections between minimized apps and active apps. I'd bet there is already a bug in the bug base on that.

Wrt the following above:
.I don't think there is any way to prevent this; and no APIs exposed that relate to this.
You may want to check out if Silverline from Librato can help you control how much and which applications get what system resources (CPU, memory, Disk and Network IO) with dynamic control based on application demand. If the above issue is a feature of flash - then obviously it may not help. But if you are trying to say run multiple applications / processes and would like to control who gets how much system resources (dynamically) then you could try Silverline - it does not require any changes to OS or app. http://silverline.librato.com

Related

CefSharp vs WebView2

I'm considering moving a project from cef (CefSharp) to WebView2 WPF. My preliminary tests shows that WebView2 API have the interface I need for this port. I am afraid that I can miss something that can prevent me from switching to WebView2 and I'll figure this out at later stage of this transition. If anyone went through this process, please share if I need to be aware of something that can be a roadblock for this transition. Are there important APIs from cef that are missing in WebView2?
This issue in WebView2's Github answers your question in part. And I would like to add my take.
A summary:
WebView2 doesn't have an API for simulating user input, it's unsuitable for automation.
WebView2 can't render offscreen. No running in the console, as a service, on a server.
WebView2 runs in a separate process; CefSharp runs in the application's process.
WebView2 has a sandbox; CefSharp doesn't.
This answer is based on my personal experience and is not an exhaustive comparison.
Process Model
The Chromium process model has the main process and many auxiliary processes. It is, of course, a bald simplification, but it will do.
Both CefSharp and WebView2 follow this process model with one very significant difference. CefSharp starts Chromium in the application's process, and WebView2 starts it as a separate process.
The in-process model is common to all CEF-based browsers. Pros: the browser starts faster. Cons:
If CEF crashes, it takes the application down with it.
If there's a vulnerability in CEF or Chromium, it can also expose the application's memory.
The out-of-process model is popular among proprietary browsers. Not only WebView2 works this way, but also DotNetBrowser and EO.WebBrowser. Pros:
It's safer.
It doesn't bite off the application's RAM.
Cons:
It starts longer.
It may be slower because of inter-process communication.
Occasionally, there are issues with the focus and drag-and-drop because the browser window belongs to another process. Not applicable for the offscreen rendering, though.
CefSharp process model. WebView2 process model.
A score for WebView2.
Offscreen Rendering
There are two approaches to the rendering of embedded web content. One is to shake off the bells and whistles from an actual Chromium window and embed it into the application. We call this "windowed" or "heavyweight" mode. Another approach is to render web content in memory and draw it on an arbitrary surface. It's called "offscreen rendering."
WebView2 supports only windowed rendering. This mode has two significant drawbacks: it requires a window to function, and the browser always stays on top (aka the airspace issue).
CefSharp also has offscreen rendering. It allows the application to run in the console, overlay web content with other controls, render web content in Unity3D, etc.
A score for CefSharp.
Automation
The bread and butter of automation is simulating user input. CefSharp has an API for dispatching "real" mouse and keyboard events to the browser. The browser handles these events as user gestures, and JavaScript can't tell between them and real human input. Look at the SendMouse* and SendKey* methods in IBrowserHost.
There's no such API in WebView2, only workarounds based on Win API.
A score for CefSharp.
Sandbox
By default, all Chromium processes are sandboxed. It makes them more secure. The Chromium team explains the sandbox in great detail here.
WebView2 and other out-of-process libraries are sandboxed as well.
CefSharp doesn't support sandboxing and, it seems, never will (#697).
A score for WebView2.
See also
CefSharp supports only primary AppDomain.
CefSharp doesn't support commercial codes by default.
In addition to the other answer I'll add some additional points
License
CefSharp is open source, 3-BSD licensed. You can customise the code, fix bugs, submit pull requests, etc.
WebView2 is not currently open source. You need to wait for Microsoft to fix bugs. Currently WebView2 team releases updates every four weeks. Even if a bug is fixed quickly you can be waiting weeks before it's released.
Privacy
WebView2: Data collection privacy notice (at time of writing)
The software may collect information about you and your end users’ use of the software, and send that to Microsoft. Microsoft may use this information to provide services and improve our products and services. There are also some features in the software that may enable you to collect data from users of your applications. If you use these features to enable data collection in your applications, you must comply with applicable law, including providing appropriate notices to users of your applications. You can learn more about data collection and use in the help documentation and the privacy statement at https://aka.ms/privacy. Your use of the software operates as your consent to these practices.
Microsoft has yet to disclose exactly what is captured. Users must opt-out of data collection.
A number of users have raised concerns regarding the data telemetry. There are a number of discussions regarding the privacy concerns here and here.
Distribution Model
Both CefSharp and WebView2 require a specialised version of Chromium to be installed/copied on your computer.
Fixed Version: A fixed version of Chromium is bundled with your application. You control which version.
Evergreen: Chromium is is installed then automatically updated via windows update. On some OS's it will be pre-installed. Currently limited/no control over if the runtime is updated.
 
CefSharp
WebView2
Fixed
[x]
[x]
Evergreen
[x]
Chromium is rapidly changing, there's a new major version every four weeks at time of writing. Each major release adds/removes features. Security policies are changed.
What worked flawlessly on a previous version of Chromium may no longer be allowed for security reasons. Deprecated features are frequently removed.
For complex applications it's important/imperative to tested against the specific version of Chromium your application uses. This applies to all Chromium based browser.
Evergreen WebView2 Runtime automatically updated via Windows Update sounds perfect? Get the latest version without having to do everything.
What happens when a bug makes it into a Stable Release? Did you test your application against the dev/beta channels to flag upcoming issues? No? You could be inundated with user complaints their application now crashes.
A quick look though the WebView2Feedback Issue Tracker and you can see examples of this happening.
M108 release was particularly problematic with many users reporting issues.
The following are just some examples
https://github.com/MicrosoftEdge/WebView2Feedback/issues/3029
https://github.com/MicrosoftEdge/WebView2Feedback/issues/3068
https://github.com/MicrosoftEdge/WebView2Feedback/issues/3062
https://github.com/MicrosoftEdge/WebView2Feedback/issues/3032
For those using an Evergreen model you must test your application on every dev/beta release to ensure your application works as expected.
WPF
CefSharp provides two WPF implementations, the first CefSharp.Wpf renders every frame to a bitmap, this allows for a native WPF experience. You can apply transforms, layer elements over the top, etc. There are no airspace issues. There are a few downsides the main being performance is lower (there are a few things you can do to squeeze some extra frames).
The second is CefSharp.Wpf.HwndHost, it's a HwndHost based implementation, it's like embedding the WinForms version in WPF with binding support, you get much better performance, no transforms, cannot layer over the top. Airspace issues apply.
WebView2 currently only provides a HwndHost implementation, airspace issues apply. There is talk of providing a more native WPF implementation

Managed library / component / api for Windows Mobile WiFi management and control?

Does anyone know of a commercial or free .NET CF library/component/api that I can use within my Windows Mobile 6 and .NET CF 3.5 application?
I need to: enumerate the list of available WiFi networks in range, connect and disconnect specific SSIDs/networks in the list, and manage switching between SSIDs programatically (e.g. I'm currently connected to "public1" and want to switch to "public2" to do some stuff, and then switch back to "public1").
I have tried the OpenNETCF library for this and it somewhat works, but it's crashing quite often with Native Exceptions, which I can't handle with a catch() in my C# code so they bubble up to the end user and they get a nasty windows crash screen with the "send" and "don't send" buttons.
OpenNETCF forums seem to be dead, with lots of posts but no replies to most of them, and the last release from those guys was way back in March 2009.
Last I remember the OpenNETCF code was decent and worked without any issues on a number of devices I tried it on. I certainly don't remember getting native exceptions from it.
Is it possible that you're working on a customised platform? It is possible that the real issue might be due to modifications made to your particular device / operating system.
IIRC we eventually switched to Summit cards for hardware or cost reasons which uses a different API but obviously an API that would only work with Summit cards.
I'm afraid I don't know of any other alternatives atm. Sorry. :(

Flash Player Version Problem

I am facing one weird problem. In my flex application, there is one
grid on click of each grid item, it will dispatch one event and show
the details. As usual am changing the state of the component to
achieve this. But this is working perfectly in my machine, but from my
client side it is not working. Only difference am seeing is the
difference in flash player version. The FP version am having here is
10,0,45,2 but the onsite is having the latest version : 10.1.102.64.
Will this cause any problem in the behaviour of the flex application?
Am quite confused here, because I have no rights to change the player
version in my machine.
Do anyone have face the same problem like this. Or can anyone help me
with the main difference between these two versions.
Thanks in advance for your help.
Cheers,
Anoop
Most behavioral differences between flex applications are due to different flex SDKs being used during compilation (for instance, is your client viewing the binary-exact copy of the .swf file that you are running) or browsers with different plug-in APIs (the way they handle 500 errors for instance). If you think it's a flash player version issue (they are probably rare since they run regression tests across player builds so that flash swf files from eons ago run fine), you can certainly upgrade to that player build and see for yourself.
Are you also able to rule-out any connectivity issues such as firewalls or proxy servers?
While the item is clicked what are you using you using to get the selected item - event.target.selecteditem or event.currentTaget.selecteditem ? Try to change from target to currentTarget or vice-versa,it might work in both the machines.

Web browser lock-down: How to?

I have an ASP.NET web application where a portion of it needs to run in a web browser as a public facing terminal.
Essentially it is used to capture anonymous user feedback (wizard control on a .aspx) in a commercial location such as a shop.
An administrator will login and prep the application for 'terminal' mode.
The terminal is a normal PC with keyboard and/or mouse like device.
I would like to prevent users from:
Viewing the browser menu's, pushing back button and/or entering a different URI in the URL and also disallow keyboard shortcuts from bypassing the intended looping functionality of the application that is running?
Which browser is best suited for its ability to disable functionality as mentioned? The app runs on IE/FF/Chrome/Opera/Safari.
HOW would one go about configuring the machine and/or browser so it is locked to prevent unauthorized/unintended use?
On a side note, I guess the web application session needs to have an unlimited timeout?
Thanks for your input!
EDITED: I am leaving the question as unanswered for now... I would like to see responses that highlight possible options for the other browsers as well.
You can run Internet Explorer in Kiosk mode.
Please see this MS KB article.
Simply put, start Internet Explorer with the -k argument
There seems to be some commercial products available also, like this.
Try How to use Kiosk Mode in Microsoft Internet Explorer
Also, there are many Kiosk tools to assist in locking down a machine. Example: http://www.thekioskstore.com/index.php/software/kiosk-lock-down
Firefox has at least two plugins (and possibly many more):
https://addons.mozilla.org/en-US/firefox/addon/1659
https://addons.mozilla.org/en-US/firefox/addon/509
It is also possible to lock down KDE and GNOME (GNOME at least has a built in tool), which you can also use to lock down the rest of the system. I suggest installing Ubuntu if the web app is running on another system.
If you have to use MS Windows, check out: http://www.microsoft.com/windows/products/winfamily/sharedaccess/seeit/internetcafe.mspx.
You can use an opensource Linux distribution designed for this very purpose, http://webconverger.com/

What kinds of production issues should I anticipate when deploying a Flex app?

My company has been working on a Flex dashboard that displays realtime financial information. It will be deployed over a corporate WAN to perhaps a few dozen users.
This is our first Flex project, and while development has been very pleasant, we're a little concerned about what production issues might come up (users not having the right Flash player installed, long download times,BlazeDS performance, etc).
Our stack is RDBMS/Spring/BlazeDS (remoting and messaging)/Flex.
Does anyone with experience deploying a commercial Flex app have any words of advice?
Your biggest problems are likely to be:
your users not having the correct version of the flash player
your users having locked-down desktops and either not being able to download the right version of the player or not being allowed to use the player at all
download speeds of the swf if you have a big app
intermittent loss of connection to your back-end due to either bugs in your code or unavailable network connection
restrictive browser policies
None of these are insurmountable, but you are likely to encounter all of them in the first few months.
I am presuming that you have tested your app for performance under reasonable load and will have fixed those scalability issues already :-)
HTH
If you're talking about a few dozen users I don't think you'll have a lot of performance issues. In my opinion the first tree bullets of Simon will be the most likely problems.
We have a flex business solution with a .NET/WebORB backend and a MS SQL2005 server.
The swf of the frontend application is about 1.2 Mb big. If you have a broadband internet connection, then download time is not an issue (as it is corporately deployed in WAN, I guess this is no issue). If not, then the first time the user loads the swf it will take some time, but then it should be cached. (caching is another issue if you often have new builds. Best is to have a contextmenu in your swf where you can see the buildversion. If a user has problems with the application, one of the first things I check is whether they have laoded the last version.).
At times the frontend player is simultaneously used by 500 candidates. Each player loads and saves data regularely to the server. We have had no problems so far and I know that using cache on the server side performance can be increased a lot. Stresstests are important here as a lot depends on your architecture, hardware, concurrent users, ...
We also use messaging for pessimistic concurrency control and that's a whole other story. We have done a lot of testing here to get things up and running well.
Security doesn't seem a great issue in your project as it is deployed corporately. But be aware that remote calls available to the swf are not secured without security.
Lieven Cardoen aka Johlero
our logs showed that flex apps would randomly drop connections to our servers. We ended up adding automatic retry logic to all of our REST calls.

Resources