Personal tools
You are here: Home FAQ How to ...

How to ...

by Kuiyu Chang last modified Aug 25, 2008 04:42 PM

Technical stuff

Show or hide the answer Branch & Merge using svn
  1. Creating a branch (to svn, a branch is just a copy):
      svn copy https://svn.mosuma.com/r9999/proj/A/trunk https://svn.mosuma.com/r9999/proj/A/branches/newbranch
    
  2. Checkout branch:
      svn co https://svn.mosuma.com/r9999/proj/A/branches/newbranch newbranch
    
  3. Change Directory to local branch, work on it:
      cd newbranch
    
  4. Merge newbranch back into trunk. First see what has changed since branching:
      cd newbranch
      svn log --stop-on-copy
    

Note the starting (when branch was created),e.g. 341, and ending revision numbers, e.g. 405

  1. Check out trunk (target for merge):
      cd ..
      svn co https://svn.mosuma.com/r9999/proj/A/trunk projA
      cd projA
      svn merge -r 341:405 https://svn.mosuma.com/proj/A/branches/newbranch
    
  2. Check status, examine changes, compile, test, etc.:
      svn status
    
  3. Commit Merge:
      svn commit -m "Merged newbranch changes r341:405 into trunk"
    

See SVN Book on Branching"

Show or hide the answer Merge conflicting files in svn
  • If conflict detected after "svn update"
    • affected file e.g. affectedfile, will have conflict markers >>>>>>> inserted inline
    • 3 special files, in addition to affectedfile will be created
      1. affectedfile.mine
        • Your local working copy before svn update
      2. affectedfile.r{oldrevision}
        • Base version before you modified your local working copy
      3. affectedfile.r{latestrevision}
        • Latest version received from SVN repository
  • To resolve conflict, do one of the following:
    1. Edit affectedfile manually, noting the conflict markers >>>>>>>>>> and referencing the 3 special files, or
    2. If you local copy is simply out-of-date, copy one of the 3 special files over to affectedfile, and/or delete out-of-date ones amongst the 3.
  • Tell svn that you have resolved the conflict:
      svn resolved affectedfile
    
  • Commit your changes:
      svn commit
    
Show or hide the answer Install PostgreSQL & pgAdmin

PostgreSQL has more SQL (SQL99) features than mySQL, and a more liberal license (see comparison) If your project needs to talk to a heavyweight DBMS, consider PostgreSQL.

  • Under Linux simply install the appropriate deb/rpm packages
  • Under windows, you could first install cygwin, then use cygwin setup tool to install the postgresql packages
  • Highly recommended: install one of the many GUI clients such as the open source pgAdmin (works for windows, linux, mac, etc.)
  • To access postgresql database from python, install PyGreSQL
    • On linux, simply install the pygresql package
    • On cygwin, you need to download openssl source, then modify your setup.py to include /usr/src/openssl/include, and install using distutils:
        python setup.py install
      
  • An underused feature of PostgreSQL is its ability to define functions in just about any language you like. Java, Perl, Python, TCL, among others, as well as PL/PGSQL. This is done using the plpython module that comes with postgresql. See example.
  • You are strongly recommended to use pgAdmin to access your postgresql db, using the psql terminal is too unproductive. To allow remote access to your postgresql instance, you need to add the following line to your /etc/postgresql/{versionnumber}/main/pg_hba.conf settings file and restart postgresql by typing as root /etc/init.d/postgresql restart. Any changes to pg_hba.conf will require a restart for the change to take place:
      host      all  all  155.69.140.125      255.255.255.255          trust
                          ^ replace 155.69.140.125 with your pgAdmin client IP address
    
  • To debug DB connections, you should do a listing of the file:
        tail /etc/postgresql/{versionnumber}/main/log/
    
Show or hide the answer Check in/out src/dat/doc using Subversion (svn)

