Q: How do I access my virtual server?

1) Using Ssh
Windows

SSHSecureShell https://owncloud.stat.ubc.ca/index.php/s/JDRoPRAeWrUHIZH
or Putty
http://www.chiark.greenend.org.uk/~sgtatham/putty/

Mac/Linux
Open a Terminal and type
ssh stat.ubc.ca -l {your login name without these parentheses}

Save your working data on
/usr/local/data/username

If you don't have the data folder ready, Email our IT help group

2) Using screen and Xpra
https://www.stat.ubc.ca/Computing/FAQ/Answer/faq.php?faq=798&category=23

Q: What is my VM specs and softwares and how do I use it?

I) Virtual server specs:
RHEL6 64 bit OS.
initially has min 4 CPUs, 8Gb of RAM and
40Gb NFS mount of storage with 7 days local disk snapshot only.
You should use StatNet home directory as your main storage for better backup.
At anytime your project needs to have more CPU/Ram, email help at stat with brief
a explanation of why you need more resources.

Host: v{your_login_name}.stat.ubc.ca

Login/Passwd are the same as your StatNet
After you login, your VM will NOT mount your StatNet Home directory.
This is because we want you to understand how sshfs mounting work.
We created a sshfs script in "/usr/local/bin/statfiles"

II) Software installed:
 Matlab
 Maple
 Atlas
 Sage
 Octave
 Blas
 Lapack
 Numpy
 R statistics
 Spicy
 Xppaut
 Xrpa/Screen for running app nohup remotely.
 Opensource development tools

Screen
http://www.gnu.org/software/screen/
Xpra
http://xpra.org/
http://winswitch.org/
 

Q: emacs

General Note (by Jenny Bryan): Everything like this has a learning curve, but, for all of the above, the ultimate benefits make this painful phase worth enduring.

External Resources


AUCTeX: editing LaTeX files in Emacs

AUCTeX is an Emacs package that makes editing LaTeX documents so much easier. It has been installed and configured on StatNet servers (as of November 1, 2005). However, if you want to use it on your own computer, you'll need to download the package and install it yourself (it doesn't come with Emacs by default).

When emacs opens a file with a .tex extension, the additional menus are named LaTeX and Command

  • From the LaTeX menu you can select many environments without typing them (e.g. begin{enumerate} ... end{enumerate}). There are also convenient shortcuts to make typing mouse-free and even faster (e.g. C-c C-e to insernt an environment).
  • From the Command menu, you can run the latex, xdvi and pdflatex programs, etc, and do a spell check that ignores latex commands. Shortcuts are also available and are, in fact, quite smart: it only takes a couple of rounds of C-c C-c to compile the file and open the result in xdvi.

This tip is provided by Harry Joe. Seconded by Mike Danilov.

ESS: Emacs Speaks Statistics

ESS a GNU Emacs and XEmacs mode for interactive statistical programming and data analysis. It is particulary good for R and S-PLUS. It has been installed and configured on StatNet servers (as of November 1, 2005) but you'll need to install it yourself if you want to use it on your own computer.

ESS can be used to save/edit interactive sessions in Splus and R (as well as SAS, stata and other statistical packages).

  1. To start R in emacs, type: Alt-X R (assuming Alt is your Meta key).
  2. Within the R command prompt, hit Alt-P to access previous R commands and Alt-N to access next R commands (which can then be edited); the list of previous commands is cyclic, so the first hit of Alt-N will lead to the first command of your present session. Note: in a properly configured environment Shift-UpArrow and Shift-DownArrow work as well.
  3. Requesting help on a function will bring the help documentation in a split screen, so that you can copy and paste the examples to run etc
  4. There is function name completion with TAB (similar to command/filename completion in the bash shell)
  5. more details about ESS, consult the help ess info within emacs (Crtl-h m, when in ESS)

This tip is provided by Harry Joe. Seconded by Jenny Bryan and Mike Danilov.

UltraTex and Lightning Completion

The UltraTex and Lightning Completion packages (play very nicely with AucTeX) will also really speed up writing LaTeX and will make it virtually impossible to have mismatched parentheses, opened/closed environments, references to non-existent figures/table/sections, etc. (and many other maddening mistakes).

