Code Blue /

What?

Code Blue is a web content management system.

Introduction

The raison d'etre of a web site falls into one of two categories: 1) information sharing, and 2) service provision, often ending up as some mixture of the two. Code Blue addresses the first category, and employs XAMPP and Ruby on Rails to address the second category.

The primary objective of Code Blue is to condense the production of content oriented web sites to the least possible quantity of labour:

  • site map definition (optional)
  • content definition
  • content population
  • content placement, i.e. template design (optional)

Here, web site creation is reduced to tasks that are inescapable. No further reduction is possible at any level of the production process, a fact that is independent of the platform being used, hence this is the quickest production route achievable. Note that in Code Blue the first and fourth steps are optional, though they are undertaken in almost all projects.

The secondary objectives driving the development of Code Blue are to remove the struggles associated with development and re-design of custom templates, and to minimize the complexities involved in the hosting and administration of multiple web sites.

Content URL Mapping

This is the heart of Code Blue. After years of web development, I found that all of my personal web site projects were content oriented, meaning they focused on content rather than applications. Each of my web sites was geared towards the collection, organization, and display of content. Eventually, as described in the Why section below, I set out to consolidate all modes of content display that I required, and the result was content URL mapping.

The reason that content placement is optional in Code Blue is content URL mapping. If no custom URL paths are defined for a content type then Code Blue automatically makes content available via a specific set of URLs. A reasonable description of Code Blue's approach to content management might be to say that Code Blue does for web content what Rails does for web applications (though Code Blue is nowhere near as comprehensive in its domain). Rails provides a quick and elegant method for creating web applications, and Code Blue provides a quick and elegant method for creating web content. Rails URL routing facility maps URL requests to controllers, methods, and values, while Code Blue's content URL mapping facility maps URL requests to content types, fields, and values. For example: Rails routes the URL /blog/view/Nori to the method view() inside of the controller BlogController, passing it the parameter 'Nori', and Code Blue maps the URL /blog/title/Nori to the ContentItem model via the ContentController, instructing it to search the database table containing content items of type 'blog' and display the database row where title = 'Nori', or display a list of all titles containing that word if there are multiple results for that term.

There are two types of content URL mapping: field and date. Field mapping handles URLs in one of the following formats:

  • /<content type name>
  • /<content type name>/<database field>
  • /<content type name>/<database field>/<value>
  • /<content type name>/<database field>/<value>/<id>

For example:

The final example includes the number 266 in order to specify the id of the database row to be shown. This URL scheme is used to display a particular database row in the case that the URL for the value 'noam chomsky', /quote/who/noam-chomsky, returns multiple results, or if the database value contains special characters that can not be used in a (pretty) URL. Appending the id to the end of the URL is the preferred solution for reasons of SEO and interface design: 1) the name of the field being viewed is always retained and thus remains available to search engines and users who are visually scanning the page, allowing both to determine the full context of the information being viewed, 2) keywords in the URL remain in logical priority sequence, and 3) the URL format remains consistent across mappings, as opposed to embedding the id somewhere within the URL.

Date mapping is a special case of field mapping, handling URLs in one of the following formats:

  • /<content type name>/date
  • /<content type name>/date/<YYYY>
  • /<content type name>/date/<YYYY>/<MM>
  • /<content type name>/date/<YYYY>/<MM>/<DD>
  • /<content type name>/date/<YYYY>/<MM>/<DD>/<content item title>

For example:

In all mappings above, if the data specified in the URL maps to a single result then that result will be displayed directly, and if the data specified in the URL maps to multiple results then an index page will be displayed, linking to all results.

In addition to field and date mapping there are two aliases for commonly accessed items: newest and oldest, whose URLs are structured as follows:

  • /<content type name>/newest
  • /<content type name>/oldest

For example:

