j4rs: JavaFX support (WIP)

Note: JavaFX support in j4rs is a work in progress. Adding features as the time passes and versioning evolves seems better than attempting to create full-feature JavaFX support for Rust. The latter feels rather difficult, frightening and time-demanding. Introduction Some time ago, I was exploring things that can be achieved by using j4rs and had the idea to implement a JavaFX GUI. This indeed happened, but the attempt included implementing some parts in Java and some in Rust, along with several hacks. [Read More]
rust  java  j4rs  javafx 

Hiding secrets in public view

Some time ago, I got intrigued by an article on the Register, finding out about the Baconian cipher. As cited in wikipedia: Bacon’s cipher is a method of message encoding devised by Francis Bacon in 1605. A message is concealed in the presentation of text, rather than its content. So I started writing some code, initially implementing Baconian cipher codecs, which encode text to As and Bs and decode it back to text. [Read More]

j4rs v0.12.0: Java to Rust direction

I would like to share a new direction that my j4rs project took after its 0.12.0 release. Until v0.12.0, j4rs provided to Rust applications the tools to achieve calls to the Java world. This included setting up and manage JVMs, instantiating Java Classes, making calls to Java methods, providing the means for Java to Rust callbacks etc. The project was following solely a Rust-first approach, giving the Rust applications the ability to take advantage of the huge amount of libraries and tools existing in the Java ecosystem. [Read More]
rust  java  j4rs 

Announcing j4rs

j4rs stands for “Java for Rust” and allows effortless calls to Java code, from Rust. Some time ago, on a need to call Java code from Rust, I started the j4rs project. The main idea was to implement a crate that would give the ability to its users to make calls to Java easily, so that they can benefit from the huge Java ecosystem. By “easily”, I mean: Taking care about the configuration required by JNI (e. [Read More]
rust  java  j4rs 

JavaFX UI in Rust

Dear reader, this post describes an approach that is outdated. You may be interested in this post instead. In this post, I would like to share the way how we can implement a Rust application that has a User Interface written in JavaFX. A brief description follows, but you may see the full code here. General description We will create a Rust application that: Creates a JVM Starts a JavaFX application Accepts callbacks from the Java world and prints them in the console. [Read More]
rust  javafx  j4rs 

Akka: To ask, or not to ask?

There are times that Akka Actors need to contact some other Actor, get the response and then continue their processing. It is debatable whether this is a good design or not. However, when designing Akka APIs to be used by different libraries/modules, it is a reality that someone may have to deal with - especially when many different teams collaborate with each other, so you don’t have access to others' code. [Read More]
scala  akka  ask  tell 

Scala: Use fold to serialize any number of Futures

Scala’s for-comprehensions are extremely useful and offer much more than just looping. For this post, I would like to focus on using for-comprehensions for manipulating Futures. More specifically, for serializing Futures. Let’s assume that we have a function that performs some kind of logic and returns a Future: def addOneAndPrint(num: Int): Future[Unit] = { Future { val addedOne = num + 1 print(addedOne + " ") } } Users of such a fuction, may want to call it more than one time and additionally, to call it serially. [Read More]
scala  for  fold 

A (kind-of) Dependency Injection in Scala

The problem While projects evolve, the lines of code increase and the dependencies between the classes are becoming more and more complicated. With the absence of some Dependency Injection (DI) framework/library, this ends up quickly in having to pass instances here and there through constructors of classes. The constructors may end up having something like 10+ arguments. To make things worse, for some cases, these arguments are not used by the logic of the classes themselves, but instead, they are just used to create subclasses! [Read More]

OSGi: Finding the way to JEE and JSF

Note: You may find the complete source code for this tutorial here. Combining the modularity offered by OSGi with the EE technologies may result to powerful, scalable and maintainable applications. Eclipse Virgo bridges OSGi and JEE worlds and provides a “completely module-based Java application server”. Even if the Virgo documentation provides detailed explanations, it seemed difficult to find tutorials that are functional and build up to a JEE Web application that is powered by OSGi bundles and services. [Read More]