Skip to content

Category: Coding

Programming and scripting topics.

MVC framework

Model–view–controller (MVC) is a software design pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.

Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become popular for designing web applications and even mobile, desktop and other clients.


As with other software architectures, MVC expresses the “core of the solution” to a problem while allowing it to be adapted for each system. Particular MVC architectures can vary significantly from the traditional description here.


A typical collaboration of the MVC components.

The central component of MVC, the model, captures the behavior of the application in terms of its problem domain, independent of the user interface.

  • The model directly manages the data, logic, and rules of the application.
  • A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants.
  • The third part, the controller, accepts input and converts it to commands for the model.


In addition to dividing the application into three kinds of components, the model–view–controller design defines the interactions between them.

  • A model stores data that is retrieved according to commands from the controller and displayed in the view.
  • A view generates new output to the user based on changes in the model.
  • A controller can send commands to the model to update the model’s state (e.g., editing a document). It can also send commands to its associated view to change the view’s presentation of the model (e.g., scrolling through a document).


One of the seminal insights in the early development of graphical user interfaces, MVC became one of the first approaches to describe and implement software constructs in terms of their responsibilities.

Trygve Reenskaug introduced MVC into Smalltalk-76 while visiting the Xerox Palo Alto Research Center (PARC) in the 1970s. In the 1980s, Jim Althoff and others implemented a version of MVC for the Smalltalk-80 class library. Only later did a 1988 article in The Journal of Object Technology (JOT) express MVC as a general concept.

The MVC pattern has subsequently evolved, giving rise to variants such as hierarchical model–view–controller (HMVC), model–view–adapter (MVA), model–view–presenter (MVP), model–view–viewmodel (MVVM), and others that adapted MVC to different contexts.

The use of the MVC pattern in web applications exploded in popularity after the introduction of Apple’s WebObjects in 1996, which was originally written in Objective-C (that borrowed heavily from Smalltalk) and helped enforce MVC principles. Later, the MVC pattern became popular with Java developers when WebObjects was ported to Java. Later frameworks for Java, such as Spring (released in October 2002), continued the strong bond between Java and MVC. The introduction of the frameworks and Django (July 2005, for Python) and Rails (December 2005, for Ruby), both of which had a strong emphasis on rapid deployment, increased MVC’s popularity outside the traditional enterprise environment in which it has long been popular. MVC web frameworks now hold large market-shares relative to non-MVC web toolkits.

Use in web applications

Although originally developed for desktop computing, MVC has been widely adopted as an architecture for World Wide Web applications in major programming languages. Several commercial and noncommercial web frameworks have been created that enforce the pattern. These software frameworks vary in their interpretations, mainly in the way that the MVC responsibilities are divided between the client and server.

Early web MVC frameworks took a thin client approach that placed almost the entire model, view and controller logic on the server. This is still reflected in popular frameworks such as Django, Rails and ASP.NET MVC. In this approach, the client sends either hyperlink requests or form input to the controller and then receives a complete and updated web page (or other document) from the view; the model exists entirely on the server. As client technologies have matured, frameworks such as AngularJS, EmberJS, JavaScriptMVC and Backbone have been created that allow the MVC components to execute partly on the client (also see Ajax).

More info at

Order your MVC framework development now from KAV Design at or call us at +359 898 884431

Responsive Web Design

Responsive web design (RWD) is a design and technical approach that aims to adapt the layout and interaction of a site or app to work optimally across a wide range of device resolutions, screen densities and interaction modes with the same underlying codebase.

RWD basics

RWD has three key elements:

  • CSS media queries, used to target styles to specific device characteristics such as screen width breakpoint or resolution.
  • A fluid grid, that specifies elements and widgets in flexible units with the goal of making them flow to fill their containers.
  • Flexible images and media, are also sized in relative units so they re-size to fit within their containers.

By creating all screen elements to be fluid and flexible, it allows the media queries to focus primarily on controlling layout rules for containers; the modules inside simply re-size to fit their containers.

A simple responsive example may be two stacked containers, each with flexible content or widgets inside. At greater widths, media queries are used to float both containers to create a two column layout to take better advantage of the wider screen.

Since the content inside each container is designed to re-flow to fit its parent, the media queries can focus just on the rules for making the columns stack or float, and to override or add styles only needed at greater widths.

Order your responsive web design now from KAV Design at or just call us at +359 898 884431

How to remove text from file name for multiple files on Windows

On Windows, you can take advantage of PowerShell:

dir | rename-item newname { $ ireplace '(.+?) 203\.bmp$','$1.bmp' }

In this code snippet we use a command that removes ‘203’ from the file name.


dir          => list the content of the current directory
 |           => send each found element to the next command
rename-item  => rename an element in a Windows PowerShell provider namespaceject
newname     => specify the name of the renamed file
    $_               => points to an object representing the actual file
   .name             => the name property of the automatic variable
   -ireplace         => perform a insensitive replace
   '(.+?) 203\.bmp$' => here comes the regex for matching the desired files
   '$1.bmp'          => the replacement string

You must run this command inside a power shell. Here is how to start it:

how to launch powershell on Windows 7?

Then cd into you dir from the Powershell window:

Change to the directory containing the files to be renamed from powershell window

More on

Also –

Joomla! 3.0 and loading jQuery / Migrate Joomla template from 2.5 to 3.1

If you need to migrate yout Joomla template from Joomla 2.5 to Joomla 3.0 or 3.1 maybe you will need this info as I did.

The Joomla! 3.0 core ships with jQuery, and previous Joomla! versions did not. Extension developers like us therefor included a custom call to load jQuery in the past, whenever it was needed. However this standard needs updating. Here’s our proposal.

Loading jQuery only once

Because jQuery could be loaded in the past more than 1 time (and loading jQuery twice leads to unwanted errors, plus it makes no sense to load it twice), extension developers more or less agreed to use a flag in the Joomla! application-class:

$loaded = JFactory::getApplication()->get('jquery');

If the flag was not yet loaded, it could simply be loaded by your own extension, after which the flag needed to be set for other extensions to pick up on:

JFactory::getApplication()->set('jquery', true);

Joomla! 3.0 changes this

The Joomla! 3.0 core changes the JApplication-class in such a way that the get() and set() methods can no longer be used – the class no longer extends the JObject class which provided these methods. Simply put: Using the code above under Joomla! 3.0 throws a PHP Fatal Error.

But Joomla! 3.0 has also introduced jQuery as a core feature. Third party extensions no longer require to load jQuery, because it is already shipped with Joomla!. The only thing that extensions require is a simple call to the JHtml-class:


Code proposal

So what is our proposal? Simple: Use the old method for Joomla! 2.5 and older, and use the new method for Joomla! 3.0. The version of Joomla! can be checked using framework-calls as well, so the code would look a bit like this:

JLoader::import( 'joomla.version' );
$version = new JVersion();
if (version_compare( $version->RELEASE, '2.5', '<=')) {
    if(JFactory::getApplication()->get('jquery') !== true) {
        // load jQuery here
        JFactory::getApplication()->set('jquery', true);
} else {

Original article –

Full list of possible conflicts between Joomla 2.5 and Joomla 3.x here –

Probably there are more things to know when migrating Joomla Templates from 2.5 to 3.x and if somebody get something please post a comment to this article.