if(typeof variable_here === 'undefined'){
// your code here.
};
Author: Admin
Productivity tools
scroll using pure javascript
Pure javascript
var theElement = document.getElementById(‘yourElementId’);
theElement.scrollIntoView();
Using jquery to select element:
$(SELECTOR)[0].scrollIntoView();
Configure xdebug and XAMPP with netbeans
[XDebug]
zend_extension = “C:xamppphpextphp_xdebug.dll”
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = “C:xampptmp”
;xdebug.profiler_output_name = “cachegrind.out.%t-%s”
xdebug.remote_enable = 1
xdebug.remote_handler = “dbgp”
xdebug.remote_host = “127.0.0.1”
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey=”netbeans-xdebug”
;xdebug.trace_output_dir = “C:xampptmp”
make sure the line “zend_extension…” is uncommented andxdebug.remote_enable is set to 1.
xdebug.idekey should be set to be the same as Netbeans’ PHP debug setting, by default it’s “netbeans-xdebug”. Same for remote_port and remote_mode.
Configure XDebug and Netbeans to listen to external requests
Modify php.ini:
xdebug.remote_autostart = 1
xdebug.idekey=”netbeans-xdebug”
In Netbeans, debug a random file, click continue when it breaks at initial breakpoint.
Run the Android app, Netbeans will break when the app sends a request to the php page.
How to check if a checkbox is checked using jQuery and set/unset it programmatically
<input type=”checkbox” id=”leCheckBox”>
To check if it’s checked or not, use:
var leCheckBoxIsChecked = $(“#leCheckBox:checked”).length>0;
It will returns true if the checkbox is checked and false otherwise.
To check the checkbox programmatically:
$(“#leCheckBox”).prop(“checked”, “true”);
To uncheck the checkbox programmatically:
$(“#leCheckBox”).removeAttr(“checked”)
How to debug PHP PDO statements
get the return value of $statement->execute(). It returns true on success and false on failure.
use $statement->errorInfo(), to find out exactly the error in the query.
Make use of xdebug and netbeans’ debugging capability.
Configure PDO to throw exception when errors occur
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
tips for improve performance for public facing Sharepoint site
1.Enable page output caching.
2. web gardening is not supported by Sharepoint, so don’t enable it.
If the page is accessed by a lot of users, try to reduce load as much as possible
Issues with scrolling on Chrome for Android
Add style overflow:hidden to the tags that have overflow to fix this problem.