Archive for the ‘php’ Category
Tags: CakePHP, Li3, Lithium, MongoDB, MVC, PHP framework, RDBMS
Posted in Li3, development, php | No Comments »
-
Monday, February 1st, 2010
Rain is a big fan of the 360 Flex conferences. We send developers every time, and have noticed the conference quality increase with each year. We are pleased to announce that we are sending 5, count them 5 speakers.
If you are considering going, I highly recommend taking part. If no other reason than to see our beautiful faces. Here is the link to register.
Here are the individuals we are sending, as well as the sessions they are teaching:


Speaker: Aaron Hardy
Title: Queue N Cache
Description: Take control of service calls by creating your own queue and dynamically shifting priority based off user interaction. Load what users are looking at first and and delay the rest for later. Show progress indicators in multiple locations for a single request. Once loaded, cache images in such a way that they can be displayed immediately anywhere in the app.


Speaker: Bryce Barrand
Title: Golden nuggets: How to find and keep top developers
Description: Part I. Even in a down economy, finding top developers is quite a task. For the most part, good people have solid jobs they love. Should you cross train? Pay hefty fees for head hunters? Monster.com? In this session we will go over a couple of options, and what we’ve found to be successful for procuring those “golden nugget” employees.
Part II: Once you have them, what makes them stay? How much does company culture make a difference? How about work load? What type of environment is cost effective for you as the employer and awesome for everybody around? We’ll also cover tips on keeping developers happy, and around for years.


Speaker: Garth Braithwaite (teaching 2 sessions)
Title: Flex 101
Description: Get up to speed on Flex quickly. We’ll be taking a full day of training to cram as much Flex 4 goodness into your head. This training is designed for those who have never used Flex.
Title: Your Flex App Looks Like Poo
Description: There is absolutely no excuse for not skinning your Flex 4 applications. We will be exploring skinning Workflows, skin requirements, and creating custom preloaders. Ultimately overhauling the interface. Although user interface design principles will be discussed, this session will not teach you how to design.


Speaker: Chase Brammer
Title: Analytics Throwdown
Description: Clients will ask, and you will be forced to choose your analytics weapon. Learn about Adomniture’s and Google’s analytics tools and how you can use them to drive business. The session will be divided up into three sections. First, the high level details about the qualities and business benefits of each. Second, a simple walk through of how to use the tools. And last, how to implement and deploy those tools in your applications.


