Monday, 30 October 2006

CSS: Display property










































































ValueDescription
noneThe element will not be displayed
blockThe element will be displayed as a block-level element, with a line break before and after the element
inlineDefault. The element will be displayed as an inline element, with no line break before or after the element
list-itemThe element will be displayed as a list
run-inThe element will be displayed as block-level or inline element depending on context
compactThe element will be displayed as block-level or inline element depending on context
marker 
tableThe element will be displayed as a block table (like <table>), with a line break before and after the table
inline-tableThe element will be displayed as an inline table (like <table>), with no line break before or after the table
table-row-groupThe element will be displayed as a group of one or more rows (like <tbody>)
table-header-groupThe element will be displayed as a group of one or more rows (like <thead>)
table-footer-groupThe element will be displayed as a group of one or more rows (like <tfoot>)
table-rowThe element will be displayed as a table row (like <tr>)
table-column-groupThe element will be displayed as a group of one or more columns (like <colgroup>)
table-columnThe element will be displayed as a column of cells (like <col>)
table-cellThe element will be displayed as a table cell (like <td> and <th>)
table-captionThe element will be displayed as a table caption (like <caption>)

Monday, 11 September 2006

REGEX; pattern matching

regular expression to match a U.S. phone number:
\(?\d{3}\)? ?\d{3}[-.]\d{4}

This regex matches phone numbers like "(314)555-4000". 
Ask yourself if the regex would match "314-555-4000" or "555-4000". 
The answer is no in both cases. Writing this pattern on one line 
conceals both flaws and design decisions. The area code is 
required and the regex fails to account for a separator 
between the area code and prefix.

/  
    \(?     # optional parentheses
      \d{3} # area code required
    \)?     # optional parentheses
    [-\s.]? # separator is either a dash, a space, or a period.
      \d{3} # 3-digit prefix
    [-.]    # another separator
      \d{4} # 4-digit line number
/x


replace all instances of double quotes with 
single - /g option is all instances
replace(/\"/g,'\'')

Friday, 25 August 2006

TSQL: Joins with 3 tables

--T-SQL with 3 tables
--Now we take a table more between A and C (it's simple in T-SQL):

update A
set A.a2 = c.c2
from A
inner join B on A.a1 = B.b1
inner join C on B.b2 = c.c1

Saturday, 15 July 2006

CSS: XP bug - background image on buttons not displaying

if the background button image doesn't display:

use "background" instead of "background-image", its an xp bug!!

http://support.microsoft.com/kb/322240

<INPUT TYPE="button" style="background:url(/_Images/mms/bt_reset.gif); border:none; height:20px; width:77px;">

Monday, 29 May 2006

TSQL: UPDATE

UPDATE 
        { 
         table_name WITH ( <table_hint_limited> [...n])
         | view_name
         | rowset_function_limited 
        }
        SET 
        {column_name = {expression | DEFAULT | NULL}
        | @variable = expression 
        | @variable = column = expression } [,...n]

    {{[FROM {<table_source>} [,...n] ]

        [WHERE 
            <search_condition>] }
        | 
        [WHERE CURRENT OF 
        { { [GLOBAL] cursor_name } | cursor_variable_name} 
        ] }
        [OPTION (<query_hint> [,...n] )]

UPDATE authors
        SET authors.au_fname = 'Annie'
        WHERE au_fname = 'Anne' 

UPDATE titles
        SET ytd_sales = t.ytd_sales + s.qty
        FROM titles t, sales s
        WHERE t.title_id = s.title_id
        AND s.ord_date = (SELECT MAX(sales.ord_date) FROM sales) 

TSQL: INSERT

INSERT [INTO] 
    { 
     table_name WITH ( <table_hint_limited> [...n])
     | view_name
     | rowset_function_limited 
    }

    {    [(column_list)] 
        { VALUES ( {    DEFAULT 
                        |    NULL
                        |    expression 
                        }[,...n]
            )
        | derived_table
        | execute_statement    
        }
    }
    | DEFAULT VALUES

<table_hint_limited> ::=
    {    INDEX(index_val [,...n])
        | FASTFIRSTROW
        | HOLDLOCK
        | PAGLOCK
        | READCOMMITTED
        | REPEATABLEREAD
        | ROWLOCK
        | SERIALIZABLE
        | TABLOCK 
        | TABLOCKX
    }

INSERT INTO TENANTS..ADDRESS (ADDRESS) VALUES ('129 GABBA ROAD, WOOLLOONGABBA')

Monday, 13 February 2006

TSQL: CASE example

SELECT
FirstName, LastName,
Salary, DOB,
CASE Gender
WHEN 'M' THEN 'Male'
WHEN 'F' THEN 'Female'
END
FROM Employees

Sunday, 15 January 2006

TSQL: Joins, INNER, OUTER and upsidedown!

An inner join excludes rows from either table that don't have a matching row in the other table. An outer join provides the ability to include unmatched rows in the query results. The outer join combines the unmatched row in one of the tables with an artificial row for the other table. This artificial row has all columns set to null.
The outer join is specified in the FROM clause and has the following general format:

table-1 { LEFT | RIGHT | FULL } OUTER JOIN table-2 ON predicate-1
predicate-1 is a join predicate for the outer join. It can only reference columns from the joined tables. The LEFT, RIGHT or FULL specifiers give the type of join:
LEFT -- only unmatched rows from the left side table (table-1) are retained
RIGHT -- only unmatched rows from the right side table (table-2) are retained
FULL -- unmatched rows from both tables (table-1 and table-2) are retained