How to run a Sencha Touch 2 app without a web server? - webserver

Does anyone have any idea on how to run a sencha touch 2 app without installing a web server (like LAMP/XAMP). (PS : I'm new to Sencha Touch)
I know there is one way - Including phonegap's javascript file in the app.json of the Sencha Touch 2 app. Which'll look like this
"js":
{
"path": "cordova-2.5.0.js"
}
After this the sample application runs on the browser without the web server.
Is there ANY other way?
How does adding the phonegap js file help in running the sencha touch app without web server anyway??

Starting chrome with --allow-file-access-from-files --disable-web-security flags also does the trick.
Sencha requires web server because if app is in development mode microloader in sencha make Ajax request for app.json file and from it, it loads other files. You can see this in
../sencha-sdk/mircroloader/development.js
file with following code -
var xhr = new XMLHttpRequest();
xhr.open('GET', 'app.json', false);
When you start chrome with above mentioned flags, chrome does allow making ajax requests even if file opened with file://.... url scheme.
When you deploy the app after compressing js/css with sencha cmd, all files are bunched into one single file. You no more need a webserver in that case.
Update
From Cordova docs for Whitelisting domain
Domain whitelisting in Apache Cordova is a security model that controls access to outside domains, such as http://google.com. The default security policy is to block all network access. The application developer can then declare access to specific network domains and subdomains.
And
In the Widget Access specification, the element is used to declare access to specific network domains. In the future, Apache Cordova will abstract the platform whitelisting implementations to the W3C Widget Access specification. However, for now each platform must implement it's own domain whitelisting.
Moreover, W3C Widget Access does not enclose the security and user agent enforce policy. It is defined in XMLHTTPRequest.
So what Cordova essential does is, adds an exception in policy to allow access to certain network resource outside app domain with whitelisted domains.

Related

embedding dual apps with webserver

I've run into issues when running a web server in an app that is embedded using the AppView approach.
The background is that we need to run two applications in Kiosk mode (digital signage implementation).
There is a primary app and a supporting application running, the support application needs to run a local web server for configuration and control purposes.
The web server needs to be accessible from external browsers.
I have had some success embedding the app with the web server and being able to access from a browser running on the same device, but not remotely.
These tests have only been done in desktop rather than kiosk mode.
From what I can tell the Manifest for both the embedded and host apps are correct, in that the apps run in single app mode ok.
The apps will embed using the AppView tag.
as per... https://developer.chrome.com/apps/tags/appview
1 - Is it possible to embed a web server as per the above senario?
2 - Are there any additional properties needed in the manifest
Any assistance would be greatly appreciated.
Thanks
P.S.
There are a few additional undocumented requirements for the embedding to work in Kiosk mode.
Such as listing the apps ID in the in the manifest for the container app.
i.e. you need to include "kiosk_secondary_apps" with a list of kiosk mode apps that you want to embed.

Deploying a GWT web application on Github

Can a GWT web application be deployed on Github?
For example, a GWT web application is created, and it works on a server intalled with Tomcat. It's known that a web page can be created on Github, like http://help.github.com/articles/creating-pages-with-the-automatic-generator/ Can a GWT web application also be deployed on Github? If it's possible, how to deploy it?
On Github Pages you can only use/host client-side technology like JavaScript, CSS and HTML. So your app would not have an back-end which can handle your RPCs. But it's possible on GitHub Pages to make Ajax calls (http://blog.teamtreehouse.com/code-a-simple-github-api-webapp-using-jquery-ajax ) , which are also the base for GWT-RPCs.
When the fron-end is running, you need a server for your backend. Afaik there are libraries to use php as an back-end (I guess most are not maintained anymore), or you could use the JsonpRequestBuilder to make HTTP-calls to a server of your choice. JSONP would be necessary to overcome the cross-domain restrictions imposed by browsers same-origin policy, because your backend would be on a different server.
So all in all this is not the way to go. As I mentioned in the comments you can try the GAE (Google App Engine) to host your application without recreating your back-end, because the other solution would require to rewrite your back-end (eg. PHP) and to host it somewhere
One last tip: Before you move definitely to GAE, check that you have all necessary libraries for you backed.
If you are using servlets and stuff : certainly no
If you are only using client stuff, my guess is also no. I don't think github even allows javascript, or even html ?

Use external mongodb in mobile build of Meteor

I've seen in a lot of places that in order to use an External Mongodb in Meteor applications, you should use an Environment Variable MONGO_URL. However, I'm building my application to work both as web app and mobile app (by generating an apk).
The problem is that when I start meteor as MONGO_URL='mongodb://user:pwd#path.mlab.com:9999/db' meteor it works well in my computer. But, it's not possible (I haven't found any way of doing so yet) to do this in mobile.
So, anyone has any idea of how I could use an external mongodb in mobile applications?
Thanks!
It seems to me that you are confused about how Meteor works, and more generally the client-server architecture.
Only your server has access to your database (whether on the same machine or at a third party provider), so that you keep control of exactly what your Client has access to.
By "Client", we mean what your visitor uses to access your app, whether a web app through a browser, or a mobile app through a Cordova wrapper.
So your mobile app only needs to know the URL of the server it has to connect to. That is specified by the --server option when you do your meteor build.
Then your server needs to know how to access the external MongoDB. This is your MONGO_URL environment variable. In production, you would set this variable on your server host. Each provider offers a different method to configure those environment variables, most of the time there is a graphical administration panel.
Note that the way Meteor works, you can use the same server to support both your web app and mobile app at the same time.
Finally, you can also test on mobile using meteor run android instead of just meteor (or with ios instead of Android, but you need a Mac). Of course you can still specify your MONGO_URL variable in the CLI when testing, exactly like you have done when testing on browser.
For mobile (cordova) meteor applications think of the app as just a web view with the ability to access native device features (camera, bluetooth ...). Since the application is basically a web view, the underlying mongodb associated with it is the same. If you want mobile device specific storage take a look at GroundDB
For your situation, if sounds like your mobile app is having problems connecting to your server, ultimately not allowing it to pull data from the mongoDB. Make sure that when you build the mobile application you have server specifed '--mobile-server'. Also if you are running it locally, make sure your mobile device is on the same network as your computer and any firewalls that might not allow connections are disabled.

