Wednesday, 29 August 2012

Practice Assignment


Schema :
Nurse(NID,Name,Bdate,WID)
Function(FID,Fname,Description)
Ward(WID,Wname,Location)
Services(WID,FID)
Certified(NID,FID)
Queries :
1.print names of nurses not assigned to any ward.
2.print the name of the ward for which no nurse is assigned.
3.for each ward print ward name and no.of services it offers.
4.print the ward with maximum no.of nurses assigned.
5.print the names of nurses whose functions are ensured by the ward to which they are assigned.
6.list the wards that offer all services offered by ward w1.
7.print the name of the most certified nurse.
8.print pairs of nurses assigned to same ward.
9.print the name of wards that ensure each function offered by the hospital.
10.print nurse-id of nurses certified for every function the hospital offers.
11.for each ward print ward-id and nurse-id of most certified nurse.

Thursday, 2 August 2012

Oracle Database Download

To practice SQL queries at home, you could download Oracle 10g Express Edition from here and then follow this tutorial. (Note that the sample database supplied with Oracle 10g is the same database we use in college).



References For Database Management Systems


Slides for the Silberchatz-Korth-Sudarshan book can be found here.

For Database Design Concepts book click here.

To download Database System Concepts book(6th edition) by Silberschatz click here.

Study material can be found here.

Tuesday, 17 July 2012

Birthday Reminder Application


Ever missed a birthday? I did. That's why I created Birthday Reminder to remind myself of when birthdays are coming.
Birthday Reminder is a simple program that remind users of important birthdays.The application helps us to add our friend's birthday, view all the birthdays stored,search for the dearest one's birthday and also to edit them.


 By- 

  • Soma Sneha - 1005-10-733051
  • V.Rasagna  - 1005-10-733042
  • Puranam Srinivas  - 1005-10-733054

Thursday, 26 April 2012

EVIL HANGMAN


Our assignment is to write a computer program which plays a game of Hangman using this “Evil Hangman” algorithm. In particular, our program will do following:

1. Read the file dictionary.txt, which contains the full contents of the words list.

2. Prompt the user for a word length, reprompting as necessary until he enters a number such that there's at least one word that's exactly that long. That is, if the user wants to play with words of length -42 or 137, since no English words are that long, we should reprompt him.

3. Prompt the user for a number of guesses, which must be an integer greater than zero.

4. Prompt the user for whether he wants to have a running total of the number of words remaining in the word list. This completely ruins the illusion of a fair game that we'll be cultivating.

 Evil Hangman algorithm:
1. Constructing list of all words in the English language whose length matches the input length.

2. Printing out how many guesses the user has remaining, along with any letters the player has guessed and the current blanked-out version of the word. If the user chose earlier to see the number of words remaining, print that out too.

3. Prompting the user for a single letter guess, reprompting until the user enters a letter that he hasn't guessed yet.

4. Partitioning the words in the dictionary into groups by word family.

5. Finding the most common “word family” in the remaining words, remove all words from the word list that aren't in that family, and report the position of the letters (if any) to the user. If the word family doesn't contain any copies of the letter, subtract a remaining guess from the user.

6. If the player has run out of guesses pick a word from the word list and display it as the word that the computer initially “chose.”

7. If the player correctly guesses the word, congratulate him.

6. Ask if the user wants to play again and loop accordingly.

           We use associative arrays for this purpose.

Monday, 2 April 2012

MESSENGER(app) --Problem Decription

Aim: To create an application which can be used to send bulk messages to mobiles on the database.

This is to connect an entire community (class,department or entire college)according to the database option selected.
--helpful to pass information at an instant to a large number of recipients pertaining to a group.

The simple design of the app contains
* a space provided to enter the message to be passed on.
* selection of recipient group.

POSSIBLE UPGRADING:
--Two way communication (COMMUNICATOR instead of MESSENGER)
--> Requirement: A toll free number 
                          
** messages go from the communicator;
     recipient can reply to a toll free number.
     these replies should be displayed in the communicator with the recipients details.
Further development can be planned. 
                           

Thursday, 15 March 2012

INLINE FUNCTIONS



DEFINITION:
An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. Instead of transferring control to and from the function code segment, a modified copy of the function body may be substituted directly for the function call. In this way, the performance overhead of a function call is avoided.

A function is declared inline by using the inline function specifier or by defining a member function within a class or structure definition. The inline specifier is only a suggestion to the compiler that an inline expansion can be performed; the compiler is free to ignore the suggestion.
The following code fragment shows an inline function definition:
inline int add(int i, int j)
 {
      return i + j;
 }
The use of the inline specifier does not change the meaning of the function. However, the inline expansion of a function may not preserve the order of evaluation of the actual arguments. Inline expansion also does not change the linkage of a function: the linkage is external by default.
         In C++, both member and nonmember functions can be inlined. Member functions that are implemented inside the body of a class declaration are implicitly declared inline. Constructors, copy constructors, assignment operators, and destructors that are created by the compiler are also implicitly declared inline. An inline function that the compiler does not inline is treated similarly to an ordinary function: only a single copy of the function exists, regardless of the number of translation units in which it is defined.
        In C, any function with internal linkage can be inlined, but a function with external linkage is subject to restriction. . The restrictions are as follows:
If the inline keyword is used in the function declaration, then the function definition must appear in the same translation unit.
An inline definition of a function is one in which all of the file-scope declarations for it in the same translation unit include the inline specifier withoutextern.
An inline definition does not provide an external definition for the function: an external definition may appear in another translation unit. The inline definition serves as an alternative to the external definition when called from within the same translation unit. 
        In the Ada programming language, there exists a pragma for inline functions. Most other languages, including Java and functional languages, do not provide language constructs for inline functions, but often do perform aggressive inline expansion.

ADVANTAGES:
  • It saves the time required to execute function calls.
  • Small inline functions, perhaps three lines or less, create less code than the equivalent function call because the compiler doesn't generate code to handle arguments and a return value.
  • Functions generated inline are subject to code optimizations not available to normal functions because the compiler does not perform inter procedural optimizations.
DISADVANTAGES:
  •  Inlining can increase the size of your executable program significantly leading to more number of page faults bringing down program performance.
  •  If used in header file, it will make your header file size large and may also make it unreadable.
DIFFERENCES BETWEEN INLINE FUNCTIONS AND MACROS:

  •  Macro is expanded by preprocessor and inline function are expanded by compiler.
  •  Expressions passed as arguments to inline functions are evaluated only once while expression passed as argument to inline functions are evaluated more than once. 
  • Inline functions are used to overcome the overhead of function calls. Macros are used to maintain the readability and easy maintainence of the code.
  • Debugging is tough in macros (because they refer to the expanded code, rather than the code the programmer typed) whereas debugging is easy in inline functions.
  • Macro invocations do not perform type checking, or even check that arguments are well-formed, whereas function calls usually do.
  •  A macro cannot return anything which is not the result of the last expression invoked inside it but in inline functions we can return any value by using keyword return();

Labels