Archive for the ‘TEChNoLoGY’ Category

C Program To Shutdown Or Turn Off Computer

February 20th, 2013, posted in C
Share

To shutdown immediately use “C:\WINDOWS\System32\ shutdown /s /t 0”. To restart use /r instead of /s.

C Program to shutdown your computer: This program turn off i.e shutdown your computer system. Firstly it will asks you to shutdown your computer if you press ‘y’ the your computer will shutdown in 30 seconds, system function of “stdlib.h” is used to run an executable file shutdown.exe which is present in C:WINDOWSsystem32 in Windows XP. You can use various options while executing shutdown.exe for example -s option shutdown the computer after 30 seconds, if you wish to shutdown immediately then you can write “shutdown -s -t 0” as an argument to system function. If you wish to restart your computer then you can write “shutdown -r”.

If you are using Turbo C Compiler then execute your file from folder. Press F9 to build your executable file from source program. When you run from within the compiler by pressing Ctrl+F9 it may not work.

C programming code for Windows XP

#include <stdio.h>
#include <stdlib.h>

main()
{
   char ch;

   printf("Do you want to shutdown your computer now (y/n)n");
   scanf("%c",&ch);

   if (ch == 'y' || ch == 'Y')
      system("C:\WINDOWS\System32\shutdown -s");

   return 0;
}




C programming code for Windows 7

#include <stdio.h>
#include <stdlib.h>

main()
{
   char ch;

   printf("Do you want to shutdown your computer now (y/n)n");
   scanf("%c",&ch);

   if (ch == 'y' || ch == 'Y')
      system("C:\WINDOWS\System32\shutdown /s");

   return 0;
}

To shutdown immediately use “C:\WINDOWS\System32\ shutdown /s /t 0”. To restart use /r instead of /s.

C programming code for Ubuntu Linux

#include <stdio.h>

int main() {
  system("shutdown -P now");
  return 0;
}


You need to be logged in as root user for above program to execute otherwise you will get the message shutdown: Need to be root, now specifies that you want to shutdown immediately. ‘-P’ option specifes you want to power off your machine. You can specify minutes as:

shutdown -P “number of minutes”

For more help or options type at terminal: man shutdown.

Share

Link to “References & Resources For Programming “

February 19th, 2013, posted in Programming
Share

1.  Java

General

  1. Java mother site @ http://java.sun.com (or http://www.oracle.com/technetwork/java/index.html).
  2. Java Developers’ sites, in particular, http://java.net.