A good example of content URL mapping at work is the 'music' content type found on the Something About Midnight web site. Something About Midnight is an internet radio show that I host with a high school friend of mine. The web site contains an archive of episode playlists, and if you visit the music index page, you'll see a list of the publicly accessible fields in the database table that contains music content items. System fields such as 'created_on', 'updated_on', and 'precedence' are not publicly accessible via the front end, and custom fields may be hidden or prohibited from display as needed. Here you see a number of fields that correspond to data typically associated with a song, such as artist, credits, label, producer, and year. If you click on any of these fields, for example producer, you'll be presented with a list of all values for that field as found in the database. If you then click on any of the values for producer, for example Masters At Work, you'll be presented with a list of all music content items where producer = 'Masters At Work', displayed by title.

Using content URL mapping, the process for making new content available via the web is as short as possible: 1) create a database table, 2) populate data in the table. Now the new content is accessible online using any of the content URL mappings described above.

Simple ideas are often the best, and as far as ideas for the structured congruence of content with SEO friendly URLs go, content URL mapping is about as direct of an idea as it gets. The ContentItem model is the interface to all content; there is no need to develop and maintain an individual BlogController, Mp3Controller, ImageController, ProductController, and BookController - they're all in the ContentController.

I suppose if I needed a confusing marketing catch phrase I could say that Code Blue is a 'web content delivery framework', because it's a platform for building platforms (web sites) that deliver content. Luckily, I don't need a confusing marketing catch phrase.

Template References

Content, project, and application data is made accessible in the front end via template references, as defined by Code Blue's template DSL. The DSL provides all commands necessary for content access, content placement, and text transformation, and can be extended in a project specific manner with the use of template callbacks. Template references are converted into data values by the TemplateParse controller, and are not processed using Rails' render() family of functions. As a result, templates do not contain conditionals or iterators, and complete separation of processing logic from presentation is achieved.

The format of a template reference is as follows:

  • {<type>:<data field 1>:<data field 2>: ... :<data field n>}

The <type> segment indicates the class of information that will be parsed into a reference. Available reference types are as follows:

  • c - CONSTANT
  • i - CONTENT_ITEM
  • g - CONTENT_GROUP
  • d - DATA
  • f - DATABASE_FIELD
  • l - LINK
  • m - METHOD
  • p - PAGE_DATA
  • t - TEMPLATE
  • v - VARIABLE

The number of data fields used varies on a per <type> basis. For a full description of the data fields employed by a particular reference type, refer to its parsing method.

For example, the following template reference refers to the content item of type 1 with database row id 78:

  • {i:1:78}

Alternatively, the same template reference may be written using 'tags', which are mnemonic strings associated on a one-to-one basis with content items, project pages, and templates:

  • {i:blog:dogma}

In closing this section, rather than duplicating the explanations here, I'll link to the RDoc documentation for the methods with the most informative comments:

Functional Overview

Code Blue tries to stay away from the structural constraints of a monolithic environment. Relative to the popular software packages that one normally associates with the term 'CMS', the feature set of Code Blue is, and will remain, modest. The goals and features listed on this page will in all likelihood forever comprise the full functional scope. The fundamental approach to web site development taken by Code Blue is enablement, not imposition: equip the user with a solid foundation, supply intelligent defaults, and allow the user to do what is best in every situation by permitting external functional extension.

Projects

  • Multi-site hosting

Content

  • Scheduling
  • Re-usability
  • Rapid Data Typing
    • Unified data typing: all content is interfaced using the same API; no need to develop and maintain multiple data models or integration points
    • High performance data model: each content type is stored in its own table and may thus be indexed on the most relevant fields
    • Transparent data model; simple data import/export; simple wholesale migration to/from Code Blue
  • SEO Friendly URLs
    • Content is automatically available via Content URL Mapping; standard and obvious conventions are used: content is browseable by all fields; no development effort required
    • The complete process for making content web accessible is as follows:
      • Content definition
      • Content population
      • Optional: template creation

Templates

  • Re-usability
  • Page and Content Caching
  • Rapid Templating
    • All content is accessible using a single, simple, powerful DSL; no need to develop and maintain multiple command sets or utilities on a per content type basis
  • MVC Separation
    • Complete separation of processing logic from presentation: the template DSL consists only of commands for content placement and text transformation
    • Templates contain design information only, and remain highly readable; code remains modular, and highly readable
    • Designers can not influence the functional operation of the system

