Friday, December 4, 2009

Configuring Xerces-C++ XML Libraries with Visual Studio 2008

The latest release of Xerces c++ xml library is Xerces-C++ 3.0.1. Download the library from the apache website @ http://xerces.apache.org/xerces-c/download.cgi from any of the available mirrors.

Integrating Xerces-C++ XML Library with Visual Studio 2008

Integration involves 3 main steps. This makes the application utilize the facilities of Xerces- C++ xml libraries, and be fully functional.

1) Set the Library path:-

· Start Visual studio 2008 and open your project.

· Go to Tools > Options…

· On the popped-up ‘options’ window, towards left, select and expand the directory ‘Projects and Solutions’. In the expanded list select ‘VC++ Directories’.

· Now towards the right of ‘Options’ window, click on ‘Show directories for:’ dropdown list and select ‘Library files’.

· Now in the window below, include the path of the Xerces-C++ ‘lib’ directory (Example: C:\xerces-c-3.0.1-x86-windows-vc-8.0\xerces-c-3.0.1-x86-windows-vc-8.0\lib). To do this, click just below the last included path. With this a cursor appears, where we can type the path, or we can even include the path by clicking on the ellipsis button at the end of the line and browse to the Xerces ‘lib’ directory.

· Finally click ‘Ok’.

2) Set the Include path:-

· Follow the first 3 instructions of the previous step.

· Now towards the right of ‘Options’ window, click on ‘Show directories for:’ dropdown list and select ‘Include files’.

· Now in the window below, include the path of the Xerces ‘include’ folder (Example: C:\xerces-c-3.0.1-x86-windows-vc-8.0\xerces-c-3.0.1-x86-windows-vc-8.0\include). To do this, click just below the last included path. With this a cursor appears, where we can type the path, or we can even include the path by clicking on the ellipsis button at the end of the line and browse to the ‘include’ directory.

· Finally click ‘Ok’.

3) Copy the two DLL’s, ‘xerces-c_3_0.dll’ and ‘xerces-c_3_0D.dll’ available in “bin” folder (Example: C:\xerces-c-3.0.1-x86-windows-vc-8.0\xerces-c-3.0.1-x86-windows-vc-8.0\bin) and put It in the system’s Windows folder. (i.e. C:\Windows)

Build and Run the application.

Thursday, September 17, 2009

Differenciating between Platform, Framework and Middleware

Introduction.

We all have used the terms Platform, Framework and Middleware at some point. These three are very necessary as they support the applications we develop and deploy, work as expected. Many a times we normally use these terms interchangeably, but that’s incorrect. Here we attempt to draw boundaries, between these three terminologies.

Definition

Think, you are developing a application, a PLATFORM is one, which provides a base to deploy and run your application, a FRAMEWORK is one which help design, develop and bind together different components to your application, a MIDDLEWARE is one which provides wide variety of services to the application from outside.

Description

Platform: A platform could be hardware architecture and some software, on top of which other applications operate. Hardware architecture is base to any software. More precisely, hardware platform refers to the processor and other hardware devices existing in any computing machine. Upon this hardware we have operating system and other application program. The software platform, for example an operating system forms the base for all other software’s to operate.

Platforms support the application programs by providing some of the following features. They include multi-tasking, memory management, access to disk and file systems, networking, security and several other functions.

Common Examples: Operating software, programming languages, compilers, runtime libraries, Java virtual machine etc.

Framework: A software framework could be a collection of support programs, a scripting language, code libraries and any other software, which help develop and bind together, different components of the software project.

Each library provides a specific functionality. More libraries the framework includes more functionality it provides. The functions provided by the framework are exposed through API’s.

The framework design is highly flexible and reusable. It facilitates software design & development, allowing designers and programmers, denote more time on actual requirement development.

Choosing the best framework for a project often requires a programmer to balance between

(i) How much functionality they get from the framework

(ii) The flexibility they are left with.

The original framework will become a part of the application being developed. I mean, if we ship the application, we ship it along with the framework. There is always a tight bonding between the application and framework it is using.

Examples: Wiki, Blogspot, Java spring framework, Struts framework

Middleware: A middleware provides services to an application. As the name tells, it acts as a mid-level agent, between the service provider and the service consumer. Also, we can say it acts as a glue or mediates between two or more already existing applications.

The middleware allows applications to communicate with one another, where either of the application runs on different platforms and could come from different vendors.

Common services provided by a middleware include, allow programs to establish access to multiple databases, provide messaging services that allow multiple applications to communicate.

Middleware supports your application from outside. That means, our application is not tightly coupled with any of the middleware, instead out application just uses some of its services.

Types of Middleware: Object Request Broker (ORB), Transaction Processing (TP) Monitors, Remote Procedure Call (RPC) systems, Enterprise Service Bus (ESB), Application Servers.

