Q: How to format output of R?

You can use R command format. For example

round(0.10000, 3)



instead of


. To get correct format, we can use the following command

format(round(0.10000,3), nsmall=3, digits=3)

Note that the return value of the above command is a character string "0.100", not a numerical value.

Q: How do I get Firefox to run an external application on a particular file type?

A helper application is a program external to the browser that will open its own window or terminal to display results. A helper application is not the same ias a plugin. A plugin is loaded by the browser process data internally and render the results within the browser window (e.g. Acrobaty Reader plugin for PDF files).

This FAQ does not cover the installation of plugins; you have to go elsewhere for that.

If you want Firefox to autmatically use an external helper program to process files of a particular type (characterized by a filename extension or MIME type) whenever you click on a link to that file, these are the steps you can perform.

Manual Method

  • Step 1 (optional): backup your existing Firefox MIME database in case you screw it up. You can also delete the file and let Firefox rebuild it if things go wrong. cd ~/.mozilla/firefox/user-profile cp mimeTypes.rdf mimeTypes.rdf~ # Now you can edit this file ... vi mimeTypes.rdf
  • Step 2: add the MIME type to the list of helpers Firefox should handle. If the <RDF:Seq ... </RDF:Seq> tag already exists, only add the middle line. <RDF:Seq RDF:about="urn:mimetypes:root"> ... <RDF:li RDF:resource="urn:mimetype:application/testapp"/> </RDF:Seq>
  • Step 3: associate file extensions with this MIME type: <RDF:Description RDF:about="urn:mimetype:application/testapp" NC:editable="true" NC:value="application/testapp" NC:description="Description of MIME type"> <NC:fileExtensions>ext1</NC:fileExtensions> <NC:fileExtensions>ext2</NC:fileExtensions> ... <NC:handlerProp RDF:resource= "urn:mimetype:handler:application/testapp"/> </RDF:Description>
  • Step 4: inform Firefox this MIME type is automatically handled by an external application. <RDF:Description RDF:about="urn:mimetype:handler:application/testapp" NC:alwaysAsk="false" NC:useSystemDefault="false" NC:saveToDisk="false"> <NC:externalApplication RDF:resource= "urn:mimetype:externalApplication:application/testapp"/> </RDF:Description>
  • Step 5: inform Firefox which external application to use: <RDF:Description RDF:about="urn:mimetype:externalApplication:application/testapp" NC:path="executable" />

For steps 2 and onward, snippets should be placed before the final line


You should replace the example values above with your particular values. For example, to view postscript files using ghostview (gv), you would replace

  • application/testapp with application/postscript.
  • ext1 with ps. Optionally, you could also replace ext1 with eps for excapsulated postscript, or you can leave that out.
  • executable with gv or /usr/local/bin/gv.
  • Description of MIME type with PostScript file.

Plugin Method

A much easier way, if you have the ability to install Firefox plugins, may be to install the MimeEdit plugin, which gives the user the ability to associate MIME types with application that can operate on them using a GUI. It can be found here

Q: How can I access the AMS MathSciNet publication database from home/off-campus?

From within the campus, the AMS MathSciNet publication database can be accessed directly at


Due to the fact that this database is a paid service via a subscription fee, direct access is only available from campus networks. However you can access MathSciNet from off-campus (e.g. ADSL connection from home) by proxying your request through the UBC Library system. You must have a valid library card to validate your request. The instructions on how to accomplish this are here:

Q: How do I handle complaints from Firefox/Netscape that another browser is running?

A browser will usually check to see if another instance of itself is running, and will refuse to start (or use your regular profile) if it believes that this is the case. It does this to ensure consistency of its database (bookmarks, browsing history, etc.) which it can't guarantee if another browser is modifying the same data it is reading from or writing to.

A browser will check that it is not stepping on its own toes by checking the existence of a lock file. A lock file is created whenever a browser starts to run to warn other potential instances of itself not to start running.

However, problems may arise if the original instance of the browser crashes or ends abnormally, and does not get the chance to remove the lock file. The lock file is located at

Firefox: ~/.mozilla/firefox/<profile-directory>/lock Netscape: ~/.netscape/lock

These file are symbolic links (not regular files) that will point to the host and process-id that created the lock file. You can glean this information by doing

ls -l <lockfile> Example output: lrwxrwxrwx 1 smith wesson 18 Jan 12 15:54 lock ->

If you cannot run a browser because of this exclusivity constraint, first make sure that there really isn't another instance running on another terminal or hiding on your desktop. You can also check to see that it really doesn't exist by logging on to the host the lock file claims the browser it is running on and doing

ssh -l smith ps -p 21321

