<?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>{ Online Notes }</title>
	<atom:link href="http://www.armando.ws/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.armando.ws</link>
	<description>All things Technical and Personal - Armando Padilla</description>
	<lastBuildDate>Sun, 01 Jan 2012 00:51:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Nodejs &#8211; First thoughts</title>
		<link>http://www.armando.ws/2011/12/nodejs-first-thoughts/</link>
		<comments>http://www.armando.ws/2011/12/nodejs-first-thoughts/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 19:13:27 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=1230</guid>
		<description><![CDATA[My first thoughts on Node as a *real* beginner. First Take. I picked up Nodej about 3 years ago when the name sounded cool in the halls of Yahoo. I didnt think much of it and just thought it was the next buzz word. From a PHP developer&#8217;s stand point and mostly the standpoint of [...]]]></description>
			<content:encoded><![CDATA[<p>My first thoughts on Node as a *real* beginner. </p>
<p><strong>First Take.</strong><br />
I picked up Nodej about 3 years ago when the name sounded cool in the halls of Yahoo.  I didnt think much of it and just thought it was the next buzz word. From a PHP developer&#8217;s stand point and mostly the standpoint of a MVC framework dude I can honestly say I didnt get it. Here&#8217;s what I didnt understand about Nodejs.</p>
<ol>
<li>No webserver like Apache, nginx, etc.</li>
<li>Javascript in the Backend?</li>
<li>Where&#8217;s the routing?</li>
<li>I had to embed my HTML into the JS?</li>
<li>I have to create all new components I have grown to rely on from scratch using Node?</li>
</ol>
<p>Yep, I was wrong&#8230;</p>
<p><strong>Node as a Web Server.</strong><br />
I&#8217;m used to Apache, Nginx, and to some degree lighttpd.  It has build in modules I can use (mod_*), is super fast (nginx), and can even route my paths any which way (rewrite rules).  So why do I need Node?  </p>
<p>Because it&#8217;s all of those rolled into one.  It has modules from NPM, is lightning fast (yet to benchmark), and has advanced routing using modules and/or a framework such as Express. Basically, I was just <strong>used to</strong> Apache, Nginx is what im saying.  Let it go. :-p  </p>
<p><strong>Routing &#038; the Uglyness that&#8217;s Javascript</strong><br />
OK! so here is where my n00b status comes in. I think Javascript is ugly enough to scare off its own mother. I will be the first to admit (and I know, not the last) that I can&#8217;t stand the sheer number of callback function you encounter in a JS file.  Wow, blah.  Based on what I&#8217;m seeing though, there&#8217;s a number of tools that allow you reduce the number of callbacks and abstract most of the underlining JS code by using a Framework or a MongoDB ODM such as  Express and Mongoose.  </p>
<p>Routing.  So here&#8217;s where I was a bit lost.  How did Node map http://www.example.com/accounts/support or http://www.example.com/welcome.html to a document in the file system.  Apache, Nginx, map those paths to a document in the web root (or where your DocumentRoot is pointed to).  So it&#8217;s a no brainer.  If you&#8217;re using a framework you set up Routing Rules or the framework dictates how it will handle paths by default (think about ZF and Cake).  With Node, it&#8217;s a different story.  You have to create all of it.  Instantiate a server, bind it to a port, create a router (or use the FileSystem &#8216;fs&#8217; module), pass the router to the server, set the encoding type, listen for query data, listen for post data, attach methods to scrub data from query string, add&#8230;.you get the idea.  Ugh. </p>
<p>When starting off, yes this seems overwhelming but take a look at Express or another Node framework.  It&#8217;s all taken care of. </p>
<p><strong>View Separation</strong><br />
HTML in the JS? &#8220;Yea no thanks&#8221;, was my first reaction.  I used to be a front-end developer back in the days and that was trying times. As I started using Node, I realized I had to do something like this&#8230;</p>
<p><code>response.write("SOME REALLY CRAZY HTML HERE");<br />
response.end();</code></p>
<p>This turned me off a bit so I kept digging for a View Renderer.  Sure enough I found a few engineers using &#8216;fs&#8217; to pull up a .html file which limited the functionality of the .html file since you couldn&#8217;t pass in variables much like a ZF Controller using $this->view->x = &#8220;hi there&#8221;.  So I stumbled upon something nice, EJS.  Take a look at that, it was exactly what I wanted!  </p>
<p><strong>NPM &#8211; Package Manager</strong><br />
One of the nice features of RoR is gem and in the PHP world, PEAR and PECL. Node has something like it but with less documentation (there&#8217;s talks on the irc channel for a better system) it&#8217;s called NPM or Node Package Manager. It&#8217;s very easy to install but you&#8217;ll need Node 0.6.X to properly run it.  A simple </p>
<p><code>npm install mongoose  </code></p>
<p>installs mongoose inside a node_modules directory in the path you ran the command. Very easy. </p>
<p><strong>Conclusion</strong><br />
I like what I see.  Though I have to admit I don&#8217;t yet understand completely the &#8220;event-driven&#8221; piece to it, I can see why it&#8217;s beneficial.  I like how the pieces are coming together, and unlike Scala&#8230;it doesnt run on Java (see my Scala first thoughts post). So, yes you can say I&#8217;m sold.</p>
<p><strong>Quick Helpful Links</strong><br />
#nodejs &#8211; IRC (freenode)<br />
<a href="http://nodejs.org">nodejs.org</a> &#8211; Download it and read the blog<br />
<a href="http://nodeguide.com/ -">Felix&#8217;s Node.js Guide</a> &#8211; This guy has tons of neat links. I suggest you take a weekend and eat it up.<br />
<a href="http://www.nodebeginner.org/">Free Beginner Node Book</a>  &#8211; Very nice beginners book to get you up and running. Recommend &#038; Its FREE!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2011/12/nodejs-first-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;Mongos&#8217; your MongoDB scharding hub</title>
		<link>http://www.armando.ws/2011/10/mongos-your-mongodb-scharding-hub/</link>
		<comments>http://www.armando.ws/2011/10/mongos-your-mongodb-scharding-hub/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 23:54:48 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=1104</guid>
		<description><![CDATA[Let&#8217;s get right into it. This is going to be a small tutorial on how to shard your data using MongoDB. So grab that cup of coffee, turn on some tunes, and let&#8217;s get cranking away. I&#8217;m going to assume a few things: 1. You know why sharding is good for managing large amounts of [...]]]></description>
			<content:encoded><![CDATA[<style>
code {
background: #eeeeee; 
}
</style>
<p>Let&#8217;s get right into it.  This is going to be a small tutorial on how to shard your data using MongoDB. So grab that cup of coffee, turn on some tunes, and let&#8217;s get cranking away. I&#8217;m going to assume a few things:</p>
<p>1. You know why sharding is good for managing large amounts of content.<br />
2. You&#8217;re ok with not knowing what column(S) to shard against.<br />
3. You have a working MongoDB+PHP set up. (Look at reference if not)</p>
<p><strong>What we&#8217;re shooting for</strong><br />
I like to know what im getting my self into before I start any project and I&#8217;m going to assume you do to.  Once done you&#8217;re going to have the set up shown in Figure 1.1. Of course, for this example we&#8217;ll run everything on one machine but in a production ready environment you should dedicate each of the services its own server. </p>
<p><a href="http://www.armando.ws/wp-content/uploads/2011/10/Mongo-Sharding.jpg"><img src="http://www.armando.ws/wp-content/uploads/2011/10/Mongo-Sharding-e1317937561565-300x135.jpg" alt="" title="Mongo Sharding" width="300" height="135" /></a></p>
<p><em>Figure 1.1 &#8211; MongoDB Shard Topology</em></p>
<p>The figure above contains 6 objects.  The mongo config server, &#8216;mongos&#8217;, 3 mongoDB servers, and your application.  </p>
<p><strong>So what&#8217;s Mongos (in a nutshell)</strong><br />
Mongos is a service which sits between your application and the mongoDBs.  It communicates with the<br />
configuration server to determine where the requested data lives, shard1, shard2, or shardN.  It then fetches the data from the shards (if the data lives in more than one location), aggregates the data, and returns it in JSON form.  </p>
<p><strong>Setting up MongoDB</strong><br />
I&#8217;m going to forgo providing a full list of how-to&#8217;s here since there is great documentation on how to install mongoDB on Windows, Unix, you name it here:  </p>
<p>1. <a href="http://www.mongodb.org/display/DOCS/Quickstart+OS+X">http://www.mongodb.org/display/DOCS/Quickstart+OS+X</a> (OS X)<br />
2. <a href="http://www.mongodb.org/display/DOCS/Quickstart+Unix">http://www.mongodb.org/display/DOCS/Quickstart+Unix</a> (Unix)<br />
3. <a href="http://www.mongodb.org/display/DOCS/Quickstart+Windows">http://www.mongodb.org/display/DOCS/Quickstart+Windows</a> (Windows)</p>
<p>http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages</p>
<p>What I will say though is this. If you run into any issues installing mongoDB on Ubuntu try these steps.<br />
1. Remove mondoDB  </p>
<p><code>> sudo apt-get remove mongodb-client</code><br />
<em>Listing 1.1 &#8211; Remove mongodb-client</em></p>
<p>2. Follow the instruction here: <a href="http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages">http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages</a></p>
<p><strong>Creating the directories</strong><br />
Once you&#8217;re done setting up your mongoDB environment we&#8217;re going to need a few directories.  Each of the below directories will hold the data mongoDB needs. We need 3 directories.</p>
<p><code><br />
> sudo mkdir -p /db/data/config<br />
> sudo mkdir -p /db/data/shard1<br />
> sudo mkdir -p /db/data/shard2<br />
</code><br />
<em>Listing 1.2 &#8211; Create 3 directories</em></p>
<p>The initial command will create the directory in which the configuration server will place the necessary content for mongos to use.  The second and the third lines create the directories used by your mongoDB instances used for sharding.   </p>
<p><strong>Setting up the config server</strong><br />
The first step is to set-up our look up system, the configuration server.  Mongos uses the configuration server to determine where the content lives mong other things.</p>
<p><code>> sudo mongod --dbpath "/db/data/config" --port 100381 --configsvr</code><br />
<em>Listing 1.3 &#8211; Creating and starting mongoDB config server</em></p>
<p>The command shown in Listing 1.3 uses mongod to create and start the mongoDB configuration daemon.  We assign it a port number, &#8220;100381&#8243;, and use the special flag, &#8216;configsvr&#8217;. This allows mongoDB to identify this instance as a configuration server. </p>
<p><strong>Setting up mongos</strong><br />
With the configuration server ready let&#8217;s start up a mongos instance and assign it a configuration server to use.</p>
<p><code>> sudo mongos --configdb localhost:100381 --port 100382 --chunkSize 1</code><br />
<em>Listing 1.4 &#8211; Set up and start up mongos</em></p>
<p>The above command will start the mongos daemon and use the configuration server we created by using the flag &#8220;configdb&#8221; and passing it the host and port of the configuration server.  Using the &#8220;port&#8221; flag we also allowed mongos to listen on port 100382 and assigned it a max allowed data size using &#8220;chunkSize&#8221;.</p>
<p><strong>Setting up the shard boxes</strong><br />
Now let&#8217;s set up the boxes containing our data.   </p>
<p><code>> sudo mongod --port 100383 --dbpath /db/data/shard1 --shardsvr<br />
> sudo mongod --port 100384 --dbpath /db/data/shard2 --shardsvr<br />
</code><br />
<em>Listing 1.5 &#8211; Set-up and start mongoDB shard servers</em></p>
<p>The above commands create and start 2 mongoDB shard instances.  Both commands start mondod instance, assigning them unique port numbers, assigning a db directory to use (we created these directories above), and finally assign them the &#8220;shardsvr&#8221; flag.</p>
<p><strong>Adding the shard servers to mongos</strong><br />
Log onto your mongos instance and add the shard servers created above.</p>
<p><code>> mongo localhost:100382<br />
> use admin<br />
> db.runCommand({addshard: "localhost:100383", allowLocal: true})<br />
> db.runCommand({addshard: "localhost:100384", allowLocal: true})</code><br />
<em>Listing 1.6 &#8211; Add shard servers to mongos</em></p>
<p>The first command shown in Listing 1.6 connects to the mongos instance.  Keep in mind that you will connect to this instance when making changes or fetching data for your application. The second command places you in the admin database to execute further commands.  Finally commands 3 and 4 will add the shard.  If you want to add more shards simply run the command and change out the host:port to point to the new shard server.</p>
<p>Ok your done.  Your environment is ready to accept data. You have set up a mongoDB shard environment using mongos, 2 mongoDB instances, and a mongo configuration service.  Awesome, time to test.</p>
<p><strong>Adding data for testing.</strong><br />
Log onto your mongos instance and create a test database, &#8220;shardhappens&#8221; for testing.</p>
<p><code>> mongo localhost:100382<br />
> use admin<br />
> shardhappens = db.getSisterDB("shardhappens")<br />
> db.runCommand({enablesharding: "shardhappens"})</code><br />
<em>Listing 1.7 &#8211; Create a database to for testing</em></p>
<p>With our database created we need to create a collection as well as a key to shard against.<br />
<code>> db.runCommand({shardcollection: "shardhappens.pebbles", key: {item_id: 1})</code><br />
<em>Listing 1.8 &#8211; Shard by a specific key</em></p>
<p>Listing 1.8 will shard our data within the pebbles collection using the key (column), &#8220;item_id&#8221;.   Now let&#8217;s add in some data to shard using PHP.</p>
<p><strong>Add data for testing</strong><br />
Create a file named, &#8220;insert.php&#8221;, and save it were the above mongoDB environment is set up.  Run the PHP script and wait for it to end.  Once it&#8217;s done you will have data spread evenly across 2 mongoDB instances to play with.</p>
<p><code><br />
<?php<br />
try<br />
{<br />
   $mongo     = new Mongo("localhost:100382");<br />
   $db            = $mongo->selectDB('shardhappens');<br />
   $collection = $db->pebbles;<br />
   for($i=0; $i < 1000; $i++)<br />
   {<br />
      $data = array();<br />
      $data['item_id'] = rand(1, 1000);<br />
      $data['text'] = "Hi mom! I'm sharding some data here...*high five*";<br />
      $collection->insert($data);<br />
   }</p>
<p>}<br />
catch(Exception $e)<br />
{<br />
   echo $e->getMessage();<br />
}<br />
</code><br />
<em>Listing 1.9 &#8211; PHP to insert data into MongoDB</em></p>
<p>Once the script has completed log back into your mongos instance and check the chunk sizes for each shard.</p>
<p><code>> mongo localhost:100382<br />
> printShardingStatus()</code><br />
<em>Listing 1.10 &#8211; Checking shard status</em></p>
<p>You should see an output similar to the text below.</p>
<p><code>shardhappens.pebbles chunks:<br />
     shard0001  10<br />
     shard0002  10</code><br />
<em>Listing 1.11 &#8211; Shard status print out.</em></p>
<p>The values for 10 might be different for you. That&#8217;s it.  You just used mongoDB to shard content.</p>
<p><strong>Conclusion</strong><br />
Even though we did not go into much details on shard theory or take a deep dive into mongoDB, you successfully utilized all the mongoDB tools to shard data as well as used PHP to connect and insert content in your mongoDB environment.</p>
<p><strong>References</strong><br />
1. <a href="http://us2.php.net/manual/en/mongo.installation.php">http://us2.php.net/manual/en/mongo.installation.php</a><br />
2. <a href="http://www.mongodb.org/display/DOCS/Sharding+Introduction">http://www.mongodb.org/display/DOCS/Sharding+Introduction</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2011/10/mongos-your-mongodb-scharding-hub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CCU, Page Views per minute, Unique Users per Hour, Oh My!</title>
		<link>http://www.armando.ws/2011/06/ccu-page-views-per-minute-unique-users-per-hour-oh-my/</link>
		<comments>http://www.armando.ws/2011/06/ccu-page-views-per-minute-unique-users-per-hour-oh-my/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 15:32:58 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=1088</guid>
		<description><![CDATA[Lately I&#8217;ve been fortunate to conduct an array of load tests using very large numbers and I believe I&#8217;ve stumbled upon something interesting within the Load/Performance testing community. Or rather something I might not understand yet&#8230;that&#8217;s also possible. A standardized way to load test. Let&#8217;s take an example. If I want to load test (not [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been fortunate to conduct an array of load tests using very large numbers and I believe I&#8217;ve stumbled upon something interesting within the Load/Performance testing community.  Or rather something I might not understand yet&#8230;that&#8217;s also possible.  A standardized way to load test. </p>
<p>Let&#8217;s take an example.  If I want to load test (not stress test) an application and I&#8217;m using CCU (<em>concurrent users &#8211; how many users are active on the site in a single second</em>) I might have someone inform me that I need to use Page Views per hour or Unique users per hour. Let&#8217;s say that we have 100 Unique users per hour on the site.  If I load test using this figure for the a duration of an hour to meet the expected 100 Unique users this is where I encounter the dilemma and sometimes confusion.</p>
<p>Did these 100 Unique users arrive in the first minute of the hour?  The first second of the hour? Did 10 users arrive every 10 seconds for 100 seconds? Never to return again? So far these questions, from my readings are of no concern as long as you hit your the desired load within the duration of an hour. This is a wrong way to look at it and I believe test. If you&#8217;re given a task to load test an application you must check how well your infrastructure deals with the peak CCU load, you might find out that hitting your server with 100 CCU completely destroys it (if this happens at this number you have many problems) . </p>
<p>I&#8217;ll discuss a bit more on Benchmarking, Load Testing, and Profiling with a ZF twist and sometimes not going forward. </p>
<p>Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2011/06/ccu-page-views-per-minute-unique-users-per-hour-oh-my/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A week at ZendCon 2010</title>
		<link>http://www.armando.ws/2010/11/a-week-zendcon-2010/</link>
		<comments>http://www.armando.ws/2010/11/a-week-zendcon-2010/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 00:00:44 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=985</guid>
		<description><![CDATA[Monday through Thursday what a ride. Yes I did miss some of the keynote speaker and yes I snagged a lunch which didnt belong to me. Sorry Sorry&#8230;ugh Anyways ZendCon was awesome! I&#8217;m not sure why this event does not have more participants but I have to say that I greatly enjoyed it. Thumbs up [...]]]></description>
			<content:encoded><![CDATA[<p> <a href="http://www.armando.ws/wp-content/uploads/2010/11/P1010009.jpg"><img src="http://www.armando.ws/wp-content/uploads/2010/11/P1010009-300x224.jpg" alt="" title="OLYMPUS DIGITAL CAMERA" width="300" height="224" class="alignleft size-medium wp-image-986" /></a>Monday through Thursday what a ride.  Yes I did miss some of the keynote speaker and yes I snagged a lunch which didnt belong to me. Sorry Sorry&#8230;ugh <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Anyways ZendCon was awesome!  I&#8217;m not sure why this event does not have more participants but I have to say that I greatly enjoyed it. Thumbs up to the organizers as well as the speakers.  Ill be attending Zendcon until i drop dead.  <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   </p>
<p><strong>Here are some key take aways from the conferenc</strong>e.<br />
1.  Someone took Matthew Weier O&#8217;Phinney voice.  He lost his voice, yet continued to participate in the talks.  Pretty hardcore if you ask me.<br />
2.  If you&#8217;re not already looking at the cloud. Look up and try to spot one. No really, start reading up on it.<br />
3.  The Zend Framework 2.0 is being worked on and looks very promising in terms of performance.<br />
4.  <strong>The Zend Framework wants your feedback in terms of a Migration plan and bug hunts!</strong><br />
5.  Zend Framework now has mobile support.<br />
6.  <strong>You MUST attend Zendcon 2011.</strong></p>
<p><strong>Reasons to attend Zendcon &#8211; Reason #1 &#8211; Networking</strong><br />
Does this sound familiar? &#8220;Meh, ill just read the Power Points when they are posted&#8221;.  Yes that was me and it might be you. Though this is a good alternative, if you have no way to reach the con or cant come up with the $ to pay for it (btw ask your company if they can help you with this. Most companies do) I have to say that you&#8217;re missing out on a lot.  The network of people you build while at the conference is great.  You talk about lessons learned while tackling a specific problem and if the conversation attracts enough people youll find yourself huddled around a table chatting it up with 5 others with the same issue.   </p>
<p><strong>Reason #2 &#8211; Information Information information!!!!</strong><br />
The second reason to attend  the conference is the ability to learn what other organizations are doing.  I can not stress this enough.  Being blind or not caring about the direction of your competitors or an industry leader in your field is tantemount to jumping out of a plane without a parachute (FAIL).  </p>
<p>As a developer you want to know what company X is doing, how long they have tried this approach, and where its taken them.  For all you know they failed and your team/company is close to implementing the same solution because it looks &#8216;attractive&#8217;&#8230;on paper.  Zendcon provides this.  I loved the open forum style talks.  Each speaker shared their experiences from the field and allowed the audience to also share their experience. And yes I was typing away all these notes for my knowledge locker just in case i ever run into a similar situation.   </p>
<p><a href="http://www.armando.ws/wp-content/uploads/2010/11/P1010010.jpg"><img src="http://www.armando.ws/wp-content/uploads/2010/11/P1010010-300x224.jpg" alt="" title="" width="300" height="224" class="alignright size-medium wp-image-1000" /></a><strong>Reason #3 &#8211; The Measuring stick doesnt lie</strong><br />
Finally the last and third reason I enjoy going to conferences and now enjoy going to this one.  I like to measure where I&#8217;m at as an engineer.  If you want to be good at what you do its not simply about building apps its about surrounding yourself with the people you want to be like.  Learning from them, listen to what they are talking about, and listen to what they failed and succeed at.  For me, the individual sitting on stage was a good reminder as to where I want to go.  They encompassed the &#8220;do&#8217;ers&#8221; of the community in my book and with Matt it was more the breath of knowledge the guy has in his head. I kinda wanted to ask him what were the next steps to becoming a good developer and what he recommended someone in my area do to grow.  But I chickened out. Next year.</p>
<p>All in all Zendcon a good conference to attend as a PHP developer and hope to see you there next year!</p>
<p>P.S. I will be posting my notes here shortly (this time for real.  I know i promised slides from the Google I/O)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2010/11/a-week-zendcon-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google I/O 2010 &#8211; Day 1</title>
		<link>http://www.armando.ws/2010/05/google-io-2010-day-1/</link>
		<comments>http://www.armando.ws/2010/05/google-io-2010-day-1/#comments</comments>
		<pubDate>Thu, 20 May 2010 06:01:02 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=822</guid>
		<description><![CDATA[Google I_O_Talk_Speed_TracerAttended my first Google I/O this year and truth be told I wasnt sure what to expect. My goal was to learn a bit more of Architecture, performance, and HTM 5. Looking back at day 1, I came away feeling good that I actually made it to the event given that I felt like [...]]]></description>
			<content:encoded><![CDATA[<p>Google I_O_Talk_Speed_TracerAttended my first Google I/O this year and truth be told I wasnt sure what to expect.  My goal was to learn a bit more of Architecture, performance, and HTM 5.  Looking back at day 1, I came away feeling good that I actually made it to the event given that I felt like just heading into work.  </p>
<p>These are my notes for the first day.  The below were the talks I chose to attend and created a quick PowerPoint Deck for a portalble version of the notes.</p>
<p>My Schedule:<br />
1. Measure in milliseconds redux: Meet Speed Tracer [ <a href="http://www.armando.ws/wp-content/uploads/2010/05/Google-I_O_Talk_Speed_Tracer.ppt">My Notes: Powerpoint Deck Download</a> ]<br />
2. Beyond JavaScript: programming the web with native code<br />
3. Architecting for performance with GWT<br />
4. Developing With HTML5<br />
5. GWT Linkers target HTML5 Web Workers, Chrome Extensions, and more</p>
<p>Stay tuned for tomorrows deck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2010/05/google-io-2010-day-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTML5, Chrome, and WebDatabase.</title>
		<link>http://www.armando.ws/2010/02/html5-chrome-and-webdatabase/</link>
		<comments>http://www.armando.ws/2010/02/html5-chrome-and-webdatabase/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 08:35:09 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=668</guid>
		<description><![CDATA[I started to get the HTML5 itch a few weeks ago so I started to look around the web to feed my appetite for all things HTML 5. Turns out info is pretty hard to come by. Not sure when your reading this but its been tough to find adequate examples of what IS and [...]]]></description>
			<content:encoded><![CDATA[<p>I started to get the HTML5 itch a few weeks ago so I started to look around the web to feed my appetite for all things HTML 5.  Turns out info is pretty hard to come by.  Not sure when your reading this but its been tough to find adequate examples of what IS and what ISNT implemented yet since it all depends on the browser your using.  Anyway. So im going to jot down my notes on using HTML5&#8242;s Web Database here by creating a few examples.</p>
<p><strong>Quick Agenda</strong><br />
1. <a href="#whatis">What is HTML 5</a>.<br />
2. <a href="#gettingstarted">What you need to get started.</a><br />
3. <a href="#devtool">The tool to view the DB</a><br />
4. <a href="#createconndb">How to create AND connect to a DB</a>.<br />
5. <a href="#createtable">How to create a table.</a><br />
6. <a href="#insertrecords">How to insert/update/delete records into a table.</a><br />
7. <a href="#listrecords">How to list records in a table.</a></p>
<p>Let get the ball rollin&#8217; now&#8230;buhahah</p>
<p><strong id="whatis">What is HTML 5.</strong><br />
HTML 5 is a collection of new tags, (<a href="http://www.w3schools.com/html5/html5_reference.asp">list here</a>)  and along with the new tags it provides a tool set to store data on the user&#8217;s machine using javascript, yes Javascript (<a href="http://dev.w3.org/html5/webdatabase/">Web database API here</a>). </p>
<p><strong id="gettingstarted">What you need to get started.</strong><br />
For the example you&#8217;ll need at least Chrome 4.  Of course you can use any browser you wish but <strong>YOU NEED TO BE SURE HTML 5 WEB DATABASE IS SUPPORTED.</strong>.  I strongly recommend you download and install Google&#8217;s Chrome browser, so far it&#8217;s great. <a href="http://www.google.com/chrome/">Click here for download link</a>.</p>
<p>Thats all you need, oh! and you&#8217;ll need some HTML and Javascript know-how.</p>
<p><div id="attachment_674" class="wp-caption alignleft" style="width: 310px"><img src="http://www.armando.ws/wp-content/uploads/2010/02/figure1.0-300x155.jpg" alt="Figure 1.0 - Chrome Developer Tools" title="figure1.0" width="300" height="155" class="size-medium wp-image-674" /><p class="wp-caption-text">Figure 1.0 - Chrome Developer Tools</p></div><strong id="devtool">The tools</strong><br />
If you don&#8217;t have Chrome installed skip this section. This section will show the visual tool Chrome supplies developers to view not only the database but other neat things about your page. </p>
<p>Load the web page your going to test on.  In my case its http://localhost then click on the &#8220;Control Page&#8221; document icon on the far-top-right corner of your browser . Select <strong><em>Developer > Developer Tools</em></strong>. (Figure 1.0)</p>
<p>You should now see a window as shown in Figure 1.2 (minus the DB). If you do not see the information displayed on Figure 1.2 click on &#8220;Storage&#8221; on the top menu. The &#8220;Storage&#8221; window contains a nice little DATABASE list on the left along with other items specific to that page.  At the moment there&#8217;s no databases so you wont see anything. This is just the place where you&#8217;ll be able to work with the DB <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong id="createconndb">How to create AND connect to the DB</strong><br />
Let&#8217;s create a database. Our database will have the name, &#8220;test_database&#8221; and will be our initial 1.0 version. (Note: the database name is case sensitive)</p>
<p><code></p>
<pre>
dbObj = null;

function connectToDB(){
  dbObj = openDatabase('test_database', '1.0',
                                 'Test Database', 1024*1024*3);
}

connectToDB();
</pre>
<p></code></p>
<p>1. <strong>openDatabase</strong>(&#8216;name of db&#8217;, &#8216;version&#8217;, &#8216;database description&#8217;, total bits table will use, call back function)</p>
<p>The callback function is used to create the table structure if present.  In this example we&#8217;ll create the tables later.  Also note that the size of the database is dependent on the amount of free space the user has available. <div id="attachment_683" class="wp-caption alignleft" style="width: 310px"><img src="http://www.armando.ws/wp-content/uploads/2010/02/figure_1.2-300x228.jpg" alt="Developer Tool Database" title="Figure 1.2" width="300" height="228" class="size-medium wp-image-683" /><p class="wp-caption-text">Figure 1.2 Developer Tool Database</p></div>It is also recommended that the site only take up to 5 mbs of space. The spec also mentions the user will be prompted when the site requests additional space. (<a href="http://dev.w3.org/html5/webdatabase/#disk-space">quote</a>)</p>
<p>Once you run the above javascript on your sandbox, pull up the Chrome Developer tool, you should now see the database (Figure 1.2) </p>
<p><strong id="createtable">How to create a table.</strong><br />
Were going to add a table.  We&#8217;re going open a connection to the database again as shown in the first example and then use the SQLTransation object to execute a CREATE statement. </p>
<p><code></p>
<pre>
dbObj = null;

function connectToDB()
{
   dbObj = openDatabase('test_database', '1.0',
                                   'Test Database', 1024*1024*3);
}

connectToDB();

  //Create the table method
createTable = function()
{
   dbObj.transaction(function(SQLTransaction){
        SQLTransaction.executeSql(
        "CREATE TABLE userinfo (id INTEGER PRIMARY KEY, item1 TEXT)", [],
        function(){ alert('I am a successfull callback function!'); },
        function(){ alert('Oh no! I am a sad error callback function'); } );
      });
}

createTable();
</pre>
<p></code></p>
<p>Copy the above javascript, place into your file, and refresh the page. You will now have the table &#8216;userinfo&#8217; in our database.  If you want to add more tables simple call the method once more with a different CREATE statement. (Figure 1.3). </p>
<p><strong>Some explaining&#8230;</strong><br />
SQLTransaction has 2 methods, transaction() (Read/Write) and readTransaction() (Read only).  We use the transaction method when we need to read AND write. The readTransaction() has only &#8216;read only&#8217; functionality and best used for SELECT SQL statements.</p>
<p>To execute the SQL statements we use the executeSql() method.  A parameter explanation is shown below.</p>
<p><strong>executeSql</strong>(&#8216;SQL Statement&#8217;, [], success callback function, error callback function) .  The [] contains values for each ? used within the SQL statement.  &#8220;INSERT INTO userinfo (item1) VALUES (?)&#8221; will replace the ? with the the content to save for the specific column.  It&#8217;s also recommended to use this feature to code against SQL Injection attacks. (<a href="http://dev.w3.org/html5/webdatabase/#sql-injection">quote</a>)</p>
<p><strong id="insertrecords">How to insert/update/delete records into the DB</strong><br />
At this point UPDATE, INSERT, as well as DELETE statements use the same process as the previous example. We use the SQLTransaction.transaction() method as well as the executeSql() method.  </p>
<p>The next example will insert a record into our database table, &#8216;userinfo&#8217;, and we&#8217;ll verify the data entered using the Chrome Developer tool. Please note that the below code assumes you already created the table.</p>
<p><code></p>
<pre>
dbObj = null;

function connectToDB()
{
   dbObj = openDatabase('test_database', '1.0',
				   'Test Database', 1024*1024*3);
}

connectToDB();

//Insert record into Table.
insertRecord = function(item1)
{
   dbObj.transaction(function(SQLTransaction){
      SQLTransaction.executeSql("INSERT INTO userinfo (item1) VALUES (?)", [item1],
   function(){ alert('Record saved!'); },
   function(){ alert('Uh Oh! record not save!'); } );

   });

}
var item1 = "your not funny dude..really your not.";
insertRecord(item1);
</pre>
<p></code></p>
<p><div id="attachment_752" class="wp-caption alignleft" style="width: 310px"><img src="http://www.armando.ws/wp-content/uploads/2010/02/figure1_3-300x228.jpg" alt="Figure 1.3 - Verifying our record was inserted." title="figure1_3" width="300" height="228" class="size-medium wp-image-752" /><p class="wp-caption-text">Figure 1.3 - Verifying our record was inserted.</p></div>Pull up your Dev Tools Window again, expand the database by clicking the arrow, and click on the table.  The record you just inserted will be displayed on the right as shown in Figure 1.3. Thats great but let&#8217;s now focus on retrieving the records to possibly manipulate the data!</p>
<p><strong id="listrecords">How to List records</strong><br />
With data in our database, lets fetch the record we have in the table.  To do so we use the read/write SQLTransaction method, readTransaction().  </p>
<p>The following code assumes you have the database created, table created, and information stored in the table.  If not go back and read the different sections.</p>
<p><code></p>
<pre>
dbObj = null;

function connectToDB()
{
   dbObj = openDatabase('test_database', '1.0',
				   'Test Database', 1024*1024*3);
}

connectToDB();

fetchRecords = function(){

   dbObj.readTransaction(function(SQLTransaction){
      SQLTransaction.executeSql('SELECT id, item1 FROM userinfo', [],
				function(SQLTransaction, data){
                                displayRecords(data); });
		});

}

displayRecords = function(data){

   var a = document.getElementById("text");
   a.innerText = data.rows.item(0).item1;

}

fetchRecords();
</pre>
<p></code></p>
<p>In this example we query the table and display the results of the call.  We use the SQLTransaction readTransaction() method, SQLTransaction executeSql() method passing in the SQL statement and a call back function displayRecords().   If the SQL SELECT statement successfully ran we pass a SQLResultSet object, &#8216;data&#8217;, to the displayRecords() method.  The displayRecords() method fetches the HTMLElement node, &#8216;text&#8217; and sets the text for the node to be the record fetched item1 value.  </p>
<p><strong>Fetching a specific value for a row.</strong><br />
To fetch the record we use the SQLResultSet object&#8217;s &#8216;rows&#8217; attribute which returns a SQLResultSetRowList object.  We then use the &#8216;item()&#8217; method to fetch a specific row in the row list.  In this case we fetch the first row and call the objects class property, &#8216;item1&#8242;.  Note that each column in the table is represented but a class property.</p>
<p><strong>Conclusion</strong><br />
We covered all the basic features of the HTML 5 web database.  Inserting, creating a table, connecting to a DB, and fetching records.  Give it a shot, if you have any questions feel free to leave a comment or refer to the W3C page <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2010/02/html5-chrome-and-webdatabase/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Benchmarking Zend Framework 1.8.4</title>
		<link>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/</link>
		<comments>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 04:11:15 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=406</guid>
		<description><![CDATA[About 2 months ago I sat in on a PHP performance session at work taught by non other than Rasmus Lerdof.  Aside from creating PHP he had some really neat stuff to talk about concerning performance.  Most of the presentation came from the php.net site, talks.php.net. Take a look at the talks when you have [...]]]></description>
			<content:encoded><![CDATA[<p>About 2 months ago I sat in on a PHP performance session at work taught by non other than Rasmus Lerdof.  Aside from creating PHP he had some really neat stuff to talk about concerning performance.  Most of the presentation came from the php.net site, <a href="http://talks.php.net">talks.php.net</a>. Take a look at the talks when you have some time. </p>
<p><strong>The question</strong><br />
Anywho&#8230;that&#8217;s when my benchmarking and optimizing curiosity kicked in.  It wasn&#8217;t until yet another talk at work concerning the benefits of an MVC framework (Symfony) that I started to think about Zend Framework and its performance out of the box (without caching).   So I sat down today and started to benchmark the framework with a simple question in mind, &#8220;How does a simple ZF application compare to an application not using it?&#8221; </p>
<p><strong>The applications</strong><br />
To answer the question I created 3 web projects. The first web project was a static-HTML only application which displayed &#8220;hello world&#8221; on the screen, very simple.  (For those who just want to see the ab results <a href="http://www.armando.ws/projects/zf_benchmark_reading.txt">click here</a>  as well as the <a href="http://www.armando.ws/projects/zf_benchmark_cachegrind.out">Xdebug cachegrind output file</a>.)</p>
<p>The second web project was a single PHP file with the below PHP code.</p>
<p><em>Listing 1.1 &#8211; Simple Hello world PHP</em><br />
<code>&lt;?php echo "hello world"; ?&gt;</code></p>
<p>The above 2 projects acted as my baselines. it would allow me to determine the overhead ZF introduced into the application.</p>
<p>Finally, the third web project was created using ZF&#8217;s Zend Tool and executing the below command.</p>
<p><em>Listing 1.2 &#8211; Zf Project Creation.</em><br />
<code>> zf create project helloworld_zf</code></p>
<p>Finally, I replaced the default index.phtml HTML with the simple PHP code shown in Listing 1.1.  </p>
<p>Yes some may say that these examples are far too simple, but I wanted to test the Framework&#8217;s process to load and what better way to do this than with a very simple example.  I also based it off the talk that was given comparing Symfony.</p>
<p><strong>The Hardware &#038; ab command</strong><br />
Here is the set-up.<br />
1.  Windows machine running Apache 2.2<br />
2.  PHP 5.2.9<br />
3.  Zend Framework 1.8.4<br />
4.  Pentium 4 3.20 GHz<br />
5.  1Gbs of RAM</p>
<p>I used the Apache Benchmark, &#8216;ab&#8217;, tool which comes included with all Apache installation and ran the below command 3 times.</p>
<p>Listing 1.3<br />
<code>&gt; ab -n 1000 -c 5 http://localhost/index.[html|php]</code></p>
<p>The results, for me, were very surprising. I have included all the ab outputs.</p>
<p><strong>Observations</strong><br />
<strong>HTML ONLY &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.344 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  426.67 [#/sec] (mean)<br />
Time per request:       11.719 [ms] (mean)<br />
Time per request:       2.344 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            146.67 [Kbytes/sec] received</p>
<p><strong>HTML ONLY &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.375 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  421.05 [#/sec] (mean)<br />
Time per request:       11.875 [ms] (mean)<br />
Time per request:       2.375 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            144.74 [Kbytes/sec] received</p>
<p><strong>HTML ONLY &#8211; Reading 3</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.344 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       352000 bytes<br />
HTML transferred:       83000 bytes<br />
Requests per second:  426.67 [#/sec] (mean)<br />
Time per request:       11.719 [ms] (mean)<br />
Time per request:       2.344 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            146.67 [Kbytes/sec] received</p>
<p>Observations:<br />
1.  Roughly 0.0117 seconds per request.<br />
2.  Up to 424.79 requests satisfied per second.</p>
<p><strong>Basic PHP &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.609 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:  383.23 [#/sec] (mean)<br />
Time per request:       13.047 [ms] (mean)<br />
Time per request:       2.609 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            99.93 [Kbytes/sec] received</p>
<p><strong>Basic PHP &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   2.609 seconds<br />
Complete requests:     1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:       267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:  383.23 [#/sec] (mean)<br />
Time per request:       13.047 [ms] (mean)<br />
Time per request:       2.609 [ms] (mean, across all concurrent requests)<br />
Transfer rate:            99.93 [Kbytes/sec] received</p>
<p><strong>Basic PHP &#8211; Reading 3</strong><br />
Concurrency Level:       5<br />
Time taken for tests:    2.625 seconds<br />
Complete requests:      1000<br />
Failed requests:          0<br />
Write errors:              0<br />
Total transferred:      267000 bytes<br />
HTML transferred:       81000 bytes<br />
Requests per second:    380.95 [#/sec] (mean)<br />
Time per request:       13.125 [ms] (mean)<br />
Time per request:       2.625 [ms] (mean, across all concurrent requests)<br />
Transfer rate:          99.33 [Kbytes/sec] received</p>
<p>Observations:<br />
1. There seems to be a 100 request (roughly) drop when supporting PHP.<br />
2. Requests per second satisfied =  382.47 (a drop of 42.32 requests or 9% drop)<br />
3. Time per request = 13.073 or 0.0130 seconds per request (Increase of 11%)</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 1</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   68.297 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.64 [#/sec] (mean)<br />
Time per request:       341.484 [ms] (mean)<br />
Time per request:       68.297 [ms] (mean, across a<br />
Transfer rate:          2.82 [Kbytes/sec] received</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 2</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   70.281 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.23 [#/sec] (mean)<br />
Time per request:       351.406 [ms] (mean)<br />
Time per request:       70.281 [ms] (mean, across all c<br />
Transfer rate:          2.74 [Kbytes/sec] received</p>
<p><strong>Out of the box ZF 1.8.4 &#8211; Reading 3</strong><br />
Concurrency Level:      5<br />
Time taken for tests:   69.656 seconds<br />
Complete requests:      1000<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      197000 bytes<br />
HTML transferred:       11000 bytes<br />
Requests per second:    14.36 [#/sec] (mean)<br />
Time per request:       348.281 [ms] (mean)<br />
Time per request:       69.656 [ms] (mean, across all c<br />
Transfer rate:          2.76 [Kbytes/sec] received</p>
<p>Observations:<br />
Framework not only has a slower response time but also satisfies less requests per second. <strong>Am I doing something wrong????</strong> This cant be correct.</p>
<p>1. Request per second = 15.24 a change of 367.23 requests per second or a drop of 96% between trivial PHP and a ZF power app.<br />
2. Time per request (time taken to satisfy 1 request) = 328.49 ms or 0.328 seconds a change of .315 seconds or an increase of 23%</p>
<p><strong>Conclusion</strong><br />
Even though my benchmarking techniques might be flawed, taking a base line reading with no HTML as well as a very simple PHP script web project allowed me to at least compare.  </p>
<p>Based on these figures (if correct) Zend Framework has a HUGE overheard.  But this should not discourage any would be ZF coder because there are caching techniques which were not used such as using APC and the benefits of a good network admin <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Also the benefits of using any framework far outweigh the drawbacks in my personal opinion.  Where else can you get code which has been tested by the best and packed to contain methods for many of our typical coding requests.</p>
<p>Armando Padilla.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/07/benchmarking-zend-framework-1-8-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to set up Zend_Tool on Windows.</title>
		<link>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/</link>
		<comments>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/#comments</comments>
		<pubDate>Tue, 19 May 2009 01:17:52 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Tool]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=404</guid>
		<description><![CDATA[A few people we&#8217;re having issues installing Zend_Tool on Windows, hell I was having trouble myself since all of the tutorials out there are either Macs or Red Hat based.  So dont feel bad if your reading this .  I thought i would take some time and create a tutorial, from the ground up and [...]]]></description>
			<content:encoded><![CDATA[<p>A few people we&#8217;re having issues installing Zend_Tool on Windows, hell I was having trouble myself since all of the tutorials out there are either Macs or Red Hat based.  So dont feel bad if your reading this <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .  I thought i would take some time and create a tutorial, from the ground up and learn a few things myself along the way.  So here we go!</p>
<p><strong>Step one Installing PHP (if you havent yet)</strong><br />
If you have PHP already installed skip this section and head over to &#8220;An overview of the installation&#8221;.  Eeryone else, head over to the PHP site,  <a href="http://www.php.net">php.net</a> and download the latest and greatest. As of this writing the latest Windows installer is php-5.2.9-2 msi.  Download the executable.  Yea so what I use executable and you should too its easier to install and configure on Windows.<br />
Once the file downloads, double click the installer, click &#8220;next&#8221; a few times, and stop when you reach the &#8220;Choose Items to Install&#8221;.</p>
<p><strong><img class="alignleft size-medium wp-image-411" style="margin: 5px;" title="choose_items" src="http://www.armando.ws/wp-content/uploads/2009/05/choose_items-300x235.jpg" alt="choose_items" width="300" height="235" /></strong><strong>Choose Items to Install</strong><br />
Once you reach this point your going to check off which extensions you want installed.  By default the installer has a few modules turned off but you can easily turn them on by checking off the items to install.  Make sure that the &#8220;CLI Executable&#8221; has no red x marks next to it as shown in the neat picture to the left.   If it does click on the &#8220;X&#8221; and select,  &#8220;Will be installed on local hard drive&#8221;.  By doing this your going to installed the php.exe file as well as allow the executable to automatically update and create System Variables. Click &#8220;Next&#8221;, then &#8220;Install&#8221; and watch it go.</p>
<p><img class="alignright size-full wp-image-410" style="margin: 5px;" title="system_var" src="http://www.armando.ws/wp-content/uploads/2009/05/system_var.jpg" alt="system_var" width="268" height="302" /></p>
<p><strong>An overview of the Installation and Required System Variables</strong><br />
When the installation is done you should have a new directory, C:\Program Files\PHP (if you didnt change the default location).  This contains the php.exe file along with a number of other things.   You should also have some updates to your environment variables.  Open the Environment Variables window by right clicking on &#8220;My Computer&#8221; , &#8220;Properties&#8221;,  &#8220;Advanced&#8221;, &#8220;Environment Variables&#8221; .  At the bottom of the window you should have 2 System Variables, &#8220;Path&#8221; and &#8220;PHPRC&#8221;.  Make sure &#8220;Path&#8221; contains the &#8220;C:\Program Files\PHP\;&#8221;  (Replace with the location of your PHP directory) and make sure PHPRC contains, &#8220;C:\Program Files\PHP\&#8221; (Location to your php.ini file) .    If all the variables are set click &#8220;Ok&#8221; and head onto the next section.</p>
<p><strong>Verifying Installation.</strong><br />
Now to check that the installation went smoothly.  Open a command line window.  You do this by going to &#8220;Start&#8221;, &#8220;Run&#8221;, and then typing in &#8220;cmd&#8221;, then click &#8220;Ok&#8221;.  Once the command line window appears type in:  php &#8211;version</p>
<p>You should see:</p>
<p><img class="alignnone size-full wp-image-414" title="php_version" src="http://www.armando.ws/wp-content/uploads/2009/05/php_version.jpg" alt="php_version" width="640" height="103" /></p>
<p><strong></strong></p>
<p>If you do great!  Your done with PHP. Let&#8217;s install Zend Framework now.</p>
<p><strong>Installing Zend_Tool</strong><br />
If all went well,  now its time to install Zend_Tool. Download the latest Zend Framework (latest is 1.8.1)  and extract the files somewhere onto your system.   Move the files</p>
<ul>
<li>bin/zf.php</li>
<li>bin/zf.bat</li>
</ul>
<p>into the directory C:\Program Files\PHP and place all the content of the library folder into the C:\zf directory.  Many tutorials recommend installing the library in your PHP includes directory but I decided to install it under C:\zf to demonstrate how to use ZEND_TOOL_INCLUDE_PATH environment variable since the library can practically live anywhere when your developing sites.    The full path to your Zend Framework instillation is now, C:\zf\library\Zend.</p>
<p><strong>Setting up ZEND_TOOL_INCLUDE_PATH</strong><br />
Open the Environment Variable window again and create a new environment variables under the &#8220;System Variables&#8221;  section.   In the &#8220;Variable Name&#8221;  text field enter, &#8220;ZEND_TOOL_INCLUDE_PATH&#8221;  and in the &#8220;Variable Value&#8221; text field enter &#8220;C:\Program Files\PHP\includes\library\&#8221;  (path to the Zend Library minus the Zend portion).   Click ok to close out the &#8220;New System Variable&#8221; window and then click &#8220;ok&#8221; once again to close the &#8220;Environment Variable&#8221; wndow.  Time to check if Zend_Tool works.</p>
<p><strong>Verify Installation</strong><br />
If you have any command line windows open, close them and then reopen one.   Type in <em>zf show version</em> you should see the below:</p>
<p><strong><img class="alignnone size-full wp-image-417" title="zf_command" src="http://www.armando.ws/wp-content/uploads/2009/05/zf_command.jpg" alt="zf_command" width="640" height="61" /><br />
</strong></p>
<p><strong>Useful commands.</strong><br />
Your set to create your projects , controller, actions now. Below I added a few commands I tend to use.</p>
<p><em>Create Project</em><br />
zf create project helloworld</p>
<p><em>Create a new controller</em> (below commands must be issued within project directory)<br />
zf create controller controller1<br />
zf create controller controller2</p>
<p><em>Create a few actions</em><br />
zf create action action1 controller1<br />
zf create action action2 controller2</p>
<p>Thats it!<br />
Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/05/how-to-set-up-zend_tool-on-windows/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Zend Framework 1.8 Released</title>
		<link>http://www.armando.ws/2009/05/zend-framework-18-released/</link>
		<comments>http://www.armando.ws/2009/05/zend-framework-18-released/#comments</comments>
		<pubDate>Mon, 04 May 2009 04:54:30 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Tool]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=382</guid>
		<description><![CDATA[Last week ZF 1.8 was released and this weekend I spent the better part of it looking through the documentation and over a few of the items released within this package. A few standouts include: Zend_Tool Zend_Tag The Cloud computing components For more information heres the complete list of features released.  I also had a [...]]]></description>
			<content:encoded><![CDATA[<p>Last week ZF 1.8 was released and this weekend I spent the better part of it looking through the documentation and over a few of the items released within this package.  A few standouts include:</p>
<ol>
<li>Zend_Tool</li>
<li>Zend_Tag</li>
<li>The Cloud computing components</li>
</ol>
<p>For more information <a href="http://devzone.zend.com/article/4524-Zend-Framework-1.8.0-Released" target="_blank">heres</a> the complete list of features released.   I also had a questions for the Zend folks regarding Zend Tool on the page.   <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Coming up I plan to take a stab at Zend_Tool_Framework_Provider and create a simple example on how use and implement.</p>
<p>Armando Padilla</p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/05/zend-framework-18-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to run Zend Framework with no .htaccess file.</title>
		<link>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/</link>
		<comments>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 06:01:32 +0000</pubDate>
		<dc:creator>Armando Padilla</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Set-Up]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.armando.ws/?p=337</guid>
		<description><![CDATA[Work has been overwhelming lately and frustrating but there was an interesting question asked by one of the developers at work.  Can the Zend Framework run without the .htaccess file?  The answer, Yes. Why do we need the .htaccess file First off why is the .htaccess file required in the first place by Zend Framework?  [...]]]></description>
			<content:encoded><![CDATA[<p>Work has been overwhelming lately and frustrating but there was an interesting question asked by one of the developers at work.  Can the Zend Framework run without the .htaccess file?  The answer, Yes.<br />
<strong><br />
Why do we need the .htaccess file</strong><br />
First off why is the .htaccess file required in the first place by Zend Framework?  Think of the .htaccess file as a funnel.<br />
In a funnel, you poor water/liquid/stuff into the end contaning the larger diameter. The &#8220;stuff&#8221; is then squeezed out of a small single point at the opposite end. In the web world the &#8220;stuff&#8221; is web traffic and the the single point is where all the traffic goes through, in this case its the .htaccess file. </p>
<p>The .htaccess file will send all incoming traffic to your Front Controller which handles routing and dispatching etc.</p>
<p><strong>Removing .htaccess from the process.</strong><br />
For this im going use Apache 2.2. Start off by opening up the httpd.conf file located in the the conf folder of your Apache installation. Somewhere near the bottom add the following lines.</p>
<p><code>#Application Specific Include file<br />
Include conf/extra/httpd-zf.conf</code></p>
<p>This will allow Apache to add addition configuration settings once Apache is restarted and its a great place to isolate application specific Apache settings.</p>
<p>Now, go ahead an create the include file, &#8220;httpd-zf.conf&#8221; inside the APACHE_HOME/conf/extra/ directory and place the ReWrite rules which were originally in your .htaccess file into<br />
it.  Hit save, remove the .htaccess file, and restart Apache.  You should see your Zend Framework application running.</p>
<p><strong>Why do this?</strong><br />
Speed.  Your application must always read the .htaccess file when someone visits the site.  Removing this extra layer and placing it into the Web Server itself will reduce the amount of time a page loads.</p>
<p>Hope that helps someone out there <img src='http://www.armando.ws/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.armando.ws/2009/03/how-to-run-zend-framework-with-no-htaccess-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

