This is more general design kind of question. My major project is to create native app for Firefox OS. Which therefor means JavaScript, jQuery, HTML5 and css. This application should have several functions. But as a general design goes I need local html,css,js application running under firefox OS with ability to access server php scripts and mysql db, but because application is running on client side, I have a major problem with communication between application and server. Which technology, language, API or JS functions could I use for Login check, registration, messaging. How can I access server from local (on PC or Mobile Device) files. There is possibility that I'm missing some point or that my whole understanding of the problem is wrong, but is this possible and how?
Apps are built using standard Web technologies with additional metadata that allows the User Agent to discover, install, launch, and grant them additional privileges.
So says MDN.
The usual way to interact with remote, shared databases is to place a RESTful HTTP front end in front of them and access that with JavaScript/XMLHttpRequest.
XHR, WebSocket or TCPSocket.
FYR:
https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest
https://developer.mozilla.org/en/docs/WebSockets
There is no TCPSocket document on MDN, but you can study gaia email app.
https://raw.github.com/mozilla-b2g/gaia/master/apps/email/js/ext/gaia-email-opt.js
Related
I need to access a SCORM content through my application (LMS). Now, this content is stored in the filesystem in a different AWS ec2 instance (ubuntu machine).
My server has different application instances installed for serving different clients. Each client instance has a separate filesystem repo sitting on a same ec2 server.
How do I maintain that the SCORM opened by a specific user interacts only with the specific client application instance so that SCORM interaction parameter values get saved in the correct database?
Note : My application does not have a multitenant architecture.
Sorry for a such a generic question, actually I am a little confused hence a little direction would be appreciated so that further I can find my way out.
SCORM and Cross Domain would require some work. If you can get the content and the Platform on the same domain that would go easier. Another option would be to just get all the content files to point to their CSS/JS/IMG assets on the other server. Then your playing in the right sandbox.
Short of that there are some IFRAME hacks out there to do the same but it pretty much requires you to touch things that would lend it self to just pointing to all the Assets anyway without the go-between.
SCORM is a JavaScript<->JavaScript communication. The LMS will send the data stored in a session to the backend commonly on a commit call.
Current scenario :
There is a webservice (build in php/mysql). User filled data is stored on a remote server.
Issue is user has extremely bad internet connection, webservice is down most of the time. Is there a way to store data locally and sync it when internet is available?
Please note, user might not have database installed on his machine also there is no localserver to work with.
Even if user had some type of RDBMS installed on the box, you probably wouldn't have any way to communicate with it. You can use the HTML 5 Storage API, but it will not solve the connection issues.
And since localStorage (which you probably would use) is available directly only from JavaScript, you would have to make a complicated and fully functional JS application to utilize it.
Note: based on your profile, I would estimate that your JavaScript skills would not be adequate for such task.
If your target audience is mobile users, then you have another alternative: create a native application.
You would still be able to use HTML for the interface (using built in web browser components). But it also would let you have SQLite DB and file storage available on the mobile device, where you can cache the necessary data.
look at the features in HTML 5 for local storage
Typically I would go with IndexDB and then push the local data to the server once the connection is back
http://diveintohtml5.info/storage.html - Should give you a brief about the features and implementation.
I am building an internal system for a small business and one of the requested features was to be able to go in to different apps by clicking a button on a web page.
So for example when you click on the icon for Coda it will open and be useable.
This does not need to work for Windows, only on Mac OS Mountain Lion!
How could this be done? or can it not be done?
Two options:
If the app can be opened using a registered URL schema, you can use that. For instance, an ftp://... link opens the default FTP application, a news://... link the default news reader. You can make up your own URL schemas. An application typically needs to register itself for a certain schema for this to work.
If that is not an option, you pretty much have to install a plugin in the client's browser that can do this via any mechanism it wants.
The problem that you face here, is the way binaries and the web works. Compiled applications like cocoa apps will only work if at least their starting binaries are there. But this basically means that the user already has downloaded the binary.
Furthermore, these apps will create their own application preferences - so a downloaded version of Coda will have no license.
And if the user has downloaded you binaries, what will stop them from using your software forever? (Just apart form license problems with the authors of said software).
So, the only thing that you could do, is to present them with some kind of VNC like client that will grant them limited access to an environment that you have under control. But writing that is way out of scope for this site.
(I assume, that the application are not already installed locally, but be usable from the server).
I recently built a web application for my company, and now they want it to support an offline mode. To complicate things, my company is very concerned about security and does not want me to use Xampp or Mamp. The application handles sensitive data and they think these programs will somehow make the data visible to the outside world (although I'm entirely sure this would be the case).
Anyways, I'm looking for a way to allow my application to run offline, and to also support the following technologies: PHP, MySQL, jQuery. The most difficult part of this is I need to execute PHP code outside of the typical server environment.
Can anyone please give me some advice on how I could implement such a system, and any associated vulnerabilities that I may face in terms of security and data storage?
Assuming you're installing this for an individual user on their machine - your best bet is to install apache/php/mysql, and configure apache to reject connections from any remote IP address.
The environment should be basically identical to your current application, but with only 1 user in the system.
There are some strange points in your question
now they want it to support an offline mode
Well, that's easy enough - get familiar with html5's offline features
To complicate things, my company is very concerned about security and does not want me to use Xampp or Mamp
Have you deployed your web app on a desktop machine? Or do you mean you are forbidden to use a webserver?? Xampp/Mamp are development tools - your public facing applications should be on a machine configured specifically for that purpose with a webserver running apache/nginx/iis/PHP5.4-builtin/whatever you like.
The most difficult part of this is I need to execute PHP code outside of the typical server environment.
How is your environment none-typical? Mike mentions php-gtk - but IMO you shouldn't go down that route unless you're requirements are "desktop app" + "absolutely must be written in php" - which is unclear from your question.
any associated vulnerabilities that I may face in terms of security and data storage
Well, anything you put in local-storage on a client (browser) the user can access - just bear that in mind. Don't send sensitive data to what is, from your perspective, an insecure and pseudo-public location i.e. some user's browser cache.
If you want to run html/javascript, you will probably need to run this in a server/client environment because a browser isn't capable of running the php and the php app as a stand alone app needs something to parse the html/css/javascript ( it needs the browser for it's presentation view ).
Best course of action is to put the application onto a server that you control access to. Set the access controls to specific IP addresses only, or even better if you can run it off an intranet behind a firewall where no one outside the network would be able to get to it.
PHP can run on a desktop environment, but they key here is that it won't run the javascript/html you use to display. You could use php with a third party library like php-gtk to make a desktop app that doesn't need a server or browser, but php-gtk doesn't have the best support.
If the application needs to store data for other computers/users to access, then it needs to be on a network. If it doesn't need to do this you might consider using a different programming language geared toward desktop applications so you can keep it entirely offline ( such a java or .NET ).
I want to sign the PDF using client certificate. It only work when I got the file is stored in my PC. Since I want to sign my PDF by using the certificate stored inside a USB token, what should I do to achieve that.
I tried to search from the internet, but all I got are mostly using JAVA. Is there anyway to achieve the same goal using PHP? If not, can anyone provide an alternative way to sign my PDF.
Are you talking about a PHP application that's running on a web server, and the USB token being attached to your client machine? Then forget it; it won't work because you cannot access the client's USB port from your web server via the client's browser without further plugins.
The java apps you're talking about are running in the client's browser and thus may have access to the usb port.
The task is tricky but doable. You need to create a client-side module, then calculate the hash of the document on the server, send it along with the client module to the web browser (by including it into the web page) and have the client-side module sign the hash. Then send the hash back to the server.
Our SecureBlackbox product does this, but it's not currently available for PHP on the server side (we plan to release library edition with PHP binding somewhere next year).