Tag Archives: Ubuntu

MySQL demo with Matlab C Java in Ubuntu Linux source files

Here are the instructions to

C: http://zetcode.com/db/mysqlc/

Java: http://quantlabs.net/blog/2015/09/java-instructions-for-mysql-and-ubuntu-linux/

Netbeans project file: TestIBTWS.tar

C files: mysql-connector-java-5.1.36.tar

Code for Matlab:

>> conn = database(‘testdb’,’root’,’Hello123_’,’/home/caustic/DB_Drivers/mysql-connector-java-5.1.36-bin.jar’,’jdbc:mysql://localhost/testdb’);

query=’select * from Cars’;

x=fetch(conn,query)

 

How to install R with RCpp RInside for C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

How to install R with RCpp RInside for  C++ HFT with multithreading capabilities for parallelizing with Open MPI in Ubuntu Linux

To get RCpp and RInside running in your Ubuntu Linux environment

Install RStudio to manage the installation of your R packages which is the lazy person’s way of doing it.  Also, ensure you have the latest R version by doing:

http://quantlabs.net/r-blog/2012/10/how-to-upgrade-to-the-latest-r-package-in-your-ubuntu-linux-environment/

In RStudio, install RCpp and RInside. Download the latest version of RInside for C++ from (under Download section)

http://dirk.eddelbuettel.com/code/rinside.html

Once the tarball is expanded in your Linux environment, navigate to the examples standard to make all the examples. Again, you will need the RCpp and RInside R packages available for the build process. Other R packages may be needed as your run the many examples.

To run the RInside examples with the OPen MPI for parallelizing examples, install Open MPI following apt-get instructions at:

http://cs.ucsb.edu/~hnielsen/cs140/openmpi-install.html

The navigate to the RInside example mpi and do a make. Run the samples and watch your jaw drop on the potential of R and C++ for HFT in a multithreaded environment.

 

 

 

Youtube video: Proper steps to integrate MongoDB NOSQL database with R on Ubuntu Linux with RStudio

Youtube video: Proper steps to integrate MongoDB NOSQL database with R on Ubuntu Linux with RStudio

Why NOSQL?

When comparing other RDMS including Oracle, MySQL or DB/2 against NOSQL, I was one of those old geezers who thought they were another ‘go fast nowhere’ technology trend.

Boy, was I wrong! I looked at all the options including HBase/Hadoop, Cassandra, Redis, and MongoDB. I found Hbase and Hadoop were difficult to install. The R packages for these were useless as there were few installation documents. Cassandra was easy but the the client support for R either didn’t exist or didn’t work with the RCassandra package. Redis looked awesome and is still one of the best for R thanks to the doRedis R package. The Java examples to shard looked promising too.

Then I revisited everything and came across MongoDB. It seems to have all the advantages of Cassandra and Redis with decent R package support.

NOSQL options and R

After looking at all the options, my recommended NOSQL databases is Redis or MongoDB. It was easy to install Redis but tricky with MongoDB. My recommendation is to install MongoDB with a clean current Ubuntu Linux Desktop version. All you need to do is type the following on the command line:

‘apt-get install mongo’

… and you’re ready to go. It takes care of all the permissions, users, etc. It was so easy that I could have saved a day’s work without going through the hoops I did. A lesson learned, and the time I lost is time you can save!

MongoDB install obstacles and tricks

Here are some current tricks to save you even more time:

Install Open JDK 6 not 7 as it will mess up the RJava install with R

If this happens, keep an eye out for a message that says something to the effect of checking your Linux Java environment. It will say you need to run as root, R CMD java or something similar. This message would be appear in your R console during the RJava package install. My problem came to Java 7 versus 6 which resolved it.

Create your MongoDB mydb data with:

http://www.mongodb.org/display/DOCS/Tutorial
http://pseudofish.com/blog/2011/05/25/analysis-of-data-with-mongodb-and-r/

Once installed, you should be able to do the following within your R shell or RStudio:
for RMongo:

> library(“RMongo”)

Loading required package: RUnit

> mongo <- mongoDbConnect(“mydb”)
> dbShowCollections(mongo)
[1] “system.indexes” “things”
> results <- dbGetQuery(mongo, “nutrient_metadatas”, “{}”, 0, 2)
> results <- dbGetQuery(mongo, “things”, “{}”, 0, 2)
> names(results)
[1] “X_id” “name”
> dbDisconnect(mongo)

[youtube_sc url=”http://www.youtube.com/watch?v=DbhdKBx-lK0″ playlist=”How to, Integrate, MongoDB ,NOSQL, database ,R , Ubuntu, Linux, RStudio ” title=”How%20to%20Integrate%20MongoDB%20NOSQL%20database%20with%20R%20on%20Ubuntu%20Linux%20with%20RStudio%20″]