{"id":432,"date":"2014-01-26T12:10:34","date_gmt":"2014-01-26T17:10:34","guid":{"rendered":"http:\/\/www.cloppermillweather.org\/blog\/?p=432"},"modified":"2014-01-26T20:05:20","modified_gmt":"2014-01-27T01:05:20","slug":"more-bug-squashing","status":"publish","type":"post","link":"https:\/\/www.cloppermillweather.org\/blog\/2014\/01\/26\/more-bug-squashing\/","title":{"rendered":"More Bug Squashing"},"content":{"rendered":"<p>Now that I was paying more attention to the Web site, I decided to make the alerts page more dynamic in order to address another nagging issue.\u00a0 If an NWS alert went into effect or expired while a user had the page open, the alert would display or clear itself dynamically on the banner at the top of the page.\u00a0 All of my pages have this capability.\u00a0 The issue is that the alert details displayed below on the weather advisories page do not update dynamically to match the banner.\u00a0 Also, the weather discussion and weather outlook were static and didn&#8217;t update over time if the page was left open.\u00a0 So I set out to make the entire page update dynamically.\u00a0 Using Knockout made short work of that item.\u00a0 I just needed to build server side pages to retrieve and return the data in JSON format.\u00a0 On the client side I modified the page to periodically retrieve the alerts, details, and discussion information and update the display.\u00a0 I got that working well and decided I should confirm that everything was working in other browsers.<\/p>\n<p>Firefox and Chrome worked fine.\u00a0 Then I tried IE11.\u00a0 Not only did this page not display correctly, but none of my other pages were updating either.\u00a0 This puzzled me because I was sure it was working previously.\u00a0 I must not have ever tested with IE11.\u00a0 So now it was time for some frantic debugging to take place.\u00a0 I eventually narrowed it down to a custom event I was using that wasn&#8217;t firing when the data was retrieved.\u00a0 This was the event that caused the page to display any updated data.\u00a0 If I refreshed the page the event would fire correctly.\u00a0 It only happened on the initial load of the page.\u00a0 So none of my dynamic pages were updating dynamically in IE11.\u00a0 Not good.<\/p>\n<p>After I pondered this for a while I wondered why I was using an event in the first place.\u00a0 I&#8217;m pretty sure it had to do with the fact that there were different schedules for retrieving the different types of data, and the different functions that got called to refresh the page.\u00a0 At one point in the past I had consolidated all of those functions, so now i had the ability to just call it directly without triggering an event.\u00a0 I made that change and all the pages worked in all the browsers I tested.\u00a0 Success!<\/p>\n<p>During this process I also decided to update the versions of Minify, jQuery, and Knockout I was using to the latest versions.\u00a0 I didn&#8217;t really see a difference from that change, but I hadn&#8217;t updated them for a long time so it was overdue.\u00a0 I also took the opportunity to add a bit more error checking and console logging to my JavaScript code.\u00a0 That should help debugging in the future.I also added a local alerts page that displays alerts created by our local county.\u00a0 I ended up moving the Government status updates off of the traffic page and adding it to the local alerts page as well.<\/p>\n<p>I still haven&#8217;t updated the source code zip file on the software Web page.\u00a0 Hopefully that will come soon.\u00a0 I also haven&#8217;t put my new and more dynamic weather advisories page into production yet.\u00a0 Testing has been fine so far, but i may want to tweak a few things before I release it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that I was paying more attention to the Web site, I decided to make the alerts page more dynamic in order to address another nagging issue.\u00a0 If an NWS alert went into effect or expired while a user had &hellip; <a href=\"https:\/\/www.cloppermillweather.org\/blog\/2014\/01\/26\/more-bug-squashing\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-432","post","type-post","status-publish","format-standard","hentry","category-weather"],"_links":{"self":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/comments?post=432"}],"version-history":[{"count":0,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/432\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/media?parent=432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/categories?post=432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/tags?post=432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}