David Dashifen Kees
2007-Apr-19 14:00 UTC
dump() javascript function - like PHP''s print_r()
I know I''ll be using this one from time to time; thought others might like it, too. The dump() function is similar to PHP''s print_r() and will show the contents of an object in a human-readable format. More information: http://www.openjs.com/scripts/others/dump_function_php_print_r.php. - Dash - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Richard Quadling
2007-Apr-19 14:11 UTC
Re: dump() javascript function - like PHP''s print_r()
Use Firebug and call console.dir(xxx,yyy,zzz) You can also use FireBugLite for IE to do the same. http://www.getfirebug.com On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > I know I''ll be using this one from time to time; thought others might > like it, too. The dump() function is similar to PHP''s print_r() and > will show the contents of an object in a human-readable format. More > information: > http://www.openjs.com/scripts/others/dump_function_php_print_r.php. > > - Dash - > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Apr-19 15:11 UTC
Re: dump() javascript function - like PHP''s print_r()
True, but this may provide the opportunity for those who don''t have firebug or firebuglite (for some unknown reason) and the output is nicer if you''re alerting the information rather than using the console functions of firebug. - Dash - Richard Quadling wrote:> Use Firebug and call console.dir(xxx,yyy,zzz) > > You can also use FireBugLite for IE to do the same. > > http://www.getfirebug.com > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> I know I''ll be using this one from time to time; thought others might >> like it, too. The dump() function is similar to PHP''s print_r() and >> will show the contents of an object in a human-readable format. More >> information: >> http://www.openjs.com/scripts/others/dump_function_php_print_r.php. >> >> - Dash - >> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Richard Quadling
2007-Apr-19 15:17 UTC
Re: dump() javascript function - like PHP''s print_r()
To generate such a thing, you could take a look at the cool PHP class dbug at http://dbug.ospinto.com Converting this to JS wouldn''t be too onerous. Is this the sort of thing you are looking for? On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > True, but this may provide the opportunity for those who don''t have firebug > or firebuglite (for some unknown reason) and the output is nicer if you''re > alerting the information rather than using the console functions of firebug. > > - Dash - > > Richard Quadling wrote: > Use Firebug and call console.dir(xxx,yyy,zzz) > > You can also use FireBugLite for IE to do the same. > > http://www.getfirebug.com > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > I know I''ll be using this one from time to time; thought others might > like it, too. The dump() function is similar to PHP''s print_r() and > will show the contents of an object in a human-readable format. More > information: > http://www.openjs.com/scripts/others/dump_function_php_print_r.php. > > - Dash - > > > > > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Richard Quadling
2007-Apr-19 15:39 UTC
Re: dump() javascript function - like PHP''s print_r()
Having said that though, your code could easily include FireBugLite.js and call console.dir(). That way you get a strong script (firebug is THE debugging script it seems) and can easily add this to your script loader (I use combine.php from http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files) If you don''t have server side PHP, making a Perl, Python or ASP variant shouldn''t be too hard. What I''m saying is that something like the print_r() command in PHP is really a poor debugging tool. Debugging shouldn''t be something you "leave in" on a production site. But by using firebuglite.js you can add debugging to your client side code easily and remove it just as easily too. On 19/04/07, Richard Quadling <rquadling-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> To generate such a thing, you could take a look at the cool PHP class > dbug at http://dbug.ospinto.com > > Converting this to JS wouldn''t be too onerous. > > Is this the sort of thing you are looking for? > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > > True, but this may provide the opportunity for those who don''t have firebug > > or firebuglite (for some unknown reason) and the output is nicer if you''re > > alerting the information rather than using the console functions of firebug. > > > > - Dash - > > > > Richard Quadling wrote: > > Use Firebug and call console.dir(xxx,yyy,zzz) > > > > You can also use FireBugLite for IE to do the same. > > > > http://www.getfirebug.com > > > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > > > > I know I''ll be using this one from time to time; thought others might > > like it, too. The dump() function is similar to PHP''s print_r() and > > will show the contents of an object in a human-readable format. More > > information: > > http://www.openjs.com/scripts/others/dump_function_php_print_r.php. > > > > - Dash - > > > > > > > > > > > > > > > > > > > -- > ----- > Richard Quadling > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Apr-19 15:47 UTC
Re: dump() javascript function - like PHP''s print_r()
Wow, that is pretty cool. It might be more than I personally need for a javascript object dumping option, but it is very cool.'''' - Dash Richard Quadling wrote:> To generate such a thing, you could take a look at the cool PHP class > dbug at http://dbug.ospinto.com > > Converting this to JS wouldn''t be too onerous. > > Is this the sort of thing you are looking for? > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> True, but this may provide the opportunity for those who don''t have firebug >> or firebuglite (for some unknown reason) and the output is nicer if you''re >> alerting the information rather than using the console functions of firebug. >> >> - Dash - >> >> Richard Quadling wrote: >> Use Firebug and call console.dir(xxx,yyy,zzz) >> >> You can also use FireBugLite for IE to do the same. >> >> http://www.getfirebug.com >> >> On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >> >> >> I know I''ll be using this one from time to time; thought others might >> like it, too. The dump() function is similar to PHP''s print_r() and >> will show the contents of an object in a human-readable format. More >> information: >> http://www.openjs.com/scripts/others/dump_function_php_print_r.php. >> >> - Dash - >> >> >> >> >> >> > >> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
An other option are tPrototype''s built-in inspect() methods: >>> $H({blah:''blech''}).inspect() "#<Hash:{''blah'': ''blech''}>" best, Thomas Am 19.04.2007 um 17:47 schrieb David Dashifen Kees:> Wow, that is pretty cool. It might be more than I personally need > for a javascript object dumping option, but it is very cool.'''' > > - Dash > > Richard Quadling wrote: >> To generate such a thing, you could take a look at the cool PHP class >> dbug at http://dbug.ospinto.com >> >> Converting this to JS wouldn''t be too onerous. >> >> Is this the sort of thing you are looking for? >> >> On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >> >>> True, but this may provide the opportunity for those who don''t >>> have firebug >>> or firebuglite (for some unknown reason) and the output is nicer >>> if you''re >>> alerting the information rather than using the console functions >>> of firebug. >>> >>> - Dash - >>> >>> Richard Quadling wrote: >>> Use Firebug and call console.dir(xxx,yyy,zzz) >>> >>> You can also use FireBugLite for IE to do the same. >>> >>> http://www.getfirebug.com >>> >>> On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >>> >>> >>> I know I''ll be using this one from time to time; thought others >>> might >>> like it, too. The dump() function is similar to PHP''s print_r() and >>> will show the contents of an object in a human-readable format. More >>> information: >>> http://www.openjs.com/scripts/others/dump_function_php_print_r.php. >>> >>> - Dash - >>> >>> >>> >>> >>> >>> > >>> >>> >> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Apr-19 16:36 UTC
Re: dump() javascript function - like PHP''s print_r()
Sure, I understand that. I''m not indicating that this should be something that''s available in production, but only that someone in addition to me might one day possibly find it useful when debugging something, not that it''s the be-all-end-all of javascript debugging capabilities. I''m a big firebug user and I evangelize it at every opportunity, but fact of the matter is that some people don''t use firefox and, those who don''t, might not be willing to use firebuglite or, prior to this thread, may not have been aware of it. Thus, a function like dump() might come in very handy for them. - Dash - Richard Quadling wrote:> Having said that though, your code could easily include FireBugLite.js > and call console.dir(). That way you get a strong script (firebug is > THE debugging script it seems) and can easily add this to your script > loader (I use combine.php from > http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files) > > If you don''t have server side PHP, making a Perl, Python or ASP > variant shouldn''t be too hard. > > What I''m saying is that something like the print_r() command in PHP is > really a poor debugging tool. Debugging shouldn''t be something you > "leave in" on a production site. > > But by using firebuglite.js you can add debugging to your client side > code easily and remove it just as easily too. > > On 19/04/07, Richard Quadling <rquadling-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> To generate such a thing, you could take a look at the cool PHP class >> dbug at http://dbug.ospinto.com >> >> Converting this to JS wouldn''t be too onerous. >> >> Is this the sort of thing you are looking for? >> >> On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >> >>> True, but this may provide the opportunity for those who don''t have firebug >>> or firebuglite (for some unknown reason) and the output is nicer if you''re >>> alerting the information rather than using the console functions of firebug. >>> >>> - Dash - >>> >>> Richard Quadling wrote: >>> Use Firebug and call console.dir(xxx,yyy,zzz) >>> >>> You can also use FireBugLite for IE to do the same. >>> >>> http://www.getfirebug.com >>> >>> On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >>> >>> >>> I know I''ll be using this one from time to time; thought others might >>> like it, too. The dump() function is similar to PHP''s print_r() and >>> will show the contents of an object in a human-readable format. More >>> information: >>> http://www.openjs.com/scripts/others/dump_function_php_print_r.php. >>> >>> - Dash - >>> >>> >>> >>> >>> >>> > > >>> >>> >> -- >> ----- >> Richard Quadling >> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 >> "Standing on the shoulders of some very clever giants!" >> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Richard Quadling
2007-Apr-20 08:56 UTC
Re: dump() javascript function - like PHP''s print_r()
I see what you''re saying, but I would feel happier using an off-the-shelf debugging tool rather than having to go through the whole design process for a roll-my-own. firebuglite.js does what it needs to do VERY well. For full blown FireBug there is a clever extension which allows you to report PHP variables to a new panel in FireBug - http://firephp.org/. I think what I''m saying is that if you are prepared to use a third party library like prototype, then you''ve obviously got your head screwed on the right way round. There would be little mileage in re-inventing the wheel when Firebug/FireBugLite does then job. Sure, you way want a something like dBug, but that is PHP specific. Also, prototype is not a debugging tool, it is an enabler - debugging should have happened long before you get to production. And that is why I like firebug. You can add a single line to your code and all the debugging info becomes available. Nice and clean and less intrusive than editing the code to add a ton of debug prints when you may edit something else. On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > Sure, I understand that. I''m not indicating that this should be something > that''s available in production, but only that someone in addition to me > might one day possibly find it useful when debugging something, not that > it''s the be-all-end-all of javascript debugging capabilities. I''m a big > firebug user and I evangelize it at every opportunity, but fact of the > matter is that some people don''t use firefox and, those who don''t, might not > be willing to use firebuglite or, prior to this thread, may not have been > aware of it. Thus, a function like dump() might come in very handy for > them. > > - Dash - > > Richard Quadling wrote: > Having said that though, your code could easily include FireBugLite.js > and call console.dir(). That way you get a strong script (firebug is > THE debugging script it seems) and can easily add this to your script > loader (I use combine.php from > http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files) > > If you don''t have server side PHP, making a Perl, Python or ASP > variant shouldn''t be too hard. > > What I''m saying is that something like the print_r() command in PHP is > really a poor debugging tool. Debugging shouldn''t be something you > "leave in" on a production site. > > But by using firebuglite.js you can add debugging to your client side > code easily and remove it just as easily too. > > On 19/04/07, Richard Quadling <rquadling-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > To generate such a thing, you could take a look at the cool PHP class > dbug at http://dbug.ospinto.com > > Converting this to JS wouldn''t be too onerous. > > Is this the sort of thing you are looking for? > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > True, but this may provide the opportunity for those who don''t have firebug > or firebuglite (for some unknown reason) and the output is nicer if you''re > alerting the information rather than using the console functions of firebug. > > - Dash - > > Richard Quadling wrote: > Use Firebug and call console.dir(xxx,yyy,zzz) > > You can also use FireBugLite for IE to do the same. > > http://www.getfirebug.com > > On 19/04/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > I know I''ll be using this one from time to time; thought others might > like it, too. The dump() function is similar to PHP''s print_r() and > will show the contents of an object in a human-readable format. More > information: > http://www.openjs.com/scripts/others/dump_function_php_print_r.php. > > - Dash - > > > > > > > > > > > > -- > ----- > Richard Quadling > Zend Certified Engineer : > http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > > > > > > > >-- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---