bloginfo('name');

bloginfo('description');

Archives Posts

PHP: Zend Framework Tutorial by Ralf Eggert

August 9th, 2007 by Blu:RayNe

I was a friend of Zend Framework when it was in version 0.5 because of the convincing and really well-thought concepts. Most of them are even better than those of CakePHP (ok, CakePHP can some little other frameworks can do much more than Zend Framework). But Zend Framework is now final and already 1.01, and i guess it has a bright future ;)

There is an easy to understand and some good tutorials on Ralf Eggert’s Blog that gives you an introduction to MVC and how things work with Zend Framework. Just try it for yourself!

And for all trolls: I know Java is better!

Filed under PHP having No Comments »

Archives Posts

Uploads with progress-meter in PHP - a pain in the ass!

Juli 26th, 2007 by Blu:RayNe

 

Armored Personal Carrier

An APC from the aliens movies; picture py paramount studios
 

Okay, i probably guess that probably have some experience with it, probably already made an implementation that works. And probably you only think it works. But often not for production level or enterprise! At the end of the article you will praise once again APC - the PHP Opcode Cache ;)

Well, I tried it all, the PECL uploadprogress_meter-extension which doesn’t really always compile to the latest PHP, upload with Flash ≥8 and JavaScript (because we want to show the progress in HTML). Then we or i have also additional requirements to the upload, like posting variables with one file. And it should really run stable what most solutions don’t!

Let’s summarize - Progress Meter using PHP as primary server language:

PECL Extionsion uploadprogress_meter
Often only compiles and runs stable to the version it was built for
Wrappers with Perl
Megaupload, Filechucker or how they call them, have some problems in stability, resulting not always in writing the monitor file. Who knows why? I made an own version based on Megaupload (which should be on release here shortly)
Other PHP hacks
Do they really run stable with the current PHP built?! Who will update them?
Flash-Uploader with JavaScript Backends
While beeing client side they have the generic problem of often calling a JavaScript-Callback that results in a flash-side timeout alert-box when you’re using broadband connections >1MB/s upstream. Shitty for all the customers on your commercial website with such a connection and without any technical knowledge.
Pure Flash-based upload progress
A solution that really works and runs stable, but do you wanna make your whole site in Flash or are you working in Flex?
APC - the PHP opcode cache
You heard right! Just add an apc.rfc1867 = on to your PHP ini and submit also a APC_UPLOAD_PROGRESS>-field and your on the right side calling the progress like with apc_fetch('upload_'.$_POST['APC_UPLOAD_PROGRESS']); For more just have a look here and enjoy ;)

My Perl-based solution mentioned above (called jjUpload) will be available here shortly – didn’t i already post about it? It won’t work on it anymore since APC now has that functionality. Just bad for all you ZendCore- or ZendDebugger-Whores :P

Anyway, i’d like to hear what you prefer - client side progress-meters -or- if the status should be pulled from the server?

Filed under Allgemein, Coding, PHP having No Comments »

Archives Posts

Real unique id

Juni 23rd, 2007 by Blu:RayNe

Every PHP programmer should know that.

I stumble upon too many lame md5-hashes based on md5(rand()) or even more ciritcal crc32(rand()). That could really lead to trouble especially when you’re using a lame unique id for critical applications like payments or somethimg.  The chance that one id is used two times is not great, but if there is a chance for such an error, a programmer has to eleminte it!

And it’s so easy with PHP!

string uniqid ( [string $prefix [, bool $more_entropy]] )

Gets a prefixed unique identifier based on the current time in microseconds.

// no prefix
// works only in PHP 5 and later versions
$token = md5(uniqid());

// better, difficult to guess
$better_token = md5(uniqid(rand(), true));

 

For more see the PHP Manual

Filed under PHP having No Comments »

Archives Posts

PEAR Mass-Install

April 17th, 2007 by Blu:RayNe

Schon einmal geärgert, dass man bei PEAR alle Pakete von der Hand installieren muss? Nein,man muss nicht!

Zum einen hilft es oft pear config-set preferred_state beta zu setzen, da viele Pakete sich nich im Beta-Status befinden.

Und uum einen hilft download-all, was aber alle PEAR und PECL-Pakete herunterlädt.

Eine andere Möglicht ist mit pear remote-list | awk ‘{print $1}’ > pear-packages  sich erst einmal die Liste aller Pakete zu holen, diese kann man dann bequem in einem Text-Editor bearbeiten, und per cat pear-packages | xargs -n 1 pear install -a dann auch bequem alle ausgewählten installieren

Filed under PHP having No Comments »