I was watching Dexter last night. It kind of scares me how I feel so connected to his thought process. Maybe I should see a shrink? Speaking of shrinks, he [Dexter] was comparing profiles of suicide victims in his area. After looking through them multiple times, a light bulb went off in his head.
He realized that they [suicide victims] had the same psychiatrist! Well, they were computer print outs, and "Word" documents I'm sure, so why not leave them digital and search through them like "grep?"
I thought up an extremely easy application as I was watching the show (ADD, I know):
#!/usr/bin/perl -w
my @prof0 = ("bobby", "luke", "test", "wheel", "root", "hacker");
my @prof1 = ("computer", "luke", "bobby", "root", "hacker");
my @dict = ("computer", "test", "wheel", "root", "hacker");
foreach my $var (@prof0) {
if (grep(/$var/, @prof1)) {
if (!grep(/$var/, @dict)) {
print $var . " is in both!\n";
}
}
}
This will compare 2 profiles (The real implementation will need to slurp the lines of each profile FILE into the corresponding arrays.)
Then (once again slurping a dictionary file into the @dict array in the real life implementation) checks to see if the word is a plain word or proper noun. Proper noun was the whole 'EUREAKA' cusp for me. "Cusp" being our mathematical peak(/pique? - curious distinction in our context eh?) for finding the last clue to solving the problem in brain activity :P
So everything from the cusp to the code above was downhill as I adjusted my thoughts into (simple) boolean logic. I am sure scientists have such applications in forensics labs, or police stations, but it was a nice exercise and taught me that I think outside of what is really being taken in by my eyes.
~Douglas.
WeakNet Labs is a computer lab I created to learn more about computer science. Security became the number 1 topic over time and programming seems to have taken it's place since. Writing security themed programs, WeakNet Linux and such, has been not only great experience for us, but it helped a few of us land good solid career-like jobs.




0 comments:
Post a Comment