I have an assignment which involves developing an NPAPI (C++) plugin for an older version of Firefox. The plugin receives a decrypted byte array from an external library and renders the content on a webpage. The plugin so far works with images and various text files by utilizing NPAPI's drawing/window capabilities, however there is also an interest in allowing it to render JAR/WAR applets.
Unless I am mistaken, there is no way to "draw" a Java program with NPAPI, so it must be handled by Firefox. And since the plugin is dealing with encryption and decryption of secure content, it seems it would defeat the purpose to write the bytes back to a JAR file in the users browser.
Basically my question is this: would it be possible to stream the raw bytes of a JAR file from plugin to browser and have it execute on the browser without storing a temp file?
Related
I am currently making a Windows Universal App starting with an Kinect SDK application called CameraFrames. It's a rather complex app but I am having trouble with playing a video from my local files.
To do this, in one of the main windows of my app I insert a MediaPlayerElement in XAML:
<MediaPlayerElement x:Name="_MediaPlayerElement" AreTransportControlsEnabled="True" HorizontalAlignment="Stretch" Grid.Row="0"/>
As shown in the captur above. Below the XAML file I have a cpp file and a header file. I tried searching on the web for a solution to my problem but couldn't find any. It's my first time using XAML thus I don't know how to connect the different objects that I put on my UI to actual code. The ideal result would be to have the ability to choose from my computer which video file I want to reproduce and then display it on this MediaPlayerElement.
You should set the Source property of your MediaPlayerElement.
If you want to do that in code, use MediaSource.CreateFromStorageFile or CreateFromStream method to create the media source.
Also, UWP apps run in isolated containers. By design, they can’t access files from arbitrary location of your hard drive. Read this article for more info.
I am new to Xcode and iOS development and I have a basic question about how to store (bundle) application data that consist of images needed by my application. My application requires a small database of images as input that I supply.
I have an Xcode project in C++ that uses OpenCV that is currently compiled and running correctly on my Mac. The application on my Mac simply reads the image data it needs from a folder on my file system that I can easily point to. I am trying to port this application to iOS using either Objective-C or Swift. I was able to write some basic Objective-C code as a wrapper to my C++/OpenCV application but I am now at the point where I need to access the iOS file system to read the images and I am not sure where to locate that data and how to configure my Xcode project to include it.
After doing some reading on this topic I see that there are several ways to store data in iOS, but I am uncertain about what approach would be appropriate and relatively easy to implement. My understanding is that all the data for my app needs to live in the application sandbox. I see plenty of examples for how to get the file path for various folders in the sandbox, but it is not clear to me how to actually configure my project to include the data (i.e., where do I put my images?). Is there something I need to configure within my Xcode project so that when I compile the application it knows about my data?
I found many posting about the iOS file system, Core data, archiving data, etc… but had a hard time locating any information about how to actually configure my project with data that I supply. Any help would be greatly appreciated.
Thank you!
If the images that you are supplying are fixed in the app (ie- not changing over time) then you simply add the images to the app itself. They are stored in the app bundle and can be accessed as follows (with sample names);
let imagePath = NSBundle.mainBundle().pathForResource("myImage", ofType:"jpg")
let splashImageURL = NSURL.fileURLWithPath(imagePath!)
anImage = NSImage(contentsOfURL:splashImageURL)
You can create a folder in the project to hold the images. This is not used in the final image path, only for convenience in the project. You can use the File menu or drag and drop image files directly into the project. Make sure to check the 'copy files' option to move the images from your source location into the project itself.
I currently have a c++ client which can play SWF, AVI, BIK etc
It uses DirectX9 to render the graphics
I currently have a requirement for dynamic SWF files, which would retrieve data from a BlazeDS server and put certain text in certain places depending on the retrieved data
From what I have read, BlazeDS talks to Adobe Flex and Adobe AIR applications
Would that mean I would have to convert my current c++ client into a Flex application
Sorry if this seems like a stupid question, I'm just having trouble trying to figure out how Blaze and Flex and Air all fit together
It's a litte unclear what you're asking, so let me have a crack:
Assuming that you have a c++ runtime that you want to communicate with BlazeDS, you could write a c++ implementation of the AMF protocol.
The protocol itself is open source, and there may even be c++ implementations of it out there already.
I assume from your question that the client that is rendering the SWF is not the flash player. If this is the case, switching your c++ app to Flex won't win you anything, as Flex itself doesn't know how to handle AMF -- the serialization process is handled by the flash player, rather than the flex framework.
Is it possible to have the src of an HTML5 Audio tag be a C++ program, and for the C++ program to stream audio to the audio element? For example, let's say I have an HTML5 Audio element trying to get audio from a local program like so:
<audio src='file://(path to program)'>
If it is possible, which libraries should I use? I just want to try it locally for now, so file:// is what I want.
EDIT: Setting the source as file:// won't work, so how can I tell it to get audio from the specific C++ program?
I am not sure about the C++ side of the question, but trying to embed a would-be program via file: will not work, as the browser would simply read the binary file foo.exe instead of calling it and reading in the standard output (or whatever).
Instead, for testing purposes, you would probably like to run the server locally on your machine, referring to it via localhost.
Certainly if your C++ program was stand-alone, you could write/include a mini-web server to service only audio requests that come in and then execute whatever code you wanted to in C++ to return the data.
Otherwise you could write a C++ plugin/module to an existing web server like IIS or apache and configure the web server to direct traffic for a specific url to your C++ functions to return the data. This might be a little more complicated but alot more powerful by allowing you to focus more on your audio code than worrying about handling HTTP protocol and TCP connections.
In either case then your C++ code would be referenced the same as any webserver. "<audio src='http://localhost:port/etc'>
I need help trying to get thermal shipping label data from a Web site to a local Zebra printer. The data itself is just plain text but spooling it from a Web site seems to be very difficult for some reason. Does anyone have any experience with this? I am using ColdFusion 8 and Windows Server 2008.
Your print data could be sent with a MIME type (there probably is one for it, but you could make one up too)
On the client's PC, they could have that MIME type mapped to a program that simply prints whatever it receives.
Setting the MIME type on a PC can be done with code or a .REG file. If you control the user's environment, that's pretty simple. Making a program that dumps whatever it receives is also easy. That would be a nice task for Visual C or good, old VB6. Very little code. As long as the user has the .EXE and the .REG file, they'll print reliably, every time, without the browser's crap getting in the way. (think of this as what happens when you click a link to a PDF - Acrobat opens. Well, have the little printing EXE open for your file type - easy).
This is familiar to me... I think I did this with a proprietary font set... AH! Yes, I had to do this to generate mortgage documents that used proprietary fonts for drawing the pretty lines. I was able to take a proprietary, stand-alone mortgage origination server, share the folder where the mortgage .PRN files had been created. A Web server with access to that share enumerate the files in the share to a Web page, then, when users clicked on a file, the .PRN would stream to their PCs where a corresponding .EXE would see it as one of its own and send it to the correct output device (a designated printer at their location). That dumb little piece of code eliminated 126 document servers (and their maintenance and licensing costs) instantly and mortgage documents were never lost or sent to the wrong branch by mistake again. I think it took 3 hours to get it all working from inception to testing at the branches.
Yeah, same thing here. It'll work. Trust me. It'll work.
I was unclear by your question as if the Zebra printer is connected to the web server and what software the server is running. If you are trying to send the data to a printer connected to the web server, I used the following information to send label data to a Zebra thermal printer in an Intranet solution and it worked great:
How to send raw data to a printer by using Visual C# .NET
Perhaps you can adapt this solution to your environment.
I fiddled about with this problem for ages. In the end I had to create downloadable printfiles. The user downloads them and then copy (MSDOS) them to the printer.
There were two main issues:
generally speaking, you can't print
from a website unless you open the
file (ie the file becomes local)
the print drivers on the user's (Windows)
machine add non-printing characters
to the barcode file as it is sent to
the printer
We installed a batch file (which runs copy instead of print) on all client machines that need to print barcodes and we added a right-click menu item to run the batch on files named *.barcode.
I'll be watching this thread to see if anyone has found a more direct solution. But this was the only thing we could do given the parameters of our situation.
I don't know if I have fully understood your problem or the exact environment but I have answered a similar question here with an example for ASP.NET (C#). That solution is mainly for a known printer (specific IP and port). If you have several clients with their own label printers the solution could be used for that as well. But then you have to make a solution where the clients are able to set their own IP and port of their label printer. They also might need to make a port forward for the traffic in their firewall. The webpage then just prints to the specified IP and port. You can also use a domain name instead of IP.
Perhaps you could try this:
http://code.google.com/p/jzebra/
This project allows the ZPL commands to be sent to the printer via a web browser.