Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: ADSI groups users

by sundialsvc4 (Monsignor)
on Mar 04, 2011 at 14:20 UTC ( #891456=note: print w/ replies, xml ) Need Help??

in reply to ADSI groups users

I naturally look at such problems with an eye toward so-called finite state machine logic.   While this particular example is trivial, the idea is more-or-less like this:

The algorithm will loop through all of the zero-or-more input records that exist.   As it does so, it will also keep some kind of “recollection of” what it has seen before ... memories of data that might have been gleaned from previous records, and, importantly, “what state we are now in.”   In this example, we might say the states are (say...) SKIPPING_FOR_GROUP_NAME and READING_USER_NAMES.   There is always an “initial state” that is established before the record-reading loop begins.

Each input record is classified both in terms of its content (e.g. “it consists entirely of digits”), and by the current state.   In response, the algorithm (a) decides what to do with this value, and (b) maybe changes the value of “current state.”

There are always activities that must occur both during the reading-loop and then one more time after the loop ends.

As always, writing an actual algorithm in a production setting is a balancing-act between sufficiency, robustness, clarity, simplicity and overkill.

Comment on Re: ADSI groups users
Re^2: ADSI groups users
by Anonymous Monk on Mar 04, 2011 at 14:54 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://891456]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-08-29 23:34 GMT
Find Nodes?
    Voting Booth?

    The best computer themed movie is:

    Results (289 votes), past polls