Results 1 to 4 of 4

Thread: [Answers] Debug-1

  1. #1
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135

    [Answers] Debug-1

    It's possible to SET DEBUG ON and SET DEBUGTRACE ON when running from the App Center. Simply add it someplace like the Init delagate for the App. That way you'll at least get the debug files.



    try deleting any .dbo files from your app's directory and the ./library/ directory and see if that changes the behavior.



    Try adding a LIST STATUS TO FILE <filename> before the MESSAGEBOX() and see if everything in there is as you expect.



    Have you tried issuing SET DEBUG ON and checking the log in the ./debug/ directory for more information? Issue it in the console before you open your app.



    If you could SET DEBUG ON, make your ODBC connection from the console, USE this table, then post the resulting debug file



    Can you switch to the lib_search.prg tab in the debugger?
    If there is an error in search.rsp, there should be an errorxxxx.mem in lianja\error.



    If you open the script in the Script Editor, you can click the Debugger button in the Headerbar to load it into the Debugger.



    Q:
    It appears that the app debugger (icon in IDE left bottom) is only for debugging Recital script pages (prg?)
    A:
    yes, the full Desktop App 'Debug' debugger is for debugging Lianja/VFP scripts.
    You can use the JavaScript command window tab in the Console or the App Inspector



    switch debug on in the Console Workspace Lianja/VFP Command Window:
    Code:
    set debug on
    Then open an App and attempt an update.
    Then in the Console Workspace, Lianja/VFP command window:
    Code:
    display status


    If you are debugging an App, just load the App and click the 'Debug this App' button in the ModeBar. This will automatically load any custom libraries referenced by the UI Controls. For example, in the lianjacustomcanvas App included in the Lianja App Builder distribution, the 'page1' Page references lib_page1.prg and the 'section2' Section references lib_page1_section2.prg.



    I've created a program called myfunc.prg and it is referenced from lib_page1_section2.prg. If I want this to be loaded along with the custom libraries when I open the Debugger, I open it in the Script Editor in the Apps Workspace and click the 'Open file in Debugger' button:



    Now when I click the 'Debug this App' button in the ModeBar, myfunc.prg is also immediately available in the Debugger, not just when it is called while the Debugger is active and 'Step Into' used.



    With my 'myfunc.prg' program loaded in the Debugger, I can set Watch and Break points and continue running the App until one of these is reached.
    I click next to the line number to make a line a Breakpoint:



    And select/highlight the name of a variable then click 'Watch' to set a Watchpoint on a variable:



    I can then run the App and the Debugger activates when a Breakpoint or Watchpoint is reached:



    At which time, I can step individual lines, or click 'Run/Continue' so that the App continues until another Breakpoint or Watchpoint is reached.





    Q:
    If my program file is named "exercise.prg"; then I must use debug excercise.prg?
    Like
    Set Debug On
    Debug excercise.prg
    Do excercise.prg
    A:
    You can, or you can load it into the Debugger like this:





    You can enable debugging for the Lianja App Center as follows (please remember to switch it off after you've tracked down the error):
    Create a text file called 'config.db' in C:\Lianja\conf and edit it to contain the line
    Code:
    set debug on
    This is the equivalent of setting debug on from the Console Workspace in the Lianja App Builder, so check for any information logged into C:\Lianja\debug\*.txt.
    I should also mention that that will be a system-wide setting while enabled - so will also apply to a Lianja App Builder on the same machine.



    In the Console, switch debug logging on:
    Code:
    set debug on
    Then do your updates, exit the App Builder and have a look at the files in Lianja\debug to see if any errors are reported.



    Can you put a LIST STATUS just before that to show what tables are already open?



    Specify a target for the SELECT - at the moment it will just be going to the Console Output Window as standard output.
    For example, save it to a cursor:

    Code:
    SELECT PENALTYDESC ;
    FROM bantam_stats!penalties ;
    WHERE teamid = intTeamID AND playernumber = intPlayerNumber;
    into cursor cPenalties
                                    
    messagebox(penaltydesc)
    or into a memory variable:

    Code:
    SELECT PENALTYDESC ;
    FROM bantam_stats!penalties ;
    WHERE teamid = intTeamID AND playernumber = intPlayerNumber into cPenaltydesc
                                    
    messagebox(cPenaltydesc)


    there is no debugger for javascript.
    You can use Lianja.writeOutput() then open the app inspector, switch to runtime mode then look in the events tab and the output.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    This same topic is extended to another thread: http://www.lianja.com/community/show...nswers-Debug-2
    Last edited by josipradnik; 2016-10-24 at 03:20.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    You can run in "debug" mode and click on the message in the console which will take you to the line which is in error.

    Also messageBox() in the web/mobile client is non-blocking and you are displaying it twice.
    If you *must*
    block the browser window with a modal dialog using alert("some text").

    If all you want to do is see whats going on use the javascript debugger in the browser (remember to run in debug mode not release mode which will compress the javascript for you).

    Also your old friend Lianja.writeLog("some text") will write to the javascript console.

    It is good practice to always terminate a function code block with a ;



    See what is wrong with the function you are trying to evaluate first. You can call it from the JavaScript console in the web client.

    Learn how to set break points in the JavaScript debugger in the browser so you can identify the error in your code.

    if Lianja cannot evaluate the expression in the client it will automatically try and execute it in the server. That error message is coming from the server.



    Q:

    I clicked the 'Web App View', then the 'Deploy' option.
    Next, I clicked the Preview option and it opened in a browser.
    Google Chrome
    Clicking this menu item still didn't seem to do anything.

    A:

    Press Ctrl+shift+i to open the Developer Tools, then select the Console tab and see if any error are reported when you click the menu item.





    Q:
    In my application, in the console, i see:
    Code:
    mer 29. lug 09:29:09 2015
    **** Lianja error ****
    
    ^
    
    mer 29. lug 09:29:10 2015
    **** Lianja error ****
    
    ^
    
    mer 29. lug 09:29:12 2015
    **** Lianja error ****
    m_field.user_edt        
    ^
    Property/Variable 'USER_EDT' not found

    I think this is a error occurs inside a try - catch VFP code.
    How can I see more detail?
    A:
    Issue the following settings in the Lianja/VFP Command Window before you open the App then check the debug files.
    Code:
    set debug on
    set debugcompile on
    set debugtrace on


    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    This same topic is extended to another thread: http://www.lianja.com/community/show...nswers-Debug-2
    Last edited by josipradnik; 2016-10-24 at 03:20.

  3. #3
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    This works fine in my application.
    Code:
    for i in range(1,20):
      Lianja.console(str(i))
    But it looks like the it is not picking up both lines when I try to test it in the app inspector or console.
    A:
    You can only issue single-line commands in the Console/App Inspector Command Windows.



    Q:
    Code:
    columnName = columnDef.name
    sql = 'alter table ? add column ? ? '                                                           
                                                            
    prepare stmt from :sql
    execute stmt using :tableName, :columnName, :colDefSql

    **** Lianja error ****
    execute stmt using :tableName, :columnName, :colDefSql

    ^
    Data type was expected
    Called from procedure - createaltertable at line 222
    Called from procedure - dodbupgrade at line 57
    Called from procedure - page1_section2_field1_click at line 5


    My variables are all good so

    Code:
    ?'alter table ' + tableName + ' add column ' + columnName + ' ' + colDefSql

    resolves to

    Code:
    alter table TEMPLATE add column ID char(36) not null


    A:
    Try this:
    Code:
    tablename = "TEMPLATE"
    columnName = "ID"
    colDefSql = columnName + " char(36) not null"
    sql = 'alter table ? add column ? '
    
    prepare stmt from :sql
    execute stmt using :tableName, :colDefSql
    Going back to your original question, if you issue

    Code:
    set debug on

    in the Lianja/VFP command window in the Console or App Inspector before running your code, you can check lianja\debug\debug.txt for errors.

    The 3 parameter statement is shown as this (with associated error)

    error message: Data type was expected
    cmdbuf: alter table [TEMPLATE] add column ID [char(36) not null]
    That looks to me like the '[]' string delimiters are being retained and the data type clause therefore not being recognised. I'm not sure if that's an invalid parameter use or whether this should be handled.



    if you find any bugs in Lianja please let us know by submitting a ticket at http://www.lianja.com/support/newticket (Sign in to submit a ticket).

    Please include detailed steps to reproduce the problem.
    Any required App(s), data and Library files should be
    attached to the ticket.
    These can be
    packaged into a Lianja Package File.
    Send cut-down versions of your data where possible - you can create a backup copy for your database in the Data workspace, remove tables or records that are not required for the ticket, then restore your backup.
    If you can
    reproduce the problem using the sample southwind database, then even better.

    If large files are required to reproduce the problem - the maximum ticket attachment size is 20MB - please contact support@lianja.com to request an ftp login and instructions on where to upload the files.

    If you have more than one problem to report, please submit an individual ticket for each one.



    Q:
    in the log "MouseWheel detected"...
    Code:
    define class clsimage as image
      proc mousewheel(nModifiers, nXpos, nYpos)
        Lianja.writelog("MouseWheel detected")
        Lianja.writelog(nModifiers)
        Lianja.writelog(nXpos)
        Lianja.writelog(nYpos)
      endproc
    enddefine
    A:
    You need to use ETOS() in the Lianja.writeLog() to convert to a string



    Look at the is_object() function in the doc



    On the client machine where you have run your installer, have a look at the drive:\lianja\log\log.txt file. This will include the dataDirectory and other directory settings it is using.
    Check that this
    directory contains the databases that you are expecting.

    You can also use the --debug command line switch in your Lianja App Center shortcut, e.g. if installed on C:

    C:\lianja\bin\lianjaruntime.exe --debug


    This will then output debugging information to the debug.txt and/or debug_client.txt files in the C:\lianja\debug directory.



    improved the debug error logging in 2.1 to hep you pinpoint hard to find errors.

    The debug.txt file is now versioned for each run of the App Builder or the App Center e.g debug.txt becomes debug_<pid>.txt where <pid> is the process id of the running executable. Same goes fro debug_client_<pid>.txt.

    You may want to purge these files periodically.



    Q:
    In Lianja App builder when I click to open 'Lianja Demo App' it seems that it tries to open it as indicated by a progress line bar on top bar but it closes the App builder without any error.
    A:
    1) set debug on, from the console, before you open the Lianja Demo App.
    2) go to the debug directory (under Lianja), and open debug.txt.
    Hint: get
    Notepad++ and leave that file open. That way, when you click on it, Notepad++ will tell you the file has been modified by another program, and ask whether you want to refresh the version.
    This way you
    don't have to go click on it every time.



    compile your .prg files with the DEBUG keyword (compile myprg debug), and then set debug on,
    and you will get a
    line-by-line recitation of what fired in what order. And where it stopped firing.



    1) compile all your prgs with the debug keyword.
    2) on the conig.db file put in: set debug on -- then compile it and move it to the deployment conf directory

    You will then be able to see what is taking time when you open your app. I think: I haven't tried this when spawning an app.



    Lianja v3.0 now includes a GUI JavaScript debugger.

    a note: when the JS debugger appears and has a permanent failure (this was a
    missing reference to the lib_xxx.js file), the rest of the app will be locked until you close the debugger.
    Makes sense, given that there is no place to go after that error, but could be confusing if you don't realize it.



    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...p?2717-Answers
    This same topic is extended to another thread: http://www.lianja.com/community/show...nswers-Debug-2
    Last edited by josipradnik; 2016-10-24 at 03:19.

  4. #4
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Q:
    Lianja.exe crashed with a stopped responding windows message error box, there were no error numbers. When restarted the home screen is blank.

    A:
    Try restarting the Lianja App Builder using the --reset command line switch, then reopen your App. If reopening your App causes the crash again, please package it and any required data and attach to the ticket. Then use the Versions workspace to restore a previously saved version of your App.



    Q:
    I am trying to sort a grid using the following code from a command button:
    Code:
    oGrid = Lianja.get("Production.Assembly").grid
    oGrid.sort(11,1) //sortsoGrid.refresh() grid in ascending order by Estimated Ship Date
    oGrid.refresh()
    It works fine in the App Builder, but does not work when I deploy it and place in the working area.

    A:
    Try adding the --debug switch to the Lianja App Center shortcut command line, then check the debug_clientXXXX.txt file in drive:\lianja\debug\.



    Q:
    review shows a blank screen

    Browser view is ok. I have tried restarting the PC

    A:
    Right-click in the panel and choose 'Inspect' and see if any (red) errors are reported in the Console.




    All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
    This same topic is extended to another thread: http://www.lianja.com/community/show...nswers-Debug-2

    These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.com/category/debug/
    Last edited by josipradnik; 2017-11-30 at 00:43.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us