Archive for September, 2007

B Bitwise AND (&) (Operator/bitwise) Example code: (Web server type)

Sunday, September 30th, 2007

B Bitwise AND (&) (Operator/bitwise) Example code: See also: Associativity, Binary bitwise operator,Bit-field, Bitwise AND then assign (&=), Bitwise expression, Bitwise operator, Logical AND (&&),Operator Precedence Cross-references: ECMA 262 edition 2 section 11.10 ECMA 262 edition 2 section 11.13 ECMA 262 edition 3 section 11.10

Web hosting unlimited bandwidth - JavaScript Programmer’s Reference Bitwise AND (&) (Operator/bitwise) Bitwise

Saturday, September 29th, 2007

JavaScript Programmer’s Reference Bitwise AND (&) (Operator/bitwise) Bitwise AND of two operands. ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Availability: Property/method value type: JavaScript syntax: - Argument list: anOperand1 anOperand2 Number primitive anOperand1 & anOperand2 Another binary bit pattern The result is the bitwise AND of both binary bit pattern values. A binary bit pattern This operator performs a bit by bit AND of the 32-bit value derived from both operands. Effectively, each corresponding bit pair has a logical AND applied to it. The truth table shows the result of this operator for two Boolean primitive values: A B AND false false false false true false true false false true true true Where a corresponding bit is 1 in both values, a 1 bit is inserted into the result otherwise the value is zero. The associativity is left to right. Refer to the Operator Precedence topic for details of execution order. 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1

Web design course - B Bit-field (Definition) Op Description | Bitwise

Saturday, September 29th, 2007

B Bit-field (Definition) Op Description | Bitwise inclusive OR ^ Bitwise XOR (exclusive OR) &= Bitwise AND and assign to an LValue |= Bitwise inclusive OR and assign to an LValue ^= Bitwise exclusive XOR and assign to an LValue <<= Bitwise shift left and assign to an LValue >>= Bitwise shift right and assign to an LValue >>>= Bitwise shift right (unsigned) and assign to an LValue The bits are individually weighted according to their position relative to the least significant digit. The single bit at the extreme right-hand end is defined by the integer value 1. The next significant bit is derived by using a zero-based indexing scheme to raise 2 to the power of its index position. Thus 2 raised to the power 0 is 1. The value 2 raised to the power 1 is 2 and thus the values proceed like this, moving from right to left: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 etc. To build bit masks containing a set bit for several positions, simply add the component bit values together. Thus a mask that includes all the four least significant bits in a value is equal to: 1 +2 +4 + 8 Here are some other useful mask values (note that we only show 8 bit values here to demonstrate the concept): 0000 0001 0000 1111 0010 0000 0101 0101 0111 1111 1111 0000 1111 1111 Mask Value Description 1 15 32 85 127 240 255 Least significant bit Least significant nibble ASCII upper/lowercase character bit Simple encryption pattern for XOR Valid ASCII character mask Most significant nibble Low 255 UNICODE character set mask See also: Bit,Bitwise AND (&), Bitwise AND then assign (&=), Bitwise expression,Bitwise NOT complement (~), Bitwise operator,Bitwise OR (|), Bitwise OR then assign (|=), Bitwise shift left (<<), Bitwise shift left then assign (<<=), Bitwise shift operator,Bitwise shift right (>>), Bitwise shift right and assign (>>=), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), Bitwise XOR (^), Bitwise XOR and assign (^=),Expression

JavaScript Programmer’s Reference Example code: // Demonstrate bit (Frontpage web hosting)

Friday, September 28th, 2007

