1. Bizarre Problem Involving EuSQL

I'm using the following query:

pfields = "PRAYERS.UNIQUE_ID,CREATION_DATE,TITLE,DESCRIPTION,TYPE,PUBLIC,
      OWNER,ANSWER"
sql = sprintf("select " & pfields &
  ",PRAYER_GROUPS.NAME,PRAYER_GROUPS.UNIQUE_ID
     FROM PRAYERS INNER JOIN PRAYING ON PRAYING.PRAYER_ID = PRAYERS.UNIQUE_ID
     INNER JOIN PRAYERS_GROUPS ON PRAYERS.UNIQUE_ID=PRAYERS_GROUPS.PRAYER_ID
     INNER JOIN PRAYER_GROUPS ON PRAYERS_GROUPS.GROUP_ID=PRAYER_GROUPS.UNIQUE_ID
     WHERE PRAYING.MEMBER_ID=%d ORDER BY PRAYER_GROUPS.NAME",{1})


It's returning nothing. My web host's error log shows

   Error opening terminal: unknown.

I'll ask them about that, but have you ever seen that Rob? anybody else who
hosts on a Linux server?

If I remove the "ORDER BY..." part, it works fine.

Here's the bizarre part: The above query works fine on my PC using wxEDB!

I know the files are the same at both the web host and locally, so the only
reason I can see it crashing (error opening terminal: unknown) is that there's
some kind of limit on the web host's PC.

Matt, I think this worked fine before the latest version of EuSQL you sent me,
so that's another confusing thing.

I'm getting in touch with my web host to ask about the "Error opening
terminal: unknown" error, but if anybody has any other ideas, I'm listening.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Bizarre Problem Involving EuSQL

Rob, here's a response I got from my web host:

Maybe your binary is corrupted?
(virt14o mpg)# file exu
exu: ERROR: Corrupted section header size

What do you think about that? Why does it say exu is corrupted?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

3. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> 
> 
> Here's the bizarre part: The above query works fine on my PC using wxEDB!

Okay, so my home PC is Windows. My web host is Linux. Is there a possible
issue with the exu binary vs. the exw binary? maybe?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

4. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> cklester wrote:
> > 
> > 
> > Here's the bizarre part: The above query works fine on my PC using wxEDB!
> 
> Okay, so my home PC is Windows. My web host is Linux. Is there a possible
> issue with the exu binary vs. the exw binary? maybe?

Maybe you used FTP to transfer exu, and you forgot
to transfer it in "binary" mode. That would cause 
a few bytes to be altered.

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

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

5. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> cklester wrote:
> > cklester wrote:
> > > Here's the bizarre part: The above query works fine on my PC using wxEDB!
> > Okay, so my home PC is Windows. My web host is Linux. Is there a possible
> > issue with the exu binary vs. the exw binary? maybe?
> Maybe you used FTP to transfer exu, and you forgot
> to transfer it in "binary" mode. That would cause 
> a few bytes to be altered.

You've got sites on Linux, right? If you do "file exu" in the directory with
the exu, do you get anything about corruption?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

6. Re: Bizarre Problem Involving EuSQL

> 
> It's returning nothing. My web host's error log
> shows
> 
>    Error opening terminal: unknown.
> 
> I'll ask them about that, but have you ever seen
> that Rob? anybody else who
> hosts on a Linux server?

I believe a few months back this issue was solved by
setting an environment varible for terminal... for
example (in bash)...

export TERM=ansi

Since there seems to be an error somewhere in your
code or in a library you are including, euphoria is
trying to open up a terminal, spew out an error
message, then die.  But, if memory for earlier posts
isn't failing me, Rob is linking to some old terminal
code that just isn't to popular these days. 

hmm... I wonder why he didn't simply write errors to
stderr?

Anyway, hope this helps.

--
Ronald Weidner
http://www.techport80.com
PHP Software developer for hire.

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

7. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> Robert Craig wrote:
> > cklester wrote:
> > > cklester wrote:
> > > > Here's the bizarre part: The above query works fine on my PC using
> > > > wxEDB!
> > > Okay, so my home PC is Windows. My web host is Linux. Is there a possible
> > > issue with the exu binary vs. the exw binary? maybe?
> > Maybe you used FTP to transfer exu, and you forgot
> > to transfer it in "binary" mode. That would cause 
> > a few bytes to be altered.
> 
> You've got sites on Linux, right? If you do "file exu" in the directory with
> the exu, do you get anything about corruption?

Yes, it seems to always say that.
I tried it on a couple of different systems.
It's probably because it's a compressed executable.
It should work though.

Nevertheless, if export TERM=ansi doesn't work, try:
   upx -d exu

You can get UPX 1.25 at:
http://upx.sourceforge.net/

That will give you an uncompressed version of exu. (over 400K,
instead of 150K or so). UPX-compressed executables
are a problem on some Linux systems. I think I'll upload a set of
non-compressed Linux executables (exu, ecu, backendu) 
to the download page, later today. The FreeBSD executables
never were compressed.

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

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

8. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> I think I'll upload a set of
> non-compressed Linux executables (exu, ecu, backendu) 
> to the download page, later today. The FreeBSD executables
> never were compressed.

You can get the Linux uncompressed executables from:

   http://www.rapideuphoria.com/25/eu25notcomp.zip

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

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

9. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> cklester wrote:
> > Robert Craig wrote:
> > > cklester wrote:
> > > > cklester wrote:
> > > > > Here's the bizarre part: The above query works fine on my PC using
> > > > > wxEDB!
> > > > Okay, so my home PC is Windows. My web host is Linux. Is there a
> > > > possible
> > > > issue with the exu binary vs. the exw binary? maybe?
> > > Maybe you used FTP to transfer exu, and you forgot
> > > to transfer it in "binary" mode. That would cause 
> > > a few bytes to be altered.
> > You've got sites on Linux, right? If you do "file exu" in the directory with
> > the exu, do you get anything about corruption?
> Yes, it seems to always say that.
> I tried it on a couple of different systems.
> It's probably because it's a compressed executable.
> It should work though.
> 
> Nevertheless, if export TERM=ansi doesn't work, try:

What does that do? Where do I enter it? I went to telnet and did that in
the directory of the program but it didn't seem to change anything.

> I think I'll upload a set of
> non-compressed Linux executables (exu, ecu, backendu) 
> to the download page, later today.

I hope they're there now! Thanks Rob.

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

10. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> 
> You can get the Linux uncompressed executables from:
> 
>    <a
>    href="http://www.rapideuphoria.com/25/eu25notcomp.zip">http://www.rapideuphoria.com/25/eu25notcomp.zip</a>

That didn't fix the problem. But thanks anyway. :(

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

11. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> 
> Robert Craig wrote:
> > I think I'll upload a set of
> > non-compressed Linux executables (exu, ecu, backendu) 
> > to the download page, later today. The FreeBSD executables
> > never were compressed.
> 
> You can get the Linux uncompressed executables from:
> 
>    <a
>    href="http://www.rapideuphoria.com/25/eu25notcomp.zip">http://www.rapideuphoria.com/25/eu25notcomp.zip</a>
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 

Robert, read my post about executable compression (match: #1):

http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=6&fromYear=1&toMonth=9&toYear=A&postedBy=darkvincentdude&keywords=upx

Then tell me why you still would bother with the extra step of compressing your
executables in the first place.

After all, I thought you wanted the Euphoria package to become bigger, to make
Euphoria look less like a "toy". tongue


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

12. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> cklester wrote:
> > cklester wrote:
> > > 
> > > Here's the bizarre part: The above query works fine on my PC using wxEDB!
> > Okay, so my home PC is Windows. My web host is Linux. Is there a possible
> > issue with the exu binary vs. the exw binary? maybe?
> Maybe you used FTP to transfer exu, and you forgot
> to transfer it in "binary" mode. That would cause 
> a few bytes to be altered.

After all this, I think the problem is sprintf(). Does it have a max length
that I've bumped into?! 8|

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

13. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> 
> Robert Craig wrote:
> > cklester wrote:
> > > cklester wrote:
> > > > 
> > > > Here's the bizarre part: The above query works fine on my PC using
> > > > wxEDB!
> > > Okay, so my home PC is Windows. My web host is Linux. Is there a possible
> > > issue with the exu binary vs. the exw binary? maybe?
> > Maybe you used FTP to transfer exu, and you forgot
> > to transfer it in "binary" mode. That would cause 
> > a few bytes to be altered.
> 
> After all this, I think the problem is sprintf(). Does it have a max length
> that I've bumped into?! 8|

Not that I'm aware of.

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

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

14. Re: Bizarre Problem Involving EuSQL

Vincent wrote:
> Then tell me why you still would bother with the extra step of 
> compressing your executables in the first place.

I agree. There's very little reason for it.
I might not do it in the next release for Linux,
since there seem to be a few Linux systems that don't like
compressed executables.

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

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

15. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> 
> Vincent wrote:
> > Then tell me why you still would bother with the extra step of 
> > compressing your executables in the first place.
> 
> I agree. There's very little reason for it.
> I might not do it in the next release for Linux,
> since there seem to be a few Linux systems that don't like
> compressed executables.
> 

If you decide not to do it for Linux like you have for FreeBSD, you might as
well not do it for DOS and Windows versions either. It would at least save me 15
minutes from having to decompress exw.exe, exwc.exe, ex.exe, ecw.exe, ec.exe,
backendw.exe, and backend.exe to save a little memory while running Euphoria
programs. Interpreted Euphoria programs that have large complex sequence
operations love to consume memory, like I love to consume pizza and ice cream, I
go a little overboard trying to reduce the effects.

You may of noticed that I saved a total of 970KB "overall" (but 3.43MB more
memory usage) when I compressed IDE.exe. But what is 970KB when you can buy a
250GB Seagate hard drive for just under $70 USD (after rebate) on TigerDirect!!

http://www.tigerdirect.com/applications/searchtools/item-Details.asp?EdpNo=1265028&sku=THD-250A&CMP=ILC-FPM07

Talk about a sizzling deal!

> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

16. Re: Bizarre Problem Involving EuSQL

Instead of being able to use this:

data = {1,"Name","Text","12.12.2004","12:15",2,1}
sql = sprintf("SELECT COUNT(*) FROM ENTRIES WHERE (JOURNAL_ID=%d) AND
    (ENTRY_NAME='%s') AND (ENTRY_TEXT='%s') AND (ENTRY_DATE='%s') AND
    (ENTRY_TIME='%s') AND (AUTHOR_ID=%d) AND (PRAYER_ID=%d)",data)


(the above kept saying "not enough values for sprintf), I had to use this:

sql = "SELECT COUNT(*) FROM ENTRIES WHERE (JOURNAL_ID=" &
   sprintf("%d",{data[1]}) & ") "
sql &= "AND (ENTRY_NAME='" & data[2] & "') AND (ENTRY_TEXT='" &
   data[3] & "') "
sql &= "AND (ENTRY_DATE='" & data[4] & "') AND (ENTRY_TIME='" &
   data[5] & "') AND (AUTHOR_ID=" & sprintf("%d",{data[6]}) & ")
   AND (PRAYER_ID=" & sprintf("%d",{data[7]}) & ")"


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

17. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> 
> Instead of being able to use this:
> 
> }}}
<eucode>
> data = {1,"Name","Text","12.12.2004","12:15",2,1}
> sql = sprintf("SELECT COUNT(*) FROM ENTRIES WHERE (JOURNAL_ID=%d) AND
>     (ENTRY_NAME='%s') AND (ENTRY_TEXT='%s') AND (ENTRY_DATE='%s') AND
>     (ENTRY_TIME='%s') AND (AUTHOR_ID=%d) AND (PRAYER_ID=%d)",data)
> <font color="#330033"></eucode>
{{{
</font>
> 
> (the above kept saying "not enough values for sprintf), I had to use this:
> </eucode>
{{{


It works for me with ex, exw, exu (Linux).
(I put the "sql =" statement all on one line.)

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

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

18. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:

> It works for me with ex, exw, exu (Linux).
> (I put the "sql =" statement all on one line.)

Ahhhh... poopie sticks. I resolved that error earlier and I was getting
confused. I was using {data} instead of data... :/ Sorry 'bout that. :)
Now I just need Matt to check that ORDER BY stuff and I should be good
to go again! :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

19. Re: Bizarre Problem Involving EuSQL

> > Instead of being able to use this:
> > 
> > }}}
<eucode>
> > data = {1,"Name","Text","12.12.2004","12:15",2,1}
> > sql = sprintf("SELECT COUNT(*) FROM ENTRIES WHERE (JOURNAL_ID=%d) AND
> >     (ENTRY_NAME='%s') AND (ENTRY_TEXT='%s') AND (ENTRY_DATE='%s') AND
> >     (ENTRY_TIME='%s') AND (AUTHOR_ID=%d) AND (PRAYER_ID=%d)",data)
> > 
> > (the above kept saying "not enough values for sprintf), I had to use this:
> 
> 

Hi,


That's interesting, because i got an error that said 
  "line ends with no closing quote"
for the line with 'sql' in it.
 

Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

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

20. Re: Bizarre Problem Involving EuSQL

> > Nevertheless, if export TERM=ansi doesn't work,
> > ...
> 
> What does that do? Where do I enter it? I went to
> telnet and did that in the directory of the program 
> but it didn't seem to change anything.

Hmm...  the "export TERM=ansi" sets the terminal
interface to "ansi".  These days it's something else
by default.  

This issue is one of few reasons I don't use euphoria
as my first choice for cgi programming.  The problem,
as you are discovering, is that error messages are
being sent to a new terminal created by euphoria.  So,
error messages, aren't getting sent out to stdout.
Therefore, they aren't displayed in the web browser.
This makes debugging much more difficult.  (although
ex.err helps) Some people actually consider this type
of behavior a security feature as error messages can
give hackers clues.

Maybe there is flag/switch or something that I don't
know about to force errors to go to stdout instead of
a new terminal?  Anyone?



--
Ronald Weidner
http://www.techport80.com
PHP Software developer for hire.

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

21. Re: Bizarre Problem Involving EuSQL

Ron Weidner wrote:
> > > Nevertheless, if export TERM=ansi doesn't work,
> > > ...
> > 
> > What does that do? Where do I enter it? I went to
> > telnet and did that in the directory of the program 
> > but it didn't seem to change anything.
> 
> Hmm...  the "export TERM=ansi" sets the terminal
> interface to "ansi".  These days it's something else
> by default.  
> 
> This issue is one of few reasons I don't use euphoria
> as my first choice for cgi programming.  The problem,
> as you are discovering, is that error messages are
> being sent to a new terminal created by euphoria.  So,
> error messages, aren't getting sent out to stdout.
> Therefore, they aren't displayed in the web browser.
> This makes debugging much more difficult.  (although
> ex.err helps) Some people actually consider this type
> of behavior a security feature as error messages can
> give hackers clues.
> 
> Maybe there is flag/switch or something that I don't
> know about to force errors to go to stdout instead of
> a new terminal?  Anyone?

My TERM is xterm by default, and that works fine for me.

If my CGI program catches an application-detected error,
I call my own small Euphoria routine that outputs some 
HTML to the Web browser (i.e. via standard output).

If the Euphoria interpreter detects an error, I use
a crash routine (new in 2.5) to handle the error.
Usually I send myself an e-mail, including ex.err.

If there's no crash routine, then on some Linux systems,
such as mine, the operating system will capture the
interpreter's message that normally goes to stderr,
(e.g. "subscript out of bounds") as well as the trace-back, 
and will e-mail it to my user id on the Linux system.

Some other debugging techniques:
   with profile - see ex.pro
   with trace / trace(3) - see ctrace.out

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

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

22. Re: Bizarre Problem Involving EuSQL

Robert Craig wrote:
> Ron Weidner wrote:
> > 
> > This issue is one of few reasons I don't use euphoria
> > as my first choice for cgi programming.

Matt sent me an updated eusql.e file and now everything works perfectly.
Don't ask me why!

=8D

Programming is fun! That will be my new motto.

> > as you are discovering, is that error messages are
> > being sent to a new terminal created by euphoria.

Error messages on my system get sent to either ex.err in the directory where
exu is located, or I can see them in my server error logs. No problems there.

> If the Euphoria interpreter detects an error, I use
> a crash routine (new in 2.5) to handle the error.
> Usually I send myself an e-mail, including ex.err.

I'll get around to it... Unless you've got some standard, plug-in code for
that! :)

-=ck
"Programming in a state of Euphoria."
http://www.cklester.com/euphoria/

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

23. Re: Bizarre Problem Involving EuSQL

cklester wrote:
> Rob Craig wrote:
> > If the Euphoria interpreter detects an error, I use
> > a crash routine (new in 2.5) to handle the error.
> > Usually I send myself an e-mail, including ex.err.
> 
> I'll get around to it... Unless you've got some standard, plug-in code for
> that! :)

This is copied from esearch.exu ...

function crash(object x)
-- in case of fire ...
    integer errfile
    
    errfile = open("ex.err", "a")
    puts(errfile, "\nquery is: " & query & '\n')
    close(errfile)

    -- send an e-mail containing ex.err
system("mail -s \"esearch.exu crashed!\" rds at RapidEuphoria.com < ex.err >
    /dev/null", 2)
    
    return 0
end function

crash_routine(routine_id("crash"))


(replace " at " with at-sign)

query is the CGI query string.

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

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

24. Re: Bizarre Problem Involving EuSQL

Ron Weidner wrote:
> 
> Although ex.err helps, some people actually consider this type of 
> behavior a security feature as error messages can give hackers clues. 
> 
> 

Or a vulnerability.

It's quite easy to make prevent a error dump file from being created, and
provide nonsense error messages, thus hackers wont have any idea.

without warning
include machine.e

crash_file("")   -- "NUL" or "/dev/null" works too
crash_message("Crikey, shes a grumpy little one!")

function prog_crash(object crash)
    machine_proc(26,0)
    return 0
end function

? 1/0  -- crash

crash_routine(routine_id("prog_crash"))



Regards,
Vincent

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

Search



Quick Links

User menu

Not signed in.

Misc Menu