Upgrading stock CentOS5 PHP to 5.2.12

To run eZ publish 4.2, I needed to upgrade CentOS’s PHP 5.1.6 to PHP 5.2.12.

I started at http://php.net, and ended at http://wiki.iuscommunity.org/Doc/ClientUsageGuide#Installing_Packages_from_IUS_Testing The site has a nice collection of RPMs for PHP, so I removed the 5.1.6 RPMS and installed 5.2.12, using RPM.

Apache configuration for a simple development server

I’m setting up a CentOS 5.4 laptop to build a new site for St. Kathryn’s Church in Hudson, NH (http://stkathryns.org).

I want to use the server to run other sites as well, so setting up virtual hosts was one of the first steps.

I like to use a dedicated /etc/httpd/conf.d/vhost.conf file for settings that affect all sites on the server.

/etc/httpd/conf.d/vhost.conf

ServerName 127.0.0.1
NameVirtualHost *:80

/etc/httpd/conf.d/localhost.conf has the localhost settings.

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName 127.0.0.1
ServerAlias localhost
</VirtualHost>

/etc/httpd/conf.d/stkathryns.conf has the settings for St. Kathryn’s new site.

<VirtualHost *:80>
DocumentRoot /var/www/html/stk
ServerName stkathryns.org
ServerAlias stk
</VirtualHost>

The final adjustment is to add the domain name for stkathryns.org into the /etc/hosts file, so I can develop locally, with the correct domain name.

127.0.0.1 localhost.localdomain localhost stkathryns.org stk

dojox/charting - notes

Notes on using dojox Charting.

  • Read the documention at the link above.
  • Assemble the page as AJAX from the beginning. Don’t bother building an HTML version first, the number of requests required for charting is large enough that these pages should be AJAX pages. Zend Framework’s Dojo Data (http://framework.zend.com/manual/en/zend.dojo.data.html) component is an excellent way to encode the data for transport. Zend Framework can be used as a library.
  • Consider using a pulldown to allow the viewer to select the theme used. This is nice for appearance and fun, but may also be valuable for people that have difficulty distinguising colors. A simple loop that lists the available themes, uses a dojo.require to fetch the code, and then applies them to the charts and legends with chart.SetTheme, chart.render, and legend.refresh is a nice feature.
  • Think carefully about what charts you’d like to use. This link
    http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/charting/tests/test_chart2d.html has great sample code. Take the time to look at the charts available. Moving up a level or two in the directory tree yields additional, valuable code.
  • Use updateSeries if possible to redraw charts, if necessary, use destroy, then recreate them.
  • Offer good explanatory text to help people interpret the displays.
  • Write the queries carefully, it’s often faster to query, then use arithmetic to find out other portions of the data. Don’t forget to fill in gaps of missing data for series that illustrate usage or events across time spans.
  • Be sure to sanitize and validate the data. Always.

Rounded Rectangles Notes

Creating rounded rectangles has become a bit of a quest.

This blog links to a utility that lets you create a rounded rectangle image that can be used in a page to help organize the content (http://wirehopper.com/design/rounded.php). It has a link to an approach that allows you to create nine images and use them to display a rounded rectangle using CSS and XHTML. Unfortunately, it doesn’t work (http://www.wirehopper.com/design/rr/). So far, the nicest implementation of rounded corner rectangles I’ve found for page layout is eZ publish’s ezwebin (http://now.ezpublish.no/).

Another approach I tried was to use dojox/gfx, which uses javascript to draw on a page.(http://docs.dojocampus.org/dojox/gfx#rectangle). This works really nicely, however, if you want to place text in the rectangle, you must be creative. The approach I tried was to use divs to position the rectangles, then use absolute positioning of additional divs to put text in the boxes. To be dynamic, the dimensions of the rectangles must be adjusted to work well with the content they’ll surround. This can be done fairly easily with javascript, by getting the dimensions of the text div using screen.clientWidth and screen.clientHeight.

After investing a significant amount of time in this fundamental layout issue, I have come to the conclusion that if you have a framework or library that has themes (http://docs.dojocampus.org/dijit-themes), you should choose one and use it, and if not, unless you’ve already found a great way to do rounded rectangles, or you really have to have them, it’s probably not worth the effort.

Rounded rectangles are excellent learning tools for web designers and developers, because they include several skill areas.

  • Proper image format. .gifs are probably the best for simple rounded rectangles, including those with transparency, .jpgs or .pngs would be good if there are gradients. It’s worth checking the file sizes and checking how they look on the page.
  • CSS layout and dimension control. Depending on the implementation, you may have a three by three block. Each ‘row’ will float, and between the rows, there must be a break. Browser compatibility must be tested.
  • Page construction. Computing the bandwidth required for each rounded rectangle is another good exercise. The bandwidth required includes the XHTML, CSS, and all images. Reusing CSS and images can reduce both bandwidth and the number of requests.
  • Server-side support. I looked into using PHP to help set up the dojox/gfx rounded rectangles, but abandoned it due to time constraints. Using a server-side technology, or template engine / taglib may be helpful.
  • Appreciation of complexity. Many people mistake the simplicity of the XHTML language as an indicator that web work is “easy”. It’s not.
  • Cost of labor. As above, it is good to understand that if a task takes longer, one must consider the cost. Spending many hours on rounded rectangles will undoubtedly reduce the time available for other, more important, tasks. In the business world, time is money.

This ends the quest for rounded rectangles. I learned:

  • Rounded rectangles are not simple.
  • Even if you invest a lot of time, sometimes, there isn’t a ‘graceful’ solution. Bear in mind this is a subjective definition - others may feel that some of the offered ideas are perfect.
  • A lot about ImageMagick (http://imagemagick.org). Including …

    • How to draw a rounded rectangle
    • How to crop pieces out of an image
    • How to tint an image
    • How to apply a gradient to an image
  • The CSS border attributes and how to apply them
  • Rounded corners on images look really nice with ezwebin
  • Many other people have posted cool ideas about rounded corners and rectangles - it’s a popular pursuit, or a necessary one. :)
  • Rounded rectangles just aren’t that important to me anymore

Additional posts in this blog:

http://web-notes.wirehopper.com/2009/07/05/imagemagick-rounded-rectangles
http://web-notes.wirehopper.com/2009/06/07/smoother-imagemagick-rounded-rectangles
http://web-notes.wirehopper.com/2009/05/11/imagemagick-rounded-corners
http://web-notes.wirehopper.com/2009/11/19/ez-publish-rounded-image-corners
http://web-notes.wirehopper.com/2009/11/06/tint-with-imagemagick
http://web-notes.wirehopper.com/2009/06/27/round-image-corners-imagemagick
http://web-notes.wirehopper.com/2009/05/17/imagemagick-rounded-corners-images

Cartoonify (quantize) an image

Quantizing an image reduces the number of colors. It’s an easy way to convert a photo into an image that looks more like a paint by number pattern, or ‘cartoon’.

It might be a fun way to create an avatar, improve image presentation while speeding delivery, or just have fun.

Thanks to: http://www.imagemagick.org/Usage/quantize