(Client) screen capture in meteor? - meteor

Is there a way to get a screen capture (of the client screen) in meteor? I don't care whether it's available (once captured) on the client or the server - either is fine.
I saw something similar to this but it appeared to only work for a browser window. I'm looking for a screen capture of the client screen no matter what is active - even if there's no browser open - just as if the user hit the "PrntScrn" key then pasted into a jpg file and saved it somewhere.

One cannot do such things (calling unapproved OS functions) from code that runs inside of a web browser.
This is a deliberate design decision for web browsers, as one doesn't want scripts from the broader internet running arbitrary code on your computer.
Internet Explorer used to (not sure if still) provide "hooks" for Windows Update that involved an Active-X control that interacted with the OS.
They MADE the OS (Microsoft) so it was their prerogative, but it undoubtedly lead to some exploits...

You can use html2canvas for generating the screenshot. There is a meter package too for the same on atmospherejs. You can find the docs and examples here
Alternative is to use PhantomJS to do this job.

Related

How can we close the opened Url through program?

I am using QDesktopServices::openUrl(url); to open a url.
How can I close that through user defined code?
You are opening your URL in a browser window, on which user code doesn't have any control.
So basically you cannot close the browser.
A workaround could be that you write a script and detect if a browser is opened on the system, if yes you can close the browser by terminating that process. But I do not recommend this method as it has many security and standard compliance issues on some platforms.
EDIT:
You do not need to create your own browser, just use Qt Webkit to render the opened URL within your own window.
I'm afraid I don't believe you can close a URL via Qt code, with QDesktopServices.
The user could have configured their operating system to open URLs with any number of different browsers, and I don't see how it would be practical for Qt to be coded to know how to close every different type of browser porgramatically, on every different platform they support.
Edit
An alternative is to put a browser widget into your application. Then you'll have control over that. Qt provides some pretty powerful tools for is. See the Qt WebKit documentation.

Flex application suspended while in the background using Safari on Mac

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

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/

Large file download in background, initiated from the browser

Is there any reasonable method to allow users of a webapp to download large files? I'm looking for something other than the browser's built-in download dialog - the requirements are that the user initiates the download from the browser and then some other application takes over, downloads the file in background and doesn't exit when the browser is closed. It might possibly work over http, ftp or even bittorrent. Platform independence would be a nice thing to have but I'm mostly concerned with Windows.
This might be a suitable use for BitTorrent. It works using a separate program (in most browsers), and will still run after the browser is closed. Not a perfect match, but meets most of your demands.
Maybe BITS is something for you?
Background Intelligent Transfer
Service Purpose
Background Intelligent Transfer
Service (BITS) transfers files
(downloads or uploads) between a
client and server and provides
progress information related to the
transfers. You can also download files
from a peer.
Where Applicable
Use BITS for applications that need
to:
Asynchronously transfer files in the
foreground or background. Preserve
the responsiveness of other network
applications. Automatically resume
file transfers after network
disconnects and computer restarts.
Developer Audience
BITS is designed for C and C++
developers.
Windows only
Try freeDownloadManager. It does integrate with IE and Firefox.
Take a look at this:
http://msdn.microsoft.com/en-us/library/aa753618(VS.85).aspx
It´s only for IE though.
Another way is to write a BandObject for IE, which hooks up on all links and starts your application.
http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx
Depending on how large the files are, pretty much all web-browsers all have built-in download managers.. Just put a link to the file, and the browser will take over when the user clicks.. You could simply recommend people install a download manager before downloading the file, linking to a recommended free client for Windows/Linux/OS X.
Depending on how large the files are, Bittorrent could be an option. You would offer a .torrent file, when people open them in a separate download-client, which is seperate from the browser.
There are drawbacks, mainly depending on your intended audience:
Bittorrent is rarely allowed on corporate or school networks
it can be difficult to use (as it's a new concept to lots of people).. for example, if someone doesn't have a torrent client installed, they get a tiny file they cannot open, which can be confusing
problems with NAT/port-forwarding/firewalls are quite common
You have to use run a torrent tracker, and seed the file
...but, there are also benefits - mainly reduced bandwidth-usage on the server, as people download also seed the file.

How to determine if the user's browser can view PDF files

What's the best way for determining whether the user's browser can view PDF files?
Ideally, it shouldn't matter on the browser or the operating system.
Is there a specific way of doing it in ASP.NET, or would the answer be just JavaScript?
Neither, none, don't try.
Re dawnerd: Plug-in detection is not the right answer. I do not have a PDF plugin installed in my browser (Firefox on Ubuntu), yet I am able to view PDF files using the operating system's document viewer (which is not Acrobat Reader).
Today, any operating system that can run a web browser can view PDF files out of the box.
If a specific system does not have a PDF viewer installed and the browser configured to use it, that likely means that either it's a hand-made install of Windows, a very trimmed down alternate operating system, or something really retro.
It is reasonable to assume that in any of those situation the user will know what a PDF file is and either deliberately choose not to be able to view them or know how to install the required software.
If I am deluding myself, I would love to have it explained to me in which way I am wrong.
A quick google search found this. Useful for all kinds of plugins.
There are users that choose not to open PDF's in the browser and disable the plugin (this allows the file to be opened in the native application external of the browser window). It is better to let the user know that software is required to open something (whether it be PDF or not) than try to detect whether the plugin is available.
Another problem with detection is that what you need to look for changes from version to version (for example, see: "PDF.PdfCtrl.*" vs "AcroPDF.PDF.*" for the Adobe PDF viewer) and different browser implementations (the previously mentioned strings are used in IE for example, while Firefox uses a totally different manner of detection. Then we need to think of Opera and Safari and ???). Also, there are different vendors (think Foxit and Ghostscript, though I am not sure if they supply a plugin for the browser) where there may be differences in detecting the plugin.
For a script written in 2008 and some more information about the caveats see Detecting plugins in Internet Explorer (and a few hints for all the others).
After initially ignoring the advise on this page the architect went ahead with Acrobat detection, causing an inevitable support nightmare.
As ddaa mentions not all the scenarios can be accurately captured with Plug-in detection. Some users, for example, may choose to view PDF files with FoxIt Reader rather than acrobat. Some user's browsers don't flag that they are Acrobat ready, and certainly not always in the same way.
A better solution would have been to give the user a choice on how they'd like to view the relevant document. Personally, I don't like to have any website rely on a plug-in - it spoils the beauty of the web.

Resources