<?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>Dev + Mocha &#187; PHP</title>
	<atom:link href="http://routecafe.com/topics/programming/php-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://routecafe.com</link>
	<description>It's all about David's Blog!</description>
	<lastBuildDate>Fri, 04 Jun 2010 02:59:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Update on the project</title>
		<link>http://routecafe.com/posts/update-on-the-project.moccha</link>
		<comments>http://routecafe.com/posts/update-on-the-project.moccha#comments</comments>
		<pubDate>Fri, 04 Jun 2010 02:59:19 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=260</guid>
		<description><![CDATA[How are things coming along in otThreads? you might ask? I assure you that this is not a vaporware first of all. I&#8217;ve been working hard on the design, not your usual WEB DESIGN but the design of the application. &#8230; <a href="http://routecafe.com/posts/update-on-the-project.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>How are things coming along in otThreads? you might ask? I assure you that this is not a vaporware first of all. I&#8217;ve been working hard on the design, not your usual WEB DESIGN but the design of the application. So far so good though! After I started unit-testing using PHPUnit, I gotta say I&#8217;ve expanded my vision to a whole new level.</p>
<p>Right now I&#8217;m working on two classes, otThreads_Profile and otThreads_Utils_File (wrapped around DirectoryIterator). otThreads_Profile is quite the future of the system itself I must say, it&#8217;s simple, there are TWO types of configurations, the framework (system) configuration and the board configuration.</p>
<p>To put it more appealing:</p>
<p>System Configuration:</p>
<ul>
<li>Makes it flexible for the developer to specify Extensions folder and Profiles folder</li>
<li>The goal is to allow the developer do some heavy-lifting in the future.</li>
<li>Work with The Hub (not going into details&#8230;)</li>
</ul>
<p>Board configuration</p>
<ul>
<li>Manages template paths, attachments path, board path, baseUrl</li>
<li>Manages to change secret salts</li>
<li>Locale</li>
<li>Roots ID</li>
<li>Authorization Key</li>
<li>Application Run Mode (Testing, production, development)</li>
<li>Provides a way to put a failsafe template path incase the path provide misses some files</li>
<li>And of course, database credentials</li>
</ul>
<p>There is still a lot of work to do, I should be getting myself started on MVC but right now there are more pressing matters, finishing these classes will help the framework to be smart. I&#8217;m changing the notion of how Routes should be managed, maybe&#8230; I don&#8217;t like reinventing the wheel, but the idea will help extension developers a LOT. Like&#8230; shared routes?</p>
<p>Anyway, final notes&#8230; I&#8217;ve been studying the concepts of ACL.. and I gotta say, it&#8217;s freaking annoying, do not misunderstand me though I&#8217;m not dissing ACL in any way, it&#8217;s just that I gotta cover a lot of ground. Creating the ACL classes are going to be a challenge for me.</p>
<p>And&#8230; dependency injection rocks. </p>
<div class='wp_likes' id='wp_likes_post-260'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(260)' class='like' title='like this post'>Like</a>&nbsp;<img class='loader' src='http://routecafe.com/wp-content/plugins/wp-likes/images/spinner.gif' alt=''/></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/update-on-the-project.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art of Threading and TDD</title>
		<link>http://routecafe.com/posts/the-art-of-threading-and-tdd.moccha</link>
		<comments>http://routecafe.com/posts/the-art-of-threading-and-tdd.moccha#comments</comments>
		<pubDate>Tue, 25 May 2010 23:05:07 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=250</guid>
		<description><![CDATA[I&#8217;m really &#8220;enjoying&#8221; my time without internet, having to use the library as a solution is as dreadful as having to deal with threads, specifically a Java Thread&#8211;since PHP does not provide a way to create multithreading apps. Well, this past week &#8230; <a href="http://routecafe.com/posts/the-art-of-threading-and-tdd.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really &#8220;enjoying&#8221; my time without internet, having to use the library as a solution is as dreadful as having to deal with threads, specifically a Java Thread&#8211;since PHP does not provide a way to create multithreading apps.</p>
<p>Well, this past week and present week it&#8217;s all been about Java. I started creating a Video Encoder using FFMPEG, true I haven&#8217;t done much since FFMPEG do everything for me, but I learned a few things, JProgressBar needs a damned monitoring class, if I run the &#8220;encode()&#8221; method without creating a thread my GUI will freeze to death due to FFMPEG encoding the video. Literally my application is a GUI for FFMPEG, and I know there are hundreds out there, no need to point it out. Its been nice though, I&#8217;ve learned tons, like being slapped for not designing my classes and having a mess of  in the &#8220;view&#8221; class.</p>
<p>The thing is, it was exciting to see it working :) I encoded a video with a duration of 10 minutes and took around 7 mins to finish, regardless of &#8220;how long did it take&#8221; I was more proud of the fact that all my hard work is paying off, except for the designing part(not gui related). I should have put more emphasis on how classes will relate, but being a Java newbie well, there is still a long road. I&#8217;m happy though, I&#8217;ve been reading that C# (C-Sharp) shouldn&#8217;t be hard to learn once I get the hang of Java. To be honest, it was about time to get my hands dirty with a real language.</p>
<p>All that time didn&#8217;t go to waste, but it sure didn&#8217;t look like I was 99% near otthreads project. When I came back to reality and sat today with otthreads current code it felt like &#8220;variables are not objects&#8230;&#8221;&#8230; my designing skill is still rough&#8230; although I&#8217;m reading a book of UML and designing my classes feels like I have a lot to learn. Not backing down anyway, I&#8217;ve been reading more about Test Driven Development, something I&#8217;ve been wanting to do.</p>
<p>I&#8217;ve been introducing myself to PHPUnit, heck, it&#8217;s easy to set up, although a bit tedious if your classes depends a lot on other classes, but that&#8217;s sort of the idea, be able to see and test with data fixtures, correct the errors and test again. Oh well, we&#8217;ll see how it goes.</p>
<p>One more thing, now in my little project written in Java I want to try out implementing the Queue interface and allow queuing up videos.</p>
<p>Peace out! </p>
<div class='wp_likes' id='wp_likes_post-250'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(250)' class='like' title='like this post'>Like</a>&nbsp;<img class='loader' src='http://routecafe.com/wp-content/plugins/wp-likes/images/spinner.gif' alt=''/></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/the-art-of-threading-and-tdd.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects, Java and otThreads</title>
		<link>http://routecafe.com/posts/objects-java-and-otthreads.moccha</link>
		<comments>http://routecafe.com/posts/objects-java-and-otthreads.moccha#comments</comments>
		<pubDate>Fri, 07 May 2010 15:00:01 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=248</guid>
		<description><![CDATA[Writing &#8220;OpenType Threads&#8221; has become a bit tiring, so I&#8217;ll be reducing it to otThreads from now on. I&#8217;ve become fascinated with Java, Android and the Play! Framework. I admit, playing with Android with my current knowledge it&#8217;s quite frustrating. Moreover, it &#8230; <a href="http://routecafe.com/posts/objects-java-and-otthreads.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Writing &#8220;OpenType Threads&#8221; has become a bit tiring, so I&#8217;ll be reducing it to otThreads from now on.</p>
<p>I&#8217;ve become fascinated with Java, Android and the Play! Framework. I admit, playing with Android with my current knowledge it&#8217;s quite frustrating. Moreover, it seems I&#8217;ve become obsessed with Java syntax, well, libraries. After seeing the power of Annotations in Java, I dared to check it out in PHP (Reflections) and did come up with a few helpful ideas that will help me and extensions developers (especially in this area).</p>
<p>Anyway, I created a guestbook which I&#8217;m hoping to deploy soon and make it available to the web. There were too many temptations while I created that guestbook, it was like a guestbook + video site + image uploads kind of guestbook, which doesn&#8217;t apply to the guestbook stereotype because it transcend what it should be&#8230; but begin new to Java I was tempted to try out so many things, some do-able (like video processing and image processing) and some quite hard to grasp (background processing, queue system, system tray icon, etc)</p>
<p>That&#8217;s it for my random posts :) </p>
<div class='wp_likes' id='wp_likes_post-248'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(248)' class='like' title='like this post'>Like</a>&nbsp;<img class='loader' src='http://routecafe.com/wp-content/plugins/wp-likes/images/spinner.gif' alt=''/></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/objects-java-and-otthreads.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing your database, sometimes its more than just a storage</title>
		<link>http://routecafe.com/posts/designing-your-database-sometimes-its-more-than-just-a-storage.moccha</link>
		<comments>http://routecafe.com/posts/designing-your-database-sometimes-its-more-than-just-a-storage.moccha#comments</comments>
		<pubDate>Fri, 22 Jan 2010 00:33:02 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=219</guid>
		<description><![CDATA[Sadly, I&#8217;m catching a cold. I seriously hate being sick, all my motivation goes to nada. Yet I wanted to post on this subject, while I&#8217;m not going to get all specific and detailed about it. I will mention basic &#8230; <a href="http://routecafe.com/posts/designing-your-database-sometimes-its-more-than-just-a-storage.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sadly, I&#8217;m catching a cold. I seriously hate being sick, all my motivation goes to nada. Yet I wanted to post on this subject, while I&#8217;m not going to get all specific and detailed about it. I will mention basic factors of designing your database. I have this book I bought on the many programming books I have, it was requested by my professor to use it in our database design class but we actually never got to use it.</p>
<p>Now it bothered me, I don&#8217;t like buying things without a purpose so I opened it to apply things I learnt in my project. I did learn a few things about database designers, they are divided in two tasks, one is to design the database and the other is to check engines and worry about all physical files and how they are going to be managed. And so on, since it had this overwhelming history of flat files. And it got me to thinking of PHP and some developers.</p>
<p>While I love so much PHP, it&#8217;s disheartening to see many people just to rush over the project start assigning all kind of unneeded data types. Let&#8217;s be realistic, many people use <strong>Int</strong> over <strong>Medium Int</strong> because they &#8220;foresee their application passing over a range of 9 millions&#8221;, to actually reach that amount it will take years unless you spend an insane amount of money in promotions to get all kind of traffic. You can&#8217;t be a microsoft or a google in a year.</p>
<p>It also makes me glad in a way, this mistakes generate jobs, didn&#8217;t  you know? Because the buyers who hired those kind of people and made the database design shaky, don&#8217;t know why their page is slow or why their query is so slow. By putting a higher range, it means more work for the database engine.</p>
<p>Don&#8217;t go adding all type of indexes, just the ones your APPLICATION use most of the type. Like for example we got our auto-incrementer primary key (id), it is UNIQUE so MySQL will check UNIQUE ones first than non-unique ones. Or if we got lets say (categoryID, attachmentID) we got non-unique IDs, but they are mostly searched in a query statement.</p>
<p>Secondly, while I won&#8217;t probably real-world examples. A bad design can lead the web application to become a nightmare to maintain or add new features because you will end up refactoring or worst, re-designing your database.</p>
<p>Read <a href="http://dev.mysql.com/doc/refman/5.1/en/data-size.html">this page</a>, it&#8217;s from <a href="http://mysql.com">MySQL</a>&#8216;s <a href="http://dev.mysql.com/doc/refman/5.1/en/index.html">documentation</a>. It&#8217;ll be a guide to you if you are designing the database using that database system.</p>
<p>I was thinking, after I release OpenType Threads, oh boy I should be prepared to receive a rain of complains. And shield myself from patterns fanboys. Oh, and I started to like Ruby and Javascript syntax, it&#8217;s quite&#8230; fun. And now, making extra code to support other browsers is NOT fun. </p>
<div class='wp_likes' id='wp_likes_post-219'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(219)' class='like' title='like this post'>Like</a>&nbsp;<img class='loader' src='http://routecafe.com/wp-content/plugins/wp-likes/images/spinner.gif' alt=''/></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/designing-your-database-sometimes-its-more-than-just-a-storage.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on security in web applications</title>
		<link>http://routecafe.com/posts/web-security-db.moccha</link>
		<comments>http://routecafe.com/posts/web-security-db.moccha#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:54:19 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=217</guid>
		<description><![CDATA[I&#8217;m pretty weary. All this week working on what/how/where/when implementations, starting with logic &#8220;what will this object hold?&#8221;. Working on the prototype of OpenType Threads has made realize how important it is to detail a plan, it&#8217;s good but also &#8230; <a href="http://routecafe.com/posts/web-security-db.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty weary. All this week working on what/how/where/when implementations, starting with logic &#8220;what will this object hold?&#8221;. Working on the prototype of OpenType Threads has made realize how important it is to detail a plan, it&#8217;s good but also a bit lonely hopefully when I launch the prototype I hope some developers join me along.</p>
<p>It is exciting in a way to get new concepts, and just yesterday I start to get a new one that I will immediately implement.</p>
<p>The plan is the following, probably nothing new to many seasoned programmers, but on current projects it is rarely seen, especially in PHP. We usually use a database storage, probably MySQL. MySQL provides the feature to allow multiple users to share one database, with different permissions. Quite a nice feature isn&#8217;t it? It&#8217;s hard to imagine how useful this is in programming, because well, installing PHP scripts just relies on the usual &#8220;SELECT, CREATE, INSERT, DELETE, DROP, UPDATE, ALTER&#8221;. We don&#8217;t usually THINK why MySQL users exists and many installers just tells you &#8220;Hey! Just write your database, database user, password, port if there is any and we&#8217;ll do the rest!&#8221; And that&#8217;s the worst mistake and you&#8217;ll see why:</p>
<p>I layered OpenType Threads administration concept in two, the master, the user. The master user has the following privileges :</p>
<p>Master user:</p>
<ul>
<li>INSERT</li>
<li>DELETE</li>
<li>UPDATE</li>
<li>SELECT</li>
<li>CREATE</li>
<li>ALTER</li>
<li>INDEX</li>
<li>DROP</li>
</ul>
<p>The user:</p>
<ul>
<li>SELECT</li>
<li>INSERT</li>
<li>DELETE</li>
<li>UPDATE</li>
</ul>
<p>Now, where do we usually use the &#8220;master user&#8221;? The answer lies in administration panel, imagine if you use wordpress, wordpress plug-ins usually need to CREATE/DROP/ALTER/INDEX a table, INSERT, DELETE, UPDATE, SELECT data. It&#8217;s perfect for the admin section.</p>
<p>Now why would I want to use two users, sharing the same database? The answer lies in SQL exploits. I won&#8217;t pretend this will take care of all injections, that depends mostly on your sanitation of inputs in your web application. It will certainly stop aggressive ones, like, for example:</p>
<p>- a malicious user attempts to DROP the database, everything will be lost in just one command.<br />
- One of your administrator&#8217;s &#8220;betrays&#8221; you and attempt tries to delete tables, again the DROP command will be unavailable.</p>
<p>Now as we see, using a the &#8220;normal user&#8221; will certainly be helpful. Yet it leaves kind of a gap, we can&#8217;t do much with the &#8220;DELETE&#8221; command, actually we can if you rethink your application. Lets say that in your <strong>articles table</strong> you have the usual (artID, artContent, artTitle) lets add one more column (artState(ENUM(&#8216;publish&#8217;,'delete&#8217;,'draft&#8217;))). We have enumerated three options, publish, delete and draft. The usual &#8220;publish&#8221; will just show the article to the users viewing your site.</p>
<p>Now, instead of using the DELETE command to delete the record, it will hide the record and add it to a &#8220;trash can&#8221; which will be ONLY be deleted when you access the administration panel so it carries the &#8220;master user&#8221;.</p>
<p>Issues like &#8220;what if I get my admin login stolen?&#8221;, &#8220;what if the malicious user steals the user, password of the master user?&#8221;.  Well, those issues depends on the security of your web application, it has nothing to do with the TRANSACTIONS made. And of course, sanitize all inputs.</p>
<p>I don&#8217;t believe it hurt to try this because so far it&#8217;s just another measure to take. Infact I&#8217;m not taking the measure with just using TWO MySQL users. I&#8217;m also throwing in <a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html">Foreign Keys Constraints</a>, to stop any user deleting data that is related in another table. The introduction of Foreign keys constraints, it&#8217;s useful, but also can turn into a double edged blade if you overuse it.</p>
<p>Well, there is still a lot to learn :) I&#8217;m still lurking in MySQL documentation to get more ideas (but I should stop, implementing all unneeded features will just put a hole in your goal). Yet I&#8217;ll just do this one to see how it goes, it&#8217;s a gamble after all. I need to see the impact it will cause and what benefits will be gained. </p>
<div><b>2</b> people like this post.</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/web-security-db.moccha/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bing API PHP Wrapper Re-factoring</title>
		<link>http://routecafe.com/posts/bing-api-php-re-factoring.moccha</link>
		<comments>http://routecafe.com/posts/bing-api-php-re-factoring.moccha#comments</comments>
		<pubDate>Thu, 14 Jan 2010 17:13:22 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=212</guid>
		<description><![CDATA[A few months ago I released Bing API PHP to the public out of boredom, it was a hobby, still is. Now re-visiting my code I discovered a few things that needed to be introduced. Starting with an Abstract class, &#8230; <a href="http://routecafe.com/posts/bing-api-php-re-factoring.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A few months ago I released Bing API PHP to the public out of boredom, it was a hobby, still is. Now re-visiting my code I discovered a few things that needed to be introduced. Starting with an Abstract class, mostly all of Bing&#8217;s XML responses are almost equal to each other. Except for some cases, yet, in the midst of working on a solution on how to &#8220;write less&#8221; and &#8220;be more efficient gathering data&#8221;. I totally forgot about abstract classes, not just totally forgot, the next version of the wrapper itself got stalled due to attempting to &#8220;write less&#8221;.</p>
<p>Why did I start re-factoring now? Good question! It had something to do with OpenType Threads, working on my prototype has taught me a lot of things about classes, design patterns and a better problem solving skill. So when I looked at my wrapper class, I said to myself &#8220;hmmm&#8230; maybe we should do this one more time&#8221;. Yet, while this is still a hobby, one of my goal of why to re-factor the code was to allow me a better manipulation with JavaScript. I know I can use XML in JavaScript but well, we&#8217;ll see how it goes :)</p>
<p>So it&#8217;s time to pay a visit to Bing&#8217;s API documentation and delete old code without thinking twice. </p>
<div><b>2</b> people like this post.</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/bing-api-php-re-factoring.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Counter-productive? A flood of PHP Frameworks!</title>
		<link>http://routecafe.com/posts/counter-productive-a-flood-of-php-frameworks.moccha</link>
		<comments>http://routecafe.com/posts/counter-productive-a-flood-of-php-frameworks.moccha#comments</comments>
		<pubDate>Thu, 26 Nov 2009 14:18:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=192</guid>
		<description><![CDATA[I&#8217;m always looking on how to develop faster and smart. So I started to hunt frameworks, and on the way I pushed aside Zend Framework because not only it takes time to set up the project, it also takes time &#8230; <a href="http://routecafe.com/posts/counter-productive-a-flood-of-php-frameworks.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always looking on how to develop faster and smart. So I started to hunt frameworks, and on the way I pushed aside Zend Framework because not only it takes time to set up the project, it also takes time to learn the APIs and their vision. It bugs me since ZF says its &#8220;configureless&#8221; but you need to follow really strict standards to put your project in motion, which takes time to do too since you got to plan what you want, how you want to do it, how it will interact ahead before starting with ZF. Unlike frameworks like CakePHP, CodeIgniter, just unzip, and start. </p>
<p>I&#8217;ll start on my topic now :) I usually read twitter, and write tweets too. I love twitter! And I stumbled with this link &#8220;<a href="http://superdit.com/2009/07/22/big-list-of-php-framework/">Big List of PHP Frameworks</a>&#8221; I started looking some of them, the list is really big, but for us, is it really productive to look for the RIGHT framework? I don&#8217;t think PHP Frameworks have reached a count of 100 yet. Sure, some of us have already sticked with one and won&#8217;t change (but that&#8217;s a bad habit :P you should try testing others on your free time)&#8211;which brings to question is it really worth checking them out one by one? </p>
<p>I&#8217;ll be honest, I don&#8217;t think I&#8217;ll be able to handle benchmarking each one and building a simple blog just to see how difficult it&#8217;ll be or checking how to configure it&#8230; or just stick with content management frameworks like Drupal and be done with it (which also have one annoying steep curve to learn it). In the end, I&#8217;ll stick with one that has a good documentation and a good community, lets say that the margin of being productive is down a few percents, but I still got my good documentation and a good community to ask. </p>
<p>Once again, check out the <a href="http://superdit.com/2009/07/22/big-list-of-php-framework/">big list of PHP frameworks</a>! </p>
<div class='wp_likes' id='wp_likes_post-192'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(192)' class='like' title='like this post'>Like</a>&nbsp;<img class='loader' src='http://routecafe.com/wp-content/plugins/wp-likes/images/spinner.gif' alt=''/></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/counter-productive-a-flood-of-php-frameworks.moccha/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OpenType Threads, new project</title>
		<link>http://routecafe.com/posts/opentype-threads-new-project.moccha</link>
		<comments>http://routecafe.com/posts/opentype-threads-new-project.moccha#comments</comments>
		<pubDate>Wed, 08 Jul 2009 00:48:37 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=152</guid>
		<description><![CDATA[Today I&#8217;ll be announcing the start of a new project called &#8220;OpenType Threads&#8221;. OpenType Threads is a Bulletin Board System (a.k.a Forum, Discussion Board, Message Board), now don&#8217;t shake your head yet! It&#8217;s not yet another message board that will &#8230; <a href="http://routecafe.com/posts/opentype-threads-new-project.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ll be announcing the start of a new project called &#8220;OpenType Threads&#8221;. OpenType Threads is a Bulletin Board System (a.k.a Forum, Discussion Board, Message Board), now don&#8217;t shake your head yet! It&#8217;s not yet another message board that will add tons of bloated things (A.K.A Smarty, Template Engines, really guys? We do not need template engines, they just eat up the ram of the poor server from so many regex, splitting </imho>). Of course that is up to you to decide :) </p>
<p>The purpose of my project is to provide rich flexibility to developers and users. </p>
<p>- <strong>MVC Design</strong> (Model-View-Controller): The application itself is a framework, yet I must warn you that it is not a framework. The choice of the MVC design is to eliminate the use of template engines. I believe PHP is not a tough language to learn, so please web designers, learn the basics. </p>
<p>So, is it really a framework or not? Hard to say buddy! It feels like one, but it&#8217;s not one. </p>
<p>- <strong>URL Routing</strong>: Oh so glorious clean urls (a.k.a pretty urls, friendly urls). This is what makes it feel a framework. OpenType Threads provides the option to create new routes: Regular Expression routes, Static, Route. So! When a developer creates an extension, they don&#8217;t need to bother with links at all. This is certainly a must-mention. OpenType Threads does not attempts to be a framework, but a solution. Sure, you can create portals with it, probably. <strong>It will be always a message board</strong>, no buts. </p>
<p>- <strong>Database</strong>: Wait? I&#8217;m going to be discussing about database? Naw! I&#8217;ll be using <a href="http://doctrine-project.org">Doctrine ORM </a>to be the main layer to manage the database. Why? </p>
<ol>
<li>You can use Oracle, Firebird, Microsoft SQL Server, etc. Through PDO</li>
<li>Prevention of SQL Injections</li>
<li>Creation of multiple connections (which is very useful if I want to import, lets say&#8230; phpBB, IceBB)</li>
</ol>
<p>- <strong>Re-usability</strong>: OpenType Threads tries it hardest to become independent of some objects. That means that if I use a e-mail validation filter, you can also use it painlessly for your extensions.<br />
- <strong>Extensions</strong>: This is the toughest part, there are design patterns that will probably help. Yet I don&#8217;t want to create a system that will overkill the server. There are many things that happens in a bulletin board, INTERNALLY. And really, I don&#8217;t want it to be a wordpress, because it may be pretty externally, but internally it&#8217;s one ugly thing to maintain. (really, how can they keep their sanity!) </p>
<p>- <strong>License</strong>: This product is under <strong>a proprietary license.</strong> See why later on :)  </p>
<p>Anyway that should give you an idea of this web application. I know there are frameworks out there I could have based my application on. It is not because I feel like &#8220;but man I hate learning other systems, I prefer writing my own!&#8221; or &#8220;php frameworks are so over-engineered&#8221;. I have been using PHP for years, on my way learning Java. See, this project is not a popularity contest. This is me wanting to learn more about design patterns, this is me becoming a better php developer, and this is me providing my knowledge to users. </p>
<p>What can I say? Don&#8217;t expect things to come to you. Go for it, life is a bitch, and while it sounds unprofessional, it&#8217;s a tough one! <strong>I&#8217;ve been hesitant for quite a long time in starting a project</strong>, always <strong>thinking the negative sides</strong> of creating one. Take joy in what you create, take joy in what you can vision. Don&#8217;t worry about &#8220;what if people don&#8217;t like it&#8221; , &#8220;what if my creation sucks&#8221;, &#8220;what if I won&#8217;t be able to support others&#8221;, &#8220;there are other alternatives&#8221;. Really, don&#8217;t worry, be happy. <strong>Part of the learning process is that sometimes you learn with others.  </strong></p>
<p>About the &#8220;there are other alternatives&#8221;. And you know what? sometimes they stick with the same features for years, same look, same logic. No <a href="http://en.wikipedia.org/wiki/Code_refactoring">re-factoring</a>, no features. A product that has an standard set of features DOES NOT limit you to be creative. I can think of a dozen ways how a message board should act, how can it look. Really, take joy in what you can create and envision. </p>
<p>Another personal thought: I started this project because <strong>I can&#8217;t stand the solutions out there</strong>. I will not name any of them because if I do I will sound more like a person with anger management problems.</p>
<p>A few more things about the project: <strong>What about Polls</strong>, <strong>private message system</strong>, etc etc? Hey guys, I&#8217;m only one person. I take action with present needs. I don&#8217;t want to go create something half done then jump onto the other. The world will not end! So, baby steps, we&#8217;ll get there :) </p>
<p>Oh yea, about the proprietary license, no no, the project will be licensed under the <strong>Lesser General Public License</strong> (LGPL)</p>
<p>I know some companies will love me for choosing the LGPL, don&#8217;t worry, the love is equal. And guys, OpenType Threads is PHP Powered!  </p>
<div><b>2</b> people like this post.</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/opentype-threads-new-project.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Bing API SOAP + PHP</title>
		<link>http://routecafe.com/posts/using-bing-api-soap-php.moccha</link>
		<comments>http://routecafe.com/posts/using-bing-api-soap-php.moccha#comments</comments>
		<pubDate>Sun, 21 Jun 2009 18:17:29 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=132</guid>
		<description><![CDATA[It has become quite an annoyance to make a simple support for Bing API SOAP. Honestly for PHP I would say you should stick with either JSON or XML. Of course my personal choice would be XML since I find &#8230; <a href="http://routecafe.com/posts/using-bing-api-soap-php.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-133" title="Bing API Library Preview of 1.2" src="http://routecafe.com/wp-content/uploads/2009/06/bingpost.png" alt="Bing API Library Preview of 1.2" width="283" height="205" />It has become quite an annoyance to make a simple support for Bing API SOAP. Honestly <strong>for PHP I would say you should stick with either JSON or XML</strong>. Of course my personal choice would be XML since I find it more flexible, then again, whatever floats your boat :)</p>
<p>That to say this is probably my first time using SOAP while I find no benefit using it on Bing&#8217;s SOAP Server it&#8217;s really educational in a way to get to know how it&#8217;s done. I don&#8217;t know if there is any benefit actually, if someone cares to fill me in drop your thoughts in a comment. Some side-thoughts is that the response from Bing&#8217;s SOAP Server is way more clear than the response given in XML, maybe.</p>
<p>In this post I&#8217;m going to be showing you how to make a request to Bing&#8217;s SOAP Server using SOAPClient object. </p>
<p>Let&#8217;s give this a try, create a php file and name it whatever you want.</p>
<pre class="brush: php">
try {
            $client = new SoapClient(&quot;http://api.bing.com/search.wsdl&quot;, array(
                &#039;features&#039;, SOAP_USE_XSI_ARRAY_TYPE,
                &#039;style&#039;    =&gt; SOAP_DOCUMENT,
                &#039;use&#039;      =&gt; SOAP_LITERAL,
                &#039;soap_version&#039;   =&gt; SOAP_1_2,
                &#039;trace&#039;=&gt;true,
                &#039;exceptions&#039;=&gt;true));
            if(!$client) {
                throw new SoapFault(&#039;You either have no SOAP support in your PHP or there is a problem contacting the server.&#039;);
            }
        } catch(SoapFault $ex) {
            echo $ex-&gt;getCode();
            echo $ex-&gt;getMessage();
            echo $ex-&gt;getLine();
            echo $ex-&gt;getTrace();
            echo &quot;Request made:\n&quot; . $client-&gt;__getLastRequestHeaders() . &quot;\n&quot;;
            echo &quot;Response:\n&quot; . $client-&gt;__getLastResponse() . &quot;\n&quot;;
            echo &quot;Response containing headers:\n&quot; . $client-&gt;__getLastResponseHeaders() . &quot;\n&quot;;
        }
</pre>
<p>Run it, while of course there will be no output, unless it runs into the Exception. Everything will be fine if it doesn&#8217;t do both.</p>
<p>Now we have a variable called <code>$client</code> that contains the object of SOAPClient. Let&#8217;s make a call to the server. Add this below in your php file.</p>
<pre class="brush: php">
try {
    $parameters = array(
            &#039;SearchRequest&#039; =&gt;
                    array(&#039;parameters&#039; =&gt;
                                array(&#039;Version&#039; =&gt; &#039;2.0&#039;,
                                      &#039;Market&#039; =&gt; &#039;en-us&#039;,
                                      &#039;Query&#039; =&gt; &#039;Bing API PHP Library&#039;,
                                      &#039;AppId&#039; =&gt; &#039;YOUR APPID KEY&#039;,
                                      &#039;Sources&#039; =&gt;
                                             array(
                                                &#039;SourceType&#039; =&gt; &#039;Web&#039;),
                                      &#039;Web&#039; =&gt; array(
                                                  &#039;Count&#039; =&gt; &#039;50&#039;,
                                                  &#039;Offset&#039; =&gt; &#039;10&#039;)
                                )
                     )
         );
 $s = $client-&gt;__soapCall(&#039;Search&#039;, $parameters  );
    if(!$s) {
    throw new SoapFault();

} } catch(SoapFault $ex) {

    echo $ex-&gt;getCode();
    echo $ex-&gt;getMessage();
    echo $ex-&gt;getLine();
    echo $ex-&gt;getTrace();

    echo &quot;Response:\n&quot; . $client-&gt;__getLastResponse() . &quot;\n&quot;;
    echo &quot;Tne response headers:\n&quot; . $client-&gt;__getLastResponseHeaders() . &quot;\n&quot;;
}

$xmlResponse = $client-&gt;__getLastResponse();
var_dump($xmlResponse);
</pre>
<p>Now you will know why I don&#8217;t like using the SOAP solution right now. It&#8217;s because even if it gives you a much clean response you will have to write quite a lot of arrays just to get the results you want. I say that&#8217;s one of the &#8220;default&#8221; ways to make the request to SOAP Server.</p>
<p>If everything is done correctly then you will see a dump of XML with the results. Else it will catch the exception. I think it&#8217;s worth mentioning that you will need to learn the structure of BING SOAP Server, it&#8217;s not hard but quite bothersome. Get the types using </p>
<pre class="brush: php">
var_dump($client-&gt;__getTypes());
</pre>
<p>You will see a wide choice of options. But you will start with <strong>struct SearchRequest</strong> and learn what&#8217;s in the brackets. Like Alessandro Catorcini (BING API Lead Program Manager) have said to me in a e-mail reply. It&#8217;s very straightforward and if you sit down and see what we have on the plate it&#8217;s really easy to figure out.</p>
<p>Another word, if you notice getTypes output and our parameters made, both of them are SIMILAR in every way. How so? getTypes HELPS YOU on how you should interact with the server and tells you how will be the structure of the request nad how it will be outputted. It&#8217;s essential that you get familiar with the Types.</p>
<p>Hope you found this useful, that, and to let you guys know that the implementation in Bing API Library is already on its way. </p>
<div><b>7</b> people like this post.</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/using-bing-api-soap-php.moccha/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Get more writing less</title>
		<link>http://routecafe.com/posts/get-more-writing-less.moccha</link>
		<comments>http://routecafe.com/posts/get-more-writing-less.moccha#comments</comments>
		<pubDate>Mon, 08 Jun 2009 20:14:25 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=101</guid>
		<description><![CDATA[Truthfully, there is a 99.9% that SimpleXML will be used to be the main support of the Bing API PHP. Of course, if you have seen some of the first examples to get a result you must enter various nodes &#8230; <a href="http://routecafe.com/posts/get-more-writing-less.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Truthfully, there is a 99.9% that SimpleXML will be used to be the main support of the Bing API PHP. Of course, if you have seen some of  the first examples to get a result you must enter various nodes and that&#8217;s quite troublesome. So my current goal is to reduce the code and get what you want writing less. </p>
<p>How! I&#8217;m introducing a new class called <code>ResultSet_Manager</code> which will take the decisions on which class to use (pretty much like factory pattern but not quite since it doesn&#8217;t follow some of the standards). The Manager can be turned on optionally to maintain an independance and if it&#8217;s on it will call the classes starting with <code>ResultSet_SourceType_(SourceType)</code>. Let&#8217;s take a look at how it would work:</p>
<pre class="brush: php">
    // // Notes: Spell query must be urlencode, REQUIRED
    $search-&gt;query(&#039;which+is+better+tweetdeck+or+seesmic&#039;)
           -&gt;setSources(&#039;Web&#039;)
           -&gt;setFormat(&#039;xml&#039;)
           -&gt;setResultManager(TRUE); # Required to be boolean

    // Contains the search
    $results = $search-&gt;getResults();
   echo $results-&gt;Total;
   echo $results-&gt;Get-&gt;WebResult[1]-&gt;Title;
   echo $results-&gt;QueriedTerm;
</pre>
<p>As you see, it is slightly shorter than the previous:</p>
<pre class="brush: php">
$ThumbURL = $ImageResultSet-&gt;Image-&gt;Results-&gt;ImageResult[$i]-&gt;Thumbnail[0]-&gt;Url;
$ThumbWidth = $ImageResultSet-&gt;Image-&gt;Results-&gt;ImageResult[$i]-&gt;Thumbnail[0]-&gt;Width;
$ThumbHeight = $ImageResultSet-&gt;Image-&gt;Results-&gt;ImageResult[$i]-&gt;Thumbnail[0]-&gt;Height;
$ThumbSite = $ImageResultSet-&gt;Image-&gt;Results-&gt;ImageResult[$i]-&gt;Url;
</pre>
<p>Now you notice quite a difference, although it&#8217;s not the same query we originally ran you should see that the code has been reduced. </p>
<p>While the goal to make everything more simple remains a priority. The ResultSet Manager and the SourceType classes (e.g ResultSet_SourceType_Web) are independant of Bing API PHP. Meaning that you can use it without calling Bing API PHP. </p>
<p>For example (example has not been tested in dev environment):</p>
<pre class="brush: php">
&lt;?php
$XML = file_get_contents(&#039;http://api.search.live.net/xml.aspx?AppId=APPID&amp;Query=Guitars&amp;Sources=Image&#039;);
require_once &#039;SourcesManager/ResultSet_SourceType_Image&#039;;
$ImageSet = new ResultSet_SourceType_Image($XML);
$ImageSet-&gt;Get-&gt;ImageResult[1]-&gt;Title;
?&gt;
</pre>
<p>All SourceTypes classes have and property called &#8220;Get&#8221; which holds the Result. In Multiple sources, while not yet developed. My other idea is to do something nearing to:</p>
<pre class="brush: php">
$MultipleSets-&gt;Get-&gt;ImageResult[1]-&gt;Title;
$MultipleSets-&gt;Get-&gt;WebResult[1]-&gt;Title;
$MultipleSets-&gt;Get-&gt;VideoResult[1]-&gt;Title;
</pre>
<p>Anyway! The next version will provide a experimental support of SOAP. That&#8217;s about it for today, see you next time.
 </p>
<div><b>2</b> people like this post.</div>
]]></content:encoded>
			<wfw:commentRss>http://routecafe.com/posts/get-more-writing-less.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
