Posts filed under 'Dreamweaver'
… or maybe they were just too polite to say.
I’m currently working on the draft of a new book about PHP, and decided to create a form to demonstrate the effect of the various arithmetic operators. I used the same set of examples that I’ve stuck with ever since Foundation Dreamweaver MX 2004. The example for modulo division is $x % $z, where $x is 20 and $z is 4.5. Since modulo gives you the remainder of a division, the result is obviously 2.
Well, at least that’s what I thought. It’s mathematically correct, so nobody ever questioned it. Imagine my surprise, then, when I fed this example into my form and the result came back as 0. Had I stumbled across a PHP bug?
I hunted around on the official PHP site, and couldn’t find anything. So I did some more tests. When I played with integers, modulo worked exactly as I expected. It’s just with decimal fractions that it behaved oddly.
Finally, I consulted Programming PHP by Kevin Tatroe and Rasmus Lerdorf, which reveals that, in PHP, the modulo operator converts both numbers to integers before performing the calculation. As a result, 4.5 was being rounded up to 5. Hence my mistake.
It’s nice to discover an error in one of your own books before others point it out, but it’s a bit embarrassing to have made the same mistake in four books.
Strange that it’s not mentioned in the PHP manual, either.
March 8th, 2007
Let’s me nail my colours to the mast straight away: I use XHTML and have done so for several years. XHTML 1.0 has been a W3C recommendation for seven years (since January 2000). I’m aware of the well-argued objections by Ian Hixie, among others, against sending XHTML as text/html. Opponents of switching to XHTML 1.0 also point out quite rightly that XHTML 2.0 won’t be backwards compatible with previous versions.
So the arguments that break out in online forums from time to time about whether to use XHTML always tend to go over the same ground again and again: XHTML 1.0 isn’t really XHTML because it’s normally delivered using the wrong MIME type (text/html instead of application/xhtml+xml), and anyway everything’s going to change several years down the line when XHTML becomes the standard. My viewpoint has always been this:
- XHTML 1.0 is an official standard
- It’s fully supported by modern browsers (even Netscape 4 has no problems with it)
- Using XHTML 1.0 properly (in other words, making sure that it validates) teaches you the stricter standards that will be necessary when XHTML 2.0 eventually comes along (if it ever does)
- Well-formed XHTML makes it easier to work with CSS and dynamic code, such as PHP
Of course, you could use the same arguments about valid HTML 4.01. What matters most of all is that your code follows the rules and doesn’t rely on the forgiving nature of current browsers to cover up your mistakes.
This subject came up again a few days ago in the Dreamweaver forum. The discussion didn’t produce any real enlightenment, but it set me thinking. One of the arguments used in the past against adopting XHTML 1.0 is that “it doesn’t futureproof your site” because you’ll have to do everything again when XHTML 2.0 comes along. Then it struck me: that argument is completely wrong.
XHTML 1.0 is HTML 4.01 reformulated as XML. Since XML is designed to be machine-readable, it is futureproof. Pages designed with XHTML 1.0 may not be displayed by future browsers in the same way as XHTML 2.0, but the DOCTYPE will tell the XML parser how to read it. The same isn’t be true of HTML pages, even if they validate according to the 4.01 recommendation, because an XML parser will choke on empty elements, such as img tags.
January 2nd, 2007
As a result of lobbying here and in a private forum, the Dreamweaver 8.0.2 PHP hotfix is now freely available for download from this technote on the Adobe website. Thanks to Scott Fegette of Adobe and everyone else for their efforts behind the scenes to bring this about. Please note that the hotfix is needed only if you are using Dreamweaver to develop with PHP. It is required to complete chapters 9 through 12 of my book Foundation PHP for Dreamweaver 8. It fixes the following problems in PHP pages in Dreamweaver 8.0.2:
- CONCAT() stripped out of SQL queries by Dreamweaver
- Failure of XSL Transformation server behavior in PHP 5.1.4 and above
- Backslashes incorrectly inserted when magic quotes are turned off
- Problems with LIKE in SQL queries
December 18th, 2006
A lot of people have complained (and rightly so) about the way Adobe forces people to jump through seemingly endless hoops in order to get the PHP hotfix that fixes a handful of serious bugs in Dreamweaver 8.0.2. One of the advantages of being an author of books on Dreamweaver is that I can participate in a private forum and raise matters of concern directly with Adobe and the Dreamweaver team. Yesterday, I posted a message in the forum expressing my frustration about the “scandalous lack of availability” of the hotfix, and in the process sparked off a heated debate.
I pointed to the slew of complaints in response to my original blog post. Fortunately, Phil Adkins had reproduced the response he received from Adobe Customer Service. An Adobe representative quickly replied that Phil had got in touch with the wrong department. It wasn’t Customer Service, but Technical Support he should have contacted. Quite frankly, this is nonsense. When customers get in touch with a company, they frequently have no idea which department they’re dealing with. It’s the job of Customer Service to put them in touch with the right one.
But it shouldn’t be necessary to ring or email any department in Adobe to get the hotfix. It should be made available for immediate download like any other Dreamweaver updater. That message has been passed on to Adobe in emphatic terms by me and several other people. The Adobe rep promised to convey that message to the Dreamweaver team. (Update: the hotfix can now be freely downloaded - see Scott Fegette’s comment. )In the meantime, the following should help:
Contact Dreamweaver Technical Support, not Customer Support (the details are in the right column of this Adobe page)
If Technical Support doesn’t know what you’re talking about, tell the representative that it’s covered by TechNote b6c2ae2a
Tell Technical Support that you need DW802_HotFix-0_6_0.mxp
If you still get nowhere, ask the representative for an incident number, and post the details here - I’ll pass them on to my contact inside Adobe
Hopefully, nobody will need to go as far as the last point, and this silly saga can be brought to a close. The tragedy is that it happened in the first place.
December 16th, 2006
Changes to the way Apache handles virtual hosts in the 2.2 series affect the instructions for setting up virtual hosts in Windows on pages 86-7 of Foundation PHP for Dreamweaver 8. The most important difference is that Apache 2.2 applies stricter permissions than either the 1.3 or the 2.0 series, so you’re likely to see a “Forbidden” message rather than the website that you were expecting. The other change is that the main configuration file, httpd.conf no longer contains everything under the sun. Virtual hosts and other optional features are now controlled by external files.
I’ve created a tutorial showing how to set up virtual hosts on Apache 2.2 in Windows. Although it was originally intended as an update for my book, I decided to give full instructions, rather than just outline the differences. As a result, the tutorial can be used even if you don’t have a copy of Foundation PHP for Dreamweaver 8. Although why anybody should be without a copy is one of the great mysteries of the universe.
If you haven’t experimented with virtual hosts in your local development environment, they’re well worth looking into - and they’re not difficult to set up. If you locate your testing sites in the Apache server root, localhost becomes the site root, and what should be the top level of the site goes in a subfolder. For simple sites, this doesn’t really matter, but it can make testing very difficult if you want to use links in PHP includes.
Root-relative links cannot be tested if the site is in a subfolder of the server root, but using a virtual host solves the problem. A virtual host gives you exactly the same structure in your testing environment as a live site because the top level folder of the virtual host becomes the testing site root. If you make extensive use of includes, virtual hosts are the way to go.
December 10th, 2006
I have created revised instructions for pages 420-421 of Foundation PHP for Dreamweaver 8 in the Tutorials section of this site. The change was necessitated by the withdrawal of MX Looper as a standalone extension following Adobe’s takeover of InterAKT. The new instructions make use of the very handy PHP Horizontal Looper extension created by Tom Muck. The extension is free, but if you find it useful, you might want to buy the more sophisticated commercial version.
November 2nd, 2006
Adobe’s acquisition of InterAKT on 6 September means that the 30-day free trial of MX Kollection 3 is no longer available. In fact, MX Kollection 3 itself is no longer available. A whole raft of InterAKT products, including the recently released AJAX Toolbox, have been discontinued. MX Kollection 3 and a handful of other products have been repackaged as Kollection, which retails for $399.
As far as readers of Foundation PHP for Dreamweaver 8 are concerned, this affects the final section of Chapter 10 and a couple of pages in Chapter 11. I’ll post more details on the book’s update page when I get chance to write the necessary instructions.
September 15th, 2006
I agree wholeheartedly with the comments about the painful and bureaucratic process Adobe is using to distribute the PHP hotfix for Dreamweaver 8.0.2. While I can do nothing to stop anyone from passing a copy to other people, please do not post links to unofficial downloads on this site. Distributing the hotfix privately is a technical breach of the Adobe licence. More importantly, anyone with a small amount of technical knowhow could doctor the code in such a way as to corrupt your Dreamweaver configuration.
I have already deleted a link posted to an unofficial version. What you post on your own site is your own affair, but please don’t expect me to host links to something that I cannot guarantee is the genuine article.
September 12th, 2006
A lot of people have come to grief trying to install PHP with the Apache 2.2 series on Windows. They go to the Apache download page, see that Apache 2.2.3 is described as “the best available version”, and naturally assume that it’s the one they should use. Unfortunately, the Apache dynamic link libraries distributed with the Windows version of PHP (up to and including PHP 5.1.6) support only Apache 2.0 or Apache 1.3.
That’s finally about to change with the release of PHP 5.2.0, which is currently in the release candidate stage. I have been running PHP 5.2.0RC3 for the past few days with Apache 2.2.3, and everything seems to be working smoothly. There are appear to be no conflicts with Dreamweaver 8 or phpMyAdmin 2.8.2.4.
If you already have a testing environment that’s working satisfactorily, I don’t think there’s any point upgrading from Apache 2.0 to Apache 2.2 just to get the latest version. However, if you’re installing Apache for the first time (or on a new machine), it does mean you will soon be able to choose whichever version takes your fancy. The only difference in the configuration is that you need to use php5apache2_2.dll instead of php5apache2.dll. Assuming that you have installed PHP in C:\php5, the appropriate line in httpd.conf looks like this:
LoadModule php5_module C:/php5/php5apache2_2.dll
If you’re absolutely desperate to use Apache 2.2 and PHP 5.2.0, you can download the Windows zip file for PHP 5.2.0RC3 now. The PHP team stopped linking to release candidates on the PHP download site a couple of years ago, but there are plans to resume this practice soon in the interests of getting more people to test them before releasing the final version. There have been a couple of embarrassing cases of a “stable” version needing to be updated after only a couple of days when a small, but vital part of the code was discovered to have introduced a new bug.
September 3rd, 2006
At long last, Adobe has released a hotfix for a number of serious issues affecting the PHP MySQL server model in Dreamweaver 8.0.2. Unfortunately, you can’t just go to the Adobe site and download it. You need to contact Adobe support and ask for it. Officially, the reason is because Adobe wants to know how many people have been affected by the problems that it solves, and it wants to check that the solution “works for them”.
Anybody using my book Foundation PHP for Dreamweaver 8 should get the hotfix pronto, as it solves two problems affecting Chapters 9 and 12:
- Without the hotfix, Dreamweaver 8.0.2 strips CONCAT() out of SQL queries.
- Changes in the way PHP 5.1.4 and above handles XML resulted in the XSL Transformatiion server behavior reporting incorrectly that the source was not a valid XML document.
The hotfix also solves a couple of other important problems, so if you have Dreamweaver 8.0.2 or have been putting off updating to 8.0.2, I strongly urge you to get in touch with Adobe support and get the hotfix. You can find full details in this technote on the Adobe site.
August 28th, 2006
Next Posts
Previous Posts