<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Perspective</title>
	<atom:link href="http://codeperspective.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeperspective.ca</link>
	<description>Coding is awesome</description>
	<lastBuildDate>Tue, 09 Mar 2010 21:34:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing Cocos2D for the iphone</title>
		<link>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/</link>
		<comments>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 21:34:36 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=229</guid>
		<description><![CDATA[I have recently started working on some Iphone games only to discover a spectacular 2D game engine on the iphone called Cocos2D. After reading their very impressive feature list and some blogs on how Cocos2D works, I decided to try it out for myself. Low and behold however that it wasn't the easiest thing to install manually for iphone development. If you try and install cocos manually, you will run into countless errors and hassles while getting it up and running.]]></description>
			<content:encoded><![CDATA[<p>I have recently started working on some Iphone games only to discover a spectacular 2D game engine on the iphone called <a title="Cocos2D" href="http://cocos2d.org/" target="_blank">Cocos2D</a>. After reading their very impressive feature list and some blogs on how Cocos2D works, I decided to try it out for myself. Low and behold however that it wasn&#8217;t the easiest thing to install manually for iphone development. If you try and install cocos manually, you will run into countless errors and hassles while getting it up and running.</p>
<p>However, Cocos2D now sports a fancy shell script to get some Cocos2D templates up and running directly in Xcode with all the files pre-configured to start. To install these templates all you have to do is navigate to the cocos2D root directory on your filesystem using the terminal and then run this command.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">./install_template.sh</pre></div></div>

<p>You can then open Xcode and you should see the following screen ready to use.</p>
<p style="text-align: center;"><a href="http://codeperspective.ca/images/XCodePart1/cocos2d.png"><img class="aligncenter" title="Cocos2D" src="http://codeperspective.ca/images/XCodePart1/cocos2d.png" alt="" width="595" height="569" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iphone Programming Part 1 &#8211; Intro to Xcode and IB</title>
		<link>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/</link>
		<comments>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 23:40:01 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X Hints]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=217</guid>
		<description><![CDATA[First off before we start, here are a couple of things you will need to get started:
1. Mac running the latest version of xcode &#8211; This can be found on your install disc for leopard or snow leopard.
2. Latest version of the iphone SDK &#8211; This can be found at developer.apple.com
Now we can get started. [...]]]></description>
			<content:encoded><![CDATA[<p>First off before we start, here are a couple of things you will need to get started:</p>
<p>1. Mac running the latest version of xcode &#8211; This can be found on your install disc for leopard or snow leopard.</p>
<p>2. Latest version of the iphone SDK &#8211; This can be found at <a title="Apple Developer Connection" href="http://developer.apple.com" target="_blank">developer.apple.com</a></p>
<p>Now we can get started. Once you have xcode and the iphone SDK installed, open up xcode(Macintosh HD &gt; developer &gt; Applications). Once you have xcode installed, from the menu bar select file &gt; new project. You should see a windows like the this one.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/CreateNewProjectXcode.png"><img class="aligncenter" title="Create New XCode Project" src="http://codeperspective.ca/images/XCodePart1/CreateNewProjectXcode.png" alt="" width="716" height="641" /></a></p>
<p>Select window based application from the iphone application option on the left hand side of the window. Once you select the window based application, xcode will prompt you to save the project. I named my project &#8220;LabelTester&#8221; and saved it under my personal iphone projects directory. Once you save the project, an xcode window should open up and look something like this.</p>
<p style="text-align: center;"><a href="http://codeperspective.ca/images/XCodePart1/initialXcodeView.png"><img class="aligncenter" title="Initial XCode View" src="http://codeperspective.ca/images/XCodePart1/initialXcodeView.png" alt="" width="713" height="550" /></a></p>
<p>You should see a combination of files here in the browser in the code browser. The first should be the CoreGraphics.framework. This is just a set of files provided by Apple that have all the code relevant to the core graphics libraries in Cocoa. The second is the foundation.framework. This is the library set for the foundation framework which is basically all the classes like NSArray, NSString and other foundation objects. The next item should be LabelTester.plist. The plist, or preference list, is a set of XML attributes that control how the application is handled. For the sake of this tutorial, you won&#8217;t need to open the plist. The next item should be the LabelTester.app file, which is the executable for your application. Once your application is deployed, all files and resources in your project will be located inside your app&#8217;s .app file. The next file is the LabelTester.pch file. This file is the prefix header for your application. The LabelTesterAppDelegate.h file is the next file in the list. This file is the header file for your application delegate. This is the starting for your application, the app delegate is what&#8217;s run by your main.m file when you app is launched. The .h file is of course the header file, which is basically the interface file that the .m file will implement. The next file is of course the LabelTesterAppDelegate.m. This file is the implementation file for the app delegate header. Next is the main.m file. This file is the application launcher for your app. It basically runs the app delegate. The next file is the Main Window.xib file. Anything with a nib/xib file extension is classified as an interface builder file and you open these files in the Interface builder application. Finally, the UIKit.framework. This library is used to correspond to all the UI elements on the iphone(text fields, buttons, etc).</p>
<p>Let&#8217;s start by opening up our Main Window.xib to setup our interface. Start by dragging a button from the libraries window onto your main View. Rename that button by double clicking on the button and change it to say &#8220;Update Label!&#8221;. Next, grab a text field and drag it just above the button. Expand the text field to fit the majority of the screen. Select the textfield and go into the attributes tab and enter into the placeholder field, &#8220;Enter Text to update Label&#8221;. Once that&#8217;s finished, drag a label onto the main window and change the text from &#8220;label&#8221; to &#8220;Label to Update&#8221;. Once that&#8217;s done you can save the interface builder file by pressing (command + s) and switch your view back to your xcode project.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/IBIntroPage.png"><img class="aligncenter" title="IB Intro Page" src="http://codeperspective.ca/images/XCodePart1/IBIntroPage.png" alt="" width="707" height="710" /></a><a href="http://codeperspective.ca/images/XCodePart1/IBAddItems.png"><img class="aligncenter" title="IB Add Items" src="http://codeperspective.ca/images/XCodePart1/IBAddItems.png" alt="" width="400" height="582" /></a></p>
<p>Open up the LabelTesterAppDelegate.h file and change the file to reflect the following code.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import </span>
&nbsp;
@interface LabelTesterAppDelegate <span style="color: #339933;">:</span> NSObject
<span style="color: #009900;">&#123;</span>
    UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
	IBOutlet UITextField <span style="color: #339933;">*</span>textField<span style="color: #339933;">;</span>
	IBOutlet UIButton <span style="color: #339933;">*</span>button<span style="color: #339933;">;</span>
	IBOutlet UILabel <span style="color: #339933;">*</span>label<span style="color: #339933;">;</span>
	IBAction <span style="color: #339933;">*</span>updateButtonPressed<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UITextField <span style="color: #339933;">*</span>textField<span style="color: #339933;">;</span>
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UILabel <span style="color: #339933;">*</span>label<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>updateButtonpressed<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> sender<span style="color: #339933;">;</span>
&nbsp;
@end</pre></div></div>

<p>The first lines inside the curly braces will declare variables that we will be hooking up in Interface builder later. After the curly braces are closed, we have these property tags. These will allow us to have access to the objects and their data in the implementation file. After that we have an IBAction method declaration. This will eventually be hooked up to our button to run every time that our button is pressed. You can think of an IBAction method as an event handler in OBjective-C. Now let&#8217;s move onto our LabelTesterAppDelegate.m file and add the following method directly below out import statement.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &quot;LabelTesterAppDelegate.h&quot;</span>
&nbsp;
@implementation LabelTesterAppDelegate
&nbsp;
@synthesize window<span style="color: #339933;">;</span>
@synthesize textField<span style="color: #339933;">;</span>
@synthesize label<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>updateButtonpressed<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> sender
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//allocate a string and initialize it with the data from the text field</span>
	NSString <span style="color: #339933;">*</span><span style="color: #993333;">string</span> <span style="color: #339933;">=</span> textField.<span style="color: #202020;">text</span><span style="color: #339933;">;</span>
&nbsp;
	label.<span style="color: #202020;">text</span> <span style="color: #339933;">=</span> <span style="color: #993333;">string</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Basically what we&#8217;re doing here is just creating that IBAction method that we declared in our interface file. Inside that method, we allocate a string to the value of our textField.text and then set the label equal to the string that we get from the textfield. That&#8217;s all the code we&#8217;ll need for now. Don&#8217;t forget to synthesize your objects below the implementation declaration in order to have access to the data you want. If you try and run this now, the application will run but will not function because the pointers in Interface Builder are not hooked up. So let&#8217;s go ahead and do that next. Save all your xcode files and open back up your Main Window.xib file in Interface Builder.</p>
<p>In order to setup a pointer in Interface builder, start by clicking on the application delegate and then the connections manager should appear. Beside each of the items that you created you should see a tiny circle. For each, click on the circle and drag the pointer to each of the elements in your window. This will create a pointer to that element. Now click on the button and then open it&#8217;s connection manager. Find the &#8220;touch up inside&#8221; connection and drag that pointer to the &#8220;file&#8217;s owner&#8221; section in the library and select &#8220;updateButtonPressed&#8221; when it appears. Once this is completed, you should see the connection screen look something like this.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/IBConnections.png"><img class="aligncenter" title="IB Add Connections" src="http://codeperspective.ca/images/XCodePart1/IBConnections.png" alt="" width="301" height="259" /></a>That&#8217;s all folks, now if you run the application and enter some text into the text field, it will update the label to whatever text you entered. To download the whole project click <a title="XcodeProject For Label Tester" href="http://codeperspective.ca/LabelTester.zip" target="_self">here</a>.</p>
<p style="text-align: center;"><a style="text-decoration: none;" href="http://codeperspective.ca/images/XCodePart1/iphoneFinish.png"><img class="aligncenter" title="Iphone Finished Product" src="http://codeperspective.ca/images/XCodePart1/iphoneFinish.png" alt="" width="290" height="539" /></a></p>
<p style="text-align: center;">Cheers everyone and stay tuned for part 2!</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kal-Arts.com is up and running</title>
		<link>http://codeperspective.ca/2010/01/10/kal-arts-com-is-up-and-running/</link>
		<comments>http://codeperspective.ca/2010/01/10/kal-arts-com-is-up-and-running/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 03:04:22 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=201</guid>
		<description><![CDATA[I have just completed my first freelance site! It's looking pretty great! I learnt a lot on this project and am really excited with the result. The full site can be found here. I'll be posting this site in a portfolio page when I get that up and running but for now here are a few screenshots.]]></description>
			<content:encoded><![CDATA[<p>I have just completed my first freelance site! It&#8217;s looking pretty great! I learnt a lot on this project and am really excited with the result. The full site can be found <a title="Chris Lee Design and Illustration" href="http://www.kal-arts.com/" target="_blank">here</a>. I&#8217;ll be posting this site in a portfolio page when I get that up and running but for now here are a few screenshots.</p>
<p>Home Page&#8230;</p>
<p><a href="http://codeperspective.ca/images/ChrisLee/home.png"><img class=" alignnone" title="Kal-Arts Home" src="http://codeperspective.ca/images/ChrisLee/home.png" alt="Home Page at kal-arts.com" width="684" height="572" /></a></p>
<p>Portfolio Page&#8230;</p>
<p><a href="http://codeperspective.ca/images/ChrisLee/portfolio.png"><img class=" alignnone" title="kal-arts portfolio page" src="http://codeperspective.ca/images/ChrisLee/portfolio.png" alt="Portfolio Page at kal-arts.com" width="656" height="566" /></a></p>
<p>Contact Form&#8230;</p>
<p><a href="http://codeperspective.ca/images/ChrisLee/contact.png"><img class=" alignnone" title="Contact Form kal-arts" src="http://codeperspective.ca/images/ChrisLee/contact.png" alt="Contact form at kal-arts.com" width="661" height="567" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/01/10/kal-arts-com-is-up-and-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to PHP &#8211; Creating a Basic Login System</title>
		<link>http://codeperspective.ca/2009/12/13/intro-to-php-creating-a-basic-login-system/</link>
		<comments>http://codeperspective.ca/2009/12/13/intro-to-php-creating-a-basic-login-system/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 04:43:18 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=181</guid>
		<description><![CDATA[Using a little knowledge of PHP and HTML you can build a simple log in system for your site. In order to correctly follow this tutorial you may want to have a good idea of basic HTML/PHP syntax as well as knowing some CSS. You should also have a basic understanding of how to create and use sessions($_SESSIONS) in PHP.]]></description>
			<content:encoded><![CDATA[<p>Using a little knowledge of PHP and HTML you can build a simple log in system for your site. In order to correctly follow this tutorial you may want to have a good idea of basic HTML/PHP syntax as well as knowing some CSS. You should also have a basic understanding of how to create and use <a title="Intro to PHP - Using Sessions and cookies" href="http://codeperspective.ca/2009/12/09/intro-to-php-intro-to-sessions-and-cookies/" target="_blank">sessions($_SESSIONS) in PHP</a>.</p>
<p>Alright let&#8217;s get started by just creating a basic log in window and place it in the center of the screen. First the log in window.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Sample Log In<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loginCSS.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;outerLimit&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;innerLimit&quot;</span>&gt;</span>
					<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loginBox&quot;</span>&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;userAuth.php&quot;</span>&gt;</span>
							<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;username&quot;</span>&gt;</span>Username:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
							<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">40</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
							<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span>&gt;</span>Password:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
							<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">40</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
							<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Log In&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
						<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
					<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Next let&#8217;s move into a bit of the CSS. Basically we just want to create a window with a gray background so the fields are extremely easy to see. I called the CSS file in this case loginCSS.css but you can call it whatever you like as long as it&#8217;s referenced properly in the HTML  section.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">min-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">468px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">min-width</span><span style="color: #00AA00;">:</span><span style="color: #933;">552px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span>Helvetica<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
a
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span>small<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loginBox</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#e4e4e4</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">25</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">25</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#outerLimit</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span>table<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#container</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #3333ff;">:table-</span>cell<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">468px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#innerLimit</span>
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">552px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">468px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>As you can see, I just styled the page a little bit to make it a little bit easier for the user to use. Now that we have a basic page for the user to log in, we&#8217;ll also need a page, such as a dashboard, for the user to access when they enter in correct login criteria. In this case we&#8217;re just going to use a page that has a basic header telling the user they have logged in correctly. The page can look something like this.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">&nbsp;
<span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Sample Log In<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loginCSS.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>You are now logged in!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;logout.php&quot;</span>&gt;</span>Log Out Here<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>As you can see I have also included a log out link just below the h1 tag. If a user logs into the system we also want them to be able to log out. Next we&#8217;re going to create the SQL for our database. For this tutorial I&#8217;ll be using MySQL, however Oracle or SQL Server could also be used.</p>
<p>Note: If you&#8217;re going to use a different database then the code to connect to the database will be slightly different.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">'testDB'</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">'user'</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">'testDB'</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">'user'</span>
<span style="color: #66cc66;">&#40;</span>
	<span style="color: #ff0000;">'username'</span> VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">'password'</span> VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">'testDB'</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">'user'</span>
<span style="color: #66cc66;">&#40;</span>username<span style="color: #66cc66;">,</span> password<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">VALUES</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'admin'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'password'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'guest'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'password'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This is just a very simple database table that contains only a username and password. This script could obviously be modified to accept further fields of to encrypt the password field to increase the security of your system. Things like that will be out of the scope of this tutorial however.</p>
<p>Now that we have our environment set up we can start to use PHP to get data from the forms and compare them with the database. For the this tutorial we will only be using the POST method of retrieving data from forms. Using GET is often not recommended when getting sensitive data such as usernames and passwords. As you can see from the log in window, we have used the POST method to get the data, and when the form is submitted we are calling the userAuth.php file. Let&#8217;s go ahead and create that file now.</p>
<p>This block of code we will be using to check to see if the fields are blank. If they are we want to send them back to the login.html file to log back in again using the header() function. Next we want to enter all the configuration information to connect to the database and use some PHP functions to protect our site from SQL injection errors.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*Create the variables to hold the database information*/</span>
&nbsp;
<span style="color: #000088;">$dbName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;testDB&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Table name that we're checking against*/</span>
&nbsp;
<span style="color: #000088;">$dbTable</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Database username*/</span>
&nbsp;
<span style="color: #000088;">$dbUsername</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DBUsername&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Database Password*/</span>
&nbsp;
<span style="color: #000088;">$dbPassword</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DBPassword&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*This next block is to prevent SQL injection hacks*/</span>
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I have put in default values into the variables. Variables such as $dbTable and $dbUsername will be subject to change based on your database configuration. These values will need to be filled in with correct values from your system. Next we&#8217;re going to be connecting to the database and opening a connection.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*Connect to the Database*/</span>
&nbsp;
<span style="color: #000088;">$connection</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbUsername</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbPassword</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Select the database you want to access*/</span>
&nbsp;
<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Select statement from the database to see if the user is in the system*/</span>
&nbsp;
<span style="color: #000088;">$sqlQuery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT COUNT(*) FROM <span style="color: #006699; font-weight: bold;">$table_name</span> WHERE username = '<span style="color: #006699; font-weight: bold;">$username</span>'
AND password = password('<span style="color: #006699; font-weight: bold;">$password</span>')&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Create a variable to hold the results of the SQL query*/</span>
&nbsp;
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqlQuery</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*Check the number of rows returned from the query*/</span>
&nbsp;
<span style="color: #000088;">$num</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now we&#8217;re getting to the user authentication section. We&#8217;re now going to see if the number of rows that was selected is anything but 0. In theory it should ever only come back with 1 or 0 rows, however in systems where users can multiple accounts it&#8217;s good to keep it to != 0.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*If the number of rows is not equal to 0 then authenticate the user*/</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Create a session for the username and password</span>
	<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">session_register</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">session_is_registered</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;location:login.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//because the user is authenticated move them to the dashboard</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: home.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: login.html&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>We then register a session and store the username and password in the session. If the session has been registered correctly then you can send the user to the home screen. If the session is not registered correctly for some reason we don&#8217;t want the users accessing the system, so we send them back to the login screen to attempt to log in again.</p>
<p>That&#8217;s it, an entire login system. Of course this is just meant to give you the idea of the steps and should by no means be used in a real-world system as is. However you should have a firm understanding of how a basic login system works using PHP/MySQL and a little bit of HTML and CSS. As always if you have any questions/concerns feel free to leave a comment and I&#8217;ll get back to you asap.</pre>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/12/13/intro-to-php-creating-a-basic-login-system/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JQuery Part 4 &#8211; Intro to CSS Manipulation</title>
		<link>http://codeperspective.ca/2009/12/10/jquery-part-4-intro-to-css-manipulation/</link>
		<comments>http://codeperspective.ca/2009/12/10/jquery-part-4-intro-to-css-manipulation/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 21:37:24 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=179</guid>
		<description><![CDATA[JQuery is often used in websites to manipulate the CSS attributes of an HTML element upon the users request. For example, if a user wants to increase the size of the font immediately so that they can read your page, or you may just want to change up the CSS on the fly to make your page stand out a little more. All these things can be done in JQuery using the css() function and css manipulation techniques. Let's get started by creating a basic page with a link and a paragraph with some links in it like so...]]></description>
			<content:encoded><![CDATA[<p>JQuery is often used in websites to manipulate the CSS attributes of an HTML element upon the users request. For example, if a user wants to increase the size of the font immediately so that they can read your page, or you may just want to change up the CSS on the fly to make your page stand out a little more. All these things can be done in JQuery using the css() function and css manipulation techniques. Let&#8217;s get started by creating a basic page with a link and a paragraph with some links in it like so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lib/jquery/jquery-1.3.2.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>JQuery CSS Manipulation<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Click Me<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam sit amet elit vitae arcu interdum ullamcorper. Nullam ultrices, nisi quis scelerisque convallis, <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>augue neque<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> tempor enim, et mattis justo nibh eu elit. Quisque ultrices gravida pede. Mauris accumsan vulputate tellus. Phasellus condimentum bibendum dolor. Mauris sed ipsum. Phasellus in diam. Nam sapien ligula, consectetuer id, <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>hendrerit<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> in, cursus sed, leo. Nam tincidunt rhoncus urna. Aliquam id massa ut nibh bibendum imperdiet. Curabitur neque mauris, porta vel, lacinia quis, placerat ultrices, orci.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>As you can see it&#8217;s a basic HTML page that references the JQuery script. We have also added a link that says &#8220;click me&#8221; along with a paragraph of lorem ipsum text with some links in it. Alright, now onto creating the CSS for the page. For this example I will be putting the CSS in the header but if you want to put it in an external file by all means go ahead and reference it in the header.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>		
p a
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>As you can see, I just added an attribute to make all the links within the paragraph tags initially turn up as red. You can add as many CSS elements here as you would like to style the links however you like but for the purpose of this demonstration you will just need the color red as an attribute. Next let&#8217;s add the JQuery and introduce the .css() function.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'p a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'color'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'blue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>As you can see the JQuery code is pretty straight forward for what we&#8217;re doing. Basically we&#8217;re starting out by checking the DOM to make sure that the file is ready to be manipulated. Then, we perform a click function anytime an anchor tag is pressed. Inside of that click function is where we actually manipulate the CSS and change the color of the anchor tags to blue instead of red like we originally set. The css() function accepts two parameters that we&#8217;ll be using. The first is the attribute that you would like to change and the second is the attribute that you want to change it to. So for our example, the attribute is the color and we&#8217;re going to change it to blue. If of course you want to change the color of the link that was originally pressed instead of every link inside the paragraph tags you could use the &#8220;this&#8221; function instead of specifying a specific tag.</p>
<p>That&#8217;s the basics to CSS manipulation using JQuery, of course the example shown here is only a very basic example and can be greatly expanded upon. This is what the final code should look like&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lib/jquery/jquery-1.3.2.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>JQuery Test<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span>		
			p a
			{
				color: red;
			}
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
			$(function()
			{
				$('a').click(function()
				{
					$('p a').css('color', 'blue');
				});
			});
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Click Me<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam sit amet elit vitae arcu interdum ullamcorper. Nullam ultrices, nisi quis scelerisque convallis, <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>augue neque<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> tempor enim, et mattis justo nibh eu elit. Quisque ultrices gravida pede. Mauris accumsan vulputate tellus. Phasellus condimentum bibendum dolor. Mauris sed ipsum. Phasellus in diam. Nam sapien ligula, consectetuer id, <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>hendrerit<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> in, cursus sed, leo. Nam tincidunt rhoncus urna. Aliquam id massa ut nibh bibendum imperdiet. Curabitur neque mauris, porta vel, lacinia quis, placerat ultrices, orci.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/12/10/jquery-part-4-intro-to-css-manipulation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Intro to PHP &#8211; Intro to Sessions and Cookies</title>
		<link>http://codeperspective.ca/2009/12/09/intro-to-php-intro-to-sessions-and-cookies/</link>
		<comments>http://codeperspective.ca/2009/12/09/intro-to-php-intro-to-sessions-and-cookies/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 17:27:58 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=177</guid>
		<description><![CDATA[Cookies and Sessions are extremely useful to a PHP programmer, however they could be considerably confusing to a beginner. Cookies and sessions are used to store pieces of information for a period of time until it is destroyed. This information inside of a cookie or a session can be used to store things like log in information, URL information and much much more.]]></description>
			<content:encoded><![CDATA[<p>Cookies and Sessions are extremely useful to a PHP programmer, however they could be considerably confusing to a beginner. Cookies and sessions are used to store pieces of information for a period of time until it is destroyed. This information inside of a cookie or a session can be used to store things like log in information, URL information and much much more.</p>
<h2>Cookies</h2>
<p>Cookies are pieces of information stored on the client&#8217;s machine. The disadvantage here is that cookies can be disabled or ignored from the client&#8217;s end. So if you&#8217;re using cookies, try not to use them for anything that is crucial to the system functioning(this is what sessions are for&#8230; more on that later). The syntax for creating a cookie looks like this&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//A cookie can be equal to a string</span>
<span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfCookie'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'What information you want to store here'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//or a cookie can be equal to a variable</span>
<span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfCookie'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span></pre></div></div>

<p>According to PHP variable declaration rules, you can name the cookie whatever you would like as long as it doesn&#8217;t break any of the PHP rules. Data from created cookies can then be used anywhere you like just like any variable such as&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//print the value of the cookie</span>
<span style="color: #b1b100;">print</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfCookie'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Alternately, you can use the isset() method to check to see if a specific cookie has been set. This is more useful when using sessions but we&#8217;ll get to that later.</p>
<h2>Sessions</h2>
<p>Session differ from cookies in that they are stored on the server as opposed to the client. Sessions offer one major advantage over cookies, they cannot be disabled by the user, thus making sessions much more secure than cookies. When dealing with things like log in information and secure data, session are a much better choice than cookies. Sessions are declared using the same conventions as cookies&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//a session can be equal to a string</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfSession'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'What information you want to store in the session'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//or a session can be equal to a variable</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfSession'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will declare a session variable, however there is one key function that needs to be created prior to using a session variable. The session_start() function needs to be called before any data is sent from the server. Even if a spare white space is sent, the session_start() function will most likely send an error. Whenever you want to use a session variable in a PHP file/function, you must call the session_start() function at the very beginning of the page in order to use a session variable that has been created. This needs to occur even prior to sending the DOCTYPE to the client. To use a session variable the syntax is as follows&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//start the session</span>
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//print the session variable</span>
<span style="color: #b1b100;">print</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nameOfSession'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The syntax is similar to using a cookie and alternatively you can use the isset() method to check if a session variable has been created or not. This becomes particularly useful when it comes to creating login systems that keeps users logged in using a session.</p>
<p>In full, you can use sessions or cookies if you like but keep in mind that sessions are stored on the server and cannot be disabled by a user, thus making them much more secure and reliable. In order to create a session, remember to call the session_start() method at the very start of the document or you may not be able to use the session variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/12/09/intro-to-php-intro-to-sessions-and-cookies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Superpower your coda!</title>
		<link>http://codeperspective.ca/2009/12/06/superpower-your-coda/</link>
		<comments>http://codeperspective.ca/2009/12/06/superpower-your-coda/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 03:54:02 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=171</guid>
		<description><![CDATA[Web development with coda seems to be a pretty popular topic these days on the web. With such a powerful engine behind it, especially for multi-user collaboration it is quickly becoming a widely used tool in the web development community. There are a couple things that you can do if you&#8217;re a coda developer to [...]]]></description>
			<content:encoded><![CDATA[<p>Web development with coda seems to be a pretty popular topic these days on the web. With such a powerful engine behind it, especially for multi-user collaboration it is quickly becoming a widely used tool in the web development community. There are a couple things that you can do if you&#8217;re a coda developer to increase your workflow, and really superpower your coda!</p>
<h2>Books</h2>
<p><a href="http://codeperspective.ca/photos/CodaBooks.png"><img class="aligncenter" title="Coda Books" src="http://codeperspective.ca/photos/CodaBooks.png" alt="" width="672" height="283" /></a></p>
<p>Using the books feature in coda can be an extremely useful resource. Whether it be to just check an API function in PHP quickly or grab the code to move a box across the screen with JQuery it&#8217;s all easily accessible in one location. If you are using the trial version of coda then this screen may not be available to you, however once you purchase the full version then you should be able to add, edit, and delete books. Coda books aren&#8217;t necessarily just ebooks either, they can be just snapshots of the API&#8217;s of languages as well. To add a book click the plus button at the bottom left and fill in the book title and the book url. The rest of the options are optional, however if you want to be able to search through a book while editing code in the editor then you will need a search url as well. By holding down the command key and double clicking a word in the editor, you can search a specific book based on what type of file you&#8217;re currently editing in. You may notice a * in the search URL of the books you add. This is used so that when you search for a word it replaces the star with the word you want to search in the book for. Here are some examples of books you may use.</p>
<p>Book Title: JQuery</p>
<p>Book URL: http://docs.jquery.com/</p>
<p>Use for Mode: Javascript</p>
<p>Search URL: http://docs.jquery.com/Special:Search?ns0=1&amp;amp;search=*&amp;amp;go=Go</p>
<p>Book Title: MySql</p>
<p>Book URL: http://dev.mysql.com/doc/</p>
<p>Use for Mode: SQL</p>
<p>Search URL: http://search.mysql.com/search?q=*&amp;amp;ie=&amp;amp;lr=lang_en</p>
<p>Book Title: PHP</p>
<p>Book URL: http://php.net</p>
<p>Use for Mode: PHP &#8211; HTML</p>
<p>Search URL: http://us2.php.net/manual-lookup.php?pattern=*&amp;amp;lang=en</p>
<h2>Clips</h2>
<p><a href="http://codeperspective.ca/photos/Clips.png"><br />
<img class="aligncenter" title="Coda Clips" src="http://codeperspective.ca/photos/Clips.png" alt="" width="468" height="507" /></a>Coda clips are used to quickly add snippets of code to documents. You can make as many categories and snippets as you like for as many language as you like. To add a clip just go to document under the edit tab and select the clips button from the bottom bar. A darkened window should appear like the one above. To add a category just click the plus sign on the left, and to add a clip within that category just click the plus sign on the right. To edit a coda clip just hover over any clip and click the information(i) button on the right side of the clip. A great resource for web development clips in a variety of languages and platforms is the <a title="Coda Clips" href="http://coda-clips.com/" target="_blank">Coda Clips</a> site.</p>
<h2>Sharing</h2>
<p><a href="http://codeperspective.ca/photos/Collaboration.png"><img class="aligncenter" title="Coda Ether Collaboration" src="http://codeperspective.ca/photos/Collaboration.png" alt="" width="313" height="75" /></a></p>
<p>Using a collaboration engine called the <a title="Sub-Etha Engine" href="http://www.codingmonkeys.de/subethaengine/" target="_blank">Sub-Etha engine</a>, coda can allow users to collaborate with multiple people on the same document at exactly the same time. It&#8217;s real time collaboration over a network. So for example, you need help working on some PHP code you&#8217;re working on. All you have to do is click the share button on the bottom left of the editor and you can proceed to invite people to view your document. Or, if you feel so willing, you can open it up on a bonjour stream and have multiple people access the file. From there you can see real-time edits from multiple different people on the same document. This can come in handy especially in large offices, instead of wasting time going from office to office to ask questions about a piece of code. Or if you so feel you could also take advantage of a modified eXtreme programming methodology and have multiple people code up the same document from multiple computers.</p>
<h2><span style="font-size: x-large; ">Summary</span></h2>
<p>Basically, coda can by itself be an extremely useful tool especially for web developers. Using the extra features such as book, clips and sharing coda can help you increase your workflow and productivity in no time. The ability to collaborate with others on the same document in real time is a huge plus especially for fast paced businesses. If you&#8217;re using coda, don&#8217;t hesitate to take advantage of the features it has to help you work faster!</p>
<p><span style="font-size: x-large; "><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/12/06/superpower-your-coda/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to become a google wave power user</title>
		<link>http://codeperspective.ca/2009/11/23/how-to-become-a-google-wave-power-user/</link>
		<comments>http://codeperspective.ca/2009/11/23/how-to-become-a-google-wave-power-user/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 21:55:45 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=169</guid>
		<description><![CDATA[With Google wave being released recently to a larger and larger user base, it's becoming a better real time collaboration tool daily. With a larger user base, also comes more and more plugins, bots, and shortcuts to save you time. I'll go over a few aspects of Google wave that will help decrease the time you spend and increase your results.]]></description>
			<content:encoded><![CDATA[<p>With Google wave being released recently to a larger and larger user base, it&#8217;s becoming a better real time collaboration tool daily. With a larger user base, also comes more and more plugins, bots, and shortcuts to save you time. I&#8217;ll go over a few aspects of Google wave that will help decrease the time you spend and increase your results.</p>
<p>First Off, Google wave is a team collaboration tool. By itself, to be honest, Google wave is really kinda useless. However wen used in a team environment it can be an incredibly useful tool to increase productivity and communication. The first tip I&#8217;ll give comes with a warning, because it&#8217;s not an officially supported browser this method does crash quite a bit more often than say in safari or firefox. Using an application developed by Mozilla called <a title="Mozilla Prism" href="http://prism.mozilla.com/" target="_blank">Prism</a> you can actually make Google wave a desktop application to use directly from your desktop. Although you still need a solid internet connection, it can facilitate having to open a browser any time you want to wave. If you&#8217;re running Windows, you can even get prism&#8217;s Google wave icon to update how many waves have new content on them.</p>
<h2>Widgets/Bot&#8217;s</h2>
<p><a title="Google Syntax Highlighter" href="http://code.google.com/p/syntaxhighlighter/" target="_blank">Google Syntax highlighter</a> &#8211; If you&#8217;re a developer this is a must. Syntax highlighting can be one in a couple ways, but as of now I&#8217;ve found that the Google Syntax highlighter to be the most stable. It supports a variety of languages and seems to embed well in most waves. The only disadvantage I&#8217;ve seen so far is if you have a ton of code to embed, the wave will significantly slow down when editing.</p>
<p><a title="Multi Lingual Bot" href="http://multilingual-bot.appspot.com/" target="_blank">Multi Lingual Bot</a> &#8211;  This bot is pretty neat,  especially if you&#8217;re dealing with a team that speaks a variety of languages. Basically, all you have to do is add the multi lingual bot to any wave. Once you have the bot added to your wave, just specify the language of your liking using the bot commands, and then voila, watch the wave being translated to the language you chose earlier.</p>
<p>For more information on using widgets and bots, look <a title="Google widget help" href="http://www.google.com/support/wave/bin/topic.py?hl=en&amp;topic=24982" target="_blank">here</a>.</p>
<h2>Organizing your waves</h2>
<p>Searches &#8211; Google wave offers the ability to perform searches, and also to save the searches. Let&#8217;s say you&#8217;re working on a project and have a bunch of waves that you want to keep organized. Whenever you create a wave for your project,  just add the name of your project as a tag for that wave. Next perform, and save a search for that tag name and then all your wave&#8217;s with that tag will then show up under the search.</p>
<p>Folders &#8211; Folders are locations that you can add wave&#8217;s to to keep them organized. The only downside to folders is that you cannot dynamically add items to them like you can with searches. To add a wave to a folder,  first create the wave, open the wave and then click on the &#8220;&#8230;&#8221; icon at the top right. You should see a drop down list with &#8220;Move to&#8221; option. Once you select the &#8220;Move to&#8221; option, you should see a list of folders you created there.</p>
<h2>Keyboard Shortcuts</h2>
<p>Spacebar &#8211; If a wave that you&#8217;re apart of is extremely long an many different people are editing it in different locations then it is extremely difficult to track what changes are happening where. The spacebar helps with that. If you&#8217;re not currently editing a wave then you can press the spacebar to scroll through the changes/replies that were made to the wave.</p>
<p>Control &#8211; The control key is an extremely useful key in Google wave. By pressing the control key and clicking on a wave, you can open multiple waves at exactly the same time. You can do this as many times as you want, the waves will just keep tiling in the window. Control also has some specific keyboard shortcuts that do specific features when editing a wave.</p>
<p>The keyboard shortcuts help list can be found <a title="Keyboard Shortcuts" href="http://www.google.com/support/wave/bin/answer.py?hl=en&amp;answer=162330" target="_blank">here</a>.</p>
<h2>Summary</h2>
<p>Google wave is an extremely useful tool when it comes to real-time team collaboration. Using it more efficiently can not only help you, but also your team.  For more information on Google wave check out <a title="Google Wave help" href="http://www.google.com/support/wave/?hl=en" target="_blank">Google wave help</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/11/23/how-to-become-a-google-wave-power-user/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Wave: First Impressions</title>
		<link>http://codeperspective.ca/2009/11/09/google-wave-first-impressions/</link>
		<comments>http://codeperspective.ca/2009/11/09/google-wave-first-impressions/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 17:28:04 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Industry News]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=167</guid>
		<description><![CDATA[For those who don't know, Google wave is a real-time collaboration tool. Unlike other real-time tools such as Etherpad, Google Wave has the ability to embed widgets into "waves". You can use already made widgets such as syntax highlighting for code, or since wave is open source you can create your own widget. This opens Google wave to endless possibility as far a functionality goes.]]></description>
			<content:encoded><![CDATA[<p>I recently received an invite to Google wave, so as any other anxious developer, I tried it out right away. Overall it&#8217;s great! The real-time collaboration is definitely a step forward, especially for project teams. There are also, however, a few things that I really hope Google implements soon or before the full release. I&#8217;ll go over the pros and cons from my point of view.</p>
<p>For those who don&#8217;t know, Google wave is a real-time collaboration tool. Unlike other real-time tools such as Etherpad, Google Wave has the ability to embed widgets into &#8220;waves&#8221;. You can use already made widgets such as syntax highlighting for code, or since wave is open source you can create your own widget. This opens Google wave to endless possibility as far a functionality goes.</p>
<p>Pros:</p>
<ul>
<li>Real Time collaboration &#8211; The ability to edit the same document in real time with team members in a project is a huge plus. And when I say real-time i mean character by character changes. For a project team of developers it&#8217;s especially useful for helping peers out with code help, or reviewing code that was written before implementation.</li>
<li>Ability to embed custom widgets &#8211; Since Google Wave&#8217;s release, the amount of widgets has gone up substantially. Although there are still quite a few widgets that could be created, it&#8217;s a great start for such a new application.</li>
<li>Problems &#8211; If at any point in time while &#8220;waving&#8221;, if a problem arises and Google wave is forced to close, I still have yet to lose more data than my last character typed. Good work on this one Google!</li>
<li>Mute Feature &#8211; If you have a busy wave with say 75 participants, your inbox can get extremely busy very quickly with updates. A simple mute of the wave will stop those updates and keep your inbox clear.</li>
</ul>
<p>Cons</p>
<ul>
<li>Settings &#8211; Google has decided that absolutely everything is done using waves. This means that changing your profile settings are also done in waves. I have to say,  I would really appreciate a section dedicated to changing your settings.</li>
<li>Folder System &#8211; So far, I have found the folder system a little bit harder to use than anticipated. Sorting Wave&#8217;s become a task of adding tags to wave&#8217;s and then searching for a certain tag. I would like to see the ability to drag and drop wave&#8217;s into folders implemented in the near future.</li>
<li>Group Waves &#8211; I would like to see the ability to automatically create a wave with a group of members already invited by default. This would be especially helpful with large project teams that are using wave as their main collaboration tool.</li>
</ul>
<p>Overall I&#8217;m very impressed with Google wave and I&#8217;m excited to see the changes that will be implemented in the future. There are some things that I hope Google changes some things before launch but I&#8217;m sure they will take the feedback given and implement as many features as they can.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/11/09/google-wave-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple: a trip down memory lane</title>
		<link>http://codeperspective.ca/2009/11/04/apple-a-trip-down-memory-lane/</link>
		<comments>http://codeperspective.ca/2009/11/04/apple-a-trip-down-memory-lane/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 23:13:22 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X Hint]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=161</guid>
		<description><![CDATA[Mac Life has a great video displaying some of Apple's major releases over the years. Awesome video to watch if you're a big mac fan!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.maclife.com/video/vp/92">Mac Life</a> has a great video displaying some of Apple&#8217;s major releases over the years. Awesome video to watch if you&#8217;re a big mac fan! </p>
<p><object width="300" height="249"><param name="movie" value="http://www.maclife.com/video/vp/92"></param><param name="wmode" value="window"></param><param name="allowFullScreen" value="true"></param>
<embed src="http://www.maclife.com/video/vp/92" type="application/x-shockwave-flash" wmode="window" allowFullScreen="true" width="300" height="249"></embed></object></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/11/04/apple-a-trip-down-memory-lane/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
