1. errors in ex.err

I've been getting less than useful error msgs lately, from an app that has run 
for years fairly flawlessly (except for the strange errors i reported and got 
laughed at here, and so i restart the app when i detect them), but this one i 
don't see how i can detect in advance:

<from ex.err>
================
u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478
slice lower index is less than 1 (-4) 

u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478	        if length(href) 
and not equal(href,"") and

 href = {47'/'}

===========================
</from>

The entire if-then code is:
if length(href) and not equal(href,"") and
           (not match("/REUTERS",upper(href))) and
           (not match("/AP",upper(href))) and
           (
           (not match(".HTML",upper(href[length(href)-5..length(href)]))) and
           (not match(".HTM", upper(href[length(href)-4..length(href)])))
           )
          then href = ""
        end if


As you can see, i FIRST test to see if there is anything at all in href, and
that
is where Eu is reporting i made a mistake. Naturally, i am now testing to see 
if (length(href) > 5) .

Kat

new topic     » topic index » view message » categorize

2. Re: errors in ex.err

Kat wrote:
> 
> I've been getting less than useful error msgs lately, from an app that has run
>
> for years fairly flawlessly (except for the strange errors i reported and got 
> laughed at here, and so i restart the app when i detect them), but this one i 
> don't see how i can detect in advance:
> 
> <from ex.err>
> ================
> u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478
> slice lower index is less than 1 (-4) 
> 
> u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478	        if length(href) 
> and not equal(href,"") and
> 
>  href = {47'/'}
> 
> ===========================
> </from>
> 
> The entire if-then code is:
> }}}
<eucode>
>         if length(href) and not equal(href,"") and
>            (not match("/REUTERS",upper(href))) and
>            (not match("/AP",upper(href))) and
>            (
>            (not match(".HTML",upper(href[length(href)-5..length(href)]))) and
>            (not match(".HTM", upper(href[length(href)-4..length(href)])))
>            )
>           then href = ""
>         end if
> </eucode>
{{{

> 
> As you can see, i FIRST test to see if there is anything at all in href, and
> that
> is where Eu is reporting i made a mistake. Naturally, i am now testing to see 
> if (length(href) > 5) .

Consider mastering regular expressions. If you are going to work
with text (especially in the Internet world), they are more than
worth the effort. Learn PERL compatible regular expressions,
such as, in the PCRE library which Bochert has provided as a
user contribution, in Javascript, in many other apps, and of
course in PERL.

I understand that href, in your code, will always be a
sequence/string.

One if statement using a regular expression match and a pattern
like the following one will work better than your large compound
if statement, and you don't have to worry about the length of
href.

Example regular expression pattern to use:
  "(/REUTERS)|(/AP)|(.HTML$)|(.HTM$)"

I would set the case sensitivity option/switch to do being case
insensitive. Then (using Bochert's library) use RGXscan() (or
RGXfind()) with the pattern and RGXcnt in a single if statement.

I know this is not a quick fix/help. But, in the long term, you would
have a much more useful and powerful tool at your disposal. One
that will save your hours of programming time and many headaches.

If you want some help getting started with regular expressions, 
email me individually.

Terry Constant

new topic     » goto parent     » topic index » view message » categorize

3. Re: errors in ex.err

On 9 Oct 2004, at 12:06, Terry Constant wrote:

> 
> 
> posted by: Terry Constant <EUforum at terryconstant.com>

<snip>

> Consider mastering regular expressions. If you are going to work
> with text (especially in the Internet world), they are more than
> worth the effort. Learn PERL compatible regular expressions,
> such as, in the PCRE library which Bochert has provided as a
> user contribution, in Javascript, in many other apps, and of
> course in PERL.

But using regexp will always be slower too. I do use regexp in other 
languages, such as:

\b(f|ph)[ ]*[ucs][ ]*[cu][ ]*[k<]\b
and
\bm+(o+|u+|0+)t+h+(a+|e+|3+)(r+|)[\s]*(p+l+|p+h+|p+|f+|h+|)(a+|u+|o+|0+)(c+k
+|w+k+|r+k+|k+|c+)[\w]*

Like i said, the code i gave to explain the ex.err has been running for years, 
and little oddities are creeping up, and it's a tangle of if-then since we have 
no clean goto, and i am rewriting it. Until i am done, the old code is called. 
even if we had a goto, it wouldn't help the ex.err reporting that error occurred
on that line, as that line did no subscripting.

Kat

new topic     » goto parent     » topic index » view message » categorize

4. Re: errors in ex.err

Kat wrote:

>it wouldn't help the ex.err reporting that error occurred 
>on that line, as that line did no subscripting.

Probably, the error points to the if statement and not to the line.
The if statement starts on that line, even though the subscripting
occurs on another text line in a single if statement. That is, doesn't the
error info just point to the EU statement where an error occurs and not 
to the specific text line within a statement that traverses multiple
lines?


Terry Constant

new topic     » goto parent     » topic index » view message » categorize

5. Re: errors in ex.err

Terry Constant wrote:
> Probably, the error points to the if statement and not to the line.
> The if statement starts on that line, even though the subscripting
> occurs on another text line in a single if statement. That is, doesn't the
> error info just point to the EU statement where an error occurs and not 
> to the specific text line within a statement that traverses multiple
> lines?

That's correct.
I don't keep enough information around at run-time 
to be able to point to a specific line within a 
multi-line statement. On the other hand, with 
compile-time (syntax) errors, I can point at the 
specific line and the approximate position within the line.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

6. Re: errors in ex.err

On Sat, 9 Oct 2004 12:44:01 -0500, Kat <gertie at visionsix.com> wrote:

>but this one i don't see how i can detect in advance:

Can I first knock one thing on the head:
>}}}
<eucode>
>        if length(href) and not equal(href,"") and
Is that not tautology, testing the same thing twice?
(which in itself is tautological blink) Anyway, that off my chest.

