Posts

Showing posts from April, 2020

#if DEBUG Preprocessor Directive on ASP.NET Web Forms Markup

I have a JavaScript that I want to include only on Release mode of my ASP.NET Web Forms app. The script will reside in the markup. To do that I will need to use #if DEBUG . But to have it working in the markup takes me a while to figure out. First, I tried wrapping my script with the following code on the markup under <head> tag and it doesn't work. <% #if !DEBUG %> <script> alert('Hello World!'); </script> <% #endif %> Next, after reading some articles online, I tried to wrap my code using the following code and it still doesn't work. <% if (!Debugger.IsAttached) { %>      <script>           alert('Hello World!');      </script> <% } %> Finally, the one that works for me is when I wrap the whole thing with  <asp:PlaceHolder> tag : <asp:PlaceHolder runat="server"> <% #if !DEBUG %>      <script> ...

Samsung Smart Switch Stuck When Updating Firmware on S20+

My old phone is dying so I got an S20+. The data transfer from old phone is easy, thanks to Samsung Smart Switch. However, even though the phone notified there was an OTA update, it can't download the update. While searching online for solution, I found out that Smart Switch PC can apply the update, so I give that a try. Smart Switch recommends using Samsung original cable, so I use the USB-C to USB-C cable that comes with the S20+. It works well to a point, phone was detected, firmware downloaded, but in my case, it is stuck at 86% for hours. Some people in the forum said, it can take up to 30 minutes. So, this is not normal. During the update, there is an option to cancel by pressing Volume down and Power key. However, that soft-brick the phone and I have to do Emergency Recovery. If you are also at this point, do jot down the "recovery code". I try the Emergency Recovery only to find out, it is also stuck at 86%. I tried two more times with the same result. Not good...