This toolkit was written by a guy down the road over in Chapel Hill, it seems. The idea seems to be to generate and configure MVC-structured PHP code with RESTful web access. Supports multiple apps with one installation. Works for me.

I grabbed the 0.20 release. It comes with a web-based front end that will mock up your initial application code. Unfortunately the javascript wasn’t working and it looked like it had a bad path to the embedded jquery library. Rather than kill myself researching, I switched to the git “edge” branch:

cd development/git
git clone http://github.com/recess/recess.git
  Initialized empty Git repository in /home/m/development/git/recess/.git/
git checkout master
  Already on 'master'

Now it seems to be able to find its css and javascript.

Next problem was with mod_rewrite. It just wouldn’t work. Time to troubleshoot… and fixed. In Recess’ defense, this was probably the reason the 0.20 release didn’t work well.

Next, I went to create an app. I had to change the permissions on the apps directory, as instructed, since I unzipped recess under a group for which apache did not have write access.

Next, I cranked through a model for one of my apps. WOW, now I have a full set of “routes”, URL’s with which to RESTfully access my model. This is looking nice… to be continued…

  • del.icio.us
  • Digg
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

mod_rewrite is essential if you’re going to write RESTful web services. Here are the steps I went through to troubleshoot my installation:

  1. Ensure you included mod_rewrite in your apache installation. For gentoo, you can use [eix www-servers/apache] – Gentoo’s apache2_modules_rewrite flag is enabled for apache, looks good.
  2. Test to see if it is being loaded. I created a dummy page phpinfo.php with the contents [<?php phpinfo(); ?>], to see what PHP had to say about it. Search for mod_rewrite – yep, there it is, good. If not, make sure it’s loaded in httpd.conf, the load line may be commented out.
  3. Now make sure it’s enabled for the path you’re using. The apache directive is [RewriteEngine On], and it has to be somewhere in your httpd.conf or an included file. In my case I use virtual hosts. According to Apache docs, I needed to add both of these to the top level of my virtual host directive:
    RewriteEngine On
    RewriteOptions Inherit
  4. The mod_rewrite rules I’m dealing with are all in .htaccess files. In that case you have to make sure you’ve turned on the switch that allows .htaccess files to override your settings. Basically, you’ll need [AllowOverride All] enabled for the path where you want to use .htaccess files.
  5. Finally, make sure your .htaccess settings and rules look good. Here’s an example I pulled from another good troubleshooting blog entry:
    cat .htaccess
     Options +FollowSymLinks
     RewriteEngine On
     RewriteRule ^alice.html$ bob.html
     RewriteRule ^bob.html$ alice.html

    It should force bob’s page to load when you request alice’s, and vice versa. Nice simple little test.

Once I went through this list, I was good to go.

  • del.icio.us
  • Digg
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

There is only one way I know of to get free functional legitimate SSL encryption for your web server, and that’s through StartCom’s StartSSL service. You can get a free “class 1″ certificate that will work out of the box in Firefox and Safari. Microsoft hasn’t added StartCom to IE, so people browsing to your site will have to specifically add StartCom’s authority certificate (instructions) (or ignore security warnings).

UPDATE: I am told as of Sept ’09, IE will include StartCom, yay! See comments for more…

Every year I have to renew my websites’ certificates, and the process is a bit clunky. Here’s a summary for next time around…

  • Sign up at the site; they will issue an [S/MIME client certificate] and “install it into your browser”; make sure you keep the stupid thing backed up, it’s the ONLY WAY BACK IN to your account! Here are backup instructions from their FAQ:
    Firefox: Select "Preferences" -> "Advanced" -> "Encryption" -> "View Certificates -> Your Certificates" and locate your certificate from the list. The certificate will be listed under StartCom Ltd. with "StartCom Free Certificate Member" as its name if this is your first one. Select the certificate and click on "Backup", choose a name for this backup file, provide a password and save it at a known location. Now you should either burn this file to a CD ROM or save it on a USB stick or smart card. Thereafter delete this file from your computer.
  • Every year, request to renew your S/MIME client certificate, as it expires; back it up to a safe place
  • Request to renew your domain certificate; provide a password; an ssl.key is generated
  • Use openssl to create a no-password key:
    openssl rsa -in ssl.key.passphrase -out ssl.key.nopassphrase
  • Grab the official StartCom certificates from https://www.startssl.com/certs/
    sub.class1.server.ca.pem
    ca.pem
  • WAIT for confirmation of your certificate (you’ll get an email)
  • Return to the website, log in, go to Tool Box -> Retrieve Certificate, save as ssl.crt
  • Set up apache to use ‘em!
        SSLEngine on
        SSLCertificateFile /path_to_certs/2009-2010/ssl.crt
        SSLCertificateKeyFile /path_to_certs/2009-2010/ssl.key
        SSLCertificateChainFile /path_to_certs/2009-2010/sub.class1.server.ca.pem
        SSLCACertificateFile /path_to_certs/2009-2010/ca.pem

That’s the basics but it should be enough to help me through annual renewal. *sigh*…

  • del.icio.us
  • Digg
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

My Forms for Portals project is a simple collection of forms to help you quickly access google, dictionary, wikipedia, imdb, maps, yellow pages, etc. from your own web pages. I’ve mentioned my portal before, hopefully the new article makes it all easily digestible (and yummy!). It’s a reaaally oldskool approach, yet still pretty useful IMHO.

And just so I’m eating my own dog food…

I recently discovered [mod_deflate], which compresses webserver content before sending it out – if you’re not using it you should really check it out. I turned it on and it worked flawlessly for me, with two exceptions.

  1. Server-side includes
    These just did not play well together out of the box…
  2. PHP and Perl “streaming” output
    I have some scripts, most notably imagescraper, that need to stream the html in the results page as it is computed, not all at once AFTER it is built, as mod_deflate requires.

Turning off [mod_deflate] is trivial. I used the no-gzip environment variable as follows:

# MDM This is to disable [mod_deflate] for imagescraper, so we don't try to compress the streaming results...
<Files images_google.pl>
    SetEnv no-gzip 1
</Files>

# MDM Drop this into a virtual host block to TURN OFF [mod_deflate], so it doesn't break SSI.
SetEnv no-gzip 1
  • del.icio.us
  • Digg
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati