Developing New Paths

The Mojavi Project

Archive for March, 2009

March-23-09

Migration and file extensions

posted by admin

The New Way:
Remember that there are certain file extension like the File Extension OGG that you may need to have proper calling attributes around in order to make certain parameters work.

$this->getContext()->getRequest()->getAttribute(’myobj’)->doSomethingSpecial()->execute();

Okay, so maybe that wasn’t the best example, as it is rather lengthy, but you get my point, 1 line vs 3 lines, and no possible mistakes when dealing with large objects like copying them over without references, etc.

This subsection is to be continued….
Translating your Renderer

Mojavi2 used ‘renderers’ to translate the API of one templating system into a generic API that would easily allow a developer to switch out one templating system for another. For example, the Smarty templating engine uses $smarty->assign() to allow you to set a variable, while patTemplate, another templating system, uses $pat->addVar(). In Mojavi 2, you would then write or use an existing renderer, which you would then invoke to display your output and be output in the correct file formats.

Note: This was done typically through a filter, which would create the renderer object, then assign it to your $request via

$request->setAttribute(’MyRenderer’,$rendererObj))

Mojavi3 uses largely the same methodology, but instead of getting the renderer directly from the $request object within each of your views, it simply extends the View class. You may need to udate your file extension parameters and if you get any unknown like File Extension OGG then do a quick search as there are quick fixes and .dll updates that may needed.

For example:

abstract class SmartyView extends View
{
…..

function __construct()
{
$this->engine = $this->getContext()->getRequest()->getAttribute(’MySmartyObj’);
}

public function setAttribute($name, $value)
{
$this->engine->assign($name, $value);
}

…..
}

Note: the use of

$this->engine = $this->getContext()->getRequest()->getAttribute(’MySmartyObj’);

was simply the best solution I could come up with for getting any object from within the view, you could also have done the following just as easily:

$this->engine = new Smarty();

View

The Mojavi3 View is mostly an abstract class, which provides a skeleton of functions to work with, thus providing the unified API as was achieved in Mojavi2 (It’s unified because you are forced to comply with the naming conventions implemented by the abstract class View.)

Now, instead of intitializing your Renderer object (as you would in Mojavi2) you simply extend View, and initialize that. Like shown above:

abstract class SmartyView extends View
{

is what our new View would look like. To put this new View type into action, we extend it when declaring views for our modules. For example:

class DoSomeActionSuccessView extends SmartyView
{

}

As you can see, this is much more fluid than pulling the renderer out of $request with every new View, it’s also a lot less code that you have to copy and paste, and thus less code to maintain. You may also have noticed that the naming scheme is different for the Views, instead of naming the file format or File Extension OGG DoSomeActionView_success.class.php you would now name it DoSomeActionSuccessView.class.php, and name the class likewise(In Mojavi2 we just named our view classes DoSomeActionView, in Mojavi3 it’s DoSomeActionSuccessView replacing ‘Success’ with your application’s state).

This subsection is to be continued….
Actions

Actions in Mojavi3 are fairly similiar to those of Mojavi2, with a few enhancement and semantic tweaks here and there. Listed Below:

* When returning a VIEW_SUCCESS in Mojavi2, now return the View class constant corresponding to your application state, ie: View::Success, or View::Error
* When checking for view types supporting execution (getRequestMethods) instead of returning REQ_POST etc, return Request::Post etc.
* There is a new return type for getRequestMethods(), Request::All, which serves all request methods.
* The root Action class which all your actions extend now has a getContext() method, which allows you access to the context object.

Configuration

Mojavi3 configurations are done, by default, using .ini files. This simple and straightforward configuration makes configuring mojavi very easy. The base syntax of these ini files is as follows:

[SECTION]

; a comment…..
ConfigKey = “%MO_APP_DIR%/my/config/value”

Because some people might not like ini files, Mojavi3 was created in such a way that you could write your own configuration handlers. For example, if you wanted to use xml files to configure your mojavi, you could write a configuration handler, plug it in, and start using your custom configuration styles.

This subsection is to be continued….
References

To find out more about PHP5 in general go here: Where can I go to learn more?

March-18-09

The popularity of the ipod

posted by admin

One of the biggest tech inventions in the past 10 years has been the Apple ipod where the reported ipod creator Tony Fadell was recently appointed to the adviser role for Steve Jobs. This may be seen as a way to reward the person who helped to change the trajectory of Apple and give them a product that is now a social icon. The role is reported to be less demanding than his current and could be to help retaing this top talent as well as help their ailing CEO who is reported to be battling health issues. The popularity of the iPod has created a whole new generation of music lovers and the way that we listen to music and books.I have always been a little lazy when it comes to reading. I will start a book, but then soon for some reason I put it aside and then never finish.  Since I am in my car frequently I can just put one in the CD player and then gain some additional knowledge while in my commute. Most recently I was asked to read “The Secret” a very popular book on what changes peoples lives. I was able to find it for download and then listened to it on my iPod. The book is quite amazing and very simple to grasp the concepts. The basic principle going back to ancient times is the Law of Attraction. If you wish or desire for something hard enough your dreams will come true.

While the advancements have been impressive with the ipod and now with the iPod touch they are not without controversy. There was recently a case brought forward where Apple  sued over an ipod that exploded is gaining attention and being added to some of the cases that are being brought forward. It was only a year and half ago that Apple was battling lawsuits about the battery life and replacement of the ipod and that it created a liability since people could not readily replace their battery that appeared to be going bad in only a few months when they released the latest ipod. Even with some of these cases being brought Apple continues to hold its lead in digital music players and the distribution of digital media through their online service itunes.

March-17-09

Creating content

posted by admin

When developing blogs and websites online the number one rule to drive search traffic is having timely, relevant, and updated content. Through the development of various platforms like Mojavi the goal has always been to create a network of developers that can contribute and enhance an open architecture. With so many sites and blog starting up every week on the web the need to create a niche is becoming more important along with content. That is why I am always looking for sites like outdoorbasecamp.com where they specialize in outdoor review content and create a community where others can contribute. You can see and participate in their forum to share your thoughts and experiences with others and gather suggestions from other outdoor enthusiasts.
They have created timely and fresh content on various outdoor activities and this will lead to a loyal customer and attract local and national experts to contribute to their site. As their success builds the search engines will pick more of their content and this will increase traffic and help them grow their brand. I can see that they will become a point of reference for some of the more popular outdoor activities like kayaking, biking, and spelunking.

Tags: