Not really new, but I did not read the GD site that much :)
In GD 2.0.26 (Changelog), they backport my antialiasing function introduced in php 4.3:
„Drastically faster, less memory-intensive antialiased drawing, thanks to Pierre-Alain Joye. This code was imported from the PHP ‚fork‘ of gd.“
They should backport the ellipse and filling functions I rewrote for php.
Archiv für das Jahr: 2004
ReflectionClass::hasMethod()
In a recent discussion on the PHP internals list Andi asked why ReflectionClass::getMethod() throws an exception when the requested method doesn’t exist instead of returning NULL. During the discussion it came out that it brings advantages to throw an exception when doing things like $class->getMethod(‚foo‘)->isInternal(); or if you really like exceptions. In addition it brings consistency with ReflectionMethod’s constructor which throws an exception too when a method can not be found. But since exceptions aren’t a good instrument just to check wether a method does (not) exist the conclusion was to add a ReflectionClass::hasMethod() method which simply returns a bool. Since I’m currently learning how this PHP stuff works I wrote a patch which was committed by Marcus this morning.
My first PHP Extension.
This is my first contribution to writing php extensions. Extractor interfaces the libextractor library which offered some nice functionality to a project I am currently working on. Libextractor is used to extract meta-data from files of arbitrary type. Ext_skel and the pear packaging system came really handy during the development process.
Following Filetypes are supported: HTML, PDF, PS, OLE2 (DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI, MAN, MP3 (ID3v1 and ID3v2), OGG, WAV, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ), ZIP, ELF, REAL, RIFF (AVI), MPEG, QT and ASF
Accessibility in PHProjekt 5.0
Beside my daily work at Mayflower GmbH/ThinkPHP I’m working a lot on XHTML/CSS/Accessibilty for the open source project phpMyFAQ and trying to add my knowledge in our projects. Because accessibility wasn’t a goal in the previous releases of PHProjekt we’re working hard on the complete XHTML/CSS rewrite of the frontend.
The switch from Java to PHP
Having read John’s posting, I can tell you something about the switch from Java to PHP.
In our last year’s project for the biggest european power supplier E.ON, we ported an application from Microsoft Access to PHP. No Java? Indeed. E.ON had two bids – one from their own IT daughter company, is:energy, and one from another company that bidded with Java. The reason why E.ON chose PHP for that project is the following:
PHP: about 550 mandays
Java: more than 2500 mandays
If you know what E.ON paid in whole for the PHP project, you can imagine what the Java project would have cost. The PHP project cost about 1 Mio. EUR.
There are also some other projects: for a well-known car rental company, we port their Java-based web applications to PHP. For a project for one of the biggest home retail stores in Germany (the one with the beaver), I wrote a PHP middleware (based on PHP, MySQL and the wonderful lighttpd from Jan Kneschke) which interfaces with Siebel, SAP and Flash clients at the POS. Not only that we could develop it in a rapid way (14 man days), but our customer also chose the PHP solution in favour of a Java standard product which required several servers (4 Java application servers, 2 Oracle servers – our solution has only a cluster of 2 servers) and could save more than 50,000 EUR with this solution. BTW, this PHP application has nothing to do with a normal web application – it receives requests from a Flash client, changes it to XML based requests for Siebel, receives answers from Siebel and transfers it to the Flash client. And in the night, the daily batch for SAP…
At one of our other customers, we manage about 35 customer extranets/portals since 2001. We displaced the software from Broadvision and Webfair with our flagship product, Chairman (a multi-brand, multi-international, multi-portal framework solution). The customer had a cost saving of about 90%. You can look at the powerpoint file downloadable from this place. Christos Marazidis from our customer held this session at the LinuxTag LAMPArea 2004.
There are more stories available. If you want to know more, feel free to e-mail me.
PHP soap server and dotNet c# client – part 1 [Nested Arrays]
This entry will show you how to model a dotnet valid wsdl file, how to send dotnet valid responses from php and finally how to connect a c# client. This is the wsdl ‚DOTNET‘ way 3->5->7->2 to continue Johann’s previous post. It is easy, at least if you know what desires the Microsoft’s xml-serializer. To put the difficulty level one step higher we define and respond with a nested array.
Is this negative? (or need for speed #2)
As Pierre wrote before sometimes you need functions you usually would say "no, you’ll never need this, this task can be done with just one line PHP" but later you see "Okay, now I could use it".
We had such a situation a few days ago: Thorsten once complained that PHP has functions for everything but no is_negative(). We all in the office, including Pierre, knew that we don’t need such a function since everybody should be able to do this using the < or > operators and would neeevvveeeerrr demand it. A few weeks later, Thorsten and Pierre are working on a project where they are doing some complex calculations and Pierre recognizes the need for such a function. As a result I can present you our companies new friend: is_negative().
MD5 „under“-signed
In one of my softwares i have to prove that the xml output given is authentic.
So i simply take secret known by my counterpart and me, add it to the xml string and use a md5 to sign the xml stuff. No more.
SOAP Box Derby and the bablefish
Actually "SOAP" is just "A".
There is no object orientation, no protocol and least but not last no "simple" in it.
Break the rules (or need for speed #1)
Sometimes some has to process a huge amount of data, applying stupid tests and formulas. There I was and stuck on low performance problem.
The obvious way is to implement the critical part (the stupid tests and formula in C and process the data using the C implementation only), sadly it’s often not even possible to customize php.
Having reached a point where no further optimizations were possible, I start to see what is slow inside php or what I can add to make trivial tasks faster.
One test surprised me: get the sign of a number.
So I go for a new get_sign() internal function and these results:
get_sign: 0.095184011459351 php tests: 0.21789693832397
No comment as I’m pretty sure such new functions will be rejected, keeping in mind the famous „1 line php code“ rule. What’s about (default) speed is my only anwser.
patch: http://pierre.dotgeek.org/ze2/get_sign.patch
tests: http://pierre.dotgeek.org/ze2/get_sign_test.phps