Does GWT support php? - php

does GWT support php ?

Useful links:
http://www.ibm.com/developerworks/xml/library/x-gwtphp/ (07 Apr 2009 )
and
http://www.gwtphp.com/
http://sourceforge.net/projects/gwtphp/)
http://code.google.com/p/gwtphp/
Havent used, so I can't tell if it's any good

To a certain extent, yes.
The heart of GWT is some magic for converting Java source code for a Web client into JavaScript. There's no wiggle room there; it's either Java or nothing.
But a GWT-translated client can interoperate with a server written in any language. You'd be missing out on some of the special remote calling capabilities offered by the GWT framework, but if you're willing to transfer XML or JSON back and forth, a PHP-based server could work with your Java/JavaScript-based client.

Yes, GWT completely supports PHP. Write your PHP script and use request builder to make the ajax call, then make your PHP return JSON data and use JSON parser within GWT to parse your JSON.
Normally, when you create a GWT application, it runs with the default java server, to direct it to your php server, use the following,
noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}"
-startupUrl <name>.html
-logLevel INFO -codeServerPort 9997
-war /opt/lampp/htdocs/../war com.<appname>.<appname>
if ever you are using eclipse, simply place the app on your php server you are using

Related

Web application using Node.js/socket.io and php/mysql

I am relatively new to node.js and socket.io. Currently I have a half finished private web project, which runs only with PHP with a MySQL database on the server side. I decided to bring it to a more advanced level using socket.io, for several features within the project.
So I read a lot about it and watched a whole bunch of tutorials. Also I found this and this during my research.
My question is, if that is still the common way to develop a web application?
More exactly: to use on one event (like a form submit) both an AJAX request and a socket.emit, for those events it is necessary/wanted.
The background of this thought is the following. I have a whole bunch of calculations running now in PHP. And the node.js server runs logically in JavaScript. So I can easily implement a node.js server without changing anything on my AJAX requests. Or rewrite everything I have so far, to js and use only a node.js server.
But this leads to 3 more questions:
Which runs possibly faster on the server side. A calculation scripted with PHP or JavaScript?
How to use transactions on a node.js server while using MySQL?
And how great is the influence by converting a PHP array to a JSON object, what you could avoid with the usage of just the node.js server where you don't need to convert anything.
JavaScript is executed on the client side so you are limited by the user's hardware whereas PHP is executed on your server. See this post for more info about performance comparaison.
I highly suggest you take a look at this pure node.js client that will perfectly do the job in your case.
PHP has many functions to use on JSON data (json_decode(), json_encode(), ...) but Node.js don't require JSON data to be converted. In the end, it really depend on your usage and how you plan to store and use that data

Is it possible to interact with a MySQL database without PHP

As the question says, is it possible to interact with a MySQL database created with XAMPP (so, using PhpMyAdmin) without using PHP, but only Javascript/JQuery?
This is a merely theoretical question, I don't want to know how to (but if you know it, I want discard your help).
With this, I don't mean using Ajax to send my request to a .php page that will then interact with the database, but directly interacting without passing through PHP.
In terms of a PHP application, it's not possible to interact with MySQL through JavaScript because JavaScript is executed client side i.e in the browser, it doesn't have access to anything on the server it is being served from.
However, with nodejs - a JavaScript runtime built on Chrome's V8 JavaScript engine - you can write a complete JavaScript server side application without having to touch PHP. There's a node-mysql module which means you can interact with a MySQL database with JavaScript code.
Several web application frameworks exist to help you get something up and running like Express, which saves you the burden of having to write up things like routing logic.
No you can't interact with MySQL through JavaScript or JQuery. You could use JavaScript and JQuery through your PHP pages if that would be a functionality you'd be interested in. You could also use another language compatible with MySQL. Otherwise interacting with MySQL straight through JavaScript/JQuery won't work.
You can do openDatabase()
Make an SQL file, db.sql,
and in a javscript file, type this: openDatabase(db.sql, '1.0', 'My First Database', 65535)
More on this here: http://html5doctor.com/introducing-web-sql-databases/.
This makes an SQLite connection. I recommend it as it doesn't use PHP, but if you really really want to use MySQL(Again, I recommend using this SQLite method) you have to use PHP or some sort of server scripting language.
Learn SQLite: https://www.tutorialspoint.com/sqlite/index.htm
This works on:
XAMPP
repl.it
well, basically anything.

How to call PHP from MATLAB?

