Jump to content

Tracy Debugger


adrian

Recommended Posts

 insert debugging statements

Interesting feature though not sure if I would ever use it.

Btw, having no access to the remote files, how would you know the line numbers? :)

(and without being a PHP guru :))

  • Like 1
Link to comment
Share on other sites

Interesting feature though not sure if I would ever use it.

Btw, having no access to the remote files, how would you know the line numbers? :)

(and without being a PHP guru :))

You'd know the line numbers from any error messages that Tracy has reported.

You can of course always enter line #1 for some scenarios. Maybe it would be nice if I had a trigger for inserting at the last line as well?

But, agreed it is probably a little obscure as a feature - I'll see how much I end up using it and see if others find a use for it.

  • Like 2
Link to comment
Share on other sites

The Editor Protocol Handler would be great, but I have problems with escaped characters like / as %2F. The links look like this:

openineclipse://open?url=file://%2FLibrary%2FWebServer%2FDocuments%2Fpw25%2Fsite%2Ftemplates%2Fhome.php&line=25

But in Safari at least this doesn't work if I don't change each "%2F" to "/".  How could I change the links to be like:

openineclipse://open?url=file:///Library/WebServer/Documents/pw25/site/templates/home.php&line=25

or get Safari or Chrome understand 

I found help on defining the Editor Protocol Handler for Eclipse "openineclipse" on this page: http://teleyag.com/blog/2011/08/19/openineclipse-url-scheme-for-mac/

I managed to fix this problem and now I have the Editor Protocol Handler working with Eclipse. Here comes what I did:

I followed the document here: http://teleyag.com/blog/2011/08/19/openineclipse-url-scheme-for-mac/

The only change was to fix that urlencoding problem above with the following AppleScript change. On line 6 I added: 

set this_URL to replace_chars(this_URL, "%2F", "/")

 
And in the end of the script this function for replace_chars:
 
on replace_chars(this_text, search_string, replacement_string)

    set AppleScript's text item delimiters to the search_string

    set the item_list to every text item of this_text

    set AppleScript's text item delimiters to the replacement_string

    set this_text to the item_list as string

    set AppleScript's text item delimiters to ""

    return this_text

end replace_chars

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

I got an issue with ajax submitting forms & Tracy. The module is always adding itself to the page, though my intention is to have a json_encoded string as the only response.

Now I got this:


"Thank you for contacting us!"

(.. tracy code here ...)

The reason could be that $config->ajax validates to false because I'm using pure JS instead of jQuery. With jQuery there's no Tracy code appearing. So unfortunately using $config->ajax to decide ajax mode wouldn't help here.

Link to comment
Share on other sites

Thanks, that solved it. I remember seeing that header in the jQuery request but haven't try adding manually.

That's the corresponding part if anyone needs:

request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  • Like 2
Link to comment
Share on other sites

Thanks for the report @tpr and for the solution @LostKobrakai. 

Sorry, I am on the road at the moment (mostly vacation) and so my response time could be several days.

It sounds like you have everything working as needed at the moment, but let me know if you think that perhaps Tracy needs to handle this better.

Not the same thing I know, but the latest version of Tracy (the core project) now provides details on ajax requests - might be coming soon to this module, but there is a PHP 5.4.4 requirement, so might have to wait until PW drops 5.3 support.

  • Like 2
Link to comment
Share on other sites

Isn't it possible to bundle two versions of Tracy and use the one appropriate? Too much work maybe?

Might be an option. I'll have a play with the new ajax stuff in the latest version of Tracy and see if it's worth it.

  • Like 1
Link to comment
Share on other sites

Adrian,

Many thanks for this debugger. It. Is. Fantastic!

Could I request the xdebug integration, please.

Thanks for the kudos - and yes, I will look into adding that Xdebug helper module (https://componette.com/jsmitka/nette-xdebug-helper/).

There is actually another one that I didn't mention in the post: https://componette.com/milo/xdebugtracepanel/ which is for showing Xdebug traces in a Tracy panel - it is currently abandoned, but the author says he is working on a new version, but not sure on  the status of that.

I should have thought that you are also working while traveling :) Thanks again for one of the most useful modules and for the blog post as well!

I shouldn't be, and I am not really - I was just silly enough to check my email the other day and saw a request from Ryan for a blog post. I am actually away on an extended trip, so I don' really mind :)

  • Like 1
Link to comment
Share on other sites

Hi everyone,

New version just committed. It comes packaged with both stable (2.3.10 - what it was using before) and master (2.4 dev) versions of Tracy. If you have PHP 5.4.4+ it will use the master/dev version which among other improvements, adds support for monitoring of, and allowing dumping from, AJAX calls. 

One quick way to see the AJAX monitoring in effect is to check "Backend" under the "Show Debug Bar" config option. Then hover over the PW menu in the admin to one of the AJAX-driven submenus - notice the new row in the debug bar showing the time etc for the AJAX request. You'll also see this popup when clicking on the Children tab when editing a page, and several other places throughout the PW admin. Of course this will also work for any AJAX requests on the front-end of you site.

Here's a screenshot showing both rows (normal and ajax) with the Dumps panels for both. I have two bd() calls - one "classic" and one via "ajax".

post-985-0-25160600-1459025713_thumb.png

Please let me know if you notice any issues with this new version.

  • Like 5
Link to comment
Share on other sites

  • 2 weeks later...

hi adrian,

what do you think about integrating a w3 validator into the tracy bar?

post-2137-0-44078300-1460140983_thumb.gi

i was thinking about implementing this as a little module, but i think it would even be better to have this as an option built into tracy. or is it a gain a feature that's already covered anywhere? :)

  • Like 5
Link to comment
Share on other sites

 Hey @bernhard - thanks for the suggestion, but I think I agree with @tpr here - this might be better handled buy a browser extension. It's funny really I used to be obsessed with having perfectly validating pages, but then it seemed that for a while there (as HTML5 was becoming more usable) that validators weren't keeping up so I stopped using one. Now the only time I use one is for validation of XML.

 
That said, if others think that it would be a useful addition to Tracy, I'd be willing - after-all, if you don't want to use it, just disable the panel and nothing will be loaded.
 
Anyone else have any thoughts on this?
Link to comment
Share on other sites

Although in the case of real projects I find it nearly impossible to produce HTML output that is considered to be valid by the W3 validator, I think it is a good idea to have a quick look so that anything considered to be a bug (say not closed elements) can be quickly identified. So I support the idea.

  • Like 5
Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...