Recent Notes
Displaying keyword search results 1 - 10
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 February 02, 2012 16:09:05
Last update: February 02, 2012 16:09:17
flowplayer is another way to embed Flash in a web page. The code looks like this:
<object width="6400" height="380" data="swf/flowpl...
You need to download two swf files:
http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf
http://releases.flowplayer.org/swf/flowplayer.controls-3.2.0.swf
Created by James on February 02, 2012 16:00:15
Last update: February 02, 2012 16:00:15
Video for Everybody seems to be a generic way to embed video in a web page, even without flash. This code snippet comes from that site.
<!-- first try HTML5 playback: if serving as XML, ...
Created by Fang on December 06, 2011 19:03:25
Last update: December 07, 2011 08:54:11
Our custom tag, as implemented in the previous note , is broken when a template is used.
Create a template file ( home-template.xhtml ):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric...
and a test page that uses it ( home.xhtml ):
<?xml version="1.0" encoding="UTF-8"?>
<ui:comp...
Then request the page with URL: http://localhost:8080/facelet-demo/home.jsf?name=Jack .
You'll find that our hello tag works inside ui:repeat but fails to get the value defined by ui:param ! What's the problem? Our hello tag implementation evaluated the EL with the wrong EL context!
This is the corrected implementation:
package com.example;
import java.io.IOExcep...
Created by Fang on November 08, 2011 20:55:00
Last update: November 21, 2011 18:19:44
In the simple taglib example , I used a tag handler class to implement a taglib. This is an example to implement a taglib with a UI component. The purpose is to use a custom tag to split a string and print each part in a separate paragraph, i.e., print
<p>john</p> <p>steve</p> <p>mike</p> with custom tag <my:foreach> : <my:foreach var="who" value="john steve mike"> ... These are the files: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... src/main/java/com/example/UIForeash.java : package com.example; import java.io.IOExcep... src/main/resources/META-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <faces-c... src/main/resources/META-INF/foreach.taglib.xml : <?xml version="1.0" encoding="UTF-8"?> <facelet... How to use: Put the JAR file generated by the above project in the WEB-INF/lib folder of the web app. If the web app is a Maven project, just add the taglib project as a dependency:...
Created by Fang on November 10, 2011 09:26:12
Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines!
<?xml version="1.0" encoding="UTF-8"?>
<xsd:sch...
Created by Dr. Xi on August 11, 2007 15:56:47
Last update: July 19, 2011 08:15:55
Here's a list of common TCP ports. You can find a more complete list here: http://www.gasmi.net/docs/tcp.html . Port Number Service Description 21 FTP File Transfer Protocol 22 SSH Secure Shell 23 Telnet Telnet remote login 25 SMTP Simple Mail Transfer Protocol 70 gopher Gopher 79 finger Finger 80 HTTP Hyper Text Transfer Protocol (WWW) 88 Kerberos Kerberos authentication 94 tivoli Tivoli Object Dispatcher 110 pop3 Post Office Protocol Version 3 123 ntp Network Time Protocol 137 netbios NetBIOS Name Service 138 netbios NetBIOS Datagram 139 netbios NetBIOS Session 143 imap Internet Message Access Protocol 161 snmp Simple Network Management Protocol 162 snmptrap SNMP trap 194 irc Internet Relay Chat Protocol 389 ldap Lightweight Directory Access Protocol 443 https Secure HTTP 445 SMB MS Server Message...
Created by Dr. Xi on February 01, 2011 14:38:55
Last update: February 01, 2011 14:40:59
Create the stuff you want to manufacture with the factory:
package tc.demo;
public class Junk {
...
Create the factory:
package tc.demo;
import java.util.Enumerati...
Tell Tomcat to use your factory. Create file context.xml and put it under the directory META-INF of your web application:
<Context>
<Resource name="/find/junk/here"
...
Note that beside name , type and factory , you can put any arbitrary attribute in the Resource element.
Access the thing with JNDI:
<%@page language="java" import="javax.naming.*,tc....
The server side log looked like this:
INFO: jndiName: here
INFO: name: scope, value: ...
Also note that, in contrast to Tomcat documentation , resource-ref is not needed in web.xml .
Created by James on September 03, 2010 15:52:12
Last update: January 11, 2011 20:22:40
Use the siblings function to find all siblings of the current jQuery object:
$(this).siblings()
which is equivalent to:
$(this).parent().children().not(this)
Or, use an optional selector to further limit the selection of siblings:
$(this).siblings('li .hilighted')
Test page:
<!DOCTYPE html>
<html>
<head>
<title>jQu...
Created by James on January 10, 2011 11:10:32
Last update: January 10, 2011 11:11:00
Following is the code snippet to embed a Flash swf file in a web page. The OBJECT tag is for IE, while the EMBED tag works for Firefox.
<HTML>
<HEAD>
<TITLE>Embed flash video in ...