adrian Posted February 29, 2016 Author Share Posted February 29, 2016 Ok, the PHP 5.3 issue should be fixed in TracyDebugger and a PR has been submitted for Performance panel as well. 3 Link to comment Share on other sites More sharing options...
adrian Posted March 1, 2016 Author Share Posted March 1, 2016 Some more improvements: Fields List and Values section on the PW Info panel Take a look at the "images" field in the screeshot - much cleaner and more informative. I have populated all the files/images related properties: filename, ext, url, httpUrl, filesize, filesizeStr, width, height, description, etc. Think of it as a cheatsheet with properties and values built right in. I have also added formatted dates and user names in parentheses for reference. Variables Panel I have also recently tweaked the Variables panel to be easier to read and to separate into columns with the variable name, its type, and value: Development Tip One final thing - a bit of a development tip using Tracy - want a quick way to see the results of a PW selector? Try this out in one of your template files: bd($pages->find("template=basic-page")->explode('name')); You will see something like this in your Dumps panel: On a live site in production mode, it pays to do it like this: if($user->isSuperuser()) bd($pages->find("template=basic-page")->explode('name')); This way, even if your selector generates an exception (quite easy to do if you accidentally enter an incorrect field name), no-one but you will see the error. 4 Link to comment Share on other sites More sharing options...
matjazp Posted March 1, 2016 Share Posted March 1, 2016 (edited) Now I get (in Diag & Output panel): PDOException: SQLSTATE[HY000] [2002] Nobene povezave ni mogoe vzpostaviti, ker jo ciljni raunalnik aktivno zavraa. in C:\inetpub\wwwroot\site\assets\cache\FileCompiler\site\modules\TracyDebugger\DiagnosticsPanel.inc:287 Stack trace: #0 C:\inetpub\wwwroot\site\assets\cache\FileCompiler\site\modules\TracyDebugger\DiagnosticsPanel.inc(287): PDO->__construct('mysql:host=loca...', 'myusername', 'mypassword') #1 C:\inetpub\wwwroot\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy\src\Tracy\Bar.php(73): DiagnosticsPanel->getPanel() #2 C:\inetpub\wwwroot\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy\src\Tracy\Debugger.php(221): Tracy\Bar->render() #3 [internal function]: Tracy\Debugger::shutdownHandler() #4 {main} It shows user/pass for DB in plain view... A also can't move some panels, see the video. Edited March 1, 2016 by matjazp 2 Link to comment Share on other sites More sharing options...
adrian Posted March 1, 2016 Author Share Posted March 1, 2016 Sorry about the database connection error. There was a problem with some attributes and the PW $database connection, but I have removed those two problem ones and now use $database. Please let me know if it is working properly again now with the latest version. I know about the panel moving issue - some do that weird resizing before they will move. It is on my list of things to take a look at - not sure if it's maybe a core Tracy issue, but I'll try to sort it out regardless. 1 Link to comment Share on other sites More sharing options...
matjazp Posted March 1, 2016 Share Posted March 1, 2016 (edited) No luck with the new version, error is stil there. Hm, it's working now ... don't know what I did... Edited March 1, 2016 by matjazp 1 Link to comment Share on other sites More sharing options...
adrian Posted March 1, 2016 Author Share Posted March 1, 2016 No luck with the new version, error is stil there. Hm, it's working now ... don't know what I did... Glad it's working fine now - please let me know if you come across any other problems with that. Link to comment Share on other sites More sharing options...
tpr Posted March 1, 2016 Share Posted March 1, 2016 Thanks for the new releases! I get used to it recently, updating Tracy when having the morning coffee Adding an "in-panel search as you type" feature would be handy I think. Basically I mean a search input above the panel tables (one per panel), in which if you start typing the table non-matching rows would get hidden. The problem is that not all panels have tables but divs. 1 Link to comment Share on other sites More sharing options...
ukyo Posted March 1, 2016 Share Posted March 1, 2016 After update to version 0.9.7 i have this error : Fatal error: Call to a member function getImageInfo() on a non-object in /......./......./......./......./site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc on line 259 Tracy panel not appear for front-end and if i comment this line it look like working. PW version : ProcessWire 3.0.9 devns Link to comment Share on other sites More sharing options...
adrian Posted March 1, 2016 Author Share Posted March 1, 2016 Hey @ukyo - sorry about that - please try the latest version and let me know how it goes for you. That was actually some leftover code that wasn't needed anymore 1 Link to comment Share on other sites More sharing options...
ukyo Posted March 1, 2016 Share Posted March 1, 2016 With 0.9.8 version problem look like gone. Thanks for quick reply / fix ! 1 Link to comment Share on other sites More sharing options...
adrian Posted March 2, 2016 Author Share Posted March 2, 2016 Hi everyone, I have just set up the ability to customize the potocol handler for opening files in your editor directly to the line of error - this is potentially a huge timesaver The new config setting is "Editor Protocol Handler": It is initially configured for SublimeText because that is my editor and I know lots of you also use it. To make things work, grab this free subl:// protocol registering app: https://github.com/saetia/sublime-url-protocol-mac - note the instructions at the bottom if you need to make it work for ST2 instead of ST3. If you're not using ST, there are other ways to set up your own custom protocol handler, but I'l leave you guys to figure that out. Once you have done that you will be able to click on any of the links in errors, dumps, and barBumps and it will open the file in ST to the exact line. Note: the links are to the actual original files, not the PW 3.x compiled versions ! 3 Link to comment Share on other sites More sharing options...
szabesz Posted March 2, 2016 Share Posted March 2, 2016 You did it again adrian Thanks a lot! Regarding protocol handlers, these links might be of interest too: https://pla.nette.org/en/how-open-files-in-ide-from-debugger and https://github.com/aik099/PhpStormProtocol 2 Link to comment Share on other sites More sharing options...
lpa Posted March 2, 2016 Share Posted March 2, 2016 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/ Link to comment Share on other sites More sharing options...
adrian Posted March 2, 2016 Author Share Posted March 2, 2016 Hi @Ipa, It's working fine for me on Safari, Chrome, and Firefox on my Mac with Sublime so I am guessing it's an eclipse issue. I wonder if it could be solved in your applescript with the urldecode line from this snippet? using terms from application "Quicksilver" on process text theurl return do shell script "php -r 'echo urldecode(\"" & theurl & "\");'" end process text end using terms from https://qsapp.com/wiki/Encode/Decode_URL_(AppleScript) or maybe one of these options: http://harvey.nu/applescript_url_decode_routine.html http://macscripter.net/viewtopic.php?id=3675 If that doesn't work, here is the route of the "problem": https://github.com/adrianbj/TracyDebugger/blob/master/tracy/src/Tracy/Helpers.php#L49 Of course that is part of the Tracy core so I'd rather not edit it. I did however test with Sublime by removing the `rawurlencode` on that line and it works fine. Maybe if you can't get Eclipse to work, you could post on the Tracy forums to see if they would remove the encoding, although I expect it is important if there are spaces in the path? I'd actually like to start compiling a list of resources for all of the various editors and platforms. I will add these to the module's readme as they are provided by you guys! 1 Link to comment Share on other sites More sharing options...
matjazp Posted March 3, 2016 Share Posted March 3, 2016 I see this in browser's View source: </body> </html> ?> <!-- Tracy Debug Bar --> <script> (function() {... There is unexpected "?>" but only in front end, not in backend. Also, is it ok to have script after the </html>? Link to comment Share on other sites More sharing options...
adrian Posted March 3, 2016 Author Share Posted March 3, 2016 The position of the Tracy script after </html> might be a little weird - I am not sure their reasoning for this, but it's definitely a core Tracy thing, rather than an issue with this module. Take at look at their demo page and you'll notice the same thing: https://nette.github.io/tracy/tracy-exception.html As for the extra "?>" - that looks to be related to the Variables panel - I am injecting code into the end of the compiled template files to make this work. I thought my regex was handling all scenarios, but perhaps not. Could you please try clearing your FileCompiler templates cache and let me know if the issue remains. If it does, please post the last few lines of your template file so I can test here and fix it. 1 Link to comment Share on other sites More sharing options...
matjazp Posted March 3, 2016 Share Posted March 3, 2016 Issue remains, but depends on template file: <?php echo $page->title; is ok. <?php echo $page->title; ?> is also ok. <?php echo $page->title; ?> foo is not ok. Link to comment Share on other sites More sharing options...
adrian Posted March 3, 2016 Author Share Posted March 3, 2016 Thanks @matjazp - that helped - I had forgotten to consider text after the last closing php tag. I have a fix that is working here. I have something else I am working on with Tracy right now so I'll commit both things fairly soon. 2 Link to comment Share on other sites More sharing options...
adrian Posted March 4, 2016 Author Share Posted March 4, 2016 @matjazp - just letting you know that the latest version includes the fix for your problem. Could you please let me know if it works for you? 1 Link to comment Share on other sites More sharing options...
matjazp Posted March 4, 2016 Share Posted March 4, 2016 Yes, it works for me, I had to clean the templates cache. One more thing: debug.innerHTML is "oneliner", with " \n\n" etc. How do you manage to debug that? 1 Link to comment Share on other sites More sharing options...
adrian Posted March 4, 2016 Author Share Posted March 4, 2016 Glad to hear it's working for you - hopefully this new approach will work in all scenarios. As for debugging debug.innerHTML - I haven't had to debug it yet - it's mostly generated by Tracy anyway. Being a JS variable, there isn't really an easy way of making it multiline without concatenation, which really isn't worth the trouble in this case. I am looking forward to Template Literals in ES6 though - we'll finally have real multiline variables for JS. But, back to your question, - if you do need to debug code like that you can use the regex find & replace option in your editor to replace \\n with \n and \\t with \t and it will be fully formatted. In Sublime Text (in case you use that), click the asterisk in the find and replace box - super easy! 1 Link to comment Share on other sites More sharing options...
adrian Posted March 5, 2016 Author Share Posted March 5, 2016 Small update that enhances links from the PW Info panel Summary section - now you can have shortcuts to either view (page name) or edit (page id) each of the linked pages that are related to the current page. The children item now has: an "open tree" link (opens this page in the page tree expanded to show all children) an "edit" link (opens this page to the Children tab, which is particularly useful if you have Batch Child Editor installed). The template filename in the Template Info section uses the defined editor protocol handler to open the file directly in your code editor. Hopefully you'll all find these nice little time/click savers And page edit and template file edit buttons are also in the footer of this panel for instant access: 6 Link to comment Share on other sites More sharing options...
adrian Posted March 6, 2016 Author Share Posted March 6, 2016 New public method: TD::templateVars() templateVars() tv() Basically what this does is strip any system PW variables and returns just those that you have defined in your template file. It replicates what is output on the "Variables" panel, but lets you dump, barDump, fireLog, or log at whatever points you want throughout the execution of your template file script. Obviously if you are only interested in the changes to one variable there is no point in using this, but if you want to see how they all change, this is a nice shortcut. It is really only designed to work with PHP's get_defined_vars() Here's an example output via barDump: bd() $i=0; $x=10; bd(tv(get_defined_vars()), 'breakpoint one'); $i++; $x--; bd(tv(get_defined_vars()), 'breakpoint two'); This results in: Without tv() in there it would include all PW variables/objects and it would be difficult to see the variables you are interested in. Note that the templateVars() and tv() shortcuts/aliases may need to be turned on in the config settings if you are upgrading. 4 Link to comment Share on other sites More sharing options...
adrian Posted March 8, 2016 Author Share Posted March 8, 2016 You can now click on the text of any entry in the PW and Tracy log panels to open the file in your code editor to the line number of the clicked entry. Of course for this to work, you need to have properly configured your editor protocol handler. Not really worthy of a screenshot, but still a very handy shortcut that I hope you'll find useful for when you have an log entry that has been truncated because it's too long for the built-in viewer. 1 Link to comment Share on other sites More sharing options...
szabesz Posted March 8, 2016 Share Posted March 8, 2016 Note: the links are to the actual original files, not the PW 3.x compiled versions ! Hello adrian, Thank you very much again for the new feature! I have just found the time to test out this protocol handler thingy, and with the following configuration string it seems to work well with PhpStorm Mac: phpstorm://open?file=%file&line=%line However, it does open the compiled file in cache instead of the original ones. Do you have any ideas why? 1 Link to comment Share on other sites More sharing options...
Recommended Posts