 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Jani Hartikainen's Blog: Closures coming in PHP 5.3 and that's a Good Thing
by Chris Cornutt February 20, 2009 @ 14:05:56
Jani Hartikainen takes a look at closures in a new post to his blog - why their good and why they can help you more than you know.
PHP 5.3 will be introducing closures to PHP. Closures, also known as anonymous functions, will allow you to declare functions "inline" and store them in variables. While the syntax may seem a bit weird compared to how it is in languages like JavaScript, closures will be a useful addition to the language. However, like reflection, it's a feature that may not immediately show it's usefulness...
He explains what they are (a sort of anonymous function) and a simple example of them in use - a function that works with data from an array to display each of the rows with the given "formatter" function. Another brief example is a method of using them in PHP functions like array_map and usort as an argument for the callback parameter.
voice your opinion now!
closure php5 good anonymous function example row loop callback
Lorna Mitchell's Blog: Introduction to Zend_Db
by Chris Cornutt October 31, 2008 @ 12:57:07
Lorna Mitchell has an introduction to Zend_Db, the Zend Framework database abstraction layer posted to her blog today:
I recently worked on a project which was based on Zend Framework - I haven't worked with it before and I was temporarily confused by the existing implementation of some of the database-level stuff. After much reading and untangling of code, I'm now pretty clear how this should look, so here's my overview. I'm not going to go into setting up a whole application, but this is a quick primer on how data models go together.
She talks about table modeling, fetching rows/data from the model and working with rows/rowsets.
voice your opinion now!
introduction zenddb database zendframework fetch row rowset
Jani Hartikainen's Blog: Understanding Doctrine's NestedSet feature
by Chris Cornutt September 02, 2008 @ 10:29:56
On his CodeUtopia blog Jani Hartikainen gives an inside look at a feature of Doctrine, nested sets.
The Doctrine library comes with a feature called nested set, which makes saving trees in a database easy. However, it's quite easy to accidentally cause a lot of extra unneeded queries if not being careful. Here are some pointers to keep in mind while working with the nested set, and some example queries to make understanding it easier.
He gives an example, showing how to get rows from the database - parent and child - and some optimization tips to keep things light. There's also some pros and cons included for doing it either way (the standard fetching or using the more optimized versions).
voice your opinion now!
doctrine nestedset feature fetch database row parent child
DevShed: Using Timers to Benchmark PHP Applications
by Chris Cornutt April 30, 2008 @ 14:31:08
DevShed has posted the second article in their series looking at benchmarking your PHP scripts. This time they look at the use of "timers" to check on script execution length.
Since you already know how to create timer functions and classes, in this tutorial, I'll create some concrete examples that show where these timing mechanisms can be applied in order to evaluate the performance of certain PHP applications.
They create a few classes that connect to a database and pull out rows (handing it off to a Result class). They use these classes in two examples - one with compression (output buffering) and one without using their Timer class to evaluate the differences.
voice your opinion now!
timer benchmark application tutorial class mysql row output buffering
WebReference.com: How To Create Alternating Row Colors in PHP
by Chris Cornutt June 20, 2007 @ 11:12:00
WebReference.com has a simple new tutorial today showing how to create alternating table rows in the output for your application.
Almost every database driven Web site uses alternating row colors when displaying a list of records, a concept used all over the Internet. You've seen it used, you like it, and now you want to do it yourself. But you're not sure how to accomplish it. Well you've come to the right place. I'm going to discuss the basic idea behind achieving this and give some concrete examples demonstrating different ways to implement it.
Their script loops through the information (numbers in their case) and checks, using the modulus operator to check and see which of the CSS styles it should apply to the div. To give a range of possibility, they also show how to do it with a while loop instead of a for to do a little benchmarking of the methods.
voice your opinion now!
alternate row color table forloop whileloop css alternate row color table forloop whileloop css
MSBWare.com: Alternating Row Colors
by Chris Cornutt May 02, 2007 @ 16:13:00
Sometimes, a simple approach is the best. That's what Michael Berman went with in this light and easy tutorial. It focuses on the creation of an "alternating rows" script with PHP.
This concept is used all over the internet. Almost every database driven website uses alternating row colors when displaying a list of records. You've seen it used, you like it, and now you want to do it yourself. But, you're not sure how to accomplish it. Well you've come to the right place. I'm going to discuss the basic idea behind achieving this and give some concrete examples demonstrating different ways to implement it.
The example code show how to alternate between two colors - white and grey - for the background of a series of DIVs. He even includes a series of tests to show which method of switching them out would be faster (while loop, for loop, etc).
voice your opinion now!
alternate row color loop benchmark tutorial alternate row color loop benchmark tutorial
DevShed: Introduction to Using SQLite with PHP 5
by Chris Cornutt December 04, 2006 @ 13:59:32
DevShed has started a small series today that seeks to guide you through the world of SQLite as is interfaced through PHP5.
If you use PHP 5 to build web-based applications that access a database, you might want to consider SQLite. A "lighter" option than MySQL, this database may still suit your purposes if you don't need all of MySQL's bells and whistles. This three-part series covers many of SQLite's most useful features.
Their post today, part one talks about the basics of the protocol and how to get started with it in PHP5. Since it's enabled by default, the chances of it being on your installation are great. They only really look at grabbing data from the database in this part, saving pushing data back in for another time.
voice your opinion now!
sqlite php5 database fetch tutorial basics row sqlite php5 database fetch tutorial basics row
|
Community Events
Don't see your event here? Let us know!
|