 | News Feed |
Sections
|
| feed this: |  |
Christopher Jones' Blog: Temporary LOBS in PHP's OCI8 Extension. Instant Client.
by Chris Cornutt January 21, 2008 @ 12:05:00
Christopher Jones talks today on his blog about a bug he's just corrected and integrated into the release of the Oracle Instant Client that lets PHP correctly take advantage of the temporary LOBS functionality.
When PHP is done with the temporary LOB, it needs to tell Oracle to destroy it. If this isn't done, then the temporary LOB will hang around using DB space until the connection is closed. I just merged a fix worked on by Krishna Mohan and myself for bug 43497.
Example code is included showing two instances of its use - a normal use that frees the memory correctly and the other showing how to create the temporary lob to hold the data as needed.
voice your opinion now!
temporary lob patch oci8 extension instant client memory leak
Arnold Daniels' Blog: Perl like temporary variables in PHP
by Chris Cornutt November 02, 2007 @ 09:38:00
Arnold Daniels points out a quick method for creating what he calls "perl-like temporary variables" in the global scope of a script:
When writing code in the global scope, I often have a problem where I'm overwriting a variable. This happens even more often when I work on code of somebody else. Usually has the variable which does the overwriting is usually just a temporary variable.
His code is a simple few lines that shows how it could be used when trying to write information out to a file handle. Some of the comments on the post criticize his use of the global scope but Arnold comes back with his reasoning - mostly that there is already code in the global scope and that adding something else is only adding to it, not making things worse.
voice your opinion now!
temporary variable perl global scope temporary variable perl global scope
Webdigity.com: Caching your pages with PHP
by Chris Cornutt July 16, 2007 @ 18:55:00
On the Webdigity.com forums, there's this new tutorial posted showing how to create a simple caching system with PHP for your site (using cached files).
A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especially for sites with heavy traffic is a real big problem.
There are two ways to solve this if you want to make your site faster. First is optimizing the queries Visit through proxy, but we will not talk about this at the present article. The second and most valuable is using some kind of custom caching technique.
Their code, contained in an easy-to-use class, makes it simple to cache the contents of a page just by setting the stop to start the caching from (and where to end).
voice your opinion now!
caching page class file custom temporary caching page class file custom temporary
PHP-Coding-Practices.com: Composing Methods Introduce Explaining Variable
by Chris Cornutt July 02, 2007 @ 07:53:00
From the PHP-Coding_Practices.com site, Tim Koschuetzki has posted an interesting suggestion for developers working with long expressions to make thing simpler - substituting temporary variables for portions of the expression.
Introduce Explaining Variable is particularly useful with long if-statements. You can take each condition, introduce an explaining variable and the conditional logic will read very well.
Another occasion is a long algorithm where each step in the calculation can be explained with a well-named temporary variable.
The method is basically the following - declare the temporary variable with part of the expression, replace where needed in the expression, repeat for other parts of the expression. In his example code, he demonstrates its use, pulling out portions of an equation to calculate an item's price to make it much more readable.
voice your opinion now!
method variable temporary compose substitution method variable temporary compose substitution
PHP-Coding-Practices.com: Composing Methods Replace Temp With Query
by Chris Cornutt June 14, 2007 @ 14:25:00
In a new article from PHP-Coding-Practices.com today, Tim Koschuetzki offers a different sort of solution for working with those little temporary variables scattered throughout your code - replacing a temporary variable with a queryable structure.
When you are using a temporary variable to hold the result of an expression, extract the expression into a method. Then replace all references to the temp with the new method. The new method can then be used in other methods.
His suggestion basically replaces the quick temp variable with something slightly more complex but something that can be used anywhere in the class. He uses the example of multiplying an amount times the quantity - first just assigned to a temporary variable inside a method then refactored as the result of another method returning the same thing (but accessible from anywhere).
voice your opinion now!
temporary variable query method temporary variable query method
Zend Developer Zone: PHP Security Tip #15 (Remove Temporary Files)
by Chris Cornutt March 23, 2007 @ 09:20:00
The Zend Developer Zone has posted security tip #15 today, focusing on an easily forgotten aspect of web development (not just in PHP) - forgetting to remove temporary files.
As developers, most of us are very messy. I've worked on countless projects and at each either run across or left a trail of diagnostic files laying around. (info.php, test.php, doMe.php, etc.) These tiles, if found by someone with nefarious intent, can leak valuable information about your system.
Always remember to remove these types of files...as Cal puts it:
It would be a shame to spend all that time securing your application only to leave info.php or worse yet, a "quick piece of code" in test.php that could potentially leak dangerous information about your system. Don't help the ad guys any more than you have to.
voice your opinion now!
temporary files remove securitytip diagnostic temporary files remove securitytip diagnostic
|
Community Events
Don't see your event here? Let us know!
|