<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>chickenBeak</title>
	<link>http://www.chickenbeak.com</link>
	<description>Design tutorials for the greater good.</description>
	<pubDate>Fri, 20 Jun 2008 13:27:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>YUI - getElementsBy TagName</title>
		<link>http://www.chickenbeak.com/javascript/yui-getelementsby-tagname/2008/06/</link>
		<comments>http://www.chickenbeak.com/javascript/yui-getelementsby-tagname/2008/06/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 13:27:08 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>Javascript</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/javascript/yui-getelementsby-tagname/2008/06/</guid>
		<description><![CDATA[Similar to jQuery, MooTools and other Javascript libraries, Yahoo!&#8217;s YUI DOM utility offers upgraded element searches. finding an element by class name is nice, but what if you want to find an element by tag name? 
YUI does not have a function named getElementsByTagName, but the getElementsBy will do just that. 
getElementsBy(method, tag, root, apply)
The [...]]]></description>
			<content:encoded><![CDATA[<p>Similar to jQuery, MooTools and other Javascript libraries, Yahoo!&#8217;s YUI DOM utility offers upgraded element searches. finding an element by class name is nice, but what if you want to find an element by tag name? </p>
<p>YUI does not have a function named getElementsByTagName, but the getElementsBy will do just that. </p>
<p><code>getElementsBy(method, tag, root, apply)</code></p>
<p>The <em>method</em> attribute is the important one here. The <em>tag</em>, and <em>root</em> are mainly there to offer optimization by reducing the possible scope of items the method is ran against.</p>
<p>If all you need is elements by a certain tag name, just pass in a function into the first argument that always returns true, and make sure to pass in a tag name for argument 2 that your looking for.</p>
<p>For example,<br />
<code>var forms = yDom.getElementsBy(function(el){return true;},'form');</code> should return an array of form elements that can be accessed further.</p>
<p>If you need a more specific filter (e.g. only &#8216;<em>a</em>&#8216; tags with <em>class=&#8217;selected&#8217;</em>) you could interact with the el item in the function. If you return true, the item will be added to the list. Otherwise return false and it won&#8217;t be in the array.</p>
<p>A good resource for more YUI Dom fun can be found at <a href="http://klauskomenda.com/archives/2007/10/27/agent-yui-mission-2-magic-of-the-dom/">klauskomenda.com</a></p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/javascript/yui-getelementsby-tagname/2008/06/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Developer cheat sheets</title>
		<link>http://www.chickenbeak.com/xhtml/developer-cheat-sheets/2008/06/</link>
		<comments>http://www.chickenbeak.com/xhtml/developer-cheat-sheets/2008/06/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 13:19:11 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>XHTML</category>
	<category>CSS</category>
	<category>PHP</category>
	<category>Javascript</category>
	<category>SQL</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/uncategorized/developer-cheat-sheets/2008/06/</guid>
		<description><![CDATA[This is just a link to a great little list of cheat sheets that will probably come in handy. It has a hand full of sheets for Design (CSS / HTML), Programming (PHP, ASP, ROR, JavaScript&#8230;), Database (MySQL, PostgreSQL, SQL Server&#8230;), and others (Vi, htaccess, Regular Expressions).
If you&#8217;ve ever found yourself looking for that exact [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a link to a great little list of cheat sheets that will probably come in handy. It has a hand full of sheets for Design (CSS / HTML), Programming (PHP, ASP, ROR, JavaScript&#8230;), Database (MySQL, PostgreSQL, SQL Server&#8230;), and others (Vi, htaccess, Regular Expressions).</p>
<p>If you&#8217;ve ever found yourself looking for that exact command on Google, one of these might be worth pinning to your workspace wall.</p>
<p><a href="http://www.webmastersbydesign.com/2008/06/19/the-best-developer-cheat-sheets-around/">The Best Developer Cheat Sheets Around (from Webmasters by Design)</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/xhtml/developer-cheat-sheets/2008/06/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Tips to optimize your SQL and PHP</title>
		<link>http://www.chickenbeak.com/php/tips-to-optimize-your-sql-and-php/2008/01/</link>
		<comments>http://www.chickenbeak.com/php/tips-to-optimize-your-sql-and-php/2008/01/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 04:48:22 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>PHP</category>
	<category>SQL</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/php/tips-to-optimize-your-sql-and-php/2008/01/</guid>
		<description><![CDATA[These tips will work for most SQL based server, including but not limited to PostgreSQL and MySQL.
1. Don&#8217;t use the DELETE statement
Instead, use an UPDATE statement to mark a row to be deleted at a later time. Build your database so that the tables have a &#8216;deleted&#8217; column. Then, run the DELETE at a later [...]]]></description>
			<content:encoded><![CDATA[<p>These tips will work for most SQL based server, including but not limited to PostgreSQL and MySQL.</p>
<h3>1. Don&#8217;t use the DELETE statement</h3>
<p>Instead, use an UPDATE statement to mark a row to be deleted at a later time. Build your database so that the tables have a &#8216;deleted&#8217; column. Then, run the DELETE at a later time on all rows marked to be deleted. Just use a small boolean value in the &#8216;deleted&#8217; column, or you could even call it &#8217;status&#8217; and leave room for more status&#8217;s of a row by using an integer or small character value.</p>
<p>This can be big. Put simply, an UPDATE statement is cheeper than a DELETE statement because your DELETE statement will force the entire table to re-index the primary keys and the indexed.</p>
<h3>2. Reduce IO&#8217;s by reducing SELECT calls</h3>
<p>If you use UPDATES a certain way, and your database is also using UNIQUE fields correctly, you can reduce SELECT statements.</p>
<p>For example, if you have a table where you want to decide wether to INSERT or UPDATE, you might try running a SELECT to check for the data first. That will ALWAYS result in two calls.</p>
<pre class="code">
&lt;?php
// this code will always result in two calls !!
$count = functRunQuery(&quot;SELECT COUNT(*) FROM user_table WHERE username=&#x27;john&#x27;;&quot;);
if ($count &gt; 0) // then run UPDATE
else // run INSERT
?&gt;
</pre>
</p>
<p>Instead, run the UPDATE or INSERT first without using a SELECT call if you can&#8230;<br />
<pre class="code">
&lt;?php
// this code could result in one call
$affectedRowCount = functRunQuery(&quot;UPDATE user_table SET username=&#x27;bob&#x27; WHERE username=&#x27;john&#x27;;&quot;);
if ($affectedRowCount &gt; 0) // we&#x27;re done, don&#x27;t need to do anything
else // didn&#x27;t find any rows so run the INSERT here
?&gt;
</pre>
<p>OR, if your table would probably see more successful INSERTs than UPDATEs do it the other way around (PHP5 method here)&#8230;</p>
<pre class="code">
&lt;?php
// this code could result in one call
try {
// try inserting the user without checking possible unique conflicts...
functRunQuery(&quot;INSERT INTO user_table (a_unique_username) VALUES (&#x27;bob&#x27;)&quot;);
} catch {
// catch the error here if &#x27;bob&#x27; is already in the database, and run an UPDATE instead
}
?&gt;
</pre>
<p>If scalability is a possible issue for your application, you should always be looking for ways to reduce database calls and cut down on re-indexing.</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/php/tips-to-optimize-your-sql-and-php/2008/01/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>PHP abstract class (my first impressions)</title>
		<link>http://www.chickenbeak.com/php/php-abstract-class-my-first-impressions/2008/01/</link>
		<comments>http://www.chickenbeak.com/php/php-abstract-class-my-first-impressions/2008/01/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 03:35:50 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>PHP</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/php/php-abstract-class-my-first-impressions/2008/01/</guid>
		<description><![CDATA[I&#8217;ve been using PHP for a while now, but I&#8217;ve never dug too deep into it&#8217;s programming strengths. I&#8217;ve recently been thrown into using abstract classes in PHP. This article is just a first impression of what they are, and how I see them being useful in a project.
First, what is an abstract class? In [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using PHP for a while now, but I&#8217;ve never dug too deep into it&#8217;s programming strengths. I&#8217;ve recently been thrown into using abstract classes in PHP. This article is just a first impression of what they are, and how I see them being useful in a project.</p>
<p>First, what is an abstract class? In not-so-technical terms, they seem to be just like a normal class. You define methods, variables, use a construct function, and can declare items as private or public.</p>
<pre class="code">
abstract class FormBuilder {

	public $method;
	public $action;
	public $name;

	function __construct($name,$action,$method) {
		$this-&gt;name = $name;
		$this-&gt;action = $action;
		$this-&gt;method = $method;
	}
}
</pre>
<p><a id="more-47"></a></p>
<p>However, you cannot create instances of these class&#8217;s directly. You must create another non-abstract class and extend the abstract class.</p>
<pre class="code">
class LoginForm extends FormBuilder {
	function printForm() {
		print &#x27;&lt;form name=&quot;&#x27;.$this-&gt;name.&#x27;&quot; method=&quot;&#x27;.$this-&gt;method.&#x27;&quot; action=&quot;&#x27;.$this-&gt;action.&#x27;&quot;&gt;&#x27;;
		print &#x27;... form body ...&#x27;;
		print &quot;&lt;/form&gt;&quot;;
		return true;
	}
}
$frontPageLoginForm = new LoginForm();
$frontPageLoginForm-&gt;printForm();
</pre>
<p>In this case you could move to creating a info request form, submit story form, or any kind you may need. Then create instances of those class&#8217;s as needed with methods and attributes custom taylored to the data that class handles.</p>
<p>So, why write the abstract class? In this case we could create a lot of form types, and build up the parent class to handle validation, creating form fields and storing variables that are relative to all forms (e.g. a unique id generator or timestamp.)</p>
<p>Then build up the classes that extend the abstract class to define less used and not-so-global features. In this case maybe username and password, along with a password encryption method may only make sense to a login form, not a request info form.</p>
<p>I think this starts to make a lot more sense as you start to use them more. At first, I thought &#8216;why not just build them into the main class?&#8217; But as our team started extending those class&#8217;s more and more, it became obvious why we used that structure when we were able to tweak one validate method in the parent  abstract class to fix a glitch in error handling was one file rather than multiple files.</p>
<p>Check out the <a title="Detailed features of abstract classes in PHP" href="http://us2.php.net/abstract" rel="nofollow">PHP Manual</a> for a much more technical view of PHP abstract classes.</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/php/php-abstract-class-my-first-impressions/2008/01/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>PHP and ASP Includes</title>
		<link>http://www.chickenbeak.com/php/php-and-asp-includes/2006/11/</link>
		<comments>http://www.chickenbeak.com/php/php-and-asp-includes/2006/11/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 03:16:00 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
	<category>PHP</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/php/php-and-asp-includes/2006/11/</guid>
		<description><![CDATA[PHP and ASP are both very powerful server side scripting languages (SSL) that can add a lot of versatility and functionality to a website. You don&#8217;t have to understand much programming, however, to make use of one of their most handy components, include statements. Which language you use depends on what type of server your [...]]]></description>
			<content:encoded><![CDATA[<p>PHP and ASP are both very powerful server side scripting languages (SSL) that can add a lot of versatility and functionality to a website. You don&#8217;t have to understand much programming, however, to make use of one of their most handy components, include statements. Which language you use depends on what type of server your site is hosted on.</p>
<p><a id="more-44"></a></p>
<h4>PHP Include</h4>
<p class="code">&lt;?php include(&#8221;header.inc&#8221;); ?&gt;</p>
<h4>ASP include</h4>
<p class="code">&lt;!&ndash;&ndash;#include file=&#8221;info_header.inc&#8221;&ndash;&ndash;&gt;</p>
<p>Include statements allow you to place part of your code into a separate document that can then be included on multiple pages of your website. The advantage is that you can include all you your <head> details, logo, links, and so forth in one file. Then, if you need to update anything in that section, all of the pages including that file are automatically updated. You can also do the same for the footer.</p>
<p>Since these included files are simple text documents, they can have whatever extension you want, but commonly end in .inc. When read by a browser, the included file is read as part of the initial page. That is, the browser sees header.inc, index.php (or .asp), and footer.inc as one document. </p>
<p>The procedure is pretty straightforward, but here are some basic examples to get you started. The following examples are in PHP, but the ASP would work exactly the same with the appropriate include statement.</p>
<h4>header.inc:</h4>
<p class="code">&lt;html&gt;</p>
<p class="code">&lt;head&gt;<br />
	&lt;title&gt;Include Example&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p class="code">&lt;body&gt;<br />
	&lt;div id=&#8221;nav&#8221;"&gt;<br />
		&lt;ul&gt;<br />
			&lt;li&gt;&lt;a href=&#8221;books.php&#8221;&gt;Favorite Books&lt;/a&gt;&lt;/li&gt;<br />
			&lt;li&gt;&lt;a href=&#8221;movies.php&#8221;&gt;Favorite Movies&lt;/a&gt;&lt;/li&gt;<br />
			&lt;li&gt;&lt;a href=&#8221;other.php&#8221;&gt;Other Favorites&lt;/a&gt;&lt;/li&gt;<br />
		&lt;/ul&gt;<br />
	&lt;/div&gt;</p>
<h4>index.php:</h4>
<p class="code">&lt;?php include(&#8221;header.inc&#8221;); ?&gt;</p>
<p class="code">&lt;div id=&#8221;content&#8221;&gt;<br />
		&lt;h1&gt;Title&lt;/h1&gt;<br />
		&lt;p&gt;Some content.&lt;/p&gt;<br />
	&lt;/div&gt;</p>
<p class="code">&lt;?php include(&#8221;footer.inc&#8221;); ?&gt;</p>
<h4>footer.inc:</h4>
<p class="code">&lt;div id=&#8221;footer&#8221;&gt;<br />
		Copyright info<br />
	&lt;/div&gt;</p>
<p class="code">&lt;/body&gt;</p>
<p class="code">&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/php/php-and-asp-includes/2006/11/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Accessibility Basics</title>
		<link>http://www.chickenbeak.com/xhtml/accessibility-basics/2006/10/</link>
		<comments>http://www.chickenbeak.com/xhtml/accessibility-basics/2006/10/#comments</comments>
		<pubDate>Mon, 02 Oct 2006 18:33:39 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
	<category>XHTML</category>
	<category>CSS</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/xhtml/accessibility-basics/2006/10/</guid>
		<description><![CDATA[Most people generally agree that websites should be made usable to the widest audience possible. Web designers are constantly trying to accommodate users with various browsers, but we must also consider a host of other possibilities.
It is likely an impossible task to make a decent website that is usable by everyone, but it is a [...]]]></description>
			<content:encoded><![CDATA[<p>Most people generally agree that websites should be made usable to the widest audience possible. Web designers are constantly trying to accommodate users with various browsers, but we must also consider a host of other possibilities.</p>
<p>It is likely an impossible task to make a decent website that is usable by everyone, but it is a noble effort to try. The major users we need to consider (in addition to those that we consider as &#8220;standard&#8221; users) include those using old browsers, screen readers, and text browsers, those with poor vision, those who are colorblind, users without Javascript, those using cell phones or other mobile device.<a id="more-43"></a></p>
<h3>What needs to be done?</h3>
<h4>1. Design using web standards.</h4>
<ul>
<li>If you do this, then you are already well on your way because you site should already degrade nicely in old browsers and be formatted pretty well for text browsers.</li>
</ul>
<h4>2. Don&#8217;t open links in new windows if you can help it.</h4>
<ul>
<li>New windows are bad news for screen readers. </li>
<li>The target attribute has been deprecated by the W3C and may not be supported by browsers in the future.</li>
</ul>
<h4>3. Avoid using Javascript for links (new windows and otherwise).</h4>
<ul>
<li>Not all users have javascript-enabled browsers. Try to provide an alternate option for these users if the use of Javascript is unavoidable.</li>
</ul>
<h4>4. Use descriptive links</h4>
<ul>
<li>Use descriptive wording that will not mislead users. Avoid the phrase &#8220;click here.&#8221;</li>
<li>Make use of the title attribute  to support or extend link description.</li>
<li>If you are going to open a link in a new window, let the user know in some way.</li>
</ul>
<h4>5. Describe you images thoroughly for screen readers and text browsers</h4>
<ul>
<li>Make sure that you describe the image in the alt attribute.</li>
<li>Make sure any and all text conveyed in the image is described in the alt tag.</li>
<li>Use the longdesc attribute for complex images such as graphs and charts.</li>
<li>Added bonus: search engine crawlers look at alt tags, so good descriptions can help your optimization.</li>
</ul>
<h4>6. Consider the near-sighted</h4>
<ul>
<li>Make sure your text is big enough to read for all.</li>
<li>Use relative units for text so that the size can be increased.</li>
</ul>
<h4>7. Use contrasting colors for text and background</h4>
<ul>
<li>One of the keys to accessibility is legibility. See my last article for more on this subject.</li>
</ul>
<p>This tutorial really just covers the basics, the stuff that is easy and that everyone should do. This should get you started, but to truly understand the reaches of accessibility, check out these links:</p>
<h4>About Accessibility</h4>
<ul>
<li><a href="http://alistapart.com/articles/wiwa/" title="A List Apart Article by Trenton Moss">What Is Web Accessibility? by Trenton Moss</a></li>
<li><a href="http://www.w3.org/WAI/" title="Web Accessibility Initiative homepage">W3C WAI</a></li>
<li><a href="http://www.section508.gov/" title="Section 508 homepage">Section 508 homepage</a></li>
</ul>
<h4>Developing Accessible websites</h4>
<ul>
<li><a href="http://www.w3.org/TR/WAI-WEBCONTENT/full-checklist.html" title="Web Content Accessibility Guidelines full checklist">W3C&#8217;s WCAG Checklist</a></li>
<li><a href="http://www.diveintoaccessibility.org/" title="Everything you could possibly need to know about Accessibility">Dive Into Accessibility</a></li>
</ul>
<h4>Validation</h4>
<ul>
<li><a href="http://www.contentquality.com/" title="Test your website for WCAG and Section 508 validity">Cynthia Says Accessibility Validation</a> (basic)</li>
<li><a href="http://www.contentquality.com/" title="Thoroughly test your website's accessibility and much more">Bobby Quality, Accessibility, and Privacy Validation</a> (advanced)</li>
</ul>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/xhtml/accessibility-basics/2006/10/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Javascript Cookies</title>
		<link>http://www.chickenbeak.com/javascript/javascript-cookies/2006/09/</link>
		<comments>http://www.chickenbeak.com/javascript/javascript-cookies/2006/09/#comments</comments>
		<pubDate>Fri, 08 Sep 2006 01:21:25 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>Javascript</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/javascript/javascript-cookies/2006/09/</guid>
		<description><![CDATA[Using a cookie with JavaScript is easy. With the cookie, you can save small bits of information that will allow you to create a customized experience for the user. Remember though, you should never save personal information in a cookie, like a social security number, a password, or a credit card number. Cookies are not [...]]]></description>
			<content:encoded><![CDATA[<p>Using a cookie with JavaScript is easy. With the cookie, you can save small bits of information that will allow you to create a customized experience for the user. Remember though, you should never save personal information in a cookie, like a social security number, a password, or a credit card number. Cookies are not a very secure way of transferring information. Also, don&#8217;t rely too heavily on JavaScript cookies since a viewer can turn them off. If you need to track viewer information or pass personal information, use server-side session variables.<a id="more-35"></a></p>
<h2>How To Set a Cookie</h2>
<p>JavaScript has a built in object called the &#8220;cookie&#8221; object. You can access it simply with the following call.</p>
<pre class="code">alert(document.cookie)</pre>
<p><a href="javascript:alert(document.cookie)">Click Here</a> to see what is in your browsers doument.cookie.</p>
<p>If you want to save something as a cookie, you have to URL encode it. This means you should use the same syntax that you see when people pass information in the address bar of a web address (the GET method, to be exact.) For example, www.chickenbeak.com?site=chickenbeak or www.chickenbeak.com?name=chris&#038;site=chicken.</p>
<pre>document.cookie = "site=chickenbeak"
document.cookie = "name=chris"</pre>
<p><a href="javascript:document.cookie='site=chickenbeak';document.cookie='name=chris'">Click Here</a> to set your browsers cookie like above.<br />
Then <a href="javascript:alert(document.cookie)">Click Here</a> to see what is in your browsers doument.cookie.</p>
<p>As you can see, the cookies are stored in the same format that you write them as, which is again URL encoded. You will want a JavaScript function that sifts through the document.cookie object and picks out the information you need. We will do this by splitting the long string saved in the document.cookie, and take the one bit of info we need.</p>
<p>What if we wanted to display a JavaScript message box to a visitor the first time they visit your homepage, but not every time they browse back to your homepage from a sub page of the site. We will set a cookie telling us that they have been there. Let&#8217;s start with a JavaScript function.</p>
<pre class="code">function getCookie(cookieName) {}</pre>
<p>The way we want this function to work is to pass the function a cookie name, and it returns the cookie value. We will mainly be using the JavaScript &#8220;split&#8221; function, storing the separate values into an array, and for each spot in that array running the split again. See, this is the pattern of a long cookie.</p>
<p>&#8220;varName=varValue;varName=varValue;varName=varValue&#8221;</p>
<p>So, let&#8217;s do the first split.</p>
<pre class="code">cookieInfo = document.cookie
cookieInfo = cookieInfo.split(";")</pre>
<p>This leaves us with an array &#8220;cookieInfo&#8221; which would contain values looking like &#8220;varName=varValue&#8221; for each cookie. We need to loop through this array one time and split it again.</p>
<pre class="code">cookieCount = cookieInfo.length
for(i = 0; i < cookieCount; i++) {
tempCookieInfo = cookieInfo[i].split("=")
//next we look at the [0] spot, which is the "varName"
//and look to see if it match's the "cookieName"
if(unescape(tempCookieInfo[0]) == cookieName
return tempCookieInfo[1]
}
}</pre>
<p>Note the comment above in the code. That is where we get the actual value based on the name of the cookie. Notice the use of the &#8220;unescape&#8221; JavaScript function? Remember that the cookies are URL encoded, which means you&#8217;ll get the codes like %20 instead of a space. That unescape will help in keeping the information formatted best for your JavaScript comparisons.</p>
<h2>Let&#8217;s put it all together</h2>
<p>We have a function now that will pull a value out of the document.cookie object. We would use it something like this&#8230;</p>
<pre class="code">if(getCookie("mySiteVisited") == "yes") {
//do nothing
} else {
document.cookie = "mySiteVisited=yes"
alert("Welcome!")
}</pre>
<p>And that would of course require our full function from above&#8230;</p>
<pre class="code">function getCookie(cookieName) {
if(document.cookie) {
cookieInfo = document.cookie
cookieInfo = cookieInfo.split(";")
cookieCount = cookieInfo.length
for(i = 0; i < cookieCount; i++) {
tempCookieInfo = cookieInfo[i].split("=")
if(unescape(tempCookieInfo[0]) == cookieName) {
return tempCookieInfo[1] } } }
else { return null }
}</pre>
<p>Oh, don&#8217;t forget that big &#8220;if&#8221; block around most of the functions code. If the document.cookie object is not used by their browser, the function returns null. That way you can see if the viewer use&#8217;s cookies or not. That can be helpful because you can write code to react the lack of cookie support.</p>
<p>There you have it, set cookies, get cookies and a bit of use from the &#8220;split&#8221; JavaScript function.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/javascript/javascript-cookies/2006/09/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Convert MySQL Date</title>
		<link>http://www.chickenbeak.com/php/convert-mysql-date/2006/09/</link>
		<comments>http://www.chickenbeak.com/php/convert-mysql-date/2006/09/#comments</comments>
		<pubDate>Wed, 06 Sep 2006 23:02:45 +0000</pubDate>
		<dc:creator>chris</dc:creator>
		
	<category>PHP</category>
	<category>SQL</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/php/convert-mysql-date/2006/09/</guid>
		<description><![CDATA[Let&#8217;s walk through the steps of creating a PHP function that will convert a MySQL date (2002-06-03) and turn that into a real world date. That way, if you ever use the date type of MySQL, you can use easily convert that date as you call it in your PHP code. It&#8217;s a small function [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s walk through the steps of creating a PHP function that will convert a MySQL date (2002-06-03) and turn that into a real world date. That way, if you ever use the date type of MySQL, you can use easily convert that date as you call it in your PHP code. It&#8217;s a small function that is driven almost solely by the <a title="php.net" target="_blank" href="http://us3.php.net/substr">substr</a> function built into PHP.<a id="more-42"></a></p>
<p>First a quick note. It&#8217;s always a good idea to write a single file for a site called something like &#8220;db_connect.inc&#8221; and use that file by all of the other pages to connect to your Database. That way, it&#8217;s one change instead of a change on each page if you ever switch the database or the method of a connection. A great place to stick this function is in that file, since it probably won&#8217;t see much use outside of the times you make a connection. Just a thought.</p>
<p>Let&#8217;s start by defining the function name, along with creating the input and output strings.</p>
<pre class="code">function db_date($mysqlDate) {
$formatedDate = $mysqlDate;
return $formatedDate;
}</pre>
<p>That&#8217;s the first step. Next, what do we want to use as the separator? A &#8216;-&#8217;, or a &#8216;/&#8217; or something else? We should be able to set this when we call the function, so we&#8217;ll make it an optional attribute. That way, if we don&#8217;t set it when we call the function, it defaults to a &#8216;-&#8217; (or anything else you want.)</p>
<pre class="code">function db_date($mysqlDate, $sep = '-') {</pre>
<p>That&#8217;s it. Now when we want to add a &#8216;-&#8217; to the output string, we just use the $sep variable instead. Next, we need to process that string with the <a title="php.net" target="_blank" href="http://us3.php.net/substr">substr</a> function. The MySQL date is in a yyyy-mm-dd format. So we can just pick out the 3 sets of numbers then send those back out of the function (with the $sep separator we defined above.</p>
<pre class="code">$month = substr($mysqlDate,5,2);
$day = substr($mysqlDate,8,2);
$year = substr($mysqlDate,0,4);</pre>
<p>The way substr works is by defining a string, defining a start position, then defining how many characters to read from the string starting from that start position. For month for example, we want to read the &#8220;$mysqlDate&#8221; string, starting at the point after the 5th character, and read the next two characters of that string.</p>
<p>Now that we have all 3 parts of the date, we combine them all and spit them out to the function. It ends up looking like this&#8230;</p>
<pre class="code">function db_date($mysqlDate, $sep = '-') {
$month = substr($mysqlDate,5,2);
$day = substr($mysqlDate,8,2);
$year = substr($mysqlDate,0,4);
$formatedDate = $month . $sep . $day . $sep . $year;
return $formatedDate;
}</pre>
<p>&#8230; and we would call it from within the PHP page something like this&#8230;</p>
<pre class="code">echo(db_date($row['date']));</pre>
<p>&#8230; assuming that the $row is the correct PHP variable in a MySQL loop of that PHP page. That&#8217;s it.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/php/convert-mysql-date/2006/09/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Legibility Basics for the Web</title>
		<link>http://www.chickenbeak.com/xhtml/legibility-basics-for-the-web/2006/09/</link>
		<comments>http://www.chickenbeak.com/xhtml/legibility-basics-for-the-web/2006/09/#comments</comments>
		<pubDate>Tue, 05 Sep 2006 17:20:55 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
	<category>XHTML</category>
	<category>CSS</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/xhtml/legibility-basics-for-the-web/2006/09/</guid>
		<description><![CDATA[Typography is one the most important aspects of design and, yet, is one of the most commonly overlooked. Good typography is essential for good design in any medium. The key to good typography on the web is legibility. By choosing the right font or combination of fonts, using contrasting colors, proper alignment and spacing, you [...]]]></description>
			<content:encoded><![CDATA[<p>Typography is one the most important aspects of design and, yet, is one of the most commonly overlooked. Good typography is essential for good design in any medium. The key to good typography on the web is legibility. By choosing the right font or combination of fonts, using contrasting colors, proper alignment and spacing, you can achieve cleaner, more dynamic, and more effective websites.<a id="more-41"></a></p>
<h3>Choosing the right colors</h3>
<p>The text color you choose should be completely dependent upon your background color. Choosing a good combination of contrasting colors will increase legibility. Don&#8217;t neglect the color blind when you design your websites.</p>
<h4>Here&#8217;s a few things to consider:</h4>
<ol>
<li>Use a dark text color on a light background color (black on white is the best).</li>
<li>Light colors on dark backgrounds is a bit more strenuous on the eye, so use it sparingly and increase your line-height when you do.</li>
<li>Avoid conflicting color combinations that strain the eye (such as blue and red or green and red)</li>
</ol>
<h3>Choosing the right typeface</h3>
<p>When designing for the web, you&#8217;ll probably want to choose a typeface that has been specifically designed for screen output (such as Trebuchet MS). The face you should choose should have generous x-heights and shortened descenders for best  legibility. </p>
<p>Unfortunately, due to the limited number of fonts shared among all computer systems, we are left with only a handful of typefaces to choose from that we can be sure that everyone (well, almost) will have on their computer and even fewer that worth using. </p>
<p>Those fonts include: verdana, trebuchet ms, georgia, arial, times new roman, and (sadly) comic sans ms.</p>
<p>These fonts are available on almost all computers straight out of the box. Verdana, Trebuchet MS, and Georgia were all specifically designed for screen output and are probably the best choices for web text.</p>
<p>If you have a typeface in mind that you are not sure others have, you should still use it, but make sure that you choose acceptable substitutes for those who don&#8217;t have the font and that your site still works properly those substitutes. This is very easy to do in CSS.</p>
<p class="code">font-family: helvetica, arial, verdana, sans-serif;</p>
<p>The way this works is that the receiving computer will simply go through the list until it finds a typeface that it has. You should always include a default typeface (such as sans-serif) as a last resort as well.</p>
<h3>Alignment</h3>
<p>In most cases, it will be best to use left alignment. It is the easiest for people to scan and read. Centered text is difficult to follow after more than a couple lines and should be used sparingly.</p>
<p>There other major option is justified type. Creating successfully justified text is a difficult endeavor even for print. It is even more so for the web, because of word-spacing, letter-spacing, and hyphenation limitations in CSS. CSS will allow you justify your text, but not adjust it in the ways that are necessary to display it properly. If you feel the need to justify your type on the web, it seems to work the best for  wide content areas that contain large amounts of content. </p>
<h3>Spacing</h3>
<p>There are many ways that you can adjust the spacing of text, such as tracking (the space between letters), kerning (the space between words) and leading (to put it simply, the space  between lines). In CSS these are represented as letter-spacing, word-spacing, and line-height respectively. </p>
<p>As mentioned above, the usefulness of letter-spacing and word-spacing in CSS is limited. Word-spacing is rather poorly supported in older browsers and both lose most of their power if you cannot set maximum and minimum limits. You may still find letter-spacing useful at times, such as with titles.</p>
<p>The most important aspect of spacing for the web is, thus, line-height. By placing a sufficient amount of space between rows of text, you will increase legibility. There are formulas to figure out the proper spacing based on text size, but all you really need to do is find a medium that is not too cramped, not too loose and flows nicely.</p>
<h3>Conclusion</h3>
<p>Unfortunately after all these sentences and paragraphs, we have only covered the basics for understanding legibility on the web and have barely scratched the surface of typography. Just remember, if something is difficult to read, then most people won&#8217;t bother.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/xhtml/legibility-basics-for-the-web/2006/09/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Photoshop Menus and Palettes part 1</title>
		<link>http://www.chickenbeak.com/photoshop/photoshop-menus-and-palettes-part-1/2006/08/</link>
		<comments>http://www.chickenbeak.com/photoshop/photoshop-menus-and-palettes-part-1/2006/08/#comments</comments>
		<pubDate>Thu, 10 Aug 2006 02:44:09 +0000</pubDate>
		<dc:creator>nicholas</dc:creator>
		
	<category>Photoshop</category>
		<guid isPermaLink="false">http://www.chickenbeak.com/photoshop/photoshop-menus-and-palettes-part-1/2006/08/</guid>
		<description><![CDATA[Adobe Photoshop is the most important piece of software for a designer. Not because it does amazing things but instead because it provides a basis for understanding how most design software works. The method in which photoshop uses layers, applies filters and lets a user manipulate pixels is one of the most important things a [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe Photoshop is the most important piece of software for a designer. Not because it does amazing things but instead because it provides a basis for understanding how most design software works. The method in which photoshop uses layers, applies filters and lets a user manipulate pixels is one of the most important things a designer can understand. It is because of this that we will be going over photoshop and most of its functionality piece by piece.<a id="more-33"></a></p>
<p>The Window menu</p>
<ul>
<li>The Window menu can be found all the way to the right on the top menu bar. Basically put the window menu houses all of photoshop&#8217;s palettes. A palette is essentially a mini window that houses certain tools in Photoshop. for example the character palette houses tools for changing fonts, font size, etc. The Layer palette is by far the most important  to understand because this metaphor will be repeated throught out most design software.</li>
</ul>
<p>The File menu</p>
<ul>
<li>The File menu is pretty much self explanatory. New opens a new document and open allows you to locate a previous document on your computer or network. Sidenote Browse, in this menu, lets you locate images with Adobe&#8217;s Bridge app which is pretty awesome but alas that is a different tutorial for a different day.</li>
<li>Let&#8217;s go back to the New command. This launches a new window which lets the user customize their document. This window lets the user pick the width, height, dots per inch, as well as color mode.  The width and height of your document can be picked in many different  ways however most projects will probably be in pixels, inches, or picas. We will only cover pixels and inches for now. A pixel is a tiny square that makes up a digital image when you zoom in on a digital picture you can start to see them easily. Almost all projects on screen i.e. tv, computer, or kiosk will be done in pixels since this will be the easiest and most accurate for that medium. Sometime you may be creating something that isn&#8217;t for screen such as a design that will be going to print, this is where it is important to use inches. Using inches will let you determine an exact size for your image so that it fits on paper stock that you are using for your project. Last but not least there is color mode. The two main color modes you will be using are RGB (Red Green Blue) and CMYK (Cyan Magenta Yellow and Black), RGB is the color mode you would use with something that is going to be on a screen, computer or TV. CMYK is what you would use for a print project. Using the correct color mode will ensure that your projects look correct and consistent on any medium.</li>
</ul>
<p>The Edit Menu</p>
<ul>
<li>The edit menu should be self explanatory. This contains undo, redo, copy, paste, cut etc. Be sure to memorize the key command here, they will safe your life, literally&#8230;while not literally but be sure you know them! Two important command in this menu are Fill (option/alt+backspace) and Free transform apple or ctrl+T. The fill command will fill a layer or selection with a color, and the free Transform will allow you to scale or rotate a layer or selection. Be sure to hold down shift while transforming something to keep its correct aspect ratio, try it, you&#8217;ll see what i mean.</li>
</ul>
<p>The Tools Palette</p>
<ul>
<li>This palette will be where most image manipulation takes place. The best way to understand this palette is to simply bring an image into photoshop and play around with each and every tool here. (Tip hold the mouse over a tool to see its name and see its key command, key commands are really freaken important just trust me.)</li>
<li>The Selection Tool(top left)(key command M) This tool simply put lets you select a part of an image. Thats it.</li>
<li>The Move tool(Top Right)(key command V) This tool lets you  move images and layers around. (Tip- make a selection of and image and then click the move tool and move it. The selected part of the image will move around while everything else stays put.)</li>
<li>The Text tool(It looks like a big T)(key command&#8230;you guessed it&#8230; T) Click this tool and click on your photoshop document. This will let you type text into your document. Use the character palette to control the text once it is in your document.</li>
<li>Set Foreground Color/Set Background Color(The two solid colors at the bottom of the toolbar)(Key command X) Double Clicking on this tool lets you choose a color, such as for text, or for a fill. Make a selection then select a color and got to Edit>Fill. That color will be placed in the selection.</li>
</ul>
<p>The Layers Palette</p>
<ul>
<li>The first thing you will see in this palette is a layer called Background in italics. Double Click on it to unlock this layer. Now it is editable. But we aren&#8217;t going to edit that. Create a new layer, to do this  click on the little square icon with a page curl on it at the bottom of the Layer Palette. This will create a new layer. Double click on the words layer 1 to give it a name. (Always name your layers it is extremely important to do this so that when you are working on a project with 100&#8217;s of layers yout will know what controls what.) On your new layer create a selection and fill it in. Now double click on the layer in the layer palette. This will bring up the effects window. Check any of the effects to add them to your layer. For now we will ad every designers&#8217; favorite and most over used effect&#8230;The Drop Shadow. Check Drop Shadow and click on the words Drop Shadow to get the controls for this effect. Play around with the sliders to see how they affect this layer. (Design Tip- Don&#8217;t overuse drop shadows or glows. These are both popular and awesome effects that add life and pop to designs but they should only be used in moderation and subtly.)</li>
</ul>
<p>Conclusion</p>
<ul>
<li>We will end Part 1 here. Hopefully this has given you a good primer into how to use the basic tools in photoshop. The single most important thing to understand about photoshop is that you need to play with the program. That is the only way to figure out how everything in this great program works.</li>
<li>In Part 2 we will be covering the Layer Palette more, The Image menu, The Crop Tool, The Clone Stamp Tool, The eye dropper tool, and the history palette.</li>
</ul>
]]></content:encoded>
			<wfw:commentRSS>http://www.chickenbeak.com/photoshop/photoshop-menus-and-palettes-part-1/2006/08/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
