Wednesday, April 20, 2011

How to add a new metric to ZMERT

1. you need to download ZMERT from its official homepage:
http://www.cs.jhu.edu/~ozaidan/zmert/

2. decompress the zip file that you just downloaded:
unzip zmert_v1.50.zip

3. you can find the jar file (zmert.jar) in the ./lib directory

4. extract zmert.jar content by using command:
jar xf zmert.jar

5. following the video: http://www.youtube.com/watch?v=Yr56pD8bTUc&fmt=18
to add new metric java file

6. after adding the new metric java source file, you need to recompile the java files:
javac *.java

7. the last step is to create a new version of zmert.jar by typing:
jar cvfM zmert.jar *.java* *.class

Tuesday, April 12, 2011

Python Repeatable Timer Example

def hello():
print "hello, world"
global t
t = Timer(3.0, hello)
t.start()

t = Timer(3.0, hello)
t.start() # after 3 seconds, "hello, world" will be printed

Sunday, February 20, 2011

VIM keyboard shotcuts

vim file +54
open file and go to line 54 any : command can be run using + on command line

vim -O file1 file2

open file1 and file2 side by side


:qa close all windows add trailing ! to force

undo/redo
u undo
Ctrl+r redo
. repeat

navigation
gg Goto start of file
G Goto end of file

search/replace
/regexp searches forwards for regexp ? reverses direction
n repeat previous search N reverses direction
* searches forward for word under cursor # reverses direction
:%s/1/2/gc search for regexp 1 and replace with 2 in file c = confirm change
:s/1/2/g search for regexp 1 and replace with 2 in (visual) selection
:%s/
^[\ \t]*\n//g # replace all the empty lines
:5,12s/foo/bar/g # changes each 'foo' to 'bar' for all lines between line 5 and line 12.
:.,$s/foo/bar/g # changes each 'foo' to 'bar' for all lines between the current line (.) and the last line ($).

windows

:e set buffer for current window you can optionally specify a new file or existing buffer number (#3 for e.g.). Note if you specify a directory a file browser is started. E.g. :e . will start the browser in the current directory (which can be changed with the :cd command).
:sp new window above ditto
:vs new window to left ditto
:q close current window
:qa close all windows add trailing ! to force
Ctrl+w {left,right,up,down} move to window
Ctrl+w Ctrl+w toggle window focus
Ctrl+w = autosize windows to new terminal size for e.g.
:ba new window for all buffers ":vert ba" tiles windows vertically

Tuesday, January 4, 2011

How to setup NUS SoC VPN on MAC OS

This is supported on Mac OS X 10.5 (Leopard) and 10.6 (Snow Leopard), on Intel platforms, only.

Installation and setup:

1. Download and install the most current non-beta version of Tunnelblick from http://code.google.com/p/tunnelblick/wiki/DownloadsEntry?tm=2.
2. Run Tunnelblick once, select "OPENVPN configuration file". Exit the text editor that is automatically opened. Exit tunnelblick. The Tunnelblick application support folder will be created in your home directory.
3. Configure OpenVPN with SoC-VPN connection profiles:
3.1. Download the SoC-VPN configuration file: http://download.comp.nus.edu.sg/download/socvpn.conf or http://download.comp.nus.edu.sg/download/socvpn-staff.conf (for SoC staff only)
3.2. Download the certificate file: http://download.comp.nus.edu.sg/download/ca.txt
3.3. Save the downloaded files socvpn.conf and/or socvpn-staff.conf, and ca.txt, into ~/Library/Application Support/Tunnelblick/Configurations.

Connect to SoC-VPN:

1. Launch Tunnelblick. Tunnelblick icon appears in the menu bar (top right of your screen).
2. Click on "Connect 'socvpn'" or "Connect 'socvpn-staff'" to connect to the VPN.
3. Enter your NUSNET userid (e.g. nusstu\g0123456) and password when prompted.
4. When the VPN connection has been established, your browser will launch and load a webpage with the message "Welcome to SoC-VPN". You are now securely connected to SoC-VPN.

To disconnect from SoC-VPN:

1. Right-click on the OpenVPN icon in the menu bar.
2. Click on Disconnect.
3. You're now disconnected from SoC-VPN.


Note that this page is following https://docs.comp.nus.edu.sg/node/2454

How to connect to Windows Remote Desktop on the MAC OS

1. there is an official Windows Remote Desktop client for MAC OS:
http://www.apple.com/downloads/macosx/networking_security/remotedesktopconnectionclient.html



Some notes:
1. Microsoft also provides many good applications for MAC, some of which are free:
http://www.microsoft.com/mac/downloads
2. if you are a NUS SoC student and you may also want to use the SoC VPN to connect to the PC in your office: please refer to http://wangpidong.blogspot.com/2011/01/how-to-setup-nus-soc-vpn-on-mac-os.html

Tuesday, December 21, 2010

How to run a command in the background on Windows

There is a command, whose name is START, on Windows, and you can use it to start another command in a new command window. The option /B allows you to run a command without extra command window.

Monday, December 20, 2010

How to disable Windows auto restart after update

1. click the Start button.
2. Once the menu pulls up we can click on "Run", and if you do not have "Run" in your start menu, you can use the keyboard shortcut "Win + r" to open the "Run" window.
3. Now you should have a field to type in, let's type "gpedit.msc" and hit enter.
4. Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update -> No auto-restart for scheduled Automatic Updates Installations
5. Double click it and set it as enabled.
6. Now close the window, and a reboot is necessary for the policy to take effect.