Friday, December 30, 2011

Object-Relational Mapping Tools

Object-Relational Mapping Tools or ORM tools are middleware tools used to create an object-oriented abstraction layer, to the programmer, while dealing with the data in a relational format, in the database.


ORM tools provide, thus, an abstraction layer that allows the programmer to abstract away from the physical format in which data is stored. Managing data persistence is delegated in the ORM tool, allowing the programmer to work at the code level with objects that instantiate the domain model, developed in the software modelling phase, instead of having to use structures with the format of the database tables.

The object-relational mapping tools establish a bidirectional connection between the objects in the code and data in a relational database.

There are several ORM tools, both commercial and free (see List of object-relational mapping software), among which the most widely-used in Java world is certainly Hibernate, and in .Net
world is ADO.Net Entity Framework and NHibernate.



Read more:
      - Choosing an object-relational mapping tool
      - Hibernate.org
      - ADO.Net Entity Framework at a glance

Other related articles:
    - ADO.Net Entity Framework
    - Start using .Net Entity Framework - 1
    - Start using .Net Entity Framework - 2

Thursday, December 29, 2011

Start using .Net Entity Framework - 2

After having created the Windows Forms Application project and generated the data model from the database let's see how we can access the database through the model, using a small illustrative example.

In the Form1 form, created automatically when creating the Windows Forms Application project, we will create a comboBox, dragging it from the toolbox.


In the Properties tab we change its name to paisesBox1.


Start using .Net Entity Framework - 1

This article illustrates the creation of an Entity Framework model and its use with a small program in C # for Windows (Windows Application).
To implement this example you must have installed Visual Studio 2010 (with 2008 should also work), as well as .Net framework 3.5 SP1 or higher.
In addition, it is necessary to access a database
service, so as the first approach, it is advisable to use Microsoft SQL Server 2008.

1. The first step is to create a new project of type
Windows Forms Application.

ADO.Net Entity Framework

Entity Framework is a set of ADO.NET technologies that support the data-oriented software development.

Typically, today, developers of data-driven applications perform the
modelling of entities and relationships in an object-oriented way, and then have to deal with the format in which these entities have to be put in a database engine. The data can be physically distributed across multiple storage systems and even applications that work with only one database system have to make trade-offs between the logical format of the modelled data, present in the data model, and the physical format, easy to maintain and oriented to an efficient access.

Entity Framework enables developers to work with data in the form of domain-specific objects, as modelled in the
data abstract model, without worrying about the tables of the database where they are stored.

With Entity Framework, developers can work at an abstraction
level higher than when they have to deal directly with the data, and can create and maintain data-driven applications with less code than with traditional applications.

As Entity Framework is a component of the .NET Framework, applications that use Entity Framework can run on any computer that has .Net framework version 3.5 SP1 or above
installed.

In the next article we will see a small example of how to use ADO.Net Entity Framework.


Other related articles:
    - Start using .Net Entity Framework - 1
    - Start using .Net Entity Framework - 2




Wednesday, December 28, 2011

How to install an extension in Joomla (1.7)

Joomla is very good. It takes only the original features to make complete websites with a professional look.

But after some time the need to
include something that is not possible with the original modules arises.

So you need to install an extension in Joomla. Y
ou can search and find various extensions for Joomla in http://extensions.joomla.org/ or http://developer.Joomla.org, amongst other sites.

There are five main extension
types in Joomla: Components, Modules, Plugins, Templates, and Languages​​. Each type deals with specific functionality (see http://docs.joomla.org/Extension_types_(general_definitions)).

Other possible
extensions are File and Library. Libraries are code packages that provide functionality to the Joomla framework or its extensions.


Install Joomla...

Joomla is another well-known portal framework, released under the GNU/GPL, which seems to be the successor to PHP-Nuke.

Its installation is very similar to PHP-Nuke, and it becomes pretty trivial after installing XAMP (described in another post).

The version 1.7.2 is the one I installed and for that I follow the steps in http://docs.joomla.org/Use_Joomla!_on_your_own_computer, although I have installed it on Windows.

However, for Windows, the installation seems to be much easier, if used a web installer -> http://www.microsoft.com/web/joomla/
This installer installs the prerequisites, as well as the WebMatrix, in addition to Joomla.



Install PHP-Nuke...

PHP-Nuke is a well known portal framework, deployed under a GNU/GPL license, in which you can install a number of modules, or to which new modules may be developed in PHP.

I have installed it in my PC (WINDOWS 7) and decided to resume in this post the way I solved a couple of problems.

To install PHP-Nuke, and because I didn't have Apache, PHP and MySQL installed on my PC, the following steps were taken:

1 - Download XAMPP (bundle that includes Apache, PHP e MySQL)
2 - Install XAMPP.
3 - Start the services (previously you should stop IIS)
4 - Download PHP-Nuke and unzip it to a directory
5 - Run PHP-Nuke (obviously it gives error, but provides a link for easy installation)
6 - Modify php.ini to ignore warningsabout old functions.

Points 1 and 2 are trivial. XAMPP can be downloaded from http://www.apachefriends.org/en/xampp-windows.html.

I used XAMPP version 1.7.7, which includes:

- Apache 2.2.21- MySQL 5.5.16
- PHP 5.3.8
- phpMyAdmin 3.4.5
- FileZilla FTP Server 0.9.39
- Tomcat 7.0.21 (with mod_proxy_ajp as connector)


Already, in section 3, to start Apache on port 80 is dependent on stopping the IIS (or start one of them in another port...)

-> To disable IIS just go to Control Panel -> System and Security -> Administrative Tools, open the Manage Internet Information Services (IIS) and stop the service.


Point 4, download PHP-Nuke, can be made from http://phpnuke.org/index.php. I used version 8.2, and unziped it to htdocs\phpnuke.

After that, I run phpnuke unziped, which causes a warning on a "deprecated" function, but provides a link to an easy installation (I will not talk about the other way to install because there was no need to use it).

This step asks for different information, among which is the name of the MySQL database where the Nuke database will be installed.

After installation, run the PHP-Nuke installed. You see the first page of the portal, but with a list of several lines with warnings of "deprecated" functions. This does not prevent the Nuke to run correctly, but it obviously doesn't look right in your portal. The simplest work around is to "hide these messages," changing the php.ini file with the following two lines:

display_errors = off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE

This solves the problem and allows us to start exploring the Nuke.