Someone here is developing an app in asp.net (Visual Basic) as this is their preference language.
Now the method he's creating (as he already started work on it) will carry out multiple databases queries.
I have a java application i.e. Java EE that requires the same output from the function of the vb application.
Is there any way I could exchange the data as in send data from jsf to asp.net, process in vb and get output back in jsf?
The only data I require is a string consisting of 8 characters at the most. So not serious data to be transferred.
The asp.net application can expose some web services to your Java application to call and get data from.
This is very easy to accomplish with asp.net and should be standard enough for your Java application to call and retrieve the results.
try using sockets as that is much easier to achieve. if you are brave enough use jni which us lot more hard work.
Related
tl;dr: Is Spring + Django back-end possible?
When I was new to industry and was still working my way around the office, I got interested in Django and created a very small, basic-level application using the framework. When I got to meet my team after a few weeks, they said to go for Spring framework. After spending half a year on the framework and the main proj, I finally started to get time to start working off-hours. But, I don't want to lose both the skills - My teammate(when we were still in office ;) ) once told me that they worked on a project that started with python code, and then later added features using Java. And I am unable to find any helpful google searches(mostly showing Spring vs Django).
How should I go about it? Is it too much to ask for? Is it worthwhile? Will I learn some new concepts of application architecture a noob like me would have missed. Please provide me with some insight.
Are there resources(docs) I can go through?
P.S. I'm not a diehard fan of either of the frameworks right now, just another coder testing waters.
You can't write java in python.
You can extend Python with C/C++ which is quite common: Extending Python with C or C++
And about the part that they told that they added features with java:
It's common to create different parts of a project using different languages and tools. Microservice architecture is a common architecture for these kinds of use cases. You basically code different parts of the project in a language you want and then you connect all the parts using different methods like REST APIs, gRPC and etc.
Imagine you are creating a website like youtube that lets others upload videos. There is a form that users upload their files and you store them in your storage and then you have to encode the video file for different qualities. You can code the form handler using Python and Django to store the files in your storage. Then you can code another service using java that handles the encoding part which is a heavy process. When an upload is completed, you send the file or file path to your java service using an internal REST API and tell the service to start encoding the video and notify the Django service and then the Django service will publish the video on the feed that can itself be written in another language.
I would say go for 1 framework and stick with it. For example Django if you want to code in python, and spring if you want to code in java. Learning both frameworks however brings a lot of value, because you can compare their benefits (eg. spring forces you to write clean code, django has build-in and simpler database management)
I like Django's build-in tooling a lot, you only need to know python for it to work. Spring requires a bit more knowledge of eg. hibernate for database management. However I predict Django will outgrow spring at some point, because of cloud valuing fast iteration over code and quick startup time (auto-scaling apps) over large overhead apps and long boot times. Hoever, if you like java, I can recommend JHipster for java/spring webapp development to get up to speed very fast and learning the ways of REST CRUD api fast.
To combine 2 programs: write your main logic in one app, and write a small service in the second language, making sure its independent of the first app (no back and forth communication and complicated logic, but simple independent request/response, as if the main app was never there). Add a REST api to the second app and use eg. http requests to communicate.
What's possible in terms of combining languages:
connect different applications with each other: by letting them communicate through their APIs. For example a python api developed with flask or django can send requests to a java api developed with spring, as long as they have a way to communicate (eg over http, or via some queue like rabbitmq)
connect a webapp to 2 different backends: by using a shared authentication system: For example a keycloak authentication server to handle tokens, that your backend applications know about.
What's not possible (and also not preferable):
combining java with python code in the same program: there are some hacky ways to get it to work, but its asking for trouble and not readable.
I have built a java program that does very simple reading, storing, and processing of server side data that it receives from some electronic sensors. This information now needs to be put onto a webpage.
Some calculations need to be done server side so I want to keep the Processing done in java rather than an interpretative language like javascript or python.
Anyway How do I get the information from the java program up onto a website using a java web application? I am a little unfamiliar with JSP and Servlets though they aren't too complicated I do not know how to get my current working program to work with those and print out the server side information.
It doesn't need to be anything fancy this is just a simple program to do some real time remote monitoring over the web of some electronics.
I do know and understand HTML as well so i do know how to work with those.
You can use tomcat+spring, here is link to a tutorial that teaches you how to create a RESTful webservice https://spring.io/guides/gs/rest-service/
What you'll need to do is basically mapping the http requests to some functions that will call your functions in your original program.
I am about to start developing a private TODO website (that later will be extended to Web applications). I am unsure what framework to use. I have read about GWT and PHP frameworks such as Yii. What advantages do each one have over another.
Background
- experience in Java
- got an apache web host that supports php
Doubts:
Would developing in GWT mean that refactoring would be easier than developing in PHP (especially since you can use Eclipse)
seems like PHP frameworks such as Yii design objects for you once you create database layout ... can this be done with GWT?
Thanks!
One big difference I haven't seen mentioned in the question or answers/comments is that Yii is a server-side framework, which runs entirely on your own/hosted server, whereas GWT compiles to JavaScript, and is therefore runs in the client's browser only. These two offerings (and ideas) serve very different purposes, and can be used together.
When using GWT to build the client, the server can be built using any tool desired, so long as it exposes data to the JS-based client. That can be in the form of JSON or XML, or some other data encoding (GWT's built in RPC, for example, can pass complex object graphs to and from a Java servlet container).
If you were to use them together, Yii could be used to create PHP objects from the database schema/layout, and to build the various rules for authentication/authorization so the client can read and write data. GWT could then be used to build a client which reads and updates that data, making calls to services exposed by Yii/PHP code.
If you like Eclipse you can certainly stay with Eclipse and still develop in PHP. The PHP tools from eclipse.org are very good and the IDE plugin from Aptana is even better.
Regarding Yii vs GWT, it really depends on your language of choice. If you are highly proficient in Java and really like the strong typing of the Java language then GWT is a good choice (although there are certainly other choices that keep you in the Java world such as Tapestry). PHP frameworks vary quite widely in how much they embrace OOP and concepts such as creating your business objects based on your database. Yii definitely stands out as a framework due to the code generation capabilities built in. That will definitely help you if you're getting started with PHP.
I want to create an application that submits same/similar data to sites containing web forms. These sites use PHP scripts...
I have a php script with me, that submits data in the manner that i require, to such forms. What I want to do is, design an entire web app around this code... I tried to obtain equivalent java code that does what the php code is doing, but could not obtain such code...
Since Google App Engine supports Quercus framework for PHP, what I am thinking now is, use the PHP code for actual submission of forms to their actions, and rest of application (that tracks all submissions and does other stuff like login/logout...) is in Java.
This would require some method by which I can pass the relevant form parameters from Java code to the PHP script, then some way for the php script to return the response of each submission back to the java code.
Is such an application doable? Pls keep in mind that I want to use Google App Engine for this purpose.
Nowadays it is possible to use different languages in different modules of the same app.
See Using both Java and Python with the new "Module" feature on AppEngine?
It should be doable with Quercus. We deploy a Python app that has some Java/Clojure backend processors but both languages are "native" to GAE. Using PHP will be a serious pain and not worth it all. I suggest that you just learn Python you will master it faster than using Quercus on GAE.
If you also go after PHP you stick to your LAMP knowledge. I suggest thay you do now!
Disclaimer: I wanted to use JRuby on AppEngine but I had a lot of difficulties (plus you have to know how everything works optimally on GAE) so I took up Python
Is it possible to build a Java web application which has a PHP front end ?
I want all my web pages to be coded in PHP. Most of them will be forms.
I want all the data submitted by a form to go to a Java Code.
I want to do all manipulation in back end and all rendering of web content on the front end.
This is just a general question as I was probing for different options for my java web application.
You might also want to take a look at php-java bridge
A web application, by definition is already a frontend (or at least includes it).
If you meant a PHP webapp built on top of a Java backend, sure, that's possible. If you use SOAP or REST for communication between the layers, it's actually relatively easy. The only drawback compared to a pure Java (or pure PHP) app would be the overhead of those protocols, so you have to be careful to avoid too fine-grained service interfaces.
It depends on where the two meet. You could have, for example, have Java backend and PHP frontend communicating via web services. I however see no benefit in such a combination.
You can use Quercus, a Java implementation of PHP, to run PHP from within Java (and thus have easy access to Java classes).
According to your edition, it looks like you don't need PHP at all. You confused it with HTML.
Yes. You can build a java web-application which has php front end.
it is possible even with C++ backend. but why?