2013年2月24日 星期日

R plot png file on centos

Problem:
 When you run R on in primary centOS server, you didn't use the png. It will appear some error "Error in X11...unable to start device PNG".  "
"unable to open connection to X11 display "


Solution:
Install the package
{code}
>yum install libpng-devel.x86_64
{code}

{code}
R
# To avoid the x11 warning
Sys.setenv("DISPLAY"=":0.0")
{code}




Reference:
Install libpng package
Check the png Capabilities of R
R with x11 setting





2013年2月21日 星期四

R package install method

Currently, I only try the local method

For example install HSAUR: A Handbook of Statistical Analyses Using R package

1. Download the package from the cran HSAUR_1.3-0.tar.gz
2. R
>install.packages(file_name_and_path, repos = NULL, type="source")


Reference: How to install R package 
the possible method from network 

2013年2月18日 星期一

2013年1月9日 星期三

linux grep color setting


1. Solution
alias grep_gray="GREP_COLOR='1;30' grep --color=always"
alias grep_red="GREP_COLOR='1;31' grep --color=always"
alias grep_green="GREP_COLOR='1;32' grep --color=always"
alias grep_yellow="GREP_COLOR='1;33' grep --color=always"
alias grep_blue="GREP_COLOR='1;34' grep --color=always"
alias grep_magenta="GREP_COLOR='1;35' grep --color=always"
alias grep_cyan="GREP_COLOR='1;36' grep --color=always"

2. Example
echo hello there | grep_magenta ll | grep_yellow ere
hello there



Reference:
detail
linux color tutorial

2013年1月8日 星期二

Centos linux etc system config

1. Introduction
This is the nerve center of your system, it contains all system related configuration files in here or in its sub-directories. A "configuration file" is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary. For this reason, it's a good idea to backup this directory regularly. It will definitely save you a lot of re-configuration later if you re-install or lose your current installation. Normally, no binaries should be or are located here. [detail]



2. Category
[Network]
Firewall:  /etc/sysconfig/iptables , service iptable restart
DNS server: /etc/resolv.conf


[File System]
Files system: /etc/fstab, mount -a
Auto mount: /etc/auto.mnt, /etc/auto.master, service autofs restart



2012年12月23日 星期日

Javascript detect browser type

1. Problem:
Sometimes there are different present in the different browser, especially in IE and firefox-like. In this we should get the browser type and do the different method


2. Solution
/* To get the browser type */
function detectIsIEBrowser(){
    var isIE = false;
    var val = navigator.userAgent.toLowerCase();
   
    if(val.indexOf("msie") > -1) {
        isIE = true;
    }
    return isIE;
   
}




Reference
Basic
Advance_PPK