User Tools

Site Tools


blog

Compile OpenBLAS for R on Windows

  1. Install MinGW using the installer: http://sourceforge.net/projects/mingw/files/latest/download?source=files Make sure install MSYS
  2. Install wget within MinGW: mingw-get install msys-wget
  3. Compile it using make
2013/02/05 16:09 · johnny · 0 Comments · 0 Linkbacks

LyX customized reference list

This can be used for APA style references in LyX of not want to use the bib file.

The following procedure can be used to create a list of references for your own style.

  1. Add a layout in Document – Settings – Local Layout with the following
        Style List
    Margin                Static
    LatexType             Item_Environment
    LatexName             reflist
    NextNoIndent          1
    LeftMargin            MMN
    LabelSep              xx
    ItemSep               0.2
    TopSep                0.7
    BottomSep             0.7
    ParSep                0.3
    Align                 Block
    AlignPossible         Block, Left
    LabelType             Itemize
    End
        
  2. In the Latex Preamble, add the following
    \newenvironment{reflist}{ 
    \begin{list}{}{\leftmargin=1em \itemindent=-1em}
    }{
    \end{list}
    }
2013/02/01 15:51 · johnny · 0 Comments · 0 Linkbacks

Install OpenBUGS 3.0.7 on Linux server

The following instructions were tested on Red Hat Enterprise Linux Server release 5.4 (Tikanga), Kernel version 2.6.18-164.11.1.el5. Could work for other linux releases.

Installation

The new version of OpenBUGS (v.3.0.7) can be run on Linux machine very easily. To install it on a linux machine, following these steps (adapted from openbugs.info)

  • Create a directory named OpenBUGS307 and create two sub-directories within it: bin and lib.
  • Download the shared library libOpenBUGS.so to the lib directory.
  • Download the bash shell script, OpenBUGS, to the bin directory.
  • Download the compiled C program, OpenBUGSCli to the bin directory.
  • Change the permission of OpenBUGS and OpenBUGSCli using
    chmod 755 OpenBUGS OpenBUGSCli

Use OpenBUGS

To use the interactive OpenBUGS, in the prompt, type the following and return (in the folder of bin)

./OpenBUGS

Below is an example to run OpenBUGS interactively using the Rats example:

$ ./OpenBUGS
OpenBUGS version 3.0.7 rev 397
type 'modelQuit()' to quit
OpenBUGS> modelCheck("model.txt")
model is syntactically correct
OpenBUGS> modelData("data.txt")
data loaded
OpenBUGS> modelCompile()
model compiled
OpenBUGS> modelInits("init.txt")
model is initialized
OpenBUGS> modelUpdate(1000)
1000 updates took 0 s
OpenBUGS> samplesSet("alpha0")
monitor set
OpenBUGS> samplesSet("beta.c")
monitor set
OpenBUGS> samplesSet("sigma")
monitor set
OpenBUGS> modelUpdate(10000)
10000 updates took 0 s
OpenBUGS> samplesStats("alpha0")
                         mean      sd        MC_error  val2.5pc  median    val97.5pc start     sample
 alpha0                  106.6     3.669     0.04221   99.41     106.6     113.6     1001      10000
OpenBUGS> samplesStats("*")
                         mean      sd        MC_error  val2.5pc  median    val97.5pc start     sample
 alpha0                  106.6     3.669     0.04221   99.41     106.6     113.6     1001      10000
 beta.c                  6.186     0.1091    0.001411  5.972     6.187     6.398     1001      10000
 sigma                   6.097     0.468     0.007489  5.263     6.07      7.106     1001      10000
OpenBUGS> samplesCoda('*', 'codafilename')
OpenBUGS> modelQuit()

To run OpenBUGS in batch format, one can save all the scripts in a file such as script.txt and then issue the command at the prompt

./OpenBUGS script.txt

Instructions for executing OpenBUGS can be obtained by typing

./OpenBUGS -h

Below is a list of related files used in the example

2010/03/17 22:05 · 1 Comment · 0 Linkbacks

Subfigures in LyX

This is an example form LyX website for using subfigures in LyX. I changed it a little to include multiple figures on multiple rows and columns.

The LyX file can be downloaded at example.lyx

The figure used can be downloaded at platypus.eps

The output looks like example.pdf

2010/02/02 17:56 · 0 Comments · 0 Linkbacks

Install and Use Subversion (svn) and ViewVC on Ubuntu

Install Subversion with Web Access on Ubuntu

  1. To install subversion, open a terminal and run the following command:
    sudo apt-get install subversion libapache2-svn
  2. To create a folder for the subversion repository in /svn, use
    sudo svnadmin create /svn
  3. Edit the configuration file for the subversion webdav module.
    sudo nano /etc/apache2/mods-enabled/dav_svn.conf


    The Location element in the configuration file dictates the root directory where subversion will be acessible from, for instance: http://128.143.XX.XX/svn
    In the file uncomment the following lines

    <Location /svn>
    
    DAV svn
    
    #The SVNPath line should be set to the same place 
    #your created the repository with the svnadmin command.
    
    # Set this to the path to your repository
    SVNParentPath /svn
    
    # Uncomment the following 3 lines to enable Basic Authentication
    AuthType Basic
    AuthName “Subversion Repository”
    AuthUserFile /etc/apache2/dav_svn.passwd
    Require valid-user ## add this line
  4. To create a user on the repository, use the following command:
    sudo htpasswd -cm /etc/apache2/dav_svn.passwd <username>


    Type in password when required.

  5. If the password file exists, use the following command:
    sudo htpasswd -m /etc/apache2/dav_svn.passwd <username>


    Type in password when required.

  6. Restart apache by running the following command:
    sudo /etc/init.d/apache2 restart
  7. Now if you go in your browser to http://128.143.XX.XX/svn. Input username and password created when required.

Use SVN

  1. Create a repos using
    $ svnadmin create /svn/repos1

    on the server

  2. In the local computer, check out the repos1 by using
    svn checkout http://128.143.XX.XX/svn/repos1
  3. Now add a new or update a file on the server
    1. Create a file
      nano test.txt
    2. Add it to repos1
      svn add test.txt
    3. Upload it to the sever to repos1
      svn commit test.txt -m "Initial readme file"

Install ViewVC on Ubuntu

  1. In the terminal
    sudo apt-get install viewvc
  2. Edit SVN configuration file
    sudo nano /etc/apache2/mods-enabled/dav_svn.conf

    Add the following line in the file

    ScriptAlias /viewvc /usr/lib/cgi-bin/viewvc.cgi

    at the end of the file

  3. Edit the file
    /etc/viewvc/viewvc.conf

    Change the root_parents to

    root_parents = /svn : svn
  4. Restart apache by running the following command:
    sudo /etc/init.d/apache2 restart
  5. Visit
    http://128.143.XX.XX/viewvc/viewvc.cgi

Access control for ViewVC

By default, anyone can access ViewVC. To control access using the rules for svn. Open the svn configure file using

sudo nano /etc/apache2/mods-enabled/dav_svn.conf

and add the following at the end

<Location /viewvc>                                        
 AuthType Basic
 AuthName "ViewSVN"
 AuthUserFile /etc/apache2/dav_svn.passwd
 Require valid-user
 </Location>

<< Newer entries | Older entries >>


Note. Everything on this blog only reflects my personal view which may or may not be true and is not related to any organization or institute.

blog.txt · Last modified: 2024/09/17 13:50 by johnny