Unfortunately for this question, I can't really post my "Attempt" at solving this issue, because I'm not sure what the issue is to begin with, here recently I've been developing a small networking wrapper for gaming servers, me and a few friends have been testing it using C#/Java clients and it's been working out great; However I decided that I wanted to try something new and mess with the (Sortof) new HTML5. I've seen examples of games that are written in HTML5 and look absolutely amazing, an example of this would be the Runescape browser based game which has an HTML5 version. More information here.
I'm only interested in working with 2D games, however I thought that instead of using a Java Applet (Like I used to) I could learn how to do things in HTML5 and have a true web-based application. The problem isn't so much learning HTML5 as it is understanding its networking.
Currently for my server I'm using Netty, which is a Java NIO framework, however I've been studying and sources claim that HTML can't connect directly to a standard TCP socket and instead require a WebSocket. I did some searching into netty for a websocket and it seems supported, information located here.
My only question, in which I can't find any information on is sending the data in a manner that the server will be able to read it. I'm using the DataInputStream class to read data on the server side, which requires special encoding to create "Blocks" of networked data, as-well as some customized encoding for primitive data-types, and a custom encoding for UTF data-types. I wrote my own output stream for our C# client API, however with HTML I'm at a complete loss.
I can't find any information about sending data, or customizing the data sent into blocks, or anything. C# made it really simple with the use of it's BinaryWriter class, but with HTML5 I'm just at a complete lack of resources to learn from, or my google-fu really needs to be worked on.
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.
In my Java Application, I need to create an RTMP (or RTSP) livestream server and feed raw RGB image data to it.
I'd like to use the Red5 Server project, as it is available via Maven and the Apache 2.0 license fits my needs.
However, I haven't found any introduction tutorials on how to start and feed a livestream server from within a standalone Java Application. I have already added the dependency to my project, and can access all of Red5's classes.
Can you point me to any resources that help me getting started? The task I'm trying to accomplish seems pretty basic to me.
With Red5 you have the control to handle the "input" in any means you want, from a servlet that accepts octet-streams, to pretty much anything else you can think up. So if your input is RGB data, implement something that accepts your byte arrays (like a servlet) and then convert it into one of the Flash supported video codecs, such as h.264; you can use ffmpeg or jcodec to do this. Lastly, you'll want to package the now encoded data into FLV format, that's more difficult, but there are non-red5 examples of how to do this on the net, google for it. Once you have it in the FLV format, create a broadcast stream and dispatch the VideoData to it. Sounds simple right? Its not, but if you are a proficient in Java and / or C/C++, you should be fine.
I'm trying to develop a server/client software which binary and string data should be transmitted over the internet from a Java server to an Android client and vise versa.
I've tried using Java and Android sockets but it's getting very complicated.
Are there any alternative classes/libraries which can help me?
You could go with RestFul services. They are supposed to be simple and supported on any platform which supports HTTP.. i.e. almost every platform out there. Unless you are looking for really high performance, I would recommend against sockets (suitable only for specialized scenarios, given several other choices of technologies today).
I have started java not that long ago, and I was wondering, if I want to make a GUI, and then I want the gui to display some data, I can't have mysql connection in that gui, it's a very big security exploit, therefore I've thought about making a java server that receives packets, and sends back data.
I know PHP HTTP callbacks are the best for this, but I really want to get into the server/networking in java.
Is there any library that offers such thing? Tutorials?
Use Grizzly, Mina, or Netty. Here's Sun's sockets tutorial if you want to learn from the ground up. Grizzly and Mina use Java NIO which is confusing to a beginner. Might want to start with the tutorial.
Out of the 3 frameworks I suggested, I've only used Netty for a project. I read Netty was lower level, and had more speed 6 months ago. It worked well for me.
We are building a Flash application for client use but will need to do server side processing of images. All our expertise and application code is in Java, but I've been told Dot Net has better Flash support. This is general but we will be modifying large (up to 50MB) image files. The idea is that what we could do in Flash should be duplicated, automated and extended on the server side.
I've never heard before that .Net server technology has better Flash support than Java. In fact, RED5 (an open source Media server for Flash) is implemented in Java.
As for capabilities, Both .Net and Java will be more than capable of duplicate and extend the same image processing done in Flash, and both have libraries and services that support AMF in case you require it.
Flash is pretty much server-agnostic anyways, so unless you get more specific reasons I think you should go with whichever language you are more comfortable with (which seems to be Java)