Security

  • The front end is contained in one database and vendor applications are contained in another; content and template data is configured as read only, thus bugs in the platform will not result in alterations to the front end or its data

Development

  • Uniform platform environment across all tiers (test, production, et al.), thus eliminating problems of consistency
  • Idempotent data promotion processes
  • Seamless integration with third party applications and modules; PHP and Perl integration via XAMPP; custom application integration via Rails
  • Written entirely in Rails - models, controllers, libraries, command line utilities - in order to increase portability, reusability, and maintainability

Documentation

Documentation is available in RDoc format.

For those taking the time to review the RDoc documentation, I'll make a housekeeping note: I've refactored Code Blue 20 times. At least. This project is my first foray into Rails, and as far as personal projects go, it's a rather large foray. I've refactored the entire system numerous times as my understanding of Rails has grown and the problem domain has become more evident. Since I first began work on Code Blue I've had a ticket open devoted solely to the management of refactoring. As of February 2008, it contains 29 to do's. As a result of this endless refactoring there may be some discrepancies in the RDoc snapshot, but I've reviewed it a few times and the comments appear to accurately reflect the functionality.

Top

Code Blue /

Why?

Because

Code Blue is the intersection of three goals: 1) engineer a web content management system that fits the nature of my web sites and my workflow, 2) learn Ruby on Rails, and 3) develop a tool I can apply to charitable services.

Content Management

I'm interested in many things, one of which is software architecture, and in particular, software engineering for the web. Accordingly, when I first began web programming, a natural outlet for the expression of my other interests was in the form of web sites, and through this I discovered the appeal of content management. As the years passed by, my multiple interests spawned multiple web sites, each bringing the opportunity to learn and explore new technologies. An enlightening experience, to be sure. But the flip side of the enjoyment that came with research and development of independent technologies was an increase in maintenance overhead, and I found myself managing several independent platforms. As life advanced inexorably towards infinity, I found less time to spare for maintenance, and I long ago lost interest in the administration of multiple systems based on already familiar technologies.

It was first in 2000 that I dreamt of creating a multi-site web CMS, but the checks and balances of capitalist life saw to it that such a dream was not meant to be realized in short order. As the second half of 2005 approached I found myself continuing to work piecemeal on my three primary sites - Risto.NET, Something About Midnight, and MOFOs Dragon Boat - as well as a host of smaller projects, duplicating a feature here and replicating a bug fix there. Not a propitious use of time. Each web site was built atop a core system that I had been expanding upon since 2000 (a semi-organized collection of utilities and third party applications I had aggregated, based in PHP / Perl / Bash / MySQL / Apache - this project was later dubbed "Code Blue 2000"), but each web site also possessed a significant amount of custom code, often with custom hooks into the shared core. The familiar and inevitable results of insufficient time; precisely what I had been hoping to avoid. I froze development on Code Blue 2000 and began to pursue the new Code Blue: a multi-site web CMS, geared towards developers; a single system delivering a core set of features across all web sites - the only difference between a development environment and a production environment would be the host name, content would be controlled by one generic data model and made automagically available via SEO friendly URLs, the core would remain lean by allowing for project specific functional extension via content callbacks and template callbacks, template development and content placement would be simplified using a concise template DSL, and all of these would combine to minimize development, maintenance, and time to market, as well as standardize hosting and administration (and everything else listed in the What section of this page). Convention, not configuration.

