Monday, June 9, 2014

New Documentation for RCaller

As a new documentation and brief introduction, the research paper "RCaller: A Software Library for Calling R from Java" has just been published in the scholarly journal "British Journal of Mathematics and Computer Science".

The aim and the motivation underlying this paper is to give a brief introduction to RCaller, how to use it in relatively small projects by means of calling R scripts and commands from Java, generating plots and images, running commands online and converting and sending plain Java objects to R.

Other two important projects, rJava and Rserve, are compared to RCaller by means of time efficiency. As a result of this, it is shown that, rJava and Rserve outperforms the RCaller in time complexity, but RCaller seems to be easier to learn and requires less setting-up effort.

The paper is freely available for downloading at

 http://www.sciencedomain.org/abstract.php?iid=550&id=6&aid=4838#.U5VvkPl_t2M

and the author's page is

http://mhsatman.com/research-paper-rcaller-a-software-library-for-calling-r-from-java/ .

Have a nice read!






Thursday, May 15, 2014

New Release: RCaller 2.3.0

New version of RCaller has just been uploaded in the Google Drive repository.

The new version includes basic bug fixes, new test files and speed enhancements.

XML file structure is now smaller in size and this makes RCaller a little bit faster than the older versions.

The most important issue in this release is the method

public int[] getDimensions(String name)

which reports the dimensions of a given object with 'name'. Here is an example:

int n = 21;
        int m = 23;
        double[][] data = new double[n][m];
        for (int i=0;i<data.length;i++){
            for (int j=0;j<data[0].length;j++){
                data[i][j] = Math.random();
            }
        }
        RCaller caller = new RCaller();
        Globals.detect_current_rscript();
        caller.setRscriptExecutable(Globals.Rscript_current);
       
        RCode code = new RCode();
        code.addDoubleMatrix("x", data);
        caller.setRCode(code);
       
        caller.runAndReturnResult("x");
       
        int[] mydim = caller.getParser().getDimensions("x");
       
        Assert.assertEquals(n, mydim[0]);
        Assert.assertEquals(m, mydim[1]);

In the code above, a matrix with dimensions 21 and 23 is passed to R and got back to Java. The variable mydim holds the number of rows and columns and they are as expected as 21 and 23.

Please use the download link

https://drive.google.com/?tab=mo&authuser=0#folders/0B-sn_YiTiFLGZUt6d3gteVdjTGM

to access compiled jar files of RCaller.

Good luck!

Wednesday, April 23, 2014

Only Numeric Values ​​in Form Fields With JavaScript

Hi everyone! 

We use form fields almost in every web project. This fields often are different. For example, password field's type is password, text's type textfield. If you want users to sign up, you should develop e-mail fields on it. so, you have to confirm values of e-mail fields. In this article, we will create a textfield for only numeric values.
First, we create HTML form:

input name="" type="text" onChange="isNumeric(this)"

The code given above is a textfield in the HTML file. As you have seen, there is a onChange function, isNumeric. Let's do this JavaScript function:
function isNumeric(v) {
    var isNum = /^[0-9-'.']*$/;
    if (!isNum.test(v.value)) {
        alert('Only Numeric Values Dude!');
        v.value = v.value.replace(/[^0-9-'.']/g,"");
    }
}

When you run this page, you will see an alert on the screen if you write some string values.

Tuesday, April 22, 2014

Word Cloud Generation Using Google Webmaster Tools Data and R

In this blog entry, we generate a word cloud graphics of our blog, stdioe, using the keyword data in Google Webmaster Tools. In webmaster tools site, when you follow

Google Index -> Content keyword

you get the keywords with their frequencies. This data set can be saved in csv format using the button "Download this table".

The csv data for our blog was like this:


One can load this file and generate a word cloud graphics using R, and our code is shown below:


require("wordcloud")
 
mydata <- read.csv("data.csv", sep=";", header=TRUE)
 
png("stdioe_cloud.png",width=1024, height=768)
wordcloud(words=mydata$Keyword, freq=mydata$Occurrences,scale=c(10,1))
dev.off()


The generated output is:




Here is the stdioe's search query keywords cloud:




Monday, April 21, 2014

How to Install and Use The TinyMCE Editor

Hi! TinyMCE is an advanced text editor for web project. It looks like Microsoft Office Word tools. Additionally The TinyMCE is the most popular advanced text editor in the world. In this article, we are going to download this editor and do an example.
You can download it from the official web site. Recent version 4.0.21: TinyMCE. If you want to try online how to work on this, you can see this page: Try Online
After downloading, just create a form.html HTML file given below and work on any internet browser:
We try on it and:
We can set editor preferences up. What we need is tinymce.init. For example, let's set width and height of the textarea element:
tinymce.init({
    width: 800,
    height: 500,
    selector: "textarea"
 });
I advise you to use TinyMCE like this:
tinymce.init({
    width: 800,
    height: 500,
    selector: "textarea",
    theme: "modern",
    plugins: [
        "advlist autolink lists link image charmap print preview hr anchor pagebreak",
        "searchreplace wordcount visualblocks visualchars code fullscreen",
        "insertdatetime media nonbreaking save table contextmenu directionality",
        "emoticons template paste textcolor moxiemanager"
    ],
    toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    toolbar2: "print preview media | forecolor backcolor emoticons | sizeselect | bold italic | fontselect |  fontsizeselect",
    image_advtab: true,
});