This tip is provided by Jenny Bryan.

Go to Top

Q: Regular expressions: examples illustrating common uses

Most common regular expressions

[0-9] digit
[a-z] lower case letter
[A-Z] upper case letter
[0-9a-zA-Z] digit or letter
[ ] space
[ t] space or tab
[^0-9a-zA-Z] not digit or letter
[0-9][a-z] digit followed by letter
[0-9]{3,5} (vi, grep, emacs) 3 to 5 digits in a sequence
[0-9]{3,5} (perl) 3 to 5 digits in a sequence
[ ]+ (vi, grep) one of more spaces in a sequence
[ ]+ (emacs/viper, perl) one of more spaces in a sequence
. any symbol but n (end of line)
z.{2}o (grep, vi, emacs) z followed by 2 chars followed by o
^ beginning of line
$ end of line
^[ ]*$ line with zero or more spaces and nothing else (vi, perl, grep, emacs)
^$ empty line
^[^0-9a-zA-Z t] line beginning with non-digit,letter,space
[0-9][0-9]/[0-9][0-9]/[0-9]{4} (vi, emacs, grep) mm/dd/yyyy date format
(vim) word beginning with doc
bdoc (perl, emacs/viper, grep) word beginning with doc
ment> (vim) word ending with ment
mentb (perl, emacs/viper, grep) word ending with ment

Using regular expressions

GREP USAGE

put regexp in quotes, e.g. grep "^[ ]*$" files

VI USAGE

for search use / or ? followed by regexp, for replacement, use something like :10,35s/regexp1/regexp2/g where the two numbers indicate the line range; this also works in 'sed' (stream editing/batch mode of vi), and no line range for sed means all lines (i.e, :1,$ )

EMACS USAGE

ESC C-r or ESC C-s for searching for regexp M-x replace-regexp for replacement of regexp1 with regexp2

Complex regexp editing may be best done from sed or perl scripts.

Summary of perl regular expressions (from a perl book)

