Jump to content
adrian

Tracy Debugger

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

...but there is a PHP 5.4.4 requirement, so might have to wait until PW drops 5.3 support.

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

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Adrian,

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

Could I request the xdebug integration, please.

  • Like 1

Share this post


Link to post
Share on other sites

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!

  • Like 2

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Try setting Mode to DEVELOPMENT or check Superuser force dev mode.

  • Like 3

Share this post


Link to post
Share on other sites

It shown up now, by setting to development mode instead of detect mode

Is it possible that you are using it on a live site or at least a publicly accessible server and not your local machine?

  • Like 2

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Browser extensions? I'm not sure if this feature is worth a (sub)module, unless it provides some benefits over them.

  • Like 2

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
    • By ukyo
      FieldtypeFontIconPicker
      Supported Icon Libraries
      FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog
      NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".
      Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files.
      All config files need to return a PHP ARRAY like examples.
      Example config file : create your own icon set.
      File location is site/configs/IconPicker.example.php
      <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it.
      File location is site/configs/IconPicker.altivebir.php
      <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name).

      If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default).

      Example : output
      if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support

      Search support

      Category support

       
×
×
  • Create New...