Adsense
Popular Posts
- Amazon web serive
- MySQL workbench -"Could not decrypt password cache"
- git svn conversion
- increase mysql query speed
- Unix Utils and wget in Windows
- add comment to table columns in phpMyAdmin
- Special characters pronunciation link
- deposit cheque in TD bank using Mobile phone
- Setup vi syntax for PHP
- Get WAMP running on EC2
Thursday, February 25, 2016
Use return instead of exit in Javascript
In PHP, we use exit function to exit a loop. We should not use exit in Javascrip.
The following statement in JS is wrong
if(fromTUG_id==null || fromTUG_id==undefined ||fromTUG_id==0) {
exit;
}
We should use return instead:
if(fromTUG_id==null || fromTUG_id==undefined ||fromTUG_id==0) {
return;
}
PHP - Comparing String to Integer gives strange results
I have url
SITAview_pdf.php?&guide=wk
In PHP, I have
$guide = $_GET['guide'];
When I tried to compare 0=='wk', the statement is true!
From PHP manual:
String conversion to numbers
When a string is evaluated in a numeric context, the resulting value and type are determined as follows.
The string will be evaluated as a float if it contains any of the characters '.', 'e', or 'E'. Otherwise, it will be evaluated as an integer.
The value is given by the initial portion of the string. If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero). Valid numeric data is an optional sign, followed by one or more digits (optionally containing a decimal point), followed by an optional exponent. The exponent is an 'e' or 'E' followed by one or more digits.
We can use triple equals instead of a double equals. This ensures that what you are comparing is a string that contains the digit zero only, and prevents any type conversion.
such as 0==='wk'
For simplify code, I used
SITAview_pdf.php?&guide=3
to fix the problem
Saturday, February 13, 2016
Allow popup windows in Firefox
A lot of applications, you need to popup a pdf file when you click a link. In Firefox, the default is block pop-up windows. To allow popup in Firefox
1) Click open menu button at right corner of Firefox
2) In the popup menu, click content at right menu
3) Uncheck block pop-up windows
Wednesday, February 3, 2016
Difference between dot and space in CSS
What is difference between
#tab1 a { text-decoration: underline; }
and
#tab.a { text-decoration: underline; }
#tab1 a { text-decoration: underline; }
<div id='tab1'><a>test</a><a>test1</a></div>
put all underline for link under id tab1
#tab.a { text-decoration: underline; }
<a id='tab1'>test</a>
Select link with id tab1 as underline
To remove underline
#tab.a { text-decoration: none; }
Subscribe to:
Posts (Atom)