Recent Notes
Displaying keyword search results 1 - 10
Created by Fang on April 16, 2012 13:32:10
Last update: April 16, 2012 13:32:10
There are two steps to create a custom function for JSP:
Declare the function in the TLD:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib...
Implement the function (must be static):
package com.example;
public class UrlTransl...
To use the function:
<%@ taglib uri="http://www.example.com/jsp/tags" p...
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 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 freyo on May 05, 2011 09:33:55
Last update: May 05, 2011 09:34:46
For Android, there's no entry function like " public static void main() " in Java. The main activity is declared by intent-filter in AndroidManifest.xml :
<intent-filter>
<action android:name="andro...
The category LAUNCHER declaration puts it in the Launcher . The action MAIN means this is the activity to start when the application icon is clicked in the Launcher. In fact, the Android ActivityManager starts the main activity with the intent:
{ act=android.intent.action.MAIN cat=[android.inte...
Created by jinx on May 04, 2011 20:01:08
Last update: May 04, 2011 20:02:59
A static variable in PHP functions and methods keeps its value after the function/method scope is exited, just like static variables in C. A static variable in a class is a class variable, and is accessed by the class name. In the global scope, static has no special meaning.
test.php:
<?php
include("test.inc");
include("...
test.inc:
<?php
static $i = 0;
$i++;
echo __FILE__,...
Output:
E:\phpwork\test.inc included: 1
E:\phpwork\test...
Created by jinx on May 03, 2011 11:43:26
Last update: May 03, 2011 11:43:26
The PHP function strval returns the string value of a variable. It does the same thing as casting a variable to string, or automatic conversion where string is expected.
Conversion rules:
Type String Value
Boolean TRUE '1'
Boolean FALSE '' (empty string)
integer of float string representing the number
Array The string 'Array'
Object Result of __toString() if defined, error otherwise
Resource 'Resource id #n' , where n is a number assigned to the resource.
NULL '' (empty string)
Example:
<?php
set_error_handler(function($errno, $errst...
Results:
bool(true)
---------------------
strval: '1'...
Created by jinx on April 29, 2011 15:03:10
Last update: April 29, 2011 15:04:02
The PHP function is_callable verifies that a variable can be invoked as a function.
Example:
<?php
define('F', 'f');
function...
Output:
var_dump: string(1) "f"
is_callable: 1
Calla...
Created by jinx on April 29, 2011 13:43:13
Last update: April 29, 2011 13:44:34
List of functions testing variable type:
Function Description
is_bool Finds out whether a variable is a boolean
is_double Alias of is_float()
is_float Finds whether the type of a variable is float
is_int Find whether the type of a variable is integer
is_integer Alias of is_int()
is_long Alias of is_int()
is_null Finds whether a variable is NULL
is_numeric Finds whether a variable is a number or a numeric string
is_object Finds whether a variable is an object
is_real Alias of is_float()
is_scalar Finds whether a variable is a scalar
is_string Find whether the type of a variable is string
Test code:
<?php
class A {
}
$a = ar...
Output:
var_dump: int(1)
-------------------------
i...
Created by jinx on April 28, 2011 20:52:45
Last update: April 29, 2011 13:27:31
This is normally a syntax error just before some variable. Try some of these:
Missing operator before a variable:
<?php
$a = 'ab';
echo('Missing conca...
Missing semicolon at end of line:
<?php
echo('Missing semicolon at end of lin...
Missing ( and ) in for loop:
<?php
foreach $a as $i {
echo "$i\n";
...
Missing keyword before class variable:
<?php
class A {
// should be var $a;
...
Created by jinx on April 29, 2011 08:38:58
Last update: April 29, 2011 08:39:47
Facts about PHP constants:
You can define a PHP constant using the function define .
Unlike variables, a constant is used by its symbol without the leading $ .
The function constant can be used to get the value of a constant. This can be useful if the name of the constant is given by runtime computation.
Class constants are defined with the const keyword.
Constants can only be scalar values.
Example:
<?php
// define a constant
define('HELLO', '...