If this process exists, you can either find where it is displaying to and stop it, or you can kill it by doing

kill 21321

If the process does nto exist, or the lock file is still there, you can now remove it:

rm <lockfile>

Try starting your browser now. If you still can't start it up, Email the IT staff.

Q: How to use Xpra and Screen to run an GUI application in background and log out?
Provided that xpra and screen already installed on the server.
On the server side:
1. Start a new screen session:
        screen -S NewScreenSessionName
2. Start an xpra server using a four digit display number:
        xpra start :FourDigitNumber
3. Start firefox running inside the xpra server:
       DISPLAY=:FourDigitNumber firefox &
4. Detach from the current screen session:
       Ctrl + a + d
5. If you want to re-attach to the screen session, run "screen -ls" to list all of the current screen session(s) and then
    run: "screen -r FullScreenSessionName" to re-attach to the screen. 
6. To terminate a screen session, type:
7. To stop the xpra server on the display number:
        xpra stop :FourDigitNumber

On a Windows or Linux client:
1. Ensure that xpra is installed.  If not, go to xpra.org to download the package and install it.
2. Use ssh to attach a Linux client to the xpra server which has firefox running:
        xpra attach ssh:YourUserName@ServerName:FourDigitNumber
   (If  you run into any perl error, just run the command again and the GUI of the remote application will be open)
3. For a Windows client, open the xpra application and fill in the required fields to attach to the xpra server.
Q: Do you have anti-virus software that I can download and use free of charge?

Updated Jan 2010
For Home use: Windows XP/7/Vista, Login using  account with Administrator privilege
Remove Sophos first.


Download and install Microsoft software.

Yes. UBC ITServices has purchased a software license for the Sophos AntiVirus software. All students, staff and faculty can download a copy and use it. Versions can be found for all flavous of Windows (95/98/Me/NT/2000/XP/2003) as well as most flavours of MacOSX (8/9/OSX/OSX 10.2 and above).

In order to download the installation kit, you first have to create a Campus Wide Login (CWL) account that verifies that you are an eligible member of the University. This can be done by going to this page and following the registration instructions to create a CWL account:


Remember the account details since you can use this CWL account in the future for other University web application that uses CWL or for downloading another copy for another machine.

When you have created the CWL account, you can then go to the UBC Software Download website and go through the procedure to download your copy of the Sophos AntiVirus software. The download site is here:


Installation instruction ought to be included but another set of installation and usage instructions can be found here:

Q: How do I get Firefox to use xpdf as my PDF reader

There are various problems associated with Adobe's PDF plugin for browsers (nppdf.so). Benign problems are the inability to print or produce printable Postscript files. More serious problems are crashing or an unwillingness to deal with different document versions.

xpdf is generally more robust. If you are on a UNIX/linux system then in $(HOME)/.mailcap, include a line with

  application/pdf; xpdf -q %s

The advantage of this approach is the 'xpdf' is the viewer for all browsers (firefox, mozilla, lynx etc) and email software (mutt, pine, thunderbird etc).

If you are using a different environment, then to configure firefox to use xpdf instead of the Acrobat plugin,

  1. Let Firefox show you plugins:
    • Type "about:config" in the URL window.
    • Look for the browser.download.hide_plugins_without_extensions option.
    • Right-click over true and toggle this value to false.
  2. Disable plugin and use xpdf instead:
    • Go to the Edit / Preferences / Downloads / View and Edit Actions menu.
    • Double-click the application/pdf file type.
    • A window will pop up asking how to handle PDF files: select Open them with this application.
    • Another file chooser window will pop up: enter /usr/local/bin/xpdf into the filename field, then click Open.
    • This will bring you back to the previous window: press OK here.
    • This will bring you back to first menu: click Close here.
  3. You are done: test by going to a clicking onto a PDF link.
Q: TexnicCenter setup configuration

When you start TeXnicCenter, it will start to run the configuration:
   - Configuration Wizard - Welcome
        Click [next]

   - Configuration wizard - Distribution Directory      C:\Program
Files\MiKTeX 2.7\miktex\bin
        click [next]

   - Configuration Wizard - PostScripts-Viewer
        leave everything blank and just click [Next]

   - Configuration Wizard - Finish
        click [finish] to finish

Q: How do I get bold math in foils?
  • For math symbols in the running text, you can use bm{} command.


    ...$bm{y_{ij}}$ is the response... The bm macro is different from the mathbf command in that it emboldens everything including symbols.
  • For math symbols in the equation or eqnarray environment, use a pair of environments: begin{boldequation} formula end{boldequation} begin{boldequation*} formula end{boldequation*} The unstarred form has automatic referencing and is numbered, while the starred form has no automatic referencing and numbering.