1. Help!!

I finished my pic loader and it can handle .bmp's, .gif's, and .pcx's but I
tried with profile then I took it out and now I get errors. Can someone tell
me how to unbind a file so I can get it back.

Albert

new topic     » topic index » view message » categorize

2. Re: Help!!

>I finished my pic loader and it can handle .bmp's, .gif's, and .pcx's but I
>tried with profile then I took it out and now I get errors. Can someone
tell
>me how to unbind a file so I can get it back.


You can't unbind a bounded file... sorry.

You should always keep a copy of your source code! (no matter what
programming language you use).

Regards,
    Daniel   Berstein
    daber at pair.com

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

3. Re: Help!!

Thanks for all your help - it was actually how i was using curl that was causing
the problem, but i've changed the function anyway. I need to test them all for
speed as my program has to upload ~23000 products!!

Thanks,

Alex

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

4. Re: Help!!

Alex Chamberlain wrote:
> 
> Thanks for all your help - it was actually how i was using curl that was
> causing
> the problem, but i've changed the function anyway. I need to test them all for
> speed as my program has to upload ~23000 products!!

This might be a bit faster as it avoid appending and precomputes as much as it
can ...

-- Initialize list of valid characters
sequence vValidChars
vValidChars = repeat(0, 256)
vValidChars['A'+1..'Z'+1] = repeat(1, 26)
vValidChars['a'+1..'z'+1] = repeat(1, 26)
vValidChars['0'+1..'9'+1] = repeat(1, 10)

-- Initialize list of converted characters
sequence vConverted
vConverted = repeat({0,0,0} , 256)
for i = 0 to 255 do
    vConverted[i+1] =  '%' & convertDecimal(i, 16)
end for

global function url_encode(sequence dat)
 sequence ret
 integer lNextChar
 integer lPos, lEnd

 -- Create a string big enough to hold largest possible conversion
 ret = repeat(0, length(dat) * 3)

 -- copy original to result
 ret[1..length(dat)] = dat

 -- Set up position to examine and current end position
 lPos = 1
 lEnd = length(dat)

 -- Examine each char, skipping over good ones and
 -- copying in converted ones
 for i = 1 to length(dat) do
  lNextChar = ret[lPos]+1

  if vValidChars[lNextChar] = 0
  then
   -- shift remaining string right
   ret[lPos+3 .. lEnd+2] = ret[lPos+1 .. lEnd]
   -- copying in pre-converted string
   ret[lPos..lPos+2] = vConverted[lNextChar]
   -- adjust positions
   lPos += 2
   lEnd += 2
  end if

  -- skip over char just examined.
  lPos += 1
 end for

 -- return fully converted string.
 return ret[1..lPos-1]
end function




-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

5. Re: Help!!

> 
> 
> posted by: Alex Chamberlain <alex.chamberlain at tiscali.co.uk>
> 
> Thanks for all your help - it was actually how i was using curl that
> was causing the problem, but i've changed the function anyway. I need
> to test them all for speed as my program has to upload ~23000
> products!!

I use wget, and have on win95 and winxp, with no problems. In fact, 
less problems than Internet Explorer. I show speeds up to 
180kbytes/sec even with other apps running on a 1.5mbit/sec line. 
I think it's safe to say wget will run as fast as the computer and the 
available internet connection. Only thing i don't like about it is 
relying on it's timeouts to return control to my programs, but that is 
offset if i simply spawn another Eu process and kill it if it doesn't 
respond in a given time. <hint>Threads would help here.</hint> 
Wget can upload using POST and http, so a server script (Eu or 
PHP) can accept the POST'd file and save it there.

Kat

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

6. Re: Help!!

Kat wrote:
> I use wget, and have on win95 and winxp, with no problems. In fact, 
> less problems than Internet Explorer. I show speeds up to 
> 180kbytes/sec even with other apps running on a 1.5mbit/sec line. 
> I think it's safe to say wget will run as fast as the computer and the 
> available internet connection. Only thing i don't like about it is 
> relying on it's timeouts to return control to my programs, but that is 
> offset if i simply spawn another Eu process and kill it if it doesn't 
> respond in a given time. <hint>Threads would help here.</hint> 

Yes, they do.
See the multi-tasking "news.exu" example in the Euphoria
multitasking preview package. news.exu runs on Linux, FreeBSD or
Windows, if you have wget.

http://www.rapideuphoria.com/cgi-bin/asearch.exu?gen=on&keywords=2.5t3






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

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

7. Help!!

I must be missing the same problems over and over.

global function url_encode(sequence dat)
 sequence ret

 ret = {}

 for i = 1 to length(dat) do
if (dat[i] < 'A' or dat[i] > 'Z') and (dat[i] < 'a' or dat[i] > 'z') and
  (dat[i] < '0' or dat[i] > '9') then
   ret &= '%'
   ret &= convertDecimal(dat[i], 16)
  else
   ret &= dat[i]
  end if
 end for

 return ret
end function


Can any one spot the mistake? It keeps generating machine exceptions.