I began to work on Code Blue during every spare moment I had outside of work. It was incredibly slow going. The upper boundary of my day job as an engineer was rarely eight hours, and combined with the travel time to work I was left with little spare time or mental energy to devote to even more engineering. But I was driven by ideas, and found myself ruminating on data models in the shower, making notes on the train, and creating prototypes late into the night. For the first time in my life I drank coffee. Oooh, I know, big deal. Not in obscene amounts, yet still a significant change for me, since I had avoided it for three decades. But I digress. I examined each of my web site projects and compiled an exhaustive list of features, then isolated the commonalities and differences, and prioritized all line items. The resulting lists were huge. Features in the common list would be built into the core of Code Blue, while features in the differences list would be built as generic plugins or project specific callbacks. Each list was translated into its own project in my ticket system, Mantis, and each ticket was assigned to a project version. The result was six projects; the CMS itself: Code Blue, and five web sites that I would develop using Code Blue: Compsci.ORG, Juola.NET, Risto.NET, MOFOs Dragon Boat, and Something About Midnight.

Finally, the time had arrived: coding hour.

If you're interested in learning more about the progression of Code Blue from this point, there are more details in the When section of this page.

Learning

I might have dispensed with this earlier, but I felt the point best suited to this section; in answer to the question "why not use an existing CMS?" there are two responses: 1) I researched and tested some of the more popular packages and the result was analysis paralysis, and 2) I was eager to create my own CMS in order to experiment with Ruby and Rails and create something to fit my needs.

My excitement is stirred by learning. Intellectual expansion and introspective consciousness are two of the most astonishing gifts we are adorned with. I enjoy reading most anything I can get my hands on, in the hope that I can accumulate some small amount of knowledge to help fill the yawning chasm that is my brain. Outside of technology, I enjoy reading philosophy, history, politics, psychology, science, and religion. The depth of human experience available is awesome in every sense of the word. To this end, Code Blue has provided me with increased opportunities for learning, in more than one way.

Firstly, and most obviously, I've been able to exercise my abilities. Since 1996, I've worked with many technologies, operating systems, hardware platforms, programming languages, and design approaches, and I've genuinely enjoyed being involved in all aspects of every project: research, administration, implementation, QA, interface design, and project management. Involvement in these roles has been rewarding, and Code Blue has afforded me the chance to apply and improve upon the lessons I've learned. And of course, even though I've worked on many (many) similar projects, it's always satisfying to implement a project based on my own specifications.

Secondly, I now have more time to learn. I've come to accept that I bear a need to collect and organize the data that is my life, and now that I use Code Blue to develop and maintain my sites, I spend less time administering and more time learning. The effort required has been reduced to the smallest possible target: adding new content. Having developed and standardized the essential processes and structures, the only task left is to use them.

Technology should be a boon to personal development, not a burden. Code Blue 2000 long ago reached the point of burden. The new incarnation of Code Blue incorporates the lessons I've learned, and provides me with a system of organization that fits my needs. The more I learn the more I wish to learn, and consequently, the greater the amount of content I produce. Code Blue furnishes me with a rich environment for the collection of my thoughts, and the cultivation of my creativity.

Regarding the selection of Ruby on Rails: a number of languages (Python, Perl, C++, Java, PHP) and web application frameworks (Catalyst, Mason, Nitro, Django, Plone, Zope, Drupal, Typo3, WT, CakePHP, PRADO, Code Igniter, Symfony, ZF, and many others) were reviewed and/or tested, and Rails was found to stand head and shoulders above the rest. Further discussion of this choice can be found on Risto.NET.

Charity

During high school, the notion of charity outside of helping friends was not on my radar. During university, I began to contemplate donations of time and zakat, but I was still trying to figure out what the hell was going on in the specific study of computer science and in the general arena of life. In every professional position I've held after university I've had the intention of performing charitable service, but I've repeatedly come up against the same two obstacles: 1) I needed to spend after hours recovering from work hours, and 2) predatory capitalist technocrats are not amenable to anything they perceive as a threat to profit (note that I'm specifically not talking about things that constitute an actual threat to profit, I'm talking about things that people senselessly view as a threat to profit). In three separate jobs, I've presented the idea of incorporating charitable service into the work week with no expense to the employer in the hope of engendering a charitable mindset into the office culture, for example by shifting my lunch hour to act as a recess monitor or crossing guard at a nearby public school (in all cases my first obligation has been to honour the contract between myself and my employer, and in this particular case shifting my lunch hour presented no conflict, as I was in an engineering role and the time of day at which I programmed had no bearing on my output, and meetings and on-call were also not a concern), but in each case the employer stood rigid. Not acceptable.

