An Alternative to symfony’s schema.yml

The symfony web framework provides two methods for building the database model files when using the Propel Object-relational mapping (ORM) toolkit. The recommended method by the symfony team is to use the schema.yml file, where you explicitly explain your table structure. The second method is to generate a schema.xml file directly from the database.

schema.yml:symfony schema yml

Just edit config/schema.yml and list your tables, columns, column types, and foreign keys in YAML form. Build the model files by running:

./symfony propel-build-model

Pros:

  • Interfaces better with plugins because most, if not all, plugins use the schema.yml method
  • Can be used to create the database tables
  • Overall easier to use because it is the most common method

Cons:

  • Requires duplicate data by having the database structure in a text file, which can be outdated when the database is updated directly

schema.xml:

To create the model files simply run:

./symfony propel-build-schema xml
./symfony propel-build-model

Pros:

  • Supports ALL  database features
  • Supports the most complex schemas

Cons:

  • Errors while building the XML file are cryptic and time consuming to track down (eg: om-template)

Comparison

The schema.yml method supports most projects with relative ease, but is limiting if you need to use more advanced database features that are not supported (propel only supports limited column types). Although, there are tricks to get around these limitations. For example, if you need to use column types that aren’t supported, like ENUM, you can simply declare the column as a varchar and Propel won’t know any better. This works fine for ENUM because it’s simply a text field, but may work for other column types too.

I recommend the schema.xml file for projects that have a very complex schema that cannot be represented in the yml file, or for projects already using XML files to define the database scheme.

I have used both methods on different large projects and have found the schema.yml method to provide faster  application development, have more developer support, and easier to work with. I full recommend use of the schema.yml method in all but the most exceptional projects.

Accelerated CSS Transforms

Recently the WebKit team added support for CSS transformations with 3D GPU acceleration. This means that soon we can built web applications that mimic desktop applications in graphical responsiveness. Charles Ying wrote a simple image gallery application that demos this new functionality.

This is definitely not yet ready for end users but it demonstrates the power of the web platform and where it is heading. With the native video tag, local and session storage, plus much faster JavaScript engines, browsers are changing from simply presenting information to being a fully interactive platform. It’s no surprise that Google is developing a web-browser operating system, called Chrome OS.

It is also quite encouraging to see the second browser war bring fresh ideas and increase the possibilities to the browser. Competition is great.

Demo of CSS Transforms
Snow Stack in WebKit Nightly r46091

The CSS Transforms were originally created at Apple by Dean Jackson, David Hyatt and Chris Marrin for the iPhone. Apple then improved the spec and submitted it to standardization at the W3C. Firefox 3.5 supports 2D css transforms but does not yet support the newer accelerated 3D animations.

So how does it work?

The images are put on the page using standard CSS and HTML, and they are then animated by JavaScript using these CSS properties:

-webkit-transition-property: -webkit-transform;
-webkit-transform: rotateY(45deg);
-webkit-transition-duration: 2s;

The transition property is set to transform, the transform is set to rotate the image in Y-space by 45 degrees, and the duration is set to 2s. With that, the web browser will take the current position of the image and rotate it by 45 degrees in 2 seconds, which produces an animation effect. How beautifully simple it is!

The Importance of the HTML Video Tag

Since Firefox, Safari, and recently Chrome hit the browser scene, the web has been growing and improving at a much faster pace. The next evolution of the web comes in the form of HTML 5, the latest HTML standard that brings native video playback, offline storage, 2D drawing via the canvas tag among others features. Of those, the video tag is the most important and critical to the continued success of the open web.

Native video playback inside a web browser will now be as simple as embedding an image into a page:

<video src="http://example.com/yourvideo.ogg" controls></video>

The benefits of this are immediately obvious to any software developer. It’s a native tag so it fits in much better to the web platform, it can be controlled through JavaScript, and no more messing around with a black-box flash embed. Side benefits of this are bringing video to all users, not just the platforms that Flash supports (stable 64 bit version + iPhone version).

So far only Firefox 3.5 and Safari 4 have built in support for the video tag; Opera and Chrome support is in the works.

The web has flourished and grown to where it is today because it is based on open standards and because it is not controlled by any one company or organization. Lets continue to keep the web open and successful by using the new video tag.