JDK
(aka Java SE)

  1. Java SE mother site @ http://java.sun.com/javase (or http://www.oracle.com/technetwork/java/javase/overview/index.html).
  2. JDK 7 API Documentation Online @ http://download.oracle.com/javase/7/docs/api/index.html.
  3. JDK 7 Documentation Online @ http://download.oracle.com/javase/7/docs/.
  4. Ken Arnold, James Gosling and David Holmes, “The Java Programming Language”, 4th Edition, 2005. (The defacto standard for Java Language, but does not seem to have been updated to cover the latest features?!)
  5. James Gosling, Bill Joy, Guy Steele and Gilad Bracha, “The Java Language Specification”, 3rd Edition, 2005. (The defacto standard for JVM, but does not seem to have been updated?!)
  6. JDK 7 Demos and Samples (to be downloaded @ http://www.oracle.com/technetwork/java/javase/downloads/index.html)

Books & Online Tutorials

  1. The online Java tutorial @ http://docs.oracle.com/javase/tutorial/. (The authoritative source.)
  2. Paul Deitel and Harvey Deitel, “Java How to Program”, 9th Edition, 2011. (A comprehensive reference for programmers.)
  3. Y. Daniel Liang, “Introduction to Java Programming”, 9th Edition, 2012. (Good text book for undergraduate Java courses.)
  4. Bruce Eckel, “Thinking in Java”, 4th edition, 2007. (Great book but has not been updated?!)


2.  HTML & CSS

Specifications

  1. HTML @ W3C (www.w3.org)
    1. HTML 4.01 Specification @ http://www.w3.org/TR/html401/.
    2. HTML 5 Draft Specification @ http://www.w3.org/TR/html5/.
  2. XHTML 1.0 Specification (W3C) @ http://www.w3.org/TR/xhtml1/.
  3. CSS Specification (W3C) @ http://www.w3.org/Style/CSS/.

Online Tutorials and Resources

  1. W3School Tutorials & References @ http://www.w3schools.com/.
  2. Mozilla Developers Network (MDN)

Books

  1. [TODO]

3.  Android

  1. Android mother site @ www.android.com.
  2. Android Developers @ developer.android.com.
  3. Andriod API Documentation @ http://developer.android.com/reference/packages.html.


4.  MySQL

MySQL Mother Site & Standards

  1. MySQL Mother Site @ www.mysql.com.
  2. MySQL 5.5 “Reference Manual” @ http://dev.mysql.com/doc/.
  3. MySQL 5.5 “SQL Statement Syntax” @ http://dev.mysql.com/doc/refman/5.5/en/sql-syntax.html.
  4. “ISO/IEC 9075 Information Technology – Database Languages SQL”: 1989 (SQL-89), 1992 (SQL-92 or SQL2), 1999 (SQL-99 or SQL3), 2003 (SQL-2003), 2006 (SQL-2006) and 2011 (SQL-2011).

Sample Databases

  1. MySQL Employees Sample Database @ http://dev.mysql.com/doc/employee/en/index.html.
  2. MySQL Sakila Sample Database @ http://dev.mysql.com/doc/sakila/en/index.html.
  3. Microsoft Nothwind Sample database @ http://www.microsoft.com/en-us/download/details.aspx?id=23654; MySQL port @ http://code.google.com/p/northwindextended.
  4. The “Classic Models” Retailer database @ http://www.mysqltutorial.org.

Books and Tutorials

  1. Codd E. F., “A Relational Model of Data for Large Shared Data Banks”, Communications of the ACM, vol. 13, issue 6, pp. 377–387, June 1970.
  2. (For Java Programmers) “JDBC Basics”, Java Online Tutorial @ http://download.oracle.com/javase/tutorial/jdbc/basics/index.html.
  3. Paul DuBois, “MySQL Developer’s Library”, 4th ed, 2009 (5th eds is probably available).
  4. http://mysqltutorial.org.
  5. Russell Dyer, “MySQL in a Nutshell”, 2nd ed, O’reilly, 2008.


5.  C Language

  1. Kernighan and Ritchie “The C Programming Language”, 2nd edition, 1988, (The “K&R”).
  2. Plauger, “The Standard C Library”, 1992, PrenticeHall.
  3. The Formal Specification of C Language:
    1. ISO/IEC 9899:2011 “Programming Languages. C” (The “C11”);
    2. ISO/IEC 9899:1999 “Programming Languages. C” (The “C99”);
    3. ISO/IEC 9899:1990 “Programming Languages. C” (The “C90”).

6.  C++ Language

  1. The Formal Specification for the C++ language:
    1. ISO/IEC 14882:2011 “Programming Language. C++” (The “C++11”);
    2. ISO/IEC 14882:2003 “Programming Language. C++” (The “C++03”);
    3. ISO/IEC 14882:1998 “Programming Language. C++” (The “C++98”).
  2. Bjarne Stroustrup (creator of C++), “The C++ Programming Language”.
  3. Bjarne Stroustrup, “The Design and Evolution of C++”.
  4. http://www.cplusplus.com (C++ documents, tutorials, library references).
  5. Stanley B. Lippman & Josee Lajoie, “C++ Primer”.
  6. Deitel & Deitel, “C++ How to Program”.
  7. Gary J. Bronson, “Program Development and Design using C++”.
Share

Link to "References & Resources For Programming "

February 19th, 2013, posted in Programming
Share

1.  Java

General

  1. Java mother site @ http://java.sun.com (or http://www.oracle.com/technetwork/java/index.html).
  2. Java Developers’ sites, in particular, http://java.net.


JDK
(aka Java SE)

  1. Java SE mother site @ http://java.sun.com/javase (or http://www.oracle.com/technetwork/java/javase/overview/index.html).
  2. JDK 7 API Documentation Online @ http://download.oracle.com/javase/7/docs/api/index.html.
  3. JDK 7 Documentation Online @ http://download.oracle.com/javase/7/docs/.
  4. Ken Arnold, James Gosling and David Holmes, “The Java Programming Language”, 4th Edition, 2005. (The defacto standard for Java Language, but does not seem to have been updated to cover the latest features?!)
  5. James Gosling, Bill Joy, Guy Steele and Gilad Bracha, “The Java Language Specification”, 3rd Edition, 2005. (The defacto standard for JVM, but does not seem to have been updated?!)
  6. JDK 7 Demos and Samples (to be downloaded @ http://www.oracle.com/technetwork/java/javase/downloads/index.html)

Books & Online Tutorials

  1. The online Java tutorial @ http://docs.oracle.com/javase/tutorial/. (The authoritative source.)
  2. Paul Deitel and Harvey Deitel, “Java How to Program”, 9th Edition, 2011. (A comprehensive reference for programmers.)
  3. Y. Daniel Liang, “Introduction to Java Programming”, 9th Edition, 2012. (Good text book for undergraduate Java courses.)
  4. Bruce Eckel, “Thinking in Java”, 4th edition, 2007. (Great book but has not been updated?!)


2.  HTML & CSS

Specifications

  1. HTML @ W3C (www.w3.org)
    1. HTML 4.01 Specification @ http://www.w3.org/TR/html401/.
    2. HTML 5 Draft Specification @ http://www.w3.org/TR/html5/.
  2. XHTML 1.0 Specification (W3C) @ http://www.w3.org/TR/xhtml1/.
  3. CSS Specification (W3C) @ http://www.w3.org/Style/CSS/.

Online Tutorials and Resources

  1. W3School Tutorials & References @ http://www.w3schools.com/.
  2. Mozilla Developers Network (MDN)

Books

  1. [TODO]

3.  Android

  1. Android mother site @ www.android.com.
  2. Android Developers @ developer.android.com.
  3. Andriod API Documentation @ http://developer.android.com/reference/packages.html.


4.  MySQL

MySQL Mother Site & Standards

  1. MySQL Mother Site @ www.mysql.com.
  2. MySQL 5.5 “Reference Manual” @ http://dev.mysql.com/doc/.
  3. MySQL 5.5 “SQL Statement Syntax” @ http://dev.mysql.com/doc/refman/5.5/en/sql-syntax.html.
  4. “ISO/IEC 9075 Information Technology – Database Languages SQL”: 1989 (SQL-89), 1992 (SQL-92 or SQL2), 1999 (SQL-99 or SQL3), 2003 (SQL-2003), 2006 (SQL-2006) and 2011 (SQL-2011).

Sample Databases

  1. MySQL Employees Sample Database @ http://dev.mysql.com/doc/employee/en/index.html.
  2. MySQL Sakila Sample Database @ http://dev.mysql.com/doc/sakila/en/index.html.
  3. Microsoft Nothwind Sample database @ http://www.microsoft.com/en-us/download/details.aspx?id=23654; MySQL port @ http://code.google.com/p/northwindextended.
  4. The “Classic Models” Retailer database @ http://www.mysqltutorial.org.

Books and Tutorials

  1. Codd E. F., “A Relational Model of Data for Large Shared Data Banks”, Communications of the ACM, vol. 13, issue 6, pp. 377–387, June 1970.
  2. (For Java Programmers) “JDBC Basics”, Java Online Tutorial @ http://download.oracle.com/javase/tutorial/jdbc/basics/index.html.
  3. Paul DuBois, “MySQL Developer’s Library”, 4th ed, 2009 (5th eds is probably available).
  4. http://mysqltutorial.org.
  5. Russell Dyer, “MySQL in a Nutshell”, 2nd ed, O’reilly, 2008.


5.  C Language

  1. Kernighan and Ritchie “The C Programming Language”, 2nd edition, 1988, (The “K&R”).
  2. Plauger, “The Standard C Library”, 1992, PrenticeHall.
  3. The Formal Specification of C Language:
    1. ISO/IEC 9899:2011 “Programming Languages. C” (The “C11”);
    2. ISO/IEC 9899:1999 “Programming Languages. C” (The “C99”);
    3. ISO/IEC 9899:1990 “Programming Languages. C” (The “C90”).

6.  C++ Language

  1. The Formal Specification for the C++ language:
    1. ISO/IEC 14882:2011 “Programming Language. C++” (The “C++11”);
    2. ISO/IEC 14882:2003 “Programming Language. C++” (The “C++03”);
    3. ISO/IEC 14882:1998 “Programming Language. C++” (The “C++98”).
  2. Bjarne Stroustrup (creator of C++), “The C++ Programming Language”.
  3. Bjarne Stroustrup, “The Design and Evolution of C++”.
  4. http://www.cplusplus.com (C++ documents, tutorials, library references).
  5. Stanley B. Lippman & Josee Lajoie, “C++ Primer”.
  6. Deitel & Deitel, “C++ How to Program”.
  7. Gary J. Bronson, “Program Development and Design using C++”.
Share

ORACLE :How to Configure Net8 in Non-RAC Database

February 17th, 2013, posted in Oracle
Share

To access the database from other than the system in which database installed you need to configure oracle supplies Net8 for this purpose. It is a common interface to client application that needs to connect to the oracle database. It consists of the three files: tnsname.ora, listener.ora, sqlnet.ora.

Steps or Process:
1.      Edit the tnsname.ora file and add the new service name for use by the client software.
2.      Edit the listener.ora file add an entry for another database instance.
3.      Use the ping command to verify connectivity to the Host.
4.      Use the tnsping command to verify the connectivity to the Net8 listener.
5.      Start/Stop the Net8 listener to reload newly added DB instance.
6.      Connect to a remote database over the network.

tnsname.ora:
The normal location for this file is D:oracleora92networkadmin. This file is located on both client and server. If you make configuration changes on the server ensure you can connect to the database through the listener if you are logged on to the server. If you make configuration change on the client ensure you can connect from your client workstation to the database through the listener running on the server.
Add the following entry in your tnsname.ora file and change the value in the bracket according to your environment.
RMAN.AL-SADHAN.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rmanbackup)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMAN)
)
)

