Recent Notes
Displaying keyword search results 1 - 10
Created by James on August 27, 2012 10:01:07
Last update: August 27, 2012 10:01:07
Some ways to get the tag name of a jQuery object:
Use the prop() function:
$('<a/>').prop('tagName');
$('<a/>').prop('node...
Get tagName from the DOM element:
$('<a/>').get(0).tagName
nodeName from the DOM element seems to do the same:
$('<a/>').get(0).nodeName;
Use the is() function:
$('<a/>').is('A');
$('<a/>').is('a');
Created by voodoo on August 03, 2012 08:42:38
Last update: August 03, 2012 09:31:25
The C function getsockopt lets you get the error codes with the option SO_ERROR . The possible error numbers are defined in the global errno.h . The relevant values are:
#define ETIMEDOUT 110 /* Connection timed out */
...
But here's the whole list on my Linux system ( /usr/include/asm-generic/errno.h ):
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENER...
Created by James on August 01, 2012 14:26:53
Last update: August 01, 2012 14:26:53
The jQuery size() function returns the number of elements in the jQuery object.
According to jQuery doc:
The .size() method is functionally equivalent to the .length property; however, the .length property is preferred because it does not have the overhead of a function call.
Created by James on April 24, 2012 14:01:39
Last update: April 24, 2012 14:01:39
This is the Mathias Bynens placeholder plugin with several bug fixes of my own.
/*! http://mths.be/placeholder v2.0.7 by @mathias ...
Created by James on April 24, 2012 13:50:05
Last update: April 24, 2012 13:50:05
The this object can be changed when calling a JavaScript function with func.call(theObject) . This is an example:
<!DOCTYPE html>
<html>
<head>
<title>jQu...
The JavaScript console logs:
[Global log] this is: [object Window]
[log.cal...
Created by James on April 24, 2012 13:01:07
Last update: April 24, 2012 13:01:07
The jQuery .add methods adds elements to a set of existing jQuery object collection. For example:
$('div').add('span').add('p').each(function() {
...
To build a collection from an empty set:
$coll = $();
$('li').each(function() {
i...
Note that .add does not alter the original object, but returns a new object with the added element, so you have to use:
$coll = $coll.add(elem);
$coll.add(elem) alone does not work!
The reverse of .add is .not( elements | selector ) . Or, you can use .end() to return to the collection before you called .add() .
Created by Fang on January 16, 2012 19:32:20
Last update: January 16, 2012 19:32:54
You can submit a form via Ajax by the jQuery Form Plugin . There are two main methods:
ajaxForm : prepares a form for Ajax submit.
Example:
$('#myFormId').ajaxForm({
target: ...
When the form is submitted, it is sent via Ajax.
ajaxSubmit : submit a form via Ajax.
Example:
$('#myForm2').submit(function() {
// i...
jQuery Form Plugin is not in the core jQuery API, so you have to include an additional JS file:
<head>
<script type="text/javascript" ...
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 Fang on November 02, 2011 16:40:10
Last update: November 02, 2011 16:40:10
Facelet taglib schema from JavaServer Faces Spec 2.0:
<xsd:schema targetNamespace="http://java.sun.com/x...
Created by voodoo on August 30, 2011 12:30:59
Last update: August 30, 2011 12:32:33
Summarized from The C Book : There are essentially two types of object in C: the internal and external objects. Anything declared outside a function is external; anything inside one, including its formal parameters, is internal. Since no function can be defined inside another, functions are always external. All function declarations implicitly have the extern keyword stuck in front of them, whether or not you put it there. These two declaearions are equivalent:
void some_function(void); extern void some_func... The term linkage is used to describe the accessibility of objects from one file to another. There are three types of linkage: external , internal , and no linkage . Type of linkage Type of object Accessibility external external Across files, througout the program internal external Within...