Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on November 12, 2011 21:03:03    Last update: November 12, 2011 21:03:03
Experts may disagree but I found it absolutely stunning that JSF EL does not provide an operator for string concatenation. The Java "+" operator is there for the take. Java, which is a strongly typed compiled language, overloads the "+" operator in such a way that any object can be concatenated with a string. But JSF EL, which definitely isn't as strongly typed as Java, restricts the "+" operator to numerical values only! Of course, experts may argue that the "+" operator overloading is a huge design flaw of the Java language. But even so, JSF EL is not the right place to fix it! In some cases, a concatenation operator isn't needed, for example: <ui:repeat var="tab" value="#{tabs}"> <img ... But in case the concatenated...
Created by James on January 10, 2011 12:35:53    Last update: November 04, 2011 19:28:03
The events mouseover and mouseout are fired when the mouse enters/leaves the element where the event handlers are registered, and any nested elements which do not handle these events (because of event bubbling ). The events mouseenter and mouseleave are fired only when the mouse enters/leaves the specified element. Nested elements do not come into play. This following is a test page. You need Firebug to view the console output. Or use the JavaScript Executor bookmarklet. If none of these are available, an alert will popup (but you won't be able to fully test with alert.). <!DOCTYPE HTML> <html> <head> <title>jQu... For the above test page, when you move the mouse through both the outer and inner areas of the mouseover/mouseout rectangle, the output is...
Created by James on October 25, 2011 19:44:30    Last update: October 25, 2011 19:45:40
jQuery automatically maps HTML5 custom data attributes to data storage associated with the data() method. Here's an example: <html> <head> <script type="text/javascript"...
Created by jinx on May 04, 2011 19:39:44    Last update: May 04, 2011 19:42:51
The function include includes the specified file multiple times, while include_once only includes the file once. This is a test: Create file test.php with contents: <?php for ($i = 0; $i < 5; $i++) { inclu... Create file test.inc with contents: <?php echo __FILE__, " included: $i\n"; ?> ... Run test.php , the output is: E:\phpwork\test.inc included: 0 E:\phpwork\test... Change include to include_once , only one line is printed: E:\phpwork\test.inc included: 0 You must use include_once to avoid duplicate includes in the case A includes B and C , but B and C both includes D . The relationship between require and require_once is the same.
Created by jinx on April 25, 2011 11:50:09    Last update: April 25, 2011 11:51:53
Use the PHP function property_exists to check if the class or object has a certain property. It returns TRUE if the property exists (even when the value of the property is NULL), FALSE if the property does not exist, or NULL in case of an error. Example: <?php class A { var $p = 'A property'; ... Outputs: Class A has property $p: bool(false) Class A ha...
Created by jinx on April 20, 2011 08:59:07    Last update: April 20, 2011 08:59:30
You get this warning when timezone is not set (which is the default): PHP Warning: mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in test.php on line 8 To get rid of the warning message, set timezone in php.ini : ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;...
Created by jinx on April 16, 2011 13:08:50    Last update: April 16, 2011 13:09:13
There are two functions: int strcasecmp (string $str1 , string $str2) : binary safe case-insensitive string comparison. int strnatcasecmp (string $str1 , string $str2) : case insensitive string comparisons using a "natural order" algorithm (a comparison algorithm that orders alphanumeric strings in the way a human being would). In both cases the function returns: < 0 if str1 is less than str2 = 0 if str1 is equal to str2 > 0 if str1 is greater than str2
Created by jinx on March 10, 2011 12:01:15    Last update: March 10, 2011 12:01:15
Use the strcasecmp function to compare two strings case insensitively. <?php if (strcasecmp('apple', 'Orange') > 0...
Created by jinx on March 10, 2011 11:50:18    Last update: March 10, 2011 11:50:46
Use the strtolower function to convert a string to lower case. <?php echo strtolower('strtolower - Make A ...
Created by Dr. Xi on November 18, 2010 22:13:36    Last update: November 18, 2010 22:13:36
You can use the eval function to substitute a value defined by a variable. Suppose you have a string literal $a = 'a $string' and you want Perl to substitute $string with the value of the $string variable. This is normally not a problem. Because if you use double quote, Perl does the interpretation automatically: $string = 'theactual'; $a = "a $string"; pri... But this doesn't work if the value of $string isn't available when you define the template $a . In this case, you have to use single quote to preserve the template definition. But you can use eval to do the replacement when the value of $string becomes available: #!/usr/bin/perl $a = 'a $string'; $string = ...
Previous  1 2 Next