Install SVN

  1. Download & install SVN client.
  2. Configure SVN. Important if your web-access is censored by a http proxy.
  3. cd to local drive path:
        cd ~/mylocalcopy
    
  4. List what is available in the repository (also viewable through a browser at the same URL or via the trac interface):
       svn list https://svn.mosuma.com/r4000/
    

Checking out a subdirectory

  1. Checkout a specify part of the repository to your local path using your research.mosuma.com userid:
    • for normal projects (small development):
            svn checkout --username youruserid https://svn.mosuma.com/r4000/proj/{projname}
      
    • for larger projects with 3 special directories trunk, tags, branches:
           svn checkout --username youruserid https://svn.mosuma.com/r4000/proj/{projname}/trunk projname
      
    • Make sure you don't check out the project itself without specifying the trunk (if there is one). See svn book notes
      • trunk stores the main line of development work
      • tags stores frozen snapshots of your work
      • branches is for different forks/variations of your development, usually when another person wants to branch/fork off from your work (not usually required here, except for mega projects). See faq entry on branching and merging
  2. Make changes to your local copy by adding/deleting/modifying files. You can check the status of your local files viz-a-viz the repository by:
         svn status
    
  3. For each new file you added/deleted, tell the repository, anywhere within your checked out local copy, do e.g:
       svn add newfile
       svn add *
       svn del oldfile
    
  4. Do an update:
       svn update
    
  5. Update the repository by committing your changes to it:
        svn -m "type some log information here" commit
    

Without Checking out you can ...

  • directly import a local directory into svn, use:
         svn -m "direct importing some stuff" import path_to_local_directory https://svn.mosuma.com/r9999/dat/newly_created_directory
    
  • do direct operations on the repository by specifying the full URL:
         svn -m "making directory" mkdir http://svn.mosuma.com/r9999/newdirectory
    
  1. For more information, refer to
Show or hide the answer Install Subversion (svn) client
Windows
You are strongly encouraged to install the command line subversion client under cygwin (see below). Only when you are familiar with the basic svn commands should you consider using a GUI svn client such as TortoiseSVN (for windows). Google svn GUI (windows and java versions available, Eclipse comes with support for subversion).
Cygwin
Install cygwin under Windows. Then install the svn client using cygwin-setup. svn is not included by the default cygwin installation.
Unix/Linux
Install the svn package for your favorite Unix/Linux distribution. svn is not included by default in most distributions. For Ubuntu linux, install subversion client using ubuntu package manager, or the following commands (the sudo command first switches you to the root user):
    sudo bash
    apt-get install subversion
Configuration
Important: if your web-access is censored by a http proxy (e.g. within NTU), please read SVN configuration
Show or hide the answer Set up dynamic DNS

In order to have a fixed name resolved to your dynamic IP address from home, apply for one of the free dynamic DNS solutions, such as dyndns. You windows or linux computer will have to install a ddclient that will update the dyndns server periodically about it's current IP address. Your router (e.g. netgear, linksys) may also have built-in support for dyndns.

Some ISP's such as minOnline block common port addresses, but not higher ports (>1023), so you should be able to run a Zope/Plone server on ports higher than 1023.

Show or hide the answer Create Table of Contents, Index, Bibliography in OpenOffice

Linux Journal Article

Using Bibus with OO

Show or hide the answer Install Linux
  • I expect all my students (Kindergarten, Primary, Secondary, Junior College, Polytechnic, BS, MS, PhD) to use/learn Linux.
  • Distributions
    1. Ubuntu Linux, the best non-commerical variation of GNU/Linux or Debian. It is also very up-to-date, and will most likely support your hardware. A new release comes out every 6 months. There are 2 choices, Server or Desktop, I strongly recommend you install the Desktop version and check the Alternate Desktop box, which gives you a text-base instead of a GUI installer. The GUI installer runs quite slow from the CD. Not to worry, you will still get a GUI desktop if you install from the alternate desktop version. The Server is for headless non-GUI PCs.
    2. Debian (GNU/Linux) is the next best choice, but not as compatible and up-to-date as Ubuntu
    3. Fedora Core X is discouraged, as it is tied to Red Hat
    4. Gentoo is strongly discouraged, unless you are Linus Torvalds, because you would be wasting way too much time installing and maintaining it
    5. SuSe Linux. Neutral. I have not used it.
