Saturday, November 5, 2016

We continue to review the mechanics of Active Directory replication:
We are referring to intrasite replication for the most often use cases of Active directory domain name-context item changes. Such AD replication takes place between DCs in pull operations, not pushes. AD controls and manages the transmission of AD Data.  We discussed what makes up the replication metadata and we saw how it is put to use.  We saw how it was used to address conflict resolution and usn rollbacks.
Today we look at ReadOnly domain controllers. This is usually deployed in branch offices where there is no need to have dedicated and full strength server, personnel or protection. There are no write operations and outbound replication is not permitted. Moreover, the objects are replicated without the user's password information. This creates an additional layer of security because if a DC "grows legs and walks away" there is no password information resident on the hard drive.

#codingexercise
We were discussing the celebrity problem yesterday and making it O(N) from O(N^2) complexity
We used a stack that compared adjacent elements. However we can do away with the stack and use the ends of the list.
int findCelebrity(int n)
{
    int a = 0;
    int b = n - 1;

    while (a < b)
    {
        if (knows(a, b))
            a++;
        else
            b--;
    }

    for (int i = 0; i < n; i++)
    {
        if ( (i != a) &&
                (knows(a, i) || !knows(i, a)) )
            return -1;
    }
    return a;
}

Remove half-nodes from a binary tree

Node RemoveHalfNodes(node root)
{
if (Root == null) return null;
root.left = RemoveHalfNodes(root.left);
root.right = Remove HalfNodes(root.right);
if (root.left == null && root.right == null)
    return root;
if (root.left == null){
    var newroot = root.right;
    delete root;
    return newroot;
}
if (root.right == null){
   var newroot = root.left;
   delete root;
   return newroot;
}
return root;
}

Given an infinite string defined by function f(x)=x+”0″+f(complement x) find k’th bit from start
Assuming complement of x is inverting bits 
we just keep track of position and iterations
for example if k is less than length(x) then the answer is trivial
else we count the length(x) + 1 + length of complement of x as the new x for the next iteration.
we iterate until the length spanned is greater than k and return the value that is immediately preceding k

Facebook API to get all friends' id:
  FB.api('/me/friends?limit=200', function(response) {
    Log.info('API response', response);
    document.getElementById('results').innerHTML = '';
    var names = JSON.parse(JSON.stringify(response));
    for (var i=0; i < names["data"].length; i++) {
      document.getElementById('results').innerHTML += JSON.stringify(names["data"][i]["id"]);
    }
    // document.getElementById('accountInfo').innerHTML += JSON.stringify(response);
  });
Examples : https://github.com/ravibeta

1 comment:

  1. Are you looking to make money from your websites or blogs via popunder advertisments?
    In case you do, have you tried using Clickadu?

    ReplyDelete