Skip to content

Web nourishment by John Ford and crew

Archive for the 'Tips' Category

Installing ImageMagick/RMagick on Leopard

John Ford Nov 26, 2007

I’ve heard many horror stories of developers trying to install ImageMagick/RMagick to manipulate images. Fortunately, when I needed to install RMagick to use with the attachment_fu plugin, I ran across a fantastic script at OnRails.org by Solomon White (many thanks). It gave the steps to install RMagick from source without MacPorts or Fink.

I made the following minor changes to get it working for me and posted the script below.

  • Changed ‘wget’ to ‘curl -O’
  • Updated a couple of links that weren’t working for me
  • Updated sourceforge links to the east coast
  • Updated links to latest version of source code (as of today)
#!/bin/sh
curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.23.tar.bz2
tar jxvf libpng-1.2.23.tar.bz2
cd libpng-1.2.23
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/wvware/libwmf-0.2.8.4.tar.gz
tar xzvf libwmf-0.2.8.4.tar.gz
cd libwmf-0.2.8.4
make clean
./configure
make
sudo make install
cd ..

curl -O http://www.littlecms.com/lcms-1.17.tar.gz
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
./configure
make
sudo make install
cd ..

curl -O http://superb-east.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.61.tar.gz
tar zxvf ghostscript-8.61.tar.gz
cd ghostscript-8.61/
./configure  --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/current/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.7-1.tar.gz
tar xzvf ImageMagick-6.3.7-1.tar.gz
cd ImageMagick-6.3.7
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..

To test that ImageMagick was installed properly you can check the version number.

convert -version

[you should see something like this]
Version: ImageMagick 6.3.7 11/26/07 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

To test that ImageMagick is working properly you can run the following test. It will create a copy of the ImageMagick logo.

convert logo: logo.gif

Getting Apache & PHP to work with Leopard (OS X 10.5)

John Ford Oct 28, 2007

I ran into a snag today while trying to get the websites on my local machine running with Leopard. The first thing was that the config file in the new version of Apache is in a different location (/etc/apache2/httpd.conf instead of /etc/httpd/httpd.conf). Once I changed the settings I kept getting 403 Forbidden messages every time I loaded a page (the default in the new httpd.conf is ‘Deny from all’ for all directories). I finally figured things out and here’s what I did:

  1. Open the httpd.conf file for editing (sudo vi /etc/apache2/httpd.conf).
  2. Uncomment the line
    LoadModule php5_module     libexec/apache2/libphp5.so
    by removing the ‘#’ from the front of the line. This will enable PHP 5. The php5.conf file is loaded automatically from /private/etc/apache2/other/.
  3. Create a file called _sites.conf in your Sites folder. I like to keep my site configuration in the Sites folder to make it more easily accessible as I’m doing development.
  4. Add the following line to the very bottom of the httpd.conf file:
    Include /Users/yourusername/Sites/_sites.conf
    That will make Apache load all the configuration settings from your _sites.conf file.
  5. Add the following information to your _sites.conf file.
# Enable named virtual hosts
NameVirtualHost *:80

# Override the default httpd.conf directives.  Make sure to
# use 'Allow from all' to prevent 403 Forbidden message.
<Directory />
	Options ExecCGI FollowSymLinks
	AllowOverride all
	Allow from all
</Directory>

# A basic virtual host config
<VirtualHost *:80>
	# Add yoursite to your /etc/hosts file so you can
	# type it directly in your browser
	ServerName yoursite

	DocumentRoot /Users/yourusername/Sites/yoursite
</VirtualHost>

Now you just need to start/restart Apache and the sites should load. PHP should be working and no more 403 Forbidden message.

script.aculo.us Slider Demo : Update Text Field and Change Slider

John Ford Jul 16, 2007

For those of you using the script.aculo.us Slider demos I’ve just added a new one. Sometimes you may have a slider and a text field to show the value. This example lets you change the value in the text box and the slider will update to match the value.

Example: Change Slider Value by Changing Text Input Field

The Architect and Builder Dilemma

John Ford Dec 4, 2006

Blueprint
(Originally uploaded by sweetsexything)

One of the problems I’ve seen over the years, in corporations where I’ve worked and as a business owner, is the misconception that a builder (a developer in this case) can quote a project without the blueprints. I often times receive a request for a quote (10 pages long) and it says something like this:

We want a dynamic website with a unique design and easy to follow navigation that we can update ourselves.

That’s basically the equivalent of going to a car dealership and asking “how much is a car with wheels and doors?” Until you tell them the make, model, and all of the features you want they can’t give you a real price.

