 | News Feed |
 | Jobs Feed |
Sections
|
Chris Tankersley's Blog: Getting Started with Reflection
by Chris Cornutt September 03, 2010 @ 14:12:13
Chris Tankersley has a new post to how blog looking at a powerful but sometimes seldom used feature of PHP - Reflection. His post introduces you to some of the basics you can use to have your code find out more about itself.
Reflection is a metaprogramming construct that allows a program to look into itself and do a multitude of different things - gain meaning, watch execution, call code, or even provide feedback. [...] With PHP 5, PHP gained a robust reflection class that allows a developer to gain access to just about every aspect of an object and interact with it. The key is figuring out what is available, and then exploiting it to gain additional benefits.
He gives examples from his project where it uses the ReflectionClass feature to pull in the values of a class including properties and methods in a class (a set of ReflectionMethods). Some code is provided to make the examples a bit more clear.
voice your opinion now!
reflection introduction tutorial reflectionclass reflectionmethod
Lorna Mitchell's Blog: Tips for Event Hosting On The Day
by Chris Cornutt September 03, 2010 @ 12:08:31
Lorna Mitchell has posted her second part of her "tips for [tech] event hosting" series (first part here) with some suggestions for the day of the event - those last minute things that might get forgotten.
As an organiser you should know exactly where you are going on the day and what you need. [...] As an organiser you see all the small behind-the-scenes crises, but if they are invisible to the average attendee, then you're doing really well.
She makes suggestions about the little things - ensuring name badges are ready, a posted schedule of the happenings at the event (not every event will have programs), check in on all of the tech like projectors, wifi and the like as well as keeping track of things like hashtags on twitter to see what people like and don't like more immediately.
voice your opinion now!
event hosting tips badges technology hashtag schedule
Kevin Schroeder's Blog: You want to do WHAT with PHP? Chapter 5
by Chris Cornutt September 03, 2010 @ 11:14:58
Kevin Schroeder has the latest excerpt from his book posted ("You Want to Do WHAT with PHP?") with a focus on the SPL - Standard PHP Library. He specifically takes a quick look at Iterators.
If you are doing any data processing whatsoever you are using arrays. And most likely you are doing database queries, iterating over the results and doing your algorithm-ing. But what if you have additional functionality that you need to have integrated with your data. You could go the traditional route and copy and paste half your application around or you could build, what we like to call structured applications. SPL allows you to do that.
In the excerpt he mentions the methods that come built in to Iterators like rewind, current and valid. There's also some sample code showing a custom iterator that works with some user data to output the information set in the constructor. You can find out more about this chapter and the rest in Kevin's book.
voice your opinion now!
book excerpt kevinschroeder iterator spl standard library
SitePoint.com: OAuth for PHP Twitter Apps, Part I
by Chris Cornutt September 03, 2010 @ 10:53:45
On the SitePoint blogs today there's a new tutorial posted, the first part of a series, from Raj Deut about making the move away from the basic authorization for connecting to the Twitter API and towards their new OAuth method for Twitter Apps.
As of August 31, Twitter's HTTP Basic Authenticated API service has been disabled entirely. Now, any interface with the API will be required to use a token-based authentication method known an OAuth. [...] At first glance, the task of implementing OAuth can appear daunting, and OAuth's token exchange system can be confusing if you're unfamiliar with it. Fortunately, there are some rather clever individuals who've done the groundwork for us.
They show you how to register your application with Twitter and use the TwitterOAuth library to make a sample connection to their servers. They also show how to generate the tokens for the URL and the ones for accessing the site as a user. With tokens in hand, the script can then connect to the system and make a sample tweet (complete code included).
voice your opinion now!
oauth basic authentication tutorial twitteroauth library
PHPFreaks.com: A simple Debian based dev environment
by Chris Cornutt September 03, 2010 @ 09:45:27
On the PHPFreaks.com site there's a new post that's a guide for creating a basic development environment on a Debian system (complete with VirtualHosts).
This is just a quick walkthrough describing how to setup a decent development environment allowing the easy setup of multiple sites. It already assumes you have a working Debian or Ubuntu OS installed and configured with PHP, MySql & Apache already running. You will also need to have a working sudo.
They add a group for the web server user (www), change some permissions on the web root directory and edit the base Apache2 "sites" file where the VirtualHosts live. They create a sample PHP file - a phpinfo page - in the directory and add a record to the local hosts file for the new domain. Commands for all of the above are included.
voice your opinion now!
debian linux apache development environment
NETTUTS.com: Creating a Web Poll with PHP
by Chris Cornutt September 03, 2010 @ 08:26:42
On NETTUTS.com today there's an intermediate tutorial showing you how to create a simple polling system for your site - complete with a database backend and a CSS styled results view.
Polls are nearly ubiquitous on the web today, and there are plenty of services that will provide a drop-in poll for you. But what if you want to write one yourself? This tutorial will take you through the steps to create a simple PHP-based poll, including database setup, vote processing, and displaying the poll.
They include all of the code and markup you'll need ready for cut & paste - the SQL for the database backend (they chose SQLite), the HTML for the question and answer sides and the CSS to style them both. No javascript is needed to make the example work. There's even some process flows to help you understand the paths the application can take.
voice your opinion now!
poll tutorial sqlite css database
Gonzalo Ayuso's Blog: Using Monkey Patching to store files in CouchDb using the standard filesystem
by Chris Cornutt September 02, 2010 @ 14:10:12
Gonzalo Ayuso takes his "CouchDb as a filesystem" approach one step further (see the previous post about it here) with this new post talking about monkey patching to store files into the CouchDb server using the normal PHP file handling functions.
Since PHP5.3 a new design pattern is available for us: Monkey Patching. With this pattern we can override PHP's core functions with a home-made functions in a different namespace (another example here). That's means if I have fopen function in the above example, PHP uses the filesystem function "fopen" but if we set a namespace in our example, PHP will search first the function within the current namespace.
By defining the new interface inside of a namespace (with functions to override the default PHP file handlers) you can have the rest of the code call the same functions (fopen, fread, etc) but they'll do different things. In this case it handles them as push and pull to the CouchDb instead of the normal filesystem. You can grab the source for this example here.
voice your opinion now!
monkeypatching namespace filesystem couchdb tutorial
Kevin Schroeder's Blog: You want to do WHAT with PHP? Chapter 4
by Chris Cornutt September 02, 2010 @ 13:49:23
Kevin Schroeder has another new post to his blog today with an excerpt from his "You Want to Do WHAT with PHP?" book. This new post is a section from the fourth chapter looking at stream handling.
Communication is key to building applications now and for the future. While it is not something that I think that everyone should do, I have not seem many applications that make good use of streams in PHP. Streams can be immensely useful in the right situations, but a lot of developers are not really aware of how streams can be used. [...] While I don't think you will end up basing your application around streams it is a really good idea to know how streams work.
The sample code (and description) talk about changing the properties of a stream on the fly. He shows how, with a fgets loop checking the input, he can catch a command from the already running script and change the compression setting on the currently open stream. The compression changes the stream's data from plain text to a binary format as handled by the streams functionality.
voice your opinion now!
book excerpt kevinschroeder streams
|
Community Events

Don't see your event here? Let us know!
|