{"id":571,"date":"2012-04-16T22:08:59","date_gmt":"2012-04-16T22:08:59","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=571"},"modified":"2012-04-16T22:08:59","modified_gmt":"2012-04-16T22:08:59","slug":"testing-debugging-easy-way-debug-flag","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/testing-debugging-easy-way-debug-flag\/","title":{"rendered":"Testing and Debugging the easy way: The debug flag"},"content":{"rendered":"<p>Setting and accomodating for a debug flag is one of the easiest ways to turn your script or application into &quot;debug mode&quot;. One such method is to allow for a dedicated query string parameter, say <strong>debug<\/strong>, where in it&#39;s presence, your script runs in &quot;debug mode&quot;.<\/p>\n<p>Using a ColdFusion example, let&#39;s say we want to alter the conditions of a query based on the presence or lack-of the query string debug parameter. The example query selects a list of all users in a database table, in preparation for a mass email. In this situation, a system for simple debugging is crucial.<\/p>\n<p><code>&lt;cfquery name=&quot;users&quot;&gt;<br \/>\n\t&nbsp;&nbsp;&nbsp; SELECT fname, lname, email<br \/>\n\t&nbsp;&nbsp;&nbsp; FROM user<br \/>\n\t&nbsp;&nbsp;&nbsp; &lt;cfif isDefined(&quot;url.debug&quot;)&gt;WHERE email = &#39;testuser@test.com&#39;&lt;\/cfif&gt;<br \/>\n\t&lt;\/cfquery&gt;<br \/>\n\t<\/code><\/p>\n<p>Now, all code in your script, which depends on the users recordset, will only be referencing the &quot;debug&quot; version of the query.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting and accomodating for a debug flag is one of the easiest ways to turn your script or application into &quot;debug mode&quot;. One such method&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[4],"tags":[168],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/571"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=571"}],"version-history":[{"count":1,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/571\/revisions"}],"predecessor-version":[{"id":572,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/571\/revisions\/572"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}