Friday, September 20, 2013

Run Rserve on eclipse Example java code

assuming that you have R installed , bring up the R console by typing 
R on console (in context of linux) 
install.packages("Rserve")
library(Rserve)
Rserve()
Wait for final message at console as below
Rserv started in daemon mode.
import org.rosuda.JRI.Rengine;
import org.rosuda.REngine.REXPMismatchException;
import org.rosuda.REngine.REngineException;

class RServerHello {


Rengine rengi
import org.rosuda.REngine.Rserve.*; publi cne; // initialized in constructor or autowired

eption {
try {

RConnection c = new RConnect
public void helloRWorld() throws REXPMismatchEx cion();// make a new local connection on default port (6311)
org.rosuda.REngine.REXP x0 = c.eval("R.version.s
double d[] = c.eval("rnorm(10)").asDoubles(); tring"); System.out.println(x0.asString()); } catch (REngineException e) { //manipulation
new RServerHel
} } public static void main(String[] args) throws REXPMismatchException { RServerHello hwObj = lo(); hwObj.helloRWorld(); }
}
Download RserveEngine.jar and include that as an external jar at configure build path (Right click on your file at project explorer -> Build Path --> configure build path).
Your java code now should be free of all errors
Run!!!
It should just work

Tuesday, September 17, 2013

touchpad disabled after upgrading kernel to 3.4.0-030400-generic on Ubuntu 12.04 Dell Vostro-Solved

Recently i upgraded my kernel of Ubuntu 12.04 LTS from 3.2.xxx to 3.4 for some software installation , however found my Vostro Dell touchpad disabled and mouse non functional

Here are the commands which help me in getting back the control of touchpad
This command will reload the mouse driver

sudo modprobe -r psmouse
sudo modprobe psmouse proto=imps
Also this helps only to make it working in current session , to be able to have it working on every boot time as you would have already figured out , we need to add it to /etc/modprobe.d
Create a file like sudo vi mouse.conf
Add this as a content of file
options psmouse proto=imps
save it , hopefully you wont see the problem again , its like adding a service at stratup as per windows definition.

Manish