Server debug

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Server debug

Post by edgore » Tue Jul 02, 2013 4:38 pm

I am finding that not being able to debug scripts running on the server is the biggest impediment I face these days. I am currently developing stuff on the desktop, then porting (which usually requires rewriting/commenting in/out lines), then copying and pasting into .lc files to run things on the server.

Frequently I am finding that the behavior on the server is different from the desktop (usually inexplicable things like a database query returning a response that has a space at the end of it on the server while the exact same query on the desktop doesn't - probably not Livecode's fault, but hard to find without the debugger). Without the ability to step through the script it's almost imposssible to find this stuff and it's destroying any productivity gains I would have over another server development environment.

So, feature request - Server debugger. Since all of the stuff I have ever done for server requires access to internal network resources (LDAP directories etc) I have never been able to use the editor that was made available for On-Rev ages ago, so I don't know if this is just an update and expansion to that tool, making it available for non-On-Rev servers, or if it's something completely different but without this developing for server is a huge hassle. I would even be fine if it required a local server instance running on the machine you develop on (that's how I work anyway), but there needs to be something.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Server debug

Post by bangkok » Tue Jul 02, 2013 5:02 pm

I second that !

Me too i use the regular TextPad and upload via FTP and copy/paste inside the script editor of LiveCode desktop to debug. It's tedious sometimes.

The special On-Rev editor/debugger was good.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Server debug

Post by FourthWorld » Tue Jul 02, 2013 5:08 pm

edgore wrote:Without the ability to step through the script it's almost imposssible to find this stuff and it's destroying any productivity gains I would have over another server development environment.
Which PHP debuggers have you found especially useful? Perhaps there's something we could learn from those to make a nice one for LC.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Re: Server debug

Post by edgore » Tue Jul 02, 2013 7:55 pm

Actually, what I am *supposed* to be using is Java and Eclipse....

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Server debug

Post by FourthWorld » Tue Jul 02, 2013 8:05 pm

I haven't worked with Java in many years. How does it handle interacting with debugging sessions through a web client?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Re: Server debug

Post by edgore » Tue Jul 02, 2013 9:19 pm

As I understand it, it isn't - it's using a desktop client to do the debugging.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Server debug

Post by FourthWorld » Tue Jul 02, 2013 9:27 pm

Ah, I see. Thanks.

If testing the code outside of Apache is suitable, you could write your scripts in a stack for testing and copy them into your irev templates after they're debugged. This won't help with server-specific interactions, of course, but it sounds like the system you're "supposed" to be using doesn't either, so at least it's no loss for relative productivity.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Re: Server debug

Post by edgore » Wed Jul 03, 2013 12:15 am

That's what I am doing today. The problem is that the exact same script copied and pasted from the desktop IDE into a .lc file gives me completely different results (both the server and the IDE are running on the same machine).

So, I am having to go through the .lc file and add debugging code to make it spit out the values of variables while the script executes (and remember to put in labels and </br>s so what comes out is readable) to figure out where the server engine is behaving differently than the desktop engine.

I would love to be able to provide an example, but everything that I am working on right now relies on internal databases and LDAP services to work (so it won't work at all in the wild) and even the output is filled with data I am not able to share...

Here is something though...I am processing a query from a database that has ID info, then using that info to perform a lookup against an LDAP directory to get info about the users associated with the IDs. In the desktop the results looks like this (before being HTMLified for display):

Desktop (the not found line ios the correct output for an ID that is not found in the system)
CORRECTNAME,USERID,TITLE,PHONE #,EMAIL,MANAGERNAME,MANAGERUSERID,MGRTITLE,MGRPHONE,MGREMAIL,ORIGINALIDSEARCHED
CORRECTNAME,USERID,TITLE,PHONE #,EMAIL,MANAGERNAME,MANAGERUSERID,MGRTITLE,MGRPHONE,MGREMAIL,ORIGINALIDSEARCHED
Not Found,USERID,Not Found, Not Found, Not Found,Not Found,Not Found,Not Found,Not Found,Not Found,Not Found,Not Found,ORIGINALIDSEARCHED
CORRECTNAME,USERID,TITLE,PHONE #,EMAIL,MANAGERNAME,MANAGERUSERID,MGRTITLE,MGRPHONE,MGREMAIL,ORIGINALIDSEARCHED

Server: (the 0ORIGINALIDSEARCHEDis just that - the original userid search on, prefixed with a 0)
CORRECTNAME,USERID,TITLE,PHONE #,EMAIL,MANAGERNAME,MANAGERUSERID,MGRTITLE,MGRPHONE,MGREMAIL,ORIGINALIDSEARCHED
0ORIGINALIDSEARCHED,,,,,,,,,ORIGINALIDSEARCHED
0ORIGINALIDSEARCHED,,,,,,,,,ORIGINALIDSEARCHED
0ORIGINALIDSEARCHED,,,,,,,,,ORIGINALIDSEARCHED

The code that does all this is an include, so it's exactly the same code in both environments, but with the <?lc ?> surrounding the server side version. I am sure that the issue has something to do with stray characters showing up in either the db query results or the shell results between the server and desktop engines (because I have seen that regularly before and I am usually able to address it in a way that fixes the server version without breaking the desktop code). But finding these things requires a lot of work and is frustrating, since the desktop code works just fine. This is happening with something that I am doing right now....

With Eclipse (at least as I understand it) the code is running on the server-side virtual machine and the server-side virtual machine is running the debugger and spitting status data out to the desktop client. Which, I believe, is similar to how the old On-Rev debugger worked. Of course, I have not actually *used* Eclipse or the On-Rev debugger, so I have no idea what I am talking about.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Server debug

Post by FourthWorld » Wed Jul 03, 2013 12:19 am

Pardon the really basic question, but just to make sure we're covering all the bases: are you using the same version of the LC engine in both your desktop and server tests?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

edgore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 197
Joined: Wed Jun 14, 2006 8:40 pm

Re: Server debug

Post by edgore » Wed Jul 03, 2013 1:27 am

Yep - the only difference is that the server is 6.1 community, while the desktop is commercial.

EDIT: So,I guess that my feature request could also just be "Make the server engine and the desktop engine work identically", that would work for me too technically. Although, it would be far more convenient to be able to just develop and debug directly on server, since the presentation stuff is different between platforms and adds development overhead, you need to comment it out/not copy it over, etc.

EDIT 2: I have also just installed community 6.1 desktop just to see if that made a difference, and it doesn't - same results. Most of the problems I run into seem to come down to stray characters appearing in DB query results and shell command results on server that do not appear on the desktop, though I have not tracked in down to that in this instance yet. I do have the newest (and the same) versions of the DB libraries and extensions on both platforms as well, and as I said they are both running on the same machine. I have noticed that the server engine doesn't automatically carry over environment variables from the desktop (which caused havoc with the DB2 ODBC drivers), but I have an include that I use with all my stuff that populates the server environment with the same variables as the desktop).

Post Reply