Little reminder about PHP references and some thoughts about FUDs
Posted by Pierre in
Uncategorized
Tuesday, February 27. 2007
Reading planet-debian and Apache (from Sven and David), I catched two posts about clones and references in php4 and php5. I do not think it is worth to explain again everything here as Sara wrote a very good post already, check it out here.
What annoys me a little is to read more and more bad posts about PHP from people not using it. As David and Sven posts were nice (but still wrong) , I remember other trashy posts (this one was on planet-ubuntu. What does that bring to the other (obviously) better languages or what does that take from PHP notoriety? Nothing, it only shows the possible lack of clue of the poster, who was not humble enough to admit it.
I wonder when the OS community in general will be mature enough to stop bitching at each other. And that’s valid for PHP developers, gnome-kde and other well established wars. Bitching ourselves (I can be a good annoyance for php itself, I admit ;) ) can be a good thing and it is way to get things done in a project (without abusing ;).
First release candidate for GD 2.0.35
Posted by Pierre in
Uncategorized
Tuesday, February 27. 2007
The first release candidate for the upcoming GD 2.0.35 has been released yesterday. It is a bug fixes only. The more important fix is about two possible race conditions in the freetype cache implementation. One in the rendering (glyph_draw) and one during the cache shutdown.
You can see the complete list of changes in the issues tracker or in the NEWS file.
Gopal's Hidef, contants for real!
Posted by Pierre in
Uncategorized
Monday, February 26. 2007
Gopal just published Hidef through PECL. This extension lets you define your constants in a ini-like file, PHP will then parse this file and defines the constants during the php startup which happens only when you start your web server. It simply drops all performance impacts introduced by the constants definition. If you are a performance freak, this extension is for you ![]()
See his blog’s post for benchmarks and a little doc.
Which Zip for which PHP and a bug fixes release (1.8.6)
Posted by Pierre in
Uncategorized
Monday, February 26. 2007
About once a day, a user asks me which Zip version they should use: the bundled version (PHP 4 or in 5.2+) or always rely on PECL. There are different cases, and all of them are good except one.
I strongly recommend to not use the bundled Zip extension in PHP 4.x (which is the PECL version 1.0). The later versions (1.1.0 or later in PECL, and bundled in PHP from 5.2.0 and later) is 100% backward compatible. For example, the version 1.8.7 fixes a leak in the old API.
PHP 5.2.0 includes Zip, and all the fixes available in PECL. The only difference between PECL’s Zip and the bundled version is the release cadences. I try to release to PECL on a monthly basis, either a development version (new features, improvements) or a bug fixes, or even both when there are enough supporters
. The PHP security policy may hide a problem or two in various changelogs, but be sure that both the PECL releases, and the PHP releases, will have the latest issues fixed.
Summary:
- 5.2.x, bug fixes only or minor improvements
- PECL Zip 1.8.x, bug fixes only or minor improvements
- PECL Zip 1.9.x, development branch, the current improvements include good stuff like pattern based additions or extractions and iterators. The improvements will be available in a PHP only after the first stable PECL release
And a new bug fixes release has been released today, see the complete changelog here.
Documentation generators for C/C++ library or application
Posted by Pierre in
Uncategorized
Monday, February 26. 2007
One of the priority for GD 2.1.0 is to improve the documentation. Not only for the readers but for the developers as well as the editors (there is one for now, Jeffrey Drake
.
There is many documentation generators out there but only a few seems to be still maintained and to fit requirements:
- Simple syntax, a documentation comment should not make the code less readable. It should obviously be readable by a human being (without parsing it)
- At least two exports format, Latex and html are the dream team, but I can live with only HTML
Both of my nominees are well known. I never heard about "Natural Docs" before and I really like its syntax:
Let me try to summarize my feelings about each of them here. This is a non objective comparison, feel free to correct me if I say something stupid
. If you know other tools or how I can customize any of these three to get the "perfect" documentation generation tools, please let me know.
I have to say that I did not ask the respective project authors, I only run some tests and read their respective documentations.
- Robodoc:
Pros:
- Output formats: HTML, XML DocBook, TROFF, ASCII, LaTeX or RTF format. You can virtually have whatever you want using of the default formats.
- Powerful configuration (check the manuals, it is really impressive)
Cons:
- The comment syntax is not very nice and concise, and it is really what keeps me away from Robodoc:
<br /> /****f* Analyser/Is_Pipe_Marker * <span class="caps">NAME</span> * Is_Pipe_Marker * <span class="caps">FUNCTION</span> * Check for “pipe” markers e.g. “|html “. * <span class="caps">SYNOPSIS</span> */<br /> static char *Is_Pipe_Marker( char *cur_char, int *pipe_mode )<br /> /* * <span class="caps">RESULT</span> * Pointer to the data to be piped to document or in case no pointers * are found. * <span class="caps">SEE</span> <span class="caps">ALSO</span> * RB_Check_Pipe * <span class="caps">SOURCE</span> */<br /> {<br /> ...<br />
- Doxygen:
Pros:
- Widely used (that’s a good point when support is required)
- Syntax relatively simple and readable (many syntax are available)
Cons:
- I do not like its html output, list of files/classes/etc. do not speak to me or do not work well for C.
(there is other syntax available):
/*! \brief Brief description.
Brief description continued.
Detailed description starts here.
\param a an integer argument.
\param s a constant character pointer.
\return The test results
\sa Test(), ~Test(), testMeToo() and publicVar()
*/
- Natural Docs:
Pros
- I like its syntax, I cannot image a simpler one as there is none, it is like I would write it
"Cons"
- only html as output and I do not have the time to hack something in perl to improve it
<br />
/*
Function: Multiply</p>
Multiplies two integers.
Parameters:
x – The first integer.
y – The second integer.
Returns:
The two integers multiplied together.
See Also:
<Divide>
*/
And the winner is, for now: Natural Docs. But still, having only html is somehow limited. I would like other outputs like manpages or latex.
Constitution, president, election, are we in France?
Posted by Pierre in
Uncategorized
Monday, February 26. 2007
No, that’s PEAR latest news. Things never change, that’s bad.
Using GD with DevC++
Posted by Pierre in
Uncategorized
Friday, February 23. 2007
A couple of persons asked me about using libGD with DevC++ or if I support it (devcpp is based or use mingw/gcc). The windows binaries work like a charm with DevCpp/Mingw or VisualC.
As I’m too lazy to write long texts and take screen shots, I recorded a little video to show how to create a small console application on windows using DevC++. Check it out here. I used camstudio on a windowsXP running in my freshly updated VirtualBox.
Howto use a single php.ini for cli or cgi with htscanner, use 0.7.0 or later :)
Posted by Pierre in
Uncategorized
Monday, February 19. 2007
Htscanner reports error during module or request init (returns FAILURE), these errors may be fatal and stop the current executions. This behavior is not desired if you use it in a shell ((if you have only one system php.ini for both cli and cgi or if htscanner is compiled statically). This release brings a new ini settings to solve this problem, stop_on_error.
When set to 1 htscanner returns a failure when an error occured internally (cache, doc_root missing, etc.). If it is et to 0 (the default) it will simply return SUCCESS and do nothing. It is useful if you have only one php.ini for cli and cgi or if you compiled it staticaly.
GD 2.0.34 has been released!
Posted by Pierre in
Uncategorized
Thursday, February 8. 2007
GD 2.0.34 has been released!
It took a lot of work to get this version released. Version 2.0.34 is a bug-fix-only release (all known security issues have been fixed), and upgrade is strongly recommended. It is also my very first GD release (hopefully, the first of many to come), and marks the official freeze of the 2.0.x tree, only security-related fixes will be made on this tree from now on.
Please find the release announcement here.
It is a second birth for the libGD project. Its new home now has all tools needed to continue its growth in an organic way:
- Public CVS (webcvs)
- Issues tracker
- Public mailing lists
- IRC channel on freenode: #libgd
- Wiki
If you are a maintainer of a language binding, I will be more than happy to hear your needs or to host your project if you are lacking the infrastructure to do so yourself. Many projects have begun to bundle or fork away from the main project, but I hope we will find a way to clean the general mess (years without releases did not help). In short, any feedback, requests, contributions or patches are welcome!
The future of the project is now looking way better than only a couple of months ago. We have already started to work on the next improvements, which will be included in the 2.1.0 release. Stay tuned!
imagerotate, little confusions in the manual (damned, I cannot say RTFM!)
Posted by Pierre in
Uncategorized
Tuesday, February 6. 2007
imagerotate has special intern functions when the rotation angle is a multiple of 90°, it actually only flips the image. The operation is quite fast as it is a two nested loops with a little copy operation. However it looks like the manual has a little mistake in the function description, which can lead to confusion:
"The center of rotation is the center of the image, and the rotated image is scaled down so that the whole rotated image fits in the destination image – the edges are not clipped."
<br /> $im = imagecreatefrompng(“foo.png”); <br /> imagepng($im, “2.png”);<br /> $imr = imagerotate($im, 90, 1, 1);<br /> imagepng($imr, “foo_90.png”);<br /> $imr = imagerotate($im, 180, 1, 1);<br /> imagepng($imr, “foo_180.png”); <br /> $imr = imagerotate($im, 270, 1, 1);<br /> imagepng($imr, “foo_270.png”); <br /> $imr = imagerotate($im, 30, 0×000FF, 0);<br /> imagepng($imr, “foo_30.png”);<br />
Will return: 




As you can see, as long as the rotation is only a flip (angle is a multiple of 90°), the image dimensions are preserved. If not, the final image will have the exact size required by the rotated image. I hope it is clearer now, I will try to update the manual as soon as possible. Thanks to the phpdoc team, I can now put all kind of psychedelic images in there!



