jump to navigation

Database, an introductory lecture March 18, 2010

Posted by etschneider in database.
Tags: , ,
add a comment

The following is only to give a general overview and idea about the databases. It does not pretend to be THE lecture about databases. It is more a case study than a theoretical lecture per se.

Database, data, information

A database is a place in which are stored data1 or information2. It is possible to differentiate data and information, but on a general point of view, they are the same.

Moreover, the database is a organized set or collection of information on a computerized system. This being said, let’s start.


How are the data organized in a database? As you know, the smaller bit of information on a computer is a bit, which has a value of 0 or 1. Human beings cannot read, or even use, bits like that. Thus, to represent something the computer takes group of 8 bits to make one character3 ([A..Z]-[a..z]-[0..1] and symbols).

With a group of several characters, one obtains a word (e.g. a day of a date of birth can be considered as a word). A word or several words can constitute information or data, so they could be put into a field (e.g. the date of birth itself or a first name). Several organized fields are a record (e.g. a lot of forms can be viewed as record, a passport, with some extent, is a kind of record). When one has several records, they could be put into a file(e.g. all the membership applications for the basketball team members for the year 2008). Then one could regroup the files together into a file cabinet or into a database (e.g. the files for the applications of 2000, 2001, 2002, 2003, etc. are put into a file cabinet named: Application 2000-2010).

To summarize:

 database < files < records < fields < words < characters 

Practical case: Database ID

One of the easiest example to understand is the one of the ID database. First, one will think about the information to put into the database. Here is a certainly-not-exhaustive list of fields:

  • name
  • date of birth

  • address
  • phone number
  • parents name

To be more precise, some of these fields can be divided into others:

  • name:

    • first name or given name
    • last name or family name

  • date of birth:

    • day
    • month
    • year
  • address:
    • street name
    • house number
    • extra
    • postal code or zip code
    • town
    • state/region/province
    • country
  • phone number:
    • land line
    • cell phone
  • parents name
    • mother’s name
      • first name or given name
      • last name or family name
    • father’s name
      • first name or given name
      • last name or family name

Stay tuned. This will continue later.

1 For a precise definition please see http://www.merriam-webster.com/dictionary/data
2 For a precise definition please see http://www.merriam-webster.com/dictionary/information
3 Of course, we can argue about the definition of character, especially if we consider foreign alphabets. Generally speaking, and except otherwise stated, when using the word character, one should read character while using the ASCII coding.


Why can’t we use CIN or IOSTREAM.H? March 18, 2010

Posted by etschneider in programming.
Tags: , , , ,
add a comment

We noticed while trying to type very (but very) simple examples of C++ programs with Visual Studio 2008/2005 (and here by Wikipedia), we obtained several error messages depending how far we managed to lead our investigations.

The first one was:

fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory

Yes, indeed it is a kind of insult: iostream.h does not exist! Hum. The first possible cause would be a bad installation, but that would be weird, since all the labs’PC would be concerned… Well, with a ghost that could be possible… Still more investigation and common sense were necessary…

Next step would be to change the <iostream.h> into <iostream>.

Well the result was different:

error C2065: 'cout' : undeclared identifier

OK, now cout is not recognized. Weird (2nd). Argh! (usually the lecturer is falling at that time, because he was used to other, more permissive compiler and didn’t know what to do).

So, there is no need to give up, we will continue the investigation further. Later on, with the help of L.U.C.K and Google, I started to have some first hints. Especially one leading to the Microsoft website. A little bit more time later, and using the internal search of the MSDN website I found this:


I’m a new Visual C++ programmer and I’m learning the coding by myself. The book which I’m refering to is based on Microsoft Visual C++ 2005 and the version which I’m using is Microsoft Visual C++ 2008.
Well I’m currently having problems with my coding. Well this is the sample which I’m working on

#include <iostream.h>

void main()
   double radius, area;
   cout << "\nEnter radius: " ;
   cin >> radius ;
   area = 3.14159 * radius * radius ;
   cout << "Area = "<< area ;

As far as I’m concerned I don’t think anything is wrong with the coding. First i tried

#include <iostream>
3 errors were found

1>.\wadever.cpp(8) : error C2065: 'cout' : undeclared identifier
1>.\wadever.cpp(9) : error C2065: 'cin' : undeclared identifier
1>.\wadever.cpp(11) : error C2065: 'cout' : undeclared identifier

When i changed it to the coding as written on the above, this came out.

1>.\wadever.cpp(1) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory

Thanks for reading, have a nice day.

For further reading have a look at the original post on the MSDN website.

So the answer lies in one word: standard (the ISO standard in fact for C++ which is supported by VS C++ 2005/2008(Express Edition)). One of the answer was:

(3) Change your code to this:

   std::cout << "\nEnter radius: " ;
   std::cin >> radius ;
   area = 3.14159 * radius * radius ;
   std::cout << "Area = "<< area ;

I put the changes in bold characters. In fact, from the C++ standard, we should indicate the namespace for some of the functions we use, in this case we are speaking about “STandarD”. If I don’t forget, I’ll come back on that subject later on. Until then, the problem is considered as solved (well, it was not really a problem).