/abc/ matches 'abc' anywhere in string
/^abc/ matches 'abc' at beginning of string
/abc$/ matches 'abc' at end of string
/a|b/ matches 'a' or 'b'
/ab{2,4}c/ matches 'a' followed by 2-4 'b's followed by 'c'
/ab*c/ matches 'a' followed by 0 or more 'b's followed by 'c'
/ab+c/ matches 'a' followed by 1 or more 'b's followed by 'c'
/ab?c/ matches 'a' followed by 0-1 'b's followed by 'c'
/./ matches any character except 'n'
/[abc]/ matches any of the characters within []
/[^abc]/ matches a character not within [^]
/(abc)/ matches 'abc' anywhere in string, parentheses as a memory, storing 'abc' in the variables ,,, etc e.g. /name=(.*)&user=1/
/abc/i matches 'abc' ignoring case
/d/ or /[0-9]/ matches a digit
/w/ or /[a-zA-Z0-9_]/ matches a character classified as a word
/s/ or /[ rtnf]/ matches a character classified as whitespace
/b/ matches a word boundary or a backspace
/D/ or /[^0-9]/ matches a character that is not a digit
/W/ or /[^a-zA-Z0-9_]/ matches a character that is not a word
/S/ or /[^ rtnf]/ matches a character that is not whitespace
/helloB/ requires that there is not word boundary (after hello)
/*/ matches *

Submitted by Harry Joe, 2006-04-21

Q: Where are the informal computing seminars from 2000?

Note: to untar a file, type tar -xvf (filename)

   UNIX Tools and VI: 

[TXT] UsingVi.txt             20-Jan-2000 14:48     3k  

[TXT] UsingViEnh.txt          20-Jan-2000 14:48     5k  
[TXT] Using_at_.txt           20-Jan-2000 14:48     2k  
[TXT] Using_grep_.txt         20-Jan-2000 14:48     1k  
[TXT] Using_tar_.txt          20-Jan-2000 14:48     1k  
[TXT] ViFAQ.txt               20-Jan-2000 14:48     2k  
[   ] atdemo.s                20-Jan-2000 14:48     1k  
[   ] atdemoscript            20-Jan-2000 14:48     1k  
[   ] example.dat             20-Jan-2000 14:48     2k  
[   ] format.pl               20-Jan-2000 14:48     1k  
[   ] list.tex                20-Jan-2000 14:48     2k  
[   ] mailscript              20-Jan-2000 14:48     1k  
[   ] mailscript1             20-Jan-2000 14:48     1k  
[   ] seminar.tar             20-Jan-2000 16:54    75k  
[   ] students                20-Jan-2000 14:48    38k  
[   ] table2html.pl           20-Jan-2000 14:48     1k  
[   ] table2tex.pl            20-Jan-2000 14:48     1k  
 

#README #Informal Computing Seminar - January 20, 2000 UsingVi.txt How to Use VI UsingViEnh.txt How to Use some of VIM's features (and Harry's Perl scripts) Using_at_.txt Using at - a process scheduler Using_grep_.txt Using grep - a pattern matcher Using_tar_.txt Using tar - a file packager ViFAQ.txt FAQ for VI atdemo.s File Used for demo of at atdemoscript File Used for demo of at example.dat Data file for illustration format.pl Harry's Perl script to format text list.tex An example TeX file mailscript File Used for demo of at mailscript1 File Used for demo of at students An example file for grep table2html.pl Harry's Perl script to convert table to HTML table2tex.pl Harry's Perl script to convert table to TEX

Speaker: Mark Robinson

Date:        January 20, 2000

   C stuff

Speaker: Mark Robinson

Date:        June 1, 2000

Q: KWord and AbiWord

KWord is used to open, edit, and print Microsoft Word document in Linux (e.g. Pascal, Fisher and Pearson server in the department install Linux system.).

To open a Microsoft Word document, type

kword filename.doc&

The interface of the KWord is quite similar to Microsoft Word.

It seems that the KWord could not save files as Microsoft Word document.

For more information, check the KWord webpage.

AbiWord is a Word processor which "will run on virtually any operating system". You can open, edit, and print Microsoft Word document by using AbiWord. It's simple and fast.

To open a Microsoft Word document by AbiWord, type

abiword filename.doc&

For more information, check the AbiWord webpage.

Q: OpenOffice.org

OpenOffice.org is a multi-platform open source office productivity suite. It includes the key desktop applications, such as a word processor, spreadsheet, presentation manager, and drawing program, with a user interface and feature set similar to other office suites. It has an ability to import documents in Microsoft formats such as *.doc or *.xls.

OpenOffice exists as ooffice on pearson on StatNet and as soffice on newton on StatNet

The components of the suite are called:

WRITER

text processor which can serve as a substitute for MS Word. The command file is normally called oowriter.

CALC

spreadsheet to substitute MS Excel. Command file: oocalc.

IMPRESS

presentation suite to take place of MS PowerPoint. Command file: ooimpress.

DRAW

image and diagrams editor. Command file: oodraw.

OpenOffice.org can also export text documents (such as imported from MSWord) and presentations (e.g. converted from MS PowerPoint) into PDF documents.

OpenOffice.org is being installed by default on most modern distributions of Linux and Solaris. However, it is available for Windows as well.

In StatNet, it is available on pascal server but cannot be used due to insufficient CPU speed and other resources (as of August 2004). It can also be run on undergraduate server ugrad.

Q: KSpread and Gnumeric (spreadsheet)

KSpread and Gnumeric can read Microsoft Excel files. The interface and the operation (e.g. short-cut key) of KSpread and Gnumeric are similar to those of Microsoft Excel. KSpread cannot save files as Microsoft Excel file format. Gnumeric can save files as Microsoft Excel (95) file format. Gnumeric can not read Microsoft Excel files which are created by higher version of Microsoft Excel than Microsoft Excel 95.

To open Microsoft Excel files, type

kspread filename.xls& or gnumeric filename.xls&

For more information, check webpages of

KSpread

and

Gnumeric

.

Pages