Thanks,

Alex

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

8. Re: Help!!

On Sat, 30 Sep 2006 12:29:25 -0700, Alex Chamberlain
<guest at RapidEuphoria.com> wrote:

>Can any one spot the mistake?
Nope. I would have integer d, d=dat[i] for performance, and negate
that test, for style, so it reads:
if (d>='A' and d<='Z') or (d>='a' and d<='z')..
 ret&=d
else
 res&='%'...
but otherwise it looks fine and runs ok here.
>It keeps generating machine exceptions.
What version of Eu are you running on?
Does trace(3) indicate the error line any better?
For a long shot, try changing ret&= to ret=ret&, see if it makes any
difference.

Regards,
Pete

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

9. Re: Help!!

Pete Lomax wrote:
> 
> On Sat, 30 Sep 2006 12:29:25 -0700, Alex Chamberlain
> <guest at RapidEuphoria.com> wrote:
> 
> >Can any one spot the mistake?
> Nope. I would have integer d, d=dat[i] for performance, and negate
> that test, for style, so it reads:
> if (d>='A' and d<='Z') or (d>='a' and d<='z')..
>  ret&=d
> else
>  res&='%'...
> but otherwise it looks fine and runs ok here.
> >It keeps generating machine exceptions.
> What version of Eu are you running on?
> Does trace(3) indicate the error line any better?
> For a long shot, try changing ret&= to ret=ret&, see if it makes any
> difference.
> 
> Regards,
> Pete
> 
> 

A table would be better to test for valid chars..

sequence VALID_CHARS
VALID_CHARS = repeat(0,255) -- NULL char is not supported
VALID_CHARS['0'..'9'] = 1
VALID_CHARS['A'..'Z'] = 1
VALID_CHARS['a'..'z'] = 1

global function url_encode(sequence dat)
 sequence ret

 ret = {}

 for i = 1 to length(dat) do
  if dat[i] and VALID_CHARS[dat[i]] then
   ret &= dat[i]
  else
   -- ret &= '%'
   -- ret &= convertDecimal(dat[i], 16)
   ret &= sprintf("%%%02x",{dat[i]})
  end if
 end for

 return ret
end function



Machine exceptions will popup in places entirely unrelated to the error.
Without the rest of the code, it would be hard to determine what the problem is.
Test the function in a minimal demo application.

BTW, what is convertDecimal() for exactly?
Converts the char code to urlencoded hex?
I replaced it with sprintf() which will convert char codes to the correct url
encoded hex.


Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~

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

10. Re: Help!!

Chris Bensler wrote:
> 
> Pete Lomax wrote:
> > 
> > On Sat, 30 Sep 2006 12:29:25 -0700, Alex Chamberlain
> > <guest at RapidEuphoria.com> wrote:
> > 
> > >Can any one spot the mistake?
> > Nope. I would have integer d, d=dat[i] for performance, and negate
> > that test, for style, so it reads:
> > if (d>='A' and d<='Z') or (d>='a' and d<='z')..
> >  ret&=d
> > else
> >  res&='%'...
> > but otherwise it looks fine and runs ok here.
> > >It keeps generating machine exceptions.
> > What version of Eu are you running on?
> > Does trace(3) indicate the error line any better?
> > For a long shot, try changing ret&= to ret=ret&, see if it makes any
> > difference.
> > 
> > Regards,
> > Pete
> > 
> > 
> A table would be better to test for valid chars..
> 
> }}}
<eucode>
> sequence VALID_CHARS
> VALID_CHARS = repeat(0,255) -- NULL char is not supported
> VALID_CHARS['0'..'9'] = 1
> VALID_CHARS['A'..'Z'] = 1
> VALID_CHARS['a'..'z'] = 1
> for i = 1 to length(VALID_CHARS) do
>   if VALID_CHARS[i] then
>     VALID_CHARS[i] = i
>   else
>     VALID_CHARS[i] = sprintf("%%%02x",{i})
>   end if
> end for
> 
> global function url_encode(sequence dat)
>  sequence ret
> 
>  ret = {}
> 
>  for i = 1 to length(dat) do
>    ret &= VALID_CHARS[dat[i]]
>  end for
> 
>  return ret
> end function
> </eucode>
{{{

> 
> 
> Machine exceptions will popup in places entirely unrelated to the error.
> Without the rest of the code, it would be hard to determine what the problem
> is. Test the function in a minimal demo application.
> 
> BTW, what is convertDecimal() for exactly?
> Converts the char code to urlencoded hex?
> I replaced it with sprintf() which will convert char codes to the correct url
> encoded hex.
> 
> 
> Chris Bensler
> ~ The difference between ordinary and extraordinary is that little extra ~

I just thought of another improvement. If you were using a table anyways, you
could pre-fill the table with the correct chars/urlcodes, so you simply have to
append the data stored in the table for the desired char.

( I modified the quoted snippet above )


Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~

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

Search



Quick Links

User menu

Not signed in.

Misc Menu