Thursday, April 16, 2015

Using Apache's Swiss Army Knife - mod_rewrite for RESTful endpoints (part III)

This is the last blog in my series on Apache's mod_rewrite.  In my previous blogs I've explained a little bit about how you can use this Apache module to redirect URLs both internally and externally.

Using Apache's Swiss Army Knife - Part II

I've provided a few examples and talked about some of the gotchas that I've encountered.  Today we're going to discuss how to use mod_rewrite to provide an API endpoint that is an alias for your web server's name without creating another virtual host.  In most cases, it makes sense to create another virtual host configuration file to implement your application API, however in the event you don't have access to Apache's configuration files, you can use mod_rewrite rules in an .htaccess file to achieve nearly the same operations.


Monday, April 13, 2015

Serving up POD & The five Cs of Good Documentation

I'm a fanatic about documentation.  As a developer that has been involved in creating tools for other developers all my career, I understand the importance of good documentation.  Creating good documentation is not easy, which is why so few people write good documentation.  Here's an easy to remember grading system for your documentation.  Does it meet the five Cs test?

 Is your documentation...

  1. Correct
  2. Complete
  3. Comprehensible
  4. Current
  5. Convenient

I probably don't need to go into too much detail here, but if ain't complete, correct, comprehensible and current it may be worse than no documentation at all.  If it ain't convenient it really doesn't matter how correct, complete, comprehensible or current it is, now does it?  It's not easy meeting all 5 Cs all of the time.  Most likely your documentation will transition through various permutations of those Cs during the software development lifecycle.  So how can we at least make our documentation more convenient and accessible and at least allows us to make an attempt to meet the 5Cs?

Thursday, April 9, 2015

What happened to MySQL TIMESTAMP columns?

Imagine you are using MySQL for some application (not so hard to do) and you're running successfully on version 5.x.  For some reason you are forced to, or decide to upgrade to 5.6.  As always, version upgrades of your software's dependencies should be done with your eyes wide open and your tests ready to run.  As the title of this blog entry suggests, MySQL TIMESTAMP column behavior has changed is some dramatic ways.

Monday, April 6, 2015

Using Apache's Swiss Army Knife - mod_rewrite (part II)

This blog was supposed to introduce some tricks to allow you to create a new subdomain for your RESTful endpoints, but I think before we launch into more details about creating your RESTful API endpoints I should share a few relevant discoveries regarding using mod_rewrite that might be of interest.

Saturday, April 4, 2015

Using Apache's Swiss Army Knife - mod_rewrite for RESTful endpoints

As I've been exploring using Bedrock for creating RESTful APIs, one of the requirements for a well crafted API is to create appropriate URIs that make sense.  I've read the phrase "you don't write RESTful APIs you DESIGN them" in more than one blog.  This usually boils down to exposing the API in a logical and hierarchical manner.  Apache's mod_rewrite is a versatile and useful tool for allowing you to create meaningful, well crafted endpoints that also work with Bedrock.


Sunday, February 1, 2015

<include --optional>

Bedrock 2.4.1-10 now includes a new option of the <include> tag.  The new --optional argument, will prevent Bedrock from throwing an exception if your include file is not found.  This might be useful for those situations where you might want to conditionally include a file.

<include:foo --optional>

There a couple of old school ways of achieving the same thing.

<if -e --file ($config.INCLUDE_DIR + '/foo.inc')>
  <include:foo>
</if>

or

<try>
  <include:foo>
<catch>
</try>

Either way you slice it, the old school way seems forced.  The --optional tag is admittedly syntactic sugar, but a welcome sweetener!

Cookieless Sessions - Automatically Login Your Users

The default Bedrock persistence store, implemented via the $session object has the ability to create a token (session identifier) you can use to automatically log your users into your applications.

This is a useful feature for resetting passwords and perhaps creating convenience links for fast access to application specific pages that would normally require a user to login to the application.  Here's how it works...