http://qs321.pair.com?node_id=579667


in reply to Re: Parsing LDAP log file given a time period
in thread Parsing LDAP log file given a time period

Uhmm, wow. That was brilliant. No magic here, but magnificent mathematics at work. Taking the minutes and dividing by the requested interval, and then multiplying by the interval yields the requested interval (int was instrumental, I see this now). and as for using a hash to count the number of BINDS/UNBINDS per interval is inspiring to me.

I've often tried to incorporate hashes into programs to take advantage of it's inherent nature to group data (am I saying that right? *shrug*), but I do not use that often enough to recognize problems like this, that a hash makes easier to deal with.

What is that skill called? I want to say data-something or other.

Thank you for the quick reply, it works beautifully.

Now, that's not to say I've let the rest of you off the hook, I'd still like to see how you might have tackled this problem. I'll add the above to my repertoire of code that I routinely search through to help me conquer these types of problems.

Very funny Scotty... Now PLEASE beam down my PANTS!

  • Comment on Re^2: Parsing LDAP log file given a time period

Replies are listed 'Best First'.
Re: Parsing LDAP log file given a time period
by jonadab (Parson) on Oct 20, 2006 at 21:35 UTC

    I've often tried to incorporate hashes into programs to take advantage of it's inherent nature to group data (am I saying that right? *shrug*), but I do not use that often enough to recognize problems like this, that a hash makes easier to deal with.

    What is that skill called? I want to say data-something or other.

    Data structures, perhaps? Knowing how to store your data so that it is easy to manipulate for your intended purpose is, indeed, an important programming skill — in any programming language.

    Ask yourself, <q>What do I need to be able to do with these data?</q> Let the answer drive your data structures.


    Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. Why, I've got so much sanity it's driving me crazy.
      That's it! Data structures... My problem is I have no formal schooling in programming, unless you count basic, and pascal (circa 1988). I guess I'll have to continue learning as I've done in the past, from books and personal experience.

      Thanks for that...

      Very funny Scotty... Now PLEASE beam down my PANTS!

        My problem is I have no formal schooling in programming, unless you count basic, and pascal (circa 1988). I guess I'll have to continue learning as I've done in the past, from books and personal experience.

        I minored in computer science, and I actually had a class called Data Structures and Algorithm Analysis, but 99% of my understanding of computer programming in general and data structures in particular is stuff I've learned since I graduated, from programming that I've done. I don't remember covering hash tables in that class, much less higher-level structures based on them. I do remember covering linked lists, binary trees, general trees, and directed graphs, most of which I've never needed to use since, because the languages I use have higher-level structures and built-ins that make them unnecessary most of the time.

        In Perl, for instance, linked lists are generally unnecessary because Perl's native list-handling is pretty good and its arrays are dynamically sized; binary trees are mostly unnecessary because hashes have even better performance metrics for lookup; directed graphs I've never used simply because I've never worked on the type of problem they're usually used to solve. (General trees I _have_ used, especially in the form of HTML::Tree and XML::Twig. I've yet to implement one myself, though.)

        Don't get me wrong, the class was useful and worthwhile. But I've learned more about programming from other sources -- from books (if you haven't read Programming Perl, do so), from other people on the internet (Perlmonks is a fantastic resource), and most especially from actually doing stuff with Perl.

        Actually, there's one thing that minoring in computer science did for me that I consider more valuable than everything else: I had to take classes in, and thus be exposed to, a number of different languages, in different language categories. Inside of three years I had COBOL, ForTran, Pascal, C++, Lingo, 8086 Assembler, and QBasic. I haven't used any of those languages recently, but being exposed to a number of _different_ languages was invaluable. If I were constructing the curriculum today, I'd require language classes in some form of BASIC, something from the Lisp family (probably Emacs Lisp, because some of its data structures (notably buffers, markers, and string properties) are fantastically well suited to its problem domain), either C or assembly (doesn't matter which; student chooses), Javascript, Inform (or maybe Smalltalk), Perl, SQL, and XML, and I'd probably specify that Perl is to be used in the data structures course. (We used QBasic. Yes, you _can_ create all those data structures in QBasic. Out of arrays. It's not efficient, but it works well enough to demonstrate the concepts.) Anyway, my point is that learning a number of different languages helps you to learn different ways of thinking about programming, different types of approaches. It makes you a better programmer, whatever language you end up using.


        Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. Why, I've got so much sanity it's driving me crazy.