I have some analysed data in MATLAB which I need to send to a server. I have a php link to access the server. Any idea how to call php from MATLAB?
Thanks.
If you will frequently send data back and forth between MATLAB and your web server, perhaps you can consider using SaturnAPI. SaturnAPI provides a REST interface for your Matlab and Octave scripts, so that you don't have to install anything on your own server. It can even send Base64 encoded 3D plots to you. Here is the demo. Below is a diagram showing that you can pass inputs to the script via the SaturnParams variable in the HTTP call.
Disclosure: I work on SaturnAPI

Using meteor.js with php server side

I've developed an application that I would like to use meteor.js for real time updates (I want to enhance but not change my program, for example when a user adds a comments make it update in real-time ) . Problem is meteor.js uses node.js (so javascript as server-side code). I use LAMP stack, Is it possible to get PHP to feed data into meteor.js from mysql.
Meteor is more than just an 'interactive webapplication'-builder or javascript framework. The idea is to have only one programming language (besides HTML/CSS for markup) to do all the work. Basically it creates a 'remote server' (in the clients browser) it can push data to and at the same time it publishes various API's to the users system. The data passed through these API's / connections has a specific structure which has to be adhered at all time.
Meteor is built around NodeJS, which makes it hard (if not impossible) to run it without this backend. Sure you can try to mimic the backend using PHP, but it would be a waste of time. Reading your question you'll be better of using a javascript framework like jQuery or Prototype. Unlike Meteor you will need to do the AJAX calls (POST & CallBack) yourself, but you can actually decide which backend you want to use yourself (including PHP / MySQL).
If you want to do this anyway you need to check the Meteor & NodeJS source code to see what the minimum requirements are to make Meteor run under PHP. The PHP stack has to interpret the commands Meteor sends and receivers, but this won't be an easy task.
You can use comet (or reverse ajax) for realtime updates.
Trying to marry node.js with PHP doesn't sound like a worthwhile path to go down. If someone insisted on using a system like Meteor.js, yet with a PHP back-end, it would make more sense to look at AngularJS which is mainly the client side.
Of course, that is different technology stack. If someone really insisted on the blending, one could consider using server side sockets to interact with PHP Web services; and/or use mongodb and/or mysql-node to interact with the same databases.
I released a meteorite package that interacts with a Wordpress site that has the Wordpress JSON API. A quick fix. For now.
Comes with a backend call that will return the raw data, or a publication that stores the posts using their id's instead of a randomly generated mongoid. And some basic templates to get you started including a Session variable that keeps track of the currently selected post.
I'm working on it a lot more and will eventually have a version that directly makes mysql calls from node so you won't need php or Wordpress; just the ability to access the mysql database (which can be remote, with the appropriate configuration, or on the same machine).

How to get data from a mysql database using javascript?

If possible, how can I get (and post) data from a mysql database using javascript? I know I can use php and other languages, but I just need to know if this is possible with javascript?
Thanks in advance.
That's not possible with Javascript. I could not find this with server-side javascript too.
Not sure about your exact requirement, but you can use Ajax to interact with database though some server side language.
If by Javascript you mean NodeJS on the server, this project might interest you http://github.com/sidorares/nodejs-mysql-native - however the answers above are correct if you are talking about Javascript running inside a browser or other container.
If you want to run a vanilla javascript (for the concurrency speed) inside your own engine, I recommend looking at NodeJS and then using the NodeJS MySQL Native Driver that I linked above.
• http://github.com/sidorares/nodejs-mysql-native
Judging from the "iPhone" and "Android" tags, I guess, you are trying to access the local storage databases on these platforms.
They don't use MySQL, but SQLite.
How you access them from the mobile browsers is described in the W3C draft documents for the local storage: http://dev.w3.org/html5/webstorage/ for the local storage API or http://www.whatwg.org/specs/web-apps/current-work/multipage/section-sql.html#sql for the SQL API. It should be roughly the same API on iOS and Android since both of them use the Webkit browser engine.
it is not possible, javascript is executed on the client.
you could make the javascript call something on the server (e.g. php script) that access the database though.
The Web SQL database API isn’t actually part of the HTML5 specification, but it is part of the suite of specifications that allows us developers to build fully fledged web applications, so it’s about time we dig in and check it out.
Some examples are here
http://html5doctor.com/introducing-web-sql-databases/
Do remove the tags iphone and android from this question. the tags are not relevant.
And only with javascript you cant accompolish this task , GET and POST request can be handled only by server side scripting languages like php.
Refer : http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml
javascript can get database from server
if use AJAX , only a way is AJAX

Categories