<?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>Bruno De Barros</title>
	<atom:link href="http://brunodebarros.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://brunodebarros.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 03 Aug 2010 18:39:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Progress on the data handler (no, there&#8217;s no name yet)</title>
		<link>http://brunodebarros.com/2010/08/03/progress-on-the-data-handler-no-theres-no-name-yet/</link>
		<comments>http://brunodebarros.com/2010/08/03/progress-on-the-data-handler-no-theres-no-name-yet/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 18:39:39 +0000</pubDate>
		<dc:creator>bruno</dc:creator>
				<category><![CDATA[Dev Series]]></category>

		<guid isPermaLink="false">http://brunodebarros.com/?p=16</guid>
		<description><![CDATA[On an earlier post, I discussed in depth my idea for a new, extremely powerful data handler for PHP. I&#8217;ve been developing it for a few months, and most of the features are already implemented, but something kept bothering me &#8230; <a href="http://brunodebarros.com/2010/08/03/progress-on-the-data-handler-no-theres-no-name-yet/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On an earlier post, I discussed in depth my idea for a new, extremely powerful data handler for PHP. I&#8217;ve been developing it for a few months, and most of the features are already implemented, but something kept bothering me &#8211; the complexity of the configuration files for database tables. At the moment, they are PHP arrays. One of my problems with this is the barrier of entry &#8211; this is an insanely powerful data handling library, and I believe that it would be possible to allow end-users (non-developers) to use it to create their own databases, manage the relationships between their data, and view/manage it easily. It might seem like a very far-fetched plan, but it is possible. Since the HTML for all the pages is generated on the fly, given a table configuration file, that means that if a tool is created to generate configuration files (and maybe even create database structures based on those same configuration files), it would allow anyone to take full control of whatever data they want.</p>
<p><strong>And then I had an epiphany.</strong></p>
<p>There is no need to create a tool to generate configuration files. I created four tables (as a proof of concept) on MySQL, one for the tables, one for the fields, one for relationships, and one for validation rules. By creating a table configurations file with a PHP array that connects all those tables properly, it becomes possible to create new configuration files using the data handling library itself &#8211; since the configuration data is on tables on a database, it is possible to manage it using the generated HTML pages, or actual code. When the user is done, it is possible to select a table and all its fields, and use the export() function to export that data into the php array format that is used by the data handling library.</p>
<p>Formidably, this all is merely an intelligent use of the library, and nothing new is necessary to make it work. The generated configuration files are PHP arrays, which means there is no extra overhead (as is the case with INI files, XML files, or even getting the configurations from the database), and they can be imported/exported on demand whenever necessary, so if anyone should ever port this library to another language, they change their &#8220;configfile&#8221; export implementation to match their language&#8217;s most efficient data structure.</p>
<p>But the idea of having to export configuration data into files, and having to have a database for managing configuration data still seemed too much for me. I even considered using a self-contained SQLite database, but that would still force users to export data into configuration files. I could make it so that it would use the SQLite database rather than relying on php files and arrays, but that would mean overhead that I wasn&#8217;t willing to accept. So, I came up with something else:</p>
<p>The database containing the four tables will be in the format of a PHP array itself, (which is possible thanks to how easy I&#8217;ve made it to create new database drivers), which removes the need for exporting completely. The php configuration files will instead be edited directly. By default, php arrays will be used, but any other data driver can be used, if you wish (which means you can use YAML, XML, or even a real database system, such as MySQL or SQLite). Included in the distribution of this library as well, there will be a php script that can be run on the browser to effortlessly start managing table configurations.</p>
<p>A few additional methods are included in this library to make it even easier to get started: discoverTableStructure(), discoverDatabaseStructure(), createTableStructure() and createDatabaseStructure().</p>
<p>The discover structure methods simply look up a table or a database&#8217;s structure and generate a configuration file from it, as well as adding it to the SQLite database for easy management.</p>
<p>The create structure methods take an existing configuration file and automatically create the table structure represented by them. This helps importing database structures onto a variety of database systems, very easily.</p>
<p><strong>updateDatabaseStructure()</strong></p>
<p>This is actually one really big problem for most developers: How to keep the database structure up to date at all times. There are a few projects for keeping a database under a version control system, the best of which is (in my opinion) dbdeploy. They use a table to keep track of what updates have been applied to any given database, and the so-called delta files to figure out what SQL to execute for a certain update, and how to roll it back.</p>
<p>I wanted to take this step a bit further. Imagine opening up your users table in the database admin, adding an extra field called BIRTHDATE, checking the box that says &#8220;Do you want to update the actual database structure?&#8221;, pressing enter, and knowing that that&#8217;s the last thing you&#8217;ll need to worry about? This involves a bit of set up on the repository&#8217;s side &#8211; you have to tell it to ignore the dbversion file, because that&#8217;s what contains the current database version, and you need to set it up to automatically run updateDatabaseStructure() upon deployment. These things can still be done manually, but my goal is to make it as effortless as possible, and if we can use the version control system to help us out, that&#8217;s even better.</p>
<p>And if you ever make any changes to the database structure that require you to run some SQL to keep it all working, you can add that in along with the update (but you&#8217;ll be required to write it in code so that the library can generate the SQL for all the different database systems and generate rollbacks as well).</p>
<p>Well, that&#8217;s one thing out of the way &#8211; the database structure. That&#8217;s extremely important for me, because it&#8217;s the foundation of the whole library. I know that most database libraries don&#8217;t rely so much on configuration files describing the database structure, field validation rules, relationships, and all of that,  but this isn&#8217;t merely a database library, and it is this reliance in these configurations that allows me to make it even easier for people to use the library, and even manage their databases. With this library, you will never have to worry about anything related to your data again. Sheer simplicity is on its way.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunodebarros.com/2010/08/03/progress-on-the-data-handler-no-theres-no-name-yet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brainstorm: Developing a robust GTD app</title>
		<link>http://brunodebarros.com/2010/08/02/brainstorm-developing-a-robust-gtd-app/</link>
		<comments>http://brunodebarros.com/2010/08/02/brainstorm-developing-a-robust-gtd-app/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 20:41:14 +0000</pubDate>
		<dc:creator>bruno</dc:creator>
				<category><![CDATA[Dev Series]]></category>

		<guid isPermaLink="false">http://brunodebarros.com/?p=11</guid>
		<description><![CDATA[I love GTD. Ever since I first heard about this approach to productivity and managing one&#8217;s life, I&#8217;ve been impressed not only by its simplicity, but also by how easy it appears to be to develop an application that can &#8230; <a href="http://brunodebarros.com/2010/08/02/brainstorm-developing-a-robust-gtd-app/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love GTD. Ever since I first heard about this approach to productivity and managing one&#8217;s life, I&#8217;ve been impressed not only by its simplicity, but also by how easy it appears to be to develop an application that can implement it. However, to my best knowledge, most so-called GTD apps out there are either to-do list applications, and those that try to fully implement GTD seem to make it a bit less intuitive than I&#8217;d want. For people familiar with GTD, some of these apps might be acceptable, but for a while now, I&#8217;ve been wanting to make something that will bring down the entry barrier for anyone looking to handle things in their life more efficiently.</p>
<p>So I set out to think about what such an application would look like, and how it would behave. For one, I will be creating a complete set-up helper, to guide newcomers and instruct them both on GTD and the application itself. I don&#8217;t want to make it too complex, though, so I will stick to the minimum necessary to give them a good understanding of GTD, and if they want to learn more, they can always buy David Allen&#8217;s book. This guide would show up on the first log in, and there would be two other routes that a user could take: &#8220;I know about GTD, just tell me what I need to know about this app&#8221; or &#8220;I know about GTD and I&#8217;m sure I can find my way around here, the app isn&#8217;t that complicated anyway. Go away and leave me alone, helper.&#8221; (I believe that their description is self-explanatory <img src='http://brunodebarros.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> )</p>
<p>One of the things I&#8217;d like to have is a virtual personal assistant. Since GTD consists of dumping all of your mind&#8217;s contents into a place that you can trust and that you will constantly visit, I thought that it would be nice if I was able to just log in from anywhere, and have the app tell me what I should do, how I&#8217;m doing in terms of productivity today, and all of that. But this virtual personal assistant wouldn&#8217;t have to be that simplistic. Ideally, I would like it to be able to manage everything I have to do, and guide me, in the most intuitive way possible. I&#8217;ll develop further on that later.</p>
<p>I think that for this particular application (and considering that there are so many productivity applications out there), integration with other applications is vital for its success. For example, GTD requires the use of a calendar. The application will have a pretty powerful calendar built-in to handle everything, but I think that most people would fall into one of three situations:</p>
<ol>
<li>They&#8217;re used to a certain calendar application and don&#8217;t want to change.</li>
<li>They would be okay with changing calendars, but it&#8217;s just too much effort to transfer everything over, plus they don&#8217;t know if all the features they have would still be available.</li>
<li>They are okay with changing, or they don&#8217;t really use a calendar application at the moment.</li>
</ol>
<p>So obviously, for this application, its calendar must work with other calendars, and make it as simple as possible to keep the calendars in sync with each other. I want to do everything to make this application the easiest to use and get used to possible.</p>
<p>One of the most important things to become more efficient, is to reduce the number of inboxes as much as possible, so that we have less places to check for new items. With the internet, it seems that our number of inboxes is increasing exponentially, with every new web service opening up a new one. Thankfully, however, most of these web services have APIs, and with that in mind, I want to make it possible not only to bring everything together into one main inbox (this application&#8217;s inbox), but also to deal with it in the application. Imagine this central inbox containing new e-mails, new @mentions to your Twitter account, new Basecamp tasks/projects assigned to you, or maybe even Facebook direct messages sent to you. I want to make it so that you can log in into this app, and everything you need to do or deal with will be sitting there, waiting for you. Because I am tired of having to check a bunch of different places. If I could read an @mention and reply back on this application, read an e-mail and reply back, or even read a reply to a blog comment I left somewhere, and reply, all within this application, that would make my life far, far easier. The less effort it takes to collect, process and deal with inbox items, the better it is, and the more efficient the application will make us all.</p>
<p>That&#8217;s it for now, I&#8217;ll follow up soon with some more ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunodebarros.com/2010/08/02/brainstorm-developing-a-robust-gtd-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brainstorm: Improving Data Handling in PHP</title>
		<link>http://brunodebarros.com/2010/07/25/brainstorm-improving-data-handling-in-php/</link>
		<comments>http://brunodebarros.com/2010/07/25/brainstorm-improving-data-handling-in-php/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 09:26:15 +0000</pubDate>
		<dc:creator>bruno</dc:creator>
				<category><![CDATA[Personal Projects]]></category>
		<category><![CDATA[data handling]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://brunodebarros.com/?p=5</guid>
		<description><![CDATA[For the past few months I&#8217;ve been working on a data handling library for PHP. This library will completely change the way we access and handle data in PHP. It is meant to combine all the tasks we often repeatedly &#8230; <a href="http://brunodebarros.com/2010/07/25/brainstorm-improving-data-handling-in-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For the past few months I&#8217;ve been working on a data handling library for PHP. This library will completely change the way we access and handle data in PHP. It is meant to combine all the tasks we often repeatedly perform that are related to our data. The idea behind it is to give developers the ability to instantiate an object that contains all the information pertaining a set of data, and tools to manipulate it accordingly.</p>
<p>The main features/ideas for this library so far:</p>
<ul>
<li><strong>Create, read, update and delete records </strong>- as is expected from modern database abstraction layers. It only works with MySQL at the moment, I am planning on using the Adapter design pattern to make it work perfectly with other databases.</li>
<li><strong>Validate data </strong>- At the moment, the validation system is a bunch of cases in a switch system, but I intend to make it much more powerful.</li>
<li><strong>Filter, sanitize and escape data</strong> &#8211; so that you can be sure your data is always valid, and won&#8217;t break your website. At the moment, not much work has been put into this part, I&#8217;ve been working on data relationships, but I am thinking of making it very strict, allowing nothing by default, so that developers are compelled to display their data properly.</li>
<li><strong>Analyze data </strong>- Be it simply counting all the rows in a set of data, finding out an average, or performing more advanced statistical analysis, I want it to be possible using this library.</li>
<li><strong>Import/Export data </strong>- I want to be able to convert data between different formats and import or export that data into different formats. For example, I&#8217;d like to <em>getLatest(10)-&gt;export(&#8216;RSS&#8217;) </em>and get an RSS file containing the 10 latest results in a data set (getLatest would know which field the creation date field is, and act accordingly). JSON, CSV and XLS are three more data formats that I&#8217;d like to support in the near future.</li>
<li><strong>Generate the HTML</strong> &#8211; Necessary for accessing and manipulating the data, as well as repopulating the forms when validation fails, inserting default values, etc.. This has to be extremely flexible: it must be possible to integrate this into an existing theme/layout as easily as possible, and also to make custom layouts, in case the developer wants to.</li>
<li><strong>Handle Data Relationships</strong> &#8211; This is extremely important to me. For example, if I had an instance of this library that had all the information about my users table, I would like to not only be able to handle the data on that table, but also get all the posts related to that user, or some additional user metadata that&#8217;s in another table (WordPress does that, for example). This is possible at the moment using custom fields (more below).</li>
<li><strong>Custom Fields</strong> &#8211; Sometimes, you don&#8217;t just want to stick with the fields in your database table, you want more. For example, you might want to display a list of your users, and the number of purchases they have completed on your website. Or you might wanna get an array of IDs of posts that your user has written. With custom fields, you can &#8211; you tell the library where the data is, and it will take care of everything for you.</li>
<li><strong>Field Identifiers</strong> &#8211; Field identifiers allow you to completely abstract your code from the underlying database structure. For example, let&#8217;s say you have two database tables, one with USERNAME and PASSWORD and the other with user_name and user_password. Or you had USERNAME and PASSWORD, but decided to change them to something else. By using field identifiers, it is possible for you to change the database fields, and the only thing you have to update is the configuration of your data set. The code remains the same.</li>
<li><strong>Method Query Language (MQL)</strong> &#8211; While developing this library, I felt that I needed a way to make my querying even easier. I had found myself writing functions getById, getByUser, and others, over the years, and I decided to implement this into the library. The results is an astonishingly simple way to both query and update the database: getFieldsByFields() and setFieldsByFields(). An example would be getUsernameById($Id), to get a user&#8217;s username, given their ID, or setAddressAndZipcodeById($Id, $Address, $Zipcode) to update the address and zipcode of the user with a given ID. It&#8217;s that simple. And thanks to Field Identifiers, if your database structure changes, you still won&#8217;t have to change the function names, so it won&#8217;t be a problem.</li>
<li><strong>REST-ful API</strong> &#8211; Just about every modern day website has to have an API to enable remote access to their data. The library includes an api/ folder, with everything necessary to make remote calls to data using method query language. By default, you can use: http://www.example.com/api/api-key/data-set/method-query/arguments. An example of this is http://api.example.com/api-key/articles/getLatest/3. This API can easily be customized to your needs, and by default it is impossible to access or use any field in the API, you have to enable API access for them manually. For example, you might want to allow API access to a list of your posts, their author&#8217;s, post creation date, and all of that, but not their metadata.</li>
</ul>
<p>Those are the main things I&#8217;m working on at the moment. I&#8217;ll be discussing them further here while I develop them, and I would like to hear your feedback. I will also release the code under the MIT license very soon, maybe even set up a git repository or something, in case any of you wants to help me out developing this mega project.</p>
<p>It&#8217;s easy to use this library. Basically, you create a configuration file that contains the fields in a database table, their validation rules, permissions (whether or not you can edit that field in the HTML forms, whether or not you can access the field using the API), and all of the things pertaining to the database table. Once that&#8217;s done, all you need to do is instantiate the library, pass it that configuration file, and you can start using it straightaway. Simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunodebarros.com/2010/07/25/brainstorm-improving-data-handling-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

