Archive for August, 2011

SVN is the centralized repository system that many developers should have been familiar with. Mercurial (Hg) is one of the latest distributed repository system that is gaining popularity, besides Bazaar and Git. TortoiseSVN and TortoiseHg are GUI tools to manage SVN and Hg respectively in windows. That said, this note would apply mostly to windows users.

I would demonstrate two options to the migration but the outcomes might not be the same and I would detail the difference of each.

spacer1) Using Convert extension

This method convert the whole SVN repository into a Hg repository. No worries, full history from the SVN will be copied and you will be working with your Hg repository as though nothing had changed. The Convert extension is installed by default in TortoiseHg, so you just have to enable it. To enable it, open the global settings of TortoiseHg, go to the extension tab, and put a tick beside the Convert extension.

Activate Convert ExtensionspacerspacerFor the next step, you have to use the command line. Suppose your repository is on your hard disk, you would type:

hg convert file:///path-to-svn-repo


or if it is on a server:

hg convert http://url-to-svn-repo

spacerSome additional options include:

svn.trunk – Relative path to the trunk (default: “trunk”)

svn.branches – Relative path to tree of branches (default: “branches”)

svn.tags -Relative path to tree of tags (default: “tags”)

svn.startrev -Start subversion revision (as of 963000ed8cac, > 0.9.5). Work for single branches conversions only.

spacerAnd you use it as follow:

hg --config convert.svn.trunk=whatsoever convert

spacerspacer2) Using HgSubversion

By using this method, the main repository of your project remains as an SVN repository, while you can use Hg to manage your personal addition or modification on your hard drive. You should choose HgSubversion over the Convert extension when you have no control over the main repository or when you simply couldn’t persuade others to change from SVN to Mercurial.

The method gives you a fully-functional distributed version control system, where you maintain a Hg repository on your local computer to commit your own modification before pushing them to the central SVN repository. You can also work the other way round, i.e. pull the changes from the SVN repository to your Hg repository. Push and Pull are two essential concepts in a distributed version control system, which involve moving changes from one repository to another in either direction.

Steps to use:

a) Install HgSubversion by cloning it.

hg clone C:/Users/Public/hgsubversion

spacerb) Configure Hg extension by editing the configuration file (usually %USER_HOME%/mercurial.ini). Add the following lines:

hgsubversion = C:/Users/Public/hgsubversion/hgsubversion

spacerc) Start cloning your SVN repository. For example:

hg clone gwt-hg

spacerd) Pull changes from the SVN repository as normal using hg pull.

e) Before pushing to the central SVN repository, you should use hg rebase –svn. Then hg push as normal to push the changes back to the SVN repository.


spacerYet, you might ask: Why should I migrate from SVN to Mercurial after all?

Firstly, SVN is simply sounds…outdated! SVN is a thing of the previous decade, and people in the open source world are switching to Mercurial or Git.

Using Mercurial encourages you to commit more, due to the flexibility of working with Hg remotely. Every user has a local repository, complete with project history and branches, etc. You can commit to this local repository even when not connected to the central repository. With more frequent commits, you avoid messing up with a large portion of unsaved work.

Compared to using only one central repository, you generally have more backups by using Mercurial. Every user holds a clone of the project’s repository. If your central repository is corrupted or lost, you may still recover the whole repository from every individual users.

So, finally…Should you decide on using Mercurial for your projects, below are some good tutorials to get you started:

Hg Init: a Mercurial tutorial by Joel Spolsky

Microsoft recently updated an article on the ten immutable laws of security (version 2.0), which it published back in ten years ago. It is really an interesting article on security and remains quite relevant until today.

These are the ten immutable laws of security, according to Microsoft:

Law #1: If a bad guy can persuade you to run his program on your computer, it’s not solely your computer anymore.
Law #2: If a bad guy can alter the operating system on your computer, it’s not your computer anymore.
Law #3: If a bad guy has unrestricted physical access to your computer, it’s not your computer anymore.
Law #4: If you allow a bad guy to run active content in your website, it’s not your website any more.
Law #5: Weak passwords trump strong security.
Law #6: A computer is only as secure as the administrator is trustworthy.
Law #7: Encrypted data is only as secure as its decryption key.
Law #8: An out-of-date antimalware scanner is only marginally better than no scanner at all.
Law #9: Absolute anonymity isn’t practically achievable, online or offline.
Law #10: Technology is not a panacea.