The reality is that we in the West live under the direct rule of capitalist democracy (while those elsewhere live under its indirect rule), and we must respect the influence of this structure on our lives. Often we must work as an apparatchik in an unsatisfying job in order to live. However, it is also incumbent upon us to determine at what point we can say that our wealth exceeds the limit of our material needs, and thus determine the point at which we can begin to look out for someone else's needs - towards the end of empowerment, not mere entertainment or increase of wealth for the already over-privileged. It's tough to be objective about this in an autocratic materialistic society, and to break the cycle of perform-mind-numbing-task-buy-ostentatious-amusement. This problem must not be understated, and the issue at hand is not merely whether or not one has amassed enough capital to venture beyond the confines of day labour while continuing to operate as a capitalist. The significance of charity does not lie solely in its application, but also in the recognition that the contemporary needs of charity furnish us with evidence of the human crisis born of totalitarian capitalism. Charitable service is indispensable, however we must understand that it is but a step in the march towards balance, and not a permanent solution in its current form. Social equality in the context of capitalist democracy works by extending acceptance and support to one social group at a time, and thus presupposes that the problem is how best to integrate social groups within our perfectible administrative systems. This however is not a deep solution; social groups continue to be isolated by resource competition, and there always remain groups outside of the support system. As a result there is no economic or moral transformation, whether inside or outside of the system. Oscar Wilde exposes this circumstance in his essay "The Soul Of Man Under Socialism", observing that the altruistic

very seriously and very sentimentally set themselves to the task of remedying the evils that they see. But their remedies do not cure the disease: they merely prolong it. Indeed, their remedies are part of the disease. They try to solve the problem of poverty, for instance, by keeping the poor alive; or, in the case of a very advanced school, by amusing the poor. But this is not a solution: it is an aggravation of the difficulty. The proper aim is to try and reconstruct society on such a basis that poverty will be impossible.

The extension of liberty must work towards the goal of universal freedom and mutual aid, not simple economic detente between competing social groups. As Irving Horowitz explains in his introduction to The Anarchists,

mutual aid, while sharing many properties of altruism, differs from the latter since altruism implies ... surrender of self in an egotistical milieu

Peter Joseph notes that many contemporary social activists

are operating within a myopic understanding about what the actual problem is. Just like all other elements of society, the "Truth Movement" has created factions, which, out of ego, serve to compete rather than unify ... Religion, Race, Class, Patriotism and all other arrogant notions of dominance and separatism is the actual problem. We must understand as human beings that our religions, races, classes, nationalities, and even fear, greed and arrogance itself are learned associations. They are no more a part of you than the clothes you have on, and you are free to take them off at anytime and discover who and what you actually are.

Thus,

the framework of the free society will be created by the very process of class struggle, as working class people create the organisations required to fight for improvements and change

The final quote given above begins to stray beyond the scope of this document (and I can see how one might feel it is more than a little disjointed), and so for further information I'll refer the reader to the compendious Anarchist FAQ, from which it originates.

Using my group of friends as a baseline, I can say that I have an average amount of assets. I'm nothing close to 'rich' by any capitalist standard, and indeed many of my friends are considerably more affluent than I. I've never experienced poverty, but I must admit that the experience of my father, who once lived in a plywood shack during winter in Finland, has thus far motivated me to steadily apply myself in capitalist pursuits with the goal of ensuring an enduring quality of life for myself and those around me. However, in my estimations, I've reached a point at which I can afford to put the bulk of my efforts towards a job whose primary objective is morally conscious action and an increase in general social welfare, without endangering the future welfare of my family.

