Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Październik, 2010

PHPClasses.org Blog: Throttling Background Tasks: Unusual Site Speedup Techniques: Part 2

PHPClasses.org Blog: Throttling Background Tasks: Unusual Site Speedup Techniques: Part 2

On the PHPClasses.org blog Manuel Lemos has posted part two of his look at techniques to help speed up your site – a few things that you maybe hadn’t thought of before.

In the previous article I talked about one important factor that often seriously affects the user perception of the speed of a site, which is the presence of content from external sites that slows down the load of pages, such as advertising and widgets. In that article I presented a technique that I am using to make external content not affect the user perception of the site speed. In this article I am addressing another factor that may also affect the user perception of site speed, but this time is related to aspects of the server side environment.

In this article he looks at things like other server-side background processes, throttling their CPU usage, throttling PHP’s CPU usage and the use of a monitoring class to help you and your applications (and sysadmins) stay on top of what’s happening with the server.

Source: http://www.phpdeveloper.org/news/15334

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Zend Framework application’s PHPUnit suite 3x faster

Zend Framework application’s PHPUnit suite 3x fasterMy regular readers may have already noticed I don’t even dare writing code without TDD/BDD-ing it from left to right. In my Zend Framework-based project, we currently have 600+ PHPUnit test cases, most of them for models and controllers, but quite some also for view helpers, bootstrap and even some views.

The whole suite is taking around 90 seconds to run on my machine against a MySQL database (modelled with Zend_Db* in an active record/table data gateway manner).

In this post I’ll be showing how I managed to decrease the time from ~90 seconds to ~30 seconds using a PHPUnit listener and database transactions.

NOTE: This is a copy of the original article on using PHPUnit listeners to wrap each test case in a database transaction available under this link .


Source: http://feedproxy.google.com/~r/ZendDeveloperZone/~3/RNMQRxW9XNk/12621-Zend-Framework-applications-PHPUnit-suite-3x-faster

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Zend Framework application’s PHPUnit suite 3x faster

Zend Framework application’s PHPUnit suite 3x fasterMy regular readers may have already noticed I don’t even dare writing code without TDD/BDD-ing it from left to right. In my Zend Framework-based project, we currently have 600+ PHPUnit test cases, most of them for models and controllers, but quite some also for view helpers, bootstrap and even some views.

The whole suite is taking around 90 seconds to run on my machine against a MySQL database (modelled with Zend_Db* in an active record/table data gateway manner).

In this post I’ll be showing how I managed to decrease the time from ~90 seconds to ~30 seconds using a PHPUnit listener and database transactions.

NOTE: This is a copy of the original article on using PHPUnit listeners to wrap each test case in a database transaction available under this link .


Source: http://feedproxy.google.com/~r/ZendDeveloperZone/~3/RNMQRxW9XNk/12621-Zend-Framework-applications-PHPUnit-suite-3x-faster

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Zend Developer Zone: File uploads with Adobe Flex and Zend AMF

Zend Developer Zone: File uploads with Adobe Flex and Zend AMF

On the Zend Developer Zone there’s a post looking at uploading files in a Adobe Flex-based application that uses a slightly different than usual approach to uploading files through Zend_Amf.

Zend AMF is a PHP implementation of the AMF (Action Message Format) binary protocol within the Zend Framework. I had to implement a system to upload files that were a little different than what is typically used in Flash, so I built upon Zend AMF for my needs. Researching a little on the net, I found a solution that was simpler than I expected. Based on an article, I only had to make a few adjustments.

He shows a (brief) version of his setup – a gateway to be used as the endpoint for Flex to connect to, the VO properties and the class to handle the upload. On the Flex side, he includes the code to create the view and pass the upload off to the waiting PHP backend. If you want to see the full code, you can grab it here.

Source: http://www.phpdeveloper.org/news/15325

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

PurpleRockScissors.com: Avoiding Cache Stampedes with Pseudo-Locks

PurpleRockScissors.com: Avoiding Cache Stampedes with Pseudo-Locks

In this quick post to the Purple Rock Scissors blog, there’s a suggestion from Rob Zienert about how you can avoid a “cache stampede” on your site’s caching tool with the help of a pseudo-lock on the record.

A cache stampede occurs when a cached item expires and multiple clients attempt to repopulate the cache at the same time. Take for example a page cache expires and a few thousand people try to refresh the generated HTML. That’s a lot of instant load – hitting the database, re-saving the cache and so-on: it’s a lot of extra processing that can bring a website to its knees. One of the many ways to avoid this from happening is to apply pseudo-locks to a cache (and works great with Memcache).

