Hello I am programming a website and like how GWT works. My host only supports PHP and no Java and thefore also no GWT. I was wondering if i could user GWT to program a fully Ajax website with php requests to the database so that it can run on my webserver.
Thanks
jan behang
The bridge between GWT and PHP
Google Web Toolkit (GWT) applications, apart from connecting to
servlets in time-honored Java™ fashion, can also use PHP Web services
to send and receive data in XML. You'll explore methods to generate
XML documents and process them, both in the Java language and in PHP.
And also check out Basic tips for using GWT with PHP as well. And also almost forget referencing GWT's own documentation, it will also teach you how to send JSON which is being widely used data format among AJAX developers. Here is the step-by-step explanation how to build the StockWatcher application using GWT with PHP: http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/GettingStartedJSON
Related
How can I use ember js without ember-cli with PHP or java? How can I interact with back end data? Any example will be much appreciated.
The first thing you'll need to understand, is that ember-cli is a command line interface. It acts as a blueprint generator and an asset pipeline and glues all the ember stuff together in a wonderful productive package. It's just standard now, and you wouldn't want to use Ember without CLI. They are basically now the same thing unless you were using Ember since pre 1.13 and can't upgrade.
Ember is a JavaScript framework for front-end/client-side user interface. It doesn't deal with server style data storage like a traditional Apache/PHP. In a PHP setup, each page is rendered on the server side and then delivered to the browser in a complete form. Ember is more like a shell that you fill with data from somewhere else, but also has the ability to manipulate that data in the browsers and persist it back to the data-source.
The data source could really be something as simple as local storage. Maybe a simple game that just stores your userScore in the built-in local storage.
The data source could be something like the WordPress API, where ember pulls in posts or page data to display on the screen. Maybe you even have a form that persists new posts back to the server.
You could use parse or firebase for real-time back-end as a service. Or you could build a server of any sort that was able to generate an API that Ember could consume.
Currently, rails is popular for the server. Also, node frameworks like hapi.js and sails. Elixr and Pheonix are gaining interest and have proven to be a powerful backend team with Ember.
Ember uses ember-data and adapters to take in API data and serialize into a simple set of conventions.
If you have API endpoints coming from PHP or Java, you could use them - however, if you are starting a new project - I wouldn't think that would be an ideal route.
You can follow the Ember guides tutorial to learn more about how Ember works. Good luck!.
I am making a simple todo list Android application using Ruby (Specifically ActiveRecord) to get data from a database containing Users (made up of attributes like name, emails, todo lists etc). My problem is I want to pass the User data from the Ruby to the Java/Android code (for example to load all a users information after login).
Similarly, how would I pass data from the Java/Android code back to ruby, so that it may update a users information on the database when necessary?
Please keep in mind that I MUST use ruby.
The basic idea is to get data by hitting URL on web from your mobile Android app:
You need to just create web services in Ruby that will return you data in the different formats like JSON, HTML, YAML, XML from which you can parse it on your mobile app. Usually we prefer JSON/XML formats data that will be easy to parse on mobile site.
Here you go, for creating RESTful api in Rails there are many tutorials and example are available on web like below:
Tutorials or screencasts on building a REST web service on Rails
http://pivotallabs.com/building-a-fast-lightweight-rest-service-with-rails-3/
http://railscasts.com/episodes/350-rest-api-versioning
http://gavinmorrice.com/blog/posts/21-building-a-rest-api-in-rails-3
http://codedecoder.wordpress.com/2013/02/21/sample-rest-api-example-in-rails/
http://jes.al/2013/10/architecting-restful-rails-4-api/
Ruby will go as far as serving the data to your android application. In order for your android application to be able to 'understand' the data it receives, both the server and your android application need to agree on an exchange format, in which the data is to be encoded: json, xml, yaml, or even a more sophisticated serialization framework like protobuf, if there is a compelling need to go there.
You might want to start by looking up those.
I'm trying to find out if there is a standard or recommended way to communicate from javascript to the application which embeds a browser widget, and vice versa. The hosting application may be written in either java or c++ and may run on Windows and Unix platforms, but the javascript would be shared across both clients.
So far I've read about:
window.external (This seems to be IE specific, so it wouldn't work on Unix.)
LiveConnect (This seems to be java and mozilla specific, so it wouldn't work for IE or c++ based applications.)
SWT's Browser widget has some of this capability, but this would be a java-only solution..
What other options are out there?
Thanks!
Shyam
We have a VB6 application that hosts Microsoft's WebBrowser object (IE). We've used a simple URL intercept mechanism to facilitate communication between the browser and the hosting application. Since the browser control has a before navigate interface, we can pull out the URL and examine it for commands and either cancel the navigation event (since it was meant for the hosting app) or let it pass through (since it is a normal URL).
We used something like app://commandName?arg1=val&arg2=val in our Javascript or HTML link tags.
Then in the BeforeNavigate event from the browser, we check the url for app:// if we get that, we know the browser is sending the parent application a message.
Simple but effective (for our needs anyway).
EDIT
Should also mention that most embedded browsers also have mechanisms to manipulate the DOM. That in mind you should be able to extract information (HTML nodes) and inject information at will.
JavaScript has the XMLHttpRequest API that makes it possible to send data to, and retrieve data from a server. The use of this API with messages formatted in XML or JSON is designated AJAX.
AJAX can be used to implement the example you gave, of a tree node in the HTML/javascript that retrieves the list of children from the server when it is expanded.
Note that when using AJAX, the server may be written in any language (C, Java, Python, Ruby, etc).
I suggest you to read about AJAX. After you get a good understanding of AJAX you can read a little bit about web services. web service is a method of communication of 2 applications developed in arbitrary programming languages through the WEB.
I want to use the Raphael Javascript framework to create some charts based on dynamic data coming from my Java web application. Is the only way to access this data from my web application through the use of hidden fields on my page which I can then lookup inside the Rapahel JS code?
A typical approach would be for the web application to send a JSON file which your javascript would use to drive the Raphael library.
Reference:
Using JSON in jQuery.
Ajax Tutorials
As Brock says above, then look at: http://www.highcharts.com/
Why reinvent the wheel? Unless you want the experience. Graphing is fun.
I'm trying to write a simple Java desktop app to query Google and get the results. I've read so many articles in the past few days. I know that I have to do it through the GWT (Google Web Toolkit), the API that Google offers to programmatically query its search engine. My problem is that the GWT seems to be useful only to construct AJAX applications. I just want to write a simple desktop app. I am not interested in Javascript, XML or any server side application. Isn't there a way to do it?
Sure, take a look at this approach.
The general idea is that you make an HTTP fetch (using vanilla java.net.HttpUrlConnection or Apache HTTP Client). The magic is in the forming of the URL with the search term, and in the processing of what you get back from Google.
For the exact details on how to do this, see Google's REST search API documentation, including this section.
You can always get a license for the webservice and get the results returned through SOAP, however you did say that you were uninterested in XML. Shame, thats the quickest way. There is always doing a direct request to google through the query URL, since it uses HTTP get.