-
Book Overview & Buying
-
Table Of Contents
Amazon SimpleDB Developer Guide
By :
Booleans are very commonly used for storing binary values. You can either choose to store them as a simple 0 or 1 in SimpleDB or store them in a slightly more readable way as the string values true and false.
Here are two simple methods to convert values from a Boolean to a string and vice versa:
public String encodeBoolean(boolean valueToEncode) { return new Boolean(valueToEncode).toString(); }
public boolean decodeBoolean(String encodedValue) { return encodedValue.equalsIgnoreCase("true"); }
These functions are in the SimpleDB PHP library. Boolean true is stored as the string true while false is stored as the string false. The following functions isolate the program from the stored value so that as an example 1 and 0 could be used for true and false instead:
public function encodeBoolean($input) {
if ($input) {
return "true";
} else {
return "false";
}
}
public function decodeBoolean($input) {
if (strtolower...
Change the font size
Change margin width
Change background colour