How to access local mysql from chrome packages app

I am developing a chrome packaged app. There is already an VB application running with mysql. I want to access the same database but use chrome packaged app as client.
How to access local mysql server from chrome packages app using javascript ?
I am aware of IndexedDB.
You have two options:
Create a web service (e.g. some PHP pages) that talks to MySQL and allows your app to use it as a go-between
Write your own MySQL driver/communicator to communicate with it directly: http://developer.chrome.com/apps/socket.html
The first is the easiest and would take the form:
Your chrome app would use AJAX to communicate with the PHP pages (probably via "POST")
Your PHP pages would expect it to login, use SSL and then use a token to continue identification during a session
The PHP would have generic capabilities to do CRUD actions
The PHP would spit back JSON for the results
but the second option would make you a hero if you took the time to develop that and put it on sourceforge or github under a permissive open source license.

Deliver application's GUI via browser

I need to show to a user an interface of some application running on a server using a browser. It should be like RDP-client for a single application on a server.
Are there any solutions or services that can implement following functionality? Maybe Citrix?
Thanks in advance!
This looks like what you're looking for:
http://freerdp.net/
About FreeRDP-WebConnect
FreeRDP-WebConnect is an open source gateway for accessing RDP
sessions using any HTML5 compliant browser. In particular it relies on
the Canvas and the WebSockets feature. FreeRDP-WebConnect is a
subproject of the FreeRDP project.
On the server side, a standalone daemon - written in C++ - provides a
Web page via HTTPS (or HTTP, if configured) and uses FreeRDP libs to
connect as a client to any RDP session. The server side WebSockets
implementation handles current RFC6455 only, so browsers that
implement the older drafts do not work. With RFC6455 being raised to
the "Proposed Standard" level, this should change now really soon.
I would create an account on the server for the user, and only give it access to the one application it needs access to.
You can use Cameyo. To start, create yourself a free account, and click on "Add App". If your installer supports unattended installation, you simply need to submit it. Otherwise, you can build a Cameyo package locally and send it in. It will then be playable as HTML5.
You don't indicate what server you are running on.
As an alternative to FreeRDP-Webconnect cited above, also open source and also using FreeRDP as rdp client through an HTTP gateway, there is Myrtille.
FreeRDP-WebConnect embeds a standalone daemon written in C++ to provide a web page via HTTP(S), and so will also work on Linux servers, while Myrtille have a IIS/.NET (C#) implementation and an MSI installer, thus is more intended for Windows Servers.