JavaScript Programmer’s Reference Example code: // Demonstrate bit inversion to change character case myString = “AbCdEfGh”; myLength = myString.length; document.write(”Original source string : “); document.write(myString); document.write(”
“); document.write(”
“); document.write(”

“); for(myEnum = 0; myEnum < myLength; myEnum++) { myChar = myString.charAt(myEnum); myCharCode = myString.charCodeAt(myEnum); myNewCharCode = myCharCode ^ 32; document.write("“); } document.write(”
“); document.write(”Orig char“); document.write(”Char code“); document.write(”Bit inverted
char code
“); document.write(”New char
“); document.write(myChar); document.write(”“); document.write(myCharCode); document.write(”“); document.write(myNewCharCode); document.write(”“); document.write(String.fromCharCode(myNewCharCode)); document.write(”
“); See also: Bit-field, String.toLocaleLowerCase(), String.toLocaleUpperCase(), String.toLowerCase(), String.toUpperCase() Bit-field (Definition) A collection of binary digits. Although JavaScript does not support bit-fields, you can perform many binary operations on patterns of bits by using the bitwise operators and various simple mathematical expressions to simulate other bit manipulation operators that are not provided as part of the standard. Op Description ~ Bitwise complement (NOT) & Bitwise AND << Bitwise left shift >> Bitwise right shift >>> Bitwise right shift (unsigned)

B Bit (Definition) Cross-references: ECMA 262 edition

Thursday, September 27th, 2007

B Bit (Definition) Cross-references: ECMA 262 edition 2 section 10.1.4 ECMA 262 edition 3 section 10.1.4 Bit (Definition) A binary digit. A Boolean value can be represented as a bit. Since a bit can maintain exactly two states (true or false), the two map very well to one another. Strictly speaking a Boolean value may yield an undefined state as well. A continuous series of 8 bits forms a byte and 16 form a word. In JavaScript, 16 bit values tend to be the smallest that you operate with and correspond to a single character in a Unicode string. However, you can probably represent most characters that you want to use in the English language with only 8 bits. In fact only 7 bits are sufficient to describe your script source text in an ASCII representation. Bit manipulation of character values allows you to convert between upper and lower case. The String.toUpperCase() and String.toLowerCase() methods allow you to convert specifically to the case you want, but if the current case is unknown and you simply want to toggle the case of a character, the difference between ‘A’ and ‘a’ is a single bit. In most cases, you won’t be operating with binary digits in JavaScript-based projects. However, the language is quite capable of working with bit patterns provided you understand how they work. Although you cannot store an individual bit on its own, you can keep collections of 32 of them in a Number value. In C language you operate on these using Bit-Fields. JavaScript does not support bit-fields but the sort of things you do with them can be simulated. This is likely to be of most use to people developing scripts for use in embedded interpreters and of less use to browser script developers. 1 1 bit 1 1 1 1 1 0 0 0 1 byte 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 word 11111000 11111000 11111000 11111000 1 long word

JavaScript Programmer’s Reference Operator Description >>>= Bitwise shift

Thursday, September 27th, 2007

JavaScript Programmer’s Reference Operator Description >>>= Bitwise shift right (unsigned) and assign to an LValue ^ Bitwise XOR (exclusive OR) ^= Bitwise exclusive XOR and assign to an LValue | Bitwise inclusive OR |= Bitwise inclusive OR and assign to an LValue || Logical OR See also: Multiplicative operator, Operator, Ternary operator Cross-references: ECMA 262 edition 2 section 11.5 ECMA 262 edition 3 section 11.6 ECMA 262 edition 3 section 11.7 ECMA 262 edition 3 section 11.8 ECMA 262 edition 3 section 11.9 ECMA 262 edition 3 section 11.10 ECMA 262 edition 3 section 11.11 ECMA 262 edition 3 section 11.13 Binding (Definition) Binding is used to resolve identifiers via the scope chain. Availability: ECMAScript edition 2 Binding is the process of locating the appropriate object or property where a value is stored for a particular identifier. The binding process uses the scope chain belonging to the current execution context to locate the earliest matching item according to the inheritance rules. See also: Identifier resolution

Web site optimization - B Binary operator (Definition) Binary operator (Definition)

Wednesday, September 26th, 2007

B Binary operator (Definition) Binary operator (Definition) An operator that works with two operands. Availability: ECMAScript edition 2 Property/method value type: Boolean primitive Binary operators require two operands and with them form an expression. The operator determines the kind of expression. Here is a list of the binary operators supported by JavaScript: Operator Description != NOT equal to % Remainder %= Remainder and assign to an LValue & Bitwise AND && Logical AND &= Bitwise AND and assign to an LValue * Multiply *= Multiply and assign to an LValue + Add + Concatenate string += Add and assign to an LValue -Subtract -= Subtract and assign to an LValue / Divide /= Divide and assign to an LValue < Less than << Bitwise left shift <<= Bitwise shift left and assign to an LValue <= Less than or equal to = Simple assignment to an LValue == Equal to > Greater than >= Greater than or equal to >> Bitwise shift right >>= Bitwise shift right and assign to an LValue >>> Bitwise shift right (unsigned) Table continued on following page

JavaScript Programmer’s Reference Cross-references: ECMA 262 edition 2 (Free web space)

Tuesday, September 25th, 2007

JavaScript Programmer’s Reference Cross-references: ECMA 262 edition 2 section 11.10 ECMA 262 edition 3 section 11.10 Binary logical operator (Definition) An operator that works with Boolean trueor false values. Availability: Property/method value type: ECMAScript edition 2 Boolean primitive Binary logical operators test a pair of Boolean values according to logical rules. If necessary, JavaScript will convert the operands that are passed to the expression into Boolean values before testing them. You should consult the toBooleanrules for each type of object being passed to ensure that values are cast in a way that you expect. The resulting value of a binary logical expression may be coerced to another data type on return. There is no logical XOR operator. It can be simulated though by testing two Boolean values for inequality, since that is going to occur when either is one and the other is zero; the inequality will not test true if both are one or both are zero. Warnings: . This is not to be confused with the bitwise operators, which yield a 32-bit integer value instead of the Boolean value yielded by a logical expression. See also: Logical AND (&&), Logical operator, Logical OR (||) Cross-references: ECMA 262 edition 2 section 11.11 ECMA 262 edition 3 section 11.11

B BGSOUND.src (Property) BGSOUND.src (Property) The URL (Web hosting plans)

Wednesday, September 19th, 2007

B BGSOUND.src (Property) BGSOUND.src (Property) The URL that the background sound file can be fetched from. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: String primitive JavaScript syntax: IE myBGSOUND.src The sound will be loaded from this location while the page is being constructed. There may be some delay between requesting the sound and being able to play it. You can define a new value here to load a different sound and play it in the background. BGSOUND.volume (Property) The volume setting at which the background sound should play. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: Number primitive JavaScript syntax: IE myBGSOUND.volume The volume setting of the background can be modified by this property. The actual perceived volume may depend on other factors. If the sound has been digitized at an unusually low volume, you may need to raise the volume setting quite high. This may yield a very noisy sound as you will also be increasing the ambient noise in the sampled sound. Digitizing is a complex activity but you should always strive for the highest possible signal to noise ratio. Other factors that may affect the apparent volume would be the user preference settings in the computer. There may also be system controls for blending and mixing sound sources and these may be set to unhelpful values. This property can obviously only control the source volume of the sound generated by the browser. Property attributes: ReadOnly.

JavaScript Programmer’s Reference Inheritance chain: (Free web servers) Element object, Node

Tuesday, September 18th, 2007

JavaScript Programmer’s Reference Inheritance chain: Element object, Node object BGSOUND.balance (Property) The stereo balance of the background sound. Availability: JScript 3.0 Internet Explorer 4.0 Property/method value type: Number primitive JavaScript syntax: IE myBGSOUND.balance The relative volume of the left and right channels will be adjusted according to the value of this property. This provides a limited amount of control over the apparent direction of the sound source. Creative use of the balance property may be tied in to the horizontal scrolling of a page for creating virtual reality effects. Much more sophisticated control is available through the aural style sheet properties, although these are not yet properly supported by browsers. See also: style.azimuth Property attributes: ReadOnly. BGSOUND.loop (Property) Whether the background sound should loop when it gets to the end. JScript 3.0 Number primitive myBGSOUND.loop IE Availability: Internet Explorer 4.0 Property/method value type: JavaScript syntax: This indicates the number of times that the sound should play before stopping.