Note: You can put either system name or directly static IP (192.168. 0.1) as HOST.
C:tnsping rman
Use the above command to verify the connectivity on windows environment.

listener.ora:
The normal location for this file is D:oracleora92networkadmin. This file is client side file (typically on remote PC). The client uses thistnsname.ora file to obtain connection details from the desired database. Add the following entry in your listener.ora file and changed the value in bracket as per your environment.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:oracleora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = RMAN)
(ORACLE_HOME = D:oracleora92)
(SID_NAME = RMAN)
)
)

Note: Provide the unique global name as you specify at the time of database creation. You can change it later with your own domain name.

SQL>ALTER DATABASE rename global_name to rman.al-sadhan.com;
C:lsnrctl
Lsnrctl>stop listener
Lsnrctl>start listener
Lsnrctl>reload listener
You can use above command to bounce the listener.

sqlnet.ora:
The normal location for this file is D:oracleora92networkadmin. The sqlnet.ora file is the profile configuration file, and it resides on the client machines and the database server. The sqnet.ora is text file that contain basic configuration details used by the SQL*Net.
NAMES.DEFAULT_DOMAIN = al-sadhan.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
trace_level_client = OFF
sqlnet.expire_time = 30
names.default_domain:  If the net service name does not have a domain specified, this parameter value is appended to the service name.

