 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Dzone.com: Diving into Behat
by Chris Cornutt April 09, 2013 @ 09:50:34
Giorgio Sironi has a new post to DZone.com today about some of his experiences with Behat, a behavior-driven development testing tool written in PHP. It uses the Gherkin language syntax to define its tests.
I had the occasion to try out and adopt Behat for a particular need in our projects at Onebip. Here is my recount of the experience from a PHPUnit contributor and invested person.
He starts off with a list of situations where he doesn't think that Behat is a good fit for testing including testing of a single object and acceptance tests where comparing the response from more than one test is needed. He suggests that it's more useful for verifying high level business rules than anything. He talks some about the shift they made to using Behat and some of the benefits they found in its use. He finishes up the post by looking at the technical side and includes a warning about letting the size of the FeatureContext file get too large.
voice your opinion now!
behat introduction context technical impact overview benefits
Nikita Popov's Blog: The true power of regular expressions
by Chris Cornutt June 15, 2012 @ 08:42:57
Nikita Popov has a new (language agnostic) post to his blog today about one of the most powerful things you can use in your development - something that a lot of developers don't understand the true power of - regular expressions.
As someone who frequents the PHP tag on StackOverflow I pretty often see questions about how to parse some particular aspect of HTML using regular expressions. A common reply to such a question is: "You cannot parse HTML with regular expressions, because HTML isn't regular. Use an XML parser instead." This statement - in the context of the question - is somewhere between very misleading and outright wrong. What I'll try to demonstrate in this article is how powerful modern regular expressions really are.
He starts with the basics, defining the "regular" part of "regular expression" (hint: it has to do with predictability) and the grammar of the expressions. He talks about the Chomsky hierarchy and how it relates to the "regular" as well as a more complex mapping of expression to language rules. He talks about matching context-free and context-sensitive languages and unrestricted grammars as well.
voice your opinion now!
power regular expression define theory context
Lorna Mitchell's Blog: Building A RESTful PHP Server Routing the Request
by Chris Cornutt January 23, 2012 @ 11:14:11
Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction"
methods for responding to GET and POST requests.
voice your opinion now!
restful server tutorial request routing controller get post action
Enrise.com: REST Style Context Switching - Part 2
by Chris Cornutt January 13, 2011 @ 12:48:57
Joshua Thijssen has written up a new post for the Enrise blog today about using REST-style context switching in Zend Framework applications with the help of a handy "RestContextSwitch" helper.
In the first part of this blog post we've talked about the theory behind REST services. In this post we put the theory into practice with the help of some code snippets you can implement in your own application.
He starts by helping you create a simple REST controller (well, cut-and-pasteable code, really) that can handle multiple output formats/contexts - XML, JSON and HTML. Next up is the helper (Service_Controller_Action_Helper_RestContextSwitch) that's not much different than the normal context switching helper. With that in place he moves on to the plugins - an accept-hander that sets the correct format based on the Accept HTTP header information and a media-format plugin to check "permissions" on the context to see if that type is allowed in that environment.
voice your opinion now!
rest zendframework context switching html xml json
Ole Markus' Blog: High load websites A lock on Memcachedget
by Chris Cornutt December 27, 2010 @ 12:34:14
Ole Markus has a new post to his blog looking at a technique for working with memcached and fetching data out of the store using a binary semaphore for better performance.
A typical document takes but a few hundred milliseconds to generate when a single request for the document enters the backend. The problem is that this is a highload website. In its current form, the backend serves hundreds of pages per second. This pretty much guarantees that the backend will concurrently receive cache miss on multiple languages and at the same time also receive cache miss on the pre-translated document.
Given that he wants the translated version to be the one that's always shared, a problem can come up when the cache request is "missed" and the document starts generating from multiple places. His fix for the situation is that only the first miss generates and all others see a lock on it and wait for it to be removed before successfully fetching the result. He provides code in a "LockedMemcached" class to help make it all more useful.
voice your opinion now!
lock memcache get set high load website varnish
php|architect: Never Use $_GET Again
by Chris Cornutt July 09, 2010 @ 09:15:48
In this new post to the php|architect blog Matt Butcher offers a security tip for all PHP developers out there - never use $_GET again.
You don't need to use $_GET or $_POST anymore. In fact, you probably shouldn't use $_GET and $_POST anymore. Since PHP 5.2, there is a new and better way to safely retrieve user-submitted data. [...] Rather than accessing the $_GET and $_POST superglobals directly, you can make use of PHP functions like filter_input() and filter_input_array().
He gives a code example of it in use and talks about the two things these functions do to help keep you safe - validate the data for correct match on criteria and sanitizing the value to ensure the return value is only what's requested. You can find more about these filter functions in the Filters section of the PHP manual.
voice your opinion now!
filter superglobal get security
Michelangelo van Dam's Blog: Zend Framework context switching for HTML content
by Chris Cornutt April 16, 2010 @ 08:43:35
Michelangelo van Dam has a new post to his blog today looking a a method for doing some context switching in his Zend Framework application to use jQuery in his app's static HTML output.
I had already build my apps using static HTML output generated by Zend Framework, so how could I add this richness to my apps without refactoring most of my code ? Simple, by using Zend_Controller_Action_Helper_ContextSwitch, ZendX_JQuery and some minor adjustments to my view scripts.
He includes some code (that's confirmed to work with ZF 1.10.3) using the contextSwitch method on a helper object that adds in the "json" type for the contexts that can be used for the responses. Then a new template is added for the type (like index.json.phtml for the json output). Make a change or two to your bootstrap file to add in the right jQuery helpers and your view is as simple as calling "$this->jQuery".
voice your opinion now!
zendframework context switch html tutorial
|
Community Events
Don't see your event here? Let us know!
|