The Problem
The problem with this process is that the client and the developer both have expectations and a vision for the project but you’re not talking apples-to-apples. Sure, the developer can give a quote based on vague information but everyone loses during the process. The client loses because their expectations aren’t going to be met. The developer loses since they can’t possibly give a realistic quote. What do you do when you start working and the client expects the Ferrari (which they all do)? Both parties clash when they aren’t on the same page.

The Solution
Hire an architect. When I get a vague request for a quote I tell the client it will take a few hours of billable time and we’ll make a blueprint together. There is no reason for me to give a vague quote on a vague request. I’ll be quoting the Ferrari just to cover every possibility, and the client can’t afford the Ferrari. No one expects an architect to build a blueprint for free and it should be the same with a developer. Once the client has the blueprint they can send it out for quoting and will get apple-to-apple quotes back instead of a fruit basket.

No one is to blame for this misconception since the idea of web development is new and mysterious to most people. However, I challenge all developers to change things and educate the clients that come asking for help. They’ll appreciate the education, respect the architect idea, save money, save time, and you’ll prevent lots of future headaches.

script.aculo.us Slider Demos and Example Code

John Ford Nov 12, 2006

I’ve been following along the script.aculo.us Slider Demo discussion area recently and have tried to answer questions when possible. Since it’s difficult to post examples to the discussion I’ve compiled a more extensive set of Slider demos. Some are examples that I’ve wanted and others are in response to questions in the discussion area.

The demo code includes the following slider examples:

  • Standard Slider
  • Reversed Slider
  • Slider Controlled with Mouse Wheel
  • One Slider Controlling Multiple Sliders
  • Using Images to Spruce Up a Slider
  • Two Colored Slider
  • Submit the Slider Value in a Form
  • Use a Slider as a Scrollbar (added Nov 21, 2006)
  • Change Slider Value by Changing Text Input Field (added Jul 16, 2007)

It’s really amazing what you can do with the script.aculo.us library. Please let me know what you think!

Staying Healthy as Designers and Developers

John Ford Oct 19, 2006

I’m just getting back into the swing of things after returning from a 2.5 week business event overseas. These trips really take a toll on my body so I do my best to stay aware and focused on my health. As regular computer users we’re also abusing our bodies by sitting in front of a computer for hours at a time. It’s become the norm for many of us these days. Here are a few personal tips to help stay healthy and sharp.

Set It Up
Make sure your computer environment is as ergonomic as possible. There are a number of ways to setup and position yourself and computer to put less stress on your body.

Sleep On It
I know I’m guilty of getting hung up on something and not sleeping until it’s done. Of course, the next day I regret the long night and I’m less productive that day. When you feel yourself fading then take a break and sleep on it. I’m always amazed how often the solution comes to me as soon as I wake up.

Look Away
I asked my eye doctor for tips to keep my vision healthy. One recommendation was to regularly focus on an object far away from the computer. Apparently, your eyes start to adjust to the nearness of your computer. By looking away you can help counter it.

Eat It Up
Everyone knows how important diet is for overall health and well-being. Make sure you take time to eat good meals throughout the day. (Caffeine and sugar don’t count as good meals.) Your brain and body need nutrients to do their part.

Use some common sense and stay healthy when you’re using the computer. You’ll be more productive and your body will thank you.

What are some things you do to stay healthy?

Don’t Submit Your Site to 300+ Search Engines

John Ford Sep 20, 2006

If you ever see a product or website that offers a service to submit your website to hundreds of search engines, here are some reasons not to do it.

  1. Link farms
    As search engines continue to become smarter they often times penalize for having your website listed on link farms or similar sites. It is possible that a submission tool may submit your site to a link farm.
  2. Automatic submission
    Some search engines penalize or ban websites for being automatically entered by software robots. It only takes a moment to submit your website to a search engine so take the time to do it by hand.
  3. Google, Yahoo!, MSN
    A December 2004 report by Nielsen//NetRatings showed the audience reach of US home and work Internet users. The estimates shown below are users who searched on each site at least once during the month.
    • Google - 44.9%
    • Yahoo - 32.0%
    • MSN - 25.2%

Another thing to note is that the search results of the next most popular search sites were usually driven by Google, Overture (Yahoo), or MSN. For example, if you search at AOL then your results are from Google.

AOL Enhanced by Google

Since the very large majority of users search these major search engines then why waste your time with the little guys? It is more cost effective and better for your search engine ranking to spend the extra time submitting your website url to the major search engines listed above and to good Internet directories such as DMOZ.

What should you really be doing?
Blogging! I’ll touch more on the details in future posts but you need to start getting your voice out there. The viral aspects of self publishing and communicating with others has formed a wonderful marriage with Google and the like.