adrian

Tracy Debugger

Recommended Posts

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

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

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 thuijzer
      https://github.com/thuijzer/processwire-FieldtypeBusinessHours
      Fieldtype Business Hours
      ProcessWire Fieldtype for entering business hours (opening hours)
       
      Input format
      Leave a day empty when closed on that day
      Times are in 24 hour format.
      9:00-12:00 9:00-12:00, 13:00-17:30 16:00-2:00  
      Usage in templates
      Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601)
      echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed'; if($page->field_name[1] == null) { echo 'Closed on Monday'; } if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; } echo $page->field_name[1]; echo $page->field_name[1]->entries[0]->getFrom()->format('H:i');  
    • By Harmen
      Hello all,
      Was wondering if any of you tried to include the Exact PHP client by Picqer in Processwire (URL)? I am trying to at the moment but I am stuck at the Authorization process. Building it inside a module file to execute a certain function every 6 hours to update something on the website. For the authorization process the file has to execute the following piece of code:
      header('Location:'. $urlThatRedirectsMeToTheLoginOfExact); But each time I am trying  to do so, I get the following error: Cannot modify header information - headers already sent by (output started at /processwire/index.php:55). I am out of options so that's why I am trying to find someone who used this library and could get it to work or someone who knows how I can fix it.
      Tips are highly appreciated (if they work ;))
      Cheers, Harmen
    • By BitPoet
      So I stumbled over the request to allow limiting templates to be used only once under every parent page in this thread
      and found that this would actually come in handy (also in a site I've built).
      The code can be found on github and soon also in the module repo.
      After installation, you'll find a new checkbox "Only once per parent" in the family tab when editing a template.

    • By Robin S
      Password Generator
      Adds a password generator to InputfieldPassword.

       
      Usage
      Install the Password Generator module.
      Now any InputfieldPassword has a password generation feature. The settings for the generator are taken automatically from the settings* of the password field.
      *Settings not supported by the generator:
      Complexify: but generated passwords should still satisfy complexify settings in the recommended range. Banned words: but the generated passwords are random strings so actual words are unlikely to occur.  
      https://modules.processwire.com/modules/password-generator/
      https://github.com/Toutouwai/PasswordGenerator
    • By Robin S
      If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it.
      This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click.
      CKEditor Link Files
      Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited.

      Features
      Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. Installation
      Install the CKEditor Link Files module.
      For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field.
       
      http://modules.processwire.com/modules/cke-link-files/
      https://github.com/Toutouwai/CkeLinkFiles