adrian

Tracy Debugger

Recommended Posts

wow! thank you for all your work! loving the logo - just updated my signature O0 :lol:

  • Like 2

Share this post


Link to post
Share on other sites
Just now, bernhard said:

loving the logo

The logo is so funny, I like it too. If Ryan does not mind that you use it this way, why change it?

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, bernhard said:

and working 200% faster thanks to favicon-16x16.png

Love it :)

  • Like 1

Share this post


Link to post
Share on other sites

Stoked about the new documentation site! I love it even more with the text size zoomed to 125% ;)

In due course it would be great to add a section about barDumpLive() / bdl() - I've never been clear on when it's okay to use this and when it should be avoided due to the dumped variable getting mixed up. I use it from time to time and when there is a variable mix-up it's usually pretty obvious, in which case I switch to bd() with max depth and max length options included. Although I still worry there might be situations where the mix-up is more subtle and could lead to confusion.

Related to this: what do you think about adding a new shortcut method for "big" bardumps? This could have options in the module config for max depth and max length. Just so there's a quick way to do a bardump where you need greater nesting depth and string length than with the standard bd(). I have added a custom shortcut in my IDE for inserting a bd() with max depth and length options, but it would be cool to have something like a "bdb()" method in Tracy (until the barDumpLive thing is resolved anyway).

 

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, Robin S said:

I love it even more with the text size zoomed to 125%

Taken care of that here - will push with the next update.

 

1 hour ago, Robin S said:

In due course it would be great to add a section about barDumpLive() / bdl()

Agreed - it will be in there with details and warnings. I am sure if it will ever be 100% reliable because of the way it works, but from my experience it only ever seems to be an problem when used within hooks.

 

1 hour ago, Robin S said:

but it would be cool to have something like a "bdb()"

I see two possibilities here :

  • a bdb() with some config settings to determine what the depth and length will be - I think the defaults should probably be 6 and 999 - any thoughts?
  • or a simplified syntax for bd(), eg bd($page, [6, 999]) so you don't have to do bd($page, ['maxDepth' => 6, 'maxLength' => 999]) which is painful

The problem with a fixed dbd() is that in the case of PW objects, anything more than 6 can results in out of memory errors (at least with my dev machine setup), but working with smaller objects/arrays, I often want 6 or 7.

I have decided to go with this for now, which sets the maxDepth to 6. Obviously pre PHP 5.4 you will still need: array(6)

bd($page, [6]);

You still need to make the depth and length settings an array - this is because the second argument in the array can either be the "title" or the options array. It's get too confusing to take it any further away from that default.

You can also do:

bd($page, [6,999]);

or:

bd($page, 'Dump Title', [6,999]);

How does that look to you?

I'll post this to the closed beta version shortly.

  • Like 2

Share this post


Link to post
Share on other sites
3 minutes ago, adrian said:

You can also do:


bd($page, [6,999]);

or:


bd($page, 'Dump Title', [6,999]);

How does that look to you?

Good solution, thanks.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Robin S said:

what do you think about adding a new shortcut method for "big" bardumps?

great idea, thx! needed that several times and maxLength=>... was a pain

9 minutes ago, adrian said:

anything more than 6 can results in out of memory errors (at least with my dev machine setup), but working with smaller objects/arrays, I often want 6 or 7.

10 minutes ago, adrian said:

bd($page, 'Dump Title', [6,999]);

How does that look to you?

would it be hard to have the shortcut bdb() for bd($page, [6,999]) ?

i think it would totally be fine to have that shortcut with fixed values since we have the other option of defining it manually like you showed above. but i think in 99% of the cases the bdb() would work just well and it is less to write and a lot easier to remember :)

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, bernhard said:

would it be hard to have the shortcut bdb() for bd($page, [6,999]) ?

Ok, I'm on it :)

  • Like 1

Share this post


Link to post
Share on other sites

It's been out for about 10 days now, but I never really announced the changes here - wanted to see if there were any issues before publicizing.

The new 4.9.x version is now available.

Here's a list of the main changes:

