Thursday, August 23, 2012

History of C / C++ Programming Language


  • Mid 1960s:
    • Martin Richards developed BCPL (Basic Combined Progamming Language) as a simplification of CPL
  • Late 1960s and early 1970s:
    • Ken Thompson developed B (based on BCPL)
    • B was used to develop the early versions of the UNIX operating system on the DEC PDP-7
  • 1971:
    • Dennis Ritchie began to extend B (most notably, adding a character type)
    • He called the extended language NB (for "new B" and, perhaps, the Latin nota bene)
  • Early 1970s:
    • Dennis Ritchie started working on a language with more types and with type composition (similar to that in Algol)
    • The name is either a progression through the alphabet or through the letters in BCPL (Ritchie himself won't say)
    • Used to write the UNIX kernel for the PDP-11
  • 1977-1978:
    • C underwent extensive modifications
    • The book The C Programming Language was written by Brian Kernighan and Dennis Ritchie
  • 1983:
    • ANSI began the process of standardizing C
    • The standard was accepted by ISO in 1990
  • 1980:
    • Bjarne Stroustrup begain working on what he called "C-with-classes"
    • He wanted to add the facilities for object-oriented programming contained in the SIMULA programming language to C
  • 1983:
    • Re-designed and re-named to C++
    • Originally, C++ source code had to be "pre-compiled" (the pre-compiler converted C++ constructs to plain C)
  • Mid to Late 1980s:
    • The first commercial version of C++ was released in 1985
    • In 1989 ISO began the standardization process (completed in 1998)

·         In C, C++ and Java

·         cexamples/basics/hello.c
·          
·         #include < stdio.h >
·          
·         int main()
·         {
·           printf( "C Hello.\n" );
·         }
·         cppexamples/basics/hello.cpp
·         #include <iostream>
·          
·         int main(void)
·         {
·            std::cout << "C++ Hello.\n";
·          
·            return (0);  
·         }
·         cppexamples/basics/Hello.java
·          
·         class Hello {
·             public static void main( String[] argv )
·             {
·                 System.out.print( "Hello.\n" );
·             }
·         }

Definition of Structs.

Struts is a free open-source framework for creating Java web applications.

Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites deliver only static pages. A web application can interact with databases and business logic engines to customize a response.

Web applications based on JavaServer Pages sometimes mix database code, page design code, and control flow code. In practice, we find that unless these concerns are separated, larger applications become difficult to maintain.

One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code. The Struts framework is designed to help developers create web applications that utilize a MVC architecture.

The framework provides three key components:

* A "request" handler provided by the application developer that is mapped to a standard URI.
* A "response" handler that transfers control to another resource which completes the response.
* A tag library that helps developers create interactive form-based applications with server pages.


The framework's architecture and tags are buzzword compliant. Struts works well with conventional REST applications and with new technologies like SOAP and AJAX

What is JBoss?


Answer

JBoss is an open source project, sponsored by Red Hat, aimed at building a Java-based middleware application server
An application server is a software engine that delivers applications to client computers or devices. The main benefit of an application server is the ease of application development, since applications need not be built from scratch, but are assembled from building blocks provided by the application server. 
Middleware is a piece of software that connects two or more software applications so that they can exchange data.

Accessing an adempiere database hosting on another machine

To allow another machine to access to your instance of Adempiere, we should do following steps.
1. In your machine launch the server instance of Adempiere.
2. Make sure firewall is disabled in your in system( Where server is running ), if your firewall is enabled in default, open the the following ports
5432 - pgsql default port
1009 - JNP port and open the port where your server running ( 5432 ). ( How to open a port is covered here )
3. In server system, open pg_hba.conf file( in fedora OS system, it is located at /var/lib/pgsql/data ), add the remote system IP address to allow the connection to servers postgres database.
Ex:
# IPv4 local connections:
#host all all 127.0.0.1/32 ident sameuser
host all all 127.0.0.1/32 trust
host all all 192.168.1.112/32 trust
host all all 192.168.1.118/32 trust
host all all 192.168.1.75/32 trust

i.e. Server allows postgres connection from IP addresses 192.168.1.112, 192.168.1.112,192.168.1.75

4. Make sure another machine(ifconfig value is 192.168.1.112 ) in LAN can access your server through browser i.e. http://192.168.1.123:8080/admin/
5. Download and extract the Adempiere Client zip file on your Client. Start Adempiere via RUN_Adempiere.sh( Line 3 in Webpage )
6. It will open a window, then give the proper credentials. It will launch Adempiere client which is pointing to the instance in server.

Sample Link for Java with PostgreSQL

Hello every body!, I have a good link for all of developer with Java Programming Language. You can learn about it by this link. Because it has sample code java with postgesql. Welcome to:

http://jdbc.postgresql.org/


Thanks !

Saret Sout

How to Enable remote access to PostgreSQL database server

By default, PostgreSQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home computer or from web server.

Step # 1: Login over ssh if server is outside your IDC

 Login over ssh to remote PostgreSQL database server:

    $ ssh user@remote.pgsql.server.com
 
Step # 2: Enable client authentication

Once connected, you need edit the PostgreSQL configuration file, edit the PostgreSQL configuration file /var/lib/pgsql/data/pg_hba.conf (or /etc/postgresql/8.2/main/pg_hba.conf for latest 8.2 version) using a text editor such as vi.
Login as postgres user using su / sudo command, enter:
     $ su - postgres

Edit the file:

$ vi /var/lib/pgsql/data/pg_hba.conf OR $ vi /etc/postgresql/8.2/main/pg_hba.conf

Append the following configuration lines to give access to 10.10.29.0/24 network:

host all all 10.10.29.0/24 trust

Save and close the file. Make sure you replace 10.10.29.0/24 with actual network IP address range of the clients system in your own network.
Step # 2: Enable networking for PostgreSQL
You need to enable TCP / IP networking. Use either step #3 or #3a as per your PostgreSQL database server version.
Step # 3: Allow TCP/IP socket
If you are using PostgreSQL version 8.x or newer use the following instructions or skip to Step # 3a for older version (7.x or older).
You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf or /etc/postgresql/8.2/main/postgresql.conf.

# vi /etc/postgresql/8.2/main/postgresql.conf

OR # vi /var/lib/pgsql/data/postgresql.conf 

Find configuration line that read as follows:

listen_addresses='localhost'

Next set IP address(es) to listen on; you can use comma-separated list of addresses; defaults to 'localhost', and '*' is all ip address:

listen_addresses='*'

Or just bind to 202.54.1.2 and 202.54.1.3 IP address

listen_addresses='202.54.1.2 202.54.1.3'

Save and close the file. Skip to step # 4.

Step #3a - Information for old version 7.x or older

Following configuration only required for PostgreSQL version 7.x or older. Open config file, enter

# vi /var/lib/pgsql/data/postgresql.conf  

Bind and open TCP/IP port by setting tcpip_socket to true. Set / modify tcpip_socket to true:

tcpip_socket = true

Save and close the file.

Step # 4: Restart PostgreSQL Server
Type the following command:

# /etc/init.d/postgresql restart

Step # 5: Iptables firewall rules
Make sure iptables is not blocking communication, open port 5432 (append rules to your iptables scripts or file /etc/sysconfig/iptables):
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 10.10.29.50  --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 10.10.29.50 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
 
Restart firewall:
 
# /etc/init.d/iptables restart
 
Step # 6: Test your setup
Use psql command from client system. Connect to remote server using IP address 10.10.29.50 and login using vivek username and sales database, enter:

$ psql -h 10.10.29.50 -U vivek -d sales
 

  

 
 


     
  


How to Install / Configure PostgreSQL Under Ubuntu Linux

PostgreSQL Installation:
Open the terminal and type following command to install postgresql

sudo apt-get install postgresql
PostgreSQL Configuration:
After successful installation of postgresql, you can configure postgresql using configuration file /etc/postgresql/9.1/main/postgresql.conf (9.1 is the version of postgresql installed under Ubuntu)

By default, connections via TCP/IP is disabled due to which users will not be able to access PostgreSQL server from another computers. To enable TCP/IP Connection edit the file /etc/postgresql/9.1/main/postgresql.conf and make the following changes.
Change #listen_addresses = localhost to ....
listen_addresses =192.168.1.1
and #password_encryption = on to ...
password_encryption = on
Setup PostgreSQL Users and Password:
NOTE: All the commands below are executed as the postgres privileged user.

Create the user
Go to terminal and type command createuser and answer few quetion to create postgreSQL user
sudo -u postgres createuser
Enter name of role to add: linuxpoison
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE 
Create the PostgreSQL Database:
Use the command createdb command to create the database :
sudo -u postgres createdb linuxdb
CREATE DATABASE
Grand access to the user for the database:
And last, using the psql command, set a password for the user and grant accesses :
sudo -u postgres psql
postgres=# alter user linuxpoison with encrypted password 'password';
ALTER ROLE
postgres=# grant all privileges on database linuxdb to linuxpoison;
GRANT
Now, on the client Linux (Ubuntu) machine, type following command to install PostgreSQL client:
sudo apt-get install postgresql-client
After successful installation of the postgresql client on the client machine, you then connect to the server with the following command
psql -h <postgresql_server_name> <database_name> <username>
After you inserted the password you access PostgreSQL with line commands.

Use the following command (from terminal) to control the PostgreSQL server
Start the service : /etc/init.d/postgresql start
Stop the service : /etc/init.d/postgresql stop
Know the status : /etc/init.d/postgresql status
Restart the service : /etc/init.d/postgresql restart