Speaker: Gary Rogers
Title: Automated Build and Deployment Processes
Description: This session would encompass the often misunderstood methods for automating flex build and deployment cycles. Several options and examples would be concisely presented including java ant, php phing and others, as well as how to wield the power of the command line flex sdk. I would present a brief tutorial on how to get started with these methods. Also, a sophisticated GUI based build server concept would be discussed. I would also weigh the pros and cons of nightly builds and scheduled deployments and how these impact various architecture phases of an application. Also arguments discouraging the use of SVN/CVS for deployments would be presented.
In case you missed it at the beginning of the post, here is the link to register.
-
Tuesday, December 15th, 2009
Those who’ve worked closely with Rain knows we’ve been a fan of using frameworks to bootstrap our development process. They have oodles of advantages over the re-invent-the-wheel approach, and our involvement with the PHP framework world has been intimate. I currently lead the documentation efforts for one of the most popular PHP frameworks available, CakePHP.
I’m also a founding member of the team for a new project called Lithium (aka Li3). The project is based on some experimental code in the CakePHP sandbox. Anyone familiar with CakePHP should feel at home in Lithium&emdash;the framework was based on CakePHP concepts and conventions, and many of the same developers who brought you CakePHP are now actively working on Li3.
I’d like to invite you to dive it and check things out by walking along with me through this quick tutorial, which covers the creation of a über-simple blogging application. After having walked through it, you should have a good idea of how Li3 is shaping up, and how to create your own simple applications with it. (more…)
Archive for the ‘php’ Category
Tags: CakePHP, Li3, Lithium, MongoDB, MVC, PHP framework, RDBMS
Posted in Li3, development, php | No Comments »
-
Friday, September 4th, 2009
Automagic is authoritatively defined by wiktionary as “Automatic, but with an apparent element of stage magic. Commonly used in computer and other technology fields, referring to complex technical processes hidden from the view of users or operators.”
While, Cake’s automagic features are what make the framework useful, they can often turn around and bite you. Though it is not necessary to understand the full implementation details of every automagic feature, it is important to be aware of some common issues.
You can link models together using associations. When using the find function, Cake automagically fetches associated data. This may cause the database to execute queries for data that is never used. The Containable Behavior is one of the best solutions to reduce the amount of data fetched.
The Containable Behavior is covered pretty well in the CakePHP book. Basically, it allows you to specify which associations you want to be included in a find query. It’s fairly new to CakePHP; before it was introduced in CakePHP 1.2, the recursive property and/or the undbindModel method were primarily used to pare down find results (if they were even pared down at all). The Containable behavior allows you to accomplish the same task in a much simpler and cleaner way.
An example of an association type is hasAndBelongsToMany (many to many). Again, the CakePHP book is a good source for learning how to save hasAndBelongsToMany data.
A key line in the docs is the following: “Cake will delete all rows on the join table before saving new ones.” It is important to be cautious when saving data with hasAndBelongToMany associations. The following example illustrates a reason for such a caution:
$options = array(
‘conditions’ => ‘Recipe.id’ => $recipeId
);
$data = $this->Recipe->find(‘first’, $options);
//Changes to $data
$this->Recipe->save($data);
If you had any hasAndBelongsToMany associated data, such as RecipeTags, these records would all be deleted. This was an unfortunate lesson I learned on a recent project.
In /app/config/core.php, you can set the debug level. There are four levels, 0-3. In the comments of this configuration file, it explains what to expect at the various levels. For levels greater than 0, model caches are refreshed.
If you are new to CakePHP, you may not understand what is meant by “model caches refreshed”. In app/tmp/cache/models you’ll find a file for every model containing a cached version of the database schema.
If you make a change to your database schema when the debug level is 0, these model caches won’t be refreshed; if you get errors or unexpected behavior after making a database change, a likely fix is rm -f app/tmp/cache/models/*.
If you ever decide to clear the cache by removing the tmp directory, remember to rebuild the directory structure and recursively set the permissions to be writable by the web server.
Be careful not to set debug to greater than 0 on a production system. Besides displaying errors and warnings, leaving your system in development mode will make requests take longer. CakePHP runs a describe query and rebuilds the cache file for each model in use.
Cake’s AuthComponent can add authentication to a site quickly and easily. However, if you don’t understand all the trickery that goes on, you can encounter some issues when your implementation varies from the example in the CakePHP book. I recently ran into some trouble when building a registration form. As is typical of registration forms, there is a password field. I wanted to include all my validation rules in the model.
When I submitted the registration form, I would consistently get a password matching error, even though the password and confirm password were the same. I discovered the AuthComponent hashes the password field when you post data via a form. Though there are numerous ways to get around this, here is my preferred approach (this snippet belongs in the User model):
var $validate = array(
'confirm_password' => array(
'minLength' => array(
'rule' => array('minLength', 6),
'message' => 'Passwords should be at least six characters long.',
),
'matching' => array(
'rule' => 'comparePasswords',
'message' => 'Passwords do not match.'
)
...
);
function comparePasswords()
{
if(
$this->data[$this->name]['password'] ==
Security::hash($this->data[$this->name]['confirm_password'], null, true)
)
{
return true;
}
return false;
}
Notice how validation is performed on the confirm_password field. This allows you to specify length and other requirements on an unhashed version of the password. I typically display errors in list form. If you wanted to display an error message next to the password field, you would need to adjust the code to also invalidate the password field.
Archive for the ‘php’ Category
Tags: Auth Component, CakePHP, Containable Behavior, hasAndBelongsToMany Association
Posted in Blogroll, php | 3 Comments »
-
Monday, September 24th, 2007
This morning while perusing my daily feeds I found a diagnostic stylesheet (CSS) I will probably use, a link to a very funny Chuck Norris video, and learned how to restyle a Window’s login screen. All of this took less than ten minutes. My morning routine of reviewing the latest and greatest in my world of front-end web development is one that I find absolutely essential. Without news feeds these skills and valuable insights would have been lost to me and I would be force to rely on my much-less-informed cubical buddies who also may, or may not, have learned these same lessons and/or have seen humorous Chuck Norris videos. The point is that what is current is only available to those in the current. The feed current. It was an anology. You know… like the blogosphere is a current. yeah..
What follows is a current list of our favorite field-related feeds, aggregated and consumed by the creative folks at mediaRAIN. The list includes sources of inspiration for designers, bags of tricks for CSS gurus, utility belts of power for our PHP developers, and fountains of wisdom for our Flash-related experts. Share, read, celebrate, create. (Perhaps we’ll follow up this post with one which lists all our favorite bedtime stories.)
Archive for the ‘php’ Category
Tags: 360 Flex, automated builds, flash, Flash analytics, flex, Flex caching, Flex conference, Flex skinning
Posted in Blogroll, design, development, flash, flex, php, project management | No Comments »