A large part of my motivation in the production of Code Blue is the idea that I can use it to contribute to the spread of humanistic intentionality. I've now found the answer to my long standing question, how can I best help? The answer is Code Blue. Most, if not all, organizations need a web site. There is no technology better than a well designed web site for information collection, management, and dissemination. In the minimal discussions I've had regarding charity and NPO web site projects, it seems that much of the pro bono help available is from students, who are often unable to help beyond a certain experience level, or may even have a negative impact, with inexperience resulting in poor decisions and wasted resources. How better for me to help than to apply over a decade's worth of web experience? I can provide professional engineering and project management services, explain what is possible and what is not, guide efforts in useful directions, and steer organizations clear of profitless labour. All the while doing something I enjoy on multiple levels. The benefit is mutual.

My rough plan is this: 1) complete enough of Code Blue to implement web sites [done, as of 2008 01 14], 2) migrate my web sites to Code Blue and test the platform, fixing bugs and adding features as appropriate [2008 01 15 - ?], 3) once Code Blue possesses a reasonable and stable feature set, approach organizations and engage them in conversation to discover their needs, describe my services and their limits, and determine if Code Blue and I are a match for them. It might be a good idea to expand on point 3, and so I'll include the following addendum: I will not be approaching organizations and offering to perform any and every technical service they need, as it is best for everyone involved that the scope of each project remains realistic - but with that being said, I will always be open to the possibility of extra work beyond the implementation of a content oriented Code Blue based web site.

The future is Blue.

Top

Code Blue /

How?

Code Blue is built on top of the following technologies:

Linux

Linux is a Unix-like computer operating system ... typically all underlying source code can be freely modified, used, and redistributed by anyone ... Predominantly known for its use in servers, Linux is supported by corporations such as Dell, Hewlett-Packard, IBM, Novell, Oracle Corporation, Red Hat, and Sun Microsystems. It is used as an operating system for a wide variety of computer hardware, including desktop computers, supercomputers, video game systems ... and embedded devices such as mobile phones and routers.

XAMPP

Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.

Mongrel

Mongrel is a fast HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI.

Ruby on Rails

Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. From the Ajax in the view, to the request and response in the controller, to the domain model wrapping the database, Rails gives you a pure-Ruby development environment. To go live, all you need to add is a database and a web server.

Top

Code Blue /

When?

Release Schedule

v0.6 Beta : 4th Quarter 2008

v0.6 Alpha : 1st Quarter 2008

v0.5 Alpha : 2nd Quarter 2007

v0.4 Alpha : 1st Quarter 2007

v0.3 Alpha : 3rd Quarter 2006

v0.2 Alpha : 1st Quarter 2006

v0.1 Alpha : 3rd Quarter 2005

The Past

Code Blue's development history provides a high level outline of the application environment and functionality, with a timeline.

The Future

Code Blue's ticket based roadmap gives an idea of the project's trajectory, with no timeline.

A note on the roadmap: I use Mantis to manage my software projects. Permit me here to address all well meaning Tracophiles: Trac is great, but Mantis fits my needs - although when I first began using Mantis in 2003 there was no roadmap utility available (there still may not be), and so I hacked something together to allow me to organize my tickets by category and version. The roadmap linked to above is the output of my Mantis roadmap utility, excluding tickets that are closed or unassigned. The roadmap snapshot above is from January 29th 2008, at which time there were 87 active tickets. Viewing the roadmap will give an idea of the manner in which tickets are created, and hopefully give some meaning to this number.

Top

Code Blue /

Where?

Web sites running on Code Blue:

Compsci.ORG

My software projects.

DNA - Penthouse Suite 912 - 1005 King Street West

Real estate web site, for the sale of my condominium.

MOFOs Dragon Boat

Home page of the MOFOs dragon boat team.

Risto.NET

My home page; an outlet for the organization of my thoughts and experiences: my blog, my beats, my gallery.

Something About Midnight

Something About Midnight internet radio, hosted by DJ Risto and DJ Pete. Something About Midnight focuses on the sound of the underground - Garage House music.

Top

Code Blue /

Who?

Code Blue is developed and maintained by Risto Juola.

Top