Ubuntu 16.04 TLS Development Environment

Ubuntu 16.04 TLS is a good, stable OS. After install the Ubuntu Desktop system, a set of applications should be installed to get a nice programming environment.

1 Web development applications
A while ago I wrote an article “Web Development Tools for Ubuntu OS“. It introduced Geany for editing, Workbench for SQL, Meld for file comparison, and Google Chrome for web testing. These applications are still hold true for Ubuntu 16.04 TLS.

2. R programming environment
First, install R base. Execute the following command in a terminal window (CTL + ALT + T) to add the source url to the APT source list.

sudo echo “deb http://cran.rstudio.com/bin/linux/ubuntu xenial/” | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install r-base r-base-dev

Then, install RStudio. Use the “Ubuntu Software” to search for R Studio and install it. It is pretty straight forward.

After install R Studio, you can open it and check if it works.

3. Python programming environment

Install Spyder. Use the “Ubuntu Software” to search for “Spyder” and install it. It is pretty straight forward.


Tags: , , ,

PyCharm – The Python IDE crossing multiple platforms

Here is the declaration on the PyCharm site about it.

PyCharm is a dedicated Python and Django IDE providing a wide range of essential tools for Python developers, tightly integrated together to create a convenient environment for productive Python development and Web development.

It is available for Windows, macOS, and Linux. It can be downloaded from http://www.jetbrains.com/pycharm/download/.

I just start using it. I read some good comments about it from the internet.


Tags: , ,

Generate PowerPoint slides in R

A new R package “officer” makes generating PowerPoint slides in R much easier. It is newly developed and still has bugs. But there are ways to get around the bugs. I believe the developer of the package will fix bugs quickly.

First, you have to install the package before using it.


Second, use the examples in the GitHub site and other sites as the start point to create your own PowerPoint slide. I found this site (http://lenkiefer.com/2017/09/23/crafting-a-powerpoint-presentation-with-r/) is really useful.

Third, get around bugs. When I used it to automate the generation of PowerPoint slides, I found that all slides with images inserted did not work at all. After PowerPoint files were generated, they cannot be open correctly. Always popup error message and let you “repair” the presentations. I searched several hours and did not get any useful information. However, I visited “officer” package’s GitHub page and found a hit in bug submitting area. The reason popping up error message is a bug in the program. All image filenames cannot include “SPACE”, otherwise, you get error.

So, I went ahead and changed my program to make sure there is no “space”s in any image filenames. Waoh-lah, it works great.

Another useful point is the slide size. If you want to insert an image to occupy the whole 9:16 widescreen slide, you should use the following parameters:

left = 0.0
top = 0.0
width = 40.0/3.0
height = 7.

Use this set of parameters in ph_with_img_at function, you can guarantee inserted images take the whole slide.

Enjoying to use the package. Thank the developer sharing the wonderful art of work with us.


Tags: , , , ,

Using rsqlserver package in R

In R programming environment, you can conveniently connect to SQL Server through RSQLServer package. However, it is little bit tricky. Not like to way you connect MySQL server through RMySQL package. I searched RSQLServer on Google and tried to find a good example to connect to the SQL server. At the beginning, nothing worked. One time I read a post and used the method in the post. I was able to connect to the SQL Server. However, the connection opened a system database instead of the database I wanted to connect. Eventually I use R help command to learn how to use dbConnect function. That helps figuring out the correct method to connect to the right database on the SQL server.

1) Install the package: RSQLServer. Run command in R:


2) To use the package, you only need to use the following R command:


3) To connect to a specific database on a given SQL Server:

con < - dbConnect( RSQLServer::SQLServer(), server="localhost", database = "yourdatabasename", properties=list(user="yourusername", password="yourpassword") )

That should work well for you. You have to provide your SQL Server IP address, database name, your login information to the function.

One get get connected, to query the database table and manipulate data in the database, you can use all the functions available in DBI package. There is no more tricks.


Tags: , , ,

Conversion of list of dictionary and dataframe in Python

In Python there is a dataframe package: pandas. The dataframe package simplifies a lot of things and it is comparable to a dataframe in R. Sometime you need convert a list of dictionary to a dataframe and vice versa.

To use dataframe you need import pandas.

To convert a list of dictionary to a dataframe, use the following:


To convert a dataframe to a list of dictionary, use the following:



Tags: , , ,