Command Line Networking Tools (Windows)

Posted: August 13, 2011 in Notes

I didn’t realize that Windows has such a bunch of networking tools until recently. These tools, available on the command line and free to use, can be used to configure, test, and troubleshoot a network. Although these tools are useful mostly to those technical people, (I might say) the average PC users may also find some useful command line tips here.

To run these tools, you need a Command Prompt. Go to Start-Run and enter “cmd” to open a Command Prompt.

  1. Windows IP Configuration Tool (ipconfig)
    The Windows IP Configuration Tool (ipconfig) is used to display TCP/IP network configuration values. If you are connected to a network, it will show your all your connections along with the IP address, subnet mask, and default gateway.

    Windows IP Configuration
    Wireless LAN adapter Wireless Network Connection:
       Connection-specific DNS Suffix  . :
       Link-local IPv6 Address . . . . . : fe80::daf:1320:ac4b:4d71%11
       IPv4 Address. . . . . . . . . . . :
       Subnet Mask . . . . . . . . . . . :
       Default Gateway . . . . . . . . . :
    Ethernet adapter Local Area Connection:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :

    Besides, ipconfig might output more information or functions if you provide it with options. You may see a list of valid options by running ipconfig /?

    C:\>ipconfig /?
        ipconfig [/allcompartments] [/? | /all |
                                     /renew [adapter] | /release [adapter] |
                                     /renew6 [adapter] | /release6 [adapter] |
                                     /flushdns | /displaydns | /registerdns |
                                     /showclassid adapter |
                                     /setclassid adapter [classid] |
                                     /showclassid6 adapter |
                                     /setclassid6 adapter [classid] ]
        adapter             Connection name
                           (wildcard characters * and ? allowed, see examples)
           /?               Display this help message
           /all             Display full configuration information.
           /release         Release the IPv4 address for the specified adapter.
           /release6        Release the IPv6 address for the specified adapter.
           /renew           Renew the IPv4 address for the specified adapter.
           /renew6          Renew the IPv6 address for the specified adapter.
           /flushdns        Purges the DNS Resolver cache.
           /registerdns     Refreshes all DHCP leases and re-registers DNS names
           /displaydns      Display the contents of the DNS Resolver Cache.
           /showclassid     Displays all the dhcp class IDs allowed for adapter.
           /setclassid      Modifies the dhcp class id.
           /showclassid6    Displays all the IPv6 DHCP class IDs allowed for adapter
           /setclassid6     Modifies the IPv6 DHCP class id.
  2. Ping
    Technically, to ping a host is to send Internet Control Message Protocol (ICMP) Echo Request messages to the host  and wait for an Echo Reply message from the host. You may ping a target to check the connectivity to a remote site, for example, ping By default, four packets will be sent, or you could force unlimited packet using ping /t The server should reply within fractions of a second (depending on the speed of your connection), and the output should look like below.

    Pinging [] with 32 bytes of data:
    Reply from bytes=32 time=69ms TTL=231
    Reply from bytes=32 time=70ms TTL=231
    Reply from bytes=32 time=68ms TTL=231
    Reply from bytes=32 time=69ms TTL=231
    Ping statistics for
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 68ms, Maximum = 70ms, Average = 69ms
  3. Tracert
    Tracert(traceroute) is used to determine the path taken from your PC to a destination. The path displayed is the list of near-side router interfaces of the routers in the path between a source host and a destination. The near-side interface is the interface of the router that is closest to the sending host in the path. For example, try enter tracert

    Tracing route to []
    over a maximum of 30 hops:
       1    <1 ms    <1 ms    <1 ms
       2    35 ms    19 ms    29 ms
       3    11 ms    27 ms     9 ms []
      13    81 ms    76 ms    75 ms
      14    84 ms    91 ms    87 ms
      15    76 ms   112 ms    76 ms []
    Trace complete.
  4. Pathping
    Pathping combines the functionality of ping with that of tracert. Pathping will first output the details of the path between your computer and the destination; and subsequently it will display Ping-like statistics for each node in the path based on samples taken over a time period.
    The advantages of Pathping over ping and traceroute are that each node is pinged as the result of a single command, and that the behavior of nodes is studied over an extended time period, rather than the default ping sample of four messages or default traceroute single route trace.
  5. Netstat
    Netstat displays a list of active connections on your computer, including all inbound and outbound connections. Besides, it can also display Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6 and UDP over IPv6 protocols).
    Shown below is a list of options. The options must be prefixed with a hyphen (-) rather than a slash (/).

    C:\>netstat /?
    Displays protocol statistics and current TCP/IP network connections.
    NETSTAT [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [interval]
      -a            Displays all connections and listening ports.
      -b            Displays the executable involved in creating each connection or
                    listening port. In some cases well-known executables host
                    multiple independent components, and in these cases the
                    sequence of components involved in creating the connection
                    or listening port is displayed. In this case the executable
                    name is in [] at the bottom, on top is the component it called,
                    and so forth until TCP/IP was reached. Note that this option
                    can be time-consuming and will fail unless you have sufficient
      -e            Displays Ethernet statistics. This may be combined with the -s
      -f            Displays Fully Qualified Domain Names (FQDN) for foreign
      -n            Displays addresses and port numbers in numerical form.
      -o            Displays the owning process ID associated with each connection.
      -p proto      Shows connections for the protocol specified by proto; proto
                    may be any of: TCP, UDP, TCPv6, or UDPv6.  If used with the -s
                    option to display per-protocol statistics, proto may be any of:
                    IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
      -r            Displays the routing table.
      -s            Displays per-protocol statistics.  By default, statistics are
                    shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
                    the -p option may be used to specify a subset of the default.
      -t            Displays the current connection offload state.
      interval      Redisplays selected statistics, pausing interval seconds
                    between each display.  Press CTRL+C to stop redisplaying
                    statistics.  If omitted, netstat will print the current
                    configuration information once.
  6. Nslookup
    Known as Name Server Lookup in full, this tool is available to query the Domain Name System (DNS) to obtain the domain name or IP address of any specific DNS record. To run a query, type nslookup followed by the domain to query and the name server (optional). For example:

    Non-authoritative answer:
  7. Netsh
    Netsh is a powerful tool to perform the following task:

    • Configure interfaces.
    • Configure routing protocols.
    • Configure filters.
    • Configure routes.
    • Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.
    • Display the configuration of a currently running router on any computer.
    • Use the scripting feature to run a collection of commands in batch mode against a specified router.

    The features available apply mostly to system administrators and are beyond the scope of this article. More information is available at Microsoft’s web site here.

Notes to Self

Posted: August 13, 2011 in Notes

One of the wonderful things about programming is that you are constantly learning and dealing with something new. Once in a while I would figure out how to install or use a new piece of software, how to troubleshoot a computer or software bug, how to integrate a new API, etc. It is always tempting to jot down what that I have learned. It helps both to serve as a reference in the future and to consolidate the knowledge that I have attained.

Previously, I’ve always written these little notes on the papers. I found it difficult to keep track of the notes I’ve produced over the years, besides being inconvenient for reference because I always work on my computer. Meanwhile, I love the joy of sharing it with others and therefore I am now putting aside this category named “Notes” in my blog for all the notes I would write to myself.

Finally, it’s my hope that you, the reader, will benefit from the little notes I wrote.

Google Plus

Posted: August 8, 2011 in Fun Stuff

Google launched a new social networking service Google Plus on June 28, 2011, in an ‘invite-only’ phase. Two weeks after the launch, Google CEO Larry Page announced that Google+ had over 10 millions users (compared to Facebook’s 750 million users).

Here are some of the features in Google Plus:

“Circles,” think social circles, akin to Facebook’s lists
“Sandbar,” a user-unifying toolbar
“Sparks,” a search engine for sharing content between users
“Huddle,” a group messaging app that allows users to share with certain “Circles”
“Hangouts,” group video chatting designed to allow up to 10 users video chat at once


Google+ Project : A quick look
Google+ Project : Circles
Google+ Project : Sparks
Google+ Project : Hangouts
Google+ Project : Instant Upload
Google+ Project : Huddle

Angry Birds Species

Posted: August 3, 2011 in Fun Stuff
Tags: ,

Here’s an interesting comic strip detailing the behavior of each angry birds character, adapted from