 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Debuggable Blog: Two CakePHP Tricks
by Chris Cornutt August 25, 2008 @ 15:58:03
On the Debuggable blog Felix has posted two quick tips you can use in your CakePHP application - one related to debugging and the other about custom config files.
For tip #1
If you just put a debug() statement in, you will see hundreds of outputs and would not know which one belongs to the case you are interested in. My favorite solution to this problem is to use the Configure class as a toggle for showing the debug information.
For tip #2
This is a very simple one. To make your application configurable via a global config file, all you need to do is the following.
Both come complete with code examples.
voice your opinion now!
cakephp trick debug function custom configure file
Dhiraj Patra's Blog: Caching PHP Programs with PEAR
by Chris Cornutt August 07, 2008 @ 12:58:09
In a recent post to his blog Dhiraj Patra looks at the caching functionality that PEAR has to offer via the PEAR Cache package.
Caching is currently a hot topic in the PHP world. Because PHP produces dynamic web pages, scripts must be run and results must be calculated each time a web page is requested, regardless if the results are the same each time. In addition, PHP compiles the script every time it is requested. [...] PEAR's Cache package offers a framework for the caching of dynamic content, database queries, and PHP function calls.
He talks a bit about what kind of methods are included with the package and shows examples of how it works for function call caching, caching the output from the script execution and how to implement your own custom caching extension of the main code to make it even more flexible.
voice your opinion now!
pear cache tutorial function call output custom handler
Developer Tutorials Blog: Parallel web scraping in PHP cURL multi functions
by Chris Cornutt July 29, 2008 @ 07:57:00
The Developer Tutorials blog has posted a tutorial about scraping other website information in parallel (with their permission, of course) with the help of the cURL extension.
For anyone who's ever tried to fetch multiple resources over HTTP in PHP, the logic is trivial, but one key challenge is ever-present: latency delays. While web servers have perfectly good downstream links, latencies can increase script execution time tenfold just by downloading a few external URLs. But there's a simple solution: parallel cURL operations. In this tutorial, I'll show you how to use the "multi" functions in PHP's cURL library to get around this quickly and easily.
He starts with a basic cURL example, grabbing the content from example.com and putting it into a variable. He modifies this to make it a bit more complex and to run multiple fetches in parallel - creating more than one cURL object and using the culr_multi_* methods to manage them.
voice your opinion now!
webscraping curl function multi parallel tutorial
Asvin Balloo's Blog: SEO friendly URL in PHP
by Chris Cornutt July 24, 2008 @ 11:14:40
Asvin Balloo has posted a quick look at making the URLs of your website a bit more "pretty" and SEO-friendly.
When I started implementing mod_rewrite in websites I had a problem in PHP as how to make a SEO friendly URL. All tutorials were geared towards how to implement mod_rewrite, about modifying .htaccess files, but none treated how to make the urls friendly with dynamic content.
He shares a function that he found that helped him a great deal - a method called friendlyURL. It changes a bit of text into a more friendly version of itself ("this is a test" becomes "this-is-a-test") that can be used in anything you'd want. An example could be in automatically generating links to other pages on your site that search engines can easily follow.
voice your opinion now!
seo friendly url function parse search engine
Vinu Thomas' Blog: mbstring Functions by default in PHP
by Chris Cornutt July 18, 2008 @ 07:57:16
In a new post to his blog, Vinu Thomas talks about a set of functions that can make your life easier when handling unicode strings - the mb_* methods of the mbstring extension.
When dealing with multiple languages and internalization in PHP, some of the default functions in PHP end up mangling up the unicode characters in PHP. This is evident when you have a lot of funny looking characters coming up on your web page instead of the actual characters. [...] There is an extensions called mbstring which you can install in PHP which gives you a set of functions which are unicode ( actually multibyte ) ready.
He mentions some of the replacements like mb_send_mail instead o fmail and mb_strlen instead of the usual strlen. Thankfully, there's a simple way to make use of these functions without having to replace a lot of code - a setting in your php.ini (mbstring.func_overload) that tells your application to seamlessly replace things behind the scenes.
voice your opinion now!
mbstring function utf8 unicode multibyte replace
Alex Netkachov's Blog: BAT file tips
by Chris Cornutt June 06, 2008 @ 07:58:08
Alex Netkachov has updated a post he made a while back (in 2006 in fact) about making Windows batch files (.BAT) that would do the same thing as some of the functions in PHP. He's added two more to it today - one for string replace and another for splitting a string.
The replace is as simple three line call, much the same as PHP's and the split call, while a bit more complex, is still pretty straight forward (it just needs a few extra variables).
Other methods in the post include a "switch" method, defining a procedure and updating variable by its name.
voice your opinion now!
bat file tip string replace split function port
|
Community Events
Don't see your event here? Let us know!
|