<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>thirst and thrust</title>
	
	<link>http://www.hypixdesign.com/blog</link>
	<description>“He that has satisfied his thirst turns his back on the well.”  -Baltasar Gracian</description>
	<pubDate>Fri, 07 Nov 2008 00:22:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/ThirstAndThrust" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Sad because it is true!</title>
		<link>http://www.hypixdesign.com/blog/2008/09/15/sad-because-it-is-true/</link>
		<comments>http://www.hypixdesign.com/blog/2008/09/15/sad-because-it-is-true/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 00:58:23 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[design]]></category>

		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=168</guid>
		<description><![CDATA[
 Share on Facebook]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/1lqxORnQARw&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/1lqxORnQARw&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/15/sad-because-it-is-true/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/15/sad-because-it-is-true/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/09/15/sad-because-it-is-true/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The object in question</title>
		<link>http://www.hypixdesign.com/blog/2008/09/15/the-object-in-question/</link>
		<comments>http://www.hypixdesign.com/blog/2008/09/15/the-object-in-question/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 00:03:39 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[design]]></category>

		<category><![CDATA[object oriented]]></category>

		<category><![CDATA[terminology]]></category>

		<category><![CDATA[object]]></category>

		<category><![CDATA[object oriented design]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=161</guid>
		<description><![CDATA[
For all the talk of object oriented design and patterns on this blog I sometimes question my own take on objects. What are objects? What are their roles? 
Most of my experience in the professional realm has been in ‘enterprise architecture’ (until recently) where layered approaches are king. Most the systems I have worked on and [...]]]></description>
			<content:encoded><![CDATA[<p><span style="float:right;padding: 6px 10px 6px 0px;"><img alt="object oriented" src="http://images.hypixdesign.com/objects.png" width="400" height="300" /></span></p>
<p>For all the talk of object oriented design and patterns on this blog I sometimes question my own take on objects. What are objects? What are their roles? </p>
<p>Most of my experience in the professional realm has been in ‘enterprise architecture’ (until recently) where layered approaches are king. Most the systems I have worked on and even designed concentrated on distributing layers, database layers, business object layer, presentation layer, and UIs (views). With this approach objects besides the aforementioned layers act as simple data types (or data transports). They tend to by strongly types and are not really aware of the state they carry. It is the business object layer or presentation controllers that are aware of the objects states. The ‘enterprise’ layer approach even through objects and classes are involved it seems more like functional programming where data types (often referred to as domain types) are defined. </p>
<p>What about the other style of objects where they encapsulated and operate on their own internal representation? </p>
<p>I have recently been working on an implementation of a non-collectable card game and it has brought the questions I have to the forefront.  With the PHP CodeIgniter framework, which I am using to implement the game, the controller deals with the model and the view indirectly through load method calls and operate on function defined in both layers. Most examples I have seen of the framework in action use simple arrays to communicate data from the database and view. I am attempting to use objects that contain state as the glue between the interfaces. This falls more in line with my experience and not a classical view of objects. I have often believed that this was a better approach to separate areas of concern when a database changes the code for that interface is one place versus spread across a high number of objects.</p>
<p>Is the classical view flawed? When is it appropriate? When is it beneficial to use a classical object approach?</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/15/the-object-in-question/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/15/the-object-in-question/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/09/15/the-object-in-question/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Does every cloud have a Chrome lining?</title>
		<link>http://www.hypixdesign.com/blog/2008/09/06/does-every-cloud-have-a-chrome-lining/</link>
		<comments>http://www.hypixdesign.com/blog/2008/09/06/does-every-cloud-have-a-chrome-lining/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 21:34:48 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[tools]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[browser]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=154</guid>
		<description><![CDATA[
I finally downloaded Google’s new browser Chrome. I had intended too the day it was released and procrastinated it for two more days. I downloaded it last night and have been playing with it off and on since then.
What does Chrome mean for web developers? For one thing it means that all development will need [...]]]></description>
			<content:encoded><![CDATA[<p><span style="float:left;padding: 6px 10px 6px 0px;"><img title="Googles Chrome" src="http://images.hypixdesign.com/chromecolour3.jpg" alt="" width="265" height="265" /></span></p>
<p>I finally downloaded Google’s new browser Chrome. I had intended too the day it was released and procrastinated it for two more days. I downloaded it last night and have been playing with it off and on since then.</p>
<p>What does Chrome mean for web developers? For one thing it means that all development will need to be testing in yet another browser. One of the biggest pains in web development is programming in such a way that sites and page behave consistently across all browsers that support different standards of the same technology [cascading style sheets [CSS] is a good example of this). </p>
<p>On the positive side chrome has some nice built in features like the browser has a nice element inspector built in that seems pretty solid.  It behaves almost exactly like the plug-in FireBug for FireFox, which is an invaluable tool for debugging pages and seeing how other implement the presentation of a page.  Since Chrome uses a multi-thread approach to the implementation, each tab has its own memory space and process, it has a built in ‘task manager’ feature (just like Windows OS Task Manager) that allow viewing a pages performance in the browser.  It will be exciting to see future features designed to make a web developers life easier.</p>
<p>From a user perspective I think the browser is awesome. It is fast, clean, and sleek. I really like the address bar behaving like a command line, a search box, and an intelligent history … clearly a brilliant idea to give it the user more power. You can drag and drop tabs into their own windows, can recover accidently closed tabs, and much more. I personally look forward to seeing the impact this beta browser will have on the browser market all together. They are certainly pushing the envelope.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/06/does-every-cloud-have-a-chrome-lining/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/09/06/does-every-cloud-have-a-chrome-lining/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/09/06/does-every-cloud-have-a-chrome-lining/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP: Manipulate Images with GD</title>
		<link>http://www.hypixdesign.com/blog/2008/08/28/php-manipulate-images-with-gd/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/28/php-manipulate-images-with-gd/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 01:00:30 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[technique]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[GD image manipulation]]></category>

		<category><![CDATA[php GD]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=150</guid>
		<description><![CDATA[I mentioned a personal project I was working on in the Comet: A Primer blog entry. I hate to mentioned my personal projects since I seem to start more than I ever finish. To let the cat out of the bag, so to speak, I am working on implementing a card game in a web [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned a personal project I was working on in the <a href="http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/" target="_blank">Comet: A Primer blog entry</a>. I hate to mentioned my personal projects since I seem to start more than I ever finish. To let the cat out of the bag, so to speak, I am working on implementing a card game in a web application. There are a number of challenges doing this in a browser and specifically within the context of HTTP.</p>
<p>One of the things I was working on tonight was manipulating an image, of a card, through PHP code. I was please to find that doing so did not require the addition of a library. Installations of PHP v5 has v2.x of the GD library bundled with the PHP installation. GD is an open source code library for the dynamic creation of images.</p>
<p>The first thing I had to do was verify that my host had GD enabled by creating a PHP file with the code below and placing it on the server and browsing to the file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php"><span style="color: #000033;">$array</span><span style="color: #339933;">=</span>gd_info <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$array</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000033;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$val</span><span style="color: #339933;">===</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000033;">$val</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Enabled&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span> 
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$val</span><span style="color: #339933;">===</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000033;">$val</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Disabled&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;$key: $val &lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It told me that GD was enabled and what types of image files it was configured to work with. First off I wanted to work with an existing image versus creating one from scratch (which either is possible). I created a stock card image (pictured below) to work with.</p>
<p><span style="align:center"><img src="http://images.hypixdesign.com/card_front.gif" alt="stock card image" /></span> </p>
<p>What I wanted to with this stock image was to add text to it. With the GD library the way to this is with the function <em>imagestring</em>. I created a simple class to manipulate the image, keep in mind this class is very much in sandbox mode and does not represent the final implementation.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">class</span> ManipulateGifImage <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000033;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000033;">$fileObj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> setFile<span style="color: #009900;">&#40;</span><span style="color: #000033;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">filename</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$file</span><span style="color: #339933;">;</span>
		<span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span>imagecreatefromgif<span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">filename</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$errmsg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// add text</span>
	<span style="color: #000000; font-weight: bold;">function</span> addText<span style="color: #009900;">&#40;</span><span style="color: #000033;">$textToAdd</span><span style="color: #339933;">,</span><span style="color: #000033;">$position</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000033;">$strArray</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000033;">$textToAdd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000033;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000033;">$len</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000033;">$linepos</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$position</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$strArray</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$word</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000033;">$len</span> <span style="color: #339933;">+=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$word</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$len</span> <span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">27</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000033;">$str</span> <span style="color: #339933;">.=</span> <span style="color: #000033;">$word</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				imagestring<span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #000033;">$linepos</span><span style="color: #339933;">,</span><span style="color: #000033;">$str</span><span style="color: #339933;">,</span>imagecolorallocate<span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000033;">$linepos</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
				<span style="color: #000033;">$str</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$word</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
				<span style="color: #000033;">$len</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$word</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		imagestring<span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #000033;">$linepos</span><span style="color: #339933;">,</span><span style="color: #000033;">$str</span><span style="color: #339933;">,</span>imagecolorallocate<span style="color: #009900;">&#40;</span><span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Using this class I was able to manipulate the image. You will notice that the <em>addText</em> function has logic for writing out lines of specific length and then moving the position to add the rest of the text on a new line position. This was done so the longer text could be added to the image by wrapping it in the image versus letting it fall off the edge.</p>
<p>To use this class I added the following code to the PHP file that displayed the manipulated image in the browser.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php"><span style="color: #666666; font-style: italic;">// file type</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/gif&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$imageManip</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ManipulateGifImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'images/card_front.gif'</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$imageManip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setFile</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$imageManip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'This is some text that shows up on the card. I am testing managing wrapping words and that is the reason this text is so long.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
imagegif<span style="color: #009900;">&#40;</span><span style="color: #000033;">$imageManip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
imagedestroy<span style="color: #009900;">&#40;</span><span style="color: #000033;">$imageManip</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileObj</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The <em>imagegif</em> function streams the image object to the browser. Also notice that I set the headers content type so the browser would know what to do with the streamed image. I also followed that with <em>imagedestroy</em> to free the servers memory used for holding the image object.</p>
<p>Here is the resulting image:</p>
<p><span style="align:center"><img src="http://images.hypixdesign.com/demo_card.gif" alt="image with text added to it in the server side code" /></span></p>
<p>Not hard. I have a long way to go with manipulating the images for the card game but this was a pretty straight forward proof of concept.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/28/php-manipulate-images-with-gd/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/28/php-manipulate-images-with-gd/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/28/php-manipulate-images-with-gd/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Checkout Ubiquity</title>
		<link>http://www.hypixdesign.com/blog/2008/08/27/checkout-ubiquity/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/27/checkout-ubiquity/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 01:41:04 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=145</guid>
		<description><![CDATA[This video impressed me. What a great idea and use of technology. Check it out.
Ubiquity for Firefox from Aza Raskin on Vimeo.
 Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>This video impressed me. What a great idea and use of technology. Check it out.</p>
<p><object width="400" height="298"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1561578&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1561578&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="298"></embed></object><br /><a href="http://vimeo.com/1561578?pg=embed&amp;sec=1561578" onclick="javascript:pageTracker._trackPageview ('/outbound/vimeo.com');">Ubiquity for Firefox</a> from <a href="http://vimeo.com/user532161?pg=embed&amp;sec=1561578" onclick="javascript:pageTracker._trackPageview ('/outbound/vimeo.com');">Aza Raskin</a> on <a href="http://vimeo.com?pg=embed&amp;sec=1561578" onclick="javascript:pageTracker._trackPageview ('/outbound/vimeo.com?pg=embed&amp;sec=1561578');">Vimeo</a>.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/27/checkout-ubiquity/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/27/checkout-ubiquity/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/27/checkout-ubiquity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ajax Comet: A Primer</title>
		<link>http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 00:59:47 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[technique]]></category>

		<category><![CDATA[terminology]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[Ajax Comet]]></category>

		<category><![CDATA[web terminology]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=142</guid>
		<description><![CDATA[Comet is a programming technique that enables web servers to send data to the client without having any need for the client to request it. 
In classic AJAX applications, web browser (client) cannot be notified in real time that the server data model has changed. The user must create a request (for example by clicking [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Comet_(programming)" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Comet is a programming technique</a> that enables web servers to send data to the client without having any need for the client to request it. </p>
<p>In classic AJAX applications, web browser (client) cannot be notified in real time that the server data model has changed. The user must create a request (for example by clicking on a link) or a periodic AJAX request must happen in order to get new data from the server.</p>
<p>As I am discovering this is not a straight forward technique. Comet can be very resource intensive. It is interesting to note that most commercial or referenced implementation of comet involves custom written web-servers designed to handle the requirements of this technique to specifically deal with the many detractors. Having to deal with lost connection, proxies that cache portions of response, and firewalls that automatically close HTTP streams after a certain period (to name a few) are all issues that may need to be addressed when attempting to implement comet.</p>
<p>In a current personal project I need to implement a push from the server so that it can notify users of events caused a particular user causes an event to happen on the server. In essence there will be a shared application state that users can affect and there is a need for all users in the same &#8217;server session&#8217; to be notified. I am going to explore my options and comet was the first thing I ran across showing promise.</p>
<p>Stay tuned.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/27/ajax-comet-a-primer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting Things Done (GTD): The Discovery</title>
		<link>http://www.hypixdesign.com/blog/2008/08/26/getting-things-done-gtd-the-discovery/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/26/getting-things-done-gtd-the-discovery/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 02:52:43 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[technique]]></category>

		<category><![CDATA[terminology]]></category>

		<category><![CDATA[Getting Things Done]]></category>

		<category><![CDATA[GTD]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=138</guid>
		<description><![CDATA[ To take a short break from my recent technology research and to indulge my topic A.D.D., I spend the evening reading about &#8216;Getting Things Done&#8217; (GTD). I forward an article to someone earlier this week from Lifehacker, and they asked me &#8220;Do I GTD?&#8221;. My first thought was &#8220;huh?&#8221;. Then I asked them what [...]]]></description>
			<content:encoded><![CDATA[<p><span style="float:left;padding: 6px 10px 6px 0px;"><div style="text-align:left" class="awshortcode-product"><iframe src="http://rcm.amazon.com/e/cm?t=thirandthru-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0142000280&amp;fc1=000&amp;IS2=1&amp;lt1=_blank&amp;lc1=00f&amp;bc1=000&amp;bg1=fff&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></div></span> To take a short break from my recent technology research and to indulge my topic A.D.D., I spend the evening reading about &#8216;Getting Things Done&#8217; (GTD). I forward an article to someone earlier this week from <a href="http://lifehacker.com/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/lifehacker.com');">Lifehacker</a>, and they asked me &#8220;Do I GTD?&#8221;. My first thought was &#8220;huh?&#8221;. Then I asked them what GTD was.</p>
<p>I never made the connection between Lifehacker and a process called GTD. It instantly made sense that they have an obsession with task lists in featured articles. I have been reading the site for a couple of months by &#8216;cherry picking&#8217; articles from the RSS feed I have on my iGoogle home page. After I read a couple of articles about GTD all the dots connected. Lifehacker is all about getting things done. Talk about not seeing the forest through the trees.</p>
<p>So what is GTD? GTD is a workflow method for organizing task, projects, priorities, and life. It is based on a book by David Allen called, appropriately, &#8216;Getting Things Done (GTD)&#8217;. Better than me rattling on about the process let me offer some links that I found useful:</p>
<p><a href="http://en.wikipedia.org/wiki/Getting_Things_Done" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Wikipedia&#8217;s entry on GTD</a><br />
<a href="http://7pproductions.com/blog/2008/02/18/a-primer-on-getting-things-done/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/7pproductions.com');">A Primer on Getting Things Done</a><br />
<a href="http://www.organizeit.co.uk/2007/07/02/huge-list-of-gtd-productivity-sitesblogs/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.organizeit.co.uk');">Huge List of GTD &#038; Productivity Sites/Blog</a><br />
<a href="http://lifehacker.com/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/lifehacker.com');">Lifehacker</a><br />
<a href="http://www.43folders.com/2004/12/29/a-year-of-getting-things-done-part-1-the-good-stuff" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.43folders.com');">A Year of Getting Things Done: Part 1, The Good Stuff</a></p>
<p>I plan on giving this a spin to see how it effects my productivity and focus.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/26/getting-things-done-gtd-the-discovery/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/26/getting-things-done-gtd-the-discovery/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/26/getting-things-done-gtd-the-discovery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP: Text Circle</title>
		<link>http://www.hypixdesign.com/blog/2008/08/25/php-text-circle/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/25/php-text-circle/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 00:12:29 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[technique]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=133</guid>
		<description><![CDATA[I was messing around trying to create a circle tag cloud that I would later use jQuery to animate the text around the outside of the circle on mouse over events. The base level to this idea was to draw a circle. I graduated college with a math minor and it never ceases to amaze [...]]]></description>
			<content:encoded><![CDATA[<p>I was messing around trying to create a circle tag cloud that I would later use jQuery to animate the text around the outside of the circle on mouse over events. The base level to this idea was to draw a circle. I graduated college with a math minor and it never ceases to amaze me how much I have forgot. To the point I had to look up the Wikipedia entry for circle to figure out how to calculate point in a circle. </p>
<p>Below is an example of how to draw a circle composed of absolutely positioned div tags with a period character.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php"><span style="color: #000033;">$radius</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$cent_x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">300</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$cent_y</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">300</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000033;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">360</span><span style="color: #339933;">;</span><span style="color: #000033;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000033;">$pos_x</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$cent_x</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$radius</span> <span style="color: #339933;">*</span> <span style="color: #990000;">cos</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000033;">$pos_y</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$cent_y</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$radius</span> <span style="color: #339933;">*</span> <span style="color: #990000;">sin</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;div style=&quot;position:absolute;top:'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$pos_x</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">';left:'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$pos_y</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">';&quot;&gt;.&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/25/php-text-circle/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/25/php-text-circle/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/25/php-text-circle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Model View Controller Explained</title>
		<link>http://www.hypixdesign.com/blog/2008/08/23/model-view-controller-explained/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/23/model-view-controller-explained/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 23:48:54 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[design]]></category>

		<category><![CDATA[object oriented]]></category>

		<category><![CDATA[terminology]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[architecture]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[software architecture]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=126</guid>
		<description><![CDATA[According to Wikipedia’s entry on Model View Controller:
Model-view-controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.
MVC [...]]]></description>
			<content:encoded><![CDATA[<p>According to <a href="http://en.wikipedia.org/wiki/Model-view-controller" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Wikipedia’s entry on Model View Controller</a>:</p>
<blockquote><p>Model-view-controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.</p></blockquote>
<p>MVC if often referred to as a design pattern and in a lot of ways it is, though it has more to do with the architecture of an application. The general definition of MVC involved three parts, the model, the view and the controller. Makes sense, huh? </p>
<p>The model represents the domain specific information on which an application runs. More times than not, the model use a database as the persistent storage mechanism for this information. Even through other mechanisms can be used the model is main goal is to encapsulate data access and domain specific logic.</p>
<p>The view is the front end representation of the application, typically a user interface, although a programmatic API could also be considered a view. </p>
<p>The controller processes and responds to events coming from either the view or the model. It becomes the interface between the model and view. It can be used to control navigation, business logic, and a host of other things. </p>
<p>I have seen a large number of different implantations of the MVC patterns and have struggled with and argued about where business and domain logic should reside and the best way to implement it. This comes to no surprise given the history of the pattern and the fact that is has been the center of many holy wars in the technological industry and academic circles.</p>
<p>Two sub-types that I like to use in describing two major paths the pattern has gone are referred to Model 1 and Model 2 MVC. </p>
<p>In <a href="http://en.wikipedia.org/wiki/Model_1" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Model 1 architecture</a>, requests are made of the view and the view handles all responsibilities for the request, validation, business logic, display logic, and generating a response (including navigation). This leads to problems with duplicate code and state control in the view. It makes it harder to move or change the interfaces implementation and can lead to maintenance nightmares. Model 1 tends to couple the presentation logic with business logic. One distinction that must be made clear is that the code behind in ASP.NET applications and a Java servlet’s in Java is considered part of the view (though a servlet can be more flexible given the fact that it can be called by a number views).</p>
<p>In <a href="http://en.wikipedia.org/wiki/Model_2" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Model 2 architecture</a>, the presentation is deliberately separate from the content. The context of the application is maintained by the controller. The controller is often used to control navigation from one view to the next. The view can be implemented to contact the model (<a href="http://java.sun.com/javase/technologies/desktop/javabeans/docs/spec.html" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/java.sun.com');">JavaBeans</a>) or model interaction can be brokered by the controller (<a href="http://msdn.microsoft.com/en-us/library/ms979216.aspx" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/msdn.microsoft.com');">Microsoft’s UIProcess</a>, <a href="http://www.codeplex.com/websf" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/www.codeplex.com');">Web Client Software Factory</a> and <a href="http://struts.apache.org/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/struts.apache.org');">Apache Foundation&#8217;s Struts</a> Actions). </p>
<p>In web development, I have had great success with using Model 2 that has extremely light weight, ‘dumb’, views where the controller controls navigation, maintains state (including state persistence), and brokers all communication with the model. I have also wrestled with the downside of Model 1.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/23/model-view-controller-explained/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/23/model-view-controller-explained/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/23/model-view-controller-explained/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ignite your PHP Code</title>
		<link>http://www.hypixdesign.com/blog/2008/08/21/ignite-your-php-code/</link>
		<comments>http://www.hypixdesign.com/blog/2008/08/21/ignite-your-php-code/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 15:03:34 +0000</pubDate>
		<dc:creator>mark lewis</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.hypixdesign.com/blog/?p=123</guid>
		<description><![CDATA[While reading a couple of PHP blogs I ran across a couple references to a framework called CodeIgniter. I decided to take a closer look.
From the CodeIgniter website:
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If [...]]]></description>
			<content:encoded><![CDATA[<p>While reading a couple of PHP blogs I ran across a couple references to a framework called <a href="http://codeigniter.com/" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/codeigniter.com');">CodeIgniter</a>. I decided to take a closer look.</p>
<p>From the CodeIgniter website:</p>
<blockquote><p>CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you&#8217;re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you&#8217;re tired of ponderously large and thoroughly undocumented frameworks</p></blockquote>
<p>Looking at the available functionality in the framework my first impression was the framework was a mish-mash of libraries bought together under an organized directory structure. While that may be true (still not clear on it) but it does has a module loader that allows the mapping of the libraries in a configuration file. It claims to be lightweight and it seems someone could take the approach of only adding the libraries that will be used. I plan on digging for to understand what the core CodeIgniter files are versus optional libraries to allow a skeletal loading of the framework.</p>
<p>One thing that caught my eye was that the framework had a MVC (model view controller) framework which I am a fan of and often through that it was something that PHP lacked. I plan on blogging on the MVC framework next.</p>
<p><a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/21/ignite-your-php-code/"><img src="http://www.hypixdesign.com/blog/wp-content/plugins/addtofacebook/facebook_share_icon.gif" alt="Share on Facebook"></a> <a href="http://www.facebook.com/share.php?u=http://www.hypixdesign.com/blog/2008/08/21/ignite-your-php-code/">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.hypixdesign.com/blog/2008/08/21/ignite-your-php-code/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