Can I secondly assume that the error message missing the actual line
of the sub-expression is perhaps misleading, but not quite the point.
<aside>
	To be fair, I've been flummoxed before by:
	
if equal(a[x..y],stuff) then <blah>..[p..q] end if
	

	and been equally baffled that x and y *are* correct, before
	 finally noticing that it is one of p or q that is wrong.
	 These things happen.
</aside>

>Naturally, i am now testing to see if (length(href) > 5) .
Am I right in guessing that what you really meant to say was that
changing the test that way stops it crashing, but allows stuff like 
"/APxx" and "b.htm" pass by?

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

7. Re: errors in ex.err

Pete Lomax wrote:

> On Sat, 9 Oct 2004 12:44:01 -0500, Kat <gertie at visionsix.com> wrote:
>
>> but this one i don't see how i can detect in advance:
>
> Can I first knock one thing on the head:
>> }}}
<eucode>
>>        if length(href) and not equal(href,"") and
>
> Is that not tautology, testing the same thing twice?
> (which in itself is tautological blink) Anyway, that off my chest.

Of course, it is.

<snip>

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

8. Re: errors in ex.err

Kat wrote:
> 
> I've been getting less than useful error msgs lately, from an app that has run
>
> for years fairly flawlessly (except for the strange errors i reported and got 
> laughed at here, and so i restart the app when i detect them), but this one i 
> don't see how i can detect in advance:
> 
> <from ex.err>
> ================
> u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478
> slice lower index is less than 1 (-4) 
> 
> u:\newsgetter\Eu webgetter tcp4u\Getabcnews4.exw:478	        if length(href) 
> and not equal(href,"") and
> 
>  href = {47'/'}
> 
> ===========================
> </from>
> 
> The entire if-then code is:
> }}}
<eucode>
>         if length(href) and not equal(href,"") and
>            (not match("/REUTERS",upper(href))) and
>            (not match("/AP",upper(href))) and
>            (
>            (not match(".HTML",upper(href[length(href)-5..length(href)]))) and
>            (not match(".HTM", upper(href[length(href)-4..length(href)])))
>            )
>           then href = ""
>         end if
> </eucode>
{{{


I assume you are testing for URLs that contain either /Reuters or /AP, 
and end in either .HTML or .HTM, and you want to do it quickly, and
you want ex.err to report the more relevant line.

If so, this might also meet your requirements...

if length(href) < 7 then
   href = ""
else
   HREF = upper(href)
   if match("/REUTERS",HREF) = 0 or match("/AP",HREF) = 0 then
       href = ""
   else
       -- Just examine last 7 chars.
       FERH = reverse(HREF[length(HREF)-6..length(HREF)])
       if match("LMTH.",FREH) != 1 and match("MTH.", FREH) != 1 then
          href = ""
       end if
   end if
end if


-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu