JavaScript

First of all, while there is more or less one stable option for Java, there exist many different libraries for JavaScript and some of them don't interact very well with Docker. As such, I recommend using the socket.io-client client library to implement the socket client.

Docker actually allows you to address your components via the names of their containers. So instead of using localhost or other IP addresses to connect to your container, you should specify the name of the container, for example use the address ws://socketserver:4001 if the name of the container that hosts the server is socketserver and it runs on port 4001. Furthermore, in your docker-compose file, you should make sure that there are no conflicts between exposed ports, and that the relevant port on the server is exposed. After that, your components should be able to interact with each other without any issues.

OperatingSystem:

ProgrammingLanguage:

Websocket interactions in Docker

I am trying to get my Websocket server (Java) and client (JS) to interact with each other when they are both running in separate Docker containers. However, no matter what I do, I cannot get the client to even establish a connection to the server. What can be done here?

Efficient and user-friendly email entry field

I am working with React and want a system that allows users to enter multiple emails without too much overhead. The system should create new textboxes automatically as old ones are filled in, and delete text boxes in case they are empty. The users should also be able to paste a list of emails into a textbox, which would be properly parsed and split into multiple textboxes. Additionally, the entered addresses should be verified to make sure that they are valid on the client-side. What would be the best design for such a system?

Set up a development environment for Kotlin/React

I wish to develop web applications in Kotlin, since the type safety and the advanced features make the development experience a lot more pleasant. Kotlin can be compiled to Javascript and ran in the browser, but the current guide on how to do this is slightly outdated.

Important use cases are not tested

With a small change (styling, new fields) during the development lot of Use-Cases can crash. To avoid the high effort of the testing all the important cases, testing should be automated. Tools like Selenium provides an capture and replay mechanism. Build servers (Bamboo) can then be configured to start the test on if something gets merged into the master branch.

No logging of user behavior

When the application gets delivered to the client for the test production, there are usually exists bugs. The testing user creates BugTickets, with the necessary information‘s what was wrong during their test run. For lager workflows it‘s not possible to provide all the information‘s (selections, inputs) during their testing. It‘s necessary to provide a logging service to provide all the steps during the test. Kibana and Zipkin provides a tool to publish this huge amount of information.

Changed REST Endpoints

The problem occurs when separate teams needs to communicate over an REST Endpoint. When someone changes the endpoint and did not mentioned it, problems occur. Therefore it is necessary to use an SWAGGER API and publish all the endpoints and give warnings if changes occur.

Use the following javascript snippet to access the Users location.

var x = document.getElementById("pos"); function getLocation() {
if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation not enabled.";
} }

function processPosition(position) {
x.innerHTML = "Lat: " +
position.coords.latitude + "<br>Long: " +
position.coords.longitude;
}

By navigator.geolocation the user will be asked for permission to share the location. navigator.geolocation.getCurrentPosition(showPosition) retrieves the location and passes it to the callback function showposition. In the position.coords object lat and long can be accessed, displayed or sent to a server via REST.

OperatingSystem:

ProgrammingLanguage:

Accessing location in browser

I want to implement a location dependent web application, is there any way of getting access to the users location in the browser?

While constant monitoring and optimizing of the code is always a good idea, there is also a process called “Minification” to do so. During a project for a university course I had to use the service minifier.org to reduce the file size of my js- and css-files. It reduces unnecessary text, like comments or whitespaces from those files and even optimizes Javascript code according to common programming optimization patterns.

Pages

Subscribe to JavaScript