News Feed
Sections




News Archive
feed this:

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

Tobias Schlitt's Blog:
Randomized Pi calculation
April 02, 2007 @ 10:04:00

Since there is no "magic variable" to get a value for Pi in an application, Tobias Schlitt offers up the next best thing - his homegrown solution for creating the value (using a randomized variation).

I don't know which is the most common way to calculate Pi in computer programs, but from the stochastics book a read for my recent stochastics exam, I have a randomized variation, which is quite cool I think.

The code example is included along with a bit of explanation for those not familiar with the concepts behind it. It uses two of PHP functions, pow() and mt_rand(), to run through a series of iterations and, using a preset precision value, find the "hits" to finally calculate the value at the end.

1 comment voice your opinion now!
randomize pi calculation pow mtrand precision randomize pi calculation pow mtrand precision


Syntux Blog:
Advanced Caching Technique - Block Randomization
August 21, 2006 @ 16:18:25

In his latest entry to the Synutx blog, Ammar Ibrahim talks about an advanced chaching technique - block randomization.

I'm currenlty working on a site where I want to improve performance of dynamic pages. One of the greatest techniques to do is to cache dynamic content and serve the generated output (HTML). It's not as easy as we all want it to be when you have all sorts of weird blocks on the page: User login area, random content, ..etc

As I had a very pleasent experience with eZ components last week, I decided to take a look at the components, but then i remembered it works on PHP5. This project is on PHP4, I had to look for an alternative and decided to use PEAR::Cache_Lite.

He gives a visual example of what he's working towards and includes some sample code (using Cache_Lite) to create the blocks of content for his site. It took a few tries to get right, but apparently, third time's the charm.

0 comments voice your opinion now!
caching technique advanced block randomize pear cache_lite caching technique advanced block randomize pear cache_lite



Community Events





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


voicesoftheelephpant artisanfiles list security library series community symfony release version language framework podcast interview composer tool introduction conference laravel opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework