Re: Need syntax/small footprint help



On Mon, 28 Mar 2005 21:44:40 -0800, robic0@xxxxxxxxx wrote:

>On Sun, 27 Mar 2005 16:27:35 +0000, Brian McCauley <nobull@xxxxxxxx>
>wrote:
>
>>
>>
>>Brian McCauley wrote:
>>
>>> All in all I think you are working way too hard. I'll stop now with
>>> the line-by-line and go have another look at your code in its entirity.
>>> Get back to you soon.
>>
>>Below find an, untested but much simpler version. I have not changed
>>the alorithm just removed some of the tortuous obfuscations.
>>
>>I've subsequently noticed what I presume is a flaw in the algorithm (but
>>that's not Perl related so OT here).
>>Consider:
>>
>> { $KEYNAME => 'foo', $VALUENAME => 'bar' }
>> { $KEYNAME => 'foo\blab' }
>> { $KEYNAME => 'foo\blab', $VALUENAME => 'bar' }
>>
>>I'm guessing the 3rd one above should be reported as redundant but won't be.

Since we're talking about deleting a key, the 3rd one would be
reported as the root key (2nd) is already being deleted.. check the
code.
BTW, the
while ($vname =~ s/^ //) {} was replace with:
$vname =~ s/^ +//;
and so the trailing spaces:
$vname =~ s/ +$//;
although its not used in this sub. i have a reduction sub
(layer) that conditions data and takes away redudendency for
"equivalence" purposes before a typical check. Its called
"sub reduce" its got like 8 reductions now... more or less
depending on how I handle url's and directories (mixed
and across os'). u understand what I mean given these
are human typed?

>>
>>## -- checks Redundant Regkey Delete // Regkey exists --
>>sub eCHK_RegDel {
>> my ($details) = @_;
>> my ($first_kname,$first_vname_exists,$aref_first);
>> for (@$details) {
>> my $aref = $_->[0];
>> next unless $aref->[5] eq $REGISTRY && $aref->[6] eq $DELETE;
>> my $kname = $aref->[4]{$KEYNAME};
>>
>> # Can input data really contain $kname='' ?
>> # if not then the check of length($kname) is redundant.

$kname is dynamic... again, if it exists, it MUST have value.
there is no ambiguity here... what good does existence without
value in an initialized world in the middle of life? prozac....
>>
>> unless ( defined($kname) && length($kname) ) {
>> # log error
>> ## 0701 -- test 07,01
>> ReportItem ('E', $CLOGINFO, $CERRLOG, '0701', glicn($aref), (0,0),
>> '', $XML_File, 1,0,1);
>> next;
>> }
>> my $vname = $aref->[4]{$VALUENAME};
>>
>> # redunant surely - does input really contain $vname
>> # with leading spaces or empty strings?

In the real world $vname contains raw human input, yes..
Unfortunately, raw spaces have length. Is a space
acceptical name on a credit card? no... so we
emulate life programitally sometimes in code to factor
out human mistakes.

>> if ( defined $vname ) {
>> $vname =~ s/^ +//;
>> undef $vname unless length $vname;
>> }
>>
>> $kname .= "\\\\";
>> unless ( $first_kname && $kname =~ /^\Q$first_kname/i ) {
>> # because of sort,the first non valuename
>> # will always be in the new keyname action
>>
>> $first_kname = $kname;
>> $aref_first = $aref;
>> $first_vname_exists = defined($vname);
>> next;
>> }
>> next if $first_vname_exists;
>> ReportItem ('E', $CLOGINFO, $CERRLOG,
>> defined($vname) ? '0703' : '0704',
>> glicn($aref), glicn($aref_first), '',
>> $XML_File, 1,0,1);
>> }
>>}
>>
>
>Hey man, thanks. This is just a followup test msg using Agent, lost
>the google crap, now I can see mo better.
>Yeah, you got some interresting stuff, I am going to correlate it with
>the code once I set up everything. Some stuff you overlooked,
>but some good stuff I have to check out. This is just a test
>of Agent so I just in "check" mode for that. Obvious of interrest
>is the extreme back slashing regx wise... I'll explain that too later.
>Anyway thanks for the look Brian... be back to ya !!!
>
>-RFC

OK thanks again Brian, keep up the good work.
That "\Q" thing has got me to find out at work tommorow what it is.
Thanks.
-rfc

.



Relevant Pages

  • Re: Comments Question
    ... > Sub EnhancedComment() ... > "Brian" <blanktree at hotmail dot com> wrote in message ...
    (microsoft.public.excel.misc)
  • RE: Combo Box Question
    ... "Brian" wrote: ... Private Sub UserForm_Initialize ... Dim myarray() As Variant ...
    (microsoft.public.excel.programming)
  • RE: adding record via form
    ... Brian, ... Make its CONTROL SOURCE also Employee_ID (i.e. the ... > Make three text boxes called Hire_Date, SSN, & Salary. ... >> Exit Sub ...
    (microsoft.public.access.forms)
  • RE: Multiple AdvancedSearchComplete results from 1 AdvancedSearch
    ... Brian ... > if the key matches the folder I'm looking for, I create a new search for each ... > sent only once, AdvancedSearchComplete returns the result twice. ... > Private Sub ProcessTopics(ByVal folderToCheck As Outlook.MAPIFolder, ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Requery and stay on current record
    ... Private Sub Command25_Click ... Dim KeyCurrent As Long ... Brian wrote in message ... >> StudentID is a long interger. ...
    (microsoft.public.access.formscoding)