1) New File Editor Panel

  • Supports editing all files in your PW install (you can define the root as /, /site, or /site/templates
  • Can be used as the handler for opening editor links from the debug bar (errors, log files, Captain Hook, ToDo, Template editor, etc), rather than your code editor.
  • Can be enabled as the link handler for live sites only, or local as well if you prefer.
  • Has "Test" functionality for all files so if you make a change, it will only appear for you and not other users.
  • Makes a backup of the old version each time you save a change and provides a "Restore Backup" button to instantly revert.
  • Supports in-code search & replace with CMD+F
  • Syntax highlighting/linting for PHP, CSS, and JS
  • This replaces the Template Editor panel, so that one has been removed.
  • Handles fatal errors gracefully - this is the biggest feature in my opinion. The problem with most online file editors is that if you accidentally make a code change that results in a fatal error, it can be impossible to fix and resave because the system is not functional. This editor gets around this problem by using Tracy's custom error handling which allows debug bar panels to continue to work, so you can manually fix the problem, or click the "Restore Backup" button. Of course if you used the "Test" option, you don't even need to worry, because you are the only one to see the version with the error anyway.

image.thumb.png.050d883e2f50b8359e5a84e4524515c0.png

As a follow up to that last point. I have used the excellent ProcessFileEdit module for helping to debug some issues on other people's sites without needing FTP access, but a couple of times I have made a fatal error mistake and had to get them to restore the file, so this really is a huge feature for me!

 

2) Support for Process File Edit

If you prefer ProcessFileEdit to this new File Editor Panel, so you can use it for handling debug bar links. Note that this won't give you the "Test" and "Restore" options, or the fatal error protection, so it's not really recommended. I added support for it before building the File Editor panel so decided to leave in case others prefer it.

3) Revamped Console Panel 

  • The code and results sections are now a "split" screen so you can adjust the size of one relative to the other with the bar in the middle. Handy for working, but especially handy when you want to post a screenshot to the forums
  • "Large and "Small" versions of the panel - click the arrows at the top right of the panel - the large version can be very handy when you have lots of code or results to display
  • Supports in-code search & replace with CMD+F

image.thumb.png.5f60f96951818223b0ba520e27643b56.png


4) New maxDepth and maxLength shortcuts and new barDumpBig() method

You can now replace dump or barDump calls like:

bd($var, array('maxDepth' => 7, 'maxLength' => 500));

with:

bd($var, [7,500]);

You can also make use of the new:

bdb($var);

as a shortcut to:

bd($var, [6,999]);

 

5) New SQL Query column in the Selector Queries section of the Debug Mode panel

This is a great learning tool to see the selector queries that are run for a given page request, and what SQL query these selectors are translated into:

image.thumb.png.6fba1698525c64823aa14d5c95c60937.png

 

6) Removed old Legacy version of Tracy core

  • It was getting too painful to maintain support for this old version. This means that TD now requires PHP 5.4.4+

7) Namespacing and refactoring lots of Javascript code

  • No feature changes, but code is now easier to follow and is much less prone to any name conflicts with your site

8) Reduced loading of unnecessary code

  • Lots of refactoring here too - should see some performance gains

9) New default server type indicator in the debug bar 

  • Not a big deal, but if you want a server type indicator and don't want the full height/width bar, you can now have one in the debug bar - I think it's a handy visual clue when looking at /working on live vs dev/test versions of a site at the same time.

image.png.fee9a07fbf469adfa336dcc06fa9f47b.png

 

10) Lots and lots of bugs fixes, layout, and styling improvements

  • It's amazing what you find when you're buried in the code for a couple of weeks solid :)
     

11) The new docs site that I mentioned earlier is now fairly complete - I just need to work on the Tips & Tricks section

  • https://adrianbj.github.io/TracyDebugger
  • Feel free to make a PR for improvements to the docs - everything is under the /docs folder in the main Github repo. There are also "Edit on github" links on each page so you can use those as well.
  • Like 13

Share this post


Link to post
Share on other sites