He includes a code snippet example showing how to create the lock using a Zend_Cache setup by looking for a URI-based lock file and setting a “locked” value to true when someone else is using it.

Source: http://www.phpdeveloper.org/news/15324

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Josh Holmes’ Blog: Zend SimpleCloud and Azure

Josh Holmes’ Blog: Zend SimpleCloud and Azure

In a new post to his blog, Josh Holmes has posted about some of the testing he done with Azure and SimpleCloud to get them connected and playing nicely together.

I’ve been playing with Zend’s SimpleCloud API for the webcast that I’m doing with Zend today. I started with the Zend Framework Quickstart tutorial but changed out the backend to hit the Azure Tables and such (well kinda – I used Zend Studio 8 Beta 2 and didn’t use the ZF tool but I still created a little guestbook). I’m going to expand this example to include blob storage and queues as well in the near future but at the moment, I’m just going to hit the Azure Tables.

He uses the Zend Framework CE, Zend Studio Beta, the Windows Azure SDK and the Windows Azure 4 Eclipse plugin to interface directly with the Azure instance. He shows how to create the project (complete with screenshots), map the IIS document root directory to the Azure instance (a Virtual Directory) and build the application. All of the code and table structures needed are included with the end result looking something like this.

Source: http://www.phpdeveloper.org/news/15323

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

VoidWeb.com: PHP Clustering using Apache httpd mod_proxy

VoidWeb.com: PHP Clustering using Apache httpd mod_proxy

New on VoidWeb.com there’s a post looking at clustering PHP applications with the help of the mod_proxy component that can be added into the Apache web server.

Often for my clients, I have to prepare the deployment strategy for their LAMP based web applications. Some of them are small to medium businesses and are starting up so a single server setup work out for them. But there are few large web applications too which are growing continuously in terms of users and demands scaling either horizontally or vertically.

They give a brief overview of what vertical and horizontal scaling are as well as a simple layout of a basic PHP-based cluster. They list some of the requirements for this simple cluster and how it should all work (in theory) and start in on how to set it all up (practically). In the end you’ll have a light proxy setup that will rotate around between the servers but do it transparently from node to node.

Source: http://www.phpdeveloper.org/news/15322

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

PHPBuilder.com: Enforcing Coding Standards with PHP_CodeSniffer

PHPBuilder.com: Enforcing Coding Standards with PHP_CodeSniffer

Developing applications has become simpler and simpler these days and the multitude of IDEs out there can help you keep all of your files organized and linked together so you know everything is in its place. There’s one thing that only a handful out there can do, though – enforce coding standards. Thankfully, there’s a tool that can help you keep your code following down the right path and PHPBuilder.com has a new tutorial about using it – PHP_CodeSniffer.

Although defined according to formal grammar and syntax, programming languages — like their spoken counterparts — often leave their users with a great deal of leeway for creative expression. [...] It can even be singularly counterproductive if you do not maintain stylistic consistency across projects, as you’ll need to continuously re-acclimate to differing syntactical variations.

The PHP_CodeSniffer tool runs your code through a validation process and checks its structure against a coding standard (like the PEAR standard) and ensure it’s formatted correctly. The tutorial shows you how to use the “phpcs” executable to test PHP, Javascript and CSSS files (using the Squiz standard).

Source: http://www.phpdeveloper.org/news/15321

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Sebastian Bergmann’s Blog: PHPUnit 3.5 Upgrading Woes

Sebastian Bergmann’s Blog: PHPUnit 3.5 Upgrading Woes

If you’ve been having issues upgrading to the latest version of PHPUnit (v3.5), Sebastian Bergmann might have the answer to your problems that’s related to the PEAR installer and this bug.

The new dependencies of the PHPUnit package, such as PHPUnit_MockObject for instance, are installed first. The PHPUnit package itself is installed last. And herein lies the problem: PHPUnit_MockObject installs the new version of MockObject/Generator.php before the PHPUnit package is upgraded. This upgrade deletes the MockObject/Generator.php file as it previously belonged to the PHPUnit package.

He includes two complete file listings showing the difference in the structure before and after the upgrade. The PEAR installer is at fault due to a misunderstanding it has about where the MockObject/Generator.php file belongs. The only way to fix this, currently, is to force install the new subpackages instead of just an update – DbUnit, PHPUnit_MockObject and PHPUnit_Selenium. Instructions and a resulting files tree are included so you can insure your install is correct.

Source: http://www.phpdeveloper.org/news/15320

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Popular Posts for the Week of 10.22.2010

Site News: Popular Posts for the Week of 10.22.2010Popular posts from PHPDeveloper.org for the past week:

Source: http://www.phpdeveloper.org/news/15319

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>