August 15th, 2009 by Eric
I have created a new page for featuring little snippets of code that I think others may find useful. Its name, quite uncreative, is “Useful Scripts”.
http://codemill.studio-connect.com/useful-scripts/
The first function posted is for getting the difference between two dates. This function takes two dates that are convertible to Unix timestamps using strtotime(), and will return an array of the number of years/months/days between the two dates. The number of days between a leap and non-leap year is not correct yet, that is on my to-do list.
PHP 5.3 introduces the new DateInterval class which will help parse dates and provide native dateDiff functionality to PHP. Until we are all on 5.3, hopefully this will help someone else.
Until next time.
July 10th, 2009 by Eric
I wanted to write a quick post about a library one of my co-workers stumbled upon this week. It is called php.js and is a compilation of php functions ported to javascript. That sounds pretty convenient!
Continue reading ‘PHP and Javascript Combine with PHP.JS’
May 29th, 2009 by Eric
Tonight I started working on a set of classes that will build forms for Propel objects. While Propel already has implementations of PatForms and HTML_QuickForm, they are both not up-to-date in svn. They both also require Creole for gathering metadata, and I am not at all interested in integrating another library into this project – especially one labeled “dead” on its own site.
Continue reading ‘Working on a Propel Form Builder…’
May 26th, 2009 by Eric
Recently when browsing past issues of php|architect magazine, I came across mention of a Firefox add-on called FirePHP. For those who have not heard of it, FirePHP is both a Firefox add-on and a PHP library used to send messages to the Firebug console.
Continue reading ‘Quick PHP Debugging with FirePHP’
April 28th, 2009 by Eric
I was recently presented with the challenge of aggregating database hits for content that is e-mailed and commented on. My gut reaction was to think of a PHP script, or perhaps set of scripts to filter & count the database rows. Script processing of data sets with proper ORM can yield very meaningful information to both the programmer and the end-user. However this can be memory-intensive, and creating an ORM layer for such a simple task *could* be considered overkill. This is when MySQL views can help you.
Continue reading ‘MySQL Views to the Rescue!’
March 30th, 2009 by Eric
About two years ago I read of an emerging ORM-solution called Propel. Having just finished my first full readthrough of PHP 5 Object, Patterns, and Practice by Matt Zandstra, I was eager to research object relational mappers that differed from the one used in that book. My experience was one of major disappointment. After spending hours of frustration installing the library, and more hours configuring and running my first propel build, I ran a measly script to add an author to a bookstore database. And it was slow…much slower than one file of PHP. I dropped Propel, deeming it too unstable and unpredictable to run in any redistributable software. Continue reading ‘Get Propelled!’
March 14th, 2009 by Eric
As I posted in a previous blog, the Gentle Beginnings site that I left over a half a year ago was 90% done, but was missing one core feature – the ability to post and read birthing stories. Recently I revisited this site to add the birthing story component, and learned a couple of hard lessons about Joomla! application development. Hopefully by posting this I can shed some light on the less documented portions of Joomla!, and perhaps save someone else precious time. Continue reading ‘Joomla! Applications: The Basics’