Entries categorized as ‘PEAR’
I remember those old days when I had to write everything by myself. I wrote huge libraries to work with MySQL. Then I learned PostgreSQL and SQLite but didn’t rewrote my old library to work with those, I was running short of time. So I forsake the opportunity to write a db library which works with them. What I did was plain code relevant to database specific portions. Oh ya, that was a long time ago.
Soon after that I came to know adoDB which made my dream come true. I was so much happy getting my all db specific works done in a much more smarter way. I get rid of database portability issues. I was very happy that time.
I learned smarty soon after I realize that my codes are getting ugly with all the inline HTMLs and PHPs. Nothing could be smarter than separating the presentation logic from the business layer. I am a big smarty fan since that time. It saves my sleep for many nights.
But again I am recurrently suffering from maintainability issues. I was not surprised to find that my code is becoming huge unmanageable giant and it takes huge time for refactoring the application. I was very sad those days. Oh what a disaster that was.
When working with my team members located remote places, I fall into a deep shit. How can we manage and track the changes done by us? Even I was getting strange code in my routine which I bet was not written by me!! It was a terrific job (more…)
Categories: CodeIgniter · Cool Webapps · FOSS · Me - Myself · MySQL · OpenSource · PEAR · PHP · PostgreSQL · SQLite
I have been working with PHP for more than 3yrs (I believe still I am beginner in this category) - I was present in several interview board. Which things disappointed me most is the “lack of eagerness” to learn what comes new. Sometime developers thinks that learning Only PHP will help them to get lucrative jobs!! OMG
Specially in BD most of the time PHP developers plays multiple roles in the companies, they are developer, they are template designers, they are HTML coders, they are DBA, they are PMs….what the heck. Only few companies have different people for these roles.
How far you can go just learning PHP (RAW code, in ancient style, that means PHP+HTML together, yak!!)? You have to have knowledge in CSS, JS, Frameworks, Multiple DBS
When it comes the question of CSS, you should maintain a list of websites where from you can get updates. Dont learn the CSS from book, but goto websites and see what is happening… If you are still using Tables to design (more…)
Categories: AJAX · Internationalization · MySQL · PEAR · PHP · SQLite · ZCE · interview
Caching is a major process of speeding up your application. By caching the output of a potentially large scale operation and displaying that output later from that cache saves a lot of time. First if you have cached output of a large scale operation, just check whether the cache is out-of-date or not. If it succeeds all the parameters, display the cache which saves that time consuming procedures. These large scale operation may include fetching content from an remote source using CURL or any stream wrapper, or a database operation, or even a time consuming graph/chart generation.
There are several types of caching, like opcode caching, output caching etc. Compiler level caching are out of scope in this article. We are simply talking about the output caching. In this step PEAR::Cache or PEAR::Cache_Lite may save really a great amount of time. Lets take a look how.
In the following example we are using PEAR::Cache. You can also use Cache_Lite which functions great by sacrificing a bit performance.
<?
include("Cache/Output.php");
$cache = new Cache_Output("file");
if (!$cache->start($cacheid, "samplegroup"))
{
//perform large scale operation
echo "Hello";
$cache->end();
}
else
{
echo "Printing from Cache";
}
//display the cached content
echo $cache->get($cacheid);
?>
First time, the output is generated as usually. But from next time the output is displayed from cached bypassing the large scale operation.
You can flush content of any cached group by accessing it’s flush() method which looks like below
$cache->flush( “samplegroup”);
Thats it.
Categories: PEAR · PHP