Show or hide the answer Connect to Linux remote desktop via VNC

You can maintain a virtual graphical desktop session on one of our KRG servers, i.e. you can logout and login the next day to find the exact same desktop (need VPN for connecting to NTU machines from outside) from anywhere in the world, with VNC installed.

ssh to the linux server:

  1. modify ~/.vnc/xstartup to include startup programs like xterm and window managers

  2. Start VNC server instance:

    vnc4server
    
  3. enter your password

  4. Check which port number (590x) vnc4server is running at by typing:

    ps aux |grep vnc
    
  5. logout from Server

On your local PC (windows,linux)

  1. Run the vnc4viewer GUI

  2. Enter the hostname/ipaddress of the linux server, followed by the port number, e.g.

    liubei.dyndns.org:5901

  3. Enter the same password you set in step 3

  4. Run a window manager such as twm, fvwm, wmaker, if you did not specify it propery in step 1 on the linux server.

Search online for more info on VNC (Virtual Network Computing).

Show or hide the answer Install software packages in Debian/Ubuntu Linux

Do not install packages from by compiling from source. It will take you a lot of effort. Instead, use the variety of package managers that comes with Ubuntu/Debian Linux to install more than 16000 software packages with just a few keystrokes using one of the following approaches:

apt-get

If you are feeling lucky, for quick and dirty installation, as root enter:

apt-get install {guess name of package you want to install}
dselect

If (you think) you are super smart, you can try running dselect from the command line as root:

dselect

dselect is a text based package selection/management software, that would serve you well even over slow remote Internet connection. However, you must excercise extreme patience in learning to use it, one mistaken keystroke could remove a bunch of essential system packages, leaving your system in an unuseable state. I have had that experience.