Example: Suppose we need to develop a Content Management System (CMS) that helps to keep all the data related to a particular project at one place. A freely available and widely used CMS is Wiki. Wiki is available in different versions. One has to download the available wiki framework and modify according to the requirements.

Also the wiki can work on many platforms; I mean many different operating systems supports wiki. But it is dependent on one such operating system. The basic framework that we download has to be deployed first, for which we need a operating system platform.

Now we need to make modifications to the wiki framework, add more code, update with new pages such that it suits our requirements. Once the application is ready, data is stored and accessed.

Now, we need to host the wiki, so it is accessible for all over the internet. To host the wiki application across a distributed network, we need certain other external applications like Web Servers and Application servers. So here we say, that these external applications which provides services to the wiki application, by hosting over the network, constitutes for the middleware.

More Information @:

http://www.hildeberto.com/2008/10/platform-versus-framework_12.html

http://www.hildeberto.com/2009/05/what-is-middleware-platform-framework.html

Friday, August 7, 2009

Configuring Boost C++ Library with Visual Studio 2008

I) Download Boost C++ Library

The latest release of Boost library is Version 1.39.0, released in may 2009. This release has the following new libraries and updates over its previous version, Version 1.38.0.

New Libraries : Signals2.

Updated Libraries : Asio, Flyweight, Foreach, Hash, Interprocess, Intrusive, Program.Options, Proto, PtrContainer, Range, Unordered, Xpressive. Updated Tools: Boostbook, Quickbook.

Download path: http://www.boost.org/

II) Integrating Boost C++ libraries with Visual studio 2008

Integration involves two steps. This makes the application utilize the facilities of Boost C++ libraries, and be fully functional.

1) ‘Including’ Boost directory path:-

Steps:-

a) Launch Visual studio 2008.

b) Click on ‘Tools’ menu & select ‘options…’

c) On the popped-up ‘options’ window, towards left, select and expand the directory ‘Projects and Solutions’. In the expanded list select ‘VC++ Directories’.

d) Now towards the right of ‘Options’ window, click on ‘Show directories for:’ dropdown list and select ‘Include files’.

e) Now in the window below, include the path of the Boost C++ ‘root’ directory. To do this, click just below the last included path. With this a cursor appears, where we can type the path, or we can even include the path by clicking on the ellipsis button at the end of the line and browse to the root directory.

f) Finally click on ‘Ok’.

2) ‘Linking’ the Boost libraries with the project.

Steps:-

a) In ‘Solution Explorer’, right click on the project folder and select properties.

b) Now the project properties window pops-up.

c) Towards the left of the properties window, select and expand ‘Configuration properties’ directory.

d) Now select and expand ‘Linker’ directory and click on ‘General’.

e) Now to the right of the ‘Project property’ window, select the property ‘Additional Library directories’ and add the path of Boost C++ Library directory.

(Example: ‘C:\Program Files\boost\boost_1_38\lib’).

f) Finally click ‘Apply’ and ‘Ok’.

III) ‘Build’ and ‘Run’ your application.

Microsoft Pre-defined macros

_MSC_VER

This is the predefined macro, which identifies the Micro

Soft Compiler VERsion. It comprises of the major and minor number components of the compiler’s version number.

Open your Visual studio Command Prompt and type in “cl/” and hit enter. The output in my system is shown below

.

So, the VC++ compiler version of my system is 15.00.21022.08. In this period delimited version number, the major number corresponds to the first component , 15 and the minor number corresponds to the second component, 00. So for Visual studio 2008, the _MSC_VER macro evaluates to 1500.

Below are a couple of examples of the usage of _MSC_VER macro in programming.

Example1:

#ifdef _MSC_VER

//if it is any version of MicroSoft Compiler, the below main() function

// is executed. Else this portion of code will be inactive.

int main(int argc, char* argv[])

{

//some come

return 0;

}

#else

//if it is any other compiler other than MicroSoft, the below main()

//function is executed. Else this portion of code will be inactive.

int main(int argc, char* argv[])

{

//some come

return 0;

}

#endif

In the above code snippet, it is shown that it has two ‘main()’ functions. But out of these two, at any point, only one will be active and the other is totally inactive. The compiler only identifies the main() function relevant to it. There by this does not result in any compiler error.

Example2:

#if (_MSC_VER >= 1400)

//VC 8.0: Executes this part of the code if the Compiler is VC 8.0

// and above.

#elseif (_MSC_VER >= 1310)

// VC 7.1: Executes this part of the code if the Compiler is VC 7.1.

#elseif (_MSC_VER >= 1300)

// VC 7.0: Executes this part of the code if the Compiler is VC 7.0.

#else

// VC 6.0: Executes this part of the code if the Compiler is VC 6.0.

#endif

In the above example a distinction is made between the various versions of Microsoft compiler. So based on the compiler version that part of the code executes and not all.