names_directory_path: This parameter specifies the order of naming methods used when a client attempts a connection to a database. Possible values include: LDAP; TNSNAMES; HOSTNAME; ONAMES; and EZCONNECT.
sqlnet.expire_time:  This parameter, set on the server, enables dead connection detection.  After the specified time interval, expressed in minutes, the server checks to see if the client is still connected. If the client is not still connected, the server process exits.

sqlnet.authentication_services: This parameter is used to enable one or more authentication services.  There is no default setting, so if authentication has been installed, it this parameter should be set to either NONE for no authentication methods or ALL for all authentication methods.

trace_level_client: This parameter enables tracing unless it is set to OFF or 0, which is the default.  Use the following values to set tracing levels: USER (4); ADMIN (10); and SUPPORT (16).

*********************************************************************************************************************
Note : Please not do make backups before using these queries and also confirm them yourself or by aother means as
 well.
*********************************************************************************************************************
Share

Write a function to count number of words in a text file named “OUT.TXT”

February 16th, 2013, posted in C++
Share
void countwords()
{
	ifstream fin;
	fin.open("out.txt");
	char word[30];
	int count=0;
	while(!fin.eof())
	{
		fin>>word;
		count++;
	}
	cout<<"Number of words in file are "<<count;
	fin.close();
}
Share