<?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; Programming</title>
	<atom:link href="http://routecafe.com/topics/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>Java, play, more?!</title>
		<link>http://routecafe.com/posts/java-play-more.moccha</link>
		<comments>http://routecafe.com/posts/java-play-more.moccha#comments</comments>
		<pubDate>Tue, 04 May 2010 14:30:33 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=246</guid>
		<description><![CDATA[I&#8217;m still fiddling with Java and the RESTful web framework, Play!. I have to admit that when I saw what it could do and compared it to PHP it did make me feel discourage to continue with the current projects &#8230; <a href="http://routecafe.com/posts/java-play-more.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m still fiddling with Java and the RESTful web framework, Play!. I have to admit that when I saw what it could do and compared it to PHP it did make me feel discourage to continue with the current projects I have ongoing, it was ridiculously easy, it taught me a few things about Java and how flexible it could be, although sometimes I find myself repeating the same line. To be honest after spending around 4 hours with Play! and Java in netbeans I saw why others would lean towards Python, Ruby on Rails and &lt;insert some hyped language&gt;.</p>
<p>Yet, I wanted to try JSTL, but I went against it. Thing is, I will be doing the exact thing, except I&#8217;ll be consuming even more time. I also want to save myself from studying the Servlet and all the talk about containers (and beans). I know, it&#8217;s an unavoidable subject but such could be studied in another time.</p>
<p>I&#8217;m hoping to finish my little &#8220;guestbook application&#8221; and upload it here. If GoDaddy allows me, which it should since they have Java installed along with JDK, it just a matter of tweaking&#8230; I think&#8230; gotta read&#8230; god knows. </p>
<div class='wp_likes' id='wp_likes_post-246'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(246)' 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/java-play-more.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The necessary evil</title>
		<link>http://routecafe.com/posts/the-necessary-evil.moccha</link>
		<comments>http://routecafe.com/posts/the-necessary-evil.moccha#comments</comments>
		<pubDate>Sun, 02 May 2010 23:15:03 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=244</guid>
		<description><![CDATA[So much for learning, really, I&#8217;m the type of person that prefers reading than practicing because I find it &#8220;useless&#8221; if I understand how it&#8217;s done and how does it work. Yet, it seems I&#8217;ve been going around in circles &#8230; <a href="http://routecafe.com/posts/the-necessary-evil.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So much for learning, really, I&#8217;m the type of person that prefers reading than practicing because I find it &#8220;useless&#8221; if I understand how it&#8217;s done and how does it work. Yet, it seems I&#8217;ve been going around in circles on how to implement some things. Not that it really affects me in any way, but it does make me wonder.</p>
<p>A few days ago, I started refactoring some classes in OpenType Threads, to make it more flexible when it comes to <strong> extending </strong> the class. I&#8217;m still on the planning phase, well, almost to end the planning phase. All this just to make the library flexible-many people might find it boring on how objects will depend to each other. The truth is, it&#8217;s fun.</p>
<p>Now, what do I mean about &#8220;the necessary evil&#8221;? I started creating a gallery web app (or script, I prefer &#8220;web app&#8221;), using Doctrine ORM and a few ideas I planned on using in OpenType Threads. Thing is, without planning, the whole script is just a bunch of disorganized classes with incoherent function names and descriptions. It certainly doesn&#8217;t have a <strong>Dispatcher</strong> because well, in the end I&#8217;m here to see the &#8220;truth&#8221;, or what I interpret as &#8220;truth&#8221;, what do I mean? Easy, as I go implementing my ideas there is a possibility that the way I thought of the implementation was erroneous.</p>
<p>Another implementation was the &#8220;MVC&#8221; wannabe method I created, it runs solely on &#8220;actions&#8221; and &#8220;views&#8221;, and quite messy too. I like it though, it does the job well, even for all the mess I did in the views object. It even has helpers! Although those helpers aren&#8217;t so helpful&#8230; (long story of a mess I created)</p>
<p>Once I start seeing the workflow, I sit down and reflect on what I just did and how to improve it (it&#8217;s important to always have a notebook with you, or notepad, seriously. I usually do this a week later so I can flush all biased thoughts). I&#8217;m still ignorant and inexperienced in many things, perhaps because of my stubborn attitude. That aside, grabbing a paper I start thinking of what I need and how will I process it.</p>
<p>Sorry if I&#8217;m not making much of a sense, I&#8217;m writing this quite slow and I get interrupted here a lot (I&#8217;m in a library).</p>
<p>It seems like an overkill having such a kick-ass ORM like Doctrine in a gallery script, of course not! The reason I used Doctrine ORM was to get familiar with it. After all I&#8217;m going to use it in OpenType Threads, and so far this ORM is&#8230;. made of pure awesomeness. The issue I&#8217;m now having is with autoloading classes and prefixing Doctrine ORM classes to avoid possible conflict.</p>
<p>I&#8217;ll say this though, I&#8217;m going to make amends for all the mistakes I&#8217;ve done. I just saw myself locking up the door of new possibilities and throwing away the key. Well, it&#8217;s not too late to caught up and become a decent php programmer. Well, it&#8217;s not like I&#8217;m going to care what other programmers will say, did that mistake once. Point is, I don&#8217;t want to create something that is going to become a mess in the future, better learn now than later, and refactoring is a pain in the ass sometimes. Releasing code to offer solutions to others or because you feel like is not bad, despise possible bugs which is always expected, it&#8217;s just trial and error. </p>
<div class='wp_likes' id='wp_likes_post-244'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(244)' 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-necessary-evil.moccha/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reducing my work</title>
		<link>http://routecafe.com/posts/reducing-my-work.moccha</link>
		<comments>http://routecafe.com/posts/reducing-my-work.moccha#comments</comments>
		<pubDate>Sat, 30 Jan 2010 11:46:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=232</guid>
		<description><![CDATA[It hurts me but like any other person with responsibilities we need a source of income and just working on this project doesn&#8217;t guarantee me money once its released or pay my bills (yet). I gave it some thoughts, well, there wasn&#8217;t &#8230; <a href="http://routecafe.com/posts/reducing-my-work.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It hurts me but like any other person with responsibilities we need a source of income and just working on this project doesn&#8217;t guarantee me money once its released or pay my bills (yet). I gave it some thoughts, well, there wasn&#8217;t much to think of-just &#8220;well&#8230; just focus on a job&#8221;, etc etc.</p>
<p>It&#8217;s also quite frustrating, because I had other ideas of a few projects I wanted to take on. Yet most of them are <strong>extensions </strong>for OpenType Threads. Yet I won&#8217;t start talking about it after I finish the prototype of the forum software. One of the things I haven&#8217;t taken into account is the upgrade of extensions/forum software and most importantly the <strong>import</strong> of other bulletin board systems into OpenType Threads. I won&#8217;t bother with such thing yet, the design comes first.</p>
<p>Now to get a job or something =/ </p>
<div class='wp_likes' id='wp_likes_post-232'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(232)' 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/reducing-my-work.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>JavaScript Madness?</title>
		<link>http://routecafe.com/posts/javascript-madness.moccha</link>
		<comments>http://routecafe.com/posts/javascript-madness.moccha#comments</comments>
		<pubDate>Tue, 12 Jan 2010 15:24:11 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://routecafe.com/?p=201</guid>
		<description><![CDATA[I&#8217;ve been learning JavaScript for a few days now. Yesterday I got stuck and tried to find documentation, to my disappointment there isn&#8217;t a &#8220;centralized documentation&#8221; of the JavaScript language, it&#8217;s methods or useful examples. It&#8217;s more about experimenting and &#8230; <a href="http://routecafe.com/posts/javascript-madness.moccha">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been learning JavaScript for a few days now. Yesterday I got stuck and tried to find documentation, to my disappointment there isn&#8217;t a &#8220;centralized documentation&#8221; of the JavaScript language, it&#8217;s methods or useful examples. It&#8217;s more about experimenting and just listen what your guts tell you. Some have linked me to JavaScript&#8217;s model specifications giving me interfaces and what it should return (and so on) others linked me to MDC ( <s>Microsoft</s> Mozilla Development Center ), MDC has nailed it, very easy to understand examples, brief overview of the JavaScript technology and its Data Types, objects constructs and literals (literals has left me quite with a &#8220;wow&#8221;).</p>
<p>All nice, right? MDC seems like a nice resourceful spot (of course!), now this story will take a plot twist, and it starts when I test my JavaScript code in Internet Explorer, IE yelled errors with nonsense. I took a deep breath, lets do the math! Mozilla: Gecko, Google Chrome: WebKit, IE: well I think it was called &#8220;Trident&#8221;, and Opera? god knows, I forgot. So these people have different implementations on how to render the web, great! Now, they also have a different way on how to interpret JavaScript, just great! The Internet Explorer team needed to follow Microsoft&#8217;s standard, that is, just tweak a few things and claim it. (Like addEventListener converted to attachEvent, extra code is great :) god bless JavaScript libraries for this)</p>
<p>I cried myself to sleep yesterday. I just had one thought in my mind, &#8220;why it had to be like this, how about uniting or something&#8230; a centralized documentation, SOMETHING!&#8221;. I guess that won&#8217;t happen, like a fleeting dream :(</p>
<p>Don&#8217;t get me wrong, I like some of Microsoft technology (and their C# language). I also secretly like their Bing Search Engine, don&#8217;t tell anyone ;)</p>
<p>I&#8217;d like to thank <a href="http://stackoverflow.com/users/126562/justin-johnson">Justin Johnson</a> for his great help over <a href="http://stackoverflow.com/">StackOverflow</a>, enlightened me :) </p>
<div class='wp_likes' id='wp_likes_post-201'>
<div style='display:none' class='text'><b>0</b> people like this post.</div>
<div><a href=' javascript:wp_likes.like(201)' 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/javascript-madness.moccha/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
