Programming

WordPress Developer’s Toolbox

Posted by admin at 19th September, 2008

Web designers and developers are getting an increasing number of requests from clients for custom theme development, and a growing number of designers are also building their own themes to distribute for free or to sell as premium themes. With all of the WordPress development that is going on, there is a need for an organized collection of resources to educate, inspire and equip developers to improve the quality and efficiency of their work. This post provides all kinds of WordPress-related resources to do just that.

The WordPress Help Sheet
This is a nice resource to refer back to when you are developing themes. It’s a one-page collection of PHP snippets and code that will come in handy when designing with WP.

The Advanced WordPress Help Sheet
A slightly more advanced version of the help sheet.

Huge Compilation of WordPress Code
A helpful post that provides code snippets for a variety of common functions.

WordPress Template Tag Reference Guide
This is a handy guide to have nearby when you’re building a theme. It lists the various template tags used by the WP system.

Unraveling the Secrets of WordPress’ comments.php File
A good starting point for getting more familiar with how comments work in WP and what you can do with them as a designer.

48 Unique Ways to Use WordPress
Want some ideas on how you can use WP in your next project?

Theme Switcher Reloaded
For displaying demos of multiple themes on your website or blog.

Category : Bills Posts / CSS / HTML / Programming (0) Comment

YUI Reset CSS

Posted by admin at 8th August, 2008

As an addendum to the earlier post about css resetting, here’s another version from Yahoo though it’s far less user friendly:

YUI Reset CSS

The foundational YUI Reset CSS file removes and neutralizes the inconsistent default styling of HTML elements, creating a level playing field across A-grade browsers and providing a sound foundation upon which you can explicitly declare your intentions.

Note: YUI Base CSS (introduced in version 2.3.0) can compliment Reset by applying a style foundation for common HTML elements that is consistent across A-grade browsers.

Category : Bills Posts / CSS / HTML / Programming (0) Comment

Cross Browser CSS Reset

Posted by admin at 8th August, 2008

Over at MyerWeb.com, Erik has a create file that he has culled together for use as a full reset across browsers, so in theory, when you add your css back in after calling it, your css will look the same across the main browsers and versions. Here’s the link to the original article.

But below is the css reset code:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    font-family: inherit;
    vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
    outline: 0;
}
body {
    line-height: 1;
    color: black;
    background: white;
}
ol, ul {
    list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: separate;
    border-spacing: 0;
}
caption, th, td {
    text-align: left;
    font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: "";
}
blockquote, q {
    quotes: "" "";
}

Category : Bills Posts / CSS / HTML / Programming (0) Comment

T-SQL to Split a varchar into Words

Posted by admin at 21st May, 2008

It’s a user-defined-function to split a given string into ‘words’. In this case I’m delimiting words using commas and spaces. So ‘Smith, Fred’ (with a comma AND a space) will be separated into ‘Smith’ and ‘Fred’.

For convenience, it returns a table with a ‘pos’ column, representing the position in the original text that the word was found.

Hope this helps someone out there.

CREATE FUNCTION SplitWords(@text varchar(8000))
RETURNS @words TABLE (pos smallint primary key, value varchar(8000))
AS
BEGIN
DECLARE @pos smallint, @i smallint, @j smallint, @s varchar(8000)
SET @pos = 1
WHILE @pos <= LEN(@text)
BEGIN
SET @i = CHARINDEX(‘ ‘, @text, @pos)
SET @j = CHARINDEX(‘,’, @text, @pos)
IF @i > 0 OR @j > 0
BEGIN
IF @i = 0 OR (@j > 0 AND @j < @i)
SET @i = @j
IF @i > @pos
BEGIN — @i now holds the earliest delimiter in the string
SET @s = SUBSTRING(@text, @pos, @i – @pos)
INSERT INTO @words VALUES (@pos, @s)
END
SET @pos = @i + 1
WHILE @pos < LEN(@text) AND SUBSTRING(@text, @pos, 1) IN (‘ ‘, ‘,’)
SET @pos = @pos + 1
END
ELSE
BEGIN
INSERT INTO @words VALUES (@pos, SUBSTRING(@text, @pos, LEN(@text) – @pos + 1))
SET @pos = LEN(@text) + 1
END
END
RETURN
END

Category : Bills Posts / Programming (0) Comment

T-SQL: Hex String to Hex Value func

Posted by admin at 19th May, 2008

SQL Server 2005 includes an undocumented function, sys.fn_varbintohexstr, that converts a hex value to a string representation of that hex value (0×3a becomes ‘0×3a’), but there is no function to go back from a hex string to a hex value. Below is something that does the trick quite nicely

CREATE FUNCTION dbo.HexStrToVarBin(@hexstr varchar(8000))
RETURNS varbinary(8000)
AS
BEGIN 
    DECLARE @hex char(2), @i int, @count int, @b varbinary(8000
    SET @count = LEN(@hexstr
    SET @b = CAST( as varbinary(1)) 
    IF SUBSTRING(@hexstr, 1, 2) = ‘0x’ 
        SET @i =
    ELSE 
        SET @i =
    WHILE (@i <= @count
     BEGIN 
        SET @hex = SUBSTRING(@hexstr, @i, 2
        SET @b = @b + 
                CAST(CASE WHEN SUBSTRING(@hex, 1, 1) LIKE ‘[0-9]‘ 
                    THEN CAST(SUBSTRING(@hex, 1, 1) as int) 
                    ELSE CAST(ASCII(UPPER(SUBSTRING(@hex, 1, 1)))-55 as int
                END * 16
                CASE WHEN SUBSTRING(@hex, 2, 1) LIKE ‘[0-9]‘ 
                    THEN CAST(SUBSTRING(@hex, 2, 1) as int) 
                    ELSE CAST(ASCII(UPPER(SUBSTRING(@hex, 2, 1)))-55 as int) 
                END as binary(1)) 
        SET @i = @i +
     END 
    RETURN @b
END
GO

Category : Bills Posts / Programming (0) Comment

Recent Comments
  • PirateKay: I really hope that it comes back to Fort Wayne next year sin...
  • admin: Woot - I got a response. I didn't think that there wasn't pe...
  • cyclone: You said: "There’s nothing wrong with living in a small to...
  • MrsH: You're so right, Bill! Thomas Jefferson would roll over in ...
  • Escarlata@FaireNews.com: Thanks for sharing how Golden Gate went, Bill. It sounds lik...
Flickr