Question: I am trying to paras DOM of a site using CSQuery. If I open a site in IE and inspect an element, its HTML slightly differs ( ordering of attributes and spacing between values ) from same site loaded using CSQuery.CreateFromUrl method. For example there is a div style generated by IE as "style=margin-bottom: 0.5em;" and for same div CSQuery's Render method generated different HTML "style=margin-bottom:0.5em;" [ No space after :].

As a result when I create a selector for CSQuery like "div[style='margin-left: 0.5em;']" it doesn't work because CSQuery's internal DOM doesn't have space between ':' and '0.5'. 

My problem is my application users will be using IE to inspect DOM elements and hence creating CSS selectors to query DOM using CSQuery. For this case I can remove spaces from selector in my code but I dont want to do this because there might be some other slight differences between other selectors. 

So is there any way to make sure CSQuery generate the same DOM as IE does ? 
I have tried using CSQuery.Creat( HTML return by IE ) but somehow CSQuery still format the HTML in its way which is different from IE DOM. 

Thanks,
Tony

Answer: 
OK, so your plane is a thread and your airfields are the shared resource. So to make your plane (thread) wait, you'll need to synchronized on the shared resource (airfield). You'll probably do something like this.

For take off,

```
public void tryStart() {
    synchronized(source) { // try to obtain source lock
        try {
            Thread.sleep(5000); // lock it for 5 seconds.
        }
        catch(Exception ignore) {
            // You'll need to decide what to do if something interrupts the thread while it's "sleeping" (ie. locked) on the source airfield. Normally, this should not happen.
        }
    }
    // After 5 seconds, releases lock on airfield "source" and Plane starts flying
}

```

For landing,

```
public void tryLadowanie() {
    synchronized(dest) { // try to obtain dest lock
        // successfully obtained lock.
        // perform your landing
    }
    // plane landed and releases "dest" resource for other planes (ie. threads)
}

```

For a more complete picture of plane flying.

```
public void run(){
    while(true){
        tryStart(); // take off from source
        lecimy();   // fly the plane. Method will only return when plane reaches destination.
        tryLadowanie(); // land the plane
        source = dest;
        dest = Rand(source); // returns a new destination but can't be the same as source
    }
}

public void tryStart(){
    synchronized(source) {
        try {
            Thread.sleep(5000);
        }
        catch(Exception ignore) { }
    }
}

public void tryLadowanie(){
    synchronized(dest) {
        // land the plane
    }
}

```
Use general java object exp. 
Object lock=new Object(); 
To wait :
Synchronized(lock)
{
 lock.wait();
}
To release or free the lock from another thread
On same lock object
Synchronized(lock)
{
 lock.notify();
}