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 BitPoet
      As threatened in the Pub sub forum in the "What are you currently building?" thread, I've toyed around with Collabora CODE and built file editing capabilities for office documents (Libre-/OpenOffice formats and MS Office as well as a few really old file types) into a PW module.
      If you are running OwnCloud or NextCloud, you'll perhaps be familiar with the Collabora app for this purpose.
      LoolEditor
      Edit office files directly in ProcessWire
      Edit your docx, odt, pptx, xlsx or whatever office files you have stored in your file fields directly from ProcessWire's page editor. Upload, click the edit icon, make your changes and save. Can be enabled per field, even in template context.
      Currently supports opening and saving of office documents. Locking functionality is in development.
      See the README on GitHub for installation instructions. You should be reasonably experienced with configuring HTTPS and running docker images to get things set up quickly.
      Pull requests are welcome!
      Here is a short demonstration:

    • By Robin S
      An Images field allows you to:
      Rename images by clicking the filename in the edit panel or in list view. Replace images, keeping metadata and filename (when possible) by dropping a new image on the thumbnail in the edit panel. Introduced here. But neither of these things is possible in File fields, which prompted this module. The way that files are renamed or replaced in this module is not as slick as in the Images field but it gets the job done. The most time-consuming part was dealing with the UI differences of the core admin themes. @tpr, gives me even more respect for the work that must go into AdminOnSteroids.
      Most of the code to support the rename/replace features is already present in InputfieldFile - there is just no UI for it currently. So hopefully that means these features will be offered in the core soon and this module can become obsolete.
       
      Files Rename Replace
      Allows files to be renamed or replaced in Page Edit.

      Usage
      Install the Files Rename Replace module.
      If you want to limit the module to certain roles only, select the roles in the module config. If no roles are selected then any role may rename/replace files.
      In Page Edit, click "Rename/Replace" for a file...
      Rename
      Use the text input to edit the existing name (excluding file extension).
      Replace
      Use the "Replace with" select to choose a replacement file from the same field. On page save the file will be replaced with the file you selected. Metadata (description, tags) will be retained, and the filename also if the file extensions are the same.
      Tip: newly uploaded files will appear in the "Replace with" select after the page has been saved.
       
      https://github.com/Toutouwai/FilesRenameReplace
      http://modules.processwire.com/modules/files-rename-replace/
    • By d'Hinnisdaël
      So I decided to wade into module development and created a wrapper module around ImageOptim, a service that compresses and optimizes images in the cloud. ImageOptim currently handles JPG, PNG and GIF files and, depending on the settings you use, shaves off between 15% and 60% in filesize. Great for bandwidth and great for users, especially on mobile.
      This module handles the part of uploading images to ImageOptim via their official API, downloading the optimized version and storing it alongside the original image.
       

       
      Download & Info
      GitHub / Module directory / Readme / Usage
       
      Why ImageOptim?
      There are other image optimization services out there, some of them free, that have outstanding ProcessWire modules. A few things make ImageOptim the best tool for most of my customers: It's not free, i.e. it will probably be around for a while and offers support. However, it's cheaper than some of the bigger competitors like Cloudinary. And it does PNG compression better than any of the free services out there, especially those with alpha channels.
       
      Installation
      Install the module like any other ProcessWire module, by either copying the folder into your modules folder or installing it via the admin. See above for downloads links on GitHub and in the module directory.
       
      Requirements
      To be able to upload images to the service, allow_url_fopen must be set on the server. The module will abort installation if that's not the case.
      I have only tested the module on ProcessWire 3.x installations. I don't see why it shouldn't work in 2.x, if anyone wants to try it out and report back.
       
      ImageOptim account
      To compress images, you first need to sign up for an ImageOptim account. They offer free trials to try the service.
       
      Usage (manual optimization)
      Images can be optimized by calling the optimize() method on any image. You can pass an options array to set ImageOptim API parameters.
      $image->size(800,600)->optimize()->url $image->optimize(['quality' => 'low', 'dpr' => 2]) // Set quality to low and enable hi-dpi mode
      Automatic optimization
      The module also has an automatic mode that optimizes all image variations after resizing. This is the recommended way to use this module since it leaves the original image uncompressed, but optimizes all derivative images.
      $image->size(800,600)->url // nothing to do here; image is optimized automatically
      To change compression setting for single images, you can pass an options array along with the standard ImageResizer options. Passing false disables optimization.
      $image->size(800, 600, ['optimize' => 'medium']) $image->size(800, 600, ['optimize' => ['quality' => 'low', 'dpr' => 2]]) $image->size(800, 600, ['optimize' => false])
      For detailed usage instructions and all API parameters, see the usage instructions on GitHub.
       
      Filenames
      Optimized images will be suffixed, e.g. image.jpg becomes image.optim.jpg. You can configure the suffix in the module settings.
       
      Roadmap
      Asynchronous processing. Not really high on the list. Image variations need to be created anyway, so waiting a few seconds longer on first load is preferable to adding complexity to achieve async optimization. Optimize image variations created by other modules. CroppableImage comes to mind. I don't use any of these, so if somebody wants to help out and submit a pull request — all for it! Add a dedicated page in the setup menu with a dashboard and detailed statistics. ImageOptim's API is very barebones for now, so not sure if that's feasible or even necessary.
      Stability
      I've been using this module on production sites for some time now, without hiccups. If you do notice oddities, feel free to comment here or investigate and submit PRs.
    • By daniels
      General
      This is a lightweight alternative to other newsletter & newsletter-subscription modules.
      It can update / create a subscriber in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin.
      This module fits your needs if you...
      ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe users to different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns You can find it here: https://github.com/danielstieber/SubscribeToMailchimp
      Let me know what you think and if I should add it to the Modules Directory.
      Setup
      Log into your Mailchimp account and go to  Profile > Extras > API Keys. If you don't have an API Key, create a new one. Copy your API Key and paste it in the module settings (Processwire > Modules > Site > SubscribeToMailchimp). Back in Mailchimp, go to the list, where you want your new subscribers. Go to Settings > List name and defaults. Copy the List ID an paste it in to the module settings.
      Usage
      To use the module, you need to load it into your template:
      $mc = $modules->get("SubscribeToMailchimp"); Now you can pass an email address to the module and it will try to edit (if the user exists) or create a new subscriber in your list.
      $mc->subscribe('john.doe@example.com'); You can also pass a data array, to add additional info.
      $mc->subscribe('john.doe@example.com', ['FNAME' => 'John', 'LNAME' => 'Doe']); You can even choose an alternative list, if you don't want this subscriber in your default list.
      $mc->subscribe('john.doe@example.com', ['FNAME' => 'John', 'LNAME' => 'Doe'], 'abcdef1356'); // Subscribe to List ID abcdef1356  
      Important Notes
      This module does not do any data validation. Use a sever-sided validation like Valitron Make sure that you have set up your fields in your Mailchimp list. You can do it at Settings > List fields and *|MERGE|* tags Example
      Example usage after a form is submitted on your page:
      // ... validation of form data $mc = $modules->get("SubscribeToMailchimp"); $email = $input->post->email; $subscriber = [ 'FNAME' => $input->post->firstname, 'LNAME' => $input->post->lastname, ]; $mc->subscribe($email, $subscriber);  
      Troubleshooting
      In case of trouble check your ProcessWire warning logs.
      I can't see the subscriber in the list
      If you have enabled double opt-in (it is enabled by default) you will not see the subscriber, until he confirmed the subscription in the email sent by Mailchimp
      I get an error in my ProccessWire warning logs
      Check if you have the right List ID and API Key. Check if you pass fields, that exist in your list. Check if you pass a valid email address. Go to Mailchimps Error Glossary for more Information
      How To Install
      Download the zip file at Github or clone directly the repo into your site/modules If you downloaded the zip file, extract it in your sites/modules directory. You might have to change the folders name to 'SubscribeToMailchimp'. Goto the modules admin page, click on refresh and install it  
    • By PWaddict
      Module for hiding pages for non-superusers.
      Download
      HidePages
      Requirements
      ProcessWire 3.x Changelog
      1.0.1 (31 March 2018)
      Module renamed to prevent confusion 1.0.0 (30 March 2018)
      Initial release