Recent Notes

Displaying notes 1 - 10
Created by James on January 27, 2012 12:38:53    Last update: January 27, 2012 12:39:46
A brief summary of jQuery DOM manipulation methods for reference. .before() and .insertBefore() : insert content before target element - as sibling. Examples: // insert summary before details $('#detail').b... .after() and .insertAfter() : insert content after target element - as sibling. Examples: // insert details after summary $('#summary').a... .prepend() and .prependTo() : insert content as first child of target element. Examples: // prepend caption to table $('table').prepend(... .append() and .appendTo() : insert content as last child of target element. Examples: // append row to table $('table').append('<tr><...
Created by James on January 26, 2012 21:23:56    Last update: January 26, 2012 21:23:56
In an HTML page, elements can overlap because of position styles. When there's an overlap, elements coming later in the HTML code are displayed on the top. This can be altered by specifying z-index in the CSS. Elements with higher z-index are placed on the top. However , z-index only works for elements that are not static positioned. Static positioned elements are always at the bottom compared to relative , fixed and absolute positioned elements. This is a test page: <!DOCTYPE html> <html> <head> <style t... Effects of z-index can be tested by adding it to the elements, for example: <div id="bg" class="big" style="z-index: 3"></div>...
Created by zhidao on January 26, 2012 20:37:45    Last update: January 26, 2012 20:37:45
There are 4 positioning styles in CSS: static : this is the default positioning style. Elements are positioned according to the normal flow of the page. fixed : the element position is fixed relative to the browser window, i.e., when you scroll, the element does not move with other contents in the page. relative : the element is positioned relative to its normal position (i.e., static position). You can use relative positioning to offset an element from its normal position. Other elements are positioned as if the relative positioned element were in its normal position. absolute : the element is positioned relative to the first ancestor element that is not static positioned. If all ancestor elements are static positioned, the element is positioned relative to...
Created by James on January 26, 2012 16:02:55    Last update: January 26, 2012 16:02:55
To append additional data to a form before Ajax form submit: var data = $(form).serializeArray(); data.push(...
Created by James on January 26, 2012 14:26:23    Last update: January 26, 2012 14:26:23
To get the value: $('#idOfTheSelectDropdown :selected').val(); To get the text: $('#idOfTheSelectDropdown :selected').text()
Created by timo on January 25, 2012 20:13:13    Last update: January 25, 2012 20:13:13
The MIPS CPU is able to run both big-endian and little-endian. So a system built on MIPS can be either big-endian (mips) or little-endian (mipsel). The file command shows the architecture: $ file ls ls: ELF 32-bit LSB executable, MIPS, ... but readelf will tell the endianness: $ readelf -h ls ELF Header: Magic: 7f 45...
Created by zhidao on January 25, 2012 19:27:53    Last update: January 25, 2012 19:28:47
The spring MVC annotation-driven declaration: <?xml version="1.0" encoding="UTF-8"?> <beans x... does the following magic : Among others, registers: RequestMappingHandlerMapping RequestMappingHandlerAdapter ExceptionHandlerExceptionResolver in support of processing requests with annotated controller methods using annotations such as @RequestMapping , @ExceptionHandler , etc. Enables Spring 3 style type conversion through a ConversionService instance in addition to the JavaBeans PropertyEditors used for Data Binding. Enables support for formatting Number fields using the @NumberFormat annotation through the ConversionService . Enables support for formatting Date, Calendar, Long, and Joda Time fields using the @DateTimeFormat annotation, if Joda Time 1.3 or higher is present on the classpath. Enables support for validating @Controller inputs with @Valid , if a JSR-303 Provider is present on the classpath. Enables HttpMessageConverter support for @RequestBody method parameters and...
Created by zhidao on January 25, 2012 16:07:29    Last update: January 25, 2012 16:07:29
A JSON response is auto-magically returned when you add the @ResponseBody annotation to the return value of a @RequestMapping annotated method: import org.springframework.stereotype.Controller; ... For magic to happen, you must: Add annotation-driven to the org.springframework.web.servlet.DispatcherServlet config xml: <?xml version="1.0" encoding="UTF-8"?> <beans x... Put Jackson jar files on CLASSPATH (i.e., under WEB-INF/lib ), which includes jackson-core-asl-1.6.4.jar and jackson-mapper-asl-1.6.4.jar .
Created by zhidao on January 23, 2012 15:00:19    Last update: January 23, 2012 15:00:19
The domain object is annotated @Entity , but Java runtime complains that it's not an entity class. Cause: : class not listed in persistence.xml , or persistence.xml misplaced, or multiple persistence.xml files existed.
Created by zhidao on January 23, 2012 14:58:58    Last update: January 23, 2012 14:58:58
This exception occurs when the Java object attribute is of type String, while the database column is of type CHAR(n), and hibernate.hbm2ddl.auto is validate in persistence.xml . There are two solutions: Add columnDefinition to the @Column annotation: @Column(name = “STATE_CODE”, columnDefinition = “c... Remove hibernate.hbm2ddl.auto from persistence.xml .
Previous  1 2 3 4 5 6 7 8 9 10 Next