Showing posts with label computer engineering bachelor's degree. Show all posts
Showing posts with label computer engineering bachelor's degree. Show all posts

Syntactic Analyzer built with Flex and YACC

Compilers construction paper
I and a dear brother in faith of mine called Wellington Magalhães Leite wrote a paper titled: A Syntactic Analyzer built with the CASE tools Flex and YACC

See the paper's abstract below:

The function of a syntactic analyzer in a compiler is to verify the syntactic structure of a program’s source code. It then detects, signalize and handle the syntactic errors found in the source code and at the same time servers as the framework for the front-end (user interface) of the program. So, its construction helps with the familiarization regarding the tasks included in the compiler project.

The language used in this paper does not have left recursion. The language neither presents subprograms, nor indexed variables and its only loop command is while for the sake of simplicity. The syntactic analyzer implemented uses the bottom-up parsing approach.

This paper presents the steps to the construction of a syntactic analyzer, which serves as a base element for a compiler implementation.

Keywords: syntactic analyzer, syntactical analysis, compiler construction, case tools, flex, yacc

CONTENTS
1 INTRODUCTION 7
  1.1 Objective 7
  1.2 Definition 7
      1.2.1 Grammar 7
            1.2.1.1 Grammar productions 8
            1.2.1.2 Lexical specifications 8
            1.2.1.3 Reserved words or keywords 10
            1.2.1.4 Operator types and attributes 11
            1.2.1.5 Separator types 11
2 DEVELOPMENT 13
  2.1 Lexical analysis 13
      2.1.1 Sample source code of a factorial program 13
      2.1.2 Flex 16
  2.2 Syntactical analysis 16
      2.2.1 Sample syntactic tree 16
      2.2.2 YACC 20
3 APPLICATION 21
  3.1 Constructing the file for the lexical analysis (lexan.lex) 21
  3.2 Constructing the file for the syntactic analysis (sinan.yacc) 21
  3.3 Guide to implementation 24
  3.4 Using a batch file to avoid boilerplate work 28
4 CONCLUSION 30
5 REFERENCES 31
6 ADDENDUM 32

See a screenshot of the syntactic analyzer in action:

SyntacticAnalyzerFlexYACCSyntaxError

You can get a PDF copy of the paper and the accompanying syntactical analyzer's files in a ZIP file at:

http://leniel.googlepages.com/SyntacticAnalyzerBuiltWithFlexYACC.pdf http://leniel.googlepages.com/SyntacticAnalyzerBuiltWithFlexYACC.zip

Tonal X Spatial Resolution X File Size

Computer graphics paper
I and a dear brother in faith of mine called Wellington Magalhães Leite wrote a paper titled: Influence of Tonal and Spatial Resolution on the Image File Size

See the original image we used to perform the tests regarding our paper:

The paper is accompanied by a spreadsheet and both are available in English and Portuguese.

See the paper's abstract below (English/Portuguese):

ABSTRACT

It is interesting to notice how the three variables (bits per pixel, number of colors and image file size) discussed in this paper are extremely related.

More and more we express ourselves through the use of images, which consequently need a place to be stored and this has to do with their usage in digital mediums as is the case of the Internet; take the Flickr service as an example. The storage is made in a digital form, that is, in bits.

It is known that: the better the image quality, the bigger will be the number of bits per pixel that are used to compose the image, what makes us capable of visualizing a great number of colors (tonal resolution), for the number of colors is coupled up to the quantity of bits per pixel. If we increase the number of pixels (spatial resolution) of the image, the generated file size will be bigger, in other words, more bits will be consumed to compose the image and depending on this value, the distribution or visualization of the image can be inadequate in certain conditions.

So, we can perceive the necessity of a case by case study, looking for a suitable value to the three variables, what will provide us with an ideal image file for each type of job.

Keywords: computer graphics, tonal resolution, spatial resolution, bits per pixel, number of colors, image file size

CONTENTS
1 INTRODUCTION 6
  1.1 Objective 6
  1.2 Definition 6
  1.3 Tonal resolution 7
  1.4 Spatial resolution 7
2 DEVELOPMENT 8
  2.1 Image edition 8
      2.1.1 Creating the work directory 8
      2.1.2 Obtaining the data “bits” for the experiment 8
      2.1.3 Selecting only the image of interest 8
      2.1.4 Opening the test file with Photoshop 9
      2.1.5 Visualizing the image size properties 10
      2.1.6 Redefining the image size 11
      2.1.7 Saving the modified image 12
      2.1.8 Producing images with different spatial resolution 13
      2.1.9 Altering the tonal resolution 13
      2.1.10 Returning to Windows Paint 14
      2.1.11 Producing images with different tonal resolutions 15
3 APPLICATION 16
  3.1 24, 16, 8, 4 and 1 bit tonal resolutions 16
  3.2 Tonal resolution vs. Spatial resolution vs. Image size 20
4 CONCLUSION 22
5 REFERENCES 23

RESUMO

É interessante notar como as três variáveis (bits por pixel, número de cores e tamanho do arquivo de imagem) discutidos neste trabalho estão intensamente relacionadas.

Cada vez mais nos expressamos através de imagens, as quais necessitam conseqüentemente de um local para serem armazenadas, haja vista a utilização em meio digital. Veja o site Flickr por exemplo. O armazenamento por sua vez é feito de forma digital, ou seja, através de bits.

É sabido que quanto maior for a qualidade da imagem, maior será o número de bits por pixel utilizados na composição da mesma, o que nos possibilita a visualização de um grande número de cores (resolução tonal), pois o número de cores está atrelado à quantidade de bits por pixel. Se aumentamos o número de pixels (resolução espacial) da imagem, maior será o tamanho do arquivo gerado, ou seja, mais bits serão consumidos para armazenar a imagem e dependendo deste valor, a distribuição ou visualização da imagem pode se tornar inadequada em certas condições.

Percebe-se então a necessidade de um estudo caso a caso, em busca de um valor adequado para essas três variáveis, de modo a obter um arquivo de imagem ideal para cada tipo de trabalho.

Palavras-chave: computação gráfica, resoulução tonal, resolução espacial, bits por pixel, número de cores, tamanho do arquivo de imagem

SUMÁRIO
1 INTRODUÇÃO 7
  1.1 Objetivo 7
  1.2 Definição 7
  1.3 Resolução tonal 8
  1.4 Resolução espacial 8
