четверг, Октябрь 27, 2005

Added AJAX + CyrLat class usage demo

No need to reload page! Ajax-technology do it for you. See examples on my phpclasses page

пятница, Октябрь 21, 2005

My class in PHPClasses.org

On PHPClasses you can see now my class for converting cyrillic to latin symbols and from latin to cyrillic. I don't thing it is intresting for non-russian speaking readers, but class is so nice :)

вторник, Октябрь 18, 2005

New template

New Template for my blog. Only CSS changed and two blocks were misplased. I think it's rather good-looking.

суббота, Октябрь 15, 2005

Generated in xx.xx seconds

Are you interested in knowing how much time is needed for PHP to proceed your script? NO? O.K., just think of this like about example, such a "Hello, world!". We'll make it using PEAR.
Let's look, what time is needed to echo "Hello, World!" phrase.
So the idea is not new: before printing phrase look at clock and remember this value. Now print phrase. Look at clock again and you'll see how much time passed.
I promised to do it using PEAR. OK, Benchmark::Timer is what we need.

<?php
# I don't think any comments needed at all, but…
require_once("PEAR.php");
require_once("Benchmark/Timer.php");
# initialize $timer
$timer=new Benchmark_timer;
# begin time counting
$timer->start();
# doing smth
echo "Hello, World!\n<br>";
# stop time counting
$timer->stop();
# show result
echo "Time elapsed: ".$timer->TimeElapsed();
?>

That's all. [Hi, Max :)]
Read docs for Benchmark::Timer, and you'll find very interesting function setMarker().

Save your nerves and time-use PEAR

Very often when you are working at a _rather_big_project_ you want to save your time and nerves. You have a clear idea of what to do in general, but digging little parts of a project you understand that details are numerous and free time is not endless. You remember, what there are a lot of usual code-parts witch are going from project to project, some parts of them were made by you some time ago from the very beginning, some were copy-pasted from codes of other people. Now they need correction for your current needs. You begin copy-pasting some scripts, editing them. Brrrr. That's a good way but… To protect your nerves and time I propose you to use PEAR.
I think that you've heard about PEAR, but I don't think you really used it. If I'm mistaken, I'm really happy for you and think that you are using PEAR with pleasure.
In any case I want to tell about my experience working with PEAR.
There is a huge number of manuals, help-topics, forum-talks about "How to get/install/use PEAR", that's why I will skip "Introduction to PEAR" and show you my vision of using it.