Archive for September, 2006

Javascript: Calculate Element Position

September 28, 2006 4 comments

This is first post about Javascript snips which I feel interesting to learn or know. Most likely, the snips should be cross-browser compatible. But the term “cross-browser compatible” is awlays with certain condition. More accurate, they are the best effort to make them to be “cross-browser compatible”. Most of them can be easily found from Internet. They might be modified to ease my own understanding. I will not give any explanation on the script snip in any means, unless I have time to do so. Anyway, they should be not so difficult to be understood, simply with the help from Internet.

Just a note, I will put the snips into a function called underscore, which serves as the namespace for these snips collection.

Here we go, let’s start with calcuating the element’s position.


underscore = {
    position: function (element) {
        var p = {x: element.offsetLeft || 0, y:element.offsetTop || 0};
        while (element = element.offsetParent) {
            p.x += element.offsetLeft;
            p.y += element.offsetTop;
        return p;


var divElement = document.getDocumentById("myid");
var p = underscore.position(divElement);
alert("position x:" + p.x + "; y:" + p.y);


Categories: javascript, Tech

Subversion Windows Installation Quick Guide

September 15, 2006 2 comments

Yes, this is a really short and quick guide.

  1. Download the latest pre-built windows binary Subversion setup file. For example, the current latest svn-1.4.0-setup.exe
  2. Install it.
  3. Append Subversion’s bin directory (by default: C:\Program Files\Subversion\bin) into system environment variable “PATH”.
  4. Create a new system environment variable “SVN_EDITOR” and set its value to be the path of your favorite text editor. For example,

    It should be a very lightweight editor, which is used to add the comments during some of the Subversion operation, like commit. My choice, as you can see, is Notepad2.

  5. Create the Subversion repository, for example, “D:\Development\svnrepos”:
    > svnadmin create --fs-type fsfs "D:\\Development\\svnrepos"
  6. Download the SVN service program from ChanLib:
  7. Extract the file SVNService.exe from and put into
  8. Install the SVNService (run the command from the Subversion’s bin directory) with the argument “-d” (run as daemon) and “-r ” followed by the repository path:
    > SVNService -install -d -r "D:\\Development\\svnrepos"
  9. Optionally, install the TortoiseSVN to have a nice GUI to directly manipulate the Subversion source files in the Windows Explorer. Nothing special here. For TotalCommander (6.5 or later), to enable viewing the TortoiseSVN’s nice icon for those Subversion files, go to “Options”, “Display”, tick “Show overlay icons, e.g. for links”. It’s not really necessary to enable the normal windows context menu popup for right click. To see the context menu, just hold your right click a bit longer 🙂


Categories: Tech, Windows