Monday, April 21, 2014

Matrix Inversion with RCaller 2.2

Here is the example of passing a double[][] matrix from Java to R, making R calculate the inverse of this matrix and handling the result in Java. Note that code is current for 2.2 version of RCaller.


RCaller caller = new RCaller(); 
Globals.detect_current_rscript(); 
caller.setRscriptExecutable(Globals.Rscript_current); 

RCode code = new RCode(); 
double[][] matrix = new double[][]{{6, 4}, {9, 8}};

code.addDoubleMatrix("x", matrix); 
code.addRCode("s<-solve font="" x="">); 

caller.setRCode(code); 

caller.runAndReturnResult("s"); 

double[][] inverse = caller.getParser().getAsDoubleMatrix("s"
                                       matrix.length, matrix[0].length); 
        
for (int i = 0; i < inverse.length; i++) {
    for (int j = 0; j < inverse[0].length; j++) {
        System.out.print( inverse[i][j] + " ");
    System.out.println();
} 
 

Fuzuli for Java Online Interpreter

JFuzuli, Java version of Fuzuli interpreter, is now the main implementation of Fuzuli Programming Language. There is always a gossip on the efficiency of C and C++ over Java and people who starts to writing computer programs are encouraged to make a decision between them but not the Java. However, when you don't do things correctly, C and C++ are the worst programming languages in means of efficiency. Allocating memory and garbage collection are important issues and should be handled by user or other third party libraries but not by the language itself. As not being a computer scientist, my both C++ and Java codes include algorithmic errors and my Java codes run faster than the code written in C++. I can confess that is my fault! But it is not false to say that a big portion of programmers does not either write the correct code and their C++ code does not reach its maximum efficiency. Finally, our Java implementation is faster than the C++ version.

Lets try our online interpreter! Fuzuli is a little bit Lisp, Scheme, C and Java! Try it, learn it and join the development team. The link for the online interpreter is http://fuzuliproject.org/index.php?node=tryonline

The screenshot of the online algorithm is given below.


Sunday, April 20, 2014

Hello world application with Google Dart


Google Dart

Dart is a new programming language developed by Google, which has a similar syntax with Java and Javascript. Dart is targeted directly for the web, however, console based applications can also be written as well as it is compilable into Javascript. Google's web browser Chromium is able to run Dart codes directly but there is not an available add-on for other browsers such as Firefox and Internet Explorer. Dart SDK supports compiling Dart to Javascript, that is, any browser will run Dart code without knowing that the original code is written Dart. The community will determine whether the language will be a standard for web based application, instead using Javascript.

In this blog entry, we will show writing a basic Dart Web Application which can be considered as a "Hello World" but it is a little bit complicated. This application will create a textbox and a button. When user writes her name and after clicks the button, the program pop ups a message box.

When a new application is created in Dart Editor, you will see something like this:



Lets change the html file. Put a textbox and command button:



Clear the Dart Code:



Fill main method. Here we handle the input element using variable name. name.onclick.listen method defines
the event handler.



Complete the code


In the screen capture above, name and say are global variables and they are defined at the top of the code. They are accessable in both main() and button_click(). The body of the method button_click() is such like its counterparts written in both Java or Javascript. Lets run the code:




Have a nice read!


Thursday, April 17, 2014

Beautiful Graphics of Flightgear 3

Here is the some screen captures of my last flight on Flightgear 3.0.
Flightgear is an open source flight simulator game which is mainly compiled for Windows, Linux and Macintosh. It is free and avaliable for downloading at site Flightgear Official Web Site




























Saturday, April 12, 2014

RCaller 2.2.0 has just been released

We have just uploaded the new compiled jar file of latest Rcaller, the simple library for calling R from within Java.

We plan to clean recently reported bugs, but the most important one was having some errors about the R package Runiversal, which is required by the library for generating XML files. The basic issue underlying this problem was the package storing policy of R which depends on the user that installed the package.

In the most recent version 2.2, users do not need to pre-install the R package Runiversal. Simply add RCaller-2.2.0-SNAPSHOT.jar to your classpath and go!

The download link of the compiled library is here [Google Driver Link]

The library is tested in a pc with Ubuntu OS installed and the usual test scenarios are success in all cases. The library has not been tested on Windows machines. 

Please use the link of Google code page at http://code.google.com/p/rcaller/issues/list and enter your problems in issues part and do not hesitate to contribute our library.