 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Johannes Schluter's Blog: DTraceing around
by Chris Cornutt October 13, 2008 @ 11:14:35
After singing the praises of DTrace for a while now, Johannes Schluter decided to show it off in a different way - introducing a collegue to it:
Yesterday, during a break at the Barcamp Munich, I gave Wolfram a short introduction on his Mac and decided to put some stuff here [in this post]. DTrace is a toolkit available on Solaris (Solaris 10 or OpenSolaris), recent MacOS versions and FreeBSD for mightier than tools like truss or strace but with way less impact. DTrace allows you to "hook" (called "probes") into the system and allows to do some analysis then.
He shows how to set up some of these "hooks" using D-script to wrap around a simple PHP script call. He alters the results to show things like the memory function its in, how much of the memory its using and a fun little script that "graphs" out the memory usage with "@" symbols.
voice your opinion now!
dtrace tutorial example emailloc memory allocate
DotNetButchering: Design Patterns you use without knowing them
by Chris Cornutt October 02, 2008 @ 10:28:00
From the DotNetButchering blog there's a recent post looking at design patterns, more specifically ones you might be using and you don't even know it.
Rise your hands if time ago (or even now) you stood literally in trance listening to your friends or colleagues talking about design patterns. [...] Anyway I felt better (and also my ego did) when I found those Design Patterns were no more than ways to solve common programming problems, and as I was programming since 2 or 3 years, I had already discovered some of them myself.
He points out two patterns - the strategy and factory patterns - and gives code examples (and UML diagrams) to show how they work.
voice your opinion now!
design pattern factory strategy uml example
Mark Brady's Blog: Closures in PHP 5.3
by Chris Cornutt October 01, 2008 @ 08:47:50
Mark Brady has a recent post he's worked up that looks at a feature in the upcoming PHP 5.3 version - closures.
According to object-oriented programming expert Martin Fowler, closures are defined as a block of code that can be passed to a function. [...] PHP's upcoming syntax for closures is shaping up to be comparable to the C# 2.0 implementation.
He includes two code examples to compare the two language's methods - one for C# and the other for PHP - that divides the input by a denominator and returns a true or false depending on the result. For more information on closures, see this proposal on the PHP.net wiki.
voice your opinion now!
closures php5 example c# compare code
CodeUtopia Blog: Generic collections in PHP
by Chris Cornutt September 19, 2008 @ 12:06:53
On the CodeUtopia blog Jani Hartikainen has posted some thoughts on generic collections in PHP and a class he's created to try to introduce them to the language.
Strictly typed languages usually use "generic" collection classes instead of arrays. They are kind of like PHP arrays which the programmer can tell which type of items to accept. This is of course only natural when you don't have dynamic typing, but it can also be useful for avoiding programming errors, so I thought I'd try making a basic generic collection class in PHP...
He shows how ti works with a simple code example - creating a new collection type (a string) and pushing the data into it. Calling the add() method on the string throws an exception because of the data type defined. You can grab the code from his svn repository.
voice your opinion now!
generic collection class download svn example string
NETTUTS.com: Create a PHP5 Framework - Part 2
by Chris Cornutt September 16, 2008 @ 10:39:53
NETTUTS.com has posted the second part of their tutorial on how to create a simple framework of your own in a PHP5 environment.
With the basic structure for our Framework in place, it is time to start adding functionality to it. In this tutorial we will create a template manager and database handler, bringing us a step closer to a powerful Framework fit for use for almost any project. If you haven't already, be sure to review Part 1 of this series first!
This time they look at a few different parts of the framework, namely the database handler, the template manager and loading data into the framework. The end it with an example of the simple framework in action - pulling a list of members from a database and displaying them to the page.
voice your opinion now!
mvc framework tutorial database template example
Devollo.com: Data Filtering Using PHP's Filter Functions - Part one
by Chris Cornutt September 15, 2008 @ 09:33:33
On Devollo.com the first part of a series looking at something every PHP developer (or any other for that matter) should include in their application - data filtering.
Filtering data. We all have to do it. Most, if not all of us, despise doing it. However, unbeknown to most are PHP's filter_* functions, that allow us to do all sorts of filtering and validation. Using PHP's filter_* functions, we can validate and sanitize data types, URLs, e-mail addresses, IP addresses, strip bad characters, and more, all with relative ease. This is part one of two, covering filter_var() and the different constants and flags that can be set.
This method, using the filter extension, takes a lot of the work out of making sure that user-submitted data is what it should be. They include examples of how to filter numeric types, URLs, email addresses and how to sanitize the data to be sure there's no cross-site scripting or SQL injections to be found. This is a great reference if you're looking to get started with the filter extension.
voice your opinion now!
data filter extension pear tutorial example
DevShed: Output Buffering
by Chris Cornutt September 03, 2008 @ 08:48:16
This new tutorial from DevShed introduces something that could make a pretty profound impact on your application if used correctly - output buffering.
Output control (or output buffering) allows you to write and execute your scripts normally but send data to the web browser at selected times. The main benefit of this system is that you can call the header(), setcookie() and session_start() functions at any place in your scripts without having to worry about the "headers already sent" error message.
They start with the basics - the functions and what they do - then move on to an example, a login form, that uses the buffering to capture errors and html to be flushed and echoed at the end.
voice your opinion now!
output buffer tutorial login form example
PHPImpact Blog: No need for set/get methods in Python
by Chris Cornutt August 18, 2008 @ 12:06:37
Federico compares two languages in this new post to the PHP::Impact blog today - PHP and Python - in their need for "getters" and "setters".
Python code doesn't typically use the get and set methods so common in PHP. Normally, when writing PHP code, you carefully protect your instance variables by making them private, so callers can only interact with them via getter and setter methods. [...] Python's solution to this problem is more readable, it has a construct called a "property".
He compares two blocks of code that do the same thing - set properties on the object with the PHP side doing a bit more error checking (seemingly) than the Python side. They both apply a title property to a book object.
voice your opinion now!
python compare getter setter example
|
Community Events
Don't see your event here? Let us know!
|