2 DESENVOLVIMENTO 9
  2.1 Edição de imagens 9
      2.1.1 Criando a pasta de trabalho 9
      2.1.2 Obtendo os dados “bits” para o experimento 9
      2.1.3 Selecionando somente a imagem de interesse 9
      2.1.4 Abrindo o arquivo de teste com o Photoshop 10
      2.1.5 Visualizando as propriedades do tamanho da imagem  11
      2.1.6 Redefinindo o tamanho da imagem 12
      2.1.7 Salvando a imagem modificada 13
      2.1.8 Produzindo imagens com diferentes resoluções espaciais 15
      2.1.9 Alterando a resolução tonal 15
      2.1.10 Retornando ao Paint do Windows 15
      2.1.11 Produzindo imagens com diferentes resoluções tonais 16
3 APLICAÇÃO 17
  3.1 Resoluções tonais de 24, 16, 8, 4 e 1 bit 17
  3.2 Resolução tonal vs. Resolução espacial vs. Tamanho do arquivo 21
4 CONCLUSÃO 23
5 BIBLIOGRAFIA 24

See the PivotChart created with the spreadsheet data:

Pivot Chart

You can get a PDF copy of the paper and the accompanying Excel spreadsheet at:

English version
http://leniel.googlepages.com/TonalSpatialResolutionImageFileSize.pdf
http://leniel.googlepages.com/TonalSpatialResolutionImageFileSize.xls

Portuguese version
http://leniel.googlepages.com/ResolucaoTonalEspacialTamanhoArquivo.pdf http://leniel.googlepages.com/ResolucaoTonalEspacialTamanhoArquivo.xls

Java Video Rental Store App - Part 1

One of the last computer engineering course works I had to do was to code a simple Java application. This application should use a database to store and retrieve its data. The discipline was Advanced Computing Topics. The teacher Luís Henrique Campos Braune sent the class an e-mail explaining what he wanted us to do. The following lines are a transcript of what he wanted us to do initially.

The basic idea was that we would study a sample java application1, a very simple one, and starting with it we would program another one. The work would be done in teams and the teacher orientation was that we should only use the allotted class time because we were also preparing our computer engineering final project and he didn't want us to spend time at home with course work related to his discipline. He thought that the time allotted to the classes would be sufficient for this task.

1 The sample Java application can be downloaded at the end of this post. The initial code and instructions were written in Portuguese. I translated all the code and instructions to the English language, so that it can reach a broader audience.

The Java Sample Application
The Java sample application is a functional and really rudimentary one and uses the Swing User Interface Toolkit.

We didn't use an Integrated Development Environment (IDE) to work with it. All the preliminary changes to the code was done using a simple text editor as the Windows Notepad. The purpose of this application was to introduce the students to the object oriented programming world based on windows and user events. We should compile and run it according to the following steps:

1st step - Download and decompress the .zip file provided by the teacher.

The sample application should be uncompressed in the root dir C:\ on the classroom computer to facilitate the work.

The following table shows the content of the .zip file:

.ZIP file content
File Description
MainMenu.java Class pertaining to the main menu
ClientRecord.java Class pertaining to Retrieve/Change/Save/Delete client
VideoRecord.java Class pertaining to Retrieve/Change/Save/Delete video
VideoRental.java Class pertaining to video rental
VideoDevolution.java Class pertaining to video devolution
DatabaseAccess.java Class pertaining to the database connection and functions
VideoRentalStore.mdb Microsoft Access database file
README.txt A read me file with instructions

2nd step - Compile the sample app To do this we should open a command prompt, navigate to the sample app directory and type: javac MainMenu.java

In case the above command didn't work for you, refer to the The Java Platform section bellow.

3rd step - Run the sample app After compiling the the Sample app it's necessary to run the same. To do this, again in the command prompt, type: java MainMenu

In both cases it's important to type observing UPPER and lower case letters. It's case sensitive.

The Java Platform
Evidently, to do the the last two steps we should have the Java Platform installed. The Java platform consists of several programs, each of which provides a distinct portion of its overall capabilities. The principal portions are: the Java compiler, the Java Virtual Machine (JVM), the Java Development Kit (JDK), the Java Runtime Environment (JRE), and the just-in-time (JIT) compiler.

If the 2nd step above didn't work, we have two possibilities:

- The JDK is installed but not configured

A simple tip to see if the JDK is already installed is to look for some version of the JDK in "C:\Program files\Java"; if there is a version but on trying to compile you get an error, then you need to configure it first. That's what we'll do in the Installing the Java Development Kit section bellow.

- The JDK isn't installed

There are different "editions" of the Java Platform, including:

  • Java ME (Micro Edition): Specifies several different sets of libraries (known as profiles) for devices which are sufficiently limited that supplying the full set of Java libraries would take up unacceptably large amounts of storage.
  • Java SE (Standard Edition): For general purpose use on desktop PCs, servers and similar devices.
  • Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tier client-server enterprise applications.

The one that would fit our necessity was the J2SE edition without the NetBeans IDE, that is usually offered with the Java Platform when you download it.

To download the J2SE go at http://java.sun.com/javase/downloads/index.jsp (select JDK 6 Update 5).

There are several flavors, each one suitable for a specific type of operating system. For this post I used the Windows offline installation file called jdk-6u2-windows-i586-p.exe (65.5 MB).

Installing the Java Development Kit
The following are the steps we used to install the JDK. It's really easy! You practically have to click on next, next and next.

Just pay attention to the fact that, after the installation of the JDK, the JRE will also be installed in case you don't have it.

The trick is to configure the Java Platform after the JDK has been installed. To do that, check where the installation was done. Usually it is in C:\Proram files\Java\jdk...

Now, right click on My computer, Properties, Advanced tab, Environment variables. Click on New variable. Can be in User variables or System variables. Create the two variables according to the following table:

Environment variables
Variable Name Value
1 CLASSPATH ;.;C:\Program files\Java\jdk1.6.0_02
2 PATH ;C:\Program files\Java\jdk1.6.0_02\bin

Notes: - A dot (.) is part of the CLASSPATH variable value. - The path here presented are for mere illustration. What really matter is the current path you have on your computer. - Each value has a semicolon in its beginning. - I used the value jdk1.6.0_02 because this is the JDK version I have on my machine. This explains why I used ... to point the JDK installation path. If you have a different version, make the appropriate change.

Save everything clicking OK.

To test if the Java Platform was installed/configured correctly, try to compile and run the sample application executing the 1st and 2nd steps of The Java Sample Application section above.

Configuring the database connection
It wasn't enough for our Java sample application. We then should configure the database, more precisely, the alias used to reference the Microsoft Access VideoRentalStore.mdb database file.

What we needed to do was to create an ODBC connection so that the database file would be referenced through the alias used within the DatabaseAccess.java source code file. To do this we should do the following:

Go to Control Panel, Administrative Tools, ODBC Data Sources, click on the Add connection and choose Microsoft Access driver; in data source name value we should type the alias "VideoRentalStore" used in the DatabaseAccess.java source code file and in Database we should select/point to the VideoRentalStore.mdb database file that is inside the uncompressed directory.

Doing so we should be able to Retrieve/Change/Save/Delete data using the sample application.

Any doubts should be reported to the teacher. That's what he's there for, right?!

OK that was the first class we had and so is the first post in this series.

Next post in this series
Come back to see a next post in which I'll start to drill down what I particularly did, that is, what path I followed to take advantage of and master my skills while developing the other version of such application.

Get the Java Video Rental Store sample application at:

http://leniel.googlepages.com/VideoRentalStoreSampleApp.zip

Breadth and depth first search - part 3

Breadth and depth first search - part 1
Breadth and depth first search - part 2

As an extra, today I'm posting the C++ code of the breadth and depth first search algorithms. Take a look at part 1 and part 2 of this series.

When I had to hand in the work for the artificial intelligence discipline, the teacher wanted the code in C++ and I had already started developing the code in C#. The result was two versions of the same functions. The good part is that I could master both languages while developing such a code.

The code presented here uses an adjacency matrix to represent the links between the cities that are part of the Romania map shown bellow.

The following is the adjacency matrix:

// Adjacency matrix
int map[21][21] = {
/*   A B C D E F G H I L M N O P R S T U V Z */
  {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0},
  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1}, // Arad
  {2,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,0}, // Bucharest
  {3,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0}, // Craiova
  {4,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, // Dobreta
  {5,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, // Eforie
  {6,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, // Fagaras
  {7,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // Girgiu
  {8,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, // Hirsova
  {9,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0}, // Iasi
  {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0}, // Lugoj
  {1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, // Mehadia
  {2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, // Neamt
  {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, // Oradea
  {4,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, // Pitesti
  {5,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, // Rimnicu Vilcea
  {6,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0}, // Sibiu
  {7,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, // Timisoara
  {8,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0}, // Urziceni
  {9,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0}, // Vaslui
  {0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}  // Zerind
};

Note that the first commented line represents the initial letter of each city's name. The mapping done with the adjacency matrix refers to these letters so that it's easier to understand. For example, getting the first entry of the adjacency matrix that refers to Arad: we have that Arad has paths that lead us to Sibiu, Timisoara and Zerind, thus we put a value of 1 on the columns that represent those cities, in this case, the columns beneath the letters S, T and Z. That's how the mapping is done. We put a value of 0 on the other columns to state that there is no path that leads us to those cities.

The code also has a hand made version of the stack and queue data structures. Each one of these structures is on its proper header file and are inline functions. See their implementations:

// Queue
struct Queue
{
  int start, end, tot;

  int info[max + 1];
};

void StartQueue(Queue *q)
{
  q->tot = 0;

  q->start = 1;

  q->end = 0;
}

int IsQueueEmpty(Queue *q)
{
  return q->tot == 0 ? 1 : 0;
}

int IsQueueFull(Queue *q)
{
  return q->tot == max ? 1 : 0;
}

int Adc(int x)
{
  return x == max ? 1 : x + 1;
}

void Enqueue(Queue *q, int x)
{
  if(!IsQueueFull(q))
  {
    q->end = Adc(q->end);

    q->info[q->end] = x;

    q->tot++;
  }
}

int Dequeue(Queue *q)
{
  int ret = 0;

  if(!IsQueueEmpty(q))
  {
    ret = q->info[q->start];
  
    q->start = Adc(q->start);
  
    q->tot--;
  }

  return ret;
}
// End Queue
// Stack
struct Stack
{
  int topo;

  int info[max + 1];
};

void StartStack(Stack *s)
{
  s->topo = 0;
}

int IsStackEmpty(Stack *s)
{
  return s->topo==0 ? 1 : 0;
}

int IsStackFull(Stack *s)
{
  return s->topo == max ? 1 : 0;
}

void Push(Stack *s, int x)
{
  if(!IsStackFull(s))
  {
    s->topo++;
  
    s->info[s->topo] = x;
  }
}

int Pop(Stack *s)
{
  int ret = 0;

  if(!IsStackEmpty(s))
  {
    ret = s->info[s->topo];
  
    s->topo--;
  }

  return ret;
}
// End Stack

The Breadth First Search and Depth First Search functions are written in the same fashion of the C# code, but with little modifications.

void BreadthFirstSearch(int origin, int destination)
{
  Queue *q = new Queue();

  StartQueue(q);

  Enqueue(q, origin);

  while(IsQueueEmpty(q) == 0)
  {
    int u = Dequeue(q);

    if(u == destination)
    {
      printf("Path found.");

      break;
    }
    else
    {
      visited[u] = 1;

      for(int v = 1; v <= 20; v++)
      {
        if(map[u][v] != 0)
        {
          if(visited[v] == 0)
          {
            visited[v] = 1;

            parents[v] = u;

            if(v != destination)
            {
              if(!IsQueueFull(q))
              {
                Enqueue(q, v);

                ShowPath(v);

                printf("\n");
              }
              else
              {
                printf("Queue full.");

                break;
              }
            }
            else
            {
              ShowPath(v);

              return;
            }
          }       
        }
      }
    }
  }
}
void DepthFirstSearch(int origin, int destination)
{
  Stack *s = new Stack();

  StartStack(s);

  Push(s, origin);

  while(IsStackEmpty(s) == 0)
  {
    int u = Pop(s);

    if(u == destination)
    {
      printf("Path found.");

      break;
    }
    else
    {
      visited[u] = 1;

      for(int v = 1; v <= 20; v++)
      {
        if(map[u][v] != 0)
        {
          if(visited[v] == 0)
          {
            visited[v] = 1;

            parents[v] = u;

            if(v != destination)
            {
              if(!IsStackFull(s))
              {
                Push(s, v);

                ShowPath(v);

                printf("\n");
              }
              else
              {
                printf("Stack full.");

                break;
              }
            }
            else
            {
              ShowPath(v);

              return;
            }
          }      
        }
      }
    }
  }
}

To show the travelled paths there is a recursive function called ShowPath:

void ShowPath(int u)
{
  if(parents[u] != 0)
    ShowPath(parents[u]);

  printf(" %s", cities[u]);
}

You see, I had finalized the C# code and even sent the code to the teacher, but I received his reply stating that he wanted the code in C++. I complained with him! I told him about the easiness that modern programming languages as C# offers us when writing code.

Today, the data structures (queue and stack) "hand made" in this code are present in modern and optimized fashions inside standard libraries. We just need to instantiate an object from that specific class, in this case, stack or queue, and tada, we get lots of functions that do the hard work. But the point here is not the easiness. What the teacher wanted to force us to do was to comprehend how those data structures really function.

Nothing is better than writing the data structures by yourself. Although I didn't agree at the time, I thank him for forcing me to learn. Needless to say, these are basic data structures and are used in a great amount of code. You'll see these data structures during your entire developer life.

Visual Studio C++ Console Application
You can get the Microsoft Visual Studio Project and the app executable at:

http://leniel.googlepages.com/BreadthDepthFirstSearchCPlusPlus.zip

Papers

The following list shows each paper I've already published online on this blog plus the post in which I comment about it. The list is chronologically organized.

List updated on 2/09/2009

  1. Fortran Numerical Constants Recognizer
    Reconhecedor de Constantes Númericas em Fortran
    http://www.leniel.net/2009/02/fortran-numerical-constants-recognizer.html
  2. A Syntactic Analyzer built with the CASE tools Flex and YACC
    Um Analisador Sintático Construído com as Ferramentas CASE Flex e YACC
    http://leniel.net/2008/04/syntactic-analyzer-built-with-lex-yacc.html
  3. Influence of Tonal and Spatial Resolution on the Image File Size
    Influência da Resolução Tonal e Espacial no Tamanho do Arquivo de Imagem
    http://leniel.net/2008/04/tonal-x-spatial-resolution-x-file-size.html
  4. Construction and Simulation of a Robot Arm with OpenGL
    Construção e Simulação de um Braço Robótico com OpenGL
    http://leniel.net/2008/02/robot-arm-with-opengl-in-csharp.html
  5. Development and Numerical Simulation of Algorithms to the Computational Resolution of Ordinary Differential Equations
    Desenvolvimento e Simulação Numérica de Algoritmos para Resolução Computacional de Equações Diferenciais Ordinárias
    http://leniel.net/2008/02/development-and-numerical-simulation-of.html
  6. Linguagem de Pesquisa Integrada à Linguagem de Programação
    http://leniel.net/2008/01/linq-language-integrated-query.html
  7. Top-Down Approach in Distributed Databases
    Abordagem Top-Down em Bancos de Dados Distribuídos
    http://leniel.net/2007/12/top-down-approach-in-distributed.html

Robot arm with OpenGL in CSharp

Robot arm
A robot arm or robotic arm can be classified as articulated and not articulated. It’s more autonomous than a simple mechanic arm and can be used to lift small parts with high precision and velocity. It’s generally used in tasks such as: welding, painting, assembling, packaging, storage, product inspection and test and even in spacecrafts as can be seen below:

OpenGL
OpenGL (Open Graphics Library) is a standard specification that defines an API (Application Program Interface) that is multi-language and multi-platform and that enables the codification of applications that output computerized graphics in 2D and 3D.

Computer graphics paper
I and a dear brother in faith of mine called Wellington Magalhães Leite wrote a paper titled: Construction and Simulation of a Robot Arm with OpenGL

We used the Tao Framework C# biding to OpenGL during the construction of the robot arm.

See one of the screenshots of our robot arm:

See the paper's abstract below:

The importance of projects related to the field of Computer Graphics in simulations has been growing a lot during the last years. Therefore it brings to life the necessity of mastering the concepts and techniques inherent to the process of elaboration, construction and simulation of a given graphical project.

The OpenGPL API specification tries to help us when we are programming the graphical details of a given project. In this article we’re showing the necessary steps and routines to the proper codification and simulation of a robotic arm in 3D, which is the most employed robot in the manufacturing industry and in areas that require a high precision rate.

With a simulation (virtual) model, we can have a closer vision of the object of study in contrast with reality, what make us capable of foreseeing how a determined object will look like and how it will behave after its proper construction in the physical world.

Keywords: robot arm, OpenGL, 3D simulation, computer graphics

You can get a PDF copy of the article at:

https://github.com/leniel/leniel.net/blob/master/Uploads/ConstructionSimulationRobotArmOpenGL.pdf

Visual Studio C# Windows Application
You can get the Microsoft Visual Studio Project and the executables at:

https://github.com/leniel/leniel.net/blob/master/Uploads/RobotArmOpenGLCSharp.zip

Development and Numerical Simulation of ODEs in C

Ordinary Differential Equation
In mathematics, an ordinary differential equation (or ODE) is a relation that contains functions of only one independent variable, and one or more of its derivatives with respect to that variable. To get in depth knowledge about ODEs refer to this article at Wikipedia.

A scientific magazine article
As the result of the Numerical Calculus discipline's classwork during the 4th term of the computer engineering course I and the teacher Dener Martins dos Santos decided to write an article about ordinary differential equations. In that discipline we studied about the classic methods for the resolution of ordinary differential equations.

We ended up with a concise informative article with the following title: Development and Numerical Simulation of Algorithms to Computational Resolution of Ordinary Differential Equations. Then we submitted the article to the scientific magazine of my alma mater university. We made it in the magazine called Revista Científica do Centro Universitário de Barra Mansa.

See the article's abstract below:

The computational simulation nowadays consists of a great tool assisting the learning process of complex mathematical calculations. This informative article shows how the computational resolution of differential equations assists in this learning. Two different types of computational resolution for differential equations are demonstrated: explicit Euler's method and Runge-Kutta's fourth order method. The programs were developed in C programming language. The results obtained via both methods are compared with the respective analytical solution (traditional, manual); in these a low level of generated computational error was perceived during their simulation, not compromising the methods.

Keywords: ordinary differential equations, numerical methods, C programming.

SUMMARY
1 INTRODUCTION
2 OBJECTIVE
3 REVISION
4 METHODOLOGY
  4.1 Programs
5 RESULTS
  5.1 Differential equation 1
      5.1.1 Initial conditions
      5.1.2 Analytical solution (traditional)
      5.1.3 Graphical solution
            5.1.3.1 Explicit Euler’s method
            5.1.3.2 Runge-Kutta’s fourth order method
  5.2 Differential equation 2
      5.2.1 Initial conditions
      5.2.2 Analytical solution (traditional)
      5.2.3 Graphical solution
            5.2.3.1 Explicit Euler’s method
            5.2.3.2 Runge-Kutta’s fourth order method
6 CONCLUSION
7 BIBLIOGRAPHY

See a screenshot of the output of Runge-Kutta's fourth order method when simulated with the 1st equation described in the paper:

RungeKuttaFourthOrderMethod1stODE

You can get a PDF copy of the article at:

http://leniel.googlepages.com/DevNumSimOfAlgorithmsCompResOfODEs.pdf

Computer influence on society

It’s known that computers help men in the more diverse areas. We see nowadays that great part of men’s activities use in some way resources proceeding from the technological evolution that in its turn is leveraged by the advancement in computational resources. However, caution is necessary.

There are a lot of barriers that complicate men’s lives when they don’t use the computer power in an adequate way. Between those barriers I can cite: aspects related to health, social life, professional life and even education. Let’s see for example: if a man doesn’t take care of his physical body, it dies.

With the intensive use of computers, the majority of people forget about physical exercises. If a man forgets about the life outside, that is, thinks that the planet only spins around the computer, this man looses his life. If a man thinks that the computer can solve any problem, this man is wrong.

A computer is only a tool. The true architects are us, the men. Without our instructions the computer is incapable of executing a task.

Leaving the bad part of the topic, let’s see some positive effects of computers on society: information access through the internet that on the other hand lends to a better informed society. Increase in job opportunities coming from better environments. The velocity we arrive at results once unthinkable of being achieved. This velocity contributes to the development of advanced resources in the research area that on the other hand will influence the more diverse branches of society.

Computers are now part of our lives. It’s our responsibility to be rational and to search for better ways of interacting with them. We must evolve together with the technological innovations, but we must not give up life. We must not be bound to the new.

Only each one of us can choose its way but a world of information is here and whoever doesn’t try to get the perfect comprehension of reality can be in a worse position. You are your manager.

LINQ - Language Integrated Query

LINQ
The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.

My bachelor's degree graduation project 

As a result of my graduation project in the computer engineering course I ended up with a concise document describing the idea behind LINQ. The document is available only in Portuguese so that I think it's a valuable source of information to people that know Portuguese given the fact that great material about LINQ is only available in English.

In addition to the intrinsic subjects related to the integration of the query language (SQL) into the programming language (C#), in this paper you'll also find information about the great language extensions that form the base of LINQ:

  • Generics
  • Anonymous methods
  • Iterators
  • Partial types
  • Nullable types
  • Query expressions
  • Automatically implemented properties
  • Implicitly typed local variables
  • Extension methods
  • Partial methods
  • Lambda expressions
  • Object initializers
  • Collection initializers
  • Anonymous types
  • Implicitly typed arrays
  • Expression trees

See the paper's abstract below (English/Português):

ABSTRACT

Macaferi, Leniel Braz de Oliveira. Query language integrated into the programming language. 2007. 96f. Monograph (bachelor’s degree in Computer Engineering) - Barra Mansa University Center, Barra Mansa, 2007. www.ubm.br

Data is the raw material of computation and is processed via software. Software products are generally structured in tiers, typically three, the data tier, the middle or business tier and the presentation or client tier. Each of these tiers has its own data model. These different paradigms cause the impedance mismatch problem between these three disparate models.

Instead of trying to unify at the data model level, a better approach is to unify at the level of algebraic operations that can be defined the same way over each data model. This allows us to define a single query language that can be used to query and transform any data model. All the data model need to do is to implement a small set of standard query operators, and each data model can do so in a way natural to itself.

The industry has reached a stable point in the evolution of object-oriented (OO) programming technologies. Programmers now take for granted the facilities of oriented programming languages and their features like classes, objects, methods and events. Such languages support the creation and use of higher order, functional style class libraries. The support is the result of new language extensions being developed. These extensions enable the construction of compositional application program interfaces (APIs) that have equal expressive power of query languages inside the programming language syntax. This makes it possible to implement the standard query operators. The standard query operators can be then applied to all sources of data, not just relational or XML domains.

This work aims to present and use the most important aspects of the language integrated query with special focus on the integration of the SQL query language into the C# programming language. Aspects as simplification of the way of writing queries, unification of the syntax for querying any data source, reinforcement of the connection between relational data and the object oriented world and less time spent in the software development process.

Keywords: query language, programming language, data models, SQL, C#, LINQ

RESUMO

Macaferi, Leniel Braz de Oliveira. Linguagem de pesquisa integrada à linguagem de programação. 2007. 96f. Monografia (bacharelado em Engenharia de Computação) - Centro Universitário de Barra Mansa, Barra Mansa, 2007. www.ubm.br


Dados formam a matéria prima da computação e são processados via software. Produtos de software são geralmente estruturados em camadas, tipicamente três: a camada de dados, a camada intermediária ou de lógica e a camada de apresentação ou do cliente. Cada uma destas camadas possui seu próprio modelo de dados. Estes diferentes paradigmas causam o problema da combinação mal sucedida entre estes três modelos completamente diferentes.

Ao invés de tentar unificar no nível do modelo de dados, uma melhor alternativa é unificar no nível das operações algébricas que podem ser definidas do mesmo modo sobre cada modelo de dados. Isto nos permite definir uma única linguagem de pesquisa que pode ser usada para pesquisar e transformar qualquer modelo de dados. Tudo o que os modelos de dados precisam implementar é um pequeno conjunto de operadores de pesquisa padrão, e cada modelo de dados pode fazer isto de uma maneira natural.

A indústria chegou a um ponto estável na evolução das tecnologias de programação orientada a objetos (OO). Desenvolvedores agora têm por certo as facilidades das linguagens de programação OO e seus ricos recursos iguais a classes, objetos, métodos e eventos. Tais linguagens suportam a criação e uso de bibliotecas de classe de estilo funcional de ordem maior. O suporte é o resultado das novas extensões de linguagem de programação que estão sendo desenvolvidas. Estas extensões permitem a criação de interfaces para programação de aplicativos (APIs) composicionais que possuem poderosas capacidades de pesquisa dentro da sintaxe da linguagem de programação. Isto torna viável a implementação dos operadores de pesquisa padrão. Os operadores de pesquisa padrão podem ser aplicados em todas as fontes de informação, não somente em domínios de bancos de dados relacionais ou XML.

Este trabalho visa apresentar e utilizar os aspectos mais importantes da linguagem integrada de pesquisa com foco na integração da linguagem de pesquisa SQL à linguagem de programação C#. Aspectos como a simplificação da maneira de escrever pesquisas, unificação da sintaxe para pesquisar qualquer fonte de dados, reforço da conexão entre dados relacionais e o mundo orientado a objetos e o menor tempo gasto no processo de desenvolvimento de software.

Palavras-chave: linguagem de pesquisa, linguagem de programação, modelos de dados, SQL, C#, LINQ

SUMÁRIO
1 INTRODUÇÃO 15
  1.1 Delimitação do tema 16
  1.2 Problema 16
  1.3 Enunciado das hipóteses 17
  1.4 Objetivos específicos e geral 18
  1.5 Justificativa do trabalho 18
2 FUNDAMENTAÇÃO TEÓRICA 19
  2.1 Linguagem de pesquisa 19
      2.1.1 Pesquisa 19
  2.2 Linguagem de programação 19
  2.3 Combinação mal sucedida entre as linguagens de pesquisa e de programação 20
  2.4 Programação orientada a objetos 24
      2.4.1 Classe e objeto 25
      2.4.2 Variável e tipo 25
      2.4.3 Membro 25
      2.4.4 Acessibilidade 25
      2.4.5 Método 26
      2.4.6 Parâmetro 26
      2.4.7 Troca de mensagem 26
      2.4.8 Herança 26
      2.4.9 Encapsulamento 26
      2.4.10 Abstração 27
      2.4.11 Polimorfismo 27
      2.4.12 Interface 27
      2.4.13 Delegate 27
  2.5 Banco de dados relacional 28
      2.5.1 Relação ou tabela 28
      2.5.2 Restrição 28
      2.5.3 Domínio de dado 28
      2.5.4 Chave primária 29
      2.5.5 Chave estrangeira 29
      2.5.6 Stored procedure 29
      2.5.7 View 29
      2.5.8 User defined function 30
  2.6 .NET Framework 30
      2.6.1 Principais recursos 32
      2.6.2 Arquitetura 33
      2.6.3 Infra-estrutura de linguagem comum 33
      2.6.4 Assemblies 34
      2.6.5 Metadados 35
      2.6.6 Biblioteca de classes base 35
  2.7 SQL 35
  2.8 C# 35
3 METODOLOGIA 37
  3.1 Extensões de linguagem 37
      3.1.1 Genéricos 37
      3.1.2 Métodos anônimos 38
      3.1.3 Iteradores 38
      3.1.4 Tipos parciais 40
      3.1.5 Tipos anuláveis 41
      3.1.6 Expressões de pesquisa 43
      3.1.7 Propriedades automaticamente implementadas 44
      3.1.8 Variáveis locais implicitamente tipificadas 45
      3.1.9 Métodos de extensão 46
      3.1.10 Métodos parciais 47
      3.1.11 Expressões lambda 49
      3.1.12 Inicializadores de objeto 50
      3.1.13 Inicializadores de coleção 50
      3.1.14 Tipos anônimos 51
      3.1.15 Arrays implicitamente tipificados 52
      3.1.16 Árvores de expressão 53
4 DESENVOLVIMENTO 54
  4.1 Linguagem de pesquisa integrada à linguagem de programação 54
      4.1.1 Operadores de pesquisa padrão 56
      4.1.2 Fonte de dados 61
      4.1.3 Operação de pesquisa 62
      4.1.4 Modelo de objetos 63
  4.2 Estudo de caso 64
      4.2.1 Classes do modelo de objetos 68
      4.2.2 DataContext 68
      4.2.3 Relacionamentos 69
      4.2.4 Pesquisa de dados 70
      4.2.5 Operações de insert, update e delete 71
5 CONCLUSÃO 73
  5.1 Avanços 73
  5.2 Limitações 74
  5.3 Trabalhos relacionados 74
  5.4 Trabalhos futuros 76
6 BIBLIOGRAFIA 78
ANEXOS 81

You can get a PDF copy of the full paper at:

https://drive.google.com/file/d/1nDbZXqKsE_jzxz4qB1ZOlgKu3LulSIKi/view?usp=sharing (Portuguese - Brazil)

Breadth and depth first search - part 2

Breadth and depth first search - part 1
Breadth and depth first search - part 3

As I've written in the previous post Breadth and depth first search - part 1 - I'll dive in more details and explain how to use the breadth and depth search methods. We'll execute a test case using the Romania map shown bellow, print the traveled paths in the screen, calculate the shortest path possible between two cities using Dijkstra's algorithm and print such a path in the screen.

To accomplish all the above let's start presenting the data structures used to represent the map in the C# programming language:
 

public class Node
{
  public Node(string key, object data);
  public Node(string key, object data, AdjacencyList neighbors);
 
  public virtual object Data { get; set; }
  public virtual string Key { get; }
  public virtual AdjacencyList Neighbors { get; }
  public virtual Node PathParent { get; set; }
 
  protected internal virtual void AddDirected(EdgeToNeighbor e);
  protected internal virtual void AddDirected(Node n);
  protected internal virtual void AddDirected(Node n, int cost);
} 

The Node class will be used to represent each city of the map.

Each city has its name represented by the key property and some other relevant data represented by the data property. Each city also has an adjacency list implemented by a specific class called AdjacencyList. This adjacency list represents the neighbors cities of a given city. For example, in the above map the neighbors cities of Bucharest are: Urziceni, Giurgiu, Pitesti and Fagaras.

Let's see the code of another class:
 

public class Graph
{
  public Graph();
  public Graph(NodeList nodes);
 
  public virtual int Count { get; }
  public virtual NodeList Nodes { get; }
 
  public virtual void AddDirectedEdge(Node u, Node v);
  public virtual void AddDirectedEdge(string uKey, string vKey);
  public virtual void AddDirectedEdge(Node u, Node v, int cost);
  public virtual void AddDirectedEdge(string uKey, string vKey,
int cost);
  public virtual void AddNode(Node n);
  public virtual Node AddNode(string key, object data);
  public virtual void AddUndirectedEdge(Node u, Node v);
  public virtual void AddUndirectedEdge(string uKey, string vKey);
  public virtual void AddUndirectedEdge(Node u, Node v, int cost);
  public virtual void AddUndirectedEdge(string uKey, string vKey,
int cost);
  public virtual void Clear();
  public virtual bool Contains(Node n);
  public virtual bool Contains(string key);
} 

The Graph class has a property that references a collection of nodes, that is, a collection of cities. This collection of cities is represented by the class NodeList that implements the so used interface IEnumerable.

As you can see the Graph class has methods that add directed or undirected edges to the graph. Each line that connects two cities (vertexes) in the Romania map is considered an edge.

The map above contains only undirected edges because they aren't defined just as one way paths between the cities. It's possible to go from Bucharest to Urziceni and then come back to Bucharest for example. So it's a two way path.

Above each line in the map is a value that represents the path cost between two cities. Let's consider this cost as the distance in miles between the cities. The path cost could be any other variable, for example, the time spent to traverse the distance (edge). The cost variable can vary according to the problem.

I implemented a class called Pathfinding as follows:
 

class Pathfinding
{
  private static Graph graph = new Graph();
 
  ...
 
  public static void BreadthFirstSearch(Node start, Node end)
  {
    ...
  }
  public static void DepthFirstSearch(Node start, Node end)
  {
    ...
  }

  ...
}

This class has additional properties and methods as ShortestPath and PrintPath. I won't spend time explaining its additional methods because they are already well explained in Part 5: From Trees to Graphs (article by Scott Mitchell). So, let's run a test case. For this we need to fill the graph with the Romania map data.
 

class Program
{
  static void Main(string[] args)
  {
    Pathfinding pathFinding = new Pathfinding();
 
    Node start, end;
 
    // Vertexes
    pathFinding.Graph.AddNode("Arad", null);
    pathFinding.Graph.AddNode("Bucharest", null);
    pathFinding.Graph.AddNode("Craiova", null);
    pathFinding.Graph.AddNode("Dobreta", null);
    pathFinding.Graph.AddNode("Eforie", null);
    pathFinding.Graph.AddNode("Fagaras", null);
    pathFinding.Graph.AddNode("Giurgiu", null);
    pathFinding.Graph.AddNode("Hirsova", null);
    pathFinding.Graph.AddNode("Iasi", null);
    pathFinding.Graph.AddNode("Lugoj", null);
    pathFinding.Graph.AddNode("Mehadia", null);
    pathFinding.Graph.AddNode("Neamt", null);
    pathFinding.Graph.AddNode("Oradea", null);
    pathFinding.Graph.AddNode("Pitesti", null);
    pathFinding.Graph.AddNode("Rimnicu Vilcea", null);
    pathFinding.Graph.AddNode("Sibiu", null);
    pathFinding.Graph.AddNode("Timisoara", null);
    pathFinding.Graph.AddNode("Urziceni", null);
    pathFinding.Graph.AddNode("Vaslui", null);
    pathFinding.Graph.AddNode("Zerind", null);
 
    // Edges
 
    // Arad <-> Zerind
    pathFinding.Graph.AddUndirectedEdge("Arad", "Zerind", 75);
    // Arad <-> Timisoara
    pathFinding.Graph.AddUndirectedEdge("Arad", "Timisoara", 118);
    // Arad <-> Sibiu
    pathFinding.Graph.AddUndirectedEdge("Arad", "Sibiu", 140);
 
    // Bucharest <-> Urziceni
    pathFinding.Graph.AddUndirectedEdge("Bucharest", "Urziceni",
85);
    // Bucharest <-> Giurgiu
    pathFinding.Graph.AddUndirectedEdge("Bucharest", "Giurgiu",
90);
    // Bucharest <-> Pitesti
    pathFinding.Graph.AddUndirectedEdge("Bucharest", "Pitesti",
101);
    // Bucharest <-> Fagaras
    pathFinding.Graph.AddUndirectedEdge("Bucharest", "Fagaras",
211);
 
    // Craiova <-> Dobreta
    pathFinding.Graph.AddUndirectedEdge("Craiova", "Dobreta",
120);
    // Craiova <-> Pitesti
    pathFinding.Graph.AddUndirectedEdge("Craiova", "Pitesti",
138);
    // Craiova <-> Rimnicu Vilcea
    pathFinding.Graph.AddUndirectedEdge("Craiova",
"Rimnicu Vilcea", 146);
 
    // Dobreta <-> Mehadia
    pathFinding.Graph.AddUndirectedEdge("Dobreta", "Mehadia", 75);
 
    // Eforie <-> Hirsova
    pathFinding.Graph.AddUndirectedEdge("Eforie", "Hirsova", 86);
 
    // Fagaras <-> Sibiu
    pathFinding.Graph.AddUndirectedEdge("Fagaras", "Sibiu", 99);
 
    // Hirsova <-> Urziceni
    pathFinding.Graph.AddUndirectedEdge("Hirsova", "Urziceni", 98);
 
    // Iasi <-> Neamt
    pathFinding.Graph.AddUndirectedEdge("Iasi", "Neamt", 87);
    // Iasi <-> Vaslui
    pathFinding.Graph.AddUndirectedEdge("Iasi", "Vaslui", 92);
 
    // Lugoj <-> Mehadia
    pathFinding.Graph.AddUndirectedEdge("Lugoj", "Mehadia", 70);
    // Lugoj <-> Timisoara
    pathFinding.Graph.AddUndirectedEdge("Lugoj", "Timisoara",
111);
 
    // Oradea <-> Zerind
    pathFinding.Graph.AddUndirectedEdge("Oradea", "Zerind", 71);
    // Oradea <-> Sibiu
    pathFinding.Graph.AddUndirectedEdge("Oradea", "Sibiu", 151);
 
    // Pitesti <-> Rimnicu Vilcea
    pathFinding.Graph.AddUndirectedEdge("Pitesti", "Rimnicu Vilcea", 97);
 
    // Rimnicu Vilcea <-> Sibiu
    pathFinding.Graph.AddUndirectedEdge("Rimnicu Vilcea", "Sibiu",
80);
 
    // Urziceni <-> Vaslui
    pathFinding.Graph.AddUndirectedEdge("Urziceni", "Vaslui",
142);
 
    start = pathFinding.Graph.Nodes["Oradea"];
 
    end = pathFinding.Graph.Nodes["Neamt"];
 
    Console.WriteLine("\nBreadth First Search algorithm");
 
    Pathfinding.BreadthFirstSearch(start, end);
 
    foreach(Node n in pathFinding.Graph.Nodes)
      n.Data = null;
 
    Console.WriteLine("\n\nDepth First Search algorithm");
 
    Pathfinding.DepthFirstSearch(start, end);
 
    Console.WriteLine("\n\nShortest path");
 
    Pathfinding.ShortestPath(start, end);
 
    pathFinding.Graph.Clear();
 
    Console.ReadKey();
  }
} 

Firstly we create a new instance of the Pathfinding class and two instances of the Node class that will reference the start and end city respectively.

The pathfinding object has a graph property that we use to store the nodes, that is, the cities of the map. To accomplish this the method AddNode of the Graph class is used.

The key that represents the node is the name of the city in this case.

After adding the cities to the graph it's time to connect the cities by means of the edges between them. For each undirected edge of the map the fourth overload of the AddUndirectedEdge method is used. The method receives as arguments the names of the edge's vertexes and the path cost.

Supposing we want to go from Oradea to Neamt, we must set the start and end node appropriately and that is done when the start and end node are assigned the values already present in the graph.

After everything is set up we can run the the breadth and depth first search methods. To start I call the the method BreadthFirstSearch already presented in the previous post Breadth and depth first search - part 1. The method receives the start and end nodes as arguments and traverses the graph according to the breadth first search algorithm. During the traversal it prints the paths in the screen so that it's easier to visually debug the code.

We use the same graph data to run the depth first search method but to avoid a wrong behavior it's necessary to set the data property of each graph's node to null. It's because such property is used to store a value indicating if that node was already visited during the path traversal of the breadth first search method.

OK. Now that the graph data is prepared we can run the depth first search method invoking the DepthSearchMethod of the Pathfinding class. This method receives the start and end nodes as arguments and traverses the graph according to the depth first search algorithm. During the traversal it prints the paths in the screen so that it's easier to visually debug the code.

The last and so important method is the ShortestPath one. The shortest path problem can be calculated through different algorithms. In this case the algorithm used (Dijkstra's algorithm) is suitable because we don't have negative costs otherwise we should use other algorithms. The ShortestPath method of the Pathfinding class receives as arguments the start and end nodes and prints in the screen the total distance of such a path and the cities travelled.

See the screenshot of the output:

Note: if you want to see a C++ implementation of the breadth and depth first search, check the third part of this series: Breadth and depth first search - part 3.

Get the complete code (Microsoft Visual C# 2008 solution) and executable of this post at:
https://github.com/leniel/leniel.net/blob/master/Uploads/BreadthDepthFirstSearchCPlusPlus.zip

To try out the code you can use the free Microsoft Visual C# 2008 Express Edition that you can get at: http://www.microsoft.com/express/vcsharp

Client server architecture

Client Server architecture
Client-Server architectureThe client server architecture is a computer architecture which separates a client computer from a server computer and is most implemented in a computer network such as the Internet. Each client or server connected to the network can be referenced as a node. The most common type of client server architecture includes only two types of nodes: client and server. This type of architecture is sometimes called 2-tier architecture. The 2-tier architecture makes possible the sharing of files and resources between devices connected to the computer network.

Client
A client is a computer that requests a service of a server. The service can be localized in other computer or in the same computer that requests the service, that is, the client computer can act as a server too.

Access to the service is available through some type of interface.

Types of clients
Common types of clients include:

  • Web browser - a web browser is a software application that enables a user to display and interact with text, images, videos, music and other information typically located on a web page at a website on the world wide web or a local network.
  • Email client - an e-mail client, also known as mail user agent (MUA) is a frontend computer program used to manage email. Sometimes, the term e-mail client is also used to refer to any agent acting as a client toward an e-mail server, independently of it being a real MUA, a relaying server, or a human typing directly on a terminal. In addition, a web application such as the Gmail from Google providing the relevant functionality is sometimes considered an email client.
  • Online chat client - an online chat client or instant messaging client is a software application that enables the user to engage in instant messaging.

Server
A server is a computer that accepts connections to serve the requests of client computers. The server sends responses to the client computers. A server is generally connected to a computer network.

Types of servers
The most common types of servers are:

  • Application server - a computer with a software engine that delivers applications to client computers or devices, typically through the Internet and using the hyper text transfer protocol (HTTP). The application server handles most, if not all, of the business logic and data access of the application.
  • Backup server - a computer responsible for safekeeping important business files, financial records, and personal music and pictures so that in case of the original files be deleted there will still exist a copy.
  • Database server - a computer responsible for the provisioning of database services to other computer programs or computers. Database servers store the database on a dedicated computer system, allow it to be accessed concurrently, maintain the integrity of the data, and handle transaction support and user authorization. A database server divides an application into a front end and a back end, in accordance with the client-server model. The front end runs on the client computer and displays the requested data. The back end runs on the server and handles tasks such as query processing, data analysis and storage.
  • DHCP server - a computer that provides the dynamic host configuration protocol (DHCP) service on the network that assigns network addresses to other devices, such as a telephone and computer.
  • DNS server - a computer that provides the domain name service (DNS) which translates the names of sites into their numerical addresses, that is, resolves the name of the website typed into the location field of the browser with the Internet protocol (IP) address of the server that will send the requested information from that website.
  • Domain server - a computer that holds all the records associated with a particular domain and answers queries about those records.
  • Email server - a computer acting as a mail transfer agent (MTA) or SMTPD (SMTP daemon) that is running the appropriate software. This computer is responsible for transferring the electronic mail messages from one computer to another.
  • File server - a computer responsible for the central storage and management of data files so that other computers on the same network can access those files.
  • Firewall server - designed to secure an internal network from threats and attacks that come from the Internet offering powerful and flexible control over all inbound and outbound network traffic.
  • FTP server - a computer that runs a program that can receive requests for a file transfer protocol (FTP) link from a client computer.
  • Logon server - a computer responsible for authenticating client computers in a domain.
  • Print server - a computer to which one or more printers are connected, which can accept print jobs from external client computers connected to the print server over a network. The print server then sends the data to the appropriate printer that it manages.
  • Proxy server - a computer system or an application program which services the requests of its clients by forwarding requests to other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server. The proxy server requests the service on behalf of the client between an internal network of an organization and the Internet as part of a security system to protect the organization's network of external intrusion.
  • Security server - a computer dedicated to provide security policy decisions and to enforce such decisions.
  • Terminal server - a specialized computer which aggregates multiple communication channels together. Because these channels are bidirectional, two models emerge: multiple entities connecting to a single resource, and a single entity connecting to multiple resources.
  • VPN server - a virtual private network (VPN) server is a piece of hardware or software that can act as a gateway into a whole network or a single computer. It is generally "always on" and listening for VPN clients to connect to it.
  • Web server - a computer that runs a program responsible for accepting HTTP requests from clients, such as web browsers, serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.).

Note: a web service can be considered a type of server. A web service is defined by the W3C as "a software system designed to support interoperable Machine to Machine interaction over a network." Web services are frequently just Web APIs that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.

Conclusion
The client server architecture is extremely used nowadays. Practically all the services that are present in the Internet are based on this architecture. Even a simple visit to a news page as much as the connection to verify the grades stored in the university’s server; all these services make use of the client server architecture.

The details related to planning, equipment acquisition, installation and configuration of software and hardware are the most important when an environment based on the client server architecture is being considered.

The application type offered by the server and the type of client that will access such application are key points to end up with a concise project.

It’s known that the greater page requisitions a server has the greater will be the necessity of a powerful hardware capable of assuring the proper operation of the application even in stress conditions. Therefore it’s important not only understand the basic concepts of the client server architecture but also acquire the understanding about specific concepts related to software and hardware, which form the base of the architecture.

We are witnesses of this fantastic era in which we see the creation of new services starting up through the great opportunities that the new wave of the internet called web 2.0 brings. Such services demands better approaches to the client server architecture.

Programming technologies, new hardware devices and network apparatus, multiple multimedia capabilities, wireless connections, etc – all reinforces the propagation of the client server architecture. As a basic example, look at the biggest video site of the planet YouTube, which receives millions of video requests and that needs to provide access to its clients in a smoothly way. All this in a transparent way to its clients.

The client server architecture will subsist for a long time because it leverages the so used means of communication of actuality called internet.