Paul's Programming Notes     Archive     Feed     Github

VBA - Delete Worksheet With A Specific Name If It Exists

Application.DisplayAlerts = False 
On Error Resume Next 
ThisWorkbook.Sheets("Sheet1").Delete 
On Error Goto 0 
Application.DisplayAlerts = True 

  • The code between "On Error Resume Next" and "On Error Goto 0" will be skipped if an error is generated. 
  • It also won't display the error to the user because of the code on line 1 (Application.DisplayAlerts = False).
  • "ThisWorkbook" will need to be declared.


Modifying PhoneGap Childbrowser View

In IOS, removing the back/forward, refresh, and history buttons from ChildBrowser requires opening its .xib file.

I removed everything except the done button:

UIWebView

My First Stack Overflow Answer

http://stackoverflow.com/questions/11783402/iscroll-and-similar-will-not-scroll-horizontally-phonegap-jqtouch-iphone-app/11852309#11852309

I use Stack Overflow a ton, and I'm going to try to make more of an effort to contribute.

I was having trouble scrolling horizontally with the iscroll plugin, and I solved it by enabling the hScroll option (which I thought should have been enabled by default). I use iscroll's zoom function to enable zooming on a single div, while the rest of the page does not zoom.

SigPad API

I had difficulties getting Thomas J Bradley's HTML5 Signature Pad to let me to use its API without resetting the field. This Github issue explains a workaround:

https://github.com/thomasjbradley/signature-pad/issues/13

He is saving the signature, declaring the api variable, then regenerating the signature.

I needed to use the .getSignatureImage() api function which allows me to turn the signature into a base64 string so I could store the signature in a database.

PHP Inline HTML

http://www.4webhelp.net/tutorials/php/echo.php

The article in the link above describes the process of adding inline HTML to PHP code instead of "echo '<html>';". It seems like it's much faster to not process each echo statement with PHP.

This is definitely a big "oh!" moment for someone still learning PHP.

Jquery Mobile - Only Load Once

If you only want something to load once, you can use the "pageinit" event.

Here's an example of some code with "pageinit":

$(document).delegate("#yourPage", "pageinit", function(event) { alert( "ALERT!"); });


The code above would not run if you visited the page again.

Make Phonegap Responsive

The following was absolutely mandatory for me to get my phonegap app to be responsive: https://github.com/cargomedia/jquery.touchToClick

Without modification, Phonegap will wait for a "double-click" after the user taps. This results in a noticeable delay. With the plugin above included, it removes the delay.

Other plugins I tested wanted me to use selectors for each element I didn't want delayed.

Prevent Scrolling

http://hankchizljaw.co.uk/tutorials/prevent-window-bounce-phonegap-1-7-ios-tip/13/05/2012/

The above link is the most simple solution I've found to prevent phone gap from scrolling outside of the bounds.