synaptics
If you have less time, run synaptics from the GUI.
GUI
If you are lazy, use the simplest way: In the Ubuntu desktop, click Applications -> Add/Remove Applications, you will be prompted to enter the root(or your) password (I can't remember, as I seldom use this approach). You might not be able to install all applications using this approach. If you can't find a package, click "Advanced" to bring up the Synaptics package manager.
Show or hide the answer Configure NTU Proxy in Linux

All outbound http (note that: https is not monitored) traffic from NTU are censored/monitored by an NTU proxy, you need to configure the proxy server as follows:

Console
  1. You need to set the http_proxy environment variable by typing:

    export http_proxy=http://proxy.ntu.edu.sg:8080
    
  2. Include the above line in your "~/.bashrc" startup file for automatic configuration

GUI
  1. Just go to your web browser to configure the automatic proxy

    http://www.ntu.edu.sg/proxy.pac
    
  2. Alternatively, you can specify a manual proxy:

    Proxy:http://proxy.ntu.edu.sg
    Port:8080
Show or hide the answer ssh without password

Follow this graphical guide here to use a public/private key and ssh-agent to remotely login to your Linux machine without typing or storing a password using putty (the most popular SSH client for non-Linux platforms) and Linux.

Show or hide the answer Create online Project Plan

All students should use the online pm tool to create a research plan.

  1. Go to "my folder"

  2. Select "add item" and "project manager". A new project manager will be created. Fill in name, title, description and body. Make sure "All projects on the site" is unchecked, otherwise you will encounter errors.

  3. Add Milestones to Project Manager

  4. DO NOT Add Todos to each Milestone

    • You aren't allowed to add it, anyway.
    • When you get down to advanced planning at the Todo level, you are over-planning. Just worry about major milestones and,
    • I will add the todos for you as during our weekly meetings
  5. In the Todos, you can search and add a member as participant of your project. Enter "zhangguiyu" to search for Kuiyu.

Each Milestone can have several Todos. You could create two Milestones, one each for the two semesters, and within each milestone, you can plan the details for each semester.

The good thing about using this to store you plan is you are always aware of your plan, and I can also check it online anytime. It is also relatively easy to update.

Show or hide the answer Browse SVN Repository

There are two options:

  1. Default SVN web interface
  2. Trac web interface

The Trac interface is signficantly more robust, and includes a wiki, latest check in activities, colored diffs between revisions, and line numbering, etc.

You will continue to use the CLT or GUI SVN client to check in/out stuff. But feel free to use the web interface to look at your files.

Show or hide the answer Set UTF-8 encoding in VIM for windows?

Edit your .vimrc settings file to include the following line:

set enc=utf-8

and you should be able to edit a UTF-8 file in Windows using gvim.

For Linux, just set the locale to utf-8 such as:

export LANG=en_SG.UTF-8
Show or hide the answer Connect to MS Exchange Server with Evolution?

Evolution is a free Micorsoft Outlook fat client replacement for Linux that talks to an Exchange server, NTU staff and students can configure it like so:

/fig/faq.img/evolution

Under "Receiving Options", you may set the Addressbook server name to

staff10.staff.main.ntu.edu.sg

in order for evolution to look up user names.

Show or hide the answer Switch URL of checked out svn copy?

If you prepare a scholarly article, it would be checked into svn as a subdirectory under "https://svn.mosuma.com/r4000/doc/papers/1draft".

When your paper undergoes a state transition, i.e. it is submitted, rejected, accepted (under revision) or published, I will move it to "https://svn.mosuma.com/r4000/doc/papers/2submitted", "https://svn.mosuma.com/r4000/doc/papers/3rejected", "https://svn.mosuma.com/r4000/doc/papers/4revised", "https://svn.mosuma.com/r4000/doc/papers/5published", respectively.

You do not need to check out a new copy of the paper when the source SVN URL changes, but you could instead issue the following command on your locally checked out copy:

cd {local_checked_out_directory}
svn switch new_svn_url

For example, you can switch to the URL of an accepted paper under revision by:

cd he2007sdm
svn switch https://svn.mosuma.com/r4000/doc/papers/4revised/he2007sdm

If you cannot understand this FAQ, the simplest thing is to delete your local checked out copy, and check out everything from the new svn URL.

Show or hide the answer Install java plugin for 64-bit Linux Firefox?

Not possible. Wasted 2 hours searching for one today.

Closed source java as of 2007.01.03 has no plugins for 64-bit Linux Mozilla.

64-bit Linux has been available for 3 years, and still no mozilla plugin. The management at Sun really demonstrated their incompetence on this one. Just check out the link below:

See bug that was opened in 2003

That is precisely the problem with closed source java.

I am glad that Sun is too behemoth to care about a 64-bit Linux java-plugin for firefox.

With opensource gaining acceptance, people will simply stop using Java, and compile everything from source.

ha ha ha, Sun will eventually be eclipsed by the Open Source Universe!

Show or hide the answer Configure Subversion (svn) through proxy

If your web-access is censored by a http proxy, e.g. your web browser requires a http proxy, add the following lines to '~/.subversion/servers':

 [groups]
 mosuma=svn.mosuma.com

 [mosuma]
 http-proxy-host=proxy.ntu.edu.sg
 http-proxy-port=8080

Show or hide the answer svn keyword
add self-updating SVN keyword inside source file
  1. Insert the following text fragment into the comment portion of your source file, e.g., mysourcefile.js
    // $Id$
  2. On the command line tell svn you are tagging your file with a keyword as follows:
    svn propset svn:keywords "Id" mysourcefile.js
  3. Commit the change to this file mysourcefile.js
    svn -m "any comments" commit mysourcefile.js

 

Viola! From now onwards, every time you check in this mysourcefile.js file, that field will be updated with the latest details.

 

 

 

See http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html

for more details

 

 

Document Actions
« January 2009 »
January
MoTuWeThFrSaSu
1234
567891011
12131415161718
19202122232425
262728293031