Monday, December 14, 2009

ubuntu karmic manager services

Use package:
 sysv-rc-conf

Or
update-rc.d -f cron remove

Or

Disabling Services using BUM


bum is a package

so  use
apt-get install bum


Sunday, December 13, 2009

Saturday, December 12, 2009

mac terminal color highlighting

Enabling directory and file color highlighting requires that the file ~/.bachrc, ~/.profile, or ~/.bash_profile to be changed:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

Wednesday, December 9, 2009

how to uninstall grub from linux

copied from somewhere. 

Using Linux

You can also use dd command from Linux itself (it removes partition table):
# dd if=/dev/null of=/dev/sdX bs=512 count=1

Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1

Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -l

Tuesday, November 24, 2009

a simple speed comparison of GSL and Rmath C libraries

Just use the functions in both libraries to generate normal random samples. 
It turns out that Rmath is faster for this simple computing.


build R on ubuntu

Both packages 'libxt-dev' and 'libx11-dev' or one of them are needed before building.


# apt-get insall libxt-dev libx11-dev
# configure
# make

Rmath example

The following is an example of code using stand alone R math library
and the compilation command.

/*
 *  C CODE
 */

#define MATHLIB_STANDALONE
#include <Rmath.h>
#include <stdio.h>
#include <stdlib.h>

int main(){
  int i;
  unsigned int SEED1, SEED2;
  double mu, sigma, PHI_X, *X;

  mu = 0;
  sigma = 1;
  SEED1 = 12345;
  SEED2 = 67890;
  set_seed(SEED1, SEED2);

  X = (double *) malloc(10 * sizeof(double));
  for(i = 0; i < 10; i++){
    X[i] = rnorm(mu, sigma);
    PHI_X = pnorm(X[i], mu, sigma, 1, 0);
    printf("X: %f, PHI(X): %f\n", X[i], PHI_X);
  }
  free(X);
}



/*
 * COMPILATION:  gcc -I/Users/local/lib64/R/include -L/Users/local/lib64 -lRmath -lm tmp2.c
 */

Thursday, November 19, 2009

tsc quit full screen on ubuntu

Re: How to exit Terminal Services fullscreen??

exit the full screen mode with Ctrl-Alt-Enter
annd close the window

Wednesday, November 18, 2009

ubuntu restart network (eth0 dhcp)

restart networking

/etc/init.d/networking restart

/etc/network/

# The primary network interface
auto eth0
iface eth0 inet dhcp
~

root@jqt-laptop:/etc/network# ls
if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.bak-0
root@jqt-laptop:/etc/network#
root@jqt-laptop:/etc/network#

Tuesday, November 10, 2009

latex eps automatically converted to pdf

Copied from http://robjhyndman.com/researchtips/converting-eps-to-pdf/

\documentclass{article}
\usepackage{graphicx,epstopdf}
\begin{document}
\includegraphics[width=\textwidth]{fig1}
\end{document}

Thursday, October 29, 2009

ubuntu packages needed for me

==
necessary
------------------
texlive-fonts-recommended
texlive-latex-recommended
subversion
vim-gnome
terminator


==
optional
---------------------------------
ubuntu-restricted-extras


Wednesday, October 28, 2009

C Man pages in UBUNTU

manpages-posix-dev - for c headers
manpages-dev - for c functions

Monday, October 26, 2009

VIM: block editing

Use CTRL+V to enter the block editing mode.
For editing something like tables, that is sweet.

Thursday, June 25, 2009

switch to debian

switched from ubuntu to Debian. Have to say that ubuntu is more end user friendly.
On debian,
I need to mount ntfs partition use
#mount -t ntfs-39 /dev/sda /mnt

And I need to use iceweasel, which is not support chinese by default,
I need to install a package.
# apt-get install iceweasel-l10n-zh-cn

Monday, June 22, 2009

modify debian console resolution

debian console resolution change


title        Debian GNU/Linux, kernel 2.6.26-2-amd64
root        (hd0,5)
kernel        /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda6 ro vga=0x303
initrd        /boot/initrd.img-2.6.26-2-amd64

http://en.wikipedia.org/wiki/VESA_BIOS_Extensions

mount ntfs partition in debian

mount ntfs in debian

#mount -t ntfs /dev/sda2  /mnt -o rw -o umask=000

Sunday, April 26, 2009

Thursday, March 12, 2009

R operators

x + y
x - y
x * y
x / y
x ^ y
x %% y
x %/% y

> 4 %% 2
[1] 0
> 4 %% 2
[1] 0
> 4 %/% 2
[1] 2
> 5 %/% 2
[1] 2

Saturday, March 7, 2009

r: clear screen

# An R function to clear the screen on RGui:
cls <- function() {
if (.Platform$GUI[1] != "Rgui")
return(invisible(FALSE))
if (!require(rcom, quietly = TRUE)) # Not shown any way!
stop("Package rcom is required for 'cls()'")
wsh <- comCreateObject("Wscript.Shell")
if (is.null(wsh)) {
return(invisible(FALSE))
} else {
comInvoke(wsh, "SendKeys", "\014")
return(invisible(TRUE))
}
}
cls() # test

from http://onertipaday.blogspot.com/2007/05/how-to-clear-screen-in-r.html,
cool!

Saturday, January 17, 2009

svnadmin --- create and load

svnadmin create my_repo
svnadmin load my_repo < my_dump_file