Tracydebugger has come a long way. Thanks for developing it into the powerful tool it has become. 

  • Like 3

Share this post


Link to post
Share on other sites
8 hours ago, pwired said:

Thanks for developing it into the powerful tool it has become.

Just a quick fix: "...the most powerful tool on this planet..." ;) 

  • Like 3

Share this post


Link to post
Share on other sites

JSON API response testing in the Console panel

I know we all know about json_decode($var, true), but here's a useful tip when working with APIs that return JSON.

Note that I am using the new shortcut for specifying a depth of 7 so I get to the deeper levels of the JSON response.

 

image.png.308bf5e4ecff17b0028200ed3d360439.png

 

Obviously that's a LOT nicer than:

image.png.49d3b2d1fe32a5950e604a8f609d5b22.png

 

  • Like 6

Share this post


Link to post
Share on other sites
2 minutes ago, adrian said:

Obviously that's a LOT nicer than:

:D Cool, thanks!

  • Like 1

Share this post


Link to post
Share on other sites

thanks for that tip!

30 minutes ago, adrian said:

Obviously that's a LOT nicer than:

sorry, dont't get it ???

Share this post


Link to post
Share on other sites
1 minute ago, bernhard said:

thanks for that tip!

sorry, dont't get it ???

Sorry @bernhard - I replaced the first image after my initial post, and accidentally replaced the second one as well. Take a look now :)

  • Haha 1

Share this post


Link to post
Share on other sites

New version just committed that is a must for Windows users - a huge thanks to @matjazp for the report and also local access to his dev machine so I could find and fix all the issues. You Windows guys need to speak up when you see issues ;) - the Console, Snippet Runner, and Captain Hook panels in particular were a mess :) Please let me know if you see anything I have missed.

Other changes include:

  • Add custom register_shutdown_function() for Console and Snippet Runner panels - especially important for PHP 5.x. PHP 7 handles most errors as non-fatal.
  • Fix AJAX panel updating for Console/Snippet Runner when SessionHandlerDB not installed.
  • A few styling fixes.
  • Like 4

Share this post


Link to post
Share on other sites
11 minutes ago, adrian said:

the Console, Snippet Runner, and Captain Hook panels in particular were a mess

Nothing obviously wrong/messy with those panels for me with v4.9.9 on Windows 8.1. Maybe some other factor comes into it. Thanks for the update though!

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Robin S said:

Nothing obviously wrong/messy with those panels for me with v4.9.9 on Windows 8.1

Interesting - the key thing was incorrect line numbers on errors when running code in Console/Snippet Runner. And with Captain Hook panel it was a lack of grouping of file under the Site Modules headings. Maybe PHP on different version of Windows IIS handle forward / back slashes differently. All the issues came down to using strpos() to see if the path to a file contained a certain subpath, eg /site/modules - the trouble being that on Windows, I had to look for \site\modules instead. I fixed things with a combination of DIRECTORY_SEPARATOR and in some cases converting the paths to all forward slashes before doing checks, displaying links etc.

Thanks for keeping an eye out for any persistent / new issues.

Share this post


Link to post
Share on other sites

Another useful update - the File Editor panel now remembers and reopens the folder tree to the currently open file and highlights that file. Should make navigation to related files much simpler after save when the page reloads.

  • Like 2

Share this post


Link to post
Share on other sites
10 hours ago, tpr said:

Shadow DOM sounds like the ideal treat for Tracy bar encapsulation headaches,  when it will widely supported:

https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM

When you say "encapsulation headaches" are you talking mostly about css inheritance?

Sorry, I haven't had a good read of that link yet :)

Share this post


Link to post
Share on other sites

Yes, having a separated DOM inside the main DOM, with its fully separated CSS.

  • Like 1

Share this post


Link to post
Share on other sites
Just now, tpr said:

Yes, having a separated DOM inside the main DOM, with its fully separated CSS.

Sounds awesome - thanks for the heads up. I wonder how hard it will be to implement and whether it really needs to be implemented in the Tracy core or not?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester