{"id":3554,"date":"2013-08-08T05:51:58","date_gmt":"2013-08-07T19:51:58","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=3554"},"modified":"2013-08-08T05:51:58","modified_gmt":"2013-08-07T19:51:58","slug":"phpjavascripthtml-debug-techniques-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/phpjavascripthtml-debug-techniques-primer-tutorial\/","title":{"rendered":"PHP\/Javascript\/HTML Debug Techniques Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Debugging\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP\/Javascript\/HTML Debug Techniques Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Debugging\/PHP_Javascript_HTML-Debug-4of.jpg\" title=\"PHP\/Javascript\/HTML Debug Techniques Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">PHP\/Javascript\/HTML Debug Techniques Primer Tutorial<\/p><\/div>\n<p>Doubt there are many programmers out there that have not been baffled (for hours) about what turns out to be the stupidest mistakes, on occasions.   When the mistake is done in language tools of the web like PHP and Javascript and HTML there may be no IDE to help you out like with the great debugging (step through and over) systems of Visual Studio and Xcode and the Microsoft Office VBA functionality.   Often find myself in a state of denial thinking I&#8217;ll see the problem sooner than it comes, but often it is better to be logical, and this often depends, for success, on the frame of your mind.   So the great I.T. community comes to the fore again with some good tools online or otherwise, and will show you today, in this tutorial, the use of PHP lint (via command line php -l [php-file-to-check.php]), <a target=_blank href='http:\/\/www.javascriptlint.com\/online_lint.php' title='Javascript lint'>Javascript lint<\/a>, a <a target=_blank title='Javascript online syntax checker' href='http:\/\/writecodeonline.com\/javascript\/'>Javascript online syntax checker<\/a> and <a target=_blank href='http:\/\/validator.w3.org' title='W3C XHTML 1.0 validator'>W3C XHTML 1.0 validator<\/a>.   These debugging tools are good for code in isolation, like the sort of thing you try to prove with unit testing, so the other extremely useful tool is the Web Browser&#8217;s View Source used a lot here too.  Another resource, of course, are the various error logs that are created on the web server.   Often PHP errors will turn up in the Apache error log.<\/p>\n<p>Enjoy the <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Debugging\/' title='Tutorial link'>tutorial<\/a>, as we depart with Wikipedia&#8217;s view of  <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/Debugging' title='Wikipedia information about debugging'>debugging<\/a>.<\/p>\n<blockquote><p>Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another. Many books have been written about debugging (see below: Further reading), as it involves numerous aspects, including interactive debugging, control flow, integration testing, log files, monitoring (application, system), memory dumps, profiling, Statistical Process Control, and special design tactics to improve detection while simplifying changes.<\/p><\/blockquote>\n<p>Just one last thing is that languages with try\/catch like PHP and Javascript help you with the avoidance of bugs in the first place perhaps, though am sure there would be a school of thought that you should minimize the use of try\/catch (for i\/o (input\/output) the contrary argument is hard to sustain, methinks &#8230; youthunk?).<\/p>\n<p>For HTML debugging have also found <a target=_blank title='Free Online HTML Validator - FreeFormatter.com' href='http:\/\/www.freeformatter.com\/html-validator.html'>Free Online HTML Validator &#8211; FreeFormatter.com<\/a> to be very useful.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d3554' onclick='var dv=document.getElementById(\"d3554\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Software\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d3554' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Doubt there are many programmers out there that have not been baffled (for hours) about what turns out to be the stupidest mistakes, on occasions. When the mistake is done in language tools of the web like PHP and Javascript &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/phpjavascripthtml-debug-techniques-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,33,37],"tags":[305,306,576,706,867,935,1337,1359,1395],"class_list":["post-3554","post","type-post","status-publish","format-standard","hentry","category-elearning","category-software","category-tutorials","tag-debug","tag-debugger","tag-html","tag-lint","tag-online-checker","tag-php-javascript","tag-unit-testing","tag-validator","tag-w3c"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/3554"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=3554"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/3554\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=3554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=3554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=3554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}