Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Frank de Jonge:
Partitioning for concurrency in synchronous business processes.
Oct 02, 2017 @ 17:18:16

Frank de Jonge has a tutorial posted to his site showing you how to use partitioning for concurrency in optimizing the business logic processing in your PHP applications.

With new ways of dealing with problems, new problems emerge. When the solution space evolves, so do the problems we deal with. One could say we only exchange one type of problem with another.

[...] Such constraints might steer you towards a synchronous solution, but a deeper understanding of a given domain might allow for an alternative approach. The need for synchronous processing is not always as final as it may seem. Sequential handling may only be a requirement within a certain context. A context may be defined by anything related to a single user, group, or even a process.

He talks some about concurrent processing versus sequential processing and how, sometimes, pure versions of either aren't exactly the right fit. Instead he proposes a system where multiple streams could be used with synchronous handling keeping with the concurrency between the streams. He illustrates his point with a "silly chat application" with the requirement that users all get their emails in order. In his proposal he starts with a standard single thread/multiple workers scenario but points out that this may lead to messages being out of order depending on the processing time for the worker it ends up on. He refactors this into a system that uses the parallel processing instead, including the PHP code that's required to make it work.

tagged: partition concurrency parallel processing business tutorial split

Link: https://blog.frankdejonge.nl/parallelise-synchronous-business-processes/

Matthew Weier O'Phinney:
Splitting the ZF2 Components
May 21, 2015 @ 15:55:18

Matthew Weier O'Phinney has a recent post about recent work that's been done to split up the componenents in Zend Framework 2 into their own repositories and linked as dependencies.

Today we accomplished one of the major goals towards Zend Framework 3: splitting the various components into their own repositories. This proved to be a huge challenge, due to the amount of history in our repository (the git repository has history going back to 2009, around the time ZF 1.8 was released!), and the goals we had for what component repositories should look like. This is the story of how we made it happen.

Matthew talks about the methods that were used to split things apart, even more so than they already were. While the components could be installed separately before, the methods used to get there were "cringeworthy". He talks about the different methods they've tried and the version bump issue that came with them, even when no changes were present. He talks about the ultimate goal of the refactor and the techniques to get there - a combination of grafts, subtree, subdirectory-filter and tree-filter through git. He covers some of the "stumbling blocks" they hit along the way including empty merge commits. The end result was a one-line command that could be executed and split out the provided component (well, with a lot of help behind the scenes).

He ends the post talking about the speed of the extraction process (hint: parallel processing is a happy thing), the ultimate results of the entire framework being split and a few lessons they learned along the way.

tagged: zendframework2 components split goal zendframework3 repositories

Link: https://mwop.net/blog/2015-05-15-splitting-components-with-git.html

Sameer Borate's Blog:
Splitting large MySQL dump files
Oct 03, 2011 @ 13:44:43

In a new post to his blog Sameer Borate includes a handy bit of code you can use to split up a large MySQL dump file into smaller, easier to digest chunks.

One of the frustrating things with working with MySQL is of importing large sql dump files. Either you get a 'max execution time exceeded' error from PHP or a 'Max_allowed_packet_size' from MySQL. In a recent task I needed to import a table of around a million records on a remote host, which quickly became an exercise in frustration due to various limitations on the server. SSH was of no help as changing the configuration files was restricted to the root user. My last resort was to split the huge 'INSERT' statements into smaller size files.

His script needs a little extra time to run (he sets max execute to 600 seconds) and takes the SQL file in line by line, splitting them back out to over files based on a "count" value - "dump-split-*". Depending on the size of your files, using something like this might not be an option. You might need something more like the command line "split" feature to keep it outside of PHP's memory management all together.

tagged: mysql sql dump file split unix multiple tutorial

Link:

Symfony Blog:
Getting help on symfony1 or Symfony2
Jun 24, 2011 @ 14:02:02

On the Symfony blog Fabien Potencier has a new post talking about a change in the support structure for developers wanting to get help with either Symfony1 or Symfony2 - a split in the mailing list to help make things a bit easier to split out.

Now that Symfony2 is just around the corner, we need to better organize community support for both symfony1 and Symfony2. As more people start using Symfony2, the user mailing-list is becoming more and more difficult to follow. [...] After an opinionated discussion on the mailing-list, I've decided to create two new mailing-lists that are replacing the current users mailing-list: one for symfony1 and another one for Symfony2. The current mailing-list has been switched to the archive mode; all messages will remain browseable and searchable but new messages will be rejected.

If you're a current member of the "users" mailing list and want a similar experience, you'll need to subscribe to both. Otherwise, pick the one you like and watch your inbox fill up. This break up makes it easier for people to find messages specifically related to their version of choice without having to look for the "[Symfony2]" tag in the subject line.

tagged: symfony1 symfony2 framework mailing list split users

Link:

Artur Ejsmont's Blog:
HTTP response splitting and mail headers splitting attacks
Nov 15, 2010 @ 16:57:16

In a recent post to his blog Artur Ejsmont looks at an attack that could potentially leave a hole open in your PHP-based application for a cross-site scripting (XSS) attack - HTTP response splitting (mail headers too).

There are two similar security issues both taken care of by Suhosin patch and strict escaping/encoding rules. They both relate to injecting new lines into headers of network protocols. They are not very well known and i think its worth mentioning it. HTTP response splitting is a web based attack where hacker manages to trick the server into injecting new lines into response headers along with arbitrary code. If you use GET/POST parameters in the headers like cookie or location, then someone could provide new lines with XSS attack.

He gives some examples of how it might work via the header function so that superglobals might be abused (like adding information on the URL to inject into $_GET). To prevent the attack, you just have to ensure that no special characters make it into the headers or cookies. He also mentions that the Suhosin patch takes care of the issue automatically.

tagged: http response header split example attack

Link:

Project:
PHPScenario - A Free Split Testing Library for PHP
Nov 03, 2010 @ 18:13:12

If you've ever wanted to do any split testing in your PHP-based application (show one group one thing, a different group another - gather statistics), you might want to check out a newly released tool from James Sylvanus called PHPScenario.

I recently wrote up a bunch of split testing code for an application of mine (listy.us) and decided to round out the code, smooth the edges, and make it available under a BSD license. The result is phpScenario (http://www.phpscenario.org), a free object-oriented split testing library for PHP 5.2+. I basically designed the library to be something you could just drop into a project, particularly a Zend Framework project, in a matter of minutes and be good to go. There are posts in the forums that provide very detailed setup instructions. At its very simplest, the library provides one-line A/B testing, and is fairly extensible. I think it'd make a great addition to designer/developer toolboxes.

Right now it's in its early beta stages, but it has plenty of (generated) documentation to help you out. There's also a basic example of its use and results on the main site. You can download it directly if you'd like to try it out.

tagged: project phpscenario split test library

Link:

NETTUTS.com:
An Introduction to Split Testing in WordPress
Aug 18, 2010 @ 17:56:55

On NETTUTS.com today there's a new tutorial showing you how to create a split testing environment in your WordPress installation with the help of the Google Website Optimizer plugin.

Split testing is a way to experiment with a live site and find which headlines and text are the most effective. Amazon uses split testing to determine which versions of their site convert customers better. We’ll use WordPress and Google’s Website Optimizer to test two different headlines, and find which works best at capturing customer emails.

They walk you through their six step process to help you create the pages for testing, install the Google plugin and use the Web Optimizer tool to keep track of the results of your testing.

tagged: wordpress split testing google website optimizer

Link:

SitePoint PHP Blog:
How to Split WordPress Content Into Two or More Columns
Feb 05, 2010 @ 18:58:00

On the SitePoint PHP blog there's a recent post from Craig Buckler showing how to split up your WordPress content into two or more columns quickly and easily.

WordPress is a great CMS, but implementing some features within your theme can require a little lateral thinking. The content for your page or post is usually output by the theme code using a single function call. But what if you need to split the content into two or more blocks? That might be necessary if your theme requires multiple columns or sections on the page.

There's a built in call WordPress includes, "get_the_content", that returns the content rather than just echoing it out. With this handy function giving you just the content, you're free to split up the content however you want - on certain tags or as they suggest, using the "more..." tag and a few modifications to a few other scripts to split it out into DIV blocks.

tagged: wordpress content tutorial split column

Link:

Matthew Turland's Blog:
Splitting PHP Class Files
Jan 25, 2010 @ 19:23:56

Matthew Turland, in trying to solve a problem from work, needed a way to split out some code into two files to simplify and make it easier to use them individually.

The issue I ran into was due to all the generated PHP classes being housed in a single file. I had to process two WSDL files that had several identical user-defined types in common. As a result, I couldn’t simply include the two PHP files generated from them because PHP doesn’t allow you to define two classes with the same name.

He used the tokenizer extension to create a simple command-line script that did the splitting for him. This script could potentially be used for splitting out other kinds of files too - "unpacking" them from their combined state. You can download the latest version from Matthew's github account.

tagged: tutorial split class file wsdl

Link:

Francois Zaninotto's Blog:
Introducing Code Usability
May 05, 2009 @ 18:48:19

Francois Zaninotto has a recent post looking at something every developer should consider when creating their applications - especially the libraries that might be used by other developers: code usability.

Usability guidelines can sometimes be of use in awkward places. I try to apply them to source code. [...] Of course, coding guidelines are there to make the code easy to read by everyone. But code usability goes somehow beyond. Let's see some of the differences.

He compares good versus bad code in a few different areas:

  • Bad Code Comments
  • Split Up Code
  • Cleanliness
  • New Conventions
  • Listen To User Feedback

Each item is described, some including code examples to help make them more clear. Be sure to check out the comments for more good suggestions.

tagged: usability comments